JS: Add icon to js notifications

This commit is contained in:
Florian Strohmaier 2021-06-29 17:32:16 +02:00 committed by Johannes Meyer
parent 63464f03be
commit 8b7a3f05af

View File

@ -1104,12 +1104,31 @@
* Create a notification. Can be improved. * Create a notification. Can be improved.
*/ */
createNotice: function (severity, message, persist) { createNotice: function (severity, message, persist) {
var c = severity; var c = severity,
icon;
if (persist) { if (persist) {
c += ' persist'; c += ' persist';
} }
switch (severity) {
case 'success':
icon = 'check-circle';
break;
case 'error':
icon = 'times';
break;
case 'warning':
icon = 'exclamation-triangle';
break;
case 'info':
icon = 'info-circle';
break;
}
var $notice = $( var $notice = $(
'<li class="' + c + '">' + this.icinga.utils.escape(message) + '</li>' '<li class="' + c + '">' +
'<i class="icon fa fa-' + icon + '"></i>' +
this.icinga.utils.escape(message) + '</li>'
).appendTo($('#notifications')); ).appendTo($('#notifications'));
if (!persist) { if (!persist) {