From 995160d6faccd3ba876d503f56a4215909901ebe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maaria=20Wahlstr=C3=B6m?= Date: Tue, 10 Dec 2024 10:31:49 +0200 Subject: [PATCH 1/2] CSCFC4EMSCR-585 Change node elementpath to array --- mscr-ui/src/common/components/schema-info/index.tsx | 13 ++++++------- .../schema-info/schema-tree/node-info/index.tsx | 1 - .../schema-tree/schema-tree-renderer/index.tsx | 7 +++---- .../interfaces/crosswalk-connection.interface.ts | 3 +-- mscr-ui/src/modules/crosswalk-editor/index.tsx | 3 +-- 5 files changed, 11 insertions(+), 16 deletions(-) diff --git a/mscr-ui/src/common/components/schema-info/index.tsx b/mscr-ui/src/common/components/schema-info/index.tsx index ef574a6f7..c27044a4f 100644 --- a/mscr-ui/src/common/components/schema-info/index.tsx +++ b/mscr-ui/src/common/components/schema-info/index.tsx @@ -116,18 +116,17 @@ export default function SchemaInfo(props: { // Used by tree select and filtering function getAllNodeIdsOnPathToLeaf(nodeIds: string[]) { - const elementPaths: string[] = []; + let idsOnPath: string[] = []; nodeIds.forEach((nodeId) => { const nodes = nodeIdToNodeDictionary[nodeId]; - nodes.map((node) => elementPaths.push(node.elementPath)); + nodes.map((node) => { + idsOnPath = idsOnPath.concat(node.elementPath); + }); }); const nodesToSelect: Set = new Set(); - elementPaths.forEach((path) => { - const nodeIdsOnPath = path.split('.'); - nodeIdsOnPath.forEach((nodeId) => { - nodesToSelect.add(nodeId); - }); + idsOnPath.forEach((pathNodeId) => { + nodesToSelect.add(pathNodeId); }); return Array.from(nodesToSelect); diff --git a/mscr-ui/src/common/components/schema-info/schema-tree/node-info/index.tsx b/mscr-ui/src/common/components/schema-info/schema-tree/node-info/index.tsx index fd99692e7..a7400c67c 100644 --- a/mscr-ui/src/common/components/schema-info/schema-tree/node-info/index.tsx +++ b/mscr-ui/src/common/components/schema-info/schema-tree/node-info/index.tsx @@ -132,7 +132,6 @@ export default function NodeInfo(props: { )} {props.isNodeEditable && selectedNode && - selectedNode?.elementPath !== 'ROOT' && !isLeafNode && !props.hasCustomRoot && (