From 7d3210eb5728a91bc4a677fa4b2067d2e396b299 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sun, 13 Sep 2020 15:44:21 +0200 Subject: [PATCH] Update SessionFunctions.js --- .../FunctionLibraries/SessionFunctions.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/DesignSpace/Workspace/FunctionLibraries/SessionFunctions.js b/DesignSpace/Workspace/FunctionLibraries/SessionFunctions.js index c1f96d72f..a80f00fcb 100644 --- a/DesignSpace/Workspace/FunctionLibraries/SessionFunctions.js +++ b/DesignSpace/Workspace/FunctionLibraries/SessionFunctions.js @@ -7,12 +7,13 @@ function newSessionFunctions() { return thisObject function runSession(node, functionLibraryProtocolNode, functionLibraryDependenciesFilter, resume, callBackFunction) { - if (validations(node) !== true) { + let networkNode = validations(node) + if (networkNode === undefined) { + /* This means that the validations failed. */ callBackFunction(GLOBAL.DEFAULT_FAIL_RESPONSE) return } - let networkNode = node.payload.parentNode.payload.parentNode.payload.parentNode.payload.parentNode.payload.parentNode.payload.parentNode.payload.parentNode let eventsServerClient = canvas.designSpace.workspace.eventsServerClients.get(networkNode.id) node.payload.uiObject.run(eventsServerClient, callBackFunction) @@ -113,12 +114,13 @@ function newSessionFunctions() { } function stopSession(node, functionLibraryProtocolNode, callBackFunction) { - if (validations(node) !== true) { + let networkNode = validations(node) + if (networkNode === undefined) { + /* This means that the validations failed. */ callBackFunction(GLOBAL.DEFAULT_FAIL_RESPONSE) return } - - let networkNode = node.payload.parentNode.payload.parentNode.payload.parentNode.payload.parentNode.payload.parentNode.payload.parentNode.payload.parentNode + let eventsServerClient = canvas.designSpace.workspace.eventsServerClients.get(networkNode.id) let key = node.name + '-' + node.type + '-' + node.id @@ -175,6 +177,8 @@ function newSessionFunctions() { return } + let networkNode = taskManager.payload.parentNode.payload.parentNode.payload.parentNode.payload.parentNode.payload.parentNode + if (node.payload.parentNode.payload.uiObject.isRunning !== true) { node.payload.uiObject.setErrorMessage('Session needs a Process Instance parent to be running.') return @@ -199,6 +203,6 @@ function newSessionFunctions() { node.payload.uiObject.setErrorMessage('Trading Engine Reference needs to reference a Trading Engine.') return } - return true + return networkNode } }