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:
mike12345567 2022-01-06 15:28:38 +00:00
parent 5ff0505f11
commit 657f55f0da
3 changed files with 29 additions and 16 deletions

View File

@ -23,10 +23,10 @@ function prepareData(config) {
return datasource
}
export async function saveDatasource(config) {
export async function saveDatasource(config, skipFetch = false) {
const datasource = prepareData(config)
// 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
await tables.fetch()

View File

@ -199,8 +199,7 @@
<Body>
Tell budibase how your tables are related to get even more smart features.
</Body>
{/if}
{#if relationshipInfo && relationshipInfo.length > 0}
{#if relationshipInfo && relationshipInfo.length > 0}
<Table
on:click={({ detail }) => openRelationshipModal(detail.from, detail.to)}
schema={relationshipSchema}
@ -209,8 +208,9 @@
allowEditRows={false}
allowSelectRows={false}
/>
{:else}
{:else}
<Body size="S"><i>No relationships configured.</i></Body>
{/if}
{/if}
<style>

View File

@ -5,22 +5,28 @@
import { IntegrationNames } from "constants/backend"
import cloneDeep from "lodash/cloneDeepWith"
import { saveDatasource as save } from "builderStore/datasource"
import { onMount } from "svelte"
export let integration
export let modal
// kill the reference so the input isn't saved
let datasource = cloneDeep(integration)
let skipFetch = false
async function saveDatasource() {
try {
const resp = await save(datasource)
const resp = await save(datasource, skipFetch)
$goto(`./datasource/${resp._id}`)
notifications.success(`Datasource updated successfully.`)
} catch (err) {
notifications.error(`Error saving datasource: ${err}`)
}
}
onMount(() => {
skipFetch = false
})
</script>
<ModalContent
@ -28,9 +34,16 @@
onConfirm={() => saveDatasource()}
onCancel={() => modal.show()}
confirmText={datasource.plus
? "Fetch tables from database"
? "Save and fetch tables"
: "Save and continue to query"}
cancelText="Back"
showSecondaryButton={datasource.plus}
secondaryButtonText={datasource.plus ? "Skip table fetch" : undefined}
secondaryAction={() => {
skipFetch = true
saveDatasource()
return true
}}
size="L"
>
<Layout noPadding>