Add a list of the queued revisions to the index page

This commit is contained in:
Christopher Baines 2019-03-03 18:15:29 +00:00
parent ffdd2416f4
commit 623347d835
No known key found for this signature in database
GPG Key ID: 5E28A33B0B84F577
3 changed files with 88 additions and 45 deletions

View File

@ -16,7 +16,8 @@
#:use-module (guix-data-service model package-metadata)
#:use-module (guix-data-service model derivation)
#:export (process-next-load-new-guix-revision-job
select-job-for-commit))
select-job-for-commit
most-recent-n-load-new-guix-revision-jobs))
(define (inferior-guix->package-ids store conn inf)
(let* ((packages (inferior-packages inf))
@ -173,6 +174,14 @@
(list commit))))
result))
(define (most-recent-n-load-new-guix-revision-jobs conn n)
(let ((result
(exec-query
conn
"SELECT * FROM load_new_guix_revision_jobs LIMIT $1"
(list (number->string n)))))
result))
(define (process-next-load-new-guix-revision-job conn)
(let ((next
(exec-query

View File

@ -201,7 +201,9 @@
(define (controller request body conn)
(match-lambda
((GET)
(apply render-html (index (most-recent-n-guix-revisions conn 10))))
(apply render-html (index
(most-recent-n-guix-revisions conn 10)
(most-recent-n-load-new-guix-revision-jobs conn 1000))))
((GET "compare")
(with-base-and-target-commits
request conn

View File

@ -81,7 +81,7 @@
"source code here") ".")))))
#:extra-headers ,extra-headers))
(define (index guix-revisions)
(define (index guix-revisions queued-guix-revisions)
(layout
#:extra-headers
'((cache-control . ((max-age . 60))))
@ -89,48 +89,80 @@
`(,(header)
(div
(@ (class "container"))
(h1 "Guix Data Service")
(form (@ (id "compare")
(action "/compare"))
(div
(@ (class "form-group"))
(label (@ (for "base_commit"))
"Base commit")
(input (@ (type "text")
(class "form-control")
(id "base_commit")
(name "base_commit")
(placeholder "base commit"))))
(div
(@ (class "form-group"))
(label (@ (for "target_commit"))
"Target commit")
(input (@ (type "text")
(class "form-control")
(id "target_commit")
(name "target_commit")
(placeholder "target commit"))))
(button
(@ (type "submit")
(class "btn btn-lg btn-primary"))
"Compare"))
(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 (samp ,commit)))))
guix-revisions))))))))
(div
(@ (class "row"))
(h1 "Guix Data Service"))
(div
(@ (class "row"))
(form
(@ (id "compare")
(action "/compare"))
(div
(@ (class "col-md-6"))
(div
(@ (class "form-group"))
(label (@ (for "base_commit"))
"Base commit")
(input (@ (type "text")
(class "form-control")
(id "base_commit")
(name "base_commit")
(placeholder "base commit"))))
(div
(@ (class "form-group"))
(label (@ (for "target_commit"))
"Target commit")
(input (@ (type "text")
(class "form-control")
(id "target_commit")
(name "target_commit")
(placeholder "target commit")))))
(div
(@ (class "col-md-6"))
(button
(@ (type "submit")
(class "btn btn-lg btn-primary"))
"Compare"))))
(div
(@ (class "row"))
(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 (samp ,commit)))))
guix-revisions)))))
(div
(@ (class "row"))
(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)))))))))
(define (compare base-commit
target-commit