diff --git a/app/Http/Controllers/Table/DeviceController.php b/app/Http/Controllers/Table/DeviceController.php index 7a108ea535..de3eebcdf1 100644 --- a/app/Http/Controllers/Table/DeviceController.php +++ b/app/Http/Controllers/Table/DeviceController.php @@ -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) diff --git a/html/pages/devices.inc.php b/html/pages/devices.inc.php index 5ab815f0f8..b4316fd212 100644 --- a/html/pages/devices.inc.php +++ b/html/pages/devices.inc.php @@ -315,7 +315,9 @@ if ($format == "graph") { return "" + row.hostname + ""; }, "uptime": function (column, row) { - if (row.status == 'down') { + if (isNaN(row.uptime.charAt(0))) { + return row.uptime; + } else if (row.status == 'down') { return "" + row.uptime + ""; } else { return "" + row.uptime + "";