Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
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 <[email protected]>
  • Loading branch information
danxuliu committed Aug 16, 2022
commit 8b197410207537c74181d543ddfe481a2ada865f
5 changes: 3 additions & 2 deletions apps/files/js/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}));
}
Expand Down
1 change: 1 addition & 0 deletions apps/files/lib/Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public static function buildFileStorageStatistics($dir) {
'maxHumanFilesize' => $maxHumanFileSize,
'freeSpace' => $storageInfo['free'],
'quota' => $storageInfo['quota'],
'total' => $storageInfo['total'],
'used' => $storageInfo['used'],
'usedSpacePercent' => (int)$storageInfo['relative'],
'owner' => $storageInfo['owner'],
Expand Down