Enhance AlertLog Table View (#11936)

This commit is contained in:
SourceDoctor
2020-07-18 00:26:17 +02:00
committed by GitHub
parent 1a8c4df880
commit dcab027c1f
2 changed files with 5 additions and 4 deletions

View File

@ -77,11 +77,12 @@ $common_output[] = '
<table id="alertlog" class="table table-hover table-condensed table-striped">
<thead>
<tr>
<th data-column-id="status" data-sortable="false"></th>
<th data-column-id="status" data-sortable="false">State</th>
<th data-column-id="time_logged" data-order="desc">Timestamp</th>
<th data-column-id="details" data-sortable="false">&nbsp;</th>
<th data-column-id="hostname">Device</th>
<th data-column-id="alert">Alert</th>
<th data-column-id="severity">Severity</th>
</tr>
</thead>
</table>

View File

@ -78,7 +78,7 @@ if ($rowCount != -1) {
$sql .= " LIMIT $limit_low,$limit_high";
}
$sql = "SELECT D.device_id,name AS alert,rule_id, state,time_logged,DATE_FORMAT(time_logged, '" . \LibreNMS\Config::get('dateformat.mysql.compact') . "') as humandate,details $sql";
$sql = "SELECT R.severity, D.device_id,name AS alert,rule_id, state,time_logged,DATE_FORMAT(time_logged, '" . \LibreNMS\Config::get('dateformat.mysql.compact') . "') as humandate,details $sql";
$rulei = 0;
foreach (dbFetchRows($sql, $param) as $alertlog) {
@ -102,14 +102,14 @@ foreach (dbFetchRows($sql, $param) as $alertlog) {
$status = 'label-primary';
}//end if
$response[] = array(
'id' => $rulei++,
'time_logged' => $alertlog['humandate'],
'details' => '<a class="fa fa-plus incident-toggle" style="display:none" data-toggle="collapse" data-target="#incident' . ($rulei) . '" data-parent="#alerts"></a>',
'hostname' => '<div class="incident">' . generate_device_link($dev, shorthost($dev['hostname'])) . '<div id="incident' . ($rulei) . '" class="collapse">' . $fault_detail . '</div></div>',
'alert' => htmlspecialchars($alertlog['alert']),
'status' => "<i class='alert-status " . $status . "'></i>"
'status' => "<i class='alert-status " . $status . "' title='". ($alert_state ? 'active':'recovered')."'></i>",
'severity' => $alertlog['severity']
);
}//end foreach