2
0
Fork 0
mirror of git://git.savannah.gnu.org/guix/data-service.git synced 2023-12-14 03:23:03 +01:00

Implement the JSON response for the package derivations page

This commit is contained in:
Christopher Baines 2020-04-24 10:28:44 +01:00
parent 68420b1085
commit 7a7dedfa1b
2 changed files with 33 additions and 1 deletions

View file

@ -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

View file

@ -1127,6 +1127,19 @@ figure {
(button (@ (type "submit")
(class "btn btn-lg btn-primary"))
"Update results")))))))
(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