summaryrefslogtreecommitdiff
path: root/lisp/webapps
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/webapps')
-rw-r--r--lisp/webapps/snow/clojurescript/snow/src/core.cljs102
-rw-r--r--lisp/webapps/snow/site.lisp20
2 files changed, 118 insertions, 4 deletions
diff --git a/lisp/webapps/snow/clojurescript/snow/src/core.cljs b/lisp/webapps/snow/clojurescript/snow/src/core.cljs
index c2078af..31df968 100644
--- a/lisp/webapps/snow/clojurescript/snow/src/core.cljs
+++ b/lisp/webapps/snow/clojurescript/snow/src/core.cljs
@@ -124,6 +124,20 @@
(declare template-octopus-latest-deployments-results)
(declare handler-octopus-latest-deployments-results)
(declare render-octopus-latest-deployments-results)
+(declare template-octopus-qrs-lsrs-redeploy)
+(declare handler-octopus-qrs-lsrs-redeploy)
+(declare render-octopus-qrs-lsrs-redeploy)
+(declare template-octopus-qrs-lsrs-redeploy-view)
+(declare handler-octopus-qrs-lsrs-redeploy-view)
+(declare render-octopus-qrs-lsrs-redeploy-view)
+(declare on-octopus-qrs-lsrs-redeploy-results-clicked)
+(declare template-octopus-qrs-lsrs-redeploy-results)
+(declare handler-octopus-qrs-lsrs-redeploy-results)
+(declare render-octopus-qrs-lsrs-redeploy-results)
+(declare on-octopus-qrs-lsrs-redeploy-results-submit-clicked)
+(declare template-octopus-qrs-lsrs-redeploy-results-submit)
+(declare handler-octopus-qrs-lsrs-redeploy-results-submit)
+(declare render-octopus-qrs-lsrs-redeploy-results-submit)
(declare on-menu-clicked)
(declare handler-location)
(declare goto-location)
@@ -687,6 +701,7 @@
(hiccups/defhtml template-octopus-latest-deployments [jsonobj]
[:h3 {:style "text-align: center"} "Find the latest octopus deployments in each environment."]
[:h5 {:style "text-align: center"} "Assumes that you have the <code>OLO_AWS_BUILD_PROFILE</code> environment variable set with the name of your build profile."]
+ [:h5 {:style "text-align: center"} "For all enviroments and projects please specify `all` for the filters."]
[:div {:id "content"}]
[:div {:id "results"}])
@@ -731,9 +746,91 @@
(defn render-octopus-latest-deployments-results []
(POST "/octopus-latest-deployments/results" {:format :raw
- :params {:ode_only_p (.-checked (dommy/sel1 :#ode_only_p))}
+ :params {:ode_only_p (.-checked (dommy/sel1 :#ode_only_p))
+ :environment (dommy/value (dommy/sel1 :#environment))
+ :project (dommy/value (dommy/sel1 :#project))}
:handler handler-octopus-latest-deployments-results}))
+;; octopus-qrs-lsrs-redeploy
+
+(hiccups/defhtml template-octopus-qrs-lsrs-redeploy [jsonobj]
+ [:h3 {:style "text-align: center"} "Redeploy Queue Retry Service and Log Streaming Retry Service to a single target in the specified environment."]
+ [:h5 {:style "text-align: center"} "The target will be chosen at random. The purpose of this tool is to clear the octopus deployment log. For this purpose the choice of target is unimportant."]
+ [:div {:id "content"}]
+ [:div {:id "results-submit-ack"}]
+ [:div {:id "results-submit"}]
+ [:div {:id "results"}])
+
+(defn handler-octopus-qrs-lsrs-redeploy [response]
+ (let [jsonobj (js->clj (js/JSON.parse response))]
+ (notifications jsonobj)
+ (dommy/set-html! (dommy/sel1 :#body) (template-octopus-qrs-lsrs-redeploy jsonobj))
+ (render-octopus-qrs-lsrs-redeploy-view)))
+
+(defn render-octopus-qrs-lsrs-redeploy []
+ (GET "/octopus-qrs-lsrs-redeploy" {:handler handler-octopus-qrs-lsrs-redeploy}))
+
+;; octopus-qrs-lsrs-redeploy-view
+
+(hiccups/defhtml template-octopus-qrs-lsrs-redeploy-view [jsonobj]
+ (ck-form/template-generic-form (get jsonobj "form") (namespace ::x)))
+
+(defn handler-octopus-qrs-lsrs-redeploy-view [response]
+ (let [jsonobj (js->clj (js/JSON.parse response))]
+ (notifications jsonobj)
+ (dommy/set-html! (dommy/sel1 :#content) (template-octopus-qrs-lsrs-redeploy-view jsonobj))))
+
+(defn render-octopus-qrs-lsrs-redeploy-view []
+ (GET "/octopus-qrs-lsrs-redeploy/view" {:handler handler-octopus-qrs-lsrs-redeploy-view}))
+
+;; octopus-qrs-lsrs-redeploy-results
+
+(defn on-octopus-qrs-lsrs-redeploy-results-clicked []
+ (when (-> (jquery "#octopus-qrs-lsrs-redeploy-form")
+ (.get "0")
+ (.checkValidity))
+ (dommy/set-html! (dommy/sel1 :#results) (template-generic-wait))
+ (dommy/set-html! (dommy/sel1 :#results-submit) "")
+ (dommy/set-html! (dommy/sel1 :#results-submit-ack) "")
+ (render-octopus-qrs-lsrs-redeploy-results)))
+
+(hiccups/defhtml template-octopus-qrs-lsrs-redeploy-results-form [jsonobj]
+ (ck-form/template-generic-form (get jsonobj "form") (namespace ::x)))
+
+(hiccups/defhtml template-octopus-qrs-lsrs-redeploy-results [jsonobj]
+ (generic-table jsonobj true))
+
+(defn handler-octopus-qrs-lsrs-redeploy-results [response]
+ (let [jsonobj (js->clj (js/JSON.parse response))]
+ (notifications jsonobj)
+ (dommy/set-html! (dommy/sel1 :#results) (template-octopus-qrs-lsrs-redeploy-results jsonobj))
+ (when (not (empty? (get jsonobj "results")))
+ (dommy/set-html! (dommy/sel1 :#results-submit) (template-octopus-qrs-lsrs-redeploy-results-form jsonobj)))))
+
+(defn render-octopus-qrs-lsrs-redeploy-results []
+ (POST "/octopus-qrs-lsrs-redeploy/results" {:format :raw
+ :params {:environment (dommy/value (dommy/sel1 :#environment))}
+ :handler handler-octopus-qrs-lsrs-redeploy-results}))
+
+;; octopus-qrs-lsrs-redeploy-results-submit
+
+(defn on-octopus-qrs-lsrs-redeploy-results-submit-clicked []
+ (dommy/set-html! (dommy/sel1 :#results-submit-ack) (template-generic-wait))
+ (render-octopus-qrs-lsrs-redeploy-results-submit))
+
+(hiccups/defhtml template-octopus-qrs-lsrs-redeploy-results-submit [jsonobj]
+ [:h5 {:style "text-align: center"}
+ "Process started in background. See the output at " [:code (get jsonobj "stdout")]])
+
+(defn handler-octopus-qrs-lsrs-redeploy-results-submit [response]
+ (let [jsonobj (js->clj (js/JSON.parse response))]
+ (notifications jsonobj)
+ (dommy/set-html! (dommy/sel1 :#results-submit) "")
+ (dommy/set-html! (dommy/sel1 :#results-submit-ack) (template-octopus-qrs-lsrs-redeploy-results-submit jsonobj))))
+
+(defn render-octopus-qrs-lsrs-redeploy-results-submit []
+ (POST "/octopus-qrs-lsrs-redeploy/results/submit" {:handler handler-octopus-qrs-lsrs-redeploy-results-submit}))
+
;; location
(defn on-menu-clicked [handler]
@@ -748,7 +845,8 @@
(cond (= handler "/octopus-environments-with-roles") (render-octopus-environments-with-roles))
(cond (= handler "/octopus-projects-with-roles") (render-octopus-projects-with-roles))
(cond (= handler "/octopus-ode-deploy-release") (render-octopus-ode-deploy-release))
- (cond (= handler "/octopus-latest-deployments") (render-octopus-latest-deployments)))
+ (cond (= handler "/octopus-latest-deployments") (render-octopus-latest-deployments))
+ (cond (= handler "/octopus-qrs-lsrs-redeploy") (render-octopus-qrs-lsrs-redeploy)))
(defn handler-location [response]
(let [jsonobj (js->clj (js/JSON.parse response))]
diff --git a/lisp/webapps/snow/site.lisp b/lisp/webapps/snow/site.lisp
index d1091ad..a640e9a 100644
--- a/lisp/webapps/snow/site.lisp
+++ b/lisp/webapps/snow/site.lisp
@@ -132,7 +132,19 @@
`(octopus-latest-deployments-view-json))
(defmacro .octopus-latest-deployments-results ()
- `(octopus-latest-deployments-results-json ode_only_p))
+ `(octopus-latest-deployments-results-json ode_only_p environment project))
+
+(defmacro .octopus-qrs-lsrs-redeploy ()
+ `(octopus-qrs-lsrs-redeploy-json))
+
+(defmacro .octopus-qrs-lsrs-redeploy-view ()
+ `(octopus-qrs-lsrs-redeploy-view-json))
+
+(defmacro .octopus-qrs-lsrs-redeploy-results ()
+ `(octopus-qrs-lsrs-redeploy-results-json environment))
+
+(defmacro .octopus-qrs-lsrs-redeploy-results-submit ()
+ `(octopus-qrs-lsrs-redeploy-results-submit-json))
(define-endpoint :get "/" () .base)
(define-endpoint :post "/location" ((location :parameter-type 'string)) .location)
@@ -167,4 +179,8 @@
(define-endpoint :post "/octopus-ode-deploy-release/results" ((project_name :parameter-type 'string) (version :parameter-type 'string) (ode_names :parameter-type 'string)) .octopus-ode-deploy-release-results)
(define-endpoint :get "/octopus-latest-deployments" () .octopus-latest-deployments)
(define-endpoint :get "/octopus-latest-deployments/view" () .octopus-latest-deployments-view)
-(define-endpoint :post "/octopus-latest-deployments/results" ((ode_only_p :parameter-type 'string)) .octopus-latest-deployments-results)
+(define-endpoint :post "/octopus-latest-deployments/results" ((ode_only_p :parameter-type 'string) (environment :parameter-type 'string) (project :parameter-type 'string)) .octopus-latest-deployments-results)
+(define-endpoint :get "/octopus-qrs-lsrs-redeploy" () .octopus-qrs-lsrs-redeploy)
+(define-endpoint :get "/octopus-qrs-lsrs-redeploy/view" () .octopus-qrs-lsrs-redeploy-view)
+(define-endpoint :post "/octopus-qrs-lsrs-redeploy/results" ((environment :parameter-type 'string)) .octopus-qrs-lsrs-redeploy-results)
+(define-endpoint :post "/octopus-qrs-lsrs-redeploy/results/submit" () .octopus-qrs-lsrs-redeploy-results-submit)