mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-19 06:06:01 +00:00
showModal(ImportExportModal => openImportExportTab
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
import openNewTab from './openNewTab';
|
||||
|
||||
export function openImportExportTab(editorProps) {
|
||||
export function openImportExportTab(editorProps, additionalProps = {}) {
|
||||
openNewTab(
|
||||
{
|
||||
tabComponent: 'ImportExportTab',
|
||||
title: 'Import/Export',
|
||||
icon: 'img export',
|
||||
...additionalProps,
|
||||
},
|
||||
{
|
||||
editor: editorProps,
|
||||
|
||||
@@ -5,13 +5,14 @@ import ImportExportModal from '../modals/ImportExportModal.svelte';
|
||||
import getElectron from './getElectron';
|
||||
import { currentDatabase, extensions, getCurrentDatabase } from '../stores';
|
||||
import { getUploadListener } from './uploadFiles';
|
||||
import {getConnectionLabel, getDatabaseFileLabel } from 'dbgate-tools';
|
||||
import { getConnectionLabel, getDatabaseFileLabel } from 'dbgate-tools';
|
||||
import { apiCall } from './api';
|
||||
import openNewTab from './openNewTab';
|
||||
import { openJsonDocument } from '../tabs/JsonTab.svelte';
|
||||
import { SAVED_FILE_HANDLERS } from '../appobj/SavedFileAppObject.svelte';
|
||||
import _ from 'lodash';
|
||||
import ErrorMessageModal from '../modals/ErrorMessageModal.svelte';
|
||||
import { openImportExportTab } from './importExportTools';
|
||||
|
||||
export function canOpenByElectron(file, extensions) {
|
||||
if (!file) return false;
|
||||
@@ -178,17 +179,30 @@ export function openElectronFileCore(filePath, extensions) {
|
||||
shortName: parsed.name,
|
||||
});
|
||||
} else {
|
||||
showModal(ImportExportModal, {
|
||||
openedFile: {
|
||||
filePath,
|
||||
storageType: format.storageType,
|
||||
shortName: parsed.name,
|
||||
},
|
||||
importToCurrentTarget: true,
|
||||
initialValues: {
|
||||
openImportExportTab(
|
||||
{
|
||||
sourceStorageType: format.storageType,
|
||||
},
|
||||
});
|
||||
{
|
||||
openedFile: {
|
||||
filePath,
|
||||
storageType: format.storageType,
|
||||
shortName: parsed.name,
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
// showModal(ImportExportModal, {
|
||||
// openedFile: {
|
||||
// filePath,
|
||||
// storageType: format.storageType,
|
||||
// shortName: parsed.name,
|
||||
// },
|
||||
// importToCurrentTarget: true,
|
||||
// initialValues: {
|
||||
// sourceStorageType: format.storageType,
|
||||
// },
|
||||
// });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import { showModal } from '../modals/modalTools';
|
||||
import ImportExportModal from '../modals/ImportExportModal.svelte';
|
||||
import ErrorMessageModal from '../modals/ErrorMessageModal.svelte';
|
||||
import openNewTab from './openNewTab';
|
||||
import { openImportExportTab } from './importExportTools';
|
||||
|
||||
let uploadListener;
|
||||
|
||||
@@ -79,13 +80,23 @@ export default function uploadFiles(files) {
|
||||
uploadListener(fileData);
|
||||
} else {
|
||||
if (findFileFormat(ext, fileData.storageType)) {
|
||||
showModal(ImportExportModal, {
|
||||
uploadedFile: fileData,
|
||||
importToCurrentTarget: true,
|
||||
initialValues: {
|
||||
openImportExportTab(
|
||||
{
|
||||
sourceStorageType: fileData.storageType,
|
||||
},
|
||||
});
|
||||
{
|
||||
uploadedFile: fileData,
|
||||
importToCurrentTarget: true,
|
||||
}
|
||||
);
|
||||
|
||||
// showModal(ImportExportModal, {
|
||||
// uploadedFile: fileData,
|
||||
// importToCurrentTarget: true,
|
||||
// initialValues: {
|
||||
// sourceStorageType: fileData.storageType,
|
||||
// },
|
||||
// });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user