aboutsummaryrefslogtreecommitdiff
path: root/guix-data-service
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2019-07-22 20:36:40 +0100
committerChristopher Baines <mail@cbaines.net>2019-07-22 20:36:40 +0100
commitc23822e14dc4e8a32522c563540e0b80941f4ccd (patch)
tree94084349a5c5b0cb1e70121d635f89a946cd2471 /guix-data-service
parent219b1fd4ad60c1abf6f2b27b94410c176f4bf990 (diff)
downloaddata-service-c23822e14dc4e8a32522c563540e0b80941f4ccd.tar
data-service-c23822e14dc4e8a32522c563540e0b80941f4ccd.tar.gz
Extract out the branches with most recent commits table
As I'm thinking about using this on the index page.
Diffstat (limited to 'guix-data-service')
-rw-r--r--guix-data-service/web/view/html.scm78
1 files changed, 42 insertions, 36 deletions
diff --git a/guix-data-service/web/view/html.scm b/guix-data-service/web/view/html.scm
index b503ce4..970492d 100644
--- a/guix-data-service/web/view/html.scm
+++ b/guix-data-service/web/view/html.scm
@@ -687,6 +687,45 @@
"Next page")))
'())))))
+(define (table/branches-with-most-recent-commits
+ git-repository-id branches-with-most-recent-commits)
+ `(table
+ (@ (class "table table-responsive"))
+ (thead
+ (tr
+ (th (@ (class "col-md-3")) "Name")
+ (th (@ (class "col-md-2")) "Date")
+ (th (@ (class "col-md-7")) "Commit")))
+ (tbody
+ ,@(map
+ (match-lambda
+ ((name commit date revision-exists? job-events)
+ `(tr
+ (td
+ (a (@ (href ,(string-append
+ "/repository/" git-repository-id
+ "/branch/" name)))
+ ,name))
+ (td ,date)
+ (td ,@(if (string=? commit "NULL")
+ '((samp "branch deleted"))
+ `((a (@ (href ,(string-append
+ "/revision/" commit)))
+ (samp ,commit))
+ " "
+ ,(cond
+ (revision-exists?
+ '(span
+ (@ (class "label label-success"))
+ "✓"))
+ ((member "failure" job-events)
+ '(span (@ (class "label label-danger"))
+ "Failed to import data"))
+ (else
+ '(span (@ (class "label label-default"))
+ "No information yet")))))))))
+ branches-with-most-recent-commits))))
+
(define* (view-git-repository git-repository-id
label url cgit-url-base
branches-with-most-recent-commits)
@@ -705,42 +744,9 @@
(div
(@ (class "col-md-12"))
(h3 "Branches")
- (table
- (@ (class "table table-responsive"))
- (thead
- (tr
- (th (@ (class "col-md-3")) "Name")
- (th (@ (class "col-md-2")) "Date")
- (th (@ (class "col-md-7")) "Commit")))
- (tbody
- ,@(map
- (match-lambda
- ((name commit date revision-exists? job-events)
- `(tr
- (td
- (a (@ (href ,(string-append
- "/repository/" git-repository-id
- "/branch/" name)))
- ,name))
- (td ,date)
- (td ,@(if (string=? commit "NULL")
- '((samp "branch deleted"))
- `((a (@ (href ,(string-append
- "/revision/" commit)))
- (samp ,commit))
- " "
- ,(cond
- (revision-exists?
- '(span
- (@ (class "label label-success"))
- "✓"))
- ((member "failure" job-events)
- '(span (@ (class "label label-danger"))
- "Failed to import data"))
- (else
- '(span (@ (class "label label-default"))
- "No information yet")))))))))
- branches-with-most-recent-commits)))))))))
+ ,(table/branches-with-most-recent-commits
+ git-repository-id
+ branches-with-most-recent-commits)))))))
(define (view-branch git-repository-id
branch-name query-parameters branch-commits)