diff options
author | Christopher Baines <mail@cbaines.net> | 2019-06-19 23:12:20 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2019-06-19 23:39:53 +0100 |
commit | ea80311c496b482e1360b5eee730f7f032c62c3d (patch) | |
tree | 49d6f72ea80f3224f4099c756a4a11de104f673f | |
parent | a168b23c24c9069ff7dc655d05a241b0c01513b3 (diff) | |
download | data-service-ea80311c496b482e1360b5eee730f7f032c62c3d.tar data-service-ea80311c496b482e1360b5eee730f7f032c62c3d.tar.gz |
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.
-rw-r--r-- | guix-data-service/model/git-repository.scm | 29 | ||||
-rw-r--r-- | guix-data-service/web/controller.scm | 3 | ||||
-rw-r--r-- | guix-data-service/web/view/html.scm | 34 |
3 files changed, 48 insertions, 18 deletions
diff --git a/guix-data-service/model/git-repository.scm b/guix-data-service/model/git-repository.scm index 463222c..bbb5553 100644 --- a/guix-data-service/model/git-repository.scm +++ b/guix-data-service/model/git-repository.scm @@ -1,5 +1,6 @@ (define-module (guix-data-service model git-repository) #:use-module (ice-9 match) + #:use-module (json) #:use-module (squee) #:export (all-git-repositories git-repository-id->url @@ -44,22 +45,36 @@ (define (guix-revisions-and-jobs-for-git-repository conn git-repository-id) (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 WHERE git_repository_id = $1 AND succeeded_at IS NULL AND NOT EXISTS ( SELECT 1 FROM load_new_guix_revision_job_events WHERE event = 'failure' AND job_id = load_new_guix_revision_jobs.id ) -UNION -SELECT id, NULL, commit, NULL +UNION ALL +SELECT id, NULL, NULL, commit, NULL FROM guix_revisions WHERE git_repository_id = $1 ORDER BY 1 DESC NULLS FIRST, 2 DESC LIMIT 10;") - (exec-query - conn - query - (list git-repository-id))) + (map + (match-lambda + ((id job_id job_events commit source) + (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 query diff --git a/guix-data-service/web/controller.scm b/guix-data-service/web/controller.scm index a812570..a6330d8 100644 --- a/guix-data-service/web/controller.scm +++ b/guix-data-service/web/controller.scm @@ -627,9 +627,10 @@ git-repository-details (map (match-lambda - ((id job-id commit source) + ((id job-id job-events commit source) (list id job-id + job-events commit source (git-branches-for-commit conn commit)))) diff --git a/guix-data-service/web/view/html.scm b/guix-data-service/web/view/html.scm index 97ce2e4..6e7fa62 100644 --- a/guix-data-service/web/view/html.scm +++ b/guix-data-service/web/view/html.scm @@ -274,25 +274,39 @@ (@ (class "table")) (thead (tr + (th (@ (class "col-md-6")) "Branch") (th (@ (class "col-md-6")) "Commit"))) (tbody ,@(map (match-lambda - ((id job-id commit source branches) + ((id job-id job-events commit source branches) `(tr - (td ,(if (string-null? id) - `(samp ,commit) - `(a (@ (href ,(string-append - "/revision/" commit))) - (samp ,commit)))) (td ,@(map (match-lambda ((name date) - `(a (@ (href ,(string-append - "/branch/" name))) - ,name))) - branches))))) + `(span + (a (@ (href ,(string-append + "/branch/" name))) + ,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)))))))) git-repositories-and-revisions))))) |