diff --git a/public/index.html b/public/index.html index 6a4ed4a..fa0304d 100644 --- a/public/index.html +++ b/public/index.html @@ -11,7 +11,6 @@ -
diff --git a/shadow-cljs.edn b/shadow-cljs.edn index acc2ef0..0137c85 100644 --- a/shadow-cljs.edn +++ b/shadow-cljs.edn @@ -4,7 +4,7 @@ "src/test/cljc" "src/test/cljs" "src/test/resources"] - :dependencies [[org.domaindrivenarchitecture/c4k-common-cljs "0.4.0"] + :dependencies [[org.domaindrivenarchitecture/c4k-common-cljs "0.4.2"] [hickory "0.7.1"]] :builds {:frontend {:target :browser :modules {:main {:init-fn dda.c4k-jira.browser/init}} diff --git a/src/main/cljs/dda/c4k_jira/browser.cljs b/src/main/cljs/dda/c4k_jira/browser.cljs index cdbe3cd..711a3f4 100644 --- a/src/main/cljs/dda/c4k_jira/browser.cljs +++ b/src/main/cljs/dda/c4k_jira/browser.cljs @@ -9,26 +9,25 @@ (defn generate-content [] (into [] (concat [(assoc (br/generate-needs-validation) :content - (into [] (concat (br/generate-input-field "fqdn" "Your fqdn:" "jira-neu.prod.meissa-gmbh.de" "dda.c4k_jira.browser") - (br/generate-input-field "jira-data-volume-path" "(Optional) Your jira-data-volume-path:" "/var/jira" "dda.c4k_jira.browser") - (br/generate-input-field "postgres-data-volume-path" "(Optional) Your postgres-data-volume-path:" "/var/postgres" "dda.c4k_jira.browser") - (br/generate-input-field "restic-repository" "(Optional) Your restic-repository:" "restic-repository" "dda.c4k_jira.browser") - (br/generate-input-field "issuer" "(Optional) Your issuer prod/staging:" "" "dda.c4k_jira.browser") + (into [] (concat (br/generate-input-field "fqdn" "Your fqdn:" "jira-neu.prod.meissa-gmbh.de") + (br/generate-input-field "jira-data-volume-path" "(Optional) Your jira-data-volume-path:" "/var/jira") + (br/generate-input-field "postgres-data-volume-path" "(Optional) Your postgres-data-volume-path:" "/var/postgres") + (br/generate-input-field "restic-repository" "(Optional) Your restic-repository:" "restic-repository") + (br/generate-input-field "issuer" "(Optional) Your issuer prod/staging:" "") [(br/generate-br)] (br/generate-text-area "auth" "Your auth.edn:" "{:postgres-db-user \"jira\" :postgres-db-password \"jira-db-password\" :aws-access-key-id \"aws-id\" :aws-secret-access-key \"aws-secret\" :restic-password \"restic-password\"}" - "5" "dda.c4k_jira.browser") + "5") [(br/generate-br)] (br/generate-button "generate-button" "Generate c4k yaml"))))] (br/generate-output "c4k-keycloak-output" "Your c4k deployment.yaml:" "25")))) -(defn generate-container-jumbotron +(defn generate-content-div [] {:type :element - :attrs {:class "container jumbotron"} :tag :div :content (generate-content)}) @@ -59,13 +58,24 @@ (br/validate! "auth" core/auth? :deserializer edn/read-string) (br/set-validated!)) +(defn add-validate-listener [name] + (-> (br/get-element-by-id name) + (.addEventListener "blur" #(do (validate-all!))))) + + (defn init [] - (br/replace-element-content "app" (generate-container-jumbotron)) + (br/append-hickory (generate-content-div)) (-> js/document (.getElementById "generate-button") (.addEventListener "click" #(do (validate-all!) - (-> (core/generate - (config-from-document) + (-> (core/generate + (config-from-document) (br/get-content-from-element "auth" :deserializer edn/read-string)) - (br/set-output!)))))) \ No newline at end of file + (br/set-output!))))) + (add-validate-listener "fqdn") + (add-validate-listener "jira-data-volume-path") + (add-validate-listener "postgres-data-volume-path") + (add-validate-listener "restic-repository") + (add-validate-listener "issuer") + (add-validate-listener "auth")) \ No newline at end of file