aboutsummaryrefslogtreecommitdiff
path: root/guix-data-service/web
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2022-01-31 20:25:06 +0000
committerChristopher Baines <mail@cbaines.net>2022-01-31 20:25:06 +0000
commit752d21ad051900561a13dc6cb6543ea586b90baa (patch)
tree689492a3259a58b92835a8e6a9d23a15a562f24f /guix-data-service/web
parentf1418c4e88e9fc77e9a450fa1c01471e897774f3 (diff)
downloaddata-service-752d21ad051900561a13dc6cb6543ea586b90baa.tar
data-service-752d21ad051900561a13dc6cb6543ea586b90baa.tar.gz
Improve the way the field fields work on various pages
Remove the brackets from the values since this makes the set of values more consistent, and don't display the no additional fields value on the page.
Diffstat (limited to 'guix-data-service/web')
-rw-r--r--guix-data-service/web/compare/html.scm3
-rw-r--r--guix-data-service/web/revision/html.scm45
2 files changed, 29 insertions, 19 deletions
diff --git a/guix-data-service/web/compare/html.scm b/guix-data-service/web/compare/html.scm
index 128e3f4..17272e3 100644
--- a/guix-data-service/web/compare/html.scm
+++ b/guix-data-service/web/compare/html.scm
@@ -680,7 +680,8 @@
(lambda (field)
(cons field
(hyphenate-words
- (string-downcase field))))
+ (remove-brackets
+ (string-downcase field)))))
'("(no additional fields)" "Builds")))
(define fields
diff --git a/guix-data-service/web/revision/html.scm b/guix-data-service/web/revision/html.scm
index eeb2fc8..d8769e6 100644
--- a/guix-data-service/web/revision/html.scm
+++ b/guix-data-service/web/revision/html.scm
@@ -549,14 +549,18 @@
any-translations-available?
#:key path-base
header-text header-link)
+ (define fields
+ '("Version" "Synopsis" "Description"
+ "Home page" "Location" "Licenses"))
+
(define field-options
(map
(lambda (field)
(cons field
(hyphenate-words
- (string-downcase field))))
- '("Version" "Synopsis" "Description"
- "Home page" "Location" "Licenses")))
+ (remove-brackets
+ (string-downcase field)))))
+ `("(no additional fields)" ,@fields)))
(layout
#:title
@@ -642,12 +646,12 @@
(tr
(th (@ (class "col-md-3")) "Name")
,@(filter-map
- (match-lambda
- ((label . value)
- (if (member value (assq-ref query-parameters 'field))
- `(th (@ (class "col-md-3")) ,label)
- #f)))
- field-options)
+ (lambda (field)
+ (if (member (assoc-ref field-options field)
+ (assq-ref query-parameters 'field))
+ `(th (@ (class "col-md-3")) ,field)
+ #f))
+ fields)
(th (@ (class "col-md-3")) "")))
(tbody
,@(let ((fields (assq-ref query-parameters 'field)))
@@ -1543,7 +1547,8 @@ figure {
(lambda (field)
(cons field
(hyphenate-words
- (string-downcase field))))
+ (remove-brackets
+ (string-downcase field)))))
'("(no additional fields)" "System" "Target" "Builds")))
(define fields
@@ -2210,13 +2215,17 @@ figure {
any-translated-lint-warnings?
#:key path-base
header-text header-link)
+ (define fields
+ '("Linter" "Message" "Location"))
+
(define field-options
(map
(lambda (field)
(cons field
(hyphenate-words
- (string-downcase field))))
- '("Linter" "Message" "Location")))
+ (remove-brackets
+ (string-downcase field)))))
+ `("(no additional fields)" ,@fields)))
(layout
#:title
@@ -2300,12 +2309,12 @@ figure {
(tr
(th (@ (class "col-md-3")) "Package")
,@(filter-map
- (match-lambda
- ((label . value)
- (if (member value (assq-ref query-parameters 'field))
- `(th (@ (class "col-md-3")) ,label)
- #f)))
- field-options)
+ (lambda (field)
+ (if (member (assoc-ref field-options field)
+ (assq-ref query-parameters 'field))
+ `(th (@ (class "col-md-3")) ,field)
+ #f))
+ fields)
(th (@ (class "col-md-3")) "")))
(tbody
,@(let ((fields (assq-ref query-parameters 'field)))