From e93b8f948e77c999b5048eb7118f6459373f15bc Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Wed, 19 Jun 2019 22:03:55 +0100 Subject: [PATCH] Improve the Unknown revision page Make it similar to the revision page, as some of the information, like the link to the relevant CGit instance might be available. --- guix-data-service/web/controller.scm | 3 +- guix-data-service/web/view/html.scm | 57 +++++++++++++++++++++++----- 2 files changed, 50 insertions(+), 10 deletions(-) diff --git a/guix-data-service/web/controller.scm b/guix-data-service/web/controller.scm index 0fb5383..a812570 100644 --- a/guix-data-service/web/controller.scm +++ b/guix-data-service/web/controller.scm @@ -151,7 +151,8 @@ #:sxml (unknown-revision commit-hash (select-job-for-commit - conn commit-hash)))))) + conn commit-hash) + (git-branches-with-repository-details-for-commit conn commit-hash)))))) (define* (render-revision-packages mime-types conn diff --git a/guix-data-service/web/view/html.scm b/guix-data-service/web/view/html.scm index 4565d16..c837724 100644 --- a/guix-data-service/web/view/html.scm +++ b/guix-data-service/web/view/html.scm @@ -1471,20 +1471,59 @@ (h1 ,header-text) (p ,body))))) -(define (unknown-revision commit-hash job) +(define (unknown-revision commit-hash job git-repositories-and-branches) (layout #:body `(,(header) (div (@ (class "container")) - (h1 "Unknown revision") - (p "No known revision with commit " - (strong (samp ,commit-hash)) - ,(match job - (() - " and it is not currently queued for processing") - ((job) - " but it is queued for processing"))))))) + ,@(match job + (() + `((h1 "Unknown revision") + (p "No known revision with commit " + (strong (samp ,commit-hash))))) + ((jobs ...) + `((div + (@ (class "row")) + (div + (@ (class "col-md-12")) + (h1 (@ (style "white-space: nowrap;")) + "Revision " (samp ,commit-hash)))) + (div + (@ (class "row")) + (div + (@ (class "col-md-6")) + (h2 "Packages") + (strong (@ (class "text-center") + (style "font-size: 2em; display: block;")) + "Unknown") + + ,@(if + (null? git-repositories-and-branches) + '() + `((h3 "Git repositories") + ,@(map + (match-lambda + (((label url cgit-url-base) . branches) + `((h4 ,url) + ,@(map + (match-lambda + ((name datetime) + (if (string-null? cgit-url-base) + `(,name " at " ,datetime) + `(a (@ (href ,(string-append + cgit-url-base + "commit/?id=" + commit-hash))) + ,name " at " ,datetime)))) + branches)))) + git-repositories-and-branches)))) + (div + (@ (class "col-md-6")) + (h3 "Derivations") + (strong (@ (class "text-center") + (style "font-size: 2em; display: block;")) + "Unknown")))))))))) (define (compare-unknown-commit base-commit target-commit base-exists? target-exists?