Add quota to the files view

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2017-06-08 16:42:43 +02:00 committed by Lukas Reschke
parent c46422b780
commit 0554dba69e
No known key found for this signature in database
GPG Key ID: B9F6980CF6E759B1
4 changed files with 41 additions and 0 deletions

View 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;
}

View File

@ -108,6 +108,10 @@
// trigger URL change event handlers
this._onPopState(urlParams);
$('#quota.has-tooltip').tooltip({
placement: 'bottom'
});
this._debouncedPersistShowHiddenFilesState = _.debounce(this._persistShowHiddenFilesState, 1200);
},

View 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

View 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']) ?>">