Coloring on log level in log tables now work again.

This commit is contained in:
Jan Böhmer 2022-12-17 01:03:22 +01:00
parent f0395d51b0
commit 618a6e49dd
3 changed files with 28 additions and 25 deletions

View file

@ -138,7 +138,12 @@ export default class extends Controller {
}
_rowCallback(row, data, index) {
//Empty by default but can be overridden by child classes
//Set the row class based on the optional $$rowClass column data, can be used to color the rows
//Check if we have a level, then change color of this row
if (data.$$rowClass) {
$(row).addClass(data.$$rowClass);
}
}
_onSelectionChange(e, dt, items ) {

View file

@ -23,29 +23,5 @@ import DatatablesController from "./datatables_controller.js";
* This is the datatables controller for log pages, it includes an mechanism to color lines based on their level.
*/
export default class extends DatatablesController {
_rowCallback(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);
}
}
}
}