Use total available space rather than quota when updating the display

The initial quota display uses the total available space rather than the
quota. Moreover, the relative usage is based on the total space rather
than the quota. Due to this now the total available space is also used
when updating the quota display.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
This commit is contained in:
Daniel Calviño Sánchez 2022-08-10 11:22:50 +02:00
parent fe2f8b5d18
commit f6bdaac88e
2 changed files with 4 additions and 2 deletions

View file

@ -98,14 +98,15 @@
}
if (response.data !== undefined
&& response.data.quota !== undefined
&& response.data.total !== 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);
var humanTotal = OC.Util.humanFileSize(response.data.total, 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').html(t('files', '{used} of {quota} used', {used: humanUsed, quota: humanQuota}));
$('#quotatext').html(t('files', '{used} of {quota} used', {used: humanUsed, quota: humanTotal}));
} else {
$('#quotatext').html(t('files', '{used} used', {used: humanUsed}));
}

View file

@ -58,6 +58,7 @@ class Helper {
'maxHumanFilesize' => $maxHumanFileSize,
'freeSpace' => $storageInfo['free'],
'quota' => $storageInfo['quota'],
'total' => $storageInfo['total'],
'used' => $storageInfo['used'],
'usedSpacePercent' => (int)$storageInfo['relative'],
'owner' => $storageInfo['owner'],