Commit db42252b authored by Frédéric Caplette's avatar Frédéric Caplette

Merge branch 'ek-replace-deprecated-create-flash-vue-files' into 'master'

Replace deprecated create flash in app/*.vue files

See merge request gitlab-org/gitlab!62785
parents 9258c973 78ce1838
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
import { GlModal, GlTabs, GlTab, GlSearchBoxByType, GlSprintf } from '@gitlab/ui'; import { GlModal, GlTabs, GlTab, GlSearchBoxByType, GlSprintf } from '@gitlab/ui';
import { mapState, mapActions } from 'vuex'; import { mapState, mapActions } from 'vuex';
import ReviewTabContainer from '~/add_context_commits_modal/components/review_tab_container.vue'; import ReviewTabContainer from '~/add_context_commits_modal/components/review_tab_container.vue';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import createFlash from '~/flash';
import { BV_SHOW_MODAL } from '~/lib/utils/constants'; import { BV_SHOW_MODAL } from '~/lib/utils/constants';
import { s__ } from '~/locale'; import { s__ } from '~/locale';
import eventHub from '../event_hub'; import eventHub from '../event_hub';
...@@ -192,9 +192,11 @@ export default { ...@@ -192,9 +192,11 @@ export default {
window.location.reload(); window.location.reload();
} }
if (!values[0] && !values[1]) { if (!values[0] && !values[1]) {
createFlash( createFlash({
s__('ContextCommits|Failed to create/remove context commits. Please try again.'), message: s__(
); 'ContextCommits|Failed to create/remove context commits. Please try again.',
),
});
} }
}); });
} else if (this.uniqueCommits.length > 0) { } else if (this.uniqueCommits.length > 0) {
......
<script> <script>
import * as Sentry from '@sentry/browser';
import MetricCard from '~/analytics/shared/components/metric_card.vue'; import MetricCard from '~/analytics/shared/components/metric_card.vue';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import createFlash from '~/flash';
import { number } from '~/lib/utils/unit_format'; import { number } from '~/lib/utils/unit_format';
import { s__ } from '~/locale'; import { s__ } from '~/locale';
import usageTrendsCountQuery from '../graphql/queries/usage_trends_count.query.graphql'; import usageTrendsCountQuery from '../graphql/queries/usage_trends_count.query.graphql';
...@@ -34,8 +33,11 @@ export default { ...@@ -34,8 +33,11 @@ export default {
}); });
}, },
error(error) { error(error) {
createFlash(this.$options.i18n.loadCountsError); createFlash({
Sentry.captureException(error); message: this.$options.i18n.loadCountsError,
captureError: true,
error,
});
}, },
}, },
}, },
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
import { GlLoadingIcon, GlFormInput, GlFormGroup, GlButton } from '@gitlab/ui'; import { GlLoadingIcon, GlFormInput, GlFormGroup, GlButton } from '@gitlab/ui';
import { escape, debounce } from 'lodash'; import { escape, debounce } from 'lodash';
import { mapActions, mapState } from 'vuex'; import { mapActions, mapState } from 'vuex';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import createFlash from '~/flash';
import { s__, sprintf } from '~/locale'; import { s__, sprintf } from '~/locale';
import createEmptyBadge from '../empty_badge'; import createEmptyBadge from '../empty_badge';
import Badge from './badge.vue'; import Badge from './badge.vue';
...@@ -134,26 +134,36 @@ export default { ...@@ -134,26 +134,36 @@ export default {
if (this.isEditing) { if (this.isEditing) {
return this.saveBadge() return this.saveBadge()
.then(() => { .then(() => {
createFlash(s__('Badges|Badge saved.'), 'notice'); createFlash({
message: s__('Badges|Badge saved.'),
type: 'notice',
});
this.wasValidated = false; this.wasValidated = false;
}) })
.catch((error) => { .catch((error) => {
createFlash( createFlash({
s__('Badges|Saving the badge failed, please check the entered URLs and try again.'), message: s__(
); 'Badges|Saving the badge failed, please check the entered URLs and try again.',
),
});
throw error; throw error;
}); });
} }
return this.addBadge() return this.addBadge()
.then(() => { .then(() => {
createFlash(s__('Badges|New badge added.'), 'notice'); createFlash({
message: s__('Badges|New badge added.'),
type: 'notice',
});
this.wasValidated = false; this.wasValidated = false;
}) })
.catch((error) => { .catch((error) => {
createFlash( createFlash({
s__('Badges|Adding the badge failed, please check the entered URLs and try again.'), message: s__(
); 'Badges|Adding the badge failed, please check the entered URLs and try again.',
),
});
throw error; throw error;
}); });
}, },
......
<script> <script>
import { GlSprintf, GlModal } from '@gitlab/ui'; import { GlSprintf, GlModal } from '@gitlab/ui';
import { mapState, mapActions } from 'vuex'; import { mapState, mapActions } from 'vuex';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import createFlash from '~/flash';
import { s__ } from '~/locale'; import { s__ } from '~/locale';
import Badge from './badge.vue'; import Badge from './badge.vue';
import BadgeForm from './badge_form.vue'; import BadgeForm from './badge_form.vue';
...@@ -40,10 +40,15 @@ export default { ...@@ -40,10 +40,15 @@ export default {
onSubmitModal() { onSubmitModal() {
this.deleteBadge(this.badgeInModal) this.deleteBadge(this.badgeInModal)
.then(() => { .then(() => {
createFlash(s__('Badges|The badge was deleted.'), 'notice'); createFlash({
message: s__('Badges|The badge was deleted.'),
type: 'notice',
});
}) })
.catch((error) => { .catch((error) => {
createFlash(s__('Badges|Deleting the badge failed, please try again.')); createFlash({
message: s__('Badges|Deleting the badge failed, please try again.'),
});
throw error; throw error;
}); });
}, },
......
<script> <script>
import { GlLoadingIcon } from '@gitlab/ui'; import { GlLoadingIcon } from '@gitlab/ui';
import { Sortable, MultiDrag } from 'sortablejs'; import { Sortable, MultiDrag } from 'sortablejs';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import createFlash from '~/flash';
import { BV_HIDE_TOOLTIP } from '~/lib/utils/constants'; import { BV_HIDE_TOOLTIP } from '~/lib/utils/constants';
import { sprintf, __ } from '~/locale'; import { sprintf, __ } from '~/locale';
import eventHub from '../eventhub'; import eventHub from '../eventhub';
...@@ -295,7 +295,9 @@ export default { ...@@ -295,7 +295,9 @@ export default {
} }
if (!toList) { if (!toList) {
createFlash(__('Something went wrong while performing the action.')); createFlash({
message: __('Something went wrong while performing the action.'),
});
} }
if (!isSameList) { if (!isSameList) {
......
<script> <script>
import { GlIcon, GlLink, GlSprintf } from '@gitlab/ui'; import { GlIcon, GlLink, GlSprintf } from '@gitlab/ui';
import Api from '../../api'; import Api from '../../api';
import { deprecatedCreateFlash as createFlash } from '../../flash'; import createFlash from '../../flash';
import { __ } from '../../locale'; import { __ } from '../../locale';
import state from '../state'; import state from '../state';
import Dropdown from './dropdown.vue'; import Dropdown from './dropdown.vue';
...@@ -79,7 +79,9 @@ export default { ...@@ -79,7 +79,9 @@ export default {
this.selectProject(this.projects[0]); this.selectProject(this.projects[0]);
}) })
.catch((e) => { .catch((e) => {
createFlash(__('Error fetching forked projects. Please try again.')); createFlash({
message: __('Error fetching forked projects. Please try again.'),
});
throw e; throw e;
}); });
}, },
......
...@@ -12,7 +12,7 @@ import { ...@@ -12,7 +12,7 @@ import {
MR_COMMITS_NEXT_COMMIT, MR_COMMITS_NEXT_COMMIT,
MR_COMMITS_PREVIOUS_COMMIT, MR_COMMITS_PREVIOUS_COMMIT,
} from '~/behaviors/shortcuts/keybindings'; } from '~/behaviors/shortcuts/keybindings';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import createFlash from '~/flash';
import { isSingleViewStyle } from '~/helpers/diffs_helper'; import { isSingleViewStyle } from '~/helpers/diffs_helper';
import { getParameterByName, parseBoolean } from '~/lib/utils/common_utils'; import { getParameterByName, parseBoolean } from '~/lib/utils/common_utils';
import { updateHistory } from '~/lib/utils/url_utility'; import { updateHistory } from '~/lib/utils/url_utility';
...@@ -424,7 +424,9 @@ export default { ...@@ -424,7 +424,9 @@ export default {
if (toggleTree) this.setTreeDisplay(); if (toggleTree) this.setTreeDisplay();
}) })
.catch(() => { .catch(() => {
createFlash(__('Something went wrong on our end. Please try again!')); createFlash({
message: __('Something went wrong on our end. Please try again!'),
});
}); });
this.fetchDiffFilesBatch() this.fetchDiffFilesBatch()
...@@ -437,7 +439,9 @@ export default { ...@@ -437,7 +439,9 @@ export default {
this.setDiscussions(); this.setDiscussions();
}) })
.catch(() => { .catch(() => {
createFlash(__('Something went wrong on our end. Please try again!')); createFlash({
message: __('Something went wrong on our end. Please try again!'),
});
}); });
if (this.endpointCoverage) { if (this.endpointCoverage) {
......
<script> <script>
import { GlIcon } from '@gitlab/ui'; import { GlIcon } from '@gitlab/ui';
import { mapState, mapActions } from 'vuex'; import { mapState, mapActions } from 'vuex';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import createFlash from '~/flash';
import { s__, sprintf } from '~/locale'; import { s__, sprintf } from '~/locale';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
import { UNFOLD_COUNT, INLINE_DIFF_VIEW_TYPE, INLINE_DIFF_LINES_KEY } from '../constants'; import { UNFOLD_COUNT, INLINE_DIFF_VIEW_TYPE, INLINE_DIFF_LINES_KEY } from '../constants';
...@@ -95,7 +95,9 @@ export default { ...@@ -95,7 +95,9 @@ export default {
this.isRequesting = false; this.isRequesting = false;
}) })
.catch(() => { .catch(() => {
createFlash(s__('Diffs|Something went wrong while fetching diff lines.')); createFlash({
message: s__('Diffs|Something went wrong while fetching diff lines.'),
});
this.isRequesting = false; this.isRequesting = false;
}); });
}, },
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
import { GlButton, GlLoadingIcon, GlSafeHtmlDirective as SafeHtml, GlSprintf } from '@gitlab/ui'; import { GlButton, GlLoadingIcon, GlSafeHtmlDirective as SafeHtml, GlSprintf } from '@gitlab/ui';
import { escape } from 'lodash'; import { escape } from 'lodash';
import { mapActions, mapGetters, mapState } from 'vuex'; import { mapActions, mapGetters, mapState } from 'vuex';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import createFlash from '~/flash';
import { hasDiff } from '~/helpers/diffs_helper'; import { hasDiff } from '~/helpers/diffs_helper';
import { diffViewerErrors } from '~/ide/constants'; import { diffViewerErrors } from '~/ide/constants';
import { scrollToElement } from '~/lib/utils/common_utils'; import { scrollToElement } from '~/lib/utils/common_utils';
...@@ -270,7 +270,9 @@ export default { ...@@ -270,7 +270,9 @@ export default {
}) })
.catch(() => { .catch(() => {
this.isLoadingCollapsedDiff = false; this.isLoadingCollapsedDiff = false;
createFlash(this.$options.i18n.genericError); createFlash({
message: this.$options.i18n.genericError,
});
}); });
}, },
showForkMessage() { showForkMessage() {
......
...@@ -13,7 +13,7 @@ import { ...@@ -13,7 +13,7 @@ import {
GlIcon, GlIcon,
} from '@gitlab/ui'; } from '@gitlab/ui';
import { mapActions, mapGetters, mapState } from 'vuex'; import { mapActions, mapGetters, mapState } from 'vuex';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import createFlash from '~/flash';
import { __, sprintf, n__ } from '~/locale'; import { __, sprintf, n__ } from '~/locale';
import Tracking from '~/tracking'; import Tracking from '~/tracking';
import TimeAgoTooltip from '~/vue_shared/components/time_ago_tooltip.vue'; import TimeAgoTooltip from '~/vue_shared/components/time_ago_tooltip.vue';
...@@ -88,7 +88,10 @@ export default { ...@@ -88,7 +88,10 @@ export default {
}, },
pollInterval: 2000, pollInterval: 2000,
update: (data) => data.project.sentryErrors.detailedError, update: (data) => data.project.sentryErrors.detailedError,
error: () => createFlash(__('Failed to load error details from Sentry.')), error: () =>
createFlash({
message: __('Failed to load error details from Sentry.'),
}),
result(res) { result(res) {
if (res.data.project?.sentryErrors?.detailedError) { if (res.data.project?.sentryErrors?.detailedError) {
this.$apollo.queries.error.stopPolling(); this.$apollo.queries.error.stopPolling();
...@@ -225,7 +228,10 @@ export default { ...@@ -225,7 +228,10 @@ export default {
if (Date.now() > this.errorPollTimeout) { if (Date.now() > this.errorPollTimeout) {
this.$apollo.queries.error.stopPolling(); this.$apollo.queries.error.stopPolling();
this.errorLoading = false; this.errorLoading = false;
createFlash(__('Could not connect to Sentry. Refresh the page to try again.'), 'warning'); createFlash({
message: __('Could not connect to Sentry. Refresh the page to try again.'),
type: 'warning',
});
} }
}, },
trackPageViews() { trackPageViews() {
......
<script> <script>
import { GlButton, GlSearchBoxByType } from '@gitlab/ui'; import { GlButton, GlSearchBoxByType } from '@gitlab/ui';
import { debounce } from 'lodash'; import { debounce } from 'lodash';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import createFlash from '~/flash';
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
import { __ } from '~/locale'; import { __ } from '~/locale';
...@@ -87,7 +87,9 @@ export default { ...@@ -87,7 +87,9 @@ export default {
.catch(() => { .catch(() => {
this.isLoading = false; this.isLoading = false;
this.closeSuggestions(); this.closeSuggestions();
createFlash(__('Something went wrong on our end. Please try again.')); createFlash({
message: __('Something went wrong on our end. Please try again.'),
});
}); });
}, 250), }, 250),
/** /**
......
...@@ -8,7 +8,7 @@ import { ...@@ -8,7 +8,7 @@ import {
GlSearchBoxByType, GlSearchBoxByType,
} from '@gitlab/ui'; } from '@gitlab/ui';
import { debounce } from 'lodash'; import { debounce } from 'lodash';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import createFlash from '~/flash';
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
import { __, sprintf } from '~/locale'; import { __, sprintf } from '~/locale';
...@@ -52,7 +52,9 @@ export default { ...@@ -52,7 +52,9 @@ export default {
this.results = data || []; this.results = data || [];
}) })
.catch(() => { .catch(() => {
createFlash(__('Something went wrong on our end. Please try again.')); createFlash({
message: __('Something went wrong on our end. Please try again.'),
});
}) })
.finally(() => { .finally(() => {
this.isLoading = false; this.isLoading = false;
......
<script> <script>
import { GlIcon, GlIntersectionObserver } from '@gitlab/ui'; import { GlIcon, GlIntersectionObserver } from '@gitlab/ui';
import Visibility from 'visibilityjs'; import Visibility from 'visibilityjs';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import createFlash from '~/flash';
import Poll from '~/lib/utils/poll'; import Poll from '~/lib/utils/poll';
import { visitUrl } from '~/lib/utils/url_utility'; import { visitUrl } from '~/lib/utils/url_utility';
import { __, s__, sprintf } from '~/locale'; import { __, s__, sprintf } from '~/locale';
...@@ -316,7 +316,9 @@ export default { ...@@ -316,7 +316,9 @@ export default {
this.store.updateState(data); this.store.updateState(data);
}) })
.catch(() => { .catch(() => {
createFlash(this.defaultErrorMessage); createFlash({
message: this.defaultErrorMessage,
});
}); });
}, },
...@@ -341,7 +343,9 @@ export default { ...@@ -341,7 +343,9 @@ export default {
this.updateAndShowForm(res.data); this.updateAndShowForm(res.data);
}) })
.catch(() => { .catch(() => {
createFlash(this.defaultErrorMessage); createFlash({
message: this.defaultErrorMessage,
});
this.updateAndShowForm(); this.updateAndShowForm();
}); });
}, },
...@@ -406,7 +410,9 @@ export default { ...@@ -406,7 +410,9 @@ export default {
errMsg += `. ${message}`; errMsg += `. ${message}`;
} }
this.flashContainer = createFlash(errMsg); this.flashContainer = createFlash({
message: errMsg,
});
}); });
}, },
...@@ -421,9 +427,11 @@ export default { ...@@ -421,9 +427,11 @@ export default {
visitUrl(data.web_url); visitUrl(data.web_url);
}) })
.catch(() => { .catch(() => {
createFlash( createFlash({
sprintf(s__('Error deleting %{issuableType}'), { issuableType: this.issuableType }), message: sprintf(s__('Error deleting %{issuableType}'), {
); issuableType: this.issuableType,
}),
});
}); });
}, },
......
<script> <script>
import { GlSafeHtmlDirective as SafeHtml } from '@gitlab/ui'; import { GlSafeHtmlDirective as SafeHtml } from '@gitlab/ui';
import $ from 'jquery'; import $ from 'jquery';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import createFlash from '~/flash';
import { s__, sprintf } from '~/locale'; import { s__, sprintf } from '~/locale';
import TaskList from '../../task_list'; import TaskList from '../../task_list';
import animateMixin from '../mixins/animate'; import animateMixin from '../mixins/animate';
...@@ -92,8 +92,8 @@ export default { ...@@ -92,8 +92,8 @@ export default {
}, },
taskListUpdateError() { taskListUpdateError() {
createFlash( createFlash({
sprintf( message: sprintf(
s__( s__(
'Someone edited this %{issueType} at the same time you did. The description has been updated and you will need to make your changes again.', 'Someone edited this %{issueType} at the same time you did. The description has been updated and you will need to make your changes again.',
), ),
...@@ -101,7 +101,7 @@ export default { ...@@ -101,7 +101,7 @@ export default {
issueType: this.issuableType, issueType: this.issuableType,
}, },
), ),
); });
this.$emit('taskListUpdateFailed'); this.$emit('taskListUpdateFailed');
}, },
......
<script> <script>
import { GlBadge, GlLoadingIcon, GlModalDirective, GlIcon, GlTooltip, GlSprintf } from '@gitlab/ui'; import { GlBadge, GlLoadingIcon, GlModalDirective, GlIcon, GlTooltip, GlSprintf } from '@gitlab/ui';
import { values, get } from 'lodash'; import { values, get } from 'lodash';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import createFlash from '~/flash';
import { BV_SHOW_MODAL, BV_HIDE_MODAL } from '~/lib/utils/constants'; import { BV_SHOW_MODAL, BV_HIDE_MODAL } from '~/lib/utils/constants';
import { s__ } from '~/locale'; import { s__ } from '~/locale';
import { OPERATORS } from '../constants'; import { OPERATORS } from '../constants';
...@@ -130,7 +130,9 @@ export default { ...@@ -130,7 +130,9 @@ export default {
this.isLoading = false; this.isLoading = false;
}) })
.catch(() => { .catch(() => {
createFlash(s__('PrometheusAlerts|Error fetching alert')); createFlash({
message: s__('PrometheusAlerts|Error fetching alert'),
});
this.isLoading = false; this.isLoading = false;
}); });
}, },
......
...@@ -3,7 +3,7 @@ import { GlButton, GlModalDirective, GlTooltipDirective, GlIcon } from '@gitlab/ ...@@ -3,7 +3,7 @@ import { GlButton, GlModalDirective, GlTooltipDirective, GlIcon } from '@gitlab/
import Mousetrap from 'mousetrap'; import Mousetrap from 'mousetrap';
import VueDraggable from 'vuedraggable'; import VueDraggable from 'vuedraggable';
import { mapActions, mapState, mapGetters } from 'vuex'; import { mapActions, mapState, mapGetters } from 'vuex';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import createFlash from '~/flash';
import invalidUrl from '~/lib/utils/invalid_url'; import invalidUrl from '~/lib/utils/invalid_url';
import { ESC_KEY } from '~/lib/utils/keys'; import { ESC_KEY } from '~/lib/utils/keys';
import { mergeUrlParams, updateHistory } from '~/lib/utils/url_utility'; import { mergeUrlParams, updateHistory } from '~/lib/utils/url_utility';
...@@ -176,11 +176,11 @@ export default { ...@@ -176,11 +176,11 @@ export default {
this.setExpandedPanel(expandedPanel); this.setExpandedPanel(expandedPanel);
} }
} catch { } catch {
createFlash( createFlash({
s__( message: s__(
'Metrics|Link contains invalid chart information, please verify the link to see the expanded panel.', 'Metrics|Link contains invalid chart information, please verify the link to see the expanded panel.',
), ),
); });
} }
}, },
expandedPanel: { expandedPanel: {
...@@ -201,12 +201,13 @@ export default { ...@@ -201,12 +201,13 @@ export default {
* This watcher is set for future SPA behaviour of the dashboard * This watcher is set for future SPA behaviour of the dashboard
*/ */
if (hasWarnings) { if (hasWarnings) {
createFlash( createFlash({
s__( message: s__(
'Metrics|Your dashboard schema is invalid. Edit the dashboard to correct the YAML schema.', 'Metrics|Your dashboard schema is invalid. Edit the dashboard to correct the YAML schema.',
), ),
'warning',
); type: 'warning',
});
} }
}, },
}, },
...@@ -318,11 +319,11 @@ export default { ...@@ -318,11 +319,11 @@ export default {
this.isRearrangingPanels = isRearrangingPanels; this.isRearrangingPanels = isRearrangingPanels;
}, },
onDateTimePickerInvalid() { onDateTimePickerInvalid() {
createFlash( createFlash({
s__( message: s__(
'Metrics|Link contains an invalid time window, please verify the link to see the requested time range.', 'Metrics|Link contains an invalid time window, please verify the link to see the requested time range.',
), ),
); });
// As a fallback, switch to default time range instead // As a fallback, switch to default time range instead
this.selectedTimeRange = defaultTimeRange; this.selectedTimeRange = defaultTimeRange;
}, },
......
<script> <script>
import { GlModal } from '@gitlab/ui'; import { GlModal } from '@gitlab/ui';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import createFlash from '~/flash';
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
import { redirectTo } from '~/lib/utils/url_utility'; import { redirectTo } from '~/lib/utils/url_utility';
import { __, s__ } from '~/locale'; import { __, s__ } from '~/locale';
...@@ -31,7 +31,9 @@ export default { ...@@ -31,7 +31,9 @@ export default {
redirectTo(response.request.responseURL); redirectTo(response.request.responseURL);
}) })
.catch((error) => { .catch((error) => {
createFlash(s__('AdminArea|Stopping jobs failed')); createFlash({
message: s__('AdminArea|Stopping jobs failed'),
});
throw error; throw error;
}); });
}, },
......
<script> <script>
import { GlModal } from '@gitlab/ui'; import { GlModal } from '@gitlab/ui';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import createFlash from '~/flash';
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
import { visitUrl } from '~/lib/utils/url_utility'; import { visitUrl } from '~/lib/utils/url_utility';
import { s__, sprintf } from '~/locale'; import { s__, sprintf } from '~/locale';
...@@ -63,7 +63,9 @@ export default { ...@@ -63,7 +63,9 @@ export default {
visitUrl(response.data.url); visitUrl(response.data.url);
}) })
.catch((error) => { .catch((error) => {
createFlash(error); createFlash({
message: error,
});
}) })
.finally(() => { .finally(() => {
this.visible = false; this.visible = false;
......
<script> <script>
import { GlTabs, GlTab, GlLoadingIcon, GlSearchBoxByType } from '@gitlab/ui'; import { GlTabs, GlTab, GlLoadingIcon, GlSearchBoxByType } from '@gitlab/ui';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import createFlash from '~/flash';
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
import { __ } from '~/locale'; import { __ } from '~/locale';
import ForkGroupsListItem from './fork_groups_list_item.vue'; import ForkGroupsListItem from './fork_groups_list_item.vue';
...@@ -44,7 +44,11 @@ export default { ...@@ -44,7 +44,11 @@ export default {
.then((response) => { .then((response) => {
this.namespaces = response.data.namespaces; this.namespaces = response.data.namespaces;
}) })
.catch(() => createFlash(__('There was a problem fetching groups.'))); .catch(() =>
createFlash({
message: __('There was a problem fetching groups.'),
}),
);
}, },
}, },
......
<script> <script>
import { GlSprintf, GlModal } from '@gitlab/ui'; import { GlSprintf, GlModal } from '@gitlab/ui';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import createFlash from '~/flash';
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
import { visitUrl } from '~/lib/utils/url_utility'; import { visitUrl } from '~/lib/utils/url_utility';
import { s__, __, sprintf } from '~/locale'; import { s__, __, sprintf } from '~/locale';
...@@ -70,7 +70,9 @@ export default { ...@@ -70,7 +70,9 @@ export default {
labelUrl: this.url, labelUrl: this.url,
successful: false, successful: false,
}); });
createFlash(error); createFlash({
message: error,
});
}); });
}, },
}, },
......
<script> <script>
import { GlTooltipDirective, GlButton, GlLoadingIcon, GlIcon } from '@gitlab/ui'; import { GlTooltipDirective, GlButton, GlLoadingIcon, GlIcon } from '@gitlab/ui';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import createFlash from '~/flash';
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
import { BV_HIDE_TOOLTIP } from '~/lib/utils/constants'; import { BV_HIDE_TOOLTIP } from '~/lib/utils/constants';
import { dasherize } from '~/lib/utils/text_utility'; import { dasherize } from '~/lib/utils/text_utility';
...@@ -81,7 +81,9 @@ export default { ...@@ -81,7 +81,9 @@ export default {
reportToSentry('action_component', err); reportToSentry('action_component', err);
createFlash(__('An error occurred while making the request.')); createFlash({
message: __('An error occurred while making the request.'),
});
}); });
}, },
}, },
......
<script> <script>
import { GlEmptyState, GlIcon, GlLoadingIcon } from '@gitlab/ui'; import { GlEmptyState, GlIcon, GlLoadingIcon } from '@gitlab/ui';
import { isEqual } from 'lodash'; import { isEqual } from 'lodash';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import createFlash from '~/flash';
import { getParameterByName } from '~/lib/utils/common_utils'; import { getParameterByName } from '~/lib/utils/common_utils';
import { __, s__ } from '~/locale'; import { __, s__ } from '~/locale';
import NavigationTabs from '~/vue_shared/components/navigation_tabs.vue'; import NavigationTabs from '~/vue_shared/components/navigation_tabs.vue';
...@@ -249,11 +249,16 @@ export default { ...@@ -249,11 +249,16 @@ export default {
.postAction(endpoint) .postAction(endpoint)
.then(() => { .then(() => {
this.isResetCacheButtonLoading = false; this.isResetCacheButtonLoading = false;
createFlash(s__('Pipelines|Project cache successfully reset.'), 'notice'); createFlash({
message: s__('Pipelines|Project cache successfully reset.'),
type: 'notice',
});
}) })
.catch(() => { .catch(() => {
this.isResetCacheButtonLoading = false; this.isResetCacheButtonLoading = false;
createFlash(s__('Pipelines|Something went wrong while cleaning runners cache.')); createFlash({
message: s__('Pipelines|Something went wrong while cleaning runners cache.'),
});
}); });
}, },
resetRequestData() { resetRequestData() {
...@@ -278,7 +283,10 @@ export default { ...@@ -278,7 +283,10 @@ export default {
} }
if (!filter.type) { if (!filter.type) {
createFlash(RAW_TEXT_WARNING, 'warning'); createFlash({
message: RAW_TEXT_WARNING,
type: 'warning',
});
} }
}); });
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
import { GlFilteredSearchToken, GlFilteredSearchSuggestion, GlLoadingIcon } from '@gitlab/ui'; import { GlFilteredSearchToken, GlFilteredSearchSuggestion, GlLoadingIcon } from '@gitlab/ui';
import { debounce } from 'lodash'; import { debounce } from 'lodash';
import Api from '~/api'; import Api from '~/api';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import createFlash from '~/flash';
import { FETCH_BRANCH_ERROR_MESSAGE, FILTER_PIPELINES_SEARCH_DELAY } from '../../../constants'; import { FETCH_BRANCH_ERROR_MESSAGE, FILTER_PIPELINES_SEARCH_DELAY } from '../../../constants';
export default { export default {
...@@ -38,7 +38,9 @@ export default { ...@@ -38,7 +38,9 @@ export default {
this.loading = false; this.loading = false;
}) })
.catch((err) => { .catch((err) => {
createFlash(FETCH_BRANCH_ERROR_MESSAGE); createFlash({
message: FETCH_BRANCH_ERROR_MESSAGE,
});
this.loading = false; this.loading = false;
throw err; throw err;
}); });
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
import { GlFilteredSearchToken, GlFilteredSearchSuggestion, GlLoadingIcon } from '@gitlab/ui'; import { GlFilteredSearchToken, GlFilteredSearchSuggestion, GlLoadingIcon } from '@gitlab/ui';
import { debounce } from 'lodash'; import { debounce } from 'lodash';
import Api from '~/api'; import Api from '~/api';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import createFlash from '~/flash';
import { FETCH_TAG_ERROR_MESSAGE, FILTER_PIPELINES_SEARCH_DELAY } from '../../../constants'; import { FETCH_TAG_ERROR_MESSAGE, FILTER_PIPELINES_SEARCH_DELAY } from '../../../constants';
export default { export default {
...@@ -38,7 +38,9 @@ export default { ...@@ -38,7 +38,9 @@ export default {
this.loading = false; this.loading = false;
}) })
.catch((err) => { .catch((err) => {
createFlash(FETCH_TAG_ERROR_MESSAGE); createFlash({
message: FETCH_TAG_ERROR_MESSAGE,
});
this.loading = false; this.loading = false;
throw err; throw err;
}); });
......
...@@ -8,7 +8,7 @@ import { ...@@ -8,7 +8,7 @@ import {
} from '@gitlab/ui'; } from '@gitlab/ui';
import { debounce } from 'lodash'; import { debounce } from 'lodash';
import Api from '~/api'; import Api from '~/api';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import createFlash from '~/flash';
import { import {
ANY_TRIGGER_AUTHOR, ANY_TRIGGER_AUTHOR,
FETCH_AUTHOR_ERROR_MESSAGE, FETCH_AUTHOR_ERROR_MESSAGE,
...@@ -61,7 +61,9 @@ export default { ...@@ -61,7 +61,9 @@ export default {
this.loading = false; this.loading = false;
}) })
.catch((err) => { .catch((err) => {
createFlash(FETCH_AUTHOR_ERROR_MESSAGE); createFlash({
message: FETCH_AUTHOR_ERROR_MESSAGE,
});
this.loading = false; this.loading = false;
throw err; throw err;
}); });
......
<script> <script>
/* eslint-disable vue/no-v-html */ /* eslint-disable vue/no-v-html */
import { GlButton, GlFormGroup, GlFormInput, GlModal, GlModalDirective } from '@gitlab/ui'; import { GlButton, GlFormGroup, GlFormInput, GlModal, GlModalDirective } from '@gitlab/ui';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import createFlash from '~/flash';
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
import { __, sprintf } from '~/locale'; import { __, sprintf } from '~/locale';
import ClipboardButton from '~/vue_shared/components/clipboard_button.vue'; import ClipboardButton from '~/vue_shared/components/clipboard_button.vue';
...@@ -65,7 +65,9 @@ export default { ...@@ -65,7 +65,9 @@ export default {
this.authorizationKey = res.data.token; this.authorizationKey = res.data.token;
}) })
.catch(() => { .catch(() => {
createFlash(__('Failed to reset key. Please try again.')); createFlash({
message: __('Failed to reset key. Please try again.'),
});
}); });
}, },
}, },
......
import { find } from 'lodash'; import { find } from 'lodash';
import createFlash from '~/flash';
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
import { __ } from '~/locale'; import { __ } from '~/locale';
import AccessDropdown from '~/projects/settings/access_dropdown'; import AccessDropdown from '~/projects/settings/access_dropdown';
import { deprecatedCreateFlash as flash } from '../flash';
import { ACCESS_LEVELS, LEVEL_TYPES } from './constants'; import { ACCESS_LEVELS, LEVEL_TYPES } from './constants';
export default class ProtectedBranchEdit { export default class ProtectedBranchEdit {
...@@ -64,7 +64,7 @@ export default class ProtectedBranchEdit { ...@@ -64,7 +64,7 @@ export default class ProtectedBranchEdit {
}) })
.then(callback) .then(callback)
.catch(() => { .catch(() => {
flash(__('Failed to update branch!')); createFlash({ message: __('Failed to update branch!') });
}); });
} }
...@@ -131,7 +131,7 @@ export default class ProtectedBranchEdit { ...@@ -131,7 +131,7 @@ export default class ProtectedBranchEdit {
.catch(() => { .catch(() => {
this.$allowedToMergeDropdown.enable(); this.$allowedToMergeDropdown.enable();
this.$allowedToPushDropdown.enable(); this.$allowedToPushDropdown.enable();
flash(__('Failed to update branch!')); createFlash({ message: __('Failed to update branch!') });
}); });
} }
......
<script> <script>
import filesQuery from 'shared_queries/repository/files.query.graphql'; import filesQuery from 'shared_queries/repository/files.query.graphql';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import createFlash from '~/flash';
import { __ } from '../../locale'; import { __ } from '../../locale';
import getRefMixin from '../mixins/get_ref'; import getRefMixin from '../mixins/get_ref';
import projectPathQuery from '../queries/project_path.query.graphql'; import projectPathQuery from '../queries/project_path.query.graphql';
...@@ -114,7 +114,9 @@ export default { ...@@ -114,7 +114,9 @@ export default {
} }
}) })
.catch((error) => { .catch((error) => {
createFlash(__('An error occurred while fetching folder content.')); createFlash({
message: __('An error occurred while fetching folder content.'),
});
throw error; throw error;
}); });
}, },
......
...@@ -13,7 +13,7 @@ import $ from 'jquery'; ...@@ -13,7 +13,7 @@ import $ from 'jquery';
import Vue from 'vue'; import Vue from 'vue';
import GfmAutoComplete from 'ee_else_ce/gfm_auto_complete'; import GfmAutoComplete from 'ee_else_ce/gfm_auto_complete';
import * as Emoji from '~/emoji'; import * as Emoji from '~/emoji';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import createFlash from '~/flash';
import { BV_SHOW_MODAL, BV_HIDE_MODAL } from '~/lib/utils/constants'; import { BV_SHOW_MODAL, BV_HIDE_MODAL } from '~/lib/utils/constants';
import { __, s__, sprintf } from '~/locale'; import { __, s__, sprintf } from '~/locale';
import { updateUserStatus } from '~/rest_api'; import { updateUserStatus } from '~/rest_api';
...@@ -138,7 +138,11 @@ export default { ...@@ -138,7 +138,11 @@ export default {
this.setDefaultEmoji(); this.setDefaultEmoji();
}) })
.catch(() => createFlash(__('Failed to load emoji list.'))); .catch(() =>
createFlash({
message: __('Failed to load emoji list.'),
}),
);
}, },
showEmojiMenu(e) { showEmojiMenu(e) {
e.stopPropagation(); e.stopPropagation();
...@@ -217,9 +221,11 @@ export default { ...@@ -217,9 +221,11 @@ export default {
window.location.reload(); window.location.reload();
}, },
onUpdateFail() { onUpdateFail() {
createFlash( createFlash({
s__("SetStatusModal|Sorry, we weren't able to set your status. Please try again later."), message: s__(
); "SetStatusModal|Sorry, we weren't able to set your status. Please try again later.",
),
});
this.closeModal(); this.closeModal();
}, },
......
<script> <script>
import { deprecatedCreateFlash as createFlash } from '~/flash'; import createFlash from '~/flash';
import Tracking from '~/tracking'; import Tracking from '~/tracking';
import EditArea from '../components/edit_area.vue'; import EditArea from '../components/edit_area.vue';
...@@ -45,7 +45,9 @@ export default { ...@@ -45,7 +45,9 @@ export default {
return !this.appData.isSupportedContent; return !this.appData.isSupportedContent;
}, },
error() { error() {
createFlash(LOAD_CONTENT_ERROR); createFlash({
message: LOAD_CONTENT_ERROR,
});
}, },
}, },
}, },
......
<script> <script>
import { GlButton } from '@gitlab/ui'; import { GlButton } from '@gitlab/ui';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import createFlash from '~/flash';
import { BV_SHOW_MODAL } from '~/lib/utils/constants'; import { BV_SHOW_MODAL } from '~/lib/utils/constants';
import { s__ } from '~/locale'; import { s__ } from '~/locale';
import eventHub from '../../event_hub'; import eventHub from '../../event_hub';
...@@ -120,7 +120,11 @@ export default { ...@@ -120,7 +120,11 @@ export default {
.then(() => { .then(() => {
this.fetchingApprovals = false; this.fetchingApprovals = false;
}) })
.catch(() => createFlash(FETCH_ERROR)); .catch(() =>
createFlash({
message: FETCH_ERROR,
}),
);
}, },
methods: { methods: {
approve() { approve() {
...@@ -131,7 +135,10 @@ export default { ...@@ -131,7 +135,10 @@ export default {
this.updateApproval( this.updateApproval(
() => this.service.approveMergeRequest(), () => this.service.approveMergeRequest(),
() => createFlash(APPROVE_ERROR), () =>
createFlash({
message: APPROVE_ERROR,
}),
); );
}, },
approveWithAuth(data) { approveWithAuth(data) {
...@@ -142,14 +149,19 @@ export default { ...@@ -142,14 +149,19 @@ export default {
this.hasApprovalAuthError = true; this.hasApprovalAuthError = true;
return; return;
} }
createFlash(APPROVE_ERROR); createFlash({
message: APPROVE_ERROR,
});
}, },
); );
}, },
unapprove() { unapprove() {
this.updateApproval( this.updateApproval(
() => this.service.unapproveMergeRequest(), () => this.service.unapproveMergeRequest(),
() => createFlash(UNAPPROVE_ERROR), () =>
createFlash({
message: UNAPPROVE_ERROR,
}),
); );
}, },
updateApproval(serviceFn, errFn) { updateApproval(serviceFn, errFn) {
......
<script> <script>
import { deprecatedCreateFlash as createFlash } from '~/flash'; import createFlash from '~/flash';
import { visitUrl } from '~/lib/utils/url_utility'; import { visitUrl } from '~/lib/utils/url_utility';
import { __, s__ } 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';
...@@ -128,7 +128,9 @@ export default { ...@@ -128,7 +128,9 @@ export default {
} }
}) })
.catch(() => { .catch(() => {
createFlash(errorMessage); createFlash({
message: errorMessage,
});
}) })
.finally(() => { .finally(() => {
this.actionInProgress = null; this.actionInProgress = null;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
import { GlButton } from '@gitlab/ui'; import { GlButton } from '@gitlab/ui';
import { produce } from 'immer'; import { produce } from 'immer';
import $ from 'jquery'; import $ from 'jquery';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import createFlash from '~/flash';
import { __ } from '~/locale'; import { __ } from '~/locale';
import MergeRequest from '~/merge_request'; import MergeRequest from '~/merge_request';
import glFeatureFlagMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; import glFeatureFlagMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
...@@ -76,7 +76,9 @@ export default { ...@@ -76,7 +76,9 @@ export default {
}, },
) { ) {
if (errors?.length) { if (errors?.length) {
createFlash(__('Something went wrong. Please try again.')); createFlash({
message: __('Something went wrong. Please try again.'),
});
return; return;
} }
...@@ -121,11 +123,18 @@ export default { ...@@ -121,11 +123,18 @@ export default {
}, },
}, },
}) => { }) => {
createFlash(__('The merge request can now be merged.'), 'notice'); createFlash({
message: __('The merge request can now be merged.'),
type: 'notice',
});
$('.merge-request .detail-page-description .title').text(title); $('.merge-request .detail-page-description .title').text(title);
}, },
) )
.catch(() => createFlash(__('Something went wrong. Please try again.'))) .catch(() =>
createFlash({
message: __('Something went wrong. Please try again.'),
}),
)
.finally(() => { .finally(() => {
this.isMakingRequest = false; this.isMakingRequest = false;
}); });
...@@ -144,7 +153,9 @@ export default { ...@@ -144,7 +153,9 @@ export default {
}) })
.catch(() => { .catch(() => {
this.isMakingRequest = false; this.isMakingRequest = false;
createFlash(__('Something went wrong. Please try again.')); createFlash({
message: __('Something went wrong. Please try again.'),
});
}); });
} }
}, },
......
...@@ -10,7 +10,7 @@ import notify from '~/lib/utils/notify'; ...@@ -10,7 +10,7 @@ import notify from '~/lib/utils/notify';
import { sprintf, s__, __ } from '~/locale'; import { sprintf, s__, __ } from '~/locale';
import Project from '~/pages/projects/project'; import Project from '~/pages/projects/project';
import SmartInterval from '~/smart_interval'; import SmartInterval from '~/smart_interval';
import { deprecatedCreateFlash as createFlash } from '../flash'; import createFlash from '../flash';
import { setFaviconOverlay } from '../lib/utils/favicon'; import { setFaviconOverlay } from '../lib/utils/favicon';
import GroupedAccessibilityReportsApp from '../reports/accessibility_report/grouped_accessibility_reports_app.vue'; import GroupedAccessibilityReportsApp from '../reports/accessibility_report/grouped_accessibility_reports_app.vue';
import GroupedCodequalityReportsApp from '../reports/codequality_report/grouped_codequality_reports_app.vue'; import GroupedCodequalityReportsApp from '../reports/codequality_report/grouped_codequality_reports_app.vue';
...@@ -217,7 +217,9 @@ export default { ...@@ -217,7 +217,9 @@ export default {
this.initWidget(data); this.initWidget(data);
}) })
.catch(() => .catch(() =>
createFlash(__('Unable to load the merge request widget. Try reloading the page.')), createFlash({
message: __('Unable to load the merge request widget. Try reloading the page.'),
}),
); );
}, },
beforeDestroy() { beforeDestroy() {
...@@ -298,7 +300,11 @@ export default { ...@@ -298,7 +300,11 @@ export default {
cb.call(null, data); cb.call(null, data);
} }
}) })
.catch(() => createFlash(__('Something went wrong. Please try again.'))); .catch(() =>
createFlash({
message: __('Something went wrong. Please try again.'),
}),
);
}, },
setFaviconHelper() { setFaviconHelper() {
if (this.mr.ciStatusFaviconPath) { if (this.mr.ciStatusFaviconPath) {
...@@ -352,11 +358,11 @@ export default { ...@@ -352,11 +358,11 @@ export default {
.catch(() => this.throwDeploymentsError()); .catch(() => this.throwDeploymentsError());
}, },
throwDeploymentsError() { throwDeploymentsError() {
createFlash( createFlash({
__( message: __(
'Something went wrong while fetching the environments for this merge request. Please try again.', 'Something went wrong while fetching the environments for this merge request. Please try again.',
), ),
); });
}, },
fetchActionsContent() { fetchActionsContent() {
this.service this.service
...@@ -370,7 +376,11 @@ export default { ...@@ -370,7 +376,11 @@ export default {
Project.initRefSwitcher(); Project.initRefSwitcher();
} }
}) })
.catch(() => createFlash(__('Something went wrong. Please try again.'))); .catch(() =>
createFlash({
message: __('Something went wrong. Please try again.'),
}),
);
}, },
handleNotification(data) { handleNotification(data) {
if (data.ci_status === this.mr.ciStatus) return; if (data.ci_status === this.mr.ciStatus) return;
......
...@@ -12,7 +12,7 @@ import { ...@@ -12,7 +12,7 @@ import {
import RecentSearchesStorageKeys from 'ee_else_ce/filtered_search/recent_searches_storage_keys'; import RecentSearchesStorageKeys from 'ee_else_ce/filtered_search/recent_searches_storage_keys';
import RecentSearchesService from '~/filtered_search/services/recent_searches_service'; import RecentSearchesService from '~/filtered_search/services/recent_searches_service';
import RecentSearchesStore from '~/filtered_search/stores/recent_searches_store'; import RecentSearchesStore from '~/filtered_search/stores/recent_searches_store';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import createFlash from '~/flash';
import { __ } from '~/locale'; import { __ } from '~/locale';
import { SortDirection } from './constants'; import { SortDirection } from './constants';
...@@ -211,7 +211,9 @@ export default { ...@@ -211,7 +211,9 @@ export default {
.catch((error) => { .catch((error) => {
if (error.name === 'RecentSearchesServiceError') return undefined; if (error.name === 'RecentSearchesServiceError') return undefined;
createFlash(__('An error occurred while parsing recent searches')); createFlash({
message: __('An error occurred while parsing recent searches'),
});
// Gracefully fail to empty array // Gracefully fail to empty array
return []; return [];
......
...@@ -8,7 +8,7 @@ import { ...@@ -8,7 +8,7 @@ import {
} from '@gitlab/ui'; } from '@gitlab/ui';
import { debounce } from 'lodash'; import { debounce } from 'lodash';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import createFlash from '~/flash';
import { __ } from '~/locale'; import { __ } from '~/locale';
import { DEFAULT_LABEL_ANY, DEBOUNCE_DELAY } from '../constants'; import { DEFAULT_LABEL_ANY, DEBOUNCE_DELAY } from '../constants';
...@@ -80,7 +80,11 @@ export default { ...@@ -80,7 +80,11 @@ export default {
// return response differently. // return response differently.
this.authors = Array.isArray(res) ? res : res.data; this.authors = Array.isArray(res) ? res : res.data;
}) })
.catch(() => createFlash(__('There was a problem fetching users.'))) .catch(() =>
createFlash({
message: __('There was a problem fetching users.'),
}),
)
.finally(() => { .finally(() => {
this.loading = false; this.loading = false;
}); });
......
...@@ -7,7 +7,7 @@ import { ...@@ -7,7 +7,7 @@ import {
} from '@gitlab/ui'; } from '@gitlab/ui';
import { debounce } from 'lodash'; import { debounce } from 'lodash';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import createFlash from '~/flash';
import { __ } from '~/locale'; import { __ } from '~/locale';
import { DEBOUNCE_DELAY, DEFAULT_NONE_ANY } from '../constants'; import { DEBOUNCE_DELAY, DEFAULT_NONE_ANY } from '../constants';
...@@ -65,7 +65,11 @@ export default { ...@@ -65,7 +65,11 @@ export default {
.then((res) => { .then((res) => {
this.emojis = Array.isArray(res) ? res : res.data; this.emojis = Array.isArray(res) ? res : res.data;
}) })
.catch(() => createFlash(__('There was a problem fetching emojis.'))) .catch(() =>
createFlash({
message: __('There was a problem fetching emojis.'),
}),
)
.finally(() => { .finally(() => {
this.loading = false; this.loading = false;
}); });
......
<script> <script>
import { GlToken, GlFilteredSearchSuggestion } from '@gitlab/ui'; import { GlToken, GlFilteredSearchSuggestion } from '@gitlab/ui';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import createFlash from '~/flash';
import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils'; import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils';
import { __ } from '~/locale'; import { __ } from '~/locale';
...@@ -78,7 +78,11 @@ export default { ...@@ -78,7 +78,11 @@ export default {
// return response differently. // return response differently.
this.labels = Array.isArray(res) ? res : res.data; this.labels = Array.isArray(res) ? res : res.data;
}) })
.catch(() => createFlash(__('There was a problem fetching labels.'))) .catch(() =>
createFlash({
message: __('There was a problem fetching labels.'),
}),
)
.finally(() => { .finally(() => {
this.loading = false; this.loading = false;
}); });
......
import MockAdapter from 'axios-mock-adapter'; import MockAdapter from 'axios-mock-adapter';
import $ from 'jquery'; import $ from 'jquery';
import { TEST_HOST } from 'helpers/test_constants'; import { TEST_HOST } from 'helpers/test_constants';
import { deprecatedCreateFlash as flash } from '~/flash'; import createFlash from '~/flash';
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
import ProtectedBranchEdit from '~/protected_branches/protected_branch_edit'; import ProtectedBranchEdit from '~/protected_branches/protected_branch_edit';
...@@ -71,7 +71,7 @@ describe('EE ProtectedBranchEdit', () => { ...@@ -71,7 +71,7 @@ describe('EE ProtectedBranchEdit', () => {
expect(mock.history.patch).toHaveLength(1); expect(mock.history.patch).toHaveLength(1);
expect(toggle).not.toBeDisabled(); expect(toggle).not.toBeDisabled();
expect(flash).not.toHaveBeenCalled(); expect(createFlash).not.toHaveBeenCalled();
})); }));
}); });
...@@ -83,7 +83,7 @@ describe('EE ProtectedBranchEdit', () => { ...@@ -83,7 +83,7 @@ describe('EE ProtectedBranchEdit', () => {
it('flashes error', () => it('flashes error', () =>
axios.waitForAll().then(() => { axios.waitForAll().then(() => {
expect(flash).toHaveBeenCalled(); expect(createFlash).toHaveBeenCalled();
})); }));
}); });
}); });
......
...@@ -3,7 +3,7 @@ import { shallowMount } from '@vue/test-utils'; ...@@ -3,7 +3,7 @@ import { shallowMount } from '@vue/test-utils';
import Approvals from 'ee/vue_merge_request_widget/components/approvals/approvals.vue'; import Approvals from 'ee/vue_merge_request_widget/components/approvals/approvals.vue';
import ApprovalsAuth from 'ee/vue_merge_request_widget/components/approvals/approvals_auth.vue'; import ApprovalsAuth from 'ee/vue_merge_request_widget/components/approvals/approvals_auth.vue';
import ApprovalsFooter from 'ee/vue_merge_request_widget/components/approvals/approvals_footer.vue'; import ApprovalsFooter from 'ee/vue_merge_request_widget/components/approvals/approvals_footer.vue';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import createFlash from '~/flash';
import ApprovalsFoss from '~/vue_merge_request_widget/components/approvals/approvals.vue'; import ApprovalsFoss from '~/vue_merge_request_widget/components/approvals/approvals.vue';
import ApprovalsSummary from '~/vue_merge_request_widget/components/approvals/approvals_summary.vue'; import ApprovalsSummary from '~/vue_merge_request_widget/components/approvals/approvals_summary.vue';
import ApprovalsSummaryOptional from '~/vue_merge_request_widget/components/approvals/approvals_summary_optional.vue'; import ApprovalsSummaryOptional from '~/vue_merge_request_widget/components/approvals/approvals_summary_optional.vue';
...@@ -147,7 +147,7 @@ describe('EE MRWidget approvals', () => { ...@@ -147,7 +147,7 @@ describe('EE MRWidget approvals', () => {
}); });
it('flashes error', () => { it('flashes error', () => {
expect(createFlash).toHaveBeenCalledWith(FETCH_ERROR); expect(createFlash).toHaveBeenCalledWith({ message: FETCH_ERROR });
}); });
}); });
...@@ -302,7 +302,7 @@ describe('EE MRWidget approvals', () => { ...@@ -302,7 +302,7 @@ describe('EE MRWidget approvals', () => {
}); });
it('flashes error message', () => { it('flashes error message', () => {
expect(createFlash).toHaveBeenCalledWith(APPROVE_ERROR); expect(createFlash).toHaveBeenCalledWith({ message: APPROVE_ERROR });
}); });
}); });
}); });
...@@ -355,7 +355,7 @@ describe('EE MRWidget approvals', () => { ...@@ -355,7 +355,7 @@ describe('EE MRWidget approvals', () => {
}); });
it('shows flash if general error', () => { it('shows flash if general error', () => {
expect(createFlash).toHaveBeenCalledWith(APPROVE_ERROR); expect(createFlash).toHaveBeenCalledWith({ message: APPROVE_ERROR });
}); });
}); });
}); });
...@@ -414,7 +414,7 @@ describe('EE MRWidget approvals', () => { ...@@ -414,7 +414,7 @@ describe('EE MRWidget approvals', () => {
}); });
it('flashes error message', () => { it('flashes error message', () => {
expect(createFlash).toHaveBeenCalledWith(UNAPPROVE_ERROR); expect(createFlash).toHaveBeenCalledWith({ message: UNAPPROVE_ERROR });
}); });
}); });
}); });
......
...@@ -21,7 +21,7 @@ import { ...@@ -21,7 +21,7 @@ import {
trackErrorDetailsViewsOptions, trackErrorDetailsViewsOptions,
trackErrorStatusUpdateOptions, trackErrorStatusUpdateOptions,
} from '~/error_tracking/utils'; } from '~/error_tracking/utils';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import createFlash from '~/flash';
import { __ } from '~/locale'; import { __ } from '~/locale';
import Tracking from '~/tracking'; import Tracking from '~/tracking';
...@@ -160,10 +160,10 @@ describe('ErrorDetails', () => { ...@@ -160,10 +160,10 @@ describe('ErrorDetails', () => {
return wrapper.vm.$nextTick().then(() => { return wrapper.vm.$nextTick().then(() => {
expect(wrapper.find(GlLoadingIcon).exists()).toBe(false); expect(wrapper.find(GlLoadingIcon).exists()).toBe(false);
expect(wrapper.find(GlLink).exists()).toBe(false); expect(wrapper.find(GlLink).exists()).toBe(false);
expect(createFlash).toHaveBeenCalledWith( expect(createFlash).toHaveBeenCalledWith({
'Could not connect to Sentry. Refresh the page to try again.', message: 'Could not connect to Sentry. Refresh the page to try again.',
'warning', type: 'warning',
); });
expect(mocks.$apollo.queries.error.stopPolling).toHaveBeenCalled(); expect(mocks.$apollo.queries.error.stopPolling).toHaveBeenCalled();
}); });
}); });
......
import { GlLoadingIcon, GlTooltip, GlSprintf, GlBadge } from '@gitlab/ui'; import { GlLoadingIcon, GlTooltip, GlSprintf, GlBadge } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import waitForPromises from 'helpers/wait_for_promises'; import waitForPromises from 'helpers/wait_for_promises';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import createFlash from '~/flash';
import AlertWidget from '~/monitoring/components/alert_widget.vue'; import AlertWidget from '~/monitoring/components/alert_widget.vue';
const mockReadAlert = jest.fn(); const mockReadAlert = jest.fn();
......
...@@ -3,7 +3,7 @@ import { shallowMount, mount } from '@vue/test-utils'; ...@@ -3,7 +3,7 @@ import { shallowMount, mount } from '@vue/test-utils';
import MockAdapter from 'axios-mock-adapter'; import MockAdapter from 'axios-mock-adapter';
import VueDraggable from 'vuedraggable'; import VueDraggable from 'vuedraggable';
import { TEST_HOST } from 'helpers/test_constants'; import { TEST_HOST } from 'helpers/test_constants';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import createFlash from '~/flash';
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
import { ESC_KEY } from '~/lib/utils/keys'; import { ESC_KEY } from '~/lib/utils/keys';
import { objectToQuery } from '~/lib/utils/url_utility'; import { objectToQuery } from '~/lib/utils/url_utility';
......
import { mount } from '@vue/test-utils'; import { mount } from '@vue/test-utils';
import MockAdapter from 'axios-mock-adapter'; import MockAdapter from 'axios-mock-adapter';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import createFlash from '~/flash';
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
import { import {
queryToObject, queryToObject,
......
...@@ -3,7 +3,7 @@ import { shallowMount } from '@vue/test-utils'; ...@@ -3,7 +3,7 @@ import { shallowMount } from '@vue/test-utils';
import { setHTMLFixture } from 'helpers/fixtures'; import { setHTMLFixture } from 'helpers/fixtures';
import { TEST_HOST } from 'helpers/test_constants'; import { TEST_HOST } from 'helpers/test_constants';
import waitForPromises from 'helpers/wait_for_promises'; import waitForPromises from 'helpers/wait_for_promises';
import * as flash from '~/flash'; import createFlash from '~/flash';
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
import * as urlUtils from '~/lib/utils/url_utility'; import * as urlUtils from '~/lib/utils/url_utility';
import PromoteMilestoneModal from '~/pages/milestones/shared/components/promote_milestone_modal.vue'; import PromoteMilestoneModal from '~/pages/milestones/shared/components/promote_milestone_modal.vue';
...@@ -103,7 +103,7 @@ describe('Promote milestone modal', () => { ...@@ -103,7 +103,7 @@ describe('Promote milestone modal', () => {
wrapper.findComponent(GlModal).vm.$emit('primary'); wrapper.findComponent(GlModal).vm.$emit('primary');
await waitForPromises(); await waitForPromises();
expect(flash.deprecatedCreateFlash).toHaveBeenCalledWith(dummyError); expect(createFlash).toHaveBeenCalledWith({ message: dummyError });
}); });
}); });
}); });
...@@ -3,7 +3,7 @@ import { shallowMount } from '@vue/test-utils'; ...@@ -3,7 +3,7 @@ import { shallowMount } from '@vue/test-utils';
import AxiosMockAdapter from 'axios-mock-adapter'; import AxiosMockAdapter from 'axios-mock-adapter';
import { nextTick } from 'vue'; import { nextTick } from 'vue';
import waitForPromises from 'helpers/wait_for_promises'; import waitForPromises from 'helpers/wait_for_promises';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import createFlash from '~/flash';
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
import ForkGroupsList from '~/pages/projects/forks/new/components/fork_groups_list.vue'; import ForkGroupsList from '~/pages/projects/forks/new/components/fork_groups_list.vue';
import ForkGroupsListItem from '~/pages/projects/forks/new/components/fork_groups_list_item.vue'; import ForkGroupsListItem from '~/pages/projects/forks/new/components/fork_groups_list_item.vue';
......
...@@ -8,7 +8,7 @@ import { extendedWrapper } from 'helpers/vue_test_utils_helper'; ...@@ -8,7 +8,7 @@ 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 { getExperimentVariant } from '~/experimentation/utils'; import { getExperimentVariant } from '~/experimentation/utils';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import createFlash from '~/flash';
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
import NavigationControls from '~/pipelines/components/pipelines_list/nav_controls.vue'; import NavigationControls from '~/pipelines/components/pipelines_list/nav_controls.vue';
import PipelinesComponent from '~/pipelines/components/pipelines_list/pipelines.vue'; import PipelinesComponent from '~/pipelines/components/pipelines_list/pipelines.vue';
...@@ -349,7 +349,7 @@ describe('Pipelines', () => { ...@@ -349,7 +349,7 @@ describe('Pipelines', () => {
it('displays a warning message if raw text search is used', () => { it('displays a warning message if raw text search is used', () => {
expect(createFlash).toHaveBeenCalledTimes(1); expect(createFlash).toHaveBeenCalledTimes(1);
expect(createFlash).toHaveBeenCalledWith(RAW_TEXT_WARNING, 'warning'); expect(createFlash).toHaveBeenCalledWith({ message: RAW_TEXT_WARNING, type: 'warning' });
}); });
it('should update browser bar', () => { it('should update browser bar', () => {
......
import MockAdapter from 'axios-mock-adapter'; import MockAdapter from 'axios-mock-adapter';
import $ from 'jquery'; import $ from 'jquery';
import { TEST_HOST } from 'helpers/test_constants'; import { TEST_HOST } from 'helpers/test_constants';
import { deprecatedCreateFlash as flash } from '~/flash'; import createFlash from '~/flash';
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
import ProtectedBranchEdit from '~/protected_branches/protected_branch_edit'; import ProtectedBranchEdit from '~/protected_branches/protected_branch_edit';
...@@ -69,7 +69,7 @@ describe('ProtectedBranchEdit', () => { ...@@ -69,7 +69,7 @@ describe('ProtectedBranchEdit', () => {
expect(mock.history.patch).toHaveLength(1); expect(mock.history.patch).toHaveLength(1);
expect(toggle).not.toBeDisabled(); expect(toggle).not.toBeDisabled();
expect(flash).not.toHaveBeenCalled(); expect(createFlash).not.toHaveBeenCalled();
})); }));
}); });
...@@ -81,7 +81,7 @@ describe('ProtectedBranchEdit', () => { ...@@ -81,7 +81,7 @@ describe('ProtectedBranchEdit', () => {
it('flashes error', () => it('flashes error', () =>
axios.waitForAll().then(() => { axios.waitForAll().then(() => {
expect(flash).toHaveBeenCalled(); expect(createFlash).toHaveBeenCalled();
})); }));
}); });
}); });
......
...@@ -3,7 +3,7 @@ import { shallowMount } from '@vue/test-utils'; ...@@ -3,7 +3,7 @@ import { shallowMount } from '@vue/test-utils';
import { initEmojiMock } from 'helpers/emoji'; import { initEmojiMock } from 'helpers/emoji';
import * as UserApi from '~/api/user_api'; import * as UserApi from '~/api/user_api';
import EmojiPicker from '~/emoji/components/picker.vue'; import EmojiPicker from '~/emoji/components/picker.vue';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import createFlash from '~/flash';
import SetStatusModalWrapper, { import SetStatusModalWrapper, {
AVAILABILITY_STATUS, AVAILABILITY_STATUS,
} from '~/set_status_modal/set_status_modal_wrapper.vue'; } from '~/set_status_modal/set_status_modal_wrapper.vue';
...@@ -289,9 +289,9 @@ describe('SetStatusModalWrapper', () => { ...@@ -289,9 +289,9 @@ describe('SetStatusModalWrapper', () => {
findModal().vm.$emit('ok'); findModal().vm.$emit('ok');
await wrapper.vm.$nextTick(); await wrapper.vm.$nextTick();
expect(createFlash).toHaveBeenCalledWith( expect(createFlash).toHaveBeenCalledWith({
"Sorry, we weren't able to set your status. Please try again later.", message: "Sorry, we weren't able to set your status. Please try again later.",
); });
}); });
}); });
}); });
......
import { GlButton } from '@gitlab/ui'; import { GlButton } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import createFlash from '~/flash';
import Approvals from '~/vue_merge_request_widget/components/approvals/approvals.vue'; import Approvals from '~/vue_merge_request_widget/components/approvals/approvals.vue';
import ApprovalsSummary from '~/vue_merge_request_widget/components/approvals/approvals_summary.vue'; import ApprovalsSummary from '~/vue_merge_request_widget/components/approvals/approvals_summary.vue';
import ApprovalsSummaryOptional from '~/vue_merge_request_widget/components/approvals/approvals_summary_optional.vue'; import ApprovalsSummaryOptional from '~/vue_merge_request_widget/components/approvals/approvals_summary_optional.vue';
...@@ -125,7 +125,7 @@ describe('MRWidget approvals', () => { ...@@ -125,7 +125,7 @@ describe('MRWidget approvals', () => {
}); });
it('flashes error', () => { it('flashes error', () => {
expect(createFlash).toHaveBeenCalledWith(FETCH_ERROR); expect(createFlash).toHaveBeenCalledWith({ message: FETCH_ERROR });
}); });
}); });
...@@ -264,7 +264,7 @@ describe('MRWidget approvals', () => { ...@@ -264,7 +264,7 @@ describe('MRWidget approvals', () => {
}); });
it('flashes error message', () => { it('flashes error message', () => {
expect(createFlash).toHaveBeenCalledWith(APPROVE_ERROR); expect(createFlash).toHaveBeenCalledWith({ message: APPROVE_ERROR });
}); });
}); });
}); });
...@@ -315,7 +315,7 @@ describe('MRWidget approvals', () => { ...@@ -315,7 +315,7 @@ describe('MRWidget approvals', () => {
}); });
it('flashes error message', () => { it('flashes error message', () => {
expect(createFlash).toHaveBeenCalledWith(UNAPPROVE_ERROR); expect(createFlash).toHaveBeenCalledWith({ message: UNAPPROVE_ERROR });
}); });
}); });
}); });
......
import { mount } from '@vue/test-utils'; import { mount } from '@vue/test-utils';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import createFlash from '~/flash';
import { visitUrl } from '~/lib/utils/url_utility'; import { visitUrl } from '~/lib/utils/url_utility';
import { import {
CREATED, CREATED,
...@@ -203,9 +203,9 @@ describe('DeploymentAction component', () => { ...@@ -203,9 +203,9 @@ describe('DeploymentAction component', () => {
it('should call createFlash with error message', () => { it('should call createFlash with error message', () => {
expect(createFlash).toHaveBeenCalled(); expect(createFlash).toHaveBeenCalled();
expect(createFlash).toHaveBeenCalledWith( expect(createFlash).toHaveBeenCalledWith({
actionButtonMocks[configConst].errorMessage, message: actionButtonMocks[configConst].errorMessage,
); });
}); });
}); });
}); });
......
...@@ -8,7 +8,7 @@ import { ...@@ -8,7 +8,7 @@ import {
import { mount } from '@vue/test-utils'; import { mount } from '@vue/test-utils';
import MockAdapter from 'axios-mock-adapter'; import MockAdapter from 'axios-mock-adapter';
import waitForPromises from 'helpers/wait_for_promises'; import waitForPromises from 'helpers/wait_for_promises';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import createFlash from '~/flash';
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
import { import {
...@@ -137,7 +137,9 @@ describe('AuthorToken', () => { ...@@ -137,7 +137,9 @@ describe('AuthorToken', () => {
wrapper.vm.fetchAuthorBySearchTerm('root'); wrapper.vm.fetchAuthorBySearchTerm('root');
return waitForPromises().then(() => { return waitForPromises().then(() => {
expect(createFlash).toHaveBeenCalledWith('There was a problem fetching users.'); expect(createFlash).toHaveBeenCalledWith({
message: 'There was a problem fetching users.',
});
}); });
}); });
......
...@@ -7,7 +7,7 @@ import { ...@@ -7,7 +7,7 @@ import {
import { mount } from '@vue/test-utils'; import { mount } from '@vue/test-utils';
import MockAdapter from 'axios-mock-adapter'; import MockAdapter from 'axios-mock-adapter';
import waitForPromises from 'helpers/wait_for_promises'; import waitForPromises from 'helpers/wait_for_promises';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import createFlash from '~/flash';
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
import { import {
...@@ -121,7 +121,9 @@ describe('EmojiToken', () => { ...@@ -121,7 +121,9 @@ describe('EmojiToken', () => {
wrapper.vm.fetchEmojiBySearchTerm('foo'); wrapper.vm.fetchEmojiBySearchTerm('foo');
return waitForPromises().then(() => { return waitForPromises().then(() => {
expect(createFlash).toHaveBeenCalledWith('There was a problem fetching emojis.'); expect(createFlash).toHaveBeenCalledWith({
message: 'There was a problem fetching emojis.',
});
}); });
}); });
......
...@@ -10,7 +10,7 @@ import { ...@@ -10,7 +10,7 @@ import {
mockRegularLabel, mockRegularLabel,
mockLabels, mockLabels,
} from 'jest/vue_shared/components/sidebar/labels_select_vue/mock_data'; } from 'jest/vue_shared/components/sidebar/labels_select_vue/mock_data';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import createFlash from '~/flash';
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
import { import {
...@@ -121,7 +121,9 @@ describe('LabelToken', () => { ...@@ -121,7 +121,9 @@ describe('LabelToken', () => {
wrapper.vm.fetchLabelBySearchTerm('foo'); wrapper.vm.fetchLabelBySearchTerm('foo');
return waitForPromises().then(() => { return waitForPromises().then(() => {
expect(createFlash).toHaveBeenCalledWith('There was a problem fetching labels.'); expect(createFlash).toHaveBeenCalledWith({
message: 'There was a problem fetching labels.',
});
}); });
}); });
......
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