mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Fix device list down devices that have never been polled (#9994)
* Fix device list down devices that have never been polled * Suggestion with 'Never' in case last_polled empty and down * Improve handling of all cases * fix doc comment
This commit is contained in:
@@ -126,7 +126,7 @@ class DeviceController extends TableController
|
||||
'metrics' => $this->getMetrics($device),
|
||||
'hardware' => Rewrite::ciscoHardware($device),
|
||||
'os' => $this->getOsText($device),
|
||||
'uptime' => Time::formatInterval($device->status ? $device->uptime : $device->last_polled->diffInSeconds(), 'short'),
|
||||
'uptime' => (!$device->status && !$device->last_polled) ? __('Never polled') : Time::formatInterval($device->status ? $device->uptime : $device->last_polled->diffInSeconds(), 'short'),
|
||||
'location' => $this->getLocation($device),
|
||||
'actions' => $this->getActions($device),
|
||||
];
|
||||
@@ -212,6 +212,8 @@ class DeviceController extends TableController
|
||||
/**
|
||||
* @param $device
|
||||
* @param $count
|
||||
* @param $tab
|
||||
* @param $icon
|
||||
* @return string
|
||||
*/
|
||||
private function formatMetric($device, $count, $tab, $icon)
|
||||
|
@@ -315,7 +315,9 @@ if ($format == "graph") {
|
||||
return "<span>" + row.hostname + "</span>";
|
||||
},
|
||||
"uptime": function (column, row) {
|
||||
if (row.status == 'down') {
|
||||
if (isNaN(row.uptime.charAt(0))) {
|
||||
return row.uptime;
|
||||
} else if (row.status == 'down') {
|
||||
return "<span class='alert-status-small label-danger'></span><span>" + row.uptime + "</span>";
|
||||
} else {
|
||||
return "<span class='alert-status-small label-success'></span><span>" + row.uptime + "</span>";
|
||||
|
Reference in New Issue
Block a user