[Eventlog] Color the rows based on their level.

This commit is contained in:
Jan Böhmer 2020-01-25 20:41:56 +01:00
parent b0ccb95a17
commit 6b7e5f7ba3

View file

@ -530,7 +530,31 @@ class AjaxUI {
"extend": 'colvis',
'className': 'mr-2 btn-light',
"text": "<i class='fa fa-cog'></i>"
}]
}],
"rowCallback": function( row, data, index ) {
//Check if we have a level, then change color of this row
if (data.level) {
let style = "";
switch(data.level) {
case "emergency":
case "alert":
case "critical":
case "error":
style = "table-danger";
break;
case "warning":
style = "table-warning";
break;
case "notice":
style = "table-info";
break;
}
if (style){
$(row).addClass(style);
}
}
}
});
//Register links.