Commit 4fc95be4 authored by Janis Altherr's avatar Janis Altherr Committed by Brandon Labuschagne

Show toast when deleting an iteration

parent 13d29305
...@@ -115,6 +115,7 @@ export default { ...@@ -115,6 +115,7 @@ export default {
} }
this.$router.push('/'); this.$router.push('/');
this.$toast.show(s__('Iterations|The iteration has been deleted.'));
}) })
.catch((err) => { .catch((err) => {
this.error = err; this.error = err;
......
...@@ -15,7 +15,7 @@ import { TYPE_ITERATION } from '~/graphql_shared/constants'; ...@@ -15,7 +15,7 @@ import { TYPE_ITERATION } from '~/graphql_shared/constants';
import { convertToGraphQLId } from '~/graphql_shared/utils'; import { convertToGraphQLId } from '~/graphql_shared/utils';
import { formatDate } from '~/lib/utils/datetime_utility'; import { formatDate } from '~/lib/utils/datetime_utility';
import { visitUrl } from '~/lib/utils/url_utility'; import { visitUrl } from '~/lib/utils/url_utility';
import { __ } from '~/locale'; import { __, s__ } from '~/locale';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
import { Namespace } from '../constants'; import { Namespace } from '../constants';
import deleteIteration from '../queries/destroy_iteration.mutation.graphql'; import deleteIteration from '../queries/destroy_iteration.mutation.graphql';
...@@ -202,6 +202,8 @@ export default { ...@@ -202,6 +202,8 @@ export default {
} }
this.isEditing = false; this.isEditing = false;
this.$toast.show(s__('Iterations|The iteration has been deleted.'));
visitUrl(this.iterationsListPath); visitUrl(this.iterationsListPath);
}) })
.catch((err) => { .catch((err) => {
......
import { GlToast } from '@gitlab/ui';
import Vue from 'vue'; import Vue from 'vue';
import VueApollo from 'vue-apollo'; import VueApollo from 'vue-apollo';
import createDefaultClient from '~/lib/graphql'; import createDefaultClient from '~/lib/graphql';
...@@ -10,6 +11,7 @@ import Iterations from './components/iterations.vue'; ...@@ -10,6 +11,7 @@ import Iterations from './components/iterations.vue';
import { Namespace } from './constants'; import { Namespace } from './constants';
import createRouter from './router'; import createRouter from './router';
Vue.use(GlToast);
Vue.use(VueApollo); Vue.use(VueApollo);
const apolloProvider = new VueApollo({ const apolloProvider = new VueApollo({
......
...@@ -21,6 +21,9 @@ const $router = { ...@@ -21,6 +21,9 @@ const $router = {
}, },
}, },
}; };
const $toast = {
show: jest.fn(),
};
describe('Iterations report', () => { describe('Iterations report', () => {
let wrapper; let wrapper;
...@@ -72,6 +75,7 @@ describe('Iterations report', () => { ...@@ -72,6 +75,7 @@ describe('Iterations report', () => {
}, },
mocks: { mocks: {
$router, $router,
$toast,
}, },
stubs: { stubs: {
GlLoadingIcon, GlLoadingIcon,
...@@ -148,6 +152,7 @@ describe('Iterations report', () => { ...@@ -148,6 +152,7 @@ describe('Iterations report', () => {
await waitForPromises(); await waitForPromises();
expect($router.push).toHaveBeenCalledWith('/'); expect($router.push).toHaveBeenCalledWith('/');
expect($toast.show).toHaveBeenCalledWith('The iteration has been deleted.');
}); });
it('shows error when delete fails', async () => { it('shows error when delete fails', async () => {
......
...@@ -19192,6 +19192,9 @@ msgstr "" ...@@ -19192,6 +19192,9 @@ msgstr ""
msgid "Iterations|The duration for each iteration (in weeks)" msgid "Iterations|The duration for each iteration (in weeks)"
msgstr "" msgstr ""
msgid "Iterations|The iteration has been deleted."
msgstr ""
msgid "Iterations|The start date of your first iteration" msgid "Iterations|The start date of your first iteration"
msgstr "" msgstr ""
......
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