Merge pull request #33495 from nextcloud/unify-initial-and-updated-quota-display

Unify initial and updated quota display
pull/32461/head^2
Vincent Petry 2022-08-15 11:26:36 +07:00 committed by GitHub
commit cb97e8f15c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 5 deletions

@ -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').attr('data-original-title', t('files', '{used}%', {used: Math.round(response.data.usedSpacePercent)}));
$('#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}));
}

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

@ -17,7 +17,7 @@
</li>
<?php else: ?>
<li id="quota" class="has-tooltip pinned <?php p($pinned === 0 ? 'first-pinned ' : '') ?>"
title="<?php p($l->t('%s%% of %s used', [$_['usage_relative'], $_['total_space']])); ?>">
title="<?php p($l->t('%s%%', [round($_['usage_relative'])])); ?>">
<a href="#" class="icon-quota svg quota-navigation-item">
<p id="quotatext" class="quota-navigation-item__text"><?php p($l->t('%1$s of %2$s used', [$_['usage'], $_['total_space']])); ?></p>
<div class="quota-navigation-item__container">