From 128d27836f7f4421c55172a3a42ceb1ab69af31c Mon Sep 17 00:00:00 2001 From: Su Date: Wed, 24 May 2023 10:46:23 -0700 Subject: [PATCH] [MD]Update data-test-subj for functional tests & fix bug in edit flow Signed-off-by: Su --- .../create_form/create_data_source_form.tsx | 2 +- .../edit_form/edit_data_source_form.tsx | 31 ++++++++++++++----- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/src/plugins/data_source_management/public/components/create_data_source_wizard/components/create_form/create_data_source_form.tsx b/src/plugins/data_source_management/public/components/create_data_source_wizard/components/create_form/create_data_source_form.tsx index 8b36e13e7deb..9f320400fb76 100644 --- a/src/plugins/data_source_management/public/components/create_data_source_wizard/components/create_form/create_data_source_form.tsx +++ b/src/plugins/data_source_management/public/components/create_data_source_wizard/components/create_form/create_data_source_form.tsx @@ -430,7 +430,7 @@ export class CreateDataSourceForm extends React.Component< value={this.state.auth.credentials.service} onChange={(e) => this.onChangeSigV4ServiceName(e)} name="ServiceName" - data-test-subj="createDataSourceFormAuthTypeSelect" + data-test-subj="createDataSourceFormSigV4ServiceTypeSelect" /> ) => { - this.setState({ auth: { ...this.state.auth, type: e.target.value as AuthType } }, () => { - this.onChangeFormValues(); - }); + const authType = e.target.value as AuthType; + this.setState( + { + auth: { + ...this.state.auth, + type: authType, + credentials: { + ...this.state.auth.credentials, + service: + (this.state.auth.credentials?.service as SigV4ServiceName) || + SigV4ServiceName.OpenSearch, + }, + }, + }, + () => { + this.onChangeFormValues(); + } + ); }; onChangeDescription = (e: { target: { value: any } }) => { @@ -804,7 +819,7 @@ export class EditDataSourceForm extends React.Component this.onChangeSigV4ServiceName(e)} name="ServiceName" - data-test-subj="createDataSourceFormAuthTypeSelect" + data-test-subj="editDataSourceFormSigV4ServiceTypeSelect" />