diff options
author | Christopher Baines <mail@cbaines.net> | 2019-12-03 10:05:08 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2019-12-12 20:07:22 +0000 |
commit | 716eb3c3b661ab6bd5cce9235640bccbe4d478b0 (patch) | |
tree | ba7e96f76452212c33098a85c2fd1b3e7dee95bc | |
parent | e078b9611daabe6fd939a39e6549c0c75fffd1b7 (diff) | |
download | data-service-716eb3c3b661ab6bd5cce9235640bccbe4d478b0.tar data-service-716eb3c3b661ab6bd5cce9235640bccbe4d478b0.tar.gz |
Move build-status helpers to the html-utils module
-rw-r--r-- | guix-data-service/web/build/html.scm | 1 | ||||
-rw-r--r-- | guix-data-service/web/html-utils.scm | 33 | ||||
-rw-r--r-- | guix-data-service/web/revision/html.scm | 1 | ||||
-rw-r--r-- | guix-data-service/web/view/html.scm | 30 |
4 files changed, 34 insertions, 31 deletions
diff --git a/guix-data-service/web/build/html.scm b/guix-data-service/web/build/html.scm index 679cda6..a0956b0 100644 --- a/guix-data-service/web/build/html.scm +++ b/guix-data-service/web/build/html.scm @@ -18,6 +18,7 @@ (define-module (guix-data-service web build html) #:use-module (ice-9 match) #:use-module (guix-data-service web query-parameters) + #:use-module (guix-data-service web html-utils) #:use-module (guix-data-service web view html) #:export (view-builds)) diff --git a/guix-data-service/web/html-utils.scm b/guix-data-service/web/html-utils.scm index e568289..db25928 100644 --- a/guix-data-service/web/html-utils.scm +++ b/guix-data-service/web/html-utils.scm @@ -17,7 +17,10 @@ (define-module (guix-data-service web html-utils) #:use-module (ice-9 match) - #:export (sexp-div)) + #:export (sexp-div + + build-status-value->display-string + build-status-span)) (define (sexp-div sexp) (match sexp @@ -33,3 +36,31 @@ ,hash)) ((and string val) val))) + +(define (build-status-value->display-string value) + (assoc-ref + '(("scheduled" . "Scheduled") + ("started" . "Started") + ("succeeded" . "Succeeded") + ("failed" . "Failed") + ("failed-dependency" . "Failed (dependency)") + ("failed-other" . "Failed (other)") + ("canceled" . "Canceled") + ("" . "Unknown")) + value)) + +(define (build-status-span 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")) + status))) + (style "display: inline-block; font-size: 1.2em; margin-top: 0.4em;")) + ,(build-status-value->display-string status))) diff --git a/guix-data-service/web/revision/html.scm b/guix-data-service/web/revision/html.scm index f1e2dec..f6c870d 100644 --- a/guix-data-service/web/revision/html.scm +++ b/guix-data-service/web/revision/html.scm @@ -22,6 +22,7 @@ #:use-module (texinfo html) #:use-module (json) #:use-module (guix-data-service web util) + #:use-module (guix-data-service web html-utils) #:use-module (guix-data-service web query-parameters) #:use-module (guix-data-service web view html) #:export (view-revision-news diff --git a/guix-data-service/web/view/html.scm b/guix-data-service/web/view/html.scm index 753cb24..ee3d4c7 100644 --- a/guix-data-service/web/view/html.scm +++ b/guix-data-service/web/view/html.scm @@ -36,8 +36,6 @@ display-possible-store-item display-store-item display-store-item-short - build-status-value->display-string - build-status-span table/branches-with-most-recent-commits @@ -359,34 +357,6 @@ "No information yet"))))))))) branches-with-most-recent-commits)))) -(define (build-status-value->display-string value) - (assoc-ref - '(("scheduled" . "Scheduled") - ("started" . "Started") - ("succeeded" . "Succeeded") - ("failed" . "Failed") - ("failed-dependency" . "Failed (dependency)") - ("failed-other" . "Failed (other)") - ("canceled" . "Canceled") - ("" . "Unknown")) - value)) - -(define (build-status-span 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")) - status))) - (style "display: inline-block; font-size: 1.2em; margin-top: 0.4em;")) - ,(build-status-value->display-string status))) - (define (display-possible-store-item value) (match (string-split value #\/) (("" "gnu" "store" item) |