Fixed frontend validation

This commit is contained in:
Clemens Geibel 2021-08-05 13:47:06 +02:00
parent 120965b8e2
commit 05f72c953e
3 changed files with 11 additions and 9 deletions

View file

@ -26,12 +26,12 @@
<label for="postgres-data-volume-path" class="form-label">(Optional) Your postgres-data-volume-path:</label>
<input class="form-control" type="text" name="postgres-data-volume-path" id="postgres-data-volume-path" value="/var/postgres">
<div class="invalid-feedback">
<pre id="postgres-data-volume-path"></pre>
<pre id="postgres-data-volume-path-validation"></pre>
</div>
<label for="restic-repository" class="form-label">(Optional) Your restic-repository:</label>
<input class="form-control" type="text" name="restic-repository" id="restic-repository" value="restic-repository">
<div class="invalid-feedback">
<pre id="restic-repository"></pre>
<pre id="restic-repository-validation"></pre>
</div>
<br>
<label for="issuer" class="form-label">(Optional) Your issuer prod/staging:</label>

View file

@ -7,6 +7,7 @@
(s/def ::fqdn cm/fqdn-string?)
(s/def ::issuer cm/letsencrypt-issuer?)
(s/def ::restic-repository string?)
(s/def ::jira-data-volume-path string?)
#?(:cljs

View file

@ -3,12 +3,13 @@
[clojure.tools.reader.edn :as edn]
[dda.c4k-jira.core :as core]
[dda.c4k-jira.jira :as jira]
[dda.c4k-common.browser :as br]))
[dda.c4k-common.browser :as br]
[dda.c4k-common.postgres :as pgc]))
(defn config-from-document []
(let [jira-data-volume-path (br/get-content-from-element "jira-data-volume-path" :optional true :deserializer keyword)
postgres-data-volume-path (br/get-content-from-element "postgres-data-volume-path" :optional true :deserializer keyword)
restic-repository (br/get-content-from-element "restic-repository" :optional true :deserializer keyword)
(let [jira-data-volume-path (br/get-content-from-element "jira-data-volume-path" :optional true)
postgres-data-volume-path (br/get-content-from-element "postgres-data-volume-path" :optional true)
restic-repository (br/get-content-from-element "restic-repository" :optional true)
issuer (br/get-content-from-element "issuer" :optional true :deserializer keyword)]
(merge
{:fqdn (br/get-content-from-element "fqdn")}
@ -24,9 +25,9 @@
(defn validate-all! []
(br/validate! "fqdn" ::jira/fqdn)
(br/validate! "jira-data-volume-path" ::jira/jira-data-volume-path :optional true :deserializer keyword)
(br/validate! "postgres-data-volume-path" ::jira/jira-data-volume-path :optional true :deserializer keyword)
(br/validate! "restic-repository" ::jira/restic-repository :optional true :deserializer keyword)
(br/validate! "jira-data-volume-path" ::jira/jira-data-volume-path :optional true)
(br/validate! "postgres-data-volume-path" ::pgc/postgres-data-volume-path :optional true)
(br/validate! "restic-repository" ::jira/restic-repository :optional true)
(br/validate! "issuer" ::jira/issuer :optional true :deserializer keyword)
(br/validate! "auth" core/auth? :deserializer edn/read-string)
(br/set-validated!))