Allow calculation views to hide required fields.
This commit is contained in:
parent
db25511948
commit
e6e25fdf94
|
@ -1024,6 +1024,26 @@ describe.each([
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it("can add a new group by field that is invisible, even if required on the table", async () => {
|
||||||
|
view.schema!.name = { visible: false }
|
||||||
|
await config.api.viewV2.update(view)
|
||||||
|
|
||||||
|
const { rows } = await config.api.row.search(view.id)
|
||||||
|
expect(rows).toHaveLength(2)
|
||||||
|
expect(rows).toEqual(
|
||||||
|
expect.arrayContaining([
|
||||||
|
{
|
||||||
|
country: "USA",
|
||||||
|
age: 65,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
country: "UK",
|
||||||
|
age: 61,
|
||||||
|
},
|
||||||
|
])
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
it("can add a new calculation field", async () => {
|
it("can add a new calculation field", async () => {
|
||||||
view.schema!.count = {
|
view.schema!.count = {
|
||||||
visible: true,
|
visible: true,
|
||||||
|
|
|
@ -178,7 +178,7 @@ function checkRequiredFields(
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!viewSchemaField?.visible) {
|
if (!helpers.views.isCalculationView(view) && !viewSchemaField?.visible) {
|
||||||
throw new HTTPError(
|
throw new HTTPError(
|
||||||
`You can't hide "${field.name}" because it is a required field.`,
|
`You can't hide "${field.name}" because it is a required field.`,
|
||||||
400
|
400
|
||||||
|
@ -186,6 +186,7 @@ function checkRequiredFields(
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
viewSchemaField &&
|
||||||
helpers.views.isBasicViewField(viewSchemaField) &&
|
helpers.views.isBasicViewField(viewSchemaField) &&
|
||||||
viewSchemaField.readonly
|
viewSchemaField.readonly
|
||||||
) {
|
) {
|
||||||
|
|
Loading…
Reference in New Issue