From 4d6a24590780f78158baf968ec9db6d744c2635c Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Fri, 1 Nov 2019 13:46:54 +0100 Subject: [PATCH] Status Dependencies can be refenreced now --- .../ReferenceAttachDetach.js | 16 +++++++ .../FunctionLibraries/UiObjectsFromNodes.js | 46 ++++++++++++++++++- FloatingSpace/UiObject.js | 9 ++++ 3 files changed, 69 insertions(+), 2 deletions(-) diff --git a/DesignerSpace/Workspace/FunctionLibraries/ReferenceAttachDetach.js b/DesignerSpace/Workspace/FunctionLibraries/ReferenceAttachDetach.js index 204214d3a..3d970bfe9 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/ReferenceAttachDetach.js +++ b/DesignerSpace/Workspace/FunctionLibraries/ReferenceAttachDetach.js @@ -32,6 +32,14 @@ function newReferenceAttachDetach () { completeDetachment(node) return } + case 'Status Dependency': { + completeDetachment(node) + return + } + case 'Execution Started Event': { + completeDetachment(node) + return + } } } @@ -61,6 +69,14 @@ function newReferenceAttachDetach () { completeAttachment(node, attachToNode) } break + case 'Status Dependency': { + completeAttachment(node, attachToNode) + } + break + case 'Execution Started Event': { + completeAttachment(node, attachToNode) + } + break } } diff --git a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js index 92177f2f4..74e7fe291 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js +++ b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js @@ -775,11 +775,37 @@ function newUiObjectsFromNodes () { return } case 'Status Report': { + let referenceChildren + if (mapOfReferenceParents !== undefined) { + if (node.savedPayload.referenceChildren !== undefined) { + referenceChildren = [] + mapOfReferenceParents.set(node.id, node) + referenceChildren = node.savedPayload.referenceChildren + } + } createUiObject(node.type, node.name, node, parentNode, chainParent, node.type) + if (referenceChildren !== undefined) { + node.savedPayload = { + referenceChildren: referenceChildren + } + } return } case 'Execution Finished Event': { + let referenceChildren + if (mapOfReferenceParents !== undefined) { + if (node.savedPayload.referenceChildren !== undefined) { + referenceChildren = [] + mapOfReferenceParents.set(node.id, node) + referenceChildren = node.savedPayload.referenceChildren + } + } createUiObject(node.type, node.name, node, parentNode, chainParent, node.type) + if (referenceChildren !== undefined) { + node.savedPayload = { + referenceChildren: referenceChildren + } + } return } case 'Calculations Procedure': { @@ -835,7 +861,21 @@ function newUiObjectsFromNodes () { return } case 'Status Dependency': { + let referenceParent + if (mapOfReferenceChildren !== undefined) { + if (node.savedPayload.referenceParent !== undefined) { + if (node.savedPayload.referenceParent.id !== undefined) { + mapOfReferenceChildren.set(node.id, node) + referenceParent = node.savedPayload.referenceParent + } + } + } createUiObject(node.type, node.name, node, parentNode, chainParent, node.type) + if (referenceParent !== undefined) { + node.savedPayload = { + referenceParent: referenceParent + } + } return } case 'Data Dependency': { @@ -1023,7 +1063,8 @@ function newUiObjectsFromNodes () { if (node.statusReport === undefined) { node.statusReport = { type: 'Status Report', - name: 'New Status Report' + name: 'New Status Report', + referenceChildren: [] } createUiObject(node.statusReport.type, node.statusReport.name, node.statusReport, node, node) } @@ -1034,7 +1075,8 @@ function newUiObjectsFromNodes () { if (node.executionFinishedEvent === undefined) { node.executionFinishedEvent = { type: 'Execution Finished Event', - name: 'New Execution Finished Event' + name: 'New Execution Finished Event', + referenceChildren: [] } createUiObject(node.executionFinishedEvent.type, node.executionFinishedEvent.name, node.executionFinishedEvent, node, node) } diff --git a/FloatingSpace/UiObject.js b/FloatingSpace/UiObject.js index ce6474012..b4b136a09 100644 --- a/FloatingSpace/UiObject.js +++ b/FloatingSpace/UiObject.js @@ -512,6 +512,7 @@ function newUiObject () { if (compatibleType.indexOf('->' + nearbyNode.type + '->') >= 0) { /* Discard objects with busy coonection ports */ if (thisObject.payload.node.type === 'Status Report' && nearbyNode.statusReport !== undefined) { continue } + if (thisObject.payload.node.type === 'Execution Finished Event' && nearbyNode.executionStartedEvent !== undefined) { continue } if (thisObject.payload.node.type === 'Execution Finished Event' && nearbyNode.executionFinishedEvent !== undefined) { continue } if (thisObject.payload.node.type === 'Calculations Procedure' && nearbyNode.calculations !== undefined) { continue } if (thisObject.payload.node.type === 'Data Building Procedure' && nearbyNode.dataBuilding !== undefined) { continue } @@ -686,6 +687,14 @@ function newUiObject () { compatibleType = '->' + 'Dataset Definition' + '->' compatibleSubType = undefined break + case 'Status Dependency': + compatibleType = '->' + 'Status Report' + '->' + compatibleSubType = undefined + break + case 'Execution Started Event': + compatibleType = '->' + 'Execution Finished Event' + '->' + compatibleSubType = undefined + break default: return }