1
0
Fork 0
mirror of synced 2024-08-12 08:31:27 +12:00

Strip hidden fields from viewsV2 in design section

This commit is contained in:
Andrew Kingston 2023-08-09 16:39:23 +01:00
parent 7a40ad66c6
commit 5188abe4e5

View file

@ -734,9 +734,19 @@ export const getSchemaForDatasource = (asset, datasource, options) => {
// Determine the schema from the backing entity if not already determined
if (table && !schema) {
if (type === "view") {
// For views, the schema is pulled from the `views` property of the
// table
// Old views
schema = cloneDeep(table.views?.[datasource.name]?.schema)
} else if (type === "viewV2") {
// New views which are DS+
const view = table.views?.[datasource.name]
schema = cloneDeep(view?.schema)
// Strip hidden fields
Object.keys(schema || {}).forEach(field => {
if (!schema[field].visible) {
delete schema[field]
}
})
} else if (
type === "query" &&
(options.formSchema || options.searchableSchema)