(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)))))))