From d7036bdd377f4a70fd28b2f2ef5a5c78aec22e9a Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Sat, 4 Jan 2020 22:15:39 +0000 Subject: Implement the search query input on the derivation outputs page --- guix-data-service/model/derivation.scm | 8 ++++++++ guix-data-service/web/revision/controller.scm | 9 ++++----- 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) -- cgit v1.2.3