[PATCH 06/10] templates/patch-list: Add patch "status" column

Stephen Finucane stephen.finucane at intel.com
Wed Jul 29 18:58:44 AEST 2015


Add a column to display the important "status" fields for each
patch. Note that only the "completed" statuses are shown (i.e.
"in progress" and "not started" statuses are ignored).

Signed-off-by: Stephen Finucane <stephen.finucane at intel.com>
---
 patchwork/templates/patchwork/patch-list.html |  5 +++++
 patchwork/templatetags/patch.py               | 13 +++++++++++++
 2 files changed, 18 insertions(+)

diff --git a/patchwork/templates/patchwork/patch-list.html b/patchwork/templates/patchwork/patch-list.html
index 4b3cb23..064dd7c 100644
--- a/patchwork/templates/patchwork/patch-list.html
+++ b/patchwork/templates/patchwork/patch-list.html
@@ -78,6 +78,10 @@
    </th>
 
    <th>
+    <span title="Success / Warning / Fail">S/W/F</span>
+   </th>
+
+   <th>
     {% ifequal order.name "date" %}
      <a class="colactive"
       href="{% listurl order=order.reversed_name %}"><img
@@ -176,6 +180,7 @@
    <td><a href="{% url 'patchwork.views.patch.patch' patch_id=patch.id %}"
      >{{ patch.name|default:"[no subject]" }}</a></td>
    <td style="white-space: nowrap;">{{ patch|patch_tags }}</td>
+   <td style="white-space: nowrap;">{{ patch|patch_statuses }}</td>
    <td>{{ patch.date|date:"Y-m-d" }}</td>
    <td>{{ patch.submitter|personify:project }}</td>
    <td>{{ patch.delegate.username }}</td>
diff --git a/patchwork/templatetags/patch.py b/patchwork/templatetags/patch.py
index ea23ebd..fc47a31 100644
--- a/patchwork/templatetags/patch.py
+++ b/patchwork/templatetags/patch.py
@@ -1,5 +1,6 @@
 # Patchwork - automated patch tracking system
 # Copyright (C) 2008 Jeremy Kerr <jk at ozlabs.org>
+# Copyright (C) 2015 Intel Corporation
 #
 # This file is part of the Patchwork package.
 #
@@ -21,6 +22,8 @@ from django import template
 from django.utils.safestring import mark_safe
 import re
 
+from patchwork.models import Status
+
 register = template.Library()
 
 @register.tag(name = 'ifpatcheditable')
@@ -76,3 +79,13 @@ def patch_tags(patch):
     return mark_safe('<span title="%s">%s</span>' % (
             ' / '.join(titles),
             ' '.join(counts)))
+
+ at register.filter(name='patch_statuses')
+def patch_statuses(patch):
+    required = [Status.STATE_SUCCESS, Status.STATE_WARNING, Status.STATE_FAIL]
+    titles = ['Success', 'Warning', 'Fail']
+    counts = patch.status_count
+
+    return mark_safe('<span title="%s">%s</span>' % (
+        ' / '.join(titles),
+        ' '.join([str(counts[state]) for state in required])))
-- 
2.0.0



More information about the Patchwork mailing list