blob: ac5f6f079405a314f0cdd1fb736b92b1a09f680c (
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
|
;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10 -*-
(declaim (optimize (speed 0) (safety 3) (debug 3)))
(in-package :snow)
(defclass tfcloud-apply-service (rest-service)
()
(:documentation ""))
(defun tfcloud-apply-json ()
(with-noauth (instance tfcloud-apply-service)
t))
(defclass tfcloud-apply/view-service (tfcloud-apply-service)
((form :initarg :form
:initform nil
:accessor form)
(location-p :initform nil))
(:documentation ""))
(defun tfcloud-apply-view-json ()
(with-noauth (instance tfcloud-apply/view-service)
(setf (form instance)
(make-form "tfcloud-apply-form"
nil
t
`((:name "filter" :label "Filter" :field-type "text" :required "required" :value ,(or (session-value :tfcloud-apply-filter) ""))
(:label "Find Matching Workspaces" :field-type "button" :onclick "on_tfcloud_apply_results_clicked()"))))))
(defclass tfcloud-apply/results-service (tfcloud-apply/view-service)
((results :initarg :results
:initform nil
:accessor results)
(location-p :initform nil))
(:documentation ""))
(defun tfcloud-apply-results-json (filter)
(with-noauth (instance tfcloud-apply/results-service)
(with-tfcloud (tfcloud)
(let ((workspaces (get-tfcloud-workspaces tfcloud filter)))
(setf (results instance) (mapcar (lambda (workspace)
(sanitize-json workspace))
workspaces))
(setf (session-value :tfcloud-apply-filter) filter)
(setf (session-value :tfcloud-apply-workspaces) workspaces)
(setf (form instance)
(make-form "tfcloud-apply-submit-form"
nil
t
`((:label "Apply Workspaces" :field-type "button" :onclick "on_tfcloud_apply_results_submit_clicked()"))))))))
(defclass tfcloud-apply/results-submit-service (tfcloud-apply-service)
((location-p :initform nil))
(:documentation ""))
(defun tfcloud-apply-results-submit-json ()
(with-noauth (instance tfcloud-apply/results-submit-service)
(loop for workspace in (session-value :tfcloud-apply-workspaces)
do (apply-tfcloud-workspace workspace))))
|