storage: Don't show empty progress bar for disks not mounted

In future, we may consider showing disks that are not mounted and allow mounting
them manually or unlocking encrypted volumes manually. Prepare for that
scenario.

Tests performed:

- Edit get_disks() code to show not mounted disks. The progress bar or free
space information should not be shown.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa 2020-05-29 18:10:59 -07:00 committed by James Valleroy
parent 10b46f1968
commit d4ce843e22
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808

View File

@ -38,21 +38,24 @@
<td>{{ disk.mount_points|join:"<br>" }}</td>
<td>{{ disk.filesystem_type }}</td>
<td>
<div class="progress">
{% if disk.percent_used < 75 %}
<div class="progress-bar progress-bar-striped progress-bar-success"
{% elif disk.percent_used < 90 %}
<div class="progress-bar progress-bar-striped progress-bar-warning"
{% else %}
<div class="progress-bar progress-bar-striped progress-bar-danger"
{% endif %}
role="progressbar" aria-valuenow="disk.percent_used"
aria-valuemin="0" aria-valuemax="100"
style="width: {{ disk.percent_used }}%;">
{{ disk.percent_used }}%
</div>
</div>
<div>{{ disk.used_str }} / {{ disk.size_str }}</div>
{% if 'percent_used' in disk %}
<div class="progress">
<div class="progress-bar progress-bar-striped
{% if disk.percent_used < 75 %}
progress-bar-success
{% elif disk.percent_used < 90 %}
progress-bar-warning
{% else %}
progress-bar-danger
{% endif %}"
role="progressbar" aria-valuenow="disk.percent_used"
aria-valuemin="0" aria-valuemax="100"
style="width: {{ disk.percent_used }}%;">
{{ disk.percent_used }}%
</div>
</div>
<div>{{ disk.used_str }} / {{ disk.size_str }}</div>
{% endif %}
</td>
<td>
{% if disk.is_removable %}