Commit 52b9dbf4 by Kálmán Viktor

dashboard: add progress bar for quota

parent bfa29ab1
......@@ -831,3 +831,21 @@ textarea[name="list-new-namelist"] {
.store-action-button {
margin-left: 5px;
}
.progress-bar {
border-top-left-radius: 4px;
border-bottom-left-radius: 4px;
}
#progress-marker-hard {
border-top-right-radius: 4px;
border-bottom-right-radius: 4px;
right: 0;
background: red;
}
.progress-marker {
width: 6px;
height: 20px;
position: absolute;
}
......@@ -12,6 +12,26 @@
</div>
</div>
<div class="progress" style="position: relative; overflow: visible;">
<div class="progress-bar" role="progressbar" aria-valuenow="{{ quota.Used }}" aria-valuemin="0"
aria-valuemax="{{ quota.Hard }}" style="width:
{% if quota.Used > quota.Hard %}100{% else %}{% widthratio quota.Used quota.Hard 100 %}%{% endif %}%">
<div style="padding-top: 2px;">
{% blocktrans with used=quota.readable_used %}
{{ used }} used
{% endblocktrans %}
</div>
</div>
<div class="progress-marker" id="progress-marker-hard" data-placement="left"
title="{% trans "Hard limit" %}: {{ quota.readable_hard }}">
</div>
<div class="progress-marker" id="progress-marker-soft" style="background: orange;
left: {% widthratio quota.Soft quota.Hard 100 %}%"
title="{% trans "Soft limit" %}: {{ quota.readable_soft }}"
data-placement="left">
</div>
</div>
{% endblock %}
{% block extra_js %}
......
......@@ -3100,7 +3100,9 @@ class StoreList(LoginRequiredMixin, TemplateView):
directory = self.request.GET.get("directory", "/")
directory = "/" if not len(directory) else directory
context['root'] = Store(self.request.user).list(directory)
store = Store(self.request.user)
context['root'] = store.list(directory)
context['quota'] = store.get_quota()
context['up_url'] = self.create_up_directory(directory)
context['current'] = directory
context['next_url'] = "%s%s?directory=%s" % (
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment