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: Sat, 18 Nov 2023 13:12:03 -0500 (EST)

branch: master
commit ac4f5c0a7e0360ab93a9f0a00b0a0e57fbbd8ca8
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Sat Nov 18 19:09:30 2023 +0100

    templates: Build table can be limited to new failures.
    
    * src/cuirass/http.scm (evaluation-html-page): Adjust ‘db-get-builds’
    call for “newly-failed” STATUS.
    * src/cuirass/templates.scm (build-eval-table): Add #:summary.  Add
    button when STATUS is “failed” or “newly-failed”.
    (evaluation-build-table): Handle STATUS as “newly-failed”.
    Pass #:summary to ‘build-eval-table’.
---
 src/cuirass/http.scm      |  7 ++++++-
 src/cuirass/templates.scm | 29 +++++++++++++++++++++++++++--
 2 files changed, 33 insertions(+), 3 deletions(-)

diff --git a/src/cuirass/http.scm b/src/cuirass/http.scm
index 2fdb8c5..b4fc574 100644
--- a/src/cuirass/http.scm
+++ b/src/cuirass/http.scm
@@ -296,7 +296,12 @@ Hydra format."
      "builds request for evaluation page"
      (db-get-builds
       `((evaluation . ,id)
-        (status . ,(and=> status string->symbol))
+        (status . ,(match (and=> status string->symbol)
+                     ('newly-failed 'failed)
+                     (status status)))
+        ,@(if (and status (string=? status "newly-failed"))
+              `((weather . new-failure))
+              '())
         ,@(if paginate?
               `((nr . ,%page-size)
                 (border-high-time . ,border-high-time)
diff --git a/src/cuirass/templates.scm b/src/cuirass/templates.scm
index 8ef9a7f..5d18d86 100644
--- a/src/cuirass/templates.scm
+++ b/src/cuirass/templates.scm
@@ -1186,7 +1186,8 @@ the existing SPEC otherwise."
    ((= (build-weather still-succeeding) status) "Still succeeding")
    ((= (build-weather still-failing) status) "Still failing")))
 
-(define (build-eval-table eval-id builds build-min build-max status)
+(define* (build-eval-table eval-id builds build-min build-max status
+                           #:key summary)
   "Return HTML for the BUILDS table evaluation with given STATUS.  BUILD-MIN
 and BUILD-MAX are global minimal and maximal (stoptime, rowid) pairs."
   (define (table-header)
@@ -1240,6 +1241,28 @@ and BUILD-MAX are global minimal and maximal (stoptime, 
rowid) pairs."
   `((table
      (@ (id "eval-table")
         (class "table table-sm table-hover table-striped"))
+
+     ;; Add button to toggle between "all failures" and "new failures".
+     ,(match status
+        ("failed"
+         (match (evaluation-summary-newly-failed summary)
+           (0 "")
+           (newly-failed
+            `(a (@ (class "btn btn-danger")
+                   (href ,(string-append "/eval/"
+                                         (number->string eval-id)
+                                         "?status=newly-failed")))
+                ,(number->string newly-failed) " new failures"))))
+        ("newly-failed"
+         `(a (@ (class "btn btn-warning")
+                (href ,(string-append "/eval/"
+                                      (number->string eval-id)
+                                      "?status=failed")))
+             "View all "
+             ,(number->string (evaluation-summary-failed summary))
+             " failures"))
+        (_ ""))
+
      ,@(if (null? builds)
            `((th (@ (scope "col") (class "border-0")) "No elements here."))
            `(,(table-header)
@@ -1571,6 +1594,7 @@ evaluation."
                    (a (@ (class ,(string-append "nav-link "
                                                 (match status
                                                   ("failed" "active")
+                                                  ("newly-failed" "active")
                                                   (_ ""))))
                          (href "?status=failed"))
                       (span (@ (class "oi oi-x text-danger")
@@ -1587,7 +1611,8 @@ evaluation."
                        builds
                        builds-id-min
                        builds-id-max
-                       status)))))))
+                       status
+                       #:summary evaluation)))))))
 
 (define (build-search-results-table query builds build-min build-max)
   "Return HTML for the BUILDS table evaluation matching QUERY.  BUILD-MIN



reply via email to

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