Merge "The progress bar is wrong when you create a snapshot for a volume."

This commit is contained in:
Jenkins 2017-03-17 11:13:41 +00:00 committed by Gerrit Code Review
commit fc8fae167a
2 changed files with 20 additions and 8 deletions

View File

@ -48,13 +48,15 @@
data-quota-limit={% block total_progress %}"{{ usages.maxTotalVolumes }}"{% endblock %}
data-quota-used={% block used_progress %}"{{ usages.volumesUsed }}"{% endblock %}
class="quota_bar">
{% widthratio usages.volumesUsed usages.maxTotalVolumes 100 as volumes_percent %}
{% if usages.numRequestedItems %}
{% widthratio 100 usages.maxTotalVolumes usages.numRequestedItems as single_step %}
{% else %}
{% widthratio 100 usages.maxTotalVolumes 1 as single_step %}
{% endif %}
{% bs_progress_bar volumes_percent single_step %}
{% block show_progress_bar %}
{% widthratio usages.volumesUsed usages.maxTotalVolumes 100 as volumes_percent %}
{% if usages.numRequestedItems %}
{% widthratio 100 usages.maxTotalVolumes usages.numRequestedItems as single_step %}
{% else %}
{% widthratio 100 usages.maxTotalVolumes 1 as single_step %}
{% endif %}
{% bs_progress_bar volumes_percent single_step %}
{% endblock %}
</div>
{{ endminifyspace }}

View File

@ -1,5 +1,5 @@
{% extends "project/volumes/_limits.html" %}
{% load i18n horizon humanize %}
{% load i18n horizon humanize bootstrap %}
{% block title %}
{% trans "From here you can create a snapshot of a volume." %}
@ -40,3 +40,13 @@
{% block used_progress %}
"{{ usages.snapshotsUsed }}"
{% endblock %}
{% block show_progress_bar %}
{% widthratio usages.snapshotsUsed usages.maxTotalSnapshots 100 as volumes_percent %}
{% if usages.numRequestedItems %}
{% widthratio usages.numRequestedItems usages.maxTotalSnapshots 100 as single_step %}
{% else %}
{% widthratio 1 usages.maxTotalSnapshots 100 as single_step %}
{% endif %}
{% bs_progress_bar volumes_percent single_step %}
{% endblock %}