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>2020-01-23 21:08:53 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-01-23 21:08:53 +0300
commitd933bc5a8738d24898c5a82cc72ee9bd050425e6 (patch)
tree6d4c5ffedc32dc82c3fd6e4e3031f7981505655a /app/assets/javascripts/flash.js
parent3f9e1b261121f4dbd045341241f81b47356c99cf (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/flash.js')
-rw-r--r--app/assets/javascripts/flash.js20
1 files changed, 17 insertions, 3 deletions
diff --git a/app/assets/javascripts/flash.js b/app/assets/javascripts/flash.js
index 2c3320b5e79..347f7b450ff 100644
--- a/app/assets/javascripts/flash.js
+++ b/app/assets/javascripts/flash.js
@@ -1,6 +1,13 @@
import _ from 'underscore';
import { spriteIcon } from './lib/utils/common_utils';
+const FLASH_TYPES = {
+ ALERT: 'alert',
+ NOTICE: 'notice',
+ SUCCESS: 'success',
+ WARNING: 'warning',
+};
+
const hideFlash = (flashEl, fadeTransition = true) => {
if (fadeTransition) {
Object.assign(flashEl.style, {
@@ -59,7 +66,7 @@ const removeFlashClickListener = (flashEl, fadeTransition) => {
* additional action or link on banner next to message
*
* @param {String} message Flash message text
- * @param {String} type Type of Flash, it can be `notice` or `alert` (default)
+ * @param {String} type Type of Flash, it can be `notice`, `success`, `warning` or `alert` (default)
* @param {Object} parent Reference to parent element under which Flash needs to appear
* @param {Object} actonConfig Map of config to show action on banner
* @param {String} href URL to which action config should point to (default: '#')
@@ -69,7 +76,7 @@ const removeFlashClickListener = (flashEl, fadeTransition) => {
*/
const createFlash = function createFlash(
message,
- type = 'alert',
+ type = FLASH_TYPES.ALERT,
parent = document,
actionConfig = null,
fadeTransition = true,
@@ -102,5 +109,12 @@ const createFlash = function createFlash(
return flashContainer;
};
-export { createFlash as default, createFlashEl, createAction, hideFlash, removeFlashClickListener };
+export {
+ createFlash as default,
+ createFlashEl,
+ createAction,
+ hideFlash,
+ removeFlashClickListener,
+ FLASH_TYPES,
+};
window.Flash = createFlash;