From c543cb143a13c5c2710196fc131193d15f3845dd Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Thu, 26 Mar 2020 17:39:42 +0000 Subject: [PATCH] drilldown complete, deleting model fields --- .../builder/src/builderStore/store/backend.js | 2 +- .../ModelDataTable/ModelDataTable.svelte | 2 +- .../ModelDataTable/modals/CreateUser.svelte | 6 ++++ .../builder/src/database/ModelView.svelte | 34 +++++++++++++------ packages/builder/src/nav/DatabasesList.svelte | 9 +++-- 5 files changed, 37 insertions(+), 16 deletions(-) diff --git a/packages/builder/src/builderStore/store/backend.js b/packages/builder/src/builderStore/store/backend.js index 268b1e7bf2..f6b20e7a90 100644 --- a/packages/builder/src/builderStore/store/backend.js +++ b/packages/builder/src/builderStore/store/backend.js @@ -56,7 +56,7 @@ export const getBackendUiStore = () => { }, views: { select: view => store.update(state => { - state.selectedView = { ...state.selectedView, ...view } + state.selectedView = view return state }) }, diff --git a/packages/builder/src/database/ModelDataTable/ModelDataTable.svelte b/packages/builder/src/database/ModelDataTable/ModelDataTable.svelte index 845b8414f0..5c2fb2182a 100644 --- a/packages/builder/src/database/ModelDataTable/ModelDataTable.svelte +++ b/packages/builder/src/database/ModelDataTable/ModelDataTable.svelte @@ -74,7 +74,7 @@ ) async function fetchRecordsForView(view, instance) { - if (!view.name) return + if (!view || !view.name) return const viewName = $backendUiStore.selectedRecord ? `${$backendUiStore.selectedRecord.key}/${view.name}` diff --git a/packages/builder/src/database/ModelDataTable/modals/CreateUser.svelte b/packages/builder/src/database/ModelDataTable/modals/CreateUser.svelte index 7512686130..9cbac0b95d 100644 --- a/packages/builder/src/database/ModelDataTable/modals/CreateUser.svelte +++ b/packages/builder/src/database/ModelDataTable/modals/CreateUser.svelte @@ -59,4 +59,10 @@ left: 0; background: #fafafa; } + select { + width: 100%; + } + option { + padding: 10px; + } diff --git a/packages/builder/src/database/ModelView.svelte b/packages/builder/src/database/ModelView.svelte index c205c65cc0..6abafdeb1f 100644 --- a/packages/builder/src/database/ModelView.svelte +++ b/packages/builder/src/database/ModelView.svelte @@ -29,7 +29,10 @@ $: models = $store.hierarchy.children $: parent = record && record.parent() $: isChildModel = parent.name !== "root" - $: modelExistsInHierarchy = getNode($store.hierarchy, $store.currentNode.nodeId) + $: modelExistsInHierarchy = getNode( + $store.hierarchy, + $store.currentNode.nodeId + ) store.subscribe($store => { record = $store.currentNode @@ -112,7 +115,7 @@
- + {#if isChildModel}
@@ -133,6 +136,7 @@ Name Type Values + @@ -146,24 +150,32 @@ {field.type} {field.typeOptions.values} + + deleteField(field)} /> + {/each} - - {#if modelExistsInHierarchy} + {#if modelExistsInHierarchy} +
Create Child Model on {record.name} - { - backendUiStore.actions.modals.show("VIEW") - await tick() - store.newChildIndex() - }}> + { + backendUiStore.actions.modals.show('VIEW') + await tick() + store.newChildIndex() + }}> Create Child View on {record.name} - {/if} - +
+ {/if} + {:else} + import { tick } from "svelte"; import { store, backendUiStore } from "../builderStore" import getIcon from "../common/icon" import { CheckIcon } from "../common/Icons" $: instances = $store.appInstances + $: views = $store.hierarchy.indexes - function selectDatabase(database) { - backendUiStore.actions.database.select(database) - backendUiStore.actions.records.select(null) + async function selectDatabase(database) { backendUiStore.actions.navigate("DATABASE") + backendUiStore.actions.records.select(null) + backendUiStore.actions.views.select(views[0]) + backendUiStore.actions.database.select(database) }