aboutsummaryrefslogtreecommitdiff
path: root/bffe/view/build.scm
blob: be33467c6c581dfe2944d0b08331328a11d437b5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
(define-module (bffe view build)
  #:use-module (srfi srfi-1)
  #:use-module (srfi srfi-19)
  #:use-module (ice-9 match)
  #:use-module (ice-9 format)
  #:use-module (bffe view util)
  #:use-module ((guix store) #:select (%store-prefix))
  #:export (build))

(define (build title build-details)
  (layout
   #:title (string-append
            "Build " (assoc-ref build-details "uuid") " — " title)
   #:body
   `((main
      (dl
       (dt "Derivation")
       (dd ,(assoc-ref build-details "derivation-name"))

       (dt "Tags")
       (dd (ul
            ,@(map (lambda (tag)
                     `(li ,(assoc-ref tag "key") ": "
                          ,(assoc-ref tag "value")))
                   (vector->list
                    (assoc-ref build-details "tags")))))

       (dt "Submitted at")
       (dd ,(assoc-ref build-details "created-at"))

       (dt "State")
       (dd ,(if (assoc-ref build-details "cancelled")
                "Canceled"
                (if (assoc-ref build-details "processed")
                    (if (string=? (assoc-ref
                                   (assoc-ref build-details "result")
                                   "result")
                                  "success")
                        "Succeeded"
                        "Failed")
                    "Pending")))

       (dt "Priority")
       (dd ,(assoc-ref build-details "priority")))

      ,@(if (assoc-ref build-details "processed")
            `((a (@ (href ,(string-append "/build/"
                                          (assoc-ref build-details "uuid")
                                          "/log")))
                 "View build log"))
            '())))))