]> source.dussan.org Git - nextcloud-server.git/commitdiff
Add quota to the files view
authorJoas Schilling <coding@schilljs.com>
Thu, 8 Jun 2017 14:42:43 +0000 (16:42 +0200)
committerMorris Jobke <hey@morrisjobke.de>
Tue, 13 Jun 2017 17:27:43 +0000 (12:27 -0500)
Signed-off-by: Joas Schilling <coding@schilljs.com>
apps/files/css/files.scss
apps/files/js/app.js
apps/files/lib/Controller/ViewController.php
apps/files/templates/appnavigation.php

index 579cf36e15b7bc652d768f167e7727d2d4fd9a27..9fcc10caf46fae3665b1cec05532d3024ffd790e 100644 (file)
@@ -747,3 +747,16 @@ table.dragshadow td.size {
 #filestable tbody tr.canDrop {
   background-color: rgba(255, 255, 140, 1);
 }
+
+
+#quota {
+       margin: 0 !important;
+       border: none;
+       div {
+               border-radius: 0;
+       }
+}
+
+#quotatext {
+       padding: 3px;
+}
index d46a0b8f9df6ef5b7fde36a2d96e7850aea6b3fa..5f1bf1a7b1e43333d848a6d4d97c8639726fe036 100644 (file)
                        // trigger URL change event handlers
                        this._onPopState(urlParams);
 
+                       $('#quota.has-tooltip').tooltip({
+                               placement: 'bottom'
+                       });
+
                        this._debouncedPersistShowHiddenFilesState = _.debounce(this._persistShowHiddenFilesState, 1200);
                },
 
index f7a4318e595495f671efc1618e60ea8e91aedbac..fc59622af895a943692fa48bd7239e4a8e27352e 100644 (file)
@@ -174,6 +174,17 @@ class ViewController extends Controller {
                });
                $nav->assign('navigationItems', $navItems);
 
+
+               $nav->assign('usage', \OC_Helper::humanFileSize($storageInfo['used']));
+               if ($storageInfo['quota'] === \OCP\Files\FileInfo::SPACE_UNLIMITED) {
+                       $totalSpace = $this->l10n->t('Unlimited');
+               } else {
+                       $totalSpace = \OC_Helper::humanFileSize($storageInfo['total']);
+               }
+               $nav->assign('total_space', $totalSpace);
+               $nav->assign('quota', $storageInfo['quota']);
+               $nav->assign('usage_relative', $storageInfo['relative']);
+
                $contentItems = [];
 
                // render the container content for every navigation item
index 9c79f8067131fc6643542b08d18dc37bb2b8d009..28019ba803d4faffc4585e41d09cbb9325546915 100644 (file)
@@ -1,4 +1,17 @@
 <div id="app-navigation">
+       <div id="quota" class="section has-tooltip" title="<?php
+       if ($_['quota'] === \OCP\Files\FileInfo::SPACE_UNLIMITED) {
+               p($l->t('You are using %s of %s', [$_['usage'], $_['total_space']]));
+       } else {
+               p($l->t('You are using %s of %s (%s %%)', [$_['usage'], $_['total_space'],  $_['usage_relative']]));
+       }
+       ?>">
+               <div style="width:<?php p($_['usage_relative']);?>%"
+                        <?php if($_['usage_relative'] > 80): ?>class="quota-warning"<?php endif; ?>>
+                       <p id="quotatext"><?php p($l->t('%s of %s in use', [$_['usage'], $_['total_space']])); ?></p>
+               </div>
+       </div>
+
        <ul class="with-icon">
                <?php foreach ($_['navigationItems'] as $item) { ?>
                <li data-id="<?php p($item['id']) ?>" class="nav-<?php p($item['id']) ?>">