From 4b9e2c5692261dacf70acfe6a8997c0c60d19c6b Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Thu, 23 Jul 2015 11:54:04 +0100 Subject: [PATCH] templates/patch-list: Add patch "checks" column Add a column to display the important "checks" fields for each patch. Note that only the "completed" checks are shown (i.e. "in progress" and "not started" checks are ignored). Signed-off-by: Stephen Finucane --- patchwork/templates/patchwork/patch-list.html | 5 +++++ patchwork/templatetags/patch.py | 14 ++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/patchwork/templates/patchwork/patch-list.html b/patchwork/templates/patchwork/patch-list.html index c81fe889..165b0794 100644 --- a/patchwork/templates/patchwork/patch-list.html +++ b/patchwork/templates/patchwork/patch-list.html @@ -75,6 +75,10 @@ $(document).ready(function() { >{% for tag in project.tags %}{{tag.abbrev}}{% if not forloop.last %}/{% endif %}{% endfor %} + + S/W/F + + {% ifequal order.name "date" %} {{ patch.name|default:"[no subject]"|truncatechars:100 }} {{ patch|patch_tags }} + {{ patch|patch_checks }} {{ patch.date|date:"Y-m-d" }} {{ patch.submitter|personify:project }} {{ patch.delegate.username }} diff --git a/patchwork/templatetags/patch.py b/patchwork/templatetags/patch.py index 3b281586..26cfc13f 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 +# Copyright (C) 2015 Intel Corporation # # This file is part of the Patchwork package. # @@ -20,6 +21,8 @@ from django import template from django.utils.safestring import mark_safe +from patchwork.models import Check + register = template.Library() @@ -37,3 +40,14 @@ def patch_tags(patch): return mark_safe('%s' % ( ' / '.join(titles), ' '.join(counts))) + + +@register.filter(name='patch_checks') +def patch_checks(patch): + required = [Check.STATE_SUCCESS, Check.STATE_WARNING, Check.STATE_FAIL] + titles = ['Success', 'Warning', 'Fail'] + counts = patch.check_count + + return mark_safe('%s' % ( + ' / '.join(titles), + ' '.join([str(counts[state]) for state in required]))) -- 2.47.3