aboutsummaryrefslogtreecommitdiff
path: root/guix-data-service/web
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2019-05-05 13:35:48 +0100
committerChristopher Baines <mail@cbaines.net>2019-05-05 14:36:52 +0100
commitce4c3c6ed3979e54a8d5db6514bf4ed87de8b707 (patch)
treeed0e8c4b4a87ebad122fb831e6ea1d01ac6f037b /guix-data-service/web
parent051962b54d9a647adc8c09fb8ef33db2ac9b659a (diff)
downloaddata-service-ce4c3c6ed3979e54a8d5db6514bf4ed87de8b707.tar
data-service-ce4c3c6ed3979e54a8d5db6514bf4ed87de8b707.tar.gz
Switch to storing Git repositories in a table
Rather than just storing the URL in the guix_revisions and load_new_guix_revision_jobs tables. This will help when storing more information like tags and branches in the future.
Diffstat (limited to 'guix-data-service/web')
-rw-r--r--guix-data-service/web/controller.scm10
-rw-r--r--guix-data-service/web/view/html.scm76
2 files changed, 36 insertions, 50 deletions
diff --git a/guix-data-service/web/controller.scm b/guix-data-service/web/controller.scm
index 2aa516d..6dda0da 100644
--- a/guix-data-service/web/controller.scm
+++ b/guix-data-service/web/controller.scm
@@ -27,6 +27,7 @@
#:use-module (web uri)
#:use-module (squee)
#:use-module (guix-data-service comparison)
+ #:use-module (guix-data-service model git-repository)
#:use-module (guix-data-service model guix-revision)
#:use-module (guix-data-service model package)
#:use-module (guix-data-service model package-derivation)
@@ -287,8 +288,13 @@
(match-lambda
((GET)
(apply render-html (index
- (most-recent-n-guix-revisions conn 10)
- (most-recent-n-load-new-guix-revision-jobs conn 1000))))
+ (map
+ (lambda (git-repository-details)
+ (cons git-repository-details
+ (guix-revisions-and-jobs-for-git-repository
+ conn
+ (car git-repository-details))))
+ (all-git-repositories conn)))))
((GET "builds")
(apply render-html
(view-builds (select-build-stats conn)
diff --git a/guix-data-service/web/view/html.scm b/guix-data-service/web/view/html.scm
index 3a039bd..8c74c18 100644
--- a/guix-data-service/web/view/html.scm
+++ b/guix-data-service/web/view/html.scm
@@ -90,7 +90,7 @@
"source code here") ".")))))
#:extra-headers ,extra-headers))
-(define (index guix-revisions queued-guix-revisions)
+(define (index git-repositories-and-revisions)
(layout
#:extra-headers
'((cache-control . ((max-age . 60))))
@@ -142,53 +142,33 @@
(@ (type "submit")
(class "btn btn-lg btn-primary"))
"Compare")))))
- (div
- (@ (class "row"))
- (div
- (@ (class "col-sm-12"))
- (h3 "Recent fetched revisions")
- ,(if (null? guix-revisions)
- '(p "No revisions")
- `(table
- (@ (class "table"))
- (thead
- (tr
- (th (@ (class "col-md-6")) "Source Repository URL")
- (th (@ (class "col-md-6")) "Commit")))
- (tbody
- ,@(map
- (match-lambda
- ((id url commit store_path)
- `(tr
- (td ,url)
- (td (a (@ (href ,(string-append
- "/revision/" commit)))
- (samp ,commit))))))
- guix-revisions))))))
- (div
- (@ (class "row"))
- (div
- (@ (class "col-sm-12"))
- (h3 "Queued revisions")
- ,(if (null? queued-guix-revisions)
- '(p "No queued revisions")
- `(table
- (@ (class "table"))
- (thead
- (tr
- (th (@ (class "col-md-4")) "Source Repository URL")
- (th (@ (class "col-md-4")) "Commit")
- (th (@ (class "col-md-4")) "Source")))
- (tbody
- ,@(map
- (match-lambda
- ((id url commit source)
- `(tr
- (td ,url)
- (td (samp ,commit))
- (td ,source))))
- queued-guix-revisions))))))))))
-
+ ,@(map
+ (match-lambda
+ (((id label url) . revisions)
+ `(div
+ (@ (class "row"))
+ (div
+ (@ (class "col-sm-12"))
+ (h3 ,url)
+ ,(if (null? revisions)
+ '(p "No revisions")
+ `(table
+ (@ (class "table"))
+ (thead
+ (tr
+ (th (@ (class "col-md-6")) "Commit")))
+ (tbody
+ ,@(map
+ (match-lambda
+ ((id job-id commit source)
+ `(tr
+ (td ,(if (string-null? id)
+ `(samp ,commit)
+ `(a (@ (href ,(string-append
+ "/revision/" commit)))
+ (samp ,commit)))))))
+ revisions))))))))
+ git-repositories-and-revisions)))))
(define (view-statistics guix-revisions-count derivations-count)
(layout