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