Commit e896579a authored by Marcel Amirault's avatar Marcel Amirault Committed by Sarah Groff Hennigh-Palermo

Change gldeprecatedbutton to glbutton in dropdown

Change button in dropdown to run manual jobs
in pipelines page. Also makes tooltip more accurate
parent d833191d
<script> <script>
import { GlDeprecatedButton, GlTooltipDirective, GlLoadingIcon } from '@gitlab/ui'; import { GlTooltipDirective, GlButton, GlLoadingIcon } from '@gitlab/ui';
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
import { deprecatedCreateFlash as flash } from '~/flash'; import { deprecatedCreateFlash as flash } from '~/flash';
import { s__, __, sprintf } from '~/locale'; import { s__, __, sprintf } from '~/locale';
...@@ -14,7 +14,7 @@ export default { ...@@ -14,7 +14,7 @@ export default {
components: { components: {
Icon, Icon,
GlCountdown, GlCountdown,
GlDeprecatedButton, GlButton,
GlLoadingIcon, GlLoadingIcon,
}, },
props: { props: {
...@@ -83,9 +83,9 @@ export default { ...@@ -83,9 +83,9 @@ export default {
type="button" type="button"
:disabled="isLoading" :disabled="isLoading"
class="dropdown-new btn btn-default js-pipeline-dropdown-manual-actions" class="dropdown-new btn btn-default js-pipeline-dropdown-manual-actions"
:title="__('Manual job')" :title="__('Run manual or delayed jobs')"
data-toggle="dropdown" data-toggle="dropdown"
:aria-label="__('Manual job')" :aria-label="__('Run manual or delayed jobs')"
> >
<icon name="play" class="icon-play" /> <icon name="play" class="icon-play" />
<i class="fa fa-caret-down" aria-hidden="true"></i> <i class="fa fa-caret-down" aria-hidden="true"></i>
...@@ -94,18 +94,21 @@ export default { ...@@ -94,18 +94,21 @@ export default {
<ul class="dropdown-menu dropdown-menu-right"> <ul class="dropdown-menu dropdown-menu-right">
<li v-for="action in actions" :key="action.path"> <li v-for="action in actions" :key="action.path">
<gl-deprecated-button <gl-button
category="tertiary"
:class="{ disabled: isActionDisabled(action) }" :class="{ disabled: isActionDisabled(action) }"
:disabled="isActionDisabled(action)" :disabled="isActionDisabled(action)"
class="js-pipeline-action-link no-btn btn d-flex align-items-center justify-content-between flex-wrap" class="js-pipeline-action-link"
@click="onClickAction(action)" @click="onClickAction(action)"
> >
{{ action.name }} <div class="d-flex justify-content-between flex-wrap">
<span v-if="action.scheduled_at"> {{ action.name }}
<icon name="clock" /> <span v-if="action.scheduled_at">
<gl-countdown :end-date-string="action.scheduled_at" /> <icon name="clock" />
</span> <gl-countdown :end-date-string="action.scheduled_at" />
</gl-deprecated-button> </span>
</div>
</gl-button>
</li> </li>
</ul> </ul>
</div> </div>
......
...@@ -14738,9 +14738,6 @@ msgstr "" ...@@ -14738,9 +14738,6 @@ msgstr ""
msgid "Manifest import" msgid "Manifest import"
msgstr "" msgstr ""
msgid "Manual job"
msgstr ""
msgid "ManualOrdering|Couldn't save the order of the issues" msgid "ManualOrdering|Couldn't save the order of the issues"
msgstr "" msgstr ""
...@@ -21100,6 +21097,9 @@ msgstr "" ...@@ -21100,6 +21097,9 @@ msgstr ""
msgid "Run housekeeping" msgid "Run housekeeping"
msgstr "" msgstr ""
msgid "Run manual or delayed jobs"
msgstr ""
msgid "Run tests against your code live using the Web Terminal" msgid "Run tests against your code live using the Web Terminal"
msgstr "" msgstr ""
......
...@@ -311,7 +311,7 @@ RSpec.describe 'Pipelines', :js do ...@@ -311,7 +311,7 @@ RSpec.describe 'Pipelines', :js do
let!(:delayed_job) do let!(:delayed_job) do
create(:ci_build, :scheduled, create(:ci_build, :scheduled,
pipeline: pipeline, pipeline: pipeline,
name: 'delayed job', name: 'delayed job 1',
stage: 'test') stage: 'test')
end end
...@@ -327,7 +327,7 @@ RSpec.describe 'Pipelines', :js do ...@@ -327,7 +327,7 @@ RSpec.describe 'Pipelines', :js do
find('.js-pipeline-dropdown-manual-actions').click find('.js-pipeline-dropdown-manual-actions').click
time_diff = [0, delayed_job.scheduled_at - Time.now].max time_diff = [0, delayed_job.scheduled_at - Time.now].max
expect(page).to have_button('delayed job') expect(page).to have_button('delayed job 1')
expect(page).to have_content(Time.at(time_diff).utc.strftime("%H:%M:%S")) expect(page).to have_content(Time.at(time_diff).utc.strftime("%H:%M:%S"))
end end
...@@ -335,7 +335,7 @@ RSpec.describe 'Pipelines', :js do ...@@ -335,7 +335,7 @@ RSpec.describe 'Pipelines', :js do
let!(:delayed_job) do let!(:delayed_job) do
create(:ci_build, :expired_scheduled, create(:ci_build, :expired_scheduled,
pipeline: pipeline, pipeline: pipeline,
name: 'delayed job', name: 'delayed job 1',
stage: 'test') stage: 'test')
end end
...@@ -349,7 +349,7 @@ RSpec.describe 'Pipelines', :js do ...@@ -349,7 +349,7 @@ RSpec.describe 'Pipelines', :js do
context 'when user played a delayed job immediately' do context 'when user played a delayed job immediately' do
before do before do
find('.js-pipeline-dropdown-manual-actions').click find('.js-pipeline-dropdown-manual-actions').click
page.accept_confirm { click_button('delayed job') } page.accept_confirm { click_button('delayed job 1') }
wait_for_requests wait_for_requests
end end
......
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import MockAdapter from 'axios-mock-adapter'; import MockAdapter from 'axios-mock-adapter';
import { TEST_HOST } from 'spec/test_constants'; import { TEST_HOST } from 'spec/test_constants';
import { GlDeprecatedButton } from '@gitlab/ui'; import { GlButton } from '@gitlab/ui';
import waitForPromises from 'helpers/wait_for_promises'; import waitForPromises from 'helpers/wait_for_promises';
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
import PipelinesActions from '~/pipelines/components/pipelines_list/pipelines_actions.vue'; import PipelinesActions from '~/pipelines/components/pipelines_list/pipelines_actions.vue';
...@@ -19,7 +19,7 @@ describe('Pipelines Actions dropdown', () => { ...@@ -19,7 +19,7 @@ describe('Pipelines Actions dropdown', () => {
}); });
}; };
const findAllDropdownItems = () => wrapper.findAll(GlDeprecatedButton); const findAllDropdownItems = () => wrapper.findAll(GlButton);
const findAllCountdowns = () => wrapper.findAll(GlCountdown); const findAllCountdowns = () => wrapper.findAll(GlCountdown);
beforeEach(() => { beforeEach(() => {
...@@ -66,7 +66,7 @@ describe('Pipelines Actions dropdown', () => { ...@@ -66,7 +66,7 @@ describe('Pipelines Actions dropdown', () => {
it('makes a request and toggles the loading state', () => { it('makes a request and toggles the loading state', () => {
mock.onPost(mockActions.path).reply(200); mock.onPost(mockActions.path).reply(200);
wrapper.find(GlDeprecatedButton).vm.$emit('click'); wrapper.find(GlButton).vm.$emit('click');
expect(wrapper.vm.isLoading).toBe(true); expect(wrapper.vm.isLoading).toBe(true);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment