From 6cca8342ed70b02448f9ceb7149731b30af9c8f3 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Fri, 25 Oct 2019 12:51:15 +0200 Subject: [PATCH 01/95] Bug Fixed: Connection lost to Web Socket Server --- Canvas.js | 4 ++++ SystemEventHandler.js | 19 ++++++++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/Canvas.js b/Canvas.js index 9da5ed793..843b27b8d 100644 --- a/Canvas.js +++ b/Canvas.js @@ -118,13 +118,17 @@ function newCanvas () { animation.initialize() thisObject.animation = animation + /* Low Level Infraestructure First */ + animation.addCallBackFunction('System Event Handler Physics', systemEventHandler.physics) + /* Spcaces Physics */ animation.addCallBackFunction('Floating Space Physics', thisObject.floatingSpace.physics) animation.addCallBackFunction('Chart Space Physics', thisObject.chartSpace.physics) animation.addCallBackFunction('CockpitSpace Physics', thisObject.cockpitSpace.physics) animation.addCallBackFunction('Strategy Space Physics', thisObject.strategySpace.physics) animation.addCallBackFunction('Panels Space Physics', thisObject.panelsSpace.physics) + /* Spcaces Drawing */ animation.addCallBackFunction('Floating Space Draw', thisObject.floatingSpace.draw) animation.addCallBackFunction('Chart Space Background', thisObject.chartSpace.drawBackground) animation.addCallBackFunction('Chart Space Draw', thisObject.chartSpace.draw) diff --git a/SystemEventHandler.js b/SystemEventHandler.js index 740048d48..c41604552 100644 --- a/SystemEventHandler.js +++ b/SystemEventHandler.js @@ -4,6 +4,7 @@ function newSystemEventHandler () { const MODULE_NAME = 'System Event Handler' const ERROR_LOG = true + const INFO_LOG = true const logger = newWebDebugLog() logger.fileName = MODULE_NAME @@ -12,6 +13,7 @@ function newSystemEventHandler () { let thisObject = { initialize: initialize, + physics: physics, createEventHandler: createEventHandler, deleteEventHandler: deleteEventHandler, listenToEvent: listenToEvent, @@ -95,6 +97,15 @@ function newSystemEventHandler () { sendCommand(eventCommand, responseCallBack) } + function physics () { + if (WEB_SOCKETS_CONNECTION !== undefined) { + if (WEB_SOCKETS_CONNECTION.readyState === 3) { // Connection closed. May happen after computer goes to sleep. + setuptWebSockets() + if (INFO_LOG === true) { logger.write('[INFO] setuptWebSockets -> Found Web Sockets Connection Closed. Reconnected to WebSockets Server.') } + } + } + } + function setuptWebSockets (callBackFunction) { try { WEB_SOCKETS_CONNECTION = new WebSocket(WEB_SOCKETS_URL) @@ -105,7 +116,13 @@ function newSystemEventHandler () { console.log('WebSocket error:' + JSON.stringify(error)) } WEB_SOCKETS_CONNECTION.onopen = () => { - callBackFunction() + if (callBackFunction !== undefined) { + callBackFunction() + } + } + WEB_SOCKETS_CONNECTION.onclose = () => { + setTimeout(setuptWebSockets, 1000) + if (INFO_LOG === true) { logger.write('[INFO] setuptWebSockets -> Web Sockets Connection was Closed. Reconnected to WebSockets Server. ') } } WEB_SOCKETS_CONNECTION.onmessage = e => { // console.log('Websoked Message Received: ' + e.data) From e349604e3b25375f471e632712cb04995afc69a9 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Fri, 25 Oct 2019 16:22:12 +0200 Subject: [PATCH 02/95] Web socket connection on suspend fixed --- SystemEventHandler.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/SystemEventHandler.js b/SystemEventHandler.js index c41604552..07618cbf8 100644 --- a/SystemEventHandler.js +++ b/SystemEventHandler.js @@ -100,8 +100,10 @@ function newSystemEventHandler () { function physics () { if (WEB_SOCKETS_CONNECTION !== undefined) { if (WEB_SOCKETS_CONNECTION.readyState === 3) { // Connection closed. May happen after computer goes to sleep. - setuptWebSockets() - if (INFO_LOG === true) { logger.write('[INFO] setuptWebSockets -> Found Web Sockets Connection Closed. Reconnected to WebSockets Server.') } + setuptWebSockets(onOpen) + function onOpen () { + if (INFO_LOG === true) { logger.write('[INFO] setuptWebSockets -> Found Web Sockets Connection Closed. Reconnected to WebSockets Server.') } + } } } } @@ -120,10 +122,6 @@ function newSystemEventHandler () { callBackFunction() } } - WEB_SOCKETS_CONNECTION.onclose = () => { - setTimeout(setuptWebSockets, 1000) - if (INFO_LOG === true) { logger.write('[INFO] setuptWebSockets -> Web Sockets Connection was Closed. Reconnected to WebSockets Server. ') } - } WEB_SOCKETS_CONNECTION.onmessage = e => { // console.log('Websoked Message Received: ' + e.data) From d99f6994ed3e6fe0cb950cdbe3bdc5dc3acef227 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sat, 26 Oct 2019 18:33:35 +0200 Subject: [PATCH 03/95] UiOBject refactoring --- .../{StrategyPartConstructor.js => UiObjectConstructor.js} | 2 +- Spaces/FloatingSpace.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename FloatingSpace/{StrategyPartConstructor.js => UiObjectConstructor.js} (99%) diff --git a/FloatingSpace/StrategyPartConstructor.js b/FloatingSpace/UiObjectConstructor.js similarity index 99% rename from FloatingSpace/StrategyPartConstructor.js rename to FloatingSpace/UiObjectConstructor.js index a47d7728f..d7827bbc7 100644 --- a/FloatingSpace/StrategyPartConstructor.js +++ b/FloatingSpace/UiObjectConstructor.js @@ -1,5 +1,5 @@ -function newStrategyPartConstructor () { +function uiObjectConstructor () { const MODULE_NAME = 'Strategy Part Constructor' const ERROR_LOG = true const logger = newWebDebugLog() diff --git a/Spaces/FloatingSpace.js b/Spaces/FloatingSpace.js index 348c8307a..45db70beb 100644 --- a/Spaces/FloatingSpace.js +++ b/Spaces/FloatingSpace.js @@ -67,7 +67,7 @@ function newFloatingSpace () { thisObject.noteSets = newNoteSets() thisObject.noteSets.initialize(thisObject.floatingLayer) - thisObject.strategyPartConstructor = newStrategyPartConstructor() + thisObject.strategyPartConstructor = uiObjectConstructor() thisObject.strategyPartConstructor.initialize(thisObject.floatingLayer) thisObject.container.eventHandler.listenToEvent('onMouseWheel', onMouseWheel) From f1d0a9b14767b0bbf8f82544dac6f979ba4fbd16 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sat, 26 Oct 2019 18:38:15 +0200 Subject: [PATCH 04/95] UiObject Refactoring part 2 --- FloatingSpace/FloatingLayer.js | 4 ++-- FloatingSpace/{StrategyPart.js => UiObject.js} | 4 ++-- FloatingSpace/UiObjectConstructor.js | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) rename FloatingSpace/{StrategyPart.js => UiObject.js} (99%) diff --git a/FloatingSpace/FloatingLayer.js b/FloatingSpace/FloatingLayer.js index 22c78cd52..57249bcac 100644 --- a/FloatingSpace/FloatingLayer.js +++ b/FloatingSpace/FloatingLayer.js @@ -293,7 +293,7 @@ function newFloatingLayer () { break } - case 'Strategy Part': { + case 'UI Object': { payload.targetPosition = floatingObject.payload.targetPosition payload.visible = floatingObject.payload.visible break @@ -563,7 +563,7 @@ function newFloatingLayer () { payload.targetPosition = floatingObject2.payload.notes[floatingObject2.payloadNoteIndex].position break } - case 'Strategy Part': { + case 'UI Object': { payload.targetPosition = floatingObject2.payload.targetPosition break } diff --git a/FloatingSpace/StrategyPart.js b/FloatingSpace/UiObject.js similarity index 99% rename from FloatingSpace/StrategyPart.js rename to FloatingSpace/UiObject.js index 295a5e5eb..974026bc0 100644 --- a/FloatingSpace/StrategyPart.js +++ b/FloatingSpace/UiObject.js @@ -1,6 +1,6 @@ -function newStrategyPart () { - const MODULE_NAME = 'Strategy Part' +function newUiObject () { + const MODULE_NAME = 'UI Object' const ERROR_LOG = true const logger = newWebDebugLog() diff --git a/FloatingSpace/UiObjectConstructor.js b/FloatingSpace/UiObjectConstructor.js index d7827bbc7..35d640580 100644 --- a/FloatingSpace/UiObjectConstructor.js +++ b/FloatingSpace/UiObjectConstructor.js @@ -1,6 +1,6 @@ function uiObjectConstructor () { - const MODULE_NAME = 'Strategy Part Constructor' + const MODULE_NAME = 'UI Object Constructor' const ERROR_LOG = true const logger = newWebDebugLog() logger.fileName = MODULE_NAME @@ -31,7 +31,7 @@ function uiObjectConstructor () { let floatingObject = newFloatingObject() floatingObject.fitFunction = canvas.floatingSpace.fitIntoVisibleArea floatingObject.container.connectToParent(canvas.floatingSpace.container, false, false, false, false, false, false, false, false) - floatingObject.initialize('Strategy Part', payload) + floatingObject.initialize('UI Object', payload) payload.floatingObject = floatingObject if (payload.node.savedPayload !== undefined) { @@ -59,7 +59,7 @@ function uiObjectConstructor () { } } - let strategyPart = newStrategyPart() + let strategyPart = newUiObject() payload.uiObject = strategyPart strategyPart.fitFunction = canvas.floatingSpace.fitIntoVisibleArea strategyPart.isVisibleFunction = canvas.floatingSpace.isThisPointVisible From d2c0ec98dea9d4cd41bcbf9d3b296886cbf8c189 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sat, 26 Oct 2019 18:42:45 +0200 Subject: [PATCH 05/95] uiObject Refactoring part 3 --- FloatingSpace/UiObjectConstructor.js | 210 +++++++++--------- Spaces/FloatingSpace.js | 9 +- .../FunctionLibraries/NodeDeleter.js | 2 +- .../FunctionLibraries/PartsFromNodes.js | 2 +- 4 files changed, 111 insertions(+), 112 deletions(-) diff --git a/FloatingSpace/UiObjectConstructor.js b/FloatingSpace/UiObjectConstructor.js index 35d640580..b178415eb 100644 --- a/FloatingSpace/UiObjectConstructor.js +++ b/FloatingSpace/UiObjectConstructor.js @@ -1,5 +1,5 @@ -function uiObjectConstructor () { +function newUiObjectConstructor () { const MODULE_NAME = 'UI Object Constructor' const ERROR_LOG = true const logger = newWebDebugLog() @@ -59,13 +59,13 @@ function uiObjectConstructor () { } } - let strategyPart = newUiObject() - payload.uiObject = strategyPart - strategyPart.fitFunction = canvas.floatingSpace.fitIntoVisibleArea - strategyPart.isVisibleFunction = canvas.floatingSpace.isThisPointVisible - let menuItemsInitialValues = getMenuItemsInitialValues(strategyPart, floatingObject, payload) - strategyPart.initialize(payload, menuItemsInitialValues) - strategyPart.container.connectToParent(floatingObject.container, false, false, true, true, false, false, true, true, true, true, true) + let uiObject = newUiObject() + payload.uiObject = uiObject + uiObject.fitFunction = canvas.floatingSpace.fitIntoVisibleArea + uiObject.isVisibleFunction = canvas.floatingSpace.isThisPointVisible + let menuItemsInitialValues = getMenuItemsInitialValues(uiObject, floatingObject, payload) + uiObject.initialize(payload, menuItemsInitialValues) + uiObject.container.connectToParent(floatingObject.container, false, false, true, true, false, false, true, true, true, true, true) setFloatingObjectBasicProperties(floatingObject, payload) @@ -162,7 +162,7 @@ function uiObjectConstructor () { ) } - function getMenuItemsInitialValues (strategyPart, floatingObject, payload) { + function getMenuItemsInitialValues (uiObject, floatingObject, payload) { let menuItemsInitialValues = [] switch (payload.node.type) { case 'Workspace': { @@ -437,10 +437,10 @@ function uiObjectConstructor () { break } case 'Telegram Bot': { - strategyPart.codeEditor = newCodeEditor() - strategyPart.codeEditor.isVisibleFunction = strategyPart.isVisibleFunction - strategyPart.codeEditor.initialize() - strategyPart.codeEditor.container.connectToParent(strategyPart.container, false, false, true, true, false, false, false, false) + uiObject.codeEditor = newCodeEditor() + uiObject.codeEditor.isVisibleFunction = uiObject.isVisibleFunction + uiObject.codeEditor.initialize() + uiObject.codeEditor.container.connectToParent(uiObject.container, false, false, true, true, false, false, false, false) addLeftIcons(menuItemsInitialValues, floatingObject) menuItemsInitialValues.push( { @@ -458,7 +458,7 @@ function uiObjectConstructor () { menuItemsInitialValues.push( { action: 'Edit Telegram Bot', - actionFunction: strategyPart.codeEditor.activate, + actionFunction: uiObject.codeEditor.activate, label: 'Edit Telegram Bot', visible: true, iconPathOn: 'html', @@ -503,10 +503,10 @@ function uiObjectConstructor () { break } case 'Announcement': { - strategyPart.codeEditor = newCodeEditor() - strategyPart.codeEditor.isVisibleFunction = strategyPart.isVisibleFunction - strategyPart.codeEditor.initialize() - strategyPart.codeEditor.container.connectToParent(strategyPart.container, false, false, true, true, false, false, false, false) + uiObject.codeEditor = newCodeEditor() + uiObject.codeEditor.isVisibleFunction = uiObject.isVisibleFunction + uiObject.codeEditor.initialize() + uiObject.codeEditor.container.connectToParent(uiObject.container, false, false, true, true, false, false, false, false) addLeftIcons(menuItemsInitialValues, floatingObject) menuItemsInitialValues.push( { @@ -525,7 +525,7 @@ function uiObjectConstructor () { menuItemsInitialValues.push( { action: 'Edit Announcement', - actionFunction: strategyPart.codeEditor.activate, + actionFunction: uiObject.codeEditor.activate, label: 'Edit Announcement', visible: true, iconPathOn: 'html', @@ -617,15 +617,15 @@ function uiObjectConstructor () { break } case 'Layer': { - strategyPart.codeEditor = newCodeEditor() - strategyPart.codeEditor.isVisibleFunction = strategyPart.isVisibleFunction - strategyPart.codeEditor.initialize() - strategyPart.codeEditor.container.connectToParent(strategyPart.container, false, false, true, true, false, false, false, false) + uiObject.codeEditor = newCodeEditor() + uiObject.codeEditor.isVisibleFunction = uiObject.isVisibleFunction + uiObject.codeEditor.initialize() + uiObject.codeEditor.container.connectToParent(uiObject.container, false, false, true, true, false, false, false, false) addLeftIcons(menuItemsInitialValues, floatingObject) menuItemsInitialValues.push( { action: 'Edit Layer', - actionFunction: strategyPart.codeEditor.activate, + actionFunction: uiObject.codeEditor.activate, label: 'Edit Layer', visible: true, iconPathOn: 'html', @@ -841,10 +841,10 @@ function uiObjectConstructor () { break } case 'Sensor': { - strategyPart.codeEditor = newCodeEditor() - strategyPart.codeEditor.isVisibleFunction = strategyPart.isVisibleFunction - strategyPart.codeEditor.initialize() - strategyPart.codeEditor.container.connectToParent(strategyPart.container, false, false, true, true, false, false, false, false) + uiObject.codeEditor = newCodeEditor() + uiObject.codeEditor.isVisibleFunction = uiObject.isVisibleFunction + uiObject.codeEditor.initialize() + uiObject.codeEditor.container.connectToParent(uiObject.container, false, false, true, true, false, false, false, false) addLeftIcons(menuItemsInitialValues, floatingObject) menuItemsInitialValues.push( @@ -863,7 +863,7 @@ function uiObjectConstructor () { menuItemsInitialValues.push( { action: 'Edit Sensor', - actionFunction: strategyPart.codeEditor.activate, + actionFunction: uiObject.codeEditor.activate, label: 'Edit Sensor', visible: true, iconPathOn: 'html', @@ -908,10 +908,10 @@ function uiObjectConstructor () { break } case 'Indicator': { - strategyPart.codeEditor = newCodeEditor() - strategyPart.codeEditor.isVisibleFunction = strategyPart.isVisibleFunction - strategyPart.codeEditor.initialize() - strategyPart.codeEditor.container.connectToParent(strategyPart.container, false, false, true, true, false, false, false, false) + uiObject.codeEditor = newCodeEditor() + uiObject.codeEditor.isVisibleFunction = uiObject.isVisibleFunction + uiObject.codeEditor.initialize() + uiObject.codeEditor.container.connectToParent(uiObject.container, false, false, true, true, false, false, false, false) addLeftIcons(menuItemsInitialValues, floatingObject) menuItemsInitialValues.push( @@ -930,7 +930,7 @@ function uiObjectConstructor () { menuItemsInitialValues.push( { action: 'Edit Indicator', - actionFunction: strategyPart.codeEditor.activate, + actionFunction: uiObject.codeEditor.activate, label: 'Edit Indicator', visible: true, iconPathOn: 'html', @@ -975,10 +975,10 @@ function uiObjectConstructor () { break } case 'Trading Engine': { - strategyPart.codeEditor = newCodeEditor() - strategyPart.codeEditor.isVisibleFunction = strategyPart.isVisibleFunction - strategyPart.codeEditor.initialize() - strategyPart.codeEditor.container.connectToParent(strategyPart.container, false, false, true, true, false, false, false, false) + uiObject.codeEditor = newCodeEditor() + uiObject.codeEditor.isVisibleFunction = uiObject.isVisibleFunction + uiObject.codeEditor.initialize() + uiObject.codeEditor.container.connectToParent(uiObject.container, false, false, true, true, false, false, false, false) addLeftIcons(menuItemsInitialValues, floatingObject) menuItemsInitialValues.push( @@ -997,7 +997,7 @@ function uiObjectConstructor () { menuItemsInitialValues.push( { action: 'Edit Trading Engine', - actionFunction: strategyPart.codeEditor.activate, + actionFunction: uiObject.codeEditor.activate, label: 'Edit Trading Engine', visible: true, iconPathOn: 'html', @@ -1042,10 +1042,10 @@ function uiObjectConstructor () { break } case 'Process': { - strategyPart.codeEditor = newCodeEditor() - strategyPart.codeEditor.isVisibleFunction = strategyPart.isVisibleFunction - strategyPart.codeEditor.initialize() - strategyPart.codeEditor.container.connectToParent(strategyPart.container, false, false, true, true, false, false, false, false) + uiObject.codeEditor = newCodeEditor() + uiObject.codeEditor.isVisibleFunction = uiObject.isVisibleFunction + uiObject.codeEditor.initialize() + uiObject.codeEditor.container.connectToParent(uiObject.container, false, false, true, true, false, false, false, false) addLeftIcons(menuItemsInitialValues, floatingObject) @@ -1106,7 +1106,7 @@ function uiObjectConstructor () { menuItemsInitialValues.push( { action: 'Edit Process', - actionFunction: strategyPart.codeEditor.activate, + actionFunction: uiObject.codeEditor.activate, label: 'Edit Process', visible: true, iconPathOn: 'html', @@ -1154,7 +1154,7 @@ function uiObjectConstructor () { menuItemsInitialValues.push( { action: 'Edit Process', - actionFunction: strategyPart.codeEditor.activate, + actionFunction: uiObject.codeEditor.activate, label: 'Edit Process', visible: true, iconPathOn: 'html', @@ -1202,10 +1202,10 @@ function uiObjectConstructor () { break } case 'Backtesting Session': { - strategyPart.codeEditor = newCodeEditor() - strategyPart.codeEditor.isVisibleFunction = strategyPart.isVisibleFunction - strategyPart.codeEditor.initialize() - strategyPart.codeEditor.container.connectToParent(strategyPart.container, false, false, true, true, false, false, false, false) + uiObject.codeEditor = newCodeEditor() + uiObject.codeEditor.isVisibleFunction = uiObject.isVisibleFunction + uiObject.codeEditor.initialize() + uiObject.codeEditor.container.connectToParent(uiObject.container, false, false, true, true, false, false, false, false) addLeftIcons(menuItemsInitialValues, floatingObject) menuItemsInitialValues.push( @@ -1273,7 +1273,7 @@ function uiObjectConstructor () { menuItemsInitialValues.push( { action: 'Edit Session', - actionFunction: strategyPart.codeEditor.activate, + actionFunction: uiObject.codeEditor.activate, label: 'Edit Session', visible: true, iconPathOn: 'html', @@ -1318,10 +1318,10 @@ function uiObjectConstructor () { break } case 'Live Trading Session': { - strategyPart.codeEditor = newCodeEditor() - strategyPart.codeEditor.isVisibleFunction = strategyPart.isVisibleFunction - strategyPart.codeEditor.initialize() - strategyPart.codeEditor.container.connectToParent(strategyPart.container, false, false, true, true, false, false, false, false) + uiObject.codeEditor = newCodeEditor() + uiObject.codeEditor.isVisibleFunction = uiObject.isVisibleFunction + uiObject.codeEditor.initialize() + uiObject.codeEditor.container.connectToParent(uiObject.container, false, false, true, true, false, false, false, false) addLeftIcons(menuItemsInitialValues, floatingObject) menuItemsInitialValues.push( @@ -1389,7 +1389,7 @@ function uiObjectConstructor () { menuItemsInitialValues.push( { action: 'Edit Session', - actionFunction: strategyPart.codeEditor.activate, + actionFunction: uiObject.codeEditor.activate, label: 'Edit Session', visible: true, iconPathOn: 'html', @@ -1434,10 +1434,10 @@ function uiObjectConstructor () { break } case 'Fordward Testing Session': { - strategyPart.codeEditor = newCodeEditor() - strategyPart.codeEditor.isVisibleFunction = strategyPart.isVisibleFunction - strategyPart.codeEditor.initialize() - strategyPart.codeEditor.container.connectToParent(strategyPart.container, false, false, true, true, false, false, false, false) + uiObject.codeEditor = newCodeEditor() + uiObject.codeEditor.isVisibleFunction = uiObject.isVisibleFunction + uiObject.codeEditor.initialize() + uiObject.codeEditor.container.connectToParent(uiObject.container, false, false, true, true, false, false, false, false) addLeftIcons(menuItemsInitialValues, floatingObject) menuItemsInitialValues.push( @@ -1505,7 +1505,7 @@ function uiObjectConstructor () { menuItemsInitialValues.push( { action: 'Edit Session', - actionFunction: strategyPart.codeEditor.activate, + actionFunction: uiObject.codeEditor.activate, label: 'Edit Session', visible: true, iconPathOn: 'html', @@ -1550,10 +1550,10 @@ function uiObjectConstructor () { break } case 'Paper Trading Session': { - strategyPart.codeEditor = newCodeEditor() - strategyPart.codeEditor.isVisibleFunction = strategyPart.isVisibleFunction - strategyPart.codeEditor.initialize() - strategyPart.codeEditor.container.connectToParent(strategyPart.container, false, false, true, true, false, false, false, false) + uiObject.codeEditor = newCodeEditor() + uiObject.codeEditor.isVisibleFunction = uiObject.isVisibleFunction + uiObject.codeEditor.initialize() + uiObject.codeEditor.container.connectToParent(uiObject.container, false, false, true, true, false, false, false, false) addLeftIcons(menuItemsInitialValues, floatingObject) menuItemsInitialValues.push( @@ -1621,7 +1621,7 @@ function uiObjectConstructor () { menuItemsInitialValues.push( { action: 'Edit Session', - actionFunction: strategyPart.codeEditor.activate, + actionFunction: uiObject.codeEditor.activate, label: 'Edit Session', visible: true, iconPathOn: 'html', @@ -1765,16 +1765,16 @@ function uiObjectConstructor () { break } case 'Exchange Account Key': { - strategyPart.codeEditor = newCodeEditor() - strategyPart.codeEditor.isVisibleFunction = strategyPart.isVisibleFunction - strategyPart.codeEditor.initialize() - strategyPart.codeEditor.container.connectToParent(strategyPart.container, false, false, true, true, false, false, false, false) + uiObject.codeEditor = newCodeEditor() + uiObject.codeEditor.isVisibleFunction = uiObject.isVisibleFunction + uiObject.codeEditor.initialize() + uiObject.codeEditor.container.connectToParent(uiObject.container, false, false, true, true, false, false, false, false) addLeftIcons(menuItemsInitialValues, floatingObject) menuItemsInitialValues.push( { action: 'Edit Key Value', - actionFunction: strategyPart.codeEditor.activate, + actionFunction: uiObject.codeEditor.activate, label: 'Edit Key Value', visible: true, iconPathOn: 'html', @@ -1912,16 +1912,16 @@ function uiObjectConstructor () { break } case 'Base Asset': { - strategyPart.codeEditor = newCodeEditor() - strategyPart.codeEditor.isVisibleFunction = strategyPart.isVisibleFunction - strategyPart.codeEditor.initialize() - strategyPart.codeEditor.container.connectToParent(strategyPart.container, false, false, true, true, false, false, false, false) + uiObject.codeEditor = newCodeEditor() + uiObject.codeEditor.isVisibleFunction = uiObject.isVisibleFunction + uiObject.codeEditor.initialize() + uiObject.codeEditor.container.connectToParent(uiObject.container, false, false, true, true, false, false, false, false) addLeftIcons(menuItemsInitialValues, floatingObject) menuItemsInitialValues.push( { action: 'Edit Base Asset', - actionFunction: strategyPart.codeEditor.activate, + actionFunction: uiObject.codeEditor.activate, label: 'Edit Base Asset', visible: true, iconPathOn: 'settings', @@ -1965,16 +1965,16 @@ function uiObjectConstructor () { break } case 'Time Range': { - strategyPart.codeEditor = newCodeEditor() - strategyPart.codeEditor.isVisibleFunction = strategyPart.isVisibleFunction - strategyPart.codeEditor.initialize() - strategyPart.codeEditor.container.connectToParent(strategyPart.container, false, false, true, true, false, false, false, false) + uiObject.codeEditor = newCodeEditor() + uiObject.codeEditor.isVisibleFunction = uiObject.isVisibleFunction + uiObject.codeEditor.initialize() + uiObject.codeEditor.container.connectToParent(uiObject.container, false, false, true, true, false, false, false, false) addLeftIcons(menuItemsInitialValues, floatingObject) menuItemsInitialValues.push( { action: 'Edit Time Range', - actionFunction: strategyPart.codeEditor.activate, + actionFunction: uiObject.codeEditor.activate, label: 'Edit Time Range', visible: true, iconPathOn: 'settings', @@ -2018,16 +2018,16 @@ function uiObjectConstructor () { break } case 'Time Period': { - strategyPart.codeEditor = newCodeEditor() - strategyPart.codeEditor.isVisibleFunction = strategyPart.isVisibleFunction - strategyPart.codeEditor.initialize() - strategyPart.codeEditor.container.connectToParent(strategyPart.container, false, false, true, true, false, false, false, false) + uiObject.codeEditor = newCodeEditor() + uiObject.codeEditor.isVisibleFunction = uiObject.isVisibleFunction + uiObject.codeEditor.initialize() + uiObject.codeEditor.container.connectToParent(uiObject.container, false, false, true, true, false, false, false, false) addLeftIcons(menuItemsInitialValues, floatingObject) menuItemsInitialValues.push( { action: 'Edit Time Period', - actionFunction: strategyPart.codeEditor.activate, + actionFunction: uiObject.codeEditor.activate, label: 'Edit Time Period', visible: true, iconPathOn: 'settings', @@ -2071,16 +2071,16 @@ function uiObjectConstructor () { break } case 'Slippage': { - strategyPart.codeEditor = newCodeEditor() - strategyPart.codeEditor.isVisibleFunction = strategyPart.isVisibleFunction - strategyPart.codeEditor.initialize() - strategyPart.codeEditor.container.connectToParent(strategyPart.container, false, false, true, true, false, false, false, false) + uiObject.codeEditor = newCodeEditor() + uiObject.codeEditor.isVisibleFunction = uiObject.isVisibleFunction + uiObject.codeEditor.initialize() + uiObject.codeEditor.container.connectToParent(uiObject.container, false, false, true, true, false, false, false, false) addLeftIcons(menuItemsInitialValues, floatingObject) menuItemsInitialValues.push( { action: 'Edit Slippage', - actionFunction: strategyPart.codeEditor.activate, + actionFunction: uiObject.codeEditor.activate, label: 'Edit Slippage', visible: true, iconPathOn: 'settings', @@ -2124,16 +2124,16 @@ function uiObjectConstructor () { break } case 'Fee Structure': { - strategyPart.codeEditor = newCodeEditor() - strategyPart.codeEditor.isVisibleFunction = strategyPart.isVisibleFunction - strategyPart.codeEditor.initialize() - strategyPart.codeEditor.container.connectToParent(strategyPart.container, false, false, true, true, false, false, false, false) + uiObject.codeEditor = newCodeEditor() + uiObject.codeEditor.isVisibleFunction = uiObject.isVisibleFunction + uiObject.codeEditor.initialize() + uiObject.codeEditor.container.connectToParent(uiObject.container, false, false, true, true, false, false, false, false) addLeftIcons(menuItemsInitialValues, floatingObject) menuItemsInitialValues.push( { action: 'Edit Fee Structure', - actionFunction: strategyPart.codeEditor.activate, + actionFunction: uiObject.codeEditor.activate, label: 'Edit Fee Structure', visible: true, iconPathOn: 'settings', @@ -2929,16 +2929,16 @@ function uiObjectConstructor () { break } case 'Formula': { - strategyPart.codeEditor = newCodeEditor() - strategyPart.codeEditor.isVisibleFunction = strategyPart.isVisibleFunction - strategyPart.codeEditor.initialize() - strategyPart.codeEditor.container.connectToParent(strategyPart.container, false, false, true, true, false, false, false, false) + uiObject.codeEditor = newCodeEditor() + uiObject.codeEditor.isVisibleFunction = uiObject.isVisibleFunction + uiObject.codeEditor.initialize() + uiObject.codeEditor.container.connectToParent(uiObject.container, false, false, true, true, false, false, false, false) addLeftIcons(menuItemsInitialValues, floatingObject) menuItemsInitialValues.push( { action: 'Edit Formula', - actionFunction: strategyPart.codeEditor.activate, + actionFunction: uiObject.codeEditor.activate, label: 'Edit Formula', visible: true, iconPathOn: 'html', @@ -3124,16 +3124,16 @@ function uiObjectConstructor () { break } case 'Code': { - strategyPart.codeEditor = newCodeEditor() - strategyPart.codeEditor.isVisibleFunction = strategyPart.isVisibleFunction - strategyPart.codeEditor.initialize() - strategyPart.codeEditor.container.connectToParent(strategyPart.container, false, false, true, true, false, false, false, false) + uiObject.codeEditor = newCodeEditor() + uiObject.codeEditor.isVisibleFunction = uiObject.isVisibleFunction + uiObject.codeEditor.initialize() + uiObject.codeEditor.container.connectToParent(uiObject.container, false, false, true, true, false, false, false, false) addLeftIcons(menuItemsInitialValues, floatingObject) menuItemsInitialValues.push( { action: 'Edit Code', - actionFunction: strategyPart.codeEditor.activate, + actionFunction: uiObject.codeEditor.activate, label: 'Edit Code', visible: true, iconPathOn: 'html', diff --git a/Spaces/FloatingSpace.js b/Spaces/FloatingSpace.js index 45db70beb..84801bd3c 100644 --- a/Spaces/FloatingSpace.js +++ b/Spaces/FloatingSpace.js @@ -10,7 +10,7 @@ function newFloatingSpace () { let thisObject = { floatingLayer: undefined, // This is the array of floatingObjects being displayed profileBalls: undefined, - strategyPartConstructor: undefined, + uiObjectConstructor: undefined, noteSets: undefined, container: undefined, oneScreenUp: oneScreenUp, @@ -53,7 +53,7 @@ function newFloatingSpace () { function finalize () { thisObject.floatingLayer.finalize() thisObject.profileBalls.finalize() - thisObject.strategyPartConstructor.finalize() + thisObject.uiObjectConstructor.finalize() thisObject.noteSets.finalize() } @@ -67,8 +67,8 @@ function newFloatingSpace () { thisObject.noteSets = newNoteSets() thisObject.noteSets.initialize(thisObject.floatingLayer) - thisObject.strategyPartConstructor = uiObjectConstructor() - thisObject.strategyPartConstructor.initialize(thisObject.floatingLayer) + thisObject.uiObjectConstructor = newUiObjectConstructor() + thisObject.uiObjectConstructor.initialize(thisObject.floatingLayer) thisObject.container.eventHandler.listenToEvent('onMouseWheel', onMouseWheel) } @@ -223,4 +223,3 @@ function newFloatingSpace () { browserCanvasContext.fill() } } - diff --git a/StrategySpace/Workspace/FunctionLibraries/NodeDeleter.js b/StrategySpace/Workspace/FunctionLibraries/NodeDeleter.js index 66597b412..9a207b396 100644 --- a/StrategySpace/Workspace/FunctionLibraries/NodeDeleter.js +++ b/StrategySpace/Workspace/FunctionLibraries/NodeDeleter.js @@ -52,7 +52,7 @@ function newNodeDeleter () { return thisObject function destroyPart (node) { - canvas.floatingSpace.strategyPartConstructor.destroyStrategyPart(node.payload) + canvas.floatingSpace.uiObjectConstructor.destroyStrategyPart(node.payload) } function deleteWorkspace (node, rootNodes) { diff --git a/StrategySpace/Workspace/FunctionLibraries/PartsFromNodes.js b/StrategySpace/Workspace/FunctionLibraries/PartsFromNodes.js index 3498dddc0..699f1d8c0 100644 --- a/StrategySpace/Workspace/FunctionLibraries/PartsFromNodes.js +++ b/StrategySpace/Workspace/FunctionLibraries/PartsFromNodes.js @@ -1298,6 +1298,6 @@ function newPartsFromNodes () { } node.payload = payload node.type = partType - canvas.floatingSpace.strategyPartConstructor.createStrategyPart(payload) + canvas.floatingSpace.uiObjectConstructor.createStrategyPart(payload) } } From ad8756687672b11dea28ebe39048942e428707ba Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sat, 26 Oct 2019 18:46:38 +0200 Subject: [PATCH 06/95] uiObject refactoring part 4 --- FloatingSpace/CircularMenu.js | 2 +- FloatingSpace/CircularMenuItem.js | 8 +- FloatingSpace/StrategyPartTitle.js | 2 +- FloatingSpace/UiObject.js | 2 +- FloatingSpace/UiObjectConstructor.js | 124 +++++++++--------- .../FunctionLibraries/NodeDeleter.js | 2 +- .../FunctionLibraries/PartsFromNodes.js | 2 +- 7 files changed, 71 insertions(+), 71 deletions(-) diff --git a/FloatingSpace/CircularMenu.js b/FloatingSpace/CircularMenu.js index 4b4676921..c8ef434f8 100644 --- a/FloatingSpace/CircularMenu.js +++ b/FloatingSpace/CircularMenu.js @@ -72,7 +72,7 @@ function newCircularMenu () { menuItem.currentRadius = menuItemInitialValue.currentRadius menuItem.angle = menuItemInitialValue.angle menuItem.currentStatus = menuItemInitialValue.currentStatus - menuItem.relatedStrategyPart = menuItemInitialValue.relatedStrategyPart + menuItem.relatedUiObject = menuItemInitialValue.relatedUiObject menuItem.dontShowAtFullscreen = menuItemInitialValue.dontShowAtFullscreen menuItem.askConfirmation = menuItemInitialValue.askConfirmation menuItem.confirmationLabel = menuItemInitialValue.confirmationLabel diff --git a/FloatingSpace/CircularMenuItem.js b/FloatingSpace/CircularMenuItem.js index 38bd97bd6..e59933ea6 100644 --- a/FloatingSpace/CircularMenuItem.js +++ b/FloatingSpace/CircularMenuItem.js @@ -33,7 +33,7 @@ function newCircularMenuItem () { angle: undefined, container: undefined, payload: undefined, - relatedStrategyPart: undefined, + relatedUiObject: undefined, dontShowAtFullscreen: undefined, internalClick: internalClick, physics: physics, @@ -170,9 +170,9 @@ function newCircularMenuItem () { thisObject.iconOn = canvas.strategySpace.iconCollection.get(thisObject.secondaryIcon) thisObject.iconOff = canvas.strategySpace.iconCollection.get(thisObject.secondaryIcon) } else { - if (thisObject.relatedStrategyPart !== undefined) { - thisObject.iconOn = canvas.strategySpace.iconByPartType.get(thisObject.relatedStrategyPart) - thisObject.iconOff = canvas.strategySpace.iconByPartType.get(thisObject.relatedStrategyPart) + if (thisObject.relatedUiObject !== undefined) { + thisObject.iconOn = canvas.strategySpace.iconByPartType.get(thisObject.relatedUiObject) + thisObject.iconOff = canvas.strategySpace.iconByPartType.get(thisObject.relatedUiObject) } else { thisObject.iconOn = canvas.strategySpace.iconCollection.get(thisObject.iconPathOn) thisObject.iconOff = canvas.strategySpace.iconCollection.get(thisObject.iconPathOff) diff --git a/FloatingSpace/StrategyPartTitle.js b/FloatingSpace/StrategyPartTitle.js index c397723a3..b2d784818 100644 --- a/FloatingSpace/StrategyPartTitle.js +++ b/FloatingSpace/StrategyPartTitle.js @@ -1,5 +1,5 @@ -function newStrategyPartTitle () { +function newUiObjectTitle () { const MODULE_NAME = 'Strategy Part Title' const ERROR_LOG = true diff --git a/FloatingSpace/UiObject.js b/FloatingSpace/UiObject.js index 974026bc0..9b77df044 100644 --- a/FloatingSpace/UiObject.js +++ b/FloatingSpace/UiObject.js @@ -120,7 +120,7 @@ function newUiObject () { /* Initialize Part Title */ - thisObject.partTitle = newStrategyPartTitle() + thisObject.partTitle = newUiObjectTitle() thisObject.partTitle.isVisibleFunction = thisObject.isVisibleFunction thisObject.partTitle.container.connectToParent(thisObject.container, false, false, true, true, false, false, true, true) thisObject.partTitle.initialize(thisObject.payload) diff --git a/FloatingSpace/UiObjectConstructor.js b/FloatingSpace/UiObjectConstructor.js index b178415eb..daa477232 100644 --- a/FloatingSpace/UiObjectConstructor.js +++ b/FloatingSpace/UiObjectConstructor.js @@ -6,8 +6,8 @@ function newUiObjectConstructor () { logger.fileName = MODULE_NAME let thisObject = { - createStrategyPart: createStrategyPart, - destroyStrategyPart: destroyStrategyPart, + createUiObject: createUiObject, + destroyUiObject: destroyUiObject, initialize: initialize, finalize: finalize } @@ -27,7 +27,7 @@ function newUiObjectConstructor () { floatingLayer = pFloatingLayer } - function createStrategyPart (payload) { + function createUiObject (payload) { let floatingObject = newFloatingObject() floatingObject.fitFunction = canvas.floatingSpace.fitIntoVisibleArea floatingObject.container.connectToParent(canvas.floatingSpace.container, false, false, false, false, false, false, false, false) @@ -200,7 +200,7 @@ function newUiObjectConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Definition', visible: true, - relatedStrategyPart: 'Definition', + relatedUiObject: 'Definition', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -230,7 +230,7 @@ function newUiObjectConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Trading System', visible: true, - relatedStrategyPart: 'Trading System', + relatedUiObject: 'Trading System', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -243,7 +243,7 @@ function newUiObjectConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Personal Data', visible: true, - relatedStrategyPart: 'Personal Data', + relatedUiObject: 'Personal Data', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -256,7 +256,7 @@ function newUiObjectConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Network', visible: true, - relatedStrategyPart: 'Network', + relatedUiObject: 'Network', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -303,7 +303,7 @@ function newUiObjectConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Network Node', visible: true, - relatedStrategyPart: 'Network Node', + relatedUiObject: 'Network Node', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -350,7 +350,7 @@ function newUiObjectConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Task Manager', visible: true, - relatedStrategyPart: 'Task Manager', + relatedUiObject: 'Task Manager', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -397,7 +397,7 @@ function newUiObjectConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Telegram Bot', visible: true, - relatedStrategyPart: 'Telegram Bot', + relatedUiObject: 'Telegram Bot', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -448,7 +448,7 @@ function newUiObjectConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Announcement', visible: true, - relatedStrategyPart: 'Announcement', + relatedUiObject: 'Announcement', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -514,7 +514,7 @@ function newUiObjectConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Formula', visible: true, - relatedStrategyPart: 'Formula', + relatedUiObject: 'Formula', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -577,7 +577,7 @@ function newUiObjectConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Layer', visible: true, - relatedStrategyPart: 'Layer', + relatedUiObject: 'Layer', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -705,7 +705,7 @@ function newUiObjectConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Task', visible: true, - relatedStrategyPart: 'Task Manager', + relatedUiObject: 'Task Manager', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -775,7 +775,7 @@ function newUiObjectConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Sensor', visible: true, - relatedStrategyPart: 'Sensor', + relatedUiObject: 'Sensor', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -788,7 +788,7 @@ function newUiObjectConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Indicator', visible: true, - relatedStrategyPart: 'Indicator', + relatedUiObject: 'Indicator', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -801,7 +801,7 @@ function newUiObjectConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Trading Engine', visible: true, - relatedStrategyPart: 'Trading Engine', + relatedUiObject: 'Trading Engine', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -853,7 +853,7 @@ function newUiObjectConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Process', visible: true, - relatedStrategyPart: 'Process', + relatedUiObject: 'Process', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -920,7 +920,7 @@ function newUiObjectConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Process', visible: true, - relatedStrategyPart: 'Process', + relatedUiObject: 'Process', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -987,7 +987,7 @@ function newUiObjectConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Process', visible: true, - relatedStrategyPart: 'Process', + relatedUiObject: 'Process', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -1057,7 +1057,7 @@ function newUiObjectConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Backtesting', visible: true, - relatedStrategyPart: 'Backtesting Session', + relatedUiObject: 'Backtesting Session', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -1070,7 +1070,7 @@ function newUiObjectConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Live Trading', visible: true, - relatedStrategyPart: 'Live Trading Session', + relatedUiObject: 'Live Trading Session', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -1083,7 +1083,7 @@ function newUiObjectConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Fordward Testing', visible: true, - relatedStrategyPart: 'Fordward Testing Session', + relatedUiObject: 'Fordward Testing Session', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -1096,7 +1096,7 @@ function newUiObjectConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Paper Trading', visible: true, - relatedStrategyPart: 'Paper Trading Session', + relatedUiObject: 'Paper Trading Session', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -1237,7 +1237,7 @@ function newUiObjectConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Layer Manager', visible: true, - relatedStrategyPart: 'Layer Manager', + relatedUiObject: 'Layer Manager', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -1250,7 +1250,7 @@ function newUiObjectConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Parameters', visible: true, - relatedStrategyPart: 'Parameters', + relatedUiObject: 'Parameters', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -1263,7 +1263,7 @@ function newUiObjectConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Social Bots', visible: true, - relatedStrategyPart: 'Social Bots', + relatedUiObject: 'Social Bots', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -1353,7 +1353,7 @@ function newUiObjectConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Layer Manager', visible: true, - relatedStrategyPart: 'Layer Manager', + relatedUiObject: 'Layer Manager', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -1366,7 +1366,7 @@ function newUiObjectConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Parameters', visible: true, - relatedStrategyPart: 'Parameters', + relatedUiObject: 'Parameters', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -1379,7 +1379,7 @@ function newUiObjectConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Social Bots', visible: true, - relatedStrategyPart: 'Social Bots', + relatedUiObject: 'Social Bots', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -1469,7 +1469,7 @@ function newUiObjectConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Layer Manager', visible: true, - relatedStrategyPart: 'Layer Manager', + relatedUiObject: 'Layer Manager', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -1482,7 +1482,7 @@ function newUiObjectConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Parameters', visible: true, - relatedStrategyPart: 'Parameters', + relatedUiObject: 'Parameters', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -1495,7 +1495,7 @@ function newUiObjectConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Social Bots', visible: true, - relatedStrategyPart: 'Social Bots', + relatedUiObject: 'Social Bots', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -1585,7 +1585,7 @@ function newUiObjectConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Layer Manager', visible: true, - relatedStrategyPart: 'Layer Manager', + relatedUiObject: 'Layer Manager', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -1598,7 +1598,7 @@ function newUiObjectConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Parameters', visible: true, - relatedStrategyPart: 'Parameters', + relatedUiObject: 'Parameters', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -1611,7 +1611,7 @@ function newUiObjectConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Social Bots', visible: true, - relatedStrategyPart: 'Social Bots', + relatedUiObject: 'Social Bots', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -1673,7 +1673,7 @@ function newUiObjectConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Exchange Account', visible: true, - relatedStrategyPart: 'Exchange Account', + relatedUiObject: 'Exchange Account', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -1706,7 +1706,7 @@ function newUiObjectConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Asset', visible: true, - relatedStrategyPart: 'Exchange Account Asset', + relatedUiObject: 'Exchange Account Asset', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -1719,7 +1719,7 @@ function newUiObjectConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Key', visible: true, - relatedStrategyPart: 'Exchange Account Key', + relatedUiObject: 'Exchange Account Key', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -1812,7 +1812,7 @@ function newUiObjectConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Strategy', visible: true, - relatedStrategyPart: 'Strategy', + relatedUiObject: 'Strategy', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -1825,7 +1825,7 @@ function newUiObjectConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Parameters', visible: true, - relatedStrategyPart: 'Parameters', + relatedUiObject: 'Parameters', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -1872,7 +1872,7 @@ function newUiObjectConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Missing Params', visible: true, - relatedStrategyPart: 'Parameters', + relatedUiObject: 'Parameters', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -2184,7 +2184,7 @@ function newUiObjectConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Missing Stages', visible: true, - relatedStrategyPart: 'Strategy', + relatedUiObject: 'Strategy', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -2231,7 +2231,7 @@ function newUiObjectConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Missing Events', visible: true, - relatedStrategyPart: 'Trigger Stage', + relatedUiObject: 'Trigger Stage', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -2278,7 +2278,7 @@ function newUiObjectConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Initial Definition', visible: true, - relatedStrategyPart: 'Initial Definition', + relatedUiObject: 'Initial Definition', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -2291,7 +2291,7 @@ function newUiObjectConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Open Execution', visible: true, - relatedStrategyPart: 'Open Execution', + relatedUiObject: 'Open Execution', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -2338,7 +2338,7 @@ function newUiObjectConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Missing Items', visible: true, - relatedStrategyPart: 'Manage Stage', + relatedUiObject: 'Manage Stage', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -2385,7 +2385,7 @@ function newUiObjectConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Close Execution', visible: true, - relatedStrategyPart: 'Close Execution', + relatedUiObject: 'Close Execution', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -2432,7 +2432,7 @@ function newUiObjectConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Formula', visible: true, - relatedStrategyPart: 'Formula', + relatedUiObject: 'Formula', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -2479,7 +2479,7 @@ function newUiObjectConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Formula', visible: true, - relatedStrategyPart: 'Formula', + relatedUiObject: 'Formula', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -2526,7 +2526,7 @@ function newUiObjectConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Situation', visible: true, - relatedStrategyPart: 'Situation', + relatedUiObject: 'Situation', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -2573,7 +2573,7 @@ function newUiObjectConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Situation', visible: true, - relatedStrategyPart: 'Situation', + relatedUiObject: 'Situation', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -2620,7 +2620,7 @@ function newUiObjectConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Situation', visible: true, - relatedStrategyPart: 'Situation', + relatedUiObject: 'Situation', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -2667,7 +2667,7 @@ function newUiObjectConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Missing Items', visible: true, - relatedStrategyPart: 'Initial Definition', + relatedUiObject: 'Initial Definition', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -2782,7 +2782,7 @@ function newUiObjectConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Phase', visible: true, - relatedStrategyPart: 'Phase', + relatedUiObject: 'Phase', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -2829,7 +2829,7 @@ function newUiObjectConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Phase', visible: true, - relatedStrategyPart: 'Phase', + relatedUiObject: 'Phase', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -2876,7 +2876,7 @@ function newUiObjectConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Formula', visible: true, - relatedStrategyPart: 'Formula', + relatedUiObject: 'Formula', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -2889,7 +2889,7 @@ function newUiObjectConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Next Phase Event', visible: true, - relatedStrategyPart: 'Next Phase Event', + relatedUiObject: 'Next Phase Event', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -2990,7 +2990,7 @@ function newUiObjectConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Situation', visible: true, - relatedStrategyPart: 'Situation', + relatedUiObject: 'Situation', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -3037,7 +3037,7 @@ function newUiObjectConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Condition', visible: true, - relatedStrategyPart: 'Condition', + relatedUiObject: 'Condition', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -3084,7 +3084,7 @@ function newUiObjectConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Code', visible: true, - relatedStrategyPart: 'Code', + relatedUiObject: 'Code', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -3502,7 +3502,7 @@ function newUiObjectConstructor () { floatingObject.labelStrokeStyle = 'rgba(' + UI_COLOR.WHITE + ', 1)' } - function destroyStrategyPart (payload) { + function destroyUiObject (payload) { floatingLayer.removeFloatingObject(payload.floatingObject.handle) payload.floatingObject.finalize() diff --git a/StrategySpace/Workspace/FunctionLibraries/NodeDeleter.js b/StrategySpace/Workspace/FunctionLibraries/NodeDeleter.js index 9a207b396..5fa3c3137 100644 --- a/StrategySpace/Workspace/FunctionLibraries/NodeDeleter.js +++ b/StrategySpace/Workspace/FunctionLibraries/NodeDeleter.js @@ -52,7 +52,7 @@ function newNodeDeleter () { return thisObject function destroyPart (node) { - canvas.floatingSpace.uiObjectConstructor.destroyStrategyPart(node.payload) + canvas.floatingSpace.uiObjectConstructor.destroyUiObject(node.payload) } function deleteWorkspace (node, rootNodes) { diff --git a/StrategySpace/Workspace/FunctionLibraries/PartsFromNodes.js b/StrategySpace/Workspace/FunctionLibraries/PartsFromNodes.js index 699f1d8c0..14d5e0167 100644 --- a/StrategySpace/Workspace/FunctionLibraries/PartsFromNodes.js +++ b/StrategySpace/Workspace/FunctionLibraries/PartsFromNodes.js @@ -1298,6 +1298,6 @@ function newPartsFromNodes () { } node.payload = payload node.type = partType - canvas.floatingSpace.uiObjectConstructor.createStrategyPart(payload) + canvas.floatingSpace.uiObjectConstructor.createUiObject(payload) } } From 312f50b6dd25fd6a820b787f37c357402ee9454a Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sat, 26 Oct 2019 18:47:58 +0200 Subject: [PATCH 07/95] strategyPart refactoring part 5 --- FloatingSpace/{StrategyPartTitle.js => UiObjectTitle.js} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename FloatingSpace/{StrategyPartTitle.js => UiObjectTitle.js} (100%) diff --git a/FloatingSpace/StrategyPartTitle.js b/FloatingSpace/UiObjectTitle.js similarity index 100% rename from FloatingSpace/StrategyPartTitle.js rename to FloatingSpace/UiObjectTitle.js From 21e3de95abbc86324c33447ca7ce7d252dba6e4b Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sat, 26 Oct 2019 19:25:17 +0200 Subject: [PATCH 08/95] Sensor Refactoring --- FloatingSpace/UiObject.js | 6 +++--- FloatingSpace/UiObjectConstructor.js | 6 +++--- FloatingSpace/UiObjectTitle.js | 2 +- Spaces/StrategySpace.js | 2 +- .../Workspace/FunctionLibraries/AttachDetach.js | 4 ++-- .../Workspace/FunctionLibraries/NodeChildren.js | 2 +- .../Workspace/FunctionLibraries/NodeDeleter.js | 6 +++--- StrategySpace/Workspace/FunctionLibraries/OnFocus.js | 2 +- .../Workspace/FunctionLibraries/PartsFromNodes.js | 10 +++++----- .../Workspace/FunctionLibraries/ProtocolNode.js | 2 +- .../Workspace/FunctionLibraries/ShortcutKeys.js | 2 +- 11 files changed, 22 insertions(+), 22 deletions(-) diff --git a/FloatingSpace/UiObject.js b/FloatingSpace/UiObject.js index 9b77df044..60f5e36a3 100644 --- a/FloatingSpace/UiObject.js +++ b/FloatingSpace/UiObject.js @@ -295,7 +295,7 @@ function newUiObject () { compatibleType = '->' + 'Task Manager' + '->' compatibleSubType = undefined break - case 'Sensor': + case 'Sensor Bot Instance': compatibleType = '->' + 'Task' + '->' compatibleSubType = undefined break @@ -310,7 +310,7 @@ function newUiObject () { case 'Process': switch (thisObject.payload.node.subType) { case 'Sensor Process': { - compatibleType = '->' + 'Sensor' + '->' + compatibleType = '->' + 'Sensor Bot Instance' + '->' break } case 'Indicator Process': { @@ -423,7 +423,7 @@ function newUiObject () { if (compatibleType.indexOf('->' + nearbyNode.type + '->') >= 0) { /* Discard objects with busy coonection ports */ if (thisObject.payload.node.type === 'Task' && nearbyNode.task !== undefined) { continue } - if (thisObject.payload.node.type === 'Sensor' && nearbyNode.bot !== undefined) { continue } + if (thisObject.payload.node.type === 'Sensor Bot Instance' && nearbyNode.bot !== undefined) { continue } if (thisObject.payload.node.type === 'Indicator' && nearbyNode.bot !== undefined) { continue } if (thisObject.payload.node.type === 'Trading Engine' && nearbyNode.bot !== undefined) { continue } if (thisObject.payload.node.type === 'Process' && nearbyNode.process !== undefined) { continue } diff --git a/FloatingSpace/UiObjectConstructor.js b/FloatingSpace/UiObjectConstructor.js index daa477232..5548c237f 100644 --- a/FloatingSpace/UiObjectConstructor.js +++ b/FloatingSpace/UiObjectConstructor.js @@ -775,7 +775,7 @@ function newUiObjectConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Sensor', visible: true, - relatedUiObject: 'Sensor', + relatedUiObject: 'Sensor Bot Instance', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -840,7 +840,7 @@ function newUiObjectConstructor () { ) break } - case 'Sensor': { + case 'Sensor Bot Instance': { uiObject.codeEditor = newCodeEditor() uiObject.codeEditor.isVisibleFunction = uiObject.isVisibleFunction uiObject.codeEditor.initialize() @@ -3234,7 +3234,7 @@ function newUiObjectConstructor () { level_3() break } - case 'Sensor': { + case 'Sensor Bot Instance': { level_3() break } diff --git a/FloatingSpace/UiObjectTitle.js b/FloatingSpace/UiObjectTitle.js index b2d784818..f7ac667b1 100644 --- a/FloatingSpace/UiObjectTitle.js +++ b/FloatingSpace/UiObjectTitle.js @@ -82,7 +82,7 @@ function newUiObjectTitle () { case 'Task': { break } - case 'Sensor': { + case 'Sensor Bot Instance': { thisObject.allwaysVisible = true break } diff --git a/Spaces/StrategySpace.js b/Spaces/StrategySpace.js index 608dd3e75..b35581d92 100644 --- a/Spaces/StrategySpace.js +++ b/Spaces/StrategySpace.js @@ -49,7 +49,7 @@ function newStrategySpace () { ['Layer', 'attractive'], ['Task Manager', 'task'], ['Task', 'timeline'], - ['Sensor', 'bot-sensor'], + ['Sensor Bot Instance', 'bot-sensor'], ['Indicator', 'bot-indicator'], ['Trading Engine', 'trading-engine'], ['Process', 'process'], diff --git a/StrategySpace/Workspace/FunctionLibraries/AttachDetach.js b/StrategySpace/Workspace/FunctionLibraries/AttachDetach.js index 43a73a8b5..8a23cacc7 100644 --- a/StrategySpace/Workspace/FunctionLibraries/AttachDetach.js +++ b/StrategySpace/Workspace/FunctionLibraries/AttachDetach.js @@ -135,7 +135,7 @@ function newAttachDetach () { completeDetachment(node, rootNodes) return } - case 'Sensor': { + case 'Sensor Bot Instance': { node.payload.parentNode.bot = undefined completeDetachment(node, rootNodes) return @@ -423,7 +423,7 @@ function newAttachDetach () { completeAttachment(node, rootNodes) } break - case 'Sensor': { + case 'Sensor Bot Instance': { node.payload.parentNode = attachToNode node.payload.chainParent = attachToNode node.payload.parentNode.bot = node diff --git a/StrategySpace/Workspace/FunctionLibraries/NodeChildren.js b/StrategySpace/Workspace/FunctionLibraries/NodeChildren.js index 2a2ff97c3..3436023fc 100644 --- a/StrategySpace/Workspace/FunctionLibraries/NodeChildren.js +++ b/StrategySpace/Workspace/FunctionLibraries/NodeChildren.js @@ -38,7 +38,7 @@ function newNodeChildren () { case 'Task': { return countChildrenTask(parentNode, childNode) } - case 'Sensor': { + case 'Sensor Bot Instance': { return countChildrenSensor(parentNode, childNode) } case 'Indicator': { diff --git a/StrategySpace/Workspace/FunctionLibraries/NodeDeleter.js b/StrategySpace/Workspace/FunctionLibraries/NodeDeleter.js index 5fa3c3137..4df67afe2 100644 --- a/StrategySpace/Workspace/FunctionLibraries/NodeDeleter.js +++ b/StrategySpace/Workspace/FunctionLibraries/NodeDeleter.js @@ -101,7 +101,7 @@ function newNodeDeleter () { deleteTask(rootNode, rootNodes) break } - case 'Sensor': { + case 'Sensor Bot Instance': { deleteBot(rootNode, rootNodes) break } @@ -1024,7 +1024,7 @@ function newNodeDeleter () { if (node.phases !== undefined) { while (node.phases.length > 0) { - deletePhase(node.phases[0]) + deletePhase(node.phases[0], rootNodes) } } @@ -1103,7 +1103,7 @@ function newNodeDeleter () { if (node.conditions !== undefined) { while (node.conditions.length > 0) { let condition = node.conditions[0] - deleteCondition(condition) + deleteCondition(condition, rootNodes) } } diff --git a/StrategySpace/Workspace/FunctionLibraries/OnFocus.js b/StrategySpace/Workspace/FunctionLibraries/OnFocus.js index 77fa1621a..de2854820 100644 --- a/StrategySpace/Workspace/FunctionLibraries/OnFocus.js +++ b/StrategySpace/Workspace/FunctionLibraries/OnFocus.js @@ -546,7 +546,7 @@ function newOnFocus () { return } } - case 'Sensor': { + case 'Sensor Bot Instance': { let child for (let m = 0; m < node.processes.length; m++) { child = getNodeThatIsOnFocus(node.processes[m]) diff --git a/StrategySpace/Workspace/FunctionLibraries/PartsFromNodes.js b/StrategySpace/Workspace/FunctionLibraries/PartsFromNodes.js index 14d5e0167..a223ff74d 100644 --- a/StrategySpace/Workspace/FunctionLibraries/PartsFromNodes.js +++ b/StrategySpace/Workspace/FunctionLibraries/PartsFromNodes.js @@ -465,8 +465,8 @@ function newPartsFromNodes () { } return } - case 'Sensor': { - createPart('Sensor', node.name, node, parentNode, chainParent, 'Sensor') + case 'Sensor Bot Instance': { + createPart('Sensor Bot Instance', node.name, node, parentNode, chainParent, 'Sensor Bot Instance') for (let m = 0; m < node.processes.length; m++) { let process = node.processes[m] createPartFromNode(process, node, node) @@ -492,7 +492,7 @@ function newPartsFromNodes () { case 'Process': { if (parentNode !== undefined) { switch (parentNode.type) { - case 'Sensor': { + case 'Sensor Bot Instance': { node.subType = 'Sensor Process' break } @@ -679,7 +679,7 @@ function newPartsFromNodes () { processes: [], code: '{}' } - createPart('Sensor', '', node.bot, node, node) + createPart('Sensor Bot Instance', '', node.bot, node, node) } return node.bot } @@ -713,7 +713,7 @@ function newPartsFromNodes () { } switch (node.type) { - case 'Sensor': { + case 'Sensor Bot Instance': { process.subType = 'Sensor Process' process.name = 'Sensor Process' break diff --git a/StrategySpace/Workspace/FunctionLibraries/ProtocolNode.js b/StrategySpace/Workspace/FunctionLibraries/ProtocolNode.js index 4d28635ed..5b034f146 100644 --- a/StrategySpace/Workspace/FunctionLibraries/ProtocolNode.js +++ b/StrategySpace/Workspace/FunctionLibraries/ProtocolNode.js @@ -772,7 +772,7 @@ function newProtocolNode () { } return object } - case 'Sensor': { + case 'Sensor Bot Instance': { let object = { type: node.type, subType: node.subType, diff --git a/StrategySpace/Workspace/FunctionLibraries/ShortcutKeys.js b/StrategySpace/Workspace/FunctionLibraries/ShortcutKeys.js index ce6e6b4f5..d4d3a0d6e 100644 --- a/StrategySpace/Workspace/FunctionLibraries/ShortcutKeys.js +++ b/StrategySpace/Workspace/FunctionLibraries/ShortcutKeys.js @@ -547,7 +547,7 @@ function newShortcutKeys () { return } } - case 'Sensor': { + case 'Sensor Bot Instance': { let child for (let m = 0; m < node.processes.length; m++) { child = getNodeByShortcutKey(node.processes[m], searchingKey) From 0fd53d7cef8e7eaf1b5a7f0e2b41147d2825f964 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sun, 27 Oct 2019 11:10:58 +0100 Subject: [PATCH 09/95] Indicator Refactoring --- FloatingSpace/UiObject.js | 6 +++--- FloatingSpace/UiObjectConstructor.js | 6 +++--- FloatingSpace/UiObjectTitle.js | 2 +- Panels/ProductsPanel.js | 2 +- Spaces/StrategySpace.js | 2 +- .../Workspace/FunctionLibraries/AttachDetach.js | 4 ++-- .../Workspace/FunctionLibraries/NodeChildren.js | 2 +- .../Workspace/FunctionLibraries/NodeDeleter.js | 2 +- StrategySpace/Workspace/FunctionLibraries/OnFocus.js | 2 +- .../Workspace/FunctionLibraries/PartsFromNodes.js | 10 +++++----- .../Workspace/FunctionLibraries/ProtocolNode.js | 2 +- .../Workspace/FunctionLibraries/ShortcutKeys.js | 2 +- 12 files changed, 21 insertions(+), 21 deletions(-) diff --git a/FloatingSpace/UiObject.js b/FloatingSpace/UiObject.js index 60f5e36a3..c352b012a 100644 --- a/FloatingSpace/UiObject.js +++ b/FloatingSpace/UiObject.js @@ -299,7 +299,7 @@ function newUiObject () { compatibleType = '->' + 'Task' + '->' compatibleSubType = undefined break - case 'Indicator': + case 'Indicator Bot Instance': compatibleType = '->' + 'Task' + '->' compatibleSubType = undefined break @@ -314,7 +314,7 @@ function newUiObject () { break } case 'Indicator Process': { - compatibleType = '->' + 'Indicator' + '->' + compatibleType = '->' + 'Indicator Bot Instance' + '->' break } case 'Trading Engine Process': { @@ -424,7 +424,7 @@ function newUiObject () { /* Discard objects with busy coonection ports */ if (thisObject.payload.node.type === 'Task' && nearbyNode.task !== undefined) { continue } if (thisObject.payload.node.type === 'Sensor Bot Instance' && nearbyNode.bot !== undefined) { continue } - if (thisObject.payload.node.type === 'Indicator' && nearbyNode.bot !== undefined) { continue } + if (thisObject.payload.node.type === 'Indicator Bot Instance' && nearbyNode.bot !== undefined) { continue } if (thisObject.payload.node.type === 'Trading Engine' && nearbyNode.bot !== undefined) { continue } if (thisObject.payload.node.type === 'Process' && nearbyNode.process !== undefined) { continue } if (thisObject.payload.node.type === 'Trading System' && nearbyNode.tradingSystem !== undefined) { continue } diff --git a/FloatingSpace/UiObjectConstructor.js b/FloatingSpace/UiObjectConstructor.js index 5548c237f..9cb2742e0 100644 --- a/FloatingSpace/UiObjectConstructor.js +++ b/FloatingSpace/UiObjectConstructor.js @@ -788,7 +788,7 @@ function newUiObjectConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Indicator', visible: true, - relatedUiObject: 'Indicator', + relatedUiObject: 'Indicator Bot Instance', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -907,7 +907,7 @@ function newUiObjectConstructor () { ) break } - case 'Indicator': { + case 'Indicator Bot Instance': { uiObject.codeEditor = newCodeEditor() uiObject.codeEditor.isVisibleFunction = uiObject.isVisibleFunction uiObject.codeEditor.initialize() @@ -3238,7 +3238,7 @@ function newUiObjectConstructor () { level_3() break } - case 'Indicator': { + case 'Indicator Bot Instance': { level_3() break } diff --git a/FloatingSpace/UiObjectTitle.js b/FloatingSpace/UiObjectTitle.js index f7ac667b1..b9662009a 100644 --- a/FloatingSpace/UiObjectTitle.js +++ b/FloatingSpace/UiObjectTitle.js @@ -86,7 +86,7 @@ function newUiObjectTitle () { thisObject.allwaysVisible = true break } - case 'Indicator': { + case 'Indicator Bot Instance': { thisObject.allwaysVisible = true break } diff --git a/Panels/ProductsPanel.js b/Panels/ProductsPanel.js index 3d6e61160..150161998 100644 --- a/Panels/ProductsPanel.js +++ b/Panels/ProductsPanel.js @@ -71,7 +71,7 @@ function newProductsPanel () { for (let j = 0; j < devTeam.bots.length; j++) { let bot = devTeam.bots[j] - if (bot.type !== 'Indicator') { continue } + if (bot.type !== 'Indicator Bot Instance') { continue } if (bot.products !== undefined) { for (let k = 0; k < bot.products.length; k++) { diff --git a/Spaces/StrategySpace.js b/Spaces/StrategySpace.js index b35581d92..a50f67716 100644 --- a/Spaces/StrategySpace.js +++ b/Spaces/StrategySpace.js @@ -50,7 +50,7 @@ function newStrategySpace () { ['Task Manager', 'task'], ['Task', 'timeline'], ['Sensor Bot Instance', 'bot-sensor'], - ['Indicator', 'bot-indicator'], + ['Indicator Bot Instance', 'bot-indicator'], ['Trading Engine', 'trading-engine'], ['Process', 'process'], ['Backtesting Session', 'session-backtesting'], diff --git a/StrategySpace/Workspace/FunctionLibraries/AttachDetach.js b/StrategySpace/Workspace/FunctionLibraries/AttachDetach.js index 8a23cacc7..79c85e8a8 100644 --- a/StrategySpace/Workspace/FunctionLibraries/AttachDetach.js +++ b/StrategySpace/Workspace/FunctionLibraries/AttachDetach.js @@ -140,7 +140,7 @@ function newAttachDetach () { completeDetachment(node, rootNodes) return } - case 'Indicator': { + case 'Indicator Bot Instance': { node.payload.parentNode.bot = undefined completeDetachment(node, rootNodes) return @@ -430,7 +430,7 @@ function newAttachDetach () { completeAttachment(node, rootNodes) } break - case 'Indicator': { + case 'Indicator Bot Instance': { node.payload.parentNode = attachToNode node.payload.chainParent = attachToNode node.payload.parentNode.bot = node diff --git a/StrategySpace/Workspace/FunctionLibraries/NodeChildren.js b/StrategySpace/Workspace/FunctionLibraries/NodeChildren.js index 3436023fc..72daee458 100644 --- a/StrategySpace/Workspace/FunctionLibraries/NodeChildren.js +++ b/StrategySpace/Workspace/FunctionLibraries/NodeChildren.js @@ -41,7 +41,7 @@ function newNodeChildren () { case 'Sensor Bot Instance': { return countChildrenSensor(parentNode, childNode) } - case 'Indicator': { + case 'Indicator Bot Instance': { return countChildrenIndicator(parentNode, childNode) } case 'Trading Engine': { diff --git a/StrategySpace/Workspace/FunctionLibraries/NodeDeleter.js b/StrategySpace/Workspace/FunctionLibraries/NodeDeleter.js index 4df67afe2..c287d3b66 100644 --- a/StrategySpace/Workspace/FunctionLibraries/NodeDeleter.js +++ b/StrategySpace/Workspace/FunctionLibraries/NodeDeleter.js @@ -105,7 +105,7 @@ function newNodeDeleter () { deleteBot(rootNode, rootNodes) break } - case 'Indicator': { + case 'Indicator Bot Instance': { deleteBot(rootNode, rootNodes) break } diff --git a/StrategySpace/Workspace/FunctionLibraries/OnFocus.js b/StrategySpace/Workspace/FunctionLibraries/OnFocus.js index de2854820..beb2590b7 100644 --- a/StrategySpace/Workspace/FunctionLibraries/OnFocus.js +++ b/StrategySpace/Workspace/FunctionLibraries/OnFocus.js @@ -560,7 +560,7 @@ function newOnFocus () { return } } - case 'Indicator': { + case 'Indicator Bot Instance': { let child for (let m = 0; m < node.processes.length; m++) { child = getNodeThatIsOnFocus(node.processes[m]) diff --git a/StrategySpace/Workspace/FunctionLibraries/PartsFromNodes.js b/StrategySpace/Workspace/FunctionLibraries/PartsFromNodes.js index a223ff74d..8d6075a95 100644 --- a/StrategySpace/Workspace/FunctionLibraries/PartsFromNodes.js +++ b/StrategySpace/Workspace/FunctionLibraries/PartsFromNodes.js @@ -473,8 +473,8 @@ function newPartsFromNodes () { } return } - case 'Indicator': { - createPart('Indicator', node.name, node, parentNode, chainParent, 'Indicator') + case 'Indicator Bot Instance': { + createPart('Indicator Bot Instance', node.name, node, parentNode, chainParent, 'Indicator Bot Instance') for (let m = 0; m < node.processes.length; m++) { let process = node.processes[m] createPartFromNode(process, node, node) @@ -496,7 +496,7 @@ function newPartsFromNodes () { node.subType = 'Sensor Process' break } - case 'Indicator': { + case 'Indicator Bot Instance': { node.subType = 'Indicator Process' break } @@ -690,7 +690,7 @@ function newPartsFromNodes () { processes: [], code: '{}' } - createPart('Indicator', '', node.bot, node, node) + createPart('Indicator Bot Instance', '', node.bot, node, node) } return node.bot } @@ -718,7 +718,7 @@ function newPartsFromNodes () { process.name = 'Sensor Process' break } - case 'Indicator': { + case 'Indicator Bot Instance': { process.subType = 'Indicator Process' process.name = 'Indicator Process' break diff --git a/StrategySpace/Workspace/FunctionLibraries/ProtocolNode.js b/StrategySpace/Workspace/FunctionLibraries/ProtocolNode.js index 5b034f146..f7ea34a97 100644 --- a/StrategySpace/Workspace/FunctionLibraries/ProtocolNode.js +++ b/StrategySpace/Workspace/FunctionLibraries/ProtocolNode.js @@ -798,7 +798,7 @@ function newProtocolNode () { } return object } - case 'Indicator': { + case 'Indicator Bot Instance': { let object = { type: node.type, subType: node.subType, diff --git a/StrategySpace/Workspace/FunctionLibraries/ShortcutKeys.js b/StrategySpace/Workspace/FunctionLibraries/ShortcutKeys.js index d4d3a0d6e..6e9e3dfa3 100644 --- a/StrategySpace/Workspace/FunctionLibraries/ShortcutKeys.js +++ b/StrategySpace/Workspace/FunctionLibraries/ShortcutKeys.js @@ -561,7 +561,7 @@ function newShortcutKeys () { return } } - case 'Indicator': { + case 'Indicator Bot Instance': { let child for (let m = 0; m < node.processes.length; m++) { child = getNodeByShortcutKey(node.processes[m], searchingKey) From f05022e02676e537eda3224e9fd5aa67d7141b35 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sun, 27 Oct 2019 11:31:16 +0100 Subject: [PATCH 10/95] Trading Engine Refactoring --- FloatingSpace/UiObject.js | 6 +++--- FloatingSpace/UiObjectConstructor.js | 6 +++--- FloatingSpace/UiObjectTitle.js | 2 +- Panels/ProductsPanel.js | 2 +- Spaces/StrategySpace.js | 2 +- .../FunctionLibraries/AttachDetach.js | 4 ++-- .../FunctionLibraries/NodeChildren.js | 2 +- .../Workspace/FunctionLibraries/NodeDeleter.js | 2 +- .../Workspace/FunctionLibraries/OnFocus.js | 2 +- .../FunctionLibraries/PartsFromNodes.js | 10 +++++----- .../FunctionLibraries/ProtocolNode.js | 2 +- .../FunctionLibraries/ShortcutKeys.js | 2 +- StrategySpace/Workspace/Workspace.js | 18 +++++++----------- 13 files changed, 28 insertions(+), 32 deletions(-) diff --git a/FloatingSpace/UiObject.js b/FloatingSpace/UiObject.js index c352b012a..284bcf250 100644 --- a/FloatingSpace/UiObject.js +++ b/FloatingSpace/UiObject.js @@ -303,7 +303,7 @@ function newUiObject () { compatibleType = '->' + 'Task' + '->' compatibleSubType = undefined break - case 'Trading Engine': + case 'Trading Bot Instance': compatibleType = '->' + 'Task' + '->' compatibleSubType = undefined break @@ -318,7 +318,7 @@ function newUiObject () { break } case 'Trading Engine Process': { - compatibleType = '->' + 'Trading Engine' + '->' + compatibleType = '->' + 'Trading Bot Instance' + '->' break } } @@ -425,7 +425,7 @@ function newUiObject () { if (thisObject.payload.node.type === 'Task' && nearbyNode.task !== undefined) { continue } if (thisObject.payload.node.type === 'Sensor Bot Instance' && nearbyNode.bot !== undefined) { continue } if (thisObject.payload.node.type === 'Indicator Bot Instance' && nearbyNode.bot !== undefined) { continue } - if (thisObject.payload.node.type === 'Trading Engine' && nearbyNode.bot !== undefined) { continue } + if (thisObject.payload.node.type === 'Trading Bot Instance' && nearbyNode.bot !== undefined) { continue } if (thisObject.payload.node.type === 'Process' && nearbyNode.process !== undefined) { continue } if (thisObject.payload.node.type === 'Trading System' && nearbyNode.tradingSystem !== undefined) { continue } if (thisObject.payload.node.type === 'Personal Data' && nearbyNode.personalData !== undefined) { continue } diff --git a/FloatingSpace/UiObjectConstructor.js b/FloatingSpace/UiObjectConstructor.js index 9cb2742e0..67a4cde7c 100644 --- a/FloatingSpace/UiObjectConstructor.js +++ b/FloatingSpace/UiObjectConstructor.js @@ -801,7 +801,7 @@ function newUiObjectConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Trading Engine', visible: true, - relatedUiObject: 'Trading Engine', + relatedUiObject: 'Trading Bot Instance', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -974,7 +974,7 @@ function newUiObjectConstructor () { ) break } - case 'Trading Engine': { + case 'Trading Bot Instance': { uiObject.codeEditor = newCodeEditor() uiObject.codeEditor.isVisibleFunction = uiObject.isVisibleFunction uiObject.codeEditor.initialize() @@ -3242,7 +3242,7 @@ function newUiObjectConstructor () { level_3() break } - case 'Trading Engine': { + case 'Trading Bot Instance': { level_3() break } diff --git a/FloatingSpace/UiObjectTitle.js b/FloatingSpace/UiObjectTitle.js index b9662009a..0aada37d5 100644 --- a/FloatingSpace/UiObjectTitle.js +++ b/FloatingSpace/UiObjectTitle.js @@ -90,7 +90,7 @@ function newUiObjectTitle () { thisObject.allwaysVisible = true break } - case 'Trading Engine': { + case 'Trading Bot Instance': { break } case 'Process': { diff --git a/Panels/ProductsPanel.js b/Panels/ProductsPanel.js index 150161998..f2c146ea1 100644 --- a/Panels/ProductsPanel.js +++ b/Panels/ProductsPanel.js @@ -297,7 +297,7 @@ function newProductsPanel () { for (let j = 0; j < devTeam.bots.length; j++) { let bot = devTeam.bots[j] - if (bot.type !== 'Trading Engine') { continue } + if (bot.type !== 'Trading Bot Instance') { continue } if (devTeam.codeName === code.team && bot.codeName === code.bot) { /* We found an instance of the same Trading Engine we are currently looking at. diff --git a/Spaces/StrategySpace.js b/Spaces/StrategySpace.js index a50f67716..791c74aeb 100644 --- a/Spaces/StrategySpace.js +++ b/Spaces/StrategySpace.js @@ -51,7 +51,7 @@ function newStrategySpace () { ['Task', 'timeline'], ['Sensor Bot Instance', 'bot-sensor'], ['Indicator Bot Instance', 'bot-indicator'], - ['Trading Engine', 'trading-engine'], + ['Trading Bot Instance', 'trading-engine'], ['Process', 'process'], ['Backtesting Session', 'session-backtesting'], ['Live Trading Session', 'session-live-trading'], diff --git a/StrategySpace/Workspace/FunctionLibraries/AttachDetach.js b/StrategySpace/Workspace/FunctionLibraries/AttachDetach.js index 79c85e8a8..441a18344 100644 --- a/StrategySpace/Workspace/FunctionLibraries/AttachDetach.js +++ b/StrategySpace/Workspace/FunctionLibraries/AttachDetach.js @@ -145,7 +145,7 @@ function newAttachDetach () { completeDetachment(node, rootNodes) return } - case 'Trading Engine': { + case 'Trading Bot Instance': { node.payload.parentNode.bot = undefined completeDetachment(node, rootNodes) return @@ -437,7 +437,7 @@ function newAttachDetach () { completeAttachment(node, rootNodes) } break - case 'Trading Engine': { + case 'Trading Bot Instance': { node.payload.parentNode = attachToNode node.payload.chainParent = attachToNode node.payload.parentNode.bot = node diff --git a/StrategySpace/Workspace/FunctionLibraries/NodeChildren.js b/StrategySpace/Workspace/FunctionLibraries/NodeChildren.js index 72daee458..b2d06ade9 100644 --- a/StrategySpace/Workspace/FunctionLibraries/NodeChildren.js +++ b/StrategySpace/Workspace/FunctionLibraries/NodeChildren.js @@ -44,7 +44,7 @@ function newNodeChildren () { case 'Indicator Bot Instance': { return countChildrenIndicator(parentNode, childNode) } - case 'Trading Engine': { + case 'Trading Bot Instance': { return countChildrenTradingEngine(parentNode, childNode) } case 'Process': { diff --git a/StrategySpace/Workspace/FunctionLibraries/NodeDeleter.js b/StrategySpace/Workspace/FunctionLibraries/NodeDeleter.js index c287d3b66..a0dae3144 100644 --- a/StrategySpace/Workspace/FunctionLibraries/NodeDeleter.js +++ b/StrategySpace/Workspace/FunctionLibraries/NodeDeleter.js @@ -109,7 +109,7 @@ function newNodeDeleter () { deleteBot(rootNode, rootNodes) break } - case 'Trading Engine': { + case 'Trading Bot Instance': { deleteBot(rootNode, rootNodes) break } diff --git a/StrategySpace/Workspace/FunctionLibraries/OnFocus.js b/StrategySpace/Workspace/FunctionLibraries/OnFocus.js index beb2590b7..3a8173511 100644 --- a/StrategySpace/Workspace/FunctionLibraries/OnFocus.js +++ b/StrategySpace/Workspace/FunctionLibraries/OnFocus.js @@ -574,7 +574,7 @@ function newOnFocus () { return } } - case 'Trading Engine': { + case 'Trading Bot Instance': { let child for (let m = 0; m < node.processes.length; m++) { child = getNodeThatIsOnFocus(node.processes[m]) diff --git a/StrategySpace/Workspace/FunctionLibraries/PartsFromNodes.js b/StrategySpace/Workspace/FunctionLibraries/PartsFromNodes.js index 8d6075a95..5190e6b9e 100644 --- a/StrategySpace/Workspace/FunctionLibraries/PartsFromNodes.js +++ b/StrategySpace/Workspace/FunctionLibraries/PartsFromNodes.js @@ -481,8 +481,8 @@ function newPartsFromNodes () { } return } - case 'Trading Engine': { - createPart('Trading Engine', node.name, node, parentNode, chainParent, 'Trading Engine') + case 'Trading Bot Instance': { + createPart('Trading Bot Instance', node.name, node, parentNode, chainParent, 'Trading Bot Instance') for (let m = 0; m < node.processes.length; m++) { let process = node.processes[m] createPartFromNode(process, node, node) @@ -500,7 +500,7 @@ function newPartsFromNodes () { node.subType = 'Indicator Process' break } - case 'Trading Engine': { + case 'Trading Bot Instance': { node.subType = 'Trading Engine Process' break } @@ -701,7 +701,7 @@ function newPartsFromNodes () { processes: [], code: '{}' } - createPart('Trading Engine', '', node.bot, node, node) + createPart('Trading Bot Instance', '', node.bot, node, node) } return node.bot } @@ -723,7 +723,7 @@ function newPartsFromNodes () { process.name = 'Indicator Process' break } - case 'Trading Engine': { + case 'Trading Bot Instance': { process.subType = 'Trading Engine Process' process.name = 'Trading Engine Process' break diff --git a/StrategySpace/Workspace/FunctionLibraries/ProtocolNode.js b/StrategySpace/Workspace/FunctionLibraries/ProtocolNode.js index f7ea34a97..2e2ba9340 100644 --- a/StrategySpace/Workspace/FunctionLibraries/ProtocolNode.js +++ b/StrategySpace/Workspace/FunctionLibraries/ProtocolNode.js @@ -824,7 +824,7 @@ function newProtocolNode () { } return object } - case 'Trading Engine': { + case 'Trading Bot Instance': { let object = { type: node.type, subType: node.subType, diff --git a/StrategySpace/Workspace/FunctionLibraries/ShortcutKeys.js b/StrategySpace/Workspace/FunctionLibraries/ShortcutKeys.js index 6e9e3dfa3..41d1bfe1a 100644 --- a/StrategySpace/Workspace/FunctionLibraries/ShortcutKeys.js +++ b/StrategySpace/Workspace/FunctionLibraries/ShortcutKeys.js @@ -575,7 +575,7 @@ function newShortcutKeys () { return } } - case 'Trading Engine': { + case 'Trading Bot Instance': { let child for (let m = 0; m < node.processes.length; m++) { child = getNodeByShortcutKey(node.processes[m], searchingKey) diff --git a/StrategySpace/Workspace/Workspace.js b/StrategySpace/Workspace/Workspace.js index b39b051c3..790459499 100644 --- a/StrategySpace/Workspace/Workspace.js +++ b/StrategySpace/Workspace/Workspace.js @@ -179,7 +179,7 @@ function newWorkspace () { let taskManager = networkNode.taskManagers[i] for (k = 0; k < taskManager.tasks.length; k++) { let task = taskManager.tasks[k] - if (task.bot.type === 'Trading Engine') { + if (task.bot.type === 'Trading Bot Instance') { tradingEngines.push(task.bot) } } @@ -195,22 +195,18 @@ function newWorkspace () { function getNodeByShortcutKey (searchingKey) { for (let i = 0; i < thisObject.workspaceNode.rootNodes.length; i++) { let rootNode = thisObject.workspaceNode.rootNodes[i] - if (rootNode.type === 'Definition') { - let definition = rootNode - let node = functionLibraryShortcutKeys.getNodeByShortcutKey(rootNode, searchingKey) - if (node !== undefined) { return node } - } + let definition = rootNode + let node = functionLibraryShortcutKeys.getNodeByShortcutKey(rootNode, searchingKey) + if (node !== undefined) { return node } } } function getNodeThatIsOnFocus () { for (let i = 0; i < thisObject.workspaceNode.rootNodes.length; i++) { let rootNode = thisObject.workspaceNode.rootNodes[i] - if (rootNode.type === 'Definition') { - let definition = rootNode - let node = functionLibraryOnFocus.getNodeThatIsOnFocus(rootNode) - if (node !== undefined) { return node } - } + let definition = rootNode + let node = functionLibraryOnFocus.getNodeThatIsOnFocus(rootNode) + if (node !== undefined) { return node } } } From 6baa267f2ae0c9690cddc6f804de7a61cd0293e2 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sun, 27 Oct 2019 12:04:45 +0100 Subject: [PATCH 11/95] Refactoring and getting icons outside menu itme menu background --- FloatingSpace/CircularMenuItem.js | 8 +++--- FloatingSpace/UiObjectConstructor.js | 36 +++++++++++++-------------- StrategySpace/Workspace/Workspace.js | 12 ++++----- Utilities/RoundedCornersBackground.js | 5 ++-- 4 files changed, 32 insertions(+), 29 deletions(-) diff --git a/FloatingSpace/CircularMenuItem.js b/FloatingSpace/CircularMenuItem.js index e59933ea6..f810012bc 100644 --- a/FloatingSpace/CircularMenuItem.js +++ b/FloatingSpace/CircularMenuItem.js @@ -105,7 +105,7 @@ function newCircularMenuItem () { selfMouseNotOverEventSubscriptionId = thisObject.container.eventHandler.listenToEvent('onMouseNotOver', onMouseNotOver) if (thisObject.type === 'Icon & Text') { - thisObject.container.frame.width = 150 + thisObject.container.frame.width = 185 } else { thisObject.container.frame.width = 50 } @@ -328,7 +328,8 @@ function newCircularMenuItem () { container: thisObject.container, borderColor: UI_COLOR.DARK, backgroundColor: backgroundColorToUse, - castShadow: false + castShadow: false, + xOffset: 40 } if (isMouseOver === true) { @@ -374,7 +375,7 @@ function newCircularMenuItem () { if (thisObject.currentRadius >= thisObject.targetRadius) { labelPoint = { - x: menuPosition.x + thisObject.currentRadius + 10, + x: menuPosition.x + thisObject.currentRadius + 20, y: menuPosition.y + fontSize * FONT_ASPECT_RATIO } @@ -386,3 +387,4 @@ function newCircularMenuItem () { } } } + diff --git a/FloatingSpace/UiObjectConstructor.js b/FloatingSpace/UiObjectConstructor.js index 67a4cde7c..bdb63b135 100644 --- a/FloatingSpace/UiObjectConstructor.js +++ b/FloatingSpace/UiObjectConstructor.js @@ -771,9 +771,9 @@ function newUiObjectConstructor () { ) menuItemsInitialValues.push( { - action: 'Add Sensor', + action: 'Add Sensor Bot Instance', actionFunction: payload.onMenuItemClick, - label: 'Add Sensor', + label: 'Add Sensor Bot Instance', visible: true, relatedUiObject: 'Sensor Bot Instance', rawRadius: 8, @@ -784,9 +784,9 @@ function newUiObjectConstructor () { ) menuItemsInitialValues.push( { - action: 'Add Indicator', + action: 'Add Indicator Bot Instance', actionFunction: payload.onMenuItemClick, - label: 'Add Indicator', + label: 'Add Indicator Bot Instance', visible: true, relatedUiObject: 'Indicator Bot Instance', rawRadius: 8, @@ -797,9 +797,9 @@ function newUiObjectConstructor () { ) menuItemsInitialValues.push( { - action: 'Add Trading Engine', + action: 'Add Trading Bot Instance', actionFunction: payload.onMenuItemClick, - label: 'Add Trading Engine', + label: 'Add Trading Bot Instance', visible: true, relatedUiObject: 'Trading Bot Instance', rawRadius: 8, @@ -862,9 +862,9 @@ function newUiObjectConstructor () { ) menuItemsInitialValues.push( { - action: 'Edit Sensor', + action: 'Edit Sensor Bot Instance', actionFunction: uiObject.codeEditor.activate, - label: 'Edit Sensor', + label: 'Edit Sensor Bot Instance', visible: true, iconPathOn: 'html', iconPathOff: 'html', @@ -877,11 +877,11 @@ function newUiObjectConstructor () { ) menuItemsInitialValues.push( { - action: 'Delete Sensor', + action: 'Delete Sensor Bot Instance', askConfirmation: true, confirmationLabel: 'Confirm to Delete', actionFunction: payload.onMenuItemClick, - label: 'Delete Sensor', + label: 'Delete Sensor Bot Instance', visible: true, iconPathOn: 'delete', iconPathOff: 'delete', @@ -929,9 +929,9 @@ function newUiObjectConstructor () { ) menuItemsInitialValues.push( { - action: 'Edit Indicator', + action: 'Edit Indicator Bot Instance', actionFunction: uiObject.codeEditor.activate, - label: 'Edit Indicator', + label: 'Edit Indicator Bot Instance', visible: true, iconPathOn: 'html', iconPathOff: 'html', @@ -944,11 +944,11 @@ function newUiObjectConstructor () { ) menuItemsInitialValues.push( { - action: 'Delete Indicator', + action: 'Delete Indicator Bot Instance', askConfirmation: true, confirmationLabel: 'Confirm to Delete', actionFunction: payload.onMenuItemClick, - label: 'Delete Indicator', + label: 'Delete Indicator Bot Instance', visible: true, iconPathOn: 'delete', iconPathOff: 'delete', @@ -996,9 +996,9 @@ function newUiObjectConstructor () { ) menuItemsInitialValues.push( { - action: 'Edit Trading Engine', + action: 'Edit Trading Bot Instance', actionFunction: uiObject.codeEditor.activate, - label: 'Edit Trading Engine', + label: 'Edit Trading Bot Instance', visible: true, iconPathOn: 'html', iconPathOff: 'html', @@ -1011,11 +1011,11 @@ function newUiObjectConstructor () { ) menuItemsInitialValues.push( { - action: 'Delete Trading Engine', + action: 'Delete Trading Bot Instance', askConfirmation: true, confirmationLabel: 'Confirm to Delete', actionFunction: payload.onMenuItemClick, - label: 'Delete Trading Engine', + label: 'Delete Trading Bot Instance', visible: true, iconPathOn: 'delete', iconPathOff: 'delete', diff --git a/StrategySpace/Workspace/Workspace.js b/StrategySpace/Workspace/Workspace.js index 790459499..a6850f292 100644 --- a/StrategySpace/Workspace/Workspace.js +++ b/StrategySpace/Workspace/Workspace.js @@ -364,17 +364,17 @@ function newWorkspace () { functionLibraryPartsFromNodes.addTask(payload.node) } break - case 'Add Sensor': + case 'Add Sensor Bot Instance': { functionLibraryPartsFromNodes.addSensor(payload.node) } break - case 'Add Indicator': + case 'Add Indicator Bot Instance': { functionLibraryPartsFromNodes.addIndicator(payload.node) } break - case 'Add Trading Engine': + case 'Add Trading Bot Instance': { functionLibraryPartsFromNodes.addTradingEngine(payload.node) } @@ -540,15 +540,15 @@ function newWorkspace () { functionLibraryNodeDeleter.deleteTask(payload.node, thisObject.workspaceNode.rootNodes) break } - case 'Delete Sensor': { + case 'Delete Sensor Bot Instance': { functionLibraryNodeDeleter.deleteSensor(payload.node, thisObject.workspaceNode.rootNodes) break } - case 'Delete Indicator': { + case 'Delete Indicator Bot Instance': { functionLibraryNodeDeleter.deleteIndicator(payload.node, thisObject.workspaceNode.rootNodes) break } - case 'Delete Trading Engine': { + case 'Delete Trading Bot Instance': { functionLibraryNodeDeleter.deleteTradingEngine(payload.node, thisObject.workspaceNode.rootNodes) break } diff --git a/Utilities/RoundedCornersBackground.js b/Utilities/RoundedCornersBackground.js index a940c81c8..557f1de72 100644 --- a/Utilities/RoundedCornersBackground.js +++ b/Utilities/RoundedCornersBackground.js @@ -1,6 +1,7 @@ function roundedCornersBackground (params) { + if (params.xOffset === undefined) { params.xOffset = 0 } borderPoint1 = { - x: params.cornerRadius, + x: params.cornerRadius + params.xOffset, y: params.cornerRadius } @@ -15,7 +16,7 @@ function roundedCornersBackground (params) { } borderPoint4 = { - x: params.cornerRadius, + x: params.cornerRadius + params.xOffset, y: params.container.frame.height - params.cornerRadius } From d419d91e6d8c1085d3da51d42e319893490688fe Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sun, 27 Oct 2019 12:48:16 +0100 Subject: [PATCH 12/95] Refactoring remaining sensor, indicator and tradingengine stuff --- Panels/ProductsPanel.js | 12 +++++----- .../FunctionLibraries/NodeChildren.js | 12 +++++----- .../FunctionLibraries/NodeDeleter.js | 16 +++++++------- .../FunctionLibraries/PartsFromNodes.js | 12 +++++----- StrategySpace/Workspace/Workspace.js | 22 +++++++++---------- 5 files changed, 37 insertions(+), 37 deletions(-) diff --git a/Panels/ProductsPanel.js b/Panels/ProductsPanel.js index f2c146ea1..90612acd2 100644 --- a/Panels/ProductsPanel.js +++ b/Panels/ProductsPanel.js @@ -278,16 +278,16 @@ function newProductsPanel () { } /* Then we get an Array of all instances of this bot placed at Definitions on the Workspace. */ - let tradingEngineInstances = canvas.strategySpace.workspace.getAllTradingEngines() + let tradingBotInstances = canvas.strategySpace.workspace.getAllTradingBotInstances() /* Here we will go through all the instances of trading engines and see their layers, to see if we can find a matching layer. */ - for (let n = 0; n < tradingEngineInstances.length; n++) { - let tradingEngine = tradingEngineInstances[n] + for (let n = 0; n < tradingBotInstances.length; n++) { + let tradingBotInstance = tradingBotInstances[n] let code try { - code = JSON.parse(tradingEngine.code) + code = JSON.parse(tradingBotInstance.code) } catch (err) { // if we can not parse this, then we ignore this trading engine. } @@ -303,8 +303,8 @@ function newProductsPanel () { /* We found an instance of the same Trading Engine we are currently looking at. Next thing to do is to see its layers to see if we can match it with the current product. */ - for (let m = 0; m < tradingEngine.processes.length; m++) { - let process = tradingEngine.processes[m] + for (let m = 0; m < tradingBotInstance.processes.length; m++) { + let process = tradingBotInstance.processes[m] if (process.session !== undefined) { if (process.session.layerManager !== undefined) { let layerManager = process.session.layerManager diff --git a/StrategySpace/Workspace/FunctionLibraries/NodeChildren.js b/StrategySpace/Workspace/FunctionLibraries/NodeChildren.js index b2d06ade9..eb7fdb677 100644 --- a/StrategySpace/Workspace/FunctionLibraries/NodeChildren.js +++ b/StrategySpace/Workspace/FunctionLibraries/NodeChildren.js @@ -39,13 +39,13 @@ function newNodeChildren () { return countChildrenTask(parentNode, childNode) } case 'Sensor Bot Instance': { - return countChildrenSensor(parentNode, childNode) + return countChildrenSensorBotInstance(parentNode, childNode) } case 'Indicator Bot Instance': { - return countChildrenIndicator(parentNode, childNode) + return countChildrenIndicatorBotInstance(parentNode, childNode) } case 'Trading Bot Instance': { - return countChildrenTradingEngine(parentNode, childNode) + return countChildrenTradingBotInstance(parentNode, childNode) } case 'Process': { return countChildrenProcess(parentNode, childNode) @@ -324,7 +324,7 @@ function newNodeChildren () { return response } - function countChildrenSensor (parentNode, childNode) { + function countChildrenSensorBotInstance (parentNode, childNode) { let response = { childrenCount: 0, childIndex: undefined @@ -340,7 +340,7 @@ function newNodeChildren () { return response } - function countChildrenIndicator (parentNode, childNode) { + function countChildrenIndicatorBotInstance (parentNode, childNode) { let response = { childrenCount: 0, childIndex: undefined @@ -356,7 +356,7 @@ function newNodeChildren () { return response } - function countChildrenTradingEngine (parentNode, childNode) { + function countChildrenTradingBotInstance (parentNode, childNode) { let response = { childrenCount: 0, childIndex: undefined diff --git a/StrategySpace/Workspace/FunctionLibraries/NodeDeleter.js b/StrategySpace/Workspace/FunctionLibraries/NodeDeleter.js index a0dae3144..8c449f999 100644 --- a/StrategySpace/Workspace/FunctionLibraries/NodeDeleter.js +++ b/StrategySpace/Workspace/FunctionLibraries/NodeDeleter.js @@ -10,9 +10,9 @@ function newNodeDeleter () { deleteLayer: deleteLayer, deleteTaskManager: deleteTaskManager, deleteTask: deleteTask, - deleteSensor: deleteBot, - deleteIndicator: deleteBot, - deleteTradingEngine: deleteBot, + deleteSensorBotInstance: deleteBotInstance, + deleteIndicatorBotInstance: deleteBotInstance, + deleteTradingBotInstance: deleteBotInstance, deleteProcess: deleteProcess, deletePersonalData: deletePersonalData, deleteExchangeAccount: deleteExchangeAccount, @@ -102,15 +102,15 @@ function newNodeDeleter () { break } case 'Sensor Bot Instance': { - deleteBot(rootNode, rootNodes) + deleteBotInstance(rootNode, rootNodes) break } case 'Indicator Bot Instance': { - deleteBot(rootNode, rootNodes) + deleteBotInstance(rootNode, rootNodes) break } case 'Trading Bot Instance': { - deleteBot(rootNode, rootNodes) + deleteBotInstance(rootNode, rootNodes) break } case 'Process': { @@ -455,14 +455,14 @@ function newNodeDeleter () { } } if (node.bot !== undefined) { - deleteBot(node.bot, rootNodes) + deleteBotInstance(node.bot, rootNodes) } completeDeletion(node, rootNodes) destroyPart(node) cleanNode(node) } - function deleteBot (node, rootNodes) { + function deleteBotInstance (node, rootNodes) { let payload = node.payload if (payload.parentNode !== undefined) { payload.parentNode.bot = undefined diff --git a/StrategySpace/Workspace/FunctionLibraries/PartsFromNodes.js b/StrategySpace/Workspace/FunctionLibraries/PartsFromNodes.js index 5190e6b9e..609510560 100644 --- a/StrategySpace/Workspace/FunctionLibraries/PartsFromNodes.js +++ b/StrategySpace/Workspace/FunctionLibraries/PartsFromNodes.js @@ -11,9 +11,9 @@ function newPartsFromNodes () { addLayer: addLayer, addTaskManager: addTaskManager, addTask: addTask, - addSensor: addSensor, - addIndicator: addIndicator, - addTradingEngine: addTradingEngine, + addSensorBotInstance: addSensorBotInstance, + addIndicatorBotInstance: addIndicatorBotInstance, + addTradingBotInstance: addTradingBotInstance, addProcess: addProcess, addBacktestingSession: addBacktestingSession, addLiveTradingSession: addLiveTradingSession, @@ -673,7 +673,7 @@ function newPartsFromNodes () { return task } - function addSensor (node) { + function addSensorBotInstance (node) { if (node.bot === undefined) { node.bot = { processes: [], @@ -684,7 +684,7 @@ function newPartsFromNodes () { return node.bot } - function addIndicator (node) { + function addIndicatorBotInstance (node) { if (node.bot === undefined) { node.bot = { processes: [], @@ -695,7 +695,7 @@ function newPartsFromNodes () { return node.bot } - function addTradingEngine (node) { + function addTradingBotInstance (node) { if (node.bot === undefined) { node.bot = { processes: [], diff --git a/StrategySpace/Workspace/Workspace.js b/StrategySpace/Workspace/Workspace.js index a6850f292..dd8dce224 100644 --- a/StrategySpace/Workspace/Workspace.js +++ b/StrategySpace/Workspace/Workspace.js @@ -13,7 +13,7 @@ function newWorkspace () { nodeChildren: undefined, getNodeThatIsOnFocus: getNodeThatIsOnFocus, getNodeByShortcutKey: getNodeByShortcutKey, - getAllTradingEngines: getAllTradingEngines, + getAllTradingBotInstances: getAllTradingBotInstances, stopAllRunningTasks: stopAllRunningTasks, onMenuItemClick: onMenuItemClick, physics: physics, @@ -165,8 +165,8 @@ function newWorkspace () { } } - function getAllTradingEngines () { - let tradingEngines = [] + function getAllTradingBotInstances () { + let tradingBotInstances = [] for (let i = 0; i < thisObject.workspaceNode.rootNodes.length; i++) { let rootNode = thisObject.workspaceNode.rootNodes[i] if (rootNode.type === 'Definition') { @@ -180,7 +180,7 @@ function newWorkspace () { for (k = 0; k < taskManager.tasks.length; k++) { let task = taskManager.tasks[k] if (task.bot.type === 'Trading Bot Instance') { - tradingEngines.push(task.bot) + tradingBotInstances.push(task.bot) } } } @@ -189,7 +189,7 @@ function newWorkspace () { } } } - return tradingEngines + return tradingBotInstances } function getNodeByShortcutKey (searchingKey) { @@ -366,17 +366,17 @@ function newWorkspace () { break case 'Add Sensor Bot Instance': { - functionLibraryPartsFromNodes.addSensor(payload.node) + functionLibraryPartsFromNodes.addSensorBotInstance(payload.node) } break case 'Add Indicator Bot Instance': { - functionLibraryPartsFromNodes.addIndicator(payload.node) + functionLibraryPartsFromNodes.addIndicatorBotInstance(payload.node) } break case 'Add Trading Bot Instance': { - functionLibraryPartsFromNodes.addTradingEngine(payload.node) + functionLibraryPartsFromNodes.addTradingBotInstance(payload.node) } break case 'Add Process': @@ -541,15 +541,15 @@ function newWorkspace () { break } case 'Delete Sensor Bot Instance': { - functionLibraryNodeDeleter.deleteSensor(payload.node, thisObject.workspaceNode.rootNodes) + functionLibraryNodeDeleter.deleteSensorBotInstance(payload.node, thisObject.workspaceNode.rootNodes) break } case 'Delete Indicator Bot Instance': { - functionLibraryNodeDeleter.deleteIndicator(payload.node, thisObject.workspaceNode.rootNodes) + functionLibraryNodeDeleter.deleteIndicatorBotInstance(payload.node, thisObject.workspaceNode.rootNodes) break } case 'Delete Trading Bot Instance': { - functionLibraryNodeDeleter.deleteTradingEngine(payload.node, thisObject.workspaceNode.rootNodes) + functionLibraryNodeDeleter.deleteTradingBotInstance(payload.node, thisObject.workspaceNode.rootNodes) break } case 'Delete Process': { From d078d1788115d38fe5d23cf7b77c6d2fb08d91e2 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sun, 27 Oct 2019 12:57:15 +0100 Subject: [PATCH 13/95] Ui Object Refactoring --- ...artsFromNodes.js => UiObjectsFromNodes.js} | 2 +- StrategySpace/Workspace/Workspace.js | 92 +++++++++---------- 2 files changed, 47 insertions(+), 47 deletions(-) rename StrategySpace/Workspace/FunctionLibraries/{PartsFromNodes.js => UiObjectsFromNodes.js} (99%) diff --git a/StrategySpace/Workspace/FunctionLibraries/PartsFromNodes.js b/StrategySpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js similarity index 99% rename from StrategySpace/Workspace/FunctionLibraries/PartsFromNodes.js rename to StrategySpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js index 609510560..c86e8507f 100644 --- a/StrategySpace/Workspace/FunctionLibraries/PartsFromNodes.js +++ b/StrategySpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js @@ -1,4 +1,4 @@ -function newPartsFromNodes () { +function newUiObjectsFromNodes () { thisObject = { createPartFromNode: createPartFromNode, addDefinition: addDefinition, diff --git a/StrategySpace/Workspace/Workspace.js b/StrategySpace/Workspace/Workspace.js index dd8dce224..ca1efbfc9 100644 --- a/StrategySpace/Workspace/Workspace.js +++ b/StrategySpace/Workspace/Workspace.js @@ -46,7 +46,7 @@ function newWorkspace () { let functionLibraryAttachDetach = newAttachDetach() let functionLibraryNodeDeleter = newNodeDeleter() - let functionLibraryPartsFromNodes = newPartsFromNodes() + let functionLibraryUiObjectsFromNodes = newUiObjectsFromNodes() let functionLibraryProtocolNode = newProtocolNode() let functionLibraryTaskFunctions = newTaskFunctions() let functionLibrarySessionFunctions = newSessionFunctions() @@ -78,15 +78,15 @@ function newWorkspace () { if (savedWorkspace === null || idAtStrategizer === null) { thisObject.workspaceNode.type = 'Workspace' thisObject.workspaceNode.name = 'My Workspace' - functionLibraryPartsFromNodes.createPartFromNode(thisObject.workspaceNode, undefined, undefined) + functionLibraryUiObjectsFromNodes.createPartFromNode(thisObject.workspaceNode, undefined, undefined) spawnPosition.y = spawnPosition.y + 250 initializeLoadingFromStrategizer() } else { thisObject.workspaceNode = JSON.parse(savedWorkspace) - functionLibraryPartsFromNodes.createPartFromNode(thisObject.workspaceNode, undefined, undefined) + functionLibraryUiObjectsFromNodes.createPartFromNode(thisObject.workspaceNode, undefined, undefined) for (let i = 0; i < thisObject.workspaceNode.rootNodes.length; i++) { let rootNode = thisObject.workspaceNode.rootNodes[i] - functionLibraryPartsFromNodes.createPartFromNode(rootNode, undefined, undefined) + functionLibraryUiObjectsFromNodes.createPartFromNode(rootNode, undefined, undefined) } thisObject.enabled = true } @@ -100,7 +100,7 @@ function newWorkspace () { if (result === true) { thisObject.definition = canvas.strategySpace.strategizerGateway.strategizerData thisObject.workspaceNode.rootNodes.push(thisObject.definition) - functionLibraryPartsFromNodes.createPartFromNode(thisObject.definition, undefined, undefined) + functionLibraryUiObjectsFromNodes.createPartFromNode(thisObject.definition, undefined, undefined) thisObject.enabled = true } @@ -222,15 +222,15 @@ function newWorkspace () { stopAllRunningTasks() functionLibraryNodeDeleter.deleteWorkspace(thisObject.workspaceNode, thisObject.workspaceNode.rootNodes) thisObject.workspaceNode = droppedNode - functionLibraryPartsFromNodes.createPartFromNode(thisObject.workspaceNode, undefined, undefined) + functionLibraryUiObjectsFromNodes.createPartFromNode(thisObject.workspaceNode, undefined, undefined) for (let i = 0; i < thisObject.workspaceNode.rootNodes.length; i++) { let rootNode = thisObject.workspaceNode.rootNodes[i] - functionLibraryPartsFromNodes.createPartFromNode(rootNode, undefined, undefined) + functionLibraryUiObjectsFromNodes.createPartFromNode(rootNode, undefined, undefined) } } else { let rootNode = functionLibraryProtocolNode.getProtocolNode(droppedNode) thisObject.workspaceNode.rootNodes.push(rootNode) - functionLibraryPartsFromNodes.createPartFromNode(rootNode, undefined, undefined) + functionLibraryUiObjectsFromNodes.createPartFromNode(rootNode, undefined, undefined) } } catch (err) { if (ERROR_LOG === true) { logger.write('[ERROR] spawn -> err = ' + err.stack) } @@ -316,192 +316,192 @@ function newWorkspace () { break case 'Add Definition': { - functionLibraryPartsFromNodes.addDefinition(payload.node) + functionLibraryUiObjectsFromNodes.addDefinition(payload.node) } break case 'Add Network': { - functionLibraryPartsFromNodes.addNetwork(payload.node) + functionLibraryUiObjectsFromNodes.addNetwork(payload.node) } break case 'Add Network Node': { - functionLibraryPartsFromNodes.addNetworkNode(payload.node) + functionLibraryUiObjectsFromNodes.addNetworkNode(payload.node) } break case 'Add Social Bots': { - functionLibraryPartsFromNodes.addSocialBots(payload.node) + functionLibraryUiObjectsFromNodes.addSocialBots(payload.node) } break case 'Add Telegram Bot': { - functionLibraryPartsFromNodes.addTelegramBot(payload.node) + functionLibraryUiObjectsFromNodes.addTelegramBot(payload.node) } break case 'Add Announcement': { - functionLibraryPartsFromNodes.addAnnouncement(payload.node) + functionLibraryUiObjectsFromNodes.addAnnouncement(payload.node) } break case 'Add Layer Manager': { - functionLibraryPartsFromNodes.addLayerManager(payload.node) + functionLibraryUiObjectsFromNodes.addLayerManager(payload.node) } break case 'Add Layer': { - functionLibraryPartsFromNodes.addLayer(payload.node) + functionLibraryUiObjectsFromNodes.addLayer(payload.node) } break case 'Add Task Manager': { - functionLibraryPartsFromNodes.addTaskManager(payload.node) + functionLibraryUiObjectsFromNodes.addTaskManager(payload.node) } break case 'Add Task': { - functionLibraryPartsFromNodes.addTask(payload.node) + functionLibraryUiObjectsFromNodes.addTask(payload.node) } break case 'Add Sensor Bot Instance': { - functionLibraryPartsFromNodes.addSensorBotInstance(payload.node) + functionLibraryUiObjectsFromNodes.addSensorBotInstance(payload.node) } break case 'Add Indicator Bot Instance': { - functionLibraryPartsFromNodes.addIndicatorBotInstance(payload.node) + functionLibraryUiObjectsFromNodes.addIndicatorBotInstance(payload.node) } break case 'Add Trading Bot Instance': { - functionLibraryPartsFromNodes.addTradingBotInstance(payload.node) + functionLibraryUiObjectsFromNodes.addTradingBotInstance(payload.node) } break case 'Add Process': { - functionLibraryPartsFromNodes.addProcess(payload.node) + functionLibraryUiObjectsFromNodes.addProcess(payload.node) } break case 'Add Backtesting Session': { - functionLibraryPartsFromNodes.addBacktestingSession(payload.node) + functionLibraryUiObjectsFromNodes.addBacktestingSession(payload.node) } break case 'Add Live Trading Session': { - functionLibraryPartsFromNodes.addLiveTradingSession(payload.node) + functionLibraryUiObjectsFromNodes.addLiveTradingSession(payload.node) } break case 'Add Fordward Testing Session': { - functionLibraryPartsFromNodes.addFordwardTestingSession(payload.node) + functionLibraryUiObjectsFromNodes.addFordwardTestingSession(payload.node) } break case 'Add Paper Trading Session': { - functionLibraryPartsFromNodes.addPaperTradingSession(payload.node) + functionLibraryUiObjectsFromNodes.addPaperTradingSession(payload.node) } break case 'Add Strategy': { - functionLibraryPartsFromNodes.addStrategy(payload.node) + functionLibraryUiObjectsFromNodes.addStrategy(payload.node) } break case 'Add Parameters': { - functionLibraryPartsFromNodes.addParameters(payload.node) + functionLibraryUiObjectsFromNodes.addParameters(payload.node) } break case 'Add Missing Parameters': { - functionLibraryPartsFromNodes.addMissingParameters(payload.node) + functionLibraryUiObjectsFromNodes.addMissingParameters(payload.node) } break case 'Add Missing Stages': { - functionLibraryPartsFromNodes.addMissingStages(payload.node) + functionLibraryUiObjectsFromNodes.addMissingStages(payload.node) } break case 'Add Missing Events': { - functionLibraryPartsFromNodes.addMissingEvents(payload.node) + functionLibraryUiObjectsFromNodes.addMissingEvents(payload.node) } break case 'Add Missing Items': { - functionLibraryPartsFromNodes.addMissingItems(payload.node) + functionLibraryUiObjectsFromNodes.addMissingItems(payload.node) } break case 'Add Initial Definition': { - functionLibraryPartsFromNodes.addInitialDefinition(payload.node) + functionLibraryUiObjectsFromNodes.addInitialDefinition(payload.node) } break case 'Add Open Execution': { - functionLibraryPartsFromNodes.addOpenExecution(payload.node) + functionLibraryUiObjectsFromNodes.addOpenExecution(payload.node) } break case 'Add Close Execution': { - functionLibraryPartsFromNodes.addCloseExecution(payload.node) + functionLibraryUiObjectsFromNodes.addCloseExecution(payload.node) } break case 'Add Phase': { - functionLibraryPartsFromNodes.addPhase(payload.node) + functionLibraryUiObjectsFromNodes.addPhase(payload.node) } break case 'Add Formula': { - functionLibraryPartsFromNodes.addFormula(payload.node) + functionLibraryUiObjectsFromNodes.addFormula(payload.node) } break case 'Add Next Phase Event': { - functionLibraryPartsFromNodes.addNextPhaseEvent(payload.node) + functionLibraryUiObjectsFromNodes.addNextPhaseEvent(payload.node) } break case 'Add Situation': { - functionLibraryPartsFromNodes.addSituation(payload.node) + functionLibraryUiObjectsFromNodes.addSituation(payload.node) } break case 'Add Condition': { - functionLibraryPartsFromNodes.addCondition(payload.node) + functionLibraryUiObjectsFromNodes.addCondition(payload.node) } break case 'Add Code': { - functionLibraryPartsFromNodes.addCode(payload.node) + functionLibraryUiObjectsFromNodes.addCode(payload.node) } break case 'Add Exchange Account': { - functionLibraryPartsFromNodes.addExchangeAccount(payload.node) + functionLibraryUiObjectsFromNodes.addExchangeAccount(payload.node) } break case 'Add Exchange Account Asset': { - functionLibraryPartsFromNodes.addExchangeAccountAsset(payload.node) + functionLibraryUiObjectsFromNodes.addExchangeAccountAsset(payload.node) } break case 'Add Exchange Account Key': { - functionLibraryPartsFromNodes.addExchangeAccountKey(payload.node) + functionLibraryUiObjectsFromNodes.addExchangeAccountKey(payload.node) } break case 'Add Trading System': { - functionLibraryPartsFromNodes.addTradingSystem(payload.node) + functionLibraryUiObjectsFromNodes.addTradingSystem(payload.node) } break case 'Add Personal Data': { - functionLibraryPartsFromNodes.addPersonalData(payload.node) + functionLibraryUiObjectsFromNodes.addPersonalData(payload.node) } break case 'Delete Network': { From f13700287e9c1181aae3800522ba17d5bbb80bcd Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sun, 27 Oct 2019 13:15:27 +0100 Subject: [PATCH 14/95] Designer Space Refactoring --- Canvas.js | 24 +-- Dashboard.js | 2 +- .../StrategizerGateway.js | 188 +++++++++--------- .../FunctionLibraries/AttachDetach.js | 0 .../FunctionLibraries/NodeChildren.js | 0 .../FunctionLibraries/NodeDeleter.js | 0 .../Workspace/FunctionLibraries/OnFocus.js | 0 .../FunctionLibraries/ProtocolNode.js | 0 .../FunctionLibraries/SessionFunctions.js | 0 .../FunctionLibraries/ShortcutKeys.js | 0 .../FunctionLibraries/TaskFunctions.js | 0 .../FunctionLibraries/UiObjectsFromNodes.js | 2 +- .../Workspace/Workspace.js | 4 +- FloatingSpace/CircularMenuItem.js | 12 +- FloatingSpace/FloatingObject.js | 2 +- FloatingSpace/UiObject.js | 8 +- Panels/ProductsPanel.js | 2 +- Spaces/CockpitSpace.js | 10 +- Spaces/{StrategySpace.js => DesignerSpace.js} | 2 +- 19 files changed, 128 insertions(+), 128 deletions(-) rename {StrategySpace => DesignerSpace}/StrategizerGateway.js (96%) rename {StrategySpace => DesignerSpace}/Workspace/FunctionLibraries/AttachDetach.js (100%) rename {StrategySpace => DesignerSpace}/Workspace/FunctionLibraries/NodeChildren.js (100%) rename {StrategySpace => DesignerSpace}/Workspace/FunctionLibraries/NodeDeleter.js (100%) rename {StrategySpace => DesignerSpace}/Workspace/FunctionLibraries/OnFocus.js (100%) rename {StrategySpace => DesignerSpace}/Workspace/FunctionLibraries/ProtocolNode.js (100%) rename {StrategySpace => DesignerSpace}/Workspace/FunctionLibraries/SessionFunctions.js (100%) rename {StrategySpace => DesignerSpace}/Workspace/FunctionLibraries/ShortcutKeys.js (100%) rename {StrategySpace => DesignerSpace}/Workspace/FunctionLibraries/TaskFunctions.js (100%) rename {StrategySpace => DesignerSpace}/Workspace/FunctionLibraries/UiObjectsFromNodes.js (99%) rename {StrategySpace => DesignerSpace}/Workspace/Workspace.js (99%) rename Spaces/{StrategySpace.js => DesignerSpace.js} (99%) diff --git a/Canvas.js b/Canvas.js index 843b27b8d..3de02826b 100644 --- a/Canvas.js +++ b/Canvas.js @@ -37,7 +37,7 @@ function newCanvas () { panelsSpace: undefined, cockpitSpace: undefined, bottomSpace: undefined, - strategySpace: undefined, + designerSpace: undefined, animation: undefined, initialize: initialize, finalize: finalize @@ -90,8 +90,8 @@ function newCanvas () { thisObject.topSpace = newTopSpace() await thisObject.topSpace.initialize() - thisObject.strategySpace = newStrategySpace() - await thisObject.strategySpace.initialize() + thisObject.designerSpace = newDesignerSpace() + await thisObject.designerSpace.initialize() thisObject.cockpitSpace = newCockpitSpace() thisObject.cockpitSpace.initialize() @@ -125,7 +125,7 @@ function newCanvas () { animation.addCallBackFunction('Floating Space Physics', thisObject.floatingSpace.physics) animation.addCallBackFunction('Chart Space Physics', thisObject.chartSpace.physics) animation.addCallBackFunction('CockpitSpace Physics', thisObject.cockpitSpace.physics) - animation.addCallBackFunction('Strategy Space Physics', thisObject.strategySpace.physics) + animation.addCallBackFunction('Strategy Space Physics', thisObject.designerSpace.physics) animation.addCallBackFunction('Panels Space Physics', thisObject.panelsSpace.physics) /* Spcaces Drawing */ @@ -136,7 +136,7 @@ function newCanvas () { animation.addCallBackFunction('ViewPort Animate', viewPort.animate) animation.addCallBackFunction('CockpitSpace Draw', thisObject.cockpitSpace.draw) animation.addCallBackFunction('Top Space Draw', thisObject.topSpace.draw) - animation.addCallBackFunction('Strategy Space Draw', thisObject.strategySpace.draw) + animation.addCallBackFunction('Strategy Space Draw', thisObject.designerSpace.draw) animation.addCallBackFunction('Splash Screen Draw', splashScreen.draw) animation.start() } catch (err) { @@ -190,7 +190,7 @@ function newCanvas () { } function onKeyDown (event) { - let nodeOnFocus = canvas.strategySpace.workspace.getNodeThatIsOnFocus() + let nodeOnFocus = canvas.designerSpace.workspace.getNodeThatIsOnFocus() if (nodeOnFocus !== undefined) { if (nodeOnFocus.payload.uiObject.codeEditor !== undefined) { if (nodeOnFocus.payload.uiObject.codeEditor.visible === true) { @@ -266,7 +266,7 @@ function newCanvas () { /* From here we prevent the default behaviour */ event.preventDefault() - let nodeUsingThisKey = canvas.strategySpace.workspace.getNodeByShortcutKey(event.key) + let nodeUsingThisKey = canvas.designerSpace.workspace.getNodeByShortcutKey(event.key) if (nodeOnFocus === undefined && nodeUsingThisKey !== undefined) { /* Then we displace the whole workspace to center it at the node using this key */ @@ -349,7 +349,7 @@ function newCanvas () { x: event.x, y: event.y } - thisObject.strategySpace.workspace.spawn(reader.result, mousePosition) + thisObject.designerSpace.workspace.spawn(reader.result, mousePosition) } } } catch (err) { @@ -372,7 +372,7 @@ function newCanvas () { /* We check if the mouse is over an element of the Strategy Space / */ - container = thisObject.strategySpace.getContainer(point) + container = thisObject.designerSpace.getContainer(point) if (container !== undefined && container.isDraggeable === true) { containerBeingDragged = container @@ -478,7 +478,7 @@ function newCanvas () { /* We check if the mouse is over an element of the Strategy Space / */ - container = thisObject.strategySpace.getContainer(point) + container = thisObject.designerSpace.getContainer(point) if (container !== undefined && container.isClickeable === true) { container.eventHandler.raiseEvent('onMouseClick', point) @@ -607,8 +607,8 @@ function newCanvas () { /* We check if the mouse is over an element of the Strategy Space / */ - if (thisObject.strategySpace !== undefined) { - container = thisObject.strategySpace.getContainer(point) + if (thisObject.designerSpace !== undefined) { + container = thisObject.designerSpace.getContainer(point) if (container !== undefined && container.detectMouseOver === true) { containerFound() diff --git a/Dashboard.js b/Dashboard.js index f6d435b22..5e0d85852 100644 --- a/Dashboard.js +++ b/Dashboard.js @@ -106,7 +106,7 @@ function newDashboard () { function setBrowserEvents () { window.onbeforeunload = onBrowserClosed function onBrowserClosed () { - canvas.strategySpace.workspace.stopAllRunningTasks() + canvas.designerSpace.workspace.stopAllRunningTasks() } } } diff --git a/StrategySpace/StrategizerGateway.js b/DesignerSpace/StrategizerGateway.js similarity index 96% rename from StrategySpace/StrategizerGateway.js rename to DesignerSpace/StrategizerGateway.js index bcf8644bb..2b626447f 100644 --- a/StrategySpace/StrategizerGateway.js +++ b/DesignerSpace/StrategizerGateway.js @@ -1,95 +1,95 @@ - -function newStrategizerGateway () { - const MODULE_NAME = 'Strategizer Gateway' - const logger = newWebDebugLog() - logger.fileName = MODULE_NAME - - let thisObject = { - idAtStrategizer: undefined, - strategizerData: undefined, - container: undefined, - loadFromStrategyzer: loadFromStrategyzer - } - - let colletionItems = [] - - thisObject.container = newContainer() - thisObject.container.name = MODULE_NAME - thisObject.container.initialize() - - thisObject.container.frame.width = 0 - thisObject.container.frame.height = 0 - - thisObject.container.frame.position.x = 0 - thisObject.container.frame.position.y = 0 - - thisObject.container.isDraggeable = false - thisObject.container.isClickeable = false - - let graphQLServer - - return thisObject - - async function loadFromStrategyzer () { - try { - const accessToken = window.localStorage.getItem(LOGGED_IN_ACCESS_TOKEN_LOCAL_STORAGE_KEY) - if (accessToken === null) { - logger.write('[ERROR] loadFromStrategyzer -> Can load from strategizer because the accessToken is missing.') - return - } - - let user = window.localStorage.getItem(LOGGED_IN_USER_LOCAL_STORAGE_KEY) - if (user === null) { - logger.write('[ERROR] saveToStrategyzer -> Can not load from strategizer because user is not logged in. ') - return - } - - user = JSON.parse(user) - - if (window.canvasApp.executingAt === 'Local') { - window.localStorage.setItem(CANVAS_APP_NAME + '.' + MODULE_NAME + '.' + user.alias, 'Local File') - thisObject.strategizerData = JSON.parse('{"type":"Definition"}') - thisObject.idAtStrategizer = 'Local File' - return true - } else { - let fbSlug = 'simulator-bot-' + user.alias.replace('.', '') - - graphQLServer = await axios({ - url: window.canvasApp.graphQL.masterAppApiUrl, - method: 'post', - data: { - query: - ` - query($fbSlug: String!){ - strategizer_TradingSystemByFb(fbSlug: $fbSlug){ - id - fbSlug - data - } - } - `, - - variables: { - fbSlug: fbSlug - } - }, - headers: { - authorization: 'Bearer ' + accessToken - } - }) - - if (graphQLServer.data.errors) { - logger.write('[ERROR] loadFromStrategyzer -> GraphQL Error: ' + JSON.stringify(graphQLServer.data.errors)) - return false - } else { - thisObject.strategizerData = JSON.parse(JSON.stringify(graphQLServer.data.data.strategizer_TradingSystemByFb.data)) - thisObject.idAtStrategizer = graphQLServer.data.data.strategizer_TradingSystemByFb.id - window.localStorage.setItem(CANVAS_APP_NAME + '.' + MODULE_NAME + '.' + user.alias, thisObject.idAtStrategizer) - return true - } - } - } catch (err) { - logger.write('[ERROR] loadFromStrategyzer -> err = ' + err.stack) - } + +function newStrategizerGateway () { + const MODULE_NAME = 'Strategizer Gateway' + const logger = newWebDebugLog() + logger.fileName = MODULE_NAME + + let thisObject = { + idAtStrategizer: undefined, + strategizerData: undefined, + container: undefined, + loadFromStrategyzer: loadFromStrategyzer } -} + + let colletionItems = [] + + thisObject.container = newContainer() + thisObject.container.name = MODULE_NAME + thisObject.container.initialize() + + thisObject.container.frame.width = 0 + thisObject.container.frame.height = 0 + + thisObject.container.frame.position.x = 0 + thisObject.container.frame.position.y = 0 + + thisObject.container.isDraggeable = false + thisObject.container.isClickeable = false + + let graphQLServer + + return thisObject + + async function loadFromStrategyzer () { + try { + const accessToken = window.localStorage.getItem(LOGGED_IN_ACCESS_TOKEN_LOCAL_STORAGE_KEY) + if (accessToken === null) { + logger.write('[ERROR] loadFromStrategyzer -> Can load from strategizer because the accessToken is missing.') + return + } + + let user = window.localStorage.getItem(LOGGED_IN_USER_LOCAL_STORAGE_KEY) + if (user === null) { + logger.write('[ERROR] saveToStrategyzer -> Can not load from strategizer because user is not logged in. ') + return + } + + user = JSON.parse(user) + + if (window.canvasApp.executingAt === 'Local') { + window.localStorage.setItem(CANVAS_APP_NAME + '.' + MODULE_NAME + '.' + user.alias, 'Local File') + thisObject.strategizerData = JSON.parse('{"type":"Definition"}') + thisObject.idAtStrategizer = 'Local File' + return true + } else { + let fbSlug = 'simulator-bot-' + user.alias.replace('.', '') + + graphQLServer = await axios({ + url: window.canvasApp.graphQL.masterAppApiUrl, + method: 'post', + data: { + query: + ` + query($fbSlug: String!){ + strategizer_TradingSystemByFb(fbSlug: $fbSlug){ + id + fbSlug + data + } + } + `, + + variables: { + fbSlug: fbSlug + } + }, + headers: { + authorization: 'Bearer ' + accessToken + } + }) + + if (graphQLServer.data.errors) { + logger.write('[ERROR] loadFromStrategyzer -> GraphQL Error: ' + JSON.stringify(graphQLServer.data.errors)) + return false + } else { + thisObject.strategizerData = JSON.parse(JSON.stringify(graphQLServer.data.data.strategizer_TradingSystemByFb.data)) + thisObject.idAtStrategizer = graphQLServer.data.data.strategizer_TradingSystemByFb.id + window.localStorage.setItem(CANVAS_APP_NAME + '.' + MODULE_NAME + '.' + user.alias, thisObject.idAtStrategizer) + return true + } + } + } catch (err) { + logger.write('[ERROR] loadFromStrategyzer -> err = ' + err.stack) + } + } +} diff --git a/StrategySpace/Workspace/FunctionLibraries/AttachDetach.js b/DesignerSpace/Workspace/FunctionLibraries/AttachDetach.js similarity index 100% rename from StrategySpace/Workspace/FunctionLibraries/AttachDetach.js rename to DesignerSpace/Workspace/FunctionLibraries/AttachDetach.js diff --git a/StrategySpace/Workspace/FunctionLibraries/NodeChildren.js b/DesignerSpace/Workspace/FunctionLibraries/NodeChildren.js similarity index 100% rename from StrategySpace/Workspace/FunctionLibraries/NodeChildren.js rename to DesignerSpace/Workspace/FunctionLibraries/NodeChildren.js diff --git a/StrategySpace/Workspace/FunctionLibraries/NodeDeleter.js b/DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js similarity index 100% rename from StrategySpace/Workspace/FunctionLibraries/NodeDeleter.js rename to DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js diff --git a/StrategySpace/Workspace/FunctionLibraries/OnFocus.js b/DesignerSpace/Workspace/FunctionLibraries/OnFocus.js similarity index 100% rename from StrategySpace/Workspace/FunctionLibraries/OnFocus.js rename to DesignerSpace/Workspace/FunctionLibraries/OnFocus.js diff --git a/StrategySpace/Workspace/FunctionLibraries/ProtocolNode.js b/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js similarity index 100% rename from StrategySpace/Workspace/FunctionLibraries/ProtocolNode.js rename to DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js diff --git a/StrategySpace/Workspace/FunctionLibraries/SessionFunctions.js b/DesignerSpace/Workspace/FunctionLibraries/SessionFunctions.js similarity index 100% rename from StrategySpace/Workspace/FunctionLibraries/SessionFunctions.js rename to DesignerSpace/Workspace/FunctionLibraries/SessionFunctions.js diff --git a/StrategySpace/Workspace/FunctionLibraries/ShortcutKeys.js b/DesignerSpace/Workspace/FunctionLibraries/ShortcutKeys.js similarity index 100% rename from StrategySpace/Workspace/FunctionLibraries/ShortcutKeys.js rename to DesignerSpace/Workspace/FunctionLibraries/ShortcutKeys.js diff --git a/StrategySpace/Workspace/FunctionLibraries/TaskFunctions.js b/DesignerSpace/Workspace/FunctionLibraries/TaskFunctions.js similarity index 100% rename from StrategySpace/Workspace/FunctionLibraries/TaskFunctions.js rename to DesignerSpace/Workspace/FunctionLibraries/TaskFunctions.js diff --git a/StrategySpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js similarity index 99% rename from StrategySpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js rename to DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js index c86e8507f..4604a047c 100644 --- a/StrategySpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js +++ b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js @@ -1291,7 +1291,7 @@ function newUiObjectsFromNodes () { payload.node = node payload.parentNode = parentNode payload.chainParent = chainParent - payload.onMenuItemClick = canvas.strategySpace.workspace.onMenuItemClick + payload.onMenuItemClick = canvas.designerSpace.workspace.onMenuItemClick if (node.id === undefined) { node.id = newUniqueId() diff --git a/StrategySpace/Workspace/Workspace.js b/DesignerSpace/Workspace/Workspace.js similarity index 99% rename from StrategySpace/Workspace/Workspace.js rename to DesignerSpace/Workspace/Workspace.js index ca1efbfc9..af95304c9 100644 --- a/StrategySpace/Workspace/Workspace.js +++ b/DesignerSpace/Workspace/Workspace.js @@ -96,9 +96,9 @@ function newWorkspace () { } async function initializeLoadingFromStrategizer () { - let result = await canvas.strategySpace.strategizerGateway.loadFromStrategyzer() + let result = await canvas.designerSpace.strategizerGateway.loadFromStrategyzer() if (result === true) { - thisObject.definition = canvas.strategySpace.strategizerGateway.strategizerData + thisObject.definition = canvas.designerSpace.strategizerGateway.strategizerData thisObject.workspaceNode.rootNodes.push(thisObject.definition) functionLibraryUiObjectsFromNodes.createPartFromNode(thisObject.definition, undefined, undefined) diff --git a/FloatingSpace/CircularMenuItem.js b/FloatingSpace/CircularMenuItem.js index f810012bc..658fa6e92 100644 --- a/FloatingSpace/CircularMenuItem.js +++ b/FloatingSpace/CircularMenuItem.js @@ -167,15 +167,15 @@ function newCircularMenuItem () { temporaryStatus === STATUS_SECONDARY_WORK_FAILED ) && thisObject.secondaryAction !== undefined ) { - thisObject.iconOn = canvas.strategySpace.iconCollection.get(thisObject.secondaryIcon) - thisObject.iconOff = canvas.strategySpace.iconCollection.get(thisObject.secondaryIcon) + thisObject.iconOn = canvas.designerSpace.iconCollection.get(thisObject.secondaryIcon) + thisObject.iconOff = canvas.designerSpace.iconCollection.get(thisObject.secondaryIcon) } else { if (thisObject.relatedUiObject !== undefined) { - thisObject.iconOn = canvas.strategySpace.iconByPartType.get(thisObject.relatedUiObject) - thisObject.iconOff = canvas.strategySpace.iconByPartType.get(thisObject.relatedUiObject) + thisObject.iconOn = canvas.designerSpace.iconByPartType.get(thisObject.relatedUiObject) + thisObject.iconOff = canvas.designerSpace.iconByPartType.get(thisObject.relatedUiObject) } else { - thisObject.iconOn = canvas.strategySpace.iconCollection.get(thisObject.iconPathOn) - thisObject.iconOff = canvas.strategySpace.iconCollection.get(thisObject.iconPathOff) + thisObject.iconOn = canvas.designerSpace.iconCollection.get(thisObject.iconPathOn) + thisObject.iconOff = canvas.designerSpace.iconCollection.get(thisObject.iconPathOff) } } diff --git a/FloatingSpace/FloatingObject.js b/FloatingSpace/FloatingObject.js index ac7d40296..efc052f92 100644 --- a/FloatingSpace/FloatingObject.js +++ b/FloatingSpace/FloatingObject.js @@ -208,7 +208,7 @@ function newFloatingObject () { let parent = thisObject.payload.chainParent if (parent !== undefined) { let distanceToChainParent = Math.sqrt(Math.pow(parent.payload.position.x - thisObject.container.frame.position.x, 2) + Math.pow(parent.payload.position.y - thisObject.container.frame.position.y, 2)) // ... we calculate the distance ... - let parentChildren = canvas.strategySpace.workspace.nodeChildren.childrenCount(parent, thisObject.payload.node) + let parentChildren = canvas.designerSpace.workspace.nodeChildren.childrenCount(parent, thisObject.payload.node) let axisCount = parentChildren.childrenCount let axisIndex = parentChildren.childIndex let baseAngle = 0 diff --git a/FloatingSpace/UiObject.js b/FloatingSpace/UiObject.js index 284bcf250..62bfc16db 100644 --- a/FloatingSpace/UiObject.js +++ b/FloatingSpace/UiObject.js @@ -549,7 +549,7 @@ function newUiObject () { if (previousDistance !== undefined) { if (ratio > THRESHOLD) { - canvas.strategySpace.workspace.detachNode(thisObject.payload.node) + canvas.designerSpace.workspace.detachNode(thisObject.payload.node) } } } @@ -658,8 +658,8 @@ function newUiObject () { } function iconPhysics () { - icon = canvas.strategySpace.iconByPartType.get(thisObject.payload.node.type) - executingIcon = canvas.strategySpace.iconCollection.get('attractive') + icon = canvas.designerSpace.iconByPartType.get(thisObject.payload.node.type) + executingIcon = canvas.designerSpace.iconCollection.get('attractive') } function onFocus () { @@ -692,7 +692,7 @@ function newUiObject () { function onDragFinished (event) { if (isAttaching === true) { - canvas.strategySpace.workspace.attachNode(thisObject.payload.node, attachToNode) + canvas.designerSpace.workspace.attachNode(thisObject.payload.node, attachToNode) attachToNode = undefined isAttaching = false } diff --git a/Panels/ProductsPanel.js b/Panels/ProductsPanel.js index 90612acd2..a6cce9c60 100644 --- a/Panels/ProductsPanel.js +++ b/Panels/ProductsPanel.js @@ -278,7 +278,7 @@ function newProductsPanel () { } /* Then we get an Array of all instances of this bot placed at Definitions on the Workspace. */ - let tradingBotInstances = canvas.strategySpace.workspace.getAllTradingBotInstances() + let tradingBotInstances = canvas.designerSpace.workspace.getAllTradingBotInstances() /* Here we will go through all the instances of trading engines and see their layers, to see if we can find a matching layer. */ diff --git a/Spaces/CockpitSpace.js b/Spaces/CockpitSpace.js index dbf34cfef..453d5e779 100644 --- a/Spaces/CockpitSpace.js +++ b/Spaces/CockpitSpace.js @@ -45,7 +45,7 @@ thisObject.container.frame.position.x = 0 let INITIAL_POSITION - if (canvas.strategySpace.workspace.enabled === true) { + if (canvas.designerSpace.workspace.enabled === true) { let localStorage = window.localStorage.getItem(MODULE_NAME) if (localStorage !== null) { storage = JSON.parse(localStorage) @@ -100,7 +100,7 @@ thisObject.status = 'MIDDLE' - if (canvas.strategySpace.workspace.enabled === true) { + if (canvas.designerSpace.workspace.enabled === true) { thisObject.container.isDraggeable = true } else { thisObject.container.isDraggeable = false @@ -109,10 +109,10 @@ if (thisObject.container.frame.position.y > browserCanvas.height * 99.5 / 100 - COCKPIT_SPACE_HEIGHT) { thisObject.container.frame.position.y = browserCanvas.height - COCKPIT_SPACE_HEIGHT thisObject.status = 'BOTTOM' - canvas.strategySpace.makeInvisible() + canvas.designerSpace.makeInvisible() canvas.floatingSpace.makeInvisible() } else { - canvas.strategySpace.makeVisible() + canvas.designerSpace.makeVisible() canvas.floatingSpace.makeVisible() } @@ -184,7 +184,7 @@ browserCanvasContext.closePath() browserCanvasContext.fill() - if (canvas.strategySpace.workspace.enabled === true) { + if (canvas.designerSpace.workspace.enabled === true) { arrow() } } diff --git a/Spaces/StrategySpace.js b/Spaces/DesignerSpace.js similarity index 99% rename from Spaces/StrategySpace.js rename to Spaces/DesignerSpace.js index 791c74aeb..8200d897d 100644 --- a/Spaces/StrategySpace.js +++ b/Spaces/DesignerSpace.js @@ -1,5 +1,5 @@ -function newStrategySpace () { +function newDesignerSpace () { const MODULE_NAME = 'Strategy Space' let thisObject = { sidePanel: undefined, From b419d3cf92eaccd50c5bfff26af36a9fd8e7be35 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sun, 27 Oct 2019 13:40:40 +0100 Subject: [PATCH 15/95] Parts Final Refactorings --- Canvas.js | 4 +- .../FunctionLibraries/NodeDeleter.js | 94 ++-- .../FunctionLibraries/UiObjectsFromNodes.js | 436 +++++++++--------- DesignerSpace/Workspace/Workspace.js | 14 +- FloatingSpace/CircularMenuItem.js | 4 +- FloatingSpace/FloatingLayer.js | 2 +- FloatingSpace/UiObject.js | 32 +- FloatingSpace/UiObjectConstructor.js | 4 +- FloatingSpace/UiObjectTitle.js | 4 +- Spaces/DesignerSpace.js | 10 +- 10 files changed, 302 insertions(+), 302 deletions(-) diff --git a/Canvas.js b/Canvas.js index 3de02826b..329e35234 100644 --- a/Canvas.js +++ b/Canvas.js @@ -197,8 +197,8 @@ function newCanvas () { return } } - if (nodeOnFocus.payload.uiObject.partTitle !== undefined) { - if (nodeOnFocus.payload.uiObject.partTitle.editMode === true) { + if (nodeOnFocus.payload.uiObject.uiObjectTitle !== undefined) { + if (nodeOnFocus.payload.uiObject.uiObjectTitle.editMode === true) { return } } diff --git a/DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js b/DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js index 8c449f999..8454b4e0a 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js +++ b/DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js @@ -51,7 +51,7 @@ function newNodeDeleter () { return thisObject - function destroyPart (node) { + function destroyUiObject (node) { canvas.floatingSpace.uiObjectConstructor.destroyUiObject(node.payload) } @@ -266,7 +266,7 @@ function newNodeDeleter () { } completeDeletion(node, rootNodes) - destroyPart(node) + destroyUiObject(node) cleanNode(node) } @@ -296,7 +296,7 @@ function newNodeDeleter () { } completeDeletion(node, rootNodes) - destroyPart(node) + destroyUiObject(node) cleanNode(node) } @@ -314,7 +314,7 @@ function newNodeDeleter () { } completeDeletion(node, rootNodes) - destroyPart(node) + destroyUiObject(node) cleanNode(node) } @@ -337,7 +337,7 @@ function newNodeDeleter () { } completeDeletion(node, rootNodes) - destroyPart(node) + destroyUiObject(node) cleanNode(node) } @@ -352,7 +352,7 @@ function newNodeDeleter () { } } completeDeletion(node, rootNodes) - destroyPart(node) + destroyUiObject(node) cleanNode(node) } @@ -372,7 +372,7 @@ function newNodeDeleter () { } } completeDeletion(node, rootNodes) - destroyPart(node) + destroyUiObject(node) cleanNode(node) } @@ -390,7 +390,7 @@ function newNodeDeleter () { deleteFormula(node.formula, rootNodes) } completeDeletion(node, rootNodes) - destroyPart(node) + destroyUiObject(node) cleanNode(node) } @@ -405,7 +405,7 @@ function newNodeDeleter () { } } completeDeletion(node, rootNodes) - destroyPart(node) + destroyUiObject(node) cleanNode(node) } @@ -420,7 +420,7 @@ function newNodeDeleter () { } } completeDeletion(node, rootNodes) - destroyPart(node) + destroyUiObject(node) cleanNode(node) } @@ -440,7 +440,7 @@ function newNodeDeleter () { } } completeDeletion(node, rootNodes) - destroyPart(node) + destroyUiObject(node) cleanNode(node) } @@ -458,7 +458,7 @@ function newNodeDeleter () { deleteBotInstance(node.bot, rootNodes) } completeDeletion(node, rootNodes) - destroyPart(node) + destroyUiObject(node) cleanNode(node) } @@ -474,7 +474,7 @@ function newNodeDeleter () { } completeDeletion(node, rootNodes) - destroyPart(node) + destroyUiObject(node) cleanNode(node) } @@ -511,7 +511,7 @@ function newNodeDeleter () { } completeDeletion(node, rootNodes) - destroyPart(node) + destroyUiObject(node) cleanNode(node) } @@ -534,7 +534,7 @@ function newNodeDeleter () { deleteSocialBots(node.socialBots, rootNodes) } completeDeletion(node, rootNodes) - destroyPart(node) + destroyUiObject(node) cleanNode(node) } @@ -557,7 +557,7 @@ function newNodeDeleter () { deleteSocialBots(node.socialBots, rootNodes) } completeDeletion(node, rootNodes) - destroyPart(node) + destroyUiObject(node) cleanNode(node) } @@ -580,7 +580,7 @@ function newNodeDeleter () { deleteSocialBots(node.socialBots, rootNodes) } completeDeletion(node, rootNodes) - destroyPart(node) + destroyUiObject(node) cleanNode(node) } @@ -603,7 +603,7 @@ function newNodeDeleter () { deleteSocialBots(node.socialBots, rootNodes) } completeDeletion(node, rootNodes) - destroyPart(node) + destroyUiObject(node) cleanNode(node) } @@ -621,7 +621,7 @@ function newNodeDeleter () { } completeDeletion(node, rootNodes) - destroyPart(node) + destroyUiObject(node) cleanNode(node) } @@ -647,7 +647,7 @@ function newNodeDeleter () { } completeDeletion(node, rootNodes) - destroyPart(node) + destroyUiObject(node) cleanNode(node) } @@ -663,7 +663,7 @@ function newNodeDeleter () { } else { completeDeletion(node, rootNodes) } - destroyPart(node) + destroyUiObject(node) cleanNode(node) } @@ -684,7 +684,7 @@ function newNodeDeleter () { } else { completeDeletion(node, rootNodes) } - destroyPart(node) + destroyUiObject(node) cleanNode(node) } @@ -706,7 +706,7 @@ function newNodeDeleter () { } completeDeletion(node, rootNodes) - destroyPart(node) + destroyUiObject(node) cleanNode(node) } @@ -735,7 +735,7 @@ function newNodeDeleter () { if (node.key !== undefined) { deleteExchangeAccountKey(node.key, rootNodes) } - destroyPart(node) + destroyUiObject(node) cleanNode(node) } @@ -746,7 +746,7 @@ function newNodeDeleter () { } else { completeDeletion(node, rootNodes) } - destroyPart(node) + destroyUiObject(node) cleanNode(node) } @@ -757,7 +757,7 @@ function newNodeDeleter () { } else { completeDeletion(node, rootNodes) } - destroyPart(node) + destroyUiObject(node) cleanNode(node) } @@ -768,7 +768,7 @@ function newNodeDeleter () { } else { completeDeletion(node, rootNodes) } - destroyPart(node) + destroyUiObject(node) cleanNode(node) } @@ -779,7 +779,7 @@ function newNodeDeleter () { } else { completeDeletion(node, rootNodes) } - destroyPart(node) + destroyUiObject(node) cleanNode(node) } @@ -790,7 +790,7 @@ function newNodeDeleter () { } else { completeDeletion(node, rootNodes) } - destroyPart(node) + destroyUiObject(node) cleanNode(node) } @@ -818,7 +818,7 @@ function newNodeDeleter () { if (node.closeStage !== undefined) { deleteCloseStage(node.closeStage, rootNodes) } - destroyPart(node) + destroyUiObject(node) cleanNode(node) } @@ -838,7 +838,7 @@ function newNodeDeleter () { if (node.takePosition !== undefined) { deleteEvent(node.takePosition, rootNodes) } - destroyPart(node) + destroyUiObject(node) cleanNode(node) } @@ -857,7 +857,7 @@ function newNodeDeleter () { deleteOpenExecution(node.openExecution, rootNodes) } - destroyPart(node) + destroyUiObject(node) cleanNode(node) } @@ -874,7 +874,7 @@ function newNodeDeleter () { if (node.takeProfit !== undefined) { deleteManagedItem(node.takeProfit, rootNodes) } - destroyPart(node) + destroyUiObject(node) cleanNode(node) } @@ -888,7 +888,7 @@ function newNodeDeleter () { if (node.closeExecution !== undefined) { deleteCloseExecution(node.closeExecution, rootNodes) } - destroyPart(node) + destroyUiObject(node) cleanNode(node) } @@ -902,7 +902,7 @@ function newNodeDeleter () { if (node.formula !== undefined) { deleteFormula(node.formula, rootNodes) } - destroyPart(node) + destroyUiObject(node) cleanNode(node) } @@ -916,7 +916,7 @@ function newNodeDeleter () { if (node.formula !== undefined) { deleteFormula(node.formula, rootNodes) } - destroyPart(node) + destroyUiObject(node) cleanNode(node) } @@ -939,7 +939,7 @@ function newNodeDeleter () { if (node.positionRate !== undefined) { deletePositionSize(node.positionRate, rootNodes) } - destroyPart(node) + destroyUiObject(node) cleanNode(node) } @@ -950,7 +950,7 @@ function newNodeDeleter () { } else { completeDeletion(node, rootNodes) } - destroyPart(node) + destroyUiObject(node) cleanNode(node) } @@ -961,7 +961,7 @@ function newNodeDeleter () { } else { completeDeletion(node, rootNodes) } - destroyPart(node) + destroyUiObject(node) cleanNode(node) } @@ -1001,7 +1001,7 @@ function newNodeDeleter () { deleteAnnouncement(node.announcements[0], rootNodes) } } - destroyPart(node) + destroyUiObject(node) cleanNode(node) } @@ -1028,7 +1028,7 @@ function newNodeDeleter () { } } - destroyPart(node) + destroyUiObject(node) cleanNode(node) } @@ -1063,7 +1063,7 @@ function newNodeDeleter () { deleteAnnouncement(node.announcements[0], rootNodes) } } - destroyPart(node) + destroyUiObject(node) cleanNode(node) } @@ -1075,7 +1075,7 @@ function newNodeDeleter () { completeDeletion(node, rootNodes) } - destroyPart(node) + destroyUiObject(node) cleanNode(node) } @@ -1094,7 +1094,7 @@ function newNodeDeleter () { situation.conditions = [] payload.parentNode.situations.splice(j, 1) - destroyPart(situation) + destroyUiObject(situation) cleanNode(situation) return } @@ -1109,7 +1109,7 @@ function newNodeDeleter () { node.conditions = [] completeDeletion(node, rootNodes) - destroyPart(node) + destroyUiObject(node) cleanNode(node) } } @@ -1129,7 +1129,7 @@ function newNodeDeleter () { if (node.code !== undefined) { deleteCode(node.code, rootNodes) } - destroyPart(node) + destroyUiObject(node) cleanNode(node) } @@ -1141,7 +1141,7 @@ function newNodeDeleter () { completeDeletion(node, rootNodes) } - destroyPart(node) + destroyUiObject(node) cleanNode(node) } diff --git a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js index 4604a047c..47d2bf2e7 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js +++ b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js @@ -1,6 +1,6 @@ function newUiObjectsFromNodes () { thisObject = { - createPartFromNode: createPartFromNode, + createUiObjectFromNode: createUiObjectFromNode, addDefinition: addDefinition, addNetwork: addNetwork, addNetworkNode: addNetworkNode, @@ -43,74 +43,74 @@ function newUiObjectsFromNodes () { return thisObject - function createPartFromNode (node, parentNode, chainParent) { + function createUiObjectFromNode (node, parentNode, chainParent) { switch (node.type) { case 'Code': { - createPart('Code', node.name, node, parentNode, chainParent, 'Code') + createUiObject('Code', node.name, node, parentNode, chainParent, 'Code') return } case 'Condition': { - createPart('Condition', node.name, node, parentNode, chainParent, 'Condition') + createUiObject('Condition', node.name, node, parentNode, chainParent, 'Condition') if (node.code !== undefined) { - createPartFromNode(node.code, node, node) + createUiObjectFromNode(node.code, node, node) } return } case 'Situation': { let situation = node - createPart('Situation', situation.name, situation, parentNode, chainParent, 'Situation') + createUiObject('Situation', situation.name, situation, parentNode, chainParent, 'Situation') for (let m = 0; m < node.conditions.length; m++) { let condition = node.conditions[m] - createPartFromNode(condition, situation, situation) + createUiObjectFromNode(condition, situation, situation) } return } case 'Formula': { - createPart('Formula', node.name, node, parentNode, chainParent, 'Formula') + createUiObject('Formula', node.name, node, parentNode, chainParent, 'Formula') return } case 'Next Phase Event': { - createPart('Next Phase Event', node.name, node, parentNode, chainParent, 'Next Phase Event') + createUiObject('Next Phase Event', node.name, node, parentNode, chainParent, 'Next Phase Event') for (let m = 0; m < node.situations.length; m++) { let situation = node.situations[m] - createPartFromNode(situation, node, node) + createUiObjectFromNode(situation, node, node) } if (node.announcements === undefined) { node.announcements = [] } for (let m = 0; m < node.announcements.length; m++) { let announcement = node.announcements[m] - createPartFromNode(announcement, node, node) + createUiObjectFromNode(announcement, node, node) } return } case 'Phase': { let phase = node - createPart('Phase', phase.name, phase, parentNode, chainParent, phase.subType) + createUiObject('Phase', phase.name, phase, parentNode, chainParent, phase.subType) if (node.formula !== undefined) { - createPartFromNode(node.formula, phase, phase) + createUiObjectFromNode(node.formula, phase, phase) } if (node.nextPhaseEvent !== undefined) { - createPartFromNode(node.nextPhaseEvent, phase, phase) + createUiObjectFromNode(node.nextPhaseEvent, phase, phase) } if (node.announcements === undefined) { node.announcements = [] } for (let m = 0; m < node.announcements.length; m++) { let announcement = node.announcements[m] - createPartFromNode(announcement, node, node) + createUiObjectFromNode(announcement, node, node) } return } case 'Stop': { let lastPhase let stop = node - createPart('Stop', stop.name, stop, parentNode, chainParent, 'Stop') + createUiObject('Stop', stop.name, stop, parentNode, chainParent, 'Stop') for (let m = 0; m < node.phases.length; m++) { let phase = node.phases[m] let thisChainParent @@ -120,14 +120,14 @@ function newUiObjectsFromNodes () { thisChainParent = lastPhase } lastPhase = phase - createPartFromNode(phase, stop, thisChainParent) + createUiObjectFromNode(phase, stop, thisChainParent) } return } case 'Take Profit': { let lastPhase let takeProfit = node - createPart('Take Profit', takeProfit.name, takeProfit, parentNode, chainParent, 'Take Profit') + createUiObject('Take Profit', takeProfit.name, takeProfit, parentNode, chainParent, 'Take Profit') for (let m = 0; m < node.phases.length; m++) { let phase = node.phases[m] let thisChainParent @@ -137,355 +137,355 @@ function newUiObjectsFromNodes () { thisChainParent = lastPhase } lastPhase = phase - createPartFromNode(phase, takeProfit, thisChainParent) + createUiObjectFromNode(phase, takeProfit, thisChainParent) } return } case 'Open Execution': { - createPart('Open Execution', node.name, node, parentNode, chainParent, 'Open Execution') + createUiObject('Open Execution', node.name, node, parentNode, chainParent, 'Open Execution') return } case 'Close Execution': { - createPart('Close Execution', node.name, node, parentNode, chainParent, 'Close Execution') + createUiObject('Close Execution', node.name, node, parentNode, chainParent, 'Close Execution') return } case 'Initial Definition': { - createPart('Initial Definition', node.name, node, parentNode, chainParent, 'Initial Definition') + createUiObject('Initial Definition', node.name, node, parentNode, chainParent, 'Initial Definition') if (node.stopLoss !== undefined) { - createPartFromNode(node.stopLoss, node, node) + createUiObjectFromNode(node.stopLoss, node, node) } if (node.takeProfit !== undefined) { - createPartFromNode(node.takeProfit, node, node) + createUiObjectFromNode(node.takeProfit, node, node) } if (node.positionSize !== undefined) { - createPartFromNode(node.positionSize, node, node) + createUiObjectFromNode(node.positionSize, node, node) } if (node.positionRate !== undefined) { - createPartFromNode(node.positionRate, node, node) + createUiObjectFromNode(node.positionRate, node, node) } return } case 'Take Position Event': { let event = node - createPart('Take Position Event', event.name, event, parentNode, chainParent, 'Take Position Event') + createUiObject('Take Position Event', event.name, event, parentNode, chainParent, 'Take Position Event') for (let m = 0; m < node.situations.length; m++) { let situation = node.situations[m] - createPartFromNode(situation, event, event) + createUiObjectFromNode(situation, event, event) } if (node.announcements === undefined) { node.announcements = [] } for (let m = 0; m < node.announcements.length; m++) { let announcement = node.announcements[m] - createPartFromNode(announcement, node, node) + createUiObjectFromNode(announcement, node, node) } return } case 'Trigger On Event': { let event = node - createPart('Trigger On Event', event.name, event, parentNode, chainParent, 'Trigger On Event') + createUiObject('Trigger On Event', event.name, event, parentNode, chainParent, 'Trigger On Event') for (let m = 0; m < node.situations.length; m++) { let situation = node.situations[m] - createPartFromNode(situation, event, event) + createUiObjectFromNode(situation, event, event) } if (node.announcements === undefined) { node.announcements = [] } for (let m = 0; m < node.announcements.length; m++) { let announcement = node.announcements[m] - createPartFromNode(announcement, node, node) + createUiObjectFromNode(announcement, node, node) } return } case 'Trigger Off Event': { let event = node - createPart('Trigger Off Event', event.name, event, parentNode, chainParent, 'Trigger Off Event') + createUiObject('Trigger Off Event', event.name, event, parentNode, chainParent, 'Trigger Off Event') for (let m = 0; m < node.situations.length; m++) { let situation = node.situations[m] - createPartFromNode(situation, event, event) + createUiObjectFromNode(situation, event, event) } if (node.announcements === undefined) { node.announcements = [] } for (let m = 0; m < node.announcements.length; m++) { let announcement = node.announcements[m] - createPartFromNode(announcement, node, node) + createUiObjectFromNode(announcement, node, node) } return } case 'Position Size': { - createPart('Position Size', node.name, node, parentNode, chainParent, 'Position Size') + createUiObject('Position Size', node.name, node, parentNode, chainParent, 'Position Size') if (node.formula !== undefined) { - createPartFromNode(node.formula, node, node) + createUiObjectFromNode(node.formula, node, node) } return } case 'Position Rate': { - createPart('Position Rate', node.name, node, parentNode, chainParent, 'Position Rate') + createUiObject('Position Rate', node.name, node, parentNode, chainParent, 'Position Rate') if (node.formula !== undefined) { - createPartFromNode(node.formula, node, node) + createUiObjectFromNode(node.formula, node, node) } return } case 'Trigger Stage': { let stage = node - createPart('Trigger Stage', stage.name, stage, parentNode, chainParent, 'Trigger Stage') + createUiObject('Trigger Stage', stage.name, stage, parentNode, chainParent, 'Trigger Stage') if (node.triggerOn !== undefined) { - createPartFromNode(node.triggerOn, stage, stage) + createUiObjectFromNode(node.triggerOn, stage, stage) } if (node.triggerOff !== undefined) { - createPartFromNode(node.triggerOff, stage, stage) + createUiObjectFromNode(node.triggerOff, stage, stage) } if (node.takePosition !== undefined) { - createPartFromNode(node.takePosition, stage, stage) + createUiObjectFromNode(node.takePosition, stage, stage) } return } case 'Open Stage': { let stage = node - createPart('Open Stage', stage.name, stage, parentNode, chainParent, 'Open Stage') + createUiObject('Open Stage', stage.name, stage, parentNode, chainParent, 'Open Stage') if (node.initialDefinition !== undefined) { - createPartFromNode(node.initialDefinition, stage, stage) + createUiObjectFromNode(node.initialDefinition, stage, stage) } if (node.openExecution !== undefined) { - createPartFromNode(node.openExecution, stage, stage) + createUiObjectFromNode(node.openExecution, stage, stage) } return } case 'Manage Stage': { let stage = node - createPart('Manage Stage', stage.name, stage, parentNode, chainParent, 'Manage Stage') + createUiObject('Manage Stage', stage.name, stage, parentNode, chainParent, 'Manage Stage') if (node.stopLoss !== undefined) { - createPartFromNode(node.stopLoss, stage, stage) + createUiObjectFromNode(node.stopLoss, stage, stage) } if (node.takeProfit !== undefined) { - createPartFromNode(node.takeProfit, stage, stage) + createUiObjectFromNode(node.takeProfit, stage, stage) } return } case 'Close Stage': { let stage = node - createPart('Close Stage', stage.name, stage, parentNode, chainParent, 'Close Stage') + createUiObject('Close Stage', stage.name, stage, parentNode, chainParent, 'Close Stage') if (node.closeExecution !== undefined) { - createPartFromNode(node.closeExecution, stage, stage) + createUiObjectFromNode(node.closeExecution, stage, stage) } return } case 'Strategy': { let strategy = node - createPart('Strategy', strategy.name, strategy, parentNode, chainParent, 'Strategy') + createUiObject('Strategy', strategy.name, strategy, parentNode, chainParent, 'Strategy') if (node.triggerStage !== undefined) { - createPartFromNode(node.triggerStage, strategy, strategy) + createUiObjectFromNode(node.triggerStage, strategy, strategy) } if (node.openStage !== undefined) { - createPartFromNode(node.openStage, strategy, strategy) + createUiObjectFromNode(node.openStage, strategy, strategy) } if (node.manageStage !== undefined) { - createPartFromNode(node.manageStage, strategy, strategy) + createUiObjectFromNode(node.manageStage, strategy, strategy) } if (node.closeStage !== undefined) { - createPartFromNode(node.closeStage, strategy, strategy) + createUiObjectFromNode(node.closeStage, strategy, strategy) } return } case 'Base Asset': { - createPart('Base Asset', node.name, node, parentNode, chainParent, 'Base Asset') + createUiObject('Base Asset', node.name, node, parentNode, chainParent, 'Base Asset') return } case 'Time Range': { - createPart('Time Range', node.name, node, parentNode, chainParent, 'Time Range') + createUiObject('Time Range', node.name, node, parentNode, chainParent, 'Time Range') return } case 'Time Period': { - createPart('Time Period', node.name, node, parentNode, chainParent, 'Time Period') + createUiObject('Time Period', node.name, node, parentNode, chainParent, 'Time Period') return } case 'Slippage': { - createPart('Slippage', node.name, node, parentNode, chainParent, 'Slippage') + createUiObject('Slippage', node.name, node, parentNode, chainParent, 'Slippage') return } case 'Fee Structure': { - createPart('Fee Structure', node.name, node, parentNode, chainParent, 'Fee Structure') + createUiObject('Fee Structure', node.name, node, parentNode, chainParent, 'Fee Structure') return } case 'Parameters': { - createPart('Parameters', node.name, node, parentNode, chainParent, 'Parameters') + createUiObject('Parameters', node.name, node, parentNode, chainParent, 'Parameters') if (node.baseAsset !== undefined) { - createPartFromNode(node.baseAsset, node, node) + createUiObjectFromNode(node.baseAsset, node, node) } if (node.timeRange !== undefined) { - createPartFromNode(node.timeRange, node, node) + createUiObjectFromNode(node.timeRange, node, node) } if (node.timePeriod !== undefined) { - createPartFromNode(node.timePeriod, node, node) + createUiObjectFromNode(node.timePeriod, node, node) } if (node.slippage !== undefined) { - createPartFromNode(node.slippage, node, node) + createUiObjectFromNode(node.slippage, node, node) } if (node.feeStructure !== undefined) { - createPartFromNode(node.feeStructure, node, node) + createUiObjectFromNode(node.feeStructure, node, node) } if (node.key !== undefined) { - createPartFromNode(node.key, node, node) + createUiObjectFromNode(node.key, node, node) } return } case 'Trading System': { let tradingSystem = node - createPart('Trading System', tradingSystem.name, tradingSystem, parentNode, chainParent, 'Trading System') + createUiObject('Trading System', tradingSystem.name, tradingSystem, parentNode, chainParent, 'Trading System') for (let m = 0; m < node.strategies.length; m++) { let strategy = node.strategies[m] - createPartFromNode(strategy, tradingSystem, tradingSystem) + createUiObjectFromNode(strategy, tradingSystem, tradingSystem) } if (node.parameters !== undefined) { - createPartFromNode(node.parameters, node, node) + createUiObjectFromNode(node.parameters, node, node) } return } case 'Workspace': { let workspace = node - createPart('Workspace', workspace.name, workspace, parentNode, chainParent, 'Workspace') + createUiObject('Workspace', workspace.name, workspace, parentNode, chainParent, 'Workspace') return } case 'Personal Data': { - createPart('Personal Data', node.name, node, parentNode, chainParent, 'Personal Data') + createUiObject('Personal Data', node.name, node, parentNode, chainParent, 'Personal Data') for (let m = 0; m < node.exchangeAccounts.length; m++) { let exchangeAccount = node.exchangeAccounts[m] - createPartFromNode(exchangeAccount, node, node) + createUiObjectFromNode(exchangeAccount, node, node) } return } case 'Exchange Account': { - createPart('Exchange Account', node.name, node, parentNode, chainParent, 'Exchange Account') + createUiObject('Exchange Account', node.name, node, parentNode, chainParent, 'Exchange Account') for (let m = 0; m < node.assets.length; m++) { let asset = node.assets[m] - createPartFromNode(asset, node, node) + createUiObjectFromNode(asset, node, node) } for (let m = 0; m < node.keys.length; m++) { let key = node.keys[m] - createPartFromNode(key, node, node) + createUiObjectFromNode(key, node, node) } return } case 'Exchange Account Asset': { - createPart('Exchange Account Asset', node.name, node, parentNode, chainParent, 'Exchange Account Asset') + createUiObject('Exchange Account Asset', node.name, node, parentNode, chainParent, 'Exchange Account Asset') return } case 'Exchange Account Key': { - createPart('Exchange Account Key', node.name, node, parentNode, chainParent, 'Exchange Account Key') + createUiObject('Exchange Account Key', node.name, node, parentNode, chainParent, 'Exchange Account Key') return } case 'Definition': { - createPart('Definition', node.name, node, parentNode, chainParent, 'Definition') + createUiObject('Definition', node.name, node, parentNode, chainParent, 'Definition') if (node.tradingSystem !== undefined) { - createPartFromNode(node.tradingSystem, node, node) + createUiObjectFromNode(node.tradingSystem, node, node) } if (node.personalData !== undefined) { - createPartFromNode(node.personalData, node, node) + createUiObjectFromNode(node.personalData, node, node) } if (node.network !== undefined) { - createPartFromNode(node.network, node, node) + createUiObjectFromNode(node.network, node, node) } return } case 'Network': { - createPart('Network', node.name, node, parentNode, chainParent, 'Network') + createUiObject('Network', node.name, node, parentNode, chainParent, 'Network') if (node.networkNodes !== undefined) { for (let m = 0; m < node.networkNodes.length; m++) { let networkNode = node.networkNodes[m] - createPartFromNode(networkNode, node, node) + createUiObjectFromNode(networkNode, node, node) } } return } case 'Network Node': { - createPart('Network Node', node.name, node, parentNode, chainParent, 'Network Node') + createUiObject('Network Node', node.name, node, parentNode, chainParent, 'Network Node') if (node.taskManagers !== undefined) { for (let m = 0; m < node.taskManagers.length; m++) { let taskManager = node.taskManagers[m] - createPartFromNode(taskManager, node, node) + createUiObjectFromNode(taskManager, node, node) } } return } case 'Social Bots': { - createPart('Social Bots', node.name, node, parentNode, chainParent, 'Social Bots') + createUiObject('Social Bots', node.name, node, parentNode, chainParent, 'Social Bots') for (let m = 0; m < node.bots.length; m++) { let bot = node.bots[m] - createPartFromNode(bot, node, node) + createUiObjectFromNode(bot, node, node) } return } case 'Telegram Bot': { - createPart('Telegram Bot', node.name, node, parentNode, chainParent, 'Telegram Bot') + createUiObject('Telegram Bot', node.name, node, parentNode, chainParent, 'Telegram Bot') for (let m = 0; m < node.announcements.length; m++) { let announcement = node.announcements[m] - createPartFromNode(announcement, node, node) + createUiObjectFromNode(announcement, node, node) } return } case 'Announcement': { - createPart('Announcement', node.name, node, parentNode, chainParent, 'Announcement') + createUiObject('Announcement', node.name, node, parentNode, chainParent, 'Announcement') if (node.formula !== undefined) { - createPartFromNode(node.formula, node, node) + createUiObjectFromNode(node.formula, node, node) } return } case 'Layer Manager': { - createPart('Layer Manager', node.name, node, parentNode, chainParent, 'Layer Manager') + createUiObject('Layer Manager', node.name, node, parentNode, chainParent, 'Layer Manager') for (let m = 0; m < node.layers.length; m++) { let layer = node.layers[m] - createPartFromNode(layer, node, node) + createUiObjectFromNode(layer, node, node) } return } case 'Layer': { - createPart('Layer', node.name, node, parentNode, chainParent, 'Layer') + createUiObject('Layer', node.name, node, parentNode, chainParent, 'Layer') return } case 'Task Manager': { - createPart('Task Manager', node.name, node, parentNode, chainParent, 'Task Manager') + createUiObject('Task Manager', node.name, node, parentNode, chainParent, 'Task Manager') for (let m = 0; m < node.tasks.length; m++) { let task = node.tasks[m] - createPartFromNode(task, node, node) + createUiObjectFromNode(task, node, node) } return } case 'Task': { - createPart('Task', node.name, node, parentNode, chainParent, 'Task') + createUiObject('Task', node.name, node, parentNode, chainParent, 'Task') if (node.bot !== undefined) { - createPartFromNode(node.bot, node, node) + createUiObjectFromNode(node.bot, node, node) } return } case 'Sensor Bot Instance': { - createPart('Sensor Bot Instance', node.name, node, parentNode, chainParent, 'Sensor Bot Instance') + createUiObject('Sensor Bot Instance', node.name, node, parentNode, chainParent, 'Sensor Bot Instance') for (let m = 0; m < node.processes.length; m++) { let process = node.processes[m] - createPartFromNode(process, node, node) + createUiObjectFromNode(process, node, node) } return } case 'Indicator Bot Instance': { - createPart('Indicator Bot Instance', node.name, node, parentNode, chainParent, 'Indicator Bot Instance') + createUiObject('Indicator Bot Instance', node.name, node, parentNode, chainParent, 'Indicator Bot Instance') for (let m = 0; m < node.processes.length; m++) { let process = node.processes[m] - createPartFromNode(process, node, node) + createUiObjectFromNode(process, node, node) } return } case 'Trading Bot Instance': { - createPart('Trading Bot Instance', node.name, node, parentNode, chainParent, 'Trading Bot Instance') + createUiObject('Trading Bot Instance', node.name, node, parentNode, chainParent, 'Trading Bot Instance') for (let m = 0; m < node.processes.length; m++) { let process = node.processes[m] - createPartFromNode(process, node, node) + createUiObjectFromNode(process, node, node) } return } @@ -506,61 +506,61 @@ function newUiObjectsFromNodes () { } } } - createPart('Process', node.name, node, parentNode, chainParent, 'Process') + createUiObject('Process', node.name, node, parentNode, chainParent, 'Process') if (node.session !== undefined) { - createPartFromNode(node.session, node, node) + createUiObjectFromNode(node.session, node, node) } return } case 'Backtesting Session': { - createPart('Backtesting Session', node.name, node, parentNode, chainParent, 'Backtesting Session') + createUiObject('Backtesting Session', node.name, node, parentNode, chainParent, 'Backtesting Session') if (node.parameters !== undefined) { - createPartFromNode(node.parameters, node, node) + createUiObjectFromNode(node.parameters, node, node) } if (node.layerManager !== undefined) { - createPartFromNode(node.layerManager, node, node) + createUiObjectFromNode(node.layerManager, node, node) } if (node.socialBots !== undefined) { - createPartFromNode(node.socialBots, node, node) + createUiObjectFromNode(node.socialBots, node, node) } return } case 'Live Trading Session': { - createPart('Live Trading Session', node.name, node, parentNode, chainParent, 'Live Trading Session') + createUiObject('Live Trading Session', node.name, node, parentNode, chainParent, 'Live Trading Session') if (node.parameters !== undefined) { - createPartFromNode(node.parameters, node, node) + createUiObjectFromNode(node.parameters, node, node) } if (node.layerManager !== undefined) { - createPartFromNode(node.layerManager, node, node) + createUiObjectFromNode(node.layerManager, node, node) } if (node.socialBots !== undefined) { - createPartFromNode(node.socialBots, node, node) + createUiObjectFromNode(node.socialBots, node, node) } return } case 'Fordward Testing Session': { - createPart('Fordward Testing Session', node.name, node, parentNode, chainParent, 'Fordward Testing Session') + createUiObject('Fordward Testing Session', node.name, node, parentNode, chainParent, 'Fordward Testing Session') if (node.parameters !== undefined) { - createPartFromNode(node.parameters, node, node) + createUiObjectFromNode(node.parameters, node, node) } if (node.layerManager !== undefined) { - createPartFromNode(node.layerManager, node, node) + createUiObjectFromNode(node.layerManager, node, node) } if (node.socialBots !== undefined) { - createPartFromNode(node.socialBots, node, node) + createUiObjectFromNode(node.socialBots, node, node) } return } case 'Paper Trading Session': { - createPart('Paper Trading Session', node.name, node, parentNode, chainParent, 'Paper Trading Session') + createUiObject('Paper Trading Session', node.name, node, parentNode, chainParent, 'Paper Trading Session') if (node.parameters !== undefined) { - createPartFromNode(node.parameters, node, node) + createUiObjectFromNode(node.parameters, node, node) } if (node.layerManager !== undefined) { - createPartFromNode(node.layerManager, node, node) + createUiObjectFromNode(node.layerManager, node, node) } if (node.socialBots !== undefined) { - createPartFromNode(node.socialBots, node, node) + createUiObjectFromNode(node.socialBots, node, node) } return } @@ -572,7 +572,7 @@ function newUiObjectsFromNodes () { node.network = { name: 'Superalgos' } - createPart('Network', node.network.name, node.network, node, node, 'Network') + createUiObject('Network', node.network.name, node.network, node, node, 'Network') } return node.network @@ -586,7 +586,7 @@ function newUiObjectsFromNodes () { node.networkNodes = [] } node.networkNodes.push(networkNode) - createPart('Network Node', networkNode.name, networkNode, node, node, 'Network Node') + createUiObject('Network Node', networkNode.name, networkNode, node, node, 'Network Node') return networkNode } @@ -597,7 +597,7 @@ function newUiObjectsFromNodes () { name: 'New Social Bots', bots: [] } - createPart('Social Bots', node.socialBots.name, node.socialBots, node, node, 'Social Bots') + createUiObject('Social Bots', node.socialBots.name, node.socialBots, node, node, 'Social Bots') } return node.socialBots @@ -610,7 +610,7 @@ function newUiObjectsFromNodes () { announcements: [] } node.bots.push(bot) - createPart('Telegram Bot', bot.name, bot, node, node, 'Telegram Bot') + createUiObject('Telegram Bot', bot.name, bot, node, node, 'Telegram Bot') return bot } @@ -621,7 +621,7 @@ function newUiObjectsFromNodes () { code: '{ \n\"text\": \"Write here what you want to announce.\",\n\"botType\": \"' + node.type + '\",\n\"botId\": \"' + node.id + '\"\n}' } node.announcements.push(announcement) - createPart('Announcement', announcement.name, announcement, node, node, 'Announcement') + createUiObject('Announcement', announcement.name, announcement, node, node, 'Announcement') return announcement } @@ -632,7 +632,7 @@ function newUiObjectsFromNodes () { name: 'New Layer Manager', layers: [] } - createPart('Layer Manager', node.layerManager.name, node.layerManager, node, node, 'Layer Manager') + createUiObject('Layer Manager', node.layerManager.name, node.layerManager, node, node, 'Layer Manager') } return node.layerManager @@ -644,7 +644,7 @@ function newUiObjectsFromNodes () { code: '{}' } node.layers.push(layer) - createPart('Layer', layer.name, layer, node, node, 'Layer') + createUiObject('Layer', layer.name, layer, node, node, 'Layer') return layer } @@ -658,7 +658,7 @@ function newUiObjectsFromNodes () { node.taskManagers = [] } node.taskManagers.push(taskManager) - createPart('Task Manager', taskManager.name, taskManager, node, node, 'Task Manager') + createUiObject('Task Manager', taskManager.name, taskManager, node, node, 'Task Manager') return taskManager } @@ -668,7 +668,7 @@ function newUiObjectsFromNodes () { name: 'New Task' } node.tasks.push(task) - createPart('Task', task.name, task, node, node, 'Task') + createUiObject('Task', task.name, task, node, node, 'Task') return task } @@ -679,7 +679,7 @@ function newUiObjectsFromNodes () { processes: [], code: '{}' } - createPart('Sensor Bot Instance', '', node.bot, node, node) + createUiObject('Sensor Bot Instance', '', node.bot, node, node) } return node.bot } @@ -690,7 +690,7 @@ function newUiObjectsFromNodes () { processes: [], code: '{}' } - createPart('Indicator Bot Instance', '', node.bot, node, node) + createUiObject('Indicator Bot Instance', '', node.bot, node, node) } return node.bot } @@ -701,7 +701,7 @@ function newUiObjectsFromNodes () { processes: [], code: '{}' } - createPart('Trading Bot Instance', '', node.bot, node, node) + createUiObject('Trading Bot Instance', '', node.bot, node, node) } return node.bot } @@ -730,7 +730,7 @@ function newUiObjectsFromNodes () { } } node.processes.push(process) - createPart('Process', process.name, process, node, node, 'Process') + createUiObject('Process', process.name, process, node, node, 'Process') return process } @@ -741,7 +741,7 @@ function newUiObjectsFromNodes () { name: 'New Backtesting Session', code: '{}' } - createPart('Backtesting Session', '', node.session, node, node) + createUiObject('Backtesting Session', '', node.session, node, node) } return node.session @@ -753,7 +753,7 @@ function newUiObjectsFromNodes () { name: 'New Live Trading Session', code: '{}' } - createPart('Live Trading Session', '', node.session, node, node) + createUiObject('Live Trading Session', '', node.session, node, node) } return node.session @@ -765,7 +765,7 @@ function newUiObjectsFromNodes () { name: 'New Fordward Testing Session', code: '{}' } - createPart('Fordward Testing Session', '', node.session, node, node) + createUiObject('Fordward Testing Session', '', node.session, node, node) } return node.session @@ -777,7 +777,7 @@ function newUiObjectsFromNodes () { name: 'New Paper Trading Session', code: '{}' } - createPart('Paper Trading Session', '', node.session, node, node) + createUiObject('Paper Trading Session', '', node.session, node, node) } return node.session @@ -788,7 +788,7 @@ function newUiObjectsFromNodes () { name: 'New Definition' } node.rootNodes.push(definition) - createPart('Definition', definition.name, definition, node, undefined, 'Definition') + createUiObject('Definition', definition.name, definition, node, undefined, 'Definition') return definition } @@ -798,7 +798,7 @@ function newUiObjectsFromNodes () { node.tradingSystem = { strategies: [] } - createPart('Trading System', '', node.tradingSystem, node, node) + createUiObject('Trading System', '', node.tradingSystem, node, node) } return node.tradingSystem } @@ -808,7 +808,7 @@ function newUiObjectsFromNodes () { node.personalData = { exchangeAccounts: [] } - createPart('Personal Data', '', node.personalData, node, node) + createUiObject('Personal Data', '', node.personalData, node, node) } return node.personalData @@ -822,7 +822,7 @@ function newUiObjectsFromNodes () { keys: [] } personalData.exchangeAccounts.push(exchangeAccount) - createPart('Exchange Account', exchangeAccount.name, exchangeAccount, personalData, personalData, 'Exchange Account') + createUiObject('Exchange Account', exchangeAccount.name, exchangeAccount, personalData, personalData, 'Exchange Account') return exchangeAccount } @@ -833,7 +833,7 @@ function newUiObjectsFromNodes () { name: 'New Asset' } exchangeAccount.assets.push(asset) - createPart('Exchange Account Asset', asset.name, asset, exchangeAccount, exchangeAccount, 'Account Asset') + createUiObject('Exchange Account Asset', asset.name, asset, exchangeAccount, exchangeAccount, 'Account Asset') return asset } @@ -845,7 +845,7 @@ function newUiObjectsFromNodes () { code: 'Paste your exchange API secret key here and the put the key name as this key object title. Secret keys are filtered out and NOT exported when using the SHARE menu option on any object at your workspace. Secret keys ARE downloaded when using the download button.' } exchangeAccount.keys.push(key) - createPart('Exchange Account Key', key.name, key, exchangeAccount, exchangeAccount, 'Account Key') + createUiObject('Exchange Account Key', key.name, key, exchangeAccount, exchangeAccount, 'Account Key') return key } @@ -896,22 +896,22 @@ function newUiObjectsFromNodes () { } strategyParent.strategies.push(strategy) - createPart('Strategy', strategy.name, strategy, strategyParent, strategyParent, 'Strategy') - createPart('Trigger Stage', '', strategy.triggerStage, strategy, strategy, 'Trigger Stage') - createPart('Open Stage', '', strategy.openStage, strategy, strategy, 'Open Stage') - createPart('Manage Stage', '', strategy.manageStage, strategy, strategy, 'Manage Stage') - createPart('Close Stage', '', strategy.closeStage, strategy, strategy, 'Close Stage') - createPart('Trigger On Event', '', strategy.triggerStage.triggerOn, strategy.triggerStage, strategy.triggerStage) - createPart('Trigger Off Event', '', strategy.triggerStage.triggerOff, strategy.triggerStage, strategy.triggerStage) - createPart('Take Position Event', '', strategy.triggerStage.takePosition, strategy.triggerStage, strategy.triggerStage) - createPart('Initial Definition', '', strategy.openStage.initialDefinition, strategy.openStage, strategy.openStage) - createPart('Position Size', '', strategy.openStage.initialDefinition.positionSize, strategy.openStage.initialDefinition, strategy.openStage.initialDefinition) - createPart('Position Rate', '', strategy.openStage.initialDefinition.positionRate, strategy.openStage.initialDefinition, strategy.openStage.initialDefinition) - createPart('Stop', '', strategy.manageStage.stopLoss, strategy.manageStage, strategy.manageStage) - createPart('Take Profit', '', strategy.manageStage.takeProfit, strategy.manageStage, strategy.manageStage) - createPart('Stop', 'Initial Stop', strategy.openStage.initialDefinition.stopLoss, strategy.openStage.initialDefinition, strategy.openStage.initialDefinition) - createPart('Take Profit', 'Initial Take Profit', strategy.openStage.initialDefinition.takeProfit, strategy.openStage.initialDefinition, strategy.openStage.initialDefinition) - createPart('Formula', '', strategy.triggerStage.positionSize.formula, strategy.triggerStage.positionSize, strategy.triggerStage.positionSize) + createUiObject('Strategy', strategy.name, strategy, strategyParent, strategyParent, 'Strategy') + createUiObject('Trigger Stage', '', strategy.triggerStage, strategy, strategy, 'Trigger Stage') + createUiObject('Open Stage', '', strategy.openStage, strategy, strategy, 'Open Stage') + createUiObject('Manage Stage', '', strategy.manageStage, strategy, strategy, 'Manage Stage') + createUiObject('Close Stage', '', strategy.closeStage, strategy, strategy, 'Close Stage') + createUiObject('Trigger On Event', '', strategy.triggerStage.triggerOn, strategy.triggerStage, strategy.triggerStage) + createUiObject('Trigger Off Event', '', strategy.triggerStage.triggerOff, strategy.triggerStage, strategy.triggerStage) + createUiObject('Take Position Event', '', strategy.triggerStage.takePosition, strategy.triggerStage, strategy.triggerStage) + createUiObject('Initial Definition', '', strategy.openStage.initialDefinition, strategy.openStage, strategy.openStage) + createUiObject('Position Size', '', strategy.openStage.initialDefinition.positionSize, strategy.openStage.initialDefinition, strategy.openStage.initialDefinition) + createUiObject('Position Rate', '', strategy.openStage.initialDefinition.positionRate, strategy.openStage.initialDefinition, strategy.openStage.initialDefinition) + createUiObject('Stop', '', strategy.manageStage.stopLoss, strategy.manageStage, strategy.manageStage) + createUiObject('Take Profit', '', strategy.manageStage.takeProfit, strategy.manageStage, strategy.manageStage) + createUiObject('Stop', 'Initial Stop', strategy.openStage.initialDefinition.stopLoss, strategy.openStage.initialDefinition, strategy.openStage.initialDefinition) + createUiObject('Take Profit', 'Initial Take Profit', strategy.openStage.initialDefinition.takeProfit, strategy.openStage.initialDefinition, strategy.openStage.initialDefinition) + createUiObject('Formula', '', strategy.triggerStage.positionSize.formula, strategy.triggerStage.positionSize, strategy.triggerStage.positionSize) return strategy } @@ -921,7 +921,7 @@ function newUiObjectsFromNodes () { node.parameters = { name: 'Parameters' } - createPart('Parameters', '', node.parameters, node, node) + createUiObject('Parameters', '', node.parameters, node, node) addMissingParameters(node.parameters) } @@ -934,35 +934,35 @@ function newUiObjectsFromNodes () { name: 'Base Asset', code: DEFAULT_CONFIG_TEXT } - createPart('Base Asset', '', node.baseAsset, node, node) + createUiObject('Base Asset', '', node.baseAsset, node, node) } if (node.timeRange === undefined) { node.timeRange = { name: 'Time Range', code: DEFAULT_CONFIG_TEXT } - createPart('Time Range', '', node.timeRange, node, node) + createUiObject('Time Range', '', node.timeRange, node, node) } if (node.timePeriod === undefined) { node.timePeriod = { name: 'Time Period', code: DEFAULT_CONFIG_TEXT } - createPart('Time Period', '', node.timePeriod, node, node) + createUiObject('Time Period', '', node.timePeriod, node, node) } if (node.slippage === undefined) { node.slippage = { name: 'Slippage', code: DEFAULT_CONFIG_TEXT } - createPart('Slippage', '', node.slippage, node, node) + createUiObject('Slippage', '', node.slippage, node, node) } if (node.feeStructure === undefined) { node.feeStructure = { name: 'Fee Structure', code: DEFAULT_CONFIG_TEXT } - createPart('Fee Structure', '', node.feeStructure, node, node) + createUiObject('Fee Structure', '', node.feeStructure, node, node) } } @@ -984,11 +984,11 @@ function newUiObjectsFromNodes () { } } } - createPart('Trigger Stage', '', node.triggerStage, node, node, 'Trigger Stage') - createPart('Trigger On Event', '', node.triggerStage.triggerOn, node.triggerStage, node.triggerStage) - createPart('Trigger Off Event', '', node.triggerStage.triggerOff, node.triggerStage, node.triggerStage) - createPart('Take Position Event', '', node.triggerStage.takePosition, node.triggerStage, node.triggerStage) - createPart('Formula', '', node.triggerStage.positionSize.formula, node.triggerStage.positionSize, node.triggerStage.positionSize) + createUiObject('Trigger Stage', '', node.triggerStage, node, node, 'Trigger Stage') + createUiObject('Trigger On Event', '', node.triggerStage.triggerOn, node.triggerStage, node.triggerStage) + createUiObject('Trigger Off Event', '', node.triggerStage.triggerOff, node.triggerStage, node.triggerStage) + createUiObject('Take Position Event', '', node.triggerStage.takePosition, node.triggerStage, node.triggerStage) + createUiObject('Formula', '', node.triggerStage.positionSize.formula, node.triggerStage.positionSize, node.triggerStage.positionSize) } if (node.openStage === undefined) { node.openStage = { @@ -1003,12 +1003,12 @@ function newUiObjectsFromNodes () { } } } - createPart('Open Stage', '', node.openStage, node, node, 'Open Stage') - createPart('Initial Definition', '', node.openStage.initialDefinition, node.openStage, node.openStage) - createPart('Stop', 'Initial Stop', node.openStage.initialDefinition.stopLoss, node.openStage.initialDefinition, node.openStage.initialDefinition) - createPart('Take Profit', 'Initial Take Profit', node.openStage.initialDefinition.takeProfit, node.openStage.initialDefinition, node.openStage.initialDefinition) - createPart('Position Size', 'Position Size', node.openStage.initialDefinition.positionSize, node.openStage.initialDefinition, node.openStage.initialDefinition) - createPart('Position Rate', 'Position Rate', node.openStage.initialDefinition.positionRate, node.openStage.initialDefinition, node.openStage.initialDefinition) + createUiObject('Open Stage', '', node.openStage, node, node, 'Open Stage') + createUiObject('Initial Definition', '', node.openStage.initialDefinition, node.openStage, node.openStage) + createUiObject('Stop', 'Initial Stop', node.openStage.initialDefinition.stopLoss, node.openStage.initialDefinition, node.openStage.initialDefinition) + createUiObject('Take Profit', 'Initial Take Profit', node.openStage.initialDefinition.takeProfit, node.openStage.initialDefinition, node.openStage.initialDefinition) + createUiObject('Position Size', 'Position Size', node.openStage.initialDefinition.positionSize, node.openStage.initialDefinition, node.openStage.initialDefinition) + createUiObject('Position Rate', 'Position Rate', node.openStage.initialDefinition.positionRate, node.openStage.initialDefinition, node.openStage.initialDefinition) } if (node.manageStage === undefined) { node.manageStage = { @@ -1019,14 +1019,14 @@ function newUiObjectsFromNodes () { phases: [] } } - createPart('Manage Stage', '', node.manageStage, node, node, 'Manage Stage') - createPart('Stop', '', node.manageStage.stopLoss, node.manageStage, node.manageStage) - createPart('Take Profit', '', node.manageStage.takeProfit, node.manageStage, node.manageStage) + createUiObject('Manage Stage', '', node.manageStage, node, node, 'Manage Stage') + createUiObject('Stop', '', node.manageStage.stopLoss, node.manageStage, node.manageStage) + createUiObject('Take Profit', '', node.manageStage.takeProfit, node.manageStage, node.manageStage) } if (node.closeStage === undefined) { node.closeStage = { } - createPart('Close Stage', '', node.closeStage, node, node, 'Close Stage') + createUiObject('Close Stage', '', node.closeStage, node, node, 'Close Stage') } } @@ -1036,21 +1036,21 @@ function newUiObjectsFromNodes () { situations: [], announcements: [] } - createPart('Trigger On Event', '', node.triggerOn, node, node) + createUiObject('Trigger On Event', '', node.triggerOn, node, node) } if (node.triggerOff === undefined) { node.triggerOff = { situations: [], announcements: [] } - createPart('Trigger Off Event', '', node.triggerOff, node, node) + createUiObject('Trigger Off Event', '', node.triggerOff, node, node) } if (node.takePosition === undefined) { node.takePosition = { situations: [], announcements: [] } - createPart('Take Position Event', '', node.takePosition, node, node) + createUiObject('Take Position Event', '', node.takePosition, node, node) } } @@ -1061,14 +1061,14 @@ function newUiObjectsFromNodes () { phases: [], maxPhases: 1 } - createPart('Stop', 'Initial Stop', node.stopLoss, node, node) + createUiObject('Stop', 'Initial Stop', node.stopLoss, node, node) } if (node.takeProfit === undefined) { node.takeProfit = { phases: [], maxPhases: 1 } - createPart('Take Profit', 'Initial Take Profit', node.takeProfit, node, node) + createUiObject('Take Profit', 'Initial Take Profit', node.takeProfit, node, node) } if (node.positionSize === undefined) { node.positionSize = { @@ -1077,8 +1077,8 @@ function newUiObjectsFromNodes () { code: DEFAULT_FORMULA_TEXT } } - createPart('Position Size', '', node.positionSize, node, node) - createPart('Formula', '', node.positionSize.formula, node.positionSize, node.positionSize) + createUiObject('Position Size', '', node.positionSize, node, node) + createUiObject('Formula', '', node.positionSize.formula, node.positionSize, node.positionSize) } if (node.positionRate === undefined) { node.positionRate = { @@ -1087,21 +1087,21 @@ function newUiObjectsFromNodes () { code: DEFAULT_FORMULA_TEXT } } - createPart('Position Rate', '', node.positionRate, node, node) - createPart('Formula', '', node.positionRate.formula, node.positionRate, node.positionRate) + createUiObject('Position Rate', '', node.positionRate, node, node) + createUiObject('Formula', '', node.positionRate.formula, node.positionRate, node.positionRate) } } else { if (node.stopLoss === undefined) { node.stopLoss = { phases: [] } - createPart('Stop', '', node.stopLoss, node, node) + createUiObject('Stop', '', node.stopLoss, node, node) } if (node.takeProfit === undefined) { node.takeProfit = { phases: [] } - createPart('Take Profit', '', node.takeProfit, node, node) + createUiObject('Take Profit', '', node.takeProfit, node, node) } } } @@ -1118,13 +1118,13 @@ function newUiObjectsFromNodes () { maxPhases: 1 } } - createPart('Initial Definition', '', node.initialDefinition, node, node) - createPart('Stop', 'Initial Stop', node.initialDefinition.stopLoss, node.initialDefinition, node.initialDefinition) - createPart('Take Profit', 'Initial Take Profit', node.initialDefinition.takeProfit, node.initialDefinition, node.initialDefinition) - createPart('Position Size', '', node.initialDefinition.positionSize, node.initialDefinition, node.initialDefinition) - createPart('Formula', '', node.initialDefinition.positionSize.formula, node.initialDefinition.positionSize, node.initialDefinition.positionSize) - createPart('Position Rate', '', node.initialDefinition.positionRate, node.initialDefinition, node.initialDefinition) - createPart('Formula', '', node.initialDefinition.positionRate.formula, node.initialDefinition.positionRate, node.initialDefinition.positionRate) + createUiObject('Initial Definition', '', node.initialDefinition, node, node) + createUiObject('Stop', 'Initial Stop', node.initialDefinition.stopLoss, node.initialDefinition, node.initialDefinition) + createUiObject('Take Profit', 'Initial Take Profit', node.initialDefinition.takeProfit, node.initialDefinition, node.initialDefinition) + createUiObject('Position Size', '', node.initialDefinition.positionSize, node.initialDefinition, node.initialDefinition) + createUiObject('Formula', '', node.initialDefinition.positionSize.formula, node.initialDefinition.positionSize, node.initialDefinition.positionSize) + createUiObject('Position Rate', '', node.initialDefinition.positionRate, node.initialDefinition, node.initialDefinition) + createUiObject('Formula', '', node.initialDefinition.positionRate.formula, node.initialDefinition.positionRate, node.initialDefinition.positionRate) } return node.initialDefinition @@ -1133,7 +1133,7 @@ function newUiObjectsFromNodes () { function addOpenExecution (node) { if (node.openExecution === undefined) { node.openExecution = {} - createPart('Open Execution', '', node.openExecution, node, node) + createUiObject('Open Execution', '', node.openExecution, node, node) } return node.openExecution @@ -1142,7 +1142,7 @@ function newUiObjectsFromNodes () { function addCloseExecution (node) { if (node.closeExecution === undefined) { node.closeExecution = {} - createPart('Close Execution', '', node.closeExecution, node, node) + createUiObject('Close Execution', '', node.closeExecution, node, node) } return node.closeExecution @@ -1153,7 +1153,7 @@ function newUiObjectsFromNodes () { node.formula = { code: DEFAULT_FORMULA_TEXT } - createPart('Formula', '', node.formula, node, node) + createUiObject('Formula', '', node.formula, node, node) } return node.formula @@ -1165,7 +1165,7 @@ function newUiObjectsFromNodes () { situations: [], announcements: [] } - createPart('Next Phase Event', '', node.nextPhaseEvent, node, node) + createUiObject('Next Phase Event', '', node.nextPhaseEvent, node, node) } return node.nextPhaseEvent @@ -1176,7 +1176,7 @@ function newUiObjectsFromNodes () { node.code = { code: DEFAULT_CODE_TEXT } - createPart('Code', '', node.code, node, node) + createUiObject('Code', '', node.code, node, node) } return node.code @@ -1212,9 +1212,9 @@ function newUiObjectsFromNodes () { } else { phaseChainParent = phaseParent } - createPart('Phase', phase.name, phase, phaseParent, phaseChainParent, 'Phase') - createPart('Formula', '', phase.formula, phase, phase, 'Formula') - createPart('Next Phase Event', '', phase.nextPhaseEvent, phase, phase) + createUiObject('Phase', phase.name, phase, phaseParent, phaseChainParent, 'Phase') + createUiObject('Formula', '', phase.formula, phase, phase, 'Formula') + createUiObject('Next Phase Event', '', phase.nextPhaseEvent, phase, phase) return phase } @@ -1226,7 +1226,7 @@ function newUiObjectsFromNodes () { conditions: [] } parentNode.situations.push(situation) - createPart('Situation', situation.name, situation, parentNode, parentNode, 'Situation') + createUiObject('Situation', situation.name, situation, parentNode, parentNode, 'Situation') return situation } @@ -1241,16 +1241,16 @@ function newUiObjectsFromNodes () { } } situation.conditions.push(condition) - createPart('Condition', condition.name, condition, situation, situation, 'Condition') - createPart('Code', '', condition.code, condition, condition, 'Code') + createUiObject('Condition', condition.name, condition, situation, situation, 'Condition') + createUiObject('Code', '', condition.code, condition, condition, 'Code') return condition } - function createPart (partType, name, node, parentNode, chainParent, title) { + function createUiObject (uiObjectType, name, node, parentNode, chainParent, title) { let payload = {} - if (name === '' || name === undefined) { name = 'My ' + partType } + if (name === '' || name === undefined) { name = 'My ' + uiObjectType } if (node.savedPayload !== undefined) { payload.targetPosition = { x: node.savedPayload.targetPosition.x, @@ -1266,7 +1266,7 @@ function newUiObjectsFromNodes () { x: spawnPosition.x, y: spawnPosition.y } - if (partType === 'Workspace' || partType === 'Trading System') { + if (uiObjectType === 'Workspace' || uiObjectType === 'Trading System') { payload.position = { x: spawnPosition.x, y: spawnPosition.y @@ -1283,7 +1283,7 @@ function newUiObjectsFromNodes () { if (title !== undefined) { payload.subTitle = title } else { - payload.subTitle = partType + payload.subTitle = uiObjectType } payload.visible = true @@ -1297,7 +1297,7 @@ function newUiObjectsFromNodes () { node.id = newUniqueId() } node.payload = payload - node.type = partType + node.type = uiObjectType canvas.floatingSpace.uiObjectConstructor.createUiObject(payload) } } diff --git a/DesignerSpace/Workspace/Workspace.js b/DesignerSpace/Workspace/Workspace.js index af95304c9..c42007589 100644 --- a/DesignerSpace/Workspace/Workspace.js +++ b/DesignerSpace/Workspace/Workspace.js @@ -78,15 +78,15 @@ function newWorkspace () { if (savedWorkspace === null || idAtStrategizer === null) { thisObject.workspaceNode.type = 'Workspace' thisObject.workspaceNode.name = 'My Workspace' - functionLibraryUiObjectsFromNodes.createPartFromNode(thisObject.workspaceNode, undefined, undefined) + functionLibraryUiObjectsFromNodes.createUiObjectFromNode(thisObject.workspaceNode, undefined, undefined) spawnPosition.y = spawnPosition.y + 250 initializeLoadingFromStrategizer() } else { thisObject.workspaceNode = JSON.parse(savedWorkspace) - functionLibraryUiObjectsFromNodes.createPartFromNode(thisObject.workspaceNode, undefined, undefined) + functionLibraryUiObjectsFromNodes.createUiObjectFromNode(thisObject.workspaceNode, undefined, undefined) for (let i = 0; i < thisObject.workspaceNode.rootNodes.length; i++) { let rootNode = thisObject.workspaceNode.rootNodes[i] - functionLibraryUiObjectsFromNodes.createPartFromNode(rootNode, undefined, undefined) + functionLibraryUiObjectsFromNodes.createUiObjectFromNode(rootNode, undefined, undefined) } thisObject.enabled = true } @@ -100,7 +100,7 @@ function newWorkspace () { if (result === true) { thisObject.definition = canvas.designerSpace.strategizerGateway.strategizerData thisObject.workspaceNode.rootNodes.push(thisObject.definition) - functionLibraryUiObjectsFromNodes.createPartFromNode(thisObject.definition, undefined, undefined) + functionLibraryUiObjectsFromNodes.createUiObjectFromNode(thisObject.definition, undefined, undefined) thisObject.enabled = true } @@ -222,15 +222,15 @@ function newWorkspace () { stopAllRunningTasks() functionLibraryNodeDeleter.deleteWorkspace(thisObject.workspaceNode, thisObject.workspaceNode.rootNodes) thisObject.workspaceNode = droppedNode - functionLibraryUiObjectsFromNodes.createPartFromNode(thisObject.workspaceNode, undefined, undefined) + functionLibraryUiObjectsFromNodes.createUiObjectFromNode(thisObject.workspaceNode, undefined, undefined) for (let i = 0; i < thisObject.workspaceNode.rootNodes.length; i++) { let rootNode = thisObject.workspaceNode.rootNodes[i] - functionLibraryUiObjectsFromNodes.createPartFromNode(rootNode, undefined, undefined) + functionLibraryUiObjectsFromNodes.createUiObjectFromNode(rootNode, undefined, undefined) } } else { let rootNode = functionLibraryProtocolNode.getProtocolNode(droppedNode) thisObject.workspaceNode.rootNodes.push(rootNode) - functionLibraryUiObjectsFromNodes.createPartFromNode(rootNode, undefined, undefined) + functionLibraryUiObjectsFromNodes.createUiObjectFromNode(rootNode, undefined, undefined) } } catch (err) { if (ERROR_LOG === true) { logger.write('[ERROR] spawn -> err = ' + err.stack) } diff --git a/FloatingSpace/CircularMenuItem.js b/FloatingSpace/CircularMenuItem.js index 658fa6e92..2ce83ed0a 100644 --- a/FloatingSpace/CircularMenuItem.js +++ b/FloatingSpace/CircularMenuItem.js @@ -171,8 +171,8 @@ function newCircularMenuItem () { thisObject.iconOff = canvas.designerSpace.iconCollection.get(thisObject.secondaryIcon) } else { if (thisObject.relatedUiObject !== undefined) { - thisObject.iconOn = canvas.designerSpace.iconByPartType.get(thisObject.relatedUiObject) - thisObject.iconOff = canvas.designerSpace.iconByPartType.get(thisObject.relatedUiObject) + thisObject.iconOn = canvas.designerSpace.iconByUiObjectType.get(thisObject.relatedUiObject) + thisObject.iconOff = canvas.designerSpace.iconByUiObjectType.get(thisObject.relatedUiObject) } else { thisObject.iconOn = canvas.designerSpace.iconCollection.get(thisObject.iconPathOn) thisObject.iconOff = canvas.designerSpace.iconCollection.get(thisObject.iconPathOff) diff --git a/FloatingSpace/FloatingLayer.js b/FloatingSpace/FloatingLayer.js index 57249bcac..91333db82 100644 --- a/FloatingSpace/FloatingLayer.js +++ b/FloatingSpace/FloatingLayer.js @@ -10,7 +10,7 @@ 2. Notes: Notes are a rectangular area where some text is posted. It has a subject and a body. - 3. Strategy Parts: These are small balls that represent parts of an strategy. + 3. UI Objects: These are small balls that represent parts of an strategy. */ function newFloatingLayer () { diff --git a/FloatingSpace/UiObject.js b/FloatingSpace/UiObject.js index 62bfc16db..f5e172683 100644 --- a/FloatingSpace/UiObject.js +++ b/FloatingSpace/UiObject.js @@ -15,7 +15,7 @@ function newUiObject () { container: undefined, payload: undefined, codeEditor: undefined, - partTitle: undefined, + uiObjectTitle: undefined, circularProgressBar: undefined, isExecuting: undefined, isRunning: undefined, @@ -95,8 +95,8 @@ function newUiObject () { thisObject.payload = undefined thisObject.menu.finalize() thisObject.menu = undefined - thisObject.partTitle.finalize() - thisObject.partTitle = undefined + thisObject.uiObjectTitle.finalize() + thisObject.uiObjectTitle = undefined thisObject.fitFunction = undefined thisObject.isVisibleFunction = undefined @@ -118,14 +118,14 @@ function newUiObject () { thisObject.menu.initialize(menuItemsInitialValues, thisObject.payload) thisObject.menu.container.connectToParent(thisObject.container, false, false, true, true, false, false, true, true) -/* Initialize Part Title */ +/* Initialize UI Object Title */ - thisObject.partTitle = newUiObjectTitle() - thisObject.partTitle.isVisibleFunction = thisObject.isVisibleFunction - thisObject.partTitle.container.connectToParent(thisObject.container, false, false, true, true, false, false, true, true) - thisObject.partTitle.initialize(thisObject.payload) + thisObject.uiObjectTitle = newUiObjectTitle() + thisObject.uiObjectTitle.isVisibleFunction = thisObject.isVisibleFunction + thisObject.uiObjectTitle.container.connectToParent(thisObject.container, false, false, true, true, false, false, true, true) + thisObject.uiObjectTitle.initialize(thisObject.payload) -/* Load Part Image */ +/* Load UI Object Image */ iconPhysics() @@ -145,7 +145,7 @@ function newUiObject () { if (container !== undefined) { return container } } - container = thisObject.partTitle.getContainer(point) + container = thisObject.uiObjectTitle.getContainer(point) if (container !== undefined) { return container } container = thisObject.menu.getContainer(point) @@ -161,7 +161,7 @@ function newUiObject () { function physics () { thisObject.menu.physics() - thisObject.partTitle.physics() + thisObject.uiObjectTitle.physics() if (thisObject.codeEditor !== undefined) { thisObject.codeEditor.physics() @@ -658,7 +658,7 @@ function newUiObject () { } function iconPhysics () { - icon = canvas.designerSpace.iconByPartType.get(thisObject.payload.node.type) + icon = canvas.designerSpace.iconByUiObjectType.get(thisObject.payload.node.type) executingIcon = canvas.designerSpace.iconCollection.get('attractive') } @@ -674,11 +674,11 @@ function newUiObject () { } function onDisplace (event) { - thisObject.partTitle.exitEditMode() + thisObject.uiObjectTitle.exitEditMode() } function onDragStarted (event) { - thisObject.partTitle.exitEditMode() + thisObject.uiObjectTitle.exitEditMode() if (thisObject.codeEditor !== undefined) { thisObject.codeEditor.deactivate() } @@ -717,7 +717,7 @@ function newUiObject () { if (thisObject.isOnFocus === false) { drawValue() drawText() - thisObject.partTitle.draw() + thisObject.uiObjectTitle.draw() } } @@ -762,7 +762,7 @@ function newUiObject () { drawErrorMessage() drawValue() drawText() - thisObject.partTitle.draw() + thisObject.uiObjectTitle.draw() } } diff --git a/FloatingSpace/UiObjectConstructor.js b/FloatingSpace/UiObjectConstructor.js index bdb63b135..7d13ce6d2 100644 --- a/FloatingSpace/UiObjectConstructor.js +++ b/FloatingSpace/UiObjectConstructor.js @@ -3178,7 +3178,7 @@ function newUiObjectConstructor () { break } default: { - if (ERROR_LOG === true) { logger.write('[ERROR] getMenuItemsInitialValues -> Part Type not Recognized -> type = ' + payload.node.type) } + if (ERROR_LOG === true) { logger.write('[ERROR] getMenuItemsInitialValues -> UI Object Type not Recognized -> type = ' + payload.node.type) } } } @@ -3395,7 +3395,7 @@ function newUiObjectConstructor () { break } default: { - if (ERROR_LOG === true) { logger.write('[ERROR] initialize -> Part Type not Recognized -> type = ' + payload.node.type) } + if (ERROR_LOG === true) { logger.write('[ERROR] initialize -> UI Object Type not Recognized -> type = ' + payload.node.type) } return } } diff --git a/FloatingSpace/UiObjectTitle.js b/FloatingSpace/UiObjectTitle.js index 0aada37d5..a832e135d 100644 --- a/FloatingSpace/UiObjectTitle.js +++ b/FloatingSpace/UiObjectTitle.js @@ -1,6 +1,6 @@ function newUiObjectTitle () { - const MODULE_NAME = 'Strategy Part Title' + const MODULE_NAME = 'UI Object Title' const ERROR_LOG = true const logger = newWebDebugLog() @@ -215,7 +215,7 @@ function newUiObjectTitle () { break } default: { - if (ERROR_LOG === true) { logger.write('[ERROR] initialize -> Part Type not Recognized -> type = ' + payload.node.type) } + if (ERROR_LOG === true) { logger.write('[ERROR] initialize -> UI Object Type not Recognized -> type = ' + payload.node.type) } } } diff --git a/Spaces/DesignerSpace.js b/Spaces/DesignerSpace.js index 8200d897d..3b1fafe50 100644 --- a/Spaces/DesignerSpace.js +++ b/Spaces/DesignerSpace.js @@ -6,7 +6,7 @@ function newDesignerSpace () { strategizerGateway: undefined, container: undefined, iconCollection: undefined, - iconByPartType: undefined, + iconByUiObjectType: undefined, workspace: undefined, physics: physics, draw: draw, @@ -23,13 +23,13 @@ function newDesignerSpace () { container.isDraggeable = false thisObject.iconCollection = new Map() - thisObject.iconByPartType = new Map() + thisObject.iconByUiObjectType = new Map() return thisObject async function initialize () { loadIconCollection() - buildIconByPartTypeMap() + buildIconByUiObjectTypeMap() thisObject.strategizerGateway = newStrategizerGateway() @@ -37,7 +37,7 @@ function newDesignerSpace () { thisObject.workspace.initialize() } - function buildIconByPartTypeMap () { + function buildIconByUiObjectTypeMap () { const relationshipArray = [ ['Definition', 'text'], ['Network', 'network'], @@ -95,7 +95,7 @@ function newDesignerSpace () { for (let i = 0; i < relationshipArray.length; i++) { let record = relationshipArray[i] let icon = thisObject.iconCollection.get(record[1]) - thisObject.iconByPartType.set(record[0], icon) + thisObject.iconByUiObjectType.set(record[0], icon) } } From 4b82e5d57c7293a4d62284abb7e5466888e9e8ff Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sun, 27 Oct 2019 21:22:30 +0100 Subject: [PATCH 16/95] Process Refactoring --- .../Workspace/FunctionLibraries/AttachDetach.js | 4 ++-- .../Workspace/FunctionLibraries/NodeChildren.js | 2 +- .../Workspace/FunctionLibraries/NodeDeleter.js | 2 +- DesignerSpace/Workspace/FunctionLibraries/OnFocus.js | 2 +- .../Workspace/FunctionLibraries/ProtocolNode.js | 2 +- .../Workspace/FunctionLibraries/ShortcutKeys.js | 2 +- .../FunctionLibraries/UiObjectsFromNodes.js | 6 +++--- FloatingSpace/UiObject.js | 12 ++++++------ FloatingSpace/UiObjectConstructor.js | 10 +++++----- FloatingSpace/UiObjectTitle.js | 2 +- Spaces/DesignerSpace.js | 2 +- 11 files changed, 23 insertions(+), 23 deletions(-) diff --git a/DesignerSpace/Workspace/FunctionLibraries/AttachDetach.js b/DesignerSpace/Workspace/FunctionLibraries/AttachDetach.js index 441a18344..490cb33ec 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/AttachDetach.js +++ b/DesignerSpace/Workspace/FunctionLibraries/AttachDetach.js @@ -170,7 +170,7 @@ function newAttachDetach () { completeDetachment(node, rootNodes) return } - case 'Process': { + case 'Process Instance': { let payload = node.payload for (let i = 0; i < payload.parentNode.processes.length; i++) { let process = payload.parentNode.processes[i] @@ -444,7 +444,7 @@ function newAttachDetach () { completeAttachment(node, rootNodes) } break - case 'Process': { + case 'Process Instance': { node.payload.parentNode = attachToNode node.payload.chainParent = attachToNode node.payload.parentNode.processes.push(node) diff --git a/DesignerSpace/Workspace/FunctionLibraries/NodeChildren.js b/DesignerSpace/Workspace/FunctionLibraries/NodeChildren.js index eb7fdb677..7b62ea6e5 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/NodeChildren.js +++ b/DesignerSpace/Workspace/FunctionLibraries/NodeChildren.js @@ -47,7 +47,7 @@ function newNodeChildren () { case 'Trading Bot Instance': { return countChildrenTradingBotInstance(parentNode, childNode) } - case 'Process': { + case 'Process Instance': { return countChildrenProcess(parentNode, childNode) } case 'Backtesting Session': { diff --git a/DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js b/DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js index 8454b4e0a..d314bbd4d 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js +++ b/DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js @@ -113,7 +113,7 @@ function newNodeDeleter () { deleteBotInstance(rootNode, rootNodes) break } - case 'Process': { + case 'Process Instance': { deleteProcess(rootNode, rootNodes) break } diff --git a/DesignerSpace/Workspace/FunctionLibraries/OnFocus.js b/DesignerSpace/Workspace/FunctionLibraries/OnFocus.js index 3a8173511..cd540b2df 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/OnFocus.js +++ b/DesignerSpace/Workspace/FunctionLibraries/OnFocus.js @@ -588,7 +588,7 @@ function newOnFocus () { return } } - case 'Process': { + case 'Process Instance': { let child child = getNodeThatIsOnFocus(node.session) if (child !== undefined) { diff --git a/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js b/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js index 2e2ba9340..3b418abe1 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js +++ b/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js @@ -850,7 +850,7 @@ function newProtocolNode () { } return object } - case 'Process': { + case 'Process Instance': { let object = { type: node.type, subType: node.subType, diff --git a/DesignerSpace/Workspace/FunctionLibraries/ShortcutKeys.js b/DesignerSpace/Workspace/FunctionLibraries/ShortcutKeys.js index 41d1bfe1a..b35cc119e 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/ShortcutKeys.js +++ b/DesignerSpace/Workspace/FunctionLibraries/ShortcutKeys.js @@ -589,7 +589,7 @@ function newShortcutKeys () { return } } - case 'Process': { + case 'Process Instance': { let child child = getNodeByShortcutKey(node.session, searchingKey) if (child !== undefined) { diff --git a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js index 47d2bf2e7..e97160766 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js +++ b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js @@ -489,7 +489,7 @@ function newUiObjectsFromNodes () { } return } - case 'Process': { + case 'Process Instance': { if (parentNode !== undefined) { switch (parentNode.type) { case 'Sensor Bot Instance': { @@ -506,7 +506,7 @@ function newUiObjectsFromNodes () { } } } - createUiObject('Process', node.name, node, parentNode, chainParent, 'Process') + createUiObject('Process Instance', node.name, node, parentNode, chainParent, 'Process Instance') if (node.session !== undefined) { createUiObjectFromNode(node.session, node, node) } @@ -730,7 +730,7 @@ function newUiObjectsFromNodes () { } } node.processes.push(process) - createUiObject('Process', process.name, process, node, node, 'Process') + createUiObject('Process Instance', process.name, process, node, node, 'Process Instance') return process } diff --git a/FloatingSpace/UiObject.js b/FloatingSpace/UiObject.js index f5e172683..c9396f51e 100644 --- a/FloatingSpace/UiObject.js +++ b/FloatingSpace/UiObject.js @@ -232,19 +232,19 @@ function newUiObject () { compatibleSubType = '->' + 'Trading Engine Process' + '->' break case 'Backtesting Session': - compatibleType = '->' + 'Process' + '->' + compatibleType = '->' + 'Process Instance' + '->' compatibleSubType = '->' + 'Trading Engine Process' + '->' break case 'Live Trading Session': - compatibleType = '->' + 'Process' + '->' + compatibleType = '->' + 'Process Instance' + '->' compatibleSubType = '->' + 'Trading Engine Process' + '->' break case 'Paper Trading Session': - compatibleType = '->' + 'Process' + '->' + compatibleType = '->' + 'Process Instance' + '->' compatibleSubType = '->' + 'Trading Engine Process' + '->' break case 'Fordward Testing Session': - compatibleType = '->' + 'Process' + '->' + compatibleType = '->' + 'Process Instance' + '->' compatibleSubType = '->' + 'Trading Engine Process' + '->' break case 'Base Asset': @@ -307,7 +307,7 @@ function newUiObject () { compatibleType = '->' + 'Task' + '->' compatibleSubType = undefined break - case 'Process': + case 'Process Instance': switch (thisObject.payload.node.subType) { case 'Sensor Process': { compatibleType = '->' + 'Sensor Bot Instance' + '->' @@ -426,7 +426,7 @@ function newUiObject () { if (thisObject.payload.node.type === 'Sensor Bot Instance' && nearbyNode.bot !== undefined) { continue } if (thisObject.payload.node.type === 'Indicator Bot Instance' && nearbyNode.bot !== undefined) { continue } if (thisObject.payload.node.type === 'Trading Bot Instance' && nearbyNode.bot !== undefined) { continue } - if (thisObject.payload.node.type === 'Process' && nearbyNode.process !== undefined) { continue } + if (thisObject.payload.node.type === 'Process Instance' && nearbyNode.process !== undefined) { continue } if (thisObject.payload.node.type === 'Trading System' && nearbyNode.tradingSystem !== undefined) { continue } if (thisObject.payload.node.type === 'Personal Data' && nearbyNode.personalData !== undefined) { continue } if (thisObject.payload.node.type === 'Parameters' && nearbyNode.parameters !== undefined) { continue } diff --git a/FloatingSpace/UiObjectConstructor.js b/FloatingSpace/UiObjectConstructor.js index 7d13ce6d2..edc4fa2ef 100644 --- a/FloatingSpace/UiObjectConstructor.js +++ b/FloatingSpace/UiObjectConstructor.js @@ -853,7 +853,7 @@ function newUiObjectConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Process', visible: true, - relatedUiObject: 'Process', + relatedUiObject: 'Process Instance', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -920,7 +920,7 @@ function newUiObjectConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Process', visible: true, - relatedUiObject: 'Process', + relatedUiObject: 'Process Instance', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -987,7 +987,7 @@ function newUiObjectConstructor () { actionFunction: payload.onMenuItemClick, label: 'Add Process', visible: true, - relatedUiObject: 'Process', + relatedUiObject: 'Process Instance', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -1041,7 +1041,7 @@ function newUiObjectConstructor () { ) break } - case 'Process': { + case 'Process Instance': { uiObject.codeEditor = newCodeEditor() uiObject.codeEditor.isVisibleFunction = uiObject.isVisibleFunction uiObject.codeEditor.initialize() @@ -3246,7 +3246,7 @@ function newUiObjectConstructor () { level_3() break } - case 'Process': { + case 'Process Instance': { level_2() break } diff --git a/FloatingSpace/UiObjectTitle.js b/FloatingSpace/UiObjectTitle.js index a832e135d..e6d1dca6f 100644 --- a/FloatingSpace/UiObjectTitle.js +++ b/FloatingSpace/UiObjectTitle.js @@ -93,7 +93,7 @@ function newUiObjectTitle () { case 'Trading Bot Instance': { break } - case 'Process': { + case 'Process Instance': { break } case 'Backtesting Session': { diff --git a/Spaces/DesignerSpace.js b/Spaces/DesignerSpace.js index 3b1fafe50..b7b9f9494 100644 --- a/Spaces/DesignerSpace.js +++ b/Spaces/DesignerSpace.js @@ -52,7 +52,7 @@ function newDesignerSpace () { ['Sensor Bot Instance', 'bot-sensor'], ['Indicator Bot Instance', 'bot-indicator'], ['Trading Bot Instance', 'trading-engine'], - ['Process', 'process'], + ['Process Instance', 'process'], ['Backtesting Session', 'session-backtesting'], ['Live Trading Session', 'session-live-trading'], ['Fordward Testing Session', 'session-forward-testing'], From 2d68a612cfc86db45656ed6d646639eeb1e3a713 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sun, 27 Oct 2019 21:43:43 +0100 Subject: [PATCH 17/95] Process Refactoring Final Part --- .../FunctionLibraries/NodeChildren.js | 4 +-- .../FunctionLibraries/NodeDeleter.js | 8 ++--- .../FunctionLibraries/UiObjectsFromNodes.js | 24 +++++++-------- DesignerSpace/Workspace/Workspace.js | 8 ++--- FloatingSpace/UiObject.js | 16 +++++----- FloatingSpace/UiObjectConstructor.js | 30 +++++++++---------- 6 files changed, 45 insertions(+), 45 deletions(-) diff --git a/DesignerSpace/Workspace/FunctionLibraries/NodeChildren.js b/DesignerSpace/Workspace/FunctionLibraries/NodeChildren.js index 7b62ea6e5..7800e7a1d 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/NodeChildren.js +++ b/DesignerSpace/Workspace/FunctionLibraries/NodeChildren.js @@ -48,7 +48,7 @@ function newNodeChildren () { return countChildrenTradingBotInstance(parentNode, childNode) } case 'Process Instance': { - return countChildrenProcess(parentNode, childNode) + return countChildrenProcessInstance(parentNode, childNode) } case 'Backtesting Session': { return countBacktestingSession(parentNode, childNode) @@ -372,7 +372,7 @@ function newNodeChildren () { return response } - function countChildrenProcess (parentNode, childNode) { + function countChildrenProcessInstance (parentNode, childNode) { let response = { childrenCount: 0, childIndex: undefined diff --git a/DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js b/DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js index d314bbd4d..304dc5403 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js +++ b/DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js @@ -13,7 +13,7 @@ function newNodeDeleter () { deleteSensorBotInstance: deleteBotInstance, deleteIndicatorBotInstance: deleteBotInstance, deleteTradingBotInstance: deleteBotInstance, - deleteProcess: deleteProcess, + deleteProcessInstance: deleteProcessInstance, deletePersonalData: deletePersonalData, deleteExchangeAccount: deleteExchangeAccount, deleteExchangeAccountAsset: deleteExchangeAccountAsset, @@ -114,7 +114,7 @@ function newNodeDeleter () { break } case 'Process Instance': { - deleteProcess(rootNode, rootNodes) + deleteProcessInstance(rootNode, rootNodes) break } case 'Personal Data': { @@ -469,7 +469,7 @@ function newNodeDeleter () { } if (node.processes !== undefined) { while (node.processes.length > 0) { - deleteProcess(node.processes[0], rootNodes) + deleteProcessInstance(node.processes[0], rootNodes) } } @@ -478,7 +478,7 @@ function newNodeDeleter () { cleanNode(node) } - function deleteProcess (node, rootNodes) { + function deleteProcessInstance (node, rootNodes) { let payload = node.payload if (payload.parentNode !== undefined) { for (let j = 0; j < payload.parentNode.processes.length; j++) { diff --git a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js index e97160766..a3881ef50 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js +++ b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js @@ -14,7 +14,7 @@ function newUiObjectsFromNodes () { addSensorBotInstance: addSensorBotInstance, addIndicatorBotInstance: addIndicatorBotInstance, addTradingBotInstance: addTradingBotInstance, - addProcess: addProcess, + addProcessInstance: addProcessInstance, addBacktestingSession: addBacktestingSession, addLiveTradingSession: addLiveTradingSession, addFordwardTestingSession: addFordwardTestingSession, @@ -493,15 +493,15 @@ function newUiObjectsFromNodes () { if (parentNode !== undefined) { switch (parentNode.type) { case 'Sensor Bot Instance': { - node.subType = 'Sensor Process' + node.subType = 'Sensor Process Instance' break } case 'Indicator Bot Instance': { - node.subType = 'Indicator Process' + node.subType = 'Indicator Process Instance' break } case 'Trading Bot Instance': { - node.subType = 'Trading Engine Process' + node.subType = 'Trading Process Instance' break } } @@ -706,26 +706,26 @@ function newUiObjectsFromNodes () { return node.bot } - function addProcess (node) { + function addProcessInstance (node) { let process = { - name: 'New Process', + name: 'New Process Instance', code: '{}' } switch (node.type) { case 'Sensor Bot Instance': { - process.subType = 'Sensor Process' - process.name = 'Sensor Process' + process.subType = 'Sensor Process Instance' + process.name = 'Sensor Process Instance' break } case 'Indicator Bot Instance': { - process.subType = 'Indicator Process' - process.name = 'Indicator Process' + process.subType = 'Indicator Process Instance' + process.name = 'Indicator Process Instance' break } case 'Trading Bot Instance': { - process.subType = 'Trading Engine Process' - process.name = 'Trading Engine Process' + process.subType = 'Trading Process Instance' + process.name = 'Trading Process Instance' break } } diff --git a/DesignerSpace/Workspace/Workspace.js b/DesignerSpace/Workspace/Workspace.js index c42007589..bc86e3f76 100644 --- a/DesignerSpace/Workspace/Workspace.js +++ b/DesignerSpace/Workspace/Workspace.js @@ -379,9 +379,9 @@ function newWorkspace () { functionLibraryUiObjectsFromNodes.addTradingBotInstance(payload.node) } break - case 'Add Process': + case 'Add Process Instance': { - functionLibraryUiObjectsFromNodes.addProcess(payload.node) + functionLibraryUiObjectsFromNodes.addProcessInstance(payload.node) } break case 'Add Backtesting Session': @@ -552,8 +552,8 @@ function newWorkspace () { functionLibraryNodeDeleter.deleteTradingBotInstance(payload.node, thisObject.workspaceNode.rootNodes) break } - case 'Delete Process': { - functionLibraryNodeDeleter.deleteProcess(payload.node, thisObject.workspaceNode.rootNodes) + case 'Delete Process Instance': { + functionLibraryNodeDeleter.deleteProcessInstance(payload.node, thisObject.workspaceNode.rootNodes) break } case 'Delete Backtesting Session': { diff --git a/FloatingSpace/UiObject.js b/FloatingSpace/UiObject.js index c9396f51e..cf630c012 100644 --- a/FloatingSpace/UiObject.js +++ b/FloatingSpace/UiObject.js @@ -229,23 +229,23 @@ function newUiObject () { break case 'Parameters': compatibleType = '->' + 'Trading System' + '->' + 'Backtesting Session' + '->' + 'Live Trading Session' + '->' + 'Paper Trading Session' + '->' + 'Fordward Testing Session' + '->' - compatibleSubType = '->' + 'Trading Engine Process' + '->' + compatibleSubType = '->' + 'Trading Process Instance' + '->' break case 'Backtesting Session': compatibleType = '->' + 'Process Instance' + '->' - compatibleSubType = '->' + 'Trading Engine Process' + '->' + compatibleSubType = '->' + 'Trading Process Instance' + '->' break case 'Live Trading Session': compatibleType = '->' + 'Process Instance' + '->' - compatibleSubType = '->' + 'Trading Engine Process' + '->' + compatibleSubType = '->' + 'Trading Process Instance' + '->' break case 'Paper Trading Session': compatibleType = '->' + 'Process Instance' + '->' - compatibleSubType = '->' + 'Trading Engine Process' + '->' + compatibleSubType = '->' + 'Trading Process Instance' + '->' break case 'Fordward Testing Session': compatibleType = '->' + 'Process Instance' + '->' - compatibleSubType = '->' + 'Trading Engine Process' + '->' + compatibleSubType = '->' + 'Trading Process Instance' + '->' break case 'Base Asset': compatibleType = '->' + 'Parameters' + '->' @@ -309,15 +309,15 @@ function newUiObject () { break case 'Process Instance': switch (thisObject.payload.node.subType) { - case 'Sensor Process': { + case 'Sensor Process Instance': { compatibleType = '->' + 'Sensor Bot Instance' + '->' break } - case 'Indicator Process': { + case 'Indicator Process Instance': { compatibleType = '->' + 'Indicator Bot Instance' + '->' break } - case 'Trading Engine Process': { + case 'Trading Process Instance': { compatibleType = '->' + 'Trading Bot Instance' + '->' break } diff --git a/FloatingSpace/UiObjectConstructor.js b/FloatingSpace/UiObjectConstructor.js index edc4fa2ef..f3e04cc2d 100644 --- a/FloatingSpace/UiObjectConstructor.js +++ b/FloatingSpace/UiObjectConstructor.js @@ -849,9 +849,9 @@ function newUiObjectConstructor () { addLeftIcons(menuItemsInitialValues, floatingObject) menuItemsInitialValues.push( { - action: 'Add Process', + action: 'Add Process Instance', actionFunction: payload.onMenuItemClick, - label: 'Add Process', + label: 'Add Process Instance', visible: true, relatedUiObject: 'Process Instance', rawRadius: 8, @@ -916,9 +916,9 @@ function newUiObjectConstructor () { addLeftIcons(menuItemsInitialValues, floatingObject) menuItemsInitialValues.push( { - action: 'Add Process', + action: 'Add Process Instance', actionFunction: payload.onMenuItemClick, - label: 'Add Process', + label: 'Add Process Instance', visible: true, relatedUiObject: 'Process Instance', rawRadius: 8, @@ -983,9 +983,9 @@ function newUiObjectConstructor () { addLeftIcons(menuItemsInitialValues, floatingObject) menuItemsInitialValues.push( { - action: 'Add Process', + action: 'Add Process Instance', actionFunction: payload.onMenuItemClick, - label: 'Add Process', + label: 'Add Process Instance', visible: true, relatedUiObject: 'Process Instance', rawRadius: 8, @@ -1050,7 +1050,7 @@ function newUiObjectConstructor () { addLeftIcons(menuItemsInitialValues, floatingObject) switch (payload.node.subType) { - case 'Trading Engine Process': { + case 'Trading Process Instance': { menuItemsInitialValues.push( { action: 'Add Backtesting Session', @@ -1105,9 +1105,9 @@ function newUiObjectConstructor () { ) menuItemsInitialValues.push( { - action: 'Edit Process', + action: 'Edit Process Instance', actionFunction: uiObject.codeEditor.activate, - label: 'Edit Process', + label: 'Edit Process Instance', visible: true, iconPathOn: 'html', iconPathOff: 'html', @@ -1120,11 +1120,11 @@ function newUiObjectConstructor () { ) menuItemsInitialValues.push( { - action: 'Delete Process', + action: 'Delete Process Instance', askConfirmation: true, confirmationLabel: 'Confirm to Delete', actionFunction: payload.onMenuItemClick, - label: 'Delete Process', + label: 'Delete Process Instance', visible: true, iconPathOn: 'delete', iconPathOff: 'delete', @@ -1153,9 +1153,9 @@ function newUiObjectConstructor () { default: { menuItemsInitialValues.push( { - action: 'Edit Process', + action: 'Edit Process Instance', actionFunction: uiObject.codeEditor.activate, - label: 'Edit Process', + label: 'Edit Process Instance', visible: true, iconPathOn: 'html', iconPathOff: 'html', @@ -1168,11 +1168,11 @@ function newUiObjectConstructor () { ) menuItemsInitialValues.push( { - action: 'Delete Process', + action: 'Delete Process Instance', askConfirmation: true, confirmationLabel: 'Confirm to Delete', actionFunction: payload.onMenuItemClick, - label: 'Delete Process', + label: 'Delete Process Instance', visible: true, iconPathOn: 'delete', iconPathOff: 'delete', From 939e111b005200a59c93aca2e8c8287b9b104e28 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sun, 27 Oct 2019 21:45:01 +0100 Subject: [PATCH 18/95] Trading Engine final refactoring --- Panels/ProductsPanel.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Panels/ProductsPanel.js b/Panels/ProductsPanel.js index a6cce9c60..12d4d976a 100644 --- a/Panels/ProductsPanel.js +++ b/Panels/ProductsPanel.js @@ -271,7 +271,7 @@ function newProductsPanel () { calculateVisbleProductCards() function synchronizeLayersAndProductCards () { - /* We will look into the ecosystem to know which Trading Engine bots are defined there. */ + /* We will look into the ecosystem to know which Trading bots are defined there. */ let ecosystem = JSON.parse(window.localStorage.getItem('ecosystem')) if (ecosystem === null || ecosystem === undefined) { ecosystem = getUserEcosystem() @@ -300,7 +300,7 @@ function newProductsPanel () { if (bot.type !== 'Trading Bot Instance') { continue } if (devTeam.codeName === code.team && bot.codeName === code.bot) { - /* We found an instance of the same Trading Engine we are currently looking at. + /* We found an instance of the same Trading we are currently looking at. Next thing to do is to see its layers to see if we can match it with the current product. */ for (let m = 0; m < tradingBotInstance.processes.length; m++) { From 30800639a5bb4636dba3db6683043aabf12f3053 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sun, 27 Oct 2019 22:36:19 +0100 Subject: [PATCH 19/95] Network as root node part 1 --- DesignerSpace/Workspace/Workspace.js | 40 ++++++++++++---------------- FloatingSpace/UiObject.js | 2 +- 2 files changed, 18 insertions(+), 24 deletions(-) diff --git a/DesignerSpace/Workspace/Workspace.js b/DesignerSpace/Workspace/Workspace.js index bc86e3f76..bc16e3966 100644 --- a/DesignerSpace/Workspace/Workspace.js +++ b/DesignerSpace/Workspace/Workspace.js @@ -148,16 +148,13 @@ function newWorkspace () { function stopAllRunningTasks () { for (let i = 0; i < thisObject.workspaceNode.rootNodes.length; i++) { let rootNode = thisObject.workspaceNode.rootNodes[i] - if (rootNode.type === 'Definition') { - let definition = rootNode - if (definition.network !== undefined) { - if (definition.network.networkNodes !== undefined) { - for (let j = 0; j < definition.network.networkNodes.length; j++) { - let networkNode = definition.network.networkNodes[j] - for (let i = 0; i < networkNode.taskManagers.length; i++) { - let taskManager = networkNode.taskManagers[i] - taskManager.payload.uiObject.menu.internalClick('Stop All Tasks') - } + if (rootNode.type === 'Network') { + if (rootNode.networkNodes !== undefined) { + for (let j = 0; j < rootNode.networkNodes.length; j++) { + let networkNode = rootNode.networkNodes[j] + for (let i = 0; i < networkNode.taskManagers.length; i++) { + let taskManager = networkNode.taskManagers[i] + taskManager.payload.uiObject.menu.internalClick('Stop All Tasks') } } } @@ -169,19 +166,16 @@ function newWorkspace () { let tradingBotInstances = [] for (let i = 0; i < thisObject.workspaceNode.rootNodes.length; i++) { let rootNode = thisObject.workspaceNode.rootNodes[i] - if (rootNode.type === 'Definition') { - let definition = rootNode - if (definition.network !== undefined) { - if (definition.network.networkNodes !== undefined) { - for (let j = 0; j < definition.network.networkNodes.length; j++) { - let networkNode = definition.network.networkNodes[j] - for (let i = 0; i < networkNode.taskManagers.length; i++) { - let taskManager = networkNode.taskManagers[i] - for (k = 0; k < taskManager.tasks.length; k++) { - let task = taskManager.tasks[k] - if (task.bot.type === 'Trading Bot Instance') { - tradingBotInstances.push(task.bot) - } + if (rootNode.type === 'Network') { + if (rootNode.networkNodes !== undefined) { + for (let j = 0; j < rootNode.networkNodes.length; j++) { + let networkNode = rootNode.networkNodes[j] + for (let i = 0; i < networkNode.taskManagers.length; i++) { + let taskManager = networkNode.taskManagers[i] + for (k = 0; k < taskManager.tasks.length; k++) { + let task = taskManager.tasks[k] + if (task.bot.type === 'Trading Bot Instance') { + tradingBotInstances.push(task.bot) } } } diff --git a/FloatingSpace/UiObject.js b/FloatingSpace/UiObject.js index cf630c012..b30927122 100644 --- a/FloatingSpace/UiObject.js +++ b/FloatingSpace/UiObject.js @@ -1034,7 +1034,7 @@ function newUiObject () { browserCanvasContext.fill() - if (thisObject.payload.node.type === 'Definition') { + if (thisObject.payload.node.type === 'Definition' || thisObject.payload.node.type === 'Network') { VISIBLE_RADIUS = thisObject.container.frame.radius * 2 let OPACITY = 1 From 6cd3b1c1fde9e58d7aa3459a262e0e97ad279f48 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sun, 27 Oct 2019 22:50:11 +0100 Subject: [PATCH 20/95] Add Network from Workspace --- .../FunctionLibraries/UiObjectsFromNodes.js | 11 +++--- FloatingSpace/UiObjectConstructor.js | 36 +++++++++---------- 2 files changed, 22 insertions(+), 25 deletions(-) diff --git a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js index a3881ef50..807373fea 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js +++ b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js @@ -568,14 +568,13 @@ function newUiObjectsFromNodes () { } function addNetwork (node) { - if (node.network === undefined) { - node.network = { - name: 'Superalgos' - } - createUiObject('Network', node.network.name, node.network, node, node, 'Network') + let network = { + name: 'Superalgos' } + node.rootNodes.push(network) + createUiObject('Network', network.name, network, node, undefined, 'Network') - return node.network + return network } function addNetworkNode (node) { diff --git a/FloatingSpace/UiObjectConstructor.js b/FloatingSpace/UiObjectConstructor.js index f3e04cc2d..27c25a6bc 100644 --- a/FloatingSpace/UiObjectConstructor.js +++ b/FloatingSpace/UiObjectConstructor.js @@ -204,7 +204,18 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: -10 + angle: -20 + }, + { + action: 'Add Network', + actionFunction: payload.onMenuItemClick, + label: 'Add Network', + visible: true, + relatedUiObject: 'Network', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: 0 }, { action: 'Share Workspace', @@ -216,7 +227,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: 10 + angle: 20 }] break } @@ -234,7 +245,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: -40 + angle: -30 } ) menuItemsInitialValues.push( @@ -247,22 +258,9 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: -20 + angle: -10 } ) - menuItemsInitialValues.push( - { - action: 'Add Network', - actionFunction: payload.onMenuItemClick, - label: 'Add Network', - visible: true, - relatedUiObject: 'Network', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: 0 - } - ) menuItemsInitialValues.push( { action: 'Delete Definition', @@ -276,7 +274,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: 20 + angle: 10 } ) menuItemsInitialValues.push( @@ -290,7 +288,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: 40 + angle: 30 } ) break From 9919697af817d710a6c4f1d0b26e455b75818df0 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sun, 27 Oct 2019 23:21:09 +0100 Subject: [PATCH 21/95] Removing Network from Definition --- DesignerSpace/Workspace/FunctionLibraries/AttachDetach.js | 2 -- DesignerSpace/Workspace/FunctionLibraries/NodeChildren.js | 6 ------ DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js | 3 --- DesignerSpace/Workspace/FunctionLibraries/OnFocus.js | 4 ---- DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js | 3 +-- DesignerSpace/Workspace/FunctionLibraries/ShortcutKeys.js | 4 ---- .../Workspace/FunctionLibraries/UiObjectsFromNodes.js | 3 --- FloatingSpace/UiObject.js | 4 ---- 8 files changed, 1 insertion(+), 28 deletions(-) diff --git a/DesignerSpace/Workspace/FunctionLibraries/AttachDetach.js b/DesignerSpace/Workspace/FunctionLibraries/AttachDetach.js index 490cb33ec..7958f430d 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/AttachDetach.js +++ b/DesignerSpace/Workspace/FunctionLibraries/AttachDetach.js @@ -12,8 +12,6 @@ function newAttachDetach () { return } case 'Network': { - node.payload.parentNode.network = undefined - completeDetachment(node, rootNodes) return } case 'Network Node': { diff --git a/DesignerSpace/Workspace/FunctionLibraries/NodeChildren.js b/DesignerSpace/Workspace/FunctionLibraries/NodeChildren.js index 7800e7a1d..603ced9a9 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/NodeChildren.js +++ b/DesignerSpace/Workspace/FunctionLibraries/NodeChildren.js @@ -181,12 +181,6 @@ function newNodeChildren () { response.childIndex = response.childrenCount } } - if (parentNode.network !== undefined) { - response.childrenCount++ - if (parentNode.network.id === childNode.id) { - response.childIndex = response.childrenCount - } - } return response } diff --git a/DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js b/DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js index 304dc5403..17ff46171 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js +++ b/DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js @@ -291,9 +291,6 @@ function newNodeDeleter () { if (node.personalData !== undefined) { deletePersonalData(node.personalData, rootNodes) } - if (node.network !== undefined) { - deleteNetwork(node.network, rootNodes) - } completeDeletion(node, rootNodes) destroyUiObject(node) diff --git a/DesignerSpace/Workspace/FunctionLibraries/OnFocus.js b/DesignerSpace/Workspace/FunctionLibraries/OnFocus.js index cd540b2df..67bda0ead 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/OnFocus.js +++ b/DesignerSpace/Workspace/FunctionLibraries/OnFocus.js @@ -723,10 +723,6 @@ function newOnFocus () { if (child !== undefined) { return child } - child = getNodeThatIsOnFocus(node.network) - if (child !== undefined) { - return child - } if (node.payload.uiObject.isOnFocus === true) { return node } else { diff --git a/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js b/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js index 3b418abe1..80a9c7da9 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js +++ b/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js @@ -1005,8 +1005,7 @@ function newProtocolNode () { subType: node.subType, name: node.name, tradingSystem: getProtocolNode(node.tradingSystem, removePersonalData, parseCode, includeIds, includePayload), - personalData: getProtocolNode(node.personalData, removePersonalData, parseCode, includeIds, includePayload), - network: getProtocolNode(node.network, removePersonalData, parseCode, includeIds, includePayload) + personalData: getProtocolNode(node.personalData, removePersonalData, parseCode, includeIds, includePayload) } if (includeIds) { object.id = node.id diff --git a/DesignerSpace/Workspace/FunctionLibraries/ShortcutKeys.js b/DesignerSpace/Workspace/FunctionLibraries/ShortcutKeys.js index b35cc119e..251226452 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/ShortcutKeys.js +++ b/DesignerSpace/Workspace/FunctionLibraries/ShortcutKeys.js @@ -708,10 +708,6 @@ function newShortcutKeys () { if (child !== undefined) { return child } - child = getNodeByShortcutKey(node.network, searchingKey) - if (child !== undefined) { - return child - } if (node.payload.uiObject.shortcutKey === searchingKey) { return node } else { diff --git a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js index 807373fea..13b9e7bfa 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js +++ b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js @@ -390,9 +390,6 @@ function newUiObjectsFromNodes () { if (node.personalData !== undefined) { createUiObjectFromNode(node.personalData, node, node) } - if (node.network !== undefined) { - createUiObjectFromNode(node.network, node, node) - } return } case 'Network': { diff --git a/FloatingSpace/UiObject.js b/FloatingSpace/UiObject.js index b30927122..d858b00b7 100644 --- a/FloatingSpace/UiObject.js +++ b/FloatingSpace/UiObject.js @@ -207,10 +207,6 @@ function newUiObject () { compatibleType = '->' + 'Definition' + '->' compatibleSubType = undefined break - case 'Network': - compatibleType = '->' + 'Definition' + '->' - compatibleSubType = undefined - break case 'Network Node': compatibleType = '->' + 'Network' + '->' compatibleSubType = undefined From a35b674fc742f304a89329b2a0f5e9ce14f5a807 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 28 Oct 2019 09:52:49 +0100 Subject: [PATCH 22/95] refactoring from attac to chainAttach --- .../{AttachDetach.js => ChainAttachDetach.js} | 10 +- DesignerSpace/Workspace/Workspace.js | 14 +-- FloatingSpace/UiObject.js | 107 +++++++++--------- 3 files changed, 65 insertions(+), 66 deletions(-) rename DesignerSpace/Workspace/FunctionLibraries/{AttachDetach.js => ChainAttachDetach.js} (99%) diff --git a/DesignerSpace/Workspace/FunctionLibraries/AttachDetach.js b/DesignerSpace/Workspace/FunctionLibraries/ChainAttachDetach.js similarity index 99% rename from DesignerSpace/Workspace/FunctionLibraries/AttachDetach.js rename to DesignerSpace/Workspace/FunctionLibraries/ChainAttachDetach.js index 7958f430d..c4d4b9b3c 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/AttachDetach.js +++ b/DesignerSpace/Workspace/FunctionLibraries/ChainAttachDetach.js @@ -1,12 +1,12 @@ -function newAttachDetach () { +function newChainAttachDetach () { thisObject = { - detachNode: detachNode, - attachNode: attachNode + chainDetachNode: chainDetachNode, + chainAttachNode: chainAttachNode } return thisObject - function detachNode (node, rootNodes) { + function chainDetachNode (node, rootNodes) { switch (node.type) { case 'Definition': { return @@ -356,7 +356,7 @@ function newAttachDetach () { } } - function attachNode (node, attachToNode, rootNodes) { + function chainAttachNode (node, attachToNode, rootNodes) { switch (node.type) { case 'Network': { node.payload.parentNode = attachToNode diff --git a/DesignerSpace/Workspace/Workspace.js b/DesignerSpace/Workspace/Workspace.js index bc16e3966..96b3ddf4a 100644 --- a/DesignerSpace/Workspace/Workspace.js +++ b/DesignerSpace/Workspace/Workspace.js @@ -18,8 +18,8 @@ function newWorkspace () { onMenuItemClick: onMenuItemClick, physics: physics, spawn: spawn, - detachNode: detachNode, - attachNode: attachNode, + chainDetachNode: chainDetachNode, + chainAttachNode: chainAttachNode, initialize: initialize, finalize: finalize } @@ -44,7 +44,7 @@ function newWorkspace () { thisObject.workspaceNode = {} thisObject.workspaceNode.rootNodes = [] - let functionLibraryAttachDetach = newAttachDetach() + let functionLibraryChainAttachDetach = newChainAttachDetach() let functionLibraryNodeDeleter = newNodeDeleter() let functionLibraryUiObjectsFromNodes = newUiObjectsFromNodes() let functionLibraryProtocolNode = newProtocolNode() @@ -106,12 +106,12 @@ function newWorkspace () { } } - function detachNode (node) { - functionLibraryAttachDetach.detachNode(node, thisObject.workspaceNode.rootNodes) + function chainDetachNode (node) { + functionLibraryChainAttachDetach.chainDetachNode(node, thisObject.workspaceNode.rootNodes) } - function attachNode (node, attachToNode) { - functionLibraryAttachDetach.attachNode(node, attachToNode, thisObject.workspaceNode.rootNodes) + function chainAttachNode (node, attachToNode) { + functionLibraryChainAttachDetach.chainAttachNode(node, attachToNode, thisObject.workspaceNode.rootNodes) } function physics () { diff --git a/FloatingSpace/UiObject.js b/FloatingSpace/UiObject.js index d858b00b7..ce056a427 100644 --- a/FloatingSpace/UiObject.js +++ b/FloatingSpace/UiObject.js @@ -22,8 +22,8 @@ function newUiObject () { shortcutKey: undefined, run: run, stop: stop, - getReadyToAttach: getReadyToAttach, - showAvailabilityToAttach: showAvailabilityToAttach, + getReadyToChainAttach: getReadyToChainAttach, + showAvailabilityToChainAttach: showAvailabilityToChainAttach, highlight: highlight, setErrorMessage: setErrorMessage, setValue: setValue, @@ -65,17 +65,16 @@ function newUiObject () { let previousDistance - let readyToAttachDisplayCounter = 5 - let readyToAttachDisplayIncrement = 0.1 + let readyToChainAttachDisplayCounter = 5 + let readyToChainAttachDisplayIncrement = 0.1 + let readyToChainAttachCounter = 0 + let isReadyToChainAttach + let availableToChainAttachCounter = 0 + let isAvailableToChainAttach + let isChainAttaching = false + let chainAttachToNode - let readyToAttachCounter = 0 - let isReadyToAttach - let availableToAttachCounter = 0 - let isAvailableToAttach - - let isAttaching = false let isDragging = false - let attachToNode let errorMessage = '' let currentValue = 0 @@ -106,7 +105,7 @@ function newUiObject () { } icon = undefined - attachToNode = undefined + chainAttachToNode = undefined } function initialize (payload, menuItemsInitialValues) { @@ -183,12 +182,12 @@ function newUiObject () { highlightPhisycs() errorMessagePhisycs() valuePhisycs() - detachingPhysics() - attachingPhysics() + chainDetachingPhysics() + chainAttachingPhysics() } - function attachingPhysics () { - attacchingCounters() + function chainAttachingPhysics () { + chainAttacchingCounters() if (thisObject.isOnFocus !== true) { return } if (isDragging !== true) { return } @@ -408,8 +407,8 @@ function newUiObject () { return } let foundCompatible = false - attachToNode = undefined - isAttaching = false + chainAttachToNode = undefined + isChainAttaching = false for (let i = 0; i < nearbyFloatingObjects.length; i++) { let nearby = nearbyFloatingObjects[i] @@ -477,54 +476,54 @@ function newUiObject () { } if (foundCompatible === false) { if (distance < thisObject.container.frame.radius * 1.5 + floatingObject.container.frame.radius * 1.5) { - nearbyNode.payload.uiObject.getReadyToAttach() - isAttaching = true - attachToNode = nearbyNode + nearbyNode.payload.uiObject.getReadyToChainAttach() + isChainAttaching = true + chainAttachToNode = nearbyNode foundCompatible = true } } - nearbyNode.payload.uiObject.showAvailabilityToAttach() + nearbyNode.payload.uiObject.showAvailabilityToChainAttach() } } } - function attacchingCounters () { - if (readyToAttachDisplayCounter > 15) { - readyToAttachDisplayIncrement = -0.25 + function chainAttacchingCounters () { + if (readyToChainAttachDisplayCounter > 15) { + readyToChainAttachDisplayIncrement = -0.25 } - if (readyToAttachDisplayCounter < 5) { - readyToAttachDisplayIncrement = 0.25 + if (readyToChainAttachDisplayCounter < 5) { + readyToChainAttachDisplayIncrement = 0.25 } - readyToAttachDisplayCounter = readyToAttachDisplayCounter + readyToAttachDisplayIncrement + readyToChainAttachDisplayCounter = readyToChainAttachDisplayCounter + readyToChainAttachDisplayIncrement - readyToAttachCounter-- - if (readyToAttachCounter <= 0) { - readyToAttachCounter = 0 - isReadyToAttach = false + readyToChainAttachCounter-- + if (readyToChainAttachCounter <= 0) { + readyToChainAttachCounter = 0 + isReadyToChainAttach = false } else { - isReadyToAttach = true + isReadyToChainAttach = true } - availableToAttachCounter-- - if (availableToAttachCounter <= 0) { - availableToAttachCounter = 0 - isAvailableToAttach = false + availableToChainAttachCounter-- + if (availableToChainAttachCounter <= 0) { + availableToChainAttachCounter = 0 + isAvailableToChainAttach = false } else { - isAvailableToAttach = true + isAvailableToChainAttach = true } } - function getReadyToAttach () { - readyToAttachCounter = 10 + function getReadyToChainAttach () { + readyToChainAttachCounter = 10 } - function showAvailabilityToAttach () { - availableToAttachCounter = 10 + function showAvailabilityToChainAttach () { + availableToChainAttachCounter = 10 } - function detachingPhysics () { + function chainDetachingPhysics () { if (isDragging !== true) { return } if (thisObject.payload.floatingObject.isFrozen === true) { return } if (rightDragging === false) { return } @@ -545,7 +544,7 @@ function newUiObject () { if (previousDistance !== undefined) { if (ratio > THRESHOLD) { - canvas.designerSpace.workspace.detachNode(thisObject.payload.node) + canvas.designerSpace.workspace.chainDetachNode(thisObject.payload.node) } } } @@ -687,10 +686,10 @@ function newUiObject () { } function onDragFinished (event) { - if (isAttaching === true) { - canvas.designerSpace.workspace.attachNode(thisObject.payload.node, attachToNode) - attachToNode = undefined - isAttaching = false + if (isChainAttaching === true) { + canvas.designerSpace.workspace.chainAttachNode(thisObject.payload.node, chainAttachToNode) + chainAttachToNode = undefined + isChainAttaching = false } isDragging = false } @@ -1086,9 +1085,9 @@ function newUiObject () { browserCanvasContext.stroke() } - if (isReadyToAttach === true) { - VISIBLE_RADIUS = thisObject.container.frame.radius * 2 + readyToAttachDisplayCounter * 2 - let OPACITY = readyToAttachCounter / 10 + if (isReadyToChainAttach === true) { + VISIBLE_RADIUS = thisObject.container.frame.radius * 2 + readyToChainAttachDisplayCounter * 2 + let OPACITY = readyToChainAttachCounter / 10 browserCanvasContext.beginPath() browserCanvasContext.arc(visiblePosition.x, visiblePosition.y, VISIBLE_RADIUS, 0, Math.PI * 2, true) @@ -1097,13 +1096,13 @@ function newUiObject () { browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.TITANIUM_YELLOW + ', ' + OPACITY + ')' browserCanvasContext.lineWidth = 10 - browserCanvasContext.setLineDash([readyToAttachDisplayCounter, readyToAttachDisplayCounter * 2]) + browserCanvasContext.setLineDash([readyToChainAttachDisplayCounter, readyToChainAttachDisplayCounter * 2]) browserCanvasContext.stroke() } - if (isAvailableToAttach === true && isReadyToAttach === false) { + if (isAvailableToChainAttach === true && isReadyToChainAttach === false) { VISIBLE_RADIUS = thisObject.container.frame.radius * 1.5 - let OPACITY = availableToAttachCounter / 10 + let OPACITY = availableToChainAttachCounter / 10 browserCanvasContext.beginPath() browserCanvasContext.arc(visiblePosition.x, visiblePosition.y, VISIBLE_RADIUS, 0, Math.PI * 2, true) From adb1f5b372cdb22594c58d065b7d25837297b42e Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 28 Oct 2019 11:20:18 +0100 Subject: [PATCH 23/95] Reference Attach Detach Semi implemented --- .../ReferenceAttachDetach.js | 82 ++++++ DesignerSpace/Workspace/Workspace.js | 11 + FloatingSpace/UiObject.js | 275 +++++++++++++++++- 3 files changed, 365 insertions(+), 3 deletions(-) create mode 100644 DesignerSpace/Workspace/FunctionLibraries/ReferenceAttachDetach.js diff --git a/DesignerSpace/Workspace/FunctionLibraries/ReferenceAttachDetach.js b/DesignerSpace/Workspace/FunctionLibraries/ReferenceAttachDetach.js new file mode 100644 index 000000000..05f4b18dd --- /dev/null +++ b/DesignerSpace/Workspace/FunctionLibraries/ReferenceAttachDetach.js @@ -0,0 +1,82 @@ +function newReferenceAttachDetach () { + thisObject = { + referenceDetachNode: referenceDetachNode, + referenceAttachNode: referenceAttachNode + } + + return thisObject + + function referenceDetachNode (node, rootNodes) { + switch (node.type) { + case 'Backtesting Session': { + node.payload.parentNode.session = undefined + completeDetachment(node, rootNodes) + return + } + case 'Live Trading Session': { + node.payload.parentNode.session = undefined + completeDetachment(node, rootNodes) + return + } + case 'Fordward Testing Session': { + node.payload.parentNode.session = undefined + completeDetachment(node, rootNodes) + return + } + case 'Paper Trading Session': { + node.payload.parentNode.session = undefined + completeDetachment(node, rootNodes) + return + } + } + } + + function referenceAttachNode (node, attachToNode, rootNodes) { + switch (node.type) { + case 'Backtesting Session': { + node.payload.parentNode = attachToNode + node.payload.referenceParent = attachToNode + node.payload.parentNode.session = node + completeAttachment(node, rootNodes) + } + break + case 'Live Trading Session': { + node.payload.parentNode = attachToNode + node.payload.referenceParent = attachToNode + node.payload.parentNode.session = node + completeAttachment(node, rootNodes) + } + break + case 'Fordward Testing Session': { + node.payload.parentNode = attachToNode + node.payload.referenceParent = attachToNode + node.payload.parentNode.session = node + completeAttachment(node, rootNodes) + } + break + case 'Paper Trading Session': { + node.payload.parentNode = attachToNode + node.payload.referenceParent = attachToNode + node.payload.parentNode.session = node + completeAttachment(node, rootNodes) + } + break + } + } + + function completeDetachment (node, rootNodes) { + node.payload.parentNode = undefined + node.payload.referenceParent = undefined + rootNodes.push(node) + } + + function completeAttachment (node, rootNodes) { + for (let i = 0; i < rootNodes.length; i++) { + let rootNode = rootNodes[i] + if (rootNode.id === node.id) { + rootNodes.splice(i, 1) + return + } + } + } +} diff --git a/DesignerSpace/Workspace/Workspace.js b/DesignerSpace/Workspace/Workspace.js index 96b3ddf4a..ffbead028 100644 --- a/DesignerSpace/Workspace/Workspace.js +++ b/DesignerSpace/Workspace/Workspace.js @@ -20,6 +20,8 @@ function newWorkspace () { spawn: spawn, chainDetachNode: chainDetachNode, chainAttachNode: chainAttachNode, + referenceDetachNode: referenceDetachNode, + referenceAttachNode: referenceAttachNode, initialize: initialize, finalize: finalize } @@ -44,6 +46,7 @@ function newWorkspace () { thisObject.workspaceNode = {} thisObject.workspaceNode.rootNodes = [] + let functionLibraryReferenceAttachDetach = newReferenceAttachDetach() let functionLibraryChainAttachDetach = newChainAttachDetach() let functionLibraryNodeDeleter = newNodeDeleter() let functionLibraryUiObjectsFromNodes = newUiObjectsFromNodes() @@ -114,6 +117,14 @@ function newWorkspace () { functionLibraryChainAttachDetach.chainAttachNode(node, attachToNode, thisObject.workspaceNode.rootNodes) } + function referenceDetachNode (node) { + functionLibraryReferenceAttachDetach.referenceDetachNode(node, thisObject.workspaceNode.rootNodes) + } + + function referenceAttachNode (node, attachToNode) { + functionLibraryReferenceAttachDetach.referenceAttachNode(node, attachToNode, thisObject.workspaceNode.rootNodes) + } + function physics () { if (thisObject.enabled !== true) { return } /* Here we will save all the workspace related objects into the local storage */ diff --git a/FloatingSpace/UiObject.js b/FloatingSpace/UiObject.js index ce056a427..b9409dade 100644 --- a/FloatingSpace/UiObject.js +++ b/FloatingSpace/UiObject.js @@ -24,6 +24,8 @@ function newUiObject () { stop: stop, getReadyToChainAttach: getReadyToChainAttach, showAvailabilityToChainAttach: showAvailabilityToChainAttach, + getReadyToReferenceAttach: getReadyToReferenceAttach, + showAvailabilityToReferenceAttach: showAvailabilityToReferenceAttach, highlight: highlight, setErrorMessage: setErrorMessage, setValue: setValue, @@ -74,6 +76,15 @@ function newUiObject () { let isChainAttaching = false let chainAttachToNode + let readyToReferenceAttachDisplayCounter = 5 + let readyToReferenceAttachDisplayIncrement = 0.1 + let readyToReferenceAttachCounter = 0 + let isReadyToReferenceAttach + let availableToReferenceAttachCounter = 0 + let isAvailableToReferenceAttach + let isReferenceAttaching = false + let referenceAttachToNode + let isDragging = false let errorMessage = '' @@ -106,6 +117,7 @@ function newUiObject () { icon = undefined chainAttachToNode = undefined + referenceAttachToNode = undefined } function initialize (payload, menuItemsInitialValues) { @@ -184,6 +196,8 @@ function newUiObject () { valuePhisycs() chainDetachingPhysics() chainAttachingPhysics() + referenceDetachingPhysics() + referenceAttachingPhysics() } function chainAttachingPhysics () { @@ -549,6 +563,180 @@ function newUiObject () { } } + function referenceAttachingPhysics () { + referenceAttacchingCounters() + + if (thisObject.isOnFocus !== true) { return } + if (isDragging !== true) { return } + if (rightDragging !== true) { return } + if (thisObject.payload.referenceParent !== undefined) { return } + + let nearbyFloatingObjects = thisObject.payload.floatingObject.nearbyFloatingObjects + let compatibleType + let compatibleSubType + switch (thisObject.payload.node.type) { + case 'Backtesting Session': + compatibleType = '->' + 'Definition' + '->' + compatibleSubType = undefined + break + case 'Live Trading Session': + compatibleType = '->' + 'Definition' + '->' + compatibleSubType = undefined + break + case 'Paper Trading Session': + compatibleType = '->' + 'Definition' + '->' + compatibleSubType = undefined + break + case 'Fordward Testing Session': + compatibleType = '->' + 'Definition' + '->' + compatibleSubType = undefined + break + default: + return + } + let foundCompatible = false + referenceAttachToNode = undefined + isReferenceAttaching = false + + for (let i = 0; i < nearbyFloatingObjects.length; i++) { + let nearby = nearbyFloatingObjects[i] + let distance = nearby[0] + let floatingObject = nearby[1] + let nearbyNode = floatingObject.payload.node + if (compatibleType.indexOf('->' + nearbyNode.type + '->') >= 0) { + /* Discard objects with busy coonection ports */ + if (thisObject.payload.node.type === 'Task' && nearbyNode.task !== undefined) { continue } + if (thisObject.payload.node.type === 'Sensor Bot Instance' && nearbyNode.bot !== undefined) { continue } + if (thisObject.payload.node.type === 'Indicator Bot Instance' && nearbyNode.bot !== undefined) { continue } + if (thisObject.payload.node.type === 'Trading Bot Instance' && nearbyNode.bot !== undefined) { continue } + if (thisObject.payload.node.type === 'Process Instance' && nearbyNode.process !== undefined) { continue } + if (thisObject.payload.node.type === 'Trading System' && nearbyNode.tradingSystem !== undefined) { continue } + if (thisObject.payload.node.type === 'Personal Data' && nearbyNode.personalData !== undefined) { continue } + if (thisObject.payload.node.type === 'Parameters' && nearbyNode.parameters !== undefined) { continue } + if (thisObject.payload.node.type === 'Backtesting Session' && nearbyNode.session !== undefined) { continue } + if (thisObject.payload.node.type === 'Live Trading Session' && nearbyNode.session !== undefined) { continue } + if (thisObject.payload.node.type === 'Fordward Testing Session' && nearbyNode.session !== undefined) { continue } + if (thisObject.payload.node.type === 'Paper Trading Session' && nearbyNode.session !== undefined) { continue } + if (thisObject.payload.node.type === 'Base Asset' && nearbyNode.baseAsset !== undefined) { continue } + if (thisObject.payload.node.type === 'Time Range' && nearbyNode.timeRange !== undefined) { continue } + if (thisObject.payload.node.type === 'Time Period' && nearbyNode.timePeriod !== undefined) { continue } + if (thisObject.payload.node.type === 'Slippage' && nearbyNode.slippage !== undefined) { continue } + if (thisObject.payload.node.type === 'Fee Structure' && nearbyNode.feeStructure !== undefined) { continue } + if (thisObject.payload.node.type === 'Trigger Stage' && nearbyNode.triggerStage !== undefined) { continue } + if (thisObject.payload.node.type === 'Open Stage' && nearbyNode.openStage !== undefined) { continue } + if (thisObject.payload.node.type === 'Manage Stage' && nearbyNode.manageStage !== undefined) { continue } + if (thisObject.payload.node.type === 'Close Stage' && nearbyNode.closeStage !== undefined) { continue } + if (thisObject.payload.node.type === 'Position Size' && nearbyNode.positionSize !== undefined) { continue } + if (thisObject.payload.node.type === 'Position Rate' && nearbyNode.positionRate !== undefined) { continue } + if (thisObject.payload.node.type === 'Take Position Event' && nearbyNode.takePosition !== undefined) { continue } + if (thisObject.payload.node.type === 'Trigger Off Event' && nearbyNode.triggerOff !== undefined) { continue } + if (thisObject.payload.node.type === 'Trigger On Event' && nearbyNode.triggerOn !== undefined) { continue } + if (thisObject.payload.node.type === 'Initial Definition' && nearbyNode.initialDefinition !== undefined) { continue } + if (thisObject.payload.node.type === 'Open Execution' && nearbyNode.openExecution !== undefined) { continue } + if (thisObject.payload.node.type === 'Close Execution' && nearbyNode.closeExecution !== undefined) { continue } + if (thisObject.payload.node.type === 'Stop' && nearbyNode.stopLoss !== undefined) { continue } + if (thisObject.payload.node.type === 'Take Profit' && nearbyNode.takeProfit !== undefined) { continue } + if (thisObject.payload.node.type === 'Formula' && nearbyNode.formula !== undefined) { continue } + if (thisObject.payload.node.type === 'Next Phase Event' && nearbyNode.nextPhaseEvent !== undefined) { continue } + if (thisObject.payload.node.type === 'Code' && nearbyNode.code !== undefined) { continue } + /* Here we check if the subtypes are compatible. */ + if (nearbyNode.subType !== undefined && compatibleSubType !== undefined) { + if (compatibleSubType.indexOf('->' + nearbyNode.subType + '->') < 0) { + continue + } + } + /* Discard Phases without partent */ + if (thisObject.payload.node.type === 'Phase' && nearbyNode.type === 'Phase' && nearbyNode.payload.parentNode === undefined) { continue } + /* Control maxPhases */ + if (thisObject.payload.node.type === 'Phase') { + if (nearbyNode.maxPhases !== undefined) { + if (nearbyNode.phases.length >= nearbyNode.maxPhases) { + continue + } + } + } + if (thisObject.payload.node.type === 'Phase' && nearbyNode.type === 'Phase') { + if (nearbyNode.payload.parentNode.maxPhases !== undefined) { + if (nearbyNode.payload.parentNode.phases.length >= nearbyNode.payload.parentNode.maxPhases) { + continue + } + } + } + if (foundCompatible === false) { + if (distance < thisObject.container.frame.radius * 1.5 + floatingObject.container.frame.radius * 1.5) { + nearbyNode.payload.uiObject.getReadyToReferenceAttach() + isReferenceAttaching = true + referenceAttachToNode = nearbyNode + foundCompatible = true + } + } + nearbyNode.payload.uiObject.showAvailabilityToReferenceAttach() + } + } + } + + function referenceAttacchingCounters () { + if (readyToReferenceAttachDisplayCounter > 15) { + readyToReferenceAttachDisplayIncrement = -0.25 + } + + if (readyToReferenceAttachDisplayCounter < 5) { + readyToReferenceAttachDisplayIncrement = 0.25 + } + + readyToReferenceAttachDisplayCounter = readyToReferenceAttachDisplayCounter + readyToReferenceAttachDisplayIncrement + + readyToReferenceAttachCounter-- + if (readyToReferenceAttachCounter <= 0) { + readyToReferenceAttachCounter = 0 + isReadyToReferenceAttach = false + } else { + isReadyToReferenceAttach = true + } + + availableToReferenceAttachCounter-- + if (availableToReferenceAttachCounter <= 0) { + availableToReferenceAttachCounter = 0 + isAvailableToReferenceAttach = false + } else { + isAvailableToReferenceAttach = true + } + } + + function getReadyToReferenceAttach () { + readyToReferenceAttachCounter = 10 + } + + function showAvailabilityToReferenceAttach () { + availableToReferenceAttachCounter = 10 + } + + function referenceDetachingPhysics () { + if (isDragging !== true) { return } + if (thisObject.payload.floatingObject.isFrozen === true) { return } + if (rightDragging === false) { return } + + let distanceToReferenceParent = Math.sqrt(Math.pow(thisObject.payload.position.x - thisObject.payload.targetPosition.x, 2) + Math.pow(thisObject.payload.position.y - thisObject.payload.targetPosition.y, 2)) + let ratio = distanceToReferenceParent / previousDistance + if (previousDistance === 0) { + previousDistance = distanceToReferenceParent + return + } + previousDistance = distanceToReferenceParent + + if (thisObject.isOnFocus !== true) { return } + if (thisObject.payload.referenceParent === undefined) { return } + if (thisObject.payload.parentNode === undefined) { return } + + let THRESHOLD = 1.15 + + if (previousDistance !== undefined) { + if (ratio > THRESHOLD) { + canvas.designerSpace.workspace.referenceDetachNode(thisObject.payload.node) + } + } + } + function highlightPhisycs () { highlightCounter-- if (highlightCounter < 0) { @@ -691,12 +879,18 @@ function newUiObject () { chainAttachToNode = undefined isChainAttaching = false } + if (isReferenceAttaching === true) { + canvas.designerSpace.workspace.referenceAttachNode(thisObject.payload.node, referenceAttachToNode) + referenceAttachToNode = undefined + isReferenceAttaching = false + } isDragging = false } function drawBackground () { if (thisObject.isOnFocus === false) { - drawConnectingLine() + drawReferenceLine() + drawChainLine() if (isDragging === false && thisObject.isOnFocus === true) { thisObject.menu.drawBackground() @@ -731,7 +925,8 @@ function newUiObject () { function drawOnFocus () { if (thisObject.isOnFocus === true) { - drawConnectingLine() + drawReferenceLine() + drawChainLine() if (thisObject.codeEditor !== undefined) { thisObject.codeEditor.drawBackground() @@ -761,7 +956,7 @@ function newUiObject () { } } - function drawConnectingLine () { + function drawChainLine () { if (thisObject.payload.chainParent === undefined) { return } let targetPoint = { @@ -811,6 +1006,50 @@ function newUiObject () { } } + function drawReferenceLine () { + if (thisObject.payload.referenceParent === undefined) { return } + + let targetPoint = { + x: thisObject.payload.targetPosition.x, + y: thisObject.payload.targetPosition.y + } + + let position = { + x: 0, + y: 0 + } + + targetPoint = canvas.floatingSpace.container.frame.frameThisPoint(targetPoint) + position = thisObject.container.frame.frameThisPoint(position) + + if (thisObject.container.frame.radius > 1) { + /* Target Line */ + + let LINE_STYLE = UI_COLOR.GREY + + browserCanvasContext.beginPath() + browserCanvasContext.moveTo(position.x, position.y) + browserCanvasContext.lineTo(targetPoint.x, targetPoint.y) + browserCanvasContext.strokeStyle = 'rgba(' + LINE_STYLE + ', 1)' + browserCanvasContext.setLineDash([1, 4]) + browserCanvasContext.lineWidth = 1 + browserCanvasContext.stroke() + browserCanvasContext.setLineDash([0, 0]) + } + + if (thisObject.container.frame.radius > 0.5) { + /* Target Spot */ + + let radius = 1 + + browserCanvasContext.beginPath() + browserCanvasContext.arc(targetPoint.x, targetPoint.y, radius, 0, Math.PI * 2, true) + browserCanvasContext.closePath() + browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.WHITE + ', 1)' + browserCanvasContext.fill() + } + } + function drawText () { /* Text Follows */ let position = { @@ -1114,6 +1353,36 @@ function newUiObject () { browserCanvasContext.setLineDash([8, 20]) browserCanvasContext.stroke() } + + if (isReadyToReferenceAttach === true) { + VISIBLE_RADIUS = thisObject.container.frame.radius * 2 + readyToReferenceAttachDisplayCounter * 2 + let OPACITY = readyToReferenceAttachCounter / 10 + + browserCanvasContext.beginPath() + browserCanvasContext.arc(visiblePosition.x, visiblePosition.y, VISIBLE_RADIUS, 0, Math.PI * 2, true) + browserCanvasContext.closePath() + + browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.TITANIUM_YELLOW + ', ' + OPACITY + ')' + + browserCanvasContext.lineWidth = 10 + browserCanvasContext.setLineDash([readyToReferenceAttachDisplayCounter, readyToReferenceAttachDisplayCounter * 2]) + browserCanvasContext.stroke() + } + + if (isAvailableToReferenceAttach === true && isReadyToReferenceAttach === false) { + VISIBLE_RADIUS = thisObject.container.frame.radius * 1.5 + let OPACITY = availableToReferenceAttachCounter / 10 + + browserCanvasContext.beginPath() + browserCanvasContext.arc(visiblePosition.x, visiblePosition.y, VISIBLE_RADIUS, 0, Math.PI * 2, true) + browserCanvasContext.closePath() + + browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.TURQUOISE + ', ' + OPACITY + ')' + + browserCanvasContext.lineWidth = 10 + browserCanvasContext.setLineDash([8, 20]) + browserCanvasContext.stroke() + } } /* Image */ From af44ceb1914f57e69635d05926810e7ebfa58beb Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 28 Oct 2019 11:50:47 +0100 Subject: [PATCH 24/95] Colores --- FloatingSpace/UiObject.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/FloatingSpace/UiObject.js b/FloatingSpace/UiObject.js index b9409dade..5e1c2bc71 100644 --- a/FloatingSpace/UiObject.js +++ b/FloatingSpace/UiObject.js @@ -1362,7 +1362,7 @@ function newUiObject () { browserCanvasContext.arc(visiblePosition.x, visiblePosition.y, VISIBLE_RADIUS, 0, Math.PI * 2, true) browserCanvasContext.closePath() - browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.TITANIUM_YELLOW + ', ' + OPACITY + ')' + browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.LIGHT_GREY + ', ' + OPACITY + ')' browserCanvasContext.lineWidth = 10 browserCanvasContext.setLineDash([readyToReferenceAttachDisplayCounter, readyToReferenceAttachDisplayCounter * 2]) @@ -1377,7 +1377,7 @@ function newUiObject () { browserCanvasContext.arc(visiblePosition.x, visiblePosition.y, VISIBLE_RADIUS, 0, Math.PI * 2, true) browserCanvasContext.closePath() - browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.TURQUOISE + ', ' + OPACITY + ')' + browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.GREY + ', ' + OPACITY + ')' browserCanvasContext.lineWidth = 10 browserCanvasContext.setLineDash([8, 20]) From 85157e0b11da00a65e219755be95aebda7c0b2b4 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 28 Oct 2019 12:56:33 +0100 Subject: [PATCH 25/95] Attaching References --- .../ReferenceAttachDetach.js | 49 ++++++----------- .../FunctionLibraries/UiObjectsFromNodes.js | 6 ++- FloatingSpace/UiObject.js | 53 +------------------ 3 files changed, 22 insertions(+), 86 deletions(-) diff --git a/DesignerSpace/Workspace/FunctionLibraries/ReferenceAttachDetach.js b/DesignerSpace/Workspace/FunctionLibraries/ReferenceAttachDetach.js index 05f4b18dd..203721ebf 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/ReferenceAttachDetach.js +++ b/DesignerSpace/Workspace/FunctionLibraries/ReferenceAttachDetach.js @@ -9,23 +9,19 @@ function newReferenceAttachDetach () { function referenceDetachNode (node, rootNodes) { switch (node.type) { case 'Backtesting Session': { - node.payload.parentNode.session = undefined - completeDetachment(node, rootNodes) + completeDetachment(node, attachToNode) return } case 'Live Trading Session': { - node.payload.parentNode.session = undefined - completeDetachment(node, rootNodes) + completeDetachment(node, attachToNode) return } case 'Fordward Testing Session': { - node.payload.parentNode.session = undefined - completeDetachment(node, rootNodes) + completeDetachment(node, attachToNode) return } case 'Paper Trading Session': { - node.payload.parentNode.session = undefined - completeDetachment(node, rootNodes) + completeDetachment(node, attachToNode) return } } @@ -34,47 +30,34 @@ function newReferenceAttachDetach () { function referenceAttachNode (node, attachToNode, rootNodes) { switch (node.type) { case 'Backtesting Session': { - node.payload.parentNode = attachToNode - node.payload.referenceParent = attachToNode - node.payload.parentNode.session = node - completeAttachment(node, rootNodes) + completeAttachment(node, attachToNode) } break case 'Live Trading Session': { - node.payload.parentNode = attachToNode - node.payload.referenceParent = attachToNode - node.payload.parentNode.session = node - completeAttachment(node, rootNodes) + completeAttachment(node, attachToNode) } break case 'Fordward Testing Session': { - node.payload.parentNode = attachToNode - node.payload.referenceParent = attachToNode - node.payload.parentNode.session = node - completeAttachment(node, rootNodes) + completeAttachment(node, attachToNode) } break case 'Paper Trading Session': { - node.payload.parentNode = attachToNode - node.payload.referenceParent = attachToNode - node.payload.parentNode.session = node - completeAttachment(node, rootNodes) + completeAttachment(node, attachToNode) } break } } - function completeDetachment (node, rootNodes) { - node.payload.parentNode = undefined - node.payload.referenceParent = undefined - rootNodes.push(node) + function completeAttachment (node, attachToNode) { + node.payload.referenceParent = attachToNode + attachToNode.referenceChildren.push(node) } - function completeAttachment (node, rootNodes) { - for (let i = 0; i < rootNodes.length; i++) { - let rootNode = rootNodes[i] - if (rootNode.id === node.id) { - rootNodes.splice(i, 1) + function completeDetachment (node, attachToNode) { + for (let i = 0; i < attachToNode.referenceChildren.length; i++) { + let child = attachToNode.referenceChildren[i] + if (child.id === node.id) { + attachToNode.referenceChildren.splice(i, 1) return } } diff --git a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js index 13b9e7bfa..f9d73e81d 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js +++ b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js @@ -390,6 +390,9 @@ function newUiObjectsFromNodes () { if (node.personalData !== undefined) { createUiObjectFromNode(node.personalData, node, node) } + if (node.referenceChildren === undefined) { + node.referenceChildren = [] + } return } case 'Network': { @@ -781,7 +784,8 @@ function newUiObjectsFromNodes () { function addDefinition (node) { let definition = { - name: 'New Definition' + name: 'New Definition', + referenceChildren: [] } node.rootNodes.push(definition) createUiObject('Definition', definition.name, definition, node, undefined, 'Definition') diff --git a/FloatingSpace/UiObject.js b/FloatingSpace/UiObject.js index 5e1c2bc71..e83b92b3e 100644 --- a/FloatingSpace/UiObject.js +++ b/FloatingSpace/UiObject.js @@ -604,64 +604,13 @@ function newUiObject () { let floatingObject = nearby[1] let nearbyNode = floatingObject.payload.node if (compatibleType.indexOf('->' + nearbyNode.type + '->') >= 0) { - /* Discard objects with busy coonection ports */ - if (thisObject.payload.node.type === 'Task' && nearbyNode.task !== undefined) { continue } - if (thisObject.payload.node.type === 'Sensor Bot Instance' && nearbyNode.bot !== undefined) { continue } - if (thisObject.payload.node.type === 'Indicator Bot Instance' && nearbyNode.bot !== undefined) { continue } - if (thisObject.payload.node.type === 'Trading Bot Instance' && nearbyNode.bot !== undefined) { continue } - if (thisObject.payload.node.type === 'Process Instance' && nearbyNode.process !== undefined) { continue } - if (thisObject.payload.node.type === 'Trading System' && nearbyNode.tradingSystem !== undefined) { continue } - if (thisObject.payload.node.type === 'Personal Data' && nearbyNode.personalData !== undefined) { continue } - if (thisObject.payload.node.type === 'Parameters' && nearbyNode.parameters !== undefined) { continue } - if (thisObject.payload.node.type === 'Backtesting Session' && nearbyNode.session !== undefined) { continue } - if (thisObject.payload.node.type === 'Live Trading Session' && nearbyNode.session !== undefined) { continue } - if (thisObject.payload.node.type === 'Fordward Testing Session' && nearbyNode.session !== undefined) { continue } - if (thisObject.payload.node.type === 'Paper Trading Session' && nearbyNode.session !== undefined) { continue } - if (thisObject.payload.node.type === 'Base Asset' && nearbyNode.baseAsset !== undefined) { continue } - if (thisObject.payload.node.type === 'Time Range' && nearbyNode.timeRange !== undefined) { continue } - if (thisObject.payload.node.type === 'Time Period' && nearbyNode.timePeriod !== undefined) { continue } - if (thisObject.payload.node.type === 'Slippage' && nearbyNode.slippage !== undefined) { continue } - if (thisObject.payload.node.type === 'Fee Structure' && nearbyNode.feeStructure !== undefined) { continue } - if (thisObject.payload.node.type === 'Trigger Stage' && nearbyNode.triggerStage !== undefined) { continue } - if (thisObject.payload.node.type === 'Open Stage' && nearbyNode.openStage !== undefined) { continue } - if (thisObject.payload.node.type === 'Manage Stage' && nearbyNode.manageStage !== undefined) { continue } - if (thisObject.payload.node.type === 'Close Stage' && nearbyNode.closeStage !== undefined) { continue } - if (thisObject.payload.node.type === 'Position Size' && nearbyNode.positionSize !== undefined) { continue } - if (thisObject.payload.node.type === 'Position Rate' && nearbyNode.positionRate !== undefined) { continue } - if (thisObject.payload.node.type === 'Take Position Event' && nearbyNode.takePosition !== undefined) { continue } - if (thisObject.payload.node.type === 'Trigger Off Event' && nearbyNode.triggerOff !== undefined) { continue } - if (thisObject.payload.node.type === 'Trigger On Event' && nearbyNode.triggerOn !== undefined) { continue } - if (thisObject.payload.node.type === 'Initial Definition' && nearbyNode.initialDefinition !== undefined) { continue } - if (thisObject.payload.node.type === 'Open Execution' && nearbyNode.openExecution !== undefined) { continue } - if (thisObject.payload.node.type === 'Close Execution' && nearbyNode.closeExecution !== undefined) { continue } - if (thisObject.payload.node.type === 'Stop' && nearbyNode.stopLoss !== undefined) { continue } - if (thisObject.payload.node.type === 'Take Profit' && nearbyNode.takeProfit !== undefined) { continue } - if (thisObject.payload.node.type === 'Formula' && nearbyNode.formula !== undefined) { continue } - if (thisObject.payload.node.type === 'Next Phase Event' && nearbyNode.nextPhaseEvent !== undefined) { continue } - if (thisObject.payload.node.type === 'Code' && nearbyNode.code !== undefined) { continue } /* Here we check if the subtypes are compatible. */ if (nearbyNode.subType !== undefined && compatibleSubType !== undefined) { if (compatibleSubType.indexOf('->' + nearbyNode.subType + '->') < 0) { continue } } - /* Discard Phases without partent */ - if (thisObject.payload.node.type === 'Phase' && nearbyNode.type === 'Phase' && nearbyNode.payload.parentNode === undefined) { continue } - /* Control maxPhases */ - if (thisObject.payload.node.type === 'Phase') { - if (nearbyNode.maxPhases !== undefined) { - if (nearbyNode.phases.length >= nearbyNode.maxPhases) { - continue - } - } - } - if (thisObject.payload.node.type === 'Phase' && nearbyNode.type === 'Phase') { - if (nearbyNode.payload.parentNode.maxPhases !== undefined) { - if (nearbyNode.payload.parentNode.phases.length >= nearbyNode.payload.parentNode.maxPhases) { - continue - } - } - } + if (foundCompatible === false) { if (distance < thisObject.container.frame.radius * 1.5 + floatingObject.container.frame.radius * 1.5) { nearbyNode.payload.uiObject.getReadyToReferenceAttach() From 375d30dcb2e7f0815d543cc8c93d80795fd8b794 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 28 Oct 2019 13:40:59 +0100 Subject: [PATCH 26/95] Reference Attaching and Detaching working well --- .../ReferenceAttachDetach.js | 19 +++++----- DesignerSpace/Workspace/Workspace.js | 2 +- FloatingSpace/UiObject.js | 38 ++++++++++--------- 3 files changed, 32 insertions(+), 27 deletions(-) diff --git a/DesignerSpace/Workspace/FunctionLibraries/ReferenceAttachDetach.js b/DesignerSpace/Workspace/FunctionLibraries/ReferenceAttachDetach.js index 203721ebf..8fb0227cf 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/ReferenceAttachDetach.js +++ b/DesignerSpace/Workspace/FunctionLibraries/ReferenceAttachDetach.js @@ -6,22 +6,22 @@ function newReferenceAttachDetach () { return thisObject - function referenceDetachNode (node, rootNodes) { + function referenceDetachNode (node) { switch (node.type) { case 'Backtesting Session': { - completeDetachment(node, attachToNode) + completeDetachment(node) return } case 'Live Trading Session': { - completeDetachment(node, attachToNode) + completeDetachment(node) return } case 'Fordward Testing Session': { - completeDetachment(node, attachToNode) + completeDetachment(node) return } case 'Paper Trading Session': { - completeDetachment(node, attachToNode) + completeDetachment(node) return } } @@ -53,11 +53,12 @@ function newReferenceAttachDetach () { attachToNode.referenceChildren.push(node) } - function completeDetachment (node, attachToNode) { - for (let i = 0; i < attachToNode.referenceChildren.length; i++) { - let child = attachToNode.referenceChildren[i] + function completeDetachment (node) { + node.payload.referenceParent = undefined + for (let i = 0; i < node.payload.referenceParent.referenceChildren.length; i++) { + let child = node.payload.referenceParent.referenceChildren[i] if (child.id === node.id) { - attachToNode.referenceChildren.splice(i, 1) + node.payload.referenceParent.referenceChildren.splice(i, 1) return } } diff --git a/DesignerSpace/Workspace/Workspace.js b/DesignerSpace/Workspace/Workspace.js index ffbead028..931604710 100644 --- a/DesignerSpace/Workspace/Workspace.js +++ b/DesignerSpace/Workspace/Workspace.js @@ -118,7 +118,7 @@ function newWorkspace () { } function referenceDetachNode (node) { - functionLibraryReferenceAttachDetach.referenceDetachNode(node, thisObject.workspaceNode.rootNodes) + functionLibraryReferenceAttachDetach.referenceDetachNode(node) } function referenceAttachNode (node, attachToNode) { diff --git a/FloatingSpace/UiObject.js b/FloatingSpace/UiObject.js index e83b92b3e..4a234597e 100644 --- a/FloatingSpace/UiObject.js +++ b/FloatingSpace/UiObject.js @@ -65,8 +65,7 @@ function newUiObject () { let hasValue let valueCounter = 0 - let previousDistance - + let previousDistanceToChainParent let readyToChainAttachDisplayCounter = 5 let readyToChainAttachDisplayIncrement = 0.1 let readyToChainAttachCounter = 0 @@ -76,6 +75,7 @@ function newUiObject () { let isChainAttaching = false let chainAttachToNode + let previousDistanceToReferenceParent let readyToReferenceAttachDisplayCounter = 5 let readyToReferenceAttachDisplayIncrement = 0.1 let readyToReferenceAttachCounter = 0 @@ -543,12 +543,12 @@ function newUiObject () { if (rightDragging === false) { return } let distanceToChainParent = Math.sqrt(Math.pow(thisObject.payload.position.x - thisObject.payload.targetPosition.x, 2) + Math.pow(thisObject.payload.position.y - thisObject.payload.targetPosition.y, 2)) - let ratio = distanceToChainParent / previousDistance - if (previousDistance === 0) { - previousDistance = distanceToChainParent + let ratio = distanceToChainParent / previousDistanceToChainParent + if (previousDistanceToChainParent === 0) { + previousDistanceToChainParent = distanceToChainParent return } - previousDistance = distanceToChainParent + previousDistanceToChainParent = distanceToChainParent if (thisObject.isOnFocus !== true) { return } if (thisObject.payload.chainParent === undefined) { return } @@ -556,7 +556,7 @@ function newUiObject () { let THRESHOLD = 1.15 - if (previousDistance !== undefined) { + if (previousDistanceToChainParent !== undefined) { if (ratio > THRESHOLD) { canvas.designerSpace.workspace.chainDetachNode(thisObject.payload.node) } @@ -664,14 +664,15 @@ function newUiObject () { if (isDragging !== true) { return } if (thisObject.payload.floatingObject.isFrozen === true) { return } if (rightDragging === false) { return } + if (thisObject.payload.referenceParent === undefined) { return } - let distanceToReferenceParent = Math.sqrt(Math.pow(thisObject.payload.position.x - thisObject.payload.targetPosition.x, 2) + Math.pow(thisObject.payload.position.y - thisObject.payload.targetPosition.y, 2)) - let ratio = distanceToReferenceParent / previousDistance - if (previousDistance === 0) { - previousDistance = distanceToReferenceParent + let distanceToReferenceParent = Math.sqrt(Math.pow(thisObject.payload.position.x - thisObject.payload.referenceParent.payload.position.x, 2) + Math.pow(thisObject.payload.position.y - thisObject.payload.referenceParent.payload.position.y, 2)) + let ratio = distanceToReferenceParent / previousDistanceToReferenceParent + if (previousDistanceToReferenceParent === 0) { + previousDistanceToReferenceParent = distanceToReferenceParent return } - previousDistance = distanceToReferenceParent + previousDistanceToReferenceParent = distanceToReferenceParent if (thisObject.isOnFocus !== true) { return } if (thisObject.payload.referenceParent === undefined) { return } @@ -679,7 +680,7 @@ function newUiObject () { let THRESHOLD = 1.15 - if (previousDistance !== undefined) { + if (previousDistanceToReferenceParent !== undefined) { if (ratio > THRESHOLD) { canvas.designerSpace.workspace.referenceDetachNode(thisObject.payload.node) } @@ -820,6 +821,9 @@ function newUiObject () { } else { rightDragging = false } + + previousDistanceToReferenceParent = undefined + previousDistanceToChainParent = undefined } function onDragFinished (event) { @@ -959,8 +963,8 @@ function newUiObject () { if (thisObject.payload.referenceParent === undefined) { return } let targetPoint = { - x: thisObject.payload.targetPosition.x, - y: thisObject.payload.targetPosition.y + x: thisObject.payload.referenceParent.payload.position.x, + y: thisObject.payload.referenceParent.payload.position.y } let position = { @@ -980,8 +984,8 @@ function newUiObject () { browserCanvasContext.moveTo(position.x, position.y) browserCanvasContext.lineTo(targetPoint.x, targetPoint.y) browserCanvasContext.strokeStyle = 'rgba(' + LINE_STYLE + ', 1)' - browserCanvasContext.setLineDash([1, 4]) - browserCanvasContext.lineWidth = 1 + browserCanvasContext.setLineDash([2, 20]) + browserCanvasContext.lineWidth = 2 browserCanvasContext.stroke() browserCanvasContext.setLineDash([0, 0]) } From bd3016877f7e5e2bb47bb7b3095bfddb57378d55 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 28 Oct 2019 15:36:01 +0100 Subject: [PATCH 27/95] Delete Objects with References --- .../FunctionLibraries/NodeDeleter.js | 100 +++++------------- .../ReferenceAttachDetach.js | 2 +- 2 files changed, 25 insertions(+), 77 deletions(-) diff --git a/DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js b/DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js index 17ff46171..89669bfa6 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js +++ b/DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js @@ -270,34 +270,25 @@ function newNodeDeleter () { cleanNode(node) } - function deleteDefinition (node, rootNodes, forced) { + function deleteDefinition (node, rootNodes) { let payload = node.payload - if (forced !== true) { - /* Can not delete if it is the last one */ - let counter = 0 - for (let i = 0; i < rootNodes.length; i++) { - let rootNode = rootNodes[i] - if (rootNode.type === node.type) { - counter++ - } - } - if (counter <= 1) { return } - } - if (node.tradingSystem !== undefined) { deleteTradingSystem(node.tradingSystem, rootNodes) } if (node.personalData !== undefined) { deletePersonalData(node.personalData, rootNodes) } - + for (let i = 0; i < node.referenceChildren.length; i++) { + let child = node.referenceChildren[i] + child.payload.referenceParent = undefined + } completeDeletion(node, rootNodes) destroyUiObject(node) cleanNode(node) } - function deleteNetwork (node, rootNodes, forced) { + function deleteNetwork (node, rootNodes) { let payload = node.payload if (payload.parentNode !== undefined) { @@ -315,7 +306,7 @@ function newNodeDeleter () { cleanNode(node) } - function deleteNetworkNode (node, rootNodes, forced) { + function deleteNetworkNode (node, rootNodes) { let payload = node.payload if (payload.parentNode !== undefined) { @@ -513,75 +504,22 @@ function newNodeDeleter () { } function deleteBacktestingSession (node, rootNodes) { - let payload = node.payload - - if (payload.parentNode !== undefined) { - payload.parentNode.session = undefined - } - - if (node.parameters !== undefined) { - deleteParameters(node.parameters, rootNodes) - } - - if (node.layerManager !== undefined) { - deleteLayerManager(node.layerManager, rootNodes) - } - - if (node.socialBots !== undefined) { - deleteSocialBots(node.socialBots, rootNodes) - } - completeDeletion(node, rootNodes) - destroyUiObject(node) - cleanNode(node) + deleteSession(node, rootNodes) } function deleteLiveTradingSession (node, rootNodes) { - let payload = node.payload - - if (payload.parentNode !== undefined) { - payload.parentNode.session = undefined - } - - if (node.parameters !== undefined) { - deleteParameters(node.parameters, rootNodes) - } - - if (node.layerManager !== undefined) { - deleteLayerManager(node.layerManager, rootNodes) - } - - if (node.socialBots !== undefined) { - deleteSocialBots(node.socialBots, rootNodes) - } - completeDeletion(node, rootNodes) - destroyUiObject(node) - cleanNode(node) + deleteSession(node, rootNodes) } function deleteFordwardTestingSession (node, rootNodes) { - let payload = node.payload - - if (payload.parentNode !== undefined) { - payload.parentNode.session = undefined - } - - if (node.parameters !== undefined) { - deleteParameters(node.parameters, rootNodes) - } - - if (node.layerManager !== undefined) { - deleteLayerManager(node.layerManager, rootNodes) - } - - if (node.socialBots !== undefined) { - deleteSocialBots(node.socialBots, rootNodes) - } - completeDeletion(node, rootNodes) - destroyUiObject(node) - cleanNode(node) + deleteSession(node, rootNodes) } function deletePaperTradingSession (node, rootNodes) { + deleteSession(node, rootNodes) + } + + function deleteSession (node, rootNodes) { let payload = node.payload if (payload.parentNode !== undefined) { @@ -599,6 +537,16 @@ function newNodeDeleter () { if (node.socialBots !== undefined) { deleteSocialBots(node.socialBots, rootNodes) } + if (node.payload.referenceParent !== undefined) { + for (let i = 0; i < node.payload.referenceParent.referenceChildren.length; i++) { + let child = node.payload.referenceParent.referenceChildren[i] + if (child.id === node.id) { + node.payload.referenceParent.referenceChildren.splice(i, 1) + return + } + } + } + completeDeletion(node, rootNodes) destroyUiObject(node) cleanNode(node) diff --git a/DesignerSpace/Workspace/FunctionLibraries/ReferenceAttachDetach.js b/DesignerSpace/Workspace/FunctionLibraries/ReferenceAttachDetach.js index 8fb0227cf..8a26ecbba 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/ReferenceAttachDetach.js +++ b/DesignerSpace/Workspace/FunctionLibraries/ReferenceAttachDetach.js @@ -54,7 +54,6 @@ function newReferenceAttachDetach () { } function completeDetachment (node) { - node.payload.referenceParent = undefined for (let i = 0; i < node.payload.referenceParent.referenceChildren.length; i++) { let child = node.payload.referenceParent.referenceChildren[i] if (child.id === node.id) { @@ -62,5 +61,6 @@ function newReferenceAttachDetach () { return } } + node.payload.referenceParent = undefined } } From 91c229c9c4a9720aaf6aa85da40eb487339897bb Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 28 Oct 2019 16:05:57 +0100 Subject: [PATCH 28/95] References Being Saved --- .../Workspace/FunctionLibraries/ProtocolNode.js | 10 +++++++++- DesignerSpace/Workspace/Workspace.js | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js b/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js index 80a9c7da9..d5a615e43 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js +++ b/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js @@ -4,7 +4,7 @@ function newProtocolNode () { } return thisObject - function getProtocolNode (node, removePersonalData, parseCode, includeIds, includePayload) { + function getProtocolNode (node, removePersonalData, parseCode, includeIds, includePayload, includeReferences) { if (node === undefined) { return } switch (node.type) { case 'Code': @@ -1013,6 +1013,14 @@ function newProtocolNode () { if (includePayload) { object.savedPayload = getSavedPayload(node) } + if (includeReferences) { + let referenceChildren = [] + for (let i = 0; i < node.referenceChildren.length; i++) { + let child = node.referenceChildren[i] + referenceChildren.push(child.id) + } + object.referenceChildren = referenceChildren + } return object } } diff --git a/DesignerSpace/Workspace/Workspace.js b/DesignerSpace/Workspace/Workspace.js index 931604710..c087df957 100644 --- a/DesignerSpace/Workspace/Workspace.js +++ b/DesignerSpace/Workspace/Workspace.js @@ -142,7 +142,7 @@ function newWorkspace () { let stringifyReadyNodes = [] for (let i = 0; i < thisObject.workspaceNode.rootNodes.length; i++) { let rootNode = thisObject.workspaceNode.rootNodes[i] - let node = functionLibraryProtocolNode.getProtocolNode(rootNode, removePersonalData, false, true, true) + let node = functionLibraryProtocolNode.getProtocolNode(rootNode, removePersonalData, false, true, true, true) if (node) { stringifyReadyNodes.push(node) } From dd55f09e0bd8934814f3b983acf37b9ff6ee7d47 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 28 Oct 2019 16:26:06 +0100 Subject: [PATCH 29/95] saving references finished --- .../FunctionLibraries/ProtocolNode.js | 31 +++++++++++++------ 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js b/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js index d5a615e43..17447e5bd 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js +++ b/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js @@ -886,7 +886,7 @@ function newProtocolNode () { object.id = node.id } if (includePayload) { - object.savedPayload = getSavedPayload(node) + object.savedPayload = getSavedPayload(node, includeReferences) } return object } @@ -907,7 +907,7 @@ function newProtocolNode () { object.id = node.id } if (includePayload) { - object.savedPayload = getSavedPayload(node) + object.savedPayload = getSavedPayload(node, includeReferences) } return object } @@ -928,7 +928,7 @@ function newProtocolNode () { object.id = node.id } if (includePayload) { - object.savedPayload = getSavedPayload(node) + object.savedPayload = getSavedPayload(node, includeReferences) } return object } @@ -949,7 +949,7 @@ function newProtocolNode () { object.id = node.id } if (includePayload) { - object.savedPayload = getSavedPayload(node) + object.savedPayload = getSavedPayload(node, includeReferences) } return object } @@ -1017,7 +1017,13 @@ function newProtocolNode () { let referenceChildren = [] for (let i = 0; i < node.referenceChildren.length; i++) { let child = node.referenceChildren[i] - referenceChildren.push(child.id) + let referencedChild = { + type: child.type, + subType: child.subType, + name: child.name, + id: child.id + } + referenceChildren.push(referencedChild) } object.referenceChildren = referenceChildren } @@ -1026,10 +1032,7 @@ function newProtocolNode () { } } - function getSavedPayload (node) { - if (node.payload === undefined) { - console.log(node) - } + function getSavedPayload (node, includeReferences) { let savedPayload = { position: { x: node.payload.position.x, @@ -1050,6 +1053,16 @@ function newProtocolNode () { shortcutKey: node.payload.uiObject.shortcutKey } } + if (includeReferences) { + if (node.payload.referenceParent !== undefined) { + savedPayload.referenceParent = { + type: node.payload.referenceParent.type, + subType: node.payload.referenceParent.subType, + name: node.payload.referenceParent.name, + id: node.payload.referenceParent.id + } + } + } return savedPayload } } From 39cd096243faf1db5ec52ad8ae658c63b08f52dd Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 28 Oct 2019 17:42:12 +0100 Subject: [PATCH 30/95] Tidyng --- .../Workspace/FunctionLibraries/UiObjectsFromNodes.js | 6 ++++++ DesignerSpace/Workspace/Workspace.js | 8 -------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js index f9d73e81d..372b729e0 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js +++ b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js @@ -352,6 +352,12 @@ function newUiObjectsFromNodes () { case 'Workspace': { let workspace = node createUiObject('Workspace', workspace.name, workspace, parentNode, chainParent, 'Workspace') + if (node.rootNodes !== undefined) { + for (let i = 0; i < node.rootNodes.length; i++) { + let rootNode = node.rootNodes[i] + createUiObjectFromNode(rootNode, undefined, undefined) + } + } return } case 'Personal Data': { diff --git a/DesignerSpace/Workspace/Workspace.js b/DesignerSpace/Workspace/Workspace.js index c087df957..0784efda2 100644 --- a/DesignerSpace/Workspace/Workspace.js +++ b/DesignerSpace/Workspace/Workspace.js @@ -87,10 +87,6 @@ function newWorkspace () { } else { thisObject.workspaceNode = JSON.parse(savedWorkspace) functionLibraryUiObjectsFromNodes.createUiObjectFromNode(thisObject.workspaceNode, undefined, undefined) - for (let i = 0; i < thisObject.workspaceNode.rootNodes.length; i++) { - let rootNode = thisObject.workspaceNode.rootNodes[i] - functionLibraryUiObjectsFromNodes.createUiObjectFromNode(rootNode, undefined, undefined) - } thisObject.enabled = true } } catch (err) { @@ -228,10 +224,6 @@ function newWorkspace () { functionLibraryNodeDeleter.deleteWorkspace(thisObject.workspaceNode, thisObject.workspaceNode.rootNodes) thisObject.workspaceNode = droppedNode functionLibraryUiObjectsFromNodes.createUiObjectFromNode(thisObject.workspaceNode, undefined, undefined) - for (let i = 0; i < thisObject.workspaceNode.rootNodes.length; i++) { - let rootNode = thisObject.workspaceNode.rootNodes[i] - functionLibraryUiObjectsFromNodes.createUiObjectFromNode(rootNode, undefined, undefined) - } } else { let rootNode = functionLibraryProtocolNode.getProtocolNode(droppedNode) thisObject.workspaceNode.rootNodes.push(rootNode) From 24b78e987308846af30f7a916e5fe6ae7a439b9b Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 28 Oct 2019 17:55:21 +0100 Subject: [PATCH 31/95] workspace created inside the lib --- .../FunctionLibraries/UiObjectsFromNodes.js | 31 ++++++++++++------- DesignerSpace/Workspace/Workspace.js | 4 +-- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js index 372b729e0..c969a8728 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js +++ b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js @@ -1,5 +1,6 @@ function newUiObjectsFromNodes () { thisObject = { + recreateWorkspace: recreateWorkspace, createUiObjectFromNode: createUiObjectFromNode, addDefinition: addDefinition, addNetwork: addNetwork, @@ -41,8 +42,27 @@ function newUiObjectsFromNodes () { addCode: addCode } + let mapOfReferenceParents + let mapOfReferenceChildren + return thisObject + function recreateWorkspace (node) { + mapOfReferenceParents = new Map() + mapOfReferenceChildren = new Map() + let workspace = node + createUiObject('Workspace', workspace.name, workspace, undefined, undefined, 'Workspace') + if (node.rootNodes !== undefined) { + for (let i = 0; i < node.rootNodes.length; i++) { + let rootNode = node.rootNodes[i] + createUiObjectFromNode(rootNode, undefined, undefined) + } + } + mapOfReferenceParents = undefined + mapOfReferenceChildren = undefined + return + } + function createUiObjectFromNode (node, parentNode, chainParent) { switch (node.type) { case 'Code': @@ -349,17 +369,6 @@ function newUiObjectsFromNodes () { } return } - case 'Workspace': { - let workspace = node - createUiObject('Workspace', workspace.name, workspace, parentNode, chainParent, 'Workspace') - if (node.rootNodes !== undefined) { - for (let i = 0; i < node.rootNodes.length; i++) { - let rootNode = node.rootNodes[i] - createUiObjectFromNode(rootNode, undefined, undefined) - } - } - return - } case 'Personal Data': { createUiObject('Personal Data', node.name, node, parentNode, chainParent, 'Personal Data') for (let m = 0; m < node.exchangeAccounts.length; m++) { diff --git a/DesignerSpace/Workspace/Workspace.js b/DesignerSpace/Workspace/Workspace.js index 0784efda2..a76beef28 100644 --- a/DesignerSpace/Workspace/Workspace.js +++ b/DesignerSpace/Workspace/Workspace.js @@ -86,7 +86,7 @@ function newWorkspace () { initializeLoadingFromStrategizer() } else { thisObject.workspaceNode = JSON.parse(savedWorkspace) - functionLibraryUiObjectsFromNodes.createUiObjectFromNode(thisObject.workspaceNode, undefined, undefined) + functionLibraryUiObjectsFromNodes.recreateWorkspace(thisObject.workspaceNode) thisObject.enabled = true } } catch (err) { @@ -223,7 +223,7 @@ function newWorkspace () { stopAllRunningTasks() functionLibraryNodeDeleter.deleteWorkspace(thisObject.workspaceNode, thisObject.workspaceNode.rootNodes) thisObject.workspaceNode = droppedNode - functionLibraryUiObjectsFromNodes.createUiObjectFromNode(thisObject.workspaceNode, undefined, undefined) + functionLibraryUiObjectsFromNodes.recreateWorkspace(thisObject.workspaceNode) } else { let rootNode = functionLibraryProtocolNode.getProtocolNode(droppedNode) thisObject.workspaceNode.rootNodes.push(rootNode) From 3e6a4470a5235528ab7f93064d20997f8d99cedb Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 28 Oct 2019 22:00:33 +0100 Subject: [PATCH 32/95] Implementation of reference parent complete --- .../FunctionLibraries/ProtocolNode.js | 16 ++-- .../FunctionLibraries/UiObjectsFromNodes.js | 88 ++++++++++++++++++- FloatingSpace/UiObject.js | 1 - 3 files changed, 96 insertions(+), 9 deletions(-) diff --git a/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js b/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js index 17447e5bd..92b869edb 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js +++ b/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js @@ -1017,15 +1017,17 @@ function newProtocolNode () { let referenceChildren = [] for (let i = 0; i < node.referenceChildren.length; i++) { let child = node.referenceChildren[i] - let referencedChild = { - type: child.type, - subType: child.subType, - name: child.name, - id: child.id + if (child !== undefined) { + let referencedChild = { + type: child.type, + subType: child.subType, + name: child.name, + id: child.id + } + referenceChildren.push(referencedChild) } - referenceChildren.push(referencedChild) } - object.referenceChildren = referenceChildren + object.savedPayload.referenceChildren = referenceChildren } return object } diff --git a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js index c969a8728..f3613d49d 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js +++ b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js @@ -58,8 +58,24 @@ function newUiObjectsFromNodes () { createUiObjectFromNode(rootNode, undefined, undefined) } } - mapOfReferenceParents = undefined + /* We reconstruct here the reference relationships. */ + for (const [key, childNode] of mapOfReferenceChildren) { + childNode.payload.referenceParent = mapOfReferenceParents.get(childNode.savedPayload.referenceParent.id) + childNode.savedPayload = undefined + } + for (const [key, parentNode] of mapOfReferenceParents) { + for (let i = 0; i < parentNode.savedPayload.referenceChildren.length; i++) { + let savedChild = parentNode.savedPayload.referenceChildren[i] + if (savedChild.id !== undefined) { + let referenceChild = mapOfReferenceChildren.get(savedChild.id) + parentNode.referenceChildren.push(referenceChild) + } + } + parentNode.savedPayload = undefined + } mapOfReferenceChildren = undefined + mapOfReferenceParents = undefined + return } @@ -398,6 +414,15 @@ function newUiObjectsFromNodes () { return } case 'Definition': { + let referenceChildren + if (mapOfReferenceParents !== undefined) { + if (node.savedPayload.referenceChildren !== undefined) { + if (node.savedPayload.referenceChildren.length > 0) { + mapOfReferenceParents.set(node.id, node) + referenceChildren = node.savedPayload.referenceChildren + } + } + } createUiObject('Definition', node.name, node, parentNode, chainParent, 'Definition') if (node.tradingSystem !== undefined) { createUiObjectFromNode(node.tradingSystem, node, node) @@ -408,6 +433,11 @@ function newUiObjectsFromNodes () { if (node.referenceChildren === undefined) { node.referenceChildren = [] } + if (referenceChildren !== undefined) { + node.savedPayload = { + referenceChildren: referenceChildren + } + } return } case 'Network': { @@ -528,6 +558,15 @@ function newUiObjectsFromNodes () { return } case 'Backtesting Session': { + 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('Backtesting Session', node.name, node, parentNode, chainParent, 'Backtesting Session') if (node.parameters !== undefined) { createUiObjectFromNode(node.parameters, node, node) @@ -538,9 +577,23 @@ function newUiObjectsFromNodes () { if (node.socialBots !== undefined) { createUiObjectFromNode(node.socialBots, node, node) } + if (referenceParent !== undefined) { + node.savedPayload = { + referenceParent: referenceParent + } + } return } case 'Live Trading Session': { + 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('Live Trading Session', node.name, node, parentNode, chainParent, 'Live Trading Session') if (node.parameters !== undefined) { createUiObjectFromNode(node.parameters, node, node) @@ -551,9 +604,23 @@ function newUiObjectsFromNodes () { if (node.socialBots !== undefined) { createUiObjectFromNode(node.socialBots, node, node) } + if (referenceParent !== undefined) { + node.savedPayload = { + referenceParent: referenceParent + } + } return } case 'Fordward Testing Session': { + 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('Fordward Testing Session', node.name, node, parentNode, chainParent, 'Fordward Testing Session') if (node.parameters !== undefined) { createUiObjectFromNode(node.parameters, node, node) @@ -564,9 +631,23 @@ function newUiObjectsFromNodes () { if (node.socialBots !== undefined) { createUiObjectFromNode(node.socialBots, node, node) } + if (referenceParent !== undefined) { + node.savedPayload = { + referenceParent: referenceParent + } + } return } case 'Paper Trading Session': { + 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('Paper Trading Session', node.name, node, parentNode, chainParent, 'Paper Trading Session') if (node.parameters !== undefined) { createUiObjectFromNode(node.parameters, node, node) @@ -577,6 +658,11 @@ function newUiObjectsFromNodes () { if (node.socialBots !== undefined) { createUiObjectFromNode(node.socialBots, node, node) } + if (referenceParent !== undefined) { + node.savedPayload = { + referenceParent: referenceParent + } + } return } } diff --git a/FloatingSpace/UiObject.js b/FloatingSpace/UiObject.js index 4a234597e..527329946 100644 --- a/FloatingSpace/UiObject.js +++ b/FloatingSpace/UiObject.js @@ -676,7 +676,6 @@ function newUiObject () { if (thisObject.isOnFocus !== true) { return } if (thisObject.payload.referenceParent === undefined) { return } - if (thisObject.payload.parentNode === undefined) { return } let THRESHOLD = 1.15 From 8a712ea30d6d426ff3d4fe93db7134167fa235c4 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 29 Oct 2019 10:04:04 +0100 Subject: [PATCH 33/95] Session working with reference parents --- .../FunctionLibraries/ProtocolNode.js | 140 +++++++++--------- .../FunctionLibraries/SessionFunctions.js | 20 +-- 2 files changed, 76 insertions(+), 84 deletions(-) diff --git a/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js b/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js index 92b869edb..2362606ec 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js +++ b/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js @@ -29,7 +29,7 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - code: getProtocolNode(node.code, removePersonalData, parseCode, includeIds, includePayload) + code: getProtocolNode(node.code, removePersonalData, parseCode, includeIds, includePayload, includeReferences) } if (includeIds) { object.id = node.id @@ -48,7 +48,7 @@ function newProtocolNode () { } for (let m = 0; m < node.conditions.length; m++) { - let condition = getProtocolNode(node.conditions[m], removePersonalData, parseCode, includeIds, includePayload) + let condition = getProtocolNode(node.conditions[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) if (condition !== undefined) { object.conditions.push(condition) } @@ -87,13 +87,13 @@ function newProtocolNode () { announcements: [] } for (let m = 0; m < node.situations.length; m++) { - let situation = getProtocolNode(node.situations[m], removePersonalData, parseCode, includeIds, includePayload) + let situation = getProtocolNode(node.situations[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) if (situation !== undefined) { object.situations.push(situation) } } for (let m = 0; m < node.announcements.length; m++) { - let announcement = getProtocolNode(node.announcements[m], removePersonalData, parseCode, includeIds, includePayload) + let announcement = getProtocolNode(node.announcements[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) if (announcement !== undefined) { object.announcements.push(announcement) } @@ -112,11 +112,11 @@ function newProtocolNode () { subType: node.subType, name: node.name, announcements: [], - formula: getProtocolNode(node.formula, removePersonalData, parseCode, includeIds, includePayload), - nextPhaseEvent: getProtocolNode(node.nextPhaseEvent, removePersonalData, parseCode, includeIds, includePayload) + formula: getProtocolNode(node.formula, removePersonalData, parseCode, includeIds, includePayload, includeReferences), + nextPhaseEvent: getProtocolNode(node.nextPhaseEvent, removePersonalData, parseCode, includeIds, includePayload, includeReferences) } for (let m = 0; m < node.announcements.length; m++) { - let announcement = getProtocolNode(node.announcements[m], removePersonalData, parseCode, includeIds, includePayload) + let announcement = getProtocolNode(node.announcements[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) if (announcement !== undefined) { object.announcements.push(announcement) } @@ -138,7 +138,7 @@ function newProtocolNode () { } for (let m = 0; m < node.phases.length; m++) { - let phase = getProtocolNode(node.phases[m], removePersonalData, parseCode, includeIds, includePayload) + let phase = getProtocolNode(node.phases[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) if (phase !== undefined) { object.phases.push(phase) } @@ -160,7 +160,7 @@ function newProtocolNode () { } for (let m = 0; m < node.phases.length; m++) { - let phase = getProtocolNode(node.phases[m], removePersonalData, parseCode, includeIds, includePayload) + let phase = getProtocolNode(node.phases[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) if (phase !== undefined) { object.phases.push(phase) } @@ -183,13 +183,13 @@ function newProtocolNode () { } for (let m = 0; m < node.situations.length; m++) { - let situation = getProtocolNode(node.situations[m], removePersonalData, parseCode, includeIds, includePayload) + let situation = getProtocolNode(node.situations[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) if (situation !== undefined) { object.situations.push(situation) } } for (let m = 0; m < node.announcements.length; m++) { - let announcement = getProtocolNode(node.announcements[m], removePersonalData, parseCode, includeIds, includePayload) + let announcement = getProtocolNode(node.announcements[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) if (announcement !== undefined) { object.announcements.push(announcement) } @@ -212,11 +212,11 @@ function newProtocolNode () { } for (let m = 0; m < node.situations.length; m++) { - let situation = getProtocolNode(node.situations[m], removePersonalData, parseCode, includeIds, includePayload) + let situation = getProtocolNode(node.situations[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) object.situations.push(situation) } for (let m = 0; m < node.announcements.length; m++) { - let announcement = getProtocolNode(node.announcements[m], removePersonalData, parseCode, includeIds, includePayload) + let announcement = getProtocolNode(node.announcements[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) if (announcement !== undefined) { object.announcements.push(announcement) } @@ -239,13 +239,13 @@ function newProtocolNode () { } for (let m = 0; m < node.situations.length; m++) { - let situation = getProtocolNode(node.situations[m], removePersonalData, parseCode, includeIds, includePayload) + let situation = getProtocolNode(node.situations[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) if (situation !== undefined) { object.situations.push(situation) } } for (let m = 0; m < node.announcements.length; m++) { - let announcement = getProtocolNode(node.announcements[m], removePersonalData, parseCode, includeIds, includePayload) + let announcement = getProtocolNode(node.announcements[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) if (announcement !== undefined) { object.announcements.push(announcement) } @@ -263,10 +263,10 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - stopLoss: getProtocolNode(node.stopLoss, removePersonalData, parseCode, includeIds, includePayload), - takeProfit: getProtocolNode(node.takeProfit, removePersonalData, parseCode, includeIds, includePayload), - positionSize: getProtocolNode(node.positionSize, removePersonalData, parseCode, includeIds, includePayload), - positionRate: getProtocolNode(node.positionRate, removePersonalData, parseCode, includeIds, includePayload) + stopLoss: getProtocolNode(node.stopLoss, removePersonalData, parseCode, includeIds, includePayload, includeReferences), + takeProfit: getProtocolNode(node.takeProfit, removePersonalData, parseCode, includeIds, includePayload, includeReferences), + positionSize: getProtocolNode(node.positionSize, removePersonalData, parseCode, includeIds, includePayload, includeReferences), + positionRate: getProtocolNode(node.positionRate, removePersonalData, parseCode, includeIds, includePayload, includeReferences) } if (includeIds) { object.id = node.id @@ -309,7 +309,7 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - formula: getProtocolNode(node.formula, removePersonalData, parseCode, includeIds, includePayload) + formula: getProtocolNode(node.formula, removePersonalData, parseCode, includeIds, includePayload, includeReferences) } if (includeIds) { object.id = node.id @@ -324,7 +324,7 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - formula: getProtocolNode(node.formula, removePersonalData, parseCode, includeIds, includePayload) + formula: getProtocolNode(node.formula, removePersonalData, parseCode, includeIds, includePayload, includeReferences) } if (includeIds) { object.id = node.id @@ -339,9 +339,9 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - triggerOn: getProtocolNode(node.triggerOn, removePersonalData, parseCode, includeIds, includePayload), - triggerOff: getProtocolNode(node.triggerOff, removePersonalData, parseCode, includeIds, includePayload), - takePosition: getProtocolNode(node.takePosition, removePersonalData, parseCode, includeIds, includePayload) + triggerOn: getProtocolNode(node.triggerOn, removePersonalData, parseCode, includeIds, includePayload, includeReferences), + triggerOff: getProtocolNode(node.triggerOff, removePersonalData, parseCode, includeIds, includePayload, includeReferences), + takePosition: getProtocolNode(node.takePosition, removePersonalData, parseCode, includeIds, includePayload, includeReferences) } if (includeIds) { object.id = node.id @@ -356,8 +356,8 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - initialDefinition: getProtocolNode(node.initialDefinition, removePersonalData, parseCode, includeIds, includePayload), - openExecution: getProtocolNode(node.openExecution, removePersonalData, parseCode, includeIds, includePayload) + initialDefinition: getProtocolNode(node.initialDefinition, removePersonalData, parseCode, includeIds, includePayload, includeReferences), + openExecution: getProtocolNode(node.openExecution, removePersonalData, parseCode, includeIds, includePayload, includeReferences) } if (includeIds) { object.id = node.id @@ -372,8 +372,8 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - stopLoss: getProtocolNode(node.stopLoss, removePersonalData, parseCode, includeIds, includePayload), - takeProfit: getProtocolNode(node.takeProfit, removePersonalData, parseCode, includeIds, includePayload) + stopLoss: getProtocolNode(node.stopLoss, removePersonalData, parseCode, includeIds, includePayload, includeReferences), + takeProfit: getProtocolNode(node.takeProfit, removePersonalData, parseCode, includeIds, includePayload, includeReferences) } if (includeIds) { object.id = node.id @@ -388,7 +388,7 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - closeExecution: getProtocolNode(node.closeExecution, removePersonalData, parseCode, includeIds, includePayload) + closeExecution: getProtocolNode(node.closeExecution, removePersonalData, parseCode, includeIds, includePayload, includeReferences) } if (includeIds) { object.id = node.id @@ -403,10 +403,10 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - triggerStage: getProtocolNode(node.triggerStage, removePersonalData, parseCode, includeIds, includePayload), - openStage: getProtocolNode(node.openStage, removePersonalData, parseCode, includeIds, includePayload), - manageStage: getProtocolNode(node.manageStage, removePersonalData, parseCode, includeIds, includePayload), - closeStage: getProtocolNode(node.closeStage, removePersonalData, parseCode, includeIds, includePayload) + triggerStage: getProtocolNode(node.triggerStage, removePersonalData, parseCode, includeIds, includePayload, includeReferences), + openStage: getProtocolNode(node.openStage, removePersonalData, parseCode, includeIds, includePayload, includeReferences), + manageStage: getProtocolNode(node.manageStage, removePersonalData, parseCode, includeIds, includePayload, includeReferences), + closeStage: getProtocolNode(node.closeStage, removePersonalData, parseCode, includeIds, includePayload, includeReferences) } if (includeIds) { object.id = node.id @@ -508,12 +508,12 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - baseAsset: getProtocolNode(node.baseAsset, removePersonalData, parseCode, includeIds, includePayload), - timeRange: getProtocolNode(node.timeRange, removePersonalData, parseCode, includeIds, includePayload), - timePeriod: getProtocolNode(node.timePeriod, removePersonalData, parseCode, includeIds, includePayload), - slippage: getProtocolNode(node.slippage, removePersonalData, parseCode, includeIds, includePayload), - feeStructure: getProtocolNode(node.feeStructure, removePersonalData, parseCode, includeIds, includePayload), - key: getProtocolNode(node.key, removePersonalData, parseCode, includeIds, includePayload) + baseAsset: getProtocolNode(node.baseAsset, removePersonalData, parseCode, includeIds, includePayload, includeReferences), + timeRange: getProtocolNode(node.timeRange, removePersonalData, parseCode, includeIds, includePayload, includeReferences), + timePeriod: getProtocolNode(node.timePeriod, removePersonalData, parseCode, includeIds, includePayload, includeReferences), + slippage: getProtocolNode(node.slippage, removePersonalData, parseCode, includeIds, includePayload, includeReferences), + feeStructure: getProtocolNode(node.feeStructure, removePersonalData, parseCode, includeIds, includePayload, includeReferences), + key: getProtocolNode(node.key, removePersonalData, parseCode, includeIds, includePayload, includeReferences) } if (includeIds) { object.id = node.id @@ -529,11 +529,11 @@ function newProtocolNode () { subType: node.subType, name: node.name, strategies: [], - parameters: getProtocolNode(node.parameters, removePersonalData, parseCode, includeIds, includePayload) + parameters: getProtocolNode(node.parameters, removePersonalData, parseCode, includeIds, includePayload, includeReferences) } for (let m = 0; m < node.strategies.length; m++) { - let strategy = getProtocolNode(node.strategies[m], removePersonalData, parseCode, includeIds, includePayload) + let strategy = getProtocolNode(node.strategies[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) if (strategy !== undefined) { object.strategies.push(strategy) } @@ -556,7 +556,7 @@ function newProtocolNode () { } for (let m = 0; m < node.exchangeAccounts.length; m++) { - let exchangeAccount = getProtocolNode(node.exchangeAccounts[m], removePersonalData, parseCode, includeIds, includePayload) + let exchangeAccount = getProtocolNode(node.exchangeAccounts[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) if (exchangeAccount !== undefined) { object.exchangeAccounts.push(exchangeAccount) } @@ -580,13 +580,13 @@ function newProtocolNode () { } for (let m = 0; m < node.assets.length; m++) { - let asset = getProtocolNode(node.assets[m], removePersonalData, parseCode, includeIds, includePayload) + let asset = getProtocolNode(node.assets[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) if (asset !== undefined) { object.assets.push(asset) } } for (let m = 0; m < node.keys.length; m++) { - let key = getProtocolNode(node.keys[m], removePersonalData, parseCode, includeIds, includePayload) + let key = getProtocolNode(node.keys[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) if (key !== undefined) { object.keys.push(key) } @@ -639,7 +639,7 @@ function newProtocolNode () { } for (let m = 0; m < node.bots.length; m++) { - let bot = getProtocolNode(node.bots[m], removePersonalData, parseCode, includeIds, includePayload) + let bot = getProtocolNode(node.bots[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) if (bot !== undefined) { object.bots.push(bot) } @@ -663,7 +663,7 @@ function newProtocolNode () { } for (let m = 0; m < node.announcements.length; m++) { - let announcement = getProtocolNode(node.announcements[m], removePersonalData, parseCode, includeIds, includePayload) + let announcement = getProtocolNode(node.announcements[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) if (announcement !== undefined) { object.announcements.push(announcement) } @@ -685,7 +685,7 @@ function newProtocolNode () { subType: node.subType, name: node.name, code: node.code, - formula: getProtocolNode(node.formula, removePersonalData, parseCode, includeIds, includePayload) + formula: getProtocolNode(node.formula, removePersonalData, parseCode, includeIds, includePayload, includeReferences) } if (includeIds) { object.id = node.id @@ -704,7 +704,7 @@ function newProtocolNode () { } for (let m = 0; m < node.layers.length; m++) { - let layer = getProtocolNode(node.layers[m], removePersonalData, parseCode, includeIds, includePayload) + let layer = getProtocolNode(node.layers[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) if (layer !== undefined) { object.layers.push(layer) } @@ -744,7 +744,7 @@ function newProtocolNode () { } for (let m = 0; m < node.tasks.length; m++) { - let task = getProtocolNode(node.tasks[m], removePersonalData, parseCode, includeIds, includePayload) + let task = getProtocolNode(node.tasks[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) if (task !== undefined) { object.tasks.push(task) } @@ -762,7 +762,7 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - bot: getProtocolNode(node.bot, removePersonalData, parseCode, includeIds, includePayload) + bot: getProtocolNode(node.bot, removePersonalData, parseCode, includeIds, includePayload, includeReferences) } if (includeIds) { object.id = node.id @@ -782,7 +782,7 @@ function newProtocolNode () { } for (let m = 0; m < node.processes.length; m++) { - let process = getProtocolNode(node.processes[m], removePersonalData, parseCode, includeIds, includePayload) + let process = getProtocolNode(node.processes[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) if (process !== undefined) { object.processes.push(process) } @@ -808,7 +808,7 @@ function newProtocolNode () { } for (let m = 0; m < node.processes.length; m++) { - let process = getProtocolNode(node.processes[m], removePersonalData, parseCode, includeIds, includePayload) + let process = getProtocolNode(node.processes[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) if (process !== undefined) { object.processes.push(process) } @@ -834,7 +834,7 @@ function newProtocolNode () { } for (let m = 0; m < node.processes.length; m++) { - let process = getProtocolNode(node.processes[m], removePersonalData, parseCode, includeIds, includePayload) + let process = getProtocolNode(node.processes[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) if (process !== undefined) { object.processes.push(process) } @@ -856,7 +856,7 @@ function newProtocolNode () { subType: node.subType, name: node.name, code: node.code, - session: getProtocolNode(node.session, removePersonalData, parseCode, includeIds, includePayload) + session: getProtocolNode(node.session, removePersonalData, parseCode, includeIds, includePayload, includeReferences) } if (parseCode) { object.code = JSON.parse(node.code) @@ -875,9 +875,9 @@ function newProtocolNode () { subType: node.subType, name: node.name, code: node.code, - parameters: getProtocolNode(node.parameters, removePersonalData, parseCode, includeIds, includePayload), - layerManager: getProtocolNode(node.layerManager, removePersonalData, parseCode, includeIds, includePayload), - socialBots: getProtocolNode(node.socialBots, removePersonalData, parseCode, includeIds, includePayload) + parameters: getProtocolNode(node.parameters, removePersonalData, parseCode, includeIds, includePayload, includeReferences), + layerManager: getProtocolNode(node.layerManager, removePersonalData, parseCode, includeIds, includePayload, includeReferences), + socialBots: getProtocolNode(node.socialBots, removePersonalData, parseCode, includeIds, includePayload, includeReferences) } if (parseCode) { object.code = JSON.parse(object.code) @@ -896,9 +896,9 @@ function newProtocolNode () { subType: node.subType, name: node.name, code: node.code, - parameters: getProtocolNode(node.parameters, removePersonalData, parseCode, includeIds, includePayload), - layerManager: getProtocolNode(node.layerManager, removePersonalData, parseCode, includeIds, includePayload), - socialBots: getProtocolNode(node.socialBots, removePersonalData, parseCode, includeIds, includePayload) + parameters: getProtocolNode(node.parameters, removePersonalData, parseCode, includeIds, includePayload, includeReferences), + layerManager: getProtocolNode(node.layerManager, removePersonalData, parseCode, includeIds, includePayload, includeReferences), + socialBots: getProtocolNode(node.socialBots, removePersonalData, parseCode, includeIds, includePayload, includeReferences) } if (parseCode) { object.code = JSON.parse(node.code) @@ -917,9 +917,9 @@ function newProtocolNode () { subType: node.subType, name: node.name, code: node.code, - parameters: getProtocolNode(node.parameters, removePersonalData, parseCode, includeIds, includePayload), - layerManager: getProtocolNode(node.layerManager, removePersonalData, parseCode, includeIds, includePayload), - socialBots: getProtocolNode(node.socialBots, removePersonalData, parseCode, includeIds, includePayload) + parameters: getProtocolNode(node.parameters, removePersonalData, parseCode, includeIds, includePayload, includeReferences), + layerManager: getProtocolNode(node.layerManager, removePersonalData, parseCode, includeIds, includePayload, includeReferences), + socialBots: getProtocolNode(node.socialBots, removePersonalData, parseCode, includeIds, includePayload, includeReferences) } if (parseCode) { object.code = JSON.parse(object.code) @@ -938,9 +938,9 @@ function newProtocolNode () { subType: node.subType, name: node.name, code: node.code, - parameters: getProtocolNode(node.parameters, removePersonalData, parseCode, includeIds, includePayload), - layerManager: getProtocolNode(node.layerManager, removePersonalData, parseCode, includeIds, includePayload), - socialBots: getProtocolNode(node.socialBots, removePersonalData, parseCode, includeIds, includePayload) + parameters: getProtocolNode(node.parameters, removePersonalData, parseCode, includeIds, includePayload, includeReferences), + layerManager: getProtocolNode(node.layerManager, removePersonalData, parseCode, includeIds, includePayload, includeReferences), + socialBots: getProtocolNode(node.socialBots, removePersonalData, parseCode, includeIds, includePayload, includeReferences) } if (parseCode) { object.code = JSON.parse(node.code) @@ -962,7 +962,7 @@ function newProtocolNode () { } if (node.taskManagers !== undefined) { for (let m = 0; m < node.taskManagers.length; m++) { - let taskManager = getProtocolNode(node.taskManagers[m], removePersonalData, parseCode, includeIds, includePayload) + let taskManager = getProtocolNode(node.taskManagers[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) if (taskManager !== undefined) { object.taskManagers.push(taskManager) } @@ -985,7 +985,7 @@ function newProtocolNode () { } if (node.networkNodes !== undefined) { for (let m = 0; m < node.networkNodes.length; m++) { - let networkNode = getProtocolNode(node.networkNodes[m], removePersonalData, parseCode, includeIds, includePayload) + let networkNode = getProtocolNode(node.networkNodes[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) if (networkNode !== undefined) { object.networkNodes.push(networkNode) } @@ -1004,8 +1004,8 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - tradingSystem: getProtocolNode(node.tradingSystem, removePersonalData, parseCode, includeIds, includePayload), - personalData: getProtocolNode(node.personalData, removePersonalData, parseCode, includeIds, includePayload) + tradingSystem: getProtocolNode(node.tradingSystem, removePersonalData, parseCode, includeIds, includePayload, includeReferences), + personalData: getProtocolNode(node.personalData, removePersonalData, parseCode, includeIds, includePayload, includeReferences) } if (includeIds) { object.id = node.id diff --git a/DesignerSpace/Workspace/FunctionLibraries/SessionFunctions.js b/DesignerSpace/Workspace/FunctionLibraries/SessionFunctions.js index b1df94730..ce13dc6bf 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/SessionFunctions.js +++ b/DesignerSpace/Workspace/FunctionLibraries/SessionFunctions.js @@ -18,12 +18,16 @@ function newSessionFunctions () { return } + if (node.payload.referenceParent === undefined) { + callBackFunction(GLOBAL.DEFAULT_FAIL_RESPONSE) + return + } + node.payload.uiObject.run(callBackFunction) let key = node.name + '-' + node.type + '-' + node.id - let thisNodeDefinition = getDefinition(node) - if (thisNodeDefinition === undefined) { return } + let thisNodeDefinition = node.payload.referenceParent /* Raise event to run the session */ let event = { @@ -34,18 +38,6 @@ function newSessionFunctions () { systemEventHandler.raiseEvent(key, 'Run Session', event) - function getDefinition (node) { - if (node.type === 'Definition') { - return node - } - - if (node.payload.parentNode !== undefined) { - return getDefinition(node.payload.parentNode) - } else { - return - } - } - function getUICurrentValues () { let dateAtScreenCorner = new Date(window.localStorage.getItem('Date @ Screen Corner')) let currentTimePeriod = JSON.parse(window.localStorage.getItem('Current Time Period')) From 9efa4547191219b154d71910fb8075b0b4f1b00d Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 29 Oct 2019 13:11:55 +0100 Subject: [PATCH 34/95] Chain Attach Detach implemented for Teams Structure --- .../FunctionLibraries/ChainAttachDetach.js | 294 +++++++++++++++++- .../FunctionLibraries/NodeChildren.js | 47 +++ 2 files changed, 339 insertions(+), 2 deletions(-) diff --git a/DesignerSpace/Workspace/FunctionLibraries/ChainAttachDetach.js b/DesignerSpace/Workspace/FunctionLibraries/ChainAttachDetach.js index c4d4b9b3c..9f1103dc0 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/ChainAttachDetach.js +++ b/DesignerSpace/Workspace/FunctionLibraries/ChainAttachDetach.js @@ -14,6 +14,177 @@ function newChainAttachDetach () { case 'Network': { return } + case 'Team': { + return + } + case 'Sensor Bot': { + let payload = node.payload + for (let i = 0; i < payload.parentNode.sensorBots.length; i++) { + let sensorBot = payload.parentNode.sensorBots[i] + if (sensorBot.id === node.id) { + payload.parentNode.sensorBots.splice(i, 1) + } + } + completeDetachment(node, rootNodes) + return + } + case 'Indicator Bot': { + let payload = node.payload + for (let i = 0; i < payload.parentNode.indicatorBots.length; i++) { + let indicatorBot = payload.parentNode.indicatorBots[i] + if (indicatorBot.id === node.id) { + payload.parentNode.indicatorBots.splice(i, 1) + } + } + completeDetachment(node, rootNodes) + return + } + case 'Trading Bot': { + let payload = node.payload + for (let i = 0; i < payload.parentNode.tradingBots.length; i++) { + let tradingBot = payload.parentNode.tradingBots[i] + if (tradingBot.id === node.id) { + payload.parentNode.tradingBots.splice(i, 1) + } + } + completeDetachment(node, rootNodes) + return + } + case 'Process Definition': { + let payload = node.payload + for (let i = 0; i < payload.parentNode.processes.length; i++) { + let process = payload.parentNode.processes[i] + if (process.id === node.id) { + payload.parentNode.processes.splice(i, 1) + } + } + completeDetachment(node, rootNodes) + return + } + case 'Calculations Procedure': { + node.payload.parentNode.calculations = undefined + completeDetachment(node, rootNodes) + return + } + case 'Data Building Procedure': { + node.payload.parentNode.dataBuilding = undefined + completeDetachment(node, rootNodes) + return + } + case 'Procedure Initialization': { + node.payload.parentNode.initialization = undefined + completeDetachment(node, rootNodes) + return + } + case 'Procedure Loop': { + node.payload.parentNode.loop = undefined + completeDetachment(node, rootNodes) + return + } + case 'Output Dataset': { + let payload = node.payload + for (let i = 0; i < payload.parentNode.outputDatasets.length; i++) { + let outputDataset = payload.parentNode.outputDatasets[i] + if (outputDataset.id === node.id) { + payload.parentNode.outputDatasets.splice(i, 1) + } + } + completeDetachment(node, rootNodes) + return + } + case 'Status Dependency': { + let payload = node.payload + for (let i = 0; i < payload.parentNode.statusDependencies.length; i++) { + let statusDependency = payload.parentNode.statusDependencies[i] + if (statusDependency.id === node.id) { + payload.parentNode.statusDependencies.splice(i, 1) + } + } + completeDetachment(node, rootNodes) + return + } + case 'Data Dependency': { + let payload = node.payload + for (let i = 0; i < payload.parentNode.dataDependencies.length; i++) { + let dataDependency = payload.parentNode.dataDependencies[i] + if (dataDependency.id === node.id) { + payload.parentNode.dataDependencies.splice(i, 1) + } + } + completeDetachment(node, rootNodes) + return + } + case 'Product Definition': { + let payload = node.payload + for (let i = 0; i < payload.parentNode.products.length; i++) { + let product = payload.parentNode.products[i] + if (product.id === node.id) { + payload.parentNode.products.splice(i, 1) + } + } + completeDetachment(node, rootNodes) + return + } + case 'Record Definition': { + node.payload.parentNode.record = undefined + completeDetachment(node, rootNodes) + return + } + case 'Record Property': { + let payload = node.payload + for (let i = 0; i < payload.parentNode.properties.length; i++) { + let property = payload.parentNode.properties[i] + if (property.id === node.id) { + payload.parentNode.properties.splice(i, 1) + } + } + completeDetachment(node, rootNodes) + return + } + case 'Dataset Definition': { + let payload = node.payload + for (let i = 0; i < payload.parentNode.datasets.length; i++) { + let dataset = payload.parentNode.datasets[i] + if (dataset.id === node.id) { + payload.parentNode.datasets.splice(i, 1) + } + } + completeDetachment(node, rootNodes) + return + } + case 'Plotter': { + let payload = node.payload + for (let i = 0; i < payload.parentNode.plotters.length; i++) { + let plotter = payload.parentNode.plotters[i] + if (plotter.id === node.id) { + payload.parentNode.plotters.splice(i, 1) + } + } + completeDetachment(node, rootNodes) + return + } + case 'Plotter Module': { + let payload = node.payload + for (let i = 0; i < payload.parentNode.modules.length; i++) { + let module = payload.parentNode.modules[i] + if (module.id === node.id) { + payload.parentNode.modules.splice(i, 1) + } + } + completeDetachment(node, rootNodes) + return + } + case 'Plotter Panel': { + let payload = node.payload + for (let i = 0; i < payload.parentNode.panels.length; i++) { + let panel = payload.parentNode.panels[i] + if (panel.id === node.id) { + payload.parentNode.panels.splice(i, 1) + } + } + completeDetachment(node, rootNodes) + return + } case 'Network Node': { let payload = node.payload for (let i = 0; i < payload.parentNode.networkNodes.length; i++) { @@ -358,10 +529,129 @@ function newChainAttachDetach () { function chainAttachNode (node, attachToNode, rootNodes) { switch (node.type) { - case 'Network': { + case 'Sensor Bot': { node.payload.parentNode = attachToNode node.payload.chainParent = attachToNode - node.payload.parentNode.network = node + node.payload.parentNode.networkNodes.push(node) + completeAttachment(node, rootNodes) + } + break + case 'Indicator Bot': { + node.payload.parentNode = attachToNode + node.payload.chainParent = attachToNode + node.payload.parentNode.networkNodes.push(node) + completeAttachment(node, rootNodes) + } + break + case 'Trading Bot': { + node.payload.parentNode = attachToNode + node.payload.chainParent = attachToNode + node.payload.parentNode.networkNodes.push(node) + completeAttachment(node, rootNodes) + } + break + case 'Process Definition': { + node.payload.parentNode = attachToNode + node.payload.chainParent = attachToNode + node.payload.parentNode.processes.push(node) + completeAttachment(node, rootNodes) + } + break + case 'Calculations Procedure': { + node.payload.parentNode = attachToNode + node.payload.chainParent = attachToNode + node.payload.parentNode.calculations = node + completeAttachment(node, rootNodes) + } + break + case 'Data Building Procedure': { + node.payload.parentNode = attachToNode + node.payload.chainParent = attachToNode + node.payload.parentNode.dataBuilding = node + completeAttachment(node, rootNodes) + } + break + case 'Procedure Initialization': { + node.payload.parentNode = attachToNode + node.payload.chainParent = attachToNode + node.payload.parentNode.initialization = node + completeAttachment(node, rootNodes) + } + break + case 'Procedure Loop': { + node.payload.parentNode = attachToNode + node.payload.chainParent = attachToNode + node.payload.parentNode.loop = node + completeAttachment(node, rootNodes) + } + break + case 'Output Dataset': { + node.payload.parentNode = attachToNode + node.payload.chainParent = attachToNode + node.payload.parentNode.outputDatasets.push(node) + completeAttachment(node, rootNodes) + } + break + case 'Status Dependency': { + node.payload.parentNode = attachToNode + node.payload.chainParent = attachToNode + node.payload.parentNode.statusDependencies.push(node) + completeAttachment(node, rootNodes) + } + break + case 'Data Dependency': { + node.payload.parentNode = attachToNode + node.payload.chainParent = attachToNode + node.payload.parentNode.dataDependencies.push(node) + completeAttachment(node, rootNodes) + } + break + case 'Product Definition': { + node.payload.parentNode = attachToNode + node.payload.chainParent = attachToNode + node.payload.parentNode.products.push(node) + completeAttachment(node, rootNodes) + } + break + case 'Record Definition': { + node.payload.parentNode = attachToNode + node.payload.chainParent = attachToNode + node.payload.parentNode.record = node + completeAttachment(node, rootNodes) + } + break + case 'Record Property': { + node.payload.parentNode = attachToNode + node.payload.chainParent = attachToNode + node.payload.parentNode.properties.push(node) + completeAttachment(node, rootNodes) + } + break + case 'Dataset Definition': { + node.payload.parentNode = attachToNode + node.payload.chainParent = attachToNode + node.payload.parentNode.datasets.push(node) + completeAttachment(node, rootNodes) + } + break + case 'Plotter': { + node.payload.parentNode = attachToNode + node.payload.chainParent = attachToNode + node.payload.parentNode.plotters.push(node) + completeAttachment(node, rootNodes) + } + break + case 'Plotter Module': { + node.payload.parentNode = attachToNode + node.payload.chainParent = attachToNode + node.payload.parentNode.modules.push(node) + completeAttachment(node, rootNodes) + } + break + case 'Plotter Panel': { + node.payload.parentNode = attachToNode + node.payload.chainParent = attachToNode + node.payload.parentNode.panels.push(node) completeAttachment(node, rootNodes) } break diff --git a/DesignerSpace/Workspace/FunctionLibraries/NodeChildren.js b/DesignerSpace/Workspace/FunctionLibraries/NodeChildren.js index 603ced9a9..858d9cbea 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/NodeChildren.js +++ b/DesignerSpace/Workspace/FunctionLibraries/NodeChildren.js @@ -14,6 +14,9 @@ function newNodeChildren () { case 'Network': { return countChildrenNetwork(parentNode, childNode) } + case 'Team': { + return countChildrenTeam(parentNode, childNode) + } case 'Network Node': { return countChildrenNetworkNode(parentNode, childNode) } @@ -201,6 +204,50 @@ function newNodeChildren () { return response } + function countChildrenTeam (parentNode, childNode) { + let response = { + childrenCount: 0, + childIndex: undefined + } + if (parentNode.sensorBots !== undefined) { + for (let i = 0; i < parentNode.sensorBots.length; i++) { + let child = parentNode.sensorBots[i] + response.childrenCount++ + if (child.id === childNode.id) { + response.childIndex = response.childrenCount + } + } + } + if (parentNode.indicatorBots !== undefined) { + for (let i = 0; i < parentNode.indicatorBots.length; i++) { + let child = parentNode.indicatorBots[i] + response.childrenCount++ + if (child.id === childNode.id) { + response.childIndex = response.childrenCount + } + } + } + if (parentNode.tradingBots !== undefined) { + for (let i = 0; i < parentNode.tradingBots.length; i++) { + let child = parentNode.tradingBots[i] + response.childrenCount++ + if (child.id === childNode.id) { + response.childIndex = response.childrenCount + } + } + } + if (parentNode.plotters !== undefined) { + for (let i = 0; i < parentNode.plotters.length; i++) { + let child = parentNode.plotters[i] + response.childrenCount++ + if (child.id === childNode.id) { + response.childIndex = response.childrenCount + } + } + } + return response + } + function countChildrenNetworkNode (parentNode, childNode) { let response = { childrenCount: 0, From fb83d5efef94b8102dc61dd26dc1f5e2ca215c6b Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 29 Oct 2019 14:08:08 +0100 Subject: [PATCH 35/95] Count Childrem of Team Structure Implemented --- .../FunctionLibraries/NodeChildren.js | 390 ++++++++++++++++++ 1 file changed, 390 insertions(+) diff --git a/DesignerSpace/Workspace/FunctionLibraries/NodeChildren.js b/DesignerSpace/Workspace/FunctionLibraries/NodeChildren.js index 858d9cbea..d82365e47 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/NodeChildren.js +++ b/DesignerSpace/Workspace/FunctionLibraries/NodeChildren.js @@ -17,6 +17,60 @@ function newNodeChildren () { case 'Team': { return countChildrenTeam(parentNode, childNode) } + case 'Sensor Bot': { + return countChildrenSensorBot(parentNode, childNode) + } + case 'Indicator Bot': { + return countChildrenIndicatorBot(parentNode, childNode) + } + case 'Trading Bot': { + return countChildrenTradingBot(parentNode, childNode) + } + case 'Process Definition': { + return countChildrenProcessDefinition(parentNode, childNode) + } + case 'Calculations Procedure': { + return countChildrenCalculationsProcedure(parentNode, childNode) + } + case 'Data Building Procedure': { + return countChildrenDataBuildingProcedure(parentNode, childNode) + } + case 'Procedure Initialization': { + return countChildrenProcedureInitialization(parentNode, childNode) + } + case 'Procedure Loop': { + return countChildrenProcedureLoop(parentNode, childNode) + } + case 'Output Dataset': { + return countChildrenOutputDataset(parentNode, childNode) + } + case 'Status Dependency': { + return countChildrenStatusDependency(parentNode, childNode) + } + case 'Data Dependency': { + return countChildrenDataDependency(parentNode, childNode) + } + case 'Product Definition': { + return countChildrenProductDefinition(parentNode, childNode) + } + case 'Record Definition': { + return countChildrenRecordDefinition(parentNode, childNode) + } + case 'Record Property': { + return countChildrenRecordProperty(parentNode, childNode) + } + case 'Dataset Definition': { + return countChildrenDatasetDefinition(parentNode, childNode) + } + case 'Plotter': { + return countChildrenPlotter(parentNode, childNode) + } + case 'Plotter Module': { + return countChildrenPlotterModule(parentNode, childNode) + } + case 'Plotter Panel': { + return countChildrenPlotterPanel(parentNode, childNode) + } case 'Network Node': { return countChildrenNetworkNode(parentNode, childNode) } @@ -248,6 +302,342 @@ function newNodeChildren () { return response } + function countChildrenSensorBot (parentNode, childNode) { + let response = { + childrenCount: 0, + childIndex: undefined + } + if (parentNode.processes !== undefined) { + for (let i = 0; i < parentNode.processes.length; i++) { + let child = parentNode.processes[i] + response.childrenCount++ + if (child.id === childNode.id) { + response.childIndex = response.childrenCount + } + } + } + if (parentNode.products !== undefined) { + for (let i = 0; i < parentNode.products.length; i++) { + let child = parentNode.products[i] + response.childrenCount++ + if (child.id === childNode.id) { + response.childIndex = response.childrenCount + } + } + } + return response + } + + function countChildrenIndicatorBot (parentNode, childNode) { + let response = { + childrenCount: 0, + childIndex: undefined + } + if (parentNode.processes !== undefined) { + for (let i = 0; i < parentNode.processes.length; i++) { + let child = parentNode.processes[i] + response.childrenCount++ + if (child.id === childNode.id) { + response.childIndex = response.childrenCount + } + } + } + if (parentNode.products !== undefined) { + for (let i = 0; i < parentNode.products.length; i++) { + let child = parentNode.products[i] + response.childrenCount++ + if (child.id === childNode.id) { + response.childIndex = response.childrenCount + } + } + } + return response + } + + function countChildrenTradingBot (parentNode, childNode) { + let response = { + childrenCount: 0, + childIndex: undefined + } + if (parentNode.processes !== undefined) { + for (let i = 0; i < parentNode.processes.length; i++) { + let child = parentNode.processes[i] + response.childrenCount++ + if (child.id === childNode.id) { + response.childIndex = response.childrenCount + } + } + } + if (parentNode.products !== undefined) { + for (let i = 0; i < parentNode.products.length; i++) { + let child = parentNode.products[i] + response.childrenCount++ + if (child.id === childNode.id) { + response.childIndex = response.childrenCount + } + } + } + return response + } + + function countChildrenProcessDefinition (parentNode, childNode) { + let response = { + childrenCount: 0, + childIndex: undefined + } + if (parentNode.calculations !== undefined) { + response.childrenCount++ + if (parentNode.calculations.id === childNode.id) { + response.childIndex = response.childrenCount + } + } + if (parentNode.dataBuilding !== undefined) { + response.childrenCount++ + if (parentNode.dataBuilding.id === childNode.id) { + response.childIndex = response.childrenCount + } + } + + if (parentNode.outputDatasets !== undefined) { + for (let i = 0; i < parentNode.outputDatasets.length; i++) { + let child = parentNode.outputDatasets[i] + response.childrenCount++ + if (child.id === childNode.id) { + response.childIndex = response.childrenCount + } + } + } + if (parentNode.statusDependencies !== undefined) { + for (let i = 0; i < parentNode.statusDependencies.length; i++) { + let child = parentNode.statusDependencies[i] + response.childrenCount++ + if (child.id === childNode.id) { + response.childIndex = response.childrenCount + } + } + } + if (parentNode.dataDependencies !== undefined) { + for (let i = 0; i < parentNode.dataDependencies.length; i++) { + let child = parentNode.dataDependencies[i] + response.childrenCount++ + if (child.id === childNode.id) { + response.childIndex = response.childrenCount + } + } + } + return response + } + + function countChildrenCalculationsProcedure (parentNode, childNode) { + let response = { + childrenCount: 0, + childIndex: undefined + } + if (parentNode.initialization !== undefined) { + response.childrenCount++ + if (parentNode.initialization.id === childNode.id) { + response.childIndex = response.childrenCount + } + } + if (parentNode.loop !== undefined) { + response.childrenCount++ + if (parentNode.loop.id === childNode.id) { + response.childIndex = response.childrenCount + } + } + return response + } + + function countChildrenDataBuildingProcedure (parentNode, childNode) { + let response = { + childrenCount: 0, + childIndex: undefined + } + if (parentNode.initialization !== undefined) { + response.childrenCount++ + if (parentNode.initialization.id === childNode.id) { + response.childIndex = response.childrenCount + } + } + if (parentNode.loop !== undefined) { + response.childrenCount++ + if (parentNode.loop.id === childNode.id) { + response.childIndex = response.childrenCount + } + } + return response + } + + function countChildrenProcedureInitialization (parentNode, childNode) { + let response = { + childrenCount: 0, + childIndex: undefined + } + if (parentNode.code !== undefined) { + response.childrenCount++ + if (parentNode.code.id === childNode.id) { + response.childIndex = response.childrenCount + } + } + return response + } + + function countChildrenProcedureLoop (parentNode, childNode) { + let response = { + childrenCount: 0, + childIndex: undefined + } + if (parentNode.code !== undefined) { + response.childrenCount++ + if (parentNode.code.id === childNode.id) { + response.childIndex = response.childrenCount + } + } + return response + } + + function countChildrenOutputDataset (parentNode, childNode) { + let response = { + childrenCount: 0, + childIndex: undefined + } + return response + } + + function countChildrenStatusDependency (parentNode, childNode) { + let response = { + childrenCount: 0, + childIndex: undefined + } + return response + } + + function countChildrenDataDependency (parentNode, childNode) { + let response = { + childrenCount: 0, + childIndex: undefined + } + return response + } + + function countChildrenProductDefinition (parentNode, childNode) { + let response = { + childrenCount: 0, + childIndex: undefined + } + if (parentNode.record !== undefined) { + response.childrenCount++ + if (parentNode.record.id === childNode.id) { + response.childIndex = response.childrenCount + } + } + + if (parentNode.datasets !== undefined) { + for (let i = 0; i < parentNode.datasets.length; i++) { + let child = parentNode.datasets[i] + response.childrenCount++ + if (child.id === childNode.id) { + response.childIndex = response.childrenCount + } + } + } + return response + } + + function countChildrenRecordDefinition (parentNode, childNode) { + let response = { + childrenCount: 0, + childIndex: undefined + } + + if (parentNode.properties !== undefined) { + for (let i = 0; i < parentNode.properties.length; i++) { + let child = parentNode.properties[i] + response.childrenCount++ + if (child.id === childNode.id) { + response.childIndex = response.childrenCount + } + } + } + return response + } + + function countChildrenRecordProperty (parentNode, childNode) { + let response = { + childrenCount: 0, + childIndex: undefined + } + if (parentNode.formula !== undefined) { + response.childrenCount++ + if (parentNode.formula.id === childNode.id) { + response.childIndex = response.childrenCount + } + } + return response + } + + function countChildrenDatasetDefinition (parentNode, childNode) { + let response = { + childrenCount: 0, + childIndex: undefined + } + return response + } + + function countChildrenPlotter (parentNode, childNode) { + let response = { + childrenCount: 0, + childIndex: undefined + } + if (parentNode.modules !== undefined) { + for (let i = 0; i < parentNode.modules.length; i++) { + let child = parentNode.modules[i] + response.childrenCount++ + if (child.id === childNode.id) { + response.childIndex = response.childrenCount + } + } + } + return response + } + + function countChildrenPlotterModule (parentNode, childNode) { + let response = { + childrenCount: 0, + childIndex: undefined + } + if (parentNode.code !== undefined) { + response.childrenCount++ + if (parentNode.code.id === childNode.id) { + response.childIndex = response.childrenCount + } + } + if (parentNode.panels !== undefined) { + for (let i = 0; i < parentNode.panels.length; i++) { + let child = parentNode.panels[i] + response.childrenCount++ + if (child.id === childNode.id) { + response.childIndex = response.childrenCount + } + } + } + return response + } + + function countChildrenPlotterPanel (parentNode, childNode) { + let response = { + childrenCount: 0, + childIndex: undefined + } + if (parentNode.code !== undefined) { + response.childrenCount++ + if (parentNode.code.id === childNode.id) { + response.childIndex = response.childrenCount + } + } + return response + } + function countChildrenNetworkNode (parentNode, childNode) { let response = { childrenCount: 0, From f45d46255765c4362dc1138f621214eadf0299ce Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 29 Oct 2019 16:44:20 +0100 Subject: [PATCH 36/95] Delete Functions implemented for Teams structure --- .../FunctionLibraries/NodeDeleter.js | 538 +++++++++++++++++- 1 file changed, 534 insertions(+), 4 deletions(-) diff --git a/DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js b/DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js index 89669bfa6..768bc42cd 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js +++ b/DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js @@ -3,6 +3,25 @@ function newNodeDeleter () { deleteDefinition: deleteDefinition, deleteNetwork: deleteNetwork, deleteNetworkNode: deleteNetworkNode, + deleteTeam: deleteTeam, + deleteSensorBot: deleteSensorBot, + deleteIndicatorBot: deleteIndicatorBot, + deleteTradingBot: deleteTradingBot, + deleteProcessDefinition: deleteProcessDefinition, + deleteCalculationsProcedure: deleteCalculationsProcedure, + deleteDataBuildingProcedure: deleteDataBuildingProcedure, + deleteProcedureInitialization: deleteProcedureInitialization, + deleteProcedureLoop: deleteProcedureLoop, + deleteOutputDataset: deleteOutputDataset, + deleteStatusDependency: deleteStatusDependency, + deleteDataDependency: deleteDataDependency, + deleteProductDefinition: deleteProductDefinition, + deleteRecordDefinition: deleteRecordDefinition, + deleteRecordProperty: deleteRecordProperty, + deleteDatasetDefinition: deleteDatasetDefinition, + deletePlotter: deletePlotter, + deletePlotterModule: deletePlotterModule, + deletePlotterPanel: deletePlotterPanel, deleteSocialBots: deleteSocialBots, deleteSocialBot: deleteSocialBot, deleteAnnouncement: deleteAnnouncement, @@ -73,6 +92,82 @@ function newNodeDeleter () { deleteNetworkNode(rootNode, rootNodes) break } + case 'Team': { + deleteTeam(rootNode, rootNodes) + break + } + case 'Sensor Bot': { + deleteSensorBot(rootNode, rootNodes) + break + } + case 'Indicator Bot': { + deleteIndicatorBot(rootNode, rootNodes) + break + } + case 'Trading Bot': { + deleteTradingBot(rootNode, rootNodes) + break + } + case 'Process Definition': { + deleteProcessDefinition(rootNode, rootNodes) + break + } + case 'Calculations Procedure': { + deleteCalculationsProcedure(rootNode, rootNodes) + break + } + case 'Data Building Procedure': { + deleteDataBuildingProcedure(rootNode, rootNodes) + break + } + case 'Procedure Initialization': { + deleteProcedureInitialization(rootNode, rootNodes) + break + } + case 'Procedure Loop': { + deleteProcedureLoop(rootNode, rootNodes) + break + } + case 'Output Dataset': { + deleteOutputDataset(rootNode, rootNodes) + break + } + case 'Status Dependency': { + deleteStatusDependency(rootNode, rootNodes) + break + } + case 'Data Dependency': { + deleteDataDependency(rootNode, rootNodes) + break + } + case 'Product Definition': { + deleteProductDefinition(rootNode, rootNodes) + break + } + case 'Record Definition': { + deleteRecordDefinition(rootNode, rootNodes) + break + } + case 'Record Property': { + deleteRecordProperty(rootNode, rootNodes) + break + } + case 'Dataset Definition': { + deleteDatasetDefinition(rootNode, rootNodes) + break + } + case 'Plotter': { + deletePlotter(rootNode, rootNodes) + break + } + case 'Plotter Module': { + deletePlotterModule(rootNode, rootNodes) + break + } + case 'Plotter Panel': { + deletePlotterPanel(rootNode, rootNodes) + break + } case 'Social Bots': { deleteSocialBots(rootNode, rootNodes) break @@ -291,10 +386,6 @@ function newNodeDeleter () { function deleteNetwork (node, rootNodes) { let payload = node.payload - if (payload.parentNode !== undefined) { - payload.parentNode.network = undefined - } - if (node.networkNodes !== undefined) { while (node.networkNodes.length > 0) { deleteNetworkNode(node.networkNodes[0], rootNodes) @@ -329,6 +420,445 @@ function newNodeDeleter () { cleanNode(node) } + function deleteTeam (node, rootNodes) { + let payload = node.payload + + if (node.sensorBots !== undefined) { + while (node.sensorBots.length > 0) { + deleteNetworkNode(node.sensorBots[0], rootNodes) + } + } + + if (node.indicatorBots !== undefined) { + while (node.indicatorBots.length > 0) { + deleteNetworkNode(node.indicatorBots[0], rootNodes) + } + } + + if (node.tradingBots !== undefined) { + while (node.tradingBots.length > 0) { + deleteNetworkNode(node.tradingBots[0], rootNodes) + } + } + + if (node.plotters !== undefined) { + while (node.plotters.length > 0) { + deleteNetworkNode(node.plotters[0], rootNodes) + } + } + + completeDeletion(node, rootNodes) + destroyUiObject(node) + cleanNode(node) + } + + function deleteSensorBot (node, rootNodes) { + let payload = node.payload + + if (payload.parentNode !== undefined) { + for (let j = 0; j < payload.parentNode.sensorBots.length; j++) { + let sensorBot = payload.parentNode.sensorBots[j] + if (sensorBot.id === node.id) { + payload.parentNode.sensorBots.splice(j, 1) + } + } + } + + if (node.processes !== undefined) { + while (node.processes.length > 0) { + deleteNetworkNode(node.processes[0], rootNodes) + } + } + + if (node.products !== undefined) { + while (node.products.length > 0) { + deleteNetworkNode(node.products[0], rootNodes) + } + } + + completeDeletion(node, rootNodes) + destroyUiObject(node) + cleanNode(node) + } + + function deleteIndicatorBot (node, rootNodes) { + let payload = node.payload + + if (payload.parentNode !== undefined) { + for (let j = 0; j < payload.parentNode.indicatorBots.length; j++) { + let indicatorBot = payload.parentNode.indicatorBots[j] + if (indicatorBot.id === node.id) { + payload.parentNode.indicatorBots.splice(j, 1) + } + } + } + + if (node.processes !== undefined) { + while (node.processes.length > 0) { + deleteNetworkNode(node.processes[0], rootNodes) + } + } + + if (node.products !== undefined) { + while (node.products.length > 0) { + deleteNetworkNode(node.products[0], rootNodes) + } + } + + completeDeletion(node, rootNodes) + destroyUiObject(node) + cleanNode(node) + } + + function deleteTradingBot (node, rootNodes) { + let payload = node.payload + + if (payload.parentNode !== undefined) { + for (let j = 0; j < payload.parentNode.tradingBots.length; j++) { + let tradingBot = payload.parentNode.tradingBots[j] + if (tradingBot.id === node.id) { + payload.parentNode.tradingBots.splice(j, 1) + } + } + } + + if (node.processes !== undefined) { + while (node.processes.length > 0) { + deleteNetworkNode(node.processes[0], rootNodes) + } + } + + if (node.products !== undefined) { + while (node.products.length > 0) { + deleteNetworkNode(node.products[0], rootNodes) + } + } + + completeDeletion(node, rootNodes) + destroyUiObject(node) + cleanNode(node) + } + + function deleteProcessDefinition (node, rootNodes) { + let payload = node.payload + + if (payload.parentNode !== undefined) { + for (let j = 0; j < payload.parentNode.processes.length; j++) { + let process = payload.parentNode.processes[j] + if (process.id === node.id) { + payload.parentNode.processes.splice(j, 1) + } + } + } + + if (node.calculations !== undefined) { + deleteParameters(node.calculations, rootNodes) + } + + if (node.dataBuilding !== undefined) { + deleteParameters(node.dataBuilding, rootNodes) + } + + if (node.outputDatasets !== undefined) { + while (node.outputDatasets.length > 0) { + deleteNetworkNode(node.outputDatasets[0], rootNodes) + } + } + + if (node.statusDependencies !== undefined) { + while (node.statusDependencies.length > 0) { + deleteNetworkNode(node.statusDependencies[0], rootNodes) + } + } + + if (node.dataDependencies !== undefined) { + while (node.dataDependencies.length > 0) { + deleteNetworkNode(node.dataDependencies[0], rootNodes) + } + } + + completeDeletion(node, rootNodes) + destroyUiObject(node) + cleanNode(node) + } + + function deleteCalculationsProcedure (node, rootNodes) { + let payload = node.payload + + if (payload.parentNode !== undefined) { + payload.parentNode.calculations = undefined + } + + if (node.initialization !== undefined) { + deleteParameters(node.initialization, rootNodes) + } + + if (node.loop !== undefined) { + deleteParameters(node.loop, rootNodes) + } + + completeDeletion(node, rootNodes) + destroyUiObject(node) + cleanNode(node) + } + + function deleteDataBuildingProcedure (node, rootNodes) { + let payload = node.payload + + if (payload.parentNode !== undefined) { + payload.parentNode.dataBuilding = undefined + } + + if (node.initialization !== undefined) { + deleteParameters(node.initialization, rootNodes) + } + + if (node.loop !== undefined) { + deleteParameters(node.loop, rootNodes) + } + + completeDeletion(node, rootNodes) + destroyUiObject(node) + cleanNode(node) + } + + function deleteProcedureInitialization (node, rootNodes) { + let payload = node.payload + + if (payload.parentNode !== undefined) { + payload.parentNode.initialization = undefined + } + + if (node.code !== undefined) { + deleteParameters(node.code, rootNodes) + } + + completeDeletion(node, rootNodes) + destroyUiObject(node) + cleanNode(node) + } + + function deleteProcedureLoop (node, rootNodes) { + let payload = node.payload + + if (payload.parentNode !== undefined) { + payload.parentNode.loop = undefined + } + + if (node.code !== undefined) { + deleteParameters(node.code, rootNodes) + } + + completeDeletion(node, rootNodes) + destroyUiObject(node) + cleanNode(node) + } + + function deleteOutputDataset (node, rootNodes) { + let payload = node.payload + + if (payload.parentNode !== undefined) { + for (let j = 0; j < payload.parentNode.outputDatasets.length; j++) { + let outputDataset = payload.parentNode.outputDatasets[j] + if (outputDataset.id === node.id) { + payload.parentNode.outputDatasets.splice(j, 1) + } + } + } + + completeDeletion(node, rootNodes) + destroyUiObject(node) + cleanNode(node) + } + + function deleteStatusDependency (node, rootNodes) { + let payload = node.payload + + if (payload.parentNode !== undefined) { + for (let j = 0; j < payload.parentNode.statusDependencies.length; j++) { + let statusDependency = payload.parentNode.statusDependencies[j] + if (statusDependency.id === node.id) { + payload.parentNode.statusDependencies.splice(j, 1) + } + } + } + + completeDeletion(node, rootNodes) + destroyUiObject(node) + cleanNode(node) + } + + function deleteDataDependency (node, rootNodes) { + let payload = node.payload + + if (payload.parentNode !== undefined) { + for (let j = 0; j < payload.parentNode.dataDependencies.length; j++) { + let dataDependency = payload.parentNode.dataDependencies[j] + if (dataDependency.id === node.id) { + payload.parentNode.dataDependencies.splice(j, 1) + } + } + } + + completeDeletion(node, rootNodes) + destroyUiObject(node) + cleanNode(node) + } + + function deleteProductDefinition (node, rootNodes) { + let payload = node.payload + + if (payload.parentNode !== undefined) { + for (let j = 0; j < payload.parentNode.products.length; j++) { + let product = payload.parentNode.products[j] + if (product.id === node.id) { + payload.parentNode.products.splice(j, 1) + } + } + } + + if (node.record !== undefined) { + deleteParameters(node.record, rootNodes) + } + + if (node.datasets !== undefined) { + while (node.datasets.length > 0) { + deleteNetworkNode(node.datasets[0], rootNodes) + } + } + + completeDeletion(node, rootNodes) + destroyUiObject(node) + cleanNode(node) + } + + function deleteRecordDefinition (node, rootNodes) { + let payload = node.payload + + if (payload.parentNode !== undefined) { + payload.parentNode.record = undefined + } + + if (node.properties !== undefined) { + while (node.properties.length > 0) { + deleteNetworkNode(node.properties[0], rootNodes) + } + } + + completeDeletion(node, rootNodes) + destroyUiObject(node) + cleanNode(node) + } + + function deleteRecordProperty (node, rootNodes) { + let payload = node.payload + + if (payload.parentNode !== undefined) { + for (let j = 0; j < payload.parentNode.properties.length; j++) { + let property = payload.parentNode.properties[j] + if (property.id === node.id) { + payload.parentNode.properties.splice(j, 1) + } + } + } + + if (node.formula !== undefined) { + deleteParameters(node.formula, rootNodes) + } + + completeDeletion(node, rootNodes) + destroyUiObject(node) + cleanNode(node) + } + + function deleteDatasetDefinition (node, rootNodes) { + let payload = node.payload + + if (payload.parentNode !== undefined) { + for (let j = 0; j < payload.parentNode.datasets.length; j++) { + let dataset = payload.parentNode.datasets[j] + if (dataset.id === node.id) { + payload.parentNode.datasets.splice(j, 1) + } + } + } + + completeDeletion(node, rootNodes) + destroyUiObject(node) + cleanNode(node) + } + + function deletePlotter (node, rootNodes) { + let payload = node.payload + + if (payload.parentNode !== undefined) { + for (let j = 0; j < payload.parentNode.plotters.length; j++) { + let plotter = payload.parentNode.plotters[j] + if (plotter.id === node.id) { + payload.parentNode.plotters.splice(j, 1) + } + } + } + + if (node.modules !== undefined) { + while (node.modules.length > 0) { + deleteNetworkNode(node.modules[0], rootNodes) + } + } + + completeDeletion(node, rootNodes) + destroyUiObject(node) + cleanNode(node) + } + + function deletePlotterModule (node, rootNodes) { + let payload = node.payload + + if (payload.parentNode !== undefined) { + for (let j = 0; j < payload.parentNode.modules.length; j++) { + let module = payload.parentNode.modules[j] + if (module.id === node.id) { + payload.parentNode.modules.splice(j, 1) + } + } + } + + if (node.code !== undefined) { + deleteParameters(node.code, rootNodes) + } + + if (node.panels !== undefined) { + while (node.panels.length > 0) { + deleteNetworkNode(node.panels[0], rootNodes) + } + } + + completeDeletion(node, rootNodes) + destroyUiObject(node) + cleanNode(node) + } + + function deletePlotterPanel (node, rootNodes) { + let payload = node.payload + + if (payload.parentNode !== undefined) { + for (let j = 0; j < payload.parentNode.panels.length; j++) { + let panel = payload.parentNode.panels[j] + if (panel.id === node.id) { + payload.parentNode.panels.splice(j, 1) + } + } + } + + if (node.code !== undefined) { + deleteParameters(node.code, rootNodes) + } + + completeDeletion(node, rootNodes) + destroyUiObject(node) + cleanNode(node) + } + function deleteSocialBots (node, rootNodes) { let payload = node.payload if (payload.parentNode !== undefined) { From 509b3dbd51bfab6102a573b7080c8cafa36ba38e Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 30 Oct 2019 08:22:08 +0100 Subject: [PATCH 37/95] On Focus Implementation of Team Structure --- .../Workspace/FunctionLibraries/OnFocus.js | 299 ++++++++++++++++++ 1 file changed, 299 insertions(+) diff --git a/DesignerSpace/Workspace/FunctionLibraries/OnFocus.js b/DesignerSpace/Workspace/FunctionLibraries/OnFocus.js index 67bda0ead..f1a22b94b 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/OnFocus.js +++ b/DesignerSpace/Workspace/FunctionLibraries/OnFocus.js @@ -729,6 +729,305 @@ function newOnFocus () { return } } + case 'Team': { + let child + + for (let m = 0; m < node.sensorBots.length; m++) { + child = getNodeThatIsOnFocus(node.sensorBots[m]) + if (child !== undefined) { + return child + } + } + for (let m = 0; m < node.indicatorBots.length; m++) { + child = getNodeThatIsOnFocus(node.indicatorBots[m]) + if (child !== undefined) { + return child + } + } + for (let m = 0; m < node.tradingBots.length; m++) { + child = getNodeThatIsOnFocus(node.tradingBots[m]) + if (child !== undefined) { + return child + } + } + for (let m = 0; m < node.plotters.length; m++) { + child = getNodeThatIsOnFocus(node.plotters[m]) + if (child !== undefined) { + return child + } + } + if (node.payload.uiObject.isOnFocus === true) { + return node + } else { + return + } + } + case 'Sensor Bot': { + let child + for (let m = 0; m < node.processes.length; m++) { + child = getNodeThatIsOnFocus(node.processes[m]) + if (child !== undefined) { + return child + } + } + for (let m = 0; m < node.products.length; m++) { + child = getNodeThatIsOnFocus(node.products[m]) + if (child !== undefined) { + return child + } + } + if (node.payload.uiObject.isOnFocus === true) { + return node + } else { + return + } + } + case 'Indicator Bot': { + let child + for (let m = 0; m < node.processes.length; m++) { + child = getNodeThatIsOnFocus(node.processes[m]) + if (child !== undefined) { + return child + } + } + for (let m = 0; m < node.products.length; m++) { + child = getNodeThatIsOnFocus(node.products[m]) + if (child !== undefined) { + return child + } + } + if (node.payload.uiObject.isOnFocus === true) { + return node + } else { + return + } + } + case 'Trading Bot': { + let child + for (let m = 0; m < node.processes.length; m++) { + child = getNodeThatIsOnFocus(node.processes[m]) + if (child !== undefined) { + return child + } + } + for (let m = 0; m < node.products.length; m++) { + child = getNodeThatIsOnFocus(node.products[m]) + if (child !== undefined) { + return child + } + } + if (node.payload.uiObject.isOnFocus === true) { + return node + } else { + return + } + } + case 'Process Definition': { + let child + child = getNodeThatIsOnFocus(node.calculations) + if (child !== undefined) { + return child + } + child = getNodeThatIsOnFocus(node.dataBuilding) + if (child !== undefined) { + return child + } + for (let m = 0; m < node.outputDatasets.length; m++) { + child = getNodeThatIsOnFocus(node.outputDatasets[m]) + if (child !== undefined) { + return child + } + } + for (let m = 0; m < node.statusDependencies.length; m++) { + child = getNodeThatIsOnFocus(node.statusDependencies[m]) + if (child !== undefined) { + return child + } + } + for (let m = 0; m < node.dataDependencies.length; m++) { + child = getNodeThatIsOnFocus(node.dataDependencies[m]) + if (child !== undefined) { + return child + } + } + if (node.payload.uiObject.isOnFocus === true) { + return node + } else { + return + } + } + case 'Calculations Procedure': { + let child + child = getNodeThatIsOnFocus(node.initialization) + if (child !== undefined) { + return child + } + child = getNodeThatIsOnFocus(node.loop) + if (child !== undefined) { + return child + } + if (node.payload.uiObject.isOnFocus === true) { + return node + } else { + return + } + } + case 'Data Building Procedure': { + let child + child = getNodeThatIsOnFocus(node.initialization) + if (child !== undefined) { + return child + } + child = getNodeThatIsOnFocus(node.loop) + if (child !== undefined) { + return child + } + if (node.payload.uiObject.isOnFocus === true) { + return node + } else { + return + } + } + case 'Procedure Initialization': { + let child + child = getNodeThatIsOnFocus(node.code) + if (child !== undefined) { + return child + } + if (node.payload.uiObject.isOnFocus === true) { + return node + } else { + return + } + } + case 'Procedure Loop': { + let child + child = getNodeThatIsOnFocus(node.code) + if (child !== undefined) { + return child + } + if (node.payload.uiObject.isOnFocus === true) { + return node + } else { + return + } + } + case 'Output Dataset': { + if (node.payload.uiObject.isOnFocus === true) { + return node + } else { + return + } + } + case 'Status Dependency': { + if (node.payload.uiObject.isOnFocus === true) { + return node + } else { + return + } + } + case 'Data Dependency': { + if (node.payload.uiObject.isOnFocus === true) { + return node + } else { + return + } + } + case 'Product Definition': { + let child + child = getNodeThatIsOnFocus(node.record) + if (child !== undefined) { + return child + } + for (let m = 0; m < node.datasets.length; m++) { + child = getNodeThatIsOnFocus(node.datasets[m]) + if (child !== undefined) { + return child + } + } + if (node.payload.uiObject.isOnFocus === true) { + return node + } else { + return + } + } + case 'Record Definition': { + let child + for (let m = 0; m < node.properties.length; m++) { + child = getNodeThatIsOnFocus(node.yyy[m]) + if (child !== undefined) { + return child + } + } + if (node.payload.uiObject.isOnFocus === true) { + return node + } else { + return + } + } + case 'Record Property': { + let child + child = getNodeThatIsOnFocus(node.formula) + if (child !== undefined) { + return child + } + if (node.payload.uiObject.isOnFocus === true) { + return node + } else { + return + } + } + case 'Dataset Definition': { + if (node.payload.uiObject.isOnFocus === true) { + return node + } else { + return + } + } + case 'Plotter': { + let child + for (let m = 0; m < node.modules.length; m++) { + child = getNodeThatIsOnFocus(node.modules[m]) + if (child !== undefined) { + return child + } + } + if (node.payload.uiObject.isOnFocus === true) { + return node + } else { + return + } + } + case 'Plotter Module': { + let child + child = getNodeThatIsOnFocus(node.code) + if (child !== undefined) { + return child + } + for (let m = 0; m < node.panels.length; m++) { + child = getNodeThatIsOnFocus(node.panels[m]) + if (child !== undefined) { + return child + } + } + if (node.payload.uiObject.isOnFocus === true) { + return node + } else { + return + } + } + case 'Plotter Panel': { + let child + child = getNodeThatIsOnFocus(node.code) + if (child !== undefined) { + return child + } + if (node.payload.uiObject.isOnFocus === true) { + return node + } else { + return + } + } } } } From 2a273e123e0563bf375ab521fdbaf21540965886 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 30 Oct 2019 09:08:25 +0100 Subject: [PATCH 38/95] Protocol Node Implemented for Teams structure --- .../FunctionLibraries/ProtocolNode.js | 434 ++++++++++++++++++ 1 file changed, 434 insertions(+) diff --git a/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js b/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js index 2362606ec..16dc21845 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js +++ b/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js @@ -1031,6 +1031,440 @@ function newProtocolNode () { } return object } + case 'Team': { + let object = { + type: node.type, + subType: node.subType, + name: node.name, + sensorBots: [], + indicatorBots: [], + tradingBots: [], + plotters: [] + } + if (node.array1 !== undefined) { + for (let m = 0; m < node.sensorBots.length; m++) { + let sensorBot = getProtocolNode(node.sensorBots[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) + if (sensorBot !== undefined) { + object.sensorBots.push(sensorBot) + } + } + } + if (node.indicatorBots !== undefined) { + for (let m = 0; m < node.indicatorBots.length; m++) { + let indicatorBot = getProtocolNode(node.indicatorBots[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) + if (indicatorBot !== undefined) { + object.indicatorBots.push(indicatorBot) + } + } + } + if (node.tradingBots !== undefined) { + for (let m = 0; m < node.tradingBots.length; m++) { + let tradingBot = getProtocolNode(node.tradingBots[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) + if (tradingBot !== undefined) { + object.tradingBots.push(tradingBot) + } + } + } + if (node.plotters !== undefined) { + for (let m = 0; m < node.plotters.length; m++) { + let plotter = getProtocolNode(node.plotters[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) + if (plotter !== undefined) { + object.plotters.push(plotter) + } + } + } + if (includeIds) { + object.id = node.id + } + if (includePayload) { + object.savedPayload = getSavedPayload(node) + } + return object + } + case 'Sensor Bot': { + let object = { + type: node.type, + subType: node.subType, + name: node.name, + processes: [], + products: [] + } + if (node.processes !== undefined) { + for (let m = 0; m < node.processes.length; m++) { + let process = getProtocolNode(node.processes[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) + if (process !== undefined) { + object.processes.push(process) + } + } + } + if (node.products !== undefined) { + for (let m = 0; m < node.products.length; m++) { + let product = getProtocolNode(node.products[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) + if (product !== undefined) { + object.products.push(product) + } + } + } + if (includeIds) { + object.id = node.id + } + if (includePayload) { + object.savedPayload = getSavedPayload(node) + } + return object + } + case 'Indicator Bot': { + let object = { + type: node.type, + subType: node.subType, + name: node.name, + processes: [], + products: [] + } + if (node.processes !== undefined) { + for (let m = 0; m < node.processes.length; m++) { + let process = getProtocolNode(node.processes[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) + if (process !== undefined) { + object.processes.push(process) + } + } + } + if (node.products !== undefined) { + for (let m = 0; m < node.products.length; m++) { + let product = getProtocolNode(node.products[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) + if (product !== undefined) { + object.products.push(product) + } + } + } + if (includeIds) { + object.id = node.id + } + if (includePayload) { + object.savedPayload = getSavedPayload(node) + } + return object + } + case 'Trading Bot': { + let object = { + type: node.type, + subType: node.subType, + name: node.name, + processes: [], + products: [] + } + if (node.processes !== undefined) { + for (let m = 0; m < node.processes.length; m++) { + let process = getProtocolNode(node.processes[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) + if (process !== undefined) { + object.processes.push(process) + } + } + } + if (node.products !== undefined) { + for (let m = 0; m < node.products.length; m++) { + let product = getProtocolNode(node.products[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) + if (product !== undefined) { + object.products.push(product) + } + } + } + if (includeIds) { + object.id = node.id + } + if (includePayload) { + object.savedPayload = getSavedPayload(node) + } + return object + } + case 'Process Definition': { + let object = { + type: node.type, + subType: node.subType, + name: node.name, + calculations: getProtocolNode(node.calculations, removePersonalData, parseCode, includeIds, includePayload, includeReferences), + dataBuilding: getProtocolNode(node.dataBuilding, removePersonalData, parseCode, includeIds, includePayload, includeReferences), + outputDatasets: [], + statusDependencies: [], + dataDependencies: [] + } + if (node.outputDatasets !== undefined) { + for (let m = 0; m < node.outputDatasets.length; m++) { + let outputDataset = getProtocolNode(node.outputDatasets[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) + if (outputDataset !== undefined) { + object.outputDatasets.push(outputDataset) + } + } + } + if (node.statusDependencies !== undefined) { + for (let m = 0; m < node.statusDependencies.length; m++) { + let statusDependency = getProtocolNode(node.statusDependencies[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) + if (statusDependency !== undefined) { + object.statusDependencies.push(statusDependency) + } + } + } + if (node.dataDependencies !== undefined) { + for (let m = 0; m < node.dataDependencies.length; m++) { + let dataDependency = getProtocolNode(node.dataDependencies[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) + if (dataDependency !== undefined) { + object.dataDependencies.push(dataDependency) + } + } + } + if (includeIds) { + object.id = node.id + } + if (includePayload) { + object.savedPayload = getSavedPayload(node) + } + return object + } + case 'Calculations Procedure': { + let object = { + type: node.type, + subType: node.subType, + name: node.name, + initialization: getProtocolNode(node.initialization, removePersonalData, parseCode, includeIds, includePayload, includeReferences), + loop: getProtocolNode(node.loop, removePersonalData, parseCode, includeIds, includePayload, includeReferences) + } + if (includeIds) { + object.id = node.id + } + if (includePayload) { + object.savedPayload = getSavedPayload(node) + } + return object + } + case 'Data Building Procedure': { + let object = { + type: node.type, + subType: node.subType, + name: node.name, + initialization: getProtocolNode(node.initialization, removePersonalData, parseCode, includeIds, includePayload, includeReferences), + loop: getProtocolNode(node.loop, removePersonalData, parseCode, includeIds, includePayload, includeReferences) + } + if (includeIds) { + object.id = node.id + } + if (includePayload) { + object.savedPayload = getSavedPayload(node) + } + return object + } + case 'Procedure Initialization': { + let object = { + type: node.type, + subType: node.subType, + name: node.name, + code: getProtocolNode(node.code, removePersonalData, parseCode, includeIds, includePayload, includeReferences) + } + if (includeIds) { + object.id = node.id + } + if (includePayload) { + object.savedPayload = getSavedPayload(node) + } + return object + } + case 'Procedure Loop': { + let object = { + type: node.type, + subType: node.subType, + name: node.name, + code: getProtocolNode(node.code, removePersonalData, parseCode, includeIds, includePayload, includeReferences) + } + if (includeIds) { + object.id = node.id + } + if (includePayload) { + object.savedPayload = getSavedPayload(node) + } + return object + } + case 'Output Dataset': { + let object = { + type: node.type, + subType: node.subType, + name: node.name + } + if (includeIds) { + object.id = node.id + } + if (includePayload) { + object.savedPayload = getSavedPayload(node) + } + return object + } + case 'Status Dependency': { + let object = { + type: node.type, + subType: node.subType, + name: node.name + } + if (includeIds) { + object.id = node.id + } + if (includePayload) { + object.savedPayload = getSavedPayload(node) + } + return object + } + case 'Data Dependency': { + let object = { + type: node.type, + subType: node.subType, + name: node.name + } + if (includeIds) { + object.id = node.id + } + if (includePayload) { + object.savedPayload = getSavedPayload(node) + } + return object + } + case 'Product Definition': { + let object = { + type: node.type, + subType: node.subType, + name: node.name, + record: getProtocolNode(node.record, removePersonalData, parseCode, includeIds, includePayload, includeReferences), + datasets: [] + } + if (node.datasets !== undefined) { + for (let m = 0; m < node.datasets.length; m++) { + let dataset = getProtocolNode(node.datasets[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) + if (dataset !== undefined) { + object.datasets.push(dataset) + } + } + } + if (includeIds) { + object.id = node.id + } + if (includePayload) { + object.savedPayload = getSavedPayload(node) + } + return object + } + case 'Record Definition': { + let object = { + type: node.type, + subType: node.subType, + name: node.name, + properties: [] + } + if (node.properties !== undefined) { + for (let m = 0; m < node.properties.length; m++) { + let property = getProtocolNode(node.properties[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) + if (property !== undefined) { + object.properties.push(property) + } + } + } + if (includeIds) { + object.id = node.id + } + if (includePayload) { + object.savedPayload = getSavedPayload(node) + } + return object + } + case 'Record Property': { + let object = { + type: node.type, + subType: node.subType, + name: node.name, + formula: getProtocolNode(node.formula, removePersonalData, parseCode, includeIds, includePayload, includeReferences) + } + if (includeIds) { + object.id = node.id + } + if (includePayload) { + object.savedPayload = getSavedPayload(node) + } + return object + } + case 'Dataset Definition': { + let object = { + type: node.type, + subType: node.subType, + name: node.name, + code: node.code + } + if (includeIds) { + object.id = node.id + } + if (includePayload) { + object.savedPayload = getSavedPayload(node) + } + return object + } + case 'Plotter': { + let object = { + type: node.type, + subType: node.subType, + name: node.name, + modules: [] + } + if (node.modules !== undefined) { + for (let m = 0; m < node.modules.length; m++) { + let module = getProtocolNode(node.modules[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) + if (module !== undefined) { + object.modules.push(module) + } + } + } + if (includeIds) { + object.id = node.id + } + if (includePayload) { + object.savedPayload = getSavedPayload(node) + } + return object + } + case 'Plotter Module': { + let object = { + type: node.type, + subType: node.subType, + name: node.name, + code: getProtocolNode(node.code, removePersonalData, parseCode, includeIds, includePayload, includeReferences), + array1: [], + array2: [] + } + if (node.panels !== undefined) { + for (let m = 0; m < node.panels.length; m++) { + let panel = getProtocolNode(node.panels[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) + if (panel !== undefined) { + object.panels.push(panel) + } + } + } + if (includeIds) { + object.id = node.id + } + if (includePayload) { + object.savedPayload = getSavedPayload(node) + } + return object + } + case 'Plotter Panel': { + let object = { + type: node.type, + subType: node.subType, + name: node.name, + code: getProtocolNode(node.code, removePersonalData, parseCode, includeIds, includePayload, includeReferences) + } + if (includeIds) { + object.id = node.id + } + if (includePayload) { + object.savedPayload = getSavedPayload(node) + } + return object + } + } } From 29a9af8d94be1b943fef832d2b8a1ade43ff44a7 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 30 Oct 2019 11:11:13 +0100 Subject: [PATCH 39/95] Shortcut Keys in Team structure --- .../FunctionLibraries/ProtocolNode.js | 3 +- .../FunctionLibraries/ShortcutKeys.js | 299 ++++++++++++++++++ 2 files changed, 300 insertions(+), 2 deletions(-) diff --git a/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js b/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js index 16dc21845..f38d027b0 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js +++ b/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js @@ -1430,8 +1430,7 @@ function newProtocolNode () { subType: node.subType, name: node.name, code: getProtocolNode(node.code, removePersonalData, parseCode, includeIds, includePayload, includeReferences), - array1: [], - array2: [] + panels: [] } if (node.panels !== undefined) { for (let m = 0; m < node.panels.length; m++) { diff --git a/DesignerSpace/Workspace/FunctionLibraries/ShortcutKeys.js b/DesignerSpace/Workspace/FunctionLibraries/ShortcutKeys.js index 251226452..a1eb48b56 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/ShortcutKeys.js +++ b/DesignerSpace/Workspace/FunctionLibraries/ShortcutKeys.js @@ -714,6 +714,305 @@ function newShortcutKeys () { return } } + case 'Team': { + let child + for (let m = 0; m < node.sensorBots.length; m++) { + child = getNodeByShortcutKey(node.sensorBots[m], searchingKey) + if (child !== undefined) { + return child + } + } + for (let m = 0; m < node.indicatorBots.length; m++) { + child = getNodeByShortcutKey(node.indicatorBots[m], searchingKey) + if (child !== undefined) { + return child + } + } + for (let m = 0; m < node.tradingBots.length; m++) { + child = getNodeByShortcutKey(node.tradingBots[m], searchingKey) + if (child !== undefined) { + return child + } + } + for (let m = 0; m < node.plotters.length; m++) { + child = getNodeByShortcutKey(node.plotters[m], searchingKey) + if (child !== undefined) { + return child + } + } + if (node.payload.uiObject.shortcutKey === searchingKey) { + return node + } else { + return + } + } + case 'Sensor Bot': { + let child + for (let m = 0; m < node.processes.length; m++) { + child = getNodeByShortcutKey(node.processes[m], searchingKey) + if (child !== undefined) { + return child + } + } + for (let m = 0; m < node.products.length; m++) { + child = getNodeByShortcutKey(node.products[m], searchingKey) + if (child !== undefined) { + return child + } + } + if (node.payload.uiObject.shortcutKey === searchingKey) { + return node + } else { + return + } + } + case 'Indicator Bot': { + let child + for (let m = 0; m < node.processes.length; m++) { + child = getNodeByShortcutKey(node.processes[m], searchingKey) + if (child !== undefined) { + return child + } + } + for (let m = 0; m < node.products.length; m++) { + child = getNodeByShortcutKey(node.products[m], searchingKey) + if (child !== undefined) { + return child + } + } + if (node.payload.uiObject.shortcutKey === searchingKey) { + return node + } else { + return + } + } + case 'Trading Bot': { + let child + for (let m = 0; m < node.processes.length; m++) { + child = getNodeByShortcutKey(node.processes[m], searchingKey) + if (child !== undefined) { + return child + } + } + for (let m = 0; m < node.products.length; m++) { + child = getNodeByShortcutKey(node.products[m], searchingKey) + if (child !== undefined) { + return child + } + } + if (node.payload.uiObject.shortcutKey === searchingKey) { + return node + } else { + return + } + } + case 'Process Definition': { + let child + child = getNodeByShortcutKey(node.calculations, searchingKey) + if (child !== undefined) { + return child + } + child = getNodeByShortcutKey(node.dataBuilding, searchingKey) + if (child !== undefined) { + return child + } + for (let m = 0; m < node.outputDatasets.length; m++) { + child = getNodeByShortcutKey(node.outputDatasets[m], searchingKey) + if (child !== undefined) { + return child + } + } + for (let m = 0; m < node.statusDependencies.length; m++) { + child = getNodeByShortcutKey(node.statusDependencies[m], searchingKey) + if (child !== undefined) { + return child + } + } + for (let m = 0; m < node.dataDependencies.length; m++) { + child = getNodeByShortcutKey(node.dataDependencies[m], searchingKey) + if (child !== undefined) { + return child + } + } + if (node.payload.uiObject.shortcutKey === searchingKey) { + return node + } else { + return + } + } + case 'Calculations Procedure': { + let child + child = getNodeByShortcutKey(node.initialization, searchingKey) + if (child !== undefined) { + return child + } + child = getNodeByShortcutKey(node.loop, searchingKey) + if (child !== undefined) { + return child + } + if (node.payload.uiObject.shortcutKey === searchingKey) { + return node + } else { + return + } + } + case 'Data Building Procedure': { + let child + child = getNodeByShortcutKey(node.initialization, searchingKey) + if (child !== undefined) { + return child + } + child = getNodeByShortcutKey(node.loop, searchingKey) + if (child !== undefined) { + return child + } + if (node.payload.uiObject.shortcutKey === searchingKey) { + return node + } else { + return + } + } + case 'Procedure Initialization': { + let child + child = getNodeByShortcutKey(node.code, searchingKey) + if (child !== undefined) { + return child + } + if (node.payload.uiObject.shortcutKey === searchingKey) { + return node + } else { + return + } + } + case 'Procedure Loop': { + let child + child = getNodeByShortcutKey(node.code, searchingKey) + if (child !== undefined) { + return child + } + if (node.payload.uiObject.shortcutKey === searchingKey) { + return node + } else { + return + } + } + case 'Output Dataset': { + if (node.payload.uiObject.shortcutKey === searchingKey) { + return node + } else { + return + } + } + case 'Status Dependency': { + if (node.payload.uiObject.shortcutKey === searchingKey) { + return node + } else { + return + } + } + case 'Data Dependency': { + if (node.payload.uiObject.shortcutKey === searchingKey) { + return node + } else { + return + } + } + case 'Product Definition': { + let child + child = getNodeByShortcutKey(node.record, searchingKey) + if (child !== undefined) { + return child + } + for (let m = 0; m < node.datasets.length; m++) { + child = getNodeByShortcutKey(node.datasets[m], searchingKey) + if (child !== undefined) { + return child + } + } + if (node.payload.uiObject.shortcutKey === searchingKey) { + return node + } else { + return + } + } + case 'Record Definition': { + let child + for (let m = 0; m < node.properties.length; m++) { + child = getNodeByShortcutKey(node.properties[m], searchingKey) + if (child !== undefined) { + return child + } + } + if (node.payload.uiObject.shortcutKey === searchingKey) { + return node + } else { + return + } + } + case 'Record Property': { + let child + child = getNodeByShortcutKey(node.formula, searchingKey) + if (child !== undefined) { + return child + } + if (node.payload.uiObject.shortcutKey === searchingKey) { + return node + } else { + return + } + } + case 'Dataset Definition': { + if (node.payload.uiObject.shortcutKey === searchingKey) { + return node + } else { + return + } + } + case 'Plotter': { + let child + for (let m = 0; m < node.modules.length; m++) { + child = getNodeByShortcutKey(node.modules[m], searchingKey) + if (child !== undefined) { + return child + } + } + if (node.payload.uiObject.shortcutKey === searchingKey) { + return node + } else { + return + } + } + case 'Plotter Module': { + let child + child = getNodeByShortcutKey(node.code, searchingKey) + if (child !== undefined) { + return child + } + for (let m = 0; m < node.panels.length; m++) { + child = getNodeByShortcutKey(node.panels[m], searchingKey) + if (child !== undefined) { + return child + } + } + if (node.payload.uiObject.shortcutKey === searchingKey) { + return node + } else { + return + } + } + case 'Plotter Panel': { + let child + child = getNodeByShortcutKey(node.code, searchingKey) + if (child !== undefined) { + return child + } + if (node.payload.uiObject.shortcutKey === searchingKey) { + return node + } else { + return + } + } + } } } From 09523e116950ec1295bcf6d1ddd4b2355dd72ba2 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 30 Oct 2019 14:35:30 +0100 Subject: [PATCH 40/95] UiObjects Team structure --- .../FunctionLibraries/ProtocolNode.js | 2 +- .../FunctionLibraries/UiObjectsFromNodes.js | 465 ++++++++++++++++++ 2 files changed, 466 insertions(+), 1 deletion(-) diff --git a/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js b/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js index f38d027b0..0684abe51 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js +++ b/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js @@ -1041,7 +1041,7 @@ function newProtocolNode () { tradingBots: [], plotters: [] } - if (node.array1 !== undefined) { + if (node.sensorBots !== undefined) { for (let m = 0; m < node.sensorBots.length; m++) { let sensorBot = getProtocolNode(node.sensorBots[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) if (sensorBot !== undefined) { diff --git a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js index f3613d49d..e8756ed12 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js +++ b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js @@ -2,6 +2,25 @@ function newUiObjectsFromNodes () { thisObject = { recreateWorkspace: recreateWorkspace, createUiObjectFromNode: createUiObjectFromNode, + addTeam: addTeam, + addSensorBot: addSensorBot, + addIndicatorBot: addIndicatorBot, + addTradingBot: addTradingBot, + addProcessDefinition: addProcessDefinition, + addCalculationsProcedure: addCalculationsProcedure, + addDataBuildingProcedure: addDataBuildingProcedure, + addProcedureInitialization: addProcedureInitialization, + addProcedureLoop: addProcedureLoop, + addOutputDataset: addOutputDataset, + addStatusDependency: addStatusDependency, + addDataDependency: addDataDependency, + addProductDefinition: addProductDefinition, + addRecordDefinition: addRecordDefinition, + addRecordProperty: addRecordProperty, + addDatasetDefinition: addDatasetDefinition, + addPlotter: addPlotter, + addPlotterModule: addPlotterModule, + addPlotterPanel: addPlotterPanel, addDefinition: addDefinition, addNetwork: addNetwork, addNetworkNode: addNetworkNode, @@ -665,9 +684,455 @@ function newUiObjectsFromNodes () { } return } + + case 'Team': { + createUiObject(node.type, node.name, node, parentNode, chainParent, node.type) + for (let m = 0; m < node.sensorBots.length; m++) { + let sensorBot = node.sensorBots[m] + createUiObjectFromNode(sensorBot, node, node) + } + for (let m = 0; m < node.indicatorBots.length; m++) { + let indicatorBot = node.indicatorBots[m] + createUiObjectFromNode(indicatorBot, node, node) + } + for (let m = 0; m < node.tradingBots.length; m++) { + let tradingBot = node.tradingBots[m] + createUiObjectFromNode(tradingBot, node, node) + } + for (let m = 0; m < node.plotters.length; m++) { + let plotter = node.plotters[m] + createUiObjectFromNode(plotter, node, node) + } + return + } + case 'Sensor Bot': { + createUiObject(node.type, node.name, node, parentNode, chainParent, node.type) + for (let m = 0; m < node.processes.length; m++) { + let process = node.processes[m] + createUiObjectFromNode(process, node, node) + } + for (let m = 0; m < node.products.length; m++) { + let product = node.products[m] + createUiObjectFromNode(product, node, node) + } + return + } + case 'Indicator Bot': { + createUiObject(node.type, node.name, node, parentNode, chainParent, node.type) + for (let m = 0; m < node.processes.length; m++) { + let process = node.processes[m] + createUiObjectFromNode(process, node, node) + } + for (let m = 0; m < node.products.length; m++) { + let product = node.products[m] + createUiObjectFromNode(product, node, node) + } + return + } + case 'Trading Bot': { + createUiObject(node.type, node.name, node, parentNode, chainParent, node.type) + for (let m = 0; m < node.processes.length; m++) { + let process = node.processes[m] + createUiObjectFromNode(process, node, node) + } + for (let m = 0; m < node.products.length; m++) { + let product = node.products[m] + createUiObjectFromNode(product, node, node) + } + return + } + case 'Process Definition': { + createUiObject(node.type, node.name, node, parentNode, chainParent, node.type) + if (node.calculations !== undefined) { + createUiObjectFromNode(node.calculations, node, node) + } + if (node.dataBuilding !== undefined) { + createUiObjectFromNode(node.dataBuilding, node, node) + } + for (let m = 0; m < node.outputDatasets.length; m++) { + let outputDataset = node.outputDatasets[m] + createUiObjectFromNode(outputDataset, node, node) + } + for (let m = 0; m < node.statusDependencies.length; m++) { + let statusDependency = node.statusDependencies[m] + createUiObjectFromNode(statusDependency, node, node) + } + for (let m = 0; m < node.dataDependencies.length; m++) { + let dataDependency = node.dataDependencies[m] + createUiObjectFromNode(dataDependency, node, node) + } + return + } + case 'Calculations Procedure': { + createUiObject(node.type, node.name, node, parentNode, chainParent, node.type) + if (node.initialization !== undefined) { + createUiObjectFromNode(node.initialization, node, node) + } + if (node.loop !== undefined) { + createUiObjectFromNode(node.loop, node, node) + } + return + } + case 'Data Building Procedure': { + createUiObject(node.type, node.name, node, parentNode, chainParent, node.type) + if (node.initialization !== undefined) { + createUiObjectFromNode(node.initialization, node, node) + } + if (node.loop !== undefined) { + createUiObjectFromNode(node.loop, node, node) + } + return + } + case 'Procedure Initialization': { + createUiObject(node.type, node.name, node, parentNode, chainParent, node.type) + if (node.code !== undefined) { + createUiObjectFromNode(node.code, node, node) + } + return + } + case 'Procedure Loop': { + createUiObject(node.type, node.name, node, parentNode, chainParent, node.type) + if (node.code !== undefined) { + createUiObjectFromNode(node.code, node, node) + } + return + } + case 'Output Dataset': { + createUiObject(node.type, node.name, node, parentNode, chainParent, node.type) + return + } + case 'Status Dependency': { + createUiObject(node.type, node.name, node, parentNode, chainParent, node.type) + return + } + case 'Data Dependency': { + createUiObject(node.type, node.name, node, parentNode, chainParent, node.type) + return + } + case 'Product Definition': { + createUiObject(node.type, node.name, node, parentNode, chainParent, node.type) + if (node.record !== undefined) { + createUiObjectFromNode(node.record, node, node) + } + for (let m = 0; m < node.datasets.length; m++) { + let dataset = node.datasets[m] + createUiObjectFromNode(dataset, node, node) + } + return + } + case 'Record Definition': { + createUiObject(node.type, node.name, node, parentNode, chainParent, node.type) + for (let m = 0; m < node.properties.length; m++) { + let property = node.properties[m] + createUiObjectFromNode(property, node, node) + } + return + } + case 'Record Property': { + createUiObject(node.type, node.name, node, parentNode, chainParent, node.type) + if (node.formula !== undefined) { + createUiObjectFromNode(node.formula, node, node) + } + return + } + case 'Dataset Definition': { + createUiObject(node.type, node.name, node, parentNode, chainParent, node.type) + return + } + case 'Plotter': { + createUiObject(node.type, node.name, node, parentNode, chainParent, node.type) + for (let m = 0; m < node.modules.length; m++) { + let module = node.modules[m] + createUiObjectFromNode(module, node, node) + } + return + } + case 'Plotter Module': { + createUiObject(node.type, node.name, node, parentNode, chainParent, node.type) + if (node.code !== undefined) { + createUiObjectFromNode(node.code, node, node) + } + for (let m = 0; m < node.panels.length; m++) { + let panel = node.panels[m] + createUiObjectFromNode(panel, node, node) + } + return + } + case 'Plotter Panel': { + createUiObject(node.type, node.name, node, parentNode, chainParent, node.type) + if (node.code !== undefined) { + createUiObjectFromNode(node.code, node, node) + } + return + } } } + function addTeam (node) { + let team = { + name: 'New Team', + sensorBots: [], + indicatorBots: [], + tradingBots: [], + plotters: [] + } + node.rootNodes.push(team) + createUiObject(node.type, network.name, network, node, undefined) + + return team + } + + function addSensorBot (node) { + let object = { + type: 'Sensor Bot', + name: 'New Sensor Bot', + processes: [], + products: [] + } + if (node.sensorBots === undefined) { + node.sensorBots = [] + } + node.sensorBots.push(object) + createUiObject(object.type, object.name, object, node, node) + + return object + } + + function addIndicatorBot (node) { + let object = { + type: 'Indicator Bot', + name: 'New Indicator Bot', + processes: [], + products: [] + } + if (node.indicatorBots === undefined) { + node.indicatorBots = [] + } + node.indicatorBots.push(object) + createUiObject(object.type, object.name, object, node, node) + + return object + } + + function addTradingBot (node) { + let object = { + type: 'Trading Bot', + name: 'New Trading Bot', + processes: [], + products: [] + } + if (node.tradingBots === undefined) { + node.tradingBots = [] + } + node.tradingBots.push(object) + createUiObject(object.type, object.name, object, node, node) + + return object + } + + function addProcessDefinition (node) { + let object = { + type: 'Process Definition', + name: 'New Process Definition', + outputDatasets: [], + statusDependencies: [], + dataDependencies: [] + } + if (node.processes === undefined) { + node.processes = [] + } + node.processes.push(object) + createUiObject(object.type, object.name, object, node, node) + + return object + } + + function addCalculationsProcedure (node) { + if (node.calculations === undefined) { + node.calculations = { + type: 'Calculations Procedure', + name: 'New Calculations Procedure' + } + createUiObject(node.calculations.type, node.calculations.name, node.calculations, node, node) + } + return node.calculations + } + + function addDataBuildingProcedure (node) { + if (node.dataBuilding === undefined) { + node.dataBuilding = { + type: 'Data Building Procedure', + name: 'New Data Building Procedure' + } + createUiObject(node.dataBuilding.type, node.dataBuilding.name, node.dataBuilding, node, node) + } + return node.dataBuilding + } + + function addProcedureInitialization (node) { + if (node.initialization === undefined) { + node.initialization = { + type: 'Procedure Initialization', + name: 'New Procedure Initialization' + } + createUiObject(node.initialization.type, node.initialization.name, node.initialization, node, node) + } + return node.initialization + } + + function addProcedureLoop (node) { + if (node.loop === undefined) { + node.loop = { + type: 'Procedure Loop', + name: 'New Procedure Loop' + } + createUiObject(node.loop.type, node.loop.name, node.loop, node, node) + } + return node.loop + } + + function addOutputDataset (node) { + let object = { + type: 'Output Dataset', + name: 'New Output Dataset' + } + if (node.outputDatasets === undefined) { + node.outputDatasets = [] + } + node.outputDatasets.push(object) + createUiObject(object.type, object.name, object, node, node) + + return object + } + + function addStatusDependency (node) { + let object = { + type: 'Status Dependency', + name: 'New Status Dependency' + } + if (node.statusDependencies === undefined) { + node.statusDependencies = [] + } + node.statusDependencies.push(object) + createUiObject(object.type, object.name, object, node, node) + + return object + } + + function addDataDependency (node) { + let object = { + type: 'Data Dependency', + name: 'New Data Dependency' + } + if (node.dataDependencies === undefined) { + node.dataDependencies = [] + } + node.dataDependencies.push(object) + createUiObject(object.type, object.name, object, node, node) + + return object + } + + function addProductDefinition (node) { + let object = { + type: 'Product Definition', + name: 'New Product Definition', + datasets: [] + } + if (node.products === undefined) { + node.products = [] + } + node.products.push(object) + createUiObject(object.type, object.name, object, node, node) + + return object + } + + function addRecordDefinition (node) { + if (node.record === undefined) { + node.record = { + type: 'Record Definition', + name: 'New Record Definition', + properties: [] + } + createUiObject(node.record.type, node.record.name, node.record, node, node) + } + return node.record + } + + function addRecordProperty (node) { + let object = { + type: 'Record Property', + name: 'New Record Property' + } + if (node.properties === undefined) { + node.properties = [] + } + node.properties.push(object) + createUiObject(object.type, object.name, object, node, node) + + return object + } + + function addDatasetDefinition (node) { + let object = { + type: 'Dataset Definition', + name: 'New Dataset Definition', + code: '{}' + } + if (node.datasets === undefined) { + node.datasets = [] + } + node.datasets.push(object) + createUiObject(object.type, object.name, object, node, node) + + return object + } + + function addPlotter (node) { + let object = { + type: 'Plotter', + name: 'New Plotter', + modules: [] + } + if (node.plotters === undefined) { + node.plotters = [] + } + node.plotters.push(object) + createUiObject(object.type, object.name, object, node, node) + + return object + } + + function addPlotterModule (node) { + let object = { + type: 'Plotter Module', + name: 'New Plotter Module', + panels: [] + } + if (node.modules === undefined) { + node.modules = [] + } + node.modules.push(object) + createUiObject(object.type, object.name, object, node, node) + + return object + } + + function addPlotterPanel (node) { + let object = { + type: 'Plotter Panel', + name: 'New Plotter Panel' + } + if (node.panels === undefined) { + node.panels = [] + } + node.panels.push(object) + createUiObject(object.type, object.name, object, node, node) + + return object + } + function addNetwork (node) { let network = { name: 'Superalgos' From 4b5870e8e84f143f5fac8e0080a784ff6f7687d8 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 30 Oct 2019 15:16:34 +0100 Subject: [PATCH 41/95] Icons for Teams Structure --- Spaces/DesignerSpace.js | 39 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/Spaces/DesignerSpace.js b/Spaces/DesignerSpace.js index b7b9f9494..70c34a8c4 100644 --- a/Spaces/DesignerSpace.js +++ b/Spaces/DesignerSpace.js @@ -51,7 +51,7 @@ function newDesignerSpace () { ['Task', 'timeline'], ['Sensor Bot Instance', 'bot-sensor'], ['Indicator Bot Instance', 'bot-indicator'], - ['Trading Bot Instance', 'trading-engine'], + ['Trading Bot Instance', 'bot-trading'], ['Process Instance', 'process'], ['Backtesting Session', 'session-backtesting'], ['Live Trading Session', 'session-live-trading'], @@ -89,7 +89,26 @@ function newDesignerSpace () { ['Next Phase Event', 'pantone'], ['Situation', 'pyramid'], ['Condition', 'testing'], - ['Code', 'html'] + ['Code', 'html'], + ['Team', 'team'], + ['Sensor Bot', 'bot-sensor'], + ['Indicator Bot', 'bot-indicator'], + ['Trading Bot', 'bot-trading'], + ['Process Definition', 'process-definition'], + ['Calculations Procedure', 'calculations-procedure'], + ['Data Building Procedure', 'data-building-procedure'], + ['Procedure Initialization', 'procedure-initialization'], + ['Procedure Loop', 'procedure-loop'], + ['Output Dataset', 'output-dataset'], + ['Status Dependency', 'status-dependency'], + ['Data Dependency', 'data-dependency'], + ['Product Definition', 'product-definition'], + ['Record Definition', 'record-definition'], + ['Record Property', 'record-property'], + ['Dataset Definition', 'pyramid'], + ['Plotter', 'plotter'], + ['Plotter Module', 'plotter-module'], + ['Plotter Panel', 'pyramid'] ] for (let i = 0; i < relationshipArray.length; i++) { @@ -183,7 +202,21 @@ function newDesignerSpace () { 'process', 'bot-indicator', 'bot-sensor', - 'time-period' + 'time-period', + 'team', + 'procedure-loop', + 'calculations-procedure', + 'data-building-procedure', + 'procedure-initialization', + 'process-definition', + 'output-dataset', + 'data-dependency', + 'product-definition', + 'plotter-module', + 'status-dependency', + 'record-property', + 'record-definition', + 'plotter' ] for (let i = 0; i < iconsNames.length; i++) { From 93ec4478dc4a7fd7b6e477158bee2b3729b82d6a Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 30 Oct 2019 16:20:28 +0100 Subject: [PATCH 42/95] UI Constructor of Team Structure --- FloatingSpace/UiObjectConstructor.js | 1120 +++++++++++++++++++++++++- Spaces/DesignerSpace.js | 2 +- 2 files changed, 1118 insertions(+), 4 deletions(-) diff --git a/FloatingSpace/UiObjectConstructor.js b/FloatingSpace/UiObjectConstructor.js index 27c25a6bc..c209e637d 100644 --- a/FloatingSpace/UiObjectConstructor.js +++ b/FloatingSpace/UiObjectConstructor.js @@ -204,7 +204,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: -20 + angle: -30 }, { action: 'Add Network', @@ -215,7 +215,18 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: 0 + angle: -10 + }, + { + action: 'Add Team', + actionFunction: payload.onMenuItemClick, + label: 'Add Team', + visible: true, + relatedUiObject: 'Team', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: 10 }, { action: 'Share Workspace', @@ -227,7 +238,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: 20 + angle: 30 }] break } @@ -293,6 +304,1033 @@ function newUiObjectConstructor () { ) break } + case 'Team': { + addLeftIcons(menuItemsInitialValues, floatingObject) + menuItemsInitialValues.push( + { + action: 'Add Sensor Bot', + actionFunction: payload.onMenuItemClick, + label: 'Add Sensor Bot', + visible: true, + relatedUiObject: 'Sensor Bot', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: -70 + } + ) + menuItemsInitialValues.push( + { + action: 'Add Indicator Bot', + actionFunction: payload.onMenuItemClick, + label: 'Add Indicator Bot', + visible: true, + relatedUiObject: 'Indicator Bot', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: -30 + } + ) + menuItemsInitialValues.push( + { + action: 'Add Trading Bot', + actionFunction: payload.onMenuItemClick, + label: 'Add Trading Bot', + visible: true, + relatedUiObject: 'Trading Bot', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: -10 + } + ) + menuItemsInitialValues.push( + { + action: 'Add Plotter', + actionFunction: payload.onMenuItemClick, + label: 'Add Plotter', + visible: true, + relatedUiObject: 'Plotter', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: 10 + } + ) + menuItemsInitialValues.push( + { + action: 'Delete Team', + askConfirmation: true, + confirmationLabel: 'Confirm to Delete', + actionFunction: payload.onMenuItemClick, + label: 'Delete Team', + visible: true, + iconPathOn: 'delete', + iconPathOff: 'delete', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: 30 + } + ) + menuItemsInitialValues.push( + { + action: 'Share', + actionFunction: payload.onMenuItemClick, + label: 'Share', + visible: true, + iconPathOn: 'menu-share', + iconPathOff: 'menu-share', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: 70 + } + ) + break + } + case 'Sensor Bot': { + addLeftIcons(menuItemsInitialValues, floatingObject) + menuItemsInitialValues.push( + { + action: 'Add Process Definition', + actionFunction: payload.onMenuItemClick, + label: 'Add Process Definition', + visible: true, + relatedUiObject: 'Process Definition', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: -60 + } + ) + menuItemsInitialValues.push( + { + action: 'Add Product Definition', + actionFunction: payload.onMenuItemClick, + label: 'Add Product Definition', + visible: true, + relatedUiObject: 'Product Definition', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: -20 + } + ) + menuItemsInitialValues.push( + { + action: 'Delete Sensor Bot', + askConfirmation: true, + confirmationLabel: 'Confirm to Delete', + actionFunction: payload.onMenuItemClick, + label: 'Delete Sensor Bot', + visible: true, + iconPathOn: 'delete', + iconPathOff: 'delete', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: 20 + } + ) + menuItemsInitialValues.push( + { + action: 'Share', + actionFunction: payload.onMenuItemClick, + label: 'Share', + visible: true, + iconPathOn: 'menu-share', + iconPathOff: 'menu-share', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: 60 + } + ) + break + } + case 'Indicator Bot': { + addLeftIcons(menuItemsInitialValues, floatingObject) + menuItemsInitialValues.push( + { + action: 'Add Process Definition', + actionFunction: payload.onMenuItemClick, + label: 'Add Process Definition', + visible: true, + relatedUiObject: 'Process Definition', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: -60 + } + ) + menuItemsInitialValues.push( + { + action: 'Add Product Definition', + actionFunction: payload.onMenuItemClick, + label: 'Add Product Definition', + visible: true, + relatedUiObject: 'Product Definition', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: -20 + } + ) + menuItemsInitialValues.push( + { + action: 'Delete Indicator Bot', + askConfirmation: true, + confirmationLabel: 'Confirm to Delete', + actionFunction: payload.onMenuItemClick, + label: 'Delete Indicator Bot', + visible: true, + iconPathOn: 'delete', + iconPathOff: 'delete', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: 20 + } + ) + menuItemsInitialValues.push( + { + action: 'Share', + actionFunction: payload.onMenuItemClick, + label: 'Share', + visible: true, + iconPathOn: 'menu-share', + iconPathOff: 'menu-share', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: 60 + } + ) + break + } + case 'Trading Bot': { + addLeftIcons(menuItemsInitialValues, floatingObject) + menuItemsInitialValues.push( + { + action: 'Add Process Definition', + actionFunction: payload.onMenuItemClick, + label: 'Add Process Definition', + visible: true, + relatedUiObject: 'Process Definition', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: -60 + } + ) + menuItemsInitialValues.push( + { + action: 'Add Product Definition', + actionFunction: payload.onMenuItemClick, + label: 'Add Product Definition', + visible: true, + relatedUiObject: 'Product Definition', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: -20 + } + ) + menuItemsInitialValues.push( + { + action: 'Delete Trading Bot', + askConfirmation: true, + confirmationLabel: 'Confirm to Delete', + actionFunction: payload.onMenuItemClick, + label: 'Delete Trading Bot', + visible: true, + iconPathOn: 'delete', + iconPathOff: 'delete', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: 20 + } + ) + menuItemsInitialValues.push( + { + action: 'Share', + actionFunction: payload.onMenuItemClick, + label: 'Share', + visible: true, + iconPathOn: 'menu-share', + iconPathOff: 'menu-share', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: 60 + } + ) + break + } + case 'Process Definition': { + addLeftIcons(menuItemsInitialValues, floatingObject) + menuItemsInitialValues.push( + { + action: 'Add Calculations Procedure', + actionFunction: payload.onMenuItemClick, + label: 'Add Calculations Procedure', + visible: true, + relatedUiObject: 'Calculations Procedure', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: -75 + } + ) + menuItemsInitialValues.push( + { + action: 'Add Data Building Procedure', + actionFunction: payload.onMenuItemClick, + label: 'Add Data Building Procedure', + visible: true, + relatedUiObject: 'Data Building Procedure', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: -40 + } + ) + menuItemsInitialValues.push( + { + action: 'Add Output Dataset', + actionFunction: payload.onMenuItemClick, + label: 'Add Output Dataset', + visible: true, + relatedUiObject: 'Output Dataset', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: -20 + } + ) + menuItemsInitialValues.push( + { + action: 'Add Status Dependency', + actionFunction: payload.onMenuItemClick, + label: 'Add Status Dependency', + visible: true, + relatedUiObject: 'Status Dependency', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: 0 + } + ) + menuItemsInitialValues.push( + { + action: 'Add Data Dependency', + actionFunction: payload.onMenuItemClick, + label: 'Add Data Dependency', + visible: true, + relatedUiObject: 'Data Dependency', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: 20 + } + ) + menuItemsInitialValues.push( + { + action: 'Delete Process Definition', + askConfirmation: true, + confirmationLabel: 'Confirm to Delete', + actionFunction: payload.onMenuItemClick, + label: 'Delete Process Definition', + visible: true, + iconPathOn: 'delete', + iconPathOff: 'delete', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: 40 + } + ) + menuItemsInitialValues.push( + { + action: 'Share', + actionFunction: payload.onMenuItemClick, + label: 'Share', + visible: true, + iconPathOn: 'menu-share', + iconPathOff: 'menu-share', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: 75 + } + ) + break + } + case 'Calculations Procedure': { + addLeftIcons(menuItemsInitialValues, floatingObject) + menuItemsInitialValues.push( + { + action: 'Add Procedure Initialization', + actionFunction: payload.onMenuItemClick, + label: 'Add Procedure Initialization', + visible: true, + relatedUiObject: 'Procedure Initialization', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: -60 + } + ) + menuItemsInitialValues.push( + { + action: 'Add Procedure Initialization', + actionFunction: payload.onMenuItemClick, + label: 'Add Procedure Initialization', + visible: true, + relatedUiObject: 'Procedure Initialization', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: -20 + } + ) + menuItemsInitialValues.push( + { + action: 'Delete Calculations Procedure', + askConfirmation: true, + confirmationLabel: 'Confirm to Delete', + actionFunction: payload.onMenuItemClick, + label: 'Delete Procedure', + visible: true, + iconPathOn: 'delete', + iconPathOff: 'delete', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: 20 + } + ) + menuItemsInitialValues.push( + { + action: 'Share', + actionFunction: payload.onMenuItemClick, + label: 'Share', + visible: true, + iconPathOn: 'menu-share', + iconPathOff: 'menu-share', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: 60 + } + ) + break + } + case 'Data Building Procedure': { + addLeftIcons(menuItemsInitialValues, floatingObject) + menuItemsInitialValues.push( + { + action: 'Add Procedure Initialization', + actionFunction: payload.onMenuItemClick, + label: 'Add Procedure Initialization', + visible: true, + relatedUiObject: 'Procedure Initialization', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: -60 + } + ) + menuItemsInitialValues.push( + { + action: 'Add Procedure Initialization', + actionFunction: payload.onMenuItemClick, + label: 'Add Procedure Initialization', + visible: true, + relatedUiObject: 'Procedure Initialization', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: -20 + } + ) + menuItemsInitialValues.push( + { + action: 'Delete Data Building Procedure', + askConfirmation: true, + confirmationLabel: 'Confirm to Delete', + actionFunction: payload.onMenuItemClick, + label: 'Delete Procedure', + visible: true, + iconPathOn: 'delete', + iconPathOff: 'delete', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: 20 + } + ) + menuItemsInitialValues.push( + { + action: 'Share', + actionFunction: payload.onMenuItemClick, + label: 'Share', + visible: true, + iconPathOn: 'menu-share', + iconPathOff: 'menu-share', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: 60 + } + ) + break + } + case 'Procedure Initialization': { + addLeftIcons(menuItemsInitialValues, floatingObject) + menuItemsInitialValues.push( + { + action: 'Add Code', + actionFunction: payload.onMenuItemClick, + label: 'Add Code', + visible: true, + relatedUiObject: 'Code', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: -40 + } + ) + menuItemsInitialValues.push( + { + action: 'Delete Procedure Initialization', + askConfirmation: true, + confirmationLabel: 'Confirm to Delete', + actionFunction: payload.onMenuItemClick, + label: 'Delete Initialization', + visible: true, + iconPathOn: 'delete', + iconPathOff: 'delete', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: 0 + } + ) + menuItemsInitialValues.push( + { + action: 'Share', + actionFunction: payload.onMenuItemClick, + label: 'Share', + visible: true, + iconPathOn: 'menu-share', + iconPathOff: 'menu-share', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: 40 + } + ) + break + } + case 'Procedure Loop': { + addLeftIcons(menuItemsInitialValues, floatingObject) + menuItemsInitialValues.push( + { + action: 'Add Code', + actionFunction: payload.onMenuItemClick, + label: 'Add Code', + visible: true, + relatedUiObject: 'Code', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: -40 + } + ) + menuItemsInitialValues.push( + { + action: 'Delete Procedure Loop', + askConfirmation: true, + confirmationLabel: 'Confirm to Delete', + actionFunction: payload.onMenuItemClick, + label: 'Delete Procedure Loop', + visible: true, + iconPathOn: 'delete', + iconPathOff: 'delete', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: 0 + } + ) + menuItemsInitialValues.push( + { + action: 'Share', + actionFunction: payload.onMenuItemClick, + label: 'Share', + visible: true, + iconPathOn: 'menu-share', + iconPathOff: 'menu-share', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: 40 + } + ) + break + } + case 'Output Dataset': { + addLeftIcons(menuItemsInitialValues, floatingObject) + menuItemsInitialValues.push( + { + action: 'Delete Output Dataset', + askConfirmation: true, + confirmationLabel: 'Confirm to Delete', + actionFunction: payload.onMenuItemClick, + label: 'Delete Output Dataset', + visible: true, + iconPathOn: 'delete', + iconPathOff: 'delete', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: -20 + } + ) + menuItemsInitialValues.push( + { + action: 'Share', + actionFunction: payload.onMenuItemClick, + label: 'Share', + visible: true, + iconPathOn: 'menu-share', + iconPathOff: 'menu-share', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: 20 + } + ) + break + } + case 'Status Dependency': { + addLeftIcons(menuItemsInitialValues, floatingObject) + menuItemsInitialValues.push( + { + action: 'Delete Status Dependency', + askConfirmation: true, + confirmationLabel: 'Confirm to Delete', + actionFunction: payload.onMenuItemClick, + label: 'Delete Status Dependency', + visible: true, + iconPathOn: 'delete', + iconPathOff: 'delete', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: -20 + } + ) + menuItemsInitialValues.push( + { + action: 'Share', + actionFunction: payload.onMenuItemClick, + label: 'Share', + visible: true, + iconPathOn: 'menu-share', + iconPathOff: 'menu-share', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: 20 + } + ) + break + } + case 'Data Dependency': { + addLeftIcons(menuItemsInitialValues, floatingObject) + menuItemsInitialValues.push( + { + action: 'Delete Data Dependency', + askConfirmation: true, + confirmationLabel: 'Confirm to Delete', + actionFunction: payload.onMenuItemClick, + label: 'Delete Data Dependency', + visible: true, + iconPathOn: 'delete', + iconPathOff: 'delete', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: -20 + } + ) + menuItemsInitialValues.push( + { + action: 'Share', + actionFunction: payload.onMenuItemClick, + label: 'Share', + visible: true, + iconPathOn: 'menu-share', + iconPathOff: 'menu-share', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: 20 + } + ) + break + } + case 'Data Product Definition': { + addLeftIcons(menuItemsInitialValues, floatingObject) + menuItemsInitialValues.push( + { + action: 'Add Record Definition', + actionFunction: payload.onMenuItemClick, + label: 'Add Record Definition', + visible: true, + relatedUiObject: 'Record Definition', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: -60 + } + ) + menuItemsInitialValues.push( + { + action: 'Add Dataset Definition', + actionFunction: payload.onMenuItemClick, + label: 'Add Dataset Definition', + visible: true, + relatedUiObject: 'Dataset Definition', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: -20 + } + ) + menuItemsInitialValues.push( + { + action: 'Delete Product Definition', + askConfirmation: true, + confirmationLabel: 'Confirm to Delete', + actionFunction: payload.onMenuItemClick, + label: 'Delete Product Definition', + visible: true, + iconPathOn: 'delete', + iconPathOff: 'delete', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: 20 + } + ) + menuItemsInitialValues.push( + { + action: 'Share', + actionFunction: payload.onMenuItemClick, + label: 'Share', + visible: true, + iconPathOn: 'menu-share', + iconPathOff: 'menu-share', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: 60 + } + ) + break + } + case 'Record Definition': { + addLeftIcons(menuItemsInitialValues, floatingObject) + menuItemsInitialValues.push( + { + action: 'Add Record Property', + actionFunction: payload.onMenuItemClick, + label: 'Add Record Property', + visible: true, + relatedUiObject: 'Record Property', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: -40 + } + ) + menuItemsInitialValues.push( + { + action: 'Delete Record Definition', + askConfirmation: true, + confirmationLabel: 'Confirm to Delete', + actionFunction: payload.onMenuItemClick, + label: 'Delete Record Definition', + visible: true, + iconPathOn: 'delete', + iconPathOff: 'delete', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: 0 + } + ) + menuItemsInitialValues.push( + { + action: 'Share', + actionFunction: payload.onMenuItemClick, + label: 'Share', + visible: true, + iconPathOn: 'menu-share', + iconPathOff: 'menu-share', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: 40 + } + ) + break + } + case 'Record Property': { + addLeftIcons(menuItemsInitialValues, floatingObject) + menuItemsInitialValues.push( + { + action: 'Add Formula', + actionFunction: payload.onMenuItemClick, + label: 'Add Formula', + visible: true, + relatedUiObject: 'Formula', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: -40 + } + ) + menuItemsInitialValues.push( + { + action: 'Delete Record Property', + askConfirmation: true, + confirmationLabel: 'Confirm to Delete', + actionFunction: payload.onMenuItemClick, + label: 'Delete Record Property', + visible: true, + iconPathOn: 'delete', + iconPathOff: 'delete', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: 0 + } + ) + menuItemsInitialValues.push( + { + action: 'Share', + actionFunction: payload.onMenuItemClick, + label: 'Share', + visible: true, + iconPathOn: 'menu-share', + iconPathOff: 'menu-share', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: 40 + } + ) + break + } + case 'Dataset Definition': { + uiObject.codeEditor = newCodeEditor() + uiObject.codeEditor.isVisibleFunction = uiObject.isVisibleFunction + uiObject.codeEditor.initialize() + uiObject.codeEditor.container.connectToParent(uiObject.container, false, false, true, true, false, false, false, false) + addLeftIcons(menuItemsInitialValues, floatingObject) + menuItemsInitialValues.push( + { + action: 'Delete Dataset Definition', + askConfirmation: true, + confirmationLabel: 'Confirm to Delete', + actionFunction: payload.onMenuItemClick, + label: 'Delete Dataset', + visible: true, + iconPathOn: 'delete', + iconPathOff: 'delete', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: -20 + } + ) + menuItemsInitialValues.push( + { + action: 'Share', + actionFunction: payload.onMenuItemClick, + label: 'Share', + visible: true, + iconPathOn: 'menu-share', + iconPathOff: 'menu-share', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: 20 + } + ) + break + } + case 'Plotter': { + addLeftIcons(menuItemsInitialValues, floatingObject) + menuItemsInitialValues.push( + { + action: 'Add Plotter Module', + actionFunction: payload.onMenuItemClick, + label: 'Add Plotter Module', + visible: true, + relatedUiObject: 'Plotter Module', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: -40 + } + ) + menuItemsInitialValues.push( + { + action: 'Delete Plotter', + askConfirmation: true, + confirmationLabel: 'Confirm to Delete', + actionFunction: payload.onMenuItemClick, + label: 'Delete Plotter', + visible: true, + iconPathOn: 'delete', + iconPathOff: 'delete', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: 0 + } + ) + menuItemsInitialValues.push( + { + action: 'Share', + actionFunction: payload.onMenuItemClick, + label: 'Share', + visible: true, + iconPathOn: 'menu-share', + iconPathOff: 'menu-share', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: 40 + } + ) + break + } + case 'Plotter Module': { + addLeftIcons(menuItemsInitialValues, floatingObject) + menuItemsInitialValues.push( + { + action: 'Add Code', + actionFunction: payload.onMenuItemClick, + label: 'Add Code', + visible: true, + relatedUiObject: 'Code', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: -60 + } + ) + menuItemsInitialValues.push( + { + action: 'Add Plotter Panel', + actionFunction: payload.onMenuItemClick, + label: 'Add Plotter Panel', + visible: true, + relatedUiObject: 'Plotter Panel', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: -20 + } + ) + menuItemsInitialValues.push( + { + action: 'Delete Plotter Module', + askConfirmation: true, + confirmationLabel: 'Confirm to Delete', + actionFunction: payload.onMenuItemClick, + label: 'Delete Plotter Module', + visible: true, + iconPathOn: 'delete', + iconPathOff: 'delete', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: 20 + } + ) + menuItemsInitialValues.push( + { + action: 'Share', + actionFunction: payload.onMenuItemClick, + label: 'Share', + visible: true, + iconPathOn: 'menu-share', + iconPathOff: 'menu-share', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: 60 + } + ) + break + } + case 'Plotter Panel': { + addLeftIcons(menuItemsInitialValues, floatingObject) + menuItemsInitialValues.push( + { + action: 'Add Plotter Module', + actionFunction: payload.onMenuItemClick, + label: 'Add Plotter Module', + visible: true, + relatedUiObject: 'Plotter Module', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: -40 + } + ) + menuItemsInitialValues.push( + { + action: 'Delete Plotter Panel', + askConfirmation: true, + confirmationLabel: 'Confirm to Delete', + actionFunction: payload.onMenuItemClick, + label: 'Delete Plotter Panel', + visible: true, + iconPathOn: 'delete', + iconPathOff: 'delete', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: 0 + } + ) + menuItemsInitialValues.push( + { + action: 'Share', + actionFunction: payload.onMenuItemClick, + label: 'Share', + visible: true, + iconPathOn: 'menu-share', + iconPathOff: 'menu-share', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: 40 + } + ) + break + } case 'Network': { addLeftIcons(menuItemsInitialValues, floatingObject) menuItemsInitialValues.push( @@ -3196,6 +4234,82 @@ function newUiObjectConstructor () { level_0() break } + case 'Team': { + level_0() + break + } + case 'Sensor Bot': { + level_1() + break + } + case 'Indicator Bot': { + level_1() + break + } + case 'Trading Bot': { + level_1() + break + } + case 'Process Definition': { + level_2() + break + } + case 'Calculations Procedure': { + level_3() + break + } + case 'Data Building Procedure': { + level_3() + break + } + case 'Procedure Initialization': { + level_4() + break + } + case 'Procedure Loop': { + level_4() + break + } + case 'Output Dataset': { + level_3() + break + } + case 'Status Dependency': { + level_3() + break + } + case 'Data Dependency': { + level_3() + break + } + case 'Product Definition': { + level_2() + break + } + case 'Record Definition': { + level_3() + break + } + case 'Record Property': { + level_4() + break + } + case 'Dataset Definition': { + level_3() + break + } + case 'Plotter': { + level_1() + break + } + case 'Plotter Module': { + level_2() + break + } + case 'Plotter Panel': { + level_3() + break + } case 'Network': { level_1() break diff --git a/Spaces/DesignerSpace.js b/Spaces/DesignerSpace.js index 70c34a8c4..22a0ef246 100644 --- a/Spaces/DesignerSpace.js +++ b/Spaces/DesignerSpace.js @@ -197,7 +197,7 @@ function newDesignerSpace () { 'session-forward-testing', 'network', 'network-node', - 'trading-engine', + 'bot-trading', 'layer-manager', 'process', 'bot-indicator', From d660207ff718c8abdfa79cc2b5ef19392aa018d6 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 30 Oct 2019 16:51:36 +0100 Subject: [PATCH 43/95] UiObject for Team Structure --- FloatingSpace/UiObject.js | 77 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) diff --git a/FloatingSpace/UiObject.js b/FloatingSpace/UiObject.js index 527329946..9d9b9fcf6 100644 --- a/FloatingSpace/UiObject.js +++ b/FloatingSpace/UiObject.js @@ -212,6 +212,78 @@ function newUiObject () { let compatibleType let compatibleSubType switch (thisObject.payload.node.type) { + case 'Sensor Bot': + compatibleType = '->' + 'Team' + '->' + compatibleSubType = undefined + break + case 'Indicator Bot': + compatibleType = '->' + 'Team' + '->' + compatibleSubType = undefined + break + case 'Trading Bot': + compatibleType = '->' + 'Team' + '->' + compatibleSubType = undefined + break + case 'Process Definition': + compatibleType = '->' + 'Sensor Bot' + '->' + 'Indicator Bot' + '->' + 'Trading Bot' + '->' + compatibleSubType = undefined + break + case 'Calculations Procedure': + compatibleType = '->' + 'Process Definition' + '->' + compatibleSubType = undefined + break + case 'Data Building Procedure': + compatibleType = '->' + 'Process Definition' + '->' + compatibleSubType = undefined + break + case 'Procedure Initialization': + compatibleType = '->' + 'Calculations Procedure' + '->' + 'Data Building Procedure' + '->' + compatibleSubType = undefined + break + case 'Procedure Loop': + compatibleType = '->' + 'Calculations Procedure' + '->' + 'Data Building Procedure' + '->' + compatibleSubType = undefined + break + case 'Output Dataset': + compatibleType = '->' + 'Process Definition' + '->' + compatibleSubType = undefined + break + case 'Status Dependency': + compatibleType = '->' + 'Process Definition' + '->' + compatibleSubType = undefined + break + case 'Data Dependency': + compatibleType = '->' + 'Process Definition' + '->' + compatibleSubType = undefined + break + case 'Product Definition': + compatibleType = '->' + 'Sensor Bot' + '->' + 'Indicator Bot' + '->' + 'Trading Bot' + '->' + compatibleSubType = undefined + break + case 'Record Definition': + compatibleType = '->' + 'Product Definition' + '->' + compatibleSubType = undefined + break + case 'Record Property': + compatibleType = '->' + 'Record Definition' + '->' + compatibleSubType = undefined + break + case 'Dataset Definition': + compatibleType = '->' + 'Product Definition' + '->' + compatibleSubType = undefined + break + case 'Plotter': + compatibleType = '->' + 'Team' + '->' + compatibleSubType = undefined + break + case 'Plotter Module': + compatibleType = '->' + 'Plotter' + '->' + compatibleSubType = undefined + break + case 'Plotter Panel': + compatibleType = '->' + 'Plotter Module' + '->' + compatibleSubType = undefined + break case 'Trading System': compatibleType = '->' + 'Definition' + '->' compatibleSubType = undefined @@ -431,6 +503,11 @@ function newUiObject () { let nearbyNode = floatingObject.payload.node if (compatibleType.indexOf('->' + nearbyNode.type + '->') >= 0) { /* Discard objects with busy coonection ports */ + if (thisObject.payload.node.type === 'Calculations Procedure' && nearbyNode.calculations !== undefined) { continue } + if (thisObject.payload.node.type === 'Data Building Procedure' && nearbyNode.dataBuilding !== undefined) { continue } + if (thisObject.payload.node.type === 'Procedure Initialization' && nearbyNode.initialization !== undefined) { continue } + if (thisObject.payload.node.type === 'Procedure Loop' && nearbyNode.loop !== undefined) { continue } + if (thisObject.payload.node.type === 'Record Definition' && nearbyNode.record !== undefined) { continue } if (thisObject.payload.node.type === 'Task' && nearbyNode.task !== undefined) { continue } if (thisObject.payload.node.type === 'Sensor Bot Instance' && nearbyNode.bot !== undefined) { continue } if (thisObject.payload.node.type === 'Indicator Bot Instance' && nearbyNode.bot !== undefined) { continue } From 82c07a9f1d3df1093a96d240132549ae62bc540f Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 30 Oct 2019 16:54:06 +0100 Subject: [PATCH 44/95] Missing Icons --- Spaces/DesignerSpace.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Spaces/DesignerSpace.js b/Spaces/DesignerSpace.js index 22a0ef246..cef5c3f58 100644 --- a/Spaces/DesignerSpace.js +++ b/Spaces/DesignerSpace.js @@ -105,10 +105,10 @@ function newDesignerSpace () { ['Product Definition', 'product-definition'], ['Record Definition', 'record-definition'], ['Record Property', 'record-property'], - ['Dataset Definition', 'pyramid'], + ['Dataset Definition', 'dataset-definition'], ['Plotter', 'plotter'], ['Plotter Module', 'plotter-module'], - ['Plotter Panel', 'pyramid'] + ['Plotter Panel', 'plotter-panel'] ] for (let i = 0; i < relationshipArray.length; i++) { @@ -216,7 +216,9 @@ function newDesignerSpace () { 'status-dependency', 'record-property', 'record-definition', - 'plotter' + 'plotter', + 'plotter-panel', + 'dataset-definition' ] for (let i = 0; i < iconsNames.length; i++) { From c04f2abcd0ef77b0a6b674a277de6f7da0e2404c Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 30 Oct 2019 16:58:50 +0100 Subject: [PATCH 45/95] titles fixed --- FloatingSpace/UiObjectTitle.js | 116 +-------------------------------- 1 file changed, 1 insertion(+), 115 deletions(-) diff --git a/FloatingSpace/UiObjectTitle.js b/FloatingSpace/UiObjectTitle.js index e6d1dca6f..f840cad40 100644 --- a/FloatingSpace/UiObjectTitle.js +++ b/FloatingSpace/UiObjectTitle.js @@ -56,32 +56,14 @@ function newUiObjectTitle () { thisObject.allwaysVisible = true break } - case 'Network Node': { - break - } - case 'Social Bots': { - break - } - case 'Telegram Bot': { - break - } case 'Announcement': { thisObject.allwaysVisible = true break } - case 'Layer Manager': { - break - } case 'Layer': { thisObject.allwaysVisible = true break } - case 'Task Manager': { - break - } - case 'Task': { - break - } case 'Sensor Bot Instance': { thisObject.allwaysVisible = true break @@ -90,12 +72,6 @@ function newUiObjectTitle () { thisObject.allwaysVisible = true break } - case 'Trading Bot Instance': { - break - } - case 'Process Instance': { - break - } case 'Backtesting Session': { thisObject.allwaysVisible = true break @@ -112,18 +88,6 @@ function newUiObjectTitle () { thisObject.allwaysVisible = true break } - case 'Personal Data': { - break - } - case 'Exchange Account': { - break - } - case 'Exchange Account Asset': { - break - } - case 'Exchange Account Key': { - break - } case 'Workspace': { thisObject.allwaysVisible = true break @@ -132,90 +96,12 @@ function newUiObjectTitle () { thisObject.allwaysVisible = true break } - case 'Parameters': { - break - } - case 'Base Asset': { - break - } - case 'Time Range': { - break - } - case 'Time Period': { - break - } - case 'Slippage': { - break - } - case 'Fee Structure': { - break - } case 'Strategy': { thisObject.allwaysVisible = true break } - case 'Trigger Stage': { - break - } - case 'Open Stage': { - break - } - case 'Manage Stage': { - break - } - case 'Close Stage': { - break - } - case 'Position Size': { - break - } - case 'Position Rate': { - break - } - case 'Trigger On Event': { - break - } - case 'Trigger Off Event': { - break - } - case 'Take Position Event': { - break - } - case 'Initial Definition': { - break - } - case 'Open Execution': { - break - } - case 'Close Execution': { - break - } - case 'Stop': { - break - } - case 'Take Profit': { - break - } - case 'Phase': { - break - } - case 'Formula': { - break - } - case 'Next Phase Event': { - break - } - case 'Situation': { - break - } - case 'Condition': { - break - } - case 'Code': { - break - } default: { - if (ERROR_LOG === true) { logger.write('[ERROR] initialize -> UI Object Type not Recognized -> type = ' + payload.node.type) } + thisObject.allwaysVisible = false } } From d5a0681f3808b67d45263cb03a1b727348145c57 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 30 Oct 2019 17:16:54 +0100 Subject: [PATCH 46/95] Workspace upgraded to Teams Structure --- DesignerSpace/Workspace/Workspace.js | 171 +++++++++++++++++++++++++++ 1 file changed, 171 insertions(+) diff --git a/DesignerSpace/Workspace/Workspace.js b/DesignerSpace/Workspace/Workspace.js index a76beef28..3fdda94aa 100644 --- a/DesignerSpace/Workspace/Workspace.js +++ b/DesignerSpace/Workspace/Workspace.js @@ -316,6 +316,101 @@ function newWorkspace () { functionLibraryUiObjectsFromNodes.addDefinition(payload.node) } break + case 'Add Team': + { + functionLibraryUiObjectsFromNodes.addTeam(payload.node) + } + break + case 'Add Sensor Bot': + { + functionLibraryUiObjectsFromNodes.addSensorBot(payload.node) + } + break + case 'Add Indicator Bot': + { + functionLibraryUiObjectsFromNodes.addIndicatorBot(payload.node) + } + break + case 'Add Trading Bot': + { + functionLibraryUiObjectsFromNodes.addTradingBot(payload.node) + } + break + case 'Add Process Definition': + { + functionLibraryUiObjectsFromNodes.addProcessDefinition(payload.node) + } + break + case 'Add Calculations Procedure': + { + functionLibraryUiObjectsFromNodes.addCalculationsProcedure(payload.node) + } + break + case 'Add Data Building Procedure': + { + functionLibraryUiObjectsFromNodes.addDataBuildingProcedure(payload.node) + } + break + case 'Add Procedure Initialization': + { + functionLibraryUiObjectsFromNodes.addProcedureInitialization(payload.node) + } + break + case 'Add Procedure Loop': + { + functionLibraryUiObjectsFromNodes.addProcedureLoop(payload.node) + } + break + case 'Add Output Dataset': + { + functionLibraryUiObjectsFromNodes.addOutputDataset(payload.node) + } + break + case 'Add Status Dependency': + { + functionLibraryUiObjectsFromNodes.addStatusDependency(payload.node) + } + break + case 'Add Data Dependency': + { + functionLibraryUiObjectsFromNodes.addDataDependency(payload.node) + } + break + case 'Add Product Definition': + { + functionLibraryUiObjectsFromNodes.addProductDefinition(payload.node) + } + break + case 'Add Record Definition': + { + functionLibraryUiObjectsFromNodes.addRecordDefinition(payload.node) + } + break + case 'Add Record Property': + { + functionLibraryUiObjectsFromNodes.addRecordProperty(payload.node) + } + break + case 'Add Dataset Definition': + { + functionLibraryUiObjectsFromNodes.addDatasetDefinition(payload.node) + } + break + case 'Add Plotter': + { + functionLibraryUiObjectsFromNodes.addPlotter(payload.node) + } + break + case 'Add Plotter Module': + { + functionLibraryUiObjectsFromNodes.addPlotterModule(payload.node) + } + break + case 'Add Plotter Panel': + { + functionLibraryUiObjectsFromNodes.addPlotterPanel(payload.node) + } + break case 'Add Network': { functionLibraryUiObjectsFromNodes.addNetwork(payload.node) @@ -501,6 +596,82 @@ function newWorkspace () { functionLibraryUiObjectsFromNodes.addPersonalData(payload.node) } break + case 'Delete Team': { + functionLibraryNodeDeleter.deleteTeam(payload.node, thisObject.workspaceNode.rootNodes) + break + } + case 'Delete Sensor Bot': { + functionLibraryNodeDeleter.deleteSensorBot(payload.node, thisObject.workspaceNode.rootNodes) + break + } + case 'Delete Indicator Bot': { + functionLibraryNodeDeleter.deleteIndicatorBot(payload.node, thisObject.workspaceNode.rootNodes) + break + } + case 'Delete Trading Bot': { + functionLibraryNodeDeleter.deleteTradingBot(payload.node, thisObject.workspaceNode.rootNodes) + break + } + case 'Delete Process Definition': { + functionLibraryNodeDeleter.deleteProcessDefinition(payload.node, thisObject.workspaceNode.rootNodes) + break + } + case 'Delete Calculations Procedure': { + functionLibraryNodeDeleter.deleteCalculationsProcedure(payload.node, thisObject.workspaceNode.rootNodes) + break + } + case 'Delete Data Building Procedure': { + functionLibraryNodeDeleter.deleteDataBuildingProcedure(payload.node, thisObject.workspaceNode.rootNodes) + break + } + case 'Delete Procedure Initialization': { + functionLibraryNodeDeleter.deleteProcedureInitialization(payload.node, thisObject.workspaceNode.rootNodes) + break + } + case 'Delete Procedure Loop': { + functionLibraryNodeDeleter.deleteProcedureLoop(payload.node, thisObject.workspaceNode.rootNodes) + break + } + case 'Delete Output Dataset': { + functionLibraryNodeDeleter.deleteOutputDataset(payload.node, thisObject.workspaceNode.rootNodes) + break + } + case 'Delete Status Dependency': { + functionLibraryNodeDeleter.deleteStatusDependency(payload.node, thisObject.workspaceNode.rootNodes) + break + } + case 'Delete Data Dependency': { + functionLibraryNodeDeleter.deleteDataDependency(payload.node, thisObject.workspaceNode.rootNodes) + break + } + case 'Delete Product Definition': { + functionLibraryNodeDeleter.deleteProductDefinition(payload.node, thisObject.workspaceNode.rootNodes) + break + } + case 'Delete Record Definition': { + functionLibraryNodeDeleter.deleteRecordDefinition(payload.node, thisObject.workspaceNode.rootNodes) + break + } + case 'Delete Record Property': { + functionLibraryNodeDeleter.deleteRecordProperty(payload.node, thisObject.workspaceNode.rootNodes) + break + } + case 'Delete Dataset Definition': { + functionLibraryNodeDeleter.deleteDatasetDefinition(payload.node, thisObject.workspaceNode.rootNodes) + break + } + case 'Delete Plotter': { + functionLibraryNodeDeleter.deletePlotter(payload.node, thisObject.workspaceNode.rootNodes) + break + } + case 'Delete Plotter Module': { + functionLibraryNodeDeleter.deletePlotterModule(payload.node, thisObject.workspaceNode.rootNodes) + break + } + case 'Delete Plotter Panel': { + functionLibraryNodeDeleter.deletePlotterPanel(payload.node, thisObject.workspaceNode.rootNodes) + break + } case 'Delete Network': { functionLibraryNodeDeleter.deleteNetwork(payload.node, thisObject.workspaceNode.rootNodes) break From 714d658ed19bdaa9177fe456d52e60abb2c12612 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 30 Oct 2019 17:26:39 +0100 Subject: [PATCH 47/95] Bug Fixed creating Team --- .../Workspace/FunctionLibraries/UiObjectsFromNodes.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js index e8756ed12..aecdcd2ce 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js +++ b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js @@ -871,14 +871,14 @@ function newUiObjectsFromNodes () { function addTeam (node) { let team = { name: 'New Team', + type: 'Team', sensorBots: [], indicatorBots: [], tradingBots: [], plotters: [] } node.rootNodes.push(team) - createUiObject(node.type, network.name, network, node, undefined) - + createUiObject(team.type, team.name, team, undefined, undefined) return team } From 8aecab584a29afc869f5e569ed6d590a20a7b7da Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 30 Oct 2019 17:29:51 +0100 Subject: [PATCH 48/95] Structure Root --- FloatingSpace/UiObject.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FloatingSpace/UiObject.js b/FloatingSpace/UiObject.js index 9d9b9fcf6..b4688b5cb 100644 --- a/FloatingSpace/UiObject.js +++ b/FloatingSpace/UiObject.js @@ -1297,7 +1297,7 @@ function newUiObject () { browserCanvasContext.fill() - if (thisObject.payload.node.type === 'Definition' || thisObject.payload.node.type === 'Network') { + if (thisObject.payload.node.type === 'Definition' || thisObject.payload.node.type === 'Network' || thisObject.payload.node.type === 'Team') { VISIBLE_RADIUS = thisObject.container.frame.radius * 2 let OPACITY = 1 From b1d0f6bbef65e75d1c422cc23a1fec2ffc05d341 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 30 Oct 2019 17:36:24 +0100 Subject: [PATCH 49/95] Angles adjusted --- FloatingSpace/UiObjectConstructor.js | 32 ++++++++++++++-------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/FloatingSpace/UiObjectConstructor.js b/FloatingSpace/UiObjectConstructor.js index c209e637d..b1e18f712 100644 --- a/FloatingSpace/UiObjectConstructor.js +++ b/FloatingSpace/UiObjectConstructor.js @@ -316,7 +316,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: -70 + angle: -60 } ) menuItemsInitialValues.push( @@ -385,7 +385,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: 70 + angle: 60 } ) break @@ -402,7 +402,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: -60 + angle: -30 } ) menuItemsInitialValues.push( @@ -415,7 +415,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: -20 + angle: -10 } ) menuItemsInitialValues.push( @@ -431,7 +431,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: 20 + angle: 10 } ) menuItemsInitialValues.push( @@ -445,7 +445,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: 60 + angle: 30 } ) break @@ -462,7 +462,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: -60 + angle: -30 } ) menuItemsInitialValues.push( @@ -475,7 +475,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: -20 + angle: -10 } ) menuItemsInitialValues.push( @@ -491,7 +491,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: 20 + angle: 10 } ) menuItemsInitialValues.push( @@ -505,7 +505,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: 60 + angle: 30 } ) break @@ -522,7 +522,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: -60 + angle: -30 } ) menuItemsInitialValues.push( @@ -535,7 +535,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: -20 + angle: -10 } ) menuItemsInitialValues.push( @@ -551,7 +551,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: 20 + angle: 10 } ) menuItemsInitialValues.push( @@ -565,7 +565,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: 60 + angle: 30 } ) break @@ -1189,7 +1189,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: -40 + angle: -20 } ) menuItemsInitialValues.push( @@ -1219,7 +1219,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: 40 + angle: 20 } ) break From a30f1d34ce98560929c61cc085bf23124bfa8e6c Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 31 Oct 2019 08:26:47 +0100 Subject: [PATCH 50/95] Bug Fixed, deleting functions not good --- .../FunctionLibraries/ChainAttachDetach.js | 6 +- .../FunctionLibraries/NodeDeleter.js | 56 +++++++++---------- 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/DesignerSpace/Workspace/FunctionLibraries/ChainAttachDetach.js b/DesignerSpace/Workspace/FunctionLibraries/ChainAttachDetach.js index 9f1103dc0..d38012d90 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/ChainAttachDetach.js +++ b/DesignerSpace/Workspace/FunctionLibraries/ChainAttachDetach.js @@ -532,21 +532,21 @@ function newChainAttachDetach () { case 'Sensor Bot': { node.payload.parentNode = attachToNode node.payload.chainParent = attachToNode - node.payload.parentNode.networkNodes.push(node) + node.payload.parentNode.sensorBots.push(node) completeAttachment(node, rootNodes) } break case 'Indicator Bot': { node.payload.parentNode = attachToNode node.payload.chainParent = attachToNode - node.payload.parentNode.networkNodes.push(node) + node.payload.parentNode.indicatorBots.push(node) completeAttachment(node, rootNodes) } break case 'Trading Bot': { node.payload.parentNode = attachToNode node.payload.chainParent = attachToNode - node.payload.parentNode.networkNodes.push(node) + node.payload.parentNode.tradingBots.push(node) completeAttachment(node, rootNodes) } break diff --git a/DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js b/DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js index 768bc42cd..d4ca33fa6 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js +++ b/DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js @@ -425,25 +425,25 @@ function newNodeDeleter () { if (node.sensorBots !== undefined) { while (node.sensorBots.length > 0) { - deleteNetworkNode(node.sensorBots[0], rootNodes) + deleteSensorBot(node.sensorBots[0], rootNodes) } } if (node.indicatorBots !== undefined) { while (node.indicatorBots.length > 0) { - deleteNetworkNode(node.indicatorBots[0], rootNodes) + deleteIndicatorBot(node.indicatorBots[0], rootNodes) } } if (node.tradingBots !== undefined) { while (node.tradingBots.length > 0) { - deleteNetworkNode(node.tradingBots[0], rootNodes) + deleteTradingBot(node.tradingBots[0], rootNodes) } } if (node.plotters !== undefined) { while (node.plotters.length > 0) { - deleteNetworkNode(node.plotters[0], rootNodes) + deletePlotter(node.plotters[0], rootNodes) } } @@ -466,13 +466,13 @@ function newNodeDeleter () { if (node.processes !== undefined) { while (node.processes.length > 0) { - deleteNetworkNode(node.processes[0], rootNodes) + deleteProcessDefinition(node.processes[0], rootNodes) } } if (node.products !== undefined) { while (node.products.length > 0) { - deleteNetworkNode(node.products[0], rootNodes) + deleteProductDefinition(node.products[0], rootNodes) } } @@ -495,13 +495,13 @@ function newNodeDeleter () { if (node.processes !== undefined) { while (node.processes.length > 0) { - deleteNetworkNode(node.processes[0], rootNodes) + deleteProcessDefinition(node.processes[0], rootNodes) } } if (node.products !== undefined) { while (node.products.length > 0) { - deleteNetworkNode(node.products[0], rootNodes) + deleteProductDefinition(node.products[0], rootNodes) } } @@ -524,13 +524,13 @@ function newNodeDeleter () { if (node.processes !== undefined) { while (node.processes.length > 0) { - deleteNetworkNode(node.processes[0], rootNodes) + deleteProcessDefinition(node.processes[0], rootNodes) } } if (node.products !== undefined) { while (node.products.length > 0) { - deleteNetworkNode(node.products[0], rootNodes) + deleteProductDefinition(node.products[0], rootNodes) } } @@ -552,28 +552,28 @@ function newNodeDeleter () { } if (node.calculations !== undefined) { - deleteParameters(node.calculations, rootNodes) + deleteCalculationsProcedure(node.calculations, rootNodes) } if (node.dataBuilding !== undefined) { - deleteParameters(node.dataBuilding, rootNodes) + deleteDataBuildingProcedure(node.dataBuilding, rootNodes) } if (node.outputDatasets !== undefined) { while (node.outputDatasets.length > 0) { - deleteNetworkNode(node.outputDatasets[0], rootNodes) + deleteOutputDataset(node.outputDatasets[0], rootNodes) } } if (node.statusDependencies !== undefined) { while (node.statusDependencies.length > 0) { - deleteNetworkNode(node.statusDependencies[0], rootNodes) + deleteStatusDependency(node.statusDependencies[0], rootNodes) } } if (node.dataDependencies !== undefined) { while (node.dataDependencies.length > 0) { - deleteNetworkNode(node.dataDependencies[0], rootNodes) + deleteDataDependency(node.dataDependencies[0], rootNodes) } } @@ -590,11 +590,11 @@ function newNodeDeleter () { } if (node.initialization !== undefined) { - deleteParameters(node.initialization, rootNodes) + deleteProcedureInitialization(node.initialization, rootNodes) } if (node.loop !== undefined) { - deleteParameters(node.loop, rootNodes) + deleteProcedureLoop(node.loop, rootNodes) } completeDeletion(node, rootNodes) @@ -610,11 +610,11 @@ function newNodeDeleter () { } if (node.initialization !== undefined) { - deleteParameters(node.initialization, rootNodes) + deleteProcedureInitialization(node.initialization, rootNodes) } if (node.loop !== undefined) { - deleteParameters(node.loop, rootNodes) + deleteProcedureLoop(node.loop, rootNodes) } completeDeletion(node, rootNodes) @@ -646,7 +646,7 @@ function newNodeDeleter () { } if (node.code !== undefined) { - deleteParameters(node.code, rootNodes) + deleteCode(node.code, rootNodes) } completeDeletion(node, rootNodes) @@ -718,12 +718,12 @@ function newNodeDeleter () { } if (node.record !== undefined) { - deleteParameters(node.record, rootNodes) + deleteRecordDefinition(node.record, rootNodes) } if (node.datasets !== undefined) { while (node.datasets.length > 0) { - deleteNetworkNode(node.datasets[0], rootNodes) + deleteDatasetDefinition(node.datasets[0], rootNodes) } } @@ -741,7 +741,7 @@ function newNodeDeleter () { if (node.properties !== undefined) { while (node.properties.length > 0) { - deleteNetworkNode(node.properties[0], rootNodes) + deleteRecordProperty(node.properties[0], rootNodes) } } @@ -763,7 +763,7 @@ function newNodeDeleter () { } if (node.formula !== undefined) { - deleteParameters(node.formula, rootNodes) + deleteFormula(node.formula, rootNodes) } completeDeletion(node, rootNodes) @@ -802,7 +802,7 @@ function newNodeDeleter () { if (node.modules !== undefined) { while (node.modules.length > 0) { - deleteNetworkNode(node.modules[0], rootNodes) + deletePlotterModule(node.modules[0], rootNodes) } } @@ -824,12 +824,12 @@ function newNodeDeleter () { } if (node.code !== undefined) { - deleteParameters(node.code, rootNodes) + deleteCode(node.code, rootNodes) } if (node.panels !== undefined) { while (node.panels.length > 0) { - deleteNetworkNode(node.panels[0], rootNodes) + deletePlotterPanel(node.panels[0], rootNodes) } } @@ -851,7 +851,7 @@ function newNodeDeleter () { } if (node.code !== undefined) { - deleteParameters(node.code, rootNodes) + deleteCode(node.code, rootNodes) } completeDeletion(node, rootNodes) From d5f21e50ec255b7de7b1ace32668bfb94341d5ee Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 31 Oct 2019 08:37:56 +0100 Subject: [PATCH 51/95] Bug Fixed, bad menues --- FloatingSpace/UiObjectConstructor.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/FloatingSpace/UiObjectConstructor.js b/FloatingSpace/UiObjectConstructor.js index b1e18f712..8acabf8d0 100644 --- a/FloatingSpace/UiObjectConstructor.js +++ b/FloatingSpace/UiObjectConstructor.js @@ -686,11 +686,11 @@ function newUiObjectConstructor () { ) menuItemsInitialValues.push( { - action: 'Add Procedure Initialization', + action: 'Add Procedure Loop', actionFunction: payload.onMenuItemClick, - label: 'Add Procedure Initialization', + label: 'Add Procedure Loop', visible: true, - relatedUiObject: 'Procedure Initialization', + relatedUiObject: 'Procedure Loop', rawRadius: 8, targetRadius: 0, currentRadius: 0, @@ -746,11 +746,11 @@ function newUiObjectConstructor () { ) menuItemsInitialValues.push( { - action: 'Add Procedure Initialization', + action: 'Add Procedure Loop', actionFunction: payload.onMenuItemClick, - label: 'Add Procedure Initialization', + label: 'Add Procedure Loop', visible: true, - relatedUiObject: 'Procedure Initialization', + relatedUiObject: 'Procedure Loop', rawRadius: 8, targetRadius: 0, currentRadius: 0, From bf43c4e937c2b7d1ebc6fbd3feb6c07b6acac930 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 31 Oct 2019 08:45:32 +0100 Subject: [PATCH 52/95] Bug Fixed, attaching formula and code --- FloatingSpace/UiObject.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/FloatingSpace/UiObject.js b/FloatingSpace/UiObject.js index b4688b5cb..ef0a1e954 100644 --- a/FloatingSpace/UiObject.js +++ b/FloatingSpace/UiObject.js @@ -470,7 +470,7 @@ function newUiObject () { compatibleSubType = undefined break case 'Formula': - compatibleType = '->' + 'Position Size' + '->' + 'Position Rate' + '->' + 'Phase' + '->' + 'Announcement' + '->' + compatibleType = '->' + 'Position Size' + '->' + 'Position Rate' + '->' + 'Phase' + '->' + 'Announcement' + '->' + 'Record Property' + '->' compatibleSubType = undefined break case 'Next Phase Event': @@ -486,7 +486,7 @@ function newUiObject () { compatibleSubType = undefined break case 'Code': - compatibleType = '->' + 'Condition' + '->' + compatibleType = '->' + 'Condition' + '->' + 'Procedure Initialization' + '->' + 'Procedure Loop' + '->' + 'Plotter Module' + '->' + 'Plotter Panel' + '->' compatibleSubType = undefined break default: From 83ba65862c561d2c5f1c526f95ef1ecb5c985513 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 31 Oct 2019 08:53:39 +0100 Subject: [PATCH 53/95] Bug Fixed Code on Plotter --- FloatingSpace/UiObjectConstructor.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/FloatingSpace/UiObjectConstructor.js b/FloatingSpace/UiObjectConstructor.js index 8acabf8d0..a5eb603f3 100644 --- a/FloatingSpace/UiObjectConstructor.js +++ b/FloatingSpace/UiObjectConstructor.js @@ -1288,11 +1288,11 @@ function newUiObjectConstructor () { addLeftIcons(menuItemsInitialValues, floatingObject) menuItemsInitialValues.push( { - action: 'Add Plotter Module', + action: 'Add Code', actionFunction: payload.onMenuItemClick, - label: 'Add Plotter Module', + label: 'Add Code', visible: true, - relatedUiObject: 'Plotter Module', + relatedUiObject: 'Code', rawRadius: 8, targetRadius: 0, currentRadius: 0, From 8c3f16aed3225b02223af6d479a32677c74b9467 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 31 Oct 2019 09:02:14 +0100 Subject: [PATCH 54/95] Title Visible --- FloatingSpace/UiObjectTitle.js | 36 ++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/FloatingSpace/UiObjectTitle.js b/FloatingSpace/UiObjectTitle.js index f840cad40..b51a68985 100644 --- a/FloatingSpace/UiObjectTitle.js +++ b/FloatingSpace/UiObjectTitle.js @@ -52,6 +52,42 @@ function newUiObjectTitle () { thisObject.allwaysVisible = true break } + case 'Team': { + thisObject.allwaysVisible = true + break + } + case 'Sensor Bot': { + thisObject.allwaysVisible = true + break + } + case 'Indicator Bot': { + thisObject.allwaysVisible = true + break + } + case 'Trading Bot': { + thisObject.allwaysVisible = true + break + } + case 'Process Definition': { + thisObject.allwaysVisible = true + break + } + case 'Product Definition': { + thisObject.allwaysVisible = true + break + } + case 'Plotter': { + thisObject.allwaysVisible = true + break + } + case 'Plotter Module': { + thisObject.allwaysVisible = true + break + } + case 'Plotter Panel': { + thisObject.allwaysVisible = true + break + } case 'Network': { thisObject.allwaysVisible = true break From 3fd56754ffa68ec3d75aecd2640a6eb0c6b7e10c Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 31 Oct 2019 09:07:25 +0100 Subject: [PATCH 55/95] Bug fixed in name --- FloatingSpace/UiObjectConstructor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FloatingSpace/UiObjectConstructor.js b/FloatingSpace/UiObjectConstructor.js index a5eb603f3..d04bd088a 100644 --- a/FloatingSpace/UiObjectConstructor.js +++ b/FloatingSpace/UiObjectConstructor.js @@ -985,7 +985,7 @@ function newUiObjectConstructor () { ) break } - case 'Data Product Definition': { + case 'Product Definition': { addLeftIcons(menuItemsInitialValues, floatingObject) menuItemsInitialValues.push( { From 0e81494ab4520e07b132698712795c674a12741a Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 31 Oct 2019 09:11:04 +0100 Subject: [PATCH 56/95] Edit menu missing --- .../Workspace/FunctionLibraries/OnFocus.js | 2 +- FloatingSpace/UiObjectConstructor.js | 19 +++++++++++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/DesignerSpace/Workspace/FunctionLibraries/OnFocus.js b/DesignerSpace/Workspace/FunctionLibraries/OnFocus.js index f1a22b94b..0a3c9db1b 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/OnFocus.js +++ b/DesignerSpace/Workspace/FunctionLibraries/OnFocus.js @@ -954,7 +954,7 @@ function newOnFocus () { case 'Record Definition': { let child for (let m = 0; m < node.properties.length; m++) { - child = getNodeThatIsOnFocus(node.yyy[m]) + child = getNodeThatIsOnFocus(node.properties[m]) if (child !== undefined) { return child } diff --git a/FloatingSpace/UiObjectConstructor.js b/FloatingSpace/UiObjectConstructor.js index d04bd088a..82e9794ba 100644 --- a/FloatingSpace/UiObjectConstructor.js +++ b/FloatingSpace/UiObjectConstructor.js @@ -1145,6 +1145,21 @@ function newUiObjectConstructor () { uiObject.codeEditor.initialize() uiObject.codeEditor.container.connectToParent(uiObject.container, false, false, true, true, false, false, false, false) addLeftIcons(menuItemsInitialValues, floatingObject) + menuItemsInitialValues.push( + { + action: 'Edit Definition', + actionFunction: uiObject.codeEditor.activate, + label: 'Edit Definition', + visible: true, + iconPathOn: 'html', + iconPathOff: 'html', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: -30, + dontShowAtFullscreen: true + } + ) menuItemsInitialValues.push( { action: 'Delete Dataset Definition', @@ -1158,7 +1173,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: -20 + angle: 0 } ) menuItemsInitialValues.push( @@ -1172,7 +1187,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: 20 + angle: 30 } ) break From ca023cbc4a5ffabba7c4d7b97cd738c1c3b113db Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 31 Oct 2019 09:19:07 +0100 Subject: [PATCH 57/95] Menu Angles adjusted --- FloatingSpace/UiObjectConstructor.js | 40 ++++++++++++++-------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/FloatingSpace/UiObjectConstructor.js b/FloatingSpace/UiObjectConstructor.js index 82e9794ba..0db7af0e2 100644 --- a/FloatingSpace/UiObjectConstructor.js +++ b/FloatingSpace/UiObjectConstructor.js @@ -681,7 +681,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: -60 + angle: -45 } ) menuItemsInitialValues.push( @@ -694,7 +694,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: -20 + angle: -15 } ) menuItemsInitialValues.push( @@ -710,7 +710,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: 20 + angle: 15 } ) menuItemsInitialValues.push( @@ -724,7 +724,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: 60 + angle: 45 } ) break @@ -741,7 +741,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: -60 + angle: -45 } ) menuItemsInitialValues.push( @@ -754,7 +754,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: -20 + angle: -15 } ) menuItemsInitialValues.push( @@ -770,7 +770,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: 20 + angle: 15 } ) menuItemsInitialValues.push( @@ -784,7 +784,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: 60 + angle: 45 } ) break @@ -997,7 +997,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: -60 + angle: -30 } ) menuItemsInitialValues.push( @@ -1010,7 +1010,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: -20 + angle: -10 } ) menuItemsInitialValues.push( @@ -1026,7 +1026,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: 20 + angle: 10 } ) menuItemsInitialValues.push( @@ -1040,7 +1040,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: 60 + angle: 30 } ) break @@ -1057,7 +1057,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: -40 + angle: -30 } ) menuItemsInitialValues.push( @@ -1087,7 +1087,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: 40 + angle: 30 } ) break @@ -1251,7 +1251,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: -60 + angle: -30 } ) menuItemsInitialValues.push( @@ -1264,7 +1264,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: -20 + angle: -10 } ) menuItemsInitialValues.push( @@ -1280,7 +1280,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: 20 + angle: 10 } ) menuItemsInitialValues.push( @@ -1294,7 +1294,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: 60 + angle: 30 } ) break @@ -1311,7 +1311,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: -40 + angle: -30 } ) menuItemsInitialValues.push( @@ -1341,7 +1341,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: 40 + angle: 30 } ) break From e7d02e2049f86f18904bb1327c772375ada006e5 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 31 Oct 2019 10:30:09 +0100 Subject: [PATCH 58/95] setting missing editors menues --- FloatingSpace/UiObjectConstructor.js | 87 +++++++++++++++++++++++----- 1 file changed, 72 insertions(+), 15 deletions(-) diff --git a/FloatingSpace/UiObjectConstructor.js b/FloatingSpace/UiObjectConstructor.js index 0db7af0e2..e0cdace0a 100644 --- a/FloatingSpace/UiObjectConstructor.js +++ b/FloatingSpace/UiObjectConstructor.js @@ -571,7 +571,26 @@ function newUiObjectConstructor () { break } case 'Process Definition': { + uiObject.codeEditor = newCodeEditor() + uiObject.codeEditor.isVisibleFunction = uiObject.isVisibleFunction + uiObject.codeEditor.initialize() + uiObject.codeEditor.container.connectToParent(uiObject.container, false, false, true, true, false, false, false, false) addLeftIcons(menuItemsInitialValues, floatingObject) + menuItemsInitialValues.push( + { + action: 'Edit Process', + actionFunction: uiObject.codeEditor.activate, + label: 'Edit Process', + visible: true, + iconPathOn: 'html', + iconPathOff: 'html', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: -80, + dontShowAtFullscreen: true + } + ) menuItemsInitialValues.push( { action: 'Add Calculations Procedure', @@ -582,7 +601,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: -75 + angle: -45 } ) menuItemsInitialValues.push( @@ -595,7 +614,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: -40 + angle: -25 } ) menuItemsInitialValues.push( @@ -608,7 +627,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: -20 + angle: -8 } ) menuItemsInitialValues.push( @@ -621,7 +640,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: 0 + angle: 8 } ) menuItemsInitialValues.push( @@ -634,7 +653,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: 20 + angle: 25 } ) menuItemsInitialValues.push( @@ -650,7 +669,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: 40 + angle: 45 } ) menuItemsInitialValues.push( @@ -664,7 +683,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: 75 + angle: 80 } ) break @@ -986,7 +1005,26 @@ function newUiObjectConstructor () { break } case 'Product Definition': { + uiObject.codeEditor = newCodeEditor() + uiObject.codeEditor.isVisibleFunction = uiObject.isVisibleFunction + uiObject.codeEditor.initialize() + uiObject.codeEditor.container.connectToParent(uiObject.container, false, false, true, true, false, false, false, false) addLeftIcons(menuItemsInitialValues, floatingObject) + menuItemsInitialValues.push( + { + action: 'Edit Product', + actionFunction: uiObject.codeEditor.activate, + label: 'Edit Product', + visible: true, + iconPathOn: 'html', + iconPathOff: 'html', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: -45, + dontShowAtFullscreen: true + } + ) menuItemsInitialValues.push( { action: 'Add Record Definition', @@ -997,7 +1035,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: -30 + angle: -20 } ) menuItemsInitialValues.push( @@ -1010,7 +1048,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: -10 + angle: 0 } ) menuItemsInitialValues.push( @@ -1026,7 +1064,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: 10 + angle: 20 } ) menuItemsInitialValues.push( @@ -1040,7 +1078,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: 30 + angle: 45 } ) break @@ -1093,7 +1131,26 @@ function newUiObjectConstructor () { break } case 'Record Property': { + uiObject.codeEditor = newCodeEditor() + uiObject.codeEditor.isVisibleFunction = uiObject.isVisibleFunction + uiObject.codeEditor.initialize() + uiObject.codeEditor.container.connectToParent(uiObject.container, false, false, true, true, false, false, false, false) addLeftIcons(menuItemsInitialValues, floatingObject) + menuItemsInitialValues.push( + { + action: 'Edit Property', + actionFunction: uiObject.codeEditor.activate, + label: 'Edit Property', + visible: true, + iconPathOn: 'html', + iconPathOff: 'html', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: -45, + dontShowAtFullscreen: true + } + ) menuItemsInitialValues.push( { action: 'Add Formula', @@ -1104,7 +1161,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: -40 + angle: -15 } ) menuItemsInitialValues.push( @@ -1120,7 +1177,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: 0 + angle: 15 } ) menuItemsInitialValues.push( @@ -1134,7 +1191,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: 40 + angle: 45 } ) break @@ -4266,7 +4323,7 @@ function newUiObjectConstructor () { break } case 'Process Definition': { - level_2() + level_0() break } case 'Calculations Procedure': { From a53059fddff84bb9f6acad24e81ba03492c71ec8 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 31 Oct 2019 10:36:39 +0100 Subject: [PATCH 59/95] Adding Code property --- DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js | 3 +++ .../Workspace/FunctionLibraries/UiObjectsFromNodes.js | 2 ++ 2 files changed, 5 insertions(+) diff --git a/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js b/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js index 0684abe51..f344e177a 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js +++ b/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js @@ -1182,6 +1182,7 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, + code: node.code, calculations: getProtocolNode(node.calculations, removePersonalData, parseCode, includeIds, includePayload, includeReferences), dataBuilding: getProtocolNode(node.dataBuilding, removePersonalData, parseCode, includeIds, includePayload, includeReferences), outputDatasets: [], @@ -1329,6 +1330,7 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, + code: node.code, record: getProtocolNode(node.record, removePersonalData, parseCode, includeIds, includePayload, includeReferences), datasets: [] } @@ -1376,6 +1378,7 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, + code: node.code, formula: getProtocolNode(node.formula, removePersonalData, parseCode, includeIds, includePayload, includeReferences) } if (includeIds) { diff --git a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js index aecdcd2ce..ba998db07 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js +++ b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js @@ -934,6 +934,7 @@ function newUiObjectsFromNodes () { let object = { type: 'Process Definition', name: 'New Process Definition', + code: '{}', outputDatasets: [], statusDependencies: [], dataDependencies: [] @@ -1037,6 +1038,7 @@ function newUiObjectsFromNodes () { let object = { type: 'Product Definition', name: 'New Product Definition', + code: '{}', datasets: [] } if (node.products === undefined) { From c886509819901d1806a1e24114d6f31eba6b8121 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 31 Oct 2019 11:06:55 +0100 Subject: [PATCH 60/95] Adding Editor to Bots --- .../FunctionLibraries/ProtocolNode.js | 4 + .../FunctionLibraries/UiObjectsFromNodes.js | 4 + FloatingSpace/UiObjectConstructor.js | 112 +++++++++++++++--- 3 files changed, 102 insertions(+), 18 deletions(-) diff --git a/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js b/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js index f344e177a..301f41a44 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js +++ b/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js @@ -1036,6 +1036,7 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, + code: node.code, sensorBots: [], indicatorBots: [], tradingBots: [], @@ -1086,6 +1087,7 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, + code: node.code, processes: [], products: [] } @@ -1118,6 +1120,7 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, + code: node.code, processes: [], products: [] } @@ -1150,6 +1153,7 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, + code: node.code, processes: [], products: [] } diff --git a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js index ba998db07..bacd5ea5d 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js +++ b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js @@ -872,6 +872,7 @@ function newUiObjectsFromNodes () { let team = { name: 'New Team', type: 'Team', + code: '{}', sensorBots: [], indicatorBots: [], tradingBots: [], @@ -886,6 +887,7 @@ function newUiObjectsFromNodes () { let object = { type: 'Sensor Bot', name: 'New Sensor Bot', + code: '{}', processes: [], products: [] } @@ -902,6 +904,7 @@ function newUiObjectsFromNodes () { let object = { type: 'Indicator Bot', name: 'New Indicator Bot', + code: '{}', processes: [], products: [] } @@ -918,6 +921,7 @@ function newUiObjectsFromNodes () { let object = { type: 'Trading Bot', name: 'New Trading Bot', + code: '{}', processes: [], products: [] } diff --git a/FloatingSpace/UiObjectConstructor.js b/FloatingSpace/UiObjectConstructor.js index e0cdace0a..c2cf631d3 100644 --- a/FloatingSpace/UiObjectConstructor.js +++ b/FloatingSpace/UiObjectConstructor.js @@ -305,7 +305,26 @@ function newUiObjectConstructor () { break } case 'Team': { + uiObject.codeEditor = newCodeEditor() + uiObject.codeEditor.isVisibleFunction = uiObject.isVisibleFunction + uiObject.codeEditor.initialize() + uiObject.codeEditor.container.connectToParent(uiObject.container, false, false, true, true, false, false, false, false) addLeftIcons(menuItemsInitialValues, floatingObject) + menuItemsInitialValues.push( + { + action: 'Edit Bot', + actionFunction: uiObject.codeEditor.activate, + label: 'Edit Bot', + visible: true, + iconPathOn: 'html', + iconPathOff: 'html', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: -75, + dontShowAtFullscreen: true + } + ) menuItemsInitialValues.push( { action: 'Add Sensor Bot', @@ -316,7 +335,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: -60 + angle: -40 } ) menuItemsInitialValues.push( @@ -329,7 +348,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: -30 + angle: -20 } ) menuItemsInitialValues.push( @@ -342,7 +361,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: -10 + angle: 0 } ) menuItemsInitialValues.push( @@ -355,7 +374,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: 10 + angle: 20 } ) menuItemsInitialValues.push( @@ -371,7 +390,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: 30 + angle: 40 } ) menuItemsInitialValues.push( @@ -385,13 +404,32 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: 60 + angle: 75 } ) break } case 'Sensor Bot': { + uiObject.codeEditor = newCodeEditor() + uiObject.codeEditor.isVisibleFunction = uiObject.isVisibleFunction + uiObject.codeEditor.initialize() + uiObject.codeEditor.container.connectToParent(uiObject.container, false, false, true, true, false, false, false, false) addLeftIcons(menuItemsInitialValues, floatingObject) + menuItemsInitialValues.push( + { + action: 'Edit Bot', + actionFunction: uiObject.codeEditor.activate, + label: 'Edit Bot', + visible: true, + iconPathOn: 'html', + iconPathOff: 'html', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: -45, + dontShowAtFullscreen: true + } + ) menuItemsInitialValues.push( { action: 'Add Process Definition', @@ -402,7 +440,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: -30 + angle: -20 } ) menuItemsInitialValues.push( @@ -415,7 +453,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: -10 + angle: 0 } ) menuItemsInitialValues.push( @@ -431,7 +469,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: 10 + angle: 20 } ) menuItemsInitialValues.push( @@ -445,13 +483,32 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: 30 + angle: 45 } ) break } case 'Indicator Bot': { + uiObject.codeEditor = newCodeEditor() + uiObject.codeEditor.isVisibleFunction = uiObject.isVisibleFunction + uiObject.codeEditor.initialize() + uiObject.codeEditor.container.connectToParent(uiObject.container, false, false, true, true, false, false, false, false) addLeftIcons(menuItemsInitialValues, floatingObject) + menuItemsInitialValues.push( + { + action: 'Edit Bot', + actionFunction: uiObject.codeEditor.activate, + label: 'Edit Bot', + visible: true, + iconPathOn: 'html', + iconPathOff: 'html', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: -45, + dontShowAtFullscreen: true + } + ) menuItemsInitialValues.push( { action: 'Add Process Definition', @@ -462,7 +519,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: -30 + angle: -20 } ) menuItemsInitialValues.push( @@ -475,7 +532,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: -10 + angle: 0 } ) menuItemsInitialValues.push( @@ -491,7 +548,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: 10 + angle: 20 } ) menuItemsInitialValues.push( @@ -505,13 +562,32 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: 30 + angle: 45 } ) break } case 'Trading Bot': { + uiObject.codeEditor = newCodeEditor() + uiObject.codeEditor.isVisibleFunction = uiObject.isVisibleFunction + uiObject.codeEditor.initialize() + uiObject.codeEditor.container.connectToParent(uiObject.container, false, false, true, true, false, false, false, false) addLeftIcons(menuItemsInitialValues, floatingObject) + menuItemsInitialValues.push( + { + action: 'Edit Bot', + actionFunction: uiObject.codeEditor.activate, + label: 'Edit Bot', + visible: true, + iconPathOn: 'html', + iconPathOff: 'html', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: -45, + dontShowAtFullscreen: true + } + ) menuItemsInitialValues.push( { action: 'Add Process Definition', @@ -522,7 +598,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: -30 + angle: -20 } ) menuItemsInitialValues.push( @@ -535,7 +611,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: -10 + angle: 0 } ) menuItemsInitialValues.push( @@ -551,7 +627,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: 10 + angle: 20 } ) menuItemsInitialValues.push( @@ -565,7 +641,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: 30 + angle: 45 } ) break From 735ddeb7f33a767141d028a622f9ad0d62b16d34 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 31 Oct 2019 12:12:40 +0100 Subject: [PATCH 61/95] title visible --- FloatingSpace/UiObjectTitle.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/FloatingSpace/UiObjectTitle.js b/FloatingSpace/UiObjectTitle.js index b51a68985..25143c9a2 100644 --- a/FloatingSpace/UiObjectTitle.js +++ b/FloatingSpace/UiObjectTitle.js @@ -76,6 +76,14 @@ function newUiObjectTitle () { thisObject.allwaysVisible = true break } + case 'Dataset Definition': { + thisObject.allwaysVisible = true + break + } + case 'Record Property': { + thisObject.allwaysVisible = true + break + } case 'Plotter': { thisObject.allwaysVisible = true break From 1d53d6710e5cd6128b5fd31cdb86d8c49108b9ad Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Fri, 1 Nov 2019 08:57:26 +0100 Subject: [PATCH 62/95] Reference Children for Output Dataset --- .../FunctionLibraries/ProtocolNode.js | 166 +++++++++--------- .../ReferenceAttachDetach.js | 8 + .../FunctionLibraries/UiObjectsFromNodes.js | 36 +++- FloatingSpace/UiObject.js | 4 + 4 files changed, 132 insertions(+), 82 deletions(-) diff --git a/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js b/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js index 301f41a44..3345353ee 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js +++ b/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js @@ -19,7 +19,7 @@ function newProtocolNode () { object.id = node.id } if (includePayload) { - object.savedPayload = getSavedPayload(node) + object.savedPayload = getSavedPayload(node, includeReferences) } return object } @@ -35,7 +35,7 @@ function newProtocolNode () { object.id = node.id } if (includePayload) { - object.savedPayload = getSavedPayload(node) + object.savedPayload = getSavedPayload(node, includeReferences) } return object } @@ -57,7 +57,7 @@ function newProtocolNode () { object.id = node.id } if (includePayload) { - object.savedPayload = getSavedPayload(node) + object.savedPayload = getSavedPayload(node, includeReferences) } return object } @@ -73,7 +73,7 @@ function newProtocolNode () { object.id = node.id } if (includePayload) { - object.savedPayload = getSavedPayload(node) + object.savedPayload = getSavedPayload(node, includeReferences) } return object } @@ -102,7 +102,7 @@ function newProtocolNode () { object.id = node.id } if (includePayload) { - object.savedPayload = getSavedPayload(node) + object.savedPayload = getSavedPayload(node, includeReferences) } return object } @@ -125,7 +125,7 @@ function newProtocolNode () { object.id = node.id } if (includePayload) { - object.savedPayload = getSavedPayload(node) + object.savedPayload = getSavedPayload(node, includeReferences) } return object } @@ -147,7 +147,7 @@ function newProtocolNode () { object.id = node.id } if (includePayload) { - object.savedPayload = getSavedPayload(node) + object.savedPayload = getSavedPayload(node, includeReferences) } return object } @@ -169,7 +169,7 @@ function newProtocolNode () { object.id = node.id } if (includePayload) { - object.savedPayload = getSavedPayload(node) + object.savedPayload = getSavedPayload(node, includeReferences) } return object } @@ -198,7 +198,7 @@ function newProtocolNode () { object.id = node.id } if (includePayload) { - object.savedPayload = getSavedPayload(node) + object.savedPayload = getSavedPayload(node, includeReferences) } return object } @@ -225,7 +225,7 @@ function newProtocolNode () { object.id = node.id } if (includePayload) { - object.savedPayload = getSavedPayload(node) + object.savedPayload = getSavedPayload(node, includeReferences) } return object } @@ -254,7 +254,7 @@ function newProtocolNode () { object.id = node.id } if (includePayload) { - object.savedPayload = getSavedPayload(node) + object.savedPayload = getSavedPayload(node, includeReferences) } return object } @@ -272,7 +272,7 @@ function newProtocolNode () { object.id = node.id } if (includePayload) { - object.savedPayload = getSavedPayload(node) + object.savedPayload = getSavedPayload(node, includeReferences) } return object } @@ -286,7 +286,7 @@ function newProtocolNode () { object.id = node.id } if (includePayload) { - object.savedPayload = getSavedPayload(node) + object.savedPayload = getSavedPayload(node, includeReferences) } return object } @@ -300,7 +300,7 @@ function newProtocolNode () { object.id = node.id } if (includePayload) { - object.savedPayload = getSavedPayload(node) + object.savedPayload = getSavedPayload(node, includeReferences) } return object } @@ -315,7 +315,7 @@ function newProtocolNode () { object.id = node.id } if (includePayload) { - object.savedPayload = getSavedPayload(node) + object.savedPayload = getSavedPayload(node, includeReferences) } return object } @@ -330,7 +330,7 @@ function newProtocolNode () { object.id = node.id } if (includePayload) { - object.savedPayload = getSavedPayload(node) + object.savedPayload = getSavedPayload(node, includeReferences) } return object } @@ -347,7 +347,7 @@ function newProtocolNode () { object.id = node.id } if (includePayload) { - object.savedPayload = getSavedPayload(node) + object.savedPayload = getSavedPayload(node, includeReferences) } return object } @@ -363,7 +363,7 @@ function newProtocolNode () { object.id = node.id } if (includePayload) { - object.savedPayload = getSavedPayload(node) + object.savedPayload = getSavedPayload(node, includeReferences) } return object } @@ -379,7 +379,7 @@ function newProtocolNode () { object.id = node.id } if (includePayload) { - object.savedPayload = getSavedPayload(node) + object.savedPayload = getSavedPayload(node, includeReferences) } return object } @@ -394,7 +394,7 @@ function newProtocolNode () { object.id = node.id } if (includePayload) { - object.savedPayload = getSavedPayload(node) + object.savedPayload = getSavedPayload(node, includeReferences) } return object } @@ -412,7 +412,7 @@ function newProtocolNode () { object.id = node.id } if (includePayload) { - object.savedPayload = getSavedPayload(node) + object.savedPayload = getSavedPayload(node, includeReferences) } return object } @@ -430,7 +430,7 @@ function newProtocolNode () { object.id = node.id } if (includePayload) { - object.savedPayload = getSavedPayload(node) + object.savedPayload = getSavedPayload(node, includeReferences) } return object } @@ -448,7 +448,7 @@ function newProtocolNode () { object.id = node.id } if (includePayload) { - object.savedPayload = getSavedPayload(node) + object.savedPayload = getSavedPayload(node, includeReferences) } return object } @@ -463,7 +463,7 @@ function newProtocolNode () { object.id = node.id } if (includePayload) { - object.savedPayload = getSavedPayload(node) + object.savedPayload = getSavedPayload(node, includeReferences) } return object } @@ -481,7 +481,7 @@ function newProtocolNode () { object.id = node.id } if (includePayload) { - object.savedPayload = getSavedPayload(node) + object.savedPayload = getSavedPayload(node, includeReferences) } return object } @@ -499,7 +499,7 @@ function newProtocolNode () { object.id = node.id } if (includePayload) { - object.savedPayload = getSavedPayload(node) + object.savedPayload = getSavedPayload(node, includeReferences) } return object } @@ -519,7 +519,7 @@ function newProtocolNode () { object.id = node.id } if (includePayload) { - object.savedPayload = getSavedPayload(node) + object.savedPayload = getSavedPayload(node, includeReferences) } return object } @@ -542,7 +542,7 @@ function newProtocolNode () { object.id = node.id } if (includePayload) { - object.savedPayload = getSavedPayload(node) + object.savedPayload = getSavedPayload(node, includeReferences) } return object } @@ -565,7 +565,7 @@ function newProtocolNode () { object.id = node.id } if (includePayload) { - object.savedPayload = getSavedPayload(node) + object.savedPayload = getSavedPayload(node, includeReferences) } return object } @@ -595,7 +595,7 @@ function newProtocolNode () { object.id = node.id } if (includePayload) { - object.savedPayload = getSavedPayload(node) + object.savedPayload = getSavedPayload(node, includeReferences) } return object } @@ -610,7 +610,7 @@ function newProtocolNode () { object.id = node.id } if (includePayload) { - object.savedPayload = getSavedPayload(node) + object.savedPayload = getSavedPayload(node, includeReferences) } return object } @@ -626,7 +626,7 @@ function newProtocolNode () { object.id = node.id } if (includePayload) { - object.savedPayload = getSavedPayload(node) + object.savedPayload = getSavedPayload(node, includeReferences) } return object } @@ -648,7 +648,7 @@ function newProtocolNode () { object.id = node.id } if (includePayload) { - object.savedPayload = getSavedPayload(node) + object.savedPayload = getSavedPayload(node, includeReferences) } return object } @@ -675,7 +675,7 @@ function newProtocolNode () { object.id = node.id } if (includePayload) { - object.savedPayload = getSavedPayload(node) + object.savedPayload = getSavedPayload(node, includeReferences) } return object } @@ -691,7 +691,7 @@ function newProtocolNode () { object.id = node.id } if (includePayload) { - object.savedPayload = getSavedPayload(node) + object.savedPayload = getSavedPayload(node, includeReferences) } return object } @@ -713,7 +713,7 @@ function newProtocolNode () { object.id = node.id } if (includePayload) { - object.savedPayload = getSavedPayload(node) + object.savedPayload = getSavedPayload(node, includeReferences) } return object } @@ -731,7 +731,7 @@ function newProtocolNode () { object.id = node.id } if (includePayload) { - object.savedPayload = getSavedPayload(node) + object.savedPayload = getSavedPayload(node, includeReferences) } return object } @@ -753,7 +753,7 @@ function newProtocolNode () { object.id = node.id } if (includePayload) { - object.savedPayload = getSavedPayload(node) + object.savedPayload = getSavedPayload(node, includeReferences) } return object } @@ -768,7 +768,7 @@ function newProtocolNode () { object.id = node.id } if (includePayload) { - object.savedPayload = getSavedPayload(node) + object.savedPayload = getSavedPayload(node, includeReferences) } return object } @@ -794,7 +794,7 @@ function newProtocolNode () { object.id = node.id } if (includePayload) { - object.savedPayload = getSavedPayload(node) + object.savedPayload = getSavedPayload(node, includeReferences) } return object } @@ -820,7 +820,7 @@ function newProtocolNode () { object.id = node.id } if (includePayload) { - object.savedPayload = getSavedPayload(node) + object.savedPayload = getSavedPayload(node, includeReferences) } return object } @@ -846,7 +846,7 @@ function newProtocolNode () { object.id = node.id } if (includePayload) { - object.savedPayload = getSavedPayload(node) + object.savedPayload = getSavedPayload(node, includeReferences) } return object } @@ -865,7 +865,7 @@ function newProtocolNode () { object.id = node.id } if (includePayload) { - object.savedPayload = getSavedPayload(node) + object.savedPayload = getSavedPayload(node, includeReferences) } return object } @@ -972,7 +972,7 @@ function newProtocolNode () { object.id = node.id } if (includePayload) { - object.savedPayload = getSavedPayload(node) + object.savedPayload = getSavedPayload(node, includeReferences) } return object } @@ -995,7 +995,7 @@ function newProtocolNode () { object.id = node.id } if (includePayload) { - object.savedPayload = getSavedPayload(node) + object.savedPayload = getSavedPayload(node, includeReferences) } return object } @@ -1011,23 +1011,7 @@ function newProtocolNode () { object.id = node.id } if (includePayload) { - object.savedPayload = getSavedPayload(node) - } - if (includeReferences) { - let referenceChildren = [] - for (let i = 0; i < node.referenceChildren.length; i++) { - let child = node.referenceChildren[i] - if (child !== undefined) { - let referencedChild = { - type: child.type, - subType: child.subType, - name: child.name, - id: child.id - } - referenceChildren.push(referencedChild) - } - } - object.savedPayload.referenceChildren = referenceChildren + object.savedPayload = getSavedPayload(node, includeReferences) } return object } @@ -1078,7 +1062,7 @@ function newProtocolNode () { object.id = node.id } if (includePayload) { - object.savedPayload = getSavedPayload(node) + object.savedPayload = getSavedPayload(node, includeReferences) } return object } @@ -1111,7 +1095,7 @@ function newProtocolNode () { object.id = node.id } if (includePayload) { - object.savedPayload = getSavedPayload(node) + object.savedPayload = getSavedPayload(node, includeReferences) } return object } @@ -1144,7 +1128,7 @@ function newProtocolNode () { object.id = node.id } if (includePayload) { - object.savedPayload = getSavedPayload(node) + object.savedPayload = getSavedPayload(node, includeReferences) } return object } @@ -1177,7 +1161,7 @@ function newProtocolNode () { object.id = node.id } if (includePayload) { - object.savedPayload = getSavedPayload(node) + object.savedPayload = getSavedPayload(node, includeReferences) } return object } @@ -1221,7 +1205,7 @@ function newProtocolNode () { object.id = node.id } if (includePayload) { - object.savedPayload = getSavedPayload(node) + object.savedPayload = getSavedPayload(node, includeReferences) } return object } @@ -1237,7 +1221,7 @@ function newProtocolNode () { object.id = node.id } if (includePayload) { - object.savedPayload = getSavedPayload(node) + object.savedPayload = getSavedPayload(node, includeReferences) } return object } @@ -1253,7 +1237,7 @@ function newProtocolNode () { object.id = node.id } if (includePayload) { - object.savedPayload = getSavedPayload(node) + object.savedPayload = getSavedPayload(node, includeReferences) } return object } @@ -1268,7 +1252,7 @@ function newProtocolNode () { object.id = node.id } if (includePayload) { - object.savedPayload = getSavedPayload(node) + object.savedPayload = getSavedPayload(node, includeReferences) } return object } @@ -1283,7 +1267,7 @@ function newProtocolNode () { object.id = node.id } if (includePayload) { - object.savedPayload = getSavedPayload(node) + object.savedPayload = getSavedPayload(node, includeReferences) } return object } @@ -1297,7 +1281,7 @@ function newProtocolNode () { object.id = node.id } if (includePayload) { - object.savedPayload = getSavedPayload(node) + object.savedPayload = getSavedPayload(node, includeReferences) } return object } @@ -1311,7 +1295,7 @@ function newProtocolNode () { object.id = node.id } if (includePayload) { - object.savedPayload = getSavedPayload(node) + object.savedPayload = getSavedPayload(node, includeReferences) } return object } @@ -1325,7 +1309,7 @@ function newProtocolNode () { object.id = node.id } if (includePayload) { - object.savedPayload = getSavedPayload(node) + object.savedPayload = getSavedPayload(node, includeReferences) } return object } @@ -1350,7 +1334,7 @@ function newProtocolNode () { object.id = node.id } if (includePayload) { - object.savedPayload = getSavedPayload(node) + object.savedPayload = getSavedPayload(node, includeReferences) } return object } @@ -1373,7 +1357,7 @@ function newProtocolNode () { object.id = node.id } if (includePayload) { - object.savedPayload = getSavedPayload(node) + object.savedPayload = getSavedPayload(node, includeReferences) } return object } @@ -1389,7 +1373,7 @@ function newProtocolNode () { object.id = node.id } if (includePayload) { - object.savedPayload = getSavedPayload(node) + object.savedPayload = getSavedPayload(node, includeReferences) } return object } @@ -1404,7 +1388,7 @@ function newProtocolNode () { object.id = node.id } if (includePayload) { - object.savedPayload = getSavedPayload(node) + object.savedPayload = getSavedPayload(node, includeReferences) } return object } @@ -1427,7 +1411,7 @@ function newProtocolNode () { object.id = node.id } if (includePayload) { - object.savedPayload = getSavedPayload(node) + object.savedPayload = getSavedPayload(node, includeReferences) } return object } @@ -1451,7 +1435,7 @@ function newProtocolNode () { object.id = node.id } if (includePayload) { - object.savedPayload = getSavedPayload(node) + object.savedPayload = getSavedPayload(node, includeReferences) } return object } @@ -1466,7 +1450,7 @@ function newProtocolNode () { object.id = node.id } if (includePayload) { - object.savedPayload = getSavedPayload(node) + object.savedPayload = getSavedPayload(node, includeReferences) } return object } @@ -1495,7 +1479,27 @@ function newProtocolNode () { shortcutKey: node.payload.uiObject.shortcutKey } } + if (includeReferences) { + /* For the ones that have reference children, we include them. */ + if (node.referenceChildren !== undefined) { + let referenceChildren = [] + for (let i = 0; i < node.referenceChildren.length; i++) { + let child = node.referenceChildren[i] + if (child !== undefined) { + let referencedChild = { + type: child.type, + subType: child.subType, + name: child.name, + id: child.id + } + referenceChildren.push(referencedChild) + } + } + savedPayload.referenceChildren = referenceChildren + } + + /* Next for the ones that have a reference parent, we include it */ if (node.payload.referenceParent !== undefined) { savedPayload.referenceParent = { type: node.payload.referenceParent.type, diff --git a/DesignerSpace/Workspace/FunctionLibraries/ReferenceAttachDetach.js b/DesignerSpace/Workspace/FunctionLibraries/ReferenceAttachDetach.js index 8a26ecbba..4dbaecb60 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/ReferenceAttachDetach.js +++ b/DesignerSpace/Workspace/FunctionLibraries/ReferenceAttachDetach.js @@ -24,6 +24,10 @@ function newReferenceAttachDetach () { completeDetachment(node) return } + case 'Output Dataset': { + completeDetachment(node) + return + } } } @@ -45,6 +49,10 @@ function newReferenceAttachDetach () { completeAttachment(node, attachToNode) } break + case 'Output Dataset': { + completeAttachment(node, attachToNode) + } + break } } diff --git a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js index bacd5ea5d..40c20b4a8 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js +++ b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js @@ -83,6 +83,9 @@ function newUiObjectsFromNodes () { childNode.savedPayload = undefined } for (const [key, parentNode] of mapOfReferenceParents) { + if (parentNode.referenceChildren === undefined) { + parentNode.referenceChildren = [] + } for (let i = 0; i < parentNode.savedPayload.referenceChildren.length; i++) { let savedChild = parentNode.savedPayload.referenceChildren[i] if (savedChild.id !== undefined) { @@ -436,6 +439,7 @@ function newUiObjectsFromNodes () { let referenceChildren if (mapOfReferenceParents !== undefined) { if (node.savedPayload.referenceChildren !== undefined) { + referenceChildren = [] if (node.savedPayload.referenceChildren.length > 0) { mapOfReferenceParents.set(node.id, node) referenceChildren = node.savedPayload.referenceChildren @@ -798,7 +802,21 @@ function newUiObjectsFromNodes () { return } case 'Output Dataset': { + 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 'Status Dependency': { @@ -836,7 +854,22 @@ function newUiObjectsFromNodes () { return } case 'Dataset Definition': { + let referenceChildren + if (mapOfReferenceParents !== undefined) { + if (node.savedPayload.referenceChildren !== undefined) { + referenceChildren = [] + if (node.savedPayload.referenceChildren.length > 0) { + 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 'Plotter': { @@ -1084,7 +1117,8 @@ function newUiObjectsFromNodes () { let object = { type: 'Dataset Definition', name: 'New Dataset Definition', - code: '{}' + code: '{}', + referenceChildren: [] } if (node.datasets === undefined) { node.datasets = [] diff --git a/FloatingSpace/UiObject.js b/FloatingSpace/UiObject.js index ef0a1e954..5a11e0b21 100644 --- a/FloatingSpace/UiObject.js +++ b/FloatingSpace/UiObject.js @@ -668,6 +668,10 @@ function newUiObject () { compatibleType = '->' + 'Definition' + '->' compatibleSubType = undefined break + case 'Output Dataset': + compatibleType = '->' + 'Dataset Definition' + '->' + compatibleSubType = undefined + break default: return } From 64b238af435dc2c3538dffb41ba70337351122fd Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Fri, 1 Nov 2019 09:54:50 +0100 Subject: [PATCH 63/95] Data Dependency with References set up and bug fixed --- .../ReferenceAttachDetach.js | 8 ++++++ .../FunctionLibraries/UiObjectsFromNodes.js | 26 +++++++++++++------ FloatingSpace/UiObject.js | 4 +++ 3 files changed, 30 insertions(+), 8 deletions(-) diff --git a/DesignerSpace/Workspace/FunctionLibraries/ReferenceAttachDetach.js b/DesignerSpace/Workspace/FunctionLibraries/ReferenceAttachDetach.js index 4dbaecb60..204214d3a 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/ReferenceAttachDetach.js +++ b/DesignerSpace/Workspace/FunctionLibraries/ReferenceAttachDetach.js @@ -28,6 +28,10 @@ function newReferenceAttachDetach () { completeDetachment(node) return } + case 'Data Dependency': { + completeDetachment(node) + return + } } } @@ -53,6 +57,10 @@ function newReferenceAttachDetach () { completeAttachment(node, attachToNode) } break + case 'Data Dependency': { + completeAttachment(node, attachToNode) + } + break } } diff --git a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js index 40c20b4a8..d856b4db2 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js +++ b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js @@ -440,10 +440,8 @@ function newUiObjectsFromNodes () { if (mapOfReferenceParents !== undefined) { if (node.savedPayload.referenceChildren !== undefined) { referenceChildren = [] - if (node.savedPayload.referenceChildren.length > 0) { - mapOfReferenceParents.set(node.id, node) - referenceChildren = node.savedPayload.referenceChildren - } + mapOfReferenceParents.set(node.id, node) + referenceChildren = node.savedPayload.referenceChildren } } createUiObject('Definition', node.name, node, parentNode, chainParent, 'Definition') @@ -824,7 +822,21 @@ function newUiObjectsFromNodes () { return } case 'Data 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 'Product Definition': { @@ -858,10 +870,8 @@ function newUiObjectsFromNodes () { if (mapOfReferenceParents !== undefined) { if (node.savedPayload.referenceChildren !== undefined) { referenceChildren = [] - if (node.savedPayload.referenceChildren.length > 0) { - mapOfReferenceParents.set(node.id, node) - referenceChildren = node.savedPayload.referenceChildren - } + mapOfReferenceParents.set(node.id, node) + referenceChildren = node.savedPayload.referenceChildren } } createUiObject(node.type, node.name, node, parentNode, chainParent, node.type) diff --git a/FloatingSpace/UiObject.js b/FloatingSpace/UiObject.js index 5a11e0b21..ac7362928 100644 --- a/FloatingSpace/UiObject.js +++ b/FloatingSpace/UiObject.js @@ -672,6 +672,10 @@ function newUiObject () { compatibleType = '->' + 'Dataset Definition' + '->' compatibleSubType = undefined break + case 'Data Dependency': + compatibleType = '->' + 'Dataset Definition' + '->' + compatibleSubType = undefined + break default: return } From 4f9c4bd403dae05d4efa2eff8dec4bccdaa0841b Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Fri, 1 Nov 2019 11:31:47 +0100 Subject: [PATCH 64/95] Status Report and Execution Finished Event Implementation part 1 --- .../FunctionLibraries/ChainAttachDetach.js | 24 ++++++ .../FunctionLibraries/NodeChildren.js | 21 +++++ .../FunctionLibraries/NodeDeleter.js | 34 +++++++++ .../Workspace/FunctionLibraries/OnFocus.js | 14 ++++ .../FunctionLibraries/ProtocolNode.js | 28 +++++++ .../FunctionLibraries/ShortcutKeys.js | 14 ++++ .../FunctionLibraries/UiObjectsFromNodes.js | 32 ++++++++ DesignerSpace/Workspace/Workspace.js | 18 +++++ FloatingSpace/UiObject.js | 10 +++ FloatingSpace/UiObjectConstructor.js | 76 +++++++++++++++++++ Spaces/DesignerSpace.js | 2 + 11 files changed, 273 insertions(+) diff --git a/DesignerSpace/Workspace/FunctionLibraries/ChainAttachDetach.js b/DesignerSpace/Workspace/FunctionLibraries/ChainAttachDetach.js index d38012d90..59dd1a884 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/ChainAttachDetach.js +++ b/DesignerSpace/Workspace/FunctionLibraries/ChainAttachDetach.js @@ -61,6 +61,16 @@ function newChainAttachDetach () { completeDetachment(node, rootNodes) return } + case 'Status Report': { + node.payload.parentNode.calculations = undefined + completeDetachment(node, rootNodes) + return + } + case 'Execution Finished Event': { + node.payload.parentNode.calculations = undefined + completeDetachment(node, rootNodes) + return + } case 'Calculations Procedure': { node.payload.parentNode.calculations = undefined completeDetachment(node, rootNodes) @@ -557,6 +567,20 @@ function newChainAttachDetach () { completeAttachment(node, rootNodes) } break + case 'Status Report': { + node.payload.parentNode = attachToNode + node.payload.chainParent = attachToNode + node.payload.parentNode.calculations = node + completeAttachment(node, rootNodes) + } + break + case 'Execution Finished Event': { + node.payload.parentNode = attachToNode + node.payload.chainParent = attachToNode + node.payload.parentNode.calculations = node + completeAttachment(node, rootNodes) + } + break case 'Calculations Procedure': { node.payload.parentNode = attachToNode node.payload.chainParent = attachToNode diff --git a/DesignerSpace/Workspace/FunctionLibraries/NodeChildren.js b/DesignerSpace/Workspace/FunctionLibraries/NodeChildren.js index d82365e47..91800eb70 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/NodeChildren.js +++ b/DesignerSpace/Workspace/FunctionLibraries/NodeChildren.js @@ -29,6 +29,12 @@ function newNodeChildren () { case 'Process Definition': { return countChildrenProcessDefinition(parentNode, childNode) } + case 'Status Rerport': { + return countChildrenStatusRerport(parentNode, childNode) + } + case 'Execution Finished Event': { + return countChildrenExecutionFinishedEvent(parentNode, childNode) + } case 'Calculations Procedure': { return countChildrenCalculationsProcedure(parentNode, childNode) } @@ -428,6 +434,21 @@ function newNodeChildren () { return response } + function countChildrenStatusRerport (parentNode, childNode) { + let response = { + childrenCount: 0, + childIndex: undefined + } + return response + } + + function countChildrenExecutionFinishedEvent (parentNode, childNode) { + let response = { + childrenCount: 0, + childIndex: undefined + } + return response + } function countChildrenCalculationsProcedure (parentNode, childNode) { let response = { childrenCount: 0, diff --git a/DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js b/DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js index d4ca33fa6..56665f456 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js +++ b/DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js @@ -8,6 +8,8 @@ function newNodeDeleter () { deleteIndicatorBot: deleteIndicatorBot, deleteTradingBot: deleteTradingBot, deleteProcessDefinition: deleteProcessDefinition, + deleteStatusReport: deleteStatusReport, + deleteExecutionFinishedEvent: deleteExecutionFinishedEvent, deleteCalculationsProcedure: deleteCalculationsProcedure, deleteDataBuildingProcedure: deleteDataBuildingProcedure, deleteProcedureInitialization: deleteProcedureInitialization, @@ -112,6 +114,14 @@ function newNodeDeleter () { deleteProcessDefinition(rootNode, rootNodes) break } + case 'Status Report': { + deleteStatusReport(rootNode, rootNodes) + break + } + case 'Execution Finished Event': { + deleteExecutionFinishedEvent(rootNode, rootNodes) + break + } case 'Calculations Procedure': { deleteCalculationsProcedure(rootNode, rootNodes) break @@ -582,6 +592,30 @@ function newNodeDeleter () { cleanNode(node) } + function deleteStatusReport (node, rootNodes) { + let payload = node.payload + + if (payload.parentNode !== undefined) { + payload.parentNode.statusReport = undefined + } + + completeDeletion(node, rootNodes) + destroyUiObject(node) + cleanNode(node) + } + + function deleteExecutionFinishedEvent (node, rootNodes) { + let payload = node.payload + + if (payload.parentNode !== undefined) { + payload.parentNode.executionFinishedEvent = undefined + } + + completeDeletion(node, rootNodes) + destroyUiObject(node) + cleanNode(node) + } + function deleteCalculationsProcedure (node, rootNodes) { let payload = node.payload diff --git a/DesignerSpace/Workspace/FunctionLibraries/OnFocus.js b/DesignerSpace/Workspace/FunctionLibraries/OnFocus.js index 0a3c9db1b..0c91c1765 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/OnFocus.js +++ b/DesignerSpace/Workspace/FunctionLibraries/OnFocus.js @@ -856,6 +856,20 @@ function newOnFocus () { return } } + case 'Status Report': { + if (node.payload.uiObject.isOnFocus === true) { + return node + } else { + return + } + } + case 'Execution Finished Event': { + if (node.payload.uiObject.isOnFocus === true) { + return node + } else { + return + } + } case 'Calculations Procedure': { let child child = getNodeThatIsOnFocus(node.initialization) diff --git a/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js b/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js index 3345353ee..d780e8b38 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js +++ b/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js @@ -1209,6 +1209,34 @@ function newProtocolNode () { } return object } + case 'Status Report': { + let object = { + type: node.type, + subType: node.subType, + name: node.name + } + if (includeIds) { + object.id = node.id + } + if (includePayload) { + object.savedPayload = getSavedPayload(node, includeReferences) + } + return object + } + case 'Execution Finished Event': { + let object = { + type: node.type, + subType: node.subType, + name: node.name + } + if (includeIds) { + object.id = node.id + } + if (includePayload) { + object.savedPayload = getSavedPayload(node, includeReferences) + } + return object + } case 'Calculations Procedure': { let object = { type: node.type, diff --git a/DesignerSpace/Workspace/FunctionLibraries/ShortcutKeys.js b/DesignerSpace/Workspace/FunctionLibraries/ShortcutKeys.js index a1eb48b56..5e84a1c50 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/ShortcutKeys.js +++ b/DesignerSpace/Workspace/FunctionLibraries/ShortcutKeys.js @@ -840,6 +840,20 @@ function newShortcutKeys () { return } } + case 'Status Report': { + if (node.payload.uiObject.shortcutKey === searchingKey) { + return node + } else { + return + } + } + case 'Execution Finished Procedure': { + if (node.payload.uiObject.shortcutKey === searchingKey) { + return node + } else { + return + } + } case 'Calculations Procedure': { let child child = getNodeByShortcutKey(node.initialization, searchingKey) diff --git a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js index d856b4db2..a12b61cc3 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js +++ b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js @@ -7,6 +7,8 @@ function newUiObjectsFromNodes () { addIndicatorBot: addIndicatorBot, addTradingBot: addTradingBot, addProcessDefinition: addProcessDefinition, + addStatusReport: addStatusReport, + addExecutionFinishedEvent: addExecutionFinishedEvent, addCalculationsProcedure: addCalculationsProcedure, addDataBuildingProcedure: addDataBuildingProcedure, addProcedureInitialization: addProcedureInitialization, @@ -765,6 +767,14 @@ function newUiObjectsFromNodes () { } return } + case 'Status Report': { + createUiObject(node.type, node.name, node, parentNode, chainParent, node.type) + return + } + case 'Execution Finished Event': { + createUiObject(node.type, node.name, node, parentNode, chainParent, node.type) + return + } case 'Calculations Procedure': { createUiObject(node.type, node.name, node, parentNode, chainParent, node.type) if (node.initialization !== undefined) { @@ -995,6 +1005,28 @@ function newUiObjectsFromNodes () { return object } + function addStatusReport (node) { + if (node.statusReport === undefined) { + node.statusReport = { + type: 'Status Report', + name: 'New Status Report' + } + createUiObject(node.calculations.type, node.calculations.name, node.calculations, node, node) + } + return node.calculations + } + + function addExecutionFinishedEvent (node) { + if (node.executionFinishedEvent === undefined) { + node.executionFinishedEvent = { + type: 'Execution Finished Event', + name: 'New Execution Finished Event' + } + createUiObject(node.calculations.type, node.calculations.name, node.calculations, node, node) + } + return node.calculations + } + function addCalculationsProcedure (node) { if (node.calculations === undefined) { node.calculations = { diff --git a/DesignerSpace/Workspace/Workspace.js b/DesignerSpace/Workspace/Workspace.js index 3fdda94aa..201023e50 100644 --- a/DesignerSpace/Workspace/Workspace.js +++ b/DesignerSpace/Workspace/Workspace.js @@ -341,6 +341,16 @@ function newWorkspace () { functionLibraryUiObjectsFromNodes.addProcessDefinition(payload.node) } break + case 'Add Status Report': + { + functionLibraryUiObjectsFromNodes.addStatusReport(payload.node) + } + break + case 'Add Execution Finished Event': + { + functionLibraryUiObjectsFromNodes.addExecutionFinishedEvent(payload.node) + } + break case 'Add Calculations Procedure': { functionLibraryUiObjectsFromNodes.addCalculationsProcedure(payload.node) @@ -616,6 +626,14 @@ function newWorkspace () { functionLibraryNodeDeleter.deleteProcessDefinition(payload.node, thisObject.workspaceNode.rootNodes) break } + case 'Delete Status Report': { + functionLibraryNodeDeleter.deleteStatusReport(payload.node, thisObject.workspaceNode.rootNodes) + break + } + case 'Delete Execution Finished Event': { + functionLibraryNodeDeleter.deleteExecutionFinishedEvent(payload.node, thisObject.workspaceNode.rootNodes) + break + } case 'Delete Calculations Procedure': { functionLibraryNodeDeleter.deleteCalculationsProcedure(payload.node, thisObject.workspaceNode.rootNodes) break diff --git a/FloatingSpace/UiObject.js b/FloatingSpace/UiObject.js index ac7362928..ce6474012 100644 --- a/FloatingSpace/UiObject.js +++ b/FloatingSpace/UiObject.js @@ -228,6 +228,14 @@ function newUiObject () { compatibleType = '->' + 'Sensor Bot' + '->' + 'Indicator Bot' + '->' + 'Trading Bot' + '->' compatibleSubType = undefined break + case 'Status Report': + compatibleType = '->' + 'Process Definition' + '->' + compatibleSubType = undefined + break + case 'Execution Finished Event': + compatibleType = '->' + 'Process Definition' + '->' + compatibleSubType = undefined + break case 'Calculations Procedure': compatibleType = '->' + 'Process Definition' + '->' compatibleSubType = undefined @@ -503,6 +511,8 @@ function newUiObject () { let nearbyNode = floatingObject.payload.node 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.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 } if (thisObject.payload.node.type === 'Procedure Initialization' && nearbyNode.initialization !== undefined) { continue } diff --git a/FloatingSpace/UiObjectConstructor.js b/FloatingSpace/UiObjectConstructor.js index c2cf631d3..5579029ea 100644 --- a/FloatingSpace/UiObjectConstructor.js +++ b/FloatingSpace/UiObjectConstructor.js @@ -764,6 +764,74 @@ function newUiObjectConstructor () { ) break } + case 'Status Report': { + addLeftIcons(menuItemsInitialValues, floatingObject) + menuItemsInitialValues.push( + { + action: 'Delete Status Report', + askConfirmation: true, + confirmationLabel: 'Confirm to Delete', + actionFunction: payload.onMenuItemClick, + label: 'Delete Status Report', + visible: true, + iconPathOn: 'delete', + iconPathOff: 'delete', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: -10 + } + ) + menuItemsInitialValues.push( + { + action: 'Share', + actionFunction: payload.onMenuItemClick, + label: 'Share', + visible: true, + iconPathOn: 'menu-share', + iconPathOff: 'menu-share', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: 10 + } + ) + break + } + case 'Execution Finished Event': { + addLeftIcons(menuItemsInitialValues, floatingObject) + menuItemsInitialValues.push( + { + action: 'Delete Execution Finished Event', + askConfirmation: true, + confirmationLabel: 'Confirm to Delete', + actionFunction: payload.onMenuItemClick, + label: 'Delete Event', + visible: true, + iconPathOn: 'delete', + iconPathOff: 'delete', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: -10 + } + ) + menuItemsInitialValues.push( + { + action: 'Share', + actionFunction: payload.onMenuItemClick, + label: 'Share', + visible: true, + iconPathOn: 'menu-share', + iconPathOff: 'menu-share', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: 10 + } + ) + break + } case 'Calculations Procedure': { addLeftIcons(menuItemsInitialValues, floatingObject) menuItemsInitialValues.push( @@ -4402,6 +4470,14 @@ function newUiObjectConstructor () { level_0() break } + case 'Status Report': { + level_3() + break + } + case 'Execution Finished Event': { + level_3() + break + } case 'Calculations Procedure': { level_3() break diff --git a/Spaces/DesignerSpace.js b/Spaces/DesignerSpace.js index cef5c3f58..cae19bd1f 100644 --- a/Spaces/DesignerSpace.js +++ b/Spaces/DesignerSpace.js @@ -95,6 +95,8 @@ function newDesignerSpace () { ['Indicator Bot', 'bot-indicator'], ['Trading Bot', 'bot-trading'], ['Process Definition', 'process-definition'], + ['Status Report', 'text'], + ['Execution Finished Event', 'pantone'], ['Calculations Procedure', 'calculations-procedure'], ['Data Building Procedure', 'data-building-procedure'], ['Procedure Initialization', 'procedure-initialization'], From 717269a931c67e72b52b59c179d9f10cf12c6b5a Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Fri, 1 Nov 2019 11:58:55 +0100 Subject: [PATCH 65/95] Status Report and Execution Finished Event part 2 --- .../FunctionLibraries/NodeChildren.js | 12 +++++++ .../FunctionLibraries/NodeDeleter.js | 8 +++++ .../Workspace/FunctionLibraries/OnFocus.js | 8 +++++ .../FunctionLibraries/ProtocolNode.js | 2 ++ .../FunctionLibraries/ShortcutKeys.js | 8 +++++ .../FunctionLibraries/UiObjectsFromNodes.js | 22 ++++++++++--- DesignerSpace/Workspace/Workspace.js | 5 +++ FloatingSpace/UiObjectConstructor.js | 31 ++++++------------- 8 files changed, 70 insertions(+), 26 deletions(-) diff --git a/DesignerSpace/Workspace/FunctionLibraries/NodeChildren.js b/DesignerSpace/Workspace/FunctionLibraries/NodeChildren.js index 91800eb70..9346f5ff3 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/NodeChildren.js +++ b/DesignerSpace/Workspace/FunctionLibraries/NodeChildren.js @@ -391,6 +391,18 @@ function newNodeChildren () { childrenCount: 0, childIndex: undefined } + if (parentNode.statusReport !== undefined) { + response.childrenCount++ + if (parentNode.statusReport.id === childNode.id) { + response.childIndex = response.childrenCount + } + } + if (parentNode.executionFinishedEvent !== undefined) { + response.childrenCount++ + if (parentNode.executionFinishedEvent.id === childNode.id) { + response.childIndex = response.childrenCount + } + } if (parentNode.calculations !== undefined) { response.childrenCount++ if (parentNode.calculations.id === childNode.id) { diff --git a/DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js b/DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js index 56665f456..0edf7cb0c 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js +++ b/DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js @@ -561,6 +561,14 @@ function newNodeDeleter () { } } + if (node.statusReport !== undefined) { + deleteStatusReport(node.statusReport, rootNodes) + } + + if (node.executionFinishedEvent !== undefined) { + deleteExecutionFinishedEvent(node.executionFinishedEvent, rootNodes) + } + if (node.calculations !== undefined) { deleteCalculationsProcedure(node.calculations, rootNodes) } diff --git a/DesignerSpace/Workspace/FunctionLibraries/OnFocus.js b/DesignerSpace/Workspace/FunctionLibraries/OnFocus.js index 0c91c1765..38801b894 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/OnFocus.js +++ b/DesignerSpace/Workspace/FunctionLibraries/OnFocus.js @@ -824,6 +824,14 @@ function newOnFocus () { } case 'Process Definition': { let child + child = getNodeThatIsOnFocus(node.statusReport) + if (child !== undefined) { + return child + } + child = getNodeThatIsOnFocus(node.executionFinishedEvent) + if (child !== undefined) { + return child + } child = getNodeThatIsOnFocus(node.calculations) if (child !== undefined) { return child diff --git a/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js b/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js index d780e8b38..2af5c36e2 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js +++ b/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js @@ -1171,6 +1171,8 @@ function newProtocolNode () { subType: node.subType, name: node.name, code: node.code, + statusReport: getProtocolNode(node.statusReport, removePersonalData, parseCode, includeIds, includePayload, includeReferences), + executionFinishedEvent: getProtocolNode(node.executionFinishedEvent, removePersonalData, parseCode, includeIds, includePayload, includeReferences), calculations: getProtocolNode(node.calculations, removePersonalData, parseCode, includeIds, includePayload, includeReferences), dataBuilding: getProtocolNode(node.dataBuilding, removePersonalData, parseCode, includeIds, includePayload, includeReferences), outputDatasets: [], diff --git a/DesignerSpace/Workspace/FunctionLibraries/ShortcutKeys.js b/DesignerSpace/Workspace/FunctionLibraries/ShortcutKeys.js index 5e84a1c50..725aa3407 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/ShortcutKeys.js +++ b/DesignerSpace/Workspace/FunctionLibraries/ShortcutKeys.js @@ -808,6 +808,14 @@ function newShortcutKeys () { } case 'Process Definition': { let child + child = getNodeByShortcutKey(node.statusReport, searchingKey) + if (child !== undefined) { + return child + } + child = getNodeByShortcutKey(node.executionFinishedEvent, searchingKey) + if (child !== undefined) { + return child + } child = getNodeByShortcutKey(node.calculations, searchingKey) if (child !== undefined) { return child diff --git a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js index a12b61cc3..92177f2f4 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js +++ b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js @@ -7,6 +7,7 @@ function newUiObjectsFromNodes () { addIndicatorBot: addIndicatorBot, addTradingBot: addTradingBot, addProcessDefinition: addProcessDefinition, + addMissingProcessDefinitionItems: addMissingProcessDefinitionItems, addStatusReport: addStatusReport, addExecutionFinishedEvent: addExecutionFinishedEvent, addCalculationsProcedure: addCalculationsProcedure, @@ -747,6 +748,12 @@ function newUiObjectsFromNodes () { } case 'Process Definition': { createUiObject(node.type, node.name, node, parentNode, chainParent, node.type) + if (node.statusReport !== undefined) { + createUiObjectFromNode(node.statusReport, node, node) + } + if (node.executionFinishedEvent !== undefined) { + createUiObjectFromNode(node.executionFinishedEvent, node, node) + } if (node.calculations !== undefined) { createUiObjectFromNode(node.calculations, node, node) } @@ -1005,15 +1012,22 @@ function newUiObjectsFromNodes () { return object } + function addMissingProcessDefinitionItems (node) { + addStatusReport(node) + addExecutionFinishedEvent(node) + addCalculationsProcedure(node) + addDataBuildingProcedure(node) + } + function addStatusReport (node) { if (node.statusReport === undefined) { node.statusReport = { type: 'Status Report', name: 'New Status Report' } - createUiObject(node.calculations.type, node.calculations.name, node.calculations, node, node) + createUiObject(node.statusReport.type, node.statusReport.name, node.statusReport, node, node) } - return node.calculations + return node.statusReport } function addExecutionFinishedEvent (node) { @@ -1022,9 +1036,9 @@ function newUiObjectsFromNodes () { type: 'Execution Finished Event', name: 'New Execution Finished Event' } - createUiObject(node.calculations.type, node.calculations.name, node.calculations, node, node) + createUiObject(node.executionFinishedEvent.type, node.executionFinishedEvent.name, node.executionFinishedEvent, node, node) } - return node.calculations + return node.executionFinishedEvent } function addCalculationsProcedure (node) { diff --git a/DesignerSpace/Workspace/Workspace.js b/DesignerSpace/Workspace/Workspace.js index 201023e50..fd37e0cac 100644 --- a/DesignerSpace/Workspace/Workspace.js +++ b/DesignerSpace/Workspace/Workspace.js @@ -341,6 +341,11 @@ function newWorkspace () { functionLibraryUiObjectsFromNodes.addProcessDefinition(payload.node) } break + case 'Add Missing Process Definition Items': + { + functionLibraryUiObjectsFromNodes.addMissingProcessDefinitionItems(payload.node) + } + break case 'Add Status Report': { functionLibraryUiObjectsFromNodes.addStatusReport(payload.node) diff --git a/FloatingSpace/UiObjectConstructor.js b/FloatingSpace/UiObjectConstructor.js index 5579029ea..a6a932beb 100644 --- a/FloatingSpace/UiObjectConstructor.js +++ b/FloatingSpace/UiObjectConstructor.js @@ -663,36 +663,23 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: -80, + angle: -70, dontShowAtFullscreen: true } ) menuItemsInitialValues.push( { - action: 'Add Calculations Procedure', + action: 'Add Missing Process Definition Items', actionFunction: payload.onMenuItemClick, - label: 'Add Calculations Procedure', + label: 'Add Missing Items', visible: true, relatedUiObject: 'Calculations Procedure', rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: -45 + angle: -40 } ) - menuItemsInitialValues.push( - { - action: 'Add Data Building Procedure', - actionFunction: payload.onMenuItemClick, - label: 'Add Data Building Procedure', - visible: true, - relatedUiObject: 'Data Building Procedure', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -25 - } - ) menuItemsInitialValues.push( { action: 'Add Output Dataset', @@ -703,7 +690,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: -8 + angle: -20 } ) menuItemsInitialValues.push( @@ -716,7 +703,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: 8 + angle: 0 } ) menuItemsInitialValues.push( @@ -729,7 +716,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: 25 + angle: 20 } ) menuItemsInitialValues.push( @@ -745,7 +732,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: 45 + angle: 40 } ) menuItemsInitialValues.push( @@ -759,7 +746,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: 80 + angle: 70 } ) break From 5a13d18ea03cc3e8db2bd2db9c886fec4af0f9c4 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Fri, 1 Nov 2019 13:15:01 +0100 Subject: [PATCH 66/95] Bug Fixes with status report detach --- .../Workspace/FunctionLibraries/ChainAttachDetach.js | 8 ++++---- FloatingSpace/UiObjectConstructor.js | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/DesignerSpace/Workspace/FunctionLibraries/ChainAttachDetach.js b/DesignerSpace/Workspace/FunctionLibraries/ChainAttachDetach.js index 59dd1a884..97445261d 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/ChainAttachDetach.js +++ b/DesignerSpace/Workspace/FunctionLibraries/ChainAttachDetach.js @@ -62,12 +62,12 @@ function newChainAttachDetach () { return } case 'Status Report': { - node.payload.parentNode.calculations = undefined + node.payload.parentNode.statusReport = undefined completeDetachment(node, rootNodes) return } case 'Execution Finished Event': { - node.payload.parentNode.calculations = undefined + node.payload.parentNode.executionFinishedEvent = undefined completeDetachment(node, rootNodes) return } @@ -570,14 +570,14 @@ function newChainAttachDetach () { case 'Status Report': { node.payload.parentNode = attachToNode node.payload.chainParent = attachToNode - node.payload.parentNode.calculations = node + node.payload.parentNode.statusReport = node completeAttachment(node, rootNodes) } break case 'Execution Finished Event': { node.payload.parentNode = attachToNode node.payload.chainParent = attachToNode - node.payload.parentNode.calculations = node + node.payload.parentNode.executionFinishedEvent = node completeAttachment(node, rootNodes) } break diff --git a/FloatingSpace/UiObjectConstructor.js b/FloatingSpace/UiObjectConstructor.js index a6a932beb..f3453c4e6 100644 --- a/FloatingSpace/UiObjectConstructor.js +++ b/FloatingSpace/UiObjectConstructor.js @@ -766,7 +766,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: -10 + angle: -15 } ) menuItemsInitialValues.push( @@ -780,7 +780,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: 10 + angle: 15 } ) break @@ -800,7 +800,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: -10 + angle: -15 } ) menuItemsInitialValues.push( @@ -814,7 +814,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: 10 + angle: 15 } ) break From 4d6a24590780f78158baf968ec9db6d744c2635c Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Fri, 1 Nov 2019 13:46:54 +0100 Subject: [PATCH 67/95] 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 } From 50bd3098268a6d64eb0dde5e7f37a803c91d6b0a Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Fri, 1 Nov 2019 14:04:35 +0100 Subject: [PATCH 68/95] Execution Started Event part 1 --- .../FunctionLibraries/ChainAttachDetach.js | 11 ++++++ .../FunctionLibraries/NodeChildren.js | 12 ++++++ .../FunctionLibraries/NodeDeleter.js | 21 ++++++++++ .../Workspace/FunctionLibraries/OnFocus.js | 7 ++++ .../FunctionLibraries/ProtocolNode.js | 14 +++++++ .../FunctionLibraries/UiObjectsFromNodes.js | 16 ++++++++ DesignerSpace/Workspace/Workspace.js | 9 +++++ FloatingSpace/UiObject.js | 6 ++- FloatingSpace/UiObjectConstructor.js | 38 +++++++++++++++++++ Spaces/DesignerSpace.js | 1 + 10 files changed, 134 insertions(+), 1 deletion(-) diff --git a/DesignerSpace/Workspace/FunctionLibraries/ChainAttachDetach.js b/DesignerSpace/Workspace/FunctionLibraries/ChainAttachDetach.js index 97445261d..c9547d6a0 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/ChainAttachDetach.js +++ b/DesignerSpace/Workspace/FunctionLibraries/ChainAttachDetach.js @@ -66,6 +66,11 @@ function newChainAttachDetach () { completeDetachment(node, rootNodes) return } + case 'Execution Started Event': { + node.payload.parentNode.executionStartedEvent = undefined + completeDetachment(node, rootNodes) + return + } case 'Execution Finished Event': { node.payload.parentNode.executionFinishedEvent = undefined completeDetachment(node, rootNodes) @@ -574,6 +579,12 @@ function newChainAttachDetach () { completeAttachment(node, rootNodes) } break + case 'Execution Started Event': { + node.payload.parentNode = attachToNode + node.payload.chainParent = attachToNode + node.payload.parentNode.executionStartedEvent = node + completeAttachment(node, rootNodes) + } case 'Execution Finished Event': { node.payload.parentNode = attachToNode node.payload.chainParent = attachToNode diff --git a/DesignerSpace/Workspace/FunctionLibraries/NodeChildren.js b/DesignerSpace/Workspace/FunctionLibraries/NodeChildren.js index 9346f5ff3..cc67770d1 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/NodeChildren.js +++ b/DesignerSpace/Workspace/FunctionLibraries/NodeChildren.js @@ -32,6 +32,9 @@ function newNodeChildren () { case 'Status Rerport': { return countChildrenStatusRerport(parentNode, childNode) } + case 'Execution Started Event': { + return countChildrenExecutionStartedEvent(parentNode, childNode) + } case 'Execution Finished Event': { return countChildrenExecutionFinishedEvent(parentNode, childNode) } @@ -454,6 +457,14 @@ function newNodeChildren () { return response } + function countChildrenExecutionStartedEvent (parentNode, childNode) { + let response = { + childrenCount: 0, + childIndex: undefined + } + return response + } + function countChildrenExecutionFinishedEvent (parentNode, childNode) { let response = { childrenCount: 0, @@ -461,6 +472,7 @@ function newNodeChildren () { } return response } + function countChildrenCalculationsProcedure (parentNode, childNode) { let response = { childrenCount: 0, diff --git a/DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js b/DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js index 0edf7cb0c..b953bacec 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js +++ b/DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js @@ -9,6 +9,7 @@ function newNodeDeleter () { deleteTradingBot: deleteTradingBot, deleteProcessDefinition: deleteProcessDefinition, deleteStatusReport: deleteStatusReport, + deleteExecutionStartedEvent: deleteExecutionStartedEvent, deleteExecutionFinishedEvent: deleteExecutionFinishedEvent, deleteCalculationsProcedure: deleteCalculationsProcedure, deleteDataBuildingProcedure: deleteDataBuildingProcedure, @@ -118,6 +119,10 @@ function newNodeDeleter () { deleteStatusReport(rootNode, rootNodes) break } + case 'Execution Started Event': { + deleteExecutionStartedEvent(rootNode, rootNodes) + break + } case 'Execution Finished Event': { deleteExecutionFinishedEvent(rootNode, rootNodes) break @@ -565,6 +570,10 @@ function newNodeDeleter () { deleteStatusReport(node.statusReport, rootNodes) } + if (node.executionStartedEvent !== undefined) { + deleteExecutionStartedEvent(node.executionStartedEvent, rootNodes) + } + if (node.executionFinishedEvent !== undefined) { deleteExecutionFinishedEvent(node.executionFinishedEvent, rootNodes) } @@ -612,6 +621,18 @@ function newNodeDeleter () { cleanNode(node) } + function deleteExecutionStartedEvent (node, rootNodes) { + let payload = node.payload + + if (payload.parentNode !== undefined) { + payload.parentNode.executionStartedEvent = undefined + } + + completeDeletion(node, rootNodes) + destroyUiObject(node) + cleanNode(node) + } + function deleteExecutionFinishedEvent (node, rootNodes) { let payload = node.payload diff --git a/DesignerSpace/Workspace/FunctionLibraries/OnFocus.js b/DesignerSpace/Workspace/FunctionLibraries/OnFocus.js index 38801b894..c5a708b00 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/OnFocus.js +++ b/DesignerSpace/Workspace/FunctionLibraries/OnFocus.js @@ -871,6 +871,13 @@ function newOnFocus () { return } } + case 'Execution Started Event': { + if (node.payload.uiObject.isOnFocus === true) { + return node + } else { + return + } + } case 'Execution Finished Event': { if (node.payload.uiObject.isOnFocus === true) { return node diff --git a/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js b/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js index 2af5c36e2..099fd9f5b 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js +++ b/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js @@ -1225,6 +1225,20 @@ function newProtocolNode () { } return object } + case 'Execution Started Event': { + let object = { + type: node.type, + subType: node.subType, + name: node.name + } + if (includeIds) { + object.id = node.id + } + if (includePayload) { + object.savedPayload = getSavedPayload(node, includeReferences) + } + return object + } case 'Execution Finished Event': { let object = { type: node.type, diff --git a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js index 74e7fe291..ebdb03990 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js +++ b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js @@ -9,6 +9,7 @@ function newUiObjectsFromNodes () { addProcessDefinition: addProcessDefinition, addMissingProcessDefinitionItems: addMissingProcessDefinitionItems, addStatusReport: addStatusReport, + addExecutionStartedEvent: addExecutionStartedEvent, addExecutionFinishedEvent: addExecutionFinishedEvent, addCalculationsProcedure: addCalculationsProcedure, addDataBuildingProcedure: addDataBuildingProcedure, @@ -791,6 +792,10 @@ function newUiObjectsFromNodes () { } return } + case 'Execution Started Event': { + createUiObject(node.type, node.name, node, parentNode, chainParent, node.type) + return + } case 'Execution Finished Event': { let referenceChildren if (mapOfReferenceParents !== undefined) { @@ -1071,6 +1076,17 @@ function newUiObjectsFromNodes () { return node.statusReport } + function addExecutionStartedEvent (node) { + if (node.executionStartedEvent === undefined) { + node.executionStartedEvent = { + type: 'Execution Started Event', + name: 'New Execution Started Event' + } + createUiObject(node.executionStartedEvent.type, node.executionStartedEvent.name, node.executionStartedEvent, node, node) + } + return node.executionStartedEvent + } + function addExecutionFinishedEvent (node) { if (node.executionFinishedEvent === undefined) { node.executionFinishedEvent = { diff --git a/DesignerSpace/Workspace/Workspace.js b/DesignerSpace/Workspace/Workspace.js index fd37e0cac..1783221ed 100644 --- a/DesignerSpace/Workspace/Workspace.js +++ b/DesignerSpace/Workspace/Workspace.js @@ -351,6 +351,11 @@ function newWorkspace () { functionLibraryUiObjectsFromNodes.addStatusReport(payload.node) } break + case 'Add Execution Started Event': + { + functionLibraryUiObjectsFromNodes.addExecutionStartedEvent(payload.node) + } + break case 'Add Execution Finished Event': { functionLibraryUiObjectsFromNodes.addExecutionFinishedEvent(payload.node) @@ -635,6 +640,10 @@ function newWorkspace () { functionLibraryNodeDeleter.deleteStatusReport(payload.node, thisObject.workspaceNode.rootNodes) break } + case 'Delete Execution Started Event': { + functionLibraryNodeDeleter.deleteExecutionStartedEvent(payload.node, thisObject.workspaceNode.rootNodes) + break + } case 'Delete Execution Finished Event': { functionLibraryNodeDeleter.deleteExecutionFinishedEvent(payload.node, thisObject.workspaceNode.rootNodes) break diff --git a/FloatingSpace/UiObject.js b/FloatingSpace/UiObject.js index b4b136a09..de7f7eaf0 100644 --- a/FloatingSpace/UiObject.js +++ b/FloatingSpace/UiObject.js @@ -232,6 +232,10 @@ function newUiObject () { compatibleType = '->' + 'Process Definition' + '->' compatibleSubType = undefined break + case 'Execution Started Event': + compatibleType = '->' + 'Process Definition' + '->' + compatibleSubType = undefined + break case 'Execution Finished Event': compatibleType = '->' + 'Process Definition' + '->' compatibleSubType = undefined @@ -512,7 +516,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 Started 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 } diff --git a/FloatingSpace/UiObjectConstructor.js b/FloatingSpace/UiObjectConstructor.js index f3453c4e6..2898afc2f 100644 --- a/FloatingSpace/UiObjectConstructor.js +++ b/FloatingSpace/UiObjectConstructor.js @@ -785,6 +785,40 @@ function newUiObjectConstructor () { ) break } + case 'Execution Started Event': { + addLeftIcons(menuItemsInitialValues, floatingObject) + menuItemsInitialValues.push( + { + action: 'Delete Execution Started Event', + askConfirmation: true, + confirmationLabel: 'Confirm to Delete', + actionFunction: payload.onMenuItemClick, + label: 'Delete Event', + visible: true, + iconPathOn: 'delete', + iconPathOff: 'delete', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: -15 + } + ) + menuItemsInitialValues.push( + { + action: 'Share', + actionFunction: payload.onMenuItemClick, + label: 'Share', + visible: true, + iconPathOn: 'menu-share', + iconPathOff: 'menu-share', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: 15 + } + ) + break + } case 'Execution Finished Event': { addLeftIcons(menuItemsInitialValues, floatingObject) menuItemsInitialValues.push( @@ -4461,6 +4495,10 @@ function newUiObjectConstructor () { level_3() break } + case 'Execution Started Event': { + level_3() + break + } case 'Execution Finished Event': { level_3() break diff --git a/Spaces/DesignerSpace.js b/Spaces/DesignerSpace.js index cae19bd1f..f5142e240 100644 --- a/Spaces/DesignerSpace.js +++ b/Spaces/DesignerSpace.js @@ -96,6 +96,7 @@ function newDesignerSpace () { ['Trading Bot', 'bot-trading'], ['Process Definition', 'process-definition'], ['Status Report', 'text'], + ['Execution Started Event', 'pantone'], ['Execution Finished Event', 'pantone'], ['Calculations Procedure', 'calculations-procedure'], ['Data Building Procedure', 'data-building-procedure'], From b6cd883598de927f18c690a56c62d44e89402b54 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Fri, 1 Nov 2019 14:12:37 +0100 Subject: [PATCH 69/95] Execution Started Event part 2 --- DesignerSpace/Workspace/FunctionLibraries/NodeChildren.js | 6 ++++++ DesignerSpace/Workspace/FunctionLibraries/OnFocus.js | 4 ++++ DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js | 1 + DesignerSpace/Workspace/FunctionLibraries/ShortcutKeys.js | 4 ++++ .../Workspace/FunctionLibraries/UiObjectsFromNodes.js | 4 ++++ 5 files changed, 19 insertions(+) diff --git a/DesignerSpace/Workspace/FunctionLibraries/NodeChildren.js b/DesignerSpace/Workspace/FunctionLibraries/NodeChildren.js index cc67770d1..215e30551 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/NodeChildren.js +++ b/DesignerSpace/Workspace/FunctionLibraries/NodeChildren.js @@ -400,6 +400,12 @@ function newNodeChildren () { response.childIndex = response.childrenCount } } + if (parentNode.executionStartedEvent !== undefined) { + response.childrenCount++ + if (parentNode.executionStartedEvent.id === childNode.id) { + response.childIndex = response.childrenCount + } + } if (parentNode.executionFinishedEvent !== undefined) { response.childrenCount++ if (parentNode.executionFinishedEvent.id === childNode.id) { diff --git a/DesignerSpace/Workspace/FunctionLibraries/OnFocus.js b/DesignerSpace/Workspace/FunctionLibraries/OnFocus.js index c5a708b00..faa814eff 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/OnFocus.js +++ b/DesignerSpace/Workspace/FunctionLibraries/OnFocus.js @@ -828,6 +828,10 @@ function newOnFocus () { if (child !== undefined) { return child } + child = getNodeThatIsOnFocus(node.executionStartedEvent) + if (child !== undefined) { + return child + } child = getNodeThatIsOnFocus(node.executionFinishedEvent) if (child !== undefined) { return child diff --git a/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js b/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js index 099fd9f5b..09ff5f75a 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js +++ b/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js @@ -1172,6 +1172,7 @@ function newProtocolNode () { name: node.name, code: node.code, statusReport: getProtocolNode(node.statusReport, removePersonalData, parseCode, includeIds, includePayload, includeReferences), + executionStartedEvent: getProtocolNode(node.executionStartedEvent, removePersonalData, parseCode, includeIds, includePayload, includeReferences), executionFinishedEvent: getProtocolNode(node.executionFinishedEvent, removePersonalData, parseCode, includeIds, includePayload, includeReferences), calculations: getProtocolNode(node.calculations, removePersonalData, parseCode, includeIds, includePayload, includeReferences), dataBuilding: getProtocolNode(node.dataBuilding, removePersonalData, parseCode, includeIds, includePayload, includeReferences), diff --git a/DesignerSpace/Workspace/FunctionLibraries/ShortcutKeys.js b/DesignerSpace/Workspace/FunctionLibraries/ShortcutKeys.js index 725aa3407..e9fed8d1e 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/ShortcutKeys.js +++ b/DesignerSpace/Workspace/FunctionLibraries/ShortcutKeys.js @@ -812,6 +812,10 @@ function newShortcutKeys () { if (child !== undefined) { return child } + child = getNodeByShortcutKey(node.executionStartedEvent, searchingKey) + if (child !== undefined) { + return child + } child = getNodeByShortcutKey(node.executionFinishedEvent, searchingKey) if (child !== undefined) { return child diff --git a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js index ebdb03990..52bc86fb5 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js +++ b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js @@ -752,6 +752,9 @@ function newUiObjectsFromNodes () { if (node.statusReport !== undefined) { createUiObjectFromNode(node.statusReport, node, node) } + if (node.executionStartedEvent !== undefined) { + createUiObjectFromNode(node.executionStartedEvent, node, node) + } if (node.executionFinishedEvent !== undefined) { createUiObjectFromNode(node.executionFinishedEvent, node, node) } @@ -1059,6 +1062,7 @@ function newUiObjectsFromNodes () { function addMissingProcessDefinitionItems (node) { addStatusReport(node) + addExecutionStartedEvent(node) addExecutionFinishedEvent(node) addCalculationsProcedure(node) addDataBuildingProcedure(node) From 58eab44f03bb31745758b07883d96eba70716658 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Fri, 1 Nov 2019 14:54:06 +0100 Subject: [PATCH 70/95] Execution Started Event finished --- .../FunctionLibraries/UiObjectsFromNodes.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js index 52bc86fb5..941bbd48c 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js +++ b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js @@ -796,7 +796,21 @@ function newUiObjectsFromNodes () { return } case 'Execution Started Event': { + 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 'Execution Finished Event': { From 5c3b669150167095fe8a34d873ec448f00cef787 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 5 Nov 2019 16:27:47 +0100 Subject: [PATCH 71/95] Process Instance with reference Parent --- Canvas.js | 7 +++ .../ReferenceAttachDetach.js | 8 ++++ .../FunctionLibraries/UiObjectsFromNodes.js | 30 ++++++++++++- FloatingSpace/UiObject.js | 45 ++++++++++++++++--- 4 files changed, 84 insertions(+), 6 deletions(-) diff --git a/Canvas.js b/Canvas.js index 329e35234..44ddd57f4 100644 --- a/Canvas.js +++ b/Canvas.js @@ -204,6 +204,13 @@ function newCanvas () { } } + if ((event.ctrlKey === true || event.metaKey === true) && event.altKey === true) { // Dev Tool + if (nodeOnFocus !== undefined) { + console.log(nodeOnFocus) + } + return + } + if (event.altKey === true && event.code === 'ArrowUp') { thisObject.cockpitSpace.toTop() return diff --git a/DesignerSpace/Workspace/FunctionLibraries/ReferenceAttachDetach.js b/DesignerSpace/Workspace/FunctionLibraries/ReferenceAttachDetach.js index 3d970bfe9..0b5099aff 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/ReferenceAttachDetach.js +++ b/DesignerSpace/Workspace/FunctionLibraries/ReferenceAttachDetach.js @@ -40,6 +40,10 @@ function newReferenceAttachDetach () { completeDetachment(node) return } + case 'Process Instance': { + completeDetachment(node) + return + } } } @@ -77,6 +81,10 @@ function newReferenceAttachDetach () { completeAttachment(node, attachToNode) } break + case 'Process Instance': { + completeAttachment(node, attachToNode) + } + break } } diff --git a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js index 941bbd48c..3c1a77195 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js +++ b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js @@ -560,6 +560,15 @@ function newUiObjectsFromNodes () { return } case 'Process Instance': { + 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 + } + } + } if (parentNode !== undefined) { switch (parentNode.type) { case 'Sensor Bot Instance': { @@ -580,6 +589,11 @@ function newUiObjectsFromNodes () { if (node.session !== undefined) { createUiObjectFromNode(node.session, node, node) } + if (referenceParent !== undefined) { + node.savedPayload = { + referenceParent: referenceParent + } + } return } case 'Backtesting Session': { @@ -748,6 +762,14 @@ function newUiObjectsFromNodes () { return } case 'Process Definition': { + 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 (node.statusReport !== undefined) { createUiObjectFromNode(node.statusReport, node, node) @@ -776,6 +798,11 @@ function newUiObjectsFromNodes () { let dataDependency = node.dataDependencies[m] createUiObjectFromNode(dataDependency, node, node) } + if (referenceChildren !== undefined) { + node.savedPayload = { + referenceChildren: referenceChildren + } + } return } case 'Status Report': { @@ -1063,7 +1090,8 @@ function newUiObjectsFromNodes () { code: '{}', outputDatasets: [], statusDependencies: [], - dataDependencies: [] + dataDependencies: [], + referenceChildren: [] } if (node.processes === undefined) { node.processes = [] diff --git a/FloatingSpace/UiObject.js b/FloatingSpace/UiObject.js index de7f7eaf0..26b89fa80 100644 --- a/FloatingSpace/UiObject.js +++ b/FloatingSpace/UiObject.js @@ -699,6 +699,10 @@ function newUiObject () { compatibleType = '->' + 'Execution Finished Event' + '->' compatibleSubType = undefined break + case 'Process Instance': + compatibleType = '->' + 'Process Definition' + '->' + compatibleSubType = undefined + break default: return } @@ -1047,7 +1051,16 @@ function newUiObject () { browserCanvasContext.moveTo(position.x, position.y) browserCanvasContext.lineTo(targetPoint.x, targetPoint.y) browserCanvasContext.strokeStyle = 'rgba(' + LINE_STYLE + ', 1)' - browserCanvasContext.setLineDash([3, 4]) + browserCanvasContext.setLineDash([3, 47]) + browserCanvasContext.lineWidth = 4 + browserCanvasContext.stroke() + browserCanvasContext.setLineDash([0, 0]) + + browserCanvasContext.beginPath() + browserCanvasContext.moveTo(position.x, position.y) + browserCanvasContext.lineTo(targetPoint.x, targetPoint.y) + browserCanvasContext.strokeStyle = 'rgba(' + LINE_STYLE + ', 1)' + browserCanvasContext.setLineDash([1, 9]) browserCanvasContext.lineWidth = 2 browserCanvasContext.stroke() browserCanvasContext.setLineDash([0, 0]) @@ -1082,17 +1095,26 @@ function newUiObject () { targetPoint = canvas.floatingSpace.container.frame.frameThisPoint(targetPoint) position = thisObject.container.frame.frameThisPoint(position) + let LINE_STYLE = UI_COLOR.GREY + if (thisObject.container.frame.radius > 1) { /* Target Line */ - let LINE_STYLE = UI_COLOR.GREY - browserCanvasContext.beginPath() browserCanvasContext.moveTo(position.x, position.y) browserCanvasContext.lineTo(targetPoint.x, targetPoint.y) browserCanvasContext.strokeStyle = 'rgba(' + LINE_STYLE + ', 1)' - browserCanvasContext.setLineDash([2, 20]) - browserCanvasContext.lineWidth = 2 + browserCanvasContext.setLineDash([1, 9]) + browserCanvasContext.lineWidth = 1 + browserCanvasContext.stroke() + browserCanvasContext.setLineDash([0, 0]) + + browserCanvasContext.beginPath() + browserCanvasContext.moveTo(position.x, position.y) + browserCanvasContext.lineTo(targetPoint.x, targetPoint.y) + browserCanvasContext.strokeStyle = 'rgba(' + LINE_STYLE + ', 1)' + browserCanvasContext.setLineDash([1, 9, 2, 8, 3, 7, 4, 6, 5, 5, 0, 100]) + browserCanvasContext.lineWidth = 4 browserCanvasContext.stroke() browserCanvasContext.setLineDash([0, 0]) } @@ -1108,6 +1130,18 @@ function newUiObject () { browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.WHITE + ', 1)' browserCanvasContext.fill() } +/* + let VISIBLE_RADIUS = thisObject.container.frame.radius * 1 + + browserCanvasContext.beginPath() + browserCanvasContext.arc(position.x, position.y, VISIBLE_RADIUS, 0, Math.PI * 2, true) + browserCanvasContext.closePath() + browserCanvasContext.strokeStyle = 'rgba(' + LINE_STYLE + ', 1)' + browserCanvasContext.lineWidth = 2 + browserCanvasContext.setLineDash([2, 20]) + browserCanvasContext.stroke() + browserCanvasContext.setLineDash([0, 0]) +*/ } function drawText () { @@ -1477,3 +1511,4 @@ function newUiObject () { } } } + From fca540dd9959633ddb6cfa736e03e69708d7e10e Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 5 Nov 2019 17:31:14 +0100 Subject: [PATCH 72/95] Aesthetics Improvements --- FloatingSpace/UiObject.js | 96 ++++++++++++++++++++++++++------------- 1 file changed, 65 insertions(+), 31 deletions(-) diff --git a/FloatingSpace/UiObject.js b/FloatingSpace/UiObject.js index 26b89fa80..e5e78b006 100644 --- a/FloatingSpace/UiObject.js +++ b/FloatingSpace/UiObject.js @@ -1130,18 +1130,6 @@ function newUiObject () { browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.WHITE + ', 1)' browserCanvasContext.fill() } -/* - let VISIBLE_RADIUS = thisObject.container.frame.radius * 1 - - browserCanvasContext.beginPath() - browserCanvasContext.arc(position.x, position.y, VISIBLE_RADIUS, 0, Math.PI * 2, true) - browserCanvasContext.closePath() - browserCanvasContext.strokeStyle = 'rgba(' + LINE_STYLE + ', 1)' - browserCanvasContext.lineWidth = 2 - browserCanvasContext.setLineDash([2, 20]) - browserCanvasContext.stroke() - browserCanvasContext.setLineDash([0, 0]) -*/ } function drawText () { @@ -1369,11 +1357,17 @@ function newUiObject () { browserCanvasContext.beginPath() browserCanvasContext.arc(visiblePosition.x, visiblePosition.y, VISIBLE_RADIUS, 0, Math.PI * 2, true) browserCanvasContext.closePath() - browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.LIGHT_GREY + ', ' + OPACITY + ')' - browserCanvasContext.lineWidth = 10 - browserCanvasContext.setLineDash([4, 20]) + browserCanvasContext.setLineDash([4, 16]) + browserCanvasContext.stroke() + + browserCanvasContext.beginPath() + browserCanvasContext.arc(visiblePosition.x, visiblePosition.y, VISIBLE_RADIUS, 0, Math.PI * 2, true) + browserCanvasContext.closePath() + browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.LIGHT_GREY + ', ' + OPACITY + ')' + browserCanvasContext.lineWidth = 1 + browserCanvasContext.setLineDash([20, 20]) browserCanvasContext.stroke() } @@ -1419,62 +1413,102 @@ function newUiObject () { } if (isReadyToChainAttach === true) { - VISIBLE_RADIUS = thisObject.container.frame.radius * 2 + readyToChainAttachDisplayCounter * 2 + VISIBLE_RADIUS = thisObject.container.frame.radius * 2.5 + readyToChainAttachDisplayCounter - readyToChainAttachDisplayCounter / 2 let OPACITY = readyToChainAttachCounter / 10 browserCanvasContext.beginPath() browserCanvasContext.arc(visiblePosition.x, visiblePosition.y, VISIBLE_RADIUS, 0, Math.PI * 2, true) browserCanvasContext.closePath() - browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.TITANIUM_YELLOW + ', ' + OPACITY + ')' - browserCanvasContext.lineWidth = 10 - browserCanvasContext.setLineDash([readyToChainAttachDisplayCounter, readyToChainAttachDisplayCounter * 2]) + browserCanvasContext.setLineDash([10, 90]) + browserCanvasContext.stroke() + + browserCanvasContext.beginPath() + browserCanvasContext.arc(visiblePosition.x, visiblePosition.y, VISIBLE_RADIUS, 0, Math.PI * 2, true) + browserCanvasContext.closePath() + browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.TITANIUM_YELLOW + ', ' + OPACITY + ')' + browserCanvasContext.lineWidth = 5 + browserCanvasContext.setLineDash([5, 45]) + browserCanvasContext.stroke() + + browserCanvasContext.beginPath() + browserCanvasContext.arc(visiblePosition.x, visiblePosition.y, VISIBLE_RADIUS, 0, Math.PI * 2, true) + browserCanvasContext.closePath() + browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.TITANIUM_YELLOW + ', ' + OPACITY + ')' + browserCanvasContext.lineWidth = 1 + browserCanvasContext.setLineDash([2, 8]) browserCanvasContext.stroke() } if (isAvailableToChainAttach === true && isReadyToChainAttach === false) { - VISIBLE_RADIUS = thisObject.container.frame.radius * 1.5 + VISIBLE_RADIUS = thisObject.container.frame.radius * 2.5 let OPACITY = availableToChainAttachCounter / 10 browserCanvasContext.beginPath() browserCanvasContext.arc(visiblePosition.x, visiblePosition.y, VISIBLE_RADIUS, 0, Math.PI * 2, true) browserCanvasContext.closePath() - browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.TURQUOISE + ', ' + OPACITY + ')' - browserCanvasContext.lineWidth = 10 - browserCanvasContext.setLineDash([8, 20]) + browserCanvasContext.setLineDash([8, 32]) + browserCanvasContext.stroke() + + browserCanvasContext.beginPath() + browserCanvasContext.arc(visiblePosition.x, visiblePosition.y, VISIBLE_RADIUS, 0, Math.PI * 2, true) + browserCanvasContext.closePath() + browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.TURQUOISE + ', ' + OPACITY + ')' + browserCanvasContext.lineWidth = 2 + browserCanvasContext.setLineDash([3, 5]) browserCanvasContext.stroke() } if (isReadyToReferenceAttach === true) { - VISIBLE_RADIUS = thisObject.container.frame.radius * 2 + readyToReferenceAttachDisplayCounter * 2 + VISIBLE_RADIUS = thisObject.container.frame.radius * 2.5 + readyToReferenceAttachDisplayCounter - readyToReferenceAttachDisplayCounter / 2 let OPACITY = readyToReferenceAttachCounter / 10 browserCanvasContext.beginPath() browserCanvasContext.arc(visiblePosition.x, visiblePosition.y, VISIBLE_RADIUS, 0, Math.PI * 2, true) browserCanvasContext.closePath() - browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.LIGHT_GREY + ', ' + OPACITY + ')' - browserCanvasContext.lineWidth = 10 - browserCanvasContext.setLineDash([readyToReferenceAttachDisplayCounter, readyToReferenceAttachDisplayCounter * 2]) + browserCanvasContext.setLineDash([10, 90]) + browserCanvasContext.stroke() + + browserCanvasContext.beginPath() + browserCanvasContext.arc(visiblePosition.x, visiblePosition.y, VISIBLE_RADIUS, 0, Math.PI * 2, true) + browserCanvasContext.closePath() + browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.LIGHT_GREY + ', ' + OPACITY + ')' + browserCanvasContext.lineWidth = 5 + browserCanvasContext.setLineDash([5, 45]) + browserCanvasContext.stroke() + + browserCanvasContext.beginPath() + browserCanvasContext.arc(visiblePosition.x, visiblePosition.y, VISIBLE_RADIUS, 0, Math.PI * 2, true) + browserCanvasContext.closePath() + browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.LIGHT_GREY + ', ' + OPACITY + ')' + browserCanvasContext.lineWidth = 1 + browserCanvasContext.setLineDash([2, 8]) browserCanvasContext.stroke() } if (isAvailableToReferenceAttach === true && isReadyToReferenceAttach === false) { - VISIBLE_RADIUS = thisObject.container.frame.radius * 1.5 + VISIBLE_RADIUS = thisObject.container.frame.radius * 2.5 let OPACITY = availableToReferenceAttachCounter / 10 browserCanvasContext.beginPath() browserCanvasContext.arc(visiblePosition.x, visiblePosition.y, VISIBLE_RADIUS, 0, Math.PI * 2, true) browserCanvasContext.closePath() - browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.GREY + ', ' + OPACITY + ')' - browserCanvasContext.lineWidth = 10 - browserCanvasContext.setLineDash([8, 20]) + browserCanvasContext.setLineDash([8, 32]) + browserCanvasContext.stroke() + + browserCanvasContext.beginPath() + browserCanvasContext.arc(visiblePosition.x, visiblePosition.y, VISIBLE_RADIUS, 0, Math.PI * 2, true) + browserCanvasContext.closePath() + browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.GREY + ', ' + OPACITY + ')' + browserCanvasContext.lineWidth = 2 + browserCanvasContext.setLineDash([3, 5]) browserCanvasContext.stroke() } } From 8950614232e367df85d7803371fa128a75fc8603 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 6 Nov 2019 09:24:56 +0100 Subject: [PATCH 73/95] Hiding reference lines pointing to collapsed parents --- FloatingSpace/UiObject.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FloatingSpace/UiObject.js b/FloatingSpace/UiObject.js index e5e78b006..eae98c25e 100644 --- a/FloatingSpace/UiObject.js +++ b/FloatingSpace/UiObject.js @@ -1081,6 +1081,7 @@ function newUiObject () { function drawReferenceLine () { if (thisObject.payload.referenceParent === undefined) { return } + if (thisObject.payload.referenceParent.payload.floatingObject.isParentCollapsed === true) { return } let targetPoint = { x: thisObject.payload.referenceParent.payload.position.x, @@ -1545,4 +1546,3 @@ function newUiObject () { } } } - From 1cc06a28eb7697938c34f014bc6158b9a5e28649 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 6 Nov 2019 10:46:28 +0100 Subject: [PATCH 74/95] Procees Output and Process Dependencies Implemented --- .../FunctionLibraries/ChainAttachDetach.js | 24 +++ .../FunctionLibraries/NodeChildren.js | 33 ++++ .../FunctionLibraries/NodeDeleter.js | 32 ++++ .../Workspace/FunctionLibraries/OnFocus.js | 24 +++ .../FunctionLibraries/ProtocolNode.js | 38 +++- .../FunctionLibraries/ShortcutKeys.js | 24 +++ .../FunctionLibraries/UiObjectsFromNodes.js | 56 +++++- DesignerSpace/Workspace/Workspace.js | 18 ++ FloatingSpace/UiObject.js | 14 +- FloatingSpace/UiObjectConstructor.js | 164 +++++++++++++----- Spaces/DesignerSpace.js | 2 + 11 files changed, 370 insertions(+), 59 deletions(-) diff --git a/DesignerSpace/Workspace/FunctionLibraries/ChainAttachDetach.js b/DesignerSpace/Workspace/FunctionLibraries/ChainAttachDetach.js index c9547d6a0..9e19ae313 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/ChainAttachDetach.js +++ b/DesignerSpace/Workspace/FunctionLibraries/ChainAttachDetach.js @@ -61,6 +61,16 @@ function newChainAttachDetach () { completeDetachment(node, rootNodes) return } + case 'Process Output': { + node.payload.parentNode.processOutput = undefined + completeDetachment(node, rootNodes) + return + } + case 'Process Dependencies': { + node.payload.parentNode.processDependencies = undefined + completeDetachment(node, rootNodes) + return + } case 'Status Report': { node.payload.parentNode.statusReport = undefined completeDetachment(node, rootNodes) @@ -572,6 +582,20 @@ function newChainAttachDetach () { completeAttachment(node, rootNodes) } break + case 'Process Output': { + node.payload.parentNode = attachToNode + node.payload.chainParent = attachToNode + node.payload.parentNode.processOutput = node + completeAttachment(node, rootNodes) + } + break + case 'Process Dependencies': { + node.payload.parentNode = attachToNode + node.payload.chainParent = attachToNode + node.payload.parentNode.processDependencies = node + completeAttachment(node, rootNodes) + } + break case 'Status Report': { node.payload.parentNode = attachToNode node.payload.chainParent = attachToNode diff --git a/DesignerSpace/Workspace/FunctionLibraries/NodeChildren.js b/DesignerSpace/Workspace/FunctionLibraries/NodeChildren.js index 215e30551..ff6490334 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/NodeChildren.js +++ b/DesignerSpace/Workspace/FunctionLibraries/NodeChildren.js @@ -29,6 +29,12 @@ function newNodeChildren () { case 'Process Definition': { return countChildrenProcessDefinition(parentNode, childNode) } + case 'Process Output': { + return countChildrenProcessOutput(parentNode, childNode) + } + case 'Process Dependencies': { + return countChildrenProcessDependencies(parentNode, childNode) + } case 'Status Rerport': { return countChildrenStatusRerport(parentNode, childNode) } @@ -394,6 +400,18 @@ function newNodeChildren () { childrenCount: 0, childIndex: undefined } + if (parentNode.processOutput !== undefined) { + response.childrenCount++ + if (parentNode.processOutput.id === childNode.id) { + response.childIndex = response.childrenCount + } + } + if (parentNode.processDependencies !== undefined) { + response.childrenCount++ + if (parentNode.processDependencies.id === childNode.id) { + response.childIndex = response.childrenCount + } + } if (parentNode.statusReport !== undefined) { response.childrenCount++ if (parentNode.statusReport.id === childNode.id) { @@ -424,7 +442,14 @@ function newNodeChildren () { response.childIndex = response.childrenCount } } + return response + } + function countChildrenProcessOutput (parentNode, childNode) { + let response = { + childrenCount: 0, + childIndex: undefined + } if (parentNode.outputDatasets !== undefined) { for (let i = 0; i < parentNode.outputDatasets.length; i++) { let child = parentNode.outputDatasets[i] @@ -434,6 +459,14 @@ function newNodeChildren () { } } } + return response + } + + function countChildrenProcessDependencies (parentNode, childNode) { + let response = { + childrenCount: 0, + childIndex: undefined + } if (parentNode.statusDependencies !== undefined) { for (let i = 0; i < parentNode.statusDependencies.length; i++) { let child = parentNode.statusDependencies[i] diff --git a/DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js b/DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js index b953bacec..fa18dc0c9 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js +++ b/DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js @@ -115,6 +115,14 @@ function newNodeDeleter () { deleteProcessDefinition(rootNode, rootNodes) break } + case 'Process Output': { + deleteProcessOutput(rootNode, rootNodes) + break + } + case 'Process Dependencies': { + deleteProcessDependencies(rootNode, rootNodes) + break + } case 'Status Report': { deleteStatusReport(rootNode, rootNodes) break @@ -566,6 +574,14 @@ function newNodeDeleter () { } } + if (node.processOutput !== undefined) { + deleteProcessOutput(node.processOutput, rootNodes) + } + + if (node.processDependencies !== undefined) { + deleteProcessDependencies(node.processDependencies, rootNodes) + } + if (node.statusReport !== undefined) { deleteStatusReport(node.statusReport, rootNodes) } @@ -586,12 +602,28 @@ function newNodeDeleter () { deleteDataBuildingProcedure(node.dataBuilding, rootNodes) } + completeDeletion(node, rootNodes) + destroyUiObject(node) + cleanNode(node) + } + + function deleteProcessOutput (node, rootNodes) { + let payload = node.payload + if (node.outputDatasets !== undefined) { while (node.outputDatasets.length > 0) { deleteOutputDataset(node.outputDatasets[0], rootNodes) } } + completeDeletion(node, rootNodes) + destroyUiObject(node) + cleanNode(node) + } + + function deleteProcessDependencies (node, rootNodes) { + let payload = node.payload + if (node.statusDependencies !== undefined) { while (node.statusDependencies.length > 0) { deleteStatusDependency(node.statusDependencies[0], rootNodes) diff --git a/DesignerSpace/Workspace/FunctionLibraries/OnFocus.js b/DesignerSpace/Workspace/FunctionLibraries/OnFocus.js index faa814eff..41e14064d 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/OnFocus.js +++ b/DesignerSpace/Workspace/FunctionLibraries/OnFocus.js @@ -824,6 +824,14 @@ function newOnFocus () { } case 'Process Definition': { let child + child = getNodeThatIsOnFocus(node.processOutput) + if (child !== undefined) { + return child + } + child = getNodeThatIsOnFocus(node.processDependencies) + if (child !== undefined) { + return child + } child = getNodeThatIsOnFocus(node.statusReport) if (child !== undefined) { return child @@ -844,12 +852,28 @@ function newOnFocus () { if (child !== undefined) { return child } + if (node.payload.uiObject.isOnFocus === true) { + return node + } else { + return + } + } + case 'Process Output': { + let child for (let m = 0; m < node.outputDatasets.length; m++) { child = getNodeThatIsOnFocus(node.outputDatasets[m]) if (child !== undefined) { return child } } + if (node.payload.uiObject.isOnFocus === true) { + return node + } else { + return + } + } + case 'Process Dependencies': { + let child for (let m = 0; m < node.statusDependencies.length; m++) { child = getNodeThatIsOnFocus(node.statusDependencies[m]) if (child !== undefined) { diff --git a/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js b/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js index 09ff5f75a..4a8aec783 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js +++ b/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js @@ -1171,14 +1171,28 @@ function newProtocolNode () { subType: node.subType, name: node.name, code: node.code, + processOutput: getProtocolNode(node.processOutput, removePersonalData, parseCode, includeIds, includePayload, includeReferences), + processDependencies: getProtocolNode(node.processDependencies, removePersonalData, parseCode, includeIds, includePayload, includeReferences), statusReport: getProtocolNode(node.statusReport, removePersonalData, parseCode, includeIds, includePayload, includeReferences), executionStartedEvent: getProtocolNode(node.executionStartedEvent, removePersonalData, parseCode, includeIds, includePayload, includeReferences), executionFinishedEvent: getProtocolNode(node.executionFinishedEvent, removePersonalData, parseCode, includeIds, includePayload, includeReferences), calculations: getProtocolNode(node.calculations, removePersonalData, parseCode, includeIds, includePayload, includeReferences), - dataBuilding: getProtocolNode(node.dataBuilding, removePersonalData, parseCode, includeIds, includePayload, includeReferences), - outputDatasets: [], - statusDependencies: [], - dataDependencies: [] + dataBuilding: getProtocolNode(node.dataBuilding, removePersonalData, parseCode, includeIds, includePayload, includeReferences) + } + if (includeIds) { + object.id = node.id + } + if (includePayload) { + object.savedPayload = getSavedPayload(node, includeReferences) + } + return object + } + case 'Process Output': { + let object = { + type: node.type, + subType: node.subType, + name: node.name, + outputDatasets: [] } if (node.outputDatasets !== undefined) { for (let m = 0; m < node.outputDatasets.length; m++) { @@ -1188,6 +1202,22 @@ function newProtocolNode () { } } } + if (includeIds) { + object.id = node.id + } + if (includePayload) { + object.savedPayload = getSavedPayload(node, includeReferences) + } + return object + } + case 'Process Dependencies': { + let object = { + type: node.type, + subType: node.subType, + name: node.name, + statusDependencies: [], + dataDependencies: [] + } if (node.statusDependencies !== undefined) { for (let m = 0; m < node.statusDependencies.length; m++) { let statusDependency = getProtocolNode(node.statusDependencies[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) diff --git a/DesignerSpace/Workspace/FunctionLibraries/ShortcutKeys.js b/DesignerSpace/Workspace/FunctionLibraries/ShortcutKeys.js index e9fed8d1e..96f399a43 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/ShortcutKeys.js +++ b/DesignerSpace/Workspace/FunctionLibraries/ShortcutKeys.js @@ -808,6 +808,14 @@ function newShortcutKeys () { } case 'Process Definition': { let child + child = getNodeByShortcutKey(node.processOutput, searchingKey) + if (child !== undefined) { + return child + } + child = getNodeByShortcutKey(node.processDependencies, searchingKey) + if (child !== undefined) { + return child + } child = getNodeByShortcutKey(node.statusReport, searchingKey) if (child !== undefined) { return child @@ -828,12 +836,28 @@ function newShortcutKeys () { if (child !== undefined) { return child } + if (node.payload.uiObject.shortcutKey === searchingKey) { + return node + } else { + return + } + } + case 'Process Output': { + let child for (let m = 0; m < node.outputDatasets.length; m++) { child = getNodeByShortcutKey(node.outputDatasets[m], searchingKey) if (child !== undefined) { return child } } + if (node.payload.uiObject.shortcutKey === searchingKey) { + return node + } else { + return + } + } + case 'Process Dependencies': { + let child for (let m = 0; m < node.statusDependencies.length; m++) { child = getNodeByShortcutKey(node.statusDependencies[m], searchingKey) if (child !== undefined) { diff --git a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js index 3c1a77195..362c263c2 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js +++ b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js @@ -8,6 +8,8 @@ function newUiObjectsFromNodes () { addTradingBot: addTradingBot, addProcessDefinition: addProcessDefinition, addMissingProcessDefinitionItems: addMissingProcessDefinitionItems, + addProcessOutput: addProcessOutput, + addProcessDependencies: addProcessDependencies, addStatusReport: addStatusReport, addExecutionStartedEvent: addExecutionStartedEvent, addExecutionFinishedEvent: addExecutionFinishedEvent, @@ -771,6 +773,12 @@ function newUiObjectsFromNodes () { } } createUiObject(node.type, node.name, node, parentNode, chainParent, node.type) + if (node.processOutput !== undefined) { + createUiObjectFromNode(node.processOutput, node, node) + } + if (node.processDependencies !== undefined) { + createUiObjectFromNode(node.processDependencies, node, node) + } if (node.statusReport !== undefined) { createUiObjectFromNode(node.statusReport, node, node) } @@ -786,10 +794,23 @@ function newUiObjectsFromNodes () { if (node.dataBuilding !== undefined) { createUiObjectFromNode(node.dataBuilding, node, node) } + if (referenceChildren !== undefined) { + node.savedPayload = { + referenceChildren: referenceChildren + } + } + return + } + case 'Process Output': { + createUiObject(node.type, node.name, node, parentNode, chainParent, node.type) for (let m = 0; m < node.outputDatasets.length; m++) { let outputDataset = node.outputDatasets[m] createUiObjectFromNode(outputDataset, node, node) } + return + } + case 'Process Dependencies': { + createUiObject(node.type, node.name, node, parentNode, chainParent, node.type) for (let m = 0; m < node.statusDependencies.length; m++) { let statusDependency = node.statusDependencies[m] createUiObjectFromNode(statusDependency, node, node) @@ -798,11 +819,6 @@ function newUiObjectsFromNodes () { let dataDependency = node.dataDependencies[m] createUiObjectFromNode(dataDependency, node, node) } - if (referenceChildren !== undefined) { - node.savedPayload = { - referenceChildren: referenceChildren - } - } return } case 'Status Report': { @@ -1088,9 +1104,6 @@ function newUiObjectsFromNodes () { type: 'Process Definition', name: 'New Process Definition', code: '{}', - outputDatasets: [], - statusDependencies: [], - dataDependencies: [], referenceChildren: [] } if (node.processes === undefined) { @@ -1103,6 +1116,8 @@ function newUiObjectsFromNodes () { } function addMissingProcessDefinitionItems (node) { + addProcessOutput(node) + addProcessDependencies(node) addStatusReport(node) addExecutionStartedEvent(node) addExecutionFinishedEvent(node) @@ -1110,6 +1125,31 @@ function newUiObjectsFromNodes () { addDataBuildingProcedure(node) } + function addProcessOutput (node) { + if (node.processOutput === undefined) { + node.processOutput = { + type: 'Process Output', + name: 'New Process Output', + outputDatasets: [] + } + createUiObject(node.processOutput.type, node.processOutput.name, node.processOutput, node, node) + } + return node.processOutput + } + + function addProcessDependencies (node) { + if (node.processDependencies === undefined) { + node.processDependencies = { + type: 'Process Dependencies', + name: 'New Process Dependencies', + statusDependencies: [], + dataDependencies: [] + } + createUiObject(node.processDependencies.type, node.processDependencies.name, node.processDependencies, node, node) + } + return node.processDependencies + } + function addStatusReport (node) { if (node.statusReport === undefined) { node.statusReport = { diff --git a/DesignerSpace/Workspace/Workspace.js b/DesignerSpace/Workspace/Workspace.js index 1783221ed..4e15e283c 100644 --- a/DesignerSpace/Workspace/Workspace.js +++ b/DesignerSpace/Workspace/Workspace.js @@ -346,6 +346,16 @@ function newWorkspace () { functionLibraryUiObjectsFromNodes.addMissingProcessDefinitionItems(payload.node) } break + case 'Add Process Output': + { + functionLibraryUiObjectsFromNodes.addProcessOutput(payload.node) + } + break + case 'Add Process Dependencies': + { + functionLibraryUiObjectsFromNodes.addProcessDependencies(payload.node) + } + break case 'Add Status Report': { functionLibraryUiObjectsFromNodes.addStatusReport(payload.node) @@ -636,6 +646,14 @@ function newWorkspace () { functionLibraryNodeDeleter.deleteProcessDefinition(payload.node, thisObject.workspaceNode.rootNodes) break } + case 'Delete Process Output': { + functionLibraryNodeDeleter.deleteProcessOutput(payload.node, thisObject.workspaceNode.rootNodes) + break + } + case 'Delete Process Dependencies': { + functionLibraryNodeDeleter.deleteProcessDependencies(payload.node, thisObject.workspaceNode.rootNodes) + break + } case 'Delete Status Report': { functionLibraryNodeDeleter.deleteStatusReport(payload.node, thisObject.workspaceNode.rootNodes) break diff --git a/FloatingSpace/UiObject.js b/FloatingSpace/UiObject.js index eae98c25e..d0f94a789 100644 --- a/FloatingSpace/UiObject.js +++ b/FloatingSpace/UiObject.js @@ -228,6 +228,14 @@ function newUiObject () { compatibleType = '->' + 'Sensor Bot' + '->' + 'Indicator Bot' + '->' + 'Trading Bot' + '->' compatibleSubType = undefined break + case 'Process Output': + compatibleType = '->' + 'Process Definition' + '->' + compatibleSubType = undefined + break + case 'Process Dependencies': + compatibleType = '->' + 'Process Definition' + '->' + compatibleSubType = undefined + break case 'Status Report': compatibleType = '->' + 'Process Definition' + '->' compatibleSubType = undefined @@ -257,15 +265,15 @@ function newUiObject () { compatibleSubType = undefined break case 'Output Dataset': - compatibleType = '->' + 'Process Definition' + '->' + compatibleType = '->' + 'Process Output' + '->' compatibleSubType = undefined break case 'Status Dependency': - compatibleType = '->' + 'Process Definition' + '->' + compatibleType = '->' + 'Process Dependencies' + '->' compatibleSubType = undefined break case 'Data Dependency': - compatibleType = '->' + 'Process Definition' + '->' + compatibleType = '->' + 'Process Dependencies' + '->' compatibleSubType = undefined break case 'Product Definition': diff --git a/FloatingSpace/UiObjectConstructor.js b/FloatingSpace/UiObjectConstructor.js index 2898afc2f..c3bb37d3f 100644 --- a/FloatingSpace/UiObjectConstructor.js +++ b/FloatingSpace/UiObjectConstructor.js @@ -663,7 +663,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: -70, + angle: -60, dontShowAtFullscreen: true } ) @@ -677,48 +677,9 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: -40 - } - ) - menuItemsInitialValues.push( - { - action: 'Add Output Dataset', - actionFunction: payload.onMenuItemClick, - label: 'Add Output Dataset', - visible: true, - relatedUiObject: 'Output Dataset', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, angle: -20 } - ) - menuItemsInitialValues.push( - { - action: 'Add Status Dependency', - actionFunction: payload.onMenuItemClick, - label: 'Add Status Dependency', - visible: true, - relatedUiObject: 'Status Dependency', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: 0 - } - ) - menuItemsInitialValues.push( - { - action: 'Add Data Dependency', - actionFunction: payload.onMenuItemClick, - label: 'Add Data Dependency', - visible: true, - relatedUiObject: 'Data Dependency', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: 20 - } - ) + ) menuItemsInitialValues.push( { action: 'Delete Process Definition', @@ -732,7 +693,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: 40 + angle: 20 } ) menuItemsInitialValues.push( @@ -746,7 +707,114 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: 70 + angle: 60 + } + ) + break + } + case 'Process Output': { + addLeftIcons(menuItemsInitialValues, floatingObject) + menuItemsInitialValues.push( + { + action: 'Add Output Dataset', + actionFunction: payload.onMenuItemClick, + label: 'Add Output Dataset', + visible: true, + relatedUiObject: 'Output Dataset', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: -30 + } + ) + menuItemsInitialValues.push( + { + action: 'Delete Process Output', + askConfirmation: true, + confirmationLabel: 'Confirm to Delete', + actionFunction: payload.onMenuItemClick, + label: 'Delete Process Output', + visible: true, + iconPathOn: 'delete', + iconPathOff: 'delete', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: 0 + } + ) + menuItemsInitialValues.push( + { + action: 'Share', + actionFunction: payload.onMenuItemClick, + label: 'Share', + visible: true, + iconPathOn: 'menu-share', + iconPathOff: 'menu-share', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: 30 + } + ) + break + } + case 'Process Dependencies': { + addLeftIcons(menuItemsInitialValues, floatingObject) + menuItemsInitialValues.push( + { + action: 'Add Status Dependency', + actionFunction: payload.onMenuItemClick, + label: 'Add Status Dependency', + visible: true, + relatedUiObject: 'Status Dependency', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: -60 + } + ) + menuItemsInitialValues.push( + { + action: 'Add Data Dependency', + actionFunction: payload.onMenuItemClick, + label: 'Add Data Dependency', + visible: true, + relatedUiObject: 'Data Dependency', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: -20 + } + ) + menuItemsInitialValues.push( + { + action: 'Delete Process Dependencies', + askConfirmation: true, + confirmationLabel: 'Confirm to Delete', + actionFunction: payload.onMenuItemClick, + label: 'Delete Process Dependencies', + visible: true, + iconPathOn: 'delete', + iconPathOff: 'delete', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: 20 + } + ) + menuItemsInitialValues.push( + { + action: 'Share', + actionFunction: payload.onMenuItemClick, + label: 'Share', + visible: true, + iconPathOn: 'menu-share', + iconPathOff: 'menu-share', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: 60 } ) break @@ -4488,7 +4556,15 @@ function newUiObjectConstructor () { break } case 'Process Definition': { - level_0() + level_2() + break + } + case 'Process Output': { + level_3() + break + } + case 'Process Dependencies': { + level_3() break } case 'Status Report': { diff --git a/Spaces/DesignerSpace.js b/Spaces/DesignerSpace.js index f5142e240..f8fea61cc 100644 --- a/Spaces/DesignerSpace.js +++ b/Spaces/DesignerSpace.js @@ -95,6 +95,8 @@ function newDesignerSpace () { ['Indicator Bot', 'bot-indicator'], ['Trading Bot', 'bot-trading'], ['Process Definition', 'process-definition'], + ['Process Output', 'image'], + ['Process Dependencies', 'headphones'], ['Status Report', 'text'], ['Execution Started Event', 'pantone'], ['Execution Finished Event', 'pantone'], From d69c999db7a807b9e65c2e7610972701a71f82e9 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 6 Nov 2019 17:46:48 +0100 Subject: [PATCH 75/95] new icons --- Spaces/DesignerSpace.js | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/Spaces/DesignerSpace.js b/Spaces/DesignerSpace.js index f8fea61cc..be4207f31 100644 --- a/Spaces/DesignerSpace.js +++ b/Spaces/DesignerSpace.js @@ -42,7 +42,7 @@ function newDesignerSpace () { ['Definition', 'text'], ['Network', 'network'], ['Network Node', 'network-node'], - ['Social Bots', 'support'], + ['Social Bots', 'social-bot'], ['Telegram Bot', 'paper-plane'], ['Announcement', 'promotion'], ['Layer Manager', 'layer-manager'], @@ -95,11 +95,11 @@ function newDesignerSpace () { ['Indicator Bot', 'bot-indicator'], ['Trading Bot', 'bot-trading'], ['Process Definition', 'process-definition'], - ['Process Output', 'image'], - ['Process Dependencies', 'headphones'], - ['Status Report', 'text'], - ['Execution Started Event', 'pantone'], - ['Execution Finished Event', 'pantone'], + ['Process Output', 'process-output'], + ['Process Dependencies', 'process-dependencies'], + ['Status Report', 'status-report'], + ['Execution Started Event', 'execution-started-event'], + ['Execution Finished Event', 'execution-finished-event'], ['Calculations Procedure', 'calculations-procedure'], ['Data Building Procedure', 'data-building-procedure'], ['Procedure Initialization', 'procedure-initialization'], @@ -223,7 +223,13 @@ function newDesignerSpace () { 'record-definition', 'plotter', 'plotter-panel', - 'dataset-definition' + 'dataset-definition', + 'status-report', + 'execution-finished-event', + 'process-dependencies', + 'process-output', + 'social-bot', + 'execution-started-event' ] for (let i = 0; i < iconsNames.length; i++) { From 0e2874cfaa3c96db35fa3ddf6e2cf4f097230b95 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 7 Nov 2019 12:24:13 +0100 Subject: [PATCH 76/95] Collapsed objects out of physics calculations --- FloatingSpace/FloatingLayer.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/FloatingSpace/FloatingLayer.js b/FloatingSpace/FloatingLayer.js index 91333db82..c0c6a7f92 100644 --- a/FloatingSpace/FloatingLayer.js +++ b/FloatingSpace/FloatingLayer.js @@ -203,7 +203,7 @@ function newFloatingLayer () { for (let i = 0; i < invisibleFloatingObjects.length; i++) { let floatingObject = invisibleFloatingObjects[i] - if (floatingObject.isFrozen === false) { + if (floatingObject.isFrozen === false && floatingObject.isParentCollapsed === false) { visibleFloatingObjects.push(floatingObject) invisibleFloatingObjects.splice(i, 1) // Delete item from array. return // Only one at the time. @@ -215,7 +215,7 @@ function newFloatingLayer () { for (let i = 0; i < visibleFloatingObjects.length; i++) { let floatingObject = visibleFloatingObjects[i] - if (floatingObject.isFrozen === true) { + if (floatingObject.isFrozen === true || floatingObject.isParentCollapsed === true) { invisibleFloatingObjects.push(floatingObject) visibleFloatingObjects.splice(i, 1) // Delete item from array. return // Only one at the time. From b95a58cbfd7487d0047f9907cb9df6d176ac0fed Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 7 Nov 2019 17:32:46 +0100 Subject: [PATCH 77/95] Following Reference Parents Implemented --- .../FunctionLibraries/ProtocolNode.js | 237 ++++++++++-------- .../FunctionLibraries/TaskFunctions.js | 2 +- 2 files changed, 133 insertions(+), 106 deletions(-) diff --git a/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js b/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js index 4a8aec783..f3dac64c1 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js +++ b/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js @@ -4,7 +4,7 @@ function newProtocolNode () { } return thisObject - function getProtocolNode (node, removePersonalData, parseCode, includeIds, includePayload, includeReferences) { + function getProtocolNode (node, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) { if (node === undefined) { return } switch (node.type) { case 'Code': @@ -29,7 +29,7 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - code: getProtocolNode(node.code, removePersonalData, parseCode, includeIds, includePayload, includeReferences) + code: getProtocolNode(node.code, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) } if (includeIds) { object.id = node.id @@ -48,7 +48,7 @@ function newProtocolNode () { } for (let m = 0; m < node.conditions.length; m++) { - let condition = getProtocolNode(node.conditions[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) + let condition = getProtocolNode(node.conditions[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) if (condition !== undefined) { object.conditions.push(condition) } @@ -87,13 +87,13 @@ function newProtocolNode () { announcements: [] } for (let m = 0; m < node.situations.length; m++) { - let situation = getProtocolNode(node.situations[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) + let situation = getProtocolNode(node.situations[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) if (situation !== undefined) { object.situations.push(situation) } } for (let m = 0; m < node.announcements.length; m++) { - let announcement = getProtocolNode(node.announcements[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) + let announcement = getProtocolNode(node.announcements[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) if (announcement !== undefined) { object.announcements.push(announcement) } @@ -112,11 +112,11 @@ function newProtocolNode () { subType: node.subType, name: node.name, announcements: [], - formula: getProtocolNode(node.formula, removePersonalData, parseCode, includeIds, includePayload, includeReferences), - nextPhaseEvent: getProtocolNode(node.nextPhaseEvent, removePersonalData, parseCode, includeIds, includePayload, includeReferences) + formula: getProtocolNode(node.formula, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent), + nextPhaseEvent: getProtocolNode(node.nextPhaseEvent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) } for (let m = 0; m < node.announcements.length; m++) { - let announcement = getProtocolNode(node.announcements[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) + let announcement = getProtocolNode(node.announcements[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) if (announcement !== undefined) { object.announcements.push(announcement) } @@ -138,7 +138,7 @@ function newProtocolNode () { } for (let m = 0; m < node.phases.length; m++) { - let phase = getProtocolNode(node.phases[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) + let phase = getProtocolNode(node.phases[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) if (phase !== undefined) { object.phases.push(phase) } @@ -160,7 +160,7 @@ function newProtocolNode () { } for (let m = 0; m < node.phases.length; m++) { - let phase = getProtocolNode(node.phases[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) + let phase = getProtocolNode(node.phases[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) if (phase !== undefined) { object.phases.push(phase) } @@ -183,13 +183,13 @@ function newProtocolNode () { } for (let m = 0; m < node.situations.length; m++) { - let situation = getProtocolNode(node.situations[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) + let situation = getProtocolNode(node.situations[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) if (situation !== undefined) { object.situations.push(situation) } } for (let m = 0; m < node.announcements.length; m++) { - let announcement = getProtocolNode(node.announcements[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) + let announcement = getProtocolNode(node.announcements[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) if (announcement !== undefined) { object.announcements.push(announcement) } @@ -212,11 +212,11 @@ function newProtocolNode () { } for (let m = 0; m < node.situations.length; m++) { - let situation = getProtocolNode(node.situations[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) + let situation = getProtocolNode(node.situations[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) object.situations.push(situation) } for (let m = 0; m < node.announcements.length; m++) { - let announcement = getProtocolNode(node.announcements[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) + let announcement = getProtocolNode(node.announcements[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) if (announcement !== undefined) { object.announcements.push(announcement) } @@ -239,13 +239,13 @@ function newProtocolNode () { } for (let m = 0; m < node.situations.length; m++) { - let situation = getProtocolNode(node.situations[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) + let situation = getProtocolNode(node.situations[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) if (situation !== undefined) { object.situations.push(situation) } } for (let m = 0; m < node.announcements.length; m++) { - let announcement = getProtocolNode(node.announcements[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) + let announcement = getProtocolNode(node.announcements[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) if (announcement !== undefined) { object.announcements.push(announcement) } @@ -263,10 +263,10 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - stopLoss: getProtocolNode(node.stopLoss, removePersonalData, parseCode, includeIds, includePayload, includeReferences), - takeProfit: getProtocolNode(node.takeProfit, removePersonalData, parseCode, includeIds, includePayload, includeReferences), - positionSize: getProtocolNode(node.positionSize, removePersonalData, parseCode, includeIds, includePayload, includeReferences), - positionRate: getProtocolNode(node.positionRate, removePersonalData, parseCode, includeIds, includePayload, includeReferences) + stopLoss: getProtocolNode(node.stopLoss, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent), + takeProfit: getProtocolNode(node.takeProfit, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent), + positionSize: getProtocolNode(node.positionSize, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent), + positionRate: getProtocolNode(node.positionRate, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) } if (includeIds) { object.id = node.id @@ -309,7 +309,7 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - formula: getProtocolNode(node.formula, removePersonalData, parseCode, includeIds, includePayload, includeReferences) + formula: getProtocolNode(node.formula, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) } if (includeIds) { object.id = node.id @@ -324,7 +324,7 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - formula: getProtocolNode(node.formula, removePersonalData, parseCode, includeIds, includePayload, includeReferences) + formula: getProtocolNode(node.formula, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) } if (includeIds) { object.id = node.id @@ -339,9 +339,9 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - triggerOn: getProtocolNode(node.triggerOn, removePersonalData, parseCode, includeIds, includePayload, includeReferences), - triggerOff: getProtocolNode(node.triggerOff, removePersonalData, parseCode, includeIds, includePayload, includeReferences), - takePosition: getProtocolNode(node.takePosition, removePersonalData, parseCode, includeIds, includePayload, includeReferences) + triggerOn: getProtocolNode(node.triggerOn, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent), + triggerOff: getProtocolNode(node.triggerOff, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent), + takePosition: getProtocolNode(node.takePosition, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) } if (includeIds) { object.id = node.id @@ -356,8 +356,8 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - initialDefinition: getProtocolNode(node.initialDefinition, removePersonalData, parseCode, includeIds, includePayload, includeReferences), - openExecution: getProtocolNode(node.openExecution, removePersonalData, parseCode, includeIds, includePayload, includeReferences) + initialDefinition: getProtocolNode(node.initialDefinition, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent), + openExecution: getProtocolNode(node.openExecution, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) } if (includeIds) { object.id = node.id @@ -372,8 +372,8 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - stopLoss: getProtocolNode(node.stopLoss, removePersonalData, parseCode, includeIds, includePayload, includeReferences), - takeProfit: getProtocolNode(node.takeProfit, removePersonalData, parseCode, includeIds, includePayload, includeReferences) + stopLoss: getProtocolNode(node.stopLoss, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent), + takeProfit: getProtocolNode(node.takeProfit, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) } if (includeIds) { object.id = node.id @@ -388,7 +388,7 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - closeExecution: getProtocolNode(node.closeExecution, removePersonalData, parseCode, includeIds, includePayload, includeReferences) + closeExecution: getProtocolNode(node.closeExecution, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) } if (includeIds) { object.id = node.id @@ -403,10 +403,10 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - triggerStage: getProtocolNode(node.triggerStage, removePersonalData, parseCode, includeIds, includePayload, includeReferences), - openStage: getProtocolNode(node.openStage, removePersonalData, parseCode, includeIds, includePayload, includeReferences), - manageStage: getProtocolNode(node.manageStage, removePersonalData, parseCode, includeIds, includePayload, includeReferences), - closeStage: getProtocolNode(node.closeStage, removePersonalData, parseCode, includeIds, includePayload, includeReferences) + triggerStage: getProtocolNode(node.triggerStage, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent), + openStage: getProtocolNode(node.openStage, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent), + manageStage: getProtocolNode(node.manageStage, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent), + closeStage: getProtocolNode(node.closeStage, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) } if (includeIds) { object.id = node.id @@ -508,12 +508,12 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - baseAsset: getProtocolNode(node.baseAsset, removePersonalData, parseCode, includeIds, includePayload, includeReferences), - timeRange: getProtocolNode(node.timeRange, removePersonalData, parseCode, includeIds, includePayload, includeReferences), - timePeriod: getProtocolNode(node.timePeriod, removePersonalData, parseCode, includeIds, includePayload, includeReferences), - slippage: getProtocolNode(node.slippage, removePersonalData, parseCode, includeIds, includePayload, includeReferences), - feeStructure: getProtocolNode(node.feeStructure, removePersonalData, parseCode, includeIds, includePayload, includeReferences), - key: getProtocolNode(node.key, removePersonalData, parseCode, includeIds, includePayload, includeReferences) + baseAsset: getProtocolNode(node.baseAsset, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent), + timeRange: getProtocolNode(node.timeRange, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent), + timePeriod: getProtocolNode(node.timePeriod, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent), + slippage: getProtocolNode(node.slippage, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent), + feeStructure: getProtocolNode(node.feeStructure, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent), + key: getProtocolNode(node.key, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) } if (includeIds) { object.id = node.id @@ -529,11 +529,11 @@ function newProtocolNode () { subType: node.subType, name: node.name, strategies: [], - parameters: getProtocolNode(node.parameters, removePersonalData, parseCode, includeIds, includePayload, includeReferences) + parameters: getProtocolNode(node.parameters, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) } for (let m = 0; m < node.strategies.length; m++) { - let strategy = getProtocolNode(node.strategies[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) + let strategy = getProtocolNode(node.strategies[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) if (strategy !== undefined) { object.strategies.push(strategy) } @@ -556,7 +556,7 @@ function newProtocolNode () { } for (let m = 0; m < node.exchangeAccounts.length; m++) { - let exchangeAccount = getProtocolNode(node.exchangeAccounts[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) + let exchangeAccount = getProtocolNode(node.exchangeAccounts[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) if (exchangeAccount !== undefined) { object.exchangeAccounts.push(exchangeAccount) } @@ -580,13 +580,13 @@ function newProtocolNode () { } for (let m = 0; m < node.assets.length; m++) { - let asset = getProtocolNode(node.assets[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) + let asset = getProtocolNode(node.assets[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) if (asset !== undefined) { object.assets.push(asset) } } for (let m = 0; m < node.keys.length; m++) { - let key = getProtocolNode(node.keys[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) + let key = getProtocolNode(node.keys[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) if (key !== undefined) { object.keys.push(key) } @@ -639,7 +639,7 @@ function newProtocolNode () { } for (let m = 0; m < node.bots.length; m++) { - let bot = getProtocolNode(node.bots[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) + let bot = getProtocolNode(node.bots[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) if (bot !== undefined) { object.bots.push(bot) } @@ -663,7 +663,7 @@ function newProtocolNode () { } for (let m = 0; m < node.announcements.length; m++) { - let announcement = getProtocolNode(node.announcements[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) + let announcement = getProtocolNode(node.announcements[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) if (announcement !== undefined) { object.announcements.push(announcement) } @@ -685,7 +685,7 @@ function newProtocolNode () { subType: node.subType, name: node.name, code: node.code, - formula: getProtocolNode(node.formula, removePersonalData, parseCode, includeIds, includePayload, includeReferences) + formula: getProtocolNode(node.formula, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) } if (includeIds) { object.id = node.id @@ -704,7 +704,7 @@ function newProtocolNode () { } for (let m = 0; m < node.layers.length; m++) { - let layer = getProtocolNode(node.layers[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) + let layer = getProtocolNode(node.layers[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) if (layer !== undefined) { object.layers.push(layer) } @@ -744,7 +744,7 @@ function newProtocolNode () { } for (let m = 0; m < node.tasks.length; m++) { - let task = getProtocolNode(node.tasks[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) + let task = getProtocolNode(node.tasks[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) if (task !== undefined) { object.tasks.push(task) } @@ -762,7 +762,7 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - bot: getProtocolNode(node.bot, removePersonalData, parseCode, includeIds, includePayload, includeReferences) + bot: getProtocolNode(node.bot, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) } if (includeIds) { object.id = node.id @@ -782,7 +782,7 @@ function newProtocolNode () { } for (let m = 0; m < node.processes.length; m++) { - let process = getProtocolNode(node.processes[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) + let process = getProtocolNode(node.processes[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) if (process !== undefined) { object.processes.push(process) } @@ -808,7 +808,7 @@ function newProtocolNode () { } for (let m = 0; m < node.processes.length; m++) { - let process = getProtocolNode(node.processes[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) + let process = getProtocolNode(node.processes[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) if (process !== undefined) { object.processes.push(process) } @@ -834,7 +834,7 @@ function newProtocolNode () { } for (let m = 0; m < node.processes.length; m++) { - let process = getProtocolNode(node.processes[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) + let process = getProtocolNode(node.processes[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) if (process !== undefined) { object.processes.push(process) } @@ -856,7 +856,7 @@ function newProtocolNode () { subType: node.subType, name: node.name, code: node.code, - session: getProtocolNode(node.session, removePersonalData, parseCode, includeIds, includePayload, includeReferences) + session: getProtocolNode(node.session, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) } if (parseCode) { object.code = JSON.parse(node.code) @@ -867,6 +867,9 @@ function newProtocolNode () { if (includePayload) { object.savedPayload = getSavedPayload(node, includeReferences) } + if (followReferenceParent) { + object.referenceParent = getProtocolNode(node.payload.referenceParent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + } return object } case 'Backtesting Session': { @@ -875,9 +878,9 @@ function newProtocolNode () { subType: node.subType, name: node.name, code: node.code, - parameters: getProtocolNode(node.parameters, removePersonalData, parseCode, includeIds, includePayload, includeReferences), - layerManager: getProtocolNode(node.layerManager, removePersonalData, parseCode, includeIds, includePayload, includeReferences), - socialBots: getProtocolNode(node.socialBots, removePersonalData, parseCode, includeIds, includePayload, includeReferences) + parameters: getProtocolNode(node.parameters, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent), + layerManager: getProtocolNode(node.layerManager, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent), + socialBots: getProtocolNode(node.socialBots, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) } if (parseCode) { object.code = JSON.parse(object.code) @@ -888,6 +891,9 @@ function newProtocolNode () { if (includePayload) { object.savedPayload = getSavedPayload(node, includeReferences) } + if (followReferenceParent) { + object.referenceParent = getProtocolNode(node.payload.referenceParent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + } return object } case 'Live Trading Session': { @@ -896,9 +902,9 @@ function newProtocolNode () { subType: node.subType, name: node.name, code: node.code, - parameters: getProtocolNode(node.parameters, removePersonalData, parseCode, includeIds, includePayload, includeReferences), - layerManager: getProtocolNode(node.layerManager, removePersonalData, parseCode, includeIds, includePayload, includeReferences), - socialBots: getProtocolNode(node.socialBots, removePersonalData, parseCode, includeIds, includePayload, includeReferences) + parameters: getProtocolNode(node.parameters, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent), + layerManager: getProtocolNode(node.layerManager, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent), + socialBots: getProtocolNode(node.socialBots, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) } if (parseCode) { object.code = JSON.parse(node.code) @@ -909,6 +915,9 @@ function newProtocolNode () { if (includePayload) { object.savedPayload = getSavedPayload(node, includeReferences) } + if (followReferenceParent) { + object.referenceParent = getProtocolNode(node.payload.referenceParent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + } return object } case 'Fordward Testing Session': { @@ -917,9 +926,9 @@ function newProtocolNode () { subType: node.subType, name: node.name, code: node.code, - parameters: getProtocolNode(node.parameters, removePersonalData, parseCode, includeIds, includePayload, includeReferences), - layerManager: getProtocolNode(node.layerManager, removePersonalData, parseCode, includeIds, includePayload, includeReferences), - socialBots: getProtocolNode(node.socialBots, removePersonalData, parseCode, includeIds, includePayload, includeReferences) + parameters: getProtocolNode(node.parameters, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent), + layerManager: getProtocolNode(node.layerManager, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent), + socialBots: getProtocolNode(node.socialBots, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) } if (parseCode) { object.code = JSON.parse(object.code) @@ -930,6 +939,9 @@ function newProtocolNode () { if (includePayload) { object.savedPayload = getSavedPayload(node, includeReferences) } + if (followReferenceParent) { + object.referenceParent = getProtocolNode(node.payload.referenceParent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + } return object } case 'Paper Trading Session': { @@ -938,9 +950,9 @@ function newProtocolNode () { subType: node.subType, name: node.name, code: node.code, - parameters: getProtocolNode(node.parameters, removePersonalData, parseCode, includeIds, includePayload, includeReferences), - layerManager: getProtocolNode(node.layerManager, removePersonalData, parseCode, includeIds, includePayload, includeReferences), - socialBots: getProtocolNode(node.socialBots, removePersonalData, parseCode, includeIds, includePayload, includeReferences) + parameters: getProtocolNode(node.parameters, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent), + layerManager: getProtocolNode(node.layerManager, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent), + socialBots: getProtocolNode(node.socialBots, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) } if (parseCode) { object.code = JSON.parse(node.code) @@ -951,6 +963,9 @@ function newProtocolNode () { if (includePayload) { object.savedPayload = getSavedPayload(node, includeReferences) } + if (followReferenceParent) { + object.referenceParent = getProtocolNode(node.payload.referenceParent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + } return object } case 'Network Node': { @@ -962,7 +977,7 @@ function newProtocolNode () { } if (node.taskManagers !== undefined) { for (let m = 0; m < node.taskManagers.length; m++) { - let taskManager = getProtocolNode(node.taskManagers[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) + let taskManager = getProtocolNode(node.taskManagers[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) if (taskManager !== undefined) { object.taskManagers.push(taskManager) } @@ -985,7 +1000,7 @@ function newProtocolNode () { } if (node.networkNodes !== undefined) { for (let m = 0; m < node.networkNodes.length; m++) { - let networkNode = getProtocolNode(node.networkNodes[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) + let networkNode = getProtocolNode(node.networkNodes[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) if (networkNode !== undefined) { object.networkNodes.push(networkNode) } @@ -1004,8 +1019,8 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - tradingSystem: getProtocolNode(node.tradingSystem, removePersonalData, parseCode, includeIds, includePayload, includeReferences), - personalData: getProtocolNode(node.personalData, removePersonalData, parseCode, includeIds, includePayload, includeReferences) + tradingSystem: getProtocolNode(node.tradingSystem, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent), + personalData: getProtocolNode(node.personalData, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) } if (includeIds) { object.id = node.id @@ -1028,7 +1043,7 @@ function newProtocolNode () { } if (node.sensorBots !== undefined) { for (let m = 0; m < node.sensorBots.length; m++) { - let sensorBot = getProtocolNode(node.sensorBots[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) + let sensorBot = getProtocolNode(node.sensorBots[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) if (sensorBot !== undefined) { object.sensorBots.push(sensorBot) } @@ -1036,7 +1051,7 @@ function newProtocolNode () { } if (node.indicatorBots !== undefined) { for (let m = 0; m < node.indicatorBots.length; m++) { - let indicatorBot = getProtocolNode(node.indicatorBots[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) + let indicatorBot = getProtocolNode(node.indicatorBots[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) if (indicatorBot !== undefined) { object.indicatorBots.push(indicatorBot) } @@ -1044,7 +1059,7 @@ function newProtocolNode () { } if (node.tradingBots !== undefined) { for (let m = 0; m < node.tradingBots.length; m++) { - let tradingBot = getProtocolNode(node.tradingBots[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) + let tradingBot = getProtocolNode(node.tradingBots[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) if (tradingBot !== undefined) { object.tradingBots.push(tradingBot) } @@ -1052,7 +1067,7 @@ function newProtocolNode () { } if (node.plotters !== undefined) { for (let m = 0; m < node.plotters.length; m++) { - let plotter = getProtocolNode(node.plotters[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) + let plotter = getProtocolNode(node.plotters[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) if (plotter !== undefined) { object.plotters.push(plotter) } @@ -1077,7 +1092,7 @@ function newProtocolNode () { } if (node.processes !== undefined) { for (let m = 0; m < node.processes.length; m++) { - let process = getProtocolNode(node.processes[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) + let process = getProtocolNode(node.processes[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) if (process !== undefined) { object.processes.push(process) } @@ -1085,7 +1100,7 @@ function newProtocolNode () { } if (node.products !== undefined) { for (let m = 0; m < node.products.length; m++) { - let product = getProtocolNode(node.products[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) + let product = getProtocolNode(node.products[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) if (product !== undefined) { object.products.push(product) } @@ -1110,7 +1125,7 @@ function newProtocolNode () { } if (node.processes !== undefined) { for (let m = 0; m < node.processes.length; m++) { - let process = getProtocolNode(node.processes[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) + let process = getProtocolNode(node.processes[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) if (process !== undefined) { object.processes.push(process) } @@ -1118,7 +1133,7 @@ function newProtocolNode () { } if (node.products !== undefined) { for (let m = 0; m < node.products.length; m++) { - let product = getProtocolNode(node.products[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) + let product = getProtocolNode(node.products[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) if (product !== undefined) { object.products.push(product) } @@ -1143,7 +1158,7 @@ function newProtocolNode () { } if (node.processes !== undefined) { for (let m = 0; m < node.processes.length; m++) { - let process = getProtocolNode(node.processes[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) + let process = getProtocolNode(node.processes[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) if (process !== undefined) { object.processes.push(process) } @@ -1151,7 +1166,7 @@ function newProtocolNode () { } if (node.products !== undefined) { for (let m = 0; m < node.products.length; m++) { - let product = getProtocolNode(node.products[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) + let product = getProtocolNode(node.products[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) if (product !== undefined) { object.products.push(product) } @@ -1171,13 +1186,13 @@ function newProtocolNode () { subType: node.subType, name: node.name, code: node.code, - processOutput: getProtocolNode(node.processOutput, removePersonalData, parseCode, includeIds, includePayload, includeReferences), - processDependencies: getProtocolNode(node.processDependencies, removePersonalData, parseCode, includeIds, includePayload, includeReferences), - statusReport: getProtocolNode(node.statusReport, removePersonalData, parseCode, includeIds, includePayload, includeReferences), - executionStartedEvent: getProtocolNode(node.executionStartedEvent, removePersonalData, parseCode, includeIds, includePayload, includeReferences), - executionFinishedEvent: getProtocolNode(node.executionFinishedEvent, removePersonalData, parseCode, includeIds, includePayload, includeReferences), - calculations: getProtocolNode(node.calculations, removePersonalData, parseCode, includeIds, includePayload, includeReferences), - dataBuilding: getProtocolNode(node.dataBuilding, removePersonalData, parseCode, includeIds, includePayload, includeReferences) + processOutput: getProtocolNode(node.processOutput, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent), + processDependencies: getProtocolNode(node.processDependencies, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent), + statusReport: getProtocolNode(node.statusReport, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent), + executionStartedEvent: getProtocolNode(node.executionStartedEvent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent), + executionFinishedEvent: getProtocolNode(node.executionFinishedEvent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent), + calculations: getProtocolNode(node.calculations, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent), + dataBuilding: getProtocolNode(node.dataBuilding, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) } if (includeIds) { object.id = node.id @@ -1196,7 +1211,7 @@ function newProtocolNode () { } if (node.outputDatasets !== undefined) { for (let m = 0; m < node.outputDatasets.length; m++) { - let outputDataset = getProtocolNode(node.outputDatasets[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) + let outputDataset = getProtocolNode(node.outputDatasets[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) if (outputDataset !== undefined) { object.outputDatasets.push(outputDataset) } @@ -1220,7 +1235,7 @@ function newProtocolNode () { } if (node.statusDependencies !== undefined) { for (let m = 0; m < node.statusDependencies.length; m++) { - let statusDependency = getProtocolNode(node.statusDependencies[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) + let statusDependency = getProtocolNode(node.statusDependencies[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) if (statusDependency !== undefined) { object.statusDependencies.push(statusDependency) } @@ -1228,7 +1243,7 @@ function newProtocolNode () { } if (node.dataDependencies !== undefined) { for (let m = 0; m < node.dataDependencies.length; m++) { - let dataDependency = getProtocolNode(node.dataDependencies[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) + let dataDependency = getProtocolNode(node.dataDependencies[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) if (dataDependency !== undefined) { object.dataDependencies.push(dataDependency) } @@ -1268,6 +1283,9 @@ function newProtocolNode () { if (includePayload) { object.savedPayload = getSavedPayload(node, includeReferences) } + if (followReferenceParent) { + object.referenceParent = getProtocolNode(node.payload.referenceParent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + } return object } case 'Execution Finished Event': { @@ -1289,8 +1307,8 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - initialization: getProtocolNode(node.initialization, removePersonalData, parseCode, includeIds, includePayload, includeReferences), - loop: getProtocolNode(node.loop, removePersonalData, parseCode, includeIds, includePayload, includeReferences) + initialization: getProtocolNode(node.initialization, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent), + loop: getProtocolNode(node.loop, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) } if (includeIds) { object.id = node.id @@ -1305,8 +1323,8 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - initialization: getProtocolNode(node.initialization, removePersonalData, parseCode, includeIds, includePayload, includeReferences), - loop: getProtocolNode(node.loop, removePersonalData, parseCode, includeIds, includePayload, includeReferences) + initialization: getProtocolNode(node.initialization, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent), + loop: getProtocolNode(node.loop, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) } if (includeIds) { object.id = node.id @@ -1321,7 +1339,7 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - code: getProtocolNode(node.code, removePersonalData, parseCode, includeIds, includePayload, includeReferences) + code: getProtocolNode(node.code, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) } if (includeIds) { object.id = node.id @@ -1336,7 +1354,7 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - code: getProtocolNode(node.code, removePersonalData, parseCode, includeIds, includePayload, includeReferences) + code: getProtocolNode(node.code, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) } if (includeIds) { object.id = node.id @@ -1358,6 +1376,9 @@ function newProtocolNode () { if (includePayload) { object.savedPayload = getSavedPayload(node, includeReferences) } + if (followReferenceParent) { + object.referenceParent = getProtocolNode(node.payload.referenceParent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + } return object } case 'Status Dependency': { @@ -1372,6 +1393,9 @@ function newProtocolNode () { if (includePayload) { object.savedPayload = getSavedPayload(node, includeReferences) } + if (followReferenceParent) { + object.referenceParent = getProtocolNode(node.payload.referenceParent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + } return object } case 'Data Dependency': { @@ -1386,6 +1410,9 @@ function newProtocolNode () { if (includePayload) { object.savedPayload = getSavedPayload(node, includeReferences) } + if (followReferenceParent) { + object.referenceParent = getProtocolNode(node.payload.referenceParent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + } return object } case 'Product Definition': { @@ -1394,12 +1421,12 @@ function newProtocolNode () { subType: node.subType, name: node.name, code: node.code, - record: getProtocolNode(node.record, removePersonalData, parseCode, includeIds, includePayload, includeReferences), + record: getProtocolNode(node.record, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent), datasets: [] } if (node.datasets !== undefined) { for (let m = 0; m < node.datasets.length; m++) { - let dataset = getProtocolNode(node.datasets[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) + let dataset = getProtocolNode(node.datasets[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) if (dataset !== undefined) { object.datasets.push(dataset) } @@ -1422,7 +1449,7 @@ function newProtocolNode () { } if (node.properties !== undefined) { for (let m = 0; m < node.properties.length; m++) { - let property = getProtocolNode(node.properties[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) + let property = getProtocolNode(node.properties[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) if (property !== undefined) { object.properties.push(property) } @@ -1442,7 +1469,7 @@ function newProtocolNode () { subType: node.subType, name: node.name, code: node.code, - formula: getProtocolNode(node.formula, removePersonalData, parseCode, includeIds, includePayload, includeReferences) + formula: getProtocolNode(node.formula, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) } if (includeIds) { object.id = node.id @@ -1476,7 +1503,7 @@ function newProtocolNode () { } if (node.modules !== undefined) { for (let m = 0; m < node.modules.length; m++) { - let module = getProtocolNode(node.modules[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) + let module = getProtocolNode(node.modules[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) if (module !== undefined) { object.modules.push(module) } @@ -1495,12 +1522,12 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - code: getProtocolNode(node.code, removePersonalData, parseCode, includeIds, includePayload, includeReferences), + code: getProtocolNode(node.code, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent), panels: [] } if (node.panels !== undefined) { for (let m = 0; m < node.panels.length; m++) { - let panel = getProtocolNode(node.panels[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences) + let panel = getProtocolNode(node.panels[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) if (panel !== undefined) { object.panels.push(panel) } @@ -1519,7 +1546,7 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - code: getProtocolNode(node.code, removePersonalData, parseCode, includeIds, includePayload, includeReferences) + code: getProtocolNode(node.code, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) } if (includeIds) { object.id = node.id diff --git a/DesignerSpace/Workspace/FunctionLibraries/TaskFunctions.js b/DesignerSpace/Workspace/FunctionLibraries/TaskFunctions.js index 4d8f9bf83..4d73ec4cf 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/TaskFunctions.js +++ b/DesignerSpace/Workspace/FunctionLibraries/TaskFunctions.js @@ -29,7 +29,7 @@ function newTaskFunctions () { let event = { taskId: node.id, taskName: node.name, - definition: JSON.stringify(functionLibraryProtocolNode.getProtocolNode(node, false, true, true)) // <- We need to do this workaround in order no to send unescaped charactars to the taskManager. + definition: JSON.stringify(functionLibraryProtocolNode.getProtocolNode(node, false, true, true, false, false, true)) // <- We need to do this workaround in order no to send unescaped charactars to the taskManager. } systemEventHandler.raiseEvent('Task Manager', 'Run Task', event) } From e83d4953ae84e58832fedec17e590d2bffb56cb0 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sat, 9 Nov 2019 11:25:12 +0100 Subject: [PATCH 78/95] Parsing code on objects that make sense --- .../Workspace/FunctionLibraries/ProtocolNode.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js b/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js index f3dac64c1..cf4d4f2e3 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js +++ b/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js @@ -1194,6 +1194,9 @@ function newProtocolNode () { calculations: getProtocolNode(node.calculations, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent), dataBuilding: getProtocolNode(node.dataBuilding, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) } + if (parseCode) { + object.code = JSON.parse(node.code) + } if (includeIds) { object.id = node.id } @@ -1432,6 +1435,9 @@ function newProtocolNode () { } } } + if (parseCode) { + object.code = JSON.parse(node.code) + } if (includeIds) { object.id = node.id } @@ -1471,6 +1477,9 @@ function newProtocolNode () { code: node.code, formula: getProtocolNode(node.formula, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) } + if (parseCode) { + object.code = JSON.parse(node.code) + } if (includeIds) { object.id = node.id } @@ -1486,6 +1495,9 @@ function newProtocolNode () { name: node.name, code: node.code } + if (parseCode) { + object.code = JSON.parse(node.code) + } if (includeIds) { object.id = node.id } From 9fa977ae31ea61578834aab07f59a25a633b51fe Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sat, 9 Nov 2019 19:18:30 +0100 Subject: [PATCH 79/95] Include Parent and Bug Fixes --- .../FunctionLibraries/ChainAttachDetach.js | 1 + .../FunctionLibraries/NodeDeleter.js | 1 + .../FunctionLibraries/ProtocolNode.js | 237 +++++++++--------- .../FunctionLibraries/TaskFunctions.js | 2 +- 4 files changed, 126 insertions(+), 115 deletions(-) diff --git a/DesignerSpace/Workspace/FunctionLibraries/ChainAttachDetach.js b/DesignerSpace/Workspace/FunctionLibraries/ChainAttachDetach.js index 9e19ae313..768153f6a 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/ChainAttachDetach.js +++ b/DesignerSpace/Workspace/FunctionLibraries/ChainAttachDetach.js @@ -609,6 +609,7 @@ function newChainAttachDetach () { node.payload.parentNode.executionStartedEvent = node completeAttachment(node, rootNodes) } + break case 'Execution Finished Event': { node.payload.parentNode = attachToNode node.payload.chainParent = attachToNode diff --git a/DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js b/DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js index fa18dc0c9..b5c8e761f 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js +++ b/DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js @@ -14,6 +14,7 @@ function newNodeDeleter () { deleteCalculationsProcedure: deleteCalculationsProcedure, deleteDataBuildingProcedure: deleteDataBuildingProcedure, deleteProcedureInitialization: deleteProcedureInitialization, + deleteProcessDependencies: deleteProcessDependencies, deleteProcedureLoop: deleteProcedureLoop, deleteOutputDataset: deleteOutputDataset, deleteStatusDependency: deleteStatusDependency, diff --git a/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js b/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js index cf4d4f2e3..5762d387d 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js +++ b/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js @@ -4,7 +4,7 @@ function newProtocolNode () { } return thisObject - function getProtocolNode (node, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) { + function getProtocolNode (node, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) { if (node === undefined) { return } switch (node.type) { case 'Code': @@ -29,7 +29,7 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - code: getProtocolNode(node.code, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + code: getProtocolNode(node.code, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) } if (includeIds) { object.id = node.id @@ -48,7 +48,7 @@ function newProtocolNode () { } for (let m = 0; m < node.conditions.length; m++) { - let condition = getProtocolNode(node.conditions[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + let condition = getProtocolNode(node.conditions[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) if (condition !== undefined) { object.conditions.push(condition) } @@ -87,13 +87,13 @@ function newProtocolNode () { announcements: [] } for (let m = 0; m < node.situations.length; m++) { - let situation = getProtocolNode(node.situations[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + let situation = getProtocolNode(node.situations[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) if (situation !== undefined) { object.situations.push(situation) } } for (let m = 0; m < node.announcements.length; m++) { - let announcement = getProtocolNode(node.announcements[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + let announcement = getProtocolNode(node.announcements[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) if (announcement !== undefined) { object.announcements.push(announcement) } @@ -112,11 +112,11 @@ function newProtocolNode () { subType: node.subType, name: node.name, announcements: [], - formula: getProtocolNode(node.formula, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent), - nextPhaseEvent: getProtocolNode(node.nextPhaseEvent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + formula: getProtocolNode(node.formula, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent), + nextPhaseEvent: getProtocolNode(node.nextPhaseEvent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) } for (let m = 0; m < node.announcements.length; m++) { - let announcement = getProtocolNode(node.announcements[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + let announcement = getProtocolNode(node.announcements[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) if (announcement !== undefined) { object.announcements.push(announcement) } @@ -138,7 +138,7 @@ function newProtocolNode () { } for (let m = 0; m < node.phases.length; m++) { - let phase = getProtocolNode(node.phases[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + let phase = getProtocolNode(node.phases[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) if (phase !== undefined) { object.phases.push(phase) } @@ -160,7 +160,7 @@ function newProtocolNode () { } for (let m = 0; m < node.phases.length; m++) { - let phase = getProtocolNode(node.phases[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + let phase = getProtocolNode(node.phases[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) if (phase !== undefined) { object.phases.push(phase) } @@ -183,13 +183,13 @@ function newProtocolNode () { } for (let m = 0; m < node.situations.length; m++) { - let situation = getProtocolNode(node.situations[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + let situation = getProtocolNode(node.situations[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) if (situation !== undefined) { object.situations.push(situation) } } for (let m = 0; m < node.announcements.length; m++) { - let announcement = getProtocolNode(node.announcements[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + let announcement = getProtocolNode(node.announcements[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) if (announcement !== undefined) { object.announcements.push(announcement) } @@ -212,11 +212,11 @@ function newProtocolNode () { } for (let m = 0; m < node.situations.length; m++) { - let situation = getProtocolNode(node.situations[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + let situation = getProtocolNode(node.situations[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) object.situations.push(situation) } for (let m = 0; m < node.announcements.length; m++) { - let announcement = getProtocolNode(node.announcements[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + let announcement = getProtocolNode(node.announcements[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) if (announcement !== undefined) { object.announcements.push(announcement) } @@ -239,13 +239,13 @@ function newProtocolNode () { } for (let m = 0; m < node.situations.length; m++) { - let situation = getProtocolNode(node.situations[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + let situation = getProtocolNode(node.situations[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) if (situation !== undefined) { object.situations.push(situation) } } for (let m = 0; m < node.announcements.length; m++) { - let announcement = getProtocolNode(node.announcements[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + let announcement = getProtocolNode(node.announcements[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) if (announcement !== undefined) { object.announcements.push(announcement) } @@ -263,10 +263,10 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - stopLoss: getProtocolNode(node.stopLoss, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent), - takeProfit: getProtocolNode(node.takeProfit, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent), - positionSize: getProtocolNode(node.positionSize, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent), - positionRate: getProtocolNode(node.positionRate, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + stopLoss: getProtocolNode(node.stopLoss, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent), + takeProfit: getProtocolNode(node.takeProfit, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent), + positionSize: getProtocolNode(node.positionSize, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent), + positionRate: getProtocolNode(node.positionRate, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) } if (includeIds) { object.id = node.id @@ -309,7 +309,7 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - formula: getProtocolNode(node.formula, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + formula: getProtocolNode(node.formula, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) } if (includeIds) { object.id = node.id @@ -324,7 +324,7 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - formula: getProtocolNode(node.formula, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + formula: getProtocolNode(node.formula, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) } if (includeIds) { object.id = node.id @@ -339,9 +339,9 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - triggerOn: getProtocolNode(node.triggerOn, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent), - triggerOff: getProtocolNode(node.triggerOff, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent), - takePosition: getProtocolNode(node.takePosition, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + triggerOn: getProtocolNode(node.triggerOn, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent), + triggerOff: getProtocolNode(node.triggerOff, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent), + takePosition: getProtocolNode(node.takePosition, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) } if (includeIds) { object.id = node.id @@ -356,8 +356,8 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - initialDefinition: getProtocolNode(node.initialDefinition, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent), - openExecution: getProtocolNode(node.openExecution, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + initialDefinition: getProtocolNode(node.initialDefinition, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent), + openExecution: getProtocolNode(node.openExecution, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) } if (includeIds) { object.id = node.id @@ -372,8 +372,8 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - stopLoss: getProtocolNode(node.stopLoss, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent), - takeProfit: getProtocolNode(node.takeProfit, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + stopLoss: getProtocolNode(node.stopLoss, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent), + takeProfit: getProtocolNode(node.takeProfit, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) } if (includeIds) { object.id = node.id @@ -388,7 +388,7 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - closeExecution: getProtocolNode(node.closeExecution, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + closeExecution: getProtocolNode(node.closeExecution, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) } if (includeIds) { object.id = node.id @@ -403,10 +403,10 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - triggerStage: getProtocolNode(node.triggerStage, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent), - openStage: getProtocolNode(node.openStage, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent), - manageStage: getProtocolNode(node.manageStage, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent), - closeStage: getProtocolNode(node.closeStage, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + triggerStage: getProtocolNode(node.triggerStage, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent), + openStage: getProtocolNode(node.openStage, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent), + manageStage: getProtocolNode(node.manageStage, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent), + closeStage: getProtocolNode(node.closeStage, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) } if (includeIds) { object.id = node.id @@ -508,12 +508,12 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - baseAsset: getProtocolNode(node.baseAsset, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent), - timeRange: getProtocolNode(node.timeRange, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent), - timePeriod: getProtocolNode(node.timePeriod, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent), - slippage: getProtocolNode(node.slippage, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent), - feeStructure: getProtocolNode(node.feeStructure, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent), - key: getProtocolNode(node.key, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + baseAsset: getProtocolNode(node.baseAsset, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent), + timeRange: getProtocolNode(node.timeRange, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent), + timePeriod: getProtocolNode(node.timePeriod, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent), + slippage: getProtocolNode(node.slippage, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent), + feeStructure: getProtocolNode(node.feeStructure, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent), + key: getProtocolNode(node.key, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) } if (includeIds) { object.id = node.id @@ -529,11 +529,11 @@ function newProtocolNode () { subType: node.subType, name: node.name, strategies: [], - parameters: getProtocolNode(node.parameters, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + parameters: getProtocolNode(node.parameters, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) } for (let m = 0; m < node.strategies.length; m++) { - let strategy = getProtocolNode(node.strategies[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + let strategy = getProtocolNode(node.strategies[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) if (strategy !== undefined) { object.strategies.push(strategy) } @@ -556,7 +556,7 @@ function newProtocolNode () { } for (let m = 0; m < node.exchangeAccounts.length; m++) { - let exchangeAccount = getProtocolNode(node.exchangeAccounts[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + let exchangeAccount = getProtocolNode(node.exchangeAccounts[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) if (exchangeAccount !== undefined) { object.exchangeAccounts.push(exchangeAccount) } @@ -580,13 +580,13 @@ function newProtocolNode () { } for (let m = 0; m < node.assets.length; m++) { - let asset = getProtocolNode(node.assets[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + let asset = getProtocolNode(node.assets[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) if (asset !== undefined) { object.assets.push(asset) } } for (let m = 0; m < node.keys.length; m++) { - let key = getProtocolNode(node.keys[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + let key = getProtocolNode(node.keys[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) if (key !== undefined) { object.keys.push(key) } @@ -639,7 +639,7 @@ function newProtocolNode () { } for (let m = 0; m < node.bots.length; m++) { - let bot = getProtocolNode(node.bots[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + let bot = getProtocolNode(node.bots[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) if (bot !== undefined) { object.bots.push(bot) } @@ -663,7 +663,7 @@ function newProtocolNode () { } for (let m = 0; m < node.announcements.length; m++) { - let announcement = getProtocolNode(node.announcements[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + let announcement = getProtocolNode(node.announcements[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) if (announcement !== undefined) { object.announcements.push(announcement) } @@ -685,7 +685,7 @@ function newProtocolNode () { subType: node.subType, name: node.name, code: node.code, - formula: getProtocolNode(node.formula, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + formula: getProtocolNode(node.formula, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) } if (includeIds) { object.id = node.id @@ -704,7 +704,7 @@ function newProtocolNode () { } for (let m = 0; m < node.layers.length; m++) { - let layer = getProtocolNode(node.layers[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + let layer = getProtocolNode(node.layers[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) if (layer !== undefined) { object.layers.push(layer) } @@ -744,7 +744,7 @@ function newProtocolNode () { } for (let m = 0; m < node.tasks.length; m++) { - let task = getProtocolNode(node.tasks[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + let task = getProtocolNode(node.tasks[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) if (task !== undefined) { object.tasks.push(task) } @@ -762,7 +762,7 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - bot: getProtocolNode(node.bot, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + bot: getProtocolNode(node.bot, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) } if (includeIds) { object.id = node.id @@ -782,7 +782,7 @@ function newProtocolNode () { } for (let m = 0; m < node.processes.length; m++) { - let process = getProtocolNode(node.processes[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + let process = getProtocolNode(node.processes[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) if (process !== undefined) { object.processes.push(process) } @@ -808,7 +808,7 @@ function newProtocolNode () { } for (let m = 0; m < node.processes.length; m++) { - let process = getProtocolNode(node.processes[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + let process = getProtocolNode(node.processes[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) if (process !== undefined) { object.processes.push(process) } @@ -834,7 +834,7 @@ function newProtocolNode () { } for (let m = 0; m < node.processes.length; m++) { - let process = getProtocolNode(node.processes[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + let process = getProtocolNode(node.processes[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) if (process !== undefined) { object.processes.push(process) } @@ -856,7 +856,7 @@ function newProtocolNode () { subType: node.subType, name: node.name, code: node.code, - session: getProtocolNode(node.session, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + session: getProtocolNode(node.session, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) } if (parseCode) { object.code = JSON.parse(node.code) @@ -868,7 +868,7 @@ function newProtocolNode () { object.savedPayload = getSavedPayload(node, includeReferences) } if (followReferenceParent) { - object.referenceParent = getProtocolNode(node.payload.referenceParent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + object.referenceParent = getProtocolNode(node.payload.referenceParent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) } return object } @@ -878,9 +878,9 @@ function newProtocolNode () { subType: node.subType, name: node.name, code: node.code, - parameters: getProtocolNode(node.parameters, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent), - layerManager: getProtocolNode(node.layerManager, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent), - socialBots: getProtocolNode(node.socialBots, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + parameters: getProtocolNode(node.parameters, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent), + layerManager: getProtocolNode(node.layerManager, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent), + socialBots: getProtocolNode(node.socialBots, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) } if (parseCode) { object.code = JSON.parse(object.code) @@ -892,7 +892,7 @@ function newProtocolNode () { object.savedPayload = getSavedPayload(node, includeReferences) } if (followReferenceParent) { - object.referenceParent = getProtocolNode(node.payload.referenceParent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + object.referenceParent = getProtocolNode(node.payload.referenceParent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) } return object } @@ -902,9 +902,9 @@ function newProtocolNode () { subType: node.subType, name: node.name, code: node.code, - parameters: getProtocolNode(node.parameters, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent), - layerManager: getProtocolNode(node.layerManager, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent), - socialBots: getProtocolNode(node.socialBots, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + parameters: getProtocolNode(node.parameters, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent), + layerManager: getProtocolNode(node.layerManager, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent), + socialBots: getProtocolNode(node.socialBots, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) } if (parseCode) { object.code = JSON.parse(node.code) @@ -916,7 +916,7 @@ function newProtocolNode () { object.savedPayload = getSavedPayload(node, includeReferences) } if (followReferenceParent) { - object.referenceParent = getProtocolNode(node.payload.referenceParent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + object.referenceParent = getProtocolNode(node.payload.referenceParent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) } return object } @@ -926,9 +926,9 @@ function newProtocolNode () { subType: node.subType, name: node.name, code: node.code, - parameters: getProtocolNode(node.parameters, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent), - layerManager: getProtocolNode(node.layerManager, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent), - socialBots: getProtocolNode(node.socialBots, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + parameters: getProtocolNode(node.parameters, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent), + layerManager: getProtocolNode(node.layerManager, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent), + socialBots: getProtocolNode(node.socialBots, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) } if (parseCode) { object.code = JSON.parse(object.code) @@ -940,7 +940,7 @@ function newProtocolNode () { object.savedPayload = getSavedPayload(node, includeReferences) } if (followReferenceParent) { - object.referenceParent = getProtocolNode(node.payload.referenceParent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + object.referenceParent = getProtocolNode(node.payload.referenceParent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) } return object } @@ -950,9 +950,9 @@ function newProtocolNode () { subType: node.subType, name: node.name, code: node.code, - parameters: getProtocolNode(node.parameters, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent), - layerManager: getProtocolNode(node.layerManager, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent), - socialBots: getProtocolNode(node.socialBots, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + parameters: getProtocolNode(node.parameters, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent), + layerManager: getProtocolNode(node.layerManager, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent), + socialBots: getProtocolNode(node.socialBots, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) } if (parseCode) { object.code = JSON.parse(node.code) @@ -964,7 +964,7 @@ function newProtocolNode () { object.savedPayload = getSavedPayload(node, includeReferences) } if (followReferenceParent) { - object.referenceParent = getProtocolNode(node.payload.referenceParent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + object.referenceParent = getProtocolNode(node.payload.referenceParent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) } return object } @@ -977,7 +977,7 @@ function newProtocolNode () { } if (node.taskManagers !== undefined) { for (let m = 0; m < node.taskManagers.length; m++) { - let taskManager = getProtocolNode(node.taskManagers[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + let taskManager = getProtocolNode(node.taskManagers[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) if (taskManager !== undefined) { object.taskManagers.push(taskManager) } @@ -1000,7 +1000,7 @@ function newProtocolNode () { } if (node.networkNodes !== undefined) { for (let m = 0; m < node.networkNodes.length; m++) { - let networkNode = getProtocolNode(node.networkNodes[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + let networkNode = getProtocolNode(node.networkNodes[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) if (networkNode !== undefined) { object.networkNodes.push(networkNode) } @@ -1019,8 +1019,8 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - tradingSystem: getProtocolNode(node.tradingSystem, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent), - personalData: getProtocolNode(node.personalData, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + tradingSystem: getProtocolNode(node.tradingSystem, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent), + personalData: getProtocolNode(node.personalData, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) } if (includeIds) { object.id = node.id @@ -1043,7 +1043,7 @@ function newProtocolNode () { } if (node.sensorBots !== undefined) { for (let m = 0; m < node.sensorBots.length; m++) { - let sensorBot = getProtocolNode(node.sensorBots[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + let sensorBot = getProtocolNode(node.sensorBots[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) if (sensorBot !== undefined) { object.sensorBots.push(sensorBot) } @@ -1051,7 +1051,7 @@ function newProtocolNode () { } if (node.indicatorBots !== undefined) { for (let m = 0; m < node.indicatorBots.length; m++) { - let indicatorBot = getProtocolNode(node.indicatorBots[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + let indicatorBot = getProtocolNode(node.indicatorBots[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) if (indicatorBot !== undefined) { object.indicatorBots.push(indicatorBot) } @@ -1059,7 +1059,7 @@ function newProtocolNode () { } if (node.tradingBots !== undefined) { for (let m = 0; m < node.tradingBots.length; m++) { - let tradingBot = getProtocolNode(node.tradingBots[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + let tradingBot = getProtocolNode(node.tradingBots[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) if (tradingBot !== undefined) { object.tradingBots.push(tradingBot) } @@ -1067,7 +1067,7 @@ function newProtocolNode () { } if (node.plotters !== undefined) { for (let m = 0; m < node.plotters.length; m++) { - let plotter = getProtocolNode(node.plotters[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + let plotter = getProtocolNode(node.plotters[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) if (plotter !== undefined) { object.plotters.push(plotter) } @@ -1092,7 +1092,7 @@ function newProtocolNode () { } if (node.processes !== undefined) { for (let m = 0; m < node.processes.length; m++) { - let process = getProtocolNode(node.processes[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + let process = getProtocolNode(node.processes[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) if (process !== undefined) { object.processes.push(process) } @@ -1100,7 +1100,7 @@ function newProtocolNode () { } if (node.products !== undefined) { for (let m = 0; m < node.products.length; m++) { - let product = getProtocolNode(node.products[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + let product = getProtocolNode(node.products[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) if (product !== undefined) { object.products.push(product) } @@ -1125,7 +1125,7 @@ function newProtocolNode () { } if (node.processes !== undefined) { for (let m = 0; m < node.processes.length; m++) { - let process = getProtocolNode(node.processes[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + let process = getProtocolNode(node.processes[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) if (process !== undefined) { object.processes.push(process) } @@ -1133,7 +1133,7 @@ function newProtocolNode () { } if (node.products !== undefined) { for (let m = 0; m < node.products.length; m++) { - let product = getProtocolNode(node.products[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + let product = getProtocolNode(node.products[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) if (product !== undefined) { object.products.push(product) } @@ -1158,7 +1158,7 @@ function newProtocolNode () { } if (node.processes !== undefined) { for (let m = 0; m < node.processes.length; m++) { - let process = getProtocolNode(node.processes[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + let process = getProtocolNode(node.processes[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) if (process !== undefined) { object.processes.push(process) } @@ -1166,7 +1166,7 @@ function newProtocolNode () { } if (node.products !== undefined) { for (let m = 0; m < node.products.length; m++) { - let product = getProtocolNode(node.products[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + let product = getProtocolNode(node.products[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) if (product !== undefined) { object.products.push(product) } @@ -1186,13 +1186,13 @@ function newProtocolNode () { subType: node.subType, name: node.name, code: node.code, - processOutput: getProtocolNode(node.processOutput, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent), - processDependencies: getProtocolNode(node.processDependencies, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent), - statusReport: getProtocolNode(node.statusReport, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent), - executionStartedEvent: getProtocolNode(node.executionStartedEvent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent), - executionFinishedEvent: getProtocolNode(node.executionFinishedEvent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent), - calculations: getProtocolNode(node.calculations, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent), - dataBuilding: getProtocolNode(node.dataBuilding, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + processOutput: getProtocolNode(node.processOutput, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent), + processDependencies: getProtocolNode(node.processDependencies, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent), + statusReport: getProtocolNode(node.statusReport, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent), + executionStartedEvent: getProtocolNode(node.executionStartedEvent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent), + executionFinishedEvent: getProtocolNode(node.executionFinishedEvent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent), + calculations: getProtocolNode(node.calculations, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent), + dataBuilding: getProtocolNode(node.dataBuilding, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) } if (parseCode) { object.code = JSON.parse(node.code) @@ -1214,7 +1214,7 @@ function newProtocolNode () { } if (node.outputDatasets !== undefined) { for (let m = 0; m < node.outputDatasets.length; m++) { - let outputDataset = getProtocolNode(node.outputDatasets[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + let outputDataset = getProtocolNode(node.outputDatasets[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) if (outputDataset !== undefined) { object.outputDatasets.push(outputDataset) } @@ -1238,7 +1238,7 @@ function newProtocolNode () { } if (node.statusDependencies !== undefined) { for (let m = 0; m < node.statusDependencies.length; m++) { - let statusDependency = getProtocolNode(node.statusDependencies[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + let statusDependency = getProtocolNode(node.statusDependencies[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) if (statusDependency !== undefined) { object.statusDependencies.push(statusDependency) } @@ -1246,7 +1246,7 @@ function newProtocolNode () { } if (node.dataDependencies !== undefined) { for (let m = 0; m < node.dataDependencies.length; m++) { - let dataDependency = getProtocolNode(node.dataDependencies[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + let dataDependency = getProtocolNode(node.dataDependencies[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) if (dataDependency !== undefined) { object.dataDependencies.push(dataDependency) } @@ -1287,7 +1287,7 @@ function newProtocolNode () { object.savedPayload = getSavedPayload(node, includeReferences) } if (followReferenceParent) { - object.referenceParent = getProtocolNode(node.payload.referenceParent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + object.referenceParent = getProtocolNode(node.payload.referenceParent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) } return object } @@ -1303,6 +1303,15 @@ function newProtocolNode () { if (includePayload) { object.savedPayload = getSavedPayload(node, includeReferences) } + if (includeParent) { + object.parentNode = { + type: node.payload.parentNode.type, + subType: node.payload.parentNode.subType, + name: node.payload.parentNode.name, + id: node.payload.parentNode.id, + code: JSON.parse(node.payload.parentNode.code) + } + } return object } case 'Calculations Procedure': { @@ -1310,8 +1319,8 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - initialization: getProtocolNode(node.initialization, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent), - loop: getProtocolNode(node.loop, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + initialization: getProtocolNode(node.initialization, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent), + loop: getProtocolNode(node.loop, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) } if (includeIds) { object.id = node.id @@ -1326,8 +1335,8 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - initialization: getProtocolNode(node.initialization, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent), - loop: getProtocolNode(node.loop, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + initialization: getProtocolNode(node.initialization, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent), + loop: getProtocolNode(node.loop, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) } if (includeIds) { object.id = node.id @@ -1342,7 +1351,7 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - code: getProtocolNode(node.code, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + code: getProtocolNode(node.code, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) } if (includeIds) { object.id = node.id @@ -1357,7 +1366,7 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - code: getProtocolNode(node.code, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + code: getProtocolNode(node.code, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) } if (includeIds) { object.id = node.id @@ -1380,7 +1389,7 @@ function newProtocolNode () { object.savedPayload = getSavedPayload(node, includeReferences) } if (followReferenceParent) { - object.referenceParent = getProtocolNode(node.payload.referenceParent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + object.referenceParent = getProtocolNode(node.payload.referenceParent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) } return object } @@ -1397,7 +1406,7 @@ function newProtocolNode () { object.savedPayload = getSavedPayload(node, includeReferences) } if (followReferenceParent) { - object.referenceParent = getProtocolNode(node.payload.referenceParent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + object.referenceParent = getProtocolNode(node.payload.referenceParent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) } return object } @@ -1414,7 +1423,7 @@ function newProtocolNode () { object.savedPayload = getSavedPayload(node, includeReferences) } if (followReferenceParent) { - object.referenceParent = getProtocolNode(node.payload.referenceParent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + object.referenceParent = getProtocolNode(node.payload.referenceParent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) } return object } @@ -1424,12 +1433,12 @@ function newProtocolNode () { subType: node.subType, name: node.name, code: node.code, - record: getProtocolNode(node.record, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent), + record: getProtocolNode(node.record, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent), datasets: [] } if (node.datasets !== undefined) { for (let m = 0; m < node.datasets.length; m++) { - let dataset = getProtocolNode(node.datasets[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + let dataset = getProtocolNode(node.datasets[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) if (dataset !== undefined) { object.datasets.push(dataset) } @@ -1455,7 +1464,7 @@ function newProtocolNode () { } if (node.properties !== undefined) { for (let m = 0; m < node.properties.length; m++) { - let property = getProtocolNode(node.properties[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + let property = getProtocolNode(node.properties[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) if (property !== undefined) { object.properties.push(property) } @@ -1475,7 +1484,7 @@ function newProtocolNode () { subType: node.subType, name: node.name, code: node.code, - formula: getProtocolNode(node.formula, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + formula: getProtocolNode(node.formula, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) } if (parseCode) { object.code = JSON.parse(node.code) @@ -1515,7 +1524,7 @@ function newProtocolNode () { } if (node.modules !== undefined) { for (let m = 0; m < node.modules.length; m++) { - let module = getProtocolNode(node.modules[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + let module = getProtocolNode(node.modules[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) if (module !== undefined) { object.modules.push(module) } @@ -1534,12 +1543,12 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - code: getProtocolNode(node.code, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent), + code: getProtocolNode(node.code, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent), panels: [] } if (node.panels !== undefined) { for (let m = 0; m < node.panels.length; m++) { - let panel = getProtocolNode(node.panels[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + let panel = getProtocolNode(node.panels[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) if (panel !== undefined) { object.panels.push(panel) } @@ -1558,7 +1567,7 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - code: getProtocolNode(node.code, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent) + code: getProtocolNode(node.code, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) } if (includeIds) { object.id = node.id diff --git a/DesignerSpace/Workspace/FunctionLibraries/TaskFunctions.js b/DesignerSpace/Workspace/FunctionLibraries/TaskFunctions.js index 4d73ec4cf..43acc3873 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/TaskFunctions.js +++ b/DesignerSpace/Workspace/FunctionLibraries/TaskFunctions.js @@ -29,7 +29,7 @@ function newTaskFunctions () { let event = { taskId: node.id, taskName: node.name, - definition: JSON.stringify(functionLibraryProtocolNode.getProtocolNode(node, false, true, true, false, false, true)) // <- We need to do this workaround in order no to send unescaped charactars to the taskManager. + definition: JSON.stringify(functionLibraryProtocolNode.getProtocolNode(node, false, true, true, false, false, true, true)) // <- We need to do this workaround in order no to send unescaped charactars to the taskManager. } systemEventHandler.raiseEvent('Task Manager', 'Run Task', event) } From 368b8cf6e962671ac80b91faa56e4c790157b48f Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sun, 10 Nov 2019 12:19:27 +0100 Subject: [PATCH 80/95] Small correction --- FloatingSpace/CircularProgressBar.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/FloatingSpace/CircularProgressBar.js b/FloatingSpace/CircularProgressBar.js index 613441a30..1fb58ce00 100644 --- a/FloatingSpace/CircularProgressBar.js +++ b/FloatingSpace/CircularProgressBar.js @@ -28,7 +28,8 @@ function newCircularProgressBar () { return thisObject function finalize () { - systemEventHandler.stopListening('Jason-Heartbeat-Period', eventSubscriptionHeartbeat) + let key = thisObject.payload.node.name + '-' + thisObject.payload.node.type + '-' + thisObject.payload.node.id + systemEventHandler.stopListening(key, eventSubscriptionHeartbeat) thisObject.container = undefined thisObject.payload = undefined From d20be80b073f20edf2bd8e1a95bba195b440f7b6 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sun, 10 Nov 2019 17:15:31 +0100 Subject: [PATCH 81/95] follow ancestors --- .../FunctionLibraries/ProtocolNode.js | 384 ++++++++++-------- 1 file changed, 215 insertions(+), 169 deletions(-) diff --git a/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js b/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js index 5762d387d..453dffc93 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js +++ b/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js @@ -4,7 +4,7 @@ function newProtocolNode () { } return thisObject - function getProtocolNode (node, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) { + function getProtocolNode (node, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) { if (node === undefined) { return } switch (node.type) { case 'Code': @@ -29,7 +29,7 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - code: getProtocolNode(node.code, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) + code: getProtocolNode(node.code, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) } if (includeIds) { object.id = node.id @@ -48,7 +48,7 @@ function newProtocolNode () { } for (let m = 0; m < node.conditions.length; m++) { - let condition = getProtocolNode(node.conditions[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) + let condition = getProtocolNode(node.conditions[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) if (condition !== undefined) { object.conditions.push(condition) } @@ -87,13 +87,13 @@ function newProtocolNode () { announcements: [] } for (let m = 0; m < node.situations.length; m++) { - let situation = getProtocolNode(node.situations[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) + let situation = getProtocolNode(node.situations[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) if (situation !== undefined) { object.situations.push(situation) } } for (let m = 0; m < node.announcements.length; m++) { - let announcement = getProtocolNode(node.announcements[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) + let announcement = getProtocolNode(node.announcements[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) if (announcement !== undefined) { object.announcements.push(announcement) } @@ -112,11 +112,11 @@ function newProtocolNode () { subType: node.subType, name: node.name, announcements: [], - formula: getProtocolNode(node.formula, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent), - nextPhaseEvent: getProtocolNode(node.nextPhaseEvent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) + formula: getProtocolNode(node.formula, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren), + nextPhaseEvent: getProtocolNode(node.nextPhaseEvent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) } for (let m = 0; m < node.announcements.length; m++) { - let announcement = getProtocolNode(node.announcements[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) + let announcement = getProtocolNode(node.announcements[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) if (announcement !== undefined) { object.announcements.push(announcement) } @@ -138,7 +138,7 @@ function newProtocolNode () { } for (let m = 0; m < node.phases.length; m++) { - let phase = getProtocolNode(node.phases[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) + let phase = getProtocolNode(node.phases[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) if (phase !== undefined) { object.phases.push(phase) } @@ -160,7 +160,7 @@ function newProtocolNode () { } for (let m = 0; m < node.phases.length; m++) { - let phase = getProtocolNode(node.phases[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) + let phase = getProtocolNode(node.phases[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) if (phase !== undefined) { object.phases.push(phase) } @@ -183,13 +183,13 @@ function newProtocolNode () { } for (let m = 0; m < node.situations.length; m++) { - let situation = getProtocolNode(node.situations[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) + let situation = getProtocolNode(node.situations[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) if (situation !== undefined) { object.situations.push(situation) } } for (let m = 0; m < node.announcements.length; m++) { - let announcement = getProtocolNode(node.announcements[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) + let announcement = getProtocolNode(node.announcements[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) if (announcement !== undefined) { object.announcements.push(announcement) } @@ -212,11 +212,11 @@ function newProtocolNode () { } for (let m = 0; m < node.situations.length; m++) { - let situation = getProtocolNode(node.situations[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) + let situation = getProtocolNode(node.situations[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) object.situations.push(situation) } for (let m = 0; m < node.announcements.length; m++) { - let announcement = getProtocolNode(node.announcements[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) + let announcement = getProtocolNode(node.announcements[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) if (announcement !== undefined) { object.announcements.push(announcement) } @@ -239,13 +239,13 @@ function newProtocolNode () { } for (let m = 0; m < node.situations.length; m++) { - let situation = getProtocolNode(node.situations[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) + let situation = getProtocolNode(node.situations[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) if (situation !== undefined) { object.situations.push(situation) } } for (let m = 0; m < node.announcements.length; m++) { - let announcement = getProtocolNode(node.announcements[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) + let announcement = getProtocolNode(node.announcements[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) if (announcement !== undefined) { object.announcements.push(announcement) } @@ -263,10 +263,10 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - stopLoss: getProtocolNode(node.stopLoss, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent), - takeProfit: getProtocolNode(node.takeProfit, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent), - positionSize: getProtocolNode(node.positionSize, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent), - positionRate: getProtocolNode(node.positionRate, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) + stopLoss: getProtocolNode(node.stopLoss, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren), + takeProfit: getProtocolNode(node.takeProfit, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren), + positionSize: getProtocolNode(node.positionSize, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren), + positionRate: getProtocolNode(node.positionRate, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) } if (includeIds) { object.id = node.id @@ -309,7 +309,7 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - formula: getProtocolNode(node.formula, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) + formula: getProtocolNode(node.formula, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) } if (includeIds) { object.id = node.id @@ -324,7 +324,7 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - formula: getProtocolNode(node.formula, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) + formula: getProtocolNode(node.formula, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) } if (includeIds) { object.id = node.id @@ -339,9 +339,9 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - triggerOn: getProtocolNode(node.triggerOn, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent), - triggerOff: getProtocolNode(node.triggerOff, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent), - takePosition: getProtocolNode(node.takePosition, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) + triggerOn: getProtocolNode(node.triggerOn, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren), + triggerOff: getProtocolNode(node.triggerOff, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren), + takePosition: getProtocolNode(node.takePosition, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) } if (includeIds) { object.id = node.id @@ -356,8 +356,8 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - initialDefinition: getProtocolNode(node.initialDefinition, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent), - openExecution: getProtocolNode(node.openExecution, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) + initialDefinition: getProtocolNode(node.initialDefinition, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren), + openExecution: getProtocolNode(node.openExecution, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) } if (includeIds) { object.id = node.id @@ -372,8 +372,8 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - stopLoss: getProtocolNode(node.stopLoss, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent), - takeProfit: getProtocolNode(node.takeProfit, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) + stopLoss: getProtocolNode(node.stopLoss, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren), + takeProfit: getProtocolNode(node.takeProfit, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) } if (includeIds) { object.id = node.id @@ -388,7 +388,7 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - closeExecution: getProtocolNode(node.closeExecution, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) + closeExecution: getProtocolNode(node.closeExecution, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) } if (includeIds) { object.id = node.id @@ -403,10 +403,10 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - triggerStage: getProtocolNode(node.triggerStage, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent), - openStage: getProtocolNode(node.openStage, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent), - manageStage: getProtocolNode(node.manageStage, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent), - closeStage: getProtocolNode(node.closeStage, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) + triggerStage: getProtocolNode(node.triggerStage, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren), + openStage: getProtocolNode(node.openStage, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren), + manageStage: getProtocolNode(node.manageStage, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren), + closeStage: getProtocolNode(node.closeStage, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) } if (includeIds) { object.id = node.id @@ -508,12 +508,12 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - baseAsset: getProtocolNode(node.baseAsset, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent), - timeRange: getProtocolNode(node.timeRange, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent), - timePeriod: getProtocolNode(node.timePeriod, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent), - slippage: getProtocolNode(node.slippage, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent), - feeStructure: getProtocolNode(node.feeStructure, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent), - key: getProtocolNode(node.key, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) + baseAsset: getProtocolNode(node.baseAsset, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren), + timeRange: getProtocolNode(node.timeRange, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren), + timePeriod: getProtocolNode(node.timePeriod, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren), + slippage: getProtocolNode(node.slippage, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren), + feeStructure: getProtocolNode(node.feeStructure, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren), + key: getProtocolNode(node.key, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) } if (includeIds) { object.id = node.id @@ -529,11 +529,11 @@ function newProtocolNode () { subType: node.subType, name: node.name, strategies: [], - parameters: getProtocolNode(node.parameters, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) + parameters: getProtocolNode(node.parameters, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) } for (let m = 0; m < node.strategies.length; m++) { - let strategy = getProtocolNode(node.strategies[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) + let strategy = getProtocolNode(node.strategies[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) if (strategy !== undefined) { object.strategies.push(strategy) } @@ -556,7 +556,7 @@ function newProtocolNode () { } for (let m = 0; m < node.exchangeAccounts.length; m++) { - let exchangeAccount = getProtocolNode(node.exchangeAccounts[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) + let exchangeAccount = getProtocolNode(node.exchangeAccounts[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) if (exchangeAccount !== undefined) { object.exchangeAccounts.push(exchangeAccount) } @@ -580,13 +580,13 @@ function newProtocolNode () { } for (let m = 0; m < node.assets.length; m++) { - let asset = getProtocolNode(node.assets[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) + let asset = getProtocolNode(node.assets[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) if (asset !== undefined) { object.assets.push(asset) } } for (let m = 0; m < node.keys.length; m++) { - let key = getProtocolNode(node.keys[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) + let key = getProtocolNode(node.keys[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) if (key !== undefined) { object.keys.push(key) } @@ -639,7 +639,7 @@ function newProtocolNode () { } for (let m = 0; m < node.bots.length; m++) { - let bot = getProtocolNode(node.bots[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) + let bot = getProtocolNode(node.bots[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) if (bot !== undefined) { object.bots.push(bot) } @@ -663,7 +663,7 @@ function newProtocolNode () { } for (let m = 0; m < node.announcements.length; m++) { - let announcement = getProtocolNode(node.announcements[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) + let announcement = getProtocolNode(node.announcements[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) if (announcement !== undefined) { object.announcements.push(announcement) } @@ -685,7 +685,7 @@ function newProtocolNode () { subType: node.subType, name: node.name, code: node.code, - formula: getProtocolNode(node.formula, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) + formula: getProtocolNode(node.formula, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) } if (includeIds) { object.id = node.id @@ -704,7 +704,7 @@ function newProtocolNode () { } for (let m = 0; m < node.layers.length; m++) { - let layer = getProtocolNode(node.layers[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) + let layer = getProtocolNode(node.layers[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) if (layer !== undefined) { object.layers.push(layer) } @@ -744,7 +744,7 @@ function newProtocolNode () { } for (let m = 0; m < node.tasks.length; m++) { - let task = getProtocolNode(node.tasks[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) + let task = getProtocolNode(node.tasks[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) if (task !== undefined) { object.tasks.push(task) } @@ -762,7 +762,7 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - bot: getProtocolNode(node.bot, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) + bot: getProtocolNode(node.bot, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) } if (includeIds) { object.id = node.id @@ -782,7 +782,7 @@ function newProtocolNode () { } for (let m = 0; m < node.processes.length; m++) { - let process = getProtocolNode(node.processes[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) + let process = getProtocolNode(node.processes[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) if (process !== undefined) { object.processes.push(process) } @@ -808,7 +808,7 @@ function newProtocolNode () { } for (let m = 0; m < node.processes.length; m++) { - let process = getProtocolNode(node.processes[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) + let process = getProtocolNode(node.processes[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) if (process !== undefined) { object.processes.push(process) } @@ -834,7 +834,7 @@ function newProtocolNode () { } for (let m = 0; m < node.processes.length; m++) { - let process = getProtocolNode(node.processes[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) + let process = getProtocolNode(node.processes[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) if (process !== undefined) { object.processes.push(process) } @@ -856,7 +856,7 @@ function newProtocolNode () { subType: node.subType, name: node.name, code: node.code, - session: getProtocolNode(node.session, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) + session: getProtocolNode(node.session, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) } if (parseCode) { object.code = JSON.parse(node.code) @@ -868,7 +868,7 @@ function newProtocolNode () { object.savedPayload = getSavedPayload(node, includeReferences) } if (followReferenceParent) { - object.referenceParent = getProtocolNode(node.payload.referenceParent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) + object.referenceParent = getProtocolNode(node.payload.referenceParent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) } return object } @@ -878,9 +878,9 @@ function newProtocolNode () { subType: node.subType, name: node.name, code: node.code, - parameters: getProtocolNode(node.parameters, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent), - layerManager: getProtocolNode(node.layerManager, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent), - socialBots: getProtocolNode(node.socialBots, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) + parameters: getProtocolNode(node.parameters, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren), + layerManager: getProtocolNode(node.layerManager, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren), + socialBots: getProtocolNode(node.socialBots, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) } if (parseCode) { object.code = JSON.parse(object.code) @@ -892,7 +892,7 @@ function newProtocolNode () { object.savedPayload = getSavedPayload(node, includeReferences) } if (followReferenceParent) { - object.referenceParent = getProtocolNode(node.payload.referenceParent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) + object.referenceParent = getProtocolNode(node.payload.referenceParent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) } return object } @@ -902,9 +902,9 @@ function newProtocolNode () { subType: node.subType, name: node.name, code: node.code, - parameters: getProtocolNode(node.parameters, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent), - layerManager: getProtocolNode(node.layerManager, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent), - socialBots: getProtocolNode(node.socialBots, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) + parameters: getProtocolNode(node.parameters, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren), + layerManager: getProtocolNode(node.layerManager, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren), + socialBots: getProtocolNode(node.socialBots, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) } if (parseCode) { object.code = JSON.parse(node.code) @@ -916,7 +916,7 @@ function newProtocolNode () { object.savedPayload = getSavedPayload(node, includeReferences) } if (followReferenceParent) { - object.referenceParent = getProtocolNode(node.payload.referenceParent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) + object.referenceParent = getProtocolNode(node.payload.referenceParent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) } return object } @@ -926,9 +926,9 @@ function newProtocolNode () { subType: node.subType, name: node.name, code: node.code, - parameters: getProtocolNode(node.parameters, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent), - layerManager: getProtocolNode(node.layerManager, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent), - socialBots: getProtocolNode(node.socialBots, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) + parameters: getProtocolNode(node.parameters, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren), + layerManager: getProtocolNode(node.layerManager, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren), + socialBots: getProtocolNode(node.socialBots, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) } if (parseCode) { object.code = JSON.parse(object.code) @@ -940,7 +940,7 @@ function newProtocolNode () { object.savedPayload = getSavedPayload(node, includeReferences) } if (followReferenceParent) { - object.referenceParent = getProtocolNode(node.payload.referenceParent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) + object.referenceParent = getProtocolNode(node.payload.referenceParent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) } return object } @@ -950,9 +950,9 @@ function newProtocolNode () { subType: node.subType, name: node.name, code: node.code, - parameters: getProtocolNode(node.parameters, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent), - layerManager: getProtocolNode(node.layerManager, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent), - socialBots: getProtocolNode(node.socialBots, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) + parameters: getProtocolNode(node.parameters, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren), + layerManager: getProtocolNode(node.layerManager, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren), + socialBots: getProtocolNode(node.socialBots, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) } if (parseCode) { object.code = JSON.parse(node.code) @@ -964,7 +964,7 @@ function newProtocolNode () { object.savedPayload = getSavedPayload(node, includeReferences) } if (followReferenceParent) { - object.referenceParent = getProtocolNode(node.payload.referenceParent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) + object.referenceParent = getProtocolNode(node.payload.referenceParent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) } return object } @@ -977,7 +977,7 @@ function newProtocolNode () { } if (node.taskManagers !== undefined) { for (let m = 0; m < node.taskManagers.length; m++) { - let taskManager = getProtocolNode(node.taskManagers[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) + let taskManager = getProtocolNode(node.taskManagers[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) if (taskManager !== undefined) { object.taskManagers.push(taskManager) } @@ -1000,7 +1000,7 @@ function newProtocolNode () { } if (node.networkNodes !== undefined) { for (let m = 0; m < node.networkNodes.length; m++) { - let networkNode = getProtocolNode(node.networkNodes[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) + let networkNode = getProtocolNode(node.networkNodes[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) if (networkNode !== undefined) { object.networkNodes.push(networkNode) } @@ -1019,8 +1019,8 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - tradingSystem: getProtocolNode(node.tradingSystem, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent), - personalData: getProtocolNode(node.personalData, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) + tradingSystem: getProtocolNode(node.tradingSystem, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren), + personalData: getProtocolNode(node.personalData, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) } if (includeIds) { object.id = node.id @@ -1041,37 +1041,47 @@ function newProtocolNode () { tradingBots: [], plotters: [] } - if (node.sensorBots !== undefined) { - for (let m = 0; m < node.sensorBots.length; m++) { - let sensorBot = getProtocolNode(node.sensorBots[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) - if (sensorBot !== undefined) { - object.sensorBots.push(sensorBot) + if (followAncestors) { + object.parentNode = getProtocolNode(node.payload.parentNode, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + } + + if (excludeChildren !== true) { + if (node.sensorBots !== undefined) { + for (let m = 0; m < node.sensorBots.length; m++) { + let sensorBot = getProtocolNode(node.sensorBots[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + if (sensorBot !== undefined) { + object.sensorBots.push(sensorBot) + } + } + } + if (node.indicatorBots !== undefined) { + for (let m = 0; m < node.indicatorBots.length; m++) { + let indicatorBot = getProtocolNode(node.indicatorBots[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + if (indicatorBot !== undefined) { + object.indicatorBots.push(indicatorBot) + } + } + } + if (node.tradingBots !== undefined) { + for (let m = 0; m < node.tradingBots.length; m++) { + let tradingBot = getProtocolNode(node.tradingBots[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + if (tradingBot !== undefined) { + object.tradingBots.push(tradingBot) + } + } + } + if (node.plotters !== undefined) { + for (let m = 0; m < node.plotters.length; m++) { + let plotter = getProtocolNode(node.plotters[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + if (plotter !== undefined) { + object.plotters.push(plotter) + } } } } - if (node.indicatorBots !== undefined) { - for (let m = 0; m < node.indicatorBots.length; m++) { - let indicatorBot = getProtocolNode(node.indicatorBots[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) - if (indicatorBot !== undefined) { - object.indicatorBots.push(indicatorBot) - } - } - } - if (node.tradingBots !== undefined) { - for (let m = 0; m < node.tradingBots.length; m++) { - let tradingBot = getProtocolNode(node.tradingBots[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) - if (tradingBot !== undefined) { - object.tradingBots.push(tradingBot) - } - } - } - if (node.plotters !== undefined) { - for (let m = 0; m < node.plotters.length; m++) { - let plotter = getProtocolNode(node.plotters[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) - if (plotter !== undefined) { - object.plotters.push(plotter) - } - } + + if (parseCode) { + object.code = JSON.parse(node.code) } if (includeIds) { object.id = node.id @@ -1090,21 +1100,29 @@ function newProtocolNode () { processes: [], products: [] } - if (node.processes !== undefined) { - for (let m = 0; m < node.processes.length; m++) { - let process = getProtocolNode(node.processes[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) - if (process !== undefined) { - object.processes.push(process) + if (followAncestors) { + object.parentNode = getProtocolNode(node.payload.parentNode, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + } + if (excludeChildren !== true) { + if (node.processes !== undefined) { + for (let m = 0; m < node.processes.length; m++) { + let process = getProtocolNode(node.processes[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + if (process !== undefined) { + object.processes.push(process) + } + } + } + if (node.products !== undefined) { + for (let m = 0; m < node.products.length; m++) { + let product = getProtocolNode(node.products[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + if (product !== undefined) { + object.products.push(product) + } } } } - if (node.products !== undefined) { - for (let m = 0; m < node.products.length; m++) { - let product = getProtocolNode(node.products[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) - if (product !== undefined) { - object.products.push(product) - } - } + if (parseCode) { + object.code = JSON.parse(node.code) } if (includeIds) { object.id = node.id @@ -1123,21 +1141,30 @@ function newProtocolNode () { processes: [], products: [] } - if (node.processes !== undefined) { - for (let m = 0; m < node.processes.length; m++) { - let process = getProtocolNode(node.processes[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) - if (process !== undefined) { - object.processes.push(process) + if (followAncestors) { + object.parentNode = getProtocolNode(node.payload.parentNode, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + } + if (excludeChildren !== true) { + /* Children are added only when not following ancestors */ + if (node.processes !== undefined) { + for (let m = 0; m < node.processes.length; m++) { + let process = getProtocolNode(node.processes[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + if (process !== undefined) { + object.processes.push(process) + } + } + } + if (node.products !== undefined) { + for (let m = 0; m < node.products.length; m++) { + let product = getProtocolNode(node.products[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + if (product !== undefined) { + object.products.push(product) + } } } } - if (node.products !== undefined) { - for (let m = 0; m < node.products.length; m++) { - let product = getProtocolNode(node.products[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) - if (product !== undefined) { - object.products.push(product) - } - } + if (parseCode) { + object.code = JSON.parse(node.code) } if (includeIds) { object.id = node.id @@ -1156,21 +1183,30 @@ function newProtocolNode () { processes: [], products: [] } - if (node.processes !== undefined) { - for (let m = 0; m < node.processes.length; m++) { - let process = getProtocolNode(node.processes[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) - if (process !== undefined) { - object.processes.push(process) + if (followAncestors) { + object.parentNode = getProtocolNode(node.payload.parentNode, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + } + if (excludeChildren !== true) { + /* Children are added only when not following ancestors */ + if (node.processes !== undefined) { + for (let m = 0; m < node.processes.length; m++) { + let process = getProtocolNode(node.processes[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + if (process !== undefined) { + object.processes.push(process) + } + } + } + if (node.products !== undefined) { + for (let m = 0; m < node.products.length; m++) { + let product = getProtocolNode(node.products[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + if (product !== undefined) { + object.products.push(product) + } } } } - if (node.products !== undefined) { - for (let m = 0; m < node.products.length; m++) { - let product = getProtocolNode(node.products[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) - if (product !== undefined) { - object.products.push(product) - } - } + if (parseCode) { + object.code = JSON.parse(node.code) } if (includeIds) { object.id = node.id @@ -1185,14 +1221,7 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - code: node.code, - processOutput: getProtocolNode(node.processOutput, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent), - processDependencies: getProtocolNode(node.processDependencies, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent), - statusReport: getProtocolNode(node.statusReport, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent), - executionStartedEvent: getProtocolNode(node.executionStartedEvent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent), - executionFinishedEvent: getProtocolNode(node.executionFinishedEvent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent), - calculations: getProtocolNode(node.calculations, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent), - dataBuilding: getProtocolNode(node.dataBuilding, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) + code: node.code } if (parseCode) { object.code = JSON.parse(node.code) @@ -1203,6 +1232,18 @@ function newProtocolNode () { if (includePayload) { object.savedPayload = getSavedPayload(node, includeReferences) } + if (followAncestors) { + object.parentNode = getProtocolNode(node.payload.parentNode, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + } + if (excludeChildren !== true) { + object.processOutput = getProtocolNode(node.processOutput, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + object.processDependencies = getProtocolNode(node.processDependencies, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + object.statusReport = getProtocolNode(node.statusReport, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + object.executionStartedEvent = getProtocolNode(node.executionStartedEvent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + object.executionFinishedEvent = getProtocolNode(node.executionFinishedEvent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + object.calculations = getProtocolNode(node.calculations, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + object.dataBuilding = getProtocolNode(node.dataBuilding, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + } return object } case 'Process Output': { @@ -1214,7 +1255,7 @@ function newProtocolNode () { } if (node.outputDatasets !== undefined) { for (let m = 0; m < node.outputDatasets.length; m++) { - let outputDataset = getProtocolNode(node.outputDatasets[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) + let outputDataset = getProtocolNode(node.outputDatasets[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) if (outputDataset !== undefined) { object.outputDatasets.push(outputDataset) } @@ -1238,7 +1279,7 @@ function newProtocolNode () { } if (node.statusDependencies !== undefined) { for (let m = 0; m < node.statusDependencies.length; m++) { - let statusDependency = getProtocolNode(node.statusDependencies[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) + let statusDependency = getProtocolNode(node.statusDependencies[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) if (statusDependency !== undefined) { object.statusDependencies.push(statusDependency) } @@ -1246,7 +1287,7 @@ function newProtocolNode () { } if (node.dataDependencies !== undefined) { for (let m = 0; m < node.dataDependencies.length; m++) { - let dataDependency = getProtocolNode(node.dataDependencies[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) + let dataDependency = getProtocolNode(node.dataDependencies[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) if (dataDependency !== undefined) { object.dataDependencies.push(dataDependency) } @@ -1266,6 +1307,11 @@ function newProtocolNode () { subType: node.subType, name: node.name } + if (includeParent) { + followAncestors = true + excludeChildren = true + object.parentNode = getProtocolNode(node.payload.parentNode, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + } if (includeIds) { object.id = node.id } @@ -1287,7 +1333,7 @@ function newProtocolNode () { object.savedPayload = getSavedPayload(node, includeReferences) } if (followReferenceParent) { - object.referenceParent = getProtocolNode(node.payload.referenceParent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) + object.referenceParent = getProtocolNode(node.payload.referenceParent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) } return object } @@ -1319,8 +1365,8 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - initialization: getProtocolNode(node.initialization, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent), - loop: getProtocolNode(node.loop, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) + initialization: getProtocolNode(node.initialization, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren), + loop: getProtocolNode(node.loop, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) } if (includeIds) { object.id = node.id @@ -1335,8 +1381,8 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - initialization: getProtocolNode(node.initialization, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent), - loop: getProtocolNode(node.loop, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) + initialization: getProtocolNode(node.initialization, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren), + loop: getProtocolNode(node.loop, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) } if (includeIds) { object.id = node.id @@ -1351,7 +1397,7 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - code: getProtocolNode(node.code, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) + code: getProtocolNode(node.code, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) } if (includeIds) { object.id = node.id @@ -1366,7 +1412,7 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - code: getProtocolNode(node.code, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) + code: getProtocolNode(node.code, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) } if (includeIds) { object.id = node.id @@ -1389,7 +1435,7 @@ function newProtocolNode () { object.savedPayload = getSavedPayload(node, includeReferences) } if (followReferenceParent) { - object.referenceParent = getProtocolNode(node.payload.referenceParent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) + object.referenceParent = getProtocolNode(node.payload.referenceParent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) } return object } @@ -1406,7 +1452,7 @@ function newProtocolNode () { object.savedPayload = getSavedPayload(node, includeReferences) } if (followReferenceParent) { - object.referenceParent = getProtocolNode(node.payload.referenceParent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) + object.referenceParent = getProtocolNode(node.payload.referenceParent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) } return object } @@ -1423,7 +1469,7 @@ function newProtocolNode () { object.savedPayload = getSavedPayload(node, includeReferences) } if (followReferenceParent) { - object.referenceParent = getProtocolNode(node.payload.referenceParent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) + object.referenceParent = getProtocolNode(node.payload.referenceParent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) } return object } @@ -1433,12 +1479,12 @@ function newProtocolNode () { subType: node.subType, name: node.name, code: node.code, - record: getProtocolNode(node.record, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent), + record: getProtocolNode(node.record, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren), datasets: [] } if (node.datasets !== undefined) { for (let m = 0; m < node.datasets.length; m++) { - let dataset = getProtocolNode(node.datasets[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) + let dataset = getProtocolNode(node.datasets[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) if (dataset !== undefined) { object.datasets.push(dataset) } @@ -1464,7 +1510,7 @@ function newProtocolNode () { } if (node.properties !== undefined) { for (let m = 0; m < node.properties.length; m++) { - let property = getProtocolNode(node.properties[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) + let property = getProtocolNode(node.properties[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) if (property !== undefined) { object.properties.push(property) } @@ -1484,7 +1530,7 @@ function newProtocolNode () { subType: node.subType, name: node.name, code: node.code, - formula: getProtocolNode(node.formula, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) + formula: getProtocolNode(node.formula, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) } if (parseCode) { object.code = JSON.parse(node.code) @@ -1524,7 +1570,7 @@ function newProtocolNode () { } if (node.modules !== undefined) { for (let m = 0; m < node.modules.length; m++) { - let module = getProtocolNode(node.modules[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) + let module = getProtocolNode(node.modules[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) if (module !== undefined) { object.modules.push(module) } @@ -1543,12 +1589,12 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - code: getProtocolNode(node.code, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent), + code: getProtocolNode(node.code, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren), panels: [] } if (node.panels !== undefined) { for (let m = 0; m < node.panels.length; m++) { - let panel = getProtocolNode(node.panels[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) + let panel = getProtocolNode(node.panels[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) if (panel !== undefined) { object.panels.push(panel) } @@ -1567,7 +1613,7 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - code: getProtocolNode(node.code, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent) + code: getProtocolNode(node.code, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) } if (includeIds) { object.id = node.id From 7f0c9f751e44e9fbc85087f5bb60061fbb1cd0fd Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 11 Nov 2019 13:29:31 +0100 Subject: [PATCH 82/95] Status Dependency with Code --- .../FunctionLibraries/ProtocolNode.js | 29 ++++++++++++++----- .../FunctionLibraries/UiObjectsFromNodes.js | 3 +- FloatingSpace/UiObjectConstructor.js | 23 +++++++++++++-- 3 files changed, 45 insertions(+), 10 deletions(-) diff --git a/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js b/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js index 453dffc93..d89ff6f61 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js +++ b/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js @@ -1443,11 +1443,15 @@ function newProtocolNode () { let object = { type: node.type, subType: node.subType, - name: node.name + name: node.name, + code: node.code } if (includeIds) { object.id = node.id } + if (parseCode) { + object.code = JSON.parse(node.code) + } if (includePayload) { object.savedPayload = getSavedPayload(node, includeReferences) } @@ -1479,17 +1483,23 @@ function newProtocolNode () { subType: node.subType, name: node.name, code: node.code, - record: getProtocolNode(node.record, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren), datasets: [] } - if (node.datasets !== undefined) { - for (let m = 0; m < node.datasets.length; m++) { - let dataset = getProtocolNode(node.datasets[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) - if (dataset !== undefined) { - object.datasets.push(dataset) + if (followAncestors) { + object.parentNode = getProtocolNode(node.payload.parentNode, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + } + if (excludeChildren !== true) { + if (node.datasets !== undefined) { + for (let m = 0; m < node.datasets.length; m++) { + let dataset = getProtocolNode(node.datasets[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + if (dataset !== undefined) { + object.datasets.push(dataset) + } } } + object.record = getProtocolNode(node.record, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) } + if (parseCode) { object.code = JSON.parse(node.code) } @@ -1553,6 +1563,11 @@ function newProtocolNode () { if (parseCode) { object.code = JSON.parse(node.code) } + if (includeParent) { + followAncestors = true + excludeChildren = true + object.parentNode = getProtocolNode(node.payload.parentNode, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + } if (includeIds) { object.id = node.id } diff --git a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js index 362c263c2..aa4365fd7 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js +++ b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js @@ -1246,7 +1246,8 @@ function newUiObjectsFromNodes () { function addStatusDependency (node) { let object = { type: 'Status Dependency', - name: 'New Status Dependency' + name: 'New Status Dependency', + code: '{"mainUtility": "Self Reference|Market Starting Point|Market Ending Point"}' } if (node.statusDependencies === undefined) { node.statusDependencies = [] diff --git a/FloatingSpace/UiObjectConstructor.js b/FloatingSpace/UiObjectConstructor.js index c3bb37d3f..269a4d13b 100644 --- a/FloatingSpace/UiObjectConstructor.js +++ b/FloatingSpace/UiObjectConstructor.js @@ -1170,7 +1170,26 @@ function newUiObjectConstructor () { break } case 'Status Dependency': { + uiObject.codeEditor = newCodeEditor() + uiObject.codeEditor.isVisibleFunction = uiObject.isVisibleFunction + uiObject.codeEditor.initialize() + uiObject.codeEditor.container.connectToParent(uiObject.container, false, false, true, true, false, false, false, false) addLeftIcons(menuItemsInitialValues, floatingObject) + menuItemsInitialValues.push( + { + action: 'Edit Status Dependency', + actionFunction: uiObject.codeEditor.activate, + label: 'Edit Status Dependency', + visible: true, + iconPathOn: 'html', + iconPathOff: 'html', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: -40, + dontShowAtFullscreen: true + } + ) menuItemsInitialValues.push( { action: 'Delete Status Dependency', @@ -1184,7 +1203,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: -20 + angle: 0 } ) menuItemsInitialValues.push( @@ -1198,7 +1217,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: 20 + angle: 40 } ) break From e7d25357e9f521c5b73293e0bbc549a7b7537cef Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 12 Nov 2019 11:03:52 +0100 Subject: [PATCH 83/95] excludeType implemented --- .../FunctionLibraries/ProtocolNode.js | 262 +++++++++--------- .../FunctionLibraries/UiObjectsFromNodes.js | 3 +- 2 files changed, 134 insertions(+), 131 deletions(-) diff --git a/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js b/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js index d89ff6f61..d7e0176b3 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js +++ b/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js @@ -4,7 +4,7 @@ function newProtocolNode () { } return thisObject - function getProtocolNode (node, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) { + function getProtocolNode (node, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) { if (node === undefined) { return } switch (node.type) { case 'Code': @@ -29,7 +29,7 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - code: getProtocolNode(node.code, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + code: getProtocolNode(node.code, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) } if (includeIds) { object.id = node.id @@ -48,7 +48,7 @@ function newProtocolNode () { } for (let m = 0; m < node.conditions.length; m++) { - let condition = getProtocolNode(node.conditions[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + let condition = getProtocolNode(node.conditions[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) if (condition !== undefined) { object.conditions.push(condition) } @@ -87,13 +87,13 @@ function newProtocolNode () { announcements: [] } for (let m = 0; m < node.situations.length; m++) { - let situation = getProtocolNode(node.situations[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + let situation = getProtocolNode(node.situations[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) if (situation !== undefined) { object.situations.push(situation) } } for (let m = 0; m < node.announcements.length; m++) { - let announcement = getProtocolNode(node.announcements[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + let announcement = getProtocolNode(node.announcements[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) if (announcement !== undefined) { object.announcements.push(announcement) } @@ -112,11 +112,11 @@ function newProtocolNode () { subType: node.subType, name: node.name, announcements: [], - formula: getProtocolNode(node.formula, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren), - nextPhaseEvent: getProtocolNode(node.nextPhaseEvent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + formula: getProtocolNode(node.formula, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType), + nextPhaseEvent: getProtocolNode(node.nextPhaseEvent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) } for (let m = 0; m < node.announcements.length; m++) { - let announcement = getProtocolNode(node.announcements[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + let announcement = getProtocolNode(node.announcements[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) if (announcement !== undefined) { object.announcements.push(announcement) } @@ -138,7 +138,7 @@ function newProtocolNode () { } for (let m = 0; m < node.phases.length; m++) { - let phase = getProtocolNode(node.phases[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + let phase = getProtocolNode(node.phases[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) if (phase !== undefined) { object.phases.push(phase) } @@ -160,7 +160,7 @@ function newProtocolNode () { } for (let m = 0; m < node.phases.length; m++) { - let phase = getProtocolNode(node.phases[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + let phase = getProtocolNode(node.phases[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) if (phase !== undefined) { object.phases.push(phase) } @@ -183,13 +183,13 @@ function newProtocolNode () { } for (let m = 0; m < node.situations.length; m++) { - let situation = getProtocolNode(node.situations[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + let situation = getProtocolNode(node.situations[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) if (situation !== undefined) { object.situations.push(situation) } } for (let m = 0; m < node.announcements.length; m++) { - let announcement = getProtocolNode(node.announcements[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + let announcement = getProtocolNode(node.announcements[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) if (announcement !== undefined) { object.announcements.push(announcement) } @@ -212,11 +212,11 @@ function newProtocolNode () { } for (let m = 0; m < node.situations.length; m++) { - let situation = getProtocolNode(node.situations[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + let situation = getProtocolNode(node.situations[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) object.situations.push(situation) } for (let m = 0; m < node.announcements.length; m++) { - let announcement = getProtocolNode(node.announcements[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + let announcement = getProtocolNode(node.announcements[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) if (announcement !== undefined) { object.announcements.push(announcement) } @@ -239,13 +239,13 @@ function newProtocolNode () { } for (let m = 0; m < node.situations.length; m++) { - let situation = getProtocolNode(node.situations[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + let situation = getProtocolNode(node.situations[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) if (situation !== undefined) { object.situations.push(situation) } } for (let m = 0; m < node.announcements.length; m++) { - let announcement = getProtocolNode(node.announcements[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + let announcement = getProtocolNode(node.announcements[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) if (announcement !== undefined) { object.announcements.push(announcement) } @@ -263,10 +263,10 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - stopLoss: getProtocolNode(node.stopLoss, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren), - takeProfit: getProtocolNode(node.takeProfit, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren), - positionSize: getProtocolNode(node.positionSize, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren), - positionRate: getProtocolNode(node.positionRate, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + stopLoss: getProtocolNode(node.stopLoss, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType), + takeProfit: getProtocolNode(node.takeProfit, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType), + positionSize: getProtocolNode(node.positionSize, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType), + positionRate: getProtocolNode(node.positionRate, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) } if (includeIds) { object.id = node.id @@ -309,7 +309,7 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - formula: getProtocolNode(node.formula, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + formula: getProtocolNode(node.formula, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) } if (includeIds) { object.id = node.id @@ -324,7 +324,7 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - formula: getProtocolNode(node.formula, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + formula: getProtocolNode(node.formula, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) } if (includeIds) { object.id = node.id @@ -339,9 +339,9 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - triggerOn: getProtocolNode(node.triggerOn, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren), - triggerOff: getProtocolNode(node.triggerOff, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren), - takePosition: getProtocolNode(node.takePosition, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + triggerOn: getProtocolNode(node.triggerOn, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType), + triggerOff: getProtocolNode(node.triggerOff, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType), + takePosition: getProtocolNode(node.takePosition, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) } if (includeIds) { object.id = node.id @@ -356,8 +356,8 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - initialDefinition: getProtocolNode(node.initialDefinition, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren), - openExecution: getProtocolNode(node.openExecution, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + initialDefinition: getProtocolNode(node.initialDefinition, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType), + openExecution: getProtocolNode(node.openExecution, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) } if (includeIds) { object.id = node.id @@ -372,8 +372,8 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - stopLoss: getProtocolNode(node.stopLoss, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren), - takeProfit: getProtocolNode(node.takeProfit, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + stopLoss: getProtocolNode(node.stopLoss, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType), + takeProfit: getProtocolNode(node.takeProfit, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) } if (includeIds) { object.id = node.id @@ -388,7 +388,7 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - closeExecution: getProtocolNode(node.closeExecution, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + closeExecution: getProtocolNode(node.closeExecution, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) } if (includeIds) { object.id = node.id @@ -403,10 +403,10 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - triggerStage: getProtocolNode(node.triggerStage, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren), - openStage: getProtocolNode(node.openStage, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren), - manageStage: getProtocolNode(node.manageStage, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren), - closeStage: getProtocolNode(node.closeStage, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + triggerStage: getProtocolNode(node.triggerStage, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType), + openStage: getProtocolNode(node.openStage, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType), + manageStage: getProtocolNode(node.manageStage, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType), + closeStage: getProtocolNode(node.closeStage, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) } if (includeIds) { object.id = node.id @@ -508,12 +508,12 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - baseAsset: getProtocolNode(node.baseAsset, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren), - timeRange: getProtocolNode(node.timeRange, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren), - timePeriod: getProtocolNode(node.timePeriod, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren), - slippage: getProtocolNode(node.slippage, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren), - feeStructure: getProtocolNode(node.feeStructure, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren), - key: getProtocolNode(node.key, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + baseAsset: getProtocolNode(node.baseAsset, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType), + timeRange: getProtocolNode(node.timeRange, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType), + timePeriod: getProtocolNode(node.timePeriod, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType), + slippage: getProtocolNode(node.slippage, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType), + feeStructure: getProtocolNode(node.feeStructure, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType), + key: getProtocolNode(node.key, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) } if (includeIds) { object.id = node.id @@ -529,11 +529,11 @@ function newProtocolNode () { subType: node.subType, name: node.name, strategies: [], - parameters: getProtocolNode(node.parameters, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + parameters: getProtocolNode(node.parameters, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) } for (let m = 0; m < node.strategies.length; m++) { - let strategy = getProtocolNode(node.strategies[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + let strategy = getProtocolNode(node.strategies[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) if (strategy !== undefined) { object.strategies.push(strategy) } @@ -556,7 +556,7 @@ function newProtocolNode () { } for (let m = 0; m < node.exchangeAccounts.length; m++) { - let exchangeAccount = getProtocolNode(node.exchangeAccounts[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + let exchangeAccount = getProtocolNode(node.exchangeAccounts[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) if (exchangeAccount !== undefined) { object.exchangeAccounts.push(exchangeAccount) } @@ -580,13 +580,13 @@ function newProtocolNode () { } for (let m = 0; m < node.assets.length; m++) { - let asset = getProtocolNode(node.assets[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + let asset = getProtocolNode(node.assets[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) if (asset !== undefined) { object.assets.push(asset) } } for (let m = 0; m < node.keys.length; m++) { - let key = getProtocolNode(node.keys[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + let key = getProtocolNode(node.keys[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) if (key !== undefined) { object.keys.push(key) } @@ -639,7 +639,7 @@ function newProtocolNode () { } for (let m = 0; m < node.bots.length; m++) { - let bot = getProtocolNode(node.bots[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + let bot = getProtocolNode(node.bots[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) if (bot !== undefined) { object.bots.push(bot) } @@ -663,7 +663,7 @@ function newProtocolNode () { } for (let m = 0; m < node.announcements.length; m++) { - let announcement = getProtocolNode(node.announcements[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + let announcement = getProtocolNode(node.announcements[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) if (announcement !== undefined) { object.announcements.push(announcement) } @@ -685,7 +685,7 @@ function newProtocolNode () { subType: node.subType, name: node.name, code: node.code, - formula: getProtocolNode(node.formula, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + formula: getProtocolNode(node.formula, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) } if (includeIds) { object.id = node.id @@ -704,7 +704,7 @@ function newProtocolNode () { } for (let m = 0; m < node.layers.length; m++) { - let layer = getProtocolNode(node.layers[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + let layer = getProtocolNode(node.layers[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) if (layer !== undefined) { object.layers.push(layer) } @@ -744,7 +744,7 @@ function newProtocolNode () { } for (let m = 0; m < node.tasks.length; m++) { - let task = getProtocolNode(node.tasks[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + let task = getProtocolNode(node.tasks[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) if (task !== undefined) { object.tasks.push(task) } @@ -762,7 +762,7 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - bot: getProtocolNode(node.bot, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + bot: getProtocolNode(node.bot, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) } if (includeIds) { object.id = node.id @@ -782,7 +782,7 @@ function newProtocolNode () { } for (let m = 0; m < node.processes.length; m++) { - let process = getProtocolNode(node.processes[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + let process = getProtocolNode(node.processes[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) if (process !== undefined) { object.processes.push(process) } @@ -808,7 +808,7 @@ function newProtocolNode () { } for (let m = 0; m < node.processes.length; m++) { - let process = getProtocolNode(node.processes[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + let process = getProtocolNode(node.processes[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) if (process !== undefined) { object.processes.push(process) } @@ -834,7 +834,7 @@ function newProtocolNode () { } for (let m = 0; m < node.processes.length; m++) { - let process = getProtocolNode(node.processes[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + let process = getProtocolNode(node.processes[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) if (process !== undefined) { object.processes.push(process) } @@ -856,7 +856,7 @@ function newProtocolNode () { subType: node.subType, name: node.name, code: node.code, - session: getProtocolNode(node.session, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + session: getProtocolNode(node.session, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) } if (parseCode) { object.code = JSON.parse(node.code) @@ -868,7 +868,7 @@ function newProtocolNode () { object.savedPayload = getSavedPayload(node, includeReferences) } if (followReferenceParent) { - object.referenceParent = getProtocolNode(node.payload.referenceParent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + object.referenceParent = getProtocolNode(node.payload.referenceParent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) } return object } @@ -878,9 +878,9 @@ function newProtocolNode () { subType: node.subType, name: node.name, code: node.code, - parameters: getProtocolNode(node.parameters, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren), - layerManager: getProtocolNode(node.layerManager, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren), - socialBots: getProtocolNode(node.socialBots, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + parameters: getProtocolNode(node.parameters, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType), + layerManager: getProtocolNode(node.layerManager, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType), + socialBots: getProtocolNode(node.socialBots, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) } if (parseCode) { object.code = JSON.parse(object.code) @@ -892,7 +892,7 @@ function newProtocolNode () { object.savedPayload = getSavedPayload(node, includeReferences) } if (followReferenceParent) { - object.referenceParent = getProtocolNode(node.payload.referenceParent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + object.referenceParent = getProtocolNode(node.payload.referenceParent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) } return object } @@ -902,9 +902,9 @@ function newProtocolNode () { subType: node.subType, name: node.name, code: node.code, - parameters: getProtocolNode(node.parameters, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren), - layerManager: getProtocolNode(node.layerManager, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren), - socialBots: getProtocolNode(node.socialBots, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + parameters: getProtocolNode(node.parameters, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType), + layerManager: getProtocolNode(node.layerManager, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType), + socialBots: getProtocolNode(node.socialBots, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) } if (parseCode) { object.code = JSON.parse(node.code) @@ -916,7 +916,7 @@ function newProtocolNode () { object.savedPayload = getSavedPayload(node, includeReferences) } if (followReferenceParent) { - object.referenceParent = getProtocolNode(node.payload.referenceParent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + object.referenceParent = getProtocolNode(node.payload.referenceParent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) } return object } @@ -926,9 +926,9 @@ function newProtocolNode () { subType: node.subType, name: node.name, code: node.code, - parameters: getProtocolNode(node.parameters, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren), - layerManager: getProtocolNode(node.layerManager, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren), - socialBots: getProtocolNode(node.socialBots, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + parameters: getProtocolNode(node.parameters, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType), + layerManager: getProtocolNode(node.layerManager, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType), + socialBots: getProtocolNode(node.socialBots, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) } if (parseCode) { object.code = JSON.parse(object.code) @@ -940,7 +940,7 @@ function newProtocolNode () { object.savedPayload = getSavedPayload(node, includeReferences) } if (followReferenceParent) { - object.referenceParent = getProtocolNode(node.payload.referenceParent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + object.referenceParent = getProtocolNode(node.payload.referenceParent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) } return object } @@ -950,9 +950,9 @@ function newProtocolNode () { subType: node.subType, name: node.name, code: node.code, - parameters: getProtocolNode(node.parameters, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren), - layerManager: getProtocolNode(node.layerManager, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren), - socialBots: getProtocolNode(node.socialBots, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + parameters: getProtocolNode(node.parameters, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType), + layerManager: getProtocolNode(node.layerManager, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType), + socialBots: getProtocolNode(node.socialBots, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) } if (parseCode) { object.code = JSON.parse(node.code) @@ -964,7 +964,7 @@ function newProtocolNode () { object.savedPayload = getSavedPayload(node, includeReferences) } if (followReferenceParent) { - object.referenceParent = getProtocolNode(node.payload.referenceParent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + object.referenceParent = getProtocolNode(node.payload.referenceParent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) } return object } @@ -977,7 +977,7 @@ function newProtocolNode () { } if (node.taskManagers !== undefined) { for (let m = 0; m < node.taskManagers.length; m++) { - let taskManager = getProtocolNode(node.taskManagers[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + let taskManager = getProtocolNode(node.taskManagers[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) if (taskManager !== undefined) { object.taskManagers.push(taskManager) } @@ -1000,7 +1000,7 @@ function newProtocolNode () { } if (node.networkNodes !== undefined) { for (let m = 0; m < node.networkNodes.length; m++) { - let networkNode = getProtocolNode(node.networkNodes[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + let networkNode = getProtocolNode(node.networkNodes[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) if (networkNode !== undefined) { object.networkNodes.push(networkNode) } @@ -1019,8 +1019,8 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - tradingSystem: getProtocolNode(node.tradingSystem, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren), - personalData: getProtocolNode(node.personalData, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + tradingSystem: getProtocolNode(node.tradingSystem, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType), + personalData: getProtocolNode(node.personalData, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) } if (includeIds) { object.id = node.id @@ -1042,13 +1042,13 @@ function newProtocolNode () { plotters: [] } if (followAncestors) { - object.parentNode = getProtocolNode(node.payload.parentNode, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + object.parentNode = getProtocolNode(node.payload.parentNode, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) } if (excludeChildren !== true) { if (node.sensorBots !== undefined) { for (let m = 0; m < node.sensorBots.length; m++) { - let sensorBot = getProtocolNode(node.sensorBots[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + let sensorBot = getProtocolNode(node.sensorBots[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) if (sensorBot !== undefined) { object.sensorBots.push(sensorBot) } @@ -1056,7 +1056,7 @@ function newProtocolNode () { } if (node.indicatorBots !== undefined) { for (let m = 0; m < node.indicatorBots.length; m++) { - let indicatorBot = getProtocolNode(node.indicatorBots[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + let indicatorBot = getProtocolNode(node.indicatorBots[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) if (indicatorBot !== undefined) { object.indicatorBots.push(indicatorBot) } @@ -1064,7 +1064,7 @@ function newProtocolNode () { } if (node.tradingBots !== undefined) { for (let m = 0; m < node.tradingBots.length; m++) { - let tradingBot = getProtocolNode(node.tradingBots[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + let tradingBot = getProtocolNode(node.tradingBots[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) if (tradingBot !== undefined) { object.tradingBots.push(tradingBot) } @@ -1072,7 +1072,7 @@ function newProtocolNode () { } if (node.plotters !== undefined) { for (let m = 0; m < node.plotters.length; m++) { - let plotter = getProtocolNode(node.plotters[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + let plotter = getProtocolNode(node.plotters[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) if (plotter !== undefined) { object.plotters.push(plotter) } @@ -1101,12 +1101,12 @@ function newProtocolNode () { products: [] } if (followAncestors) { - object.parentNode = getProtocolNode(node.payload.parentNode, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + object.parentNode = getProtocolNode(node.payload.parentNode, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) } if (excludeChildren !== true) { if (node.processes !== undefined) { for (let m = 0; m < node.processes.length; m++) { - let process = getProtocolNode(node.processes[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + let process = getProtocolNode(node.processes[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) if (process !== undefined) { object.processes.push(process) } @@ -1114,7 +1114,7 @@ function newProtocolNode () { } if (node.products !== undefined) { for (let m = 0; m < node.products.length; m++) { - let product = getProtocolNode(node.products[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + let product = getProtocolNode(node.products[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) if (product !== undefined) { object.products.push(product) } @@ -1142,13 +1142,13 @@ function newProtocolNode () { products: [] } if (followAncestors) { - object.parentNode = getProtocolNode(node.payload.parentNode, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + object.parentNode = getProtocolNode(node.payload.parentNode, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) } if (excludeChildren !== true) { /* Children are added only when not following ancestors */ if (node.processes !== undefined) { for (let m = 0; m < node.processes.length; m++) { - let process = getProtocolNode(node.processes[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + let process = getProtocolNode(node.processes[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) if (process !== undefined) { object.processes.push(process) } @@ -1156,7 +1156,7 @@ function newProtocolNode () { } if (node.products !== undefined) { for (let m = 0; m < node.products.length; m++) { - let product = getProtocolNode(node.products[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + let product = getProtocolNode(node.products[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) if (product !== undefined) { object.products.push(product) } @@ -1184,13 +1184,13 @@ function newProtocolNode () { products: [] } if (followAncestors) { - object.parentNode = getProtocolNode(node.payload.parentNode, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + object.parentNode = getProtocolNode(node.payload.parentNode, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) } if (excludeChildren !== true) { /* Children are added only when not following ancestors */ if (node.processes !== undefined) { for (let m = 0; m < node.processes.length; m++) { - let process = getProtocolNode(node.processes[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + let process = getProtocolNode(node.processes[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) if (process !== undefined) { object.processes.push(process) } @@ -1198,7 +1198,7 @@ function newProtocolNode () { } if (node.products !== undefined) { for (let m = 0; m < node.products.length; m++) { - let product = getProtocolNode(node.products[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + let product = getProtocolNode(node.products[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) if (product !== undefined) { object.products.push(product) } @@ -1233,16 +1233,16 @@ function newProtocolNode () { object.savedPayload = getSavedPayload(node, includeReferences) } if (followAncestors) { - object.parentNode = getProtocolNode(node.payload.parentNode, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + object.parentNode = getProtocolNode(node.payload.parentNode, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) } if (excludeChildren !== true) { - object.processOutput = getProtocolNode(node.processOutput, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) - object.processDependencies = getProtocolNode(node.processDependencies, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) - object.statusReport = getProtocolNode(node.statusReport, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) - object.executionStartedEvent = getProtocolNode(node.executionStartedEvent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) - object.executionFinishedEvent = getProtocolNode(node.executionFinishedEvent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) - object.calculations = getProtocolNode(node.calculations, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) - object.dataBuilding = getProtocolNode(node.dataBuilding, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + object.processOutput = getProtocolNode(node.processOutput, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) + object.processDependencies = getProtocolNode(node.processDependencies, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) + object.statusReport = getProtocolNode(node.statusReport, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) + object.executionStartedEvent = getProtocolNode(node.executionStartedEvent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) + object.executionFinishedEvent = getProtocolNode(node.executionFinishedEvent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) + object.calculations = getProtocolNode(node.calculations, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) + object.dataBuilding = getProtocolNode(node.dataBuilding, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) } return object } @@ -1255,7 +1255,7 @@ function newProtocolNode () { } if (node.outputDatasets !== undefined) { for (let m = 0; m < node.outputDatasets.length; m++) { - let outputDataset = getProtocolNode(node.outputDatasets[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + let outputDataset = getProtocolNode(node.outputDatasets[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) if (outputDataset !== undefined) { object.outputDatasets.push(outputDataset) } @@ -1279,7 +1279,7 @@ function newProtocolNode () { } if (node.statusDependencies !== undefined) { for (let m = 0; m < node.statusDependencies.length; m++) { - let statusDependency = getProtocolNode(node.statusDependencies[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + let statusDependency = getProtocolNode(node.statusDependencies[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) if (statusDependency !== undefined) { object.statusDependencies.push(statusDependency) } @@ -1287,7 +1287,7 @@ function newProtocolNode () { } if (node.dataDependencies !== undefined) { for (let m = 0; m < node.dataDependencies.length; m++) { - let dataDependency = getProtocolNode(node.dataDependencies[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + let dataDependency = getProtocolNode(node.dataDependencies[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) if (dataDependency !== undefined) { object.dataDependencies.push(dataDependency) } @@ -1310,7 +1310,7 @@ function newProtocolNode () { if (includeParent) { followAncestors = true excludeChildren = true - object.parentNode = getProtocolNode(node.payload.parentNode, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + object.parentNode = getProtocolNode(node.payload.parentNode, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) } if (includeIds) { object.id = node.id @@ -1333,7 +1333,7 @@ function newProtocolNode () { object.savedPayload = getSavedPayload(node, includeReferences) } if (followReferenceParent) { - object.referenceParent = getProtocolNode(node.payload.referenceParent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + object.referenceParent = getProtocolNode(node.payload.referenceParent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) } return object } @@ -1365,8 +1365,8 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - initialization: getProtocolNode(node.initialization, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren), - loop: getProtocolNode(node.loop, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + initialization: getProtocolNode(node.initialization, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType), + loop: getProtocolNode(node.loop, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) } if (includeIds) { object.id = node.id @@ -1381,8 +1381,8 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - initialization: getProtocolNode(node.initialization, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren), - loop: getProtocolNode(node.loop, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + initialization: getProtocolNode(node.initialization, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType), + loop: getProtocolNode(node.loop, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) } if (includeIds) { object.id = node.id @@ -1397,7 +1397,7 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - code: getProtocolNode(node.code, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + code: getProtocolNode(node.code, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) } if (includeIds) { object.id = node.id @@ -1412,7 +1412,7 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - code: getProtocolNode(node.code, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + code: getProtocolNode(node.code, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) } if (includeIds) { object.id = node.id @@ -1435,7 +1435,7 @@ function newProtocolNode () { object.savedPayload = getSavedPayload(node, includeReferences) } if (followReferenceParent) { - object.referenceParent = getProtocolNode(node.payload.referenceParent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + object.referenceParent = getProtocolNode(node.payload.referenceParent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) } return object } @@ -1456,7 +1456,7 @@ function newProtocolNode () { object.savedPayload = getSavedPayload(node, includeReferences) } if (followReferenceParent) { - object.referenceParent = getProtocolNode(node.payload.referenceParent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + object.referenceParent = getProtocolNode(node.payload.referenceParent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) } return object } @@ -1473,7 +1473,7 @@ function newProtocolNode () { object.savedPayload = getSavedPayload(node, includeReferences) } if (followReferenceParent) { - object.referenceParent = getProtocolNode(node.payload.referenceParent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + object.referenceParent = getProtocolNode(node.payload.referenceParent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) } return object } @@ -1485,21 +1485,23 @@ function newProtocolNode () { code: node.code, datasets: [] } - if (followAncestors) { - object.parentNode = getProtocolNode(node.payload.parentNode, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) - } if (excludeChildren !== true) { - if (node.datasets !== undefined) { - for (let m = 0; m < node.datasets.length; m++) { - let dataset = getProtocolNode(node.datasets[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) - if (dataset !== undefined) { - object.datasets.push(dataset) + if (excludeType !== 'Dataset Definition') { + if (node.datasets !== undefined) { + for (let m = 0; m < node.datasets.length; m++) { + let dataset = getProtocolNode(node.datasets[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) + if (dataset !== undefined) { + object.datasets.push(dataset) + } } } } - object.record = getProtocolNode(node.record, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + object.record = getProtocolNode(node.record, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) + } + if (followAncestors) { + excludeChildren = true + object.parentNode = getProtocolNode(node.payload.parentNode, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) } - if (parseCode) { object.code = JSON.parse(node.code) } @@ -1520,7 +1522,7 @@ function newProtocolNode () { } if (node.properties !== undefined) { for (let m = 0; m < node.properties.length; m++) { - let property = getProtocolNode(node.properties[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + let property = getProtocolNode(node.properties[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) if (property !== undefined) { object.properties.push(property) } @@ -1540,7 +1542,7 @@ function newProtocolNode () { subType: node.subType, name: node.name, code: node.code, - formula: getProtocolNode(node.formula, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + formula: getProtocolNode(node.formula, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) } if (parseCode) { object.code = JSON.parse(node.code) @@ -1565,8 +1567,8 @@ function newProtocolNode () { } if (includeParent) { followAncestors = true - excludeChildren = true - object.parentNode = getProtocolNode(node.payload.parentNode, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + excludeType = 'Dataset Definition' + object.parentNode = getProtocolNode(node.payload.parentNode, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) } if (includeIds) { object.id = node.id @@ -1585,7 +1587,7 @@ function newProtocolNode () { } if (node.modules !== undefined) { for (let m = 0; m < node.modules.length; m++) { - let module = getProtocolNode(node.modules[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + let module = getProtocolNode(node.modules[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) if (module !== undefined) { object.modules.push(module) } @@ -1604,12 +1606,12 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - code: getProtocolNode(node.code, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren), + code: getProtocolNode(node.code, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType), panels: [] } if (node.panels !== undefined) { for (let m = 0; m < node.panels.length; m++) { - let panel = getProtocolNode(node.panels[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + let panel = getProtocolNode(node.panels[m], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) if (panel !== undefined) { object.panels.push(panel) } @@ -1628,7 +1630,7 @@ function newProtocolNode () { type: node.type, subType: node.subType, name: node.name, - code: getProtocolNode(node.code, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren) + code: getProtocolNode(node.code, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) } if (includeIds) { object.id = node.id diff --git a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js index aa4365fd7..45f14ed61 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js +++ b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js @@ -1303,7 +1303,8 @@ function newUiObjectsFromNodes () { function addRecordProperty (node) { let object = { type: 'Record Property', - name: 'New Record Property' + name: 'New Record Property', + code: '{}' } if (node.properties === undefined) { node.properties = [] From b243b93199093dfe860b6deada229819b134cfd0 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 12 Nov 2019 11:29:51 +0100 Subject: [PATCH 84/95] Relocating Procedures from Process to Product --- .../FunctionLibraries/NodeChildren.js | 25 ++++++++++--------- .../FunctionLibraries/NodeDeleter.js | 16 ++++++------ .../Workspace/FunctionLibraries/OnFocus.js | 16 ++++++------ .../FunctionLibraries/ProtocolNode.js | 4 +-- .../FunctionLibraries/ShortcutKeys.js | 16 ++++++------ .../FunctionLibraries/UiObjectsFromNodes.js | 16 +++++++----- DesignerSpace/Workspace/Workspace.js | 5 ++++ FloatingSpace/UiObject.js | 4 +-- FloatingSpace/UiObjectConstructor.js | 23 +++++++++++++---- 9 files changed, 74 insertions(+), 51 deletions(-) diff --git a/DesignerSpace/Workspace/FunctionLibraries/NodeChildren.js b/DesignerSpace/Workspace/FunctionLibraries/NodeChildren.js index ff6490334..f96277c64 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/NodeChildren.js +++ b/DesignerSpace/Workspace/FunctionLibraries/NodeChildren.js @@ -430,18 +430,6 @@ function newNodeChildren () { response.childIndex = response.childrenCount } } - if (parentNode.calculations !== undefined) { - response.childrenCount++ - if (parentNode.calculations.id === childNode.id) { - response.childIndex = response.childrenCount - } - } - if (parentNode.dataBuilding !== undefined) { - response.childrenCount++ - if (parentNode.dataBuilding.id === childNode.id) { - response.childIndex = response.childrenCount - } - } return response } @@ -625,6 +613,19 @@ function newNodeChildren () { } } } + + if (parentNode.calculations !== undefined) { + response.childrenCount++ + if (parentNode.calculations.id === childNode.id) { + response.childIndex = response.childrenCount + } + } + if (parentNode.dataBuilding !== undefined) { + response.childrenCount++ + if (parentNode.dataBuilding.id === childNode.id) { + response.childIndex = response.childrenCount + } + } return response } diff --git a/DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js b/DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js index b5c8e761f..1435c1a90 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js +++ b/DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js @@ -595,14 +595,6 @@ function newNodeDeleter () { deleteExecutionFinishedEvent(node.executionFinishedEvent, rootNodes) } - if (node.calculations !== undefined) { - deleteCalculationsProcedure(node.calculations, rootNodes) - } - - if (node.dataBuilding !== undefined) { - deleteDataBuildingProcedure(node.dataBuilding, rootNodes) - } - completeDeletion(node, rootNodes) destroyUiObject(node) cleanNode(node) @@ -823,6 +815,14 @@ function newNodeDeleter () { } } + if (node.calculations !== undefined) { + deleteCalculationsProcedure(node.calculations, rootNodes) + } + + if (node.dataBuilding !== undefined) { + deleteDataBuildingProcedure(node.dataBuilding, rootNodes) + } + completeDeletion(node, rootNodes) destroyUiObject(node) cleanNode(node) diff --git a/DesignerSpace/Workspace/FunctionLibraries/OnFocus.js b/DesignerSpace/Workspace/FunctionLibraries/OnFocus.js index 41e14064d..d3633c3d7 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/OnFocus.js +++ b/DesignerSpace/Workspace/FunctionLibraries/OnFocus.js @@ -844,14 +844,6 @@ function newOnFocus () { if (child !== undefined) { return child } - child = getNodeThatIsOnFocus(node.calculations) - if (child !== undefined) { - return child - } - child = getNodeThatIsOnFocus(node.dataBuilding) - if (child !== undefined) { - return child - } if (node.payload.uiObject.isOnFocus === true) { return node } else { @@ -1002,6 +994,14 @@ function newOnFocus () { return child } } + child = getNodeThatIsOnFocus(node.calculations) + if (child !== undefined) { + return child + } + child = getNodeThatIsOnFocus(node.dataBuilding) + if (child !== undefined) { + return child + } if (node.payload.uiObject.isOnFocus === true) { return node } else { diff --git a/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js b/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js index d7e0176b3..3e31f010c 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js +++ b/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js @@ -1241,8 +1241,6 @@ function newProtocolNode () { object.statusReport = getProtocolNode(node.statusReport, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) object.executionStartedEvent = getProtocolNode(node.executionStartedEvent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) object.executionFinishedEvent = getProtocolNode(node.executionFinishedEvent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) - object.calculations = getProtocolNode(node.calculations, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) - object.dataBuilding = getProtocolNode(node.dataBuilding, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) } return object } @@ -1497,6 +1495,8 @@ function newProtocolNode () { } } object.record = getProtocolNode(node.record, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) + object.calculations = getProtocolNode(node.calculations, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) + object.dataBuilding = getProtocolNode(node.dataBuilding, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) } if (followAncestors) { excludeChildren = true diff --git a/DesignerSpace/Workspace/FunctionLibraries/ShortcutKeys.js b/DesignerSpace/Workspace/FunctionLibraries/ShortcutKeys.js index 96f399a43..874f93f29 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/ShortcutKeys.js +++ b/DesignerSpace/Workspace/FunctionLibraries/ShortcutKeys.js @@ -828,14 +828,6 @@ function newShortcutKeys () { if (child !== undefined) { return child } - child = getNodeByShortcutKey(node.calculations, searchingKey) - if (child !== undefined) { - return child - } - child = getNodeByShortcutKey(node.dataBuilding, searchingKey) - if (child !== undefined) { - return child - } if (node.payload.uiObject.shortcutKey === searchingKey) { return node } else { @@ -979,6 +971,14 @@ function newShortcutKeys () { return child } } + child = getNodeByShortcutKey(node.calculations, searchingKey) + if (child !== undefined) { + return child + } + child = getNodeByShortcutKey(node.dataBuilding, searchingKey) + if (child !== undefined) { + return child + } if (node.payload.uiObject.shortcutKey === searchingKey) { return node } else { diff --git a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js index 45f14ed61..1513b6386 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js +++ b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js @@ -8,6 +8,7 @@ function newUiObjectsFromNodes () { addTradingBot: addTradingBot, addProcessDefinition: addProcessDefinition, addMissingProcessDefinitionItems: addMissingProcessDefinitionItems, + addMissingProductDefinitionItems: addMissingProductDefinitionItems, addProcessOutput: addProcessOutput, addProcessDependencies: addProcessDependencies, addStatusReport: addStatusReport, @@ -788,12 +789,6 @@ function newUiObjectsFromNodes () { if (node.executionFinishedEvent !== undefined) { createUiObjectFromNode(node.executionFinishedEvent, node, node) } - if (node.calculations !== undefined) { - createUiObjectFromNode(node.calculations, node, node) - } - if (node.dataBuilding !== undefined) { - createUiObjectFromNode(node.dataBuilding, node, node) - } if (referenceChildren !== undefined) { node.savedPayload = { referenceChildren: referenceChildren @@ -970,6 +965,12 @@ function newUiObjectsFromNodes () { let dataset = node.datasets[m] createUiObjectFromNode(dataset, node, node) } + if (node.calculations !== undefined) { + createUiObjectFromNode(node.calculations, node, node) + } + if (node.dataBuilding !== undefined) { + createUiObjectFromNode(node.dataBuilding, node, node) + } return } case 'Record Definition': { @@ -1121,6 +1122,9 @@ function newUiObjectsFromNodes () { addStatusReport(node) addExecutionStartedEvent(node) addExecutionFinishedEvent(node) + } + + function addMissingProductDefinitionItems (node) { addCalculationsProcedure(node) addDataBuildingProcedure(node) } diff --git a/DesignerSpace/Workspace/Workspace.js b/DesignerSpace/Workspace/Workspace.js index 4e15e283c..54ae32327 100644 --- a/DesignerSpace/Workspace/Workspace.js +++ b/DesignerSpace/Workspace/Workspace.js @@ -346,6 +346,11 @@ function newWorkspace () { functionLibraryUiObjectsFromNodes.addMissingProcessDefinitionItems(payload.node) } break + case 'Add Missing Product Definition Items': + { + functionLibraryUiObjectsFromNodes.addMissingProductDefinitionItems(payload.node) + } + break case 'Add Process Output': { functionLibraryUiObjectsFromNodes.addProcessOutput(payload.node) diff --git a/FloatingSpace/UiObject.js b/FloatingSpace/UiObject.js index d0f94a789..1f77f9847 100644 --- a/FloatingSpace/UiObject.js +++ b/FloatingSpace/UiObject.js @@ -249,11 +249,11 @@ function newUiObject () { compatibleSubType = undefined break case 'Calculations Procedure': - compatibleType = '->' + 'Process Definition' + '->' + compatibleType = '->' + 'Product Definition' + '->' compatibleSubType = undefined break case 'Data Building Procedure': - compatibleType = '->' + 'Process Definition' + '->' + compatibleType = '->' + 'Product Definition' + '->' compatibleSubType = undefined break case 'Procedure Initialization': diff --git a/FloatingSpace/UiObjectConstructor.js b/FloatingSpace/UiObjectConstructor.js index 269a4d13b..5df26de1c 100644 --- a/FloatingSpace/UiObjectConstructor.js +++ b/FloatingSpace/UiObjectConstructor.js @@ -1273,7 +1273,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: -45, + angle: -60, dontShowAtFullscreen: true } ) @@ -1287,7 +1287,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: -20 + angle: -30 } ) menuItemsInitialValues.push( @@ -1300,9 +1300,22 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: 0 + angle: -10 } ) + menuItemsInitialValues.push( + { + action: 'Add Missing Product Definition Items', + actionFunction: payload.onMenuItemClick, + label: 'Add Missing Items', + visible: true, + relatedUiObject: 'Calculations Procedure', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: 10 + } + ) menuItemsInitialValues.push( { action: 'Delete Product Definition', @@ -1316,7 +1329,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: 20 + angle: 30 } ) menuItemsInitialValues.push( @@ -1330,7 +1343,7 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: 45 + angle: 60 } ) break From 72545aebeb8f165d410ac1c73e7baddcbac365e6 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 13 Nov 2019 16:14:12 +0100 Subject: [PATCH 85/95] Bigger code editor --- FloatingSpace/CodeEditor.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/FloatingSpace/CodeEditor.js b/FloatingSpace/CodeEditor.js index c552a55e7..1ed862964 100644 --- a/FloatingSpace/CodeEditor.js +++ b/FloatingSpace/CodeEditor.js @@ -128,8 +128,8 @@ function newCodeEditor () { thisObject.container.frame.position.x = 0 thisObject.container.frame.position.y = 0 - thisObject.container.frame.width = thisObject.container.frame.radius * 1.8 - thisObject.container.frame.height = thisObject.container.frame.radius * 1 + thisObject.container.frame.width = thisObject.container.frame.radius * 1.8 * 2 + thisObject.container.frame.height = thisObject.container.frame.radius * 1 * 2 let textAreaPosition = { x: 0 - thisObject.container.frame.width / 2, @@ -161,7 +161,7 @@ function newCodeEditor () { position = thisObject.container.frame.frameThisPoint(position) - let radius = thisObject.container.frame.radius + let radius = thisObject.container.frame.radius * 2 if (radius > 0.5) { browserCanvasContext.beginPath() From 324498db766e10ceb059acb84ec87c843405be73 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 13 Nov 2019 18:22:56 +0100 Subject: [PATCH 86/95] Debug Task Event Implemented --- .../Workspace/FunctionLibraries/TaskFunctions.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/DesignerSpace/Workspace/FunctionLibraries/TaskFunctions.js b/DesignerSpace/Workspace/FunctionLibraries/TaskFunctions.js index 43acc3873..aec7aebc4 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/TaskFunctions.js +++ b/DesignerSpace/Workspace/FunctionLibraries/TaskFunctions.js @@ -24,13 +24,19 @@ function newTaskFunctions () { process.payload.uiObject.run() } - node.payload.uiObject.run(callBackFunction) - let event = { taskId: node.id, taskName: node.name, definition: JSON.stringify(functionLibraryProtocolNode.getProtocolNode(node, false, true, true, false, false, true, true)) // <- We need to do this workaround in order no to send unescaped charactars to the taskManager. } + + if (node.payload.parentNode === undefined) { + callBackFunction(GLOBAL.DEFAULT_FAIL_RESPONSE) + systemEventHandler.raiseEvent('Task Server', 'Debug Task Started', event) + return + } + + node.payload.uiObject.run(callBackFunction) systemEventHandler.raiseEvent('Task Manager', 'Run Task', event) } From 6557e50e7935284f713560e56e541abf6f3be28a Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 14 Nov 2019 20:20:02 +0100 Subject: [PATCH 87/95] Following Ancestor from Process Definition --- DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js b/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js index 3e31f010c..2fdb0ae82 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js +++ b/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js @@ -1226,6 +1226,7 @@ function newProtocolNode () { if (parseCode) { object.code = JSON.parse(node.code) } + if (includeIds) { object.id = node.id } @@ -1242,6 +1243,12 @@ function newProtocolNode () { object.executionStartedEvent = getProtocolNode(node.executionStartedEvent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) object.executionFinishedEvent = getProtocolNode(node.executionFinishedEvent, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) } + + if (includeParent) { + followAncestors = true + excludeChildren = true + object.parentNode = getProtocolNode(node.payload.parentNode, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) + } return object } case 'Process Output': { From f1716bf250c3d33555dd717325393adb18eae1dd Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sat, 16 Nov 2019 09:15:55 +0100 Subject: [PATCH 88/95] shorcuts --- Canvas.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Canvas.js b/Canvas.js index 44ddd57f4..52e0d39a9 100644 --- a/Canvas.js +++ b/Canvas.js @@ -204,11 +204,11 @@ function newCanvas () { } } - if ((event.ctrlKey === true || event.metaKey === true) && event.altKey === true) { // Dev Tool + if ((event.ctrlKey === true || event.metaKey === true) && event.altKey === true && event.shiftKey === true && event.keyCode === 123) { // Dev Tool when used with F12 if (nodeOnFocus !== undefined) { console.log(nodeOnFocus) + return } - return } if (event.altKey === true && event.code === 'ArrowUp') { @@ -268,7 +268,7 @@ function newCanvas () { } } - if ((event.ctrlKey === true || event.metaKey === true)) { + if ((event.ctrlKey === true || event.metaKey === true) && event.altKey === true) { if (event.keyCode >= 65 && event.keyCode <= 90) { /* From here we prevent the default behaviour */ event.preventDefault() @@ -295,15 +295,15 @@ function newCanvas () { /* If there is not node using this key and a node in focus, we assign this key to this node */ if (nodeUsingThisKey === undefined && nodeOnFocus !== undefined) { nodeOnFocus.payload.uiObject.shortcutKey = event.key - nodeOnFocus.payload.uiObject.setValue('Shortcut Key: Ctrl + ' + event.key) + nodeOnFocus.payload.uiObject.setValue('Shortcut Key: Ctrl + Alt + ' + event.key) } return } } - if (event.ctrlKey === true && nodeOnFocus !== undefined) { + if (event.ctrlKey === true && event.altKey === true && nodeOnFocus !== undefined) { if (nodeOnFocus.payload.uiObject.shortcutKey !== undefined && nodeOnFocus.payload.uiObject.shortcutKey !== '') { - nodeOnFocus.payload.uiObject.setValue('Shortcut Key: Ctrl + ' + nodeOnFocus.payload.uiObject.shortcutKey) + nodeOnFocus.payload.uiObject.setValue('Shortcut Key: Ctrl + Alt + ' + nodeOnFocus.payload.uiObject.shortcutKey) } } } From 37ad57d4c7ebd8341c7e3e4d569827769ecd60f2 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sat, 16 Nov 2019 09:27:01 +0100 Subject: [PATCH 89/95] Error Messages Improved --- DesignerSpace/Workspace/FunctionLibraries/SessionFunctions.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/DesignerSpace/Workspace/FunctionLibraries/SessionFunctions.js b/DesignerSpace/Workspace/FunctionLibraries/SessionFunctions.js index ce13dc6bf..453fe61e7 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/SessionFunctions.js +++ b/DesignerSpace/Workspace/FunctionLibraries/SessionFunctions.js @@ -9,16 +9,19 @@ function newSessionFunctions () { function runSession (node, functionLibraryProtocolNode, callBackFunction) { /* We can not run a sessionif its parent process is not running. Less if it does not have a parent. */ if (node.payload.parentNode === undefined) { + node.payload.uiObject.setErrorMessage('Session needs a Process Instance parent to be able to run.') callBackFunction(GLOBAL.DEFAULT_FAIL_RESPONSE) return } if (node.payload.parentNode.payload.uiObject.isRunning !== true) { + node.payload.uiObject.setErrorMessage('Session needs a Process Instance parent to be running to be able to run.') callBackFunction(GLOBAL.DEFAULT_FAIL_RESPONSE) return } if (node.payload.referenceParent === undefined) { + node.payload.uiObject.setErrorMessage('Parent Process Instance need to reference a Process Definition.') callBackFunction(GLOBAL.DEFAULT_FAIL_RESPONSE) return } From 1da5a7a3642c9fb7ca40da196d689a120de5ac7e Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 18 Nov 2019 13:10:31 +0100 Subject: [PATCH 90/95] Backup and Share main structures with state of inner objects --- .../FunctionLibraries/UiObjectsFromNodes.js | 369 +++++++++--------- DesignerSpace/Workspace/Workspace.js | 58 ++- 2 files changed, 242 insertions(+), 185 deletions(-) diff --git a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js index 1513b6386..dc713be6f 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js +++ b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js @@ -108,74 +108,74 @@ function newUiObjectsFromNodes () { return } - function createUiObjectFromNode (node, parentNode, chainParent) { + function createUiObjectFromNode (node, parentNode, chainParent, positionOffset) { switch (node.type) { case 'Code': { - createUiObject('Code', node.name, node, parentNode, chainParent, 'Code') + createUiObject('Code', node.name, node, parentNode, chainParent, 'Code', positionOffset) return } case 'Condition': { - createUiObject('Condition', node.name, node, parentNode, chainParent, 'Condition') + createUiObject('Condition', node.name, node, parentNode, chainParent, 'Condition', positionOffset) if (node.code !== undefined) { - createUiObjectFromNode(node.code, node, node) + createUiObjectFromNode(node.code, node, node, positionOffset) } return } case 'Situation': { let situation = node - createUiObject('Situation', situation.name, situation, parentNode, chainParent, 'Situation') + createUiObject('Situation', situation.name, situation, parentNode, chainParent, 'Situation', positionOffset) for (let m = 0; m < node.conditions.length; m++) { let condition = node.conditions[m] - createUiObjectFromNode(condition, situation, situation) + createUiObjectFromNode(condition, situation, situation, positionOffset) } return } case 'Formula': { - createUiObject('Formula', node.name, node, parentNode, chainParent, 'Formula') + createUiObject('Formula', node.name, node, parentNode, chainParent, 'Formula', positionOffset) return } case 'Next Phase Event': { - createUiObject('Next Phase Event', node.name, node, parentNode, chainParent, 'Next Phase Event') + createUiObject('Next Phase Event', node.name, node, parentNode, chainParent, 'Next Phase Event', positionOffset) for (let m = 0; m < node.situations.length; m++) { let situation = node.situations[m] - createUiObjectFromNode(situation, node, node) + createUiObjectFromNode(situation, node, node, positionOffset) } if (node.announcements === undefined) { node.announcements = [] } for (let m = 0; m < node.announcements.length; m++) { let announcement = node.announcements[m] - createUiObjectFromNode(announcement, node, node) + createUiObjectFromNode(announcement, node, node, positionOffset) } return } case 'Phase': { let phase = node - createUiObject('Phase', phase.name, phase, parentNode, chainParent, phase.subType) + createUiObject('Phase', phase.name, phase, parentNode, chainParent, phase.subType, positionOffset) if (node.formula !== undefined) { - createUiObjectFromNode(node.formula, phase, phase) + createUiObjectFromNode(node.formula, phase, phase, positionOffset) } if (node.nextPhaseEvent !== undefined) { - createUiObjectFromNode(node.nextPhaseEvent, phase, phase) + createUiObjectFromNode(node.nextPhaseEvent, phase, phase, positionOffset) } if (node.announcements === undefined) { node.announcements = [] } for (let m = 0; m < node.announcements.length; m++) { let announcement = node.announcements[m] - createUiObjectFromNode(announcement, node, node) + createUiObjectFromNode(announcement, node, node, positionOffset) } return } case 'Stop': { let lastPhase let stop = node - createUiObject('Stop', stop.name, stop, parentNode, chainParent, 'Stop') + createUiObject('Stop', stop.name, stop, parentNode, chainParent, 'Stop', positionOffset) for (let m = 0; m < node.phases.length; m++) { let phase = node.phases[m] let thisChainParent @@ -185,14 +185,14 @@ function newUiObjectsFromNodes () { thisChainParent = lastPhase } lastPhase = phase - createUiObjectFromNode(phase, stop, thisChainParent) + createUiObjectFromNode(phase, stop, thisChainParent, positionOffset) } return } case 'Take Profit': { let lastPhase let takeProfit = node - createUiObject('Take Profit', takeProfit.name, takeProfit, parentNode, chainParent, 'Take Profit') + createUiObject('Take Profit', takeProfit.name, takeProfit, parentNode, chainParent, 'Take Profit', positionOffset) for (let m = 0; m < node.phases.length; m++) { let phase = node.phases[m] let thisChainParent @@ -202,244 +202,244 @@ function newUiObjectsFromNodes () { thisChainParent = lastPhase } lastPhase = phase - createUiObjectFromNode(phase, takeProfit, thisChainParent) + createUiObjectFromNode(phase, takeProfit, thisChainParent, positionOffset) } return } case 'Open Execution': { - createUiObject('Open Execution', node.name, node, parentNode, chainParent, 'Open Execution') + createUiObject('Open Execution', node.name, node, parentNode, chainParent, 'Open Execution', positionOffset) return } case 'Close Execution': { - createUiObject('Close Execution', node.name, node, parentNode, chainParent, 'Close Execution') + createUiObject('Close Execution', node.name, node, parentNode, chainParent, 'Close Execution', positionOffset) return } case 'Initial Definition': { - createUiObject('Initial Definition', node.name, node, parentNode, chainParent, 'Initial Definition') + createUiObject('Initial Definition', node.name, node, parentNode, chainParent, 'Initial Definition', positionOffset) if (node.stopLoss !== undefined) { - createUiObjectFromNode(node.stopLoss, node, node) + createUiObjectFromNode(node.stopLoss, node, node, positionOffset) } if (node.takeProfit !== undefined) { - createUiObjectFromNode(node.takeProfit, node, node) + createUiObjectFromNode(node.takeProfit, node, node, positionOffset) } if (node.positionSize !== undefined) { - createUiObjectFromNode(node.positionSize, node, node) + createUiObjectFromNode(node.positionSize, node, node, positionOffset) } if (node.positionRate !== undefined) { - createUiObjectFromNode(node.positionRate, node, node) + createUiObjectFromNode(node.positionRate, node, node, positionOffset) } return } case 'Take Position Event': { let event = node - createUiObject('Take Position Event', event.name, event, parentNode, chainParent, 'Take Position Event') + createUiObject('Take Position Event', event.name, event, parentNode, chainParent, 'Take Position Event', positionOffset) for (let m = 0; m < node.situations.length; m++) { let situation = node.situations[m] - createUiObjectFromNode(situation, event, event) + createUiObjectFromNode(situation, event, event, positionOffset) } if (node.announcements === undefined) { node.announcements = [] } for (let m = 0; m < node.announcements.length; m++) { let announcement = node.announcements[m] - createUiObjectFromNode(announcement, node, node) + createUiObjectFromNode(announcement, node, node, positionOffset) } return } case 'Trigger On Event': { let event = node - createUiObject('Trigger On Event', event.name, event, parentNode, chainParent, 'Trigger On Event') + createUiObject('Trigger On Event', event.name, event, parentNode, chainParent, 'Trigger On Event', positionOffset) for (let m = 0; m < node.situations.length; m++) { let situation = node.situations[m] - createUiObjectFromNode(situation, event, event) + createUiObjectFromNode(situation, event, event, positionOffset) } if (node.announcements === undefined) { node.announcements = [] } for (let m = 0; m < node.announcements.length; m++) { let announcement = node.announcements[m] - createUiObjectFromNode(announcement, node, node) + createUiObjectFromNode(announcement, node, node, positionOffset) } return } case 'Trigger Off Event': { let event = node - createUiObject('Trigger Off Event', event.name, event, parentNode, chainParent, 'Trigger Off Event') + createUiObject('Trigger Off Event', event.name, event, parentNode, chainParent, 'Trigger Off Event', positionOffset) for (let m = 0; m < node.situations.length; m++) { let situation = node.situations[m] - createUiObjectFromNode(situation, event, event) + createUiObjectFromNode(situation, event, event, positionOffset) } if (node.announcements === undefined) { node.announcements = [] } for (let m = 0; m < node.announcements.length; m++) { let announcement = node.announcements[m] - createUiObjectFromNode(announcement, node, node) + createUiObjectFromNode(announcement, node, node, positionOffset) } return } case 'Position Size': { - createUiObject('Position Size', node.name, node, parentNode, chainParent, 'Position Size') + createUiObject('Position Size', node.name, node, parentNode, chainParent, 'Position Size', positionOffset) if (node.formula !== undefined) { - createUiObjectFromNode(node.formula, node, node) + createUiObjectFromNode(node.formula, node, node, positionOffset) } return } case 'Position Rate': { - createUiObject('Position Rate', node.name, node, parentNode, chainParent, 'Position Rate') + createUiObject('Position Rate', node.name, node, parentNode, chainParent, 'Position Rate', positionOffset) if (node.formula !== undefined) { - createUiObjectFromNode(node.formula, node, node) + createUiObjectFromNode(node.formula, node, node, positionOffset) } return } case 'Trigger Stage': { let stage = node - createUiObject('Trigger Stage', stage.name, stage, parentNode, chainParent, 'Trigger Stage') + createUiObject('Trigger Stage', stage.name, stage, parentNode, chainParent, 'Trigger Stage', positionOffset) if (node.triggerOn !== undefined) { - createUiObjectFromNode(node.triggerOn, stage, stage) + createUiObjectFromNode(node.triggerOn, stage, stage, positionOffset) } if (node.triggerOff !== undefined) { - createUiObjectFromNode(node.triggerOff, stage, stage) + createUiObjectFromNode(node.triggerOff, stage, stage, positionOffset) } if (node.takePosition !== undefined) { - createUiObjectFromNode(node.takePosition, stage, stage) + createUiObjectFromNode(node.takePosition, stage, stage, positionOffset) } return } case 'Open Stage': { let stage = node - createUiObject('Open Stage', stage.name, stage, parentNode, chainParent, 'Open Stage') + createUiObject('Open Stage', stage.name, stage, parentNode, chainParent, 'Open Stage', positionOffset) if (node.initialDefinition !== undefined) { - createUiObjectFromNode(node.initialDefinition, stage, stage) + createUiObjectFromNode(node.initialDefinition, stage, stage, positionOffset) } if (node.openExecution !== undefined) { - createUiObjectFromNode(node.openExecution, stage, stage) + createUiObjectFromNode(node.openExecution, stage, stage, positionOffset) } return } case 'Manage Stage': { let stage = node - createUiObject('Manage Stage', stage.name, stage, parentNode, chainParent, 'Manage Stage') + createUiObject('Manage Stage', stage.name, stage, parentNode, chainParent, 'Manage Stage', positionOffset) if (node.stopLoss !== undefined) { - createUiObjectFromNode(node.stopLoss, stage, stage) + createUiObjectFromNode(node.stopLoss, stage, stage, positionOffset) } if (node.takeProfit !== undefined) { - createUiObjectFromNode(node.takeProfit, stage, stage) + createUiObjectFromNode(node.takeProfit, stage, stage, positionOffset) } return } case 'Close Stage': { let stage = node - createUiObject('Close Stage', stage.name, stage, parentNode, chainParent, 'Close Stage') + createUiObject('Close Stage', stage.name, stage, parentNode, chainParent, 'Close Stage', positionOffset) if (node.closeExecution !== undefined) { - createUiObjectFromNode(node.closeExecution, stage, stage) + createUiObjectFromNode(node.closeExecution, stage, stage, positionOffset) } return } case 'Strategy': { let strategy = node - createUiObject('Strategy', strategy.name, strategy, parentNode, chainParent, 'Strategy') + createUiObject('Strategy', strategy.name, strategy, parentNode, chainParent, 'Strategy', positionOffset) if (node.triggerStage !== undefined) { - createUiObjectFromNode(node.triggerStage, strategy, strategy) + createUiObjectFromNode(node.triggerStage, strategy, strategy, positionOffset) } if (node.openStage !== undefined) { - createUiObjectFromNode(node.openStage, strategy, strategy) + createUiObjectFromNode(node.openStage, strategy, strategy, positionOffset) } if (node.manageStage !== undefined) { - createUiObjectFromNode(node.manageStage, strategy, strategy) + createUiObjectFromNode(node.manageStage, strategy, strategy, positionOffset) } if (node.closeStage !== undefined) { - createUiObjectFromNode(node.closeStage, strategy, strategy) + createUiObjectFromNode(node.closeStage, strategy, strategy, positionOffset) } return } case 'Base Asset': { - createUiObject('Base Asset', node.name, node, parentNode, chainParent, 'Base Asset') + createUiObject('Base Asset', node.name, node, parentNode, chainParent, 'Base Asset', positionOffset) return } case 'Time Range': { - createUiObject('Time Range', node.name, node, parentNode, chainParent, 'Time Range') + createUiObject('Time Range', node.name, node, parentNode, chainParent, 'Time Range', positionOffset) return } case 'Time Period': { - createUiObject('Time Period', node.name, node, parentNode, chainParent, 'Time Period') + createUiObject('Time Period', node.name, node, parentNode, chainParent, 'Time Period', positionOffset) return } case 'Slippage': { - createUiObject('Slippage', node.name, node, parentNode, chainParent, 'Slippage') + createUiObject('Slippage', node.name, node, parentNode, chainParent, 'Slippage', positionOffset) return } case 'Fee Structure': { - createUiObject('Fee Structure', node.name, node, parentNode, chainParent, 'Fee Structure') + createUiObject('Fee Structure', node.name, node, parentNode, chainParent, 'Fee Structure', positionOffset) return } case 'Parameters': { - createUiObject('Parameters', node.name, node, parentNode, chainParent, 'Parameters') + createUiObject('Parameters', node.name, node, parentNode, chainParent, 'Parameters', positionOffset) if (node.baseAsset !== undefined) { - createUiObjectFromNode(node.baseAsset, node, node) + createUiObjectFromNode(node.baseAsset, node, node, positionOffset) } if (node.timeRange !== undefined) { - createUiObjectFromNode(node.timeRange, node, node) + createUiObjectFromNode(node.timeRange, node, node, positionOffset) } if (node.timePeriod !== undefined) { - createUiObjectFromNode(node.timePeriod, node, node) + createUiObjectFromNode(node.timePeriod, node, node, positionOffset) } if (node.slippage !== undefined) { - createUiObjectFromNode(node.slippage, node, node) + createUiObjectFromNode(node.slippage, node, node, positionOffset) } if (node.feeStructure !== undefined) { - createUiObjectFromNode(node.feeStructure, node, node) + createUiObjectFromNode(node.feeStructure, node, node, positionOffset) } if (node.key !== undefined) { - createUiObjectFromNode(node.key, node, node) + createUiObjectFromNode(node.key, node, node, positionOffset) } return } case 'Trading System': { let tradingSystem = node - createUiObject('Trading System', tradingSystem.name, tradingSystem, parentNode, chainParent, 'Trading System') + createUiObject('Trading System', tradingSystem.name, tradingSystem, parentNode, chainParent, 'Trading System', positionOffset) for (let m = 0; m < node.strategies.length; m++) { let strategy = node.strategies[m] - createUiObjectFromNode(strategy, tradingSystem, tradingSystem) + createUiObjectFromNode(strategy, tradingSystem, tradingSystem, positionOffset) } if (node.parameters !== undefined) { - createUiObjectFromNode(node.parameters, node, node) + createUiObjectFromNode(node.parameters, node, node, positionOffset) } return } case 'Personal Data': { - createUiObject('Personal Data', node.name, node, parentNode, chainParent, 'Personal Data') + createUiObject('Personal Data', node.name, node, parentNode, chainParent, 'Personal Data', positionOffset) for (let m = 0; m < node.exchangeAccounts.length; m++) { let exchangeAccount = node.exchangeAccounts[m] - createUiObjectFromNode(exchangeAccount, node, node) + createUiObjectFromNode(exchangeAccount, node, node, positionOffset) } return } case 'Exchange Account': { - createUiObject('Exchange Account', node.name, node, parentNode, chainParent, 'Exchange Account') + createUiObject('Exchange Account', node.name, node, parentNode, chainParent, 'Exchange Account', positionOffset) for (let m = 0; m < node.assets.length; m++) { let asset = node.assets[m] - createUiObjectFromNode(asset, node, node) + createUiObjectFromNode(asset, node, node, positionOffset) } for (let m = 0; m < node.keys.length; m++) { let key = node.keys[m] - createUiObjectFromNode(key, node, node) + createUiObjectFromNode(key, node, node, positionOffset) } return } case 'Exchange Account Asset': { - createUiObject('Exchange Account Asset', node.name, node, parentNode, chainParent, 'Exchange Account Asset') + createUiObject('Exchange Account Asset', node.name, node, parentNode, chainParent, 'Exchange Account Asset', positionOffset) return } case 'Exchange Account Key': { - createUiObject('Exchange Account Key', node.name, node, parentNode, chainParent, 'Exchange Account Key') + createUiObject('Exchange Account Key', node.name, node, parentNode, chainParent, 'Exchange Account Key', positionOffset) return } case 'Definition': { @@ -451,12 +451,12 @@ function newUiObjectsFromNodes () { referenceChildren = node.savedPayload.referenceChildren } } - createUiObject('Definition', node.name, node, parentNode, chainParent, 'Definition') + createUiObject('Definition', node.name, node, parentNode, chainParent, 'Definition', positionOffset) if (node.tradingSystem !== undefined) { - createUiObjectFromNode(node.tradingSystem, node, node) + createUiObjectFromNode(node.tradingSystem, node, node, positionOffset) } if (node.personalData !== undefined) { - createUiObjectFromNode(node.personalData, node, node) + createUiObjectFromNode(node.personalData, node, node, positionOffset) } if (node.referenceChildren === undefined) { node.referenceChildren = [] @@ -469,96 +469,96 @@ function newUiObjectsFromNodes () { return } case 'Network': { - createUiObject('Network', node.name, node, parentNode, chainParent, 'Network') + createUiObject('Network', node.name, node, parentNode, chainParent, 'Network', positionOffset) if (node.networkNodes !== undefined) { for (let m = 0; m < node.networkNodes.length; m++) { let networkNode = node.networkNodes[m] - createUiObjectFromNode(networkNode, node, node) + createUiObjectFromNode(networkNode, node, node, positionOffset) } } return } case 'Network Node': { - createUiObject('Network Node', node.name, node, parentNode, chainParent, 'Network Node') + createUiObject('Network Node', node.name, node, parentNode, chainParent, 'Network Node', positionOffset) if (node.taskManagers !== undefined) { for (let m = 0; m < node.taskManagers.length; m++) { let taskManager = node.taskManagers[m] - createUiObjectFromNode(taskManager, node, node) + createUiObjectFromNode(taskManager, node, node, positionOffset) } } return } case 'Social Bots': { - createUiObject('Social Bots', node.name, node, parentNode, chainParent, 'Social Bots') + createUiObject('Social Bots', node.name, node, parentNode, chainParent, 'Social Bots', positionOffset) for (let m = 0; m < node.bots.length; m++) { let bot = node.bots[m] - createUiObjectFromNode(bot, node, node) + createUiObjectFromNode(bot, node, node, positionOffset) } return } case 'Telegram Bot': { - createUiObject('Telegram Bot', node.name, node, parentNode, chainParent, 'Telegram Bot') + createUiObject('Telegram Bot', node.name, node, parentNode, chainParent, 'Telegram Bot', positionOffset) for (let m = 0; m < node.announcements.length; m++) { let announcement = node.announcements[m] - createUiObjectFromNode(announcement, node, node) + createUiObjectFromNode(announcement, node, node, positionOffset) } return } case 'Announcement': { - createUiObject('Announcement', node.name, node, parentNode, chainParent, 'Announcement') + createUiObject('Announcement', node.name, node, parentNode, chainParent, 'Announcement', positionOffset) if (node.formula !== undefined) { - createUiObjectFromNode(node.formula, node, node) + createUiObjectFromNode(node.formula, node, node, positionOffset) } return } case 'Layer Manager': { - createUiObject('Layer Manager', node.name, node, parentNode, chainParent, 'Layer Manager') + createUiObject('Layer Manager', node.name, node, parentNode, chainParent, 'Layer Manager', positionOffset) for (let m = 0; m < node.layers.length; m++) { let layer = node.layers[m] - createUiObjectFromNode(layer, node, node) + createUiObjectFromNode(layer, node, node, positionOffset) } return } case 'Layer': { - createUiObject('Layer', node.name, node, parentNode, chainParent, 'Layer') + createUiObject('Layer', node.name, node, parentNode, chainParent, 'Layer', positionOffset) return } case 'Task Manager': { - createUiObject('Task Manager', node.name, node, parentNode, chainParent, 'Task Manager') + createUiObject('Task Manager', node.name, node, parentNode, chainParent, 'Task Manager', positionOffset) for (let m = 0; m < node.tasks.length; m++) { let task = node.tasks[m] - createUiObjectFromNode(task, node, node) + createUiObjectFromNode(task, node, node, positionOffset) } return } case 'Task': { - createUiObject('Task', node.name, node, parentNode, chainParent, 'Task') + createUiObject('Task', node.name, node, parentNode, chainParent, 'Task', positionOffset) if (node.bot !== undefined) { - createUiObjectFromNode(node.bot, node, node) + createUiObjectFromNode(node.bot, node, node, positionOffset) } return } case 'Sensor Bot Instance': { - createUiObject('Sensor Bot Instance', node.name, node, parentNode, chainParent, 'Sensor Bot Instance') + createUiObject('Sensor Bot Instance', node.name, node, parentNode, chainParent, 'Sensor Bot Instance', positionOffset) for (let m = 0; m < node.processes.length; m++) { let process = node.processes[m] - createUiObjectFromNode(process, node, node) + createUiObjectFromNode(process, node, node, positionOffset) } return } case 'Indicator Bot Instance': { - createUiObject('Indicator Bot Instance', node.name, node, parentNode, chainParent, 'Indicator Bot Instance') + createUiObject('Indicator Bot Instance', node.name, node, parentNode, chainParent, 'Indicator Bot Instance', positionOffset) for (let m = 0; m < node.processes.length; m++) { let process = node.processes[m] - createUiObjectFromNode(process, node, node) + createUiObjectFromNode(process, node, node, positionOffset) } return } case 'Trading Bot Instance': { - createUiObject('Trading Bot Instance', node.name, node, parentNode, chainParent, 'Trading Bot Instance') + createUiObject('Trading Bot Instance', node.name, node, parentNode, chainParent, 'Trading Bot Instance', positionOffset) for (let m = 0; m < node.processes.length; m++) { let process = node.processes[m] - createUiObjectFromNode(process, node, node) + createUiObjectFromNode(process, node, node, positionOffset) } return } @@ -588,9 +588,9 @@ function newUiObjectsFromNodes () { } } } - createUiObject('Process Instance', node.name, node, parentNode, chainParent, 'Process Instance') + createUiObject('Process Instance', node.name, node, parentNode, chainParent, 'Process Instance', positionOffset) if (node.session !== undefined) { - createUiObjectFromNode(node.session, node, node) + createUiObjectFromNode(node.session, node, node, positionOffset) } if (referenceParent !== undefined) { node.savedPayload = { @@ -609,15 +609,15 @@ function newUiObjectsFromNodes () { } } } - createUiObject('Backtesting Session', node.name, node, parentNode, chainParent, 'Backtesting Session') + createUiObject('Backtesting Session', node.name, node, parentNode, chainParent, 'Backtesting Session', positionOffset) if (node.parameters !== undefined) { - createUiObjectFromNode(node.parameters, node, node) + createUiObjectFromNode(node.parameters, node, node, positionOffset) } if (node.layerManager !== undefined) { - createUiObjectFromNode(node.layerManager, node, node) + createUiObjectFromNode(node.layerManager, node, node, positionOffset) } if (node.socialBots !== undefined) { - createUiObjectFromNode(node.socialBots, node, node) + createUiObjectFromNode(node.socialBots, node, node, positionOffset) } if (referenceParent !== undefined) { node.savedPayload = { @@ -636,15 +636,15 @@ function newUiObjectsFromNodes () { } } } - createUiObject('Live Trading Session', node.name, node, parentNode, chainParent, 'Live Trading Session') + createUiObject('Live Trading Session', node.name, node, parentNode, chainParent, 'Live Trading Session', positionOffset) if (node.parameters !== undefined) { - createUiObjectFromNode(node.parameters, node, node) + createUiObjectFromNode(node.parameters, node, node, positionOffset) } if (node.layerManager !== undefined) { - createUiObjectFromNode(node.layerManager, node, node) + createUiObjectFromNode(node.layerManager, node, node, positionOffset) } if (node.socialBots !== undefined) { - createUiObjectFromNode(node.socialBots, node, node) + createUiObjectFromNode(node.socialBots, node, node, positionOffset) } if (referenceParent !== undefined) { node.savedPayload = { @@ -663,15 +663,15 @@ function newUiObjectsFromNodes () { } } } - createUiObject('Fordward Testing Session', node.name, node, parentNode, chainParent, 'Fordward Testing Session') + createUiObject('Fordward Testing Session', node.name, node, parentNode, chainParent, 'Fordward Testing Session', positionOffset) if (node.parameters !== undefined) { - createUiObjectFromNode(node.parameters, node, node) + createUiObjectFromNode(node.parameters, node, node, positionOffset) } if (node.layerManager !== undefined) { - createUiObjectFromNode(node.layerManager, node, node) + createUiObjectFromNode(node.layerManager, node, node, positionOffset) } if (node.socialBots !== undefined) { - createUiObjectFromNode(node.socialBots, node, node) + createUiObjectFromNode(node.socialBots, node, node, positionOffset) } if (referenceParent !== undefined) { node.savedPayload = { @@ -690,15 +690,15 @@ function newUiObjectsFromNodes () { } } } - createUiObject('Paper Trading Session', node.name, node, parentNode, chainParent, 'Paper Trading Session') + createUiObject('Paper Trading Session', node.name, node, parentNode, chainParent, 'Paper Trading Session', positionOffset) if (node.parameters !== undefined) { - createUiObjectFromNode(node.parameters, node, node) + createUiObjectFromNode(node.parameters, node, node, positionOffset) } if (node.layerManager !== undefined) { - createUiObjectFromNode(node.layerManager, node, node) + createUiObjectFromNode(node.layerManager, node, node, positionOffset) } if (node.socialBots !== undefined) { - createUiObjectFromNode(node.socialBots, node, node) + createUiObjectFromNode(node.socialBots, node, node, positionOffset) } if (referenceParent !== undefined) { node.savedPayload = { @@ -709,58 +709,58 @@ function newUiObjectsFromNodes () { } case 'Team': { - createUiObject(node.type, node.name, node, parentNode, chainParent, node.type) + createUiObject(node.type, node.name, node, parentNode, chainParent, node.type, positionOffset) for (let m = 0; m < node.sensorBots.length; m++) { let sensorBot = node.sensorBots[m] - createUiObjectFromNode(sensorBot, node, node) + createUiObjectFromNode(sensorBot, node, node, positionOffset) } for (let m = 0; m < node.indicatorBots.length; m++) { let indicatorBot = node.indicatorBots[m] - createUiObjectFromNode(indicatorBot, node, node) + createUiObjectFromNode(indicatorBot, node, node, positionOffset) } for (let m = 0; m < node.tradingBots.length; m++) { let tradingBot = node.tradingBots[m] - createUiObjectFromNode(tradingBot, node, node) + createUiObjectFromNode(tradingBot, node, node, positionOffset) } for (let m = 0; m < node.plotters.length; m++) { let plotter = node.plotters[m] - createUiObjectFromNode(plotter, node, node) + createUiObjectFromNode(plotter, node, node, positionOffset) } return } case 'Sensor Bot': { - createUiObject(node.type, node.name, node, parentNode, chainParent, node.type) + createUiObject(node.type, node.name, node, parentNode, chainParent, node.type, positionOffset) for (let m = 0; m < node.processes.length; m++) { let process = node.processes[m] - createUiObjectFromNode(process, node, node) + createUiObjectFromNode(process, node, node, positionOffset) } for (let m = 0; m < node.products.length; m++) { let product = node.products[m] - createUiObjectFromNode(product, node, node) + createUiObjectFromNode(product, node, node, positionOffset) } return } case 'Indicator Bot': { - createUiObject(node.type, node.name, node, parentNode, chainParent, node.type) + createUiObject(node.type, node.name, node, parentNode, chainParent, node.type, positionOffset) for (let m = 0; m < node.processes.length; m++) { let process = node.processes[m] - createUiObjectFromNode(process, node, node) + createUiObjectFromNode(process, node, node, positionOffset) } for (let m = 0; m < node.products.length; m++) { let product = node.products[m] - createUiObjectFromNode(product, node, node) + createUiObjectFromNode(product, node, node, positionOffset) } return } case 'Trading Bot': { - createUiObject(node.type, node.name, node, parentNode, chainParent, node.type) + createUiObject(node.type, node.name, node, parentNode, chainParent, node.type, positionOffset) for (let m = 0; m < node.processes.length; m++) { let process = node.processes[m] - createUiObjectFromNode(process, node, node) + createUiObjectFromNode(process, node, node, positionOffset) } for (let m = 0; m < node.products.length; m++) { let product = node.products[m] - createUiObjectFromNode(product, node, node) + createUiObjectFromNode(product, node, node, positionOffset) } return } @@ -773,21 +773,21 @@ function newUiObjectsFromNodes () { referenceChildren = node.savedPayload.referenceChildren } } - createUiObject(node.type, node.name, node, parentNode, chainParent, node.type) + createUiObject(node.type, node.name, node, parentNode, chainParent, node.type, positionOffset) if (node.processOutput !== undefined) { - createUiObjectFromNode(node.processOutput, node, node) + createUiObjectFromNode(node.processOutput, node, node, positionOffset) } if (node.processDependencies !== undefined) { - createUiObjectFromNode(node.processDependencies, node, node) + createUiObjectFromNode(node.processDependencies, node, node, positionOffset) } if (node.statusReport !== undefined) { - createUiObjectFromNode(node.statusReport, node, node) + createUiObjectFromNode(node.statusReport, node, node, positionOffset) } if (node.executionStartedEvent !== undefined) { - createUiObjectFromNode(node.executionStartedEvent, node, node) + createUiObjectFromNode(node.executionStartedEvent, node, node, positionOffset) } if (node.executionFinishedEvent !== undefined) { - createUiObjectFromNode(node.executionFinishedEvent, node, node) + createUiObjectFromNode(node.executionFinishedEvent, node, node, positionOffset) } if (referenceChildren !== undefined) { node.savedPayload = { @@ -797,22 +797,22 @@ function newUiObjectsFromNodes () { return } case 'Process Output': { - createUiObject(node.type, node.name, node, parentNode, chainParent, node.type) + createUiObject(node.type, node.name, node, parentNode, chainParent, node.type, positionOffset) for (let m = 0; m < node.outputDatasets.length; m++) { let outputDataset = node.outputDatasets[m] - createUiObjectFromNode(outputDataset, node, node) + createUiObjectFromNode(outputDataset, node, node, positionOffset) } return } case 'Process Dependencies': { - createUiObject(node.type, node.name, node, parentNode, chainParent, node.type) + createUiObject(node.type, node.name, node, parentNode, chainParent, node.type, positionOffset) for (let m = 0; m < node.statusDependencies.length; m++) { let statusDependency = node.statusDependencies[m] - createUiObjectFromNode(statusDependency, node, node) + createUiObjectFromNode(statusDependency, node, node, positionOffset) } for (let m = 0; m < node.dataDependencies.length; m++) { let dataDependency = node.dataDependencies[m] - createUiObjectFromNode(dataDependency, node, node) + createUiObjectFromNode(dataDependency, node, node, positionOffset) } return } @@ -825,7 +825,7 @@ function newUiObjectsFromNodes () { referenceChildren = node.savedPayload.referenceChildren } } - createUiObject(node.type, node.name, node, parentNode, chainParent, node.type) + createUiObject(node.type, node.name, node, parentNode, chainParent, node.type, positionOffset) if (referenceChildren !== undefined) { node.savedPayload = { referenceChildren: referenceChildren @@ -843,7 +843,7 @@ function newUiObjectsFromNodes () { } } } - createUiObject(node.type, node.name, node, parentNode, chainParent, node.type) + createUiObject(node.type, node.name, node, parentNode, chainParent, node.type, positionOffset) if (referenceParent !== undefined) { node.savedPayload = { referenceParent: referenceParent @@ -860,7 +860,7 @@ function newUiObjectsFromNodes () { referenceChildren = node.savedPayload.referenceChildren } } - createUiObject(node.type, node.name, node, parentNode, chainParent, node.type) + createUiObject(node.type, node.name, node, parentNode, chainParent, node.type, positionOffset) if (referenceChildren !== undefined) { node.savedPayload = { referenceChildren: referenceChildren @@ -869,36 +869,36 @@ function newUiObjectsFromNodes () { return } case 'Calculations Procedure': { - createUiObject(node.type, node.name, node, parentNode, chainParent, node.type) + createUiObject(node.type, node.name, node, parentNode, chainParent, node.type, positionOffset) if (node.initialization !== undefined) { - createUiObjectFromNode(node.initialization, node, node) + createUiObjectFromNode(node.initialization, node, node, positionOffset) } if (node.loop !== undefined) { - createUiObjectFromNode(node.loop, node, node) + createUiObjectFromNode(node.loop, node, node, positionOffset) } return } case 'Data Building Procedure': { - createUiObject(node.type, node.name, node, parentNode, chainParent, node.type) + createUiObject(node.type, node.name, node, parentNode, chainParent, node.type, positionOffset) if (node.initialization !== undefined) { - createUiObjectFromNode(node.initialization, node, node) + createUiObjectFromNode(node.initialization, node, node, positionOffset) } if (node.loop !== undefined) { - createUiObjectFromNode(node.loop, node, node) + createUiObjectFromNode(node.loop, node, node, positionOffset) } return } case 'Procedure Initialization': { - createUiObject(node.type, node.name, node, parentNode, chainParent, node.type) + createUiObject(node.type, node.name, node, parentNode, chainParent, node.type, positionOffset) if (node.code !== undefined) { - createUiObjectFromNode(node.code, node, node) + createUiObjectFromNode(node.code, node, node, positionOffset) } return } case 'Procedure Loop': { - createUiObject(node.type, node.name, node, parentNode, chainParent, node.type) + createUiObject(node.type, node.name, node, parentNode, chainParent, node.type, positionOffset) if (node.code !== undefined) { - createUiObjectFromNode(node.code, node, node) + createUiObjectFromNode(node.code, node, node, positionOffset) } return } @@ -912,7 +912,7 @@ function newUiObjectsFromNodes () { } } } - createUiObject(node.type, node.name, node, parentNode, chainParent, node.type) + createUiObject(node.type, node.name, node, parentNode, chainParent, node.type, positionOffset) if (referenceParent !== undefined) { node.savedPayload = { referenceParent: referenceParent @@ -930,7 +930,7 @@ function newUiObjectsFromNodes () { } } } - createUiObject(node.type, node.name, node, parentNode, chainParent, node.type) + createUiObject(node.type, node.name, node, parentNode, chainParent, node.type, positionOffset) if (referenceParent !== undefined) { node.savedPayload = { referenceParent: referenceParent @@ -948,7 +948,7 @@ function newUiObjectsFromNodes () { } } } - createUiObject(node.type, node.name, node, parentNode, chainParent, node.type) + createUiObject(node.type, node.name, node, parentNode, chainParent, node.type, positionOffset) if (referenceParent !== undefined) { node.savedPayload = { referenceParent: referenceParent @@ -957,34 +957,34 @@ function newUiObjectsFromNodes () { return } case 'Product Definition': { - createUiObject(node.type, node.name, node, parentNode, chainParent, node.type) + createUiObject(node.type, node.name, node, parentNode, chainParent, node.type, positionOffset) if (node.record !== undefined) { - createUiObjectFromNode(node.record, node, node) + createUiObjectFromNode(node.record, node, node, positionOffset) } for (let m = 0; m < node.datasets.length; m++) { let dataset = node.datasets[m] - createUiObjectFromNode(dataset, node, node) + createUiObjectFromNode(dataset, node, node, positionOffset) } if (node.calculations !== undefined) { - createUiObjectFromNode(node.calculations, node, node) + createUiObjectFromNode(node.calculations, node, node, positionOffset) } if (node.dataBuilding !== undefined) { - createUiObjectFromNode(node.dataBuilding, node, node) + createUiObjectFromNode(node.dataBuilding, node, node, positionOffset) } return } case 'Record Definition': { - createUiObject(node.type, node.name, node, parentNode, chainParent, node.type) + createUiObject(node.type, node.name, node, parentNode, chainParent, node.type, positionOffset) for (let m = 0; m < node.properties.length; m++) { let property = node.properties[m] - createUiObjectFromNode(property, node, node) + createUiObjectFromNode(property, node, node, positionOffset) } return } case 'Record Property': { - createUiObject(node.type, node.name, node, parentNode, chainParent, node.type) + createUiObject(node.type, node.name, node, parentNode, chainParent, node.type, positionOffset) if (node.formula !== undefined) { - createUiObjectFromNode(node.formula, node, node) + createUiObjectFromNode(node.formula, node, node, positionOffset) } return } @@ -997,7 +997,7 @@ function newUiObjectsFromNodes () { referenceChildren = node.savedPayload.referenceChildren } } - createUiObject(node.type, node.name, node, parentNode, chainParent, node.type) + createUiObject(node.type, node.name, node, parentNode, chainParent, node.type, positionOffset) if (referenceChildren !== undefined) { node.savedPayload = { referenceChildren: referenceChildren @@ -1006,28 +1006,28 @@ function newUiObjectsFromNodes () { return } case 'Plotter': { - createUiObject(node.type, node.name, node, parentNode, chainParent, node.type) + createUiObject(node.type, node.name, node, parentNode, chainParent, node.type, positionOffset) for (let m = 0; m < node.modules.length; m++) { let module = node.modules[m] - createUiObjectFromNode(module, node, node) + createUiObjectFromNode(module, node, node, positionOffset) } return } case 'Plotter Module': { - createUiObject(node.type, node.name, node, parentNode, chainParent, node.type) + createUiObject(node.type, node.name, node, parentNode, chainParent, node.type, positionOffset) if (node.code !== undefined) { - createUiObjectFromNode(node.code, node, node) + createUiObjectFromNode(node.code, node, node, positionOffset) } for (let m = 0; m < node.panels.length; m++) { let panel = node.panels[m] - createUiObjectFromNode(panel, node, node) + createUiObjectFromNode(panel, node, node, positionOffset) } return } case 'Plotter Panel': { - createUiObject(node.type, node.name, node, parentNode, chainParent, node.type) + createUiObject(node.type, node.name, node, parentNode, chainParent, node.type, positionOffset) if (node.code !== undefined) { - createUiObjectFromNode(node.code, node, node) + createUiObjectFromNode(node.code, node, node, positionOffset) } return } @@ -2059,15 +2059,24 @@ function newUiObjectsFromNodes () { return condition } - function createUiObject (uiObjectType, name, node, parentNode, chainParent, title) { + function createUiObject (uiObjectType, name, node, parentNode, chainParent, title, positionOffset) { let payload = {} if (name === '' || name === undefined) { name = 'My ' + uiObjectType } if (node.savedPayload !== undefined) { + /* If there is a position offset, we apply it here. */ + if (positionOffset !== undefined) { + node.savedPayload.targetPosition.x = node.savedPayload.targetPosition.x + positionOffset.x + node.savedPayload.targetPosition.y = node.savedPayload.targetPosition.y + positionOffset.y + node.savedPayload.position.x = node.savedPayload.position.x + positionOffset.x + node.savedPayload.position.y = node.savedPayload.position.y + positionOffset.y + } + payload.targetPosition = { x: node.savedPayload.targetPosition.x, y: node.savedPayload.targetPosition.y } + node.savedPayload.targetPosition = undefined if (payload.targetPosition.x === null) { payload.targetPosition.x = spawnPosition.x } diff --git a/DesignerSpace/Workspace/Workspace.js b/DesignerSpace/Workspace/Workspace.js index 54ae32327..9ddfc5263 100644 --- a/DesignerSpace/Workspace/Workspace.js +++ b/DesignerSpace/Workspace/Workspace.js @@ -224,11 +224,39 @@ function newWorkspace () { functionLibraryNodeDeleter.deleteWorkspace(thisObject.workspaceNode, thisObject.workspaceNode.rootNodes) thisObject.workspaceNode = droppedNode functionLibraryUiObjectsFromNodes.recreateWorkspace(thisObject.workspaceNode) + return } else { - let rootNode = functionLibraryProtocolNode.getProtocolNode(droppedNode) - thisObject.workspaceNode.rootNodes.push(rootNode) - functionLibraryUiObjectsFromNodes.createUiObjectFromNode(rootNode, undefined, undefined) + if ( + droppedNode.type === 'Definition' || + droppedNode.type === 'Network' || + droppedNode.type === 'Team' + ) { + /* We will only respect the state of each object on these structures, if the structure does not yet exist inside the workspace */ + let alreadyExists = false + for (let i = 0; i < thisObject.workspaceNode.rootNodes.length; i++) { + let rootNode = thisObject.workspaceNode.rootNodes[i] + if (droppedNode.id === rootNode.id) { + alreadyExists = true + } + } + if (alreadyExists === false) { + /* It does not exist, so we recreeate it respecting the inner state of each object. */ + let positionOffset = { + x: spawnPosition.x - droppedNode.savedPayload.targetPosition.x, + y: spawnPosition.y - droppedNode.savedPayload.targetPosition.y + } + + thisObject.workspaceNode.rootNodes.push(droppedNode) + functionLibraryUiObjectsFromNodes.createUiObjectFromNode(droppedNode, undefined, undefined, positionOffset) + return + } + } } + + /* This is the default behaviour, which consists of cleaning all nodes that are not supported and then creating the UIObjects that remains on the data structure. */ + let rootNode = functionLibraryProtocolNode.getProtocolNode(droppedNode) + thisObject.workspaceNode.rootNodes.push(rootNode) + functionLibraryUiObjectsFromNodes.createUiObjectFromNode(rootNode, undefined, undefined) } catch (err) { if (ERROR_LOG === true) { logger.write('[ERROR] spawn -> err = ' + err.stack) } } @@ -255,7 +283,17 @@ function newWorkspace () { break case 'Share': { - let text = JSON.stringify(functionLibraryProtocolNode.getProtocolNode(payload.node, true)) + let text + if ( + payload.node.type === 'Definition' || + payload.node.type === 'Network' || + payload.node.type === 'Team' + ) { + text = JSON.stringify(functionLibraryProtocolNode.getProtocolNode(payload.node, true, false, true, true, true)) + } else { + text = JSON.stringify(functionLibraryProtocolNode.getProtocolNode(payload.node, true)) + } + let nodeName = payload.node.name if (nodeName === undefined) { nodeName = '' @@ -269,7 +307,17 @@ function newWorkspace () { break case 'Backup': { - let text = JSON.stringify(functionLibraryProtocolNode.getProtocolNode(payload.node, false)) + let text + if ( + payload.node.type === 'Definition' || + payload.node.type === 'Network' || + payload.node.type === 'Team' + ) { + text = JSON.stringify(functionLibraryProtocolNode.getProtocolNode(payload.node, false, false, true, true, true)) + } else { + text = JSON.stringify(functionLibraryProtocolNode.getProtocolNode(payload.node, false)) + } + let nodeName = payload.node.name if (nodeName === undefined) { nodeName = '' From ab39db0e879a8f58df1934e47ce3e37817987add Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 21 Nov 2019 10:58:29 +0100 Subject: [PATCH 91/95] Bug Fix --- FloatingSpace/UiObjectConstructor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FloatingSpace/UiObjectConstructor.js b/FloatingSpace/UiObjectConstructor.js index 5df26de1c..f238e55bf 100644 --- a/FloatingSpace/UiObjectConstructor.js +++ b/FloatingSpace/UiObjectConstructor.js @@ -312,7 +312,7 @@ function newUiObjectConstructor () { addLeftIcons(menuItemsInitialValues, floatingObject) menuItemsInitialValues.push( { - action: 'Edit Bot', + action: 'Edit Team', actionFunction: uiObject.codeEditor.activate, label: 'Edit Bot', visible: true, From 0907de36f3b645b94c46f5b267f86e853fed3a9a Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 21 Nov 2019 11:59:43 +0100 Subject: [PATCH 92/95] Reorganizing some menues --- FloatingSpace/UiObjectConstructor.js | 84 ++++++++++++++-------------- 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/FloatingSpace/UiObjectConstructor.js b/FloatingSpace/UiObjectConstructor.js index f238e55bf..538d29438 100644 --- a/FloatingSpace/UiObjectConstructor.js +++ b/FloatingSpace/UiObjectConstructor.js @@ -2220,19 +2220,6 @@ function newUiObjectConstructor () { uiObject.codeEditor.container.connectToParent(uiObject.container, false, false, true, true, false, false, false, false) addLeftIcons(menuItemsInitialValues, floatingObject) - menuItemsInitialValues.push( - { - action: 'Add Process Instance', - actionFunction: payload.onMenuItemClick, - label: 'Add Process Instance', - visible: true, - relatedUiObject: 'Process Instance', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -45 - } - ) menuItemsInitialValues.push( { action: 'Edit Sensor Bot Instance', @@ -2244,10 +2231,23 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: -15, + angle: -45, dontShowAtFullscreen: true } ) + menuItemsInitialValues.push( + { + action: 'Add Process Instance', + actionFunction: payload.onMenuItemClick, + label: 'Add Process Instance', + visible: true, + relatedUiObject: 'Process Instance', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: -15 + } + ) menuItemsInitialValues.push( { action: 'Delete Sensor Bot Instance', @@ -2287,19 +2287,6 @@ function newUiObjectConstructor () { uiObject.codeEditor.container.connectToParent(uiObject.container, false, false, true, true, false, false, false, false) addLeftIcons(menuItemsInitialValues, floatingObject) - menuItemsInitialValues.push( - { - action: 'Add Process Instance', - actionFunction: payload.onMenuItemClick, - label: 'Add Process Instance', - visible: true, - relatedUiObject: 'Process Instance', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -45 - } - ) menuItemsInitialValues.push( { action: 'Edit Indicator Bot Instance', @@ -2311,10 +2298,23 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: -15, + angle: -45, dontShowAtFullscreen: true } ) + menuItemsInitialValues.push( + { + action: 'Add Process Instance', + actionFunction: payload.onMenuItemClick, + label: 'Add Process Instance', + visible: true, + relatedUiObject: 'Process Instance', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: -15 + } + ) menuItemsInitialValues.push( { action: 'Delete Indicator Bot Instance', @@ -2354,19 +2354,6 @@ function newUiObjectConstructor () { uiObject.codeEditor.container.connectToParent(uiObject.container, false, false, true, true, false, false, false, false) addLeftIcons(menuItemsInitialValues, floatingObject) - menuItemsInitialValues.push( - { - action: 'Add Process Instance', - actionFunction: payload.onMenuItemClick, - label: 'Add Process Instance', - visible: true, - relatedUiObject: 'Process Instance', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -45 - } - ) menuItemsInitialValues.push( { action: 'Edit Trading Bot Instance', @@ -2378,10 +2365,23 @@ function newUiObjectConstructor () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: -15, + angle: -45, dontShowAtFullscreen: true } ) + menuItemsInitialValues.push( + { + action: 'Add Process Instance', + actionFunction: payload.onMenuItemClick, + label: 'Add Process Instance', + visible: true, + relatedUiObject: 'Process Instance', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: -15 + } + ) menuItemsInitialValues.push( { action: 'Delete Trading Bot Instance', From abec6880c51fc05da84b9e751821782fc8b3bd6f Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 21 Nov 2019 14:21:46 +0100 Subject: [PATCH 93/95] Can drag and Icon while using crtl + arrows to pan the designer --- Canvas.js | 30 +++++++++++++++++++++--------- Spaces/FloatingSpace.js | 4 ++++ 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/Canvas.js b/Canvas.js index 52e0d39a9..fcc1c23b6 100644 --- a/Canvas.js +++ b/Canvas.js @@ -47,6 +47,7 @@ function newCanvas () { let splashScreen let lastContainerMouseOver + return thisObject function finalize () { @@ -71,6 +72,9 @@ function newCanvas () { browserCanvas.removeEventListener('drop', onDragDrop, false) browserCanvas.removeEventListener('keydown', onKeyDown, false) + + splashScreen = undefined + lastContainerMouseOver = undefined } catch (err) { if (ERROR_LOG === true) { logger.write('[ERROR] finalize -> err = ' + err.stack) } } @@ -242,22 +246,34 @@ function newCanvas () { } if ((event.ctrlKey === true || event.metaKey === true) && event.code === 'ArrowLeft') { - canvas.floatingSpace.oneScreenLeft() + let displaceVector = canvas.floatingSpace.oneScreenLeft() + dragVector.downX = dragVector.downX + displaceVector.x + dragVector.downY = dragVector.downY + displaceVector.y + checkDrag() return } if ((event.ctrlKey === true || event.metaKey === true) && event.code === 'ArrowRight') { - canvas.floatingSpace.oneScreenRight() + let displaceVector = canvas.floatingSpace.oneScreenRight() + dragVector.downX = dragVector.downX + displaceVector.x + dragVector.downY = dragVector.downY + displaceVector.y + checkDrag() return } if ((event.ctrlKey === true || event.metaKey === true) && event.code === 'ArrowUp') { - canvas.floatingSpace.oneScreenUp() + let displaceVector = canvas.floatingSpace.oneScreenUp() + dragVector.downX = dragVector.downX + displaceVector.x + dragVector.downY = dragVector.downY + displaceVector.y + checkDrag() return } if ((event.ctrlKey === true || event.metaKey === true) && event.code === 'ArrowDown') { - canvas.floatingSpace.oneScreenDown() + let displaceVector = canvas.floatingSpace.oneScreenDown() + dragVector.downX = dragVector.downX + displaceVector.x + dragVector.downY = dragVector.downY + displaceVector.y + checkDrag() return } @@ -557,6 +573,7 @@ function newCanvas () { function onMouseMove (event) { try { + /* Processing the event */ let point = { x: event.pageX, y: event.pageY - CURRENT_TOP_MARGIN @@ -784,11 +801,6 @@ function newCanvas () { function checkDrag (event) { try { if (containerDragStarted === true || floatingObjectDragStarted === true || viewPortBeingDragged === true) { - let point = { - x: event.pageX, - y: event.pageY - CURRENT_TOP_MARGIN - } - browserCanvas.style.cursor = 'grabbing' thisObject.eventHandler.raiseEvent('Dragging', undefined) diff --git a/Spaces/FloatingSpace.js b/Spaces/FloatingSpace.js index 84801bd3c..da3c213d6 100644 --- a/Spaces/FloatingSpace.js +++ b/Spaces/FloatingSpace.js @@ -107,6 +107,7 @@ function newFloatingSpace () { } thisObject.container.displace(displaceVector) + return displaceVector } function oneScreenDown () { @@ -116,6 +117,7 @@ function newFloatingSpace () { } thisObject.container.displace(displaceVector) + return displaceVector } function oneScreenLeft () { @@ -125,6 +127,7 @@ function newFloatingSpace () { } thisObject.container.displace(displaceVector) + return displaceVector } function oneScreenRight () { @@ -134,6 +137,7 @@ function newFloatingSpace () { } thisObject.container.displace(displaceVector) + return displaceVector } function positionAtNode (node) { From 670827f651ad20159bae0e8d2fddbd35868ed618 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 21 Nov 2019 16:12:40 +0100 Subject: [PATCH 94/95] Bug Fixed, layers not appearing --- Panels/ProductsPanel.js | 62 ++++++++++++++++++++++------------------- 1 file changed, 33 insertions(+), 29 deletions(-) diff --git a/Panels/ProductsPanel.js b/Panels/ProductsPanel.js index 12d4d976a..32f500524 100644 --- a/Panels/ProductsPanel.js +++ b/Panels/ProductsPanel.js @@ -286,12 +286,19 @@ function newProductsPanel () { for (let n = 0; n < tradingBotInstances.length; n++) { let tradingBotInstance = tradingBotInstances[n] let code - try { - code = JSON.parse(tradingBotInstance.code) - } catch (err) { - // if we can not parse this, then we ignore this trading engine. - } - if (code !== undefined) { + let instanceBot + let instanceTeam + + for (let m = 0; m < tradingBotInstance.processes.length; m++) { + let process = tradingBotInstance.processes[m] + try { + code = JSON.parse(process.payload.referenceParent.payload.parentNode.code) + instanceBot = code.codeName + code = JSON.parse(process.payload.referenceParent.payload.parentNode.payload.parentNode.code) + instanceTeam = code.codeName + } catch (err) { + continue + } for (let i = 0; i < ecosystem.devTeams.length; i++) { let devTeam = ecosystem.devTeams[i] @@ -299,37 +306,34 @@ function newProductsPanel () { let bot = devTeam.bots[j] if (bot.type !== 'Trading Bot Instance') { continue } - if (devTeam.codeName === code.team && bot.codeName === code.bot) { + if (devTeam.codeName === instanceTeam && bot.codeName === instanceBot) { /* We found an instance of the same Trading we are currently looking at. Next thing to do is to see its layers to see if we can match it with the current product. */ - for (let m = 0; m < tradingBotInstance.processes.length; m++) { - let process = tradingBotInstance.processes[m] - if (process.session !== undefined) { - if (process.session.layerManager !== undefined) { - let layerManager = process.session.layerManager + if (process.session !== undefined) { + if (process.session.layerManager !== undefined) { + let layerManager = process.session.layerManager - if (bot.products !== undefined) { - for (let k = 0; k < bot.products.length; k++) { - let product = bot.products[k] + if (bot.products !== undefined) { + for (let k = 0; k < bot.products.length; k++) { + let product = bot.products[k] - for (let p = 0; p < layerManager.layers.length; p++) { - let layer = layerManager.layers[p] - let layerCode - try { - layerCode = JSON.parse(layer.code) - } catch (err) { + for (let p = 0; p < layerManager.layers.length; p++) { + let layer = layerManager.layers[p] + let layerCode + try { + layerCode = JSON.parse(layer.code) + } catch (err) { // if we can not parse this, then we ignore this trading engine. - } + } - if (product.codeName === layerCode.product) { + if (product.codeName === layerCode.product) { /* We have a layer that is matching the current product */ - let cardCode = exchange + '-' + market.assetB + '/' + market.assetA + '-' + devTeam.codeName + '-' + bot.codeName + '-' + product.codeName + '-' + process.session.id - let cardFound = removeFromLocalProductCards(cardCode) - if (cardFound !== true) { - productCard = addProductCard(devTeam, bot, product, process.session) - onProductCardStatusChanged(productCard) - } + let cardCode = exchange + '-' + market.assetB + '/' + market.assetA + '-' + devTeam.codeName + '-' + bot.codeName + '-' + product.codeName + '-' + process.session.id + let cardFound = removeFromLocalProductCards(cardCode) + if (cardFound !== true) { + productCard = addProductCard(devTeam, bot, product, process.session) + onProductCardStatusChanged(productCard) } } } From 65f1de7041881213048fc3c2faa0ae79cb745d1b Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Fri, 22 Nov 2019 19:50:13 +0100 Subject: [PATCH 95/95] avoiding annoyng messages --- FloatingSpace/FloatingObject.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FloatingSpace/FloatingObject.js b/FloatingSpace/FloatingObject.js index efc052f92..65a6672d5 100644 --- a/FloatingSpace/FloatingObject.js +++ b/FloatingSpace/FloatingObject.js @@ -186,7 +186,7 @@ function newFloatingObject () { function frozenPhysics () { if (thisObject.frozenManually === false) { let parent = thisObject.payload.chainParent - if (parent !== undefined) { + if (parent !== undefined && parent.payload !== undefined) { thisObject.isFrozen = parent.payload.floatingObject.isFrozen } }