mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-21 01:25:55 +02:00
Use stimulus for parts tables and select actions.
This commit is contained in:
parent
565cb3a790
commit
452f0a8362
9 changed files with 1369 additions and 1053 deletions
32
assets/controllers/elements/datatables/log_controller.js
Normal file
32
assets/controllers/elements/datatables/log_controller.js
Normal file
|
@ -0,0 +1,32 @@
|
|||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue