mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-05-01 17:53:59 +00:00
vfk editor fix (svelte bug)
This commit is contained in:
@@ -9,7 +9,7 @@
|
|||||||
import SelectField from '../forms/SelectField.svelte';
|
import SelectField from '../forms/SelectField.svelte';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import { useDatabaseInfo, useTableInfo } from '../utility/metadataLoaders';
|
import { useDatabaseInfo, useTableInfo } from '../utility/metadataLoaders';
|
||||||
import { onMount } from 'svelte';
|
import { onMount, tick } from 'svelte';
|
||||||
import TargetApplicationSelect from '../forms/TargetApplicationSelect.svelte';
|
import TargetApplicationSelect from '../forms/TargetApplicationSelect.svelte';
|
||||||
import { apiCall } from '../utility/api';
|
import { apiCall } from '../utility/api';
|
||||||
import { saveDbToApp } from '../utility/appTools';
|
import { saveDbToApp } from '../utility/appTools';
|
||||||
@@ -34,6 +34,19 @@
|
|||||||
// ..._.sortBy($dbInfo?.views || [], ['schemaName', 'pureName']),
|
// ..._.sortBy($dbInfo?.views || [], ['schemaName', 'pureName']),
|
||||||
];
|
];
|
||||||
|
|
||||||
|
let tableOptions = [];
|
||||||
|
|
||||||
|
$: (async () => {
|
||||||
|
// without this has svelte problem, doesn't invalidate SelectField options
|
||||||
|
await tick();
|
||||||
|
// to replicate try to invoke VFK editor after page refresh, when active widget without DB, eg. application layers
|
||||||
|
// and comment line above. Tables list in vFK editor will be empty
|
||||||
|
|
||||||
|
tableOptions = tableList.map(tbl => ({
|
||||||
|
label: fullNameToLabel(tbl),
|
||||||
|
value: fullNameToString(tbl),
|
||||||
|
}));
|
||||||
|
})();
|
||||||
$: refTableInfo = tableList.find(x => x.pureName == refTableName && x.schemaName == refSchemaName);
|
$: refTableInfo = tableList.find(x => x.pureName == refTableName && x.schemaName == refSchemaName);
|
||||||
// $dbInfo?.views?.find(x => x.pureName == refTableName && x.schemaName == refSchemaName);
|
// $dbInfo?.views?.find(x => x.pureName == refTableName && x.schemaName == refSchemaName);
|
||||||
|
|
||||||
@@ -51,6 +64,7 @@
|
|||||||
// $: console.log('conid, database', conid, database);
|
// $: console.log('conid, database', conid, database);
|
||||||
// $: console.log('$dbInfo?.tables', $dbInfo?.tables);
|
// $: console.log('$dbInfo?.tables', $dbInfo?.tables);
|
||||||
// $: console.log('tableList', tableList);
|
// $: console.log('tableList', tableList);
|
||||||
|
// $: console.log('tableOptions', tableOptions);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<FormProvider>
|
<FormProvider>
|
||||||
@@ -65,10 +79,7 @@
|
|||||||
value={fullNameToString({ pureName: refTableName, schemaName: refSchemaName })}
|
value={fullNameToString({ pureName: refTableName, schemaName: refSchemaName })}
|
||||||
isNative
|
isNative
|
||||||
notSelected
|
notSelected
|
||||||
options={tableList.map(tbl => ({
|
options={tableOptions}
|
||||||
label: fullNameToLabel(tbl),
|
|
||||||
value: fullNameToString(tbl),
|
|
||||||
}))}
|
|
||||||
on:change={e => {
|
on:change={e => {
|
||||||
if (e.detail) {
|
if (e.detail) {
|
||||||
const name = fullNameFromString(e.detail);
|
const name = fullNameFromString(e.detail);
|
||||||
|
|||||||
Reference in New Issue
Block a user