Commit 3c7fea32 authored by Kushal Pandya's avatar Kushal Pandya

Merge branch '3895-mlunoe-migrate-away-from-deprecated-create-flash' into 'master'

Refactor(createFlash): use non-deprecated function

See merge request gitlab-org/gitlab!55549
parents 5eabe70d 0d11dfee
<script> <script>
/* eslint-disable @gitlab/vue-require-i18n-strings */ /* eslint-disable @gitlab/vue-require-i18n-strings */
import { GlButton, GlIcon } from '@gitlab/ui'; import { GlButton, GlIcon } from '@gitlab/ui';
import { deprecatedCreateFlash as Flash } from '~/flash'; import createFlash from '~/flash';
import { redirectTo } from '~/lib/utils/url_utility'; import { redirectTo } from '~/lib/utils/url_utility';
import { __ } from '~/locale'; import { __ } from '~/locale';
...@@ -77,7 +77,11 @@ export default { ...@@ -77,7 +77,11 @@ export default {
addToSlack() { addToSlack() {
GitlabSlackService.addToSlack(this.slackLinkPath, this.selectedProjectId) GitlabSlackService.addToSlack(this.slackLinkPath, this.selectedProjectId)
.then((response) => redirectTo(response.data.add_to_slack_link)) .then((response) => redirectTo(response.data.add_to_slack_link))
.catch(() => Flash(__('Unable to build Slack link.'))); .catch(() =>
createFlash({
message: __('Unable to build Slack link.'),
}),
);
}, },
}, },
}; };
......
import API from 'ee/api'; import API from 'ee/api';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import createFlash from '~/flash';
import { normalizeHeaders, parseIntPagination } from '~/lib/utils/common_utils'; import { normalizeHeaders, parseIntPagination } from '~/lib/utils/common_utils';
import { __ } from '~/locale'; import { __ } from '~/locale';
import { filterToQueryObject } from '~/vue_shared/components/filtered_search_bar/filtered_search_utils'; import { filterToQueryObject } from '~/vue_shared/components/filtered_search_bar/filtered_search_utils';
...@@ -40,7 +40,9 @@ export const fetchMergeRequests = ({ commit, state, rootState }) => { ...@@ -40,7 +40,9 @@ export const fetchMergeRequests = ({ commit, state, rootState }) => {
.catch(({ response }) => { .catch(({ response }) => {
const { status } = response; const { status } = response;
commit(types.RECEIVE_MERGE_REQUESTS_ERROR, status); commit(types.RECEIVE_MERGE_REQUESTS_ERROR, status);
createFlash(__('An error occurred while loading merge requests.')); createFlash({
message: __('An error occurred while loading merge requests.'),
});
}); });
}; };
......
...@@ -10,7 +10,7 @@ import { ...@@ -10,7 +10,7 @@ import {
import { debounce } from 'lodash'; import { debounce } from 'lodash';
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import Api from 'ee/api'; import Api from 'ee/api';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import createFlash from '~/flash';
import { __ } from '~/locale'; import { __ } from '~/locale';
import { DATA_REFETCH_DELAY } from '../../shared/constants'; import { DATA_REFETCH_DELAY } from '../../shared/constants';
import { removeFlash } from '../utils'; import { removeFlash } from '../utils';
...@@ -104,7 +104,9 @@ export default { ...@@ -104,7 +104,9 @@ export default {
this.labels = data; this.labels = data;
}) })
.catch(() => { .catch(() => {
createFlash(__('There was an error fetching label data for the selected group')); createFlash({
message: __('There was an error fetching label data for the selected group'),
});
}) })
.finally(() => { .finally(() => {
this.loading = false; this.loading = false;
......
<script> <script>
import { GlDropdownDivider, GlSegmentedControl, GlIcon, GlSprintf } from '@gitlab/ui'; import { GlDropdownDivider, GlSegmentedControl, GlIcon, GlSprintf } from '@gitlab/ui';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import createFlash from '~/flash';
import { s__, sprintf } from '~/locale'; import { s__, sprintf } from '~/locale';
import { import {
TASKS_BY_TYPE_FILTERS, TASKS_BY_TYPE_FILTERS,
...@@ -74,7 +74,10 @@ export default { ...@@ -74,7 +74,10 @@ export default {
s__('CycleAnalytics|Only %{maxLabels} labels can be selected at this time'), s__('CycleAnalytics|Only %{maxLabels} labels can be selected at this time'),
{ maxLabels }, { maxLabels },
); );
createFlash(message, 'notice'); createFlash({
message,
type: 'notice',
});
} }
}, },
}, },
......
<script> <script>
import Api from 'ee/api'; import Api from 'ee/api';
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 { sprintf, __, s__ } from '~/locale'; import { sprintf, __, s__ } from '~/locale';
import { OVERVIEW_METRICS } from '../constants'; import { OVERVIEW_METRICS } from '../constants';
import { removeFlash, prepareTimeMetricsData } from '../utils'; import { removeFlash, prepareTimeMetricsData } from '../utils';
...@@ -65,14 +65,14 @@ export default { ...@@ -65,14 +65,14 @@ export default {
this.requestType === OVERVIEW_METRICS.TIME_SUMMARY this.requestType === OVERVIEW_METRICS.TIME_SUMMARY
? __('time summary') ? __('time summary')
: __('recent activity'); : __('recent activity');
createFlash( createFlash({
sprintf( message: sprintf(
s__( s__(
'There was an error while fetching value stream analytics %{requestTypeName} data.', 'There was an error while fetching value stream analytics %{requestTypeName} data.',
), ),
{ requestTypeName }, { requestTypeName },
), ),
); });
}) })
.finally(() => { .finally(() => {
this.loading = false; this.loading = false;
......
import Api from 'ee/api'; import Api from 'ee/api';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import createFlash from '~/flash';
import httpStatus from '~/lib/utils/http_status'; import httpStatus from '~/lib/utils/http_status';
import { __, sprintf } from '~/locale'; import { __, sprintf } from '~/locale';
import { FETCH_VALUE_STREAM_DATA, OVERVIEW_STAGE_CONFIG } from '../constants'; import { FETCH_VALUE_STREAM_DATA, OVERVIEW_STAGE_CONFIG } from '../constants';
...@@ -72,7 +72,9 @@ export const requestStageMedianValues = ({ commit }) => commit(types.REQUEST_STA ...@@ -72,7 +72,9 @@ export const requestStageMedianValues = ({ commit }) => commit(types.REQUEST_STA
export const receiveStageMedianValuesError = ({ commit }, error) => { export const receiveStageMedianValuesError = ({ commit }, error) => {
commit(types.RECEIVE_STAGE_MEDIANS_ERROR, error); commit(types.RECEIVE_STAGE_MEDIANS_ERROR, error);
createFlash(__('There was an error fetching median data for stages')); createFlash({
message: __('There was an error fetching median data for stages'),
});
}; };
const fetchStageMedian = ({ groupId, valueStreamId, stageId, params }) => const fetchStageMedian = ({ groupId, valueStreamId, stageId, params }) =>
...@@ -124,7 +126,9 @@ export const receiveCycleAnalyticsDataError = ({ commit }, { response = {} }) => ...@@ -124,7 +126,9 @@ export const receiveCycleAnalyticsDataError = ({ commit }, { response = {} }) =>
commit(types.RECEIVE_VALUE_STREAM_DATA_ERROR, status); commit(types.RECEIVE_VALUE_STREAM_DATA_ERROR, status);
if (status !== httpStatus.FORBIDDEN) { if (status !== httpStatus.FORBIDDEN) {
createFlash(__('There was an error while fetching value stream analytics data.')); createFlash({
message: __('There was an error while fetching value stream analytics data.'),
});
} }
}; };
...@@ -148,7 +152,9 @@ export const requestGroupStages = ({ commit }) => commit(types.REQUEST_GROUP_STA ...@@ -148,7 +152,9 @@ export const requestGroupStages = ({ commit }) => commit(types.REQUEST_GROUP_STA
export const receiveGroupStagesError = ({ commit }, error) => { export const receiveGroupStagesError = ({ commit }, error) => {
commit(types.RECEIVE_GROUP_STAGES_ERROR, error); commit(types.RECEIVE_GROUP_STAGES_ERROR, error);
createFlash(__('There was an error fetching value stream analytics stages.')); createFlash({
message: __('There was an error fetching value stream analytics stages.'),
});
}; };
export const setDefaultSelectedStage = ({ dispatch, getters, state: { featureFlags } = {} }) => { export const setDefaultSelectedStage = ({ dispatch, getters, state: { featureFlags } = {} }) => {
...@@ -166,7 +172,9 @@ export const setDefaultSelectedStage = ({ dispatch, getters, state: { featureFla ...@@ -166,7 +172,9 @@ export const setDefaultSelectedStage = ({ dispatch, getters, state: { featureFla
]); ]);
} }
createFlash(__('There was an error while fetching value stream analytics data.')); createFlash({
message: __('There was an error while fetching value stream analytics data.'),
});
return Promise.resolve(); return Promise.resolve();
}; };
...@@ -207,12 +215,17 @@ export const fetchGroupStagesAndEvents = ({ dispatch, getters }) => { ...@@ -207,12 +215,17 @@ export const fetchGroupStagesAndEvents = ({ dispatch, getters }) => {
export const requestUpdateStage = ({ commit }) => commit(types.REQUEST_UPDATE_STAGE); export const requestUpdateStage = ({ commit }) => commit(types.REQUEST_UPDATE_STAGE);
export const receiveUpdateStageSuccess = ({ commit, dispatch }, updatedData) => { export const receiveUpdateStageSuccess = ({ commit, dispatch }, updatedData) => {
commit(types.RECEIVE_UPDATE_STAGE_SUCCESS); commit(types.RECEIVE_UPDATE_STAGE_SUCCESS);
createFlash(__('Stage data updated'), 'notice'); createFlash({
message: __('Stage data updated'),
type: 'notice',
});
return Promise.resolve() return Promise.resolve()
.then(() => dispatch('fetchGroupStagesAndEvents')) .then(() => dispatch('fetchGroupStagesAndEvents'))
.then(() => dispatch('customStages/showEditForm', updatedData)) .then(() => dispatch('customStages/showEditForm', updatedData))
.catch(() => { .catch(() => {
createFlash(__('There was a problem refreshing the data, please try again')); createFlash({
message: __('There was a problem refreshing the data, please try again'),
});
}); });
}; };
...@@ -228,7 +241,9 @@ export const receiveUpdateStageError = ( ...@@ -228,7 +241,9 @@ export const receiveUpdateStageError = (
? sprintf(__(`'%{name}' stage already exists`), { name }) ? sprintf(__(`'%{name}' stage already exists`), { name })
: __('There was a problem saving your custom stage, please try again'); : __('There was a problem saving your custom stage, please try again');
createFlash(__(message)); createFlash({
message: __(message),
});
return dispatch('customStages/setStageFormErrors', errors); return dispatch('customStages/setStageFormErrors', errors);
}; };
...@@ -253,13 +268,18 @@ export const updateStage = ({ dispatch, getters }, { id, ...params }) => { ...@@ -253,13 +268,18 @@ export const updateStage = ({ dispatch, getters }, { id, ...params }) => {
export const requestRemoveStage = ({ commit }) => commit(types.REQUEST_REMOVE_STAGE); export const requestRemoveStage = ({ commit }) => commit(types.REQUEST_REMOVE_STAGE);
export const receiveRemoveStageSuccess = ({ commit, dispatch }) => { export const receiveRemoveStageSuccess = ({ commit, dispatch }) => {
commit(types.RECEIVE_REMOVE_STAGE_RESPONSE); commit(types.RECEIVE_REMOVE_STAGE_RESPONSE);
createFlash(__('Stage removed'), 'notice'); createFlash({
message: __('Stage removed'),
type: 'notice',
});
return dispatch('fetchCycleAnalyticsData'); return dispatch('fetchCycleAnalyticsData');
}; };
export const receiveRemoveStageError = ({ commit }) => { export const receiveRemoveStageError = ({ commit }) => {
commit(types.RECEIVE_REMOVE_STAGE_RESPONSE); commit(types.RECEIVE_REMOVE_STAGE_RESPONSE);
createFlash(__('There was an error removing your custom stage, please try again')); createFlash({
message: __('There was an error removing your custom stage, please try again'),
});
}; };
export const removeStage = ({ dispatch, getters }, stageId) => { export const removeStage = ({ dispatch, getters }, stageId) => {
...@@ -319,7 +339,9 @@ export const receiveReorderStageSuccess = ({ commit }) => ...@@ -319,7 +339,9 @@ export const receiveReorderStageSuccess = ({ commit }) =>
export const receiveReorderStageError = ({ commit }) => { export const receiveReorderStageError = ({ commit }) => {
commit(types.RECEIVE_REORDER_STAGE_ERROR); commit(types.RECEIVE_REORDER_STAGE_ERROR);
createFlash(__('There was an error updating the stage order. Please try reloading the page.')); createFlash({
message: __('There was an error updating the stage order. Please try reloading the page.'),
});
}; };
export const reorderStage = ({ dispatch, getters }, initialData) => { export const reorderStage = ({ dispatch, getters }, initialData) => {
......
import Api from 'ee/api'; import Api from 'ee/api';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import createFlash from '~/flash';
import httpStatusCodes from '~/lib/utils/http_status'; import httpStatusCodes from '~/lib/utils/http_status';
import { __, sprintf } from '~/locale'; import { __, sprintf } from '~/locale';
import { removeFlash, isStageNameExistsError } from '../../../utils'; import { removeFlash, isStageNameExistsError } from '../../../utils';
...@@ -40,13 +40,18 @@ export const clearSavingCustomStage = ({ commit }) => commit(types.CLEAR_SAVING_ ...@@ -40,13 +40,18 @@ export const clearSavingCustomStage = ({ commit }) => commit(types.CLEAR_SAVING_
export const receiveCreateStageSuccess = ({ commit, dispatch }, { data: { title } }) => { export const receiveCreateStageSuccess = ({ commit, dispatch }, { data: { title } }) => {
commit(types.RECEIVE_CREATE_STAGE_SUCCESS); commit(types.RECEIVE_CREATE_STAGE_SUCCESS);
createFlash(sprintf(__(`Your custom stage '%{title}' was created`), { title }), 'notice'); createFlash({
message: sprintf(__(`Your custom stage '%{title}' was created`), { title }),
type: 'notice',
});
return Promise.resolve() return Promise.resolve()
.then(() => dispatch('fetchGroupStagesAndEvents', null, { root: true })) .then(() => dispatch('fetchGroupStagesAndEvents', null, { root: true }))
.then(() => dispatch('clearSavingCustomStage')) .then(() => dispatch('clearSavingCustomStage'))
.catch(() => { .catch(() => {
createFlash(__('There was a problem refreshing the data, please try again')); createFlash({
message: __('There was a problem refreshing the data, please try again'),
});
}); });
}; };
...@@ -61,7 +66,9 @@ export const receiveCreateStageError = ( ...@@ -61,7 +66,9 @@ export const receiveCreateStageError = (
? sprintf(__(`'%{name}' stage already exists`), { name }) ? sprintf(__(`'%{name}' stage already exists`), { name })
: __('There was a problem saving your custom stage, please try again'); : __('There was a problem saving your custom stage, please try again');
createFlash(flashMessage); createFlash({
message: flashMessage,
});
return dispatch('setStageFormErrors', errors); return dispatch('setStageFormErrors', errors);
}; };
......
import dateFormat from 'dateformat'; import dateFormat from 'dateformat';
import { isNumber } from 'lodash'; import { isNumber } from 'lodash';
import { hideFlash, deprecatedCreateFlash as createFlash } from '~/flash'; import createFlash, { hideFlash } from '~/flash';
import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils'; import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils';
import { import {
newDate, newDate,
...@@ -327,7 +327,9 @@ const buildDataError = ({ status = httpStatus.INTERNAL_SERVER_ERROR, error }) => ...@@ -327,7 +327,9 @@ const buildDataError = ({ status = httpStatus.INTERNAL_SERVER_ERROR, error }) =>
*/ */
export const flashErrorIfStatusNotOk = ({ error, message }) => { export const flashErrorIfStatusNotOk = ({ error, message }) => {
if (error?.errorCode !== httpStatus.OK) { if (error?.errorCode !== httpStatus.OK) {
createFlash(message); createFlash({
message,
});
} }
}; };
......
<script> <script>
import Api from 'ee/api'; import Api from 'ee/api';
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 { __, s__ } from '~/locale'; import { __, s__ } from '~/locale';
export default { export default {
...@@ -54,7 +54,9 @@ export default { ...@@ -54,7 +54,9 @@ export default {
this.isLoading = false; this.isLoading = false;
}) })
.catch(() => { .catch(() => {
createFlash(__('Failed to load group activity metrics. Please try again.')); createFlash({
message: __('Failed to load group activity metrics. Please try again.'),
});
this.isLoading = false; this.isLoading = false;
}); });
}, },
......
...@@ -3,7 +3,7 @@ import { ...@@ -3,7 +3,7 @@ import {
mapApprovalSettingsResponse, mapApprovalSettingsResponse,
mapApprovalFallbackRuleRequest, mapApprovalFallbackRuleRequest,
} from 'ee/approvals/mappers'; } from 'ee/approvals/mappers';
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 * as types from '../base/mutation_types'; import * as types from '../base/mutation_types';
...@@ -21,7 +21,11 @@ export const fetchRules = ({ rootState, dispatch, commit }) => { ...@@ -21,7 +21,11 @@ export const fetchRules = ({ rootState, dispatch, commit }) => {
return axios return axios
.get(settingsPath) .get(settingsPath)
.then((response) => dispatch('receiveRulesSuccess', mapApprovalSettingsResponse(response.data))) .then((response) => dispatch('receiveRulesSuccess', mapApprovalSettingsResponse(response.data)))
.catch(() => createFlash(__('An error occurred fetching the approval rules.'))); .catch(() =>
createFlash({
message: __('An error occurred fetching the approval rules.'),
}),
);
}; };
export const postRule = ({ rootState, dispatch }, rule) => { export const postRule = ({ rootState, dispatch }, rule) => {
...@@ -30,7 +34,11 @@ export const postRule = ({ rootState, dispatch }, rule) => { ...@@ -30,7 +34,11 @@ export const postRule = ({ rootState, dispatch }, rule) => {
return axios return axios
.post(rulesPath, mapApprovalRuleRequest(rule)) .post(rulesPath, mapApprovalRuleRequest(rule))
.then(() => dispatch('fetchRules')) .then(() => dispatch('fetchRules'))
.catch(() => createFlash(__('An error occurred while adding approvers'))); .catch(() =>
createFlash({
message: __('An error occurred while adding approvers'),
}),
);
}; };
export const putRule = ({ rootState, dispatch }, { id, ...newRule }) => { export const putRule = ({ rootState, dispatch }, { id, ...newRule }) => {
...@@ -39,7 +47,11 @@ export const putRule = ({ rootState, dispatch }, { id, ...newRule }) => { ...@@ -39,7 +47,11 @@ export const putRule = ({ rootState, dispatch }, { id, ...newRule }) => {
return axios return axios
.put(`${rulesPath}/${id}`, mapApprovalRuleRequest(newRule)) .put(`${rulesPath}/${id}`, mapApprovalRuleRequest(newRule))
.then(() => dispatch('fetchRules')) .then(() => dispatch('fetchRules'))
.catch(() => createFlash(__('An error occurred while updating approvers'))); .catch(() =>
createFlash({
message: __('An error occurred while updating approvers'),
}),
);
}; };
export const deleteRule = ({ rootState, dispatch }, id) => { export const deleteRule = ({ rootState, dispatch }, id) => {
...@@ -48,7 +60,11 @@ export const deleteRule = ({ rootState, dispatch }, id) => { ...@@ -48,7 +60,11 @@ export const deleteRule = ({ rootState, dispatch }, id) => {
return axios return axios
.delete(`${rulesPath}/${id}`) .delete(`${rulesPath}/${id}`)
.then(() => dispatch('fetchRules')) .then(() => dispatch('fetchRules'))
.catch(() => createFlash(__('An error occurred while deleting the approvers group'))); .catch(() =>
createFlash({
message: __('An error occurred while deleting the approvers group'),
}),
);
}; };
export const putFallbackRule = ({ rootState, dispatch }, fallback) => { export const putFallbackRule = ({ rootState, dispatch }, fallback) => {
...@@ -57,5 +73,9 @@ export const putFallbackRule = ({ rootState, dispatch }, fallback) => { ...@@ -57,5 +73,9 @@ export const putFallbackRule = ({ rootState, dispatch }, fallback) => {
return axios return axios
.put(projectPath, mapApprovalFallbackRuleRequest(fallback)) .put(projectPath, mapApprovalFallbackRuleRequest(fallback))
.then(() => dispatch('fetchRules')) .then(() => dispatch('fetchRules'))
.catch(() => createFlash(__('An error occurred while deleting the approvers group'))); .catch(() =>
createFlash({
message: __('An error occurred while deleting the approvers group'),
}),
);
}; };
import { memoize, uniqBy, uniqueId, flatten } from 'lodash'; import { memoize, uniqBy, uniqueId, flatten } from 'lodash';
import Api from '~/api'; import Api from '~/api';
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 { RULE_TYPE_ANY_APPROVER } from '../../../constants'; import { RULE_TYPE_ANY_APPROVER } from '../../../constants';
...@@ -56,7 +56,9 @@ export const receiveRulesSuccess = ({ commit }, { resetToDefault, settings }) => ...@@ -56,7 +56,9 @@ export const receiveRulesSuccess = ({ commit }, { resetToDefault, settings }) =>
}; };
export const receiveRulesError = () => { export const receiveRulesError = () => {
createFlash(__('An error occurred fetching the approval rules.')); createFlash({
message: __('An error occurred fetching the approval rules.'),
});
}; };
export const fetchRules = ( export const fetchRules = (
...@@ -95,7 +97,9 @@ export const postRule = ({ commit, dispatch }, rule) => ...@@ -95,7 +97,9 @@ export const postRule = ({ commit, dispatch }, rule) =>
dispatch('createModal/close'); dispatch('createModal/close');
}) })
.catch((e) => { .catch((e) => {
createFlash(__('An error occurred fetching the approvers for the new rule.')); createFlash({
message: __('An error occurred fetching the approvers for the new rule.'),
});
throw e; throw e;
}); });
...@@ -106,7 +110,9 @@ export const putRule = ({ commit, dispatch }, rule) => ...@@ -106,7 +110,9 @@ export const putRule = ({ commit, dispatch }, rule) =>
dispatch('createModal/close'); dispatch('createModal/close');
}) })
.catch((e) => { .catch((e) => {
createFlash(__('An error occurred fetching the approvers for the new rule.')); createFlash({
message: __('An error occurred fetching the approvers for the new rule.'),
});
throw e; throw e;
}); });
...@@ -137,7 +143,9 @@ export const postRegularRule = ({ commit, dispatch }, rule) => ...@@ -137,7 +143,9 @@ export const postRegularRule = ({ commit, dispatch }, rule) =>
dispatch('createModal/close'); dispatch('createModal/close');
}) })
.catch((e) => { .catch((e) => {
createFlash(__('An error occurred fetching the approvers for the new rule.')); createFlash({
message: __('An error occurred fetching the approvers for the new rule.'),
});
throw e; throw e;
}); });
......
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 { import {
...@@ -18,7 +18,9 @@ export const receiveRulesSuccess = ({ commit }, approvalSettings) => { ...@@ -18,7 +18,9 @@ export const receiveRulesSuccess = ({ commit }, approvalSettings) => {
}; };
export const receiveRulesError = () => { export const receiveRulesError = () => {
createFlash(__('An error occurred fetching the approval rules.')); createFlash({
message: __('An error occurred fetching the approval rules.'),
});
}; };
export const fetchRules = ({ rootState, dispatch }) => { export const fetchRules = ({ rootState, dispatch }) => {
...@@ -59,7 +61,9 @@ export const deleteRuleSuccess = ({ dispatch }) => { ...@@ -59,7 +61,9 @@ export const deleteRuleSuccess = ({ dispatch }) => {
}; };
export const deleteRuleError = () => { export const deleteRuleError = () => {
createFlash(__('An error occurred while deleting the approvers group')); createFlash({
message: __('An error occurred while deleting the approvers group'),
});
}; };
export const deleteRule = ({ rootState, dispatch }, id) => { export const deleteRule = ({ rootState, dispatch }, id) => {
......
...@@ -6,7 +6,7 @@ import { ...@@ -6,7 +6,7 @@ import {
GlAvatar, GlAvatar,
} 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 httpStatusCodes from '~/lib/utils/http_status'; import httpStatusCodes from '~/lib/utils/http_status';
import { isNumeric } from '~/lib/utils/number_utils'; import { isNumeric } from '~/lib/utils/number_utils';
import { sprintf, s__, __ } from '~/locale'; import { sprintf, s__, __ } from '~/locale';
...@@ -102,7 +102,9 @@ export default { ...@@ -102,7 +102,9 @@ export default {
} else { } else {
message = s__('AuditLogs|Failed to find %{type}. Please try again.'); message = s__('AuditLogs|Failed to find %{type}. Please try again.');
} }
createFlash(sprintf(message, { type })); createFlash({
message: sprintf(message, { type }),
});
}, },
selectActiveItem(id) { selectActiveItem(id) {
this.activeItem = this.suggestions.find((u) => u.id === id); this.activeItem = this.suggestions.find((u) => u.id === id);
......
...@@ -3,7 +3,7 @@ import { GlButton, GlFormInput } from '@gitlab/ui'; ...@@ -3,7 +3,7 @@ import { GlButton, GlFormInput } from '@gitlab/ui';
import { mapActions, mapGetters, mapState } from 'vuex'; import { mapActions, mapGetters, mapState } from 'vuex';
import boardsStoreEE from 'ee/boards/stores/boards_store_ee'; import boardsStoreEE from 'ee/boards/stores/boards_store_ee';
import { inactiveId } from '~/boards/constants'; import { inactiveId } from '~/boards/constants';
import { deprecatedCreateFlash as flash } from '~/flash'; import createFlash from '~/flash';
import { __, n__ } from '~/locale'; import { __, n__ } from '~/locale';
import autofocusonshow from '~/vue_shared/directives/autofocusonshow'; import autofocusonshow from '~/vue_shared/directives/autofocusonshow';
...@@ -84,7 +84,9 @@ export default { ...@@ -84,7 +84,9 @@ export default {
}) })
.catch(() => { .catch(() => {
this.unsetActiveId(); this.unsetActiveId();
flash(__('Something went wrong while updating your list settings')); createFlash({
message: __('Something went wrong while updating your list settings'),
});
}) })
.finally(() => { .finally(() => {
this.resetStateAfterUpdate(); this.resetStateAfterUpdate();
...@@ -102,7 +104,9 @@ export default { ...@@ -102,7 +104,9 @@ export default {
}) })
.catch(() => { .catch(() => {
this.unsetActiveId(); this.unsetActiveId();
flash(__('Something went wrong while updating your list settings')); createFlash({
message: __('Something went wrong while updating your list settings'),
});
}) })
.finally(() => { .finally(() => {
this.resetStateAfterUpdate(); this.resetStateAfterUpdate();
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
modify the passed parameter in conformity with non-ee BoardsStore. modify the passed parameter in conformity with non-ee BoardsStore.
*/ */
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 { parseBoolean } from '~/lib/utils/common_utils'; import { parseBoolean } from '~/lib/utils/common_utils';
import { __, sprintf } from '~/locale'; import { __, sprintf } from '~/locale';
...@@ -192,7 +192,9 @@ class BoardsStoreEE { ...@@ -192,7 +192,9 @@ class BoardsStoreEE {
}) })
.catch(() => { .catch(() => {
issue.setLoadingState('weight', false); issue.setLoadingState('weight', false);
createFlash(__('An error occurred when updating the issue weight')); createFlash({
message: __('An error occurred when updating the issue weight'),
});
}); });
} }
} }
...@@ -208,11 +210,11 @@ class BoardsStoreEE { ...@@ -208,11 +210,11 @@ class BoardsStoreEE {
this.store.state[listType] = data; this.store.state[listType] = data;
}) })
.catch(() => { .catch(() => {
createFlash( createFlash({
sprintf(__('Something went wrong while fetching %{listType} list'), { message: sprintf(__('Something went wrong while fetching %{listType} list'), {
listType, listType,
}), }),
); });
}); });
} }
} }
......
<script> <script>
import { GlAlert, GlButton, GlButtonGroup, GlSprintf } from '@gitlab/ui'; import { GlAlert, GlButton, GlButtonGroup, GlSprintf } from '@gitlab/ui';
import dateFormat from 'dateformat'; import dateFormat from 'dateformat';
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 { getDayDifference, nDaysAfter, newDateAsLocaleTime } from '~/lib/utils/datetime_utility'; import { getDayDifference, nDaysAfter, newDateAsLocaleTime } from '~/lib/utils/datetime_utility';
import { __ } from '~/locale'; import { __ } from '~/locale';
...@@ -183,7 +183,9 @@ export default { ...@@ -183,7 +183,9 @@ export default {
}) })
.catch(() => { .catch(() => {
this.fetchedLegacyData = false; this.fetchedLegacyData = false;
createFlash(__('Error loading burndown chart data')); createFlash({
message: __('Error loading burndown chart data'),
});
}); });
}, },
pluckBurnupDataProperties(total, completed) { pluckBurnupDataProperties(total, completed) {
......
import Api from '~/api'; import Api from '~/api';
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 { s__ } from '~/locale'; import { s__ } from '~/locale';
...@@ -33,6 +33,8 @@ export const fetchReport = ({ state, dispatch }) => { ...@@ -33,6 +33,8 @@ export const fetchReport = ({ state, dispatch }) => {
}) })
.catch((error) => { .catch((error) => {
dispatch('receiveReportError', error); dispatch('receiveReportError', error);
createFlash(s__('ciReport|There was an error fetching the codequality report.')); createFlash({
message: s__('ciReport|There was an error fetching the codequality report.'),
});
}); });
}; };
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 { normalizeHeaders, parseIntPagination } from '~/lib/utils/common_utils'; import { normalizeHeaders, parseIntPagination } from '~/lib/utils/common_utils';
import { __ } from '~/locale'; import { __ } from '~/locale';
...@@ -50,7 +50,9 @@ export const fetchDependencies = ({ state, dispatch }, params = {}) => { ...@@ -50,7 +50,9 @@ export const fetchDependencies = ({ state, dispatch }, params = {}) => {
}) })
.catch((error) => { .catch((error) => {
dispatch('receiveDependenciesError', error); dispatch('receiveDependenciesError', error);
createFlash(FETCH_ERROR_MESSAGE); createFlash({
message: FETCH_ERROR_MESSAGE,
});
}); });
}; };
......
...@@ -7,7 +7,7 @@ import { ...@@ -7,7 +7,7 @@ import {
GlFormGroup, GlFormGroup,
GlFormInput, GlFormInput,
} from '@gitlab/ui'; } from '@gitlab/ui';
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 MarkdownField from '~/vue_shared/components/markdown/field.vue'; import MarkdownField from '~/vue_shared/components/markdown/field.vue';
...@@ -80,7 +80,9 @@ export default { ...@@ -80,7 +80,9 @@ export default {
.then(({ data }) => { .then(({ data }) => {
const { errors, epic } = data.createEpic; const { errors, epic } = data.createEpic;
if (errors?.length > 0) { if (errors?.length > 0) {
createFlash(errors[0]); createFlash({
message: errors[0],
});
this.loading = false; this.loading = false;
return; return;
} }
...@@ -89,7 +91,9 @@ export default { ...@@ -89,7 +91,9 @@ export default {
}) })
.catch(() => { .catch(() => {
this.loading = false; this.loading = false;
createFlash(s__('Epics|Unable to save epic. Please try again')); createFlash({
message: s__('Epics|Unable to save epic. Please try again'),
});
}); });
}, },
updateDueDate(val) { updateDueDate(val) {
......
import epicDetailsQuery from 'shared_queries/epic/epic_details.query.graphql'; import epicDetailsQuery from 'shared_queries/epic/epic_details.query.graphql';
import { deprecatedCreateFlash as flash } from '~/flash'; import createFlash from '~/flash';
import { EVENT_ISSUABLE_VUE_APP_CHANGE } from '~/issuable/constants'; import { EVENT_ISSUABLE_VUE_APP_CHANGE } from '~/issuable/constants';
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
...@@ -42,7 +42,9 @@ export const fetchEpicDetails = ({ state, dispatch }) => { ...@@ -42,7 +42,9 @@ export const fetchEpicDetails = ({ state, dispatch }) => {
}; };
export const requestEpicParticipantsFailure = () => { export const requestEpicParticipantsFailure = () => {
flash(__('There was an error getting the epic participants.')); createFlash({
message: __('There was an error getting the epic participants.'),
});
}; };
export const requestEpicStatusChange = ({ commit }) => commit(types.REQUEST_EPIC_STATUS_CHANGE); export const requestEpicStatusChange = ({ commit }) => commit(types.REQUEST_EPIC_STATUS_CHANGE);
...@@ -52,7 +54,9 @@ export const requestEpicStatusChangeSuccess = ({ commit }, data) => ...@@ -52,7 +54,9 @@ export const requestEpicStatusChangeSuccess = ({ commit }, data) =>
export const requestEpicStatusChangeFailure = ({ commit }) => { export const requestEpicStatusChangeFailure = ({ commit }) => {
commit(types.REQUEST_EPIC_STATUS_CHANGE_FAILURE); commit(types.REQUEST_EPIC_STATUS_CHANGE_FAILURE);
flash(__('Unable to update this epic at this time.')); createFlash({
message: __('Unable to update this epic at this time.'),
});
}; };
export const triggerIssuableEvent = (_, { isEpicOpen }) => { export const triggerIssuableEvent = (_, { isEpicOpen }) => {
...@@ -106,9 +110,13 @@ export const requestEpicTodoToggleFailure = ({ commit, state }, data) => { ...@@ -106,9 +110,13 @@ export const requestEpicTodoToggleFailure = ({ commit, state }, data) => {
commit(types.REQUEST_EPIC_TODO_TOGGLE_FAILURE, data); commit(types.REQUEST_EPIC_TODO_TOGGLE_FAILURE, data);
if (state.todoExists) { if (state.todoExists) {
flash(__('There was an error deleting the To Do.')); createFlash({
message: __('There was an error deleting the To Do.'),
});
} else { } else {
flash(__('There was an error adding a To Do.')); createFlash({
message: __('There was an error adding a To Do.'),
});
} }
}; };
export const triggerTodoToggleEvent = (_, { count }) => { export const triggerTodoToggleEvent = (_, { count }) => {
...@@ -150,11 +158,11 @@ export const requestEpicDateSaveSuccess = ({ commit }, data) => ...@@ -150,11 +158,11 @@ export const requestEpicDateSaveSuccess = ({ commit }, data) =>
commit(types.REQUEST_EPIC_DATE_SAVE_SUCCESS, data); commit(types.REQUEST_EPIC_DATE_SAVE_SUCCESS, data);
export const requestEpicDateSaveFailure = ({ commit }, data) => { export const requestEpicDateSaveFailure = ({ commit }, data) => {
commit(types.REQUEST_EPIC_DATE_SAVE_FAILURE, data); commit(types.REQUEST_EPIC_DATE_SAVE_FAILURE, data);
flash( createFlash({
sprintf(s__('Epics|An error occurred while saving the %{epicDateType} date'), { message: sprintf(s__('Epics|An error occurred while saving the %{epicDateType} date'), {
epicDateType: dateTypes.start === data.dateType ? s__('Epics|start') : s__('Epics|due'), epicDateType: dateTypes.start === data.dateType ? s__('Epics|start') : s__('Epics|due'),
}), }),
); });
}; };
export const saveDate = ({ state, dispatch }, { dateType, dateTypeIsFixed, newDate }) => { export const saveDate = ({ state, dispatch }, { dateType, dateTypeIsFixed, newDate }) => {
const updateEpicInput = { const updateEpicInput = {
...@@ -207,7 +215,9 @@ export const receiveEpicLabelsSelectSuccess = ({ commit }, labels) => ...@@ -207,7 +215,9 @@ export const receiveEpicLabelsSelectSuccess = ({ commit }, labels) =>
commit(types.RECEIVE_EPIC_LABELS_SELECT_SUCCESS, labels); commit(types.RECEIVE_EPIC_LABELS_SELECT_SUCCESS, labels);
export const receiveEpicLabelsSelectFailure = ({ commit }) => { export const receiveEpicLabelsSelectFailure = ({ commit }) => {
commit(types.RECEIVE_EPIC_LABELS_SELECT_FAILURE); commit(types.RECEIVE_EPIC_LABELS_SELECT_FAILURE);
flash(s__('Epics|An error occurred while updating labels.')); createFlash({
message: s__('Epics|An error occurred while updating labels.'),
});
}; };
export const updateEpicLabels = ({ dispatch, state }, labels) => { export const updateEpicLabels = ({ dispatch, state }, labels) => {
const addLabelIds = labels.filter((label) => label.set).map((label) => label.id); const addLabelIds = labels.filter((label) => label.set).map((label) => label.id);
...@@ -250,9 +260,13 @@ export const requestEpicSubscriptionToggleSuccess = ({ commit }, data) => ...@@ -250,9 +260,13 @@ export const requestEpicSubscriptionToggleSuccess = ({ commit }, data) =>
export const requestEpicSubscriptionToggleFailure = ({ commit, state }) => { export const requestEpicSubscriptionToggleFailure = ({ commit, state }) => {
commit(types.REQUEST_EPIC_SUBSCRIPTION_TOGGLE_FAILURE); commit(types.REQUEST_EPIC_SUBSCRIPTION_TOGGLE_FAILURE);
if (state.subscribed) { if (state.subscribed) {
flash(__('An error occurred while unsubscribing to notifications.')); createFlash({
message: __('An error occurred while unsubscribing to notifications.'),
});
} else { } else {
flash(__('An error occurred while subscribing to notifications.')); createFlash({
message: __('An error occurred while subscribing to notifications.'),
});
} }
}; };
export const toggleEpicSubscription = ({ state, dispatch }) => { export const toggleEpicSubscription = ({ state, dispatch }) => {
...@@ -293,7 +307,9 @@ export const requestEpicCreate = ({ commit }) => commit(types.REQUEST_EPIC_CREAT ...@@ -293,7 +307,9 @@ export const requestEpicCreate = ({ commit }) => commit(types.REQUEST_EPIC_CREAT
export const requestEpicCreateSuccess = (_, webUrl) => visitUrl(webUrl); export const requestEpicCreateSuccess = (_, webUrl) => visitUrl(webUrl);
export const requestEpicCreateFailure = ({ commit }) => { export const requestEpicCreateFailure = ({ commit }) => {
commit(types.REQUEST_EPIC_CREATE_FAILURE); commit(types.REQUEST_EPIC_CREATE_FAILURE);
flash(s__('Error creating epic')); createFlash({
message: s__('Error creating epic'),
});
}; };
export const createEpic = ({ state, dispatch }) => { export const createEpic = ({ state, dispatch }) => {
dispatch('requestEpicCreate'); dispatch('requestEpicCreate');
......
import { flatten } from 'lodash'; import { flatten } from 'lodash';
import Api from 'ee/api'; import Api from 'ee/api';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import createFlash from '~/flash';
import { convertObjectPropsToSnakeCase } from '~/lib/utils/common_utils'; import { convertObjectPropsToSnakeCase } from '~/lib/utils/common_utils';
import { visitUrl } from '~/lib/utils/url_utility'; import { visitUrl } from '~/lib/utils/url_utility';
import { __ } from '~/locale'; import { __ } from '~/locale';
...@@ -21,7 +21,9 @@ export const requestSyncNamespaces = ({ commit }) => commit(types.REQUEST_SYNC_N ...@@ -21,7 +21,9 @@ export const requestSyncNamespaces = ({ commit }) => commit(types.REQUEST_SYNC_N
export const receiveSyncNamespacesSuccess = ({ commit }, data) => export const receiveSyncNamespacesSuccess = ({ commit }, data) =>
commit(types.RECEIVE_SYNC_NAMESPACES_SUCCESS, data); commit(types.RECEIVE_SYNC_NAMESPACES_SUCCESS, data);
export const receiveSyncNamespacesError = ({ commit }) => { export const receiveSyncNamespacesError = ({ commit }) => {
createFlash(__("There was an error fetching the Node's Groups")); createFlash({
message: __("There was an error fetching the Node's Groups"),
});
commit(types.RECEIVE_SYNC_NAMESPACES_ERROR); commit(types.RECEIVE_SYNC_NAMESPACES_ERROR);
}; };
...@@ -49,7 +51,9 @@ export const receiveSaveGeoNodeError = ({ commit }, data) => { ...@@ -49,7 +51,9 @@ export const receiveSaveGeoNodeError = ({ commit }, data) => {
errorMessage += ` ${getSaveErrorMessage(data.message)}`; errorMessage += ` ${getSaveErrorMessage(data.message)}`;
} }
createFlash(errorMessage); createFlash({
message: errorMessage,
});
commit(types.RECEIVE_SAVE_GEO_NODE_COMPLETE); commit(types.RECEIVE_SAVE_GEO_NODE_COMPLETE);
}; };
......
<script> <script>
import { GlLoadingIcon, GlModal } from '@gitlab/ui'; import { GlLoadingIcon, GlModal } from '@gitlab/ui';
import { deprecatedCreateFlash as Flash } 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 SmartInterval from '~/smart_interval'; import SmartInterval from '~/smart_interval';
...@@ -96,7 +96,9 @@ export default { ...@@ -96,7 +96,9 @@ export default {
}) })
.catch(() => { .catch(() => {
this.isLoading = false; this.isLoading = false;
Flash(s__('GeoNodes|Something went wrong while fetching nodes')); createFlash({
message: s__('GeoNodes|Something went wrong while fetching nodes'),
});
}); });
}, },
fetchNodeDetails(node) { fetchNodeDetails(node) {
...@@ -135,7 +137,9 @@ export default { ...@@ -135,7 +137,9 @@ export default {
}) })
.catch(() => { .catch(() => {
this.setNodeActionStatus(targetNode, false); this.setNodeActionStatus(targetNode, false);
Flash(s__('GeoNodes|Something went wrong while repairing node')); createFlash({
message: s__('GeoNodes|Something went wrong while repairing node'),
});
}); });
}, },
toggleNode(targetNode) { toggleNode(targetNode) {
...@@ -151,7 +155,9 @@ export default { ...@@ -151,7 +155,9 @@ export default {
}) })
.catch(() => { .catch(() => {
this.setNodeActionStatus(targetNode, false); this.setNodeActionStatus(targetNode, false);
Flash(s__('GeoNodes|Something went wrong while changing node status')); createFlash({
message: s__('GeoNodes|Something went wrong while changing node status'),
});
}); });
}, },
removeNode(targetNode) { removeNode(targetNode) {
...@@ -164,7 +170,9 @@ export default { ...@@ -164,7 +170,9 @@ export default {
}) })
.catch(() => { .catch(() => {
this.setNodeActionStatus(targetNode, false); this.setNodeActionStatus(targetNode, false);
Flash(s__('GeoNodes|Something went wrong while removing node')); createFlash({
message: s__('GeoNodes|Something went wrong while removing node'),
});
}); });
}, },
handleNodeAction() { handleNodeAction() {
......
import Api from 'ee/api'; import Api from 'ee/api';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import createFlash from '~/flash';
import { import {
parseIntPagination, parseIntPagination,
normalizeHeaders, normalizeHeaders,
...@@ -17,11 +17,11 @@ export const requestReplicableItems = ({ commit }) => commit(types.REQUEST_REPLI ...@@ -17,11 +17,11 @@ export const requestReplicableItems = ({ commit }) => commit(types.REQUEST_REPLI
export const receiveReplicableItemsSuccess = ({ commit }, data) => export const receiveReplicableItemsSuccess = ({ commit }, data) =>
commit(types.RECEIVE_REPLICABLE_ITEMS_SUCCESS, data); commit(types.RECEIVE_REPLICABLE_ITEMS_SUCCESS, data);
export const receiveReplicableItemsError = ({ state, commit }) => { export const receiveReplicableItemsError = ({ state, commit }) => {
createFlash( createFlash({
sprintf(__('There was an error fetching the %{replicableType}'), { message: sprintf(__('There was an error fetching the %{replicableType}'), {
replicableType: state.replicableType, replicableType: state.replicableType,
}), }),
); });
commit(types.RECEIVE_REPLICABLE_ITEMS_ERROR); commit(types.RECEIVE_REPLICABLE_ITEMS_ERROR);
}; };
...@@ -115,11 +115,11 @@ export const receiveInitiateAllReplicableSyncsSuccess = ( ...@@ -115,11 +115,11 @@ export const receiveInitiateAllReplicableSyncsSuccess = (
dispatch('fetchReplicableItems'); dispatch('fetchReplicableItems');
}; };
export const receiveInitiateAllReplicableSyncsError = ({ state, commit }) => { export const receiveInitiateAllReplicableSyncsError = ({ state, commit }) => {
createFlash( createFlash({
sprintf(__('There was an error syncing the %{replicableType}'), { message: sprintf(__('There was an error syncing the %{replicableType}'), {
replicableType: state.replicableType, replicableType: state.replicableType,
}), }),
); });
commit(types.RECEIVE_INITIATE_ALL_REPLICABLE_SYNCS_ERROR); commit(types.RECEIVE_INITIATE_ALL_REPLICABLE_SYNCS_ERROR);
}; };
...@@ -142,7 +142,9 @@ export const receiveInitiateReplicableSyncSuccess = ({ commit, dispatch }, { nam ...@@ -142,7 +142,9 @@ export const receiveInitiateReplicableSyncSuccess = ({ commit, dispatch }, { nam
dispatch('fetchReplicableItems'); dispatch('fetchReplicableItems');
}; };
export const receiveInitiateReplicableSyncError = ({ commit }, { name }) => { export const receiveInitiateReplicableSyncError = ({ commit }, { name }) => {
createFlash(sprintf(__('There was an error syncing project %{name}'), { name })); createFlash({
message: sprintf(__('There was an error syncing project %{name}'), { name }),
});
commit(types.RECEIVE_INITIATE_REPLICABLE_SYNC_ERROR); commit(types.RECEIVE_INITIATE_REPLICABLE_SYNC_ERROR);
}; };
......
import Api from 'ee/api'; import Api from 'ee/api';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import createFlash from '~/flash';
import { __ } from '~/locale'; import { __ } from '~/locale';
import * as types from './mutation_types'; import * as types from './mutation_types';
...@@ -13,7 +13,9 @@ export const fetchGeoSettings = ({ commit }) => { ...@@ -13,7 +13,9 @@ export const fetchGeoSettings = ({ commit }) => {
}); });
}) })
.catch(() => { .catch(() => {
createFlash(__('There was an error fetching the Geo Settings')); createFlash({
message: __('There was an error fetching the Geo Settings'),
});
commit(types.RECEIVE_GEO_SETTINGS_ERROR); commit(types.RECEIVE_GEO_SETTINGS_ERROR);
}); });
}; };
...@@ -31,7 +33,9 @@ export const updateGeoSettings = ({ commit, state }) => { ...@@ -31,7 +33,9 @@ export const updateGeoSettings = ({ commit, state }) => {
}); });
}) })
.catch(() => { .catch(() => {
createFlash(__('There was an error updating the Geo Settings')); createFlash({
message: __('There was an error updating the Geo Settings'),
});
commit(types.RECEIVE_UPDATE_GEO_SETTINGS_ERROR); commit(types.RECEIVE_UPDATE_GEO_SETTINGS_ERROR);
}); });
}; };
......
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 { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils'; import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils';
import { __ } from '~/locale'; import { __ } from '~/locale';
...@@ -75,7 +75,9 @@ export default class GroupMemberStore { ...@@ -75,7 +75,9 @@ export default class GroupMemberStore {
}) })
.catch((e) => { .catch((e) => {
this.state.isLoading = false; this.state.isLoading = false;
Flash(__('Something went wrong while fetching group member contributions')); createFlash({
message: __('Something went wrong while fetching group member contributions'),
});
throw e; throw e;
}); });
} }
......
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';
...@@ -10,7 +10,9 @@ export const receiveConfigSuccess = ({ commit }, data) => ...@@ -10,7 +10,9 @@ export const receiveConfigSuccess = ({ commit }, data) =>
export const receiveConfigError = ({ commit }, errorMessage) => { export const receiveConfigError = ({ commit }, errorMessage) => {
const error = errorMessage || __('Unknown Error'); const error = errorMessage || __('Unknown Error');
const message = `${__('There was an error fetching configuration for charts')}: ${error}`; const message = `${__('There was an error fetching configuration for charts')}: ${error}`;
createFlash(message); createFlash({
message,
});
commit(types.RECEIVE_CONFIG_ERROR); commit(types.RECEIVE_CONFIG_ERROR);
}; };
...@@ -51,7 +53,9 @@ export const fetchChartData = ({ dispatch }, { endpoint, chart }) => ...@@ -51,7 +53,9 @@ export const fetchChartData = ({ dispatch }, { endpoint, chart }) =>
if (error.response.data && error.response.data.message) { if (error.response.data && error.response.data.message) {
message += `: ${error.response.data.message}`; message += `: ${error.response.data.message}`;
} }
createFlash(message); createFlash({
message,
});
dispatch('receiveChartDataError', { chart, error: message }); dispatch('receiveChartDataError', { chart, error: message });
}); });
...@@ -65,7 +69,9 @@ export const setActiveTab = ({ commit, state }, key) => { ...@@ -65,7 +69,9 @@ export const setActiveTab = ({ commit, state }, key) => {
commit(types.SET_ACTIVE_TAB, key); commit(types.SET_ACTIVE_TAB, key);
commit(types.SET_ACTIVE_PAGE, page); commit(types.SET_ACTIVE_PAGE, page);
} else { } else {
createFlash(__('The specified tab is invalid, please select another')); createFlash({
message: __('The specified tab is invalid, please select another'),
});
} }
} }
}; };
......
...@@ -12,7 +12,7 @@ import { ...@@ -12,7 +12,7 @@ import {
GlLabel, GlLabel,
} from '@gitlab/ui'; } 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 { getDayDifference } from '~/lib/utils/datetime_utility'; import { getDayDifference } from '~/lib/utils/datetime_utility';
import { capitalizeFirstCharacter } from '~/lib/utils/text_utility'; import { capitalizeFirstCharacter } from '~/lib/utils/text_utility';
...@@ -120,7 +120,9 @@ export default { ...@@ -120,7 +120,9 @@ export default {
this.isLoading = false; this.isLoading = false;
}) })
.catch(() => { .catch(() => {
createFlash(s__('IssueAnalytics|Failed to load issues. Please try again.')); createFlash({
message: s__('IssueAnalytics|Failed to load issues. Please try again.'),
});
this.isLoading = false; this.isLoading = false;
}); });
}, },
......
import { deprecatedCreateFlash as flash } from '~/flash'; import createFlash from '~/flash';
import { __ } from '~/locale'; import { __ } from '~/locale';
import service from '../../../services/issue_analytics_service'; import service from '../../../services/issue_analytics_service';
import * as types from './mutation_types'; import * as types from './mutation_types';
...@@ -19,5 +19,9 @@ export const fetchChartData = ({ commit, dispatch, getters }, endpoint) => { ...@@ -19,5 +19,9 @@ export const fetchChartData = ({ commit, dispatch, getters }, endpoint) => {
.then((res) => res.data) .then((res) => res.data)
.then((data) => commit(types.SET_CHART_DATA, data)) .then((data) => commit(types.SET_CHART_DATA, data))
.then(() => dispatch('setLoadingState', false)) .then(() => dispatch('setLoadingState', false))
.catch(() => flash(__('An error occurred while loading chart data'))); .catch(() =>
createFlash({
message: __('An error occurred while loading chart data'),
}),
);
}; };
<script> <script>
import { GlButton, GlForm, GlFormInput } from '@gitlab/ui'; import { GlButton, GlForm, GlFormInput } from '@gitlab/ui';
import DueDateSelectors from '~/due_date_select'; import DueDateSelectors from '~/due_date_select';
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 { __ } from '~/locale'; import { __ } from '~/locale';
import MarkdownField from '~/vue_shared/components/markdown/field.vue'; import MarkdownField from '~/vue_shared/components/markdown/field.vue';
...@@ -90,7 +90,9 @@ export default { ...@@ -90,7 +90,9 @@ export default {
const { errors, iteration } = data.createIteration; const { errors, iteration } = data.createIteration;
if (errors.length > 0) { if (errors.length > 0) {
this.loading = false; this.loading = false;
createFlash(errors[0]); createFlash({
message: errors[0],
});
return; return;
} }
...@@ -98,7 +100,9 @@ export default { ...@@ -98,7 +100,9 @@ export default {
}) })
.catch(() => { .catch(() => {
this.loading = false; this.loading = false;
createFlash(__('Unable to save iteration. Please try again')); createFlash({
message: __('Unable to save iteration. Please try again'),
});
}); });
}, },
updateIteration() { updateIteration() {
...@@ -115,14 +119,18 @@ export default { ...@@ -115,14 +119,18 @@ export default {
.then(({ data }) => { .then(({ data }) => {
const { errors } = data.updateIteration; const { errors } = data.updateIteration;
if (errors.length > 0) { if (errors.length > 0) {
createFlash(errors[0]); createFlash({
message: errors[0],
});
return; return;
} }
this.$emit('updated'); this.$emit('updated');
}) })
.catch(() => { .catch(() => {
createFlash(__('Unable to save iteration. Please try again')); createFlash({
message: __('Unable to save iteration. Please try again'),
});
}) })
.finally(() => { .finally(() => {
this.loading = false; this.loading = false;
......
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 { normalizeHeaders, parseIntPagination } from '~/lib/utils/common_utils'; import { normalizeHeaders, parseIntPagination } from '~/lib/utils/common_utils';
import { __ } from '~/locale'; import { __ } from '~/locale';
...@@ -46,5 +46,7 @@ export const receiveLicensesSuccess = ({ commit }, { headers, data }) => { ...@@ -46,5 +46,7 @@ export const receiveLicensesSuccess = ({ commit }, { headers, data }) => {
export const receiveLicensesError = ({ commit }) => { export const receiveLicensesError = ({ commit }) => {
commit(types.RECEIVE_LICENSES_ERROR); commit(types.RECEIVE_LICENSES_ERROR);
createFlash(FETCH_ERROR_MESSAGE); createFlash({
message: FETCH_ERROR_MESSAGE,
});
}; };
import Api from '~/api'; import Api from '~/api';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import createFlash from '~/flash';
import { normalizeHeaders, parseIntPagination } from '~/lib/utils/common_utils'; import { normalizeHeaders, parseIntPagination } from '~/lib/utils/common_utils';
import { __ } from '~/locale'; import { __ } from '~/locale';
import * as types from './mutation_types'; import * as types from './mutation_types';
...@@ -22,6 +22,8 @@ export function fetchPage({ commit, state }, newPage) { ...@@ -22,6 +22,8 @@ export function fetchPage({ commit, state }, newPage) {
}); });
}) })
.catch(() => { .catch(() => {
createFlash(__('An error occurred while loading group members.')); createFlash({
message: __('An error occurred while loading group members.'),
});
}); });
} }
import $ from 'jquery'; import $ from 'jquery';
import { deprecatedCreateFlash as Flash } from '~/flash'; import createFlash from '~/flash';
import { loadCSSFile } from '~/lib/utils/css_utils'; import { loadCSSFile } from '~/lib/utils/css_utils';
import { __ } from '~/locale'; import { __ } from '~/locale';
import MirrorRepos from '~/mirrors/mirror_repos'; import MirrorRepos from '~/mirrors/mirror_repos';
...@@ -32,7 +32,9 @@ export default class EEMirrorRepos extends MirrorRepos { ...@@ -32,7 +32,9 @@ export default class EEMirrorRepos extends MirrorRepos {
this.showForm(); this.showForm();
}) })
.catch(() => { .catch(() => {
Flash(__('Something went wrong on our end.')); createFlash({
message: __('Something went wrong on our end.'),
});
}); });
} }
......
import { debounce } from 'lodash'; import { debounce } from 'lodash';
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 { __ } from '~/locale'; import { __ } from '~/locale';
...@@ -66,7 +66,9 @@ export default class UsernameSuggester { ...@@ -66,7 +66,9 @@ export default class UsernameSuggester {
this.usernameElement.value = data.username; this.usernameElement.value = data.username;
}) })
.catch(() => { .catch(() => {
Flash(__('An error occurred while generating a username. Please try again.')); createFlash({
message: __('An error occurred while generating a username. Please try again.'),
});
}) })
.finally(() => { .finally(() => {
this.isLoading = false; this.isLoading = false;
......
import $ from 'jquery'; import $ from 'jquery';
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 { __ } from '~/locale'; import { __ } from '~/locale';
...@@ -21,5 +21,9 @@ if (selectElement?.dataset) { ...@@ -21,5 +21,9 @@ if (selectElement?.dataset) {
}); });
$(selectElement).val(selectedOption).trigger('change.select2'); $(selectElement).val(selectedOption).trigger('change.select2');
}) })
.catch(() => new Flash(__('Error loading countries data.'))); .catch(() =>
createFlash({
message: __('Error loading countries data.'),
}),
);
} }
import $ from 'jquery'; import $ from 'jquery';
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 { sprintf, __ } from '~/locale'; import { sprintf, __ } from '~/locale';
...@@ -25,6 +25,10 @@ export default function initPathLocks(url, path) { ...@@ -25,6 +25,10 @@ export default function initPathLocks(url, path) {
.then(() => { .then(() => {
window.location.reload(); window.location.reload();
}) })
.catch(() => flash(__('An error occurred while initializing path locks'))); .catch(() =>
createFlash({
message: __('An error occurred while initializing path locks'),
}),
);
}); });
} }
import $ from 'jquery'; import $ from 'jquery';
import CreateItemDropdown from '~/create_item_dropdown'; import CreateItemDropdown from '~/create_item_dropdown';
import { deprecatedCreateFlash as Flash } from '~/flash'; import createFlash from '~/flash';
import AccessorUtilities from '~/lib/utils/accessor'; import AccessorUtilities from '~/lib/utils/accessor';
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
import { __ } from '~/locale'; import { __ } from '~/locale';
...@@ -67,7 +67,9 @@ export default class ProtectedEnvironmentCreate { ...@@ -67,7 +67,9 @@ export default class ProtectedEnvironmentCreate {
callback(results); callback(results);
}) })
.catch(() => { .catch(() => {
Flash(__('An error occurred while fetching environments.')); createFlash({
message: __('An error occurred while fetching environments.'),
});
callback([]); callback([]);
}); });
} }
...@@ -115,6 +117,10 @@ export default class ProtectedEnvironmentCreate { ...@@ -115,6 +117,10 @@ export default class ProtectedEnvironmentCreate {
window.location.hash = 'js-protected-environments-settings'; window.location.hash = 'js-protected-environments-settings';
window.location.reload(); window.location.reload();
}) })
.catch(() => Flash(__('Failed to protect the environment'))); .catch(() =>
createFlash({
message: __('Failed to protect the environment'),
}),
);
} }
} }
import $ from 'jquery'; import $ from 'jquery';
import { find } from 'lodash'; import { find } from 'lodash';
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 { __ } from '~/locale'; import { __ } from '~/locale';
import AccessDropdown from '~/projects/settings/access_dropdown'; import AccessDropdown from '~/projects/settings/access_dropdown';
...@@ -70,7 +70,11 @@ export default class ProtectedEnvironmentEdit { ...@@ -70,7 +70,11 @@ export default class ProtectedEnvironmentEdit {
}) })
.catch(() => { .catch(() => {
this.$allowedToDeployDropdown.enable(); this.$allowedToDeployDropdown.enable();
Flash(__('Failed to update environment!'), null, $('.js-protected-environments-list')); createFlash({
message: __('Failed to update environment!'),
type: null,
parent: $('.js-protected-environments-list'),
});
}); });
} }
......
import $ from 'jquery'; import $ from 'jquery';
import CreateItemDropdown from '~/create_item_dropdown'; import CreateItemDropdown from '~/create_item_dropdown';
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 { s__, __ } from '~/locale'; import { s__, __ } from '~/locale';
import AccessDropdown from '~/projects/settings/access_dropdown'; import AccessDropdown from '~/projects/settings/access_dropdown';
...@@ -98,6 +98,10 @@ export default class ProtectedTagCreate { ...@@ -98,6 +98,10 @@ export default class ProtectedTagCreate {
.then(() => { .then(() => {
window.location.reload(); window.location.reload();
}) })
.catch(() => createFlash(s__('ProjectSettings|Failed to protect the tag'))); .catch(() =>
createFlash({
message: s__('ProjectSettings|Failed to protect the tag'),
}),
);
} }
} }
import { find } from 'lodash'; import { find } 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 AccessDropdown from '~/projects/settings/access_dropdown'; import AccessDropdown from '~/projects/settings/access_dropdown';
import { FAILED_TO_UPDATE_TAG_MESSAGE } from '~/protected_tags/constants'; import { FAILED_TO_UPDATE_TAG_MESSAGE } from '~/protected_tags/constants';
...@@ -67,7 +67,9 @@ export default class ProtectedTagEdit { ...@@ -67,7 +67,9 @@ export default class ProtectedTagEdit {
}) })
.catch(() => { .catch(() => {
window.scrollTo({ top: 0, behavior: 'smooth' }); window.scrollTo({ top: 0, behavior: 'smooth' });
createFlash(FAILED_TO_UPDATE_TAG_MESSAGE); createFlash({
message: FAILED_TO_UPDATE_TAG_MESSAGE,
});
}); });
} }
......
import Api from 'ee/api'; import Api from 'ee/api';
import epicChildren from 'shared_queries/epic/epic_children.query.graphql'; import epicChildren from 'shared_queries/epic/epic_children.query.graphql';
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 { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils'; import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils';
import httpStatusCodes from '~/lib/utils/http_status'; import httpStatusCodes from '~/lib/utils/http_status';
...@@ -75,7 +75,9 @@ export const setIssuePageInfo = ({ commit }, data) => commit(types.SET_ISSUE_PAG ...@@ -75,7 +75,9 @@ export const setIssuePageInfo = ({ commit }, data) => commit(types.SET_ISSUE_PAG
export const requestItems = ({ commit }, data) => commit(types.REQUEST_ITEMS, data); export const requestItems = ({ commit }, data) => commit(types.REQUEST_ITEMS, data);
export const receiveItemsSuccess = ({ commit }, data) => commit(types.RECEIVE_ITEMS_SUCCESS, data); export const receiveItemsSuccess = ({ commit }, data) => commit(types.RECEIVE_ITEMS_SUCCESS, data);
export const receiveItemsFailure = ({ commit }, data) => { export const receiveItemsFailure = ({ commit }, data) => {
flash(s__('Epics|Something went wrong while fetching child epics.')); createFlash({
message: s__('Epics|Something went wrong while fetching child epics.'),
});
commit(types.RECEIVE_ITEMS_FAILURE, data); commit(types.RECEIVE_ITEMS_FAILURE, data);
}; };
export const fetchItems = ({ dispatch }, { parentItem, isSubItem = false }) => { export const fetchItems = ({ dispatch }, { parentItem, isSubItem = false }) => {
...@@ -135,7 +137,9 @@ export const fetchItems = ({ dispatch }, { parentItem, isSubItem = false }) => { ...@@ -135,7 +137,9 @@ export const fetchItems = ({ dispatch }, { parentItem, isSubItem = false }) => {
}; };
export const receiveNextPageItemsFailure = () => { export const receiveNextPageItemsFailure = () => {
flash(s__('Epics|Something went wrong while fetching child epics.')); createFlash({
message: s__('Epics|Something went wrong while fetching child epics.'),
});
}; };
export const fetchNextPageItems = ({ dispatch, state }, { parentItem, isSubItem = false }) => { export const fetchNextPageItems = ({ dispatch, state }, { parentItem, isSubItem = false }) => {
const { iid, fullPath } = parentItem; const { iid, fullPath } = parentItem;
...@@ -224,11 +228,12 @@ export const receiveRemoveItemSuccess = ({ commit }, data) => ...@@ -224,11 +228,12 @@ export const receiveRemoveItemSuccess = ({ commit }, data) =>
export const receiveRemoveItemFailure = ({ commit }, { item, status }) => { export const receiveRemoveItemFailure = ({ commit }, { item, status }) => {
commit(types.RECEIVE_REMOVE_ITEM_FAILURE, item); commit(types.RECEIVE_REMOVE_ITEM_FAILURE, item);
const issuableType = issuableTypesMap[item.type.toUpperCase()]; const issuableType = issuableTypesMap[item.type.toUpperCase()];
flash( createFlash({
status === httpStatusCodes.NOT_FOUND message:
? pathIndeterminateErrorMap[issuableType] status === httpStatusCodes.NOT_FOUND
: relatedIssuesRemoveErrorMap[issuableType], ? pathIndeterminateErrorMap[issuableType]
); : relatedIssuesRemoveErrorMap[issuableType],
});
}; };
export const removeItem = ({ dispatch }, { parentItem, item }) => { export const removeItem = ({ dispatch }, { parentItem, item }) => {
dispatch('requestRemoveItem', { dispatch('requestRemoveItem', {
...@@ -383,7 +388,9 @@ export const receiveCreateItemSuccess = ({ state, commit, dispatch, getters }, { ...@@ -383,7 +388,9 @@ export const receiveCreateItemSuccess = ({ state, commit, dispatch, getters }, {
}; };
export const receiveCreateItemFailure = ({ commit }) => { export const receiveCreateItemFailure = ({ commit }) => {
commit(types.RECEIVE_CREATE_ITEM_FAILURE); commit(types.RECEIVE_CREATE_ITEM_FAILURE);
flash(s__('Epics|Something went wrong while creating child epics.')); createFlash({
message: s__('Epics|Something went wrong while creating child epics.'),
});
}; };
export const createItem = ({ state, dispatch }, { itemTitle, groupFullPath }) => { export const createItem = ({ state, dispatch }, { itemTitle, groupFullPath }) => {
dispatch('requestCreateItem'); dispatch('requestCreateItem');
...@@ -415,7 +422,9 @@ export const createItem = ({ state, dispatch }, { itemTitle, groupFullPath }) => ...@@ -415,7 +422,9 @@ export const createItem = ({ state, dispatch }, { itemTitle, groupFullPath }) =>
export const receiveReorderItemFailure = ({ commit }, data) => { export const receiveReorderItemFailure = ({ commit }, data) => {
commit(types.REORDER_ITEM, data); commit(types.REORDER_ITEM, data);
flash(s__('Epics|Something went wrong while ordering item.')); createFlash({
message: s__('Epics|Something went wrong while ordering item.'),
});
}; };
export const reorderItem = ( export const reorderItem = (
{ dispatch, commit }, { dispatch, commit },
...@@ -460,7 +469,9 @@ export const reorderItem = ( ...@@ -460,7 +469,9 @@ export const reorderItem = (
export const receiveMoveItemFailure = ({ commit }, data) => { export const receiveMoveItemFailure = ({ commit }, data) => {
commit(types.MOVE_ITEM_FAILURE, data); commit(types.MOVE_ITEM_FAILURE, data);
flash(s__('Epics|Something went wrong while moving item.')); createFlash({
message: s__('Epics|Something went wrong while moving item.'),
});
}; };
export const moveItem = ( export const moveItem = (
...@@ -540,7 +551,9 @@ export const receiveCreateIssueSuccess = ({ commit }) => ...@@ -540,7 +551,9 @@ export const receiveCreateIssueSuccess = ({ commit }) =>
commit(types.RECEIVE_CREATE_ITEM_SUCCESS, { insertAt: 0, items: [] }); commit(types.RECEIVE_CREATE_ITEM_SUCCESS, { insertAt: 0, items: [] });
export const receiveCreateIssueFailure = ({ commit }) => { export const receiveCreateIssueFailure = ({ commit }) => {
commit(types.RECEIVE_CREATE_ITEM_FAILURE); commit(types.RECEIVE_CREATE_ITEM_FAILURE);
flash(s__('Epics|Something went wrong while creating issue.')); createFlash({
message: s__('Epics|Something went wrong while creating issue.'),
});
}; };
export const createNewIssue = ({ state, dispatch }, { issuesEndpoint, title }) => { export const createNewIssue = ({ state, dispatch }, { issuesEndpoint, title }) => {
const { parentItem } = state; const { parentItem } = state;
...@@ -568,7 +581,9 @@ export const receiveProjectsSuccess = ({ commit }, data) => ...@@ -568,7 +581,9 @@ export const receiveProjectsSuccess = ({ commit }, data) =>
commit(types.RECIEVE_PROJECTS_SUCCESS, data); commit(types.RECIEVE_PROJECTS_SUCCESS, data);
export const receiveProjectsFailure = ({ commit }) => { export const receiveProjectsFailure = ({ commit }) => {
commit(types.RECIEVE_PROJECTS_FAILURE); commit(types.RECIEVE_PROJECTS_FAILURE);
flash(__('Something went wrong while fetching projects.')); createFlash({
message: __('Something went wrong while fetching projects.'),
});
}; };
export const fetchProjects = ({ state, dispatch }, searchKey = '') => { export const fetchProjects = ({ state, dispatch }, searchKey = '') => {
const params = { const params = {
......
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 initTree from '~/repository'; import initTree from '~/repository';
...@@ -34,7 +34,9 @@ export default () => { ...@@ -34,7 +34,9 @@ export default () => {
.then(() => window.location.reload()) .then(() => window.location.reload())
.catch(() => { .catch(() => {
toggleBtn.removeAttribute('disabled'); toggleBtn.removeAttribute('disabled');
createFlash(__('An error occurred while initializing path locks')); createFlash({
message: __('An error occurred while initializing path locks'),
});
}); });
}); });
} }
......
import { deprecatedCreateFlash as flash } from '~/flash'; import createFlash from '~/flash';
import { s__ } from '~/locale'; import { s__ } from '~/locale';
import { EXTEND_AS } from '../constants'; import { EXTEND_AS } from '../constants';
...@@ -119,7 +119,9 @@ export const receiveEpicsSuccess = ( ...@@ -119,7 +119,9 @@ export const receiveEpicsSuccess = (
}; };
export const receiveEpicsFailure = ({ commit }) => { export const receiveEpicsFailure = ({ commit }) => {
commit(types.RECEIVE_EPICS_FAILURE); commit(types.RECEIVE_EPICS_FAILURE);
flash(s__('GroupRoadmap|Something went wrong while fetching epics')); createFlash({
message: s__('GroupRoadmap|Something went wrong while fetching epics'),
});
}; };
export const requestChildrenEpics = ({ commit }, { parentItemId }) => { export const requestChildrenEpics = ({ commit }, { parentItemId }) => {
...@@ -335,7 +337,9 @@ export const receiveMilestonesSuccess = ( ...@@ -335,7 +337,9 @@ export const receiveMilestonesSuccess = (
export const receiveMilestonesFailure = ({ commit }) => { export const receiveMilestonesFailure = ({ commit }) => {
commit(types.RECEIVE_MILESTONES_FAILURE); commit(types.RECEIVE_MILESTONES_FAILURE);
flash(s__('GroupRoadmap|Something went wrong while fetching milestones')); createFlash({
message: s__('GroupRoadmap|Something went wrong while fetching milestones'),
});
}; };
export const refreshMilestoneDates = ({ commit, state }) => { export const refreshMilestoneDates = ({ commit, state }) => {
......
import { deprecatedCreateFlash as createFlash } from '~/flash'; import createFlash from '~/flash';
import { __ } from '~/locale'; import { __ } from '~/locale';
import SCIMTokenService from './scim_token_service'; import SCIMTokenService from './scim_token_service';
...@@ -72,7 +72,9 @@ export default class SCIMTokenToggleArea { ...@@ -72,7 +72,9 @@ export default class SCIMTokenToggleArea {
this.setTokenAndToggleSCIMForm(response.data); this.setTokenAndToggleSCIMForm(response.data);
}) })
.catch((error) => { .catch((error) => {
createFlash(error); createFlash({
message: error,
});
this.toggleLoading(); this.toggleLoading();
this.toggleFormVisibility(container); this.toggleFormVisibility(container);
......
<script> <script>
import { GlIcon, GlLink, GlCard, GlFormCheckbox, GlSprintf } from '@gitlab/ui'; import { GlIcon, GlLink, GlCard, GlFormCheckbox, GlSprintf } from '@gitlab/ui';
import * as Sentry from '@sentry/browser'; import * as Sentry from '@sentry/browser';
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 glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
...@@ -77,9 +77,11 @@ export default { ...@@ -77,9 +77,11 @@ export default {
}) })
.catch((e) => { .catch((e) => {
Sentry.captureException(e); Sentry.captureException(e);
createFlash( createFlash({
__('Something went wrong while toggling auto-fix settings, please try again later.'), message: __(
); 'Something went wrong while toggling auto-fix settings, please try again later.',
),
});
this.isChecked = !enabled; this.isChecked = !enabled;
}) })
.finally(() => { .finally(() => {
......
<script> <script>
import { GlPopover, GlIcon, GlLink, GlButton, GlTooltipDirective } from '@gitlab/ui'; import { GlPopover, GlIcon, GlLink, GlButton, GlTooltipDirective } from '@gitlab/ui';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import createFlash from '~/flash';
import AccessorUtils from '~/lib/utils/accessor'; import AccessorUtils from '~/lib/utils/accessor';
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
import { formatDate } from '~/lib/utils/datetime_utility'; import { formatDate } from '~/lib/utils/datetime_utility';
...@@ -62,7 +62,9 @@ export default { ...@@ -62,7 +62,9 @@ export default {
}); });
}) })
.catch(() => { .catch(() => {
createFlash(s__('SecurityReports|There was an error while generating the report.')); createFlash({
message: s__('SecurityReports|There was an error while generating the report.'),
});
}) })
.finally(() => { .finally(() => {
this.isPreparingCsvExport = false; this.isPreparingCsvExport = false;
......
...@@ -6,7 +6,7 @@ import deleteProjectFromSecurityDashboard from 'ee/security_dashboard/graphql/mu ...@@ -6,7 +6,7 @@ import deleteProjectFromSecurityDashboard from 'ee/security_dashboard/graphql/mu
import projectsQuery from 'ee/security_dashboard/graphql/queries/get_instance_security_dashboard_projects.query.graphql'; import projectsQuery from 'ee/security_dashboard/graphql/queries/get_instance_security_dashboard_projects.query.graphql';
import getProjects from 'ee/security_dashboard/graphql/queries/get_projects.query.graphql'; import getProjects from 'ee/security_dashboard/graphql/queries/get_projects.query.graphql';
import { createInvalidProjectMessage } from 'ee/security_dashboard/utils/first_class_project_manager_utils'; import { createInvalidProjectMessage } from 'ee/security_dashboard/utils/first_class_project_manager_utils';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import createFlash from '~/flash';
import { __, s__, sprintf } from '~/locale'; import { __, s__, sprintf } from '~/locale';
import ProjectSelector from '~/vue_shared/components/project_selector/project_selector.vue'; import ProjectSelector from '~/vue_shared/components/project_selector/project_selector.vue';
import ProjectList from './project_list.vue'; import ProjectList from './project_list.vue';
...@@ -136,7 +136,9 @@ export default { ...@@ -136,7 +136,9 @@ export default {
}, },
); );
createFlash(errorMessages.join('<br/>')); createFlash({
message: errorMessages.join('<br/>'),
});
} }
}) })
.finally(() => { .finally(() => {
...@@ -167,7 +169,11 @@ export default { ...@@ -167,7 +169,11 @@ export default {
.then(() => { .then(() => {
this.$emit('handleProjectManipulation', false); this.$emit('handleProjectManipulation', false);
}) })
.catch(() => createFlash(__('Something went wrong, unable to delete project'))); .catch(() =>
createFlash({
message: __('Something went wrong, unable to delete project'),
}),
);
}, },
searched(query) { searched(query) {
this.searchQuery = query; this.searchQuery = query;
......
import Api from '~/api'; import Api from '~/api';
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 { __, s__, sprintf } from '~/locale'; import { __, s__, sprintf } from '~/locale';
import * as types from './mutation_types'; import * as types from './mutation_types';
...@@ -76,11 +76,11 @@ export const receiveAddProjectsSuccess = ({ commit, dispatch, state }, data) => ...@@ -76,11 +76,11 @@ export const receiveAddProjectsSuccess = ({ commit, dispatch, state }, data) =>
} else { } else {
invalidProjects = firstProject; invalidProjects = firstProject;
} }
createFlash( createFlash({
sprintf(s__('SecurityReports|Unable to add %{invalidProjects}'), { message: sprintf(s__('SecurityReports|Unable to add %{invalidProjects}'), {
invalidProjects, invalidProjects,
}), }),
); });
} }
if (added.length) { if (added.length) {
...@@ -91,7 +91,9 @@ export const receiveAddProjectsSuccess = ({ commit, dispatch, state }, data) => ...@@ -91,7 +91,9 @@ export const receiveAddProjectsSuccess = ({ commit, dispatch, state }, data) =>
export const receiveAddProjectsError = ({ commit }) => { export const receiveAddProjectsError = ({ commit }) => {
commit(types.RECEIVE_ADD_PROJECTS_ERROR); commit(types.RECEIVE_ADD_PROJECTS_ERROR);
createFlash(__('Something went wrong, unable to add projects to dashboard')); createFlash({
message: __('Something went wrong, unable to add projects to dashboard'),
});
}; };
export const fetchProjects = ({ state, dispatch }) => { export const fetchProjects = ({ state, dispatch }) => {
...@@ -116,7 +118,9 @@ export const receiveProjectsSuccess = ({ commit }, { projects }) => { ...@@ -116,7 +118,9 @@ export const receiveProjectsSuccess = ({ commit }, { projects }) => {
export const receiveProjectsError = ({ commit }) => { export const receiveProjectsError = ({ commit }) => {
commit(types.RECEIVE_PROJECTS_ERROR); commit(types.RECEIVE_PROJECTS_ERROR);
createFlash(__('Something went wrong, unable to get projects')); createFlash({
message: __('Something went wrong, unable to get projects'),
});
}; };
export const removeProject = ({ dispatch }, removePath) => { export const removeProject = ({ dispatch }, removePath) => {
...@@ -142,7 +146,9 @@ export const receiveRemoveProjectSuccess = ({ commit, dispatch }) => { ...@@ -142,7 +146,9 @@ export const receiveRemoveProjectSuccess = ({ commit, dispatch }) => {
export const receiveRemoveProjectError = ({ commit }) => { export const receiveRemoveProjectError = ({ commit }) => {
commit(types.RECEIVE_REMOVE_PROJECT_ERROR); commit(types.RECEIVE_REMOVE_PROJECT_ERROR);
createFlash(__('Something went wrong, unable to delete project')); createFlash({
message: __('Something went wrong, unable to delete project'),
});
}; };
export const fetchSearchResults = ({ state, dispatch, commit }) => { export const fetchSearchResults = ({ state, dispatch, commit }) => {
......
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 { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils'; import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils';
import { __ } from '~/locale'; import { __ } from '~/locale';
...@@ -31,7 +31,9 @@ export const receiveUnscannedProjectsSuccess = ({ commit }, payload) => { ...@@ -31,7 +31,9 @@ export const receiveUnscannedProjectsSuccess = ({ commit }, payload) => {
}; };
export const receiveUnscannedProjectsError = ({ commit }) => { export const receiveUnscannedProjectsError = ({ commit }) => {
createFlash(__('Unable to fetch unscanned projects')); createFlash({
message: __('Unable to fetch unscanned projects'),
});
commit(RECEIVE_UNSCANNED_PROJECTS_ERROR); commit(RECEIVE_UNSCANNED_PROJECTS_ERROR);
}; };
import _ from 'lodash'; import _ 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 { parseIntPagination, normalizeHeaders } from '~/lib/utils/common_utils'; import { parseIntPagination, normalizeHeaders } from '~/lib/utils/common_utils';
import download from '~/lib/utils/downloader'; import download from '~/lib/utils/downloader';
...@@ -125,11 +125,11 @@ export const receiveCreateIssueError = ({ commit }, { flashError }) => { ...@@ -125,11 +125,11 @@ export const receiveCreateIssueError = ({ commit }, { flashError }) => {
commit(types.RECEIVE_CREATE_ISSUE_ERROR); commit(types.RECEIVE_CREATE_ISSUE_ERROR);
if (flashError) { if (flashError) {
createFlash( createFlash({
s__('SecurityReports|There was an error creating the issue.'), message: s__('SecurityReports|There was an error creating the issue.'),
'alert', type: 'alert',
document.querySelector('.ci-table'), parent: document.querySelector('.ci-table'),
); });
} }
}; };
...@@ -197,11 +197,11 @@ export const receiveDismissSelectedVulnerabilitiesSuccess = ({ commit, getters } ...@@ -197,11 +197,11 @@ export const receiveDismissSelectedVulnerabilitiesSuccess = ({ commit, getters }
export const receiveDismissSelectedVulnerabilitiesError = ({ commit }, { flashError }) => { export const receiveDismissSelectedVulnerabilitiesError = ({ commit }, { flashError }) => {
commit(types.RECEIVE_DISMISS_SELECTED_VULNERABILITIES_ERROR); commit(types.RECEIVE_DISMISS_SELECTED_VULNERABILITIES_ERROR);
if (flashError) { if (flashError) {
createFlash( createFlash({
s__('SecurityReports|There was an error dismissing the vulnerabilities.'), message: s__('SecurityReports|There was an error dismissing the vulnerabilities.'),
'alert', type: 'alert',
document.querySelector('.ci-table'), parent: document.querySelector('.ci-table'),
); });
} }
}; };
...@@ -284,11 +284,11 @@ export const receiveDismissVulnerabilitySuccess = ({ commit }, payload) => { ...@@ -284,11 +284,11 @@ export const receiveDismissVulnerabilitySuccess = ({ commit }, payload) => {
export const receiveDismissVulnerabilityError = ({ commit }, { flashError }) => { export const receiveDismissVulnerabilityError = ({ commit }, { flashError }) => {
commit(types.RECEIVE_DISMISS_VULNERABILITY_ERROR); commit(types.RECEIVE_DISMISS_VULNERABILITY_ERROR);
if (flashError) { if (flashError) {
createFlash( createFlash({
s__('SecurityReports|There was an error dismissing the vulnerability.'), message: s__('SecurityReports|There was an error dismissing the vulnerability.'),
'alert', type: 'alert',
document.querySelector('.ci-table'), parent: document.querySelector('.ci-table'),
); });
} }
}; };
...@@ -407,11 +407,11 @@ export const receiveUndoDismissSuccess = ({ commit }, payload) => { ...@@ -407,11 +407,11 @@ export const receiveUndoDismissSuccess = ({ commit }, payload) => {
export const receiveUndoDismissError = ({ commit }, { flashError }) => { export const receiveUndoDismissError = ({ commit }, { flashError }) => {
commit(types.RECEIVE_REVERT_DISMISSAL_ERROR); commit(types.RECEIVE_REVERT_DISMISSAL_ERROR);
if (flashError) { if (flashError) {
createFlash( createFlash({
s__('SecurityReports|There was an error reverting this dismissal.'), message: s__('SecurityReports|There was an error reverting this dismissal.'),
'alert', type: 'alert',
document.querySelector('.ci-table'), parent: document.querySelector('.ci-table'),
); });
} }
}; };
...@@ -475,11 +475,11 @@ export const receiveCreateMergeRequestError = ({ commit }, { flashError }) => { ...@@ -475,11 +475,11 @@ export const receiveCreateMergeRequestError = ({ commit }, { flashError }) => {
commit(types.RECEIVE_CREATE_MERGE_REQUEST_ERROR); commit(types.RECEIVE_CREATE_MERGE_REQUEST_ERROR);
if (flashError) { if (flashError) {
createFlash( createFlash({
s__('SecurityReports|There was an error creating the merge request.'), message: s__('SecurityReports|There was an error creating the merge request.'),
'alert', type: 'alert',
document.querySelector('.ci-table'), parent: document.querySelector('.ci-table'),
); });
} }
}; };
......
import axios from 'axios'; import axios from 'axios';
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';
...@@ -34,7 +34,9 @@ export const receiveProjectsSuccess = ({ commit }, payload) => { ...@@ -34,7 +34,9 @@ export const receiveProjectsSuccess = ({ commit }, payload) => {
}; };
export const receiveProjectsError = ({ commit }) => { export const receiveProjectsError = ({ commit }) => {
createFlash(__('Unable to fetch vulnerable projects')); createFlash({
message: __('Unable to fetch vulnerable projects'),
});
commit(SET_HAS_ERROR, true); commit(SET_HAS_ERROR, true);
}; };
<script> <script>
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import { deprecatedCreateFlash as Flash } from '~/flash'; import createFlash from '~/flash';
import { __ } from '~/locale'; import { __ } from '~/locale';
import { OPENED, REOPENED } from '~/notes/constants'; import { OPENED, REOPENED } from '~/notes/constants';
import Status from './status.vue'; import Status from './status.vue';
...@@ -27,7 +27,9 @@ export default { ...@@ -27,7 +27,9 @@ export default {
methods: { methods: {
handleDropdownClick(status) { handleDropdownClick(status) {
this.mediator.updateStatus(status).catch(() => { this.mediator.updateStatus(status).catch(() => {
Flash(__('Error occurred while updating the issue status')); createFlash({
message: __('Error occurred while updating the issue status'),
});
}); });
}, },
}, },
......
<script> <script>
import { deprecatedCreateFlash as Flash } from '~/flash'; import createFlash from '~/flash';
import { __ } from '~/locale'; import { __ } from '~/locale';
import eventHub from '~/sidebar/event_hub'; import eventHub from '~/sidebar/event_hub';
import weightComponent from './weight.vue'; import weightComponent from './weight.vue';
...@@ -29,7 +29,9 @@ export default { ...@@ -29,7 +29,9 @@ export default {
methods: { methods: {
onUpdateWeight(newWeight) { onUpdateWeight(newWeight) {
this.mediator.updateWeight(newWeight).catch(() => { this.mediator.updateWeight(newWeight).catch(() => {
Flash(__('Error occurred while updating the issue weight')); createFlash({
message: __('Error occurred while updating the issue weight'),
});
}); });
}, },
}, },
......
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 { refreshCurrentPage } from '~/lib/utils/url_utility'; import { refreshCurrentPage } from '~/lib/utils/url_utility';
import { __ } from '~/locale'; import { __ } from '~/locale';
...@@ -50,5 +50,8 @@ export const receiveStatusPageSettingsUpdateError = (_, error) => { ...@@ -50,5 +50,8 @@ export const receiveStatusPageSettingsUpdateError = (_, error) => {
const { response } = error; const { response } = error;
const message = response?.data?.message || ''; const message = response?.data?.message || '';
createFlash(`${__('There was an error saving your changes.')} ${message}`, 'alert'); createFlash({
message: `${__('There was an error saving your changes.')} ${message}`,
type: 'alert',
});
}; };
import Api from 'ee/api'; import Api from 'ee/api';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import createFlash from '~/flash';
import { redirectTo } from '~/lib/utils/url_utility'; import { redirectTo } from '~/lib/utils/url_utility';
import { sprintf, s__ } from '~/locale'; import { sprintf, s__ } from '~/locale';
import { STEPS, PAYMENT_FORM_ID } from '../constants'; import { STEPS, PAYMENT_FORM_ID } from '../constants';
...@@ -55,7 +55,9 @@ export const fetchCountriesSuccess = ({ commit }, data = []) => { ...@@ -55,7 +55,9 @@ export const fetchCountriesSuccess = ({ commit }, data = []) => {
}; };
export const fetchCountriesError = () => { export const fetchCountriesError = () => {
createFlash(s__('Checkout|Failed to load countries. Please try again.')); createFlash({
message: s__('Checkout|Failed to load countries. Please try again.'),
});
}; };
export const fetchStates = ({ state, dispatch }) => { export const fetchStates = ({ state, dispatch }) => {
...@@ -77,7 +79,9 @@ export const fetchStatesSuccess = ({ commit }, data = {}) => { ...@@ -77,7 +79,9 @@ export const fetchStatesSuccess = ({ commit }, data = {}) => {
}; };
export const fetchStatesError = () => { export const fetchStatesError = () => {
createFlash(s__('Checkout|Failed to load states. Please try again.')); createFlash({
message: s__('Checkout|Failed to load states. Please try again.'),
});
}; };
export const resetStates = ({ commit }) => { export const resetStates = ({ commit }) => {
...@@ -119,22 +123,24 @@ export const fetchPaymentFormParams = ({ dispatch }) => ...@@ -119,22 +123,24 @@ export const fetchPaymentFormParams = ({ dispatch }) =>
export const fetchPaymentFormParamsSuccess = ({ commit }, data) => { export const fetchPaymentFormParamsSuccess = ({ commit }, data) => {
if (data.errors) { if (data.errors) {
createFlash( createFlash({
sprintf( message: sprintf(
s__('Checkout|Credit card form failed to load: %{message}'), s__('Checkout|Credit card form failed to load: %{message}'),
{ {
message: data.errors, message: data.errors,
}, },
false, false,
), ),
); });
} else { } else {
commit(types.UPDATE_PAYMENT_FORM_PARAMS, data); commit(types.UPDATE_PAYMENT_FORM_PARAMS, data);
} }
}; };
export const fetchPaymentFormParamsError = () => { export const fetchPaymentFormParamsError = () => {
createFlash(s__('Checkout|Credit card form failed to load. Please try again.')); createFlash({
message: s__('Checkout|Credit card form failed to load. Please try again.'),
});
}; };
export const zuoraIframeRendered = ({ commit }) => export const zuoraIframeRendered = ({ commit }) =>
...@@ -157,15 +163,15 @@ export const paymentFormSubmittedSuccess = ({ commit, dispatch }, paymentMethodI ...@@ -157,15 +163,15 @@ export const paymentFormSubmittedSuccess = ({ commit, dispatch }, paymentMethodI
}; };
export const paymentFormSubmittedError = (_, response) => { export const paymentFormSubmittedError = (_, response) => {
createFlash( createFlash({
sprintf( message: sprintf(
s__( s__(
'Checkout|Submitting the credit card form failed with code %{errorCode}: %{errorMessage}', 'Checkout|Submitting the credit card form failed with code %{errorCode}: %{errorMessage}',
), ),
response, response,
false, false,
), ),
); });
}; };
export const fetchPaymentMethodDetails = ({ state, dispatch, commit }) => export const fetchPaymentMethodDetails = ({ state, dispatch, commit }) =>
...@@ -181,7 +187,9 @@ export const fetchPaymentMethodDetailsSuccess = ({ commit, dispatch }, creditCar ...@@ -181,7 +187,9 @@ export const fetchPaymentMethodDetailsSuccess = ({ commit, dispatch }, creditCar
}; };
export const fetchPaymentMethodDetailsError = () => { export const fetchPaymentMethodDetailsError = () => {
createFlash(s__('Checkout|Failed to register credit card. Please try again.')); createFlash({
message: s__('Checkout|Failed to register credit card. Please try again.'),
});
}; };
export const confirmOrder = ({ getters, dispatch, commit }) => { export const confirmOrder = ({ getters, dispatch, commit }) => {
...@@ -211,5 +219,7 @@ export const confirmOrderError = ({ commit }, message = null) => { ...@@ -211,5 +219,7 @@ export const confirmOrderError = ({ commit }, message = null) => {
? s__('Checkout|Failed to confirm your order: %{message}. Please try again.') ? s__('Checkout|Failed to confirm your order: %{message}. Please try again.')
: s__('Checkout|Failed to confirm your order! Please try again.'); : s__('Checkout|Failed to confirm your order! Please try again.');
createFlash(sprintf(errorString, { message }, false)); createFlash({
message: sprintf(errorString, { message }, false),
});
}; };
import { deprecatedCreateFlash as createFlash, FLASH_TYPES } from '~/flash'; import createFlash, { FLASH_TYPES } from '~/flash';
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
import { joinPaths } from '~/lib/utils/url_utility'; import { joinPaths } from '~/lib/utils/url_utility';
import { s__, sprintf } from '~/locale'; import { s__, sprintf } from '~/locale';
...@@ -13,7 +13,9 @@ const commitReceivePoliciesError = (commit, data) => { ...@@ -13,7 +13,9 @@ const commitReceivePoliciesError = (commit, data) => {
data?.error || s__('NetworkPolicies|Something went wrong, unable to fetch policies'); data?.error || s__('NetworkPolicies|Something went wrong, unable to fetch policies');
const policies = data?.payload?.length ? data.payload : []; const policies = data?.payload?.length ? data.payload : [];
commit(types.RECEIVE_POLICIES_ERROR, policies); commit(types.RECEIVE_POLICIES_ERROR, policies);
createFlash(error); createFlash({
message: error,
});
}; };
export const fetchPolicies = ({ state, commit }, environmentId) => { export const fetchPolicies = ({ state, commit }, environmentId) => {
...@@ -35,7 +37,9 @@ const commitPolicyError = (commit, type, payload) => { ...@@ -35,7 +37,9 @@ const commitPolicyError = (commit, type, payload) => {
const error = const error =
payload?.error || s__('NetworkPolicies|Something went wrong, failed to update policy'); payload?.error || s__('NetworkPolicies|Something went wrong, failed to update policy');
commit(type, error); commit(type, error);
createFlash(error); createFlash({
message: error,
});
}; };
export const createPolicy = ({ state, commit }, { environmentId, policy }) => { export const createPolicy = ({ state, commit }, { environmentId, policy }) => {
...@@ -52,12 +56,13 @@ export const createPolicy = ({ state, commit }, { environmentId, policy }) => { ...@@ -52,12 +56,13 @@ export const createPolicy = ({ state, commit }, { environmentId, policy }) => {
}) })
.then(({ data }) => { .then(({ data }) => {
commit(types.RECEIVE_CREATE_POLICY_SUCCESS, data); commit(types.RECEIVE_CREATE_POLICY_SUCCESS, data);
createFlash( createFlash({
sprintf(s__('NetworkPolicies|Policy %{policyName} was successfully changed'), { message: sprintf(s__('NetworkPolicies|Policy %{policyName} was successfully changed'), {
policyName: policy.name, policyName: policy.name,
}), }),
FLASH_TYPES.SUCCESS,
); type: FLASH_TYPES.SUCCESS,
});
}) })
.catch((error) => .catch((error) =>
commitPolicyError(commit, types.RECEIVE_CREATE_POLICY_ERROR, error?.response?.data), commitPolicyError(commit, types.RECEIVE_CREATE_POLICY_ERROR, error?.response?.data),
...@@ -82,12 +87,13 @@ export const updatePolicy = ({ state, commit }, { environmentId, policy }) => { ...@@ -82,12 +87,13 @@ export const updatePolicy = ({ state, commit }, { environmentId, policy }) => {
policy, policy,
updatedPolicy: data, updatedPolicy: data,
}); });
createFlash( createFlash({
sprintf(s__('NetworkPolicies|Policy %{policyName} was successfully changed'), { message: sprintf(s__('NetworkPolicies|Policy %{policyName} was successfully changed'), {
policyName: policy.name, policyName: policy.name,
}), }),
FLASH_TYPES.SUCCESS,
); type: FLASH_TYPES.SUCCESS,
});
}) })
.catch((error) => .catch((error) =>
commitPolicyError(commit, types.RECEIVE_UPDATE_POLICY_ERROR, error?.response?.data), commitPolicyError(commit, types.RECEIVE_UPDATE_POLICY_ERROR, error?.response?.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 { s__ } from '~/locale'; import { s__ } from '~/locale';
import * as types from './mutation_types'; import * as types from './mutation_types';
...@@ -20,7 +20,9 @@ export const receiveEnvironmentsSuccess = ({ commit }, environments) => ...@@ -20,7 +20,9 @@ export const receiveEnvironmentsSuccess = ({ commit }, environments) =>
commit(types.RECEIVE_ENVIRONMENTS_SUCCESS, environments); commit(types.RECEIVE_ENVIRONMENTS_SUCCESS, environments);
export const receiveEnvironmentsError = ({ commit }) => { export const receiveEnvironmentsError = ({ commit }) => {
commit(types.RECEIVE_ENVIRONMENTS_ERROR); commit(types.RECEIVE_ENVIRONMENTS_ERROR);
createFlash(s__('ThreatMonitoring|Something went wrong, unable to fetch environments')); createFlash({
message: s__('ThreatMonitoring|Something went wrong, unable to fetch environments'),
});
}; };
const getAllEnvironments = (url, page = 1) => const getAllEnvironments = (url, page = 1) =>
......
import { deprecatedCreateFlash as createFlash } from '~/flash'; import createFlash from '~/flash';
import httpStatusCodes from '~/lib/utils/http_status'; import httpStatusCodes from '~/lib/utils/http_status';
import pollUntilComplete from '~/lib/utils/poll_until_complete'; import pollUntilComplete from '~/lib/utils/poll_until_complete';
import { s__ } from '~/locale'; import { s__ } from '~/locale';
...@@ -13,7 +13,9 @@ export const receiveStatisticsSuccess = ({ commit }, statistics) => ...@@ -13,7 +13,9 @@ export const receiveStatisticsSuccess = ({ commit }, statistics) =>
commit(types.RECEIVE_STATISTICS_SUCCESS, statistics); commit(types.RECEIVE_STATISTICS_SUCCESS, statistics);
export const receiveStatisticsError = ({ commit }) => { export const receiveStatisticsError = ({ commit }) => {
commit(types.RECEIVE_STATISTICS_ERROR); commit(types.RECEIVE_STATISTICS_ERROR);
createFlash(s__('ThreatMonitoring|Something went wrong, unable to fetch statistics')); createFlash({
message: s__('ThreatMonitoring|Something went wrong, unable to fetch statistics'),
});
}; };
export const fetchStatistics = ({ state, dispatch, rootState }) => { export const fetchStatistics = ({ state, dispatch, rootState }) => {
......
<script> <script>
import { deprecatedCreateFlash as createFlash } from '~/flash'; import createFlash from '~/flash';
import { BV_HIDE_MODAL } from '~/lib/utils/constants'; import { BV_HIDE_MODAL } from '~/lib/utils/constants';
import Approvals from '~/vue_merge_request_widget/components/approvals/approvals.vue'; import Approvals from '~/vue_merge_request_widget/components/approvals/approvals.vue';
import { FETCH_ERROR } from '~/vue_merge_request_widget/components/approvals/messages'; import { FETCH_ERROR } from '~/vue_merge_request_widget/components/approvals/messages';
...@@ -67,7 +67,9 @@ export default { ...@@ -67,7 +67,9 @@ export default {
if (this.isBasic) return Promise.resolve(); if (this.isBasic) return Promise.resolve();
return Promise.all([this.refreshRules(), this.refreshApprovals()]).catch(() => return Promise.all([this.refreshRules(), this.refreshApprovals()]).catch(() =>
createFlash(FETCH_ERROR), createFlash({
message: FETCH_ERROR,
}),
); );
}, },
refreshRules() { refreshRules() {
......
import Api from 'ee/api'; import Api from 'ee/api';
import { noneEpic } from 'ee/vue_shared/constants'; import { noneEpic } from 'ee/vue_shared/constants';
import boardsStore from '~/boards/stores/boards_store'; import boardsStore from '~/boards/stores/boards_store';
import { deprecatedCreateFlash as flash } from '~/flash'; import createFlash from '~/flash';
import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils'; import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils';
import { formatDate, timeFor } from '~/lib/utils/datetime_utility'; import { formatDate, timeFor } from '~/lib/utils/datetime_utility';
...@@ -35,7 +35,9 @@ export const receiveEpicsSuccess = ({ commit }, data) => { ...@@ -35,7 +35,9 @@ export const receiveEpicsSuccess = ({ commit }, data) => {
commit(types.RECEIVE_EPICS_SUCCESS, { epics }); commit(types.RECEIVE_EPICS_SUCCESS, { epics });
}; };
export const receiveEpicsFailure = ({ commit }) => { export const receiveEpicsFailure = ({ commit }) => {
flash(s__('Epics|Something went wrong while fetching group epics.')); createFlash({
message: s__('Epics|Something went wrong while fetching group epics.'),
});
commit(types.RECEIVE_EPICS_FAILURE); commit(types.RECEIVE_EPICS_FAILURE);
}; };
export const fetchEpics = ({ state, dispatch }, search = '') => { export const fetchEpics = ({ state, dispatch }, search = '') => {
...@@ -108,7 +110,9 @@ export const receiveIssueUpdateSuccess = ({ state, commit }, { data, epic, isRem ...@@ -108,7 +110,9 @@ export const receiveIssueUpdateSuccess = ({ state, commit }, { data, epic, isRem
* @param {string} errorMessage * @param {string} errorMessage
*/ */
export const receiveIssueUpdateFailure = ({ commit }, errorMessage) => { export const receiveIssueUpdateFailure = ({ commit }, errorMessage) => {
flash(errorMessage); createFlash({
message: errorMessage,
});
commit(types.RECEIVE_ISSUE_UPDATE_FAILURE); commit(types.RECEIVE_ISSUE_UPDATE_FAILURE);
}; };
......
import { find } from 'lodash'; import { find } from 'lodash';
import Visibility from 'visibilityjs'; import Visibility from 'visibilityjs';
import Api from '~/api'; import Api from '~/api';
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 Poll from '~/lib/utils/poll'; import Poll from '~/lib/utils/poll';
import { __, s__, n__, sprintf } from '~/locale'; import { __, s__, n__, sprintf } from '~/locale';
...@@ -70,8 +70,8 @@ export const receiveAddProjectsToDashboardSuccess = ({ dispatch, state }, data) ...@@ -70,8 +70,8 @@ export const receiveAddProjectsToDashboardSuccess = ({ dispatch, state }, data)
} else { } else {
invalidProjects = firstProject; invalidProjects = firstProject;
} }
createFlash( createFlash({
sprintf( message: sprintf(
s__( s__(
'Dashboard|Unable to add %{invalidProjects}. This dashboard is available for public projects, and private projects in groups with a Premium plan.', 'Dashboard|Unable to add %{invalidProjects}. This dashboard is available for public projects, and private projects in groups with a Premium plan.',
), ),
...@@ -79,7 +79,7 @@ export const receiveAddProjectsToDashboardSuccess = ({ dispatch, state }, data) ...@@ -79,7 +79,7 @@ export const receiveAddProjectsToDashboardSuccess = ({ dispatch, state }, data)
invalidProjects, invalidProjects,
}, },
), ),
); });
} }
if (added.length) { if (added.length) {
...@@ -88,11 +88,11 @@ export const receiveAddProjectsToDashboardSuccess = ({ dispatch, state }, data) ...@@ -88,11 +88,11 @@ export const receiveAddProjectsToDashboardSuccess = ({ dispatch, state }, data)
}; };
export const receiveAddProjectsToDashboardError = ({ state }) => { export const receiveAddProjectsToDashboardError = ({ state }) => {
createFlash( createFlash({
sprintf(__('Something went wrong, unable to add %{project} to dashboard'), { message: sprintf(__('Something went wrong, unable to add %{project} to dashboard'), {
project: n__('project', 'projects', state.selectedProjects.length), project: n__('project', 'projects', state.selectedProjects.length),
}), }),
); });
}; };
export const fetchProjects = ({ state, dispatch, commit }, page) => { export const fetchProjects = ({ state, dispatch, commit }, page) => {
...@@ -134,7 +134,9 @@ export const requestProjects = ({ commit }) => { ...@@ -134,7 +134,9 @@ export const requestProjects = ({ commit }) => {
export const receiveProjectsError = ({ commit }) => { export const receiveProjectsError = ({ commit }) => {
commit(types.RECEIVE_PROJECTS_ERROR); commit(types.RECEIVE_PROJECTS_ERROR);
createFlash(__('Something went wrong, unable to get projects')); createFlash({
message: __('Something went wrong, unable to get projects'),
});
}; };
export const removeProject = ({ dispatch }, removePath) => { export const removeProject = ({ dispatch }, removePath) => {
...@@ -147,7 +149,9 @@ export const removeProject = ({ dispatch }, removePath) => { ...@@ -147,7 +149,9 @@ export const removeProject = ({ dispatch }, removePath) => {
export const receiveRemoveProjectSuccess = ({ dispatch }) => dispatch('forceProjectsRequest'); export const receiveRemoveProjectSuccess = ({ dispatch }) => dispatch('forceProjectsRequest');
export const receiveRemoveProjectError = () => { export const receiveRemoveProjectError = () => {
createFlash(__('Something went wrong, unable to delete project')); createFlash({
message: __('Something went wrong, unable to delete project'),
});
}; };
export const setSearchQuery = ({ commit }, query) => commit(types.SET_SEARCH_QUERY, query); export const setSearchQuery = ({ commit }, query) => commit(types.SET_SEARCH_QUERY, query);
......
import Vue from 'vue'; import Vue from 'vue';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import createFlash from '~/flash';
import AccessorUtilities from '~/lib/utils/accessor'; import AccessorUtilities from '~/lib/utils/accessor';
import { parseIntPagination, normalizeHeaders } from '~/lib/utils/common_utils'; import { parseIntPagination, normalizeHeaders } from '~/lib/utils/common_utils';
import { __ } from '~/locale'; import { __ } from '~/locale';
...@@ -29,10 +29,10 @@ export default { ...@@ -29,10 +29,10 @@ export default {
state.projects.map((p) => p.id), state.projects.map((p) => p.id),
); );
} else { } else {
createFlash( createFlash({
__('Project order will not be saved as local storage is not available.'), message: __('Project order will not be saved as local storage is not available.'),
'warning', type: 'warning',
); });
} }
}, },
[types.SET_SEARCH_QUERY](state, query) { [types.SET_SEARCH_QUERY](state, query) {
......
...@@ -5,7 +5,7 @@ import Api from 'ee/api'; ...@@ -5,7 +5,7 @@ import Api from 'ee/api';
import MergeRequestNote from 'ee/vue_shared/security_reports/components/merge_request_note.vue'; import MergeRequestNote from 'ee/vue_shared/security_reports/components/merge_request_note.vue';
import SolutionCard from 'ee/vue_shared/security_reports/components/solution_card.vue'; import SolutionCard from 'ee/vue_shared/security_reports/components/solution_card.vue';
import { VULNERABILITY_STATE_OBJECTS } from 'ee/vulnerabilities/constants'; import { VULNERABILITY_STATE_OBJECTS } from 'ee/vulnerabilities/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 { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils'; import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils';
import Poll from '~/lib/utils/poll'; import Poll from '~/lib/utils/poll';
...@@ -138,11 +138,11 @@ export default { ...@@ -138,11 +138,11 @@ export default {
}); });
}) })
.catch(() => { .catch(() => {
createFlash( createFlash({
s__( message: s__(
'VulnerabilityManagement|Something went wrong while trying to retrieve the vulnerability history. Please try again later.', 'VulnerabilityManagement|Something went wrong while trying to retrieve the vulnerability history. Please try again later.',
), ),
); });
}); });
}, },
createNotesPoll() { createNotesPoll() {
...@@ -161,7 +161,9 @@ export default { ...@@ -161,7 +161,9 @@ export default {
this.lastFetchedAt = lastFetchedAt; this.lastFetchedAt = lastFetchedAt;
}, },
errorCallback: () => errorCallback: () =>
createFlash(__('Something went wrong while fetching latest comments.')), createFlash({
message: __('Something went wrong while fetching latest comments.'),
}),
}); });
}, },
updateNotes(notes) { updateNotes(notes) {
......
...@@ -3,7 +3,7 @@ import { GlLoadingIcon, GlButton, GlBadge } from '@gitlab/ui'; ...@@ -3,7 +3,7 @@ import { GlLoadingIcon, GlButton, GlBadge } from '@gitlab/ui';
import fetchHeaderVulnerabilityQuery from 'ee/security_dashboard/graphql/header_vulnerability.graphql'; import fetchHeaderVulnerabilityQuery from 'ee/security_dashboard/graphql/header_vulnerability.graphql';
import vulnerabilityStateMutations from 'ee/security_dashboard/graphql/mutate_vulnerability_state'; import vulnerabilityStateMutations from 'ee/security_dashboard/graphql/mutate_vulnerability_state';
import SplitButton from 'ee/vue_shared/security_reports/components/split_button.vue'; import SplitButton from 'ee/vue_shared/security_reports/components/split_button.vue';
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 { convertObjectPropsToSnakeCase } from '~/lib/utils/common_utils'; import { convertObjectPropsToSnakeCase } from '~/lib/utils/common_utils';
import download from '~/lib/utils/downloader'; import download from '~/lib/utils/downloader';
...@@ -80,11 +80,11 @@ export default { ...@@ -80,11 +80,11 @@ export default {
}; };
}, },
error() { error() {
createFlash( createFlash({
s__( message: s__(
'VulnerabilityManagement|Something went wrong while trying to refresh the vulnerability. Please try again later.', 'VulnerabilityManagement|Something went wrong while trying to refresh the vulnerability. Please try again later.',
), ),
); });
}, },
skip() { skip() {
return !this.shouldRefreshVulnerability; return !this.shouldRefreshVulnerability;
...@@ -155,7 +155,9 @@ export default { ...@@ -155,7 +155,9 @@ export default {
this.user = userData; this.user = userData;
}) })
.catch(() => { .catch(() => {
createFlash(s__('VulnerabilityManagement|Something went wrong, could not get user.')); createFlash({
message: s__('VulnerabilityManagement|Something went wrong, could not get user.'),
});
}) })
.finally(() => { .finally(() => {
this.isLoadingUser = false; this.isLoadingUser = false;
...@@ -188,11 +190,13 @@ export default { ...@@ -188,11 +190,13 @@ export default {
this.$emit('vulnerability-state-change'); this.$emit('vulnerability-state-change');
} catch (error) { } catch (error) {
createFlash({ createFlash({
error, message: {
captureError: true, error,
message: s__( captureError: true,
'VulnerabilityManagement|Something went wrong, could not update vulnerability state.', message: s__(
), 'VulnerabilityManagement|Something went wrong, could not update vulnerability state.',
),
},
}); });
} finally { } finally {
this.isLoadingVulnerability = false; this.isLoadingVulnerability = false;
...@@ -228,9 +232,11 @@ export default { ...@@ -228,9 +232,11 @@ export default {
}) })
.catch(() => { .catch(() => {
this.isProcessingAction = false; this.isProcessingAction = false;
createFlash( createFlash({
s__('ciReport|There was an error creating the merge request. Please try again.'), message: s__(
); 'ciReport|There was an error creating the merge request. Please try again.',
),
});
}); });
}, },
downloadPatch() { downloadPatch() {
......
<script> <script>
import { GlButton, GlSafeHtmlDirective as SafeHtml, GlLoadingIcon } from '@gitlab/ui'; import { GlButton, GlSafeHtmlDirective as SafeHtml, GlLoadingIcon } from '@gitlab/ui';
import EventItem from 'ee/vue_shared/security_reports/components/event_item.vue'; import EventItem from 'ee/vue_shared/security_reports/components/event_item.vue';
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 { __, s__ } from '~/locale'; import { __, s__ } from '~/locale';
import HistoryCommentEditor from './history_comment_editor.vue'; import HistoryCommentEditor from './history_comment_editor.vue';
...@@ -108,11 +108,11 @@ export default { ...@@ -108,11 +108,11 @@ export default {
this.$emit(emitName, responseData, this.comment); this.$emit(emitName, responseData, this.comment);
}) })
.catch(() => { .catch(() => {
createFlash( createFlash({
s__( message: s__(
'VulnerabilityManagement|Something went wrong while trying to save the comment. Please try again later.', 'VulnerabilityManagement|Something went wrong while trying to save the comment. Please try again later.',
), ),
); });
}); });
}, },
deleteComment() { deleteComment() {
...@@ -125,11 +125,11 @@ export default { ...@@ -125,11 +125,11 @@ export default {
this.$emit('onCommentDeleted', this.comment); this.$emit('onCommentDeleted', this.comment);
}) })
.catch(() => .catch(() =>
createFlash( createFlash({
s__( message: s__(
'VulnerabilityManagement|Something went wrong while trying to delete the comment. Please try again later.', 'VulnerabilityManagement|Something went wrong while trying to delete the comment. Please try again later.',
), ),
), }),
) )
.finally(() => { .finally(() => {
this.isDeletingComment = false; this.isDeletingComment = false;
......
<script> <script>
import { GlButton } from '@gitlab/ui'; import { GlButton } from '@gitlab/ui';
import axios from 'axios'; import axios from 'axios';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import createFlash from '~/flash';
import { joinPaths, redirectTo } from '~/lib/utils/url_utility'; import { joinPaths, redirectTo } from '~/lib/utils/url_utility';
import { sprintf, __, s__ } from '~/locale'; import { sprintf, __, s__ } from '~/locale';
import RelatedIssuesBlock from '~/related_issues/components/related_issues_block.vue'; import RelatedIssuesBlock from '~/related_issues/components/related_issues_block.vue';
...@@ -135,7 +135,9 @@ export default { ...@@ -135,7 +135,9 @@ export default {
if (hasErrors) { if (hasErrors) {
const messages = errors.map((error) => sprintf(RELATED_ISSUES_ERRORS.LINK_ERROR, error)); const messages = errors.map((error) => sprintf(RELATED_ISSUES_ERRORS.LINK_ERROR, error));
createFlash(messages.join(' ')); createFlash({
message: messages.join(' '),
});
} }
}); });
}, },
...@@ -150,7 +152,9 @@ export default { ...@@ -150,7 +152,9 @@ export default {
this.store.removeRelatedIssue(issue); this.store.removeRelatedIssue(issue);
}) })
.catch(() => { .catch(() => {
createFlash(RELATED_ISSUES_ERRORS.UNLINK_ERROR); createFlash({
message: RELATED_ISSUES_ERRORS.UNLINK_ERROR,
});
}); });
}, },
fetchRelatedIssues() { fetchRelatedIssues() {
...@@ -177,7 +181,9 @@ export default { ...@@ -177,7 +181,9 @@ export default {
); );
}) })
.catch(() => { .catch(() => {
createFlash(__('An error occurred while fetching issues.')); createFlash({
message: __('An error occurred while fetching issues.'),
});
}) })
.finally(() => { .finally(() => {
this.isFetching = false; this.isFetching = false;
......
...@@ -4,7 +4,7 @@ import * as actions from 'ee/analytics/code_review_analytics/store/modules/merge ...@@ -4,7 +4,7 @@ import * as actions from 'ee/analytics/code_review_analytics/store/modules/merge
import * as types from 'ee/analytics/code_review_analytics/store/modules/merge_requests/mutation_types'; import * as types from 'ee/analytics/code_review_analytics/store/modules/merge_requests/mutation_types';
import getInitialState from 'ee/analytics/code_review_analytics/store/modules/merge_requests/state'; import getInitialState from 'ee/analytics/code_review_analytics/store/modules/merge_requests/state';
import testAction from 'helpers/vuex_action_helper'; import testAction from 'helpers/vuex_action_helper';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import createFlash from '~/flash';
import { mockMergeRequests } from '../../../mock_data'; import { mockMergeRequests } from '../../../mock_data';
jest.mock('~/flash'); jest.mock('~/flash');
......
...@@ -13,7 +13,7 @@ import { ...@@ -13,7 +13,7 @@ import {
import createStore from 'ee/analytics/cycle_analytics/store'; import createStore from 'ee/analytics/cycle_analytics/store';
import * as getters from 'ee/analytics/cycle_analytics/store/getters'; import * as getters from 'ee/analytics/cycle_analytics/store/getters';
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 { groupLabels } from '../../mock_data'; import { groupLabels } from '../../mock_data';
const selectedLabelIds = [groupLabels[0].id]; const selectedLabelIds = [groupLabels[0].id];
...@@ -174,10 +174,10 @@ describe('TasksByTypeFilters', () => { ...@@ -174,10 +174,10 @@ describe('TasksByTypeFilters', () => {
}); });
it('should display a message', () => { it('should display a message', () => {
expect(createFlash).toHaveBeenCalledWith( expect(createFlash).toHaveBeenCalledWith({
'Only 2 labels can be selected at this time', message: 'Only 2 labels can be selected at this time',
'notice', type: 'notice',
); });
}); });
}); });
}); });
......
...@@ -2,7 +2,7 @@ import { shallowMount } from '@vue/test-utils'; ...@@ -2,7 +2,7 @@ import { shallowMount } from '@vue/test-utils';
import TimeMetricsCard from 'ee/analytics/cycle_analytics/components/time_metrics_card.vue'; import TimeMetricsCard from 'ee/analytics/cycle_analytics/components/time_metrics_card.vue';
import { OVERVIEW_METRICS } from 'ee/analytics/cycle_analytics/constants'; import { OVERVIEW_METRICS } from 'ee/analytics/cycle_analytics/constants';
import Api from 'ee/api'; import Api from 'ee/api';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import createFlash from '~/flash';
import { group, timeMetricsData, recentActivityData } from '../mock_data'; import { group, timeMetricsData, recentActivityData } from '../mock_data';
jest.mock('~/flash'); jest.mock('~/flash');
...@@ -59,9 +59,9 @@ describe('TimeMetricsCard', () => { ...@@ -59,9 +59,9 @@ describe('TimeMetricsCard', () => {
}); });
it('should render an error message', () => { it('should render an error message', () => {
expect(createFlash).toHaveBeenCalledWith( expect(createFlash).toHaveBeenCalledWith({
`There was an error while fetching value stream analytics ${metric.toLowerCase()} data.`, message: `There was an error while fetching value stream analytics ${metric.toLowerCase()} data.`,
); });
}); });
}); });
......
...@@ -5,7 +5,7 @@ import * as actions from 'ee/analytics/cycle_analytics/store/actions'; ...@@ -5,7 +5,7 @@ import * as actions from 'ee/analytics/cycle_analytics/store/actions';
import * as getters from 'ee/analytics/cycle_analytics/store/getters'; import * as getters from 'ee/analytics/cycle_analytics/store/getters';
import * as types from 'ee/analytics/cycle_analytics/store/mutation_types'; import * as types from 'ee/analytics/cycle_analytics/store/mutation_types';
import testAction from 'helpers/vuex_action_helper'; import testAction from 'helpers/vuex_action_helper';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import createFlash from '~/flash';
import httpStatusCodes from '~/lib/utils/http_status'; import httpStatusCodes from '~/lib/utils/http_status';
import { import {
currentGroup, currentGroup,
...@@ -54,11 +54,6 @@ describe('Value Stream Analytics actions', () => { ...@@ -54,11 +54,6 @@ describe('Value Stream Analytics actions', () => {
let state; let state;
let mock; let mock;
const shouldFlashAMessage = (msg, type = null) => {
const args = type ? [msg, type] : [msg];
expect(createFlash).toHaveBeenCalledWith(...args);
};
beforeEach(() => { beforeEach(() => {
state = { state = {
startDate, startDate,
...@@ -229,7 +224,9 @@ describe('Value Stream Analytics actions', () => { ...@@ -229,7 +224,9 @@ describe('Value Stream Analytics actions', () => {
it('will flash an error message', () => { it('will flash an error message', () => {
actions.receiveStageDataError({ commit: () => {} }, {}); actions.receiveStageDataError({ commit: () => {} }, {});
shouldFlashAMessage('There was an error fetching data for the selected stage'); expect(createFlash).toHaveBeenCalledWith({
message: 'There was an error fetching data for the selected stage',
});
}); });
}); });
...@@ -296,7 +293,9 @@ describe('Value Stream Analytics actions', () => { ...@@ -296,7 +293,9 @@ describe('Value Stream Analytics actions', () => {
commit: () => {}, commit: () => {},
}) })
.then(() => { .then(() => {
shouldFlashAMessage('There was an error fetching median data for stages'); expect(createFlash).toHaveBeenCalledWith({
message: 'There was an error fetching median data for stages',
});
}); });
}); });
...@@ -320,7 +319,9 @@ describe('Value Stream Analytics actions', () => { ...@@ -320,7 +319,9 @@ describe('Value Stream Analytics actions', () => {
commit: () => {}, commit: () => {},
}) })
.then(() => { .then(() => {
shouldFlashAMessage('There was an error fetching value stream analytics stages.'); expect(createFlash).toHaveBeenCalledWith({
message: 'There was an error fetching value stream analytics stages.',
});
}); });
}); });
}); });
...@@ -367,7 +368,7 @@ describe('Value Stream Analytics actions', () => { ...@@ -367,7 +368,7 @@ describe('Value Stream Analytics actions', () => {
{ response }, { response },
); );
shouldFlashAMessage(flashErrorMessage); expect(createFlash).toHaveBeenCalledWith({ message: flashErrorMessage });
}); });
}); });
...@@ -452,7 +453,7 @@ describe('Value Stream Analytics actions', () => { ...@@ -452,7 +453,7 @@ describe('Value Stream Analytics actions', () => {
{ getters: { activeStages: data }, dispatch: () => {} }, { getters: { activeStages: data }, dispatch: () => {} },
{}, {},
); );
shouldFlashAMessage(flashErrorMessage); expect(createFlash).toHaveBeenCalledWith({ message: flashErrorMessage });
}); });
it('will select the first active stage', () => { it('will select the first active stage', () => {
...@@ -548,7 +549,9 @@ describe('Value Stream Analytics actions', () => { ...@@ -548,7 +549,9 @@ describe('Value Stream Analytics actions', () => {
}, },
) )
.then(() => { .then(() => {
shouldFlashAMessage(`'${stageId}' stage already exists`); expect(createFlash).toHaveBeenCalledWith({
message: `'${stageId}' stage already exists`,
});
}); });
}); });
...@@ -563,7 +566,9 @@ describe('Value Stream Analytics actions', () => { ...@@ -563,7 +566,9 @@ describe('Value Stream Analytics actions', () => {
{ status: httpStatusCodes.BAD_REQUEST }, { status: httpStatusCodes.BAD_REQUEST },
) )
.then(() => { .then(() => {
shouldFlashAMessage('There was a problem saving your custom stage, please try again'); expect(createFlash).toHaveBeenCalledWith({
message: 'There was a problem saving your custom stage, please try again',
});
}); });
}); });
}); });
...@@ -595,7 +600,10 @@ describe('Value Stream Analytics actions', () => { ...@@ -595,7 +600,10 @@ describe('Value Stream Analytics actions', () => {
response, response,
) )
.then(() => { .then(() => {
shouldFlashAMessage('Stage data updated', 'notice'); expect(createFlash).toHaveBeenCalledWith({
message: 'Stage data updated',
type: 'notice',
});
}); });
}); });
...@@ -610,7 +618,9 @@ describe('Value Stream Analytics actions', () => { ...@@ -610,7 +618,9 @@ describe('Value Stream Analytics actions', () => {
response, response,
) )
.then(() => { .then(() => {
shouldFlashAMessage('There was a problem refreshing the data, please try again'); expect(createFlash).toHaveBeenCalledWith({
message: 'There was a problem refreshing the data, please try again',
});
})); }));
}); });
}); });
...@@ -662,7 +672,9 @@ describe('Value Stream Analytics actions', () => { ...@@ -662,7 +672,9 @@ describe('Value Stream Analytics actions', () => {
it('flashes an error message', () => { it('flashes an error message', () => {
actions.receiveRemoveStageError({ commit: () => {}, state }, {}); actions.receiveRemoveStageError({ commit: () => {}, state }, {});
shouldFlashAMessage('There was an error removing your custom stage, please try again'); expect(createFlash).toHaveBeenCalledWith({
message: 'There was an error removing your custom stage, please try again',
});
}); });
}); });
}); });
...@@ -695,7 +707,9 @@ describe('Value Stream Analytics actions', () => { ...@@ -695,7 +707,9 @@ describe('Value Stream Analytics actions', () => {
}, },
{}, {},
) )
.then(() => shouldFlashAMessage('Stage removed', 'notice')); .then(() =>
expect(createFlash).toHaveBeenCalledWith({ message: 'Stage removed', type: 'notice' }),
);
}); });
}); });
...@@ -795,7 +809,9 @@ describe('Value Stream Analytics actions', () => { ...@@ -795,7 +809,9 @@ describe('Value Stream Analytics actions', () => {
it('will flash an error message', () => { it('will flash an error message', () => {
actions.receiveStageMedianValuesError({ commit: () => {} }); actions.receiveStageMedianValuesError({ commit: () => {} });
shouldFlashAMessage('There was an error fetching median data for stages'); expect(createFlash).toHaveBeenCalledWith({
message: 'There was an error fetching median data for stages',
});
}); });
}); });
...@@ -933,9 +949,9 @@ describe('Value Stream Analytics actions', () => { ...@@ -933,9 +949,9 @@ describe('Value Stream Analytics actions', () => {
], ],
[], [],
).then(() => { ).then(() => {
shouldFlashAMessage( expect(createFlash).toHaveBeenCalledWith({
'There was an error updating the stage order. Please try reloading the page.', message: 'There was an error updating the stage order. Please try reloading the page.',
); });
}); });
}); });
}); });
......
...@@ -3,7 +3,7 @@ import MockAdapter from 'axios-mock-adapter'; ...@@ -3,7 +3,7 @@ import MockAdapter from 'axios-mock-adapter';
import * as actions from 'ee/analytics/cycle_analytics/store/modules/custom_stages/actions'; import * as actions from 'ee/analytics/cycle_analytics/store/modules/custom_stages/actions';
import * as types from 'ee/analytics/cycle_analytics/store/modules/custom_stages/mutation_types'; import * as types from 'ee/analytics/cycle_analytics/store/modules/custom_stages/mutation_types';
import testAction from 'helpers/vuex_action_helper'; import testAction from 'helpers/vuex_action_helper';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import createFlash from '~/flash';
import httpStatusCodes from '~/lib/utils/http_status'; import httpStatusCodes from '~/lib/utils/http_status';
import { currentGroup, endpoints, rawCustomStage } from '../../../mock_data'; import { currentGroup, endpoints, rawCustomStage } from '../../../mock_data';
...@@ -14,11 +14,6 @@ describe('Custom stage actions', () => { ...@@ -14,11 +14,6 @@ describe('Custom stage actions', () => {
let mock; let mock;
const selectedStage = rawCustomStage; const selectedStage = rawCustomStage;
const shouldFlashAMessage = (msg, type = null) => {
const args = type ? [msg, type] : [msg];
expect(createFlash).toHaveBeenCalledWith(...args);
};
beforeEach(() => { beforeEach(() => {
mock = new MockAdapter(axios); mock = new MockAdapter(axios);
}); });
...@@ -128,7 +123,9 @@ describe('Custom stage actions', () => { ...@@ -128,7 +123,9 @@ describe('Custom stage actions', () => {
response, response,
) )
.then(() => { .then(() => {
shouldFlashAMessage('There was a problem saving your custom stage, please try again'); expect(createFlash).toHaveBeenCalledWith({
message: 'There was a problem saving your custom stage, please try again',
});
}); });
}); });
...@@ -147,7 +144,7 @@ describe('Custom stage actions', () => { ...@@ -147,7 +144,7 @@ describe('Custom stage actions', () => {
}, },
) )
.then(() => { .then(() => {
shouldFlashAMessage("'uh oh' stage already exists"); expect(createFlash).toHaveBeenCalledWith({ message: "'uh oh' stage already exists" });
}); });
}); });
}); });
...@@ -180,7 +177,9 @@ describe('Custom stage actions', () => { ...@@ -180,7 +177,9 @@ describe('Custom stage actions', () => {
response, response,
) )
.then(() => { .then(() => {
shouldFlashAMessage('There was a problem refreshing the data, please try again'); expect(createFlash).toHaveBeenCalledWith({
message: 'There was a problem refreshing the data, please try again',
});
})); }));
}); });
}); });
......
...@@ -9,17 +9,12 @@ import * as actions from 'ee/analytics/cycle_analytics/store/modules/type_of_wor ...@@ -9,17 +9,12 @@ import * as actions from 'ee/analytics/cycle_analytics/store/modules/type_of_wor
import * as getters from 'ee/analytics/cycle_analytics/store/modules/type_of_work/getters'; import * as getters from 'ee/analytics/cycle_analytics/store/modules/type_of_work/getters';
import * as types from 'ee/analytics/cycle_analytics/store/modules/type_of_work/mutation_types'; import * as types from 'ee/analytics/cycle_analytics/store/modules/type_of_work/mutation_types';
import testAction from 'helpers/vuex_action_helper'; import testAction from 'helpers/vuex_action_helper';
import { deprecatedCreateFlash } from '~/flash'; import createFlash from '~/flash';
import httpStatusCodes from '~/lib/utils/http_status'; import httpStatusCodes from '~/lib/utils/http_status';
import { groupLabels, endpoints, startDate, endDate, rawTasksByTypeData } from '../../../mock_data'; import { groupLabels, endpoints, startDate, endDate, rawTasksByTypeData } from '../../../mock_data';
jest.mock('~/flash'); jest.mock('~/flash');
const shouldFlashAMessage = (msg, type = null) => {
const args = type ? [msg, type] : [msg];
expect(deprecatedCreateFlash).toHaveBeenCalledWith(...args);
};
const error = new Error(`Request failed with status code ${httpStatusCodes.NOT_FOUND}`); const error = new Error(`Request failed with status code ${httpStatusCodes.NOT_FOUND}`);
describe('Type of work actions', () => { describe('Type of work actions', () => {
...@@ -147,7 +142,9 @@ describe('Type of work actions', () => { ...@@ -147,7 +142,9 @@ describe('Type of work actions', () => {
commit: () => {}, commit: () => {},
}); });
shouldFlashAMessage('There was an error fetching the top labels for the selected group'); expect(createFlash).toHaveBeenCalledWith({
message: 'There was an error fetching the top labels for the selected group',
});
}); });
}); });
}); });
...@@ -217,7 +214,9 @@ describe('Type of work actions', () => { ...@@ -217,7 +214,9 @@ describe('Type of work actions', () => {
commit: () => {}, commit: () => {},
}); });
shouldFlashAMessage('There was an error fetching data for the tasks by type chart'); expect(createFlash).toHaveBeenCalledWith({
message: 'There was an error fetching data for the tasks by type chart',
});
}); });
}); });
}); });
......
...@@ -3,7 +3,7 @@ import { mapApprovalSettingsResponse } from 'ee/approvals/mappers'; ...@@ -3,7 +3,7 @@ import { mapApprovalSettingsResponse } from 'ee/approvals/mappers';
import * as baseMutationTypes from 'ee/approvals/stores/modules/base/mutation_types'; import * as baseMutationTypes from 'ee/approvals/stores/modules/base/mutation_types';
import * as actions from 'ee/approvals/stores/modules/license_compliance/actions'; import * as actions from 'ee/approvals/stores/modules/license_compliance/actions';
import testAction from 'helpers/vuex_action_helper'; import testAction from 'helpers/vuex_action_helper';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import createFlash from '~/flash';
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
jest.mock('~/flash'); jest.mock('~/flash');
...@@ -77,7 +77,7 @@ describe('EE approvals license-compliance actions', () => { ...@@ -77,7 +77,7 @@ describe('EE approvals license-compliance actions', () => {
await actions.fetchRules({ rootState: state, dispatch: () => {}, commit: () => {} }); await actions.fetchRules({ rootState: state, dispatch: () => {}, commit: () => {} });
expect(createFlash).toHaveBeenNthCalledWith(1, expect.any(String)); expect(createFlash).toHaveBeenNthCalledWith(1, { message: expect.any(String) });
}); });
}); });
...@@ -114,7 +114,7 @@ describe('EE approvals license-compliance actions', () => { ...@@ -114,7 +114,7 @@ describe('EE approvals license-compliance actions', () => {
await actions.postRule({ rootState: state, dispatch: () => {}, commit: () => {} }, []); await actions.postRule({ rootState: state, dispatch: () => {}, commit: () => {} }, []);
expect(createFlash).toHaveBeenNthCalledWith(1, expect.any(String)); expect(createFlash).toHaveBeenNthCalledWith(1, { message: expect.any(String) });
}); });
}); });
...@@ -155,7 +155,7 @@ describe('EE approvals license-compliance actions', () => { ...@@ -155,7 +155,7 @@ describe('EE approvals license-compliance actions', () => {
await actions.putRule({ rootState: state, dispatch: () => {} }, { id }); await actions.putRule({ rootState: state, dispatch: () => {} }, { id });
expect(createFlash).toHaveBeenNthCalledWith(1, expect.any(String)); expect(createFlash).toHaveBeenNthCalledWith(1, { message: expect.any(String) });
}); });
}); });
...@@ -184,7 +184,7 @@ describe('EE approvals license-compliance actions', () => { ...@@ -184,7 +184,7 @@ describe('EE approvals license-compliance actions', () => {
await actions.deleteRule({ rootState: state, dispatch: () => {} }, deleteUrl); await actions.deleteRule({ rootState: state, dispatch: () => {} }, deleteUrl);
expect(createFlash).toHaveBeenNthCalledWith(1, expect.any(String)); expect(createFlash).toHaveBeenNthCalledWith(1, { message: expect.any(String) });
}); });
}); });
...@@ -219,7 +219,7 @@ describe('EE approvals license-compliance actions', () => { ...@@ -219,7 +219,7 @@ describe('EE approvals license-compliance actions', () => {
await actions.putFallbackRule({ rootState: state, dispatch: () => {} }, {}); await actions.putFallbackRule({ rootState: state, dispatch: () => {} }, {});
expect(createFlash).toHaveBeenNthCalledWith(1, expect.any(String)); expect(createFlash).toHaveBeenNthCalledWith(1, { message: expect.any(String) });
}); });
}); });
}); });
...@@ -3,7 +3,7 @@ import { mapApprovalRuleRequest, mapApprovalSettingsResponse } from 'ee/approval ...@@ -3,7 +3,7 @@ import { mapApprovalRuleRequest, mapApprovalSettingsResponse } from 'ee/approval
import * as types from 'ee/approvals/stores/modules/base/mutation_types'; import * as types from 'ee/approvals/stores/modules/base/mutation_types';
import * as actions from 'ee/approvals/stores/modules/project_settings/actions'; import * as actions from 'ee/approvals/stores/modules/project_settings/actions';
import testAction from 'helpers/vuex_action_helper'; import testAction from 'helpers/vuex_action_helper';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import createFlash from '~/flash';
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
jest.mock('~/flash'); jest.mock('~/flash');
...@@ -82,7 +82,9 @@ describe('EE approvals project settings module actions', () => { ...@@ -82,7 +82,9 @@ describe('EE approvals project settings module actions', () => {
actions.receiveRulesError(); actions.receiveRulesError();
expect(createFlash).toHaveBeenCalledTimes(1); expect(createFlash).toHaveBeenCalledTimes(1);
expect(createFlash).toHaveBeenCalledWith(expect.stringMatching('error occurred')); expect(createFlash).toHaveBeenCalledWith({
message: expect.stringMatching('error occurred'),
});
}); });
}); });
...@@ -193,7 +195,9 @@ describe('EE approvals project settings module actions', () => { ...@@ -193,7 +195,9 @@ describe('EE approvals project settings module actions', () => {
actions.deleteRuleError(); actions.deleteRuleError();
expect(createFlash.mock.calls[0]).toEqual([expect.stringMatching('error occurred')]); expect(createFlash.mock.calls[0]).toEqual([
{ message: expect.stringMatching('error occurred') },
]);
}); });
}); });
......
import { GlLoadingIcon } from '@gitlab/ui'; import { GlLoadingIcon } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import AuditFilterToken from 'ee/audit_events/components/tokens/shared/audit_filter_token.vue'; import AuditFilterToken from 'ee/audit_events/components/tokens/shared/audit_filter_token.vue';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import createFlash from '~/flash';
import httpStatusCodes from '~/lib/utils/http_status'; import httpStatusCodes from '~/lib/utils/http_status';
jest.mock('~/flash'); jest.mock('~/flash');
...@@ -139,9 +139,9 @@ describe('AuditFilterToken', () => { ...@@ -139,9 +139,9 @@ describe('AuditFilterToken', () => {
}); });
it('shows a flash error message', () => { it('shows a flash error message', () => {
expect(createFlash).toHaveBeenCalledWith( expect(createFlash).toHaveBeenCalledWith({
'Failed to find foo. Please search for another foo.', message: 'Failed to find foo. Please search for another foo.',
); });
}); });
}); });
...@@ -152,9 +152,9 @@ describe('AuditFilterToken', () => { ...@@ -152,9 +152,9 @@ describe('AuditFilterToken', () => {
}); });
it('shows a flash error message', () => { it('shows a flash error message', () => {
expect(createFlash).toHaveBeenCalledWith( expect(createFlash).toHaveBeenCalledWith({
'Failed to find foo bar. Please search for another foo bar.', message: 'Failed to find foo bar. Please search for another foo bar.',
); });
}); });
}); });
}); });
...@@ -193,9 +193,9 @@ describe('AuditFilterToken', () => { ...@@ -193,9 +193,9 @@ describe('AuditFilterToken', () => {
}); });
it('shows a flash error message', () => { it('shows a flash error message', () => {
expect(createFlash).toHaveBeenCalledWith( expect(createFlash).toHaveBeenCalledWith({
'Failed to find foo. Please search for another foo.', message: 'Failed to find foo. Please search for another foo.',
); });
}); });
}); });
}); });
......
...@@ -8,7 +8,7 @@ import Vuex from 'vuex'; ...@@ -8,7 +8,7 @@ import Vuex from 'vuex';
import BoardSettingsWipLimit from 'ee_component/boards/components/board_settings_wip_limit.vue'; import BoardSettingsWipLimit from 'ee_component/boards/components/board_settings_wip_limit.vue';
import waitForPromises from 'helpers/wait_for_promises'; import waitForPromises from 'helpers/wait_for_promises';
import boardsStore from '~/boards/stores/boards_store'; import boardsStore from '~/boards/stores/boards_store';
import { deprecatedCreateFlash as flash } from '~/flash'; import createFlash from '~/flash';
jest.mock('~/flash'); jest.mock('~/flash');
...@@ -185,7 +185,7 @@ describe('BoardSettingsWipLimit', () => { ...@@ -185,7 +185,7 @@ describe('BoardSettingsWipLimit', () => {
}); });
afterEach(() => { afterEach(() => {
flash.mockReset(); createFlash.mockReset();
boardsStore.removeList(listId); boardsStore.removeList(listId);
}); });
...@@ -296,7 +296,7 @@ describe('BoardSettingsWipLimit', () => { ...@@ -296,7 +296,7 @@ describe('BoardSettingsWipLimit', () => {
}); });
it('calls flash with expected error', () => { it('calls flash with expected error', () => {
expect(flash).toHaveBeenCalledTimes(1); expect(createFlash).toHaveBeenCalledTimes(1);
}); });
}); });
}); });
......
import AxiosMockAdapter from 'axios-mock-adapter'; import AxiosMockAdapter from 'axios-mock-adapter';
import BoardsStoreEE from 'ee_else_ce/boards/stores/boards_store_ee'; import BoardsStoreEE from 'ee_else_ce/boards/stores/boards_store_ee';
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';
jest.mock('~/flash'); jest.mock('~/flash');
......
...@@ -5,7 +5,7 @@ import * as types from 'ee/codequality_report/store/mutation_types'; ...@@ -5,7 +5,7 @@ import * as types from 'ee/codequality_report/store/mutation_types';
import { TEST_HOST } from 'helpers/test_constants'; import { TEST_HOST } from 'helpers/test_constants';
import testAction from 'helpers/vuex_action_helper'; import testAction from 'helpers/vuex_action_helper';
import Api from '~/api'; import Api from '~/api';
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 { unparsedIssues, parsedIssues } from '../mock_data'; import { unparsedIssues, parsedIssues } from '../mock_data';
...@@ -110,9 +110,9 @@ describe('Codequality report actions', () => { ...@@ -110,9 +110,9 @@ describe('Codequality report actions', () => {
[], [],
[{ type: 'requestReport' }, { type: 'receiveReportError', payload: new Error() }], [{ type: 'requestReport' }, { type: 'receiveReportError', payload: new Error() }],
() => { () => {
expect(createFlash).toHaveBeenCalledWith( expect(createFlash).toHaveBeenCalledWith({
'There was an error fetching the codequality report.', message: 'There was an error fetching the codequality report.',
); });
done(); done();
}, },
); );
...@@ -126,9 +126,9 @@ describe('Codequality report actions', () => { ...@@ -126,9 +126,9 @@ describe('Codequality report actions', () => {
[], [],
[{ type: 'requestReport' }, { type: 'receiveReportError', payload: new Error() }], [{ type: 'requestReport' }, { type: 'receiveReportError', payload: new Error() }],
() => { () => {
expect(createFlash).toHaveBeenCalledWith( expect(createFlash).toHaveBeenCalledWith({
'There was an error fetching the codequality report.', message: 'There was an error fetching the codequality report.',
); });
done(); done();
}, },
); );
......
...@@ -11,7 +11,7 @@ import * as types from 'ee/dependencies/store/modules/list/mutation_types'; ...@@ -11,7 +11,7 @@ import * as types from 'ee/dependencies/store/modules/list/mutation_types';
import getInitialState from 'ee/dependencies/store/modules/list/state'; import getInitialState from 'ee/dependencies/store/modules/list/state';
import { TEST_HOST } from 'helpers/test_constants'; import { TEST_HOST } from 'helpers/test_constants';
import testAction from 'helpers/vuex_action_helper'; import testAction from 'helpers/vuex_action_helper';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import createFlash from '~/flash';
import mockDependenciesResponse from './data/mock_dependencies.json'; import mockDependenciesResponse from './data/mock_dependencies.json';
...@@ -250,7 +250,9 @@ describe('Dependencies actions', () => { ...@@ -250,7 +250,9 @@ describe('Dependencies actions', () => {
], ],
).then(() => { ).then(() => {
expect(createFlash).toHaveBeenCalledTimes(1); expect(createFlash).toHaveBeenCalledTimes(1);
expect(createFlash).toHaveBeenCalledWith(FETCH_ERROR_MESSAGE); expect(createFlash).toHaveBeenCalledWith({
message: FETCH_ERROR_MESSAGE,
});
})); }));
}); });
}); });
......
...@@ -3,7 +3,7 @@ import * as actions from 'ee/geo_node_form/store/actions'; ...@@ -3,7 +3,7 @@ import * as actions from 'ee/geo_node_form/store/actions';
import * as types from 'ee/geo_node_form/store/mutation_types'; import * as types from 'ee/geo_node_form/store/mutation_types';
import createState from 'ee/geo_node_form/store/state'; import createState from 'ee/geo_node_form/store/state';
import testAction from 'helpers/vuex_action_helper'; import testAction from 'helpers/vuex_action_helper';
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 { visitUrl } from '~/lib/utils/url_utility'; import { visitUrl } from '~/lib/utils/url_utility';
import { MOCK_SYNC_NAMESPACES, MOCK_NODE, MOCK_ERROR_MESSAGE } from '../mock_data'; import { MOCK_SYNC_NAMESPACES, MOCK_NODE, MOCK_ERROR_MESSAGE } from '../mock_data';
...@@ -20,8 +20,8 @@ describe('GeoNodeForm Store Actions', () => { ...@@ -20,8 +20,8 @@ describe('GeoNodeForm Store Actions', () => {
const noCallback = () => {}; const noCallback = () => {};
const flashCallback = () => { const flashCallback = () => {
expect(flash).toHaveBeenCalledTimes(1); expect(createFlash).toHaveBeenCalledTimes(1);
flash.mockClear(); createFlash.mockClear();
}; };
const visitUrlCallback = () => { const visitUrlCallback = () => {
expect(visitUrl).toHaveBeenCalledWith('/admin/geo/nodes'); expect(visitUrl).toHaveBeenCalledWith('/admin/geo/nodes');
...@@ -86,8 +86,10 @@ describe('GeoNodeForm Store Actions', () => { ...@@ -86,8 +86,10 @@ describe('GeoNodeForm Store Actions', () => {
[], [],
).then(() => { ).then(() => {
const errors = "Errors: name can't be blank, url can't be blank, url must be a valid URL"; const errors = "Errors: name can't be blank, url can't be blank, url must be a valid URL";
expect(flash).toHaveBeenCalledWith(`${defaultErrorMessage} ${errors}`); expect(createFlash).toHaveBeenCalledWith({
flash.mockClear(); message: `${defaultErrorMessage} ${errors}`,
});
createFlash.mockClear();
}); });
}); });
...@@ -99,8 +101,10 @@ describe('GeoNodeForm Store Actions', () => { ...@@ -99,8 +101,10 @@ describe('GeoNodeForm Store Actions', () => {
[{ type: types.RECEIVE_SAVE_GEO_NODE_COMPLETE }], [{ type: types.RECEIVE_SAVE_GEO_NODE_COMPLETE }],
[], [],
).then(() => { ).then(() => {
expect(flash).toHaveBeenCalledWith(defaultErrorMessage); expect(createFlash).toHaveBeenCalledWith({
flash.mockClear(); message: defaultErrorMessage,
});
createFlash.mockClear();
}); });
}); });
}); });
......
...@@ -6,7 +6,7 @@ import * as types from 'ee/geo_replicable/store/mutation_types'; ...@@ -6,7 +6,7 @@ import * as types from 'ee/geo_replicable/store/mutation_types';
import createState from 'ee/geo_replicable/store/state'; import createState from 'ee/geo_replicable/store/state';
import { gqClient } from 'ee/geo_replicable/utils'; import { gqClient } from 'ee/geo_replicable/utils';
import testAction from 'helpers/vuex_action_helper'; import testAction from 'helpers/vuex_action_helper';
import { deprecatedCreateFlash as flash } from '~/flash'; import createFlash from '~/flash';
import { normalizeHeaders, parseIntPagination } from '~/lib/utils/common_utils'; import { normalizeHeaders, parseIntPagination } from '~/lib/utils/common_utils';
import toast from '~/vue_shared/plugins/global_toast'; import toast from '~/vue_shared/plugins/global_toast';
import { import {
...@@ -70,7 +70,7 @@ describe('GeoReplicable Store Actions', () => { ...@@ -70,7 +70,7 @@ describe('GeoReplicable Store Actions', () => {
[{ type: types.RECEIVE_REPLICABLE_ITEMS_ERROR }], [{ type: types.RECEIVE_REPLICABLE_ITEMS_ERROR }],
[], [],
() => { () => {
expect(flash).toHaveBeenCalledTimes(1); expect(createFlash).toHaveBeenCalledTimes(1);
}, },
); );
}); });
...@@ -396,7 +396,7 @@ describe('GeoReplicable Store Actions', () => { ...@@ -396,7 +396,7 @@ describe('GeoReplicable Store Actions', () => {
[{ type: types.RECEIVE_INITIATE_ALL_REPLICABLE_SYNCS_ERROR }], [{ type: types.RECEIVE_INITIATE_ALL_REPLICABLE_SYNCS_ERROR }],
[], [],
() => { () => {
expect(flash).toHaveBeenCalledTimes(1); expect(createFlash).toHaveBeenCalledTimes(1);
}, },
); );
}); });
...@@ -493,7 +493,7 @@ describe('GeoReplicable Store Actions', () => { ...@@ -493,7 +493,7 @@ describe('GeoReplicable Store Actions', () => {
[{ type: types.RECEIVE_INITIATE_REPLICABLE_SYNC_ERROR }], [{ type: types.RECEIVE_INITIATE_REPLICABLE_SYNC_ERROR }],
[], [],
() => { () => {
expect(flash).toHaveBeenCalledTimes(1); expect(createFlash).toHaveBeenCalledTimes(1);
}, },
); );
}); });
......
...@@ -3,7 +3,7 @@ import * as actions from 'ee/geo_settings/store/actions'; ...@@ -3,7 +3,7 @@ import * as actions from 'ee/geo_settings/store/actions';
import * as types from 'ee/geo_settings/store/mutation_types'; import * as types from 'ee/geo_settings/store/mutation_types';
import state from 'ee/geo_settings/store/state'; import state from 'ee/geo_settings/store/state';
import testAction from 'helpers/vuex_action_helper'; import testAction from 'helpers/vuex_action_helper';
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 { MOCK_BASIC_SETTINGS_DATA, MOCK_APPLICATION_SETTINGS_FETCH_RESPONSE } from '../mock_data'; import { MOCK_BASIC_SETTINGS_DATA, MOCK_APPLICATION_SETTINGS_FETCH_RESPONSE } from '../mock_data';
...@@ -14,8 +14,8 @@ describe('GeoSettings Store Actions', () => { ...@@ -14,8 +14,8 @@ describe('GeoSettings Store Actions', () => {
const noCallback = () => {}; const noCallback = () => {};
const flashCallback = () => { const flashCallback = () => {
expect(flash).toHaveBeenCalledTimes(1); expect(createFlash).toHaveBeenCalledTimes(1);
flash.mockClear(); createFlash.mockClear();
}; };
beforeEach(() => { beforeEach(() => {
......
import MockAdapter from 'axios-mock-adapter'; import MockAdapter from 'axios-mock-adapter';
import defaultColumns from 'ee/group_member_contributions/constants'; import defaultColumns from 'ee/group_member_contributions/constants';
import GroupMemberStore from 'ee/group_member_contributions/store/group_member_store'; import GroupMemberStore from 'ee/group_member_contributions/store/group_member_store';
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 { rawMembers, contributionsPath } from '../mock_data'; import { rawMembers, contributionsPath } from '../mock_data';
...@@ -97,9 +97,9 @@ describe('GroupMemberStore', () => { ...@@ -97,9 +97,9 @@ describe('GroupMemberStore', () => {
.catch((e) => { .catch((e) => {
expect(e.message).toBe('Request failed with status code 500'); expect(e.message).toBe('Request failed with status code 500');
expect(store.isLoading).toBe(false); expect(store.isLoading).toBe(false);
expect(createFlash).toHaveBeenCalledWith( expect(createFlash).toHaveBeenCalledWith({
'Something went wrong while fetching group member contributions', message: 'Something went wrong while fetching group member contributions',
); });
}) })
.then(done) .then(done)
.catch(done.fail); .catch(done.fail);
......
...@@ -5,7 +5,7 @@ import * as actions from 'ee/insights/stores/modules/insights/actions'; ...@@ -5,7 +5,7 @@ import * as actions from 'ee/insights/stores/modules/insights/actions';
import { TEST_HOST } from 'helpers/test_constants'; import { TEST_HOST } from 'helpers/test_constants';
import testAction from 'helpers/vuex_action_helper'; import testAction from 'helpers/vuex_action_helper';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import createFlash from '~/flash';
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
const ERROR_MESSAGE = 'TEST_ERROR_MESSAGE'; const ERROR_MESSAGE = 'TEST_ERROR_MESSAGE';
...@@ -62,9 +62,9 @@ describe('Insights store actions', () => { ...@@ -62,9 +62,9 @@ describe('Insights store actions', () => {
[{ type: 'RECEIVE_CONFIG_ERROR' }], [{ type: 'RECEIVE_CONFIG_ERROR' }],
[], [],
() => { () => {
expect(createFlash).toHaveBeenCalledWith( expect(createFlash).toHaveBeenCalledWith({
`There was an error fetching configuration for charts: ${ERROR_MESSAGE}`, message: `There was an error fetching configuration for charts: ${ERROR_MESSAGE}`,
); });
}, },
); );
}); });
...@@ -77,9 +77,9 @@ describe('Insights store actions', () => { ...@@ -77,9 +77,9 @@ describe('Insights store actions', () => {
expect.any(Array), expect.any(Array),
expect.any(Array), expect.any(Array),
() => { () => {
expect(createFlash).toHaveBeenCalledWith( expect(createFlash).toHaveBeenCalledWith({
`There was an error fetching configuration for charts: Unknown Error`, message: `There was an error fetching configuration for charts: Unknown Error`,
); });
}, },
); );
}); });
......
...@@ -4,7 +4,7 @@ import axios from 'axios'; ...@@ -4,7 +4,7 @@ import axios from 'axios';
import MockAdapter from 'axios-mock-adapter'; import MockAdapter from 'axios-mock-adapter';
import IssuesAnalyticsTable from 'ee/issues_analytics/components/issues_analytics_table.vue'; import IssuesAnalyticsTable from 'ee/issues_analytics/components/issues_analytics_table.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 httpStatusCodes from '~/lib/utils/http_status'; import httpStatusCodes from '~/lib/utils/http_status';
import { mockIssuesApiResponse, tableHeaders, endpoints } from '../mock_data'; import { mockIssuesApiResponse, tableHeaders, endpoints } from '../mock_data';
...@@ -107,7 +107,9 @@ describe('IssuesAnalyticsTable', () => { ...@@ -107,7 +107,9 @@ describe('IssuesAnalyticsTable', () => {
}); });
it('displays an error', () => { it('displays an error', () => {
expect(createFlash).toHaveBeenCalledWith('Failed to load issues. Please try again.'); expect(createFlash).toHaveBeenCalledWith({
message: 'Failed to load issues. Please try again.',
});
}); });
}); });
}); });
...@@ -11,7 +11,7 @@ import getInitialState from 'ee/license_compliance/store/modules/list/state'; ...@@ -11,7 +11,7 @@ import getInitialState from 'ee/license_compliance/store/modules/list/state';
import { TEST_HOST } from 'helpers/test_constants'; import { TEST_HOST } from 'helpers/test_constants';
import testAction from 'helpers/vuex_action_helper'; import testAction from 'helpers/vuex_action_helper';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import createFlash from '~/flash';
import mockLicensesResponse from './data/mock_licenses.json'; import mockLicensesResponse from './data/mock_licenses.json';
...@@ -107,7 +107,9 @@ describe('Licenses actions', () => { ...@@ -107,7 +107,9 @@ describe('Licenses actions', () => {
[], [],
).then(() => { ).then(() => {
expect(createFlash).toHaveBeenCalledTimes(1); expect(createFlash).toHaveBeenCalledTimes(1);
expect(createFlash).toHaveBeenCalledWith(FETCH_ERROR_MESSAGE); expect(createFlash).toHaveBeenCalledWith({
message: FETCH_ERROR_MESSAGE,
});
}); });
}); });
}); });
......
...@@ -4,7 +4,7 @@ import createInitialState from 'ee/pages/groups/saml_providers/saml_members/stor ...@@ -4,7 +4,7 @@ import createInitialState from 'ee/pages/groups/saml_providers/saml_members/stor
import testAction from 'helpers/vuex_action_helper'; import testAction from 'helpers/vuex_action_helper';
import Api from '~/api'; import Api from '~/api';
import { deprecatedCreateFlash as flash } from '~/flash'; import createFlash from '~/flash';
jest.mock('~/flash'); jest.mock('~/flash');
jest.mock('~/api', () => ({ jest.mock('~/api', () => ({
...@@ -19,7 +19,7 @@ const state = { ...@@ -19,7 +19,7 @@ const state = {
describe('saml_members actions', () => { describe('saml_members actions', () => {
afterEach(() => { afterEach(() => {
Api.groupMembers.mockClear(); Api.groupMembers.mockClear();
flash.mockClear(); createFlash.mockClear();
}); });
describe('fetchPage', () => { describe('fetchPage', () => {
...@@ -75,7 +75,7 @@ describe('saml_members actions', () => { ...@@ -75,7 +75,7 @@ describe('saml_members actions', () => {
it('should show flash on wrong data', (done) => { it('should show flash on wrong data', (done) => {
Api.groupMembers.mockReturnValue(Promise.reject(new Error())); Api.groupMembers.mockReturnValue(Promise.reject(new Error()));
testAction(fetchPage, undefined, state, [], [], () => { testAction(fetchPage, undefined, state, [], [], () => {
expect(flash).toHaveBeenCalledTimes(1); expect(createFlash).toHaveBeenCalledTimes(1);
done(); done();
}); });
}); });
......
...@@ -8,7 +8,7 @@ import * as epicUtils from 'ee/related_items_tree/utils/epic_utils'; ...@@ -8,7 +8,7 @@ import * as epicUtils from 'ee/related_items_tree/utils/epic_utils';
import testAction from 'helpers/vuex_action_helper'; import testAction from 'helpers/vuex_action_helper';
import { TEST_HOST } from 'spec/test_constants'; import { TEST_HOST } from 'spec/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 { import {
issuableTypesMap, issuableTypesMap,
...@@ -324,7 +324,9 @@ describe('RelatedItemTree', () => { ...@@ -324,7 +324,9 @@ describe('RelatedItemTree', () => {
{}, {},
); );
expect(createFlash).toHaveBeenCalledWith(message); expect(createFlash).toHaveBeenCalledWith({
message,
});
}); });
}); });
...@@ -458,7 +460,9 @@ describe('RelatedItemTree', () => { ...@@ -458,7 +460,9 @@ describe('RelatedItemTree', () => {
{}, {},
); );
expect(createFlash).toHaveBeenCalledWith(message); expect(createFlash).toHaveBeenCalledWith({
message,
});
}); });
}); });
...@@ -665,7 +669,9 @@ describe('RelatedItemTree', () => { ...@@ -665,7 +669,9 @@ describe('RelatedItemTree', () => {
}, },
); );
expect(createFlash).toHaveBeenCalledWith('An error occurred while removing epics.'); expect(createFlash).toHaveBeenCalledWith({
message: 'An error occurred while removing epics.',
});
}); });
}); });
...@@ -1047,7 +1053,9 @@ describe('RelatedItemTree', () => { ...@@ -1047,7 +1053,9 @@ describe('RelatedItemTree', () => {
}, },
); );
expect(createFlash).toHaveBeenCalledWith(message); expect(createFlash).toHaveBeenCalledWith({
message,
});
}); });
}); });
...@@ -1136,7 +1144,9 @@ describe('RelatedItemTree', () => { ...@@ -1136,7 +1144,9 @@ describe('RelatedItemTree', () => {
}, },
); );
expect(createFlash).toHaveBeenCalledWith(message); expect(createFlash).toHaveBeenCalledWith({
message,
});
}); });
}); });
...@@ -1281,7 +1291,9 @@ describe('RelatedItemTree', () => { ...@@ -1281,7 +1291,9 @@ describe('RelatedItemTree', () => {
}, },
); );
expect(createFlash).toHaveBeenCalledWith(message); expect(createFlash).toHaveBeenCalledWith({
message,
});
}); });
}); });
...@@ -1478,7 +1490,9 @@ describe('RelatedItemTree', () => { ...@@ -1478,7 +1490,9 @@ describe('RelatedItemTree', () => {
}, },
); );
expect(createFlash).toHaveBeenCalledWith(message); expect(createFlash).toHaveBeenCalledWith({
message,
});
}); });
}); });
...@@ -1604,7 +1618,9 @@ describe('RelatedItemTree', () => { ...@@ -1604,7 +1618,9 @@ describe('RelatedItemTree', () => {
}, },
); );
expect(createFlash).toHaveBeenCalledWith(message); expect(createFlash).toHaveBeenCalledWith({
message,
});
}); });
}); });
......
...@@ -8,7 +8,7 @@ import * as epicUtils from 'ee/roadmap/utils/epic_utils'; ...@@ -8,7 +8,7 @@ import * as epicUtils from 'ee/roadmap/utils/epic_utils';
import * as roadmapItemUtils from 'ee/roadmap/utils/roadmap_item_utils'; import * as roadmapItemUtils from 'ee/roadmap/utils/roadmap_item_utils';
import { getTimeframeForMonthsView } from 'ee/roadmap/utils/roadmap_utils'; import { getTimeframeForMonthsView } from 'ee/roadmap/utils/roadmap_utils';
import testAction from 'helpers/vuex_action_helper'; import testAction from 'helpers/vuex_action_helper';
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 {
mockGroupId, mockGroupId,
...@@ -147,7 +147,9 @@ describe('Roadmap Vuex Actions', () => { ...@@ -147,7 +147,9 @@ describe('Roadmap Vuex Actions', () => {
it('should show flash error', () => { it('should show flash error', () => {
actions.receiveEpicsFailure({ commit: () => {} }); actions.receiveEpicsFailure({ commit: () => {} });
expect(createFlash).toHaveBeenCalledWith('Something went wrong while fetching epics'); expect(createFlash).toHaveBeenCalledWith({
message: 'Something went wrong while fetching epics',
});
}); });
}); });
...@@ -670,7 +672,9 @@ describe('Roadmap Vuex Actions', () => { ...@@ -670,7 +672,9 @@ describe('Roadmap Vuex Actions', () => {
it('should show flash error', () => { it('should show flash error', () => {
actions.receiveMilestonesFailure({ commit: () => {} }); actions.receiveMilestonesFailure({ commit: () => {} });
expect(createFlash).toHaveBeenCalledWith('Something went wrong while fetching milestones'); expect(createFlash).toHaveBeenCalledWith({
message: 'Something went wrong while fetching milestones',
});
}); });
}); });
......
...@@ -3,7 +3,7 @@ import AxiosMockAdapter from 'axios-mock-adapter'; ...@@ -3,7 +3,7 @@ import AxiosMockAdapter from 'axios-mock-adapter';
import AutoFixSettings from 'ee/security_configuration/components/auto_fix_settings.vue'; import AutoFixSettings from 'ee/security_configuration/components/auto_fix_settings.vue';
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 { deprecatedCreateFlash as createFlash } from '~/flash'; import createFlash from '~/flash';
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
jest.mock('~/flash.js'); jest.mock('~/flash.js');
...@@ -152,9 +152,10 @@ describe('Auto-fix Settings', () => { ...@@ -152,9 +152,10 @@ describe('Auto-fix Settings', () => {
itShowsInitialState(); itShowsInitialState();
it('shows error flash', () => { it('shows error flash', () => {
expect(createFlash).toHaveBeenCalledWith( expect(createFlash).toHaveBeenCalledWith({
'Something went wrong while toggling auto-fix settings, please try again later.', message:
); 'Something went wrong while toggling auto-fix settings, please try again later.',
});
}); });
}); });
}); });
......
...@@ -6,7 +6,7 @@ import CsvExportButton, { ...@@ -6,7 +6,7 @@ import CsvExportButton, {
} from 'ee/security_dashboard/components/csv_export_button.vue'; } from 'ee/security_dashboard/components/csv_export_button.vue';
import { useLocalStorageSpy } from 'helpers/local_storage_helper'; import { useLocalStorageSpy } from 'helpers/local_storage_helper';
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 AccessorUtils from '~/lib/utils/accessor'; import AccessorUtils from '~/lib/utils/accessor';
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
import { formatDate } from '~/lib/utils/datetime_utility'; import { formatDate } from '~/lib/utils/datetime_utility';
...@@ -93,7 +93,9 @@ describe('Csv Button Export', () => { ...@@ -93,7 +93,9 @@ describe('Csv Button Export', () => {
await axios.waitForAll(); await axios.waitForAll();
expect(downloader).not.toHaveBeenCalled(); expect(downloader).not.toHaveBeenCalled();
expect(createFlash).toHaveBeenCalledWith('There was an error while generating the report.'); expect(createFlash).toHaveBeenCalledWith({
message: 'There was an error while generating the report.',
});
}); });
it('shows the flash error when backend fails to generate the export', async () => { it('shows the flash error when backend fails to generate the export', async () => {
...@@ -102,7 +104,9 @@ describe('Csv Button Export', () => { ...@@ -102,7 +104,9 @@ describe('Csv Button Export', () => {
findCsvExportButton().vm.$emit('click'); findCsvExportButton().vm.$emit('click');
await axios.waitForAll(); await axios.waitForAll();
expect(createFlash).toHaveBeenCalledWith('There was an error while generating the report.'); expect(createFlash).toHaveBeenCalledWith({
message: 'There was an error while generating the report.',
});
}); });
it('displays the export icon when not loading and the loading icon when loading', async () => { it('displays the export icon when not loading and the loading icon when loading', async () => {
......
...@@ -5,7 +5,7 @@ import ProjectList from 'ee/security_dashboard/components/first_class_project_ma ...@@ -5,7 +5,7 @@ import ProjectList from 'ee/security_dashboard/components/first_class_project_ma
import ProjectManager from 'ee/security_dashboard/components/first_class_project_manager/project_manager.vue'; import ProjectManager from 'ee/security_dashboard/components/first_class_project_manager/project_manager.vue';
import getProjects from 'ee/security_dashboard/graphql/queries/get_projects.query.graphql'; import getProjects from 'ee/security_dashboard/graphql/queries/get_projects.query.graphql';
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 ProjectSelector from '~/vue_shared/components/project_selector/project_selector.vue'; import ProjectSelector from '~/vue_shared/components/project_selector/project_selector.vue';
jest.mock('~/flash'); jest.mock('~/flash');
...@@ -163,9 +163,10 @@ describe('Project Manager component', () => { ...@@ -163,9 +163,10 @@ describe('Project Manager component', () => {
findAddProjectsButton().vm.$emit('click'); findAddProjectsButton().vm.$emit('click');
return waitForPromises().then(() => { return waitForPromises().then(() => {
expect(createFlash).toHaveBeenCalledTimes(1); expect(createFlash).toHaveBeenCalledTimes(1);
expect(createFlash).toHaveBeenCalledWith( expect(createFlash).toHaveBeenCalledWith({
'Unable to add Sample Project 1: Project was not found or you do not have permission to add this project to Security Dashboards.', message:
); 'Unable to add Sample Project 1: Project was not found or you do not have permission to add this project to Security Dashboards.',
});
}); });
}); });
...@@ -179,9 +180,10 @@ describe('Project Manager component', () => { ...@@ -179,9 +180,10 @@ describe('Project Manager component', () => {
findAddProjectsButton().vm.$emit('click'); findAddProjectsButton().vm.$emit('click');
return waitForPromises().then(() => { return waitForPromises().then(() => {
expect(createFlash).toHaveBeenCalledTimes(1); expect(createFlash).toHaveBeenCalledTimes(1);
expect(createFlash).toHaveBeenCalledWith( expect(createFlash).toHaveBeenCalledWith({
'Unable to add Sample Project 2 and Sample Project 3: Project was not found or you do not have permission to add this project to Security Dashboards.', message:
); 'Unable to add Sample Project 2 and Sample Project 3: Project was not found or you do not have permission to add this project to Security Dashboards.',
});
}); });
}); });
}); });
......
...@@ -4,7 +4,7 @@ import * as types from 'ee/security_dashboard/store/modules/project_selector/mut ...@@ -4,7 +4,7 @@ import * as types from 'ee/security_dashboard/store/modules/project_selector/mut
import createState from 'ee/security_dashboard/store/modules/project_selector/state'; import createState from 'ee/security_dashboard/store/modules/project_selector/state';
import testAction from 'helpers/vuex_action_helper'; import testAction from 'helpers/vuex_action_helper';
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';
jest.mock('~/flash'); jest.mock('~/flash');
...@@ -199,7 +199,9 @@ describe('EE projectSelector actions', () => { ...@@ -199,7 +199,9 @@ describe('EE projectSelector actions', () => {
[{ type: types.RECEIVE_ADD_PROJECTS_SUCCESS }], [{ type: types.RECEIVE_ADD_PROJECTS_SUCCESS }],
[], [],
).then(() => { ).then(() => {
expect(createFlash).toHaveBeenCalledWith(`Unable to add ${invalidProject.name}`); expect(createFlash).toHaveBeenCalledWith({
message: `Unable to add ${invalidProject.name}`,
});
}); });
}); });
...@@ -218,9 +220,9 @@ describe('EE projectSelector actions', () => { ...@@ -218,9 +220,9 @@ describe('EE projectSelector actions', () => {
[{ type: types.RECEIVE_ADD_PROJECTS_SUCCESS }], [{ type: types.RECEIVE_ADD_PROJECTS_SUCCESS }],
[], [],
).then(() => { ).then(() => {
expect(createFlash).toHaveBeenCalledWith( expect(createFlash).toHaveBeenCalledWith({
`Unable to add ${invalidProject1.name} and ${invalidProject2.name}`, message: `Unable to add ${invalidProject1.name} and ${invalidProject2.name}`,
); });
}); });
}); });
...@@ -240,9 +242,9 @@ describe('EE projectSelector actions', () => { ...@@ -240,9 +242,9 @@ describe('EE projectSelector actions', () => {
[{ type: types.RECEIVE_ADD_PROJECTS_SUCCESS }], [{ type: types.RECEIVE_ADD_PROJECTS_SUCCESS }],
[], [],
).then(() => { ).then(() => {
expect(createFlash).toHaveBeenCalledWith( expect(createFlash).toHaveBeenCalledWith({
`Unable to add ${invalidProject1.name}, ${invalidProject2.name}, and ${invalidProject3.name}`, message: `Unable to add ${invalidProject1.name}, ${invalidProject2.name}, and ${invalidProject3.name}`,
); });
}); });
}); });
}); });
...@@ -265,9 +267,9 @@ describe('EE projectSelector actions', () => { ...@@ -265,9 +267,9 @@ describe('EE projectSelector actions', () => {
actions.receiveAddProjectsError(mockDispatchContext); actions.receiveAddProjectsError(mockDispatchContext);
expect(createFlash).toHaveBeenCalledTimes(1); expect(createFlash).toHaveBeenCalledTimes(1);
expect(createFlash).toHaveBeenCalledWith( expect(createFlash).toHaveBeenCalledWith({
'Something went wrong, unable to add projects to dashboard', message: 'Something went wrong, unable to add projects to dashboard',
); });
}); });
}); });
...@@ -353,7 +355,9 @@ describe('EE projectSelector actions', () => { ...@@ -353,7 +355,9 @@ describe('EE projectSelector actions', () => {
], ],
[], [],
).then(() => { ).then(() => {
expect(createFlash).toHaveBeenCalledWith('Something went wrong, unable to get projects'); expect(createFlash).toHaveBeenCalledWith({
message: 'Something went wrong, unable to get projects',
});
})); }));
}); });
...@@ -433,7 +437,9 @@ describe('EE projectSelector actions', () => { ...@@ -433,7 +437,9 @@ describe('EE projectSelector actions', () => {
actions.receiveRemoveProjectError(mockDispatchContext); actions.receiveRemoveProjectError(mockDispatchContext);
expect(createFlash).toHaveBeenCalledTimes(1); expect(createFlash).toHaveBeenCalledTimes(1);
expect(createFlash).toHaveBeenCalledWith('Something went wrong, unable to delete project'); expect(createFlash).toHaveBeenCalledWith({
message: 'Something went wrong, unable to delete project',
});
}); });
}); });
......
...@@ -5,7 +5,7 @@ import * as types from 'ee/security_dashboard/store/modules/unscanned_projects/m ...@@ -5,7 +5,7 @@ import * as types from 'ee/security_dashboard/store/modules/unscanned_projects/m
import createState from 'ee/security_dashboard/store/modules/unscanned_projects/state'; import createState from 'ee/security_dashboard/store/modules/unscanned_projects/state';
import testAction from 'helpers/vuex_action_helper'; import testAction from 'helpers/vuex_action_helper';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import createFlash from '~/flash';
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
jest.mock('~/flash'); jest.mock('~/flash');
...@@ -114,7 +114,9 @@ describe('EE Unscanned Projects actions', () => { ...@@ -114,7 +114,9 @@ describe('EE Unscanned Projects actions', () => {
actions.receiveUnscannedProjectsError(mockDispatchContext); actions.receiveUnscannedProjectsError(mockDispatchContext);
expect(createFlash).toHaveBeenCalledTimes(1); expect(createFlash).toHaveBeenCalledTimes(1);
expect(createFlash).toHaveBeenCalledWith('Unable to fetch unscanned projects'); expect(createFlash).toHaveBeenCalledWith({
message: 'Unable to fetch unscanned projects',
});
}); });
}); });
}); });
...@@ -5,7 +5,7 @@ import * as types from 'ee/security_dashboard/store/modules/vulnerable_projects/ ...@@ -5,7 +5,7 @@ import * as types from 'ee/security_dashboard/store/modules/vulnerable_projects/
import createState from 'ee/security_dashboard/store/modules/vulnerable_projects/state'; import createState from 'ee/security_dashboard/store/modules/vulnerable_projects/state';
import testAction from 'helpers/vuex_action_helper'; import testAction from 'helpers/vuex_action_helper';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import createFlash from '~/flash';
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
jest.mock('~/flash'); jest.mock('~/flash');
...@@ -127,7 +127,9 @@ describe('Vulnerable Projects actions', () => { ...@@ -127,7 +127,9 @@ describe('Vulnerable Projects actions', () => {
actions.receiveProjectsError(mockDispatchContext); actions.receiveProjectsError(mockDispatchContext);
expect(createFlash).toHaveBeenCalledTimes(1); expect(createFlash).toHaveBeenCalledTimes(1);
expect(createFlash).toHaveBeenCalledWith('Unable to fetch vulnerable projects'); expect(createFlash).toHaveBeenCalledWith({
message: 'Unable to fetch vulnerable projects',
});
}); });
}); });
}); });
...@@ -2,7 +2,7 @@ import MockAdapter from 'axios-mock-adapter'; ...@@ -2,7 +2,7 @@ import MockAdapter from 'axios-mock-adapter';
import * as actions from 'ee/status_page_settings/store/actions'; import * as actions from 'ee/status_page_settings/store/actions';
import * as types from 'ee/status_page_settings/store/mutation_types'; import * as types from 'ee/status_page_settings/store/mutation_types';
import testAction from 'helpers/vuex_action_helper'; import testAction from 'helpers/vuex_action_helper';
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 { refreshCurrentPage } from '~/lib/utils/url_utility'; import { refreshCurrentPage } from '~/lib/utils/url_utility';
...@@ -110,10 +110,10 @@ describe('Status Page actions', () => { ...@@ -110,10 +110,10 @@ describe('Status Page actions', () => {
const error = { response: { data: { message: 'Update error' } } }; const error = { response: { data: { message: 'Update error' } } };
it('should handle error update', (done) => { it('should handle error update', (done) => {
testAction(actions.receiveStatusPageSettingsUpdateError, error, null, [], [], () => { testAction(actions.receiveStatusPageSettingsUpdateError, error, null, [], [], () => {
expect(createFlash).toHaveBeenCalledWith( expect(createFlash).toHaveBeenCalledWith({
`There was an error saving your changes. ${error.response.data.message}`, message: `There was an error saving your changes. ${error.response.data.message}`,
'alert', type: 'alert',
); });
done(); done();
}); });
}); });
......
...@@ -4,7 +4,7 @@ import * as constants from 'ee/subscriptions/new/constants'; ...@@ -4,7 +4,7 @@ import * as constants from 'ee/subscriptions/new/constants';
import * as actions from 'ee/subscriptions/new/store/actions'; import * as actions from 'ee/subscriptions/new/store/actions';
import { useMockLocationHelper } from 'helpers/mock_window_location_helper'; import { useMockLocationHelper } from 'helpers/mock_window_location_helper';
import testAction from 'helpers/vuex_action_helper'; import testAction from 'helpers/vuex_action_helper';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import createFlash from '~/flash';
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
const { const {
...@@ -193,7 +193,9 @@ describe('Subscriptions Actions', () => { ...@@ -193,7 +193,9 @@ describe('Subscriptions Actions', () => {
describe('fetchCountriesError', () => { describe('fetchCountriesError', () => {
it('creates a flash', (done) => { it('creates a flash', (done) => {
testAction(actions.fetchCountriesError, null, {}, [], [], () => { testAction(actions.fetchCountriesError, null, {}, [], [], () => {
expect(createFlash).toHaveBeenCalledWith('Failed to load countries. Please try again.'); expect(createFlash).toHaveBeenCalledWith({
message: 'Failed to load countries. Please try again.',
});
done(); done();
}); });
}); });
...@@ -262,7 +264,9 @@ describe('Subscriptions Actions', () => { ...@@ -262,7 +264,9 @@ describe('Subscriptions Actions', () => {
describe('fetchStatesError', () => { describe('fetchStatesError', () => {
it('creates a flash', (done) => { it('creates a flash', (done) => {
testAction(actions.fetchStatesError, null, {}, [], [], () => { testAction(actions.fetchStatesError, null, {}, [], [], () => {
expect(createFlash).toHaveBeenCalledWith('Failed to load states. Please try again.'); expect(createFlash).toHaveBeenCalledWith({
message: 'Failed to load states. Please try again.',
});
done(); done();
}); });
}); });
...@@ -425,9 +429,9 @@ describe('Subscriptions Actions', () => { ...@@ -425,9 +429,9 @@ describe('Subscriptions Actions', () => {
[], [],
[], [],
() => { () => {
expect(createFlash).toHaveBeenCalledWith( expect(createFlash).toHaveBeenCalledWith({
'Credit card form failed to load: error message', message: 'Credit card form failed to load: error message',
); });
done(); done();
}, },
); );
...@@ -437,9 +441,9 @@ describe('Subscriptions Actions', () => { ...@@ -437,9 +441,9 @@ describe('Subscriptions Actions', () => {
describe('fetchPaymentFormParamsError', () => { describe('fetchPaymentFormParamsError', () => {
it('creates a flash', (done) => { it('creates a flash', (done) => {
testAction(actions.fetchPaymentFormParamsError, null, {}, [], [], () => { testAction(actions.fetchPaymentFormParamsError, null, {}, [], [], () => {
expect(createFlash).toHaveBeenCalledWith( expect(createFlash).toHaveBeenCalledWith({
'Credit card form failed to load. Please try again.', message: 'Credit card form failed to load. Please try again.',
); });
done(); done();
}); });
}); });
...@@ -508,9 +512,10 @@ describe('Subscriptions Actions', () => { ...@@ -508,9 +512,10 @@ describe('Subscriptions Actions', () => {
[], [],
[], [],
() => { () => {
expect(createFlash).toHaveBeenCalledWith( expect(createFlash).toHaveBeenCalledWith({
'Submitting the credit card form failed with code codeFromResponse: messageFromResponse', message:
); 'Submitting the credit card form failed with code codeFromResponse: messageFromResponse',
});
done(); done();
}, },
); );
...@@ -578,9 +583,9 @@ describe('Subscriptions Actions', () => { ...@@ -578,9 +583,9 @@ describe('Subscriptions Actions', () => {
describe('fetchPaymentMethodDetailsError', () => { describe('fetchPaymentMethodDetailsError', () => {
it('creates a flash', (done) => { it('creates a flash', (done) => {
testAction(actions.fetchPaymentMethodDetailsError, null, {}, [], [], () => { testAction(actions.fetchPaymentMethodDetailsError, null, {}, [], [], () => {
expect(createFlash).toHaveBeenCalledWith( expect(createFlash).toHaveBeenCalledWith({
'Failed to register credit card. Please try again.', message: 'Failed to register credit card. Please try again.',
); });
done(); done();
}); });
}); });
...@@ -650,9 +655,9 @@ describe('Subscriptions Actions', () => { ...@@ -650,9 +655,9 @@ describe('Subscriptions Actions', () => {
[{ type: 'UPDATE_IS_CONFIRMING_ORDER', payload: false }], [{ type: 'UPDATE_IS_CONFIRMING_ORDER', payload: false }],
[], [],
() => { () => {
expect(createFlash).toHaveBeenCalledWith( expect(createFlash).toHaveBeenCalledWith({
'Failed to confirm your order! Please try again.', message: 'Failed to confirm your order! Please try again.',
); });
done(); done();
}, },
); );
...@@ -666,9 +671,9 @@ describe('Subscriptions Actions', () => { ...@@ -666,9 +671,9 @@ describe('Subscriptions Actions', () => {
[{ type: 'UPDATE_IS_CONFIRMING_ORDER', payload: false }], [{ type: 'UPDATE_IS_CONFIRMING_ORDER', payload: false }],
[], [],
() => { () => {
expect(createFlash).toHaveBeenCalledWith( expect(createFlash).toHaveBeenCalledWith({
'Failed to confirm your order: "Error". Please try again.', message: 'Failed to confirm your order: "Error". Please try again.',
); });
done(); done();
}, },
); );
......
...@@ -3,7 +3,7 @@ import * as actions from 'ee/threat_monitoring/store/modules/network_policies/ac ...@@ -3,7 +3,7 @@ import * as actions from 'ee/threat_monitoring/store/modules/network_policies/ac
import * as types from 'ee/threat_monitoring/store/modules/network_policies/mutation_types'; import * as types from 'ee/threat_monitoring/store/modules/network_policies/mutation_types';
import getInitialState from 'ee/threat_monitoring/store/modules/network_policies/state'; import getInitialState from 'ee/threat_monitoring/store/modules/network_policies/state';
import testAction from 'helpers/vuex_action_helper'; import testAction from 'helpers/vuex_action_helper';
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 httpStatus from '~/lib/utils/http_status'; import httpStatus from '~/lib/utils/http_status';
import { joinPaths } from '~/lib/utils/url_utility'; import { joinPaths } from '~/lib/utils/url_utility';
......
...@@ -4,7 +4,7 @@ import * as actions from 'ee/threat_monitoring/store/modules/threat_monitoring/a ...@@ -4,7 +4,7 @@ import * as actions from 'ee/threat_monitoring/store/modules/threat_monitoring/a
import * as types from 'ee/threat_monitoring/store/modules/threat_monitoring/mutation_types'; import * as types from 'ee/threat_monitoring/store/modules/threat_monitoring/mutation_types';
import getInitialState from 'ee/threat_monitoring/store/modules/threat_monitoring/state'; import getInitialState from 'ee/threat_monitoring/store/modules/threat_monitoring/state';
import testAction from 'helpers/vuex_action_helper'; import testAction from 'helpers/vuex_action_helper';
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 httpStatus from '~/lib/utils/http_status'; import httpStatus from '~/lib/utils/http_status';
......
...@@ -4,7 +4,7 @@ import * as actions from 'ee/threat_monitoring/store/modules/threat_monitoring_s ...@@ -4,7 +4,7 @@ import * as actions from 'ee/threat_monitoring/store/modules/threat_monitoring_s
import * as types from 'ee/threat_monitoring/store/modules/threat_monitoring_statistics/mutation_types'; import * as types from 'ee/threat_monitoring/store/modules/threat_monitoring_statistics/mutation_types';
import getInitialState from 'ee/threat_monitoring/store/modules/threat_monitoring_statistics/state'; import getInitialState from 'ee/threat_monitoring/store/modules/threat_monitoring_statistics/state';
import testAction from 'helpers/vuex_action_helper'; import testAction from 'helpers/vuex_action_helper';
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 httpStatus from '~/lib/utils/http_status'; import httpStatus from '~/lib/utils/http_status';
......
...@@ -4,7 +4,7 @@ import createStore from 'ee/vue_shared/dashboards/store/index'; ...@@ -4,7 +4,7 @@ import createStore from 'ee/vue_shared/dashboards/store/index';
import * as types from 'ee/vue_shared/dashboards/store/mutation_types'; import * as types from 'ee/vue_shared/dashboards/store/mutation_types';
import { mockHeaders, mockText, mockProjectData } from 'ee_jest/vue_shared/dashboards/mock_data'; import { mockHeaders, mockText, mockProjectData } from 'ee_jest/vue_shared/dashboards/mock_data';
import testAction from 'helpers/vuex_action_helper'; import testAction from 'helpers/vuex_action_helper';
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 clearState from '../helpers'; import clearState from '../helpers';
...@@ -139,25 +139,27 @@ describe('actions', () => { ...@@ -139,25 +139,27 @@ describe('actions', () => {
selectProjects(1); selectProjects(1);
addInvalidProjects([0]); addInvalidProjects([0]);
expect(createFlash).toHaveBeenCalledWith(`Unable to add mock-name. ${errorMessage}`); expect(createFlash).toHaveBeenCalledWith({
message: `Unable to add mock-name. ${errorMessage}`,
});
}); });
it('displays an error when user tries to add two invalid projects to dashboard', () => { it('displays an error when user tries to add two invalid projects to dashboard', () => {
selectProjects(2); selectProjects(2);
addInvalidProjects([0, 1]); addInvalidProjects([0, 1]);
expect(createFlash).toHaveBeenCalledWith( expect(createFlash).toHaveBeenCalledWith({
`Unable to add mock-name and mock-name. ${errorMessage}`, message: `Unable to add mock-name and mock-name. ${errorMessage}`,
); });
}); });
it('displays an error when user tries to add more than two invalid projects to dashboard', () => { it('displays an error when user tries to add more than two invalid projects to dashboard', () => {
selectProjects(3); selectProjects(3);
addInvalidProjects([0, 1, 2]); addInvalidProjects([0, 1, 2]);
expect(createFlash).toHaveBeenCalledWith( expect(createFlash).toHaveBeenCalledWith({
`Unable to add mock-name, mock-name, and mock-name. ${errorMessage}`, message: `Unable to add mock-name, mock-name, and mock-name. ${errorMessage}`,
); });
}); });
}); });
...@@ -165,7 +167,9 @@ describe('actions', () => { ...@@ -165,7 +167,9 @@ describe('actions', () => {
it('shows error message', () => { it('shows error message', () => {
store.dispatch('receiveAddProjectsToDashboardError'); store.dispatch('receiveAddProjectsToDashboardError');
expect(createFlash).toHaveBeenCalledWith(mockText.ADD_PROJECTS_ERROR); expect(createFlash).toHaveBeenCalledWith({
message: mockText.ADD_PROJECTS_ERROR,
});
}); });
}); });
...@@ -261,7 +265,9 @@ describe('actions', () => { ...@@ -261,7 +265,9 @@ describe('actions', () => {
[], [],
); );
expect(createFlash).toHaveBeenCalledWith(mockText.RECEIVE_PROJECTS_ERROR); expect(createFlash).toHaveBeenCalledWith({
message: mockText.RECEIVE_PROJECTS_ERROR,
});
}); });
}); });
...@@ -308,7 +314,9 @@ describe('actions', () => { ...@@ -308,7 +314,9 @@ describe('actions', () => {
describe('receiveRemoveProjectError', () => { describe('receiveRemoveProjectError', () => {
it('displays project removal error', () => { it('displays project removal error', () => {
return testAction(actions.receiveRemoveProjectError, null, null, [], []).then(() => { return testAction(actions.receiveRemoveProjectError, null, null, [], []).then(() => {
expect(createFlash).toHaveBeenCalledWith(mockText.REMOVE_PROJECT_ERROR); expect(createFlash).toHaveBeenCalledWith({
message: mockText.REMOVE_PROJECT_ERROR,
});
}); });
}); });
}); });
......
...@@ -3,7 +3,7 @@ import mutations from 'ee/vue_shared/dashboards/store/mutations'; ...@@ -3,7 +3,7 @@ import mutations from 'ee/vue_shared/dashboards/store/mutations';
import state from 'ee/vue_shared/dashboards/store/state'; import state from 'ee/vue_shared/dashboards/store/state';
import { mockProjectData } from 'ee_jest/vue_shared/dashboards/mock_data'; import { mockProjectData } from 'ee_jest/vue_shared/dashboards/mock_data';
import { useLocalStorageSpy } from 'helpers/local_storage_helper'; import { useLocalStorageSpy } from 'helpers/local_storage_helper';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import createFlash from '~/flash';
import { parseIntPagination, normalizeHeaders } from '~/lib/utils/common_utils'; import { parseIntPagination, normalizeHeaders } from '~/lib/utils/common_utils';
jest.mock('~/flash'); jest.mock('~/flash');
...@@ -61,10 +61,10 @@ describe('mutations', () => { ...@@ -61,10 +61,10 @@ describe('mutations', () => {
mutations[types.SET_PROJECTS](localState, projects); mutations[types.SET_PROJECTS](localState, projects);
expect(createFlash).toHaveBeenCalledWith( expect(createFlash).toHaveBeenCalledWith({
'Project order will not be saved as local storage is not available.', message: 'Project order will not be saved as local storage is not available.',
'warning', type: 'warning',
); });
}); });
}); });
......
...@@ -10,7 +10,7 @@ import RelatedIssues from 'ee/vulnerabilities/components/related_issues.vue'; ...@@ -10,7 +10,7 @@ import RelatedIssues from 'ee/vulnerabilities/components/related_issues.vue';
import RelatedJiraIssues from 'ee/vulnerabilities/components/related_jira_issues.vue'; import RelatedJiraIssues from 'ee/vulnerabilities/components/related_jira_issues.vue';
import StatusDescription from 'ee/vulnerabilities/components/status_description.vue'; import StatusDescription from 'ee/vulnerabilities/components/status_description.vue';
import { VULNERABILITY_STATES } from 'ee/vulnerabilities/constants'; import { VULNERABILITY_STATES } from 'ee/vulnerabilities/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 initUserPopovers from '~/user_popovers'; import initUserPopovers from '~/user_popovers';
......
...@@ -14,7 +14,7 @@ import { FEEDBACK_TYPES, VULNERABILITY_STATE_OBJECTS } from 'ee/vulnerabilities/ ...@@ -14,7 +14,7 @@ import { FEEDBACK_TYPES, VULNERABILITY_STATE_OBJECTS } from 'ee/vulnerabilities/
import createMockApollo from 'helpers/mock_apollo_helper'; import createMockApollo from 'helpers/mock_apollo_helper';
import UsersMockHelper from 'helpers/user_mock_data_helper'; import UsersMockHelper from 'helpers/user_mock_data_helper';
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 { convertObjectPropsToSnakeCase } from '~/lib/utils/common_utils'; import { convertObjectPropsToSnakeCase } from '~/lib/utils/common_utils';
import download from '~/lib/utils/downloader'; import download from '~/lib/utils/downloader';
...@@ -260,9 +260,9 @@ describe('Vulnerability Header', () => { ...@@ -260,9 +260,9 @@ describe('Vulnerability Header', () => {
findGlButton().vm.$emit('click'); findGlButton().vm.$emit('click');
return waitForPromises().then(() => { return waitForPromises().then(() => {
expect(mockAxios.history.post).toHaveLength(1); expect(mockAxios.history.post).toHaveLength(1);
expect(createFlash).toHaveBeenCalledWith( expect(createFlash).toHaveBeenCalledWith({
'There was an error creating the merge request. Please try again.', message: 'There was an error creating the merge request. Please try again.',
); });
}); });
}); });
}); });
......
...@@ -3,7 +3,7 @@ import MockAdapter from 'axios-mock-adapter'; ...@@ -3,7 +3,7 @@ import MockAdapter from 'axios-mock-adapter';
import EventItem from 'ee/vue_shared/security_reports/components/event_item.vue'; import EventItem from 'ee/vue_shared/security_reports/components/event_item.vue';
import HistoryComment from 'ee/vulnerabilities/components/history_comment.vue'; import HistoryComment from 'ee/vulnerabilities/components/history_comment.vue';
import HistoryCommentEditor from 'ee/vulnerabilities/components/history_comment_editor.vue'; import HistoryCommentEditor from 'ee/vulnerabilities/components/history_comment_editor.vue';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import createFlash from '~/flash';
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
const mockAxios = new MockAdapter(axios); const mockAxios = new MockAdapter(axios);
......
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import MockAdapter from 'axios-mock-adapter'; import MockAdapter from 'axios-mock-adapter';
import RelatedIssues from 'ee/vulnerabilities/components/related_issues.vue'; import RelatedIssues from 'ee/vulnerabilities/components/related_issues.vue';
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 httpStatusCodes from '~/lib/utils/http_status'; import httpStatusCodes from '~/lib/utils/http_status';
import * as urlUtility from '~/lib/utils/url_utility'; import * as urlUtility from '~/lib/utils/url_utility';
......
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