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

The progress bar is wrong when you create a snapshot for a volume,
it shows the progress bar for the volumes, not for the snapshots.
Change the template for the snapshot limit in order to show the
right progress bar.

Change-Id: Ibdaff7469c389bd7161ba1466641a623db351ac9
Close-Bug: #1671457
This commit is contained in:
zengrui 2017-03-09 23:22:45 -05:00
parent e0b6936178
commit be94c29410
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 %}