Adding a skip button for fetching plus datasource tables incase working with very large data sets and still want to perform queries.
This commit is contained in:
parent
5ff0505f11
commit
657f55f0da
|
@ -23,10 +23,10 @@ function prepareData(config) {
|
||||||
return datasource
|
return datasource
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function saveDatasource(config) {
|
export async function saveDatasource(config, skipFetch = false) {
|
||||||
const datasource = prepareData(config)
|
const datasource = prepareData(config)
|
||||||
// Create datasource
|
// Create datasource
|
||||||
const resp = await datasources.save(datasource, datasource.plus)
|
const resp = await datasources.save(datasource, !skipFetch && datasource.plus)
|
||||||
|
|
||||||
// update the tables incase data source plus
|
// update the tables incase data source plus
|
||||||
await tables.fetch()
|
await tables.fetch()
|
||||||
|
|
|
@ -199,18 +199,18 @@
|
||||||
<Body>
|
<Body>
|
||||||
Tell budibase how your tables are related to get even more smart features.
|
Tell budibase how your tables are related to get even more smart features.
|
||||||
</Body>
|
</Body>
|
||||||
{/if}
|
{#if relationshipInfo && relationshipInfo.length > 0}
|
||||||
{#if relationshipInfo && relationshipInfo.length > 0}
|
<Table
|
||||||
<Table
|
on:click={({ detail }) => openRelationshipModal(detail.from, detail.to)}
|
||||||
on:click={({ detail }) => openRelationshipModal(detail.from, detail.to)}
|
schema={relationshipSchema}
|
||||||
schema={relationshipSchema}
|
data={relationshipInfo}
|
||||||
data={relationshipInfo}
|
allowEditColumns={false}
|
||||||
allowEditColumns={false}
|
allowEditRows={false}
|
||||||
allowEditRows={false}
|
allowSelectRows={false}
|
||||||
allowSelectRows={false}
|
/>
|
||||||
/>
|
{:else}
|
||||||
{:else}
|
<Body size="S"><i>No relationships configured.</i></Body>
|
||||||
<Body size="S"><i>No relationships configured.</i></Body>
|
{/if}
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|
|
@ -5,22 +5,28 @@
|
||||||
import { IntegrationNames } from "constants/backend"
|
import { IntegrationNames } from "constants/backend"
|
||||||
import cloneDeep from "lodash/cloneDeepWith"
|
import cloneDeep from "lodash/cloneDeepWith"
|
||||||
import { saveDatasource as save } from "builderStore/datasource"
|
import { saveDatasource as save } from "builderStore/datasource"
|
||||||
|
import { onMount } from "svelte"
|
||||||
|
|
||||||
export let integration
|
export let integration
|
||||||
export let modal
|
export let modal
|
||||||
|
|
||||||
// kill the reference so the input isn't saved
|
// kill the reference so the input isn't saved
|
||||||
let datasource = cloneDeep(integration)
|
let datasource = cloneDeep(integration)
|
||||||
|
let skipFetch = false
|
||||||
|
|
||||||
async function saveDatasource() {
|
async function saveDatasource() {
|
||||||
try {
|
try {
|
||||||
const resp = await save(datasource)
|
const resp = await save(datasource, skipFetch)
|
||||||
$goto(`./datasource/${resp._id}`)
|
$goto(`./datasource/${resp._id}`)
|
||||||
notifications.success(`Datasource updated successfully.`)
|
notifications.success(`Datasource updated successfully.`)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
notifications.error(`Error saving datasource: ${err}`)
|
notifications.error(`Error saving datasource: ${err}`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onMount(() => {
|
||||||
|
skipFetch = false
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<ModalContent
|
<ModalContent
|
||||||
|
@ -28,9 +34,16 @@
|
||||||
onConfirm={() => saveDatasource()}
|
onConfirm={() => saveDatasource()}
|
||||||
onCancel={() => modal.show()}
|
onCancel={() => modal.show()}
|
||||||
confirmText={datasource.plus
|
confirmText={datasource.plus
|
||||||
? "Fetch tables from database"
|
? "Save and fetch tables"
|
||||||
: "Save and continue to query"}
|
: "Save and continue to query"}
|
||||||
cancelText="Back"
|
cancelText="Back"
|
||||||
|
showSecondaryButton={datasource.plus}
|
||||||
|
secondaryButtonText={datasource.plus ? "Skip table fetch" : undefined}
|
||||||
|
secondaryAction={() => {
|
||||||
|
skipFetch = true
|
||||||
|
saveDatasource()
|
||||||
|
return true
|
||||||
|
}}
|
||||||
size="L"
|
size="L"
|
||||||
>
|
>
|
||||||
<Layout noPadding>
|
<Layout noPadding>
|
||||||
|
|
Loading…
Reference in New Issue