Skip to content

Commit

Permalink
CB-4541 chore: revert test code
Browse files Browse the repository at this point in the history
  • Loading branch information
Wroud committed Jan 24, 2024
1 parent d94d239 commit 255a778
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 31 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
fragment NavNodeInfo on NavigatorNodeInfo {
id
uri
name
plainName
hasChildren
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { useMemo } from 'react';

import { getComputed, s, useResource, useS, useUserData } from '@cloudbeaver/core-blocks';
import { useService } from '@cloudbeaver/core-di';
import { EObjectFeature, NavNodeInfoResource, NavTreeResource, ProjectsNavNodeService } from '@cloudbeaver/core-navigation-tree';
import { NavNodeInfoResource, NavTreeResource, ProjectsNavNodeService } from '@cloudbeaver/core-navigation-tree';
import { ProjectInfoResource, ProjectsService } from '@cloudbeaver/core-projects';
import { resourceKeyList } from '@cloudbeaver/core-resource';
import { getRmResourcePath, ResourceManagerResource, RESOURCES_NODE_PATH } from '@cloudbeaver/core-resource-manager';
Expand All @@ -22,8 +22,6 @@ import {
getNavigationTreeUserSettingsId,
IElementsTreeSettings,
NavigationTreeService,
Tree,
useTreeData,
validateElementsTreeSettings,
} from '@cloudbeaver/plugin-navigation-tree';
import { ResourceManagerService } from '@cloudbeaver/plugin-resource-manager';
Expand Down Expand Up @@ -102,36 +100,9 @@ export const ResourceManagerTree: React.FC<Props> = observer(function ResourceMa

const settingsElements = useMemo(() => [ProjectsSettingsPlaceholderElement], []);

const data = useTreeData({
rootId: '',
getNode(nodeId) {
const node = navNodeInfoResource.get(nodeId);
const outdated = navTreeResource.isOutdated(nodeId);
const children = navTreeResource.get(nodeId);

return {
name: node?.name ?? 'Unknown',
icon: node?.icon,
tooltip: node?.description,
leaf: node?.objectFeatures.includes(EObjectFeature.entity) || !node?.hasChildren || (children?.length === 0 && !outdated),
};
},
getChildren(nodeId) {
return navTreeService.getChildren(nodeId) ?? [];
},
async load(nodeId, manual) {
await navTreeService.loadNestedNodes(nodeId, manual);
},
});

function getNodeHeight(nodeId: string): number {
return nodeId === root ? 0 : 22;
}

return (
<CaptureView view={navTreeService} className={s(styles, { captureView: true })}>
<ResourceManagerTreeCaptureViewContext resourceTypeId={resourceTypeId} />
<Tree data={data} getNodeHeight={getNodeHeight} />
<ElementsTreeLoader
root={root}
getChildren={navTreeService.getChildren}
Expand Down

0 comments on commit 255a778

Please sign in to comment.