git.fiddlerwoaroof.com
Browse code

feat: synchronize web console region and initial stack pane region

Ed Langley authored on 29/06/2020 22:32:35
Showing 4 changed files
... ...
@@ -11,7 +11,7 @@
11 11
    (%credentials :reader credentials
12 12
                  :initarg :credentials))
13 13
   (:default-initargs
14
-   :region "us-east-1"
14
+   :region :|us-east-1|
15 15
    :credentials (error "AWS-DISPATCHER requires a :CREDENTIALS initarg")))
16 16
 
17 17
 (defmacro defprint-slots (class slots)
... ...
@@ -108,9 +108,11 @@
108 108
                                                 (bundle-resource-root))))))
109 109
   (:method ((action (eql :|Cloudformation Stacks|)) (interface mfa-tool))
110 110
     (let ((stack-interface (make-instance 'mfa-tool.stack:stack-interface
111
-                                          :credentials (current-credentials interface))))
112
-      (mfa-tool.store:dispatch stack-interface :|Get Stacks|)
113
-      (capi:display stack-interface)))
111
+                                          :credentials (current-credentials interface)
112
+                                          :region (capi:choice-selected-item
113
+                                                   (region-selector interface)))))
114
+      (prog1 (capi:display stack-interface)
115
+        (mfa-tool.store:dispatch stack-interface :|Get Stacks|))))
114 116
   (:method ((action (eql :|Lisp REPL|)) (interface mfa-tool))
115 117
     (capi:contain (make-instance 'capi:listener-pane)
116 118
                   :best-width 1280
... ...
@@ -7,6 +7,7 @@
7 7
 (defun region-selected (region)
8 8
   (setf (ubiquitous:value :default-region)
9 9
         region))
10
+
10 11
 (defparameter *developer-p* (equal "elangley" (uiop/os:getenv "USER")))
11 12
 
12 13
 (defgeneric assumed-credentials (store))
... ...
@@ -25,10 +25,10 @@
25 25
          stream))
26 26
 
27 27
 (defun get-output-columns (type col1 col2)
28
-  `((:title ,(format nil "~a Name" type) 
28
+  `((:title ,(format nil "~a Name" type)
29 29
      :adjust :right
30 30
      :width (character ,(max (+ (length type) 5) col1)))
31
-    (:title "Value" 
31
+    (:title "Value"
32 32
      :adjust :left
33 33
      :width (character ,(max (+ (length type) 5) col2)))))
34 34
 
... ...
@@ -45,11 +45,12 @@
45 45
    (region-chooser capi:option-pane
46 46
                    :reader region-chooser
47 47
                    ;; :external-max-width '(character 35)
48
-                   :items (list "us-east-1" "us-east-2"
49
-                                "us-west-1" "us-west-2"
50
-                                "ca-central-1"
51
-                                "eu-central-1"
52
-                                "eu-west-1" "eu-west-2")
48
+                   :items (list :|us-east-1| :|us-east-2|
49
+                                :|us-west-1| :|us-west-2|
50
+                                :|ca-central-1|
51
+                                :|eu-central-1|
52
+                                :|eu-west-1| :|eu-west-2|)
53
+                   :selected-item (mfa-tool.aws-dispatcher::region capi:interface)
53 54
                    :selection-callback (dispatch-with-action-creator 'mfa-tool.aws-dispatcher::update-region)
54 55
                    :callback-type :interface-data)
55 56
 
... ...
@@ -160,7 +161,7 @@
160 161
        outputs-display :columns (apply 'get-output-columns "Output" (max-widths outputs)))
161 162
       (capi:modify-multi-column-list-panel-columns
162 163
        parameters-display :columns (apply 'get-output-columns "Parameter" (max-widths parameters)))
163
-      
164
+
164 165
       (when (not (eq (capi:choice-selected-item (stack-chooser interface))
165 166
                      (mfa-tool.aws-dispatcher:stack _)))
166 167
         (setf (capi:choice-selected-item (stack-chooser interface)) (mfa-tool.stack-store:selected-stack interface)))
... ...
@@ -170,4 +171,3 @@
170 171
                     selected-stack)
171 172
             (capi:collection-items parameters-display) parameters
172 173
             (capi:collection-items outputs-display) outputs))))
173
-