mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-19 04:56:00 +00:00
Merge branch 'master' into redis
This commit is contained in:
@@ -70,7 +70,7 @@
|
||||
import { archiveFilesAsDataSheets, currentArchive, extensions, getCurrentDatabase } from '../stores';
|
||||
|
||||
import createQuickExportMenu from '../utility/createQuickExportMenu';
|
||||
import { exportElectronFile } from '../utility/exportElectronFile';
|
||||
import { exportQuickExportFile } from '../utility/exportFileTools';
|
||||
import openNewTab from '../utility/openNewTab';
|
||||
import AppObjectCore from './AppObjectCore.svelte';
|
||||
import getConnectionLabel from '../utility/getConnectionLabel';
|
||||
@@ -169,31 +169,33 @@
|
||||
{ text: 'Delete', onClick: handleDelete },
|
||||
{ text: 'Rename', onClick: handleRename },
|
||||
data.fileType == 'jsonl' &&
|
||||
createQuickExportMenu($extensions, fmt => async () => {
|
||||
exportElectronFile(
|
||||
data.fileName,
|
||||
{
|
||||
functionName: 'archiveReader',
|
||||
props: {
|
||||
fileName: data.fileName,
|
||||
folderName: data.folderName,
|
||||
createQuickExportMenu(
|
||||
fmt => async () => {
|
||||
exportQuickExportFile(
|
||||
data.fileName,
|
||||
{
|
||||
functionName: 'archiveReader',
|
||||
props: {
|
||||
fileName: data.fileName,
|
||||
folderName: data.folderName,
|
||||
},
|
||||
},
|
||||
fmt
|
||||
);
|
||||
},
|
||||
{
|
||||
text: 'Export',
|
||||
onClick: () => {
|
||||
showModal(ImportExportModal, {
|
||||
initialValues: {
|
||||
sourceStorageType: 'archive',
|
||||
sourceArchiveFolder: data.folderName,
|
||||
sourceList: [data.fileName],
|
||||
},
|
||||
});
|
||||
},
|
||||
fmt
|
||||
);
|
||||
}),
|
||||
data.fileType == 'jsonl' && {
|
||||
text: 'Export',
|
||||
onClick: () => {
|
||||
showModal(ImportExportModal, {
|
||||
initialValues: {
|
||||
sourceStorageType: 'archive',
|
||||
sourceArchiveFolder: data.folderName,
|
||||
sourceList: [data.fileName],
|
||||
},
|
||||
});
|
||||
},
|
||||
},
|
||||
}
|
||||
),
|
||||
data.fileType.endsWith('.sql') && { text: 'Open SQL', onClick: handleOpenSqlFile },
|
||||
data.fileType.endsWith('.yaml') && { text: 'Open YAML', onClick: handleOpenYamlFile },
|
||||
];
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts" context="module">
|
||||
export const extractKey = ({ schemaName, pureName }) => (schemaName ? `${schemaName}.${pureName}` : pureName);
|
||||
export const createMatcher = ({ pureName }) => filter => filterName(filter, pureName);
|
||||
export const createMatcher = ({ schemaName, pureName }) => filter => filterName(filter, pureName, schemaName);
|
||||
const electron = getElectron();
|
||||
|
||||
export const databaseObjectIcons = {
|
||||
@@ -60,12 +60,9 @@
|
||||
{
|
||||
divider: true,
|
||||
},
|
||||
{
|
||||
isQuickExport: true,
|
||||
functionName: 'tableReader',
|
||||
},
|
||||
{
|
||||
label: 'Export',
|
||||
functionName: 'tableReader',
|
||||
isExport: true,
|
||||
},
|
||||
{
|
||||
@@ -131,13 +128,10 @@
|
||||
{
|
||||
divider: true,
|
||||
},
|
||||
{
|
||||
isQuickExport: true,
|
||||
functionName: 'tableReader',
|
||||
},
|
||||
{
|
||||
label: 'Export',
|
||||
isExport: true,
|
||||
functionName: 'tableReader',
|
||||
},
|
||||
{
|
||||
label: 'Open as data sheet',
|
||||
@@ -196,13 +190,10 @@
|
||||
{
|
||||
divider: true,
|
||||
},
|
||||
{
|
||||
isQuickExport: true,
|
||||
functionName: 'tableReader',
|
||||
},
|
||||
{
|
||||
label: 'Export',
|
||||
isExport: true,
|
||||
functionName: 'tableReader',
|
||||
},
|
||||
{
|
||||
label: 'Open as data sheet',
|
||||
@@ -304,13 +295,10 @@
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
isQuickExport: true,
|
||||
functionName: 'tableReader',
|
||||
},
|
||||
{
|
||||
label: 'Export',
|
||||
isExport: true,
|
||||
functionName: 'tableReader',
|
||||
},
|
||||
{
|
||||
label: 'Drop collection',
|
||||
@@ -411,40 +399,45 @@
|
||||
.map(menu => {
|
||||
if (menu.divider) return menu;
|
||||
|
||||
if (menu.isQuickExport) {
|
||||
return createQuickExportMenu(getExtensions(), fmt => async () => {
|
||||
const coninfo = await getConnectionInfo(data);
|
||||
exportElectronFile(
|
||||
data.pureName,
|
||||
{
|
||||
functionName: menu.functionName,
|
||||
props: {
|
||||
connection: {
|
||||
..._.omit(coninfo, ['_id', 'displayName']),
|
||||
..._.pick(data, ['database']),
|
||||
if (menu.isExport) {
|
||||
return createQuickExportMenu(
|
||||
fmt => async () => {
|
||||
const coninfo = await getConnectionInfo(data);
|
||||
exportQuickExportFile(
|
||||
data.pureName,
|
||||
{
|
||||
functionName: menu.functionName,
|
||||
props: {
|
||||
connection: {
|
||||
..._.omit(coninfo, ['_id', 'displayName']),
|
||||
..._.pick(data, ['database']),
|
||||
},
|
||||
..._.pick(data, ['pureName', 'schemaName']),
|
||||
},
|
||||
..._.pick(data, ['pureName', 'schemaName']),
|
||||
},
|
||||
fmt
|
||||
);
|
||||
},
|
||||
{
|
||||
onClick: () => {
|
||||
showModal(ImportExportModal, {
|
||||
initialValues: {
|
||||
sourceStorageType: 'database',
|
||||
sourceConnectionId: data.conid,
|
||||
sourceDatabaseName: data.database,
|
||||
sourceSchemaName: data.schemaName,
|
||||
sourceList: [data.pureName],
|
||||
},
|
||||
});
|
||||
},
|
||||
fmt
|
||||
);
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
return {
|
||||
text: menu.label,
|
||||
onClick: async () => {
|
||||
if (menu.isExport) {
|
||||
showModal(ImportExportModal, {
|
||||
initialValues: {
|
||||
sourceStorageType: 'database',
|
||||
sourceConnectionId: data.conid,
|
||||
sourceDatabaseName: data.database,
|
||||
sourceSchemaName: data.schemaName,
|
||||
sourceList: [data.pureName],
|
||||
},
|
||||
});
|
||||
} else if (menu.isOpenFreeTable) {
|
||||
if (menu.isOpenFreeTable) {
|
||||
const coninfo = await getConnectionInfo(data);
|
||||
openNewTab({
|
||||
title: data.pureName,
|
||||
@@ -620,7 +613,7 @@
|
||||
import SqlGeneratorModal from '../modals/SqlGeneratorModal.svelte';
|
||||
import getConnectionLabel from '../utility/getConnectionLabel';
|
||||
import getElectron from '../utility/getElectron';
|
||||
import { exportElectronFile } from '../utility/exportElectronFile';
|
||||
import { exportQuickExportFile } from '../utility/exportFileTools';
|
||||
import createQuickExportMenu from '../utility/createQuickExportMenu';
|
||||
import ConfirmSqlModal from '../modals/ConfirmSqlModal.svelte';
|
||||
import { alterDatabaseDialog, renameDatabaseObjectDialog } from '../utility/alterDatabaseTools';
|
||||
|
||||
Reference in New Issue
Block a user