Add JSON output for the branch package versions page
This commit is contained in:
parent
00ac080297
commit
4df889fc3c
2 changed files with 38 additions and 10 deletions
|
|
@ -883,16 +883,37 @@
|
||||||
#:before-date (assq-ref parsed-query-parameters
|
#:before-date (assq-ref parsed-query-parameters
|
||||||
'before_date)))))))
|
'before_date)))))))
|
||||||
(('GET "repository" repository-id "branch" branch-name "package" package-name)
|
(('GET "repository" repository-id "branch" branch-name "package" package-name)
|
||||||
|
(let ((package-versions
|
||||||
|
(package-versions-for-branch conn
|
||||||
|
(string->number repository-id)
|
||||||
|
branch-name
|
||||||
|
package-name)))
|
||||||
|
(case (most-appropriate-mime-type
|
||||||
|
'(application/json text/html)
|
||||||
|
mime-types)
|
||||||
|
((application/json)
|
||||||
|
(render-json
|
||||||
|
`((versions . ,(list->vector
|
||||||
|
(map (match-lambda
|
||||||
|
((package-version first-guix-revision-commit
|
||||||
|
first-datetime
|
||||||
|
last-guix-revision-commit
|
||||||
|
last-datetime)
|
||||||
|
`((version . ,package-version)
|
||||||
|
(first_revision
|
||||||
|
. ((commit . ,first-guix-revision-commit)
|
||||||
|
(datetime . ,first-datetime)))
|
||||||
|
(last_revision
|
||||||
|
. ((commit . ,last-guix-revision-commit)
|
||||||
|
(datetime . ,last-datetime))))))
|
||||||
|
package-versions))))))
|
||||||
|
(else
|
||||||
(render-html
|
(render-html
|
||||||
#:sxml (view-branch-package
|
#:sxml (view-branch-package
|
||||||
repository-id
|
repository-id
|
||||||
branch-name
|
branch-name
|
||||||
package-name
|
package-name
|
||||||
(package-versions-for-branch
|
package-versions))))))
|
||||||
conn
|
|
||||||
(string->number repository-id)
|
|
||||||
branch-name
|
|
||||||
package-name))))
|
|
||||||
(('GET "repository" repository-id "branch" branch-name "latest-processed-revision")
|
(('GET "repository" repository-id "branch" branch-name "latest-processed-revision")
|
||||||
(let ((commit-hash
|
(let ((commit-hash
|
||||||
(latest-processed-commit-for-branch conn repository-id branch-name)))
|
(latest-processed-commit-for-branch conn repository-id branch-name)))
|
||||||
|
|
|
||||||
|
|
@ -1107,6 +1107,13 @@
|
||||||
(a (@ (href ,(string-append "/repository/" git-repository-id
|
(a (@ (href ,(string-append "/repository/" git-repository-id
|
||||||
"/branch/" branch-name)))
|
"/branch/" branch-name)))
|
||||||
(h3 ,(string-append branch-name " branch")))
|
(h3 ,(string-append branch-name " branch")))
|
||||||
|
(a (@ (class "btn btn-default btn-lg pull-right")
|
||||||
|
(href ,(string-append
|
||||||
|
"/repository/" git-repository-id
|
||||||
|
"/branch/" branch-name
|
||||||
|
"/package/" package-name
|
||||||
|
".json")))
|
||||||
|
"View JSON")
|
||||||
(h1 (@ (style "white-space: nowrap;"))
|
(h1 (@ (style "white-space: nowrap;"))
|
||||||
(samp ,package-name))))
|
(samp ,package-name))))
|
||||||
(div
|
(div
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue