summaryrefslogtreecommitdiff
path: root/lisp/webapps/snow
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/webapps/snow')
-rw-r--r--lisp/webapps/snow/clojurescript/snow/src/core.cljs67
-rw-r--r--lisp/webapps/snow/site.lisp12
2 files changed, 79 insertions, 0 deletions
diff --git a/lisp/webapps/snow/clojurescript/snow/src/core.cljs b/lisp/webapps/snow/clojurescript/snow/src/core.cljs
index 304e5ec..922df5a 100644
--- a/lisp/webapps/snow/clojurescript/snow/src/core.cljs
+++ b/lisp/webapps/snow/clojurescript/snow/src/core.cljs
@@ -50,6 +50,16 @@
(declare template-asg-recycle-results-submit)
(declare handler-asg-recycle-results-submit)
(declare render-asg-recycle-results-submit)
+(declare template-unhealthy-targetgroups)
+(declare handler-unhealthy-targetgroups)
+(declare render-unhealthy-targetgroups)
+(declare template-unhealthy-targetgroups-view)
+(declare handler-unhealthy-targetgroups-view)
+(declare render-unhealthy-targetgroups-view)
+(declare on-unhealthy-targetgroups-results-clicked)
+(declare template-unhealthy-targetgroups-results)
+(declare handler-unhealthy-targetgroups-results)
+(declare render-unhealthy-targetgroups-results)
(declare template-tfcloud-apply)
(declare handler-tfcloud-apply)
(declare render-tfcloud-apply)
@@ -247,6 +257,7 @@
(hiccups/defhtml template-asg-recycle [jsonobj]
[:h3 {:style "text-align: center"} "Recycle the ASGs matching the filter."]
+ [:h5 {:style "text-align: center"} "For all ASGs please specify `all` for the filter."]
[:div {:id "content"}]
[:div {:id "results-submit-ack"}]
[:div {:id "results-submit"}]
@@ -325,6 +336,61 @@
:params {:howmany howmany}
:handler handler-asg-recycle-results-submit}))
+;; unhealthy-targetgroups
+
+(hiccups/defhtml template-unhealthy-targetgroups [jsonobj]
+ [:h3 {:style "text-align: center"} "Find all unhealthy targetgroups matching the filter."]
+ [:h5 {:style "text-align: center"} "For all targetgroups please specify `all` for the filter."]
+ [:div {:id "content"}]
+ [:div {:id "results"}])
+
+(defn handler-unhealthy-targetgroups [response]
+ (let [jsonobj (js->clj (js/JSON.parse response))]
+ (notifications jsonobj)
+ (dommy/set-html! (dommy/sel1 :#body) (template-unhealthy-targetgroups jsonobj))
+ (render-unhealthy-targetgroups-view)))
+
+(defn render-unhealthy-targetgroups []
+ (GET "/unhealthy-targetgroups" {:handler handler-unhealthy-targetgroups}))
+
+;; unhealthy-targetgroups-view
+
+(hiccups/defhtml template-unhealthy-targetgroups-view [jsonobj]
+ (ck-form/template-generic-form (get jsonobj "form") (namespace ::x)))
+
+(defn handler-unhealthy-targetgroups-view [response]
+ (let [jsonobj (js->clj (js/JSON.parse response))]
+ (notifications jsonobj)
+ (dommy/set-html! (dommy/sel1 :#content) (template-unhealthy-targetgroups-view jsonobj))))
+
+(defn render-unhealthy-targetgroups-view []
+ (GET "/unhealthy-targetgroups/view" {:handler handler-unhealthy-targetgroups-view}))
+
+;; unhealthy-targetgroups-results
+
+(defn on-unhealthy-targetgroups-results-clicked []
+ (when (-> (jquery "#unhealthy-targetgroups-form")
+ (.get "0")
+ (.checkValidity))
+ (dommy/set-html! (dommy/sel1 :#results) (template-generic-wait))
+ (render-unhealthy-targetgroups-results)))
+
+(hiccups/defhtml template-unhealthy-targetgroups-results [jsonobj]
+ [:h5 {:style "text-align: center"}
+ "Process started in background. See the output at " [:code (get jsonobj "stdout")]])
+
+(defn handler-unhealthy-targetgroups-results [response]
+ (let [jsonobj (js->clj (js/JSON.parse response))]
+ (notifications jsonobj)
+ (dommy/set-html! (dommy/sel1 :#results) (template-unhealthy-targetgroups-results jsonobj))))
+
+(defn render-unhealthy-targetgroups-results []
+ (POST "/unhealthy-targetgroups/results" {:format :raw
+ :params {:profile (dommy/value (dommy/sel1 :#profile))
+ :region (dommy/value (dommy/sel1 :#region))
+ :filter (dommy/value (dommy/sel1 :#filter))}
+ :handler handler-unhealthy-targetgroups-results}))
+
;; tfcloud-apply
(hiccups/defhtml template-tfcloud-apply [jsonobj]
@@ -676,6 +742,7 @@
(cond (= handler "/home") (render-home))
(cond (= handler "/git-update") (render-git-update))
(cond (= handler "/asg-recycle") (render-asg-recycle))
+ (cond (= handler "/unhealthy-targetgroups") (render-unhealthy-targetgroups))
(cond (= handler "/tfcloud-apply") (render-tfcloud-apply))
(cond (= handler "/octopus-machines-with-roles") (render-octopus-machines-with-roles))
(cond (= handler "/octopus-environments-with-roles") (render-octopus-environments-with-roles))
diff --git a/lisp/webapps/snow/site.lisp b/lisp/webapps/snow/site.lisp
index 868a188..d1091ad 100644
--- a/lisp/webapps/snow/site.lisp
+++ b/lisp/webapps/snow/site.lisp
@@ -68,6 +68,15 @@
(defmacro .asg-recycle-results-submit ()
`(asg-recycle-results-submit-json howmany))
+(defmacro .unhealthy-targetgroups ()
+ `(unhealthy-targetgroups-json))
+
+(defmacro .unhealthy-targetgroups-view ()
+ `(unhealthy-targetgroups-view-json))
+
+(defmacro .unhealthy-targetgroups-results ()
+ `(unhealthy-targetgroups-results-json profile region filter))
+
(defmacro .tfcloud-apply ()
`(tfcloud-apply-json))
@@ -137,6 +146,9 @@
(define-endpoint :get "/asg-recycle/view" () .asg-recycle-view)
(define-endpoint :post "/asg-recycle/results" ((profile :parameter-type 'string) (region :parameter-type 'string) (filter :parameter-type 'string)) .asg-recycle-results)
(define-endpoint :post "/asg-recycle/results/submit" ((howmany :parameter-type 'string)) .asg-recycle-results-submit)
+(define-endpoint :get "/unhealthy-targetgroups" () .unhealthy-targetgroups)
+(define-endpoint :get "/unhealthy-targetgroups/view" () .unhealthy-targetgroups-view)
+(define-endpoint :post "/unhealthy-targetgroups/results" ((profile :parameter-type 'string) (region :parameter-type 'string) (filter :parameter-type 'string)) .unhealthy-targetgroups-results)
(define-endpoint :get "/tfcloud-apply" () .tfcloud-apply)
(define-endpoint :get "/tfcloud-apply/view" () .tfcloud-apply-view)
(define-endpoint :post "/tfcloud-apply/results" ((filter :parameter-type 'string)) .tfcloud-apply-results)