aboutsummaryrefslogtreecommitdiff
path: root/guix-data-service/web/revision
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2020-09-27 12:06:18 +0100
committerChristopher Baines <mail@cbaines.net>2020-09-27 12:06:18 +0100
commit84907fe040b6cef0b738ac1acce9359720dfcc33 (patch)
tree2930bdcf6a8bd1725fad8bd5e529fece4132dc3d /guix-data-service/web/revision
parent5b13ee22518df33c42ed04ee299a7c94b78fbb81 (diff)
downloaddata-service-84907fe040b6cef0b738ac1acce9359720dfcc33.tar
data-service-84907fe040b6cef0b738ac1acce9359720dfcc33.tar.gz
Implement the JSON representation for system tests
Diffstat (limited to 'guix-data-service/web/revision')
-rw-r--r--guix-data-service/web/revision/controller.scm17
-rw-r--r--guix-data-service/web/revision/html.scm10
2 files changed, 26 insertions, 1 deletions
diff --git a/guix-data-service/web/revision/controller.scm b/guix-data-service/web/revision/controller.scm
index ec93c04..be6a4d0 100644
--- a/guix-data-service/web/revision/controller.scm
+++ b/guix-data-service/web/revision/controller.scm
@@ -423,7 +423,22 @@
mime-types)
((application/json)
(render-json
- '())) ; TODO
+ `((commit . ,commit-hash)
+ (system . ,(assq-ref query-parameters 'system))
+ (system_tests
+ . ,(list->vector
+ (map
+ (match-lambda
+ ((name description file line column-number
+ derivation-file-name builds)
+ `((name . ,name)
+ (description . ,description)
+ (location . ((file . ,file)
+ (line . ,line)
+ (column-number . ,column-number)))
+ (derivation . ,derivation-file-name)
+ (builds . ,(list->vector builds)))))
+ system-tests))))))
(else
(render-html
#:sxml (view-revision-system-tests
diff --git a/guix-data-service/web/revision/html.scm b/guix-data-service/web/revision/html.scm
index 5917d50..32cd3ec 100644
--- a/guix-data-service/web/revision/html.scm
+++ b/guix-data-service/web/revision/html.scm
@@ -868,6 +868,16 @@
(button (@ (type "submit")
(class "btn btn-lg btn-primary"))
"Update results")))))
+ (a (@ (class "btn btn-lg btn-default pull-right")
+ (href ,(let ((query-parameter-string
+ (query-parameters->string query-parameters)))
+ (string-append
+ path-base ".json"
+ (if (string-null? query-parameter-string)
+ ""
+ (string-append "?" query-parameter-string)))))
+ (role "button"))
+ "View JSON")
(table
(@ (class "table"))
(thead