]> source.dussan.org Git - nextcloud-server.git/commitdiff
Show usage percenteage in the tooltip 33580/head
authorDaniel Calviño Sánchez <danxuliu@gmail.com>
Wed, 10 Aug 2022 09:23:27 +0000 (11:23 +0200)
committerbackportbot-nextcloud[bot] <backportbot-nextcloud[bot]@users.noreply.github.com>
Wed, 17 Aug 2022 12:21:16 +0000 (12:21 +0000)
The tooltip of the initial quota display showed the usage percenteage
and the total available space. However, the total available space was
redundant, as it was shown just below. The tooltip of the updated quota
display showed the usage percenteage, but based on the quota rather than
the total available space, so there was a mismatch between the tooltip
and the bar below. Now the tooltip of the initial and the updated quota
display both show just the usage percenteage based on the total
available space.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
apps/files/js/files.js
apps/files/lib/Helper.php
apps/files/templates/appnavigation.php

index 1aff9f5332d20dfff8c94b03aea3fbd87e54317c..37b084234f9a288a7870e54be35a296d88cdf6a6 100644 (file)
                                var humanUsed = OC.Util.humanFileSize(response.data.used, 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: humanTotal}));
                                } else {
index 22744e5940f3de9530e7895c73f31be557a56bdd..1d9591cafe0562844db881c67ea46125f3a81776 100644 (file)
@@ -60,7 +60,7 @@ class Helper {
                        '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'],
index 9aea68fef99b017ed5f6f1640c3503c153d0eb2f..7b0bc0291bb84ea945bd81ececf1fdf583f10d15 100644 (file)
@@ -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">
                                        <p id="quotatext"><?php p($l->t('%1$s of %2$s used', [$_['usage'], $_['total_space']])); ?></p>
                                        <div class="quota-container">