aboutsummaryrefslogtreecommitdiff
path: root/guix-data-service/web/controller.scm
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2019-07-19 21:22:15 +0100
committerChristopher Baines <mail@cbaines.net>2019-07-19 21:22:15 +0100
commit1f977f6c125e10061610dd62c7287e6e9448dea5 (patch)
tree9bc4f9d736378f8cb231eb15cb0e59b8ef4a2abf /guix-data-service/web/controller.scm
parent6dd52f08edbe7525c26b86a0d1a414b96cf2288d (diff)
downloaddata-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/controller.scm')
-rw-r--r--guix-data-service/web/controller.scm26
1 files changed, 20 insertions, 6 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