mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-12 23:14:18 +01:00
N°7243 - Add toast notifications to iTop (#614)
* N°7243 - Add toast notifications to iTop * Apply suggestions from code review Co-authored-by: Molkobain <lajarige.guillaume@free.fr> * Apply suggestions from code review Co-authored-by: Molkobain <lajarige.guillaume@free.fr> * Apply suggestions from code review Co-authored-by: Molkobain <lajarige.guillaume@free.fr> * Apply suggestions from code review Co-authored-by: Molkobain <lajarige.guillaume@free.fr> * Apply suggestions from code review Co-authored-by: Molkobain <lajarige.guillaume@free.fr> * Apply suggestions from code review Co-authored-by: Molkobain <lajarige.guillaume@free.fr> * Update js/pages/backoffice/toolbox.js * Update js/utils.js * N°7243 - Move some rules to a dedicated partial and use spacing variables --------- Co-authored-by: Molkobain <lajarige.guillaume@free.fr>
This commit is contained in:
59
js/utils.js
59
js/utils.js
@@ -1574,4 +1574,63 @@ let CombodoModal = {
|
||||
OpenErrorModal: function(sMessage, oOptions) {
|
||||
CombodoModal.OpenInformativeModal(sMessage, CombodoModal.INFORMATIVE_MODAL_SEVERITY_ERROR, oOptions);
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Abstract wrapper to manage toasts in iTop.
|
||||
* Implementations for the various GUIs may vary but APIs are the same.
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
let CombodoToast = {
|
||||
/**
|
||||
* Open a standard toast and put the content into it.
|
||||
*
|
||||
* @param sMessage {String} Message to be displayed in the toast
|
||||
* @param sSeverity {String} Severity of the information. Default values are success, information, warning, error.
|
||||
* @param aOptions {Object} {@see CombodoModal.OpenModal
|
||||
*/
|
||||
OpenToast: function(sMessage, sSeverity, aOptions = {}) {
|
||||
// Meant for overloading
|
||||
CombodoJSConsole.Debug('CombodoToast.OpenToast not implemented');
|
||||
},
|
||||
/**
|
||||
* Open a standard toast for success messages.
|
||||
*
|
||||
* @param sMessage {String} Success message to be displayed in the toast
|
||||
* @param aOptions {Object} {@see CombodoModal.OpenModal
|
||||
*/
|
||||
OpenSuccessToast: function(sMessage, aOptions = {}) {
|
||||
CombodoToast.OpenToast(sMessage, 'success', aOptions);
|
||||
},
|
||||
|
||||
/**
|
||||
* Open a standard toast for information messages.
|
||||
*
|
||||
* @param sMessage {String} Information message to be displayed in the toast
|
||||
* @param aOptions {Object} {@see CombodoModal.OpenModal
|
||||
*/
|
||||
OpenInformationToast: function(sMessage, aOptions = {}) {
|
||||
CombodoToast.OpenToast(sMessage, 'information', aOptions);
|
||||
},
|
||||
|
||||
/**
|
||||
* Open a standard toast for warning messages.
|
||||
*
|
||||
* @param sMessage {String} Warning message to be displayed in the toast
|
||||
* @param aOptions {Object} {@see CombodoModal.OpenModal
|
||||
*/
|
||||
OpenWarningToast: function(sMessage, aOptions = {}) {
|
||||
CombodoToast.OpenToast(sMessage, 'warning', aOptions);
|
||||
},
|
||||
|
||||
/**
|
||||
* Open a standard toast for error messages.
|
||||
*
|
||||
* @param sMessage {String} Error message to be displayed in the toast
|
||||
* @param aOptions {Object} {@see CombodoModal.OpenModal
|
||||
*/
|
||||
OpenErrorToast: function(sMessage, aOptions = {}) {
|
||||
CombodoToast.OpenToast(sMessage, 'error', aOptions);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user