grouped inputs
This commit is contained in:
parent
6b6488595d
commit
2d3e097703
2 changed files with 46 additions and 35 deletions
|
@ -6,40 +6,40 @@
|
||||||
[dda.c4k-common.browser :as br]
|
[dda.c4k-common.browser :as br]
|
||||||
[dda.c4k-common.postgres :as pgc]))
|
[dda.c4k-common.postgres :as pgc]))
|
||||||
|
|
||||||
|
;; TODO: Move these fkt up to common
|
||||||
|
(defn concat-vec [& vs]
|
||||||
|
(into []
|
||||||
|
(apply concat vs)))
|
||||||
|
|
||||||
(defn generate-group
|
(defn generate-group
|
||||||
[name
|
[name
|
||||||
content]
|
content]
|
||||||
{:type :element
|
{:type :element
|
||||||
:tag :div
|
:tag :div
|
||||||
:attrs {:class "rounded border border-3 m-2 p-2"}
|
:attrs {:class "rounded border border-3 m-3 p-2"}
|
||||||
:content [{:type :element
|
:content [{:type :element
|
||||||
|
:tag :b
|
||||||
|
:attrs {:style "z-index: 1; position: relative; top: -1.3rem;"}
|
||||||
|
:content name}
|
||||||
|
{:type :element
|
||||||
:tag :fieldset
|
:tag :fieldset
|
||||||
:content
|
:content content}]})
|
||||||
content}]})
|
|
||||||
|
|
||||||
(defn generate-content
|
(defn generate-content []
|
||||||
[]
|
(concat-vec
|
||||||
(into
|
|
||||||
[]
|
|
||||||
(concat
|
|
||||||
[(assoc
|
[(assoc
|
||||||
(br/generate-needs-validation) :content
|
(br/generate-needs-validation) :content
|
||||||
(into
|
(concat-vec
|
||||||
[]
|
|
||||||
(concat
|
|
||||||
[(generate-group
|
[(generate-group
|
||||||
"domain"
|
"domain"
|
||||||
(into
|
(concat-vec
|
||||||
[]
|
|
||||||
(concat
|
|
||||||
(br/generate-input-field "fqdn" "Your fqdn:" "shynet.prod.meissa-gmbh.de")
|
(br/generate-input-field "fqdn" "Your fqdn:" "shynet.prod.meissa-gmbh.de")
|
||||||
(br/generate-input-field "issuer" "(Optional) Your issuer prod/staging:" ""))))
|
(br/generate-input-field "issuer" "(Optional) Your issuer prod/staging:" "")))
|
||||||
(generate-group
|
(generate-group
|
||||||
"provider"
|
"provider"
|
||||||
(into
|
(concat-vec
|
||||||
[]
|
(br/generate-input-field "ingress-type" "(Optional) Your ingress type (traefik/ngingx):" "traefik")
|
||||||
(concat
|
(br/generate-input-field "postgres-data-volume-path" "(Optional) Your postgres-data-volume-path:" "/var/postgres")))
|
||||||
(br/generate-input-field "postgres-data-volume-path" "(Optional) Your postgres-data-volume-path:" "/var/postgres"))))
|
|
||||||
(generate-group
|
(generate-group
|
||||||
"credentials"
|
"credentials"
|
||||||
(br/generate-text-area
|
(br/generate-text-area
|
||||||
|
@ -49,8 +49,8 @@
|
||||||
:django-secret-key \"djangosecretkey\"}"
|
:django-secret-key \"djangosecretkey\"}"
|
||||||
"5"))]
|
"5"))]
|
||||||
[(br/generate-br)]
|
[(br/generate-br)]
|
||||||
(br/generate-button "generate-button" "Generate c4k yaml"))))]
|
(br/generate-button "generate-button" "Generate c4k yaml")))]
|
||||||
(br/generate-output "c4k-shynet-output" "Your c4k deployment.yaml:" "25"))))
|
(br/generate-output "c4k-shynet-output" "Your c4k deployment.yaml:" "25")))
|
||||||
|
|
||||||
(defn generate-content-div
|
(defn generate-content-div
|
||||||
[]
|
[]
|
||||||
|
|
11
src/test/cljc/dda/c4k_shynet/browser_test.cljc
Normal file
11
src/test/cljc/dda/c4k_shynet/browser_test.cljc
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
(ns dda.c4k-shynet.browser-test
|
||||||
|
(:require
|
||||||
|
#?(:clj [clojure.test :refer [deftest is are testing run-tests]]
|
||||||
|
:cljs [cljs.test :refer-macros [deftest is are testing run-tests]])
|
||||||
|
[hickory.render :as hr]
|
||||||
|
[dda.c4k-shynet.browser :as cut]))
|
||||||
|
|
||||||
|
(deftest should-generate-group
|
||||||
|
(is (= "<div class=\"rounded border border-3 m-3 p-2\"><b style=\"z-index: 1; position: relative; top: -1.3rem;\">id1</b><fieldset>content</fieldset></div>"
|
||||||
|
(hr/hickory-to-html
|
||||||
|
(cut/generate-group "id1" "content")))))
|
Loading…
Reference in a new issue