From dd24a05bb27276710a90e60d52910acb3afcfb1d Mon Sep 17 00:00:00 2001 From: Wroud Date: Wed, 1 Sep 2021 14:51:22 +0300 Subject: [PATCH] fix(core-app): CB-1211 empty groups in nav-tree --- .../navigationTreeConnectionGroupFilter.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/webapp/packages/core-app/src/NavigationTree/navigationTreeConnectionGroupFilter.ts b/webapp/packages/core-app/src/NavigationTree/navigationTreeConnectionGroupFilter.ts index 1b2d7758cb..3f17190b74 100644 --- a/webapp/packages/core-app/src/NavigationTree/navigationTreeConnectionGroupFilter.ts +++ b/webapp/packages/core-app/src/NavigationTree/navigationTreeConnectionGroupFilter.ts @@ -40,6 +40,13 @@ function sortManageable(connectionInfoResource: ConnectionInfoResource): (nodeA: const connectionA = connectionInfoResource.get(NodeManagerUtils.connectionNodeIdToConnectionId(nodeA.id)); const connectionB = connectionInfoResource.get(NodeManagerUtils.connectionNodeIdToConnectionId(nodeB.id)); + // if (!connectionA || !connectionB) { + // if (connectionA === connectionB) { + // return 0; + // } + // return connectionA ? 1 : -1; + // } + const nodeAManageable = connectionA?.features.includes(EConnectionFeature.manageable); const nodeBManageable = connectionB?.features.includes(EConnectionFeature.manageable); @@ -71,7 +78,9 @@ export function navigationTreeConnectionGroupFilter( for (const node of nodes) { const connection = connectionInfoResource.get(NodeManagerUtils.connectionNodeIdToConnectionId(node.id)); - const manageable = connection?.features.includes(EConnectionFeature.manageable); + const manageable = !!connection?.features.includes(EConnectionFeature.manageable); + + console.log(!!connection, manageable); let nextGroup = NAVIGATION_TREE_CONNECTION_GROUPS.unsorted; @@ -101,6 +110,8 @@ export function navigationTreeConnectionGroupFilter( ); } + console.log(groupedChildren); + return groupedChildren; }; }