diff --git a/packages/builder/src/components/database/ModelDataTable/modals/CreateEditModel/CreateEditModel.svelte b/packages/builder/src/components/database/ModelDataTable/modals/CreateEditModel/CreateEditModel.svelte index 6e1a1d564b..2cb718c278 100644 --- a/packages/builder/src/components/database/ModelDataTable/modals/CreateEditModel/CreateEditModel.svelte +++ b/packages/builder/src/components/database/ModelDataTable/modals/CreateEditModel/CreateEditModel.svelte @@ -37,7 +37,7 @@
{#if !showFieldView} -

Create / Edit Model

+

Create / Edit Table

{:else}

Create / Edit Field

diff --git a/packages/builder/src/components/nav/ModelNavigator/EmptyModel.svelte b/packages/builder/src/components/nav/ModelNavigator/EmptyModel.svelte index da01963937..4541c095d3 100644 --- a/packages/builder/src/components/nav/ModelNavigator/EmptyModel.svelte +++ b/packages/builder/src/components/nav/ModelNavigator/EmptyModel.svelte @@ -19,19 +19,19 @@ ...rest, }, }) - notifier.success(`${model.name} model created.`) + notifier.success(`${model.name} table created.`) }
-

Create New Model

-

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

+

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 model quicker.

+

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

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

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

+

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

{#each Object.values(BLOCKS) as field}
- Models -

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

+ Tables +

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

{#each Object.values(MODELS) as model} {#if selectedTab === 'NAVIGATE'}
{#each $backendUiStore.models as model} diff --git a/packages/builder/src/components/nav/ModelSetupNav/ModelSetupNav.svelte b/packages/builder/src/components/nav/ModelSetupNav/ModelSetupNav.svelte index 39be32bf07..e1f4d3601b 100644 --- a/packages/builder/src/components/nav/ModelSetupNav/ModelSetupNav.svelte +++ b/packages/builder/src/components/nav/ModelSetupNav/ModelSetupNav.svelte @@ -52,7 +52,35 @@ }) } + function validate() { + let errors = [] + for (let field of Object.values($backendUiStore.draftModel.schema)) { + const restrictedFieldNames = ["type", "modelId"] + if (field.name.startsWith("_")) { + errors.push(`field '${field.name}' - name cannot begin with '_''`) + } else if (restrictedFieldNames.includes(field.name)) { + errors.push(`field '${field.name}' - is a restricted name, please rename`) + } else if (!field.name || !field.name.trim()) { + errors.push("field name cannot be blank") + } + } + + if (!$backendUiStore.draftModel.name) { + errors.push("Table name cannot be blank") + } + + return errors + } + async function saveModel() { + const errors = validate() + if (errors.length > 0) { + notifier.danger( + errors.join("/n") + ) + return + } + await backendUiStore.actions.models.save({ model: $backendUiStore.draftModel, }) diff --git a/packages/builder/src/components/userInterface/Colorpicker/components/CheckedBackground.svelte b/packages/builder/src/components/userInterface/Colorpicker/components/CheckedBackground.svelte index 2baa6b466e..c1a3c2f6fc 100644 --- a/packages/builder/src/components/userInterface/Colorpicker/components/CheckedBackground.svelte +++ b/packages/builder/src/components/userInterface/Colorpicker/components/CheckedBackground.svelte @@ -1,5 +1,5 @@ - -
- -
- -
- -
-
-
- -
- -
-
- setHue(hue.detail)} - on:dragend={dispatchValue} /> - - - setAlpha(alpha.detail, isDrag)} - on:dragend={dispatchValue} /> - - -
-
- - {#if !disableSwatches} -
- {#if hasSwatches} - {#each swatches as color, idx} - {#if idx < 12} - applySwatch(color)} - on:removeswatch={() => removeSwatch(idx)} /> - {/if} - {/each} - {/if} - {#if swatches.length < 12} -
- + -
- {/if} -
- {/if} - -
- - handleColorInput(event.target.value)} - on:change={dispatchInputChange} /> -
-
- -
- - + + +
+ +
+ +
+ +
+
+
+ +
+ +
+
+ setHue(hue.detail)} + on:dragend={dispatchValue} /> + + + setAlpha(alpha.detail, isDrag)} + on:dragend={dispatchValue} /> + + +
+
+ + {#if !disableSwatches} +
+ {#if hasSwatches} + {#each swatches as color, idx} + {#if idx < 12} + applySwatch(color)} + on:removeswatch={() => removeSwatch(idx)} /> + {/if} + {/each} + {/if} + {#if swatches.length < 12} +
+ + +
+ {/if} +
+ {/if} + +
+ + handleColorInput(event.target.value)} + on:change={dispatchInputChange} /> +
+
+ +
+ diff --git a/packages/builder/src/components/userInterface/Colorpicker/components/Colorpreview.svelte b/packages/builder/src/components/userInterface/Colorpicker/components/Colorpreview.svelte index a28c8d2560..f3ab6f6f22 100644 --- a/packages/builder/src/components/userInterface/Colorpicker/components/Colorpreview.svelte +++ b/packages/builder/src/components/userInterface/Colorpicker/components/Colorpreview.svelte @@ -1,93 +1,141 @@ + +
@@ -127,41 +175,3 @@
{/if}
- - diff --git a/packages/builder/src/components/userInterface/temporaryPanelStructure.js b/packages/builder/src/components/userInterface/temporaryPanelStructure.js index 99692d2827..73bd9dd9b7 100644 --- a/packages/builder/src/components/userInterface/temporaryPanelStructure.js +++ b/packages/builder/src/components/userInterface/temporaryPanelStructure.js @@ -313,7 +313,7 @@ export default { icon: "ri-archive-drawer-fill", properties: { design: { ...all }, - settings: [{ label: "Model", key: "model", control: ModelSelect }], + settings: [{ label: "Table", key: "model", control: ModelSelect }], }, children: [], }, @@ -331,7 +331,7 @@ export default { design: { ...all }, settings: [ { - label: "Model", + label: "Table", key: "model", control: ModelSelect, }, @@ -351,7 +351,7 @@ export default { design: { ...all }, settings: [ { - label: "Model", + label: "Table", key: "model", control: ModelSelect, }, @@ -368,7 +368,7 @@ export default { properties: { design: { ...all }, settings: [ - { label: "Model", key: "model", control: ModelSelect }, + { label: "Table", key: "model", control: ModelSelect }, { label: "Chart Type", key: "type", @@ -399,18 +399,18 @@ export default { icon: "ri-file-list-fill", properties: { design: { ...all }, - settings: [{ label: "Model", key: "model", control: ModelSelect }], + settings: [{ label: "Table", key: "model", control: ModelSelect }], }, children: [], }, { name: "List", _component: "@budibase/standard-components/list", - description: "Renders all children once per record, of a given model", + description: "Renders all children once per record, of a given table", icon: "ri-file-list-fill", properties: { design: { ...all }, - settings: [{ label: "Model", key: "model", control: ModelSelect }], + settings: [{ label: "Table", key: "model", control: ModelSelect }], }, children: [], }, @@ -422,7 +422,7 @@ export default { icon: "ri-profile-line", properties: { design: { ...all }, - settings: [{ label: "Model", key: "model", control: ModelSelect }], + settings: [{ label: "Table", key: "model", control: ModelSelect }], }, children: [], }, diff --git a/packages/builder/src/pages/[application]/backend/model/[selectedModel]/index.svelte b/packages/builder/src/pages/[application]/backend/model/[selectedModel]/index.svelte index 232a569caa..3b2c43a178 100644 --- a/packages/builder/src/pages/[application]/backend/model/[selectedModel]/index.svelte +++ b/packages/builder/src/pages/[application]/backend/model/[selectedModel]/index.svelte @@ -28,7 +28,7 @@ {:else if $backendUiStore.selectedDatabase._id && selectedModel.name} {:else} - create your first model to start building + create your first table to start building {/if}