From 89dc9f886af7338518ba04877d5556bfe294ab44 Mon Sep 17 00:00:00 2001 From: Peter Clement Date: Wed, 6 Oct 2021 15:06:48 +0100 Subject: [PATCH] do not persist datasource config details in modal --- .../modals/DatasourceConfigModal.svelte | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/packages/builder/src/components/backend/DatasourceNavigator/modals/DatasourceConfigModal.svelte b/packages/builder/src/components/backend/DatasourceNavigator/modals/DatasourceConfigModal.svelte index 56fa26ee0a..23dc63a060 100644 --- a/packages/builder/src/components/backend/DatasourceNavigator/modals/DatasourceConfigModal.svelte +++ b/packages/builder/src/components/backend/DatasourceNavigator/modals/DatasourceConfigModal.svelte @@ -5,24 +5,29 @@ import IntegrationConfigForm from "components/backend/DatasourceNavigator/TableIntegrationMenu/IntegrationConfigForm.svelte" import { datasources } from "stores/backend" import { IntegrationNames } from "constants" + import cloneDeep from "lodash/cloneDeepWith" export let integration + export let modal + + // kill the reference so the input isn't saved + let config = cloneDeep(integration) function prepareData() { let datasource = {} let existingTypeCount = $datasources.list.filter( - ds => ds.source == integration.type + ds => ds.source == config.type ).length - let baseName = IntegrationNames[integration.type] + let baseName = IntegrationNames[config.type] let name = existingTypeCount == 0 ? baseName : `${baseName}-${existingTypeCount + 1}` datasource.type = "datasource" - datasource.source = integration.type - datasource.config = integration.config + datasource.source = config.type + datasource.config = config.config datasource.name = name - datasource.plus = integration.plus + datasource.plus = config.plus return datasource } @@ -48,9 +53,10 @@ saveDatasource()} - confirmText={integration.plus + onCancel={() => modal.show()} + confirmText={config.plus ? "Fetch tables from database" : "Save and continue to query"} cancelText="Back" @@ -62,10 +68,7 @@ - +