From b3730e3637432011ea29f3097819223bbc782005 Mon Sep 17 00:00:00 2001 From: zzyangh <799463087@qq.com> Date: Tue, 11 Mar 2025 17:58:09 +0800 Subject: [PATCH] [feature]: Remove export actions --- webapp/packages/core-view/src/index.ts | 2 +- .../src/DataExportMenuService.ts | 91 +++++++++---------- 2 files changed, 44 insertions(+), 49 deletions(-) diff --git a/webapp/packages/core-view/src/index.ts b/webapp/packages/core-view/src/index.ts index c0af039136d..7a553a8d552 100644 --- a/webapp/packages/core-view/src/index.ts +++ b/webapp/packages/core-view/src/index.ts @@ -1,7 +1,7 @@ export * from './Action/Actions/ACTION_COLLAPSE_ALL'; export * from './Action/Actions/ACTION_DELETE'; export * from './Action/Actions/ACTION_EDIT'; -export * from './Action/Actions/ACTION_EXPORT'; +// export * from './Action/Actions/ACTION_EXPORT'; export * from './Action/Actions/ACTION_FILTER'; export * from './Action/Actions/ACTION_LAYOUT'; export * from './Action/Actions/ACTION_NEW_FOLDER'; diff --git a/webapp/packages/plugin-data-export/src/DataExportMenuService.ts b/webapp/packages/plugin-data-export/src/DataExportMenuService.ts index 48e757a6aa8..a4ee7a1e52c 100644 --- a/webapp/packages/plugin-data-export/src/DataExportMenuService.ts +++ b/webapp/packages/plugin-data-export/src/DataExportMenuService.ts @@ -10,7 +10,7 @@ import { injectable } from '@cloudbeaver/core-di'; import { CommonDialogService, IMenuContext } from '@cloudbeaver/core-dialogs'; import { LocalizationService } from '@cloudbeaver/core-localization'; import { DATA_CONTEXT_NAV_NODE, EObjectFeature } from '@cloudbeaver/core-navigation-tree'; -import { ACTION_EXPORT, ActionService, DATA_CONTEXT_MENU_NESTED, MenuService } from '@cloudbeaver/core-view'; +import { ActionService, DATA_CONTEXT_MENU_NESTED, MenuService } from '@cloudbeaver/core-view'; import { DATA_CONTEXT_CONNECTION } from '@cloudbeaver/plugin-connections'; import { IDatabaseDataSource, IDataContainerOptions, ITableFooterMenuContext, TableFooterMenuService } from '@cloudbeaver/plugin-data-viewer'; import type { IDataQueryOptions } from '@cloudbeaver/plugin-sql-editor'; @@ -30,53 +30,48 @@ export class DataExportMenuService { ) {} register(): void { - this.tableFooterMenuService.registerMenuItem({ - id: 'export ', - order: 5, - title: 'data_transfer_dialog_export', - tooltip: 'data_transfer_dialog_export_tooltip', - icon: 'table-export', - isPresent(context) { - return context.contextType === TableFooterMenuService.nodeContextType; - }, - isHidden: () => this.isDisabled(), - isDisabled(context) { - return ( - context.data.model.isLoading() || - context.data.model.isDisabled(context.data.resultIndex) || - !context.data.model.getResult(context.data.resultIndex) - ); - }, - onClick: this.exportData.bind(this), - }); - - this.menuService.addCreator({ - isApplicable: context => { - const node = context.tryGet(DATA_CONTEXT_NAV_NODE); - - if (node && !node.objectFeatures.includes(EObjectFeature.dataContainer)) { - return false; - } - - return !this.isDisabled() && context.has(DATA_CONTEXT_CONNECTION) && !context.has(DATA_CONTEXT_MENU_NESTED); - }, - getItems: (context, items) => [...items, ACTION_EXPORT], - }); - - this.actionService.addHandler({ - id: 'data-export', - isActionApplicable: (context, action) => action === ACTION_EXPORT && context.has(DATA_CONTEXT_CONNECTION) && context.has(DATA_CONTEXT_NAV_NODE), - handler: async (context, action) => { - const node = context.get(DATA_CONTEXT_NAV_NODE); - const connection = context.get(DATA_CONTEXT_CONNECTION); - - this.commonDialogService.open(DataExportDialog, { - connectionKey: createConnectionParam(connection), - name: node?.name, - containerNodePath: node?.id, - }); - }, - }); + // this.tableFooterMenuService.registerMenuItem({ + // id: 'export ', + // order: 5, + // title: 'data_transfer_dialog_export', + // tooltip: 'data_transfer_dialog_export_tooltip', + // icon: 'table-export', + // isPresent(context) { + // return context.contextType === TableFooterMenuService.nodeContextType; + // }, + // isHidden: () => this.isDisabled(), + // isDisabled(context) { + // return ( + // context.data.model.isLoading() || + // context.data.model.isDisabled(context.data.resultIndex) || + // !context.data.model.getResult(context.data.resultIndex) + // ); + // }, + // onClick: this.exportData.bind(this), + // }); + // this.menuService.addCreator({ + // isApplicable: context => { + // const node = context.tryGet(DATA_CONTEXT_NAV_NODE); + // if (node && !node.objectFeatures.includes(EObjectFeature.dataContainer)) { + // return false; + // } + // return !this.isDisabled() && context.has(DATA_CONTEXT_CONNECTION) && !context.has(DATA_CONTEXT_MENU_NESTED); + // }, + // getItems: (context, items) => [...items, ACTION_EXPORT], + // }); + // this.actionService.addHandler({ + // id: 'data-export', + // isActionApplicable: (context, action) => action === ACTION_EXPORT && context.has(DATA_CONTEXT_CONNECTION) && context.has(DATA_CONTEXT_NAV_NODE), + // handler: async (context, action) => { + // const node = context.get(DATA_CONTEXT_NAV_NODE); + // const connection = context.get(DATA_CONTEXT_CONNECTION); + // this.commonDialogService.open(DataExportDialog, { + // connectionKey: createConnectionParam(connection), + // name: node?.name, + // containerNodePath: node?.id, + // }); + // }, + // }); } private exportData(context: IMenuContext) {