]> git.ipfire.org Git - thirdparty/patchwork.git/commitdiff
templates/patch: Add check summary panel
authorStephen Finucane <stephen.finucane@intel.com>
Sat, 25 Jul 2015 12:51:13 +0000 (13:51 +0100)
committerStephen Finucane <stephen.finucane@intel.com>
Thu, 5 Nov 2015 17:08:03 +0000 (17:08 +0000)
Add a table to display the checks associated with a patch. This
includes the requisite styling along with some additional filters.

Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
--

v3: Slight restyling per web UI rework

htdocs/css/style.css
patchwork/settings/base.py
patchwork/templates/patchwork/patch.html
patchwork/templatetags/patch.py

index 96575df78b247f30f62d200e614ea73eef7f56e6..a5eac2e55800ab9afa5e16e442a58d37df0fecf0 100644 (file)
@@ -244,6 +244,60 @@ table.patchmeta tr th, table.patchmeta tr td {
        padding-top: 1em;
 }
 
+/* checks forms */
+/* TODO(stephenfin): Merge this with 'div.patchform' rules */
+.checks {
+       border: 1px solid gray;
+       margin: 0.5em 1em;
+}
+
+.checks th {
+       margin-top: 0em;
+       margin-left: -0.6em;
+       margin-right: -0.6em;
+       padding: 0.3em 0.3em 0.3em 0.6em;
+       background-color: #0A0A47;
+       color: white;
+       font-size: 100%;
+       font-weight: normal;
+}
+
+.checks td {
+       border-top: 1px solid gray;
+       padding: 10px 15px;
+       padding-left: 0.2em;
+       margin-top: 0em;
+}
+
+.checks td a {
+       text-decoration: none;
+}
+
+.checks td a:visited {
+       color: #786FB4;
+}
+
+.checks a:hover {
+       text-decoration: underline;
+}
+
+.checks .state {
+       font-weight: bold;
+       color: #ddd;
+}
+
+.checks .state.success {
+       color: #82ca9d;
+}
+
+.checks .state.warning {
+       color: #ffe59a;
+}
+
+.checks .state.fail {
+       color: #f7977a;
+}
+
 .comment .meta {
        background: #f0f0f0;
        padding: 0.3em 0.5em;
index f0387278b308d03694c3b4a4a01056cb362c5117..82c792c7ef14ce036a1646a62009b35ccf8318a6 100644 (file)
@@ -19,6 +19,7 @@ ROOT_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)),
 INSTALLED_APPS = [
     'django.contrib.auth',
     'django.contrib.contenttypes',
+    'django.contrib.humanize',
     'django.contrib.sessions',
     'django.contrib.sites',
     'django.contrib.admin',
index 00dc5a64404e5812d2ca939d15ed6befd686a011..37a3bebcd8dfbbb2c6f06c845500a19dc683f81f 100644 (file)
@@ -1,5 +1,6 @@
 {% extends "base.html" %}
 
+{% load humanize %}
 {% load syntax %}
 {% load person %}
 {% load patch %}
@@ -165,6 +166,37 @@ function toggle_headers(link_id, headers_id)
  >{{ patch.pull_url }}</a>
 {% endif %}
 
+{% if patch.checks %}
+<h2>Checks</h2>
+<table class="checks">
+<tr>
+  <th>Context</th>
+  <th>Check</th>
+  <th>Description</th>
+</tr>
+{% for check in patch.checks %}
+<tr>
+  <td>{{ check.context }}</td>
+  <td>
+    <span title="Updated {{ check.date|naturaltime }}"
+        class="state {{ check.get_state_display }}">
+      {{ check.get_state_display }}
+    </span>
+  </td>
+  <td>
+    {% if check.target_url %}
+    <a href="{{ check.target_url }}">
+    {% endif %}
+      {{ check.description }}
+    {% if check.target_url %}
+    </a>
+    {% endif %}
+  </td>
+</tr>
+{% endfor %}
+</table>
+{% endif %}
+
 {% for item in patch.commit_message %}
 <h2>Commit Message</h2>
 <div class="comment">
index 26cfc13fdac2fdd845121ca621753f937c307836..af5e54dda563eeea0f0e45370d40578f8387b888 100644 (file)
@@ -51,3 +51,8 @@ def patch_checks(patch):
     return mark_safe('<span title="%s">%s</span>' % (
         ' / '.join(titles),
         ' '.join([str(counts[state]) for state in required])))
+
+
+@register.filter(name='state_class')
+def state_class(state):
+    return '-'.join(state.split())