@@ -4,14 +4,14 @@ import { useFormik, FormikErrors } from 'formik'
4
4
import { isEmpty } from 'lodash'
5
5
import {
6
6
EuiButton ,
7
+ EuiCollapsibleNavGroup ,
7
8
EuiFieldText ,
8
9
EuiFlexGroup ,
9
10
EuiFlexItem ,
10
11
EuiForm ,
11
12
EuiFormRow ,
12
13
EuiLink ,
13
14
EuiText ,
14
- EuiTitle ,
15
15
EuiToolTip ,
16
16
EuiWindowEvent ,
17
17
keys ,
@@ -52,9 +52,6 @@ const fieldDisplayNames: Values = {
52
52
53
53
const Message = ( ) => (
54
54
< >
55
- < FeatureFlagComponent name = { FeatureFlags . cloudSso } >
56
- < EuiTitle className = { styles . messageTitle } > < h4 > Use Cloud API key</ h4 > </ EuiTitle >
57
- </ FeatureFlagComponent >
58
55
< EuiText color = "subdued" size = "s" className = { styles . message } data-testid = "summary" >
59
56
{ `Enter API keys to discover and add databases.
60
57
API keys can be enabled by following the steps
@@ -180,57 +177,79 @@ const CloudConnectionForm = (props: Props) => {
180
177
return null
181
178
}
182
179
180
+ const CloudApiForm = (
181
+ < div className = { styles . cloudApi } >
182
+ < Message />
183
+ < br />
184
+ < EuiWindowEvent event = "keydown" handler = { onKeyDown } />
185
+ < EuiForm component = "form" onSubmit = { formik . handleSubmit } >
186
+ < EuiFlexGroup className = { flexGroupClassName } >
187
+ < EuiFlexItem className = { flexItemClassName } >
188
+ < EuiFormRow label = "API Account Key*" >
189
+ < EuiFieldText
190
+ name = "accessKey"
191
+ id = "accessKey"
192
+ data-testid = "access-key"
193
+ maxLength = { 200 }
194
+ placeholder = { fieldDisplayNames . accessKey }
195
+ value = { formik . values . accessKey }
196
+ autoComplete = "off"
197
+ onChange = { ( e : ChangeEvent < HTMLInputElement > ) => {
198
+ formik . setFieldValue ( e . target . name , validateField ( e . target . value . trim ( ) ) )
199
+ } }
200
+ />
201
+ </ EuiFormRow >
202
+ </ EuiFlexItem >
203
+ </ EuiFlexGroup >
204
+ < EuiFlexGroup className = { flexGroupClassName } >
205
+ < EuiFlexItem className = { flexItemClassName } >
206
+ < EuiFormRow label = "API User Key*" >
207
+ < EuiFieldText
208
+ name = "secretKey"
209
+ id = "secretKey"
210
+ data-testid = "secret-key"
211
+ maxLength = { 200 }
212
+ placeholder = { fieldDisplayNames . secretKey }
213
+ value = { formik . values . secretKey }
214
+ autoComplete = "off"
215
+ onChange = { ( e : ChangeEvent < HTMLInputElement > ) => {
216
+ formik . setFieldValue ( e . target . name , validateField ( e . target . value . trim ( ) ) )
217
+ } }
218
+ />
219
+ </ EuiFormRow >
220
+ </ EuiFlexItem >
221
+ </ EuiFlexGroup >
222
+ < Footer />
223
+ </ EuiForm >
224
+ </ div >
225
+ )
226
+
183
227
return (
184
228
< >
185
229
< div className = "getStartedForm" >
186
230
< FeatureFlagComponent name = { FeatureFlags . cloudSso } >
187
- < OAuthSocial type = { OAuthSocialType . Autodiscovery } />
188
- < div className = { styles . divider } > OR</ div >
231
+ < EuiText color = "subdued" size = "s" > Connect with:</ EuiText >
232
+ < EuiCollapsibleNavGroup
233
+ isCollapsible
234
+ className = { styles . accordion }
235
+ title = "Use Cloud Account"
236
+ initialIsOpen = { false }
237
+ data-testid = "use-cloud-account-accordion"
238
+ >
239
+ < OAuthSocial type = { OAuthSocialType . Autodiscovery } hideTitle />
240
+ </ EuiCollapsibleNavGroup >
241
+ </ FeatureFlagComponent >
242
+ < FeatureFlagComponent name = { FeatureFlags . cloudSso } otherwise = { CloudApiForm } >
243
+ < EuiCollapsibleNavGroup
244
+ isCollapsible
245
+ className = { styles . accordion }
246
+ title = "Use Cloud API Keys"
247
+ initialIsOpen = { false }
248
+ data-testid = "use-cloud-keys-accordion"
249
+ >
250
+ { CloudApiForm }
251
+ </ EuiCollapsibleNavGroup >
189
252
</ FeatureFlagComponent >
190
- < div className = { styles . cloudApi } >
191
- < Message />
192
- < br />
193
- < EuiWindowEvent event = "keydown" handler = { onKeyDown } />
194
- < EuiForm component = "form" onSubmit = { formik . handleSubmit } >
195
- < EuiFlexGroup className = { flexGroupClassName } >
196
- < EuiFlexItem className = { flexItemClassName } >
197
- < EuiFormRow label = "API Account Key*" >
198
- < EuiFieldText
199
- name = "accessKey"
200
- id = "accessKey"
201
- data-testid = "access-key"
202
- maxLength = { 200 }
203
- placeholder = { fieldDisplayNames . accessKey }
204
- value = { formik . values . accessKey }
205
- autoComplete = "off"
206
- onChange = { ( e : ChangeEvent < HTMLInputElement > ) => {
207
- formik . setFieldValue ( e . target . name , validateField ( e . target . value . trim ( ) ) )
208
- } }
209
- />
210
- </ EuiFormRow >
211
- </ EuiFlexItem >
212
- </ EuiFlexGroup >
213
- < EuiFlexGroup className = { flexGroupClassName } >
214
- < EuiFlexItem className = { flexItemClassName } >
215
- < EuiFormRow label = "API User Key*" >
216
- < EuiFieldText
217
- name = "secretKey"
218
- id = "secretKey"
219
- data-testid = "secret-key"
220
- maxLength = { 200 }
221
- placeholder = { fieldDisplayNames . secretKey }
222
- value = { formik . values . secretKey }
223
- autoComplete = "off"
224
- onChange = { ( e : ChangeEvent < HTMLInputElement > ) => {
225
- formik . setFieldValue ( e . target . name , validateField ( e . target . value . trim ( ) ) )
226
- } }
227
- />
228
- </ EuiFormRow >
229
- </ EuiFlexItem >
230
- </ EuiFlexGroup >
231
- < Footer />
232
- </ EuiForm >
233
- </ div >
234
253
</ div >
235
254
</ >
236
255
)
0 commit comments