From d933bc5a8738d24898c5a82cc72ee9bd050425e6 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Thu, 23 Jan 2020 18:08:53 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- app/assets/javascripts/flash.js | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'app/assets/javascripts/flash.js') 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; -- cgit v1.2.3