From 27ae2a59a987e4a034fcd1c457ca93345f158b1e Mon Sep 17 00:00:00 2001 From: sergeyteleshev Date: Fri, 13 Dec 2024 17:47:41 +0100 Subject: [PATCH] CB-5955 cleanup --- .../src/CustomConnectionPluginBootstrap.ts | 6 +++--- .../src/DriverSelector/DriverSelectorDialog.tsx | 2 +- .../src/Actions/ACTION_TREE_CREATE_CONNECTION.ts | 2 +- .../src/Actions/ACTION_TREE_CREATE_FOLDER.ts | 2 +- .../src/NavNodes/ResourceFoldersBootstrap.ts | 16 ++++------------ 5 files changed, 10 insertions(+), 18 deletions(-) diff --git a/webapp/packages/plugin-connection-custom/src/CustomConnectionPluginBootstrap.ts b/webapp/packages/plugin-connection-custom/src/CustomConnectionPluginBootstrap.ts index 5f53d1b70d..237e4baa04 100644 --- a/webapp/packages/plugin-connection-custom/src/CustomConnectionPluginBootstrap.ts +++ b/webapp/packages/plugin-connection-custom/src/CustomConnectionPluginBootstrap.ts @@ -6,12 +6,12 @@ * you may not use this file except in compliance with the License. */ import { importLazyComponent } from '@cloudbeaver/core-blocks'; -import { ConnectionsManagerService, getFolderPath, isConnectionNode, NAV_NODE_TYPE_CONNECTION } from '@cloudbeaver/core-connections'; +import { ConnectionsManagerService, getFolderPath, isConnectionNode } from '@cloudbeaver/core-connections'; import type { IDataContextProvider } from '@cloudbeaver/core-data-context'; import { Bootstrap, injectable } from '@cloudbeaver/core-di'; import { CommonDialogService } from '@cloudbeaver/core-dialogs'; -import { DATA_CONTEXT_NAV_NODE, isFolderNode, isProjectNode, NAV_NODE_TYPE_FOLDER } from '@cloudbeaver/core-navigation-tree'; -import { getProjectNodeId, NAV_NODE_TYPE_PROJECT, ProjectInfoResource } from '@cloudbeaver/core-projects'; +import { DATA_CONTEXT_NAV_NODE, isFolderNode, isProjectNode } from '@cloudbeaver/core-navigation-tree'; +import { getProjectNodeId, ProjectInfoResource } from '@cloudbeaver/core-projects'; import { CachedMapAllKey, getCachedMapResourceLoaderState } from '@cloudbeaver/core-resource'; import { ActionService, type IAction, MenuService } from '@cloudbeaver/core-view'; import { ACTION_TREE_CREATE_CONNECTION, MENU_CONNECTIONS } from '@cloudbeaver/plugin-connections'; diff --git a/webapp/packages/plugin-connection-custom/src/DriverSelector/DriverSelectorDialog.tsx b/webapp/packages/plugin-connection-custom/src/DriverSelector/DriverSelectorDialog.tsx index f954c63e6a..1c53de307e 100644 --- a/webapp/packages/plugin-connection-custom/src/DriverSelector/DriverSelectorDialog.tsx +++ b/webapp/packages/plugin-connection-custom/src/DriverSelector/DriverSelectorDialog.tsx @@ -40,7 +40,7 @@ export const DriverSelectorDialog: DialogComponent = observer(function - dialog.select(driverId)} /> + ); diff --git a/webapp/packages/plugin-connections/src/Actions/ACTION_TREE_CREATE_CONNECTION.ts b/webapp/packages/plugin-connections/src/Actions/ACTION_TREE_CREATE_CONNECTION.ts index cf526576ec..8aaa7e1829 100644 --- a/webapp/packages/plugin-connections/src/Actions/ACTION_TREE_CREATE_CONNECTION.ts +++ b/webapp/packages/plugin-connections/src/Actions/ACTION_TREE_CREATE_CONNECTION.ts @@ -7,6 +7,6 @@ */ import { createAction } from '@cloudbeaver/core-view'; -export const ACTION_TREE_CREATE_CONNECTION = createAction('create-connection', { +export const ACTION_TREE_CREATE_CONNECTION = createAction('create-tree-connection', { label: 'plugin_connections_connection_create_menu_title', }); diff --git a/webapp/packages/plugin-connections/src/Actions/ACTION_TREE_CREATE_FOLDER.ts b/webapp/packages/plugin-connections/src/Actions/ACTION_TREE_CREATE_FOLDER.ts index c4bf0d6b7e..bd57b1ef06 100644 --- a/webapp/packages/plugin-connections/src/Actions/ACTION_TREE_CREATE_FOLDER.ts +++ b/webapp/packages/plugin-connections/src/Actions/ACTION_TREE_CREATE_FOLDER.ts @@ -7,6 +7,6 @@ */ import { createAction } from '@cloudbeaver/core-view'; -export const ACTION_TREE_CREATE_FOLDER = createAction('create-folder', { +export const ACTION_TREE_CREATE_FOLDER = createAction('create-tree-folder', { label: 'ui_folder_new', }); diff --git a/webapp/packages/plugin-navigation-tree-rm/src/NavNodes/ResourceFoldersBootstrap.ts b/webapp/packages/plugin-navigation-tree-rm/src/NavNodes/ResourceFoldersBootstrap.ts index c81c341c76..ac81dabbcb 100644 --- a/webapp/packages/plugin-navigation-tree-rm/src/NavNodes/ResourceFoldersBootstrap.ts +++ b/webapp/packages/plugin-navigation-tree-rm/src/NavNodes/ResourceFoldersBootstrap.ts @@ -77,7 +77,7 @@ export class ResourceFoldersBootstrap extends Bootstrap { this.actionService.addHandler({ id: 'tree-tools-menu-resource-folders-handler', actions: [ACTION_NEW_FOLDER], - contexts: [DATA_CONTEXT_ELEMENTS_TREE], + contexts: [DATA_CONTEXT_ELEMENTS_TREE, DATA_CONTEXT_RESOURCE_MANAGER_TREE_RESOURCE_TYPE_ID], isActionApplicable: context => { const tree = context.get(DATA_CONTEXT_ELEMENTS_TREE)!; @@ -89,11 +89,7 @@ export class ResourceFoldersBootstrap extends Bootstrap { }, getLoader: () => getCachedMapResourceLoaderState(this.projectInfoResource, () => CachedMapAllKey), isDisabled: context => { - const tree = context.get(DATA_CONTEXT_ELEMENTS_TREE); - - if (!tree) { - return true; - } + const tree = context.get(DATA_CONTEXT_ELEMENTS_TREE)!; return this.treeSelectionService.getFirstSelectedNode(tree, getRmProjectNodeId) === undefined; }, @@ -164,12 +160,8 @@ export class ResourceFoldersBootstrap extends Bootstrap { } private async elementsTreeActionHandler(contexts: IDataContextProvider, action: IAction) { - const resourceTypeId = contexts.get(DATA_CONTEXT_RESOURCE_MANAGER_TREE_RESOURCE_TYPE_ID); - const tree = contexts.get(DATA_CONTEXT_ELEMENTS_TREE); - - if (!tree) { - return; - } + const resourceTypeId = contexts.get(DATA_CONTEXT_RESOURCE_MANAGER_TREE_RESOURCE_TYPE_ID)!; + const tree = contexts.get(DATA_CONTEXT_ELEMENTS_TREE)!; switch (action) { case ACTION_NEW_FOLDER: {