Fixed frontend validation
This commit is contained in:
parent
120965b8e2
commit
05f72c953e
3 changed files with 11 additions and 9 deletions
|
@ -26,12 +26,12 @@
|
||||||
<label for="postgres-data-volume-path" class="form-label">(Optional) Your postgres-data-volume-path:</label>
|
<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">
|
<input class="form-control" type="text" name="postgres-data-volume-path" id="postgres-data-volume-path" value="/var/postgres">
|
||||||
<div class="invalid-feedback">
|
<div class="invalid-feedback">
|
||||||
<pre id="postgres-data-volume-path"></pre>
|
<pre id="postgres-data-volume-path-validation"></pre>
|
||||||
</div>
|
</div>
|
||||||
<label for="restic-repository" class="form-label">(Optional) Your restic-repository:</label>
|
<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">
|
<input class="form-control" type="text" name="restic-repository" id="restic-repository" value="restic-repository">
|
||||||
<div class="invalid-feedback">
|
<div class="invalid-feedback">
|
||||||
<pre id="restic-repository"></pre>
|
<pre id="restic-repository-validation"></pre>
|
||||||
</div>
|
</div>
|
||||||
<br>
|
<br>
|
||||||
<label for="issuer" class="form-label">(Optional) Your issuer prod/staging:</label>
|
<label for="issuer" class="form-label">(Optional) Your issuer prod/staging:</label>
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
|
|
||||||
(s/def ::fqdn cm/fqdn-string?)
|
(s/def ::fqdn cm/fqdn-string?)
|
||||||
(s/def ::issuer cm/letsencrypt-issuer?)
|
(s/def ::issuer cm/letsencrypt-issuer?)
|
||||||
|
(s/def ::restic-repository string?)
|
||||||
(s/def ::jira-data-volume-path string?)
|
(s/def ::jira-data-volume-path string?)
|
||||||
|
|
||||||
#?(:cljs
|
#?(:cljs
|
||||||
|
|
|
@ -3,12 +3,13 @@
|
||||||
[clojure.tools.reader.edn :as edn]
|
[clojure.tools.reader.edn :as edn]
|
||||||
[dda.c4k-jira.core :as core]
|
[dda.c4k-jira.core :as core]
|
||||||
[dda.c4k-jira.jira :as jira]
|
[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 []
|
(defn config-from-document []
|
||||||
(let [jira-data-volume-path (br/get-content-from-element "jira-data-volume-path" :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 :deserializer keyword)
|
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 :deserializer keyword)
|
restic-repository (br/get-content-from-element "restic-repository" :optional true)
|
||||||
issuer (br/get-content-from-element "issuer" :optional true :deserializer keyword)]
|
issuer (br/get-content-from-element "issuer" :optional true :deserializer keyword)]
|
||||||
(merge
|
(merge
|
||||||
{:fqdn (br/get-content-from-element "fqdn")}
|
{:fqdn (br/get-content-from-element "fqdn")}
|
||||||
|
@ -24,9 +25,9 @@
|
||||||
|
|
||||||
(defn validate-all! []
|
(defn validate-all! []
|
||||||
(br/validate! "fqdn" ::jira/fqdn)
|
(br/validate! "fqdn" ::jira/fqdn)
|
||||||
(br/validate! "jira-data-volume-path" ::jira/jira-data-volume-path :optional true :deserializer keyword)
|
(br/validate! "jira-data-volume-path" ::jira/jira-data-volume-path :optional true)
|
||||||
(br/validate! "postgres-data-volume-path" ::jira/jira-data-volume-path :optional true :deserializer keyword)
|
(br/validate! "postgres-data-volume-path" ::pgc/postgres-data-volume-path :optional true)
|
||||||
(br/validate! "restic-repository" ::jira/restic-repository :optional true :deserializer keyword)
|
(br/validate! "restic-repository" ::jira/restic-repository :optional true)
|
||||||
(br/validate! "issuer" ::jira/issuer :optional true :deserializer keyword)
|
(br/validate! "issuer" ::jira/issuer :optional true :deserializer keyword)
|
||||||
(br/validate! "auth" core/auth? :deserializer edn/read-string)
|
(br/validate! "auth" core/auth? :deserializer edn/read-string)
|
||||||
(br/set-validated!))
|
(br/set-validated!))
|
||||||
|
|
Reference in a new issue