Add initial JSON output for the package page
This commit is contained in:
parent
e64fc090cd
commit
de76f89cb3
1 changed files with 50 additions and 16 deletions
|
|
@ -125,6 +125,50 @@
|
||||||
(apply render-html
|
(apply render-html
|
||||||
(view-revision-packages commit-hash packages))))))
|
(view-revision-packages commit-hash packages))))))
|
||||||
|
|
||||||
|
(define (render-revision-package mime-types
|
||||||
|
conn
|
||||||
|
commit-hash
|
||||||
|
name
|
||||||
|
version)
|
||||||
|
(let ((metadata
|
||||||
|
(select-package-metadata-by-revision-name-and-version
|
||||||
|
conn
|
||||||
|
commit-hash
|
||||||
|
name
|
||||||
|
version))
|
||||||
|
(derivations
|
||||||
|
(select-derivations-by-revision-name-and-version
|
||||||
|
conn
|
||||||
|
commit-hash
|
||||||
|
name
|
||||||
|
version)))
|
||||||
|
(case (most-appropriate-mime-type
|
||||||
|
'(application/json text/html)
|
||||||
|
mime-types)
|
||||||
|
((application/json)
|
||||||
|
(render-json
|
||||||
|
`((name . ,name)
|
||||||
|
(version . ,version)
|
||||||
|
,@(match metadata
|
||||||
|
(((synopsis description home-page))
|
||||||
|
`((synopsis . ,synopsis)
|
||||||
|
(description . ,description)
|
||||||
|
(home-page . ,home-page))))
|
||||||
|
(derivations . ,(list->vector
|
||||||
|
(map (match-lambda
|
||||||
|
((system target file-name status)
|
||||||
|
`((system . ,system)
|
||||||
|
(target . ,target)
|
||||||
|
(derivation . ,file-name))))
|
||||||
|
derivations))))))
|
||||||
|
(else
|
||||||
|
(apply render-html
|
||||||
|
(view-revision-package-and-version commit-hash
|
||||||
|
name
|
||||||
|
version
|
||||||
|
metadata
|
||||||
|
derivations))))))
|
||||||
|
|
||||||
(define (render-compare-unknown-commit mime-types
|
(define (render-compare-unknown-commit mime-types
|
||||||
conn
|
conn
|
||||||
base-commit
|
base-commit
|
||||||
|
|
@ -401,22 +445,12 @@
|
||||||
mime-types
|
mime-types
|
||||||
conn
|
conn
|
||||||
commit-hash))
|
commit-hash))
|
||||||
((GET "revision" commit-hash "package" name version)
|
((GET "revision" commit-hash "package" name version) (render-revision-package
|
||||||
(apply render-html
|
mime-types
|
||||||
(view-revision-package-and-version
|
conn
|
||||||
commit-hash
|
commit-hash
|
||||||
name
|
name
|
||||||
version
|
version))
|
||||||
(select-package-metadata-by-revision-name-and-version
|
|
||||||
conn
|
|
||||||
commit-hash
|
|
||||||
name
|
|
||||||
version)
|
|
||||||
(select-derivations-by-revision-name-and-version
|
|
||||||
conn
|
|
||||||
commit-hash
|
|
||||||
name
|
|
||||||
version))))
|
|
||||||
((GET "branches")
|
((GET "branches")
|
||||||
(apply render-html
|
(apply render-html
|
||||||
(view-branches
|
(view-branches
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue