From 96a1bc52de9b07151c18c3b5d247c09a57ddd3cc Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Thu, 7 May 2020 14:59:06 +0100 Subject: [PATCH] added model props --- .../builder/src/builderStore/store/backend.js | 13 +-- .../builder/src/builderStore/store/index.js | 10 +- .../ModelDataTable/ModelDataTable.svelte | 9 -- .../modals/CreateEditRecord.svelte | 14 --- .../src/components/nav/DatabasesList.svelte | 1 - .../userInterface/PropControl.svelte | 2 +- .../userInterface/StateBindingControl.svelte | 12 ++- .../userInterface/pagesParsing/createProps.js | 11 +-- .../userInterface/pagesParsing/types.js | 3 + .../backend/database/_layout.svelte | 1 - .../[application]/frontend/_layout.svelte | 1 - packages/standard-components/components.json | 15 +-- .../standard-components/src/DataChart.svelte | 99 +++++++++++++++++++ scripts/symlinkDev.js | 17 ++-- 14 files changed, 131 insertions(+), 77 deletions(-) create mode 100644 packages/standard-components/src/DataChart.svelte diff --git a/packages/builder/src/builderStore/store/backend.js b/packages/builder/src/builderStore/store/backend.js index a28be5d982..a7bb363f09 100644 --- a/packages/builder/src/builderStore/store/backend.js +++ b/packages/builder/src/builderStore/store/backend.js @@ -80,15 +80,4 @@ export const createDatabaseForApp = store => appInstance => { state.appInstances.push(appInstance) return state }) -} - -export const saveBackend = async state => { - await api.post(`/_builder/api/${state.appname}/backend`, { - appDefinition: { - hierarchy: state.hierarchy, - actions: state.actions, - triggers: state.triggers, - }, - accessLevels: state.accessLevels, - }) -} +} \ No newline at end of file diff --git a/packages/builder/src/builderStore/store/index.js b/packages/builder/src/builderStore/store/index.js index d1d4aa3e6d..3baaa2558f 100644 --- a/packages/builder/src/builderStore/store/index.js +++ b/packages/builder/src/builderStore/store/index.js @@ -24,7 +24,6 @@ export const getStore = () => { const initial = { apps: [], appname: "", - hierarchy: {}, pages: DEFAULT_PAGES_OBJECT, mainUi: {}, unauthenticatedUi: {}, @@ -44,14 +43,7 @@ export const getStore = () => { store.setPackage = setPackage(store, initial) - // store.saveLevel = backendStoreActions.saveLevel(store) - // store.deleteLevel = backendStoreActions.deleteLevel(store) store.createDatabaseForApp = backendStoreActions.createDatabaseForApp(store) - // store.saveAction = backendStoreActions.saveAction(store) - // store.deleteAction = backendStoreActions.deleteAction(store) - // store.saveTrigger = backendStoreActions.saveTrigger(store) - // store.deleteTrigger = backendStoreActions.deleteTrigger(store) - // store.importAppDefinition = importAppDefinition(store) store.saveScreen = saveScreen(store) store.renameScreen = renameScreen(store) @@ -364,7 +356,7 @@ const addChildComponent = store => (componentToAdd, presetName) => { : state.components[componentToAdd] const presetProps = presetName ? component.presets[presetName] : {} - const newComponent = createProps(component, presetProps) + const newComponent = createProps(component, presetProps, state) state.currentComponentInfo._children = state.currentComponentInfo._children.concat( newComponent.props diff --git a/packages/builder/src/components/database/ModelDataTable/ModelDataTable.svelte b/packages/builder/src/components/database/ModelDataTable/ModelDataTable.svelte index b84bd319ee..7729bb23d3 100644 --- a/packages/builder/src/components/database/ModelDataTable/ModelDataTable.svelte +++ b/packages/builder/src/components/database/ModelDataTable/ModelDataTable.svelte @@ -80,15 +80,6 @@ currentPage * ITEMS_PER_PAGE + ITEMS_PER_PAGE ) - function drillIntoRecord(record) { - backendUiStore.update(state => { - state.breadcrumbs = [...state.breadcrumbs, record.type, record.id] - state.selectedRecord = record - state.selectedView = childViewsForRecord($store.hierarchy)[0] - return state - }) - } - onMount(() => { if (views.length) { backendUiStore.actions.views.select(views[0]) diff --git a/packages/builder/src/components/database/ModelDataTable/modals/CreateEditRecord.svelte b/packages/builder/src/components/database/ModelDataTable/modals/CreateEditRecord.svelte index 53cbe5e45c..183c7b3f6e 100644 --- a/packages/builder/src/components/database/ModelDataTable/modals/CreateEditRecord.svelte +++ b/packages/builder/src/components/database/ModelDataTable/modals/CreateEditRecord.svelte @@ -20,10 +20,6 @@ $: instanceId = $backendUiStore.selectedDatabase.id - $: models = $backendUiStore.selectedRecord - ? childModelsForModel($store.hierarchy) - : $store.hierarchy.children - $: modelSchema = $backendUiStore.selectedModel ? Object.entries($backendUiStore.selectedModel.schema) : [] @@ -65,16 +61,6 @@

Create / Edit Record

- {#if !record} -
- - -
- {/if} {#each modelSchema as [key, meta]}
{prop_name} setProp(prop_name, v)} /> diff --git a/packages/builder/src/components/userInterface/StateBindingControl.svelte b/packages/builder/src/components/userInterface/StateBindingControl.svelte index 266b61cd50..9dfff26991 100644 --- a/packages/builder/src/components/userInterface/StateBindingControl.svelte +++ b/packages/builder/src/components/userInterface/StateBindingControl.svelte @@ -1,4 +1,5 @@ + + + + + + + + {#each headers as header} + + {/each} + + + + {#each data as row} + + {#each headers as header} + {#if row[header]} + + {/if} + {/each} + + {/each} + +
{header}
{row[header]}
+ + + + diff --git a/scripts/symlinkDev.js b/scripts/symlinkDev.js index 5c258b84fb..9792a4529e 100755 --- a/scripts/symlinkDev.js +++ b/scripts/symlinkDev.js @@ -9,29 +9,28 @@ const fs = require("fs") const { resolve } = require("path") +const rimraf = require("rimraf"); -const devDir = "/tmp/.budibase/@budibase" +const devDir = "/tmp/.budibase" -// create the dev directory if it doesn't exist -if (!fs.existsSync(devDir)) { - fs.mkdirSync(devDir, { recursive: true }) -} +rimraf.sync(devDir); +fs.mkdirSync(`${devDir}/@budibase`, { recursive: true }) const SYMLINK_PATHS = [ { - symlink: "/tmp/.budibase/@budibase/materialdesign-components", + symlink: `${devDir}/@budibase/materialdesign-components`, destination: resolve("packages/materialdesign-components"), }, { - symlink: "/tmp/.budibase/@budibase/standard-components", + symlink: `${devDir}/@budibase/standard-components`, destination: resolve("packages/standard-components"), }, { - symlink: "/tmp/.budibase/budibase-client.esm.mjs", + symlink: `${devDir}/budibase-client.esm.mjs`, destination: resolve("packages/client/dist/budibase-client.esm.mjs"), }, { - symlink: "/tmp/.budibase/budibase-client.js", + symlink: `${devDir}/budibase-client.js`, destination: resolve("packages/client/dist/budibase-client.js"), }, ]