diff --git a/packages/builder/src/components/backend/ModelNavigator/ModelNavigator.svelte b/packages/builder/src/components/backend/ModelNavigator/ModelNavigator.svelte index 7cd3101d59..627acab415 100644 --- a/packages/builder/src/components/backend/ModelNavigator/ModelNavigator.svelte +++ b/packages/builder/src/components/backend/ModelNavigator/ModelNavigator.svelte @@ -2,7 +2,7 @@ import { goto } from "@sveltech/routify" import { backendUiStore } from "builderStore" import ListItem from "./ListItem.svelte" - import CreateTablePopover from "./popovers/CreateTablePopover.svelte" + import CreateTableModal from "./modals/CreateTableModal.svelte" import EditTablePopover from "./popovers/EditTablePopover.svelte" import EditViewPopover from "./popovers/EditViewPopover.svelte" import { Heading } from "@budibase/bbui" @@ -28,7 +28,7 @@
Tables - +
{#each $backendUiStore.models as model} + import { goto } from "@sveltech/routify" + import { backendUiStore } from "builderStore" + import { notifier } from "builderStore/store/notifications" + import { Button, Input, Label } from "@budibase/bbui" + import Spinner from "components/common/Spinner.svelte" + import TableDataImport from "../TableDataImport.svelte" + import analytics from "analytics" + import { Modal } from "components/common/Modal" + + let visible = false + let name + let dataImport + let loading = false + + function resetState() { + name = "" + dataImport = undefined + loading = false + } + + async function saveTable() { + loading = true + const model = await backendUiStore.actions.models.save({ + name, + schema: dataImport.schema || {}, + dataImport, + }) + notifier.success(`Table ${name} created successfully.`) + $goto(`./model/${model._id}`) + analytics.captureEvent("Table Created", { name }) + visible = false + resetState() + } + + function onClosed() { + visible = false + resetState() + } + + + + + +
+ + +
+
diff --git a/packages/builder/src/components/backend/ModelNavigator/popovers/CreateTablePopover.svelte b/packages/builder/src/components/backend/ModelNavigator/popovers/CreateTablePopover.svelte deleted file mode 100644 index 1468d206eb..0000000000 --- a/packages/builder/src/components/backend/ModelNavigator/popovers/CreateTablePopover.svelte +++ /dev/null @@ -1,84 +0,0 @@ - - -
- -
- -
-
Create Table
- -
- - -
-
- - -
-
-
- -