Skip to content

Commit

Permalink
CB-5955 cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
sergeyteleshev committed Dec 13, 2024
1 parent 3618589 commit 27ae2a5
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const DriverSelectorDialog: DialogComponent<Payload> = observer(function
<CommonDialogWrapper size="large" autofocus={false} fixedSize>
<CommonDialogHeader title={translate('plugin_connections_new_connection_dialog_title')} />
<CommonDialogBody noBodyPadding noOverflow>
<DriverSelector className={s(style, { driverSelector: true })} drivers={enabledDrivers} onSelect={driverId => dialog.select(driverId)} />
<DriverSelector className={s(style, { driverSelector: true })} drivers={enabledDrivers} onSelect={dialog.select} />
</CommonDialogBody>
</CommonDialogWrapper>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
});
Original file line number Diff line number Diff line change
Expand Up @@ -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',
});
Original file line number Diff line number Diff line change
Expand Up @@ -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)!;

Expand All @@ -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;
},
Expand Down Expand Up @@ -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: {
Expand Down

0 comments on commit 27ae2a5

Please sign in to comment.