mirror of
https://github.com/dbgate/dbgate
synced 2024-11-07 20:26:23 +00:00
import download fixes
This commit is contained in:
parent
5aff88630a
commit
3e1e6f7164
@ -109,11 +109,12 @@ function getFileFilters(extensions, storageType) {
|
||||
return res;
|
||||
}
|
||||
|
||||
async function addFileToSourceListDefault({ fileName, shortName }, newSources, newValues) {
|
||||
async function addFileToSourceListDefault({ fileName, shortName, isDownload }, newSources, newValues) {
|
||||
const sourceName = shortName;
|
||||
newSources.push(sourceName);
|
||||
newValues[`sourceFile_${sourceName}`] = {
|
||||
fileName,
|
||||
isDownload,
|
||||
};
|
||||
}
|
||||
|
||||
@ -385,7 +386,7 @@ function SourceName({ name }) {
|
||||
);
|
||||
};
|
||||
const doChangeUrl = (url) => {
|
||||
setFieldValue(`sourceFile_${name}`, { fileName: url });
|
||||
setFieldValue(`sourceFile_${name}`, { fileName: url, isDownload: true });
|
||||
};
|
||||
const handleChangeUrl = () => {
|
||||
showModal((modalState) => (
|
||||
@ -455,6 +456,8 @@ export default function ImportExportConfigurator({ uploadedFile = undefined, onC
|
||||
}, []);
|
||||
|
||||
const supportsPreview = !!findFileFormat(extensions, values.sourceStorageType);
|
||||
const previewFileName =
|
||||
previewSource && values[`sourceFile_${previewSource}`] && values[`sourceFile_${previewSource}`].fileName;
|
||||
|
||||
const handleChangePreviewSource = async () => {
|
||||
if (previewSource && supportsPreview) {
|
||||
@ -467,7 +470,7 @@ export default function ImportExportConfigurator({ uploadedFile = undefined, onC
|
||||
|
||||
React.useEffect(() => {
|
||||
handleChangePreviewSource();
|
||||
}, [previewSource, supportsPreview]);
|
||||
}, [previewSource, supportsPreview, previewFileName]);
|
||||
|
||||
const oldValues = React.useRef({});
|
||||
React.useEffect(() => {
|
||||
|
@ -68,7 +68,7 @@ function getSourceExpr(extensions, sourceName, values, sourceConnection, sourceD
|
||||
return [
|
||||
format.readerFunc,
|
||||
{
|
||||
...sourceFile,
|
||||
..._.omit(sourceFile, ['isDownload']),
|
||||
...extractApiParameters(values, 'source', format),
|
||||
},
|
||||
];
|
||||
|
Loading…
Reference in New Issue
Block a user