diff --git a/src/translation/en.json b/src/translation/en.json index 84a0b1353..869fea507 100644 --- a/src/translation/en.json +++ b/src/translation/en.json @@ -1447,7 +1447,8 @@ "title": "Data Directory", "description": "If the server is running out of disk space, use this to move the app's data to a volume. Any data here is part of the app's backup.", "dataDirPlaceholder": "Leave empty to use platform default", - "moveAction": "Move Data" + "moveAction": "Move Data", + "diskUsage": "The app is currently using {{ size }} of storage (as of {{ date }})." }, "mounts": { "title": "Mounts", diff --git a/src/views/app.html b/src/views/app.html index 10cbd5065..a72aff03e 100644 --- a/src/views/app.html +++ b/src/views/app.html @@ -975,6 +975,7 @@
+

diff --git a/src/views/app.js b/src/views/app.js index 4eea56ea2..80c006a47 100644 --- a/src/views/app.js +++ b/src/views/app.js @@ -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