Commit a5efb594 authored by Simon Knox's avatar Simon Knox

Merge branch '342316-pb-improve-tooltip-text-retry' into 'master'

Improve retry tooltip for failed pipeline

See merge request gitlab-org/gitlab!79888
parents b2ee0c6e 52d9593e
<script> <script>
import { GlAlert, GlButton, GlLoadingIcon, GlModal, GlModalDirective } from '@gitlab/ui'; import {
GlAlert,
GlButton,
GlLoadingIcon,
GlModal,
GlModalDirective,
GlTooltipDirective,
} from '@gitlab/ui';
import { setUrlFragment, redirectTo } from '~/lib/utils/url_utility'; import { setUrlFragment, redirectTo } from '~/lib/utils/url_utility';
import { __ } from '~/locale'; import { __ } from '~/locale';
import ciHeader from '~/vue_shared/components/header_ci_component.vue'; import ciHeader from '~/vue_shared/components/header_ci_component.vue';
import { LOAD_FAILURE, POST_FAILURE, DELETE_FAILURE, DEFAULT } from '../constants'; import {
LOAD_FAILURE,
POST_FAILURE,
DELETE_FAILURE,
DEFAULT,
BUTTON_TOOLTIP_RETRY,
} from '../constants';
import cancelPipelineMutation from '../graphql/mutations/cancel_pipeline.mutation.graphql'; import cancelPipelineMutation from '../graphql/mutations/cancel_pipeline.mutation.graphql';
import deletePipelineMutation from '../graphql/mutations/delete_pipeline.mutation.graphql'; import deletePipelineMutation from '../graphql/mutations/delete_pipeline.mutation.graphql';
import retryPipelineMutation from '../graphql/mutations/retry_pipeline.mutation.graphql'; import retryPipelineMutation from '../graphql/mutations/retry_pipeline.mutation.graphql';
...@@ -15,6 +28,7 @@ const POLL_INTERVAL = 10000; ...@@ -15,6 +28,7 @@ const POLL_INTERVAL = 10000;
export default { export default {
name: 'PipelineHeaderSection', name: 'PipelineHeaderSection',
BUTTON_TOOLTIP_RETRY,
pipelineCancel: 'pipelineCancel', pipelineCancel: 'pipelineCancel',
pipelineRetry: 'pipelineRetry', pipelineRetry: 'pipelineRetry',
finishedStatuses: ['FAILED', 'SUCCESS', 'CANCELED'], finishedStatuses: ['FAILED', 'SUCCESS', 'CANCELED'],
...@@ -27,6 +41,7 @@ export default { ...@@ -27,6 +41,7 @@ export default {
}, },
directives: { directives: {
GlModal: GlModalDirective, GlModal: GlModalDirective,
GlTooltip: GlTooltipDirective,
}, },
errorTexts: { errorTexts: {
[LOAD_FAILURE]: __('We are currently unable to fetch data for the pipeline header.'), [LOAD_FAILURE]: __('We are currently unable to fetch data for the pipeline header.'),
...@@ -225,6 +240,9 @@ export default { ...@@ -225,6 +240,9 @@ export default {
> >
<gl-button <gl-button
v-if="canRetryPipeline" v-if="canRetryPipeline"
v-gl-tooltip
:aria-label="$options.BUTTON_TOOLTIP_RETRY"
:title="$options.BUTTON_TOOLTIP_RETRY"
:loading="isRetrying" :loading="isRetrying"
:disabled="isRetrying" :disabled="isRetrying"
category="secondary" category="secondary"
......
<script> <script>
import { GlButton, GlTooltipDirective, GlModalDirective } from '@gitlab/ui'; import { GlButton, GlTooltipDirective, GlModalDirective } from '@gitlab/ui';
import { __ } from '~/locale';
import eventHub from '../../event_hub'; import eventHub from '../../event_hub';
import { BUTTON_TOOLTIP_RETRY, BUTTON_TOOLTIP_CANCEL } from '../../constants';
import PipelineMultiActions from './pipeline_multi_actions.vue'; import PipelineMultiActions from './pipeline_multi_actions.vue';
import PipelinesManualActions from './pipelines_manual_actions.vue'; import PipelinesManualActions from './pipelines_manual_actions.vue';
export default { export default {
i18n: { BUTTON_TOOLTIP_RETRY,
cancelTitle: __('Cancel'), BUTTON_TOOLTIP_CANCEL,
redeployTitle: __('Retry'),
},
directives: { directives: {
GlTooltip: GlTooltipDirective, GlTooltip: GlTooltipDirective,
GlModalDirective, GlModalDirective,
...@@ -75,12 +73,13 @@ export default { ...@@ -75,12 +73,13 @@ export default {
<gl-button <gl-button
v-if="pipeline.flags.retryable" v-if="pipeline.flags.retryable"
v-gl-tooltip.hover v-gl-tooltip.hover
:aria-label="$options.i18n.redeployTitle" :aria-label="$options.BUTTON_TOOLTIP_RETRY"
:title="$options.i18n.redeployTitle" :title="$options.BUTTON_TOOLTIP_RETRY"
:disabled="isRetrying" :disabled="isRetrying"
:loading="isRetrying" :loading="isRetrying"
class="js-pipelines-retry-button" class="js-pipelines-retry-button"
data-qa-selector="pipeline_retry_button" data-qa-selector="pipeline_retry_button"
data-testid="pipelines-retry-button"
icon="repeat" icon="repeat"
variant="default" variant="default"
category="secondary" category="secondary"
...@@ -91,14 +90,15 @@ export default { ...@@ -91,14 +90,15 @@ export default {
v-if="pipeline.flags.cancelable" v-if="pipeline.flags.cancelable"
v-gl-tooltip.hover v-gl-tooltip.hover
v-gl-modal-directive="'confirmation-modal'" v-gl-modal-directive="'confirmation-modal'"
:aria-label="$options.i18n.cancelTitle" :aria-label="$options.BUTTON_TOOLTIP_CANCEL"
:title="$options.i18n.cancelTitle" :title="$options.BUTTON_TOOLTIP_CANCEL"
:loading="isCancelling" :loading="isCancelling"
:disabled="isCancelling" :disabled="isCancelling"
icon="cancel" icon="cancel"
variant="danger" variant="danger"
category="primary" category="primary"
class="js-pipelines-cancel-button gl-ml-1" class="js-pipelines-cancel-button gl-ml-1"
data-testid="pipelines-cancel-button"
@click="handleCancelClick" @click="handleCancelClick"
/> />
......
...@@ -59,3 +59,6 @@ export const PipelineKeyOptions = [ ...@@ -59,3 +59,6 @@ export const PipelineKeyOptions = [
]; ];
export const TOAST_MESSAGE = s__('Pipeline|Creating pipeline.'); export const TOAST_MESSAGE = s__('Pipeline|Creating pipeline.');
export const BUTTON_TOOLTIP_RETRY = __('Retry failed jobs');
export const BUTTON_TOOLTIP_CANCEL = __('Cancel');
...@@ -30864,6 +30864,9 @@ msgstr "" ...@@ -30864,6 +30864,9 @@ msgstr ""
msgid "Retry" msgid "Retry"
msgstr "" msgstr ""
msgid "Retry failed jobs"
msgstr ""
msgid "Retry job" msgid "Retry job"
msgstr "" msgstr ""
......
...@@ -4,6 +4,7 @@ import HeaderComponent from '~/pipelines/components/header_component.vue'; ...@@ -4,6 +4,7 @@ import HeaderComponent from '~/pipelines/components/header_component.vue';
import cancelPipelineMutation from '~/pipelines/graphql/mutations/cancel_pipeline.mutation.graphql'; import cancelPipelineMutation from '~/pipelines/graphql/mutations/cancel_pipeline.mutation.graphql';
import deletePipelineMutation from '~/pipelines/graphql/mutations/delete_pipeline.mutation.graphql'; import deletePipelineMutation from '~/pipelines/graphql/mutations/delete_pipeline.mutation.graphql';
import retryPipelineMutation from '~/pipelines/graphql/mutations/retry_pipeline.mutation.graphql'; import retryPipelineMutation from '~/pipelines/graphql/mutations/retry_pipeline.mutation.graphql';
import { BUTTON_TOOLTIP_RETRY } from '~/pipelines/constants';
import { import {
mockCancelledPipelineHeader, mockCancelledPipelineHeader,
mockFailedPipelineHeader, mockFailedPipelineHeader,
...@@ -113,6 +114,10 @@ describe('Pipeline details header', () => { ...@@ -113,6 +114,10 @@ describe('Pipeline details header', () => {
variables: { id: mockCancelledPipelineHeader.id }, variables: { id: mockCancelledPipelineHeader.id },
}); });
}); });
it('should render retry action tooltip', () => {
expect(findRetryButton().attributes('title')).toBe(BUTTON_TOOLTIP_RETRY);
});
}); });
describe('Cancel action', () => { describe('Cancel action', () => {
......
...@@ -9,7 +9,11 @@ import PipelineTriggerer from '~/pipelines/components/pipelines_list/pipeline_tr ...@@ -9,7 +9,11 @@ import PipelineTriggerer from '~/pipelines/components/pipelines_list/pipeline_tr
import PipelineUrl from '~/pipelines/components/pipelines_list/pipeline_url.vue'; import PipelineUrl from '~/pipelines/components/pipelines_list/pipeline_url.vue';
import PipelinesTable from '~/pipelines/components/pipelines_list/pipelines_table.vue'; import PipelinesTable from '~/pipelines/components/pipelines_list/pipelines_table.vue';
import PipelinesTimeago from '~/pipelines/components/pipelines_list/time_ago.vue'; import PipelinesTimeago from '~/pipelines/components/pipelines_list/time_ago.vue';
import { PipelineKeyOptions } from '~/pipelines/constants'; import {
PipelineKeyOptions,
BUTTON_TOOLTIP_RETRY,
BUTTON_TOOLTIP_CANCEL,
} from '~/pipelines/constants';
import eventHub from '~/pipelines/event_hub'; import eventHub from '~/pipelines/event_hub';
import CiBadge from '~/vue_shared/components/ci_badge_link.vue'; import CiBadge from '~/vue_shared/components/ci_badge_link.vue';
...@@ -66,6 +70,8 @@ describe('Pipelines Table', () => { ...@@ -66,6 +70,8 @@ describe('Pipelines Table', () => {
const findStagesTh = () => wrapper.findByTestId('stages-th'); const findStagesTh = () => wrapper.findByTestId('stages-th');
const findTimeAgoTh = () => wrapper.findByTestId('timeago-th'); const findTimeAgoTh = () => wrapper.findByTestId('timeago-th');
const findActionsTh = () => wrapper.findByTestId('actions-th'); const findActionsTh = () => wrapper.findByTestId('actions-th');
const findRetryBtn = () => wrapper.findByTestId('pipelines-retry-button');
const findCancelBtn = () => wrapper.findByTestId('pipelines-cancel-button');
beforeEach(() => { beforeEach(() => {
pipeline = createMockPipeline(); pipeline = createMockPipeline();
...@@ -192,6 +198,14 @@ describe('Pipelines Table', () => { ...@@ -192,6 +198,14 @@ describe('Pipelines Table', () => {
it('should render pipeline operations', () => { it('should render pipeline operations', () => {
expect(findActions().exists()).toBe(true); expect(findActions().exists()).toBe(true);
}); });
it('should render retry action tooltip', () => {
expect(findRetryBtn().attributes('title')).toBe(BUTTON_TOOLTIP_RETRY);
});
it('should render cancel action tooltip', () => {
expect(findCancelBtn().attributes('title')).toBe(BUTTON_TOOLTIP_CANCEL);
});
}); });
}); });
......
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