mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-26 13:16:00 +00:00
showModal(ImportExportModal => openImportExportTab
This commit is contained in:
@@ -618,15 +618,22 @@
|
|||||||
});
|
});
|
||||||
} else if (menu.isImport) {
|
} else if (menu.isImport) {
|
||||||
const { conid, database } = data;
|
const { conid, database } = data;
|
||||||
showModal(ImportExportModal, {
|
openImportExportTab({
|
||||||
initialValues: {
|
sourceStorageType: getDefaultFileFormat(getExtensions()).storageType,
|
||||||
sourceStorageType: getDefaultFileFormat(getExtensions()).storageType,
|
targetStorageType: 'database',
|
||||||
targetStorageType: 'database',
|
targetConnectionId: conid,
|
||||||
targetConnectionId: conid,
|
targetDatabaseName: database,
|
||||||
targetDatabaseName: database,
|
fixedTargetPureName: data.pureName,
|
||||||
fixedTargetPureName: data.pureName,
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
// showModal(ImportExportModal, {
|
||||||
|
// initialValues: {
|
||||||
|
// sourceStorageType: getDefaultFileFormat(getExtensions()).storageType,
|
||||||
|
// targetStorageType: 'database',
|
||||||
|
// targetConnectionId: conid,
|
||||||
|
// targetDatabaseName: database,
|
||||||
|
// fixedTargetPureName: data.pureName,
|
||||||
|
// },
|
||||||
|
// });
|
||||||
} else {
|
} else {
|
||||||
openDatabaseObjectDetail(
|
openDatabaseObjectDetail(
|
||||||
menu.tab,
|
menu.tab,
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ import ErrorMessageModal from '../modals/ErrorMessageModal.svelte';
|
|||||||
import NewCollectionModal from '../modals/NewCollectionModal.svelte';
|
import NewCollectionModal from '../modals/NewCollectionModal.svelte';
|
||||||
import ConfirmModal from '../modals/ConfirmModal.svelte';
|
import ConfirmModal from '../modals/ConfirmModal.svelte';
|
||||||
import localforage from 'localforage';
|
import localforage from 'localforage';
|
||||||
|
import { openImportExportTab } from '../utility/importExportTools';
|
||||||
|
|
||||||
// function themeCommand(theme: ThemeDefinition) {
|
// function themeCommand(theme: ThemeDefinition) {
|
||||||
// return {
|
// return {
|
||||||
@@ -483,10 +484,18 @@ registerCommand({
|
|||||||
toolbar: true,
|
toolbar: true,
|
||||||
icon: 'icon import',
|
icon: 'icon import',
|
||||||
onClick: () =>
|
onClick: () =>
|
||||||
showModal(ImportExportModal, {
|
openImportExportTab(
|
||||||
importToCurrentTarget: true,
|
{
|
||||||
initialValues: { sourceStorageType: getDefaultFileFormat(get(extensions)).storageType },
|
sourceStorageType: getDefaultFileFormat(get(extensions)).storageType,
|
||||||
}),
|
},
|
||||||
|
{
|
||||||
|
importToCurrentTarget: true,
|
||||||
|
}
|
||||||
|
),
|
||||||
|
// showModal(ImportExportModal, {
|
||||||
|
// importToCurrentTarget: true,
|
||||||
|
// initialValues: { sourceStorageType: getDefaultFileFormat(get(extensions)).storageType },
|
||||||
|
// }),
|
||||||
});
|
});
|
||||||
|
|
||||||
registerCommand({
|
registerCommand({
|
||||||
@@ -595,8 +604,6 @@ registerCommand({
|
|||||||
onClick: () => getElectron().send('check-for-updates'),
|
onClick: () => getElectron().send('check-for-updates'),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export function registerFileCommands({
|
export function registerFileCommands({
|
||||||
idPrefix,
|
idPrefix,
|
||||||
category,
|
category,
|
||||||
|
|||||||
@@ -136,6 +136,7 @@
|
|||||||
|
|
||||||
import LoadingDataGridCore from './LoadingDataGridCore.svelte';
|
import LoadingDataGridCore from './LoadingDataGridCore.svelte';
|
||||||
import { mongoFilterBehaviour, standardFilterBehaviours } from 'dbgate-tools';
|
import { mongoFilterBehaviour, standardFilterBehaviours } from 'dbgate-tools';
|
||||||
|
import { openImportExportTab } from '../utility/importExportTools';
|
||||||
|
|
||||||
export let conid;
|
export let conid;
|
||||||
export let display;
|
export let display;
|
||||||
@@ -207,7 +208,8 @@
|
|||||||
initialValues.sourceQueryType = coninfo.isReadOnly ? 'json' : 'native';
|
initialValues.sourceQueryType = coninfo.isReadOnly ? 'json' : 'native';
|
||||||
initialValues.sourceList = [pureName];
|
initialValues.sourceList = [pureName];
|
||||||
initialValues[`columns_${pureName}`] = display.getExportColumnMap();
|
initialValues[`columns_${pureName}`] = display.getExportColumnMap();
|
||||||
showModal(ImportExportModal, { initialValues });
|
openImportExportTab(initialValues);
|
||||||
|
// showModal(ImportExportModal, { initialValues });
|
||||||
}
|
}
|
||||||
|
|
||||||
export function openQuery() {
|
export function openQuery() {
|
||||||
|
|||||||
@@ -59,6 +59,7 @@
|
|||||||
|
|
||||||
import LoadingDataGridCore from './LoadingDataGridCore.svelte';
|
import LoadingDataGridCore from './LoadingDataGridCore.svelte';
|
||||||
import RowsArrayGrider from './RowsArrayGrider';
|
import RowsArrayGrider from './RowsArrayGrider';
|
||||||
|
import { openImportExportTab } from '../utility/importExportTools';
|
||||||
|
|
||||||
export let jslid;
|
export let jslid;
|
||||||
export let display;
|
export let display;
|
||||||
@@ -152,7 +153,8 @@
|
|||||||
initialValues.sourceList = ['query-data'];
|
initialValues.sourceList = ['query-data'];
|
||||||
initialValues[`columns_query-data`] = display.getExportColumnMap();
|
initialValues[`columns_query-data`] = display.getExportColumnMap();
|
||||||
}
|
}
|
||||||
showModal(ImportExportModal, { initialValues });
|
openImportExportTab(initialValues);
|
||||||
|
// showModal(ImportExportModal, { initialValues });
|
||||||
}
|
}
|
||||||
|
|
||||||
const quickExportHandler = fmt => async () => {
|
const quickExportHandler = fmt => async () => {
|
||||||
|
|||||||
@@ -84,6 +84,7 @@
|
|||||||
|
|
||||||
import LoadingDataGridCore from './LoadingDataGridCore.svelte';
|
import LoadingDataGridCore from './LoadingDataGridCore.svelte';
|
||||||
import hasPermission from '../utility/hasPermission';
|
import hasPermission from '../utility/hasPermission';
|
||||||
|
import { openImportExportTab } from '../utility/importExportTools';
|
||||||
|
|
||||||
export let conid;
|
export let conid;
|
||||||
export let display;
|
export let display;
|
||||||
@@ -145,7 +146,8 @@
|
|||||||
initialValues.sourceQueryType = coninfo.isReadOnly ? 'json' : 'native';
|
initialValues.sourceQueryType = coninfo.isReadOnly ? 'json' : 'native';
|
||||||
initialValues.sourceList = display.baseTableOrSimilar ? [display.baseTableOrSimilar.pureName] : [];
|
initialValues.sourceList = display.baseTableOrSimilar ? [display.baseTableOrSimilar.pureName] : [];
|
||||||
initialValues[`columns_${pureName}`] = display.getExportColumnMap();
|
initialValues[`columns_${pureName}`] = display.getExportColumnMap();
|
||||||
showModal(ImportExportModal, { initialValues });
|
openImportExportTab(initialValues);
|
||||||
|
// showModal(ImportExportModal, { initialValues });
|
||||||
}
|
}
|
||||||
|
|
||||||
export function openQuery() {
|
export function openQuery() {
|
||||||
|
|||||||
@@ -60,6 +60,7 @@
|
|||||||
import { showSnackbarError } from '../utility/snackbar';
|
import { showSnackbarError } from '../utility/snackbar';
|
||||||
import useEffect from '../utility/useEffect';
|
import useEffect from '../utility/useEffect';
|
||||||
import useTimerLabel from '../utility/useTimerLabel';
|
import useTimerLabel from '../utility/useTimerLabel';
|
||||||
|
import { openImportExportTab } from '../utility/importExportTools';
|
||||||
|
|
||||||
export let tabid;
|
export let tabid;
|
||||||
|
|
||||||
@@ -156,7 +157,8 @@
|
|||||||
export function openWizard() {
|
export function openWizard() {
|
||||||
const jsonTextMatch = ($editorValue || '').match(configRegex);
|
const jsonTextMatch = ($editorValue || '').match(configRegex);
|
||||||
if (jsonTextMatch) {
|
if (jsonTextMatch) {
|
||||||
showModal(ImportExportModal, { initialValues: JSON.parse(jsonTextMatch[1]) });
|
openImportExportTab(JSON.parse(jsonTextMatch[1]));
|
||||||
|
// showModal(ImportExportModal, { initialValues: JSON.parse(jsonTextMatch[1]) });
|
||||||
} else {
|
} else {
|
||||||
showSnackbarError('No wizard info found');
|
showSnackbarError('No wizard info found');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
import openNewTab from './openNewTab';
|
import openNewTab from './openNewTab';
|
||||||
|
|
||||||
export function openImportExportTab(editorProps) {
|
export function openImportExportTab(editorProps, additionalProps = {}) {
|
||||||
openNewTab(
|
openNewTab(
|
||||||
{
|
{
|
||||||
tabComponent: 'ImportExportTab',
|
tabComponent: 'ImportExportTab',
|
||||||
title: 'Import/Export',
|
title: 'Import/Export',
|
||||||
icon: 'img export',
|
icon: 'img export',
|
||||||
|
...additionalProps,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
editor: editorProps,
|
editor: editorProps,
|
||||||
|
|||||||
@@ -5,13 +5,14 @@ import ImportExportModal from '../modals/ImportExportModal.svelte';
|
|||||||
import getElectron from './getElectron';
|
import getElectron from './getElectron';
|
||||||
import { currentDatabase, extensions, getCurrentDatabase } from '../stores';
|
import { currentDatabase, extensions, getCurrentDatabase } from '../stores';
|
||||||
import { getUploadListener } from './uploadFiles';
|
import { getUploadListener } from './uploadFiles';
|
||||||
import {getConnectionLabel, getDatabaseFileLabel } from 'dbgate-tools';
|
import { getConnectionLabel, getDatabaseFileLabel } from 'dbgate-tools';
|
||||||
import { apiCall } from './api';
|
import { apiCall } from './api';
|
||||||
import openNewTab from './openNewTab';
|
import openNewTab from './openNewTab';
|
||||||
import { openJsonDocument } from '../tabs/JsonTab.svelte';
|
import { openJsonDocument } from '../tabs/JsonTab.svelte';
|
||||||
import { SAVED_FILE_HANDLERS } from '../appobj/SavedFileAppObject.svelte';
|
import { SAVED_FILE_HANDLERS } from '../appobj/SavedFileAppObject.svelte';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import ErrorMessageModal from '../modals/ErrorMessageModal.svelte';
|
import ErrorMessageModal from '../modals/ErrorMessageModal.svelte';
|
||||||
|
import { openImportExportTab } from './importExportTools';
|
||||||
|
|
||||||
export function canOpenByElectron(file, extensions) {
|
export function canOpenByElectron(file, extensions) {
|
||||||
if (!file) return false;
|
if (!file) return false;
|
||||||
@@ -178,17 +179,30 @@ export function openElectronFileCore(filePath, extensions) {
|
|||||||
shortName: parsed.name,
|
shortName: parsed.name,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
showModal(ImportExportModal, {
|
openImportExportTab(
|
||||||
openedFile: {
|
{
|
||||||
filePath,
|
|
||||||
storageType: format.storageType,
|
|
||||||
shortName: parsed.name,
|
|
||||||
},
|
|
||||||
importToCurrentTarget: true,
|
|
||||||
initialValues: {
|
|
||||||
sourceStorageType: format.storageType,
|
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 ImportExportModal from '../modals/ImportExportModal.svelte';
|
||||||
import ErrorMessageModal from '../modals/ErrorMessageModal.svelte';
|
import ErrorMessageModal from '../modals/ErrorMessageModal.svelte';
|
||||||
import openNewTab from './openNewTab';
|
import openNewTab from './openNewTab';
|
||||||
|
import { openImportExportTab } from './importExportTools';
|
||||||
|
|
||||||
let uploadListener;
|
let uploadListener;
|
||||||
|
|
||||||
@@ -79,13 +80,23 @@ export default function uploadFiles(files) {
|
|||||||
uploadListener(fileData);
|
uploadListener(fileData);
|
||||||
} else {
|
} else {
|
||||||
if (findFileFormat(ext, fileData.storageType)) {
|
if (findFileFormat(ext, fileData.storageType)) {
|
||||||
showModal(ImportExportModal, {
|
openImportExportTab(
|
||||||
uploadedFile: fileData,
|
{
|
||||||
importToCurrentTarget: true,
|
|
||||||
initialValues: {
|
|
||||||
sourceStorageType: fileData.storageType,
|
sourceStorageType: fileData.storageType,
|
||||||
},
|
},
|
||||||
});
|
{
|
||||||
|
uploadedFile: fileData,
|
||||||
|
importToCurrentTarget: true,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
// showModal(ImportExportModal, {
|
||||||
|
// uploadedFile: fileData,
|
||||||
|
// importToCurrentTarget: true,
|
||||||
|
// initialValues: {
|
||||||
|
// sourceStorageType: fileData.storageType,
|
||||||
|
// },
|
||||||
|
// });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user