aboutsummaryrefslogtreecommitdiff
path: root/guix-data-service/web/jobs
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2020-01-12 17:30:52 +0000
committerChristopher Baines <mail@cbaines.net>2020-01-12 17:30:52 +0000
commit2062badf5167d942c0eb96d7ca73e0906de7e36b (patch)
treed658f8e667e11a8f06193a7b910752239a473eb3 /guix-data-service/web/jobs
parent331e3e789d164a80de277a5ce1a56f05d8fbc634 (diff)
downloaddata-service-2062badf5167d942c0eb96d7ca73e0906de7e36b.tar
data-service-2062badf5167d942c0eb96d7ca73e0906de7e36b.tar.gz
Add a small table of recent job events
To make it easier to see what recently happened.
Diffstat (limited to 'guix-data-service/web/jobs')
-rw-r--r--guix-data-service/web/jobs/controller.scm4
-rw-r--r--guix-data-service/web/jobs/html.scm33
2 files changed, 36 insertions, 1 deletions
diff --git a/guix-data-service/web/jobs/controller.scm b/guix-data-service/web/jobs/controller.scm
index 949fac2..733fb35 100644
--- a/guix-data-service/web/jobs/controller.scm
+++ b/guix-data-service/web/jobs/controller.scm
@@ -64,11 +64,13 @@
(jobs (select-jobs-and-events
conn
(assq-ref query-parameters 'before_id)
- limit-results)))
+ limit-results))
+ (recent-events (select-recent-job-events conn)))
(render-html
#:sxml (view-jobs
query-parameters
jobs
+ recent-events
(and limit-results
(>= (length jobs)
limit-results))))))
diff --git a/guix-data-service/web/jobs/html.scm b/guix-data-service/web/jobs/html.scm
index f2b45b2..830d0e6 100644
--- a/guix-data-service/web/jobs/html.scm
+++ b/guix-data-service/web/jobs/html.scm
@@ -26,6 +26,7 @@
(define (view-jobs query-parameters
jobs-and-events
+ recent-events
show-next-page?)
(layout
#:body
@@ -49,6 +50,38 @@
(div
(@ (class "row"))
(div
+ (@ (class "col-sm-1")))
+ (div
+ (@ (class "col-sm-10"))
+ (table
+ (@ (class "table"))
+ (thead
+ (tr
+ (th "Job")
+ (th "Event")
+ (th "Occurred at")))
+ (tbody
+ ,@(map
+ (match-lambda
+ ((id commit source git-repository-id event occurred-at)
+ `(tr
+ (td (a (@ (href
+ ,(string-append
+ "/revision/" commit)))
+ (samp ,commit)))
+ (td ,@(let ((classes '(("start" . "info")
+ ("success" . "success")
+ ("failure" . "danger"))))
+ (or (and=> (assoc-ref classes event)
+ (lambda (class)
+ `((@ (class ,class)))))
+ '()))
+ ,event)
+ (td ,occurred-at))))
+ recent-events)))))
+ (div
+ (@ (class "row"))
+ (div
(@ (class "col-sm-12"))
(div
(@ (class "well"))