Default state of view is no data returned.
This commit is contained in:
parent
9e0964a5e3
commit
672e370904
|
@ -82,18 +82,16 @@ export function enrichSchema(view: View | ViewV2, tableSchema: TableSchema) {
|
|||
const anyViewOrder = Object.values(view.schema || {}).some(
|
||||
ui => ui.order != null
|
||||
)
|
||||
if (Object.keys(view.schema || {}).length > 0) {
|
||||
for (const key of Object.keys(schema)) {
|
||||
// if nothing specified in view, then it is not visible
|
||||
const ui = view.schema?.[key] || { visible: false }
|
||||
if (ui.visible === false) {
|
||||
schema[key].visible = false
|
||||
} else {
|
||||
schema[key] = {
|
||||
...schema[key],
|
||||
...ui,
|
||||
order: anyViewOrder ? ui?.order ?? undefined : schema[key].order,
|
||||
}
|
||||
for (const key of Object.keys(schema)) {
|
||||
// if nothing specified in view, then it is not visible
|
||||
const ui = view.schema?.[key] || { visible: false }
|
||||
if (ui.visible === false) {
|
||||
schema[key].visible = false
|
||||
} else {
|
||||
schema[key] = {
|
||||
...schema[key],
|
||||
...ui,
|
||||
order: anyViewOrder ? ui?.order ?? undefined : schema[key].order,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ describe("table sdk", () => {
|
|||
}
|
||||
|
||||
describe("enrichViewSchemas", () => {
|
||||
it("should fetch the default schema if not overriden", async () => {
|
||||
it("should fetch the default schema if not overridden", async () => {
|
||||
const tableId = basicTable._id!
|
||||
const view: ViewV2 = {
|
||||
version: 2,
|
||||
|
@ -66,7 +66,7 @@ describe("table sdk", () => {
|
|||
name: {
|
||||
type: "string",
|
||||
name: "name",
|
||||
visible: true,
|
||||
visible: false,
|
||||
order: 2,
|
||||
width: 80,
|
||||
constraints: {
|
||||
|
@ -76,7 +76,7 @@ describe("table sdk", () => {
|
|||
description: {
|
||||
type: "string",
|
||||
name: "description",
|
||||
visible: true,
|
||||
visible: false,
|
||||
width: 200,
|
||||
constraints: {
|
||||
type: "string",
|
||||
|
@ -85,7 +85,7 @@ describe("table sdk", () => {
|
|||
id: {
|
||||
type: "number",
|
||||
name: "id",
|
||||
visible: true,
|
||||
visible: false,
|
||||
order: 1,
|
||||
constraints: {
|
||||
type: "number",
|
||||
|
|
Loading…
Reference in New Issue