export - tables select

This commit is contained in:
Jan Prochazka
2021-03-13 09:57:40 +01:00
parent af54c958ba
commit 423f876d68
2 changed files with 32 additions and 3 deletions

View File

@@ -1,4 +1,8 @@
<script lang="ts">
import _ from 'lodash';
import FormStyledButton from '../elements/FormStyledButton.svelte';
import { getFormContext } from '../forms/FormProviderCore.svelte';
import FormSelectField from '../forms/FormSelectField.svelte';
import { useDatabaseInfo, useDatabaseList } from '../utility/metadataLoaders';
@@ -6,8 +10,9 @@
export let conidName;
export let databaseName;
export let schemaName;
export let name;
const { values } = getFormContext();
const { values, setFieldValue } = getFormContext();
$: dbinfo = useDatabaseInfo({ conid: $values[conidName], database: $values[databaseName] });
$: tablesOptions = [...(($dbinfo && $dbinfo.tables) || []), ...(($dbinfo && $dbinfo.views) || [])]
@@ -18,4 +23,28 @@
}));
</script>
<FormSelectField {...$$restProps} options={tablesOptions} isMulti />
<div class="wrapper">
<FormSelectField {...$$restProps} {name} options={tablesOptions} isMulti templateProps={{ noMargin: true }} />
<div>
<FormStyledButton
type="button"
value="All tables"
on:click={() =>
setFieldValue(name, _.uniq([...($values[name] || []), ...($dbinfo && $dbinfo.tables.map(x => x.pureName))]))}
/>
<FormStyledButton
type="button"
value="All views"
on:click={() =>
setFieldValue(name, _.uniq([...($values[name] || []), ...($dbinfo && $dbinfo.views.map(x => x.pureName))]))}
/>
<FormStyledButton type="button" value="Remove all" on:click={() => setFieldValue(name, [])} />
</div>
</div>
<style>
.wrapper {
margin: var(--dim-large-form-margin);
}
</style>

View File

@@ -84,7 +84,7 @@
</svelte:fragment>
<div class="wrapper">
<HorizontalSplitter>
<HorizontalSplitter initialValue="70%">
<svelte:fragment slot="1">
<ImportExportConfigurator />
</svelte:fragment>