Add some basic pagination to the packages page
Lower powered devices will have problems displaying all ~9000+ packages, so return a smaller number by default.
This commit is contained in:
parent
8eac26b17d
commit
0bdc555ff8
3 changed files with 93 additions and 26 deletions
|
|
@ -107,8 +107,15 @@
|
|||
|
||||
(define (render-revision-packages mime-types
|
||||
conn
|
||||
commit-hash)
|
||||
(let ((packages (select-packages-in-revision conn commit-hash)))
|
||||
commit-hash
|
||||
query-parameters)
|
||||
(let ((packages (select-packages-in-revision
|
||||
conn
|
||||
commit-hash
|
||||
#:limit-results (assq-ref query-parameters
|
||||
'limit_results)
|
||||
#:after-name (assq-ref query-parameters
|
||||
'after_name))))
|
||||
(case (most-appropriate-mime-type
|
||||
'(application/json text/html)
|
||||
mime-types)
|
||||
|
|
@ -123,7 +130,9 @@
|
|||
packages))))))
|
||||
(else
|
||||
(apply render-html
|
||||
(view-revision-packages commit-hash packages))))))
|
||||
(view-revision-packages commit-hash
|
||||
query-parameters
|
||||
packages))))))
|
||||
|
||||
(define (render-revision-package mime-types
|
||||
conn
|
||||
|
|
@ -441,10 +450,17 @@
|
|||
((GET "revision" commit-hash) (render-view-revision mime-types
|
||||
conn
|
||||
commit-hash))
|
||||
((GET "revision" commit-hash "packages") (render-revision-packages
|
||||
mime-types
|
||||
conn
|
||||
commit-hash))
|
||||
((GET "revision" commit-hash "packages")
|
||||
(let ((parsed-query-parameters
|
||||
(parse-query-parameters
|
||||
request
|
||||
`((after_name ,identity)
|
||||
(limit_results ,parse-result-limit #:default 100)))))
|
||||
|
||||
(render-revision-packages mime-types
|
||||
conn
|
||||
commit-hash
|
||||
parsed-query-parameters)))
|
||||
((GET "revision" commit-hash "package" name version) (render-revision-package
|
||||
mime-types
|
||||
conn
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue