Improve system and target query parameter handling
This commit is contained in:
parent
dfccbf911c
commit
374dc25440
5 changed files with 50 additions and 22 deletions
|
|
@ -68,8 +68,7 @@
|
|||
"x86_64-linux"))
|
||||
|
||||
(define (valid-targets conn)
|
||||
'("" ;; no target
|
||||
"arm-linux-gnueabihf"
|
||||
'("arm-linux-gnueabihf"
|
||||
"aarch64-linux-gnu"
|
||||
"powerpc-linux-gnu"
|
||||
"riscv64-linux-gnu"
|
||||
|
|
|
|||
|
|
@ -44,9 +44,6 @@
|
|||
. (public
|
||||
(max-age . ,cache-control-default-max-age)))))
|
||||
|
||||
(define (parse-system s)
|
||||
s)
|
||||
|
||||
(define (parse-build-status s)
|
||||
s)
|
||||
|
||||
|
|
@ -106,7 +103,7 @@
|
|||
`((base_commit ,(parse-commit conn) #:required)
|
||||
(target_commit ,(parse-commit conn) #:required)
|
||||
(system ,parse-system #:multi-value)
|
||||
(target ,parse-system #:multi-value)
|
||||
(target ,parse-target #:multi-value)
|
||||
(build_status ,parse-build-status #:multi-value)))))
|
||||
(render-compare/derivations mime-types
|
||||
conn
|
||||
|
|
@ -121,7 +118,7 @@
|
|||
(target_branch ,identity #:required)
|
||||
(target_datetime ,parse-datetime #:required)
|
||||
(system ,parse-system #:multi-value)
|
||||
(target ,parse-system #:multi-value)
|
||||
(target ,parse-target #:multi-value)
|
||||
(build_status ,parse-build-status #:multi-value)))
|
||||
'((base_commit base_datetime)
|
||||
(target_commit target_datetime)))))
|
||||
|
|
|
|||
|
|
@ -42,7 +42,11 @@
|
|||
parse-datetime
|
||||
parse-checkbox-value
|
||||
parse-number
|
||||
parse-result-limit))
|
||||
parse-result-limit
|
||||
parse-system
|
||||
parse-target
|
||||
|
||||
valid-targets->options))
|
||||
|
||||
(define (parse-query-string query)
|
||||
"Parse and decode the URI query string QUERY and return an alist."
|
||||
|
|
@ -219,6 +223,19 @@
|
|||
|
||||
(define parse-result-limit parse-number)
|
||||
|
||||
(define parse-system identity)
|
||||
|
||||
(define (parse-target target)
|
||||
(if (string=? target "none")
|
||||
""
|
||||
target))
|
||||
|
||||
(define (valid-targets->options targets)
|
||||
`(("" . "none")
|
||||
,@(map (lambda (target)
|
||||
(cons target target))
|
||||
targets)))
|
||||
|
||||
(define (any-invalid-query-parameters? query-parameters)
|
||||
(->bool (any (lambda (val)
|
||||
(if (list? val)
|
||||
|
|
|
|||
|
|
@ -64,9 +64,6 @@
|
|||
. (public
|
||||
(max-age . ,cache-control-default-max-age)))))
|
||||
|
||||
(define (parse-system s)
|
||||
s)
|
||||
|
||||
(define (parse-build-status status)
|
||||
(if (member status build-status-strings)
|
||||
status
|
||||
|
|
@ -173,7 +170,7 @@
|
|||
request
|
||||
`((search_query ,identity)
|
||||
(system ,parse-system #:multi-value)
|
||||
(target ,identity #:multi-value)
|
||||
(target ,parse-target #:multi-value)
|
||||
(maximum_builds ,parse-number)
|
||||
(minimum_builds ,parse-number)
|
||||
(after_name ,identity)
|
||||
|
|
@ -202,7 +199,7 @@
|
|||
(output_consistency ,identity
|
||||
#:default "any")
|
||||
(system ,parse-system #:default "x86_64-linux")
|
||||
(target ,identity)
|
||||
(target ,parse-target)
|
||||
(limit_results ,parse-result-limit
|
||||
#:no-default-when (all_results)
|
||||
#:default 10)
|
||||
|
|
@ -252,7 +249,7 @@
|
|||
`((build_status ,parse-build-status #:multi-value)
|
||||
(build_server ,(parse-build-server conn) #:multi-value)
|
||||
(system ,parse-system #:default "x86_64-linux")
|
||||
(target ,identity)))))
|
||||
(target ,parse-target)))))
|
||||
|
||||
(render-revision-builds mime-types
|
||||
conn
|
||||
|
|
@ -698,7 +695,8 @@
|
|||
#:sxml (view-revision-derivations commit-hash
|
||||
query-parameters
|
||||
(valid-systems conn)
|
||||
(valid-targets conn)
|
||||
(valid-targets->options
|
||||
(valid-targets conn))
|
||||
'()
|
||||
'()
|
||||
#f
|
||||
|
|
@ -755,7 +753,8 @@
|
|||
#:sxml (view-revision-derivations commit-hash
|
||||
query-parameters
|
||||
(valid-systems conn)
|
||||
(valid-targets conn)
|
||||
(valid-targets->options
|
||||
(valid-targets conn))
|
||||
derivations
|
||||
build-server-urls
|
||||
show-next-page?
|
||||
|
|
@ -830,7 +829,8 @@
|
|||
derivation-outputs
|
||||
build-server-urls
|
||||
(valid-systems conn)
|
||||
(valid-targets conn)
|
||||
(valid-targets->options
|
||||
(valid-targets conn))
|
||||
show-next-page?
|
||||
#:path-base path-base
|
||||
#:header-text header-text
|
||||
|
|
@ -852,7 +852,8 @@
|
|||
commit-hash
|
||||
build-status-strings
|
||||
(valid-systems conn)
|
||||
(valid-targets conn)
|
||||
(valid-targets->options
|
||||
(valid-targets conn))
|
||||
'()
|
||||
'()
|
||||
'()))
|
||||
|
|
@ -863,7 +864,8 @@
|
|||
commit-hash
|
||||
build-status-strings
|
||||
(valid-systems conn)
|
||||
(valid-targets conn)
|
||||
(valid-targets->options
|
||||
(valid-targets conn))
|
||||
(map (match-lambda
|
||||
((id url lookup-all-derivations)
|
||||
(cons url id)))
|
||||
|
|
|
|||
|
|
@ -104,7 +104,8 @@
|
|||
options
|
||||
(allow-selecting-multiple-options #t)
|
||||
font-family
|
||||
(type "text"))
|
||||
(type "text")
|
||||
(null-string-value "none"))
|
||||
(define (value->text value)
|
||||
(match value
|
||||
(#f "")
|
||||
|
|
@ -163,14 +164,26 @@
|
|||
(map (match-lambda
|
||||
((option-label . option-value)
|
||||
`(option
|
||||
(@ ,@(if (member option-value selected-options)
|
||||
(@ ,@(if (member (if (and
|
||||
(string? option-value)
|
||||
(string=? option-value
|
||||
null-string-value))
|
||||
""
|
||||
option-value)
|
||||
selected-options)
|
||||
'((selected ""))
|
||||
'())
|
||||
(value ,option-value))
|
||||
,(value->text option-label)))
|
||||
(option-value
|
||||
`(option
|
||||
(@ ,@(if (member option-value selected-options)
|
||||
(@ ,@(if (member (if (and
|
||||
(string? option-value)
|
||||
(string=? option-value
|
||||
null-string-value))
|
||||
""
|
||||
option-value)
|
||||
selected-options)
|
||||
'((selected ""))
|
||||
'()))
|
||||
,(value->text option-value))))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue