Fix generating datsource structure for components which have a setting of type table
This commit is contained in:
parent
ee4e9e7a61
commit
654c2f3c9c
|
@ -243,18 +243,18 @@ export const getDatasourceForProvider = (asset, component) => {
|
|||
return null
|
||||
}
|
||||
|
||||
// There are different types of setting which can be a datasource, for
|
||||
// example an actual datasource object, or a table ID string.
|
||||
// Convert the datasource setting into a proper datasource object so that
|
||||
// we can use it properly
|
||||
if (datasourceSetting.type === "table") {
|
||||
// For legacy compatibility, we need to be able to handle datasources that are
|
||||
// just strings. These are not generated any more, so could be removed in
|
||||
// future.
|
||||
// TODO: remove at some point
|
||||
const datasource = component[datasourceSetting?.key]
|
||||
if (typeof datasource === "string") {
|
||||
return {
|
||||
tableId: component[datasourceSetting?.key],
|
||||
tableId: datasource,
|
||||
type: "table",
|
||||
}
|
||||
} else {
|
||||
return component[datasourceSetting?.key]
|
||||
}
|
||||
return datasource
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue