From 1699ebd77f2d7c756218879cf56e2998b1d4878c Mon Sep 17 00:00:00 2001 From: Brenden Harrell Date: Fri, 30 Jul 2021 21:47:06 -0500 Subject: [PATCH] clean up --- .../UI/Function-Libraries/ProtocolNode.js | 9 +++------ .../UI/Function-Libraries/UiObjectsFromNodes.js | 13 ++++++++----- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Projects/Foundations/UI/Function-Libraries/ProtocolNode.js b/Projects/Foundations/UI/Function-Libraries/ProtocolNode.js index 1dda672ed..1fdc985b3 100644 --- a/Projects/Foundations/UI/Function-Libraries/ProtocolNode.js +++ b/Projects/Foundations/UI/Function-Libraries/ProtocolNode.js @@ -262,21 +262,18 @@ function newFoundationsFunctionLibraryProtocolNode() { // If the path has not been saved save it now if (node.payload.referenceParentCombinedNodePath === undefined) { let attachNodePath = UI.projects.foundations.utilities.hierarchy.getNodeNameTypePath(node.payload.referenceParent) - // Save path to reference parent for auto restore - // savedPayload.referenceParentCombinedNodePath = { path: attachNodePath } - //console.log("this is the saved payload new save", savedPayload) + // Save path to reference parent for auto restore + savedPayload.referenceParentCombinedNodePath = { path: attachNodePath } } else { // Save path to reference parent for auto restore savedPayload.referenceParentCombinedNodePath = node.payload.referenceParentCombinedNodePath - console.log("this is the saved payload old save", savedPayload) } } else { /* The referenceParent property can be inherited from the previous saved payload. */ if (node.savedPayload !== undefined) { savedPayload.referenceParent = node.savedPayload.referenceParent // Save path to reference parent for auto restore - savedPayload.referenceParentCombinedNodePath = node.savedPayload.referenceParentCombinedNodePath - //console.log("this is the saved payload inherited", savedPayload) + savedPayload.referenceParentCombinedNodePath = node.savedPayload.referenceParentCombinedNodePath } } } diff --git a/Projects/Foundations/UI/Function-Libraries/UiObjectsFromNodes.js b/Projects/Foundations/UI/Function-Libraries/UiObjectsFromNodes.js index 23dea6628..72fa4b1c3 100644 --- a/Projects/Foundations/UI/Function-Libraries/UiObjectsFromNodes.js +++ b/Projects/Foundations/UI/Function-Libraries/UiObjectsFromNodes.js @@ -315,7 +315,7 @@ function newFoundationsFunctionLibraryUiObjectsFromNodes() { // if Reestablishment failed now reestablish reference based on saved path if (node.payload.referenceParent === undefined) { - console.log('this node failed to connect' + node.type + ' ' + node.name, node ) + console.log('this node failed to connect by id ' + node.type + ' ' + node.name, node ) // Gather saved path let rawPath = node.savedPayload.referenceParentCombinedNodePath if (rawPath !== undefined) { @@ -329,7 +329,11 @@ function newFoundationsFunctionLibraryUiObjectsFromNodes() { if (i === 0) { pathName = rawPath[i][0] pathType = rawPath[i][1] - pathNode = UI.projects.foundations.spaces.designSpace.workspace.getHierarchyHeadsByCodeNameAndNodeType( pathName, pathType) + pathNode = UI.projects.foundations.spaces.designSpace.workspace.getHierarchyHeadsByCodeNameAndNodeType( pathName, pathType ) + // If reference parent is workspace node grab node + if (pathType === "Workspace") { + pathNode = UI.projects.foundations.spaces.designSpace.workspace.workspaceNode + } continue } else { // Walk through children nodes and find the next node from saved path pathName = rawPath[i][0] @@ -349,8 +353,8 @@ function newFoundationsFunctionLibraryUiObjectsFromNodes() { for (let i = 0; i < schemaDocument.childrenNodesProperties.length; i++) { let property = schemaDocument.childrenNodesProperties[i] - //console.log("this is path", pathName, pathType) switch (property.type) { + // If child node is directly withing parent node look for it case 'node': { if (node[property.name] !== undefined) { if (node[property.name].name === pathName && node[property.name].type === pathType) { @@ -361,15 +365,14 @@ function newFoundationsFunctionLibraryUiObjectsFromNodes() { } break } + // If child node is in an array look for it case 'array': { if (node[property.name] !== undefined) { let nodePropertyArray = node[property.name] for (let m = 0; m < nodePropertyArray.length; m++) { - console.log( nodePropertyArray[m].name, ' equals ', pathName, ' ', nodePropertyArray[m].type, " equals ",pathType) if (nodePropertyArray[m].name === pathName && nodePropertyArray[m].type === pathType) { nextNode = nodePropertyArray[m] - console.log("we have a match!", nextNode) return nextNode } }