aboutsummaryrefslogtreecommitdiff
path: root/bffe/view/agent.scm
blob: 1de2f715ed09b974e1a28ac05eca6f1fe075e043 (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
(define-module (bffe view agent)
  #:use-module (srfi srfi-1)
  #:use-module (bffe view util)
  #:export (agent))

(define (agent title agent-details)
  (layout
   #:title (string-append "Agent "
                          (assoc-ref agent-details "id")
                          " — " title)
   #:body
   `((main
      (dl
       (dt "Description")
       (dd ,(assoc-ref agent-details "description"))

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

       (dt "Allocated builds")
       (dl (ul
            ,@(map (lambda (build)
                     `(li
                       (a (@ (href
                              ,(string-append "/build/"
                                              (assoc-ref build "uuid"))))
                          ,(assoc-ref build "derivation_name")
                          " (derived priority: "
                          ,(assoc-ref build "derived_priority")
                          ")")))
                   (vector->list
                    (assoc-ref agent-details "allocated_builds"))))))))))