do not persist datasource config details in modal
This commit is contained in:
parent
a6341e396a
commit
0178dfdffd
|
@ -5,24 +5,29 @@
|
||||||
import IntegrationConfigForm from "components/backend/DatasourceNavigator/TableIntegrationMenu/IntegrationConfigForm.svelte"
|
import IntegrationConfigForm from "components/backend/DatasourceNavigator/TableIntegrationMenu/IntegrationConfigForm.svelte"
|
||||||
import { datasources } from "stores/backend"
|
import { datasources } from "stores/backend"
|
||||||
import { IntegrationNames } from "constants"
|
import { IntegrationNames } from "constants"
|
||||||
|
import cloneDeep from "lodash/cloneDeepWith"
|
||||||
|
|
||||||
export let integration
|
export let integration
|
||||||
|
export let modal
|
||||||
|
|
||||||
|
// kill the reference so the input isn't saved
|
||||||
|
let config = cloneDeep(integration)
|
||||||
|
|
||||||
function prepareData() {
|
function prepareData() {
|
||||||
let datasource = {}
|
let datasource = {}
|
||||||
let existingTypeCount = $datasources.list.filter(
|
let existingTypeCount = $datasources.list.filter(
|
||||||
ds => ds.source == integration.type
|
ds => ds.source == config.type
|
||||||
).length
|
).length
|
||||||
|
|
||||||
let baseName = IntegrationNames[integration.type]
|
let baseName = IntegrationNames[config.type]
|
||||||
let name =
|
let name =
|
||||||
existingTypeCount == 0 ? baseName : `${baseName}-${existingTypeCount + 1}`
|
existingTypeCount == 0 ? baseName : `${baseName}-${existingTypeCount + 1}`
|
||||||
|
|
||||||
datasource.type = "datasource"
|
datasource.type = "datasource"
|
||||||
datasource.source = integration.type
|
datasource.source = config.type
|
||||||
datasource.config = integration.config
|
datasource.config = config.config
|
||||||
datasource.name = name
|
datasource.name = name
|
||||||
datasource.plus = integration.plus
|
datasource.plus = config.plus
|
||||||
|
|
||||||
return datasource
|
return datasource
|
||||||
}
|
}
|
||||||
|
@ -48,9 +53,10 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<ModalContent
|
<ModalContent
|
||||||
title={`Connect to ${IntegrationNames[integration.type]}`}
|
title={`Connect to ${IntegrationNames[config.type]}`}
|
||||||
onConfirm={() => saveDatasource()}
|
onConfirm={() => saveDatasource()}
|
||||||
confirmText={integration.plus
|
onCancel={() => modal.show()}
|
||||||
|
confirmText={config.plus
|
||||||
? "Fetch tables from database"
|
? "Fetch tables from database"
|
||||||
: "Save and continue to query"}
|
: "Save and continue to query"}
|
||||||
cancelText="Back"
|
cancelText="Back"
|
||||||
|
@ -62,10 +68,7 @@
|
||||||
</Body>
|
</Body>
|
||||||
</Layout>
|
</Layout>
|
||||||
|
|
||||||
<IntegrationConfigForm
|
<IntegrationConfigForm schema={config.schema} integration={config.config} />
|
||||||
schema={integration.schema}
|
|
||||||
bind:integration={integration.config}
|
|
||||||
/>
|
|
||||||
</ModalContent>
|
</ModalContent>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|
Loading…
Reference in New Issue