bind generate to button

This commit is contained in:
jem 2021-02-26 17:32:34 +01:00
parent 42a08c3c7f
commit 2f2ac79ece
3 changed files with 8 additions and 3 deletions

View file

@ -54,7 +54,7 @@
:token "XXXX" :token "XXXX"
:token_secret "XXXX"}}} :token_secret "XXXX"}}}
</textarea><br><br> </textarea><br><br>
<button type="button" onclick="generate()">Generate k8s yaml</button> <button type="button" id="generate-button">Generate k8s yaml</button>
</div> </div>
<div id="k8s-mastodon-bot-output"> <div id="k8s-mastodon-bot-output">
<label for="output">Your k8s deployment.yaml:</label> <label for="output">Your k8s deployment.yaml:</label>

View file

@ -6,7 +6,7 @@
[expound "0.8.4"]] [expound "0.8.4"]]
:dev-http {8080 "public"} :dev-http {8080 "public"}
:builds {:frontend {:target :browser :builds {:frontend {:target :browser
:modules {:main {:init-fn dda.k8s-mastodon-bot.browser/generate}} :modules {:main {:init-fn dda.k8s-mastodon-bot.browser/init}}
:release {}} :release {}}
:app {:target :node-script :app {:target :node-script
:output-to "target/k8s-mastodon-bot.js" :output-to "target/k8s-mastodon-bot.js"

View file

@ -22,3 +22,8 @@
(defn generate [] (defn generate []
(-> (dda.k8s-mastodon-bot.core/generate (config-from-document) (auth-from-document)) (-> (dda.k8s-mastodon-bot.core/generate (config-from-document) (auth-from-document))
(render-to-document))) (render-to-document)))
(defn init []
(-> js/document
(.getElementById "generate-button")
(.onclick generate)))