Fix calc view schemas not being determined correctly

This commit is contained in:
Andrew Kingston 2021-02-17 16:01:11 +00:00
parent 09e3ab9078
commit 7f92c82298
1 changed files with 9 additions and 0 deletions

View File

@ -231,6 +231,15 @@ export const getSchemaForDatasource = (datasource, isForm = false) => {
if (table) {
if (type === "view") {
schema = cloneDeep(table.views?.[datasource.name]?.schema)
// Some calc views don't include a "name" property inside the schema
if (schema) {
Object.keys(schema).forEach(field => {
if (!schema[field].name) {
schema[field].name = field
}
})
}
} else if (type === "query" && isForm) {
schema = {}
const params = table.parameters || []