Updating fetch within main datasource UI to mimic that of the onboarding.
This commit is contained in:
parent
dd8f7fdb91
commit
9ee06e8e42
|
@ -46,7 +46,9 @@ export async function validateDatasourceConfig(config) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getDatasourceInfo(config) {
|
export async function getDatasourceInfo(config) {
|
||||||
const datasource = prepareData(config)
|
let datasource = config
|
||||||
const resp = await API.fetchInfoForDatasource(datasource)
|
if (!config._id) {
|
||||||
return resp
|
datasource = prepareData(config)
|
||||||
|
}
|
||||||
|
return await API.fetchInfoForDatasource(datasource)
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
notifications,
|
notifications,
|
||||||
Modal,
|
Modal,
|
||||||
Table,
|
Table,
|
||||||
Toggle,
|
FancyCheckboxGroup,
|
||||||
} from "@budibase/bbui"
|
} from "@budibase/bbui"
|
||||||
import { datasources, integrations, tables } from "stores/backend"
|
import { datasources, integrations, tables } from "stores/backend"
|
||||||
import CreateEditRelationship from "components/backend/Datasources/CreateEditRelationship.svelte"
|
import CreateEditRelationship from "components/backend/Datasources/CreateEditRelationship.svelte"
|
||||||
|
@ -16,7 +16,7 @@
|
||||||
import ArrayRenderer from "components/common/renderers/ArrayRenderer.svelte"
|
import ArrayRenderer from "components/common/renderers/ArrayRenderer.svelte"
|
||||||
import ConfirmDialog from "components/common/ConfirmDialog.svelte"
|
import ConfirmDialog from "components/common/ConfirmDialog.svelte"
|
||||||
import { goto } from "@roxi/routify"
|
import { goto } from "@roxi/routify"
|
||||||
import ValuesList from "components/common/ValuesList.svelte"
|
import { getDatasourceInfo } from "builderStore/datasource"
|
||||||
|
|
||||||
export let datasource
|
export let datasource
|
||||||
export let save
|
export let save
|
||||||
|
@ -34,7 +34,7 @@
|
||||||
let selectedFromRelationship, selectedToRelationship
|
let selectedFromRelationship, selectedToRelationship
|
||||||
let confirmDialog
|
let confirmDialog
|
||||||
let specificTables = null
|
let specificTables = null
|
||||||
let requireSpecificTables = false
|
let tableList
|
||||||
|
|
||||||
$: integration = datasource && $integrations[datasource.source]
|
$: integration = datasource && $integrations[datasource.source]
|
||||||
$: plusTables = datasource?.plus
|
$: plusTables = datasource?.plus
|
||||||
|
@ -153,30 +153,29 @@
|
||||||
warning={false}
|
warning={false}
|
||||||
title="Confirm table fetch"
|
title="Confirm table fetch"
|
||||||
>
|
>
|
||||||
<Toggle
|
|
||||||
bind:value={requireSpecificTables}
|
|
||||||
on:change={e => {
|
|
||||||
requireSpecificTables = e.detail
|
|
||||||
specificTables = null
|
|
||||||
}}
|
|
||||||
thin
|
|
||||||
text="Fetch listed tables only (one per line)"
|
|
||||||
/>
|
|
||||||
{#if requireSpecificTables}
|
|
||||||
<ValuesList label="" bind:values={specificTables} />
|
|
||||||
{/if}
|
|
||||||
<br />
|
|
||||||
<Body>
|
<Body>
|
||||||
If you have fetched tables from this database before, this action may
|
If you have fetched tables from this database before, this action may
|
||||||
overwrite any changes you made after your initial fetch.
|
overwrite any changes you made after your initial fetch.
|
||||||
</Body>
|
</Body>
|
||||||
|
<br />
|
||||||
|
<div class="table-checkboxes">
|
||||||
|
<FancyCheckboxGroup options={tableList} bind:selected={specificTables} />
|
||||||
|
</div>
|
||||||
</ConfirmDialog>
|
</ConfirmDialog>
|
||||||
|
|
||||||
<Divider />
|
<Divider />
|
||||||
<div class="query-header">
|
<div class="query-header">
|
||||||
<Heading size="S">Tables</Heading>
|
<Heading size="S">Tables</Heading>
|
||||||
<div class="table-buttons">
|
<div class="table-buttons">
|
||||||
<Button secondary on:click={() => confirmDialog.show()}>
|
<Button
|
||||||
|
secondary
|
||||||
|
on:click={async () => {
|
||||||
|
console.log(datasource)
|
||||||
|
const info = await getDatasourceInfo(datasource)
|
||||||
|
tableList = info.tableNames
|
||||||
|
confirmDialog.show()
|
||||||
|
}}
|
||||||
|
>
|
||||||
Fetch tables
|
Fetch tables
|
||||||
</Button>
|
</Button>
|
||||||
<Button cta icon="Add" on:click={createNewTable}>New table</Button>
|
<Button cta icon="Add" on:click={createNewTable}>New table</Button>
|
||||||
|
@ -246,4 +245,8 @@
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: var(--spacing-m);
|
gap: var(--spacing-m);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.table-checkboxes {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -164,5 +164,6 @@ export function mergeConfigs(update: Datasource, old: Datasource) {
|
||||||
delete update.config[key]
|
delete update.config[key]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return update
|
return update
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue