aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2019-06-22 01:14:57 +0200
committerChristopher Baines <mail@cbaines.net>2019-06-22 01:51:49 +0200
commite2c9709c7db2fab142112a8fd2ebf16dae76d8b8 (patch)
treedf119a042cdf20fbbf78bf5e3a50607a313cb17f
parentd96add30a02dc6f5cee313f37b31c5525dbd5a3d (diff)
downloaddata-service-e2c9709c7db2fab142112a8fd2ebf16dae76d8b8.tar
data-service-e2c9709c7db2fab142112a8fd2ebf16dae76d8b8.tar.gz
Add a job page
Which shows the output for that job.
-rw-r--r--guix-data-service/web/controller.scm10
-rw-r--r--guix-data-service/web/view/html.scm29
2 files changed, 36 insertions, 3 deletions
diff --git a/guix-data-service/web/controller.scm b/guix-data-service/web/controller.scm
index f5d4d90..6990fb9 100644
--- a/guix-data-service/web/controller.scm
+++ b/guix-data-service/web/controller.scm
@@ -529,6 +529,12 @@
#:sxml (view-jobs
(select-jobs-and-events conn))))
+(define (render-job mime-types conn job-id)
+ (render-html
+ #:sxml (view-job
+ job-id
+ (log-for-job conn job-id))))
+
(define (parse-commit conn)
(lambda (s)
(if (guix-commit-exists? conn s)
@@ -816,5 +822,9 @@
((GET "jobs")
(render-jobs mime-types
conn))
+ ((GET "job" job-id)
+ (render-job mime-types
+ conn
+ job-id))
((GET path ...)
(not-found (request-uri request)))))
diff --git a/guix-data-service/web/view/html.scm b/guix-data-service/web/view/html.scm
index 6e28837..da7e992 100644
--- a/guix-data-service/web/view/html.scm
+++ b/guix-data-service/web/view/html.scm
@@ -41,6 +41,7 @@
view-derivation
view-store-item
view-jobs
+ view-job
compare
compare/derivations
compare/packages
@@ -930,11 +931,12 @@
(tr
(th "Commit")
(th "Source")
- (th "Events")))
+ (th "Events")
+ (th "")))
(tdata
,@(map (match-lambda
((id commit source git-repository-id created-at succeeded-at
- events)
+ events log-exists?)
`(tr
(@ (class
,(let ((event-names
@@ -965,9 +967,30 @@
(cons
`(("event" . "created")
("occurred_at" . ,created-at))
- (vector->list events))))))))
+ (vector->list events)))))
+ (td
+ ,@(if log-exists?
+ `((a (@ (href ,(string-append "/job/" id)))
+ "View log"))
+ '())))))
jobs-and-events)))))))))
+(define (view-job job-id log)
+ (layout
+ #:body
+ `(,(header)
+ (div
+ (@ (class "container"))
+ (div
+ (@ (class "row"))
+ (div
+ (@ (class "col-sm-12"))
+ (h1 "Job " ,job-id)))
+ (div
+ (@ (class "row"))
+ (div
+ (pre ,log)))))))
+
(define (view-derivation derivation derivation-inputs derivation-outputs
builds)
(layout