Commit 121420a9 authored by Jacques Erasmus's avatar Jacques Erasmus

Merge branch 'gitlab-ui-integration-246-bootstrap-vue-toast' into 'master'

Update dependency @gitlab/ui to v30

See merge request gitlab-org/gitlab!63919
parents 081f0504 0d97d1e9
...@@ -145,7 +145,7 @@ export default class FileTemplateMediator { ...@@ -145,7 +145,7 @@ export default class FileTemplateMediator {
text: __('Undo'), text: __('Undo'),
onClick: (e, toastObj) => { onClick: (e, toastObj) => {
self.restoreFromCache(); self.restoreFromCache();
toastObj.goAway(0); toastObj.hide();
}, },
}, },
}); });
......
...@@ -78,7 +78,7 @@ export default { ...@@ -78,7 +78,7 @@ export default {
} = await axios.put(this.resetPath); } = await axios.put(this.resetPath);
this.email = newAddress; this.email = newAddress;
} catch { } catch {
this.$toast.show(__('There was an error when reseting email token.'), { type: 'error' }); this.$toast.show(__('There was an error when reseting email token.'));
} }
}, },
cancelHandler() { cancelHandler() {
......
...@@ -73,7 +73,7 @@ export default { ...@@ -73,7 +73,7 @@ export default {
this.events = this.buildEvents(events); this.events = this.buildEvents(events);
} catch (error) { } catch (error) {
this.$toast.show(this.$options.i18n.loadNotificationLevelErrorMessage, { type: 'error' }); this.$toast.show(this.$options.i18n.loadNotificationLevelErrorMessage);
} finally { } finally {
this.isLoading = false; this.isLoading = false;
} }
...@@ -93,7 +93,7 @@ export default { ...@@ -93,7 +93,7 @@ export default {
this.events = this.buildEvents(events); this.events = this.buildEvents(events);
} catch (error) { } catch (error) {
this.$toast.show(this.$options.i18n.updateNotificationLevelErrorMessage, { type: 'error' }); this.$toast.show(this.$options.i18n.updateNotificationLevelErrorMessage);
} }
}, },
}, },
......
...@@ -104,7 +104,7 @@ export default { ...@@ -104,7 +104,7 @@ export default {
this.selectedNotificationLevel = level; this.selectedNotificationLevel = level;
this.openNotificationsModal(); this.openNotificationsModal();
} catch (error) { } catch (error) {
this.$toast.show(this.$options.i18n.updateNotificationLevelErrorMessage, { type: 'error' }); this.$toast.show(this.$options.i18n.updateNotificationLevelErrorMessage);
} finally { } finally {
this.isLoading = false; this.isLoading = false;
} }
......
...@@ -86,7 +86,7 @@ export default { ...@@ -86,7 +86,7 @@ export default {
this.alertMessage = ERROR_UPDATING_SETTINGS; this.alertMessage = ERROR_UPDATING_SETTINGS;
} else { } else {
this.dismissAlert(); this.dismissAlert();
this.$toast.show(SUCCESS_UPDATING_SETTINGS, { type: 'success' }); this.$toast.show(SUCCESS_UPDATING_SETTINGS);
} }
}) })
.catch((e) => { .catch((e) => {
......
...@@ -158,14 +158,14 @@ export default { ...@@ -158,14 +158,14 @@ export default {
.then(({ data }) => { .then(({ data }) => {
const errorMessage = data?.updateContainerExpirationPolicy?.errors[0]; const errorMessage = data?.updateContainerExpirationPolicy?.errors[0];
if (errorMessage) { if (errorMessage) {
this.$toast.show(errorMessage, { type: 'error' }); this.$toast.show(errorMessage);
} else { } else {
this.$toast.show(UPDATE_SETTINGS_SUCCESS_MESSAGE, { type: 'success' }); this.$toast.show(UPDATE_SETTINGS_SUCCESS_MESSAGE);
} }
}) })
.catch((error) => { .catch((error) => {
this.setApiErrors(error); this.setApiErrors(error);
this.$toast.show(UPDATE_SETTINGS_ERROR_MESSAGE, { type: 'error' }); this.$toast.show(UPDATE_SETTINGS_ERROR_MESSAGE);
}) })
.finally(() => { .finally(() => {
this.mutationLoading = false; this.mutationLoading = false;
......
...@@ -82,7 +82,7 @@ export default { ...@@ -82,7 +82,7 @@ export default {
text: this.alertContent.actionText, text: this.alertContent.actionText,
onClick: (_, toastObject) => { onClick: (_, toastObject) => {
this[this.alertContent.actionName](); this[this.alertContent.actionName]();
toastObject.goAway(0); toastObject.hide();
}, },
}, },
}; };
......
...@@ -2,7 +2,7 @@ import { GlToast } from '@gitlab/ui'; ...@@ -2,7 +2,7 @@ import { GlToast } from '@gitlab/ui';
import Vue from 'vue'; import Vue from 'vue';
Vue.use(GlToast); Vue.use(GlToast);
const instance = new Vue(); export const instance = new Vue();
export default function showGlobalToast(...args) { export default function showGlobalToast(...args) {
return instance.$toast.show(...args); return instance.$toast.show(...args);
......
...@@ -168,9 +168,7 @@ export default { ...@@ -168,9 +168,7 @@ export default {
const msg = this.isEditing const msg = this.isEditing
? this.$options.i18n.FORM_EDITED ? this.$options.i18n.FORM_EDITED
: this.$options.i18n.FORM_CREATED; : this.$options.i18n.FORM_CREATED;
this.$toast.show(sprintf(msg, { name: this.name }), { this.$toast.show(sprintf(msg, { name: this.name }));
position: 'top-center',
});
this.name = ''; this.name = '';
this.nameError = []; this.nameError = [];
this.stages = initializeStages(this.defaultStageConfig, this.selectedPreset); this.stages = initializeStages(this.defaultStageConfig, this.selectedPreset);
......
...@@ -84,7 +84,7 @@ export default { ...@@ -84,7 +84,7 @@ export default {
methods: { methods: {
...mapActions(['setSelectedValueStream', 'deleteValueStream']), ...mapActions(['setSelectedValueStream', 'deleteValueStream']),
onSuccess(message) { onSuccess(message) {
this.$toast.show(message, { position: 'top-center' }); this.$toast.show(message);
}, },
isSelected(id) { isSelected(id) {
return Boolean(this.selectedValueStreamId && this.selectedValueStreamId === id); return Boolean(this.selectedValueStreamId && this.selectedValueStreamId === id);
......
...@@ -44,12 +44,12 @@ export default { ...@@ -44,12 +44,12 @@ export default {
const { targetBranch } = this; const { targetBranch } = this;
return this.fetchRules({ targetBranch, resetToDefault: true }).then(() => { return this.fetchRules({ targetBranch, resetToDefault: true }).then(() => {
const toast = showToast(__('Approval rules reset to project defaults'), { showToast(__('Approval rules reset to project defaults'), {
action: { action: {
text: __('Undo'), text: __('Undo'),
onClick: () => { onClick: (_, toast) => {
this.undoRulesChange(); this.undoRulesChange();
toast.goAway(0); toast.hide();
}, },
}, },
}); });
......
...@@ -22,11 +22,7 @@ export default { ...@@ -22,11 +22,7 @@ export default {
this.$toast.show(__('User pipeline minutes were successfully reset.')); this.$toast.show(__('User pipeline minutes were successfully reset.'));
} }
}) })
.catch(() => .catch(() => this.$toast.show(__('There was an error resetting user pipeline minutes.')));
this.$toast.show(__('There was an error resetting user pipeline minutes.'), {
type: 'error',
}),
);
}, },
}, },
}; };
......
...@@ -243,7 +243,7 @@ export const dismissVulnerability = ( ...@@ -243,7 +243,7 @@ export const dismissVulnerability = (
dispatch('revertDismissVulnerability', { vulnerability }) dispatch('revertDismissVulnerability', { vulnerability })
.then(() => dispatch('fetchVulnerabilities', { page })) .then(() => dispatch('fetchVulnerabilities', { page }))
.catch(() => {}); .catch(() => {});
toastObject.goAway(0); toastObject.hide();
} }
}, },
}, },
......
...@@ -315,9 +315,7 @@ describe('ValueStreamForm', () => { ...@@ -315,9 +315,7 @@ describe('ValueStreamForm', () => {
}); });
it('displays a toast message', () => { it('displays a toast message', () => {
expect(mockToastShow).toHaveBeenCalledWith(`'${initialData.name}' Value Stream saved`, { expect(mockToastShow).toHaveBeenCalledWith(`'${initialData.name}' Value Stream saved`);
position: 'top-center',
});
}); });
it('sends tracking information', () => { it('sends tracking information', () => {
...@@ -411,9 +409,7 @@ describe('ValueStreamForm', () => { ...@@ -411,9 +409,7 @@ describe('ValueStreamForm', () => {
}); });
it('displays a toast message', () => { it('displays a toast message', () => {
expect(mockToastShow).toHaveBeenCalledWith(`'${streamName}' Value Stream created`, { expect(mockToastShow).toHaveBeenCalledWith(`'${streamName}' Value Stream created`);
position: 'top-center',
});
}); });
it('sends tracking information', () => { it('sends tracking information', () => {
......
...@@ -202,9 +202,6 @@ describe('ValueStreamSelect', () => { ...@@ -202,9 +202,6 @@ describe('ValueStreamSelect', () => {
it('displays a toast message', () => { it('displays a toast message', () => {
expect(mockToastShow).toHaveBeenCalledWith( expect(mockToastShow).toHaveBeenCalledWith(
`'${selectedValueStream.name}' Value Stream deleted`, `'${selectedValueStream.name}' Value Stream deleted`,
{
position: 'top-center',
},
); );
}); });
......
...@@ -87,9 +87,6 @@ describe('Reset pipeline minutes button', () => { ...@@ -87,9 +87,6 @@ describe('Reset pipeline minutes button', () => {
expect(axiosSpy).toHaveBeenCalled(); expect(axiosSpy).toHaveBeenCalled();
expect($toast.show).toHaveBeenCalledWith( expect($toast.show).toHaveBeenCalledWith(
'There was an error resetting user pipeline minutes.', 'There was an error resetting user pipeline minutes.',
{
type: 'error',
},
); );
}); });
}); });
......
...@@ -47,11 +47,11 @@ end ...@@ -47,11 +47,11 @@ end
def check_undo_button_display def check_undo_button_display
expect(page).to have_content('template applied') expect(page).to have_content('template applied')
expect(page).to have_css('.toasted-container') expect(page).to have_css('.b-toaster')
end end
def check_content_reverted(template_content) def check_content_reverted(template_content)
find('.toasted-container a', text: 'Undo').click find('.b-toaster a', text: 'Undo').click
expect(page).not_to have_content(template_content) expect(page).not_to have_content(template_content)
expect(page).to have_css('.template-type-selector .dropdown-toggle-text') expect(page).to have_css('.template-type-selector .dropdown-toggle-text')
end end
......
...@@ -5,6 +5,7 @@ import * as actions from '~/emoji/awards_app/store/actions'; ...@@ -5,6 +5,7 @@ import * as actions from '~/emoji/awards_app/store/actions';
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
jest.mock('@sentry/browser'); jest.mock('@sentry/browser');
jest.mock('~/vue_shared/plugins/global_toast');
describe('Awards app actions', () => { describe('Awards app actions', () => {
afterEach(() => { afterEach(() => {
......
...@@ -154,10 +154,7 @@ describe('IssuableByEmail', () => { ...@@ -154,10 +154,7 @@ describe('IssuableByEmail', () => {
await clickResetEmail(); await clickResetEmail();
expect(mockToastShow).toHaveBeenCalledWith( expect(mockToastShow).toHaveBeenCalledWith('There was an error when reseting email token.');
'There was an error when reseting email token.',
{ type: 'error' },
);
expect(findFormInputGroup().props('value')).toBe('user@gitlab.com'); expect(findFormInputGroup().props('value')).toBe('user@gitlab.com');
}); });
}); });
......
...@@ -177,11 +177,8 @@ describe('CustomNotificationsModal', () => { ...@@ -177,11 +177,8 @@ describe('CustomNotificationsModal', () => {
await waitForPromises(); await waitForPromises();
expect( expect(mockToastShow).toHaveBeenCalledWith(
mockToastShow,
).toHaveBeenCalledWith(
'An error occurred while loading the notification settings. Please try again.', 'An error occurred while loading the notification settings. Please try again.',
{ type: 'error' },
); );
}); });
}); });
...@@ -255,11 +252,8 @@ describe('CustomNotificationsModal', () => { ...@@ -255,11 +252,8 @@ describe('CustomNotificationsModal', () => {
await waitForPromises(); await waitForPromises();
expect( expect(mockToastShow).toHaveBeenCalledWith(
mockToastShow,
).toHaveBeenCalledWith(
'An error occurred while updating the notification settings. Please try again.', 'An error occurred while updating the notification settings. Please try again.',
{ type: 'error' },
); );
}); });
}); });
......
...@@ -242,11 +242,8 @@ describe('NotificationsDropdown', () => { ...@@ -242,11 +242,8 @@ describe('NotificationsDropdown', () => {
await clickDropdownItemAt(1); await clickDropdownItemAt(1);
expect(wrapper.vm.selectedNotificationLevel).toBe('global'); expect(wrapper.vm.selectedNotificationLevel).toBe('global');
expect( expect(mockToastShow).toHaveBeenCalledWith(
mockToastShow,
).toHaveBeenCalledWith(
'An error occurred while updating the notification settings. Please try again.', 'An error occurred while updating the notification settings. Please try again.',
{ type: 'error' },
); );
}); });
......
...@@ -244,9 +244,7 @@ describe('Group Settings App', () => { ...@@ -244,9 +244,7 @@ describe('Group Settings App', () => {
await waitForPromises(); await waitForPromises();
expect(show).toHaveBeenCalledWith(SUCCESS_UPDATING_SETTINGS, { expect(show).toHaveBeenCalledWith(SUCCESS_UPDATING_SETTINGS);
type: 'success',
});
}); });
it('has an optimistic response', async () => { it('has an optimistic response', async () => {
......
...@@ -321,9 +321,7 @@ describe('Settings Form', () => { ...@@ -321,9 +321,7 @@ describe('Settings Form', () => {
await waitForPromises(); await waitForPromises();
await wrapper.vm.$nextTick(); await wrapper.vm.$nextTick();
expect(wrapper.vm.$toast.show).toHaveBeenCalledWith(UPDATE_SETTINGS_SUCCESS_MESSAGE, { expect(wrapper.vm.$toast.show).toHaveBeenCalledWith(UPDATE_SETTINGS_SUCCESS_MESSAGE);
type: 'success',
});
}); });
describe('when submit fails', () => { describe('when submit fails', () => {
...@@ -339,9 +337,7 @@ describe('Settings Form', () => { ...@@ -339,9 +337,7 @@ describe('Settings Form', () => {
await waitForPromises(); await waitForPromises();
await wrapper.vm.$nextTick(); await wrapper.vm.$nextTick();
expect(wrapper.vm.$toast.show).toHaveBeenCalledWith('foo', { expect(wrapper.vm.$toast.show).toHaveBeenCalledWith('foo');
type: 'error',
});
}); });
}); });
...@@ -355,9 +351,7 @@ describe('Settings Form', () => { ...@@ -355,9 +351,7 @@ describe('Settings Form', () => {
await waitForPromises(); await waitForPromises();
await wrapper.vm.$nextTick(); await wrapper.vm.$nextTick();
expect(wrapper.vm.$toast.show).toHaveBeenCalledWith(UPDATE_SETTINGS_ERROR_MESSAGE, { expect(wrapper.vm.$toast.show).toHaveBeenCalledWith(UPDATE_SETTINGS_ERROR_MESSAGE);
type: 'error',
});
}); });
it('parses the error messages', async () => { it('parses the error messages', async () => {
......
import Vue from 'vue'; import toast, { instance } from '~/vue_shared/plugins/global_toast';
import toast from '~/vue_shared/plugins/global_toast';
describe('Global toast', () => { describe('Global toast', () => {
let spyFunc; let spyFunc;
beforeEach(() => { beforeEach(() => {
spyFunc = jest.spyOn(Vue.prototype.$toast, 'show').mockImplementation(() => {}); spyFunc = jest.spyOn(instance.$toast, 'show').mockImplementation(() => {});
}); });
afterEach(() => { afterEach(() => {
...@@ -18,7 +17,7 @@ describe('Global toast', () => { ...@@ -18,7 +17,7 @@ describe('Global toast', () => {
toast(arg1, arg2); toast(arg1, arg2);
expect(Vue.prototype.$toast.show).toHaveBeenCalledTimes(1); expect(instance.$toast.show).toHaveBeenCalledTimes(1);
expect(Vue.prototype.$toast.show).toHaveBeenCalledWith(arg1, arg2); expect(instance.$toast.show).toHaveBeenCalledWith(arg1, arg2);
}); });
}); });
...@@ -908,13 +908,12 @@ ...@@ -908,13 +908,12 @@
resolved "https://registry.yarnpkg.com/@gitlab/tributejs/-/tributejs-1.0.0.tgz#672befa222aeffc83e7d799b0500a7a4418e59b8" resolved "https://registry.yarnpkg.com/@gitlab/tributejs/-/tributejs-1.0.0.tgz#672befa222aeffc83e7d799b0500a7a4418e59b8"
integrity sha512-nmKw1+hB6MHvlmPz63yPwVs1qQkycHwsKgxpEbzmky16Y6mL4EJMk3w1b8QlOAF/AIAzjCERPhe/R4MJiohbZw== integrity sha512-nmKw1+hB6MHvlmPz63yPwVs1qQkycHwsKgxpEbzmky16Y6mL4EJMk3w1b8QlOAF/AIAzjCERPhe/R4MJiohbZw==
"@gitlab/ui@29.38.1": "@gitlab/ui@30.0.0":
version "29.38.1" version "30.0.0"
resolved "https://registry.yarnpkg.com/@gitlab/ui/-/ui-29.38.1.tgz#93ab2ad7cb8008b3050599b452b626c109630e97" resolved "https://registry.yarnpkg.com/@gitlab/ui/-/ui-30.0.0.tgz#1f7c4bb2dfa1a987f5673f865384ebcbbe3d7a3e"
integrity sha512-5sKdbZI9Q9S7KW3/ybN40tFS/KInm76cog8O0SMe2Ne026ZZ18CAHEMvkfoVXTN3XMkWZnMlk92s8f/WqM5//A== integrity sha512-+o8t4TVm8MOV6llX6zq9HKuggRWKuPDZfbmjptNJA0CwW3IGPV/WcgFuSozHW8x2lxE0ZfrD7vMwI0dfTwghwQ==
dependencies: dependencies:
"@babel/standalone" "^7.0.0" "@babel/standalone" "^7.0.0"
"@gitlab/vue-toasted" "^1.3.0"
bootstrap-vue "2.18.1" bootstrap-vue "2.18.1"
copy-to-clipboard "^3.0.8" copy-to-clipboard "^3.0.8"
dompurify "^2.2.9" dompurify "^2.2.9"
...@@ -932,11 +931,6 @@ ...@@ -932,11 +931,6 @@
resolved "https://registry.yarnpkg.com/@gitlab/visual-review-tools/-/visual-review-tools-1.6.1.tgz#0d8f3ff9f51b05f7c80b9a107727703d48997e4e" resolved "https://registry.yarnpkg.com/@gitlab/visual-review-tools/-/visual-review-tools-1.6.1.tgz#0d8f3ff9f51b05f7c80b9a107727703d48997e4e"
integrity sha512-vY8K1igwZFoEOmU0h4E7XTLlilsQ4ylPr27O01UsSe6ZTKi6oEMREsRAEpNIUgRlxUARCsf+Opp4pgSFzFkFcw== integrity sha512-vY8K1igwZFoEOmU0h4E7XTLlilsQ4ylPr27O01UsSe6ZTKi6oEMREsRAEpNIUgRlxUARCsf+Opp4pgSFzFkFcw==
"@gitlab/vue-toasted@^1.3.0":
version "1.3.0"
resolved "https://registry.yarnpkg.com/@gitlab/vue-toasted/-/vue-toasted-1.3.0.tgz#f21550d4ce406ee5f99447a02abf36250ecc922d"
integrity sha512-xexu7YbbIkQS5FDqPaewrOTQ4/myth5VyU8+hWZ+Tj1e5CuAlDNha3dHbvwyLW8/2flm/2mfslFNPAX2DRe8ZQ==
"@istanbuljs/load-nyc-config@^1.0.0": "@istanbuljs/load-nyc-config@^1.0.0":
version "1.1.0" version "1.1.0"
resolved "https://registry.yarnpkg.com/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz#fd3db1d59ecf7cf121e80650bb86712f9b55eced" resolved "https://registry.yarnpkg.com/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz#fd3db1d59ecf7cf121e80650bb86712f9b55eced"
......
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