Add a very rough JSON output for the package derivation outputs page
This commit is contained in:
parent
3225766207
commit
efbbac5099
2 changed files with 57 additions and 1 deletions
|
|
@ -1113,7 +1113,50 @@
|
||||||
mime-types)
|
mime-types)
|
||||||
((application/json)
|
((application/json)
|
||||||
(render-json
|
(render-json
|
||||||
`()))
|
`((store_paths
|
||||||
|
. ,(list->vector
|
||||||
|
(map (match-lambda
|
||||||
|
((path hash-algorithm hash recursive
|
||||||
|
nars)
|
||||||
|
`((path . ,path)
|
||||||
|
(data
|
||||||
|
. ,(if (null? hash-algorithm)
|
||||||
|
(list->vector
|
||||||
|
(map
|
||||||
|
(match-lambda
|
||||||
|
((hash . nars)
|
||||||
|
`((hash . ,hash)
|
||||||
|
(nars . ,(list->vector nars)))))
|
||||||
|
(group-to-alist
|
||||||
|
(lambda (nar)
|
||||||
|
(cons (assoc-ref nar "hash")
|
||||||
|
nar))
|
||||||
|
(vector->list nars))))
|
||||||
|
hash))
|
||||||
|
(output_consistency
|
||||||
|
. ,(let* ((hashes
|
||||||
|
(delete-duplicates
|
||||||
|
(map (lambda (nar)
|
||||||
|
(assoc-ref nar "hash"))
|
||||||
|
(vector->list nars))))
|
||||||
|
(build-servers
|
||||||
|
(delete-duplicates
|
||||||
|
(map (lambda (nar)
|
||||||
|
(assoc-ref nar "build_server_id"))
|
||||||
|
(vector->list nars))))
|
||||||
|
(hash-count
|
||||||
|
(length hashes))
|
||||||
|
(build-server-count
|
||||||
|
(length build-servers)))
|
||||||
|
(cond
|
||||||
|
((or (eq? hash-count 0)
|
||||||
|
(eq? build-server-count 1))
|
||||||
|
"unknown")
|
||||||
|
((eq? hash-count 1)
|
||||||
|
"matching")
|
||||||
|
((> hash-count 1)
|
||||||
|
"not-matching")))))))
|
||||||
|
derivation-outputs))))))
|
||||||
(else
|
(else
|
||||||
(letpar& ((systems
|
(letpar& ((systems
|
||||||
(with-thread-postgresql-connection valid-systems))
|
(with-thread-postgresql-connection valid-systems))
|
||||||
|
|
|
||||||
|
|
@ -1756,6 +1756,19 @@ figure {
|
||||||
(button (@ (type "submit")
|
(button (@ (type "submit")
|
||||||
(class "btn btn-lg btn-primary"))
|
(class "btn btn-lg btn-primary"))
|
||||||
"Update results")))))))
|
"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
|
(div
|
||||||
(@ (class "row"))
|
(@ (class "row"))
|
||||||
(div
|
(div
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue