mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-21 09:35:49 +02:00
[Eventlog] Color the rows based on their level.
This commit is contained in:
parent
b0ccb95a17
commit
6b7e5f7ba3
1 changed files with 32 additions and 8 deletions
|
@ -530,7 +530,31 @@ class AjaxUI {
|
||||||
"extend": 'colvis',
|
"extend": 'colvis',
|
||||||
'className': 'mr-2 btn-light',
|
'className': 'mr-2 btn-light',
|
||||||
"text": "<i class='fa fa-cog'></i>"
|
"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.
|
//Register links.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue