diff --git a/packages/builder/src/builderStore/store/backend.js b/packages/builder/src/builderStore/store/backend.js index 153cba784f..268b1e7bf2 100644 --- a/packages/builder/src/builderStore/store/backend.js +++ b/packages/builder/src/builderStore/store/backend.js @@ -49,6 +49,10 @@ export const getBackendUiStore = () => { state.breadcrumbs = [state.selectedDatabase.name, record.id] return state }), + select: record => store.update(state => { + state.selectedRecord = record + return state + }) }, views: { select: view => store.update(state => { @@ -59,6 +63,13 @@ export const getBackendUiStore = () => { modals: { show: modal => store.update(state => ({ ...state, visibleModal: modal })), hide: () => store.update(state => ({ ...state, visibleModal: null })) + }, + users: { + create: user => store.update(state => { + state.users.push(user) + state.users = state.users + return state + }) } } diff --git a/packages/builder/src/database/ActionsHeader.svelte b/packages/builder/src/database/ActionsHeader.svelte index f012bd2bb3..42661efef1 100644 --- a/packages/builder/src/database/ActionsHeader.svelte +++ b/packages/builder/src/database/ActionsHeader.svelte @@ -29,6 +29,8 @@ Save + + diff --git a/packages/builder/src/database/IndexView.svelte b/packages/builder/src/database/IndexView.svelte index 6028f76e77..c0fabcb5b4 100644 --- a/packages/builder/src/database/IndexView.svelte +++ b/packages/builder/src/database/IndexView.svelte @@ -7,7 +7,7 @@ import { filter, some, map, compose } from "lodash/fp" import { hierarchy as hierarchyFunctions, common } from "../../../core/src" import ErrorsBox from "../common/ErrorsBox.svelte" - + const SNIPPET_EDITORS = { MAP: "Map", FILTER: "Filter", @@ -21,7 +21,9 @@ const indexableRecordsFromIndex = compose( map(node => ({ node, - isallowed: index.allowedRecordNodeIds.some(id => node.nodeId === id), + isallowed: + index.allowedRecordNodeIds && + index.allowedRecordNodeIds.some(id => node.nodeId === id), })), filter(hierarchyFunctions.isRecord), filter(hierarchyFunctions.isDecendant($store.currentNode.parent())), diff --git a/packages/builder/src/database/ModelDataTable/modals/CreateEditRecord.svelte b/packages/builder/src/database/ModelDataTable/modals/CreateEditRecord.svelte index 5ed2eb9efd..23e85900c2 100644 --- a/packages/builder/src/database/ModelDataTable/modals/CreateEditRecord.svelte +++ b/packages/builder/src/database/ModelDataTable/modals/CreateEditRecord.svelte @@ -1,7 +1,7 @@ diff --git a/packages/builder/src/database/ModelView.svelte b/packages/builder/src/database/ModelView.svelte index 16e2dd85bb..468049ec12 100644 --- a/packages/builder/src/database/ModelView.svelte +++ b/packages/builder/src/database/ModelView.svelte @@ -2,12 +2,14 @@ import Textbox from "../common/Textbox.svelte" import Button from "../common/Button.svelte" import Select from "../common/Select.svelte" + import ActionButton from "../common/ActionButton.svelte" import getIcon from "../common/icon" import FieldView from "./FieldView.svelte" import Modal from "../common/Modal.svelte" import { map, join, filter, some, find, keys, isDate } from "lodash/fp" import { store } from "../builderStore" import { common, hierarchy } from "../../../core/src" + import { getNode } from "../common/core" import { templateApi, pipe, validate } from "../common/core" import ActionsHeader from "./ActionsHeader.svelte" import ErrorsBox from "../common/ErrorsBox.svelte" @@ -22,9 +24,11 @@ let deleteField let onFinishedFieldEdit let editIndex - let parentRecord $: models = $store.hierarchy.children + $: parent = record && record.parent() + $: isChildModel = parent.name !== "root" + $: modelExistsInHierarchy = getNode($store.hierarchy, $store.currentNode.nodeId) store.subscribe($store => { record = $store.currentNode @@ -107,23 +111,13 @@
-
- + + {#if isChildModel}
-
- -
+
{parent.name}
+ {/if}
@@ -155,7 +149,13 @@ {/each} - + + {#if modelExistsInHierarchy} + + Create Child Model on {record.name} + + {/if} + {:else} diff --git a/packages/builder/src/nav/DatabasesList.svelte b/packages/builder/src/nav/DatabasesList.svelte index c58ac23c84..582d73661d 100644 --- a/packages/builder/src/nav/DatabasesList.svelte +++ b/packages/builder/src/nav/DatabasesList.svelte @@ -7,6 +7,7 @@ function selectDatabase(database) { backendUiStore.actions.database.select(database) + backendUiStore.actions.records.select(null) backendUiStore.actions.navigate("DATABASE") } diff --git a/packages/builder/src/nav/UsersList.svelte b/packages/builder/src/nav/UsersList.svelte index b9db50d970..e39d137b8b 100644 --- a/packages/builder/src/nav/UsersList.svelte +++ b/packages/builder/src/nav/UsersList.svelte @@ -21,6 +21,10 @@ const FETCH_USERS_URL = `/_builder/instance/${currentAppInfo.appname}/${currentAppInfo.instanceId}/api/users` const response = await api.get(FETCH_USERS_URL); users = await response.json() + backendUiStore.update(state => { + state.users = users + return state + }) } onMount(fetchUsers)