Skip to content

Commit

Permalink
adding relation between credential selection and no auth checkbox (op…
Browse files Browse the repository at this point in the history
…ensearch-project#2175)

Signed-off-by: mpabba3003 <[email protected]>

Signed-off-by: mpabba3003 <[email protected]>
Signed-off-by: Kristen Tian <[email protected]>
  • Loading branch information
mpabba3003 authored and kristenTian committed Sep 15, 2022
1 parent a058cc4 commit a38f5d3
Showing 1 changed file with 19 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,20 @@ export class CreateEditDataSourceWizard extends React.Component<
});
};

onChangeNoAuth = () => {
this.setState(
{
noAuthentication: !this.state.noAuthentication,
},
() => {
/* When credential is already selected and user checks the noAuth checkbox, reset previously selected credential*/
if (this.state.noAuthentication && this.state.selectedCredentials.length) {
this.setState({ selectedCredentials: [] });
}
}
);
};

onClickCreateNewDataSource = () => {
if (this.isFormValid()) {
const formValues: DataSourceEditPageItem = {
Expand All @@ -231,6 +245,10 @@ export class CreateEditDataSourceWizard extends React.Component<

onSelectExistingCredentials = (options: CredentialsComboBoxItem[]) => {
this.setState({ selectedCredentials: options }, () => {
/* When noAuth checkbox is checked and user selects credentials, un-check the noAuth checkbox*/
if (options.length && this.state.noAuthentication) {
this.onChangeNoAuth();
}
if (this.state.formErrorsByField.credential.length) {
this.isFormValid();
}
Expand Down Expand Up @@ -435,11 +453,7 @@ export class CreateEditDataSourceWizard extends React.Component<
id="noAuthentication"
label="Continue without authentication"
checked={this.state.noAuthentication}
onChange={(e) => {
this.setState({
noAuthentication: !this.state.noAuthentication,
});
}}
onChange={this.onChangeNoAuth}
compressed
/>

Expand Down

0 comments on commit a38f5d3

Please sign in to comment.