diff --git a/frontend/src/components/Sidebar.tsx b/frontend/src/components/Sidebar.tsx index 4400e54..a5feea2 100644 --- a/frontend/src/components/Sidebar.tsx +++ b/frontend/src/components/Sidebar.tsx @@ -89,7 +89,11 @@ import { resolveConnectionAccentColor, resolveConnectionIconType } from '../util import { buildJVMTabTitle } from '../utils/jvmRuntimePresentation'; import { buildJVMDiagnosticActionDescriptor, buildJVMMonitoringActionDescriptors } from '../utils/jvmSidebarActions'; import { buildTableSelectQuery } from '../utils/objectQueryTemplates'; -import { buildTableExportTab } from '../utils/tableExportTab'; +import { + buildBatchDatabaseExportWorkbenchTab, + buildBatchTableExportWorkbenchTab, + buildTableExportTab, +} from '../utils/tableExportTab'; import { useExportProgressDialog } from './ExportProgressModal'; import { getShortcutPlatform, resolveShortcutDisplay } from '../utils/shortcuts'; import { buildExternalSQLDirectoryId, buildExternalSQLRootNode, buildExternalSQLTabId, type ExternalSQLTreeNode } from '../utils/externalSqlTree'; @@ -4024,6 +4028,30 @@ const Sidebar: React.FC<{ setIsBatchModalOpen(true); }; + const openBatchTableExportWorkbench = () => { + let connId = ''; + let dbName = ''; + + if (selectedNodesRef.current.length > 0) { + const node = selectedNodesRef.current[0]; + if (node.type === 'connection' && node.dataRef?.config?.type !== 'redis') { + connId = node.key as string; + } else if (node.type === 'database') { + connId = node.dataRef.id; + dbName = node.title; + } else if (node.type === 'table' || node.type === 'view' || node.type === 'materialized-view') { + connId = node.dataRef.id; + dbName = node.dataRef.dbName; + } + } + + addTab(buildBatchTableExportWorkbenchTab({ + connectionId: connId, + dbName: dbName || undefined, + title: dbName ? `批量导出 ${dbName} 对象` : '批量导出对象', + })); + }; + const loadDatabasesForBatch = async (conn: SavedConnection) => { const config = { ...conn.config, @@ -4347,6 +4375,24 @@ const Sidebar: React.FC<{ setIsBatchDbModalOpen(true); }; + const openBatchDatabaseExportWorkbench = () => { + let connId = ''; + + if (selectedNodesRef.current.length > 0) { + const node = selectedNodesRef.current[0]; + if (node.type === 'connection' && node.dataRef?.config?.type !== 'redis') { + connId = node.key as string; + } else if (node.type === 'database' || node.type === 'table' || node.type === 'view' || node.type === 'materialized-view') { + connId = node.dataRef.id; + } + } + + addTab(buildBatchDatabaseExportWorkbenchTab({ + connectionId: connId, + title: '批量导出库', + })); + }; + const loadDatabasesForDbBatch = async (conn: SavedConnection) => { setBatchConnContext(conn); @@ -9221,7 +9267,7 @@ const Sidebar: React.FC<{ + + + + ({ value: item.value, label: item.label }))} + onChange={(next) => setBatchTableMode(next as BatchTableExportMode)} + /> +
+ {batchTableModeMeta.description} +
+ + +
+
导出格式
+ { + setSelectedConnectionId(String(next || '').trim()); + setSelectedDatabaseNames([]); + setDatabaseLoadError(''); + }} + /> +
+ + + +
+
+
数据库
+
+ + +
+
+ ({ value: item.value, label: item.label }))} + onChange={(next) => setBatchDatabaseMode(next as BatchDatabaseExportMode)} + /> +
+ {batchDatabaseModeMeta.description} +
+
+ +
+
导出格式
+