1
0
Fork 0
mirror of synced 2024-06-27 02:20:35 +12:00

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 48d354444d
commit cd3148da95
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,18 +199,18 @@
<Body>
Tell budibase how your tables are related to get even more smart features.
</Body>
{/if}
{#if relationshipInfo && relationshipInfo.length > 0}
<Table
on:click={({ detail }) => openRelationshipModal(detail.from, detail.to)}
schema={relationshipSchema}
data={relationshipInfo}
allowEditColumns={false}
allowEditRows={false}
allowSelectRows={false}
/>
{:else}
<Body size="S"><i>No relationships configured.</i></Body>
{#if relationshipInfo && relationshipInfo.length > 0}
<Table
on:click={({ detail }) => openRelationshipModal(detail.from, detail.to)}
schema={relationshipSchema}
data={relationshipInfo}
allowEditColumns={false}
allowEditRows={false}
allowSelectRows={false}
/>
{: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>