summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2017-12-21 10:48:43 +0100
committerJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2017-12-21 10:48:43 +0100
commit0cb45f681f28c08784eb50dbc60080008eb897cd (patch)
tree737c87db670398ca985d2522f05e086bba227c63 /apps
parent0c38c1b2dbd2c9eb5948b088375601136342aebb (diff)
downloadnextcloud-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')
-rw-r--r--apps/files/js/file-upload.js2
-rw-r--r--apps/files/js/filelist.js1
-rw-r--r--apps/files/js/files.js28
-rw-r--r--apps/files/lib/Helper.php2
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'],