expound config on input leave
This commit is contained in:
parent
c91af154ec
commit
79008746e2
2 changed files with 13 additions and 7 deletions
|
@ -26,8 +26,8 @@
|
||||||
(yaml/from-string (yaml/load-resource "deployment.yaml"))))
|
(yaml/from-string (yaml/load-resource "deployment.yaml"))))
|
||||||
|
|
||||||
(defn-spec generate any?
|
(defn-spec generate any?
|
||||||
[my-config ::config
|
[my-config string?
|
||||||
my-auth cd/auth?]
|
my-auth string?]
|
||||||
(cs/join "\n"
|
(cs/join "\n"
|
||||||
[(yaml/to-string (generate-config my-config my-auth))
|
[(yaml/to-string (generate-config my-config my-auth))
|
||||||
"---"
|
"---"
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
(ns dda.k8s-mastodon-bot.browser
|
(ns dda.k8s-mastodon-bot.browser
|
||||||
(:require
|
(:require
|
||||||
[clojure.spec.alpha :as s]
|
[clojure.tools.reader.edn :as edn]
|
||||||
|
[expound.alpha :as expound]
|
||||||
[dda.k8s-mastodon-bot.core :as core]))
|
[dda.k8s-mastodon-bot.core :as core]))
|
||||||
|
|
||||||
(defn config-from-document []
|
(defn config-from-document []
|
||||||
|
@ -20,16 +21,21 @@
|
||||||
(.-value)
|
(.-value)
|
||||||
(set! input)))
|
(set! input)))
|
||||||
|
|
||||||
|
(defn expound-config
|
||||||
|
[config]
|
||||||
|
(expound/expound ::core/config config))
|
||||||
|
|
||||||
(defn init []
|
(defn init []
|
||||||
(-> js/document
|
(-> js/document
|
||||||
(.getElementById "generate-button")
|
(.getElementById "generate-button")
|
||||||
(.addEventListener "click"
|
(.addEventListener "click"
|
||||||
#(-> (core/generate (config-from-document) (auth-from-document))
|
#(-> (core/generate (config-from-document) (auth-from-document))
|
||||||
(render-output-to-document)
|
(render-output-to-document))))
|
||||||
(print "1"))))
|
|
||||||
(-> js/document
|
(-> js/document
|
||||||
(.getElementById "config")
|
(.getElementById "config")
|
||||||
(.addEventListener "blur"
|
(.addEventListener "blur"
|
||||||
#(-> (s/explain ::core/config (config-from-document))
|
#(-> (config-from-document)
|
||||||
|
(edn/read-string)
|
||||||
|
(expound-config)
|
||||||
(print))))
|
(print))))
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue