Implement the search query input on the derivation outputs page

This commit is contained in:
Christopher Baines 2020-01-04 22:15:39 +00:00
parent 6cb7e92257
commit d7036bdd37
2 changed files with 12 additions and 5 deletions

View file

@ -423,6 +423,7 @@ ORDER BY derivations.file_name
(define* (select-derivation-outputs-in-revision conn
commit-hash
#:key
search-query
output-consistency
system
target
@ -477,6 +478,9 @@ WHERE guix_revisions.commit = $1
'())
,@(if target
'(" AND package_derivations.target = ")
'())
,@(if search-query
'(" AND derivation_output_details.path LIKE ")
'()))))
(string-concatenate
(map (lambda (query count)
@ -549,6 +553,10 @@ ORDER BY derivation_output_details.path
'())
,@(if target
(list target)
'())
,@(if search-query
(list (string-append
"%" search-query "%"))
'())))))
(define (fix-derivation-output-details-hash-encoding conn)

View file

@ -195,7 +195,8 @@
(guard-against-mutually-exclusive-query-parameters
(parse-query-parameters
request
`((after_path ,identity)
`((search_query ,identity)
(after_path ,identity)
(output_consistency ,identity
#:default "any")
(system ,parse-system #:default "x86_64-linux")
@ -204,10 +205,7 @@
#:no-default-when (all_results)
#:default 10)
(all_results ,parse-checkbox-value)))
;; You can't specify a search query, but then also limit the
;; results by filtering for after a particular output path
'((after_path search_query)
(limit_results all_results)))))
'((limit_results all_results)))))
(render-revision-derivation-outputs mime-types
conn
@ -723,6 +721,7 @@
(select-derivation-outputs-in-revision
conn
commit-hash
#:search-query (assq-ref query-parameters 'search_query)
#:output-consistency
(assq-ref query-parameters 'output_consistency)
#:system (assq-ref query-parameters 'system)