diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files/js/file-upload.js | 2 | ||||
-rw-r--r-- | apps/files/js/filelist.js | 1 | ||||
-rw-r--r-- | apps/files/js/files.js | 28 | ||||
-rw-r--r-- | apps/files/lib/Helper.php | 2 |
4 files changed, 32 insertions, 1 deletions
diff --git a/apps/files/js/file-upload.js b/apps/files/js/file-upload.js index d1730fa7bc7..e9534111e10 100644 --- a/apps/files/js/file-upload.js +++ b/apps/files/js/file-upload.js @@ -130,7 +130,7 @@ OC.FileUpload.prototype = { }, /** - * Get full path for the target file, + * Get full path for the target file, * including relative path and file name. * * @return {String} full path diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index fa9819b78b5..a3ae92f575a 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -3054,6 +3054,7 @@ var uploadText = self.$fileList.find('tr .uploadtext'); self.showFileBusyState(uploadText.closest('tr'), false); + self.updateStorageStatistics(true); uploadText.fadeOut(); uploadText.attr('currentUploads', 0); }); diff --git a/apps/files/js/files.js b/apps/files/js/files.js index 017bf7ecf41..c682f290a56 100644 --- a/apps/files/js/files.js +++ b/apps/files/js/files.js @@ -29,6 +29,7 @@ state.dir = null; state.call = null; Files.updateMaxUploadFilesize(response); + Files.updateQuota(response); }); }, /** @@ -77,6 +78,33 @@ }, + updateQuota:function(response) { + console.log('updateQuota'); + if (response === undefined) { + return; + } + if (response.data !== undefined + && response.data.quota !== undefined + && response.data.used !== undefined + && response.data.usedSpacePercent !== undefined) { + var humanUsed = OC.Util.humanFileSize(response.data.used, true); + var humanQuota = OC.Util.humanFileSize(response.data.quota, true); + if (response.data.quota > 0) { + $('#quota').attr('data-original-title', Math.floor(response.data.used/response.data.quota*1000)/10 + '%'); + $('#quota progress').val(response.data.usedSpacePercent); + $('#quotatext').text(t('files', '{used} of {quota} used', {used: humanUsed, quota: humanQuota})); + } else { + $('#quotatext').text(t('files', '{used} used', {used: humanUsed})); + } + if (response.data.usedSpacePercent > 80) { + $('#quota progress').addClass('warn'); + } else { + $('#quota progress').removeClass('warn'); + } + } + + }, + /** * Fix path name by removing double slash at the beginning, if any */ diff --git a/apps/files/lib/Helper.php b/apps/files/lib/Helper.php index ab952c97dfb..9d9717c9401 100644 --- a/apps/files/lib/Helper.php +++ b/apps/files/lib/Helper.php @@ -56,6 +56,8 @@ class Helper { 'uploadMaxFilesize' => $maxUploadFileSize, 'maxHumanFilesize' => $maxHumanFileSize, 'freeSpace' => $storageInfo['free'], + 'quota' => $storageInfo['quota'], + 'used' => $storageInfo['used'], 'usedSpacePercent' => (int)$storageInfo['relative'], 'owner' => $storageInfo['owner'], 'ownerDisplayName' => $storageInfo['ownerDisplayName'], |