mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-21 01:25:55 +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
|
@ -386,8 +386,8 @@ class AjaxUI {
|
||||||
|
|
||||||
switch(request.status) {
|
switch(request.status) {
|
||||||
case 500:
|
case 500:
|
||||||
title = 'Internal Server Error!';
|
title = 'Internal Server Error!';
|
||||||
break;
|
break;
|
||||||
case 404:
|
case 404:
|
||||||
title = "Site not found!";
|
title = "Site not found!";
|
||||||
break;
|
break;
|
||||||
|
@ -396,7 +396,7 @@ class AjaxUI {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
var alert = bootbox.alert(
|
var alert = bootbox.alert(
|
||||||
{
|
{
|
||||||
size: 'large',
|
size: 'large',
|
||||||
message: function() {
|
message: function() {
|
||||||
|
@ -418,10 +418,10 @@ class AjaxUI {
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
alert.init(function (){
|
alert.init(function (){
|
||||||
var dstFrame = document.getElementById('iframe');
|
var dstFrame = document.getElementById('iframe');
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
var dstDoc = dstFrame.contentDocument || dstFrame.contentWindow.document;
|
var dstDoc = dstFrame.contentDocument || dstFrame.contentWindow.document;
|
||||||
dstDoc.write(request.responseText);
|
dstDoc.write(request.responseText);
|
||||||
dstDoc.close();
|
dstDoc.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
@ -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