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:
Tony Murray
2019-03-19 06:52:06 -05:00
committed by GitHub
parent b237e42615
commit bc24d39bf1
2 changed files with 6 additions and 2 deletions

View File

@@ -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)