Commit 292a36c8 authored by Angelo Gulina's avatar Angelo Gulina Committed by Martin Wortschack

Add tooltip for pipeline actions

parent d63a0234
<script> <script>
import { GlButton } from '@gitlab/ui'; import { GlButton, GlTooltipDirective } from '@gitlab/ui';
import eventHub from '../../event_hub'; import eventHub from '../../event_hub';
import { __ } from '~/locale';
import PipelinesActionsComponent from './pipelines_actions.vue'; import PipelinesActionsComponent from './pipelines_actions.vue';
import PipelinesArtifactsComponent from './pipelines_artifacts.vue'; import PipelinesArtifactsComponent from './pipelines_artifacts.vue';
import CiBadge from '~/vue_shared/components/ci_badge_link.vue'; import CiBadge from '~/vue_shared/components/ci_badge_link.vue';
...@@ -17,6 +18,13 @@ import { PIPELINES_TABLE } from '../../constants'; ...@@ -17,6 +18,13 @@ import { PIPELINES_TABLE } from '../../constants';
* Given the received object renders a table row in the pipelines' table. * Given the received object renders a table row in the pipelines' table.
*/ */
export default { export default {
i18n: {
cancelTitle: __('Cancel'),
redeployTitle: __('Pipelines|Retry'),
},
directives: {
GlTooltip: GlTooltipDirective,
},
components: { components: {
PipelinesActionsComponent, PipelinesActionsComponent,
PipelinesArtifactsComponent, PipelinesArtifactsComponent,
...@@ -342,8 +350,11 @@ export default { ...@@ -342,8 +350,11 @@ export default {
<gl-button <gl-button
v-if="pipeline.flags.retryable" v-if="pipeline.flags.retryable"
:loading="isRetrying" v-gl-tooltip.hover
:aria-label="$options.i18n.redeployTitle"
:title="$options.i18n.redeployTitle"
:disabled="isRetrying" :disabled="isRetrying"
:loading="isRetrying"
class="js-pipelines-retry-button btn-retry" class="js-pipelines-retry-button btn-retry"
data-qa-selector="pipeline_retry_button" data-qa-selector="pipeline_retry_button"
icon="repeat" icon="repeat"
...@@ -354,6 +365,9 @@ export default { ...@@ -354,6 +365,9 @@ export default {
<gl-button <gl-button
v-if="pipeline.flags.cancelable" v-if="pipeline.flags.cancelable"
v-gl-tooltip.hover
:aria-label="$options.i18n.cancelTitle"
:title="$options.i18n.cancelTitle"
:loading="isCancelling" :loading="isCancelling"
:disabled="isCancelling" :disabled="isCancelling"
data-toggle="modal" data-toggle="modal"
......
---
title: Add tooltip for pipeline actions
merge_request: 44317
author:
type: fixed
...@@ -8,6 +8,8 @@ msgid "" ...@@ -8,6 +8,8 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: gitlab 1.0.0\n" "Project-Id-Version: gitlab 1.0.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-10-12 08:34+0200\n"
"PO-Revision-Date: 2020-10-12 08:34+0200\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n" "Language: \n"
...@@ -18995,6 +18997,9 @@ msgstr "" ...@@ -18995,6 +18997,9 @@ msgstr ""
msgid "Pipelines|Project cache successfully reset." msgid "Pipelines|Project cache successfully reset."
msgstr "" msgstr ""
msgid "Pipelines|Retry"
msgstr ""
msgid "Pipelines|Revoke" msgid "Pipelines|Revoke"
msgstr "" msgstr ""
......
import { GlButton } from '@gitlab/ui';
import { mount } from '@vue/test-utils'; import { mount } from '@vue/test-utils';
import PipelinesTable from '~/pipelines/components/pipelines_list/pipelines_table.vue'; import PipelinesTable from '~/pipelines/components/pipelines_list/pipelines_table.vue';
...@@ -19,6 +20,7 @@ describe('Pipelines Table', () => { ...@@ -19,6 +20,7 @@ describe('Pipelines Table', () => {
}); });
}; };
const findRows = () => wrapper.findAll('.commit.gl-responsive-table-row'); const findRows = () => wrapper.findAll('.commit.gl-responsive-table-row');
const findGlButtons = () => wrapper.findAll(GlButton);
preloadFixtures(jsonFixtureName); preloadFixtures(jsonFixtureName);
...@@ -63,4 +65,28 @@ describe('Pipelines Table', () => { ...@@ -63,4 +65,28 @@ describe('Pipelines Table', () => {
expect(findRows()).toHaveLength(1); expect(findRows()).toHaveLength(1);
}); });
}); });
describe('pipline actions', () => {
it('should set the "Re-deploy" title', () => {
const pipelines = [{ ...pipeline, flags: { cancelable: false, retryable: true } }];
createComponent({ ...defaultProps, pipelines });
expect(findGlButtons().length).toBe(1);
expect(
findGlButtons()
.at(0)
.attributes('title'),
).toMatch('Retry');
});
it('should set the "Cancel" title', () => {
const pipelines = [{ ...pipeline, flags: { cancelable: true, retryable: false } }];
createComponent({ ...defaultProps, pipelines });
expect(findGlButtons().length).toBe(1);
expect(
findGlButtons()
.at(0)
.attributes('title'),
).toMatch('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