From 099eee5f8c0cc2752b623282b9d936388a3e0dac Mon Sep 17 00:00:00 2001 From: Gerard Burns Date: Wed, 28 Jun 2023 12:14:23 +0100 Subject: [PATCH] Fix table selection (#11050) --- .../TableImportSelection/index.svelte | 19 ++++-- .../tableSelectionStore.js | 6 +- .../backend/Datasources/TableSelect.svelte | 21 ------- .../index.svelte | 2 +- .../_components/panels/Tables/Controls.svelte | 59 ++++--------------- .../datasource/[datasourceId]/index.svelte | 1 - 6 files changed, 30 insertions(+), 78 deletions(-) rename packages/builder/src/{pages/builder/app/[application]/data/_components/CreateExternalDatasourceModal => components/backend/Datasources}/TableImportSelection/index.svelte (81%) rename packages/builder/src/{pages/builder/app/[application]/data/_components/CreateExternalDatasourceModal => components/backend/Datasources}/TableImportSelection/tableSelectionStore.js (97%) delete mode 100644 packages/builder/src/components/backend/Datasources/TableSelect.svelte diff --git a/packages/builder/src/pages/builder/app/[application]/data/_components/CreateExternalDatasourceModal/TableImportSelection/index.svelte b/packages/builder/src/components/backend/Datasources/TableImportSelection/index.svelte similarity index 81% rename from packages/builder/src/pages/builder/app/[application]/data/_components/CreateExternalDatasourceModal/TableImportSelection/index.svelte rename to packages/builder/src/components/backend/Datasources/TableImportSelection/index.svelte index 0c26ea649e..1fc83d4978 100644 --- a/packages/builder/src/pages/builder/app/[application]/data/_components/CreateExternalDatasourceModal/TableImportSelection/index.svelte +++ b/packages/builder/src/components/backend/Datasources/TableImportSelection/index.svelte @@ -6,6 +6,7 @@ Layout, ModalContent, } from "@budibase/bbui" + import Spinner from "components/common/Spinner.svelte" import { IntegrationTypes } from "constants/backend" import { createTableSelectionStore } from "./tableSelectionStore" @@ -19,9 +20,10 @@ $: tableType = isSheets ? "sheets" : "tables" $: title = `Choose your ${tableType}` - $: confirmText = $store.hasSelected - ? `Fetch ${tableType}` - : "Continue without fetching" + $: confirmText = + $store.loading || $store.hasSelected + ? `Fetch ${tableType}` + : "Continue without fetching" $: description = isSheets ? "Select which spreadsheets you want to connect." @@ -39,7 +41,9 @@ disabled={$store.loading} > {#if $store.loading} -

loading...

+
+ +
{:else} {description} @@ -60,3 +64,10 @@ {/if} + + diff --git a/packages/builder/src/pages/builder/app/[application]/data/_components/CreateExternalDatasourceModal/TableImportSelection/tableSelectionStore.js b/packages/builder/src/components/backend/Datasources/TableImportSelection/tableSelectionStore.js similarity index 97% rename from packages/builder/src/pages/builder/app/[application]/data/_components/CreateExternalDatasourceModal/TableImportSelection/tableSelectionStore.js rename to packages/builder/src/components/backend/Datasources/TableImportSelection/tableSelectionStore.js index c5a87bda26..a361618897 100644 --- a/packages/builder/src/pages/builder/app/[application]/data/_components/CreateExternalDatasourceModal/TableImportSelection/tableSelectionStore.js +++ b/packages/builder/src/components/backend/Datasources/TableImportSelection/tableSelectionStore.js @@ -32,10 +32,10 @@ export const createTableSelectionStore = (integration, datasource) => { } else { notifications.error("Error fetching tables.") } - } - // Prevent modal closing - return false + // Prevent modal closing + return false + } } const combined = derived( diff --git a/packages/builder/src/components/backend/Datasources/TableSelect.svelte b/packages/builder/src/components/backend/Datasources/TableSelect.svelte deleted file mode 100644 index 5595d5d3ab..0000000000 --- a/packages/builder/src/components/backend/Datasources/TableSelect.svelte +++ /dev/null @@ -1,21 +0,0 @@ - - - - - {#each tables as table} - select(table)}> - {table.name} - {#if selected} - - {/if} - - {/each} - - diff --git a/packages/builder/src/pages/builder/app/[application]/data/_components/CreateExternalDatasourceModal/index.svelte b/packages/builder/src/pages/builder/app/[application]/data/_components/CreateExternalDatasourceModal/index.svelte index 1511bf990e..706e1a2015 100644 --- a/packages/builder/src/pages/builder/app/[application]/data/_components/CreateExternalDatasourceModal/index.svelte +++ b/packages/builder/src/pages/builder/app/[application]/data/_components/CreateExternalDatasourceModal/index.svelte @@ -5,7 +5,7 @@ import GoogleAuthPrompt from "./GoogleAuthPrompt.svelte" import { get } from "svelte/store" - import TableImportSelection from "./TableImportSelection/index.svelte" + import TableImportSelection from "components/backend/Datasources/TableImportSelection/index.svelte" import DatasourceConfigEditor from "components/backend/Datasources/ConfigEditor/index.svelte" import { datasources } from "stores/backend" import { createOnGoogleAuthStore } from "./stores/onGoogleAuth.js" diff --git a/packages/builder/src/pages/builder/app/[application]/data/datasource/[datasourceId]/_components/panels/Tables/Controls.svelte b/packages/builder/src/pages/builder/app/[application]/data/datasource/[datasourceId]/_components/panels/Tables/Controls.svelte index 881f39992a..881b552438 100644 --- a/packages/builder/src/pages/builder/app/[application]/data/datasource/[datasourceId]/_components/panels/Tables/Controls.svelte +++ b/packages/builder/src/pages/builder/app/[application]/data/datasource/[datasourceId]/_components/panels/Tables/Controls.svelte @@ -1,66 +1,29 @@ - confirmDialog.hide()} - warning={false} - title="Confirm table fetch" -> - { - requireSpecificTables = e.detail - specificTables = null - }} - thin - text="Fetch listed tables only (one per line)" - /> - {#if requireSpecificTables} - - {/if} -
- - If you have fetched tables from this database before, this action may - overwrite any changes you made after your initial fetch. - -
+ + +
- +