mirror of
https://github.com/dbeaver/cloudbeaver.git
synced 2026-09-24 16:04:36 +08:00
fix(core): nav tree context menu for connections
This commit is contained in:
-1
@@ -28,7 +28,6 @@ export const TreeNodeMenu = observer(function TreeNodeMenu({
|
||||
node,
|
||||
isSelected,
|
||||
}: TreeNodeMenuProps) {
|
||||
|
||||
const navigationTreeContextMenuService = useService(NavigationTreeContextMenuService);
|
||||
|
||||
const menuPanel = useMemo(
|
||||
|
||||
@@ -55,13 +55,14 @@ export class ConnectionDialogsService {
|
||||
this.contextMenuService.getRootMenuToken(),
|
||||
{
|
||||
id: 'closeConnection',
|
||||
isPresent: (context: IMenuContext<NavNode>) => {
|
||||
isPresent:
|
||||
(context: IMenuContext<NavNode>) => context.contextType === NavigationTreeContextMenuService.nodeContextType,
|
||||
isHidden: (context: IMenuContext<NavNode>) => {
|
||||
const connectionId = NodeManagerUtils.connectionNodeIdToConnectionId(context.data.id);
|
||||
const connection = this.connectionInfoResource.get(connectionId);
|
||||
|
||||
return context.contextType === NavigationTreeContextMenuService.nodeContextType
|
||||
&& !!context.data.objectFeatures.includes(EObjectFeature.dataSource)
|
||||
&& !!connection?.connected;
|
||||
return !context.data.objectFeatures.includes(EObjectFeature.dataSource)
|
||||
|| !connection?.connected;
|
||||
},
|
||||
title: 'Disconnect',
|
||||
onClick: (context: IMenuContext<NavNode>) => {
|
||||
@@ -75,13 +76,14 @@ export class ConnectionDialogsService {
|
||||
this.contextMenuService.getRootMenuToken(),
|
||||
{
|
||||
id: 'deleteConnection',
|
||||
isPresent: (context: IMenuContext<NavNode>) => {
|
||||
isPresent:
|
||||
(context: IMenuContext<NavNode>) => context.contextType === NavigationTreeContextMenuService.nodeContextType,
|
||||
isHidden: (context: IMenuContext<NavNode>) => {
|
||||
const connectionId = NodeManagerUtils.connectionNodeIdToConnectionId(context.data.id);
|
||||
const connection = this.connectionInfoResource.get(connectionId);
|
||||
|
||||
return context.contextType === NavigationTreeContextMenuService.nodeContextType
|
||||
&& !!context.data.objectFeatures.includes(EObjectFeature.dataSource)
|
||||
&& !!connection?.features.includes(EConnectionFeature.temporary);
|
||||
return !context.data.objectFeatures.includes(EObjectFeature.dataSource)
|
||||
|| !connection?.features.includes(EConnectionFeature.temporary);
|
||||
},
|
||||
title: 'Delete',
|
||||
onClick: (context: IMenuContext<NavNode>) => {
|
||||
|
||||
@@ -314,7 +314,7 @@ export class NavNodeManagerService {
|
||||
let connection: Connection | undefined;
|
||||
try {
|
||||
connection = await this.connectionAuthService.auth(
|
||||
NodeManagerUtils.connectionNodeIdToConnectionId(nodeInfo.nodeId)
|
||||
NodeManagerUtils.nodeIdToConnectionId(nodeInfo.nodeId)
|
||||
);
|
||||
} catch (exception) {
|
||||
this.notificationService.logException(exception);
|
||||
|
||||
Reference in New Issue
Block a user