mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-23 08:58:26 +00:00
Fixed : App allows to create a datasource with no name (#1253)
* Update DataSourceManager.jsx * Update DataSourceManager.jsx
This commit is contained in:
parent
1aca2b0ea0
commit
56165ad8bd
1 changed files with 22 additions and 16 deletions
|
|
@ -111,23 +111,29 @@ class DataSourceManager extends React.Component {
|
|||
encrypted: keyMeta ? keyMeta.encrypted : false,
|
||||
};
|
||||
});
|
||||
|
||||
if (selectedDataSource.id) {
|
||||
this.setState({ isSaving: true });
|
||||
datasourceService.save(selectedDataSource.id, appId, name, parsedOptions).then(() => {
|
||||
this.setState({ isSaving: false });
|
||||
this.hideModal();
|
||||
toast.success('Datasource Saved', { hideProgressBar: true, position: 'top-center' });
|
||||
this.props.dataSourcesChanged();
|
||||
});
|
||||
if (name.trim() !== ''){
|
||||
if (selectedDataSource.id) {
|
||||
this.setState({ isSaving: true });
|
||||
datasourceService.save(selectedDataSource.id, appId, name, parsedOptions).then(() => {
|
||||
this.setState({ isSaving: false });
|
||||
this.hideModal();
|
||||
toast.success('Datasource Saved', { hideProgressBar: true, position: 'top-center' });
|
||||
this.props.dataSourcesChanged();
|
||||
});
|
||||
} else {
|
||||
this.setState({ isSaving: true });
|
||||
datasourceService.create(appId, name, kind, parsedOptions).then(() => {
|
||||
this.setState({ isSaving: false });
|
||||
this.hideModal();
|
||||
toast.success('Datasource Added', { hideProgressBar: true, position: 'top-center' });
|
||||
this.props.dataSourcesChanged();
|
||||
});
|
||||
}
|
||||
} else {
|
||||
this.setState({ isSaving: true });
|
||||
datasourceService.create(appId, name, kind, parsedOptions).then(() => {
|
||||
this.setState({ isSaving: false });
|
||||
this.hideModal();
|
||||
toast.success('Datasource Added', { hideProgressBar: true, position: 'top-center' });
|
||||
this.props.dataSourcesChanged();
|
||||
});
|
||||
toast.error(
|
||||
"The name of datasource should not be empty",
|
||||
{ hideProgressBar: true, position: 'top-center' }
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue