summaryrefslogtreecommitdiff
path: root/lisp/webapps/snow/site.lisp
blob: a640e9a3d83498fb43a651fcf1a8913bc4ecd67e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10 -*-
(declaim (optimize (speed 0) (safety 3) (debug 3)))

(in-package :snow)

(defmacro .base (&optional (onload-fn "goto_location('/home')"))
  `(org-ckons-http::html5
    `(html
      (head
       ((meta :name "viewport" :content "width=device-width, initial-scale=1, shrink-to-fit=no"))
       ((meta :charset "utf-8"))
       ((title) ,(title *webapp*))
       ,@(mapcar (lambda (css)
                   `((link :rel "stylesheet" :href ,(getf css :href) :integrity ,(getf css :integrity) :crossorigin ,(getf css :crossorigin))))
                 '((:href "https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.min.css" :integrity "sha384-xOolHFLEh07PJGoPkLv1IbcEPTNtaed2xpHsD9ESMhqIYd0nLMwNLD69Npy4HI+N" :crossorigin "anonymous")
                   (:href "/static/css/stylesheet.css" :crossorigin "anonymous")))
       ,@(mapcar (lambda (js)
                   `((script :type "text/javascript" :src ,(getf js :src) :integrity ,(getf js :integrity) :crossorigin ,(getf js :crossorigin))))
                 '((:src "https://code.jquery.com/jquery-3.7.1.slim.min.js" :integrity "ha256-kmHvs0B+OpCW5GVHUNjv9rOmY0IvSIRcf7zGUDTDQM8=" :crossorigin "anonymous")))
       ((script :type "text/javascript" :src "/cljs-out/dev-main.js")))
      ((body :onload ,(format nil "snow.core.~a" ,onload-fn))
       ((div :class "container-fluid")
        ((div :class "row")
         ((div :class "col") " ")
         ((div :class "col")
          ((div :class "page-header")
           ((h2 :align "center") ,(title *webapp*))))
         ((div :class "col") " "))
        ((div :id "menu" :class "well"))
        ((div :id "location" :style "display: none"))
        ((div :id "errormsg"))
        ((div :id "message"))
        ((div :id "body"))
        ,@(mapcar (lambda (js)
                    `((script :type "text/javascript" :src ,(getf js :src) :integrity ,(getf js :integrity) :crossorigin ,(getf js :crossorigin))))
                  '((:src "https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/js/bootstrap.bundle.min.js" :integrity "sha384-Fy6S3B9q64WdZWQUiU+q4/2Lc9npb8tCaSX9FK7E8HnRr0Jz8D6OP9dO5Vg3Q9ct" :crossorigin "anonymous"))))))))

(defmacro .location ()
  `(location-json location))

(defmacro .home-get ()
  `(home-json))

(defmacro .home-post ()
  `(home-json message errormsg))

(defmacro .menu ()
  `(menu-json))

(defmacro .git-update ()
  `(git-update-json))

(defmacro .git-update-view ()
  `(git-update-view-json))

(defmacro .git-update-results ()
  `(git-update-results-json))

(defmacro .asg-recycle ()
  `(asg-recycle-json))

(defmacro .asg-recycle-view ()
  `(asg-recycle-view-json))

(defmacro .asg-recycle-results ()
  `(asg-recycle-results-json profile region filter))

(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))

(defmacro .tfcloud-apply-view ()
  `(tfcloud-apply-view-json))

(defmacro .tfcloud-apply-results ()
  `(tfcloud-apply-results-json filter))

(defmacro .tfcloud-apply-results-submit ()
  `(tfcloud-apply-results-submit-json))

(defmacro .octopus-machines-with-roles ()
  `(octopus-machines-with-roles-json))

(defmacro .octopus-machines-with-roles-view ()
  `(octopus-machines-with-roles-view-json))

(defmacro .octopus-machines-with-roles-results ()
  `(octopus-machines-with-roles-results-json roles))

(defmacro .octopus-environments-with-roles ()
  `(octopus-environments-with-roles-json))

(defmacro .octopus-environments-with-roles-view ()
  `(octopus-environments-with-roles-view-json))

(defmacro .octopus-environments-with-roles-results ()
  `(octopus-environments-with-roles-results-json ode_only_p roles))

(defmacro .octopus-projects-with-roles ()
  `(octopus-projects-with-roles-json))

(defmacro .octopus-projects-with-roles-view ()
  `(octopus-projects-with-roles-view-json))

(defmacro .octopus-projects-with-roles-results ()
  `(octopus-projects-with-roles-results-json roles))

(defmacro .octopus-ode-deploy-release ()
  `(octopus-ode-deploy-release-json))

(defmacro .octopus-ode-deploy-release-view ()
  `(octopus-ode-deploy-release-view-json))

(defmacro .octopus-ode-deploy-release-results ()
  `(octopus-ode-deploy-release-results-json project_name version ode_names))

(defmacro .octopus-latest-deployments ()
  `(octopus-latest-deployments-json))

(defmacro .octopus-latest-deployments-view ()
  `(octopus-latest-deployments-view-json))

(defmacro .octopus-latest-deployments-results ()
  `(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)
(define-endpoint :get "/home" () .home-get)
(define-endpoint :post "/home" ((message :parameter-type 'string) (errormsg :parameter-type 'string)) .home-post)
(define-endpoint :get "/menu" () .menu)
(define-endpoint :get "/git-update" () .git-update)
(define-endpoint :get "/git-update/view" () .git-update-view)
(define-endpoint :post "/git-update/results" () .git-update-results)
(define-endpoint :get "/asg-recycle" () .asg-recycle)
(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)
(define-endpoint :post "/tfcloud-apply/results/submit" () .tfcloud-apply-results-submit)
(define-endpoint :get "/octopus-machines-with-roles" () .octopus-machines-with-roles)
(define-endpoint :get "/octopus-machines-with-roles/view" () .octopus-machines-with-roles-view)
(define-endpoint :post "/octopus-machines-with-roles/results" ((roles :parameter-type 'string)) .octopus-machines-with-roles-results)
(define-endpoint :get "/octopus-environments-with-roles" () .octopus-environments-with-roles)
(define-endpoint :get "/octopus-environments-with-roles/view" () .octopus-environments-with-roles-view)
(define-endpoint :post "/octopus-environments-with-roles/results" ((ode_only_p :parameter-type 'string) (roles :parameter-type 'string)) .octopus-environments-with-roles-results)
(define-endpoint :get "/octopus-projects-with-roles" () .octopus-projects-with-roles)
(define-endpoint :get "/octopus-projects-with-roles/view" () .octopus-projects-with-roles-view)
(define-endpoint :post "/octopus-projects-with-roles/results" ((roles :parameter-type 'string)) .octopus-projects-with-roles-results)
(define-endpoint :get "/octopus-ode-deploy-release" () .octopus-ode-deploy-release)
(define-endpoint :get "/octopus-ode-deploy-release/view" () .octopus-ode-deploy-release-view)
(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) (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)