diff options
author | Danjela Lura <danielaluraa@gmail.com> | 2020-06-24 14:52:45 +0200 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2020-06-26 17:54:19 +0100 |
commit | bd3aa98620330f3312f091244ac842750adec4de (patch) | |
tree | d3f133479b239b5b790af652d032f000fffa8127 | |
parent | d442d408ee580e51faca26844deb5cabe3c971ac (diff) | |
download | data-service-bd3aa98620330f3312f091244ac842750adec4de.tar data-service-bd3aa98620330f3312f091244ac842750adec4de.tar.gz |
Add indications for no translations available in the lint warnings page
Signed-off-by: Christopher Baines <mail@cbaines.net>
-rw-r--r-- | guix-data-service/model/lint-warning.scm | 16 | ||||
-rw-r--r-- | guix-data-service/web/revision/controller.scm | 5 | ||||
-rw-r--r-- | guix-data-service/web/revision/html.scm | 22 |
3 files changed, 38 insertions, 5 deletions
diff --git a/guix-data-service/model/lint-warning.scm b/guix-data-service/model/lint-warning.scm index 6371772..856f3e6 100644 --- a/guix-data-service/model/lint-warning.scm +++ b/guix-data-service/model/lint-warning.scm @@ -16,12 +16,16 @@ ;;; <http://www.gnu.org/licenses/>. (define-module (guix-data-service model lint-warning) + #:use-module (ice-9 match) + #:use-module (srfi srfi-1) #:use-module (squee) #:use-module (guix-data-service model utils) #:export (lint-warnings-data->lint-warning-ids insert-guix-revision-lint-warnings lint-warnings-for-guix-revision - select-lint-warnings-by-revision-package-name-and-version)) + select-lint-warnings-by-revision-package-name-and-version + + any-translated-lint-warnings?)) (define (lint-warnings-data->lint-warning-ids conn @@ -206,3 +210,13 @@ WHERE packages.id IN ( (exec-query conn query (list commit-hash name version locale))) + +(define (any-translated-lint-warnings? lint-warnings-data locale) + (any + (match-lambda + ((lint-warnings-id lint-checker-name lint-checker-description + description-locale network-dependent package-name + packages-version file line column message message-locale) + (or (string=? description-locale locale) + (string=? message-locale locale)))) + lint-warnings-data)) diff --git a/guix-data-service/web/revision/controller.scm b/guix-data-service/web/revision/controller.scm index 2df5b99..5b6d1bf 100644 --- a/guix-data-service/web/revision/controller.scm +++ b/guix-data-service/web/revision/controller.scm @@ -1071,7 +1071,9 @@ #:locale locale #:package-query package-query #:linters linters - #:message-query message-query))) + #:message-query message-query)) + (any-translated-lint-warnings? + (any-translated-lint-warnings? lint-warnings locale))) (case (most-appropriate-mime-type '(application/json text/html) mime-types) @@ -1113,6 +1115,7 @@ git-repositories lint-checker-options lint-warnings-locale-options + any-translated-lint-warnings? #:path-base path-base #:header-text header-text #:header-link header-link) diff --git a/guix-data-service/web/revision/html.scm b/guix-data-service/web/revision/html.scm index a22c38e..c49624d 100644 --- a/guix-data-service/web/revision/html.scm +++ b/guix-data-service/web/revision/html.scm @@ -1848,6 +1848,7 @@ figure { git-repositories lint-checker-options lint-warnings-locale-options + any-translated-lint-warnings? #:key path-base header-text header-link) (define field-options @@ -1886,7 +1887,10 @@ figure { #:options lint-warnings-locale-options #:allow-selecting-multiple-options #f #:help-text - "Language") + (if any-translated-lint-warnings? + "Language" + '((span (@ (class "text-danger")) + "No translations available in this page")))) ,(form-horizontal-control "Package query" query-parameters #:help-text @@ -1961,10 +1965,22 @@ figure { `((td (span (@ (style "font-family: monospace; display: block;")) ,lint-checker-name) (p (@ (style "font-size: small; margin: 6px 0 0px;")) - ,lint-checker-description))) + ,lint-checker-description) + ,(if (string=? lint-checker-description-locale + (assq-ref query-parameters 'locale)) + "" + '((span (@ (class "text-danger") + (style "font-size: small; display: block;")) + "No translation available for lint checker description."))))) '()) ,@(if (member "message" fields) - `((td ,message)) + `((td ,message + ,(if (string=? message-locale + (assq-ref query-parameters 'locale)) + "" + '((span (@ (class "text-danger") + (style "font-size: small; display: block;")) + "\nNo translation available for lint warning message."))))) '()) ,@(if (member "location" fields) `((td |