Use view name when generating bindings
This commit is contained in:
parent
118bf9e9c3
commit
d6688d1914
|
@ -350,12 +350,19 @@ const getProviderContextBindings = (asset, dataProviders) => {
|
||||||
schema = info.schema
|
schema = info.schema
|
||||||
table = info.table
|
table = info.table
|
||||||
|
|
||||||
// For JSON arrays, use the array name as the readable prefix.
|
// Determine what to prefix bindings with
|
||||||
// Otherwise use the table name
|
|
||||||
if (datasource.type === "jsonarray") {
|
if (datasource.type === "jsonarray") {
|
||||||
|
// For JSON arrays, use the array name as the readable prefix
|
||||||
const split = datasource.label.split(".")
|
const split = datasource.label.split(".")
|
||||||
readablePrefix = split[split.length - 1]
|
readablePrefix = split[split.length - 1]
|
||||||
|
} else if (datasource.type === "viewV2") {
|
||||||
|
// For views, use the view name
|
||||||
|
const view = Object.values(table?.views || {}).find(
|
||||||
|
view => view.id === datasource.id
|
||||||
|
)
|
||||||
|
readablePrefix = view?.name
|
||||||
} else {
|
} else {
|
||||||
|
// Otherwise use the table name
|
||||||
readablePrefix = info.table?.name
|
readablePrefix = info.table?.name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue