diff options
author | Christopher Baines <mail@cbaines.net> | 2019-07-19 21:22:15 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2019-07-19 21:22:15 +0100 |
commit | 1f977f6c125e10061610dd62c7287e6e9448dea5 (patch) | |
tree | 9bc4f9d736378f8cb231eb15cb0e59b8ef4a2abf /guix-data-service/web | |
parent | 6dd52f08edbe7525c26b86a0d1a414b96cf2288d (diff) | |
download | data-service-1f977f6c125e10061610dd62c7287e6e9448dea5.tar data-service-1f977f6c125e10061610dd62c7287e6e9448dea5.tar.gz |
Improve how repositories and branches are handled
Make the link between repositories and branches clearer, replacing the
/branches and /branch pages by /repository/ and /repository/*/branch/* pages.
Diffstat (limited to 'guix-data-service/web')
-rw-r--r-- | guix-data-service/web/controller.scm | 26 | ||||
-rw-r--r-- | guix-data-service/web/view/html.scm | 27 |
2 files changed, 39 insertions, 14 deletions
diff --git a/guix-data-service/web/controller.scm b/guix-data-service/web/controller.scm index 8923da8..e49e0a7 100644 --- a/guix-data-service/web/controller.scm +++ b/guix-data-service/web/controller.scm @@ -682,11 +682,22 @@ (render-unknown-revision mime-types conn commit-hash))) - (('GET "branches") - (render-html - #:sxml (view-branches - (all-branches-with-most-recent-commit conn)))) - (('GET "branch" branch-name) + (('GET "repository" id) + (match (select-git-repository conn id) + ((label url cgit-url-base) + (render-html + #:sxml + (view-git-repository + id + label url cgit-url-base + (all-branches-with-most-recent-commit conn id)))) + (#f + (render-html + #:sxml (general-not-found + "Repository not found" + "") + #:code 404)))) + (('GET "repository" repository-id "branch" branch-name) (let ((parsed-query-parameters (parse-query-parameters request @@ -695,12 +706,15 @@ (limit_results ,parse-result-limit #:default 100))))) (render-html #:sxml (if (any-invalid-query-parameters? parsed-query-parameters) - (view-branch branch-name parsed-query-parameters '()) + (view-branch repository-id + branch-name parsed-query-parameters '()) (view-branch + repository-id branch-name parsed-query-parameters (most-recent-commits-for-branch conn + repository-id branch-name #:limit (assq-ref parsed-query-parameters 'limit_results) #:after-date (assq-ref parsed-query-parameters diff --git a/guix-data-service/web/view/html.scm b/guix-data-service/web/view/html.scm index bd0be26..78a7183 100644 --- a/guix-data-service/web/view/html.scm +++ b/guix-data-service/web/view/html.scm @@ -35,6 +35,7 @@ view-revision-package-and-version view-revision view-revision-packages + view-git-repository view-branches view-branch view-builds @@ -232,7 +233,7 @@ (h1 "Guix Data Service"))) ,@(map (match-lambda - (((id label url) . revisions) + (((repository-id label url) . revisions) `(div (@ (class "row")) (div @@ -249,7 +250,7 @@ (tbody ,@(map (match-lambda - ((id job-id job-events commit source branches) + ((revision-id job-id job-events commit source branches) `(tr (td ,@(map @@ -257,6 +258,8 @@ ((name date) `(span (a (@ (href ,(string-append + "/repository/" + repository-id "/branch/" name))) ,name) " at " @@ -267,7 +270,7 @@ (samp ,commit)) " " ,(cond - ((not (string-null? id)) + ((not (string-null? revision-id)) '(span (@ (class "label label-success")) "✓")) @@ -630,7 +633,9 @@ "Next page"))) '()))))) -(define* (view-branches branches-with-most-recent-commits) +(define* (view-git-repository git-repository-id + label url cgit-url-base + branches-with-most-recent-commits) (layout #:body `(,(header) @@ -640,11 +645,12 @@ (@ (class "row")) (div (@ (class "col-md-12")) - (h1 "Branches"))) + (h1 ,url))) (div (@ (class "row")) (div (@ (class "col-md-12")) + (h3 "Branches") (table (@ (class "table table-responsive")) (thead @@ -658,7 +664,9 @@ ((name commit date revision-exists? job-events) `(tr (td - (a (@ (href ,(string-append "/branch/" name))) + (a (@ (href ,(string-append + "/repository/" git-repository-id + "/branch/" name))) ,name)) (td ,date) (td ,@(if (string=? commit "NULL") @@ -680,8 +688,8 @@ "No information yet"))))))))) branches-with-most-recent-commits))))))))) -(define (view-branch branch-name query-parameters - branch-commits) +(define (view-branch git-repository-id + branch-name query-parameters branch-commits) (layout #:body `(,(header) @@ -691,6 +699,8 @@ (@ (class "row")) (div (@ (class "col-md-12")) + (a (@ (href ,(string-append "/repository/" git-repository-id))) + (h3 "Repository")) (h1 (@ (style "white-space: nowrap;")) (samp ,branch-name) " branch"))) (div @@ -723,6 +733,7 @@ (@ (class "col-sm-12")) (a (@ (class "btn btn-default btn-lg pull-right") (href ,(string-append + "/repository/" git-repository-id "/branch/" branch-name "/latest-processed-revision"))) "Latest processed revision"))) (div |