Commit 1ef2c8fa authored by Denys Mishunov's avatar Denys Mishunov

Merge branch '294214-improve-run-pipeline-ux-on-mr' into 'master'

Improve MR run pipeline ux with toast message

See merge request gitlab-org/gitlab!73479
parents c4f6712e 32bfb6ac
...@@ -49,3 +49,5 @@ export const PipelineKeyOptions = [ ...@@ -49,3 +49,5 @@ export const PipelineKeyOptions = [
key: 'iid', key: 'iid',
}, },
]; ];
export const TOAST_MESSAGE = s__('Pipeline|Creating pipeline.');
...@@ -4,7 +4,7 @@ import { historyPushState, buildUrlWithCurrentLocation } from '~/lib/utils/commo ...@@ -4,7 +4,7 @@ import { historyPushState, buildUrlWithCurrentLocation } from '~/lib/utils/commo
import Poll from '~/lib/utils/poll'; import Poll from '~/lib/utils/poll';
import { __ } from '~/locale'; import { __ } from '~/locale';
import { validateParams } from '~/pipelines/utils'; import { validateParams } from '~/pipelines/utils';
import { CANCEL_REQUEST } from '../constants'; import { CANCEL_REQUEST, TOAST_MESSAGE } from '../constants';
import eventHub from '../event_hub'; import eventHub from '../event_hub';
export default { export default {
...@@ -191,7 +191,10 @@ export default { ...@@ -191,7 +191,10 @@ export default {
this.service this.service
.runMRPipeline(options) .runMRPipeline(options)
.then(() => this.updateTable()) .then(() => {
this.$toast.show(TOAST_MESSAGE);
this.updateTable();
})
.catch(() => { .catch(() => {
createFlash({ createFlash({
message: __( message: __(
......
...@@ -25534,6 +25534,9 @@ msgstr "" ...@@ -25534,6 +25534,9 @@ msgstr ""
msgid "Pipeline|Created" msgid "Pipeline|Created"
msgstr "" msgstr ""
msgid "Pipeline|Creating pipeline."
msgstr ""
msgid "Pipeline|Date" msgid "Pipeline|Date"
msgstr "" msgstr ""
......
...@@ -6,8 +6,13 @@ import { extendedWrapper } from 'helpers/vue_test_utils_helper'; ...@@ -6,8 +6,13 @@ import { extendedWrapper } from 'helpers/vue_test_utils_helper';
import waitForPromises from 'helpers/wait_for_promises'; import waitForPromises from 'helpers/wait_for_promises';
import Api from '~/api'; import Api from '~/api';
import PipelinesTable from '~/commit/pipelines/pipelines_table.vue'; import PipelinesTable from '~/commit/pipelines/pipelines_table.vue';
import { TOAST_MESSAGE } from '~/pipelines/constants';
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
const $toast = {
show: jest.fn(),
};
describe('Pipelines table in Commits and Merge requests', () => { describe('Pipelines table in Commits and Merge requests', () => {
let wrapper; let wrapper;
let pipeline; let pipeline;
...@@ -30,6 +35,9 @@ describe('Pipelines table in Commits and Merge requests', () => { ...@@ -30,6 +35,9 @@ describe('Pipelines table in Commits and Merge requests', () => {
errorStateSvgPath: 'foo', errorStateSvgPath: 'foo',
...props, ...props,
}, },
mocks: {
$toast,
},
}), }),
); );
}; };
...@@ -178,6 +186,12 @@ describe('Pipelines table in Commits and Merge requests', () => { ...@@ -178,6 +186,12 @@ describe('Pipelines table in Commits and Merge requests', () => {
await waitForPromises(); await waitForPromises();
}); });
it('displays a toast message during pipeline creation', async () => {
await findRunPipelineBtn().trigger('click');
expect($toast.show).toHaveBeenCalledWith(TOAST_MESSAGE);
});
it('on desktop, shows a loading button', async () => { it('on desktop, shows a loading button', async () => {
await findRunPipelineBtn().trigger('click'); await findRunPipelineBtn().trigger('click');
......
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