aboutsummaryrefslogtreecommitdiff
path: root/guix-data-service/web/revision
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2020-04-24 10:28:44 +0100
committerChristopher Baines <mail@cbaines.net>2020-04-24 10:28:44 +0100
commit7a7dedfa1bf0d623d9a7cb8fc509c85caa3b9fdd (patch)
tree82ae2897800885c9fbc571f9befbcc314d339fa6 /guix-data-service/web/revision
parent68420b1085c55682b074f1835f9b31a238fc82c1 (diff)
downloaddata-service-7a7dedfa1bf0d623d9a7cb8fc509c85caa3b9fdd.tar
data-service-7a7dedfa1bf0d623d9a7cb8fc509c85caa3b9fdd.tar.gz
Implement the JSON response for the package derivations page
Diffstat (limited to 'guix-data-service/web/revision')
-rw-r--r--guix-data-service/web/revision/controller.scm21
-rw-r--r--guix-data-service/web/revision/html.scm13
2 files changed, 33 insertions, 1 deletions
diff --git a/guix-data-service/web/revision/controller.scm b/guix-data-service/web/revision/controller.scm
index 25b7604..9f8592a 100644
--- a/guix-data-service/web/revision/controller.scm
+++ b/guix-data-service/web/revision/controller.scm
@@ -767,7 +767,26 @@
mime-types)
((application/json)
(render-json
- `()))
+ `((derivations . ,(list->vector
+ (map (match-lambda
+ ((derivation system target)
+ `((derivation . ,derivation)
+ ,@(if (member "system" fields)
+ `((system . ,system))
+ '())
+ ,@(if (member "target" fields)
+ `((target . ,target))
+ '())))
+ ((derivation system target builds)
+ `((derivation . ,derivation)
+ ,@(if (member "system" fields)
+ `((system . ,system))
+ '())
+ ,@(if (member "target" fields)
+ `((target . ,target))
+ '())
+ (builds . ,builds))))
+ derivations))))))
(else
(render-html
#:sxml (view-revision-package-derivations
diff --git a/guix-data-service/web/revision/html.scm b/guix-data-service/web/revision/html.scm
index 2d1b706..35b5782 100644
--- a/guix-data-service/web/revision/html.scm
+++ b/guix-data-service/web/revision/html.scm
@@ -1130,6 +1130,19 @@ figure {
(div
(@ (class "row"))
(div
+ (@ (class "col-sm-12"))
+ (a (@ (class "btn btn-default btn-lg 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))))))
+ "View JSON")))
+ (div
+ (@ (class "row"))
+ (div
(@ (class "col-md-12"))
(h1 "Package derivations")
(p "Showing " ,(length derivations) " results")