Fix forms not providing correct datasource object
This commit is contained in:
parent
7afcee9748
commit
f453ed6c43
|
@ -69,8 +69,9 @@ export const getDatasourceForProvider = component => {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Extract datasource from component instance
|
// Extract datasource from component instance
|
||||||
|
const validSettingTypes = ["datasource", "table", "schema"]
|
||||||
const datasourceSetting = def.settings.find(setting => {
|
const datasourceSetting = def.settings.find(setting => {
|
||||||
return setting.type === "datasource" || setting.type === "table"
|
return validSettingTypes.includes(setting.type)
|
||||||
})
|
})
|
||||||
if (!datasourceSetting) {
|
if (!datasourceSetting) {
|
||||||
return null
|
return null
|
||||||
|
@ -80,15 +81,14 @@ export const getDatasourceForProvider = component => {
|
||||||
// example an actual datasource object, or a table ID string.
|
// example an actual datasource object, or a table ID string.
|
||||||
// Convert the datasource setting into a proper datasource object so that
|
// Convert the datasource setting into a proper datasource object so that
|
||||||
// we can use it properly
|
// we can use it properly
|
||||||
if (datasourceSetting.type === "datasource") {
|
if (datasourceSetting.type === "table") {
|
||||||
return component[datasourceSetting?.key]
|
|
||||||
} else if (datasourceSetting.type === "table") {
|
|
||||||
return {
|
return {
|
||||||
tableId: component[datasourceSetting?.key],
|
tableId: component[datasourceSetting?.key],
|
||||||
type: "table",
|
type: "table",
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
return component[datasourceSetting?.key]
|
||||||
}
|
}
|
||||||
return null
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue