Commit c58f5c34 by Fukász Rómeó Ervin

dashboard, storage: fix WorkerNotFound on StorageList when DataStore is offline

parent 64bafc82
{% load i18n %}
{% with record.used_percent as used_percent %}
{% if used_percent < 0 %}
<div>
{% trans 'The DataStore is offline.' %}
</div>
{% else %}
<div class="progress">
{% with record.used_percent as used_percent %}
<div class="progress-bar progress-bar-stripped
{% if used_percent < 80 %}progress-bar-success
{% elif used_percent < 90 %}progress-bar-warning
......@@ -7,5 +13,6 @@
role="progressbar" style="min-width: 30px; width: {{ used_percent }}%">
{{ used_percent }}%
</div>
{% endwith %}
</div>
{% endif %}
{% endwith %}
......@@ -119,9 +119,11 @@ class DataStore(Model):
@property
def used_percent(self):
try:
stats = self.get_statistics()
except WorkerNotFound:
return -1 # invalid value for unreachable
free_percent = float(stats['free_percent'])
return int(100 - free_percent)
@property
......
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