added hickory dep, started refactor for html
This commit is contained in:
parent
2804fd9b15
commit
1f77840be9
3 changed files with 68 additions and 3 deletions
|
@ -5,7 +5,8 @@
|
||||||
:url "https://www.apache.org/licenses/LICENSE-2.0.html"}
|
:url "https://www.apache.org/licenses/LICENSE-2.0.html"}
|
||||||
:dependencies [[org.clojure/clojure "1.10.3"]
|
:dependencies [[org.clojure/clojure "1.10.3"]
|
||||||
[org.clojure/tools.reader "1.3.4"]
|
[org.clojure/tools.reader "1.3.4"]
|
||||||
[org.domaindrivenarchitecture/c4k-common-clj "0.2.8"]]
|
[org.domaindrivenarchitecture/c4k-common-clj "0.2.8"]
|
||||||
|
[hickory "0.7.1"]]
|
||||||
:target-path "target/%s/"
|
:target-path "target/%s/"
|
||||||
:source-paths ["src/main/cljc"
|
:source-paths ["src/main/cljc"
|
||||||
"src/main/clj"]
|
"src/main/clj"]
|
||||||
|
|
|
@ -4,7 +4,8 @@
|
||||||
"src/test/cljc"
|
"src/test/cljc"
|
||||||
"src/test/cljs"
|
"src/test/cljs"
|
||||||
"src/test/resources"]
|
"src/test/resources"]
|
||||||
:dependencies [[org.domaindrivenarchitecture/c4k-common-cljs "0.2.8"]]
|
:dependencies [[org.domaindrivenarchitecture/c4k-common-cljs "0.2.8"]
|
||||||
|
[hickory "0.7.1"]]
|
||||||
:builds {:frontend {:target :browser
|
:builds {:frontend {:target :browser
|
||||||
:modules {:main {:init-fn dda.c4k-jira.browser/init}}
|
:modules {:main {:init-fn dda.c4k-jira.browser/init}}
|
||||||
:release {}
|
:release {}
|
||||||
|
|
|
@ -7,7 +7,10 @@
|
||||||
[dda.c4k-common.yaml :as yaml]
|
[dda.c4k-common.yaml :as yaml]
|
||||||
[dda.c4k-common.postgres :as postgres]
|
[dda.c4k-common.postgres :as postgres]
|
||||||
[dda.c4k-jira.jira :as jira]
|
[dda.c4k-jira.jira :as jira]
|
||||||
[dda.c4k-jira.backup :as backup]))
|
[dda.c4k-jira.backup :as backup]
|
||||||
|
[clojure.zip :as zip]
|
||||||
|
[hickory.core :as hc]
|
||||||
|
[hickory.zip :as hz]))
|
||||||
|
|
||||||
(def config-defaults {:issuer :staging})
|
(def config-defaults {:issuer :staging})
|
||||||
|
|
||||||
|
@ -19,6 +22,66 @@
|
||||||
::aws-access-key-id ::aws-secret-access-key
|
::aws-access-key-id ::aws-secret-access-key
|
||||||
::restic-password]))
|
::restic-password]))
|
||||||
|
|
||||||
|
; START OF HTML EDIT REFACTOR
|
||||||
|
; TODO: Move this to somewhere in commons
|
||||||
|
|
||||||
|
(def htest (hz/hickory-zip (hc/as-hickory (hc/parse (clojure.core/slurp "public/index.html")))))
|
||||||
|
|
||||||
|
(defn-spec generate-feedback-tag map?
|
||||||
|
[id string?]
|
||||||
|
{:type :element :attrs {:class "invalid-feedback"} :tag :div :content [{:type :element :attrs {:id (str id "-validation")} :tag :pre :content "nil"}]})
|
||||||
|
|
||||||
|
(defn-spec generate-label map?
|
||||||
|
[id-for string?
|
||||||
|
label string?]
|
||||||
|
{:type :element :attrs {:for id-for :class "form-label"} :tag :label :content [label]})
|
||||||
|
|
||||||
|
(defn-spec generate-input-field vector?
|
||||||
|
[id string?
|
||||||
|
label string?
|
||||||
|
default-value string?]
|
||||||
|
[(generate-label id label)
|
||||||
|
{:type :element :attrs {:class "form-control" :type "text" :name id :value default-value} :tag :input :content "nil"}
|
||||||
|
(generate-feedback-tag id)])
|
||||||
|
|
||||||
|
(defn-spec generate-text-area vector?
|
||||||
|
[id string?
|
||||||
|
label string?
|
||||||
|
default-value string?
|
||||||
|
rows int?]
|
||||||
|
[(generate-label id label)
|
||||||
|
{:type :element :attrs {:name id :id id :class "form-control" :rows rows} :tag :textarea :content default-value}
|
||||||
|
(generate-feedback-tag id)])
|
||||||
|
|
||||||
|
; TODO: add br tags
|
||||||
|
; TODO: add generate button
|
||||||
|
; TODO: add output text-area
|
||||||
|
(defn generate-content
|
||||||
|
[]
|
||||||
|
(conj (generate-input-field "fqdn" "Your fqdn:" "jira-neu.prod.meissa-gmbh.de")
|
||||||
|
(generate-input-field "jira-data-volume-path" "(Optional) Your jira-data-volume-path:" "/var/jira")
|
||||||
|
(generate-input-field "postgres-data-volume-path" "(Optional) Your postgres-data-volume-path:" "/var/postgres")
|
||||||
|
(generate-input-field "restic-repository" "(Optional) Your restic-repository:" "restic-repository")
|
||||||
|
(generate-input-field "issuer" "(Optional) Your issuer prod/staging:" "")
|
||||||
|
(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)))
|
||||||
|
|
||||||
|
(defn find-map
|
||||||
|
[zipper]
|
||||||
|
(if (and (not (zip/end? zipper))
|
||||||
|
(map? (zip/node zipper))
|
||||||
|
(= (:class (:attrs (zip/node zipper))) "needs-validation"))
|
||||||
|
;replace instead of print later
|
||||||
|
(println (assoc (zip/node zipper) :content (generate-content)))
|
||||||
|
nil)
|
||||||
|
(find-map (zip/next zipper)))
|
||||||
|
|
||||||
|
; END REFACTOR
|
||||||
|
|
||||||
(defn k8s-objects [config]
|
(defn k8s-objects [config]
|
||||||
(into
|
(into
|
||||||
[]
|
[]
|
||||||
|
|
Reference in a new issue