Show last updated for disks and allow refresh on-demand
This commit is contained in:
+20
-6
@@ -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();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user