Foundations: Bug Fixed getNextNodeFromPath Fails when the Node Schema can not be found.
This commit is contained in:
1 parent
9199a70e4b
commit
e227f3afe1
1 file changed
+18
-18
@@ -312,42 +312,41 @@ function newFoundationsFunctionLibraryUiObjectsFromNodes() {
|
||||
if (node.savedPayload.referenceParent !== undefined) { // these are children recreated
|
||||
// Reestablish based on Id
|
||||
node.payload.referenceParent = mapOfNodes.get(node.savedPayload.referenceParent.id)
|
||||
|
||||
|
||||
// if Reestablishment failed now reestablish reference based on saved path
|
||||
if (node.payload.referenceParent === undefined) {
|
||||
if (node.payload.referenceParent === undefined) {
|
||||
// Gather saved path
|
||||
let rawPath = node.savedPayload.referenceParentCombinedNodePath
|
||||
if (rawPath !== undefined) {
|
||||
// Step down node hierarchy to find missing referenceParent
|
||||
let pathNode
|
||||
let pathName
|
||||
let pathType
|
||||
for (let i = 0; i < rawPath.length; i++) {
|
||||
|
||||
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 )
|
||||
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
|
||||
}
|
||||
}
|
||||
// If Hierarchy Head is not located within the workspace abort reconnection
|
||||
if (pathNode === undefined) {
|
||||
console.log("[WARN] Abort reconnection saved path head node not found in current workspace", node)
|
||||
return
|
||||
}
|
||||
}
|
||||
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 ) {
|
||||
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 )
|
||||
@@ -355,7 +354,8 @@ function newFoundationsFunctionLibraryUiObjectsFromNodes() {
|
||||
|
||||
function getNextNodeFromPath(node, pathName, pathType) {
|
||||
console.log("pathNode", node)
|
||||
let schemaDocument = getSchemaDocument(node)
|
||||
let schemaDocument = getSchemaDocument(node)
|
||||
if (schemaDocument === undefined) { return }
|
||||
let nextNode = undefined
|
||||
for (let i = 0; i < schemaDocument.childrenNodesProperties.length; i++) {
|
||||
|
||||
@@ -368,7 +368,7 @@ function newFoundationsFunctionLibraryUiObjectsFromNodes() {
|
||||
nextNode = node[property.name]
|
||||
console.log("we have a match!", nextNode)
|
||||
return nextNode
|
||||
}
|
||||
}
|
||||
}
|
||||
break
|
||||
}
|
||||
@@ -378,7 +378,7 @@ function newFoundationsFunctionLibraryUiObjectsFromNodes() {
|
||||
let nodePropertyArray = node[property.name]
|
||||
for (let m = 0; m < nodePropertyArray.length; m++) {
|
||||
if (nodePropertyArray[m].name === pathName && nodePropertyArray[m].type === pathType) {
|
||||
|
||||
|
||||
nextNode = nodePropertyArray[m]
|
||||
return nextNode
|
||||
}
|
||||
@@ -387,13 +387,13 @@ function newFoundationsFunctionLibraryUiObjectsFromNodes() {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user