Show app disk usage in storage tab

This commit is contained in:
Johannes Zellner
2022-11-15 14:54:07 +01:00
parent f5edcf90a0
commit 2cb3c918f7
3 changed files with 28 additions and 1 deletions

View File

@@ -52,6 +52,8 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
$scope.groups = [];
$scope.users = [];
$scope.backupConfig = null;
$scope.diskUsage = 0;
$scope.diskUsageDate = 0;
$scope.APP_TYPES = APP_TYPES;
$scope.HOST_PORT_MIN = 1;
@@ -1931,6 +1933,28 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
});
}
function fetchDiskUsage(callback) {
$scope.diskUsage = 0;
Client.diskUsage(function (error, result) {
if (error) return callback(error);
$scope.diskUsageDate = result.usage.ts;
for (var diskName in result.usage.disks) {
var disk = result.usage.disks[diskName];
var content = disk.contents.find(function (c) { return c.id === appId; });
if (content) {
$scope.diskUsage = content.usage;
break;
}
}
callback();
});
}
function getDomains(callback) {
Client.getDomains(function (error, result) {
if (error) return callback(error);
@@ -2075,6 +2099,7 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
async.series([
fetchUsers,
fetchGroups,
fetchDiskUsage,
getDomains,
getVolumes,
getBackupConfig