From 9f1c4d56d25c2a39b2837028d19d58fb58edf787 Mon Sep 17 00:00:00 2001 From: Kálmán Viktor <kviktor@cloud.bme.hu> Date: Tue, 18 Mar 2014 16:51:54 +0100 Subject: [PATCH] dashboard: use failed property to detect failed disks --- circle/dashboard/templates/dashboard/_disk-list-element.html | 8 ++++---- circle/storage/models.py | 3 +++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/circle/dashboard/templates/dashboard/_disk-list-element.html b/circle/dashboard/templates/dashboard/_disk-list-element.html index a89d1c3..e3d864f 100644 --- a/circle/dashboard/templates/dashboard/_disk-list-element.html +++ b/circle/dashboard/templates/dashboard/_disk-list-element.html @@ -1,13 +1,13 @@ {% load i18n %} {% load sizefieldtags %} -<i class="{% if d.is_downloading %}icon-refresh icon-spin{% else %}icon-file{% if not d.ready %}" style="color: #d9534f;{% endif %}{% endif %}"></i> +<i class="{% if d.is_downloading %}icon-refresh icon-spin{% else %}icon-file{% if d.failed %}" style="color: #d9534f;{% endif %}{% endif %}"></i> {{ d.name }} (#{{ d.id }}) - {% if not d.is_downloading %} - {% if d.ready %} - {{ d.size|filesize }} + {% if not d.failed %} + {% if d.size %}{{ d.size|filesize }}{% endif %} {% else %} - <div class="label label-danger">failed</div> + <div class="label label-danger"{% if user.is_superuser %} title="{{ d.get_latest_activity_result }}"{% endif %}>failed</div> {% endif %} {% else %}<span class="disk-list-disk-percentage" data-disk-pk="{{ d.pk }}">{{ d.get_download_percentage }}</span>%{% endif %} <a href="{% url "dashboard.views.disk-remove" pk=d.pk %}?next={{ request.path }}" diff --git a/circle/storage/models.py b/circle/storage/models.py index 845eca1..b72b49c 100644 --- a/circle/storage/models.py +++ b/circle/storage/models.py @@ -193,6 +193,9 @@ class Disk(AclBase, TimeStampedModel): result = celery.AsyncResult(id=task) return result.info.get("percent") + def get_latest_activity_result(self): + return self.activity_log.latest("pk").result + @property def is_deletable(self): """True if the associated file can be deleted. -- libgit2 0.26.0