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