Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding relation between credential selection and no auth checkbox #2175

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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