aboutsummaryrefslogtreecommitdiff
path: root/guix-data-service
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2019-07-22 20:16:28 +0100
committerChristopher Baines <mail@cbaines.net>2019-07-22 20:29:29 +0100
commit7a70e9ca6fa666e7f92ebeda8e98ae2859ec97bf (patch)
treeb67ada27ece4c47d45ee71818487fe7597974ff0 /guix-data-service
parent91be72df039b1b1c914bece96a81d4b0cdee2144 (diff)
downloaddata-service-7a70e9ca6fa666e7f92ebeda8e98ae2859ec97bf.tar
data-service-7a70e9ca6fa666e7f92ebeda8e98ae2859ec97bf.tar.gz
Extract out view-revision/git-repositories
As this was duplicated in the functions for viewing known and unknown revisions.
Diffstat (limited to 'guix-data-service')
-rw-r--r--guix-data-service/web/view/html.scm73
1 files changed, 31 insertions, 42 deletions
diff --git a/guix-data-service/web/view/html.scm b/guix-data-service/web/view/html.scm
index 25b759e..bf9c366 100644
--- a/guix-data-service/web/view/html.scm
+++ b/guix-data-service/web/view/html.scm
@@ -394,6 +394,28 @@
(td ,(build-status-span status)))))
derivations)))))))))
+(define (view-revision/git-repositories git-repositories-and-branches
+ commit-hash)
+ `((h3 "Git repositories")
+ ,@(map
+ (match-lambda
+ (((id label url cgit-url-base) . branches)
+ `((a (@ (href ,(string-append
+ "/repository/" id)))
+ (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)))
+
(define* (view-revision commit-hash packages-count
git-repositories-and-branches derivations-count
jobs-and-events
@@ -421,28 +443,10 @@
(a (@ (href ,(string-append path-base "/packages")))
"View packages")
- ,@(if
- (null? git-repositories-and-branches)
- '()
- `((h3 "Git repositories")
- ,@(map
- (match-lambda
- (((id label url cgit-url-base) . branches)
- `((a (@ (href ,(string-append
- "/repository/" id)))
- (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)))
+ ,@(if (null? git-repositories-and-branches)
+ '()
+ (view-revision/git-repositories git-repositories-and-branches
+ commit-hash))
(h3 "Jobs")
(table
(@ (class "table"))
@@ -1564,26 +1568,11 @@
(style "font-size: 2em; display: block;"))
"Unknown")
- ,@(if
- (null? git-repositories-and-branches)
- '()
- `((h3 "Git repositories")
- ,@(map
- (match-lambda
- (((id 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)))
+ ,@(if (null? git-repositories-and-branches)
+ '()
+ (view-revision/git-repositories
+ git-repositories-and-branches
+ commit-hash))
(h3 "Jobs")
(table
(@ (class "table"))