diff options
author | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2017-12-21 10:48:43 +0100 |
---|---|---|
committer | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2017-12-21 10:48:43 +0100 |
commit | 0cb45f681f28c08784eb50dbc60080008eb897cd (patch) | |
tree | 737c87db670398ca985d2522f05e086bba227c63 /apps/files/js/files.js | |
parent | 0c38c1b2dbd2c9eb5948b088375601136342aebb (diff) | |
download | nextcloud-server-0cb45f681f28c08784eb50dbc60080008eb897cd.tar.gz nextcloud-server-0cb45f681f28c08784eb50dbc60080008eb897cd.zip |
Update quota on file upload and deletion
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'apps/files/js/files.js')
-rw-r--r-- | apps/files/js/files.js | 28 |
1 files changed, 28 insertions, 0 deletions
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 */ |