Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-06-18 09:10:20 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-06-18 09:10:20 +0300
commit3bce40cd27cae740c5de57dacb5ed19fba397007 (patch)
tree67890f5787bae757bd75af075c0dac3af05c5a8b /app/assets/javascripts
parentb7a1160154d52bad5af11a8155369de827df2f74 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts')
-rw-r--r--app/assets/javascripts/ide/ide_router.js18
-rw-r--r--app/assets/javascripts/ide/stores/actions.js35
-rw-r--r--app/assets/javascripts/ide/stores/actions/project.js27
-rw-r--r--app/assets/javascripts/ide/stores/modules/commit/actions.js11
-rw-r--r--app/assets/javascripts/issuable_bulk_update_actions.js6
-rw-r--r--app/assets/javascripts/issue.js12
-rw-r--r--app/assets/javascripts/issues_list/components/issuables_list_app.vue6
-rw-r--r--app/assets/javascripts/jobs/store/actions.js24
-rw-r--r--app/assets/javascripts/label_manager.js12
-rw-r--r--app/assets/javascripts/labels_select.js14
-rw-r--r--app/assets/javascripts/merge_conflicts/components/diff_file_editor.vue6
-rw-r--r--app/assets/javascripts/merge_request_tabs.js10
-rw-r--r--app/assets/javascripts/milestone.js8
-rw-r--r--app/assets/javascripts/mirrors/mirror_repos.js8
-rw-r--r--app/assets/javascripts/mirrors/ssh_mirror.js6
-rw-r--r--app/assets/javascripts/namespaces/leave_by_url.js10
-rw-r--r--app/assets/javascripts/notes/components/comment_form.vue8
-rw-r--r--app/assets/javascripts/notes/components/note_actions.vue8
-rw-r--r--app/assets/javascripts/notes/components/note_awards_list.vue8
-rw-r--r--app/assets/javascripts/notes/components/noteable_discussion.vue8
-rw-r--r--app/assets/javascripts/notes/components/noteable_note.vue12
-rw-r--r--app/assets/javascripts/notes/components/notes_app.vue6
-rw-r--r--app/assets/javascripts/notes/mixins/resolvable.js8
-rw-r--r--app/assets/javascripts/notes/stores/actions.js52
-rw-r--r--app/assets/javascripts/pages/admin/application_settings/payload_previewer.js6
-rw-r--r--app/assets/javascripts/pages/admin/broadcast_messages/broadcast_message.js8
-rw-r--r--app/assets/javascripts/pages/dashboard/todos/index/todos.js12
-rw-r--r--app/assets/javascripts/pages/groups/new/group_path_validator.js8
-rw-r--r--app/assets/javascripts/pages/milestones/shared/components/delete_milestone_modal.vue14
-rw-r--r--app/assets/javascripts/pages/projects/merge_requests/creations/new/compare_autocomplete.js8
30 files changed, 260 insertions, 119 deletions
diff --git a/app/assets/javascripts/ide/ide_router.js b/app/assets/javascripts/ide/ide_router.js
index 5f60bf0269d..f771b152e70 100644
--- a/app/assets/javascripts/ide/ide_router.js
+++ b/app/assets/javascripts/ide/ide_router.js
@@ -1,5 +1,5 @@
import Vue from 'vue';
-import { deprecatedCreateFlash as flash } from '~/flash';
+import createFlash from '~/flash';
import IdeRouter from '~/ide/ide_router_extension';
import { joinPaths } from '~/lib/utils/url_utility';
import { __ } from '~/locale';
@@ -111,14 +111,14 @@ export const createRouter = (store, defaultBranch) => {
}
})
.catch((e) => {
- flash(
- __('Error while loading the project data. Please try again.'),
- 'alert',
- document,
- null,
- false,
- true,
- );
+ createFlash({
+ message: __('Error while loading the project data. Please try again.'),
+ type: 'alert',
+ parent: document,
+ actionConfig: null,
+ fadeTransition: false,
+ addBodyClass: true,
+ });
throw e;
});
}
diff --git a/app/assets/javascripts/ide/stores/actions.js b/app/assets/javascripts/ide/stores/actions.js
index 062dc150805..68d006ab0bd 100644
--- a/app/assets/javascripts/ide/stores/actions.js
+++ b/app/assets/javascripts/ide/stores/actions.js
@@ -1,6 +1,6 @@
import { escape } from 'lodash';
import Vue from 'vue';
-import { deprecatedCreateFlash as flash } from '~/flash';
+import createFlash from '~/flash';
import { visitUrl } from '~/lib/utils/url_utility';
import { __, sprintf } from '~/locale';
import {
@@ -36,16 +36,17 @@ export const createTempEntry = (
const fullName = name.slice(-1) !== '/' && type === 'tree' ? `${name}/` : name;
if (getters.entryExists(name)) {
- flash(
- sprintf(__('The name "%{name}" is already taken in this directory.'), {
+ createFlash({
+ message: sprintf(__('The name "%{name}" is already taken in this directory.'), {
name: name.split('/').pop(),
}),
- 'alert',
- document,
- null,
- false,
- true,
- );
+
+ type: 'alert',
+ parent: document,
+ actionConfig: null,
+ fadeTransition: false,
+ addBodyClass: true,
+ });
return undefined;
}
@@ -284,14 +285,14 @@ export const getBranchData = ({ commit, state }, { projectId, branchId, force =
if (e.response.status === 404) {
reject(e);
} else {
- flash(
- __('Error loading branch data. Please try again.'),
- 'alert',
- document,
- null,
- false,
- true,
- );
+ createFlash({
+ message: __('Error loading branch data. Please try again.'),
+ type: 'alert',
+ parent: document,
+ actionConfig: null,
+ fadeTransition: false,
+ addBodyClass: true,
+ });
reject(
new Error(
diff --git a/app/assets/javascripts/ide/stores/actions/project.js b/app/assets/javascripts/ide/stores/actions/project.js
index 120a577d44a..da63e5a1b6e 100644
--- a/app/assets/javascripts/ide/stores/actions/project.js
+++ b/app/assets/javascripts/ide/stores/actions/project.js
@@ -1,5 +1,5 @@
import { escape } from 'lodash';
-import { deprecatedCreateFlash as flash } from '~/flash';
+import createFlash from '~/flash';
import { __, sprintf } from '~/locale';
import api from '../../../api';
import service from '../../services';
@@ -19,14 +19,14 @@ export const getProjectData = ({ commit, state }, { namespace, projectId, force
resolve(data);
})
.catch(() => {
- flash(
- __('Error loading project data. Please try again.'),
- 'alert',
- document,
- null,
- false,
- true,
- );
+ createFlash({
+ message: __('Error loading project data. Please try again.'),
+ type: 'alert',
+ parent: document,
+ actionConfig: null,
+ fadeTransition: false,
+ addBodyClass: true,
+ });
reject(new Error(`Project not loaded ${namespace}/${projectId}`));
});
} else {
@@ -45,7 +45,14 @@ export const refreshLastCommitData = ({ commit }, { projectId, branchId } = {})
});
})
.catch((e) => {
- flash(__('Error loading last commit.'), 'alert', document, null, false, true);
+ createFlash({
+ message: __('Error loading last commit.'),
+ type: 'alert',
+ parent: document,
+ actionConfig: null,
+ fadeTransition: false,
+ addBodyClass: true,
+ });
throw e;
});
diff --git a/app/assets/javascripts/ide/stores/modules/commit/actions.js b/app/assets/javascripts/ide/stores/modules/commit/actions.js
index 29555799074..e706c70560f 100644
--- a/app/assets/javascripts/ide/stores/modules/commit/actions.js
+++ b/app/assets/javascripts/ide/stores/modules/commit/actions.js
@@ -1,4 +1,4 @@
-import { deprecatedCreateFlash as flash } from '~/flash';
+import createFlash from '~/flash';
import { addNumericSuffix } from '~/ide/utils';
import { sprintf, __ } from '~/locale';
import { leftSidebarViews } from '../../../constants';
@@ -143,7 +143,14 @@ export const commitChanges = ({ commit, state, getters, dispatch, rootState, roo
commit(types.UPDATE_LOADING, false);
if (!data.short_id) {
- flash(data.message, 'alert', document, null, false, true);
+ createFlash({
+ message: data.message,
+ type: 'alert',
+ parent: document,
+ actionConfig: null,
+ fadeTransition: false,
+ addBodyClass: true,
+ });
return null;
}
diff --git a/app/assets/javascripts/issuable_bulk_update_actions.js b/app/assets/javascripts/issuable_bulk_update_actions.js
index 366a9a8a883..911533457ac 100644
--- a/app/assets/javascripts/issuable_bulk_update_actions.js
+++ b/app/assets/javascripts/issuable_bulk_update_actions.js
@@ -1,6 +1,6 @@
import $ from 'jquery';
import { difference, intersection, union } from 'lodash';
-import { deprecatedCreateFlash as Flash } from './flash';
+import createFlash from './flash';
import axios from './lib/utils/axios_utils';
import { __ } from './locale';
@@ -32,7 +32,9 @@ export default {
onFormSubmitFailure() {
this.form.find('[type="submit"]').enable();
- return new Flash(__('Issue update failed'));
+ return createFlash({
+ message: __('Issue update failed'),
+ });
},
/**
diff --git a/app/assets/javascripts/issue.js b/app/assets/javascripts/issue.js
index f6eff8133a7..1e053d7daaa 100644
--- a/app/assets/javascripts/issue.js
+++ b/app/assets/javascripts/issue.js
@@ -1,7 +1,7 @@
import $ from 'jquery';
import { joinPaths } from '~/lib/utils/url_utility';
import CreateMergeRequestDropdown from './create_merge_request_dropdown';
-import { deprecatedCreateFlash as flash } from './flash';
+import createFlash from './flash';
import { EVENT_ISSUABLE_VUE_APP_CHANGE } from './issuable/constants';
import axios from './lib/utils/axios_utils';
import { addDelimiter } from './lib/utils/text_utility';
@@ -68,7 +68,9 @@ export default class Issue {
this.createMergeRequestDropdown.checkAbilityToCreateBranch();
}
} else {
- flash(issueFailMessage);
+ createFlash({
+ message: issueFailMessage,
+ });
}
}
@@ -102,6 +104,10 @@ export default class Issue {
$container.html(data.html);
}
})
- .catch(() => flash(__('Failed to load related branches')));
+ .catch(() =>
+ createFlash({
+ message: __('Failed to load related branches'),
+ }),
+ );
}
}
diff --git a/app/assets/javascripts/issues_list/components/issuables_list_app.vue b/app/assets/javascripts/issues_list/components/issuables_list_app.vue
index 51cad662ebf..bd0f5463b0b 100644
--- a/app/assets/javascripts/issues_list/components/issuables_list_app.vue
+++ b/app/assets/javascripts/issues_list/components/issuables_list_app.vue
@@ -6,7 +6,7 @@ import {
GlSafeHtmlDirective as SafeHtml,
} from '@gitlab/ui';
import { toNumber, omit } from 'lodash';
-import { deprecatedCreateFlash as flash } from '~/flash';
+import createFlash from '~/flash';
import axios from '~/lib/utils/axios_utils';
import {
scrollToElement,
@@ -265,7 +265,9 @@ export default {
})
.catch(() => {
this.loading = false;
- return flash(__('An error occurred while loading issues'));
+ return createFlash({
+ message: __('An error occurred while loading issues'),
+ });
});
},
getQueryObject() {
diff --git a/app/assets/javascripts/jobs/store/actions.js b/app/assets/javascripts/jobs/store/actions.js
index c89aeada69d..a8be5d8d039 100644
--- a/app/assets/javascripts/jobs/store/actions.js
+++ b/app/assets/javascripts/jobs/store/actions.js
@@ -1,5 +1,5 @@
import Visibility from 'visibilityjs';
-import { deprecatedCreateFlash as flash } from '~/flash';
+import createFlash from '~/flash';
import axios from '~/lib/utils/axios_utils';
import { setFaviconOverlay, resetFavicon } from '~/lib/utils/favicon';
import httpStatusCodes from '~/lib/utils/http_status';
@@ -99,7 +99,9 @@ export const receiveJobSuccess = ({ commit }, data = {}) => {
};
export const receiveJobError = ({ commit }) => {
commit(types.RECEIVE_JOB_ERROR);
- flash(__('An error occurred while fetching the job.'));
+ createFlash({
+ message: __('An error occurred while fetching the job.'),
+ });
resetFavicon();
};
@@ -197,11 +199,15 @@ export const stopPollingTrace = ({ state, commit }) => {
export const receiveTraceSuccess = ({ commit }, log) => commit(types.RECEIVE_TRACE_SUCCESS, log);
export const receiveTraceError = ({ dispatch }) => {
dispatch('stopPollingTrace');
- flash(__('An error occurred while fetching the job log.'));
+ createFlash({
+ message: __('An error occurred while fetching the job log.'),
+ });
};
export const receiveTraceUnauthorizedError = ({ dispatch }) => {
dispatch('stopPollingTrace');
- flash(__('The current user is not authorized to access the job log.'));
+ createFlash({
+ message: __('The current user is not authorized to access the job log.'),
+ });
};
/**
* When the user clicks a collapsible line in the job
@@ -240,7 +246,9 @@ export const receiveJobsForStageSuccess = ({ commit }, data) =>
commit(types.RECEIVE_JOBS_FOR_STAGE_SUCCESS, data);
export const receiveJobsForStageError = ({ commit }) => {
commit(types.RECEIVE_JOBS_FOR_STAGE_ERROR);
- flash(__('An error occurred while fetching the jobs.'));
+ createFlash({
+ message: __('An error occurred while fetching the jobs.'),
+ });
};
export const triggerManualJob = ({ state }, variables) => {
@@ -254,5 +262,9 @@ export const triggerManualJob = ({ state }, variables) => {
.post(state.job.status.action.path, {
job_variables_attributes: parsedVariables,
})
- .catch(() => flash(__('An error occurred while triggering the job.')));
+ .catch(() =>
+ createFlash({
+ message: __('An error occurred while triggering the job.'),
+ }),
+ );
};
diff --git a/app/assets/javascripts/label_manager.js b/app/assets/javascripts/label_manager.js
index 2a020a66fd2..e0068edbb9b 100644
--- a/app/assets/javascripts/label_manager.js
+++ b/app/assets/javascripts/label_manager.js
@@ -3,7 +3,7 @@
import $ from 'jquery';
import Sortable from 'sortablejs';
import { dispose } from '~/tooltips';
-import { deprecatedCreateFlash as flash } from './flash';
+import createFlash from './flash';
import axios from './lib/utils/axios_utils';
import { __ } from './locale';
@@ -111,7 +111,11 @@ export default class LabelManager {
}
onPrioritySortUpdate() {
- this.savePrioritySort().catch(() => flash(this.errorMessage));
+ this.savePrioritySort().catch(() =>
+ createFlash({
+ message: this.errorMessage,
+ }),
+ );
}
savePrioritySort() {
@@ -123,7 +127,9 @@ export default class LabelManager {
rollbackLabelPosition($label, originalAction) {
const action = originalAction === 'remove' ? 'add' : 'remove';
this.toggleLabelPriority($label, action, false);
- flash(this.errorMessage);
+ createFlash({
+ message: this.errorMessage,
+ });
}
getSortedLabelsIds() {
diff --git a/app/assets/javascripts/labels_select.js b/app/assets/javascripts/labels_select.js
index fb88e48c9a6..3df806161f7 100644
--- a/app/assets/javascripts/labels_select.js
+++ b/app/assets/javascripts/labels_select.js
@@ -8,7 +8,7 @@ import initDeprecatedJQueryDropdown from '~/deprecated_jquery_dropdown';
import { isScopedLabel } from '~/lib/utils/common_utils';
import boardsStore from './boards/stores/boards_store';
import CreateLabelDropdown from './create_label';
-import { deprecatedCreateFlash as flash } from './flash';
+import createFlash from './flash';
import IssuableBulkUpdateActions from './issuable_bulk_update_actions';
import axios from './lib/utils/axios_utils';
import { sprintf, __ } from './locale';
@@ -148,7 +148,11 @@ export default class LabelsSelect {
container: 'body',
});
})
- .catch(() => flash(__('Error saving label update.')));
+ .catch(() =>
+ createFlash({
+ message: __('Error saving label update.'),
+ }),
+ );
};
initDeprecatedJQueryDropdown($dropdown, {
showMenuAbove,
@@ -183,7 +187,11 @@ export default class LabelsSelect {
$dropdown.data('deprecatedJQueryDropdown').positionMenuAbove();
}
})
- .catch(() => flash(__('Error fetching labels.')));
+ .catch(() =>
+ createFlash({
+ message: __('Error fetching labels.'),
+ }),
+ );
},
renderRow(label) {
let colorEl;
diff --git a/app/assets/javascripts/merge_conflicts/components/diff_file_editor.vue b/app/assets/javascripts/merge_conflicts/components/diff_file_editor.vue
index 04e493712ec..f09aebea431 100644
--- a/app/assets/javascripts/merge_conflicts/components/diff_file_editor.vue
+++ b/app/assets/javascripts/merge_conflicts/components/diff_file_editor.vue
@@ -2,7 +2,7 @@
import { GlButton } from '@gitlab/ui';
import { debounce } from 'lodash';
import { mapActions } from 'vuex';
-import { deprecatedCreateFlash as flash } from '~/flash';
+import createFlash from '~/flash';
import axios from '~/lib/utils/axios_utils';
import { __ } from '~/locale';
import { INTERACTIVE_RESOLVE_MODE } from '../constants';
@@ -75,7 +75,9 @@ export default {
},
)
.catch(() => {
- flash(__('An error occurred while loading the file'));
+ createFlash({
+ message: __('An error occurred while loading the file'),
+ });
});
},
saveDiffResolution() {
diff --git a/app/assets/javascripts/merge_request_tabs.js b/app/assets/javascripts/merge_request_tabs.js
index d5db9f43d09..602d6ef611f 100644
--- a/app/assets/javascripts/merge_request_tabs.js
+++ b/app/assets/javascripts/merge_request_tabs.js
@@ -8,7 +8,7 @@ import createEventHub from '~/helpers/event_hub_factory';
import initAddContextCommitsTriggers from './add_context_commits_modal';
import BlobForkSuggestion from './blob/blob_fork_suggestion';
import Diff from './diff';
-import { deprecatedCreateFlash as flash } from './flash';
+import createFlash from './flash';
import initChangesDropdown from './init_changes_dropdown';
import axios from './lib/utils/axios_utils';
import {
@@ -345,7 +345,9 @@ export default class MergeRequestTabs {
})
.catch(() => {
this.toggleLoading(false);
- flash(__('An error occurred while fetching this tab.'));
+ createFlash({
+ message: __('An error occurred while fetching this tab.'),
+ });
});
}
@@ -446,7 +448,9 @@ export default class MergeRequestTabs {
})
.catch(() => {
this.toggleLoading(false);
- flash(__('An error occurred while fetching this tab.'));
+ createFlash({
+ message: __('An error occurred while fetching this tab.'),
+ });
});
}
diff --git a/app/assets/javascripts/milestone.js b/app/assets/javascripts/milestone.js
index 280613bda49..b4e53c1fab6 100644
--- a/app/assets/javascripts/milestone.js
+++ b/app/assets/javascripts/milestone.js
@@ -1,5 +1,5 @@
import $ from 'jquery';
-import { deprecatedCreateFlash as flash } from './flash';
+import createFlash from './flash';
import axios from './lib/utils/axios_utils';
import { __ } from './locale';
@@ -39,7 +39,11 @@ export default class Milestone {
$(tabElId).html(data.html);
$target.addClass('is-loaded');
})
- .catch(() => flash(__('Error loading milestone tab')));
+ .catch(() =>
+ createFlash({
+ message: __('Error loading milestone tab'),
+ }),
+ );
}
}
}
diff --git a/app/assets/javascripts/mirrors/mirror_repos.js b/app/assets/javascripts/mirrors/mirror_repos.js
index a26c8f85958..e59da18fb77 100644
--- a/app/assets/javascripts/mirrors/mirror_repos.js
+++ b/app/assets/javascripts/mirrors/mirror_repos.js
@@ -1,6 +1,6 @@
import $ from 'jquery';
import { debounce } from 'lodash';
-import { deprecatedCreateFlash as Flash } from '~/flash';
+import createFlash from '~/flash';
import axios from '~/lib/utils/axios_utils';
import { __ } from '~/locale';
import { hide } from '~/tooltips';
@@ -111,7 +111,11 @@ export default class MirrorRepos {
return axios
.put(this.mirrorEndpoint, payload)
.then(() => this.removeRow($target))
- .catch(() => Flash(__('Failed to remove mirror.')));
+ .catch(() =>
+ createFlash({
+ message: __('Failed to remove mirror.'),
+ }),
+ );
}
/* eslint-disable class-methods-use-this */
diff --git a/app/assets/javascripts/mirrors/ssh_mirror.js b/app/assets/javascripts/mirrors/ssh_mirror.js
index 15ded478405..5138c450feb 100644
--- a/app/assets/javascripts/mirrors/ssh_mirror.js
+++ b/app/assets/javascripts/mirrors/ssh_mirror.js
@@ -1,6 +1,6 @@
import $ from 'jquery';
import { escape } from 'lodash';
-import { deprecatedCreateFlash as Flash } from '~/flash';
+import createFlash from '~/flash';
import axios from '~/lib/utils/axios_utils';
import { backOff } from '~/lib/utils/common_utils';
import { __ } from '~/locale';
@@ -115,7 +115,9 @@ export default class SSHMirror {
const failureMessage = response.data
? response.data.message
: __('An error occurred while detecting host keys');
- Flash(failureMessage);
+ createFlash({
+ message: failureMessage,
+ });
$btnLoadSpinner.addClass('hidden');
this.$btnDetectHostKeys.enable();
diff --git a/app/assets/javascripts/namespaces/leave_by_url.js b/app/assets/javascripts/namespaces/leave_by_url.js
index 094590804c1..05f6f550fa0 100644
--- a/app/assets/javascripts/namespaces/leave_by_url.js
+++ b/app/assets/javascripts/namespaces/leave_by_url.js
@@ -1,4 +1,4 @@
-import { deprecatedCreateFlash as Flash } from '~/flash';
+import createFlash from '~/flash';
import { getParameterByName } from '~/lib/utils/common_utils';
import { initRails } from '~/lib/utils/rails_ujs';
import { __, sprintf } from '~/locale';
@@ -18,8 +18,10 @@ export default function leaveByUrl(namespaceType) {
if (leaveLink) {
leaveLink.click();
} else {
- Flash(
- sprintf(__('You do not have permission to leave this %{namespaceType}.'), { namespaceType }),
- );
+ createFlash({
+ message: sprintf(__('You do not have permission to leave this %{namespaceType}.'), {
+ namespaceType,
+ }),
+ });
}
}
diff --git a/app/assets/javascripts/notes/components/comment_form.vue b/app/assets/javascripts/notes/components/comment_form.vue
index 7213658bdf2..9504ed78778 100644
--- a/app/assets/javascripts/notes/components/comment_form.vue
+++ b/app/assets/javascripts/notes/components/comment_form.vue
@@ -14,7 +14,7 @@ import $ from 'jquery';
import { mapActions, mapGetters, mapState } from 'vuex';
import Autosave from '~/autosave';
import { refreshUserMergeRequestCounts } from '~/commons/nav/user_merge_requests';
-import { deprecatedCreateFlash as Flash } from '~/flash';
+import createFlash from '~/flash';
import { statusBoxState } from '~/issuable/components/status_box.vue';
import httpStatusCodes from '~/lib/utils/http_status';
import {
@@ -293,7 +293,11 @@ export default {
toggleState()
.then(() => statusBoxState.updateStatus && statusBoxState.updateStatus())
.then(refreshUserMergeRequestCounts)
- .catch(() => Flash(constants.toggleStateErrorMessage[this.noteableType][this.openState]));
+ .catch(() =>
+ createFlash({
+ message: constants.toggleStateErrorMessage[this.noteableType][this.openState],
+ }),
+ );
},
discard(shouldClear = true) {
// `blur` is needed to clear slash commands autocomplete cache if event fired.
diff --git a/app/assets/javascripts/notes/components/note_actions.vue b/app/assets/javascripts/notes/components/note_actions.vue
index 0f72b4f2dba..44d0c741d5a 100644
--- a/app/assets/javascripts/notes/components/note_actions.vue
+++ b/app/assets/javascripts/notes/components/note_actions.vue
@@ -3,7 +3,7 @@ import { GlTooltipDirective, GlIcon, GlButton, GlDropdownItem } from '@gitlab/ui
import { mapActions, mapGetters } from 'vuex';
import Api from '~/api';
import resolvedStatusMixin from '~/batch_comments/mixins/resolved_status';
-import { deprecatedCreateFlash as flash } from '~/flash';
+import createFlash from '~/flash';
import { BV_HIDE_TOOLTIP } from '~/lib/utils/constants';
import { __, sprintf } from '~/locale';
import eventHub from '~/sidebar/event_hub';
@@ -234,7 +234,11 @@ export default {
assignee_ids: assignees.map((assignee) => assignee.id),
})
.then(() => this.handleAssigneeUpdate(assignees))
- .catch(() => flash(__('Something went wrong while updating assignees')));
+ .catch(() =>
+ createFlash({
+ message: __('Something went wrong while updating assignees'),
+ }),
+ );
}
},
setAwardEmoji(awardName) {
diff --git a/app/assets/javascripts/notes/components/note_awards_list.vue b/app/assets/javascripts/notes/components/note_awards_list.vue
index 9eb7b928ea4..6ad5ce3ba5c 100644
--- a/app/assets/javascripts/notes/components/note_awards_list.vue
+++ b/app/assets/javascripts/notes/components/note_awards_list.vue
@@ -2,7 +2,7 @@
import { mapActions, mapGetters } from 'vuex';
import { __ } from '~/locale';
import AwardsList from '~/vue_shared/components/awards_list.vue';
-import { deprecatedCreateFlash as Flash } from '../../flash';
+import createFlash from '../../flash';
export default {
components: {
@@ -48,7 +48,11 @@ export default {
awardName,
};
- this.toggleAwardRequest(data).catch(() => Flash(__('Something went wrong on our end.')));
+ this.toggleAwardRequest(data).catch(() =>
+ createFlash({
+ message: __('Something went wrong on our end.'),
+ }),
+ );
},
},
};
diff --git a/app/assets/javascripts/notes/components/noteable_discussion.vue b/app/assets/javascripts/notes/components/noteable_discussion.vue
index 1af9e4be373..f3be918d1c4 100644
--- a/app/assets/javascripts/notes/components/noteable_discussion.vue
+++ b/app/assets/javascripts/notes/components/noteable_discussion.vue
@@ -6,7 +6,7 @@ import { clearDraft, getDiscussionReplyKey } from '~/lib/utils/autosave';
import { s__, __ } from '~/locale';
import diffLineNoteFormMixin from '~/notes/mixins/diff_line_note_form';
import TimelineEntryItem from '~/vue_shared/components/notes/timeline_entry_item.vue';
-import { deprecatedCreateFlash as Flash } from '../../flash';
+import createFlash from '../../flash';
import userAvatarLink from '../../vue_shared/components/user_avatar/user_avatar_link.vue';
import eventHub from '../event_hub';
import noteable from '../mixins/noteable';
@@ -220,7 +220,11 @@ export default {
const msg = __(
'Your comment could not be submitted! Please check your network connection and try again.',
);
- Flash(msg, 'alert', this.$el);
+ createFlash({
+ message: msg,
+ type: 'alert',
+ parent: this.$el,
+ });
this.$refs.noteForm.note = noteText;
callback(err);
});
diff --git a/app/assets/javascripts/notes/components/noteable_note.vue b/app/assets/javascripts/notes/components/noteable_note.vue
index 0feb77be653..d9783b3e732 100644
--- a/app/assets/javascripts/notes/components/noteable_note.vue
+++ b/app/assets/javascripts/notes/components/noteable_note.vue
@@ -7,7 +7,7 @@ import { INLINE_DIFF_LINES_KEY } from '~/diffs/constants';
import httpStatusCodes from '~/lib/utils/http_status';
import { truncateSha } from '~/lib/utils/text_utility';
import TimelineEntryItem from '~/vue_shared/components/notes/timeline_entry_item.vue';
-import { deprecatedCreateFlash as Flash } from '../../flash';
+import createFlash from '../../flash';
import { __, s__, sprintf } from '../../locale';
import userAvatarLink from '../../vue_shared/components/user_avatar/user_avatar_link.vue';
import eventHub from '../event_hub';
@@ -247,7 +247,9 @@ export default {
this.isDeleting = false;
})
.catch(() => {
- Flash(__('Something went wrong while deleting your note. Please try again.'));
+ createFlash({
+ message: __('Something went wrong while deleting your note. Please try again.'),
+ });
this.isDeleting = false;
});
}
@@ -316,7 +318,11 @@ export default {
this.setSelectedCommentPositionHover();
this.$nextTick(() => {
const msg = __('Something went wrong while editing your comment. Please try again.');
- Flash(msg, 'alert', this.$el);
+ createFlash({
+ message: msg,
+ type: 'alert',
+ parent: this.$el,
+ });
this.recoverNoteContent(noteText);
callback();
});
diff --git a/app/assets/javascripts/notes/components/notes_app.vue b/app/assets/javascripts/notes/components/notes_app.vue
index 433f75a752d..1b888cfce7f 100644
--- a/app/assets/javascripts/notes/components/notes_app.vue
+++ b/app/assets/javascripts/notes/components/notes_app.vue
@@ -7,7 +7,7 @@ import TimelineEntryItem from '~/vue_shared/components/notes/timeline_entry_item
import OrderedLayout from '~/vue_shared/components/ordered_layout.vue';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
import draftNote from '../../batch_comments/components/draft_note.vue';
-import { deprecatedCreateFlash as Flash } from '../../flash';
+import createFlash from '../../flash';
import { getLocationHash, doesHashExistInUrl } from '../../lib/utils/url_utility';
import placeholderNote from '../../vue_shared/components/notes/placeholder_note.vue';
import placeholderSystemNote from '../../vue_shared/components/notes/placeholder_system_note.vue';
@@ -216,7 +216,9 @@ export default {
.catch(() => {
this.setLoadingState(false);
this.setNotesFetchedState(true);
- Flash(__('Something went wrong while fetching comments. Please try again.'));
+ createFlash({
+ message: __('Something went wrong while fetching comments. Please try again.'),
+ });
});
},
initPolling() {
diff --git a/app/assets/javascripts/notes/mixins/resolvable.js b/app/assets/javascripts/notes/mixins/resolvable.js
index 27ed8e203b0..794a7926f7b 100644
--- a/app/assets/javascripts/notes/mixins/resolvable.js
+++ b/app/assets/javascripts/notes/mixins/resolvable.js
@@ -1,4 +1,4 @@
-import { deprecatedCreateFlash as Flash } from '~/flash';
+import createFlash from '~/flash';
import { __ } from '~/locale';
export default {
@@ -46,7 +46,11 @@ export default {
this.isResolving = false;
const msg = __('Something went wrong while resolving this discussion. Please try again.');
- Flash(msg, 'alert', this.$el);
+ createFlash({
+ message: msg,
+ type: 'alert',
+ parent: this.$el,
+ });
});
},
},
diff --git a/app/assets/javascripts/notes/stores/actions.js b/app/assets/javascripts/notes/stores/actions.js
index 086e9122c60..5cb7b7aa4e2 100644
--- a/app/assets/javascripts/notes/stores/actions.js
+++ b/app/assets/javascripts/notes/stores/actions.js
@@ -9,7 +9,7 @@ import { confidentialWidget } from '~/sidebar/components/confidential/sidebar_co
import updateIssueLockMutation from '~/sidebar/components/lock/mutations/update_issue_lock.mutation.graphql';
import updateMergeRequestLockMutation from '~/sidebar/components/lock/mutations/update_merge_request_lock.mutation.graphql';
import loadAwardsHandler from '../../awards_handler';
-import { deprecatedCreateFlash as Flash } from '../../flash';
+import createFlash from '../../flash';
import { isInViewport, scrollToElement, isInMRPage } from '../../lib/utils/common_utils';
import Poll from '../../lib/utils/poll';
import { create } from '../../lib/utils/recurrence';
@@ -354,7 +354,11 @@ export const saveNote = ({ commit, dispatch }, noteData) => {
$('.js-gfm-input').trigger('clear-commands-cache.atwho');
- Flash(message || __('Commands applied'), 'notice', noteData.flashContainer);
+ createFlash({
+ message: message || __('Commands applied'),
+ type: 'notice',
+ parent: noteData.flashContainer,
+ });
}
return res;
@@ -375,11 +379,11 @@ export const saveNote = ({ commit, dispatch }, noteData) => {
awardsHandler.scrollToAwards();
})
.catch(() => {
- Flash(
- __('Something went wrong while adding your award. Please try again.'),
- 'alert',
- noteData.flashContainer,
- );
+ createFlash({
+ message: __('Something went wrong while adding your award. Please try again.'),
+ type: 'alert',
+ parent: noteData.flashContainer,
+ });
})
.then(() => res);
};
@@ -417,7 +421,11 @@ export const saveNote = ({ commit, dispatch }, noteData) => {
const errorMsg = sprintf(__('Your comment could not be submitted because %{error}'), {
error: base[0].toLowerCase(),
});
- Flash(errorMsg, 'alert', noteData.flashContainer);
+ createFlash({
+ message: errorMsg,
+ type: 'alert',
+ parent: noteData.flashContainer,
+ });
return { ...data, hasFlash: true };
}
}
@@ -480,7 +488,9 @@ export const poll = ({ commit, state, getters, dispatch }) => {
});
notePollOccurrenceTracking.handle(2, () => {
// On the second failure in a row, show the alert and try one more time (hoping to succeed and clear the error)
- flashContainer = Flash(__('Something went wrong while fetching latest comments.'));
+ flashContainer = createFlash({
+ message: __('Something went wrong while fetching latest comments.'),
+ });
setTimeout(() => eTagPoll.restart(), NOTES_POLLING_INTERVAL);
});
@@ -570,7 +580,9 @@ export const filterDiscussion = ({ dispatch }, { path, filter, persistFilter })
.catch(() => {
dispatch('setLoadingState', false);
dispatch('setNotesFetchedState', true);
- Flash(__('Something went wrong while fetching comments. Please try again.'));
+ createFlash({
+ message: __('Something went wrong while fetching comments. Please try again.'),
+ });
});
};
@@ -613,7 +625,11 @@ export const submitSuggestion = (
const flashMessage = errorMessage || defaultMessage;
- Flash(__(flashMessage), 'alert', flashContainer);
+ createFlash({
+ message: __(flashMessage),
+ type: 'alert',
+ parent: flashContainer,
+ });
})
.finally(() => {
commit(types.SET_RESOLVING_DISCUSSION, false);
@@ -646,7 +662,11 @@ export const submitSuggestionBatch = ({ commit, dispatch, state }, { flashContai
const flashMessage = errorMessage || defaultMessage;
- Flash(__(flashMessage), 'alert', flashContainer);
+ createFlash({
+ message: __(flashMessage),
+ type: 'alert',
+ parent: flashContainer,
+ });
})
.finally(() => {
commit(types.SET_APPLYING_BATCH_STATE, false);
@@ -685,7 +705,9 @@ export const fetchDescriptionVersion = ({ dispatch }, { endpoint, startingVersio
})
.catch((error) => {
dispatch('receiveDescriptionVersionError', error);
- Flash(__('Something went wrong while fetching description changes. Please try again.'));
+ createFlash({
+ message: __('Something went wrong while fetching description changes. Please try again.'),
+ });
});
};
@@ -717,7 +739,9 @@ export const softDeleteDescriptionVersion = (
})
.catch((error) => {
dispatch('receiveDeleteDescriptionVersionError', error);
- Flash(__('Something went wrong while deleting description changes. Please try again.'));
+ createFlash({
+ message: __('Something went wrong while deleting description changes. Please try again.'),
+ });
// Throw an error here because a component like SystemNote -
// needs to know if the request failed to reset its internal state.
diff --git a/app/assets/javascripts/pages/admin/application_settings/payload_previewer.js b/app/assets/javascripts/pages/admin/application_settings/payload_previewer.js
index bc1d4dd6122..1ab1064b6f9 100644
--- a/app/assets/javascripts/pages/admin/application_settings/payload_previewer.js
+++ b/app/assets/javascripts/pages/admin/application_settings/payload_previewer.js
@@ -1,4 +1,4 @@
-import { deprecatedCreateFlash as flash } from '../../../flash';
+import createFlash from '../../../flash';
import axios from '../../../lib/utils/axios_utils';
import { __ } from '../../../locale';
@@ -38,7 +38,9 @@ export default class PayloadPreviewer {
})
.catch(() => {
this.spinner.classList.remove('d-inline-flex');
- flash(__('Error fetching payload data.'));
+ createFlash({
+ message: __('Error fetching payload data.'),
+ });
});
}
diff --git a/app/assets/javascripts/pages/admin/broadcast_messages/broadcast_message.js b/app/assets/javascripts/pages/admin/broadcast_messages/broadcast_message.js
index 5a16716fe2d..14f79294ea7 100644
--- a/app/assets/javascripts/pages/admin/broadcast_messages/broadcast_message.js
+++ b/app/assets/javascripts/pages/admin/broadcast_messages/broadcast_message.js
@@ -1,6 +1,6 @@
import $ from 'jquery';
import { debounce } from 'lodash';
-import { deprecatedCreateFlash as flash } from '~/flash';
+import createFlash from '~/flash';
import axios from '~/lib/utils/axios_utils';
import { textColorForBackground } from '~/lib/utils/color_utils';
import { __ } from '~/locale';
@@ -30,7 +30,11 @@ export default () => {
.then(({ data }) => {
$jsBroadcastMessagePreview.html(data.message);
})
- .catch(() => flash(__('An error occurred while rendering preview broadcast message')));
+ .catch(() =>
+ createFlash({
+ message: __('An error occurred while rendering preview broadcast message'),
+ }),
+ );
}
};
diff --git a/app/assets/javascripts/pages/dashboard/todos/index/todos.js b/app/assets/javascripts/pages/dashboard/todos/index/todos.js
index 42341436b55..946076cfb29 100644
--- a/app/assets/javascripts/pages/dashboard/todos/index/todos.js
+++ b/app/assets/javascripts/pages/dashboard/todos/index/todos.js
@@ -4,7 +4,7 @@ import $ from 'jquery';
import { getGroups } from '~/api/groups_api';
import { getProjects } from '~/api/projects_api';
import initDeprecatedJQueryDropdown from '~/deprecated_jquery_dropdown';
-import { deprecatedCreateFlash as flash } from '~/flash';
+import createFlash from '~/flash';
import axios from '~/lib/utils/axios_utils';
import { isMetaClick } from '~/lib/utils/common_utils';
import { addDelimiter } from '~/lib/utils/text_utility';
@@ -103,7 +103,9 @@ export default class Todos {
})
.catch(() => {
this.updateRowState(target, true);
- return flash(__('Error updating status of to-do item.'));
+ return createFlash({
+ message: __('Error updating status of to-do item.'),
+ });
});
}
@@ -145,7 +147,11 @@ export default class Todos {
this.updateAllState(target, data);
this.updateBadges(data);
})
- .catch(() => flash(__('Error updating status for all to-do items.')));
+ .catch(() =>
+ createFlash({
+ message: __('Error updating status for all to-do items.'),
+ }),
+ );
}
updateAllState(target, data) {
diff --git a/app/assets/javascripts/pages/groups/new/group_path_validator.js b/app/assets/javascripts/pages/groups/new/group_path_validator.js
index a0ff98645fb..4466980c255 100644
--- a/app/assets/javascripts/pages/groups/new/group_path_validator.js
+++ b/app/assets/javascripts/pages/groups/new/group_path_validator.js
@@ -1,6 +1,6 @@
import { debounce } from 'lodash';
-import { deprecatedCreateFlash as flash } from '~/flash';
+import createFlash from '~/flash';
import { __ } from '~/locale';
import InputValidator from '~/validators/input_validator';
import fetchGroupPathAvailability from './fetch_group_path_availability';
@@ -60,7 +60,11 @@ export default class GroupPathValidator extends InputValidator {
GroupPathValidator.showSuggestions(inputDomElement, data.suggests);
}
})
- .catch(() => flash(__('An error occurred while validating group path')));
+ .catch(() =>
+ createFlash({
+ message: __('An error occurred while validating group path'),
+ }),
+ );
}
}
diff --git a/app/assets/javascripts/pages/milestones/shared/components/delete_milestone_modal.vue b/app/assets/javascripts/pages/milestones/shared/components/delete_milestone_modal.vue
index 16f68b94c9a..34f9fe778ea 100644
--- a/app/assets/javascripts/pages/milestones/shared/components/delete_milestone_modal.vue
+++ b/app/assets/javascripts/pages/milestones/shared/components/delete_milestone_modal.vue
@@ -1,6 +1,6 @@
<script>
import { GlSafeHtmlDirective as SafeHtml, GlModal } from '@gitlab/ui';
-import { deprecatedCreateFlash as Flash } from '~/flash';
+import createFlash from '~/flash';
import axios from '~/lib/utils/axios_utils';
import { redirectTo } from '~/lib/utils/url_utility';
@@ -98,17 +98,17 @@ Once deleted, it cannot be undone or recovered.`),
});
if (error.response && error.response.status === 404) {
- Flash(
- sprintf(s__('Milestones|Milestone %{milestoneTitle} was not found'), {
+ createFlash({
+ message: sprintf(s__('Milestones|Milestone %{milestoneTitle} was not found'), {
milestoneTitle: this.milestoneTitle,
}),
- );
+ });
} else {
- Flash(
- sprintf(s__('Milestones|Failed to delete milestone %{milestoneTitle}'), {
+ createFlash({
+ message: sprintf(s__('Milestones|Failed to delete milestone %{milestoneTitle}'), {
milestoneTitle: this.milestoneTitle,
}),
- );
+ });
}
throw error;
});
diff --git a/app/assets/javascripts/pages/projects/merge_requests/creations/new/compare_autocomplete.js b/app/assets/javascripts/pages/projects/merge_requests/creations/new/compare_autocomplete.js
index 68ab7021cf3..e5f97530c02 100644
--- a/app/assets/javascripts/pages/projects/merge_requests/creations/new/compare_autocomplete.js
+++ b/app/assets/javascripts/pages/projects/merge_requests/creations/new/compare_autocomplete.js
@@ -2,7 +2,7 @@
import $ from 'jquery';
import initDeprecatedJQueryDropdown from '~/deprecated_jquery_dropdown';
-import { deprecatedCreateFlash as flash } from '~/flash';
+import createFlash from '~/flash';
import axios from '~/lib/utils/axios_utils';
import { capitalizeFirstCharacter } from '~/lib/utils/text_utility';
import { __ } from '~/locale';
@@ -37,7 +37,11 @@ export default function initCompareAutocomplete(limitTo = null, clickHandler = (
callback(data);
}
})
- .catch(() => flash(__('Error fetching refs')));
+ .catch(() =>
+ createFlash({
+ message: __('Error fetching refs'),
+ }),
+ );
},
selectable: true,
filterable: true,