Merge branch 'fix/datasourceName' into 'release'

Duplicate datasource fixes

- Do not show datasoure field menu when url is blank
- Embedded datasource name shouldn't be blank
- Omit datasource name while creating a datasource

See merge request theappsmith/internal-tools-client!759
This commit is contained in:
Hetu Nandu 2020-06-20 05:28:10 +00:00
commit 760713aa69
2 changed files with 5 additions and 4 deletions

View File

@ -106,7 +106,7 @@ const DatasourcesField = (
}
const DropdownIndicator = (props: any) => {
if (props.hasValue) return null;
if (props.hasValue || !props.selectProps.inputValue) return null;
const MenuContainer = (
<StyledMenu>
@ -198,7 +198,7 @@ const DatasourcesField = (
const baseUrl = url.origin;
datasourcePayload = {
name: baseUrl,
name: baseUrl || "DEFAULT_REST_DATASOURCE",
datasourceConfiguration: {
url: baseUrl,
},
@ -206,7 +206,7 @@ const DatasourcesField = (
pathPayload = path + params;
} catch (e) {
datasourcePayload = {
name: value,
name: value || "DEFAULT_REST_DATASOURCE",
datasourceConfiguration: {
url: value,
},

View File

@ -368,7 +368,8 @@ function* storeAsDatasourceSaga() {
const { values } = yield select(getFormData, API_EDITOR_FORM_NAME);
const applicationId = yield select(getCurrentApplicationId);
const pageId = yield select(getCurrentPageId);
const datasource = _.get(values, "datasource");
let datasource = _.get(values, "datasource");
datasource = _.omit(datasource, ["name"]);
history.push(DATA_SOURCES_EDITOR_URL(applicationId, pageId));