guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[no subject]


From: Ludovic Courtès
Date: Tue, 5 Sep 2023 09:26:26 -0400 (EDT)

branch: master
commit c74a2a1332a7e8ebfb97869bd2a608b61de05054
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Tue Sep 5 14:31:36 2023 +0200

    templates: Factorize badges for broken evaluations.
    
    * src/cuirass/templates.scm (broken-evaluation-badge): New procedure…
    (evaluation-badges): … extracted from here.  Use it.
---
 src/cuirass/templates.scm | 33 ++++++++++++++++++---------------
 1 file changed, 18 insertions(+), 15 deletions(-)

diff --git a/src/cuirass/templates.scm b/src/cuirass/templates.scm
index ee6963a..c3cfaf5 100644
--- a/src/cuirass/templates.scm
+++ b/src/cuirass/templates.scm
@@ -881,6 +881,20 @@ the existing SPEC otherwise."
           ", ")))
     (if (string=? changes "") '(em "None") changes)))
 
+(define (broken-evaluation-badge eval-id status)
+  (cond ((= status (evaluation-status failed))
+         `((a (@ (href "/eval/" ,eval-id "/log/raw")
+                 (class "oi oi-x text-danger")
+                 (title "Failed")
+                 (aria-hidden "true"))
+              "")))
+        ((= status (evaluation-status aborted))
+         `((a (@ (href "/eval/" ,eval-id "/log/raw")
+                 (class "oi oi-x text-warning")
+                 (title "Aborted")
+                 (aria-hidden "true"))
+              "")))))
+
 (define (evaluation-badges evaluation absolute)
   (define (dashboard-link body)
     `(a (@ (href "/eval/" ,(build-summary-evaluation-id evaluation)
@@ -891,20 +905,6 @@ the existing SPEC otherwise."
     (if (= status (evaluation-status started))
         '((em "In progress…"))
         (cond
-         ((= status (evaluation-status failed))
-          `((a (@ (href "/eval/" ,(build-summary-evaluation-id evaluation)
-                        "/log/raw")
-                  (class "oi oi-x text-danger")
-                  (title "Failed")
-                  (aria-hidden "true"))
-               "")))
-         ((= status (evaluation-status aborted))
-          `((a (@ (href "/eval/" ,(build-summary-evaluation-id evaluation)
-                        "/log/raw")
-                  (class "oi oi-x text-warning")
-                  (title "Aborted")
-                  (aria-hidden "true"))
-               "")))
          ((= status (evaluation-status succeeded))
           `((div
              (@ (class "job-abs d-none"))
@@ -942,7 +942,10 @@ the existing SPEC otherwise."
                                       "/eval/"
                                       (number->string
                                        (build-summary-evaluation-id 
evaluation))
-                                      "?status=pending")))))))))
+                                      "?status=pending")))))
+         (else
+          (broken-evaluation-badge (build-summary-evaluation-id evaluation)
+                                   status))))))
 
 (define* (evaluation-info-table name evaluations id-min id-max
                                 #:key absolute-summary)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]