mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
added colour priority to the label column (#11607)
This commit is contained in:
@@ -83,6 +83,7 @@ class SyslogController extends TableController
|
||||
$device = $syslog->device;
|
||||
|
||||
return [
|
||||
'label' => $this->setLabel($syslog),
|
||||
'timestamp' => $syslog->timestamp,
|
||||
'level' => htmlentities($syslog->level),
|
||||
'device_id' => $device ? \LibreNMS\Util\Url::deviceLink($device, $device->shortDisplayName()) : '',
|
||||
@@ -91,4 +92,40 @@ class SyslogController extends TableController
|
||||
'priority' => htmlentities($syslog->priority),
|
||||
];
|
||||
}
|
||||
|
||||
private function setLabel($syslog)
|
||||
{
|
||||
$output = "<span class='alert-status ";
|
||||
$output .= $this->priorityLabel($syslog->priority);
|
||||
$output .= "'>";
|
||||
$output .= "</span>";
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $syslog_priority
|
||||
* @return string $syslog_priority_icon
|
||||
*/
|
||||
private function priorityLabel($syslog_priority)
|
||||
{
|
||||
switch ($syslog_priority) {
|
||||
case "debug":
|
||||
return "label-default"; //Debug
|
||||
case "info":
|
||||
return "label-info"; //Informational
|
||||
case "notice":
|
||||
return "label-primary"; //Notice
|
||||
case "warning":
|
||||
return "label-warning"; //Warning
|
||||
case "err":
|
||||
return "label-danger"; //Error
|
||||
case "crit":
|
||||
return "label-danger"; //Critical
|
||||
case "alert":
|
||||
return "label-danger"; //Alert
|
||||
case "emerg":
|
||||
return "label-danger"; //Emergency
|
||||
}
|
||||
} // end syslog_priority
|
||||
}
|
||||
|
Reference in New Issue
Block a user