Add color coded indicator to notifications

This commit is contained in:
Johannes Zellner
2023-09-26 12:58:19 +02:00
parent b72a5e9c69
commit 8f87070b45
4 changed files with 40 additions and 3 deletions
+20 -1
View File
@@ -2,7 +2,7 @@
/* global angular:false */
/* global $:false */
/* global ERROR,ISTATES,HSTATES,RSTATES,APP_TYPES */
/* global ERROR,ISTATES,HSTATES,RSTATES,APP_TYPES,NOTIFICATION_TYPES */
// deal with accessToken in the query, this is passed for example on password reset and account setup upon invite
var search = decodeURIComponent(window.location.search).slice(1).split('&').map(function (item) { return item.split('='); }).reduce(function (o, k) { o[k[0]] = k[1]; return o; }, {});
@@ -118,6 +118,25 @@ app.config(['$routeProvider', function ($routeProvider) {
}).otherwise({ redirectTo: '/'});
}]);
app.filter('notificadtionTypeToColor', function () {
return function (n) {
switch (n.type) {
case NOTIFICATION_TYPES.ALERT_REBOOT:
case NOTIFICATION_TYPES.ALERT_APP_OOM:
case NOTIFICATION_TYPES.ALERT_MAIL_STATUS:
case NOTIFICATION_TYPES.ALERT_CERTIFICATE_RENEWAL_FAILED:
case NOTIFICATION_TYPES.ALERT_DISK_SPACE:
case NOTIFICATION_TYPES.ALERT_BACKUP_CONFIG:
return '#ff4c4c';
case NOTIFICATION_TYPES.ALERT_BOX_UPDATE:
case NOTIFICATION_TYPES.ALERT_MANUAL_APP_UPDATE:
return '#f0ad4e';
default:
return '#2196f3';
}
};
});
app.filter('capitalize', function () {
return function (s) {
return s.charAt(0).toUpperCase() + s.slice(1);