branch: master
commit 22b82f8a133bbb718b78800118c2fb7fe44347b3
Author: Ludovic Courtès <l...@gnu.org>
AuthorDate: Tue Nov 23 20:22:47 2021 +0100

    templates: Show build log links only when relevant.
    
    * src/cuirass/templates.scm (build-details): Include link to log file
    only when relevant for STATUS.
    (build-eval-table)[table-row]: Likewise.
---
 src/cuirass/templates.scm | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/src/cuirass/templates.scm b/src/cuirass/templates.scm
index 8b1aedd..121fb4c 100644
--- a/src/cuirass/templates.scm
+++ b/src/cuirass/templates.scm
@@ -1,6 +1,6 @@
 ;;; templates.scm -- HTTP API
 ;;; Copyright © 2018 Tatiana Sholokhova <tanja201...@gmail.com>
-;;; Copyright © 2018, 2019, 2020 Ludovic Courtès <l...@gnu.org>
+;;; Copyright © 2018, 2019, 2020, 2021 Ludovic Courtès <l...@gnu.org>
 ;;; Copyright © 2019, 2020 Ricardo Wurmus <rek...@elephly.net>
 ;;; Copyright © 2020 Mathieu Othacehe <othac...@gnu.org>
 ;;;
@@ -726,8 +726,13 @@ the existing SPEC otherwise."
                        (aria-hidden "true"))
                     "")))
       (tr (th "Log file")
-          (td (a (@ (href "/build/" ,(assq-ref build #:id) "/log/raw"))
-                 "raw")))
+          (td ,(if (or (= (build-status started) status)
+                       (= (build-status succeeded) status)
+                       (= (build-status failed) status)
+                       (= (build-status canceled) status))
+                   `(a (@ (href "/build/" ,(assq-ref build #:id) "/log/raw"))
+                       "raw")
+                   "—")))
       (tr (th "Derivation")
           (td (pre ,(assq-ref build #:derivation))))
       (tr (th "Dependencies")
@@ -1122,8 +1127,10 @@ and BUILD-MAX are global minimal and maximal (stoptime, 
rowid) pairs."
       (td ,(assq-ref build #:job))
       (td ,(assq-ref build #:nixname))
       (td ,(assq-ref build #:system))
-      (td (a (@ (href "/build/" ,(assq-ref build #:id) "/log/raw"))
-               "raw"))))
+      (td ,(if completed?
+               `(a (@ (href "/build/" ,(assq-ref build #:id) "/log/raw"))
+                   "raw")
+               "—"))))
 
   (define (build-id build)
     (match build

Reply via email to