Commit 9f1c4d56 by Kálmán Viktor

dashboard: use failed property to detect failed disks

parent cc8c734f
{% load i18n %} {% load i18n %}
{% load sizefieldtags %} {% 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 }}) - {{ d.name }} (#{{ d.id }}) -
{% if not d.is_downloading %} {% if not d.is_downloading %}
{% if d.ready %} {% if not d.failed %}
{{ d.size|filesize }} {% if d.size %}{{ d.size|filesize }}{% endif %}
{% else %} {% 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 %} {% endif %}
{% else %}<span class="disk-list-disk-percentage" data-disk-pk="{{ d.pk }}">{{ d.get_download_percentage }}</span>%{% 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 }}" <a href="{% url "dashboard.views.disk-remove" pk=d.pk %}?next={{ request.path }}"
......
...@@ -193,6 +193,9 @@ class Disk(AclBase, TimeStampedModel): ...@@ -193,6 +193,9 @@ class Disk(AclBase, TimeStampedModel):
result = celery.AsyncResult(id=task) result = celery.AsyncResult(id=task)
return result.info.get("percent") return result.info.get("percent")
def get_latest_activity_result(self):
return self.activity_log.latest("pk").result
@property @property
def is_deletable(self): def is_deletable(self):
"""True if the associated file can be deleted. """True if the associated file can be deleted.
......
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