Use revision labels on the index page as well
Also flip the branch and revision columns around, and add date information to the branch column.
This commit is contained in:
parent
a168b23c24
commit
ea80311c49
3 changed files with 48 additions and 18 deletions
|
|
@ -1,5 +1,6 @@
|
||||||
(define-module (guix-data-service model git-repository)
|
(define-module (guix-data-service model git-repository)
|
||||||
#:use-module (ice-9 match)
|
#:use-module (ice-9 match)
|
||||||
|
#:use-module (json)
|
||||||
#:use-module (squee)
|
#:use-module (squee)
|
||||||
#:export (all-git-repositories
|
#:export (all-git-repositories
|
||||||
git-repository-id->url
|
git-repository-id->url
|
||||||
|
|
@ -44,22 +45,36 @@
|
||||||
(define (guix-revisions-and-jobs-for-git-repository conn git-repository-id)
|
(define (guix-revisions-and-jobs-for-git-repository conn git-repository-id)
|
||||||
(define query
|
(define query
|
||||||
"
|
"
|
||||||
SELECT NULL AS id, load_new_guix_revision_jobs.id AS job_id, commit, source
|
SELECT NULL AS id, load_new_guix_revision_jobs.id AS job_id,
|
||||||
|
(
|
||||||
|
SELECT json_agg(event)
|
||||||
|
FROM load_new_guix_revision_job_events
|
||||||
|
WHERE load_new_guix_revision_jobs.id = load_new_guix_revision_job_events.job_id
|
||||||
|
) AS job_events, commit, source
|
||||||
FROM load_new_guix_revision_jobs
|
FROM load_new_guix_revision_jobs
|
||||||
WHERE git_repository_id = $1 AND succeeded_at IS NULL AND NOT EXISTS (
|
WHERE git_repository_id = $1 AND succeeded_at IS NULL AND NOT EXISTS (
|
||||||
SELECT 1 FROM load_new_guix_revision_job_events
|
SELECT 1 FROM load_new_guix_revision_job_events
|
||||||
WHERE event = 'failure' AND job_id = load_new_guix_revision_jobs.id
|
WHERE event = 'failure' AND job_id = load_new_guix_revision_jobs.id
|
||||||
)
|
)
|
||||||
UNION
|
UNION ALL
|
||||||
SELECT id, NULL, commit, NULL
|
SELECT id, NULL, NULL, commit, NULL
|
||||||
FROM guix_revisions
|
FROM guix_revisions
|
||||||
WHERE git_repository_id = $1
|
WHERE git_repository_id = $1
|
||||||
ORDER BY 1 DESC NULLS FIRST, 2 DESC LIMIT 10;")
|
ORDER BY 1 DESC NULLS FIRST, 2 DESC LIMIT 10;")
|
||||||
|
|
||||||
(exec-query
|
(map
|
||||||
conn
|
(match-lambda
|
||||||
query
|
((id job_id job_events commit source)
|
||||||
(list git-repository-id)))
|
(list id
|
||||||
|
job_id
|
||||||
|
(if (string=? "" job_events)
|
||||||
|
'()
|
||||||
|
(vector->list (json-string->scm job_events)))
|
||||||
|
commit source)))
|
||||||
|
(exec-query
|
||||||
|
conn
|
||||||
|
query
|
||||||
|
(list git-repository-id))))
|
||||||
|
|
||||||
(define (git-repositories-containing-commit conn commit)
|
(define (git-repositories-containing-commit conn commit)
|
||||||
(define query
|
(define query
|
||||||
|
|
|
||||||
|
|
@ -627,9 +627,10 @@
|
||||||
git-repository-details
|
git-repository-details
|
||||||
(map
|
(map
|
||||||
(match-lambda
|
(match-lambda
|
||||||
((id job-id commit source)
|
((id job-id job-events commit source)
|
||||||
(list id
|
(list id
|
||||||
job-id
|
job-id
|
||||||
|
job-events
|
||||||
commit
|
commit
|
||||||
source
|
source
|
||||||
(git-branches-for-commit conn commit))))
|
(git-branches-for-commit conn commit))))
|
||||||
|
|
|
||||||
|
|
@ -274,25 +274,39 @@
|
||||||
(@ (class "table"))
|
(@ (class "table"))
|
||||||
(thead
|
(thead
|
||||||
(tr
|
(tr
|
||||||
|
(th (@ (class "col-md-6")) "Branch")
|
||||||
(th (@ (class "col-md-6")) "Commit")))
|
(th (@ (class "col-md-6")) "Commit")))
|
||||||
(tbody
|
(tbody
|
||||||
,@(map
|
,@(map
|
||||||
(match-lambda
|
(match-lambda
|
||||||
((id job-id commit source branches)
|
((id job-id job-events commit source branches)
|
||||||
`(tr
|
`(tr
|
||||||
(td ,(if (string-null? id)
|
|
||||||
`(samp ,commit)
|
|
||||||
`(a (@ (href ,(string-append
|
|
||||||
"/revision/" commit)))
|
|
||||||
(samp ,commit))))
|
|
||||||
(td
|
(td
|
||||||
,@(map
|
,@(map
|
||||||
(match-lambda
|
(match-lambda
|
||||||
((name date)
|
((name date)
|
||||||
`(a (@ (href ,(string-append
|
`(span
|
||||||
"/branch/" name)))
|
(a (@ (href ,(string-append
|
||||||
,name)))
|
"/branch/" name)))
|
||||||
branches)))))
|
,name)
|
||||||
|
" at "
|
||||||
|
,date)))
|
||||||
|
branches))
|
||||||
|
(td (a (@ (href ,(string-append
|
||||||
|
"/revision/" commit)))
|
||||||
|
(samp ,commit)
|
||||||
|
" "
|
||||||
|
,(cond
|
||||||
|
((not (string-null? id))
|
||||||
|
'(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"))))))))
|
||||||
revisions))))))))
|
revisions))))))))
|
||||||
git-repositories-and-revisions)))))
|
git-repositories-and-revisions)))))
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue