GNU bug report logs - #36874
[PATCH] Fix templates to handle all statuses.

Previous Next

Package: guix-patches;

Reported by: Robert Vollmert <rob <at> vllmrt.net>

Date: Wed, 31 Jul 2019 14:51:02 UTC

Severity: normal

Tags: patch

Done: Ricardo Wurmus <rekado <at> elephly.net>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 36874 in the body.
You can then email your comments to 36874 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#36874; Package guix-patches. (Wed, 31 Jul 2019 14:51:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Robert Vollmert <rob <at> vllmrt.net>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Wed, 31 Jul 2019 14:51:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Robert Vollmert <rob <at> vllmrt.net>
To: guix-patches <at> gnu.org
Cc: Robert Vollmert <rob <at> vllmrt.net>
Subject: [PATCH] Fix templates to handle all statuses.
Date: Wed, 31 Jul 2019 16:48:50 +0200
* src/cuirass/templates.scm: Factor out class and title helpers
for build statuses, and handle all the statuses.
---
 src/cuirass/templates.scm | 109 ++++++++++++--------------------------
 1 file changed, 33 insertions(+), 76 deletions(-)

diff --git a/src/cuirass/templates.scm b/src/cuirass/templates.scm
index ab1b85c..84097f0 100644
--- a/src/cuirass/templates.scm
+++ b/src/cuirass/templates.scm
@@ -103,6 +103,28 @@
                 ,body
                 (hr)))))
 
+(define (status-class status)
+  (cond
+    ((= (build-status scheduled)         status) "oi oi-clock         text-warning")
+    ((= (build-status started)           status) "oi oi-reload        text-warning")
+    ((= (build-status succeeded)         status) "oi oi-check         text-success")
+    ((= (build-status failed)            status) "oi oi-x             text-danger")
+    ((= (build-status failed-dependency) status) "oi oi-warning       text-danger")
+    ((= (build-status failed-other)      status) "oi oi-warning       text-danger")
+    ((= (build-status canceled)          status) "oi oi-question-mark text-warning")
+    (else                                        "oi oi-warning       text-danger")))
+
+(define (status-title status)
+  (cond
+    ((= (build-status scheduled)         status) "Scheduled")
+    ((= (build-status started)           status) "Started")
+    ((= (build-status succeeded)         status) "Succeeded")
+    ((= (build-status failed)            status) "Failed")
+    ((= (build-status failed-dependency) status) "Failed (dependency)")
+    ((= (build-status failed-other)      status) "Failed (other)")
+    ((= (build-status canceled)          status) "Canceled")
+    (else                                        "Invalid status")))
+
 (define (specifications-table specs)
   "Return HTML for the SPECS table."
   `((p (@ (class "lead")) "Specifications")
@@ -128,29 +150,6 @@
 (define (build-details build)
   "Return HTML showing details for the BUILD."
   (define status (assq-ref build #:status))
-  (define display-status
-    (cond
-     ((= (build-status succeeded) status)
-      `(span (@ (class "oi oi-check text-success")
-                (title "Succeeded"))
-             " Success"))
-     ((= (build-status scheduled) status)
-      `(span (@ (class "oi oi-clock text-warning")
-                (title "Scheduled")
-                (aria-hidden "true"))
-             " Scheduled"))
-     ((= (build-status canceled) status)
-      `(span (@ (class "oi oi-question-mark text-warning")
-                (title "Canceled"))
-             " Canceled"))
-     ((= (build-status failed-dependency) status)
-      `(span (@ (class "oi oi-warning text-danger")
-                (title "Dependency failed"))
-             " Dependency failed"))
-     (else
-      `(span (@ (class "oi oi-x text-danger")
-                (title "Failed"))
-             " Failed"))))
   (define blocking-outputs
     (or (and-let* (((= (build-status failed-dependency) status))
                    (drv (false-if-exception
@@ -172,7 +171,9 @@
       (tr (th "Build ID")
           (td ,(assq-ref build #:id)))
       (tr (th "Status")
-          (td ,display-status
+          (td (span (@ (class ,(status-class status))
+                       (title ,(status-title status)))
+                ,(string-append " " (status-title status)))
               ,@(map (lambda (output)
                        `((br)
                          (a (@ (href ,(string-append "/log/" (basename output))))
@@ -361,32 +362,10 @@ and BUILD-MAX are global minimal and maximal (stoptime, rowid) pairs."
           (= (build-status failed) status)))
 
     `(tr
-      (td ,(cond
-            ((= (build-status succeeded) status)
-             `(span (@ (class "oi oi-check text-success")
-                       (title "Succeeded")
-                       (aria-hidden "true"))
-                    ""))
-            ((= (build-status scheduled) status)
-             `(span (@ (class "oi oi-clock text-warning")
-                       (title "Scheduled")
-                       (aria-hidden "true"))
-                    ""))
-            ((= (build-status canceled) status)
-             `(span (@ (class "oi oi-question-mark text-warning")
-                       (title "Canceled")
-                       (aria-hidden "true"))
-                    ""))
-            ((= (build-status failed-dependency) status)
-             `(span (@ (class "oi oi-warning text-danger")
-                       (title "Dependency failed")
-                       (aria-hidden "true"))
-                    ""))
-            (else
-             `(span (@ (class "oi oi-x text-danger")
-                       (title "Failed")
-                       (aria-hidden "true"))
-                    ""))))
+      (td (span (@ (class ,(status-class status))
+                   (title ,(status-title status))
+                   (aria-hidden "true"))
+                ""))
       (th (@ (scope "row"))
           (a (@ (href "/build/" ,(assq-ref build #:id) "/details"))
              ,(assq-ref build #:id)))
@@ -474,32 +453,10 @@ and BUILD-MAX are global minimal and maximal row identifiers."
           (= (build-status failed) status)))
 
     `(tr
-      (td ,(cond
-            ((= (build-status succeeded) status)
-             `(span (@ (class "oi oi-check text-success")
-                       (title "Succeeded")
-                       (aria-hidden "true"))
-                    ""))
-            ((= (build-status scheduled) status)
-             `(span (@ (class "oi oi-clock text-warning")
-                       (title "Scheduled")
-                       (aria-hidden "true"))
-                    ""))
-            ((= (build-status canceled) status)
-             `(span (@ (class "oi oi-question-mark text-warning")
-                       (title "Canceled")
-                       (aria-hidden "true"))
-                    ""))
-            ((= (build-status failed-dependency) status)
-             `(span (@ (class "oi oi-warning text-danger")
-                       (title "Dependency failed")
-                       (aria-hidden "true"))
-                    ""))
-            (else
-             `(span (@ (class "oi oi-x text-danger")
-                       (title "Failed")
-                       (aria-hidden "true"))
-                    ""))))
+      (td (span (@ (class ,(status-class status))
+                   (title ,(status-title status))
+                   (aria-hidden "true"))
+                ""))
       (th (@ (scope "row"))
           (a (@ (href "/build/" ,(assq-ref build #:id) "/details"))
              ,(assq-ref build #:id)))
-- 
2.21.0





Reply sent to Ricardo Wurmus <rekado <at> elephly.net>:
You have taken responsibility. (Wed, 07 Aug 2019 14:22:01 GMT) Full text and rfc822 format available.

Notification sent to Robert Vollmert <rob <at> vllmrt.net>:
bug acknowledged by developer. (Wed, 07 Aug 2019 14:22:02 GMT) Full text and rfc822 format available.

Message #10 received at 36874-done <at> debbugs.gnu.org (full text, mbox):

From: Ricardo Wurmus <rekado <at> elephly.net>
To: Robert Vollmert <rob <at> vllmrt.net>
Cc: 36874-done <at> debbugs.gnu.org
Subject: Re: [bug#36874] [PATCH] Fix templates to handle all statuses.
Date: Wed, 07 Aug 2019 16:21:09 +0200
Hi Robert,

> * src/cuirass/templates.scm: Factor out class and title helpers
> for build statuses, and handle all the statuses.

Applied!  Thank you and sorry for the delay.

-- 
Ricardo





bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 05 Sep 2019 11:24:11 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 206 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.