Merge branch 'master' into BUDI-8686/feature-flag
This commit is contained in:
commit
946fca2042
|
@ -133,9 +133,7 @@ export async function buildSqlFieldList(
|
||||||
|
|
||||||
let fields: string[] = []
|
let fields: string[] = []
|
||||||
if (sdk.views.isView(source)) {
|
if (sdk.views.isView(source)) {
|
||||||
fields = Object.keys(helpers.views.basicFields(source)).filter(
|
fields = Object.keys(helpers.views.basicFields(source))
|
||||||
key => source.schema?.[key]?.visible !== false
|
|
||||||
)
|
|
||||||
} else {
|
} else {
|
||||||
fields = extractRealFields(source)
|
fields = extractRealFields(source)
|
||||||
}
|
}
|
||||||
|
|
|
@ -800,6 +800,34 @@ describe.each([
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
isInternal &&
|
||||||
|
it("shouldn't trigger a complex type check on a group by field if field is invisible", async () => {
|
||||||
|
const table = await config.api.table.save(
|
||||||
|
saveTableRequest({
|
||||||
|
schema: {
|
||||||
|
field: {
|
||||||
|
name: "field",
|
||||||
|
type: FieldType.JSON,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
)
|
||||||
|
|
||||||
|
await config.api.viewV2.create(
|
||||||
|
{
|
||||||
|
tableId: table._id!,
|
||||||
|
name: generator.guid(),
|
||||||
|
type: ViewV2Type.CALCULATION,
|
||||||
|
schema: {
|
||||||
|
field: { visible: false },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
status: 201,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe("update", () => {
|
describe("update", () => {
|
||||||
|
|
|
@ -68,9 +68,7 @@ async function buildInternalFieldList(
|
||||||
const { relationships, allowedFields } = opts || {}
|
const { relationships, allowedFields } = opts || {}
|
||||||
let schemaFields: string[] = []
|
let schemaFields: string[] = []
|
||||||
if (sdk.views.isView(source)) {
|
if (sdk.views.isView(source)) {
|
||||||
schemaFields = Object.keys(helpers.views.basicFields(source)).filter(
|
schemaFields = Object.keys(helpers.views.basicFields(source))
|
||||||
key => source.schema?.[key]?.visible !== false
|
|
||||||
)
|
|
||||||
} else {
|
} else {
|
||||||
schemaFields = Object.keys(source.schema).filter(
|
schemaFields = Object.keys(source.schema).filter(
|
||||||
key => source.schema[key].visible !== false
|
key => source.schema[key].visible !== false
|
||||||
|
|
|
@ -33,6 +33,13 @@ export function calculationFields(view: UnsavedViewV2) {
|
||||||
return pickBy(view.schema || {}, isCalculationField)
|
return pickBy(view.schema || {}, isCalculationField)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function basicFields(view: UnsavedViewV2) {
|
export function isVisible(field: ViewFieldMetadata) {
|
||||||
return pickBy(view.schema || {}, field => !isCalculationField(field))
|
return field.visible !== false
|
||||||
|
}
|
||||||
|
|
||||||
|
export function basicFields(view: UnsavedViewV2, opts?: { visible?: boolean }) {
|
||||||
|
const { visible = true } = opts || {}
|
||||||
|
return pickBy(view.schema || {}, field => {
|
||||||
|
return !isCalculationField(field) && (!visible || isVisible(field))
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue