1
1
<template >
2
2
<div v-show =" doShow" id =" profile-selector-container" :data-app =" app" >
3
3
<!-- Icon -->
4
- <div id =" icon-container" >
4
+ <div id =" icon-container" class = " bottomMargin " >
5
5
<svg
6
6
v-if =" app === 'AMAZONQ'"
7
7
width =" 71"
45
45
</svg >
46
46
</div >
47
47
48
- <div class =" text-container" >
49
- <div id =" title" >Choose a Q Developer profile</div >
50
- <div class =" description" >
48
+ <template v-if =" isFirstLoading " >
49
+ <div class =" header bottomMargin" >Authenticating in browser...</div >
50
+ <button class =" continue-button" >Cancel</button >
51
+ </template >
52
+
53
+ <template v-else >
54
+ <div class =" header" >Choose a Q Developer profile</div >
55
+ <div class =" subHeader bottomMargin topMargin" >
51
56
Your administrator has given you access to Q from multiple profiles. Choose the profile that meets your
52
57
current working needs. You can change your profile at any time.
53
58
</div >
54
- </div >
55
59
56
- <div id =" content-container" >
57
- <div class =" options" >
60
+ <div class =" bottomMargin" >
58
61
<!-- TODO: should use profile.arn as item-id but not idx, which will require more work to refactor auth flow code path -->
59
62
<SelectableItem
60
63
v-for =" (profile, idx) in availableRegionProfiles"
65
68
:item-sub-title =" `${profile.region}`"
66
69
:item-text =" `Account: ${profile.description}`"
67
70
:isSelected =" selectedRegionProfileIndex === idx"
68
- :class =" ['option ', { selected: selectedRegionProfileIndex === idx }]"
71
+ :class =" ['selectable-item ', { selected: selectedRegionProfileIndex === idx }]"
69
72
></SelectableItem >
70
73
</div >
71
74
72
- <div v-if =" errorMessage" id =" error-message" >
75
+ <div v-if =" errorMessage" id =" error-message" class = " bottomMargin " >
73
76
We couldn't load your Q Developer profiles. Please try again.
74
77
</div >
75
78
76
79
<div >
77
80
<template v-if =" errorMessage " >
78
- <button id =" reload" class =" continue-button" v-on:click =" listAvailableProfiles " >Try again</button >
79
- <button id =" signout" v-on:click =" signout" >Sign Out</button >
81
+ <button id =" reload" class =" continue-button" v-on:click =" retryLoadProfiles " >Try again</button >
82
+ <button id =" signout" class = " topMargin " v-on:click =" signout" >Sign Out</button >
80
83
</template >
81
84
<template v-else >
82
85
<button
83
86
class =" continue-button"
84
87
id =" profile-selection-continue-button"
85
88
v-on:click =" onClickContinue()"
89
+ :disabled =" isRetryLoading"
86
90
>
87
- Continue
91
+ {{ isRetryLoading ? 'Refreshing' : ' Continue' }}
88
92
</button >
89
93
</template >
90
94
</div >
91
- </div >
95
+ </template >
92
96
</div >
93
97
</template >
94
98
<script lang="ts">
@@ -119,6 +123,8 @@ export default defineComponent({
119
123
doShow: false ,
120
124
availableRegionProfiles: [] as RegionProfile [],
121
125
selectedRegionProfileIndex: 0 ,
126
+ isFirstLoading: false ,
127
+ isRetryLoading: false ,
122
128
}
123
129
},
124
130
props: {
@@ -134,8 +140,8 @@ export default defineComponent({
134
140
async created() {
135
141
this .doShow = true
136
142
},
137
- async beforeMount () {
138
- await this .listAvailableProfiles ()
143
+ async mounted () {
144
+ this .firstTimeLoadProfiles ()
139
145
},
140
146
methods: {
141
147
toggleItemSelection(itemId : number ) {
@@ -153,6 +159,18 @@ export default defineComponent({
153
159
client .emitUiClick (' auth_signout' )
154
160
await client .signout ()
155
161
},
162
+ // hack to have 2 different flag because we want to render differently for 2 paths
163
+ async retryLoadProfiles() {
164
+ this .isRetryLoading = true
165
+ await this .listAvailableProfiles ()
166
+ this .isRetryLoading = false
167
+ },
168
+ firstTimeLoadProfiles() {
169
+ this .isFirstLoading = true
170
+ this .listAvailableProfiles ().then (() => {
171
+ this .isFirstLoading = false
172
+ })
173
+ },
156
174
async listAvailableProfiles() {
157
175
this .errorMessage = ' '
158
176
const r = await client .listRegionProfiles ()
@@ -190,74 +208,97 @@ export function getReadyElementId() {
190
208
margin : auto ;
191
209
position : absolute ;
192
210
top : var (--auth-container-top );
211
+ max-width : 260px ;
193
212
width : 90vw ;
194
- max-width : 400px ;
195
213
}
196
214
197
- #content-container {
198
- display : flex ;
199
- flex-direction : column ;
200
- /* All items are centered vertically */
201
- justify-content : space-between ;
202
- /* * The overall height of the container, then spacing is automatic between child elements */
203
- /* height: 7rem; */
204
- align-items : center ;
215
+ .selectable-item {
216
+ margin-bottom : 5px ;
217
+ /* margin-top: 10px; */
218
+ cursor : pointer ;
219
+ width : 100% ;
205
220
}
206
221
207
- #content-container > * {
208
- width : 100 % ;
209
- max-width : 260 px ;
222
+ .header {
223
+ font-size : var ( --font-size-base ) ;
224
+ font-weight : bold ;
210
225
}
211
226
212
- #icon-container {
213
- display : flex ;
214
- flex-direction : column ;
215
- /* justify-content: center; */
216
- align-items : center ;
227
+ .vscode-dark .header {
228
+ color : white ;
229
+ }
230
+ .vscode-light .header {
231
+ color : black ;
217
232
}
218
233
219
- .text-container {
220
- display : flex ;
221
- flex-direction : column ;
222
- margin-bottom : 1rem ;
223
- margin-left : 2rem ;
224
- margin-top : 1rem ;
234
+ .title {
235
+ margin-bottom : 3px ;
236
+ margin-top : 3px ;
237
+ font-size : var (--font-size-base );
238
+ font-weight : 500 ;
239
+ }
240
+ .vscode-dark .title {
241
+ color : white ;
242
+ }
243
+ .vscode-light .title {
244
+ color : black ;
225
245
}
226
246
227
- #title {
247
+ .subHeader {
248
+ font-size : var (--font-size-sm );
249
+ }
250
+ .continue-button {
251
+ background-color : var (--vscode-button-background );
252
+ color : white ;
253
+ width : 100% ;
254
+ height : 30px ;
255
+ border : none ;
256
+ border-radius : 4px ;
228
257
font-weight : bold ;
229
- margin-bottom : 1.5px ;
258
+ margin-bottom : 3px ;
259
+ margin-top : 3px ;
260
+ cursor : pointer ;
261
+ font-size : var (--font-size-base );
230
262
}
231
263
232
- .description {
233
- margin-top : 0.5rem ;
234
- font-weight : normal ;
264
+ .continue-button :disabled {
265
+ background-color : var (--vscode-input-background );
266
+ color : #6f6f6f ;
267
+ cursor : not-allowed ;
235
268
}
236
269
237
- #error-message {
238
- text-align : center ;
239
- font-size : var (--font-size-base );
270
+ body .vscode-high-contrast :not (body .vscode-high-contrast-light ) .continue-button {
271
+ background-color : white ;
272
+ color : var (--vscode-input-background );
273
+ }
274
+
275
+ body .vscode-high-contrast :not (body .vscode-high-contrast-light ) .continue-button :disabled {
276
+ background-color : #6f6f6f ;
277
+ color : var (--vscode-input-background );
240
278
}
241
279
242
280
body .vscode-high-contrast-light .continue-button {
243
281
background-color : var (--vscode-button-background );
244
282
color : white ;
245
283
}
246
284
247
- body .vscode-high-contrast-light .continue-button :disabled {
248
- background-color : #6f6f6f ;
249
- color : var (--vscode-input-background );
285
+ .bottomMargin {
286
+ margin-bottom : 12px ;
287
+ }
288
+ .topMargin {
289
+ margin-top : 6px ;
250
290
}
251
291
252
- .options {
253
- text-align : center ;
292
+ #icon-container {
293
+ display : flex ;
294
+ flex-direction : column ;
295
+ /* justify-content: center; */
254
296
align-items : center ;
255
297
}
256
298
257
- .option {
258
- width : 100% ;
259
- margin-bottom : 7px ;
260
- cursor : pointer ;
299
+ #error-message {
300
+ text-align : center ;
301
+ font-size : var (--font-size-base );
261
302
}
262
303
263
304
button #signout {
@@ -266,6 +307,9 @@ button#signout {
266
307
border : none ;
267
308
background : none ;
268
309
user-select : none ;
269
- margin-top : 0.5rem ;
310
+ width : 100% ;
311
+ display : flex ;
312
+ flex-direction : column ;
313
+ align-items : center ;
270
314
}
271
315
</style >
0 commit comments