mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Replaced color indicator near uptime counter with colored text and change color of status indicator to black on disabled devices instead of gray(#10372)
(matches availablity map with show ignored/disabled enabled)
This commit is contained in:
@ -120,7 +120,7 @@ class DeviceController extends TableController
|
||||
{
|
||||
return [
|
||||
'extra' => $this->getLabel($device),
|
||||
'status' => $device->statusName(),
|
||||
'status' => $this->getStatus($device),
|
||||
'icon' => '<img src="' . asset($device->icon) . '" title="' . pathinfo($device->icon, PATHINFO_FILENAME) . '">',
|
||||
'hostname' => $this->getHostname($device),
|
||||
'metrics' => $this->getMetrics($device),
|
||||
@ -132,6 +132,22 @@ class DeviceController extends TableController
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the device up/down status
|
||||
* @param Device $device
|
||||
* @return string
|
||||
*/
|
||||
private function getStatus($device)
|
||||
{
|
||||
if ($device->disabled == 1) {
|
||||
return 'disabled';
|
||||
} elseif ($device->status == 0) {
|
||||
return 'down';
|
||||
}
|
||||
|
||||
return 'up';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the status label class
|
||||
* @param Device $device
|
||||
@ -139,15 +155,20 @@ class DeviceController extends TableController
|
||||
*/
|
||||
private function getLabel($device)
|
||||
{
|
||||
if ($device->disabled) {
|
||||
if ($device->disabled == 1) {
|
||||
return 'blackbg';
|
||||
} elseif ($device->ignore == 1) {
|
||||
return 'label-default';
|
||||
}
|
||||
} elseif ($device->status == 0) {
|
||||
return 'label-danger';
|
||||
} else {
|
||||
$warning_time = \LibreNMS\Config::get('uptime_warning', 84600);
|
||||
if ($device->uptime < $warning_time && $device->uptime != 0) {
|
||||
return 'label-warning';
|
||||
}
|
||||
|
||||
if ($device->ignore) {
|
||||
return 'label-default';
|
||||
return 'label-success';
|
||||
}
|
||||
|
||||
return $device->status ? 'label-success' : 'label-danger';
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user