mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Updated alerts table to show status messages
This commit is contained in:
@@ -11,6 +11,7 @@ require_once('includes/modal/new_alert_rule.inc.php');
|
||||
<table id="alerts" class="table table-hover table-condensed alerts">
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-column-id="status" data-formatter="status" data-sortable="false">Status</th>
|
||||
<th data-column-id="id" data-sortable="false">#</th>
|
||||
<th data-column-id="rule">Rule</th>
|
||||
<th data-column-id="hostname">Hostname</th>
|
||||
@@ -35,6 +36,9 @@ var grid = $("#alerts").bootgrid({
|
||||
},
|
||||
url: "/ajax_table.php",
|
||||
formatters: {
|
||||
"status": function(column,row) {
|
||||
return "<span class='label label-"+row.extra+"'>" + row.msg + "</span>";
|
||||
},
|
||||
"ack": function(column,row) {
|
||||
return "<button type='button' class='btn btn-"+row.ack_col+" btn-sm command-ack-alert' data-target='#ack-alert' data-state='"+row.state+"' data-alert_id='"+row.alert_id+"' name='ack-alert' id='ack-alert' data-extra='"+row.extra+"'><span class='glyphicon glyphicon-"+row.ack_ico+"'aria-hidden='true'></span></button>";
|
||||
}
|
||||
|
@@ -49,17 +49,27 @@ foreach (dbFetchRows($sql,$param) as $alert) {
|
||||
$ico = "ok";
|
||||
$col = "green";
|
||||
$extra = "";
|
||||
$msg = "";
|
||||
if ( (int) $alert['state'] === 0 ) {
|
||||
$ico = "ok";
|
||||
$col = "green";
|
||||
} elseif ( (int) $alert['state'] === 1 ) {
|
||||
$extra = "success";
|
||||
$msg = "OK";
|
||||
} elseif ( (int) $alert['state'] === 1 || (int) $alert['state'] === 3 || (int) $alert['state'] === 4) {
|
||||
$ico = "volume-up";
|
||||
$col = "red";
|
||||
$extra = "danger";
|
||||
} elseif ( (int) $alert['state'] === 2 ) {
|
||||
$msg = "ALERT";
|
||||
if ( (int) $alert['state'] === 3) {
|
||||
$msg = "WORSE";
|
||||
} elseif ( (int) $alert['state'] === 4) {
|
||||
$msg = "BETTER";
|
||||
}
|
||||
} elseif ( (int) $alert['state'] === 2) {
|
||||
$ico = "volume-off";
|
||||
$col = "#800080";
|
||||
$extra = "warning";
|
||||
$msg = "MUTED";
|
||||
}
|
||||
$alert_checked = '';
|
||||
$orig_ico = $ico;
|
||||
@@ -91,7 +101,8 @@ foreach (dbFetchRows($sql,$param) as $alert) {
|
||||
'state'=>$alert['state'],
|
||||
'alert_id'=>$alert['id'],
|
||||
'ack_ico'=>$ack_ico,
|
||||
'extra'=>$extra);
|
||||
'extra'=>$extra,
|
||||
'msg'=>$msg);
|
||||
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user