diff --git a/src/theme.scss b/src/theme.scss index 8219b7993..c9fe7dade 100644 --- a/src/theme.scss +++ b/src/theme.scss @@ -1374,6 +1374,12 @@ footer { overflow: auto; } +.disks-last-updated { + font-size: 12px; + font-weight: bold; + align-self: center; +} + // ---------------------------- // Error and status page classes // ---------------------------- diff --git a/src/views/system.html b/src/views/system.html index 5b2082a9f..f6dd45295 100644 --- a/src/views/system.html +++ b/src/views/system.html @@ -48,8 +48,9 @@

{{ 'system.diskUsage.title' | tr }} + Last updated: {{ disks.ts | prettyDate }}
- +

@@ -63,7 +64,6 @@

- {{ 'system.diskUsage.notAvailableYet' | tr }} diff --git a/src/views/system.js b/src/views/system.js index 522b386e8..f3794b09b 100644 --- a/src/views/system.js +++ b/src/views/system.js @@ -30,16 +30,18 @@ angular.module('Application').controller('SystemController', ['$scope', '$locati $scope.disks = { busy: true, + busyRefresh: false, + ts: 0, disks: [], - refresh: function () { - $scope.disks.busy = true; - - Client.refreshDiskUsage(function (error, result) { + show: function () { + Client.diskUsage(function (error, result) { if (error) return console.error('Failed to refresh disk usage.', error); + $scope.disks.ts = result.usage.ts; + // [ { filesystem, type, size, used, available, capacity, mountpoint }] - $scope.disks.disks = Object.keys(result).map(function (k) { return result[k]; }); + $scope.disks.disks = Object.keys(result.usage.disks).map(function (k) { return result.usage.disks[k]; }); $scope.disks.disks.forEach(function (disk) { var usageOther = disk.occupied; @@ -77,6 +79,18 @@ angular.module('Application').controller('SystemController', ['$scope', '$locati $scope.disks.busy = false; }); + }, + + refresh: function () { + $scope.disks.busyRefresh = true; + + Client.refreshDiskUsage(function (error) { + $scope.disks.busyRefresh = false; + + if (error) return console.error('Failed to refresh disk usage.', error); + + $scope.disks.show(); + }); } }; @@ -224,7 +238,7 @@ angular.module('Application').controller('SystemController', ['$scope', '$locati volumes.forEach(function (v) { $scope.volumesById[v.id] = v; }); $scope.graphs.refresh(); - $scope.disks.refresh(); + $scope.disks.show(); }); }); });