aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2020-01-04 22:15:39 +0000
committerChristopher Baines <mail@cbaines.net>2020-01-04 22:15:39 +0000
commitd7036bdd377f4a70fd28b2f2ef5a5c78aec22e9a (patch)
tree92c19d6f89a25de6ed6da7db0b9e6800c7d7a09a
parent6cb7e9225708dabdbbbe8a8f9272a42010ed900c (diff)
downloaddata-service-d7036bdd377f4a70fd28b2f2ef5a5c78aec22e9a.tar
data-service-d7036bdd377f4a70fd28b2f2ef5a5c78aec22e9a.tar.gz
Implement the search query input on the derivation outputs page
-rw-r--r--guix-data-service/model/derivation.scm8
-rw-r--r--guix-data-service/web/revision/controller.scm9
2 files changed, 12 insertions, 5 deletions
diff --git a/guix-data-service/model/derivation.scm b/guix-data-service/model/derivation.scm
index 7416512..cd850ae 100644
--- a/guix-data-service/model/derivation.scm
+++ b/guix-data-service/model/derivation.scm
@@ -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)
diff --git a/guix-data-service/web/revision/controller.scm b/guix-data-service/web/revision/controller.scm
index 7a4432b..b45076b 100644
--- a/guix-data-service/web/revision/controller.scm
+++ b/guix-data-service/web/revision/controller.scm
@@ -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)