Files
cacti/include/js/ui-notices.js
Thomas Vincent f28071eb67 fix(theme): [develop] restore Midwinter login controls, form state and notifications (#8326)
* fix(theme): preserve Midwinter authentication controls

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

* docs(changelog): describe theme fix

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

* fix(ui): preserve form state and notification lifecycles

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

* fix: replace the blinking timer during skin setup

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

---------

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
2026-10-12 15:40:56 -07:00

70 lines
1.6 KiB
JavaScript

$.toastPopup = function(options) {
var fixedOptions = {
stack: 50,
textAlign: 'left',
allowToastClose: true,
position: 'bottom-center',
showHideTransition: 'fade',
afterHidden: function (toast) {
const wrapper = toast.closest('.jq-toast-wrap');
toast.remove();
if (!wrapper.children('.jq-toast-single').length) {
wrapper.remove();
}
}
}
var defaultOptions = {
text: "No text was set, please check the usage of showToast",
hideAfter: false,
loader: true,
}
if (options === undefined) {
options = {};
} else if (typeof options === "string" || options instanceof String) {
options = {
text: String(options)
};
}
const toastOptions = $.extend(defaultOptions, options, fixedOptions);
return $.toast(toastOptions);
}
PopupWarning = function(message, heading, currentToast) {
return $.toastPopup({
text: message,
heading: heading,
icon: 'warning',
hideAfter: 20000,
}, currentToast);
}
PopupUnknown = function(message, heading, currentToast) {
return $.toastPopup({
text: message,
heading: heading,
icon: 'info',
hideAfter: false,
}, currentToast);
}
PopupError = function(message, heading, currentToast) {
return $.toastPopup({
text: message,
heading: heading,
icon: 'error',
hideAfter: false,
}, currentToast);
}
PopupNotice = function(message, heading, currentToast) {
return $.toastPopup({
text: message,
heading: heading,
icon: 'success',
hideAfter: 10000,
}, currentToast);
}