aboutsummaryrefslogtreecommitdiff
path: root/guix-qa-frontpage/view/patches.scm
blob: bdace25d1d028782bfb96ffdd7a55d836a0b16f7 (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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
(define-module (guix-qa-frontpage view patches)
  #:use-module (srfi srfi-1)
  #:use-module (ice-9 match)
  #:use-module (ice-9 string-fun)
  #:use-module (guix-qa-frontpage issue)
  #:use-module (guix-qa-frontpage view util)
  #:export (patches-view))

(define (patches-view latest-series
                      filtered-statuses
                      systems-with-low-substitute-availability)

  (define (status->issue-status-span status)
    (cond
     ((eq? status 'reviewed-looks-good)
      `(span (@ (aria-label "status: darkgreen")
                (class "darkgreen-dot"))
             (*ENTITY* "#10004")))
     ((eq? status 'important-checks-passing)
      '(span (@ (aria-label "status: green")
                (class "green-dot"))
             (*ENTITY* "#10004")))
     ((eq? status 'important-checks-failing)
      '(span (@ (aria-label "status: red")
                (class "red-dot"))
             (*ENTITY* "#10005")))
     ((eq? status 'failed-to-apply-patches)
      '(span (@ (aria-label "status: darkred")
                (class "darkred-dot"))
             (*ENTITY* "#10005")))
     ((eq? status 'patches-missing)
      '(span (@ (aria-label "status: pink")
                (class "pink-dot"))
             "?"))
     ((eq? status 'guix-data-service-failed)
      '(span (@ (aria-label "status: yellow")
                (class "yellow-dot"))
             (*ENTITY* "#10005")))
     ((eq? status 'needs-looking-at)
      '(span (@ (aria-label "status: orange")
                (class "orange-dot"))
             (*ENTITY* "#9888")))
     (else
      `(span (@ (aria-label "status: grey")
                (class "grey-dot"))
             "?"))))

  (layout
   #:title "Patches"
   #:body
   `((main
      (p "The aim with this page is that the patches to look at should be towards the
top.")
      (p "For issues with the green status (reviewed or important checks passing), the oldest ones
will appear first.")
      ,@(if (or (eq? #f systems-with-low-substitute-availability)
                (null? systems-with-low-substitute-availability))
            '()
            `((p (@ (style "text-align: center; font-weight: bold;"))
                 "Builds for new patch series suspended as "
                 (a (@ (href "/branch/master"))
                    "master branch substitute availability")
                 " is low for: "
                 ,@(append-map
                    (lambda (system)
                      `((span (@ (style "font-family: monospace;"))
                              ,system
                              " ")))
                    systems-with-low-substitute-availability))))
      (details
       ,@(if (null? filtered-statuses)
             '()
             '((@ (open ""))))
       (summary "Filter issues")
       (form
        ,@(map
           (lambda (status)
             `(div
               (@ (style "text-align: left;"))
               (input (@ (type "checkbox")
                         (id ,status)
                         (name ,status)
                         ,@(if (member status filtered-statuses)
                               '((checked ""))
                               '())))
               (label (@ (for ,status))
                      ,(status->issue-status-span status)
                      " "
                      ,(string-replace-substring
                        (symbol->string status)
                        "-"
                        " "))))
           %overall-statuses)
        (button (@ (type "submit")) "Update")))
      (table
       (tbody
        ,@(map (match-lambda
                 ((id . details)
                  (let ((status (assq-ref details 'overall-status)))
                    `(tr
                      (td (a (@ (href ,(simple-format #f "/issue/~A" id)))
                             ,id))
                      (td
                       (@ (style "vertical-align: middle;"))
                       ,@(cond
                          ((eq? status 'reviewed-looks-good)
                           `((span (@ (aria-label "status: darkgreen")
                                      (class "darkgreen-dot"))
                                   (*ENTITY* "#10004"))))
                          ((eq? status 'important-checks-passing)
                           `((span (@ (aria-label "status: green")
                                      (class "green-dot"))
                                   (*ENTITY* "#10004"))))
                          ((eq? status 'important-checks-failing)
                           `((span (@ (aria-label "status: red")
                                      (class "red-dot"))
                                   (*ENTITY* "#10005"))))
                          ((eq? status 'failed-to-apply-patches)
                           `((span (@ (aria-label "status: darkred")
                                      (class "darkred-dot"))
                                   (*ENTITY* "#10005"))))
                          ((eq? status 'patches-missing)
                           `((span (@ (aria-label "status: pink")
                                      (class "pink-dot"))
                                   "?")))
                          ((eq? status 'guix-data-service-failed)
                           `((span (@ (aria-label "status: yellow")
                                      (class "yellow-dot"))
                                   (*ENTITY* "#10005"))))
                          ((eq? status 'needs-looking-at)
                           `((span (@ (aria-label "status: orange")
                                      (class "orange-dot"))
                                   (*ENTITY* "#9888"))))
                          (else
                           `((span (@ (aria-label "status: grey")
                                      (class "grey-dot"))
                                   "?")))))
                      (td (@ (style "text-align: left;"))
                          ,(assoc-ref details "name"))))))
               latest-series)))))))