diff options
author | Christopher Baines <mail@cbaines.net> | 2021-02-03 12:57:29 +0000 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2021-02-03 12:57:29 +0000 |
commit | b0b87cced723ced1b9ffdeef5de4d868a480f6ea (patch) | |
tree | 46b22242d97c8c744a7367a2991729ac5139acec /guix-data-service | |
parent | 9a9d156366d8cf1348e2f29c0c760edc1ffb4c3d (diff) | |
download | data-service-b0b87cced723ced1b9ffdeef5de4d868a480f6ea.tar data-service-b0b87cced723ced1b9ffdeef5de4d868a480f6ea.tar.gz |
Improve the revision page when a revision hasn't been processed
Diffstat (limited to 'guix-data-service')
-rw-r--r-- | guix-data-service/web/revision/controller.scm | 87 | ||||
-rw-r--r-- | guix-data-service/web/revision/html.scm | 30 |
2 files changed, 88 insertions, 29 deletions
diff --git a/guix-data-service/web/revision/controller.scm b/guix-data-service/web/revision/controller.scm index 5a48701..ec890bf 100644 --- a/guix-data-service/web/revision/controller.scm +++ b/guix-data-service/web/revision/controller.scm @@ -123,8 +123,8 @@ (render-revision-news mime-types commit-hash parsed-query-parameters)) - (render-unknown-revision mime-types - commit-hash))) + (render-unprocessed-revision mime-types + commit-hash))) (('GET "revision" commit-hash "packages") (if (parallel-via-thread-pool-channel (with-thread-postgresql-connection @@ -152,8 +152,8 @@ commit-hash parsed-query-parameters #:path-base path)) - (render-unknown-revision mime-types - commit-hash))) + (render-unprocessed-revision mime-types + commit-hash))) (('GET "revision" commit-hash "packages-translation-availability") (if (parallel-via-thread-pool-channel (with-thread-postgresql-connection @@ -162,8 +162,8 @@ (render-revision-packages-translation-availability mime-types commit-hash #:path-base path) - (render-unknown-revision mime-types - commit-hash))) + (render-unprocessed-revision mime-types + commit-hash))) (('GET "revision" commit-hash "package" name) (if (parallel-via-thread-pool-channel (with-thread-postgresql-connection @@ -172,8 +172,8 @@ (render-revision-package mime-types commit-hash name) - (render-unknown-revision mime-types - commit-hash))) + (render-unprocessed-revision mime-types + commit-hash))) (('GET "revision" commit-hash "package" name version) (if (parallel-via-thread-pool-channel (with-thread-postgresql-connection @@ -188,8 +188,8 @@ name version parsed-query-parameters)) - (render-unknown-revision mime-types - commit-hash))) + (render-unprocessed-revision mime-types + commit-hash))) (('GET "revision" commit-hash "package-derivations") (if (parallel-via-thread-pool-channel (with-thread-postgresql-connection @@ -218,8 +218,8 @@ commit-hash parsed-query-parameters #:path-base path)) - (render-unknown-revision mime-types - commit-hash))) + (render-unprocessed-revision mime-types + commit-hash))) (('GET "revision" commit-hash "fixed-output-package-derivations") (if (parallel-via-thread-pool-channel (with-thread-postgresql-connection @@ -244,8 +244,8 @@ commit-hash parsed-query-parameters #:path-base path)) - (render-unknown-revision mime-types - commit-hash))) + (render-unprocessed-revision mime-types + commit-hash))) (('GET "revision" commit-hash "package-derivation-outputs") (if (parallel-via-thread-pool-channel (with-thread-postgresql-connection @@ -275,8 +275,8 @@ commit-hash parsed-query-parameters #:path-base path)) - (render-unknown-revision mime-types - commit-hash))) + (render-unprocessed-revision mime-types + commit-hash))) (('GET "revision" commit-hash "system-tests") (if (parallel-via-thread-pool-channel (with-thread-postgresql-connection @@ -290,8 +290,8 @@ commit-hash parsed-query-parameters #:path-base path)) - (render-unknown-revision mime-types - commit-hash))) + (render-unprocessed-revision mime-types + commit-hash))) (('GET "revision" commit-hash "channel-instances") (if (parallel-via-thread-pool-channel (with-thread-postgresql-connection @@ -300,8 +300,8 @@ (render-revision-channel-instances mime-types commit-hash #:path-base path) - (render-unknown-revision mime-types - commit-hash))) + (render-unprocessed-revision mime-types + commit-hash))) (('GET "revision" commit-hash "package-substitute-availability") (if (parallel-via-thread-pool-channel (with-thread-postgresql-connection @@ -310,8 +310,8 @@ (render-revision-package-substitute-availability mime-types commit-hash #:path-base path) - (render-unknown-revision mime-types - commit-hash))) + (render-unprocessed-revision mime-types + commit-hash))) (('GET "revision" commit-hash "package-reproducibility") (if (parallel-via-thread-pool-channel (with-thread-postgresql-connection @@ -320,8 +320,8 @@ (render-revision-package-reproduciblity mime-types commit-hash #:path-base path) - (render-unknown-revision mime-types - commit-hash))) + (render-unprocessed-revision mime-types + commit-hash))) (('GET "revision" commit-hash "builds") (if (parallel-via-thread-pool-channel (with-thread-postgresql-connection @@ -345,8 +345,8 @@ commit-hash parsed-query-parameters #:path-base path)) - (render-unknown-revision mime-types - commit-hash))) + (render-unprocessed-revision mime-types + commit-hash))) (('GET "revision" commit-hash "lint-warnings") (if (parallel-via-thread-pool-channel (with-thread-postgresql-connection @@ -368,8 +368,8 @@ commit-hash parsed-query-parameters #:path-base path)) - (render-unknown-revision mime-types - commit-hash))) + (render-unprocessed-revision mime-types + commit-hash))) (_ #f))) (define (texinfo->variants-alist s locale) @@ -412,6 +412,37 @@ git-repositories-and-branches jobs-and-events)))))) +(define (render-unprocessed-revision mime-types commit-hash) + (case (most-appropriate-mime-type + '(application/json text/html) + mime-types) + ((application/json) + (render-json + '((unknown_commit . ,commit-hash)) + #:code 404)) + (else + (letpar& ((job + (with-thread-postgresql-connection + (lambda (conn) + (select-job-for-commit conn commit-hash)))) + (git-repositories-and-branches + (with-thread-postgresql-connection + (lambda (conn) + (git-branches-with-repository-details-for-commit conn + commit-hash)))) + (jobs-and-events + (with-thread-postgresql-connection + (lambda (conn) + (select-jobs-and-events-for-commit conn commit-hash))))) + + (render-html + #:code 404 + #:sxml (unprocessed-revision + commit-hash + job + git-repositories-and-branches + jobs-and-events)))))) + (define* (render-view-revision mime-types commit-hash #:key path-base diff --git a/guix-data-service/web/revision/html.scm b/guix-data-service/web/revision/html.scm index 1012d65..25b79f4 100644 --- a/guix-data-service/web/revision/html.scm +++ b/guix-data-service/web/revision/html.scm @@ -42,7 +42,8 @@ view-revision-channel-instances view-revision-builds view-revision-lint-warnings - unknown-revision)) + unknown-revision + unprocessed-revision)) (define* (view-revision-news commit-hash query-parameters @@ -2350,3 +2351,30 @@ figure { (p "No known revision with commit " (strong (samp ,commit-hash))))))))) +(define (unprocessed-revision commit-hash job git-repositories-and-branches + jobs-and-events) + (layout + #:body + `(,(header) + (div + (@ (class "container")) + ,@(if job + `((div + (@ (class "row")) + (div + (@ (class "col-md-12")) + (h1 (@ (style "white-space: nowrap;")) + "Revision " (samp ,commit-hash) (br) "not yet processed"))) + (div + (@ (class "row")) + (div + (@ (class "col-md-12")) + ,@(if (null? git-repositories-and-branches) + '() + (view-revision/git-repositories + git-repositories-and-branches + commit-hash)) + ,@(view-revision/jobs-and-events jobs-and-events)))) + `((h1 "Unknown revision") + (p "No known revision with commit " + (strong (samp ,commit-hash))))))))) |