mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-18 12:35:59 +00:00
export menu refactor
This commit is contained in:
@@ -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(fmt => async () => {
|
||||
const coninfo = await getConnectionInfo(data);
|
||||
exportQuickExportFile(
|
||||
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,
|
||||
|
||||
Reference in New Issue
Block a user