From d9ec0c8c496c19bb8cc7001e0c46e759257d4d6c Mon Sep 17 00:00:00 2001 From: Brenden Harrell Date: Fri, 23 Jul 2021 21:58:51 -0500 Subject: [PATCH 1/7] Initial work on Auto Reference feature --- .../UI/Function-Libraries/ProtocolNode.js | 12 ++++++++++ .../ReferenceAttachDetach.js | 24 ++++++++++++++++++- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/Projects/Foundations/UI/Function-Libraries/ProtocolNode.js b/Projects/Foundations/UI/Function-Libraries/ProtocolNode.js index 50696f57c..3ce61e541 100644 --- a/Projects/Foundations/UI/Function-Libraries/ProtocolNode.js +++ b/Projects/Foundations/UI/Function-Libraries/ProtocolNode.js @@ -259,13 +259,25 @@ function newFoundationsFunctionLibraryProtocolNode() { name: node.payload.referenceParent.name, id: node.payload.referenceParent.id } + // 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 } + } else { + // Save path to reference parent for auto restore + savedPayload.referenceParentCombinedNodePath = { path: node.payload.referenceParentCombinedNodePath } + } } 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.payload.referenceParentCombinedNodePath } } } + console.log("this is the saved payload", savedPayload) return savedPayload } } diff --git a/Projects/Foundations/UI/Function-Libraries/ReferenceAttachDetach.js b/Projects/Foundations/UI/Function-Libraries/ReferenceAttachDetach.js index eaeee4f98..aed3561dc 100644 --- a/Projects/Foundations/UI/Function-Libraries/ReferenceAttachDetach.js +++ b/Projects/Foundations/UI/Function-Libraries/ReferenceAttachDetach.js @@ -7,17 +7,39 @@ function newFoundationsFunctionLibraryAttachDetach() { return thisObject function referenceDetachNode(node) { - completeDetachment(node) + cleanAttachNodePath(node) + completeDetachment(node) + } function referenceAttachNode(node, attachToNode) { + storeAttachNodePath(node, attachToNode) completeAttachment(node, attachToNode) } + // Store the path to the reference parent to make restoring it possible if the reference partent is updated and given a new id + function storeAttachNodePath(node, attachToNode) { + let attachNodePath = UI.projects.foundations.utilities.hierarchy.getNodeNameTypePath(attachToNode) + // Save attach path to active payload + node.payload.referenceParentCombinedNodePath = { path: attachNodePath } + } + + // Clear the path to reference parent when the reference is cleared + function cleanAttachNodePath(node){ + if (node.payload !== undefined) { + node.payload.referenceParentCombinedNodePath = undefined + if (node.savedPayload !== undefined) { + node.savedPayload.referenceParentCombinedNodePath = undefined + } + } + } + + // Establish the reference between node and it's reference parent function completeAttachment(node, attachToNode) { node.payload.referenceParent = attachToNode } + // Detach the reference between node and it's reference parent function completeDetachment(node) { if (node.payload !== undefined) { if (node.payload.referenceParent !== undefined) { From 9c1d79ec7d6e4cb35bf7bb0fb9c07e20a29a30ce Mon Sep 17 00:00:00 2001 From: Brenden Harrell Date: Tue, 27 Jul 2021 17:45:02 -0500 Subject: [PATCH 2/7] More work on Auto Reference --- .../UI/Function-Libraries/ProtocolNode.js | 11 ++-- .../ReferenceAttachDetach.js | 2 +- .../Function-Libraries/UiObjectsFromNodes.js | 51 +++++++++++++++++-- 3 files changed, 55 insertions(+), 9 deletions(-) diff --git a/Projects/Foundations/UI/Function-Libraries/ProtocolNode.js b/Projects/Foundations/UI/Function-Libraries/ProtocolNode.js index 3ce61e541..1dda672ed 100644 --- a/Projects/Foundations/UI/Function-Libraries/ProtocolNode.js +++ b/Projects/Foundations/UI/Function-Libraries/ProtocolNode.js @@ -263,21 +263,24 @@ function newFoundationsFunctionLibraryProtocolNode() { 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 } + // savedPayload.referenceParentCombinedNodePath = { path: attachNodePath } + //console.log("this is the saved payload new save", savedPayload) } else { // Save path to reference parent for auto restore - savedPayload.referenceParentCombinedNodePath = { path: node.payload.referenceParentCombinedNodePath } + 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.payload.referenceParentCombinedNodePath + savedPayload.referenceParentCombinedNodePath = node.savedPayload.referenceParentCombinedNodePath + //console.log("this is the saved payload inherited", savedPayload) } } } - console.log("this is the saved payload", savedPayload) + return savedPayload } } diff --git a/Projects/Foundations/UI/Function-Libraries/ReferenceAttachDetach.js b/Projects/Foundations/UI/Function-Libraries/ReferenceAttachDetach.js index aed3561dc..c50184947 100644 --- a/Projects/Foundations/UI/Function-Libraries/ReferenceAttachDetach.js +++ b/Projects/Foundations/UI/Function-Libraries/ReferenceAttachDetach.js @@ -21,7 +21,7 @@ function newFoundationsFunctionLibraryAttachDetach() { function storeAttachNodePath(node, attachToNode) { let attachNodePath = UI.projects.foundations.utilities.hierarchy.getNodeNameTypePath(attachToNode) // Save attach path to active payload - node.payload.referenceParentCombinedNodePath = { path: attachNodePath } + node.payload.referenceParentCombinedNodePath = attachNodePath } // Clear the path to reference parent when the reference is cleared diff --git a/Projects/Foundations/UI/Function-Libraries/UiObjectsFromNodes.js b/Projects/Foundations/UI/Function-Libraries/UiObjectsFromNodes.js index 987a87b04..ba90e4642 100644 --- a/Projects/Foundations/UI/Function-Libraries/UiObjectsFromNodes.js +++ b/Projects/Foundations/UI/Function-Libraries/UiObjectsFromNodes.js @@ -308,11 +308,54 @@ function newFoundationsFunctionLibraryUiObjectsFromNodes() { } if (node.savedPayload !== undefined) { if (node.savedPayload.referenceParent !== undefined) { // these are children recreated + // Reestablish based on Id node.payload.referenceParent = mapOfNodes.get(node.savedPayload.referenceParent.id) - if (node.payload.referenceParent === undefined) { - //console.log('[WARN]' + node.type + ' ' + node.name + ' reference parent lost during re-binding phase.') - } - } + //console.log("this is the node we tried to connect to", node.payload.referenceParent) + if (node.payload.referenceParent === undefined) { + console.log('this node failed to connect' + node.type + ' ' + node.name, node ) + let rawPath = node.savedPayload.referenceParentCombinedNodePath + if (rawPath !== undefined) { + console.log('this is a saved path',node.savedPayload.referenceParentCombinedNodePath) + // Attempt to reestablish reference based on saved path + let nodePath = [] + let headNode = UI.projects.foundations.spaces.designSpace.workspace.getHierarchyHeadsByCodeNameAndNodeType(rawPath[0][0], rawPath[0][1]) + console.log('this is our returned head node', headNode) + // Loop through saved Path and gather nodes + /*for (let i = 0; i < rawPath.length; i++) { + console.log("we are at this step in the node path", rawPath[i]) + // Loop through map of nodes to find each node in path + for (let x = 0; x < mapOfNodes.length; x++) { + let mapNode = mapOfNodes[x] + let mapNodeCodeName = UI.projects.foundations.utilities.nodeConfig.loadConfigProperty(mapNode.payload, 'codeName') + if (mapNodeCodeName === rawPath[i][0] && mapNode.type === ) { + nodePath.push(mapNode) + } + } + console.log("nodePath", nodePath) + }*/ + } + } + + // need to figure out how to check that this has failed to move to path implimentation + + + + function getMapNodeByCodeNameAndNodeType(codeName, nodeType) { + for (let i = 0; i < mapOfNodes.length; i++) { + let mapNode = mapOfNodes[i] + let mapNodeCodeName = UI.projects.foundations.utilities.nodeConfig.loadConfigProperty(mapNode.payload, 'codeName') + if (mapNodeCodeName === codeName && mapNode.type === nodeType) { + return mapNode + } + } + } + //console.log("this is the node", node, "saved path", path, "and map", mapOfNodes ) + + if (node.payload.referenceParent === undefined) { + //console.log('[WARN]' + node.type + ' ' + node.name + ' reference parent lost during re-binding phase.') + } + + } } } } From 82c5299d48570f562e01947ccf8c66651685e694 Mon Sep 17 00:00:00 2001 From: Brenden Harrell Date: Fri, 30 Jul 2021 11:06:53 -0500 Subject: [PATCH 3/7] More work on reference autofix feature --- .../Function-Libraries/UiObjectsFromNodes.js | 63 ++++++++++++++++--- .../UI/Spaces/Design-Space/Workspace.js | 3 + 2 files changed, 56 insertions(+), 10 deletions(-) diff --git a/Projects/Foundations/UI/Function-Libraries/UiObjectsFromNodes.js b/Projects/Foundations/UI/Function-Libraries/UiObjectsFromNodes.js index ba90e4642..828a8a9fc 100644 --- a/Projects/Foundations/UI/Function-Libraries/UiObjectsFromNodes.js +++ b/Projects/Foundations/UI/Function-Libraries/UiObjectsFromNodes.js @@ -295,6 +295,7 @@ function newFoundationsFunctionLibraryUiObjectsFromNodes() { console.log('ACA') } if (node.payload === undefined) { continue } + if (node.payload.referenceParent !== undefined) { if (node.payload.referenceParent.cleaned === true) { node.payload.referenceParent = mapOfNodes.get(node.payload.referenceParent.id) @@ -306,32 +307,74 @@ function newFoundationsFunctionLibraryUiObjectsFromNodes() { continue // In this case the reference is already good. } } + if (node.savedPayload !== undefined) { if (node.savedPayload.referenceParent !== undefined) { // these are children recreated // Reestablish based on Id node.payload.referenceParent = mapOfNodes.get(node.savedPayload.referenceParent.id) - //console.log("this is the node we tried to connect to", node.payload.referenceParent) + + // 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 ) + // Gather saved path let rawPath = node.savedPayload.referenceParentCombinedNodePath if (rawPath !== undefined) { + // Construct map from head node in saved path console.log('this is a saved path',node.savedPayload.referenceParentCombinedNodePath) - // Attempt to reestablish reference based on saved path - let nodePath = [] - let headNode = UI.projects.foundations.spaces.designSpace.workspace.getHierarchyHeadsByCodeNameAndNodeType(rawPath[0][0], rawPath[0][1]) - console.log('this is our returned head node', headNode) - // Loop through saved Path and gather nodes - /*for (let i = 0; i < rawPath.length; i++) { + const pathHeadName = rawPath[0][0] + const pathHeadType = rawPath[0][1] + let headNode = UI.projects.foundations.spaces.designSpace.workspace.getHierarchyHeadsByCodeNameAndNodeType( pathHeadName, pathHeadType) + const pathName = rawPath[1][0] + const pathType = rawPath[1][1] + getNextNode(headNode, pathName, pathType) + + function getNextNode(node, pathName, pathType) { + let schemaDocument = getSchemaDocument(node) + let nextNode = undefined + for (let i = 0; i < schemaDocument.childrenNodesProperties.length; i++) { + + let property = schemaDocument.childrenNodesProperties[i] + console.log("this is path", pathName, pathType) + switch (property.type) { + case 'node': { + if (node[property.name] !== undefined) { + console.log('this is a node property', headNode[property.name]) + } + break + } + case 'array': { + if (headNode[property.name] !== undefined) { + let nodePropertyArray = headNode[property.name] + for (let m = 0; m < nodePropertyArray.length; m++) { + console.log('this is an array property', nodePropertyArray[m]) + if (nodePropertyArray[m].name === pathName && nodePropertyArray[m].type === pathType) { + + nextNode = nodePropertyArray[m] + console.log("we have a match!", nextNode) + return nextNode + } + } + } + break + } + } + + } + } + + let nodePathMap = UI.projects.foundations.utilities.hierarchy.getHiriarchyMap(headNode) + console.log('this is our returned path map', nodePathMap) + // Loop through saved Path and gather reference parent from nodes map + /*for (let i = 1; i < rawPath.length; i++) { console.log("we are at this step in the node path", rawPath[i]) // Loop through map of nodes to find each node in path - for (let x = 0; x < mapOfNodes.length; x++) { + /*for (let x = 0; x < mapOfNodes.length; x++) { let mapNode = mapOfNodes[x] let mapNodeCodeName = UI.projects.foundations.utilities.nodeConfig.loadConfigProperty(mapNode.payload, 'codeName') if (mapNodeCodeName === rawPath[i][0] && mapNode.type === ) { nodePath.push(mapNode) } - } - console.log("nodePath", nodePath) + } }*/ } } diff --git a/Projects/Foundations/UI/Spaces/Design-Space/Workspace.js b/Projects/Foundations/UI/Spaces/Design-Space/Workspace.js index d8c7db23d..6664b013c 100644 --- a/Projects/Foundations/UI/Spaces/Design-Space/Workspace.js +++ b/Projects/Foundations/UI/Spaces/Design-Space/Workspace.js @@ -556,6 +556,9 @@ function newWorkspace() { let hierarchyHeadCodeName = UI.projects.foundations.utilities.nodeConfig.loadConfigProperty(hierarchyHead.payload, 'codeName') if (hierarchyHeadCodeName === codeName && hierarchyHead.type === nodeType) { return hierarchyHead + } else if (hierarchyHead.name === codeName && hierarchyHead.type === nodeType) { + // This condition is used for auto fixing references in UiObjectsFromNodes.js + return hierarchyHead } } } From f105ba21ad79df850642d714dfdfefc572494239 Mon Sep 17 00:00:00 2001 From: Brenden Harrell Date: Fri, 30 Jul 2021 17:11:48 -0500 Subject: [PATCH 4/7] initial working auto fix --- .../Function-Libraries/UiObjectsFromNodes.js | 60 ++++++++++--------- 1 file changed, 31 insertions(+), 29 deletions(-) diff --git a/Projects/Foundations/UI/Function-Libraries/UiObjectsFromNodes.js b/Projects/Foundations/UI/Function-Libraries/UiObjectsFromNodes.js index 828a8a9fc..ca704b123 100644 --- a/Projects/Foundations/UI/Function-Libraries/UiObjectsFromNodes.js +++ b/Projects/Foundations/UI/Function-Libraries/UiObjectsFromNodes.js @@ -319,34 +319,51 @@ function newFoundationsFunctionLibraryUiObjectsFromNodes() { // Gather saved path let rawPath = node.savedPayload.referenceParentCombinedNodePath if (rawPath !== undefined) { - // Construct map from head node in saved path - console.log('this is a saved path',node.savedPayload.referenceParentCombinedNodePath) - const pathHeadName = rawPath[0][0] - const pathHeadType = rawPath[0][1] - let headNode = UI.projects.foundations.spaces.designSpace.workspace.getHierarchyHeadsByCodeNameAndNodeType( pathHeadName, pathHeadType) - const pathName = rawPath[1][0] - const pathType = rawPath[1][1] - getNextNode(headNode, pathName, pathType) + // Step down node hierarchy to find missing referenceParent + let pathNode + let pathName + let pathType + for (let i = 0; i < rawPath.length; i++) { + + // Get Hierarchy head node + if (i === 0) { + pathName = rawPath[i][0] + pathType = rawPath[i][1] + pathNode = UI.projects.foundations.spaces.designSpace.workspace.getHierarchyHeadsByCodeNameAndNodeType( pathName, pathType) + continue + } else { // Walk through children nodes and find the next node from saved path + pathName = rawPath[i][0] + pathType = rawPath[i][1] + pathNode = getNextNodeFromPath(pathNode, pathName, pathType) + } + } + if (pathNode !== undefined ) { + UI.projects.foundations.functionLibraries.attachDetach.referenceAttachNode(node, pathNode) + } else { + console.log("[Warn] ", node.name, ' ', node.type, "failed to fix reference. Unable to find reference parent ", pathName, ' ', pathType ) + } - function getNextNode(node, pathName, pathType) { + function getNextNodeFromPath(node, pathName, pathType) { let schemaDocument = getSchemaDocument(node) let nextNode = undefined for (let i = 0; i < schemaDocument.childrenNodesProperties.length; i++) { let property = schemaDocument.childrenNodesProperties[i] - console.log("this is path", pathName, pathType) + //console.log("this is path", pathName, pathType) switch (property.type) { case 'node': { if (node[property.name] !== undefined) { - console.log('this is a node property', headNode[property.name]) + if (node[property.name].name === pathName && node[property.name].type === pathType) { + //console.log('this is a node property', node[property.name]) + } } break } case 'array': { - if (headNode[property.name] !== undefined) { - let nodePropertyArray = headNode[property.name] + if (node[property.name] !== undefined) { + let nodePropertyArray = node[property.name] for (let m = 0; m < nodePropertyArray.length; m++) { - console.log('this is an array property', nodePropertyArray[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] @@ -361,21 +378,6 @@ function newFoundationsFunctionLibraryUiObjectsFromNodes() { } } - - let nodePathMap = UI.projects.foundations.utilities.hierarchy.getHiriarchyMap(headNode) - console.log('this is our returned path map', nodePathMap) - // Loop through saved Path and gather reference parent from nodes map - /*for (let i = 1; i < rawPath.length; i++) { - console.log("we are at this step in the node path", rawPath[i]) - // Loop through map of nodes to find each node in path - /*for (let x = 0; x < mapOfNodes.length; x++) { - let mapNode = mapOfNodes[x] - let mapNodeCodeName = UI.projects.foundations.utilities.nodeConfig.loadConfigProperty(mapNode.payload, 'codeName') - if (mapNodeCodeName === rawPath[i][0] && mapNode.type === ) { - nodePath.push(mapNode) - } - } - }*/ } } From 1c89aac2ff8460d510afd1b314b2dc3fe903b6ec Mon Sep 17 00:00:00 2001 From: Brenden Harrell Date: Fri, 30 Jul 2021 17:25:04 -0500 Subject: [PATCH 5/7] harden hierargy walk function --- .../Foundations/UI/Function-Libraries/UiObjectsFromNodes.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Projects/Foundations/UI/Function-Libraries/UiObjectsFromNodes.js b/Projects/Foundations/UI/Function-Libraries/UiObjectsFromNodes.js index ca704b123..23dea6628 100644 --- a/Projects/Foundations/UI/Function-Libraries/UiObjectsFromNodes.js +++ b/Projects/Foundations/UI/Function-Libraries/UiObjectsFromNodes.js @@ -354,7 +354,9 @@ function newFoundationsFunctionLibraryUiObjectsFromNodes() { case 'node': { if (node[property.name] !== undefined) { if (node[property.name].name === pathName && node[property.name].type === pathType) { - //console.log('this is a node property', node[property.name]) + nextNode = node[property.name] + console.log("we have a match!", nextNode) + return nextNode } } break From 1699ebd77f2d7c756218879cf56e2998b1d4878c Mon Sep 17 00:00:00 2001 From: Brenden Harrell Date: Fri, 30 Jul 2021 21:47:06 -0500 Subject: [PATCH 6/7] 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 } } From 158cc0a55aea4fffb9bb29b4b8a7f1965492caf5 Mon Sep 17 00:00:00 2001 From: Brenden Harrell Date: Fri, 30 Jul 2021 23:00:22 -0500 Subject: [PATCH 7/7] Code clean up --- .../Function-Libraries/UiObjectsFromNodes.js | 20 ++----------------- 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/Projects/Foundations/UI/Function-Libraries/UiObjectsFromNodes.js b/Projects/Foundations/UI/Function-Libraries/UiObjectsFromNodes.js index 72fa4b1c3..c9d079d0a 100644 --- a/Projects/Foundations/UI/Function-Libraries/UiObjectsFromNodes.js +++ b/Projects/Foundations/UI/Function-Libraries/UiObjectsFromNodes.js @@ -344,7 +344,7 @@ function newFoundationsFunctionLibraryUiObjectsFromNodes() { if (pathNode !== undefined ) { UI.projects.foundations.functionLibraries.attachDetach.referenceAttachNode(node, pathNode) } else { - console.log("[Warn] ", node.name, ' ', node.type, "failed to fix reference. Unable to find reference parent ", pathName, ' ', pathType ) + console.log("[WARN] ", node.name, ' ', node.type, "failed to fix reference. Unable to find reference parent ", pathName, ' ', pathType ) } function getNextNodeFromPath(node, pathName, pathType) { @@ -385,24 +385,8 @@ function newFoundationsFunctionLibraryUiObjectsFromNodes() { } } } - - // need to figure out how to check that this has failed to move to path implimentation - - - - function getMapNodeByCodeNameAndNodeType(codeName, nodeType) { - for (let i = 0; i < mapOfNodes.length; i++) { - let mapNode = mapOfNodes[i] - let mapNodeCodeName = UI.projects.foundations.utilities.nodeConfig.loadConfigProperty(mapNode.payload, 'codeName') - if (mapNodeCodeName === codeName && mapNode.type === nodeType) { - return mapNode - } - } - } - //console.log("this is the node", node, "saved path", path, "and map", mapOfNodes ) - if (node.payload.referenceParent === undefined) { - //console.log('[WARN]' + node.type + ' ' + node.name + ' reference parent lost during re-binding phase.') + console.log('[WARN]' + node.type + ' ' + node.name + ' reference parent lost during re-binding phase.') } }