From 63f3623664852844ea986f73e5f7e875ec4ebd39 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Fri, 7 Aug 2020 16:13:57 +0100 Subject: [PATCH 1/8] creating rows and columns working --- packages/builder/package.json | 3 +- .../builder/src/builderStore/store/backend.js | 2 - .../ModelDataTable/ModelDataTable.svelte | 64 +++++-- .../CreateEditModel/CreateEditModel.svelte | 165 ------------------ .../modals/CreateEditRecord.svelte | 36 +--- .../modals/CreateEditTable.svelte | 143 +++++++++++++++ .../modals/RecordFieldControl.svelte | 40 +---- .../modals/tests/CreateEditTable.spec.js | 38 ++++ .../ModelDataTable/popovers/Column.svelte | 25 +++ .../popovers/ColumnHeader.svelte | 114 ++++++++++++ .../ModelDataTable/popovers/Row.svelte | 21 +++ .../ModelDataTable/popovers/View.svelte | 0 .../nav/ModelNavigator/EmptyModel.svelte | 16 +- .../nav/ModelNavigator/ModelNavigator.svelte | 19 +- .../builder/src/constants/backend/index.js | 37 +--- .../[application]/backend/_layout.svelte | 5 +- 16 files changed, 408 insertions(+), 320 deletions(-) delete mode 100644 packages/builder/src/components/database/ModelDataTable/modals/CreateEditModel/CreateEditModel.svelte create mode 100644 packages/builder/src/components/database/ModelDataTable/modals/CreateEditTable.svelte create mode 100644 packages/builder/src/components/database/ModelDataTable/modals/tests/CreateEditTable.spec.js create mode 100644 packages/builder/src/components/database/ModelDataTable/popovers/Column.svelte create mode 100644 packages/builder/src/components/database/ModelDataTable/popovers/ColumnHeader.svelte create mode 100644 packages/builder/src/components/database/ModelDataTable/popovers/Row.svelte create mode 100644 packages/builder/src/components/database/ModelDataTable/popovers/View.svelte diff --git a/packages/builder/package.json b/packages/builder/package.json index 7dfd29354a..f560d8b5c3 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -57,7 +57,7 @@ ] }, "dependencies": { - "@budibase/bbui": "^1.18.0", + "@budibase/bbui": "^1.22.3", "@budibase/client": "^0.1.1", "@budibase/colorpicker": "^1.0.1", "@nx-js/compiler-util": "^2.0.0", @@ -96,6 +96,7 @@ "cypress-terminal-report": "^1.4.1", "eslint-plugin-cypress": "^2.11.1", "http-proxy-middleware": "^0.19.1", + "identity-obj-proxy": "^3.0.0", "jest": "^24.8.0", "ncp": "^2.0.0", "npm-run-all": "^4.1.5", diff --git a/packages/builder/src/builderStore/store/backend.js b/packages/builder/src/builderStore/store/backend.js index 393371ce85..b0d5fcee29 100644 --- a/packages/builder/src/builderStore/store/backend.js +++ b/packages/builder/src/builderStore/store/backend.js @@ -61,7 +61,6 @@ export const getBackendUiStore = () => { state.draftModel = cloneDeep(model) state.selectedField = "" state.selectedView = `all_${model._id}` - state.tabs.SETUP_PANEL = "SETUP" return state }), save: async ({ model }) => { @@ -95,7 +94,6 @@ export const getBackendUiStore = () => { [field.name]: cloneDeep(field), } state.selectedField = field.name - state.tabs.NAVIGATION_PANEL = "NAVIGATE" return state }) diff --git a/packages/builder/src/components/database/ModelDataTable/ModelDataTable.svelte b/packages/builder/src/components/database/ModelDataTable/ModelDataTable.svelte index bbd9d6d4a3..becef0e117 100644 --- a/packages/builder/src/components/database/ModelDataTable/ModelDataTable.svelte +++ b/packages/builder/src/components/database/ModelDataTable/ModelDataTable.svelte @@ -1,12 +1,15 @@ - -
- {#if !showFieldView} - -

Create / Edit Table

- {:else} - -

Create / Edit Field

- {/if} -
-{#if !showFieldView} -
- {#if $store.errors && $store.errors.length > 0} - - {/if} -
- -
-
- Fields -
(showFieldView = true)}> - Add new field -
-
- - - - - - - - - - - {#each modelFields as [key, meta]} - - - - - - - {/each} - -
EditNameType -
- editField(meta)} /> - -
{key}
-
{meta.type} - deleteField(meta)} /> -
-
- Save -
-
-{:else} - (showFieldView = false)} /> -{/if} - - diff --git a/packages/builder/src/components/database/ModelDataTable/modals/CreateEditRecord.svelte b/packages/builder/src/components/database/ModelDataTable/modals/CreateEditRecord.svelte index f17730893c..af831d98cd 100644 --- a/packages/builder/src/components/database/ModelDataTable/modals/CreateEditRecord.svelte +++ b/packages/builder/src/components/database/ModelDataTable/modals/CreateEditRecord.svelte @@ -68,10 +68,7 @@
-
- -

Create / Edit Record

-
+
Add New Row
{#each modelSchema as [key, meta]} @@ -97,40 +94,11 @@
- +
diff --git a/packages/builder/src/components/database/ModelDataTable/modals/RecordFieldControl.svelte b/packages/builder/src/components/database/ModelDataTable/modals/RecordFieldControl.svelte index 465ca29c42..790b33604f 100644 --- a/packages/builder/src/components/database/ModelDataTable/modals/RecordFieldControl.svelte +++ b/packages/builder/src/components/database/ModelDataTable/modals/RecordFieldControl.svelte @@ -1,18 +1,13 @@ - - {#if type === 'select'} - {/each} - + {:else} - 0} {checked} {type} {value} on:input={handleInput} on:change={handleInput} /> -{/if} - - +{/if} \ No newline at end of file diff --git a/packages/builder/src/components/database/ModelDataTable/modals/tests/CreateEditTable.spec.js b/packages/builder/src/components/database/ModelDataTable/modals/tests/CreateEditTable.spec.js new file mode 100644 index 0000000000..97af4fd87f --- /dev/null +++ b/packages/builder/src/components/database/ModelDataTable/modals/tests/CreateEditTable.spec.js @@ -0,0 +1,38 @@ +import "@testing-library/jest-dom/extend-expect" +import { render, fireEvent } from "@testing-library/svelte" +import CreateEditTable from "../CreateEditTable.svelte"; + +const testField = { + field: {}, + name: "Yeet" +}; + +describe("", () => { + + describe("New Column", () => { + it("shows proper heading when rendered", () => { + const { getByText } = render(CreateEditTable, { name: 'World' }) + + expect(getByText('Hello World!')).toBeInTheDocument() + }) + }) + + describe("Edit Existing Column", () => { + const { getByText } = render(CreateEditTable, testField) + + }) + +}) + + +// // Note: This is as an async test as we are using `fireEvent` +// test('changes button text on click', async () => { +// const { getByText } = render(Comp, { name: 'World' }) +// const button = getByText('Button') + +// // Using await when firing events is unique to the svelte testing library because +// // we have to wait for the next `tick` so that Svelte flushes all pending state changes. +// await fireEvent.click(button) + +// expect(button).toHaveTextContent('Button Clicked') +// }) \ No newline at end of file diff --git a/packages/builder/src/components/database/ModelDataTable/popovers/Column.svelte b/packages/builder/src/components/database/ModelDataTable/popovers/Column.svelte new file mode 100644 index 0000000000..44bc751f5e --- /dev/null +++ b/packages/builder/src/components/database/ModelDataTable/popovers/Column.svelte @@ -0,0 +1,25 @@ + + +
+ +
+ + + + + diff --git a/packages/builder/src/components/database/ModelDataTable/popovers/ColumnHeader.svelte b/packages/builder/src/components/database/ModelDataTable/popovers/ColumnHeader.svelte new file mode 100644 index 0000000000..ab4ad05f86 --- /dev/null +++ b/packages/builder/src/components/database/ModelDataTable/popovers/ColumnHeader.svelte @@ -0,0 +1,114 @@ + + +
+ {field.name} + +
+ + {#if editing} +
Edit Column
+ + {:else} +
    +
  • + + Edit +
  • +
  • + + Delete +
  • +
  • + + Sort A - Z +
  • +
  • + + Sort Z - A +
  • +
+ {/if} +
+ + diff --git a/packages/builder/src/components/database/ModelDataTable/popovers/Row.svelte b/packages/builder/src/components/database/ModelDataTable/popovers/Row.svelte new file mode 100644 index 0000000000..3f01147943 --- /dev/null +++ b/packages/builder/src/components/database/ModelDataTable/popovers/Row.svelte @@ -0,0 +1,21 @@ + + +
+ +
+ + + + + diff --git a/packages/builder/src/components/database/ModelDataTable/popovers/View.svelte b/packages/builder/src/components/database/ModelDataTable/popovers/View.svelte new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/builder/src/components/nav/ModelNavigator/EmptyModel.svelte b/packages/builder/src/components/nav/ModelNavigator/EmptyModel.svelte index 4541c095d3..b43c7210a1 100644 --- a/packages/builder/src/components/nav/ModelNavigator/EmptyModel.svelte +++ b/packages/builder/src/components/nav/ModelNavigator/EmptyModel.svelte @@ -3,7 +3,7 @@ import { uuid } from "builderStore/uuid" import { fade } from "svelte/transition" import { notifier } from "builderStore/store/notifications" - import { FIELDS, BLOCKS, MODELS } from "constants/backend" + import { FIELDS, BLOCKS } from "constants/backend" import Block from "components/common/Block.svelte" function addNewField(field) { @@ -56,20 +56,6 @@ {/each} - -
- Tables -

Blocks are pre-made fields and help you build your table quicker.

-
- {#each Object.values(MODELS) as model} - createModel(model)} /> - {/each} -
-
diff --git a/packages/builder/src/components/database/ModelDataTable/popovers/ColumnHeader.svelte b/packages/builder/src/components/database/ModelDataTable/popovers/ColumnHeader.svelte index ab4ad05f86..a444ead1f1 100644 --- a/packages/builder/src/components/database/ModelDataTable/popovers/ColumnHeader.svelte +++ b/packages/builder/src/components/database/ModelDataTable/popovers/ColumnHeader.svelte @@ -23,7 +23,7 @@ } function deleteField() { - alert("Delete Field Not Implemented") + backendUiStore.actions.models.deleteField(field) } function save() {} @@ -88,27 +88,4 @@ li:active { color: var(--blue); } - - .editor { - padding: var(--spacing-xl); - } - - footer { - padding: var(--spacing-xl); - display: grid; - grid-template-columns: 1fr 1fr 1fr 1fr; - gap: 20px; - border-bottom-left-radius: 0.5rem; - border-bottom-left-radius: 0.5rem; - } - - .button-margin-3 { - grid-column-start: 3; - display: grid; - } - - .button-margin-4 { - grid-column-start: 4; - display: grid; - } diff --git a/packages/builder/src/components/nav/ModelNavigator/ModelNavigator.svelte b/packages/builder/src/components/nav/ModelNavigator/ModelNavigator.svelte index ccf9875b65..cfda2cdfaf 100644 --- a/packages/builder/src/components/nav/ModelNavigator/ModelNavigator.svelte +++ b/packages/builder/src/components/nav/ModelNavigator/ModelNavigator.svelte @@ -51,26 +51,19 @@ {#if $backendUiStore.selectedDatabase && $backendUiStore.selectedDatabase._id}
- - {#if selectedTab === 'NAVIGATE'} - -
- {#each $backendUiStore.models as model} - selectModel(model)} /> - {/each} -
- {:else if selectedTab === 'ADD'} - - {/if} -
+

Tables

+ +
+ {#each $backendUiStore.models as model} + selectModel(model)} /> + {/each} +
{/if} From de93c0f53027121dad228eca2d5de9e8f7c125b2 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Fri, 7 Aug 2020 18:31:40 +0100 Subject: [PATCH 3/8] new table creation --- .../cypress/integration/createModel.spec.js | 22 ----- .../cypress/integration/createTable.spec.js | 42 +++++++++ packages/builder/package.json | 1 + .../builder/src/builderStore/store/backend.js | 6 +- .../ModelDataTable/ModelDataTable.svelte | 60 ++---------- ...itTable.svelte => CreateEditColumn.svelte} | 4 - .../modals/CreateEditRecord.svelte | 5 - .../modals/tests/CreateEditTable.spec.js | 8 +- .../ModelDataTable/popovers/Column.svelte | 11 ++- .../popovers/ColumnHeader.svelte | 25 +++-- .../ModelDataTable/popovers/EditRow.svelte | 94 +++++++++++++++++++ .../ModelDataTable/popovers/Row.svelte | 6 +- .../nav/ModelNavigator/BlockNavigator.svelte | 91 ------------------ .../nav/ModelNavigator/CreateEditTable.svelte | 65 +++++++++++++ .../nav/ModelNavigator/EmptyModel.svelte | 93 ------------------ .../nav/ModelNavigator/ListItem.svelte | 1 + .../nav/ModelNavigator/ModelNavigator.svelte | 18 +--- .../nav/ModelSetupNav/ModelSetupNav.svelte | 6 +- .../model/[selectedModel]/index.svelte | 11 --- 19 files changed, 255 insertions(+), 314 deletions(-) delete mode 100644 packages/builder/cypress/integration/createModel.spec.js create mode 100644 packages/builder/cypress/integration/createTable.spec.js rename packages/builder/src/components/database/ModelDataTable/modals/{CreateEditTable.svelte => CreateEditColumn.svelte} (98%) create mode 100644 packages/builder/src/components/database/ModelDataTable/popovers/EditRow.svelte delete mode 100644 packages/builder/src/components/nav/ModelNavigator/BlockNavigator.svelte create mode 100644 packages/builder/src/components/nav/ModelNavigator/CreateEditTable.svelte delete mode 100644 packages/builder/src/components/nav/ModelNavigator/EmptyModel.svelte diff --git a/packages/builder/cypress/integration/createModel.spec.js b/packages/builder/cypress/integration/createModel.spec.js deleted file mode 100644 index 06b2420331..0000000000 --- a/packages/builder/cypress/integration/createModel.spec.js +++ /dev/null @@ -1,22 +0,0 @@ -xcontext('Create a Model', () => { - - before(() => { - cy.visit('localhost:4001/_builder') - // https://on.cypress.io/type - cy.createApp('Model App', 'Model App Description') - }) - - // https://on.cypress.io/interacting-with-elements - it('should create a new model', () => { - - cy.createModel('dog', 'name', 'age') - - // Check if model exists - cy.get('.title').should('have.text', 'dog') - }) - it('should add a record', () => { - cy.addRecord('bob', '15') - - cy.contains('bob').should('have.text', 'bob') - }) -}) diff --git a/packages/builder/cypress/integration/createTable.spec.js b/packages/builder/cypress/integration/createTable.spec.js new file mode 100644 index 0000000000..d44a7cc6d6 --- /dev/null +++ b/packages/builder/cypress/integration/createTable.spec.js @@ -0,0 +1,42 @@ +xcontext('Create a Table', () => { + + before(() => { + cy.visit('localhost:4001/_builder') + // https://on.cypress.io/type + cy.createApp('Table App', 'Table App Description') + }) + + // https://on.cypress.io/interacting-with-elements + it('should create a new Table', () => { + + cy.createTable('dog', 'name', 'age') + + // Check if Table exists + cy.get('.title').should('have.text', 'dog') + }) + + it('adds a new column to the table', () => { + cy.addRecord('bob', '15') + + cy.contains('bob').should('have.text', 'bob') + }) + + it('updates a column on the table', () => { + cy.addRecord('bob', '15') + + cy.contains('bob').should('have.text', 'bob') + }) + + it('edits a record', () => { + cy.addRecord('bob', '15') + + cy.contains('bob').should('have.text', 'bob') + }) + + it('deletes a record', () => { + cy.addRecord('bob', '15') + + cy.contains('bob').should('have.text', 'bob') + }) + +}) diff --git a/packages/builder/package.json b/packages/builder/package.json index 26af308a29..ca1a6082e9 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -66,6 +66,7 @@ "codemirror": "^5.51.0", "date-fns": "^1.29.0", "deepmerge": "^4.2.2", + "fast-sort": "^2.2.0", "feather-icons": "^4.21.0", "flatpickr": "^4.5.7", "lodash": "^4.17.13", diff --git a/packages/builder/src/builderStore/store/backend.js b/packages/builder/src/builderStore/store/backend.js index 5708c98a98..3063c71a82 100644 --- a/packages/builder/src/builderStore/store/backend.js +++ b/packages/builder/src/builderStore/store/backend.js @@ -63,7 +63,7 @@ export const getBackendUiStore = () => { state.selectedView = `all_${model._id}` return state }), - save: async ({ model }) => { + save: async model => { const updatedModel = cloneDeep(model) // update any renamed schema keys to reflect their names @@ -97,14 +97,14 @@ export const getBackendUiStore = () => { ...state.draftModel.schema, [field.name]: cloneDeep(field), } - store.actions.models.save({ model: state.draftModel }) + store.actions.models.save(state.draftModel) return state }) }, deleteField: field => { store.update(state => { delete state.draftModel.schema[field.name] - store.actions.models.save({ model: state.draftModel }) + store.actions.models.save(state.draftModel) return state }) } diff --git a/packages/builder/src/components/database/ModelDataTable/ModelDataTable.svelte b/packages/builder/src/components/database/ModelDataTable/ModelDataTable.svelte index becef0e117..7476e7454e 100644 --- a/packages/builder/src/components/database/ModelDataTable/ModelDataTable.svelte +++ b/packages/builder/src/components/database/ModelDataTable/ModelDataTable.svelte @@ -1,5 +1,6 @@
-
Add New Row
{#each modelSchema as [key, meta]} diff --git a/packages/builder/src/components/database/ModelDataTable/modals/tests/CreateEditTable.spec.js b/packages/builder/src/components/database/ModelDataTable/modals/tests/CreateEditTable.spec.js index 97af4fd87f..44e866ddb3 100644 --- a/packages/builder/src/components/database/ModelDataTable/modals/tests/CreateEditTable.spec.js +++ b/packages/builder/src/components/database/ModelDataTable/modals/tests/CreateEditTable.spec.js @@ -1,24 +1,24 @@ import "@testing-library/jest-dom/extend-expect" import { render, fireEvent } from "@testing-library/svelte" -import CreateEditTable from "../CreateEditTable.svelte"; +import CreateEditColumn from "../CreateEditColumn.svelte"; const testField = { field: {}, name: "Yeet" }; -describe("", () => { +describe("", () => { describe("New Column", () => { it("shows proper heading when rendered", () => { - const { getByText } = render(CreateEditTable, { name: 'World' }) + const { getByText } = render(CreateEditColumn, { name: 'World' }) expect(getByText('Hello World!')).toBeInTheDocument() }) }) describe("Edit Existing Column", () => { - const { getByText } = render(CreateEditTable, testField) + const { getByText } = render(CreateEditColumn, testField) }) diff --git a/packages/builder/src/components/database/ModelDataTable/popovers/Column.svelte b/packages/builder/src/components/database/ModelDataTable/popovers/Column.svelte index 44f733ca06..8230bcecb5 100644 --- a/packages/builder/src/components/database/ModelDataTable/popovers/Column.svelte +++ b/packages/builder/src/components/database/ModelDataTable/popovers/Column.svelte @@ -4,7 +4,7 @@ import { FIELDS } from "constants/backend" import { ModelSetupNav } from "components/nav/ModelSetupNav" import ModelFieldEditor from "components/nav/ModelSetupNav/ModelFieldEditor.svelte" - import CreateEditTable from "../modals/CreateEditTable.svelte" + import CreateEditColumn from "../modals/CreateEditColumn.svelte" let anchor let dropdown @@ -18,10 +18,13 @@
-
Create Column
- +

Create Column

+
diff --git a/packages/builder/src/components/database/ModelDataTable/popovers/ColumnHeader.svelte b/packages/builder/src/components/database/ModelDataTable/popovers/ColumnHeader.svelte index a444ead1f1..c0862c97cb 100644 --- a/packages/builder/src/components/database/ModelDataTable/popovers/ColumnHeader.svelte +++ b/packages/builder/src/components/database/ModelDataTable/popovers/ColumnHeader.svelte @@ -4,7 +4,7 @@ import { FIELDS } from "constants/backend" import { ModelSetupNav } from "components/nav/ModelSetupNav" import ModelFieldEditor from "components/nav/ModelSetupNav/ModelFieldEditor.svelte" - import CreateEditTable from "../modals/CreateEditTable.svelte" + import CreateEditColumn from "../modals/CreateEditColumn.svelte" export let field @@ -26,7 +26,13 @@ backendUiStore.actions.models.deleteField(field) } - function save() {} + function sort(direction, column) { + backendUiStore.update(state => { + state.sort = { direction, column } + return state + }) + hideEditor() + }
@@ -35,9 +41,9 @@
{#if editing} -
Edit Column
- Edit Column + {:else} @@ -50,11 +56,11 @@ Delete -
  • +
  • sort('asc', field.name)}> Sort A - Z
  • -
  • +
  • sort('desc', field.name)}> Sort Z - A
  • @@ -63,6 +69,11 @@
    diff --git a/packages/builder/src/components/database/ModelDataTable/popovers/Row.svelte b/packages/builder/src/components/database/ModelDataTable/popovers/Row.svelte index 3f01147943..bd50b5215e 100644 --- a/packages/builder/src/components/database/ModelDataTable/popovers/Row.svelte +++ b/packages/builder/src/components/database/ModelDataTable/popovers/Row.svelte @@ -13,9 +13,13 @@ +

    Add New Row

    diff --git a/packages/builder/src/components/nav/ModelNavigator/BlockNavigator.svelte b/packages/builder/src/components/nav/ModelNavigator/BlockNavigator.svelte deleted file mode 100644 index a1eb2b7d3b..0000000000 --- a/packages/builder/src/components/nav/ModelNavigator/BlockNavigator.svelte +++ /dev/null @@ -1,91 +0,0 @@ - - -
    -
    - {#each HEADINGS as tab} - (selectedTab = tab.key)}> - {tab.title} - - {/each} -
    - -
    - {#each Object.values(blockDefinitions[selectedTab]) as blockDefinition} - addField(blockDefinition)} - title={blockDefinition.name} - icon={blockDefinition.icon} /> - {/each} -
    -
    - - diff --git a/packages/builder/src/components/nav/ModelNavigator/CreateEditTable.svelte b/packages/builder/src/components/nav/ModelNavigator/CreateEditTable.svelte new file mode 100644 index 0000000000..201d6d03c0 --- /dev/null +++ b/packages/builder/src/components/nav/ModelNavigator/CreateEditTable.svelte @@ -0,0 +1,65 @@ + + +
    + +
    + +
    +

    Create Table

    + +
    +
    +
    + +
    +
    + +
    +
    +
    + + diff --git a/packages/builder/src/components/nav/ModelNavigator/EmptyModel.svelte b/packages/builder/src/components/nav/ModelNavigator/EmptyModel.svelte deleted file mode 100644 index b43c7210a1..0000000000 --- a/packages/builder/src/components/nav/ModelNavigator/EmptyModel.svelte +++ /dev/null @@ -1,93 +0,0 @@ - - -
    -
    -

    Create New Table

    -

    Before you can view your table, you need to set it up.

    -
    - -
    - Fields -

    Blocks are pre-made fields and help you build your table quicker.

    -
    - {#each Object.values(FIELDS) as field} - addNewField(field)} /> - {/each} -
    -
    - -
    - Blocks -

    Blocks are pre-made fields and help you build your table quicker.

    -
    - {#each Object.values(BLOCKS) as field} - addNewField(field)} /> - {/each} -
    -
    -
    - - diff --git a/packages/builder/src/components/nav/ModelNavigator/ListItem.svelte b/packages/builder/src/components/nav/ModelNavigator/ListItem.svelte index 83d83487a3..34fc577b7f 100644 --- a/packages/builder/src/components/nav/ModelNavigator/ListItem.svelte +++ b/packages/builder/src/components/nav/ModelNavigator/ListItem.svelte @@ -9,6 +9,7 @@
    {title} +
    diff --git a/packages/builder/src/components/database/ModelDataTable/modals/CreateEditColumn.svelte b/packages/builder/src/components/database/ModelDataTable/modals/CreateEditColumn.svelte index 892d50ac5a..833c49a7ce 100644 --- a/packages/builder/src/components/database/ModelDataTable/modals/CreateEditColumn.svelte +++ b/packages/builder/src/components/database/ModelDataTable/modals/CreateEditColumn.svelte @@ -18,9 +18,8 @@ export let onClosed export let field = {} - export let columnName - let originalName = columnName + let originalName = field.name $: required = field.constraints && @@ -36,10 +35,7 @@ backendUiStore.update(state => { backendUiStore.actions.models.saveField({ originalName, - field: { - ...field, - name: columnName - } + field }) return state @@ -49,7 +45,7 @@
    - + +