This commit is contained in:
jem 2021-03-19 14:26:32 +01:00
parent 122a7ddee7
commit 7a6f31b96a

View file

@ -1,6 +1,7 @@
(ns dda.k8s-mastodon-bot.browser
(:require
[clojure.string :as st]
[clojure.spec.alpha :as s]
[clojure.tools.reader.edn :as edn]
[expound.alpha :as expound]
[dda.k8s-mastodon-bot.core :as core]))
@ -40,13 +41,13 @@
(.-value)
(set! input)))
(defn expound-config
[config]
(st/replace
(expound/expound-str ::core/config config {:print-specs? false})
#"\n" "<br>"))
(defn validate-config! []
(let [config (config-from-document)]
(when-not (s/valid? ::core/config config)
(-> config
(edn/read-string)
#(expound/expound-str ::core/config % {:print-specs? false})
(render-validation-result-to-config)))))
(defn render-validation-result-to-config
[validation-result]
@ -67,9 +68,4 @@
(set-output!))))
(-> (config)
(.addEventListener "blur"
#(-> (config-from-document)
(edn/read-string)
(expound-config)
(print-debug)
(render-validation-result-to-config))))
)
#(validate-config!))))