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(
|
const anyViewOrder = Object.values(view.schema || {}).some(
|
||||||
ui => ui.order != null
|
ui => ui.order != null
|
||||||
)
|
)
|
||||||
if (Object.keys(view.schema || {}).length > 0) {
|
for (const key of Object.keys(schema)) {
|
||||||
for (const key of Object.keys(schema)) {
|
// if nothing specified in view, then it is not visible
|
||||||
// if nothing specified in view, then it is not visible
|
const ui = view.schema?.[key] || { visible: false }
|
||||||
const ui = view.schema?.[key] || { visible: false }
|
if (ui.visible === false) {
|
||||||
if (ui.visible === false) {
|
schema[key].visible = false
|
||||||
schema[key].visible = false
|
} else {
|
||||||
} else {
|
schema[key] = {
|
||||||
schema[key] = {
|
...schema[key],
|
||||||
...schema[key],
|
...ui,
|
||||||
...ui,
|
order: anyViewOrder ? ui?.order ?? undefined : schema[key].order,
|
||||||
order: anyViewOrder ? ui?.order ?? undefined : schema[key].order,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@ describe("table sdk", () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
describe("enrichViewSchemas", () => {
|
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 tableId = basicTable._id!
|
||||||
const view: ViewV2 = {
|
const view: ViewV2 = {
|
||||||
version: 2,
|
version: 2,
|
||||||
|
@ -66,7 +66,7 @@ describe("table sdk", () => {
|
||||||
name: {
|
name: {
|
||||||
type: "string",
|
type: "string",
|
||||||
name: "name",
|
name: "name",
|
||||||
visible: true,
|
visible: false,
|
||||||
order: 2,
|
order: 2,
|
||||||
width: 80,
|
width: 80,
|
||||||
constraints: {
|
constraints: {
|
||||||
|
@ -76,7 +76,7 @@ describe("table sdk", () => {
|
||||||
description: {
|
description: {
|
||||||
type: "string",
|
type: "string",
|
||||||
name: "description",
|
name: "description",
|
||||||
visible: true,
|
visible: false,
|
||||||
width: 200,
|
width: 200,
|
||||||
constraints: {
|
constraints: {
|
||||||
type: "string",
|
type: "string",
|
||||||
|
@ -85,7 +85,7 @@ describe("table sdk", () => {
|
||||||
id: {
|
id: {
|
||||||
type: "number",
|
type: "number",
|
||||||
name: "id",
|
name: "id",
|
||||||
visible: true,
|
visible: false,
|
||||||
order: 1,
|
order: 1,
|
||||||
constraints: {
|
constraints: {
|
||||||
type: "number",
|
type: "number",
|
||||||
|
|
Loading…
Reference in New Issue