diff options
author | Christopher Baines <mail@cbaines.net> | 2019-12-05 16:31:38 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2019-12-12 20:07:22 +0000 |
commit | 9a99722643a54e207216b50014dc2d7d87641f4c (patch) | |
tree | 17975c323450e620a88cee6d731f71eab3849537 | |
parent | 0cebb973402796cc21a5cd49d885d6686d44df9e (diff) | |
download | data-service-9a99722643a54e207216b50014dc2d7d87641f4c.tar data-service-9a99722643a54e207216b50014dc2d7d87641f4c.tar.gz |
Add a utility to generate a span for the status of a build
-rw-r--r-- | guix-data-service/web/html-utils.scm | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/guix-data-service/web/html-utils.scm b/guix-data-service/web/html-utils.scm index db25928..a987984 100644 --- a/guix-data-service/web/html-utils.scm +++ b/guix-data-service/web/html-utils.scm @@ -20,7 +20,8 @@ #:export (sexp-div build-status-value->display-string - build-status-span)) + build-status-span + build-status-alist->build-icon)) (define (sexp-div sexp) (match sexp @@ -64,3 +65,20 @@ status))) (style "display: inline-block; font-size: 1.2em; margin-top: 0.4em;")) ,(build-status-value->display-string status))) + +(define (build-status-alist->build-icon status) + `(span (@ (class ,(string-append + "label label-" + (assoc-ref + '(("scheduled" . "info") + ("started" . "primary") + ("succeeded" . "success") + ("failed" . "danger") + ("failed-dependency" . "warning") + ("failed-other" . "danger") + ("canceled" . "default") + ("" . "default")) + (assoc-ref status "status")))) + (style "display: inline-block; font-size: 1.2em; margin-top: 0.4em;")) + ,(build-status-value->display-string + (assoc-ref status "status")))) |