mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-23 05:46:01 +00:00
import WIP
This commit is contained in:
@@ -694,7 +694,9 @@
|
|||||||
targetConnectionId: conid,
|
targetConnectionId: conid,
|
||||||
targetDatabaseName: extractDbNameFromComposite(database),
|
targetDatabaseName: extractDbNameFromComposite(database),
|
||||||
targetSchemaName: data.schemaName,
|
targetSchemaName: data.schemaName,
|
||||||
fixedTargetPureName: data.pureName,
|
sourceList: ['__TEMPLATE__'],
|
||||||
|
targetName___TEMPLATE__: data.pureName,
|
||||||
|
// fixedTargetPureName: data.pureName,
|
||||||
});
|
});
|
||||||
// showModal(ImportExportModal, {
|
// showModal(ImportExportModal, {
|
||||||
// initialValues: {
|
// initialValues: {
|
||||||
|
|||||||
@@ -25,7 +25,10 @@
|
|||||||
await (format.addFileToSourceList || addFileToSourceListDefault)(file, newSources, newValues, apiCall);
|
await (format.addFileToSourceList || addFileToSourceListDefault)(file, newSources, newValues, apiCall);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
newValues['sourceList'] = [...(values.sourceList || []).filter(x => !newSources.includes(x)), ...newSources];
|
newValues['sourceList'] = [
|
||||||
|
...(values.sourceList || []).filter(x => !newSources.includes(x) && x != '__TEMPLATE__'),
|
||||||
|
...newSources,
|
||||||
|
];
|
||||||
if (preferedStorageType && preferedStorageType != values.sourceStorageType) {
|
if (preferedStorageType && preferedStorageType != values.sourceStorageType) {
|
||||||
newValues['sourceStorageType'] = preferedStorageType;
|
newValues['sourceStorageType'] = preferedStorageType;
|
||||||
}
|
}
|
||||||
@@ -91,6 +94,8 @@
|
|||||||
$: sourceEngine = $sourceConnectionInfo?.engine;
|
$: sourceEngine = $sourceConnectionInfo?.engine;
|
||||||
$: sourceList = $values.sourceList;
|
$: sourceList = $values.sourceList;
|
||||||
|
|
||||||
|
let targetEditKey = 0;
|
||||||
|
|
||||||
const previewSource = writable(null);
|
const previewSource = writable(null);
|
||||||
|
|
||||||
$: supportsPreview =
|
$: supportsPreview =
|
||||||
@@ -125,6 +130,7 @@
|
|||||||
previewSource.set
|
previewSource.set
|
||||||
);
|
);
|
||||||
// setFieldValue('sourceList', [...(sourceList || []), file.originalName]);
|
// setFieldValue('sourceList', [...(sourceList || []), file.originalName]);
|
||||||
|
targetEditKey += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
$: effectActiveTab = useEffect(() => {
|
$: effectActiveTab = useEffect(() => {
|
||||||
@@ -138,30 +144,30 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const lastSourcesRef = createRef(null);
|
// const lastSourcesRef = createRef(null);
|
||||||
function setFixedTargetForNewSources(values, valuesStore) {
|
// function setFixedTargetForNewSources(values, valuesStore) {
|
||||||
if (lastSourcesRef.get() && values.fixedTargetPureName) {
|
// if (lastSourcesRef.get() && values.fixedTargetPureName) {
|
||||||
const newSources = values.sourceList.filter(x => !lastSourcesRef.get()?.includes(x));
|
// const newSources = values.sourceList.filter(x => !lastSourcesRef.get()?.includes(x));
|
||||||
const newValues = {};
|
// const newValues = {};
|
||||||
for (const source of newSources) {
|
// for (const source of newSources) {
|
||||||
if (values.fixedTargetPureName) {
|
// if (values.fixedTargetPureName) {
|
||||||
if (!values[`targetName_${source}`]) {
|
// if (!values[`targetName_${source}`]) {
|
||||||
newValues[`targetName_${source}`] = values.fixedTargetPureName;
|
// newValues[`targetName_${source}`] = values.fixedTargetPureName;
|
||||||
}
|
// }
|
||||||
if (!values[`actionType_${source}`]) {
|
// if (!values[`actionType_${source}`]) {
|
||||||
newValues[`actionType_${source}`] = 'appendData';
|
// newValues[`actionType_${source}`] = 'appendData';
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
valuesStore.set({
|
// valuesStore.set({
|
||||||
...values,
|
// ...values,
|
||||||
...newValues,
|
// ...newValues,
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
lastSourcesRef.set(values.sourceList);
|
// lastSourcesRef.set(values.sourceList);
|
||||||
}
|
// }
|
||||||
|
|
||||||
$: setFixedTargetForNewSources($values, values);
|
// $: setFixedTargetForNewSources($values, values);
|
||||||
|
|
||||||
$effectActiveTab;
|
$effectActiveTab;
|
||||||
</script>
|
</script>
|
||||||
@@ -195,8 +201,10 @@
|
|||||||
<div class="m-2">
|
<div class="m-2">
|
||||||
<div class="title"><FontIcon icon="icon tables" /> Map source tables/files</div>
|
<div class="title"><FontIcon icon="icon tables" /> Map source tables/files</div>
|
||||||
|
|
||||||
|
{#key targetEditKey}
|
||||||
<TableControl
|
<TableControl
|
||||||
rows={$values.sourceList || []}
|
rows={$values.sourceList || []}
|
||||||
|
passProps={{ targetEditKeyValue: targetEditKey }}
|
||||||
columns={[
|
columns={[
|
||||||
{
|
{
|
||||||
fieldName: 'source',
|
fieldName: 'source',
|
||||||
@@ -255,7 +263,10 @@
|
|||||||
menu={() => {
|
menu={() => {
|
||||||
return $targetDbinfo.tables.map(opt => ({
|
return $targetDbinfo.tables.map(opt => ({
|
||||||
text: opt.pureName,
|
text: opt.pureName,
|
||||||
onClick: () => setFieldValue(`targetName_${row}`, opt.pureName),
|
onClick: () => {
|
||||||
|
setFieldValue(`targetName_${row}`, opt.pureName);
|
||||||
|
targetEditKey += 1;
|
||||||
|
},
|
||||||
}));
|
}));
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
@@ -278,6 +289,7 @@
|
|||||||
</Link>
|
</Link>
|
||||||
</svelte:fragment>
|
</svelte:fragment>
|
||||||
</TableControl>
|
</TableControl>
|
||||||
|
{/key}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user