summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2019-05-19 21:28:01 +0100
committerChristopher Baines <mail@cbaines.net>2019-05-19 21:28:01 +0100
commite92e095ee9bab35901f768c5712383649c588e70 (patch)
tree3bf2d57b054326588ca3ac82e4e97f591a80ab3f
parent0a7e6a76f332813f6b1d37db026fa8ce5243784c (diff)
downloaddata-service-e92e095ee9bab35901f768c5712383649c588e70.tar
data-service-e92e095ee9bab35901f768c5712383649c588e70.tar.gz
Add an all results option to the packages page
-rw-r--r--guix-data-service/web/controller.scm11
-rw-r--r--guix-data-service/web/view/html.scm4
2 files changed, 12 insertions, 3 deletions
diff --git a/guix-data-service/web/controller.scm b/guix-data-service/web/controller.scm
index a1f16ef..81093ef 100644
--- a/guix-data-service/web/controller.scm
+++ b/guix-data-service/web/controller.scm
@@ -151,7 +151,8 @@
#f))))
(let* ((search-query (assq-ref query-parameters 'search_query))
- (limit-results (assq-ref query-parameters 'limit_results))
+ (limit-results (or (assq-ref query-parameters 'limit_results)
+ 99999)) ; TODO There shouldn't be a limit
(fields (assq-ref query-parameters 'field))
(packages
(if search-query
@@ -563,10 +564,14 @@
(field ,identity #:multi-value
#:default ("version" "synopsis"))
(search_query ,identity)
- (limit_results ,parse-result-limit #:default 100)))
+ (limit_results ,parse-result-limit
+ #:no-default-when (all_results)
+ #:default 100)
+ (all_results ,parse-checkbox-value)))
;; You can't specify a search query, but then also limit the
;; results by filtering for after a particular package name
- '((after_name search_query)))))
+ '((after_name search_query)
+ (limit_results all_results)))))
(render-revision-packages mime-types
conn
diff --git a/guix-data-service/web/view/html.scm b/guix-data-service/web/view/html.scm
index 2e3991c..9d87548 100644
--- a/guix-data-service/web/view/html.scm
+++ b/guix-data-service/web/view/html.scm
@@ -527,6 +527,10 @@
,(form-horizontal-control
"Limit results" query-parameters
#:help-text "The maximum number of packages by name to return.")
+ ,(form-horizontal-control
+ "All results" query-parameters
+ #:type "checkbox"
+ #:help-text "Return all results.")
(div (@ (class "form-group form-group-lg"))
(div (@ (class "col-sm-offset-2 col-sm-10"))
(button (@ (type "submit")