diff options
| author | ckonstanski <carlos.konstanski@olo.com> | 2025-12-18 15:03:55 -0700 |
|---|---|---|
| committer | ckonstanski <carlos.konstanski@olo.com> | 2025-12-18 15:03:55 -0700 |
| commit | 116554ad7fe82bf7df08be4ee8732e306eac38f1 (patch) | |
| tree | 773fc30be41d96badcaecfe6cff999f611014207 /lisp/webapps/snow/clojurescript | |
| parent | e7268f15f90251933edb07df2366bc40e1bc1fb5 (diff) | |
[INF-18465] Create an unhealthy targetgroup report
Diffstat (limited to 'lisp/webapps/snow/clojurescript')
| -rw-r--r-- | lisp/webapps/snow/clojurescript/snow/src/core.cljs | 67 |
1 files changed, 67 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)) |
