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