From 2875aab0e718bd23e5e58edb382cd52c3b4cea76 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 9 Dec 2019 12:41:13 +0100 Subject: [PATCH 01/72] Delete UI Object defined at Schema Implemented --- .../FunctionLibraries/NodeDeleter.js | 75 +++++++++++++++++++ DesignerSpace/Workspace/Workspace.js | 5 ++ FloatingSpace/UiObjectConstructor.js | 1 + 3 files changed, 81 insertions(+) diff --git a/DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js b/DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js index da06b462f..9b70edf8f 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js +++ b/DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js @@ -1,5 +1,6 @@ function newNodeDeleter () { thisObject = { + deleteUIObject: deleteUIObject, deleteDefinition: deleteDefinition, deleteNetwork: deleteNetwork, deleteNetworkNode: deleteNetworkNode, @@ -389,6 +390,80 @@ function newNodeDeleter () { cleanNode(node) } + function deleteUIObject (node, rootNodes) { + let nodeDefinition = APP_SCHEMA_MAP.get(node.type) + if (nodeDefinition !== undefined) { + /* Remove all of its own children nodes. */ + if (nodeDefinition.properties !== undefined) { + for (i = 0; i < nodeDefinition.properties.length; i++) { + let property = nodeDefinition.properties[i] + + switch (property.type) { + case 'node': { + if (node[property.name] !== undefined) { + deleteTradingSystem(node[property.name], rootNodes) + } + } + break + case 'array': { + let nodePropertyArray = node[property.name] + if (nodePropertyArray !== undefined) { + while (nodePropertyArray.length > 0) { + deleteNetworkNode(nodePropertyArray[0], rootNodes) + } + } + } + break + } + } + } + + /* Remove node from parent */ + if (node.payload.parentNode !== undefined) { + let parentNodeDefinition = APP_SCHEMA_MAP.get(node.payload.parentNode.type) + if (parentNodeDefinition !== undefined) { + if (parentNodeDefinition.properties !== undefined) { + for (i = 0; i < parentNodeDefinition.properties.length; i++) { + let property = parentNodeDefinition.properties[i] + if (nodeDefinition.propertyNameAtParent === property.name) { + switch (property.type) { + case 'node': { + node.payload.parentNode[property.name] = undefined + } + break + case 'array': { + let nodePropertyArray = node.payload.parentNode[property.name] + if (nodePropertyArray !== undefined) { + for (let j = 0; j < nodePropertyArray.length; j++) { + let arrayItem = nodePropertyArray[j] + if (arrayItem.id === node.id) { + nodePropertyArray.splice(j, 1) + } + } + } + } + break + } + } + } + } + } + } + + /* Remove from Reference Children. */ + if (node.referenceChildren !== undefined) { + 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 deleteDefinition (node, rootNodes) { let payload = node.payload diff --git a/DesignerSpace/Workspace/Workspace.js b/DesignerSpace/Workspace/Workspace.js index ed8f1f339..02976a846 100644 --- a/DesignerSpace/Workspace/Workspace.js +++ b/DesignerSpace/Workspace/Workspace.js @@ -255,6 +255,11 @@ function newWorkspace () { functionLibraryUiObjectsFromNodes.addUIObject(payload.node, relatedUiObject) } break + case 'Delete UI Object': + { + functionLibraryNodeDeleter.deleteUIObject(payload.node, thisObject.workspaceNode.rootNodes) + } + break case 'Share Workspace': { let text = stringifyWorkspace(true) diff --git a/FloatingSpace/UiObjectConstructor.js b/FloatingSpace/UiObjectConstructor.js index b05162849..78455d36a 100644 --- a/FloatingSpace/UiObjectConstructor.js +++ b/FloatingSpace/UiObjectConstructor.js @@ -4712,6 +4712,7 @@ function newUiObjectConstructor () { default: { let nodeDefinition = APP_SCHEMA_MAP.get(payload.node.type) if (nodeDefinition !== undefined) { + addLeftIcons(menuItemsInitialValues, floatingObject) for (i = 0; i < nodeDefinition.menuItems.length; i++) { let menutItemDefinition = nodeDefinition.menuItems[i] let newMenuItem = JSON.parse(JSON.stringify(menutItemDefinition)) From ef85e0ca66ced62c35726cbdf5c6a2ab6dbe89da Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 9 Dec 2019 14:27:51 +0100 Subject: [PATCH 02/72] Bug Fixed, Counting Children --- .../FunctionLibraries/NodeChildren.js | 68 ++++++++++++++++--- 1 file changed, 57 insertions(+), 11 deletions(-) diff --git a/DesignerSpace/Workspace/FunctionLibraries/NodeChildren.js b/DesignerSpace/Workspace/FunctionLibraries/NodeChildren.js index 1eb525cd0..102f6a3ac 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/NodeChildren.js +++ b/DesignerSpace/Workspace/FunctionLibraries/NodeChildren.js @@ -231,11 +231,51 @@ function newNodeChildren () { return countChildrenJavascriptCode(parentNode, childNode) } default: { - console.log('WARNING this parentNode type is not listed at NodeChildren: ' + parentNode.type) + return countChildrenUiObject(parentNode, childNode) } } } + function countChildrenUiObject (parentNode, childNode) { + let response = { + childrenCount: 0, + childIndex: undefined + } + let nodeDefinition = APP_SCHEMA_MAP.get(parentNode.type) + if (nodeDefinition !== undefined) { + if (nodeDefinition.properties !== undefined) { + for (i = 0; i < nodeDefinition.properties.length; i++) { + let property = nodeDefinition.properties[i] + if (parentNode[property.name] !== undefined) { + switch (property.type) { + case 'node': { + parent[property.name] = object + response.childrenCount++ + if (parentNode[property.name].id === childNode.id) { + response.childIndex = response.childrenCount + } + } + break + case 'array': { + let nodePropertyArray = parentNode[property.name] + for (let j = 0; j < nodePropertyArray.length; j++) { + let child = nodePropertyArray[j] + response.childrenCount++ + if (child.id === childNode.id) { + response.childIndex = response.childrenCount + } + } + } + break + } + } + } + } + } + + return response + } + function countChildrenDefinition (parentNode, childNode) { let response = { childrenCount: 0, @@ -545,9 +585,9 @@ function newNodeChildren () { childrenCount: 0, childIndex: undefined } - if (parentNode.code !== undefined) { + if (parentNode.javascriptCode !== undefined) { response.childrenCount++ - if (parentNode.code.id === childNode.id) { + if (parentNode.javascriptCode.id === childNode.id) { response.childIndex = response.childrenCount } } @@ -559,9 +599,9 @@ function newNodeChildren () { childrenCount: 0, childIndex: undefined } - if (parentNode.code !== undefined) { + if (parentNode.javascriptCode !== undefined) { response.childrenCount++ - if (parentNode.code.id === childNode.id) { + if (parentNode.javascriptCode.id === childNode.id) { response.childIndex = response.childrenCount } } @@ -691,9 +731,15 @@ function newNodeChildren () { childrenCount: 0, childIndex: undefined } - if (parentNode.code !== undefined) { + if (parentNode.javascriptCode !== undefined) { response.childrenCount++ - if (parentNode.code.id === childNode.id) { + if (parentNode.javascriptCode.id === childNode.id) { + response.childIndex = response.childrenCount + } + } + if (parentNode.shapes !== undefined) { + response.childrenCount++ + if (parentNode.shapes.id === childNode.id) { response.childIndex = response.childrenCount } } @@ -714,9 +760,9 @@ function newNodeChildren () { childrenCount: 0, childIndex: undefined } - if (parentNode.code !== undefined) { + if (parentNode.javascriptCode !== undefined) { response.childrenCount++ - if (parentNode.code.id === childNode.id) { + if (parentNode.javascriptCode.id === childNode.id) { response.childIndex = response.childrenCount } } @@ -1474,9 +1520,9 @@ function newNodeChildren () { childrenCount: 0, childIndex: undefined } - if (parentNode.code !== undefined) { + if (parentNode.javascriptCode !== undefined) { response.childrenCount++ - if (parentNode.code.id === childNode.id) { + if (parentNode.javascriptCode.id === childNode.id) { response.childIndex = response.childrenCount } } From 2286fc977abe0012ababe4dbf7b8f942a55f3d5f Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 9 Dec 2019 14:53:14 +0100 Subject: [PATCH 03/72] Detaching UI defined at Schema --- .../FunctionLibraries/ChainAttachDetach.js | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/DesignerSpace/Workspace/FunctionLibraries/ChainAttachDetach.js b/DesignerSpace/Workspace/FunctionLibraries/ChainAttachDetach.js index e4c5e9e04..9807cfdf2 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/ChainAttachDetach.js +++ b/DesignerSpace/Workspace/FunctionLibraries/ChainAttachDetach.js @@ -549,6 +549,43 @@ function newChainAttachDetach () { } return } + default: { + let nodeDefinition = APP_SCHEMA_MAP.get(node.type) + if (nodeDefinition !== undefined) { + /* Detach from parent */ + if (node.payload.parentNode !== undefined) { + let parentNodeDefinition = APP_SCHEMA_MAP.get(node.payload.parentNode.type) + if (parentNodeDefinition !== undefined) { + if (parentNodeDefinition.properties !== undefined) { + for (i = 0; i < parentNodeDefinition.properties.length; i++) { + let property = parentNodeDefinition.properties[i] + if (nodeDefinition.propertyNameAtParent === property.name) { + switch (property.type) { + case 'node': { + node.payload.parentNode[property.name] = undefined + } + break + case 'array': { + let nodePropertyArray = node.payload.parentNode[property.name] + if (nodePropertyArray !== undefined) { + for (let j = 0; j < nodePropertyArray.length; j++) { + let arrayItem = nodePropertyArray[j] + if (arrayItem.id === node.id) { + nodePropertyArray.splice(j, 1) + } + } + } + } + break + } + } + } + } + } + } + completeDetachment(node, rootNodes) + } + } } } From 04ba9e18c59509dc9508ff7c88ead4a6d6b8cf5d Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 9 Dec 2019 15:30:23 +0100 Subject: [PATCH 04/72] Chain Attachment of Schema Defined Objects is done --- .../FunctionLibraries/ChainAttachDetach.js | 34 ++ FloatingSpace/UiObject.js | 390 ++++++++++-------- 2 files changed, 248 insertions(+), 176 deletions(-) diff --git a/DesignerSpace/Workspace/FunctionLibraries/ChainAttachDetach.js b/DesignerSpace/Workspace/FunctionLibraries/ChainAttachDetach.js index 9807cfdf2..886f1a35d 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/ChainAttachDetach.js +++ b/DesignerSpace/Workspace/FunctionLibraries/ChainAttachDetach.js @@ -1144,6 +1144,40 @@ function newChainAttachDetach () { completeAttachment(node, rootNodes) } break + default: { + let nodeDefinition = APP_SCHEMA_MAP.get(node.type) + if (nodeDefinition !== undefined) { + node.payload.parentNode = attachToNode + node.payload.chainParent = attachToNode + /* Attach to new parent */ + if (node.payload.parentNode !== undefined) { + let parentNodeDefinition = APP_SCHEMA_MAP.get(node.payload.parentNode.type) + if (parentNodeDefinition !== undefined) { + if (parentNodeDefinition.properties !== undefined) { + for (i = 0; i < parentNodeDefinition.properties.length; i++) { + let property = parentNodeDefinition.properties[i] + if (nodeDefinition.propertyNameAtParent === property.name) { + switch (property.type) { + case 'node': { + node.payload.parentNode[property.name] = node + } + break + case 'array': { + let nodePropertyArray = node.payload.parentNode[property.name] + if (nodePropertyArray !== undefined) { + nodePropertyArray.push(node) + } + } + break + } + } + } + } + } + } + completeAttachment(node, rootNodes) + } + } } } diff --git a/FloatingSpace/UiObject.js b/FloatingSpace/UiObject.js index 50eb1d391..380bd2f95 100644 --- a/FloatingSpace/UiObject.js +++ b/FloatingSpace/UiObject.js @@ -254,308 +254,318 @@ function newUiObject () { if (thisObject.payload.chainParent !== undefined) { return } let nearbyFloatingObjects = thisObject.payload.floatingObject.nearbyFloatingObjects - let compatibleType - let compatibleSubType + let compatibleTypes + let compatibleSubTypes switch (thisObject.payload.node.type) { case 'Sensor Bot': - compatibleType = '->' + 'Team' + '->' - compatibleSubType = undefined + compatibleTypes = '->' + 'Team' + '->' + compatibleSubTypes = undefined break case 'Indicator Bot': - compatibleType = '->' + 'Team' + '->' - compatibleSubType = undefined + compatibleTypes = '->' + 'Team' + '->' + compatibleSubTypes = undefined break case 'Trading Bot': - compatibleType = '->' + 'Team' + '->' - compatibleSubType = undefined + compatibleTypes = '->' + 'Team' + '->' + compatibleSubTypes = undefined break case 'Process Definition': - compatibleType = '->' + 'Sensor Bot' + '->' + 'Indicator Bot' + '->' + 'Trading Bot' + '->' - compatibleSubType = undefined + compatibleTypes = '->' + 'Sensor Bot' + '->' + 'Indicator Bot' + '->' + 'Trading Bot' + '->' + compatibleSubTypes = undefined break case 'Process Output': - compatibleType = '->' + 'Process Definition' + '->' - compatibleSubType = undefined + compatibleTypes = '->' + 'Process Definition' + '->' + compatibleSubTypes = undefined break case 'Process Dependencies': - compatibleType = '->' + 'Process Definition' + '->' - compatibleSubType = undefined + compatibleTypes = '->' + 'Process Definition' + '->' + compatibleSubTypes = undefined break case 'Status Report': - compatibleType = '->' + 'Process Definition' + '->' - compatibleSubType = undefined + compatibleTypes = '->' + 'Process Definition' + '->' + compatibleSubTypes = undefined break case 'Execution Started Event': - compatibleType = '->' + 'Process Definition' + '->' - compatibleSubType = undefined + compatibleTypes = '->' + 'Process Definition' + '->' + compatibleSubTypes = undefined break case 'Execution Finished Event': - compatibleType = '->' + 'Process Definition' + '->' - compatibleSubType = undefined + compatibleTypes = '->' + 'Process Definition' + '->' + compatibleSubTypes = undefined break case 'Calculations Procedure': - compatibleType = '->' + 'Product Definition' + '->' - compatibleSubType = undefined + compatibleTypes = '->' + 'Product Definition' + '->' + compatibleSubTypes = undefined break case 'Data Building Procedure': - compatibleType = '->' + 'Product Definition' + '->' - compatibleSubType = undefined + compatibleTypes = '->' + 'Product Definition' + '->' + compatibleSubTypes = undefined break case 'Procedure Initialization': - compatibleType = '->' + 'Calculations Procedure' + '->' + 'Data Building Procedure' + '->' - compatibleSubType = undefined + compatibleTypes = '->' + 'Calculations Procedure' + '->' + 'Data Building Procedure' + '->' + compatibleSubTypes = undefined break case 'Procedure Loop': - compatibleType = '->' + 'Calculations Procedure' + '->' + 'Data Building Procedure' + '->' - compatibleSubType = undefined + compatibleTypes = '->' + 'Calculations Procedure' + '->' + 'Data Building Procedure' + '->' + compatibleSubTypes = undefined break case 'Output Dataset': - compatibleType = '->' + 'Process Output' + '->' - compatibleSubType = undefined + compatibleTypes = '->' + 'Process Output' + '->' + compatibleSubTypes = undefined break case 'Status Dependency': - compatibleType = '->' + 'Process Dependencies' + '->' - compatibleSubType = undefined + compatibleTypes = '->' + 'Process Dependencies' + '->' + compatibleSubTypes = undefined break case 'Data Dependency': - compatibleType = '->' + 'Process Dependencies' + '->' - compatibleSubType = undefined + compatibleTypes = '->' + 'Process Dependencies' + '->' + compatibleSubTypes = undefined break case 'Product Definition': - compatibleType = '->' + 'Sensor Bot' + '->' + 'Indicator Bot' + '->' + 'Trading Bot' + '->' - compatibleSubType = undefined + compatibleTypes = '->' + 'Sensor Bot' + '->' + 'Indicator Bot' + '->' + 'Trading Bot' + '->' + compatibleSubTypes = undefined break case 'Record Definition': - compatibleType = '->' + 'Product Definition' + '->' - compatibleSubType = undefined + compatibleTypes = '->' + 'Product Definition' + '->' + compatibleSubTypes = undefined break case 'Record Property': - compatibleType = '->' + 'Record Definition' + '->' - compatibleSubType = undefined + compatibleTypes = '->' + 'Record Definition' + '->' + compatibleSubTypes = undefined break case 'Dataset Definition': - compatibleType = '->' + 'Product Definition' + '->' - compatibleSubType = undefined + compatibleTypes = '->' + 'Product Definition' + '->' + compatibleSubTypes = undefined break case 'Plotter': - compatibleType = '->' + 'Team' + '->' - compatibleSubType = undefined + compatibleTypes = '->' + 'Team' + '->' + compatibleSubTypes = undefined break case 'Plotter Module': - compatibleType = '->' + 'Plotter' + '->' - compatibleSubType = undefined + compatibleTypes = '->' + 'Plotter' + '->' + compatibleSubTypes = undefined break case 'Plotter Panel': - compatibleType = '->' + 'Plotter Module' + '->' - compatibleSubType = undefined + compatibleTypes = '->' + 'Plotter Module' + '->' + compatibleSubTypes = undefined break case 'Trading System': - compatibleType = '->' + 'Definition' + '->' - compatibleSubType = undefined + compatibleTypes = '->' + 'Definition' + '->' + compatibleSubTypes = undefined break case 'Personal Data': - compatibleType = '->' + 'Definition' + '->' - compatibleSubType = undefined + compatibleTypes = '->' + 'Definition' + '->' + compatibleSubTypes = undefined break case 'Network Node': - compatibleType = '->' + 'Network' + '->' - compatibleSubType = undefined + compatibleTypes = '->' + 'Network' + '->' + compatibleSubTypes = undefined break case 'Exchange Account': - compatibleType = '->' + 'Personal Data' + '->' - compatibleSubType = undefined + compatibleTypes = '->' + 'Personal Data' + '->' + compatibleSubTypes = undefined break case 'Exchange Account Asset': - compatibleType = '->' + 'Exchange Account' + '->' - compatibleSubType = undefined + compatibleTypes = '->' + 'Exchange Account' + '->' + compatibleSubTypes = undefined break case 'Exchange Account Key': - compatibleType = '->' + 'Exchange Account' + '->' + 'Parameters' + '->' - compatibleSubType = undefined + compatibleTypes = '->' + 'Exchange Account' + '->' + 'Parameters' + '->' + compatibleSubTypes = undefined break case 'Parameters': - compatibleType = '->' + 'Trading System' + '->' + 'Backtesting Session' + '->' + 'Live Trading Session' + '->' + 'Paper Trading Session' + '->' + 'Fordward Testing Session' + '->' - compatibleSubType = '->' + 'Trading Process Instance' + '->' + compatibleTypes = '->' + 'Trading System' + '->' + 'Backtesting Session' + '->' + 'Live Trading Session' + '->' + 'Paper Trading Session' + '->' + 'Fordward Testing Session' + '->' + compatibleSubTypes = '->' + 'Trading Process Instance' + '->' break case 'Backtesting Session': - compatibleType = '->' + 'Process Instance' + '->' - compatibleSubType = '->' + 'Trading Process Instance' + '->' + compatibleTypes = '->' + 'Process Instance' + '->' + compatibleSubTypes = '->' + 'Trading Process Instance' + '->' break case 'Live Trading Session': - compatibleType = '->' + 'Process Instance' + '->' - compatibleSubType = '->' + 'Trading Process Instance' + '->' + compatibleTypes = '->' + 'Process Instance' + '->' + compatibleSubTypes = '->' + 'Trading Process Instance' + '->' break case 'Paper Trading Session': - compatibleType = '->' + 'Process Instance' + '->' - compatibleSubType = '->' + 'Trading Process Instance' + '->' + compatibleTypes = '->' + 'Process Instance' + '->' + compatibleSubTypes = '->' + 'Trading Process Instance' + '->' break case 'Fordward Testing Session': - compatibleType = '->' + 'Process Instance' + '->' - compatibleSubType = '->' + 'Trading Process Instance' + '->' + compatibleTypes = '->' + 'Process Instance' + '->' + compatibleSubTypes = '->' + 'Trading Process Instance' + '->' break case 'Base Asset': - compatibleType = '->' + 'Parameters' + '->' - compatibleSubType = undefined + compatibleTypes = '->' + 'Parameters' + '->' + compatibleSubTypes = undefined break case 'Time Range': - compatibleType = '->' + 'Parameters' + '->' - compatibleSubType = undefined + compatibleTypes = '->' + 'Parameters' + '->' + compatibleSubTypes = undefined break case 'Time Period': - compatibleType = '->' + 'Parameters' + '->' - compatibleSubType = undefined + compatibleTypes = '->' + 'Parameters' + '->' + compatibleSubTypes = undefined break case 'Slippage': - compatibleType = '->' + 'Parameters' + '->' - compatibleSubType = undefined + compatibleTypes = '->' + 'Parameters' + '->' + compatibleSubTypes = undefined break case 'Fee Structure': - compatibleType = '->' + 'Parameters' + '->' - compatibleSubType = undefined + compatibleTypes = '->' + 'Parameters' + '->' + compatibleSubTypes = undefined break case 'Layer Manager': - compatibleType = '->' + 'Backtesting Session' + '->' + 'Live Trading Session' + '->' + 'Paper Trading Session' + '->' + 'Fordward Testing Session' + '->' - compatibleSubType = undefined + compatibleTypes = '->' + 'Backtesting Session' + '->' + 'Live Trading Session' + '->' + 'Paper Trading Session' + '->' + 'Fordward Testing Session' + '->' + compatibleSubTypes = undefined break case 'Layer': - compatibleType = '->' + 'Layer Manager' + '->' - compatibleSubType = undefined + compatibleTypes = '->' + 'Layer Manager' + '->' + compatibleSubTypes = undefined break case 'Social Bots': - compatibleType = '->' + 'Backtesting Session' + '->' + 'Live Trading Session' + '->' + 'Paper Trading Session' + '->' + 'Fordward Testing Session' + '->' - compatibleSubType = undefined + compatibleTypes = '->' + 'Backtesting Session' + '->' + 'Live Trading Session' + '->' + 'Paper Trading Session' + '->' + 'Fordward Testing Session' + '->' + compatibleSubTypes = undefined break case 'Telegram Bot': - compatibleType = '->' + 'Social Bots' + '->' - compatibleSubType = undefined + compatibleTypes = '->' + 'Social Bots' + '->' + compatibleSubTypes = undefined break case 'Announcement': - compatibleType = '->' + 'Telegram Bot' + '->' + 'Trigger On Event' + '->' + 'Trigger Off Event' + '->' + 'Take Position Event' + '->' + 'Next Phase Event' + '->' + '->' + 'Phase' + '->' - compatibleSubType = undefined + compatibleTypes = '->' + 'Telegram Bot' + '->' + 'Trigger On Event' + '->' + 'Trigger Off Event' + '->' + 'Take Position Event' + '->' + 'Next Phase Event' + '->' + '->' + 'Phase' + '->' + compatibleSubTypes = undefined break case 'Task Manager': - compatibleType = '->' + 'Network Node' + '->' - compatibleSubType = undefined + compatibleTypes = '->' + 'Network Node' + '->' + compatibleSubTypes = undefined break case 'Task': - compatibleType = '->' + 'Task Manager' + '->' - compatibleSubType = undefined + compatibleTypes = '->' + 'Task Manager' + '->' + compatibleSubTypes = undefined break case 'Sensor Bot Instance': - compatibleType = '->' + 'Task' + '->' - compatibleSubType = undefined + compatibleTypes = '->' + 'Task' + '->' + compatibleSubTypes = undefined break case 'Indicator Bot Instance': - compatibleType = '->' + 'Task' + '->' - compatibleSubType = undefined + compatibleTypes = '->' + 'Task' + '->' + compatibleSubTypes = undefined break case 'Trading Bot Instance': - compatibleType = '->' + 'Task' + '->' - compatibleSubType = undefined + compatibleTypes = '->' + 'Task' + '->' + compatibleSubTypes = undefined break case 'Process Instance': switch (thisObject.payload.node.subType) { case 'Sensor Process Instance': { - compatibleType = '->' + 'Sensor Bot Instance' + '->' + compatibleTypes = '->' + 'Sensor Bot Instance' + '->' break } case 'Indicator Process Instance': { - compatibleType = '->' + 'Indicator Bot Instance' + '->' + compatibleTypes = '->' + 'Indicator Bot Instance' + '->' break } case 'Trading Process Instance': { - compatibleType = '->' + 'Trading Bot Instance' + '->' + compatibleTypes = '->' + 'Trading Bot Instance' + '->' break } } - compatibleSubType = undefined + compatibleSubTypes = undefined break case 'Strategy': - compatibleType = '->' + 'Trading System' + '->' - compatibleSubType = undefined + compatibleTypes = '->' + 'Trading System' + '->' + compatibleSubTypes = undefined break case 'Trigger Stage': - compatibleType = '->' + 'Strategy' + '->' - compatibleSubType = undefined + compatibleTypes = '->' + 'Strategy' + '->' + compatibleSubTypes = undefined break case 'Open Stage': - compatibleType = '->' + 'Strategy' + '->' - compatibleSubType = undefined + compatibleTypes = '->' + 'Strategy' + '->' + compatibleSubTypes = undefined break case 'Manage Stage': - compatibleType = '->' + 'Strategy' + '->' - compatibleSubType = undefined + compatibleTypes = '->' + 'Strategy' + '->' + compatibleSubTypes = undefined break case 'Close Stage': - compatibleType = '->' + 'Strategy' + '->' - compatibleSubType = undefined + compatibleTypes = '->' + 'Strategy' + '->' + compatibleSubTypes = undefined break case 'Position Size': - compatibleType = '->' + 'Initial Definition' + '->' - compatibleSubType = undefined + compatibleTypes = '->' + 'Initial Definition' + '->' + compatibleSubTypes = undefined break case 'Position Rate': - compatibleType = '->' + 'Initial Definition' + '->' - compatibleSubType = undefined + compatibleTypes = '->' + 'Initial Definition' + '->' + compatibleSubTypes = undefined break case 'Take Position Event': - compatibleType = '->' + 'Trigger Stage' + '->' - compatibleSubType = undefined + compatibleTypes = '->' + 'Trigger Stage' + '->' + compatibleSubTypes = undefined break case 'Trigger Off Event': - compatibleType = '->' + 'Trigger Stage' + '->' - compatibleSubType = undefined + compatibleTypes = '->' + 'Trigger Stage' + '->' + compatibleSubTypes = undefined break case 'Trigger On Event': - compatibleType = '->' + 'Trigger Stage' + '->' - compatibleSubType = undefined + compatibleTypes = '->' + 'Trigger Stage' + '->' + compatibleSubTypes = undefined break case 'Initial Definition': - compatibleType = '->' + 'Open Stage' + '->' - compatibleSubType = undefined + compatibleTypes = '->' + 'Open Stage' + '->' + compatibleSubTypes = undefined break case 'Open Execution': - compatibleType = '->' + 'Open Stage' + '->' - compatibleSubType = undefined + compatibleTypes = '->' + 'Open Stage' + '->' + compatibleSubTypes = undefined break case 'Close Execution': - compatibleType = '->' + 'Close Stage' + '->' - compatibleSubType = undefined + compatibleTypes = '->' + 'Close Stage' + '->' + compatibleSubTypes = undefined break case 'Stop': - compatibleType = '->' + 'Manage Stage' + '->' + 'Initial Definition' + '->' - compatibleSubType = undefined + compatibleTypes = '->' + 'Manage Stage' + '->' + 'Initial Definition' + '->' + compatibleSubTypes = undefined break case 'Take Profit': - compatibleType = '->' + 'Manage Stage' + '->' + 'Initial Definition' + '->' - compatibleSubType = undefined + compatibleTypes = '->' + 'Manage Stage' + '->' + 'Initial Definition' + '->' + compatibleSubTypes = undefined break case 'Phase': - compatibleType = '->' + 'Stop' + '->' + 'Take Profit' + '->' + 'Phase' + '->' - compatibleSubType = undefined + compatibleTypes = '->' + 'Stop' + '->' + 'Take Profit' + '->' + 'Phase' + '->' + compatibleSubTypes = undefined break case 'Formula': - compatibleType = '->' + 'Position Size' + '->' + 'Position Rate' + '->' + 'Phase' + '->' + 'Announcement' + '->' + 'Record Property' + '->' - compatibleSubType = undefined + compatibleTypes = '->' + 'Position Size' + '->' + 'Position Rate' + '->' + 'Phase' + '->' + 'Announcement' + '->' + 'Record Property' + '->' + compatibleSubTypes = undefined break case 'Next Phase Event': - compatibleType = '->' + 'Phase' + '->' - compatibleSubType = undefined + compatibleTypes = '->' + 'Phase' + '->' + compatibleSubTypes = undefined break case 'Situation': - compatibleType = '->' + 'Take Position Event' + '->' + 'Trigger On Event' + '->' + 'Trigger Off Event' + '->' + 'Next Phase Event' + '->' - compatibleSubType = undefined + compatibleTypes = '->' + 'Take Position Event' + '->' + 'Trigger On Event' + '->' + 'Trigger Off Event' + '->' + 'Next Phase Event' + '->' + compatibleSubTypes = undefined break case 'Condition': - compatibleType = '->' + 'Situation' + '->' - compatibleSubType = undefined + compatibleTypes = '->' + 'Situation' + '->' + compatibleSubTypes = undefined break case 'Javascript Code': - compatibleType = '->' + 'Condition' + '->' + 'Procedure Initialization' + '->' + 'Procedure Loop' + '->' + 'Plotter Module' + '->' + 'Plotter Panel' + '->' - compatibleSubType = undefined + compatibleTypes = '->' + 'Condition' + '->' + 'Procedure Initialization' + '->' + 'Procedure Loop' + '->' + 'Plotter Module' + '->' + 'Plotter Panel' + '->' + compatibleSubTypes = undefined break default: - return + let nodeDefinition = APP_SCHEMA_MAP.get(thisObject.payload.node.type) + if (nodeDefinition !== undefined) { + if (nodeDefinition.attachesTo !== undefined) { + compatibleTypes = nodeDefinition.attachesTo.compatibleTypes + compatibleSubTypes = nodeDefinition.attachesTo.compatibleSubTypes + } else { + return + } + } else { + return + } } let foundCompatible = false chainAttachToNode = undefined @@ -566,8 +576,36 @@ function newUiObject () { 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 (compatibleTypes.indexOf('->' + nearbyNode.type + '->') >= 0) { + /* Discard App Schema defined objects with busy coonection ports */ + let nodeDefinition = APP_SCHEMA_MAP.get(thisObject.payload.node.type) + if (nodeDefinition !== undefined) { + let mustContinue = false + let parentNodeDefinition = APP_SCHEMA_MAP.get(nearbyNode.type) + if (parentNodeDefinition !== undefined) { + if (parentNodeDefinition.properties !== undefined) { + for (j = 0; j < parentNodeDefinition.properties.length; j++) { + let property = parentNodeDefinition.properties[j] + if (nodeDefinition.propertyNameAtParent === property.name) { + switch (property.type) { + case 'node': { + if (nearbyNode[property.name] !== undefined) { + mustContinue = true + } + } + break + case 'array': { + /* Nothing to worry about since an array can take more than one element. */ + } + break + } + } + } + } + } + if (mustContinue === true) { continue } + } + /* Discard legacy objects with busy coonection ports */ if (thisObject.payload.node.type === 'Status Report' && nearbyNode.statusReport !== 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 } @@ -611,8 +649,8 @@ function newUiObject () { if (thisObject.payload.node.type === 'Next Phase Event' && nearbyNode.nextPhaseEvent !== undefined) { continue } if (thisObject.payload.node.type === 'Javascript Code' && nearbyNode.javascriptCode !== undefined) { continue } /* Here we check if the subtypes are compatible. */ - if (nearbyNode.subType !== undefined && compatibleSubType !== undefined) { - if (compatibleSubType.indexOf('->' + nearbyNode.subType + '->') < 0) { + if (nearbyNode.subType !== undefined && compatibleSubTypes !== undefined) { + if (compatibleSubTypes.indexOf('->' + nearbyNode.subType + '->') < 0) { continue } } @@ -717,48 +755,48 @@ function newUiObject () { if (thisObject.payload.referenceParent !== undefined) { return } let nearbyFloatingObjects = thisObject.payload.floatingObject.nearbyFloatingObjects - let compatibleType - let compatibleSubType + let compatibleTypes + let compatibleSubTypes switch (thisObject.payload.node.type) { case 'Backtesting Session': - compatibleType = '->' + 'Definition' + '->' - compatibleSubType = undefined + compatibleTypes = '->' + 'Definition' + '->' + compatibleSubTypes = undefined break case 'Live Trading Session': - compatibleType = '->' + 'Definition' + '->' - compatibleSubType = undefined + compatibleTypes = '->' + 'Definition' + '->' + compatibleSubTypes = undefined break case 'Paper Trading Session': - compatibleType = '->' + 'Definition' + '->' - compatibleSubType = undefined + compatibleTypes = '->' + 'Definition' + '->' + compatibleSubTypes = undefined break case 'Fordward Testing Session': - compatibleType = '->' + 'Definition' + '->' - compatibleSubType = undefined + compatibleTypes = '->' + 'Definition' + '->' + compatibleSubTypes = undefined break case 'Output Dataset': - compatibleType = '->' + 'Dataset Definition' + '->' - compatibleSubType = undefined + compatibleTypes = '->' + 'Dataset Definition' + '->' + compatibleSubTypes = undefined break case 'Data Dependency': - compatibleType = '->' + 'Dataset Definition' + '->' - compatibleSubType = undefined + compatibleTypes = '->' + 'Dataset Definition' + '->' + compatibleSubTypes = undefined break case 'Status Dependency': - compatibleType = '->' + 'Status Report' + '->' - compatibleSubType = undefined + compatibleTypes = '->' + 'Status Report' + '->' + compatibleSubTypes = undefined break case 'Execution Started Event': - compatibleType = '->' + 'Execution Finished Event' + '->' - compatibleSubType = undefined + compatibleTypes = '->' + 'Execution Finished Event' + '->' + compatibleSubTypes = undefined break case 'Process Instance': - compatibleType = '->' + 'Process Definition' + '->' - compatibleSubType = undefined + compatibleTypes = '->' + 'Process Definition' + '->' + compatibleSubTypes = undefined break case 'Product Definition': - compatibleType = '->' + 'Plotter Module' + '->' - compatibleSubType = undefined + compatibleTypes = '->' + 'Plotter Module' + '->' + compatibleSubTypes = undefined break default: return @@ -772,10 +810,10 @@ function newUiObject () { let distance = nearby[0] let floatingObject = nearby[1] let nearbyNode = floatingObject.payload.node - if (compatibleType.indexOf('->' + nearbyNode.type + '->') >= 0) { + if (compatibleTypes.indexOf('->' + nearbyNode.type + '->') >= 0) { /* Here we check if the subtypes are compatible. */ - if (nearbyNode.subType !== undefined && compatibleSubType !== undefined) { - if (compatibleSubType.indexOf('->' + nearbyNode.subType + '->') < 0) { + if (nearbyNode.subType !== undefined && compatibleSubTypes !== undefined) { + if (compatibleSubTypes.indexOf('->' + nearbyNode.subType + '->') < 0) { continue } } From ce0f51a8b23c3c815d1222c69dc33293d5d88bbf Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 9 Dec 2019 17:47:03 +0100 Subject: [PATCH 05/72] Bug Fixes, Array objects now working --- DesignerSpace/Workspace/FunctionLibraries/NodeChildren.js | 1 - DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js | 2 +- .../Workspace/FunctionLibraries/UiObjectsFromNodes.js | 3 +++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/DesignerSpace/Workspace/FunctionLibraries/NodeChildren.js b/DesignerSpace/Workspace/FunctionLibraries/NodeChildren.js index 102f6a3ac..043ae77b5 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/NodeChildren.js +++ b/DesignerSpace/Workspace/FunctionLibraries/NodeChildren.js @@ -249,7 +249,6 @@ function newNodeChildren () { if (parentNode[property.name] !== undefined) { switch (property.type) { case 'node': { - parent[property.name] = object response.childrenCount++ if (parentNode[property.name].id === childNode.id) { response.childIndex = response.childrenCount diff --git a/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js b/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js index 68482972f..508985c21 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js +++ b/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js @@ -1683,7 +1683,7 @@ function newProtocolNode () { case 'node': { if (node[property.name] !== undefined) { if (excludeType !== property.childType) { - object[property.name] = getProtocolNode(node.payload.parentNode, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) + object[property.name] = getProtocolNode(node[property.name], removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) } } break diff --git a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js index e2a05c867..0b487ea2a 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js +++ b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js @@ -1132,6 +1132,9 @@ function newUiObjectsFromNodes () { } break case 'array': { + if (parent[property.name] === undefined) { + parent[property.name] = [] + } parent[property.name].push(object) } break From 4a23a032b1b0aa1ef5a66357b57a56109d082c9a Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 9 Dec 2019 18:04:27 +0100 Subject: [PATCH 06/72] Bug Fixed with for without let --- .../Workspace/FunctionLibraries/ChainAttachDetach.js | 4 ++-- DesignerSpace/Workspace/FunctionLibraries/NodeChildren.js | 2 +- DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js | 4 ++-- DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js | 5 ++++- .../Workspace/FunctionLibraries/UiObjectsFromNodes.js | 4 ++-- DesignerSpace/Workspace/Workspace.js | 2 +- FloatingSpace/NoteSets.js | 2 +- FloatingSpace/UiObject.js | 2 +- FloatingSpace/UiObjectConstructor.js | 2 +- 9 files changed, 15 insertions(+), 12 deletions(-) diff --git a/DesignerSpace/Workspace/FunctionLibraries/ChainAttachDetach.js b/DesignerSpace/Workspace/FunctionLibraries/ChainAttachDetach.js index 886f1a35d..19bb15465 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/ChainAttachDetach.js +++ b/DesignerSpace/Workspace/FunctionLibraries/ChainAttachDetach.js @@ -557,7 +557,7 @@ function newChainAttachDetach () { let parentNodeDefinition = APP_SCHEMA_MAP.get(node.payload.parentNode.type) if (parentNodeDefinition !== undefined) { if (parentNodeDefinition.properties !== undefined) { - for (i = 0; i < parentNodeDefinition.properties.length; i++) { + for (let i = 0; i < parentNodeDefinition.properties.length; i++) { let property = parentNodeDefinition.properties[i] if (nodeDefinition.propertyNameAtParent === property.name) { switch (property.type) { @@ -1154,7 +1154,7 @@ function newChainAttachDetach () { let parentNodeDefinition = APP_SCHEMA_MAP.get(node.payload.parentNode.type) if (parentNodeDefinition !== undefined) { if (parentNodeDefinition.properties !== undefined) { - for (i = 0; i < parentNodeDefinition.properties.length; i++) { + for (let i = 0; i < parentNodeDefinition.properties.length; i++) { let property = parentNodeDefinition.properties[i] if (nodeDefinition.propertyNameAtParent === property.name) { switch (property.type) { diff --git a/DesignerSpace/Workspace/FunctionLibraries/NodeChildren.js b/DesignerSpace/Workspace/FunctionLibraries/NodeChildren.js index 043ae77b5..fd2456a0e 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/NodeChildren.js +++ b/DesignerSpace/Workspace/FunctionLibraries/NodeChildren.js @@ -244,7 +244,7 @@ function newNodeChildren () { let nodeDefinition = APP_SCHEMA_MAP.get(parentNode.type) if (nodeDefinition !== undefined) { if (nodeDefinition.properties !== undefined) { - for (i = 0; i < nodeDefinition.properties.length; i++) { + for (let i = 0; i < nodeDefinition.properties.length; i++) { let property = nodeDefinition.properties[i] if (parentNode[property.name] !== undefined) { switch (property.type) { diff --git a/DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js b/DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js index 9b70edf8f..761885d25 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js +++ b/DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js @@ -395,7 +395,7 @@ function newNodeDeleter () { if (nodeDefinition !== undefined) { /* Remove all of its own children nodes. */ if (nodeDefinition.properties !== undefined) { - for (i = 0; i < nodeDefinition.properties.length; i++) { + for (let i = 0; i < nodeDefinition.properties.length; i++) { let property = nodeDefinition.properties[i] switch (property.type) { @@ -423,7 +423,7 @@ function newNodeDeleter () { let parentNodeDefinition = APP_SCHEMA_MAP.get(node.payload.parentNode.type) if (parentNodeDefinition !== undefined) { if (parentNodeDefinition.properties !== undefined) { - for (i = 0; i < parentNodeDefinition.properties.length; i++) { + for (let i = 0; i < parentNodeDefinition.properties.length; i++) { let property = parentNodeDefinition.properties[i] if (nodeDefinition.propertyNameAtParent === property.name) { switch (property.type) { diff --git a/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js b/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js index 508985c21..f4c34bdb5 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js +++ b/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js @@ -1676,7 +1676,7 @@ function newProtocolNode () { if (excludeChildren !== true) { /* Children Nodes */ if (nodeDefinition.properties !== undefined) { - for (i = 0; i < nodeDefinition.properties.length; i++) { + for (let i = 0; i < nodeDefinition.properties.length; i++) { let property = nodeDefinition.properties[i] switch (property.type) { @@ -1750,6 +1750,9 @@ function newProtocolNode () { } function getSavedPayload (node, includeReferences) { + if (node.payload === undefined) { + console.log('HERE') + } let savedPayload = { position: { x: node.payload.position.x, diff --git a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js index 0b487ea2a..48839560b 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js +++ b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js @@ -1087,7 +1087,7 @@ function newUiObjectsFromNodes () { createUiObject(false, node.type, node.name, node, parentNode, chainParent, node.type, positionOffset) if (nodeDefinition.properties !== undefined) { - for (i = 0; i < nodeDefinition.properties.length; i++) { + for (let i = 0; i < nodeDefinition.properties.length; i++) { let property = nodeDefinition.properties[i] if (node[property.name] !== undefined) { switch (property.type) { @@ -1123,7 +1123,7 @@ function newUiObjectsFromNodes () { let nodeDefinition = APP_SCHEMA_MAP.get(parent.type) if (nodeDefinition !== undefined) { if (nodeDefinition.properties !== undefined) { - for (i = 0; i < nodeDefinition.properties.length; i++) { + for (let i = 0; i < nodeDefinition.properties.length; i++) { let property = nodeDefinition.properties[i] if (property.childType === type) { switch (property.type) { diff --git a/DesignerSpace/Workspace/Workspace.js b/DesignerSpace/Workspace/Workspace.js index 02976a846..f904cd6ee 100644 --- a/DesignerSpace/Workspace/Workspace.js +++ b/DesignerSpace/Workspace/Workspace.js @@ -158,7 +158,7 @@ function newWorkspace () { 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++) { + for (let k = 0; k < taskManager.tasks.length; k++) { let task = taskManager.tasks[k] if (task.bot !== undefined) { if (task.bot.type === 'Trading Bot Instance') { diff --git a/FloatingSpace/NoteSets.js b/FloatingSpace/NoteSets.js index f61a55c67..f9eaca6f4 100644 --- a/FloatingSpace/NoteSets.js +++ b/FloatingSpace/NoteSets.js @@ -100,7 +100,7 @@ function newNoteSets () { let i - for (i = 0; i < pNewNotes.length; i++) { + for (let i = 0; i < pNewNotes.length; i++) { let plotterNote = pNewNotes[i] let plotterNoteKey = plotterNote.date.toString() + plotterNote.rate.toString() diff --git a/FloatingSpace/UiObject.js b/FloatingSpace/UiObject.js index 380bd2f95..b3b9bb9c3 100644 --- a/FloatingSpace/UiObject.js +++ b/FloatingSpace/UiObject.js @@ -584,7 +584,7 @@ function newUiObject () { let parentNodeDefinition = APP_SCHEMA_MAP.get(nearbyNode.type) if (parentNodeDefinition !== undefined) { if (parentNodeDefinition.properties !== undefined) { - for (j = 0; j < parentNodeDefinition.properties.length; j++) { + for (let j = 0; j < parentNodeDefinition.properties.length; j++) { let property = parentNodeDefinition.properties[j] if (nodeDefinition.propertyNameAtParent === property.name) { switch (property.type) { diff --git a/FloatingSpace/UiObjectConstructor.js b/FloatingSpace/UiObjectConstructor.js index 78455d36a..96c194e1c 100644 --- a/FloatingSpace/UiObjectConstructor.js +++ b/FloatingSpace/UiObjectConstructor.js @@ -4713,7 +4713,7 @@ function newUiObjectConstructor () { let nodeDefinition = APP_SCHEMA_MAP.get(payload.node.type) if (nodeDefinition !== undefined) { addLeftIcons(menuItemsInitialValues, floatingObject) - for (i = 0; i < nodeDefinition.menuItems.length; i++) { + for (let i = 0; i < nodeDefinition.menuItems.length; i++) { let menutItemDefinition = nodeDefinition.menuItems[i] let newMenuItem = JSON.parse(JSON.stringify(menutItemDefinition)) From 78e5e6d3531700952efbed3bd1333099d7cb628e Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 9 Dec 2019 18:07:51 +0100 Subject: [PATCH 07/72] Bug Fixed, deleting UI objects Schema defined --- DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js b/DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js index 761885d25..5ce654fde 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js +++ b/DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js @@ -401,7 +401,7 @@ function newNodeDeleter () { switch (property.type) { case 'node': { if (node[property.name] !== undefined) { - deleteTradingSystem(node[property.name], rootNodes) + deleteUIObject(node[property.name], rootNodes) } } break @@ -409,7 +409,7 @@ function newNodeDeleter () { let nodePropertyArray = node[property.name] if (nodePropertyArray !== undefined) { while (nodePropertyArray.length > 0) { - deleteNetworkNode(nodePropertyArray[0], rootNodes) + deleteUIObject(nodePropertyArray[0], rootNodes) } } } From cf5864017c80f961bf4f15b3314cc58ebd881ff9 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 10 Dec 2019 11:06:38 +0100 Subject: [PATCH 08/72] Bug Fixed with Titles --- FloatingSpace/UiObjectConstructor.js | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/FloatingSpace/UiObjectConstructor.js b/FloatingSpace/UiObjectConstructor.js index 96c194e1c..eddb627ad 100644 --- a/FloatingSpace/UiObjectConstructor.js +++ b/FloatingSpace/UiObjectConstructor.js @@ -5043,32 +5043,30 @@ function newUiObjectConstructor () { switch (nodeDefinition.level) { case 0: { level_0() - return + break } case 1: { level_1() - return + break } case 2: { level_2() - return + break } case 3: { level_3() - return + break } case 4: { level_4() - return + break } case 5: { level_5() - return + break } } } - if (ERROR_LOG === true) { logger.write('[ERROR] initialize -> UI Object Type not Recognized -> type = ' + payload.node.type) } - return } } @@ -5083,7 +5081,6 @@ function newUiObjectConstructor () { floatingObject.fillStyle = 'rgba(' + UI_COLOR.WHITE + ', 1)' } - function level_1 () { floatingObject.targetFriction = 0.94 floatingObject.friction = INITIAL_FRICTION @@ -5099,7 +5096,6 @@ function newUiObjectConstructor () { // floatingObject.tensionToggle() } } - function level_2 () { floatingObject.targetFriction = FRICTION floatingObject.friction = INITIAL_FRICTION @@ -5115,7 +5111,6 @@ function newUiObjectConstructor () { // floatingObject.tensionToggle() } } - function level_3 () { floatingObject.targetFriction = FRICTION floatingObject.friction = INITIAL_FRICTION @@ -5131,7 +5126,6 @@ function newUiObjectConstructor () { // floatingObject.tensionToggle() } } - function level_4 () { floatingObject.targetFriction = FRICTION floatingObject.friction = INITIAL_FRICTION @@ -5147,7 +5141,6 @@ function newUiObjectConstructor () { // floatingObject.tensionToggle() } } - function level_5 () { floatingObject.targetFriction = FRICTION floatingObject.friction = INITIAL_FRICTION From 01152a729df6f439f0046475e844fada60d64512 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 10 Dec 2019 11:42:24 +0100 Subject: [PATCH 09/72] Focus and Shortcut keys working with the APP Schema --- .../Workspace/FunctionLibraries/OnFocus.js | 45 +++++++++++++++++++ .../FunctionLibraries/ShortcutKeys.js | 45 +++++++++++++++++++ 2 files changed, 90 insertions(+) diff --git a/DesignerSpace/Workspace/FunctionLibraries/OnFocus.js b/DesignerSpace/Workspace/FunctionLibraries/OnFocus.js index 353eb3723..902c89d31 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/OnFocus.js +++ b/DesignerSpace/Workspace/FunctionLibraries/OnFocus.js @@ -1061,6 +1061,10 @@ function newOnFocus () { if (child !== undefined) { return child } + child = getNodeThatIsOnFocus(node.shapes) + if (child !== undefined) { + return child + } for (let m = 0; m < node.panels.length; m++) { child = getNodeThatIsOnFocus(node.panels[m]) if (child !== undefined) { @@ -1085,6 +1089,47 @@ function newOnFocus () { return } } + default: { + let nodeDefinition = APP_SCHEMA_MAP.get(node.type) + if (nodeDefinition !== undefined) { + /* First we ask the question to ourself */ + if (node.payload.uiObject.isOnFocus === true) { + return node + } + + /* Then we check all of its own children nodes. */ + if (nodeDefinition.properties !== undefined) { + for (let i = 0; i < nodeDefinition.properties.length; i++) { + let property = nodeDefinition.properties[i] + + switch (property.type) { + case 'node': { + if (node[property.name] !== undefined) { + let child + child = getNodeThatIsOnFocus(node[property.name]) + if (child !== undefined) { + return child + } + } + } + break + case 'array': { + let nodePropertyArray = node[property.name] + if (nodePropertyArray !== undefined) { + for (let m = 0; m < nodePropertyArray.length; m++) { + child = getNodeThatIsOnFocus(nodePropertyArray[m]) + if (child !== undefined) { + return child + } + } + } + } + break + } + } + } + } + } } } } diff --git a/DesignerSpace/Workspace/FunctionLibraries/ShortcutKeys.js b/DesignerSpace/Workspace/FunctionLibraries/ShortcutKeys.js index 31e3c7070..891e81e9b 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/ShortcutKeys.js +++ b/DesignerSpace/Workspace/FunctionLibraries/ShortcutKeys.js @@ -1038,6 +1038,10 @@ function newShortcutKeys () { if (child !== undefined) { return child } + child = getNodeByShortcutKey(node.shapes, searchingKey) + if (child !== undefined) { + return child + } for (let m = 0; m < node.panels.length; m++) { child = getNodeByShortcutKey(node.panels[m], searchingKey) if (child !== undefined) { @@ -1063,6 +1067,47 @@ function newShortcutKeys () { } } + default: { + let nodeDefinition = APP_SCHEMA_MAP.get(node.type) + if (nodeDefinition !== undefined) { + /* Check Self first */ + if (node.payload.uiObject.shortcutKey === searchingKey) { + return node + } + + /* Check all of its own children nodes. */ + if (nodeDefinition.properties !== undefined) { + for (let i = 0; i < nodeDefinition.properties.length; i++) { + let property = nodeDefinition.properties[i] + + switch (property.type) { + case 'node': { + if (node[property.name] !== undefined) { + let child + child = getNodeByShortcutKey(node[property.name], searchingKey) + if (child !== undefined) { + return child + } + } + } + break + case 'array': { + let nodePropertyArray = node[property.name] + if (nodePropertyArray !== undefined) { + for (let m = 0; m < nodePropertyArray.length; m++) { + child = getNodeByShortcutKey(nodePropertyArray[m], searchingKey) + if (child !== undefined) { + return child + } + } + } + } + break + } + } + } + } + } } } } From 5b87bedb339c219a4c97987bdde1e6ee7727d801 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 10 Dec 2019 12:42:20 +0100 Subject: [PATCH 10/72] Editors from the APP Schema --- .../FunctionLibraries/UiObjectsFromNodes.js | 32 ++++++++++++++++--- FloatingSpace/UiObjectConstructor.js | 27 ++++++++++++++++ 2 files changed, 54 insertions(+), 5 deletions(-) diff --git a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js index 48839560b..619e7a51c 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js +++ b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js @@ -1084,8 +1084,19 @@ function newUiObjectsFromNodes () { default: { let nodeDefinition = APP_SCHEMA_MAP.get(node.type) if (nodeDefinition !== undefined) { + /* Resolve Initial Values */ + if (nodeDefinition.initialValues !== undefined) { + if (nodeDefinition.initialValues.code !== undefined) { + if (node.code === undefined) { + node.code = nodeDefinition.initialValues.code + } + } + } + + /* Create Self */ createUiObject(false, node.type, node.name, node, parentNode, chainParent, node.type, positionOffset) + /* Create Children */ if (nodeDefinition.properties !== undefined) { for (let i = 0; i < nodeDefinition.properties.length; i++) { let property = nodeDefinition.properties[i] @@ -1120,11 +1131,22 @@ function newUiObjectsFromNodes () { } createUiObject(true, object.type, object.name, object, parent, parent) - let nodeDefinition = APP_SCHEMA_MAP.get(parent.type) - if (nodeDefinition !== undefined) { - if (nodeDefinition.properties !== undefined) { - for (let i = 0; i < nodeDefinition.properties.length; i++) { - let property = nodeDefinition.properties[i] + let parentNodeDefinition = APP_SCHEMA_MAP.get(parent.type) + if (parentNodeDefinition !== undefined) { + /* Resolve Initial Values */ + let nodeDefinition = APP_SCHEMA_MAP.get(object.type) + if (nodeDefinition !== undefined) { + if (nodeDefinition.initialValues !== undefined) { + if (nodeDefinition.initialValues.code !== undefined) { + object.code = nodeDefinition.initialValues.code + } + } + } + + /* Connect to Parent */ + if (parentNodeDefinition.properties !== undefined) { + for (let i = 0; i < parentNodeDefinition.properties.length; i++) { + let property = parentNodeDefinition.properties[i] if (property.childType === type) { switch (property.type) { case 'node': { diff --git a/FloatingSpace/UiObjectConstructor.js b/FloatingSpace/UiObjectConstructor.js index eddb627ad..589d323f4 100644 --- a/FloatingSpace/UiObjectConstructor.js +++ b/FloatingSpace/UiObjectConstructor.js @@ -4712,6 +4712,33 @@ function newUiObjectConstructor () { default: { let nodeDefinition = APP_SCHEMA_MAP.get(payload.node.type) if (nodeDefinition !== undefined) { + if (nodeDefinition.editors !== undefined) { + if (nodeDefinition.editors.config === true) { + uiObject.configEditor = newConfigEditor() + uiObject.configEditor.isVisibleFunction = uiObject.isVisibleFunction + uiObject.configEditor.initialize() + uiObject.configEditor.container.connectToParent(uiObject.container, false, false, true, true, false, false, false, false) + } + if (nodeDefinition.editors.code === true) { + 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) + } + if (nodeDefinition.editors.formula === true) { + uiObject.formulaEditor = newFormulaEditor() + uiObject.formulaEditor.isVisibleFunction = uiObject.isVisibleFunction + uiObject.formulaEditor.initialize() + uiObject.formulaEditor.container.connectToParent(uiObject.container, false, false, true, true, false, false, false, false) + } + if (nodeDefinition.editors.condition === true) { + uiObject.conditionEditor = newConditionEditor() + uiObject.conditionEditor.isVisibleFunction = uiObject.isVisibleFunction + uiObject.conditionEditor.initialize() + uiObject.conditionEditor.container.connectToParent(uiObject.container, false, false, true, true, false, false, false, false) + } + } + addLeftIcons(menuItemsInitialValues, floatingObject) for (let i = 0; i < nodeDefinition.menuItems.length; i++) { let menutItemDefinition = nodeDefinition.menuItems[i] From 984f100b88e8b20a8a6cdaf89ebc719ae6b98c57 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 10 Dec 2019 14:34:39 +0100 Subject: [PATCH 11/72] new icon --- Spaces/DesignerSpace.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Spaces/DesignerSpace.js b/Spaces/DesignerSpace.js index 8cde058e0..e56e8f57b 100644 --- a/Spaces/DesignerSpace.js +++ b/Spaces/DesignerSpace.js @@ -236,7 +236,8 @@ function newDesignerSpace () { 'process-dependencies', 'process-output', 'social-bot', - 'execution-started-event' + 'execution-started-event', + 'shapes' ] for (let i = 0; i < iconsNames.length; i++) { From 991ab7d355c7b89dec27381735934865d0b2c697 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 10 Dec 2019 15:15:55 +0100 Subject: [PATCH 12/72] Update ReferenceAttachDetach.js --- .../ReferenceAttachDetach.js | 86 +------------------ 1 file changed, 2 insertions(+), 84 deletions(-) diff --git a/DesignerSpace/Workspace/FunctionLibraries/ReferenceAttachDetach.js b/DesignerSpace/Workspace/FunctionLibraries/ReferenceAttachDetach.js index ad9ed3e4f..f3ffe978a 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/ReferenceAttachDetach.js +++ b/DesignerSpace/Workspace/FunctionLibraries/ReferenceAttachDetach.js @@ -7,93 +7,11 @@ function newReferenceAttachDetach () { return thisObject function referenceDetachNode (node) { - switch (node.type) { - case 'Backtesting Session': { - completeDetachment(node) - return - } - case 'Live Trading Session': { - completeDetachment(node) - return - } - case 'Fordward Testing Session': { - completeDetachment(node) - return - } - case 'Paper Trading Session': { - completeDetachment(node) - return - } - case 'Output Dataset': { - completeDetachment(node) - return - } - case 'Data Dependency': { - completeDetachment(node) - return - } - case 'Status Dependency': { - completeDetachment(node) - return - } - case 'Execution Started Event': { - completeDetachment(node) - return - } - case 'Process Instance': { - completeDetachment(node) - return - } - case 'Product Definition': { - completeDetachment(node) - return - } - } + completeDetachment(node) } function referenceAttachNode (node, attachToNode, rootNodes) { - switch (node.type) { - case 'Backtesting Session': { - completeAttachment(node, attachToNode) - } - break - case 'Live Trading Session': { - completeAttachment(node, attachToNode) - } - break - case 'Fordward Testing Session': { - completeAttachment(node, attachToNode) - } - break - case 'Paper Trading Session': { - completeAttachment(node, attachToNode) - } - break - case 'Output Dataset': { - completeAttachment(node, attachToNode) - } - break - case 'Data Dependency': { - completeAttachment(node, attachToNode) - } - break - case 'Status Dependency': { - completeAttachment(node, attachToNode) - } - break - case 'Execution Started Event': { - completeAttachment(node, attachToNode) - } - break - case 'Process Instance': { - completeAttachment(node, attachToNode) - } - break - case 'Product Definition': { - completeAttachment(node, attachToNode) - } - break - } + completeAttachment(node, attachToNode) } function completeAttachment (node, attachToNode) { From 50c0268c134fbd3649f377b9fe79b683493a3f3a Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 10 Dec 2019 17:28:07 +0100 Subject: [PATCH 13/72] Reference Parents and Children Implemented at APP SCHEMA --- .../ReferenceAttachDetach.js | 3 ++ .../FunctionLibraries/UiObjectsFromNodes.js | 51 +++++++++++++++++++ FloatingSpace/UiObject.js | 18 +++++-- 3 files changed, 68 insertions(+), 4 deletions(-) diff --git a/DesignerSpace/Workspace/FunctionLibraries/ReferenceAttachDetach.js b/DesignerSpace/Workspace/FunctionLibraries/ReferenceAttachDetach.js index f3ffe978a..f0f6dc9df 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/ReferenceAttachDetach.js +++ b/DesignerSpace/Workspace/FunctionLibraries/ReferenceAttachDetach.js @@ -16,6 +16,9 @@ function newReferenceAttachDetach () { function completeAttachment (node, attachToNode) { node.payload.referenceParent = attachToNode + if (attachToNode.referenceChildren === undefined) { + attachToNode.referenceChildren = [] + } attachToNode.referenceChildren.push(node) } diff --git a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js index 619e7a51c..3d403db29 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js +++ b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js @@ -1082,8 +1082,34 @@ function newUiObjectsFromNodes () { return } default: { + /* Get node definition */ let nodeDefinition = APP_SCHEMA_MAP.get(node.type) if (nodeDefinition !== undefined) { + /* Open Check for reference Children. */ + let referenceChildren + if (nodeDefinition.isReferenceParent === true) { + if (mapOfReferenceParents !== undefined) { + if (node.savedPayload.referenceChildren !== undefined) { + referenceChildren = [] + mapOfReferenceParents.set(node.id, node) + referenceChildren = node.savedPayload.referenceChildren + } + } + } + + /* Open Check Reference Parent */ + let referenceParent + if (nodeDefinition.isReferenceChildren === true) { + if (mapOfReferenceChildren !== undefined) { + if (node.savedPayload.referenceParent !== undefined) { + if (node.savedPayload.referenceParent.id !== undefined) { + mapOfReferenceChildren.set(node.id, node) + referenceParent = node.savedPayload.referenceParent + } + } + } + } + /* Resolve Initial Values */ if (nodeDefinition.initialValues !== undefined) { if (nodeDefinition.initialValues.code !== undefined) { @@ -1118,7 +1144,31 @@ function newUiObjectsFromNodes () { } } } + + /* Close Reference Children Check. */ + if (nodeDefinition.isReferenceParent === true) { + if (node.referenceChildren === undefined) { + node.referenceChildren = [] + } + if (referenceChildren !== undefined) { + node.savedPayload = { + referenceChildren: referenceChildren + } + } else { + node.referenceChildren = [] + } + } + + /* Close Reference Parent Check */ + if (nodeDefinition.isReferenceChildren === true) { + if (referenceParent !== undefined) { + node.savedPayload = { + referenceParent: referenceParent + } + } + } } + return } } @@ -1129,6 +1179,7 @@ function newUiObjectsFromNodes () { name: 'New ' + type, type: type } + createUiObject(true, object.type, object.name, object, parent, parent) let parentNodeDefinition = APP_SCHEMA_MAP.get(parent.type) diff --git a/FloatingSpace/UiObject.js b/FloatingSpace/UiObject.js index b3b9bb9c3..8ab62c54f 100644 --- a/FloatingSpace/UiObject.js +++ b/FloatingSpace/UiObject.js @@ -557,9 +557,9 @@ function newUiObject () { default: let nodeDefinition = APP_SCHEMA_MAP.get(thisObject.payload.node.type) if (nodeDefinition !== undefined) { - if (nodeDefinition.attachesTo !== undefined) { - compatibleTypes = nodeDefinition.attachesTo.compatibleTypes - compatibleSubTypes = nodeDefinition.attachesTo.compatibleSubTypes + if (nodeDefinition.chainAttachesTo !== undefined) { + compatibleTypes = nodeDefinition.chainAttachesTo.compatibleTypes + compatibleSubTypes = nodeDefinition.chainAttachesTo.compatibleSubTypes } else { return } @@ -799,7 +799,17 @@ function newUiObject () { compatibleSubTypes = undefined break default: - return + let nodeDefinition = APP_SCHEMA_MAP.get(thisObject.payload.node.type) + if (nodeDefinition !== undefined) { + if (nodeDefinition.referenceAttachesTo !== undefined) { + compatibleTypes = nodeDefinition.referenceAttachesTo.compatibleTypes + compatibleSubTypes = nodeDefinition.referenceAttachesTo.compatibleSubTypes + } else { + return + } + } else { + return + } } let foundCompatible = false referenceAttachToNode = undefined From 6365dd172bd2f4b021ccf369abd79ecf5889ddcb Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 10 Dec 2019 20:36:56 +0100 Subject: [PATCH 14/72] new icons --- Spaces/DesignerSpace.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Spaces/DesignerSpace.js b/Spaces/DesignerSpace.js index e56e8f57b..6a33ede08 100644 --- a/Spaces/DesignerSpace.js +++ b/Spaces/DesignerSpace.js @@ -237,7 +237,16 @@ function newDesignerSpace () { 'process-output', 'social-bot', 'execution-started-event', - 'shapes' + 'shapes', + 'chart-point', + 'style', + 'chart-points', + 'shapes-polygon-vertex', + 'shapes-polygon-border', + 'shapes-polygon-body', + 'chart-point-formula', + 'style-condition', + 'shapes-polygon' ] for (let i = 0; i < iconsNames.length; i++) { From 9d58659d1c77d12b08ed36f0f8dc50212b42f2a3 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 11 Dec 2019 10:23:24 +0100 Subject: [PATCH 15/72] First Iteration, plotter without coding implemented --- .../FunctionLibraries/ProtocolNode.js | 19 +- Panels/ProductsPanel.js | 3 - Plotter.js | 163 +++++++++++++++--- 3 files changed, 160 insertions(+), 25 deletions(-) diff --git a/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js b/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js index f4c34bdb5..b6376fe97 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js +++ b/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js @@ -1,4 +1,9 @@ function newProtocolNode () { + const MODULE_NAME = 'Protocol Node' + const ERROR_LOG = true + const logger = newWebDebugLog() + logger.fileName = MODULE_NAME + thisObject = { getProtocolNode: getProtocolNode } @@ -1730,8 +1735,18 @@ function newProtocolNode () { object.parentNode = getProtocolNode(node.payload.parentNode, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) } - if (parseCode) { - object.code = JSON.parse(node.code) + if (parseCode && object.code !== undefined && nodeDefinition.editors !== undefined) { + if (nodeDefinition.editors.config === true) { + try { + object.code = JSON.parse(node.code) + } catch (err) { + if (ERROR_LOG === true) { logger.write('[ERROR] getProtocolNode -> default -> err = ' + err.stack) } + if (ERROR_LOG === true) { logger.write('[ERROR] getProtocolNode -> default -> node.type = ' + node.type) } + if (ERROR_LOG === true) { logger.write('[ERROR] getProtocolNode -> default -> node.name = ' + node.name) } + if (ERROR_LOG === true) { logger.write('[ERROR] getProtocolNode -> default -> node.code = ' + node.code) } + if (ERROR_LOG === true) { logger.write('[ERROR] getProtocolNode -> default -> node.id = ' + node.id) } + } + } } if (includeIds) { diff --git a/Panels/ProductsPanel.js b/Panels/ProductsPanel.js index 042560c73..4f52059ed 100644 --- a/Panels/ProductsPanel.js +++ b/Panels/ProductsPanel.js @@ -159,9 +159,6 @@ function newProductsPanel () { continue } - if (plotterModuleNode.javascriptCode === undefined) { continue } - if (plotterModuleNode.javascriptCode.code === undefined) { continue } - /* Conversion to fit old format */ product.plotter = plotter product.plotter.devTeam = plotterTeam.codeName diff --git a/Plotter.js b/Plotter.js index de33a8f26..0367024b5 100644 --- a/Plotter.js +++ b/Plotter.js @@ -75,7 +75,7 @@ function newPlotter () { marketFile = undefined fileCursor = undefined } catch (err) { - if (ERROR_LOG === true) { logger.write('[ERROR] finalize -> err = ' + err.stack) } + if (ERROR_LOG === true) { logger.write('[ERROR] finalize -> err = ' + err.stack.stack) } } } @@ -115,7 +115,7 @@ function newPlotter () { callBackFunction() } catch (err) { - if (ERROR_LOG === true) { logger.write('[ERROR] initialize -> err = ' + err) } + if (ERROR_LOG === true) { logger.write('[ERROR] initialize -> err = ' + err.stack) } callBackFunction(GLOBAL.DEFAULT_FAIL_RESPONSE) } } @@ -128,7 +128,7 @@ function newPlotter () { recalculate() } } catch (err) { - if (ERROR_LOG === true) { logger.write('[ERROR] onMarketFilesUpdated -> err = ' + err.stack) } + if (ERROR_LOG === true) { logger.write('[ERROR] onMarketFilesUpdated -> err = ' + err.stack.stack) } } } @@ -140,7 +140,7 @@ function newPlotter () { recalculate() } } catch (err) { - if (ERROR_LOG === true) { logger.write('[ERROR] onDailyFilesUpdated -> err = ' + err.stack) } + if (ERROR_LOG === true) { logger.write('[ERROR] onDailyFilesUpdated -> err = ' + err.stack.stack) } } } @@ -155,7 +155,7 @@ function newPlotter () { return undefined } } catch (err) { - if (ERROR_LOG === true) { logger.write('[ERROR] getContainer -> err = ' + err) } + if (ERROR_LOG === true) { logger.write('[ERROR] getContainer -> err = ' + err.stack) } } } @@ -181,7 +181,7 @@ function newPlotter () { } } } catch (err) { - if (ERROR_LOG === true) { logger.write('[ERROR] setTimePeriod -> err = ' + err) } + if (ERROR_LOG === true) { logger.write('[ERROR] setTimePeriod -> err = ' + err.stack) } } } @@ -196,7 +196,7 @@ function newPlotter () { recalculate() } } catch (err) { - if (ERROR_LOG === true) { logger.write('[ERROR] onDailyFileLoaded -> err = ' + err) } + if (ERROR_LOG === true) { logger.write('[ERROR] onDailyFileLoaded -> err = ' + err.stack) } } } @@ -205,7 +205,7 @@ function newPlotter () { this.container.frame.draw() plotChart() } catch (err) { - if (ERROR_LOG === true) { logger.write('[ERROR] draw -> err = ' + err) } + if (ERROR_LOG === true) { logger.write('[ERROR] draw -> err = ' + err.stack) } } } @@ -218,7 +218,7 @@ function newPlotter () { } thisObject.container.eventHandler.raiseEvent('CandleStairs Changed', records) // --> Check This } catch (err) { - if (ERROR_LOG === true) { logger.write('[ERROR] recalculate -> err = ' + err) } + if (ERROR_LOG === true) { logger.write('[ERROR] recalculate -> err = ' + err.stack) } } } @@ -274,7 +274,7 @@ function newPlotter () { try { eval(calculationsProcedure.initialization.javascriptCode.code) } catch (err) { - logger.write('[ERROR] calculationsProcedure -> initialization -> Error executing User Code. Error = ' + err.stack) + logger.write('[ERROR] calculationsProcedure -> initialization -> Error executing User Code. Error = ' + err.stack.stack) logger.write('[ERROR] calculationsProcedure -> initialization -> Error executing User Code. Code = ' + calculationsProcedure.initialization.javascriptCode.code) throw ('Error Executing User Code.') } @@ -291,7 +291,7 @@ function newPlotter () { try { eval(calculationsProcedure.loop.javascriptCode.code) } catch (err) { - logger.write('[ERROR] calculationsProcedure -> loop -> Error executing User Code. Error = ' + err.stack) + logger.write('[ERROR] calculationsProcedure -> loop -> Error executing User Code. Error = ' + err.stack.stack) logger.write('[ERROR] calculationsProcedure -> loop -> Error executing User Code. product = ' + JSON.stringify(product)) logger.write('[ERROR] calculationsProcedure -> loop -> Error executing User Code. Code = ' + calculationsProcedure.loop.javascriptCode.code) throw ('Error Executing User Code.') @@ -308,7 +308,7 @@ function newPlotter () { let currentRecord = product currentRecord[property.code.codeName] = newValue } catch (err) { - logger.write('[ERROR] calculationsProcedure -> loop -> formula -> Error executing User Code. Error = ' + err.stack) + logger.write('[ERROR] calculationsProcedure -> loop -> formula -> Error executing User Code. Error = ' + err.stack.stack) logger.write('[ERROR] calculationsProcedure -> loop -> formula -> Error executing User Code. product = ' + JSON.stringify(product)) logger.write('[ERROR] calculationsProcedure -> loop -> formula -> Error executing User Code. Code = ' + property.formula.code) throw ('Error Executing User Code.') @@ -376,7 +376,7 @@ function newPlotter () { } } } catch (err) { - if (ERROR_LOG === true) { logger.write('[ERROR] recalculateUsingDailyFiles -> err = ' + err) } + if (ERROR_LOG === true) { logger.write('[ERROR] recalculateUsingDailyFiles -> err = ' + err.stack) } } } @@ -407,7 +407,7 @@ function newPlotter () { records.push(...jsonData)// This adds records to the current array. } } catch (err) { - if (ERROR_LOG === true) { logger.write('[ERROR] recalculateUsingMarketFiles -> err = ' + err) } + if (ERROR_LOG === true) { logger.write('[ERROR] recalculateUsingMarketFiles -> err = ' + err.stack) } } } @@ -432,7 +432,7 @@ function newPlotter () { thisObject.container.frame.height ) } catch (err) { - if (ERROR_LOG === true) { logger.write('[ERROR] recalculateScale -> err = ' + err) } + if (ERROR_LOG === true) { logger.write('[ERROR] recalculateScale -> err = ' + err.stack) } } } @@ -480,10 +480,133 @@ function newPlotter () { thisObject.container.eventHandler.raiseEvent('Current Record Changed', currentRecord) } - eval(productDefinition.referenceParent.javascriptCode.code) + /* If there is code we execute it now. */ + if (productDefinition.referenceParent.javascriptCode !== undefined) { + eval(productDefinition.referenceParent.javascriptCode.code) + } + + if (productDefinition.referenceParent.shapes === undefined) { continue } + if (productDefinition.referenceParent.shapes.chartPoints === undefined) { continue } + + let dataPoints = new Map() + + for (let j = 0; j < productDefinition.referenceParent.shapes.chartPoints.points.length; j++) { + let point = productDefinition.referenceParent.shapes.chartPoints.points[j] + if (point.pointFormula !== undefined) { + let x = 0 + let y = 0 + eval(point.pointFormula.code) + let dataPoint = { + x: x, + y: y + } + + /* + The information we store in files is independent from the charing system and its coordinate systems. + That means that the first thing we allways need to do is to trasform these points to the coordinate system of the timeline. + */ + dataPoint = timeLineCoordinateSystem.transformThisPoint(dataPoint) + + /* + The browser canvas object does not care about our timeline and its coordinate system. In order to draw on a html canvas we + need the points to be converted into the canvas coordinate system. + Next we transform again to the screen coordinate system. + */ + dataPoint = transformThisPoint(dataPoint, thisObject.container) + + /* We make sure the points do not fall outside the viewport visible area. This step allways need to be done. */ + dataPoint = viewPort.fitIntoVisibleArea(dataPoint) + + /* Store the data point at the local map */ + dataPoints.set(point.id, dataPoint) + } + } + + for (let j = 0; j < productDefinition.referenceParent.shapes.polygons.length; j++) { + let polygon = productDefinition.referenceParent.shapes.polygons[j] + + /* Finding out the fill style */ + let fillStyle = { // default values + opacity: 1, + paletteColor: UI_COLOR.BLACK + } + if (polygon.polygonBody !== undefined) { + if (polygon.polygonBody.style !== undefined) { + let bodyStyle = polygon.polygonBody.style.code + if (bodyStyle.opacity !== undefined) { fillStyle.opacity = bodyStyle.opacity } + if (bodyStyle.paletteColor !== undefined) { fillStyle.paletteColor = eval(bodyStyle.paletteColor) } + } + for (let k = 0; k < polygon.polygonBody.styleConditions.length; k++) { + let condition = polygon.polygonBody.styleConditions[k] + let value = eval(condition.code) + if (value === true) { + if (condition.style !== undefined) { + let bodyStyle = condition.style.code + if (bodyStyle.opacity !== undefined) { fillStyle.opacity = bodyStyle.opacity } + if (bodyStyle.paletteColor !== undefined) { fillStyle.paletteColor = eval(bodyStyle.paletteColor) } + } + } + } + } + + /* Finding out the stroke style */ + let strokeStyle = { // default values + opacity: 1, + paletteColor: UI_COLOR.BLACK, + lineWidth: 1, + lineDash: [0, 0] + } + if (polygon.polygonBorder !== undefined) { + if (polygon.polygonBorder.style !== undefined) { + let borderStyle = polygon.polygonBorder.style.code + if (borderStyle.opacity !== undefined) { strokeStyle.opacity = borderStyle.opacity } + if (borderStyle.paletteColor !== undefined) { strokeStyle.paletteColor = eval(borderStyle.paletteColor) } + if (borderStyle.lineWidth !== undefined) { strokeStyle.lineWidth = borderStyle.lineWidth } + if (borderStyle.lineDash !== undefined) { strokeStyle.lineDash = borderStyle.lineDash } + } + for (let k = 0; k < polygon.polygonBorder.styleConditions.length; k++) { + let condition = polygon.polygonBorder.styleConditions[k] + let value = eval(condition.code) + if (value === true) { + if (condition.style !== undefined) { + let borderStyle = condition.style.code + if (borderStyle.opacity !== undefined) { strokeStyle.opacity = borderStyle.opacity } + if (borderStyle.paletteColor !== undefined) { strokeStyle.paletteColor = eval(borderStyle.paletteColor) } + if (borderStyle.lineWidth !== undefined) { strokeStyle.lineWidth = borderStyle.lineWidth } + if (borderStyle.lineDash !== undefined) { strokeStyle.lineDash = borderStyle.lineDash } + } + } + } + } + + /* Draw the Polygon */ + browserCanvasContext.beginPath() + for (let k = 0; k < polygon.polygonVertexes.length; k++) { + let polygonVertex = polygon.polygonVertexes[k] + if (polygonVertex.referenceParent !== undefined) { + let dataPoint = dataPoints.get(polygonVertex.referenceParent.id) + if (k === 0) { + browserCanvasContext.moveTo(dataPoint.x, dataPoint.y) + } else { + browserCanvasContext.lineTo(dataPoint.x, dataPoint.y) + } + } + } + browserCanvasContext.closePath() + + /* Apply the fill style to the canvas object */ + browserCanvasContext.fillStyle = 'rgba(' + fillStyle.paletteColor + ', ' + fillStyle.opacity + ')' + browserCanvasContext.fill() + + /* Apply the stroke style to the canvas object */ + browserCanvasContext.lineWidth = strokeStyle.lineWidth + browserCanvasContext.setLineDash(strokeStyle.lineDash) + browserCanvasContext.strokeStyle = 'rgba(' + strokeStyle.paletteColor + ', ' + strokeStyle.opacity + ')' + browserCanvasContext.stroke() + } } } catch (err) { - if (ERROR_LOG === true) { logger.write('[ERROR] plotChart -> err = ' + err) } + if (ERROR_LOG === true) { logger.write('[ERROR] plotChart -> err = ' + err.stack) } } } @@ -491,7 +614,7 @@ function newPlotter () { try { recalculate() } catch (err) { - if (ERROR_LOG === true) { logger.write('[ERROR] onZoomChanged -> err = ' + err) } + if (ERROR_LOG === true) { logger.write('[ERROR] onZoomChanged -> err = ' + err.stack) } } } @@ -499,7 +622,7 @@ function newPlotter () { try { recalculate() } catch (err) { - if (ERROR_LOG === true) { logger.write('[ERROR] onDragFinished -> err = ' + err) } + if (ERROR_LOG === true) { logger.write('[ERROR] onDragFinished -> err = ' + err.stack) } } } @@ -515,7 +638,7 @@ function newPlotter () { recalculate() }; } catch (err) { - if (ERROR_LOG === true) { logger.write('[ERROR] onOffsetChanged -> err = ' + err) } + if (ERROR_LOG === true) { logger.write('[ERROR] onOffsetChanged -> err = ' + err.stack) } } } } From 77525a14b366e001806f0dc13b67b8b2fa3423e9 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 11 Dec 2019 13:10:04 +0100 Subject: [PATCH 16/72] shortcuts and onfocus ignoring collapsed branches --- .../FunctionLibraries/NodeDeleter.js | 4 ++ .../Workspace/FunctionLibraries/OnFocus.js | 44 +++++++++---------- .../FunctionLibraries/ShortcutKeys.js | 42 +++++++++--------- DesignerSpace/Workspace/Workspace.js | 2 - 4 files changed, 48 insertions(+), 44 deletions(-) diff --git a/DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js b/DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js index 5ce654fde..2a96e6ce5 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js +++ b/DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js @@ -998,6 +998,10 @@ function newNodeDeleter () { deleteJavascriptCode(node.javascriptCode, rootNodes) } + if (node.shapes !== undefined) { + deleteUIObject(node.shapes, rootNodes) + } + if (node.panels !== undefined) { while (node.panels.length > 0) { deletePlotterPanel(node.panels[0], rootNodes) diff --git a/DesignerSpace/Workspace/FunctionLibraries/OnFocus.js b/DesignerSpace/Workspace/FunctionLibraries/OnFocus.js index 902c89d31..2f7de9a10 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/OnFocus.js +++ b/DesignerSpace/Workspace/FunctionLibraries/OnFocus.js @@ -11,8 +11,6 @@ function newOnFocus () { { if (node.payload.uiObject.isOnFocus === true) { return node - } else { - return } } case 'Condition': @@ -1098,33 +1096,35 @@ function newOnFocus () { } /* Then we check all of its own children nodes. */ - if (nodeDefinition.properties !== undefined) { - for (let i = 0; i < nodeDefinition.properties.length; i++) { - let property = nodeDefinition.properties[i] + if (node.payload.floatingObject.isCollapsed !== true) { + if (nodeDefinition.properties !== undefined) { + for (let i = 0; i < nodeDefinition.properties.length; i++) { + let property = nodeDefinition.properties[i] - switch (property.type) { - case 'node': { - if (node[property.name] !== undefined) { - let child - child = getNodeThatIsOnFocus(node[property.name]) - if (child !== undefined) { - return child - } - } - } - break - case 'array': { - let nodePropertyArray = node[property.name] - if (nodePropertyArray !== undefined) { - for (let m = 0; m < nodePropertyArray.length; m++) { - child = getNodeThatIsOnFocus(nodePropertyArray[m]) + switch (property.type) { + case 'node': { + if (node[property.name] !== undefined) { + let child + child = getNodeThatIsOnFocus(node[property.name]) if (child !== undefined) { return child } } } + break + case 'array': { + let nodePropertyArray = node[property.name] + if (nodePropertyArray !== undefined) { + for (let m = 0; m < nodePropertyArray.length; m++) { + child = getNodeThatIsOnFocus(nodePropertyArray[m]) + if (child !== undefined) { + return child + } + } + } + } + break } - break } } } diff --git a/DesignerSpace/Workspace/FunctionLibraries/ShortcutKeys.js b/DesignerSpace/Workspace/FunctionLibraries/ShortcutKeys.js index 891e81e9b..11baf45b9 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/ShortcutKeys.js +++ b/DesignerSpace/Workspace/FunctionLibraries/ShortcutKeys.js @@ -1076,33 +1076,35 @@ function newShortcutKeys () { } /* Check all of its own children nodes. */ - if (nodeDefinition.properties !== undefined) { - for (let i = 0; i < nodeDefinition.properties.length; i++) { - let property = nodeDefinition.properties[i] + if (node.payload.floatingObject.isCollapsed !== true) { + if (nodeDefinition.properties !== undefined) { + for (let i = 0; i < nodeDefinition.properties.length; i++) { + let property = nodeDefinition.properties[i] - switch (property.type) { - case 'node': { - if (node[property.name] !== undefined) { - let child - child = getNodeByShortcutKey(node[property.name], searchingKey) - if (child !== undefined) { - return child - } - } - } - break - case 'array': { - let nodePropertyArray = node[property.name] - if (nodePropertyArray !== undefined) { - for (let m = 0; m < nodePropertyArray.length; m++) { - child = getNodeByShortcutKey(nodePropertyArray[m], searchingKey) + switch (property.type) { + case 'node': { + if (node[property.name] !== undefined) { + let child + child = getNodeByShortcutKey(node[property.name], searchingKey) if (child !== undefined) { return child } } } + break + case 'array': { + let nodePropertyArray = node[property.name] + if (nodePropertyArray !== undefined) { + for (let m = 0; m < nodePropertyArray.length; m++) { + child = getNodeByShortcutKey(nodePropertyArray[m], searchingKey) + if (child !== undefined) { + return child + } + } + } + } + break } - break } } } diff --git a/DesignerSpace/Workspace/Workspace.js b/DesignerSpace/Workspace/Workspace.js index f904cd6ee..aef9f4bc8 100644 --- a/DesignerSpace/Workspace/Workspace.js +++ b/DesignerSpace/Workspace/Workspace.js @@ -179,7 +179,6 @@ function newWorkspace () { function getNodeByShortcutKey (searchingKey) { for (let i = 0; i < thisObject.workspaceNode.rootNodes.length; i++) { let rootNode = thisObject.workspaceNode.rootNodes[i] - let definition = rootNode let node = functionLibraryShortcutKeys.getNodeByShortcutKey(rootNode, searchingKey) if (node !== undefined) { return node } } @@ -188,7 +187,6 @@ function newWorkspace () { function getNodeThatIsOnFocus () { for (let i = 0; i < thisObject.workspaceNode.rootNodes.length; i++) { let rootNode = thisObject.workspaceNode.rootNodes[i] - let definition = rootNode let node = functionLibraryOnFocus.getNodeThatIsOnFocus(rootNode) if (node !== undefined) { return node } } From 41294a8cc2c1e05a6c17d96cf49a5bfa9253bb45 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 11 Dec 2019 13:44:50 +0100 Subject: [PATCH 17/72] Bug fixed with on focus and shorcut --- DesignerSpace/Workspace/FunctionLibraries/OnFocus.js | 10 +++++----- .../Workspace/FunctionLibraries/ShortcutKeys.js | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/DesignerSpace/Workspace/FunctionLibraries/OnFocus.js b/DesignerSpace/Workspace/FunctionLibraries/OnFocus.js index 2f7de9a10..d9581b2f3 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/OnFocus.js +++ b/DesignerSpace/Workspace/FunctionLibraries/OnFocus.js @@ -16,7 +16,7 @@ function newOnFocus () { case 'Condition': { let child - child = getNodeThatIsOnFocus(node.code) + child = getNodeThatIsOnFocus(node.javascriptCode) if (child !== undefined) { return child } @@ -937,7 +937,7 @@ function newOnFocus () { } case 'Procedure Initialization': { let child - child = getNodeThatIsOnFocus(node.code) + child = getNodeThatIsOnFocus(node.javascriptCode) if (child !== undefined) { return child } @@ -949,7 +949,7 @@ function newOnFocus () { } case 'Procedure Loop': { let child - child = getNodeThatIsOnFocus(node.code) + child = getNodeThatIsOnFocus(node.javascriptCode) if (child !== undefined) { return child } @@ -1055,7 +1055,7 @@ function newOnFocus () { } case 'Plotter Module': { let child - child = getNodeThatIsOnFocus(node.code) + child = getNodeThatIsOnFocus(node.javascriptCode) if (child !== undefined) { return child } @@ -1077,7 +1077,7 @@ function newOnFocus () { } case 'Plotter Panel': { let child - child = getNodeThatIsOnFocus(node.code) + child = getNodeThatIsOnFocus(node.javascriptCode) if (child !== undefined) { return child } diff --git a/DesignerSpace/Workspace/FunctionLibraries/ShortcutKeys.js b/DesignerSpace/Workspace/FunctionLibraries/ShortcutKeys.js index 11baf45b9..8fba3e417 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/ShortcutKeys.js +++ b/DesignerSpace/Workspace/FunctionLibraries/ShortcutKeys.js @@ -18,7 +18,7 @@ function newShortcutKeys () { case 'Condition': { let child - child = getNodeByShortcutKey(node.code, searchingKey) + child = getNodeByShortcutKey(node.javascriptCode, searchingKey) if (child !== undefined) { return child } @@ -916,7 +916,7 @@ function newShortcutKeys () { } case 'Procedure Initialization': { let child - child = getNodeByShortcutKey(node.code, searchingKey) + child = getNodeByShortcutKey(node.javascriptCode, searchingKey) if (child !== undefined) { return child } @@ -928,7 +928,7 @@ function newShortcutKeys () { } case 'Procedure Loop': { let child - child = getNodeByShortcutKey(node.code, searchingKey) + child = getNodeByShortcutKey(node.javascriptCode, searchingKey) if (child !== undefined) { return child } @@ -1034,7 +1034,7 @@ function newShortcutKeys () { } case 'Plotter Module': { let child - child = getNodeByShortcutKey(node.code, searchingKey) + child = getNodeByShortcutKey(node.javascriptCode, searchingKey) if (child !== undefined) { return child } @@ -1056,7 +1056,7 @@ function newShortcutKeys () { } case 'Plotter Panel': { let child - child = getNodeByShortcutKey(node.code, searchingKey) + child = getNodeByShortcutKey(node.javascriptCode, searchingKey) if (child !== undefined) { return child } From f9f722ed5228def0db900d134b22609b8594355d Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 11 Dec 2019 15:10:51 +0100 Subject: [PATCH 18/72] No keys from within editors --- Canvas.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Canvas.js b/Canvas.js index 113cd3047..9c9a83214 100644 --- a/Canvas.js +++ b/Canvas.js @@ -195,6 +195,21 @@ function newCanvas () { return } } + if (nodeOnFocus.payload.uiObject.configEditor !== undefined) { + if (nodeOnFocus.payload.uiObject.configEditor.visible === true) { + return + } + } + if (nodeOnFocus.payload.uiObject.formulaEditor !== undefined) { + if (nodeOnFocus.payload.uiObject.formulaEditor.visible === true) { + return + } + } + if (nodeOnFocus.payload.uiObject.conditionEditor !== undefined) { + if (nodeOnFocus.payload.uiObject.conditionEditor.visible === true) { + return + } + } if (nodeOnFocus.payload.uiObject.uiObjectTitle !== undefined) { if (nodeOnFocus.payload.uiObject.uiObjectTitle.editMode === true) { return From f30df7af0d1a152f81b2505dc2a7761fa8899b7d Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 11 Dec 2019 17:13:46 +0100 Subject: [PATCH 19/72] record.previous --- Plotter.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Plotter.js b/Plotter.js index 0367024b5..db6018153 100644 --- a/Plotter.js +++ b/Plotter.js @@ -450,6 +450,12 @@ function newPlotter () { for (let i = 0; i < records.length; i++) { let record = records[i] + if (i == 0) { + record.previous = record + } else { + record.previous = records[i - 1] + } + let beginPoint = { x: record.begin, y: 0 @@ -604,6 +610,10 @@ function newPlotter () { browserCanvasContext.strokeStyle = 'rgba(' + strokeStyle.paletteColor + ', ' + strokeStyle.opacity + ')' browserCanvasContext.stroke() } + + /* Some cleaning */ + record.previous = undefined + record = undefined } } catch (err) { if (ERROR_LOG === true) { logger.write('[ERROR] plotChart -> err = ' + err.stack) } From ba5578d10bfe1f3216edcf618cbb068043e8901b Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 11 Dec 2019 18:03:29 +0100 Subject: [PATCH 20/72] Bug Fixed --- Panels/ProductCard.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Panels/ProductCard.js b/Panels/ProductCard.js index 49eba7250..a9c5b6d4f 100644 --- a/Panels/ProductCard.js +++ b/Panels/ProductCard.js @@ -151,7 +151,10 @@ function newProductCard () { /* Add information that will later be needed. */ let team = ecosystem.getTeam(thisObject.product.plotter.devTeam) - let plotter = ecosystem.getPlotter(team, thisObject.product.plotter.codeName) + let plotter + if (team !== undefined) { + plotter = ecosystem.getPlotter(team, thisObject.product.plotter.codeName) + } if (plotter !== undefined) { let plotterModule = ecosystem.getPlotterModule(plotter, thisObject.product.plotter.moduleName) From 862913952208fcdc836ea4469864e38ce57874ac Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 11 Dec 2019 18:52:38 +0100 Subject: [PATCH 21/72] Bug fix with children of Plotter Module --- DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js b/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js index b6376fe97..41ef0611b 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js +++ b/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js @@ -1626,10 +1626,13 @@ function newProtocolNode () { subType: node.subType, name: node.name, code: node.code, - javascriptCode: getProtocolNode(node.javascriptCode, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType), - shapes: getProtocolNode(node.shapes, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType), panels: [] } + if (excludeChildren !== true) { + object.javascriptCode = getProtocolNode(node.javascriptCode, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) + object.shapes = getProtocolNode(node.shapes, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) + } + if (includeParent) { followAncestors = true excludeChildren = true From f7dc87e9185ec5f163940cba55ad025c9903da7c Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 12 Dec 2019 08:02:30 +0100 Subject: [PATCH 22/72] tension physics adjustment --- FloatingSpace/FloatingObject.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FloatingSpace/FloatingObject.js b/FloatingSpace/FloatingObject.js index 70d4bc0f1..4dacd262a 100644 --- a/FloatingSpace/FloatingObject.js +++ b/FloatingSpace/FloatingObject.js @@ -245,7 +245,7 @@ function newFloatingObject () { thisObject.payload.angle = thisObject.payload.angle - 360 } - if (distanceToChainParent > 1000) { return } // this is introduced to avoid edges cases when importing workspaces. + if (distanceToChainParent > 2000) { return } // this is introduced to avoid edges cases when importing workspaces. newPosition = { x: parent.payload.position.x + distanceToChainParent * Math.cos(toRadians(thisObject.payload.angle)), From ad7228d3fd3581bcfd55b5ab4ad6924106225384 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 12 Dec 2019 11:15:08 +0100 Subject: [PATCH 23/72] Plotting to slots implemented --- ChartsSpace/TimeMachine.js | 14 ++- .../FunctionLibraries/NodeDeleter.js | 2 +- Plotter.js | 94 +++++++++++++------ ProductStorage.js | 2 + 4 files changed, 76 insertions(+), 36 deletions(-) diff --git a/ChartsSpace/TimeMachine.js b/ChartsSpace/TimeMachine.js index 8b35c71fe..13add3ae8 100644 --- a/ChartsSpace/TimeMachine.js +++ b/ChartsSpace/TimeMachine.js @@ -64,10 +64,16 @@ function newTimeMachine () { } thisObject.charts = [] - thisObject.timeScale.finalize() - thisObject.timeScale = undefined - thisObject.rateScale.finalize() - thisObject.rateScale = undefined + + if (thisObject.timeScale !== undefined) { + thisObject.timeScale.finalize() + thisObject.timeScale = undefined + } + if (thisObject.rateScale !== undefined) { + thisObject.rateScale.finalize() + thisObject.rateScale = undefined + } + thisObject.fitFunction = undefined thisObject.container.finalize() diff --git a/DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js b/DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js index 2a96e6ce5..1aed7ed81 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js +++ b/DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js @@ -379,7 +379,7 @@ function newNodeDeleter () { } default: { - console.log('WARNING this node type is not listed at NodeDeleter: ' + rootNode.type) + deleteUIObject(rootNode, rootNodes) } } } diff --git a/Plotter.js b/Plotter.js index db6018153..71bcf34c6 100644 --- a/Plotter.js +++ b/Plotter.js @@ -31,7 +31,10 @@ function newPlotter () { container.initialize() thisObject.container = container - let timeLineCoordinateSystem = newTimeLineCoordinateSystem() // Needed to be able to plot on the timeline, otherwise not. + let timeLineCoordinateSystem = newTimeLineCoordinateSystem() // Needed to be able to plot on the timeline. + let slotCoordinateSystem // Needed to be able to plot on a slot over the timeline. + let plotterModuleConfig + let slotHeight = (viewPort.visibleArea.bottomRight.y - viewPort.visibleArea.topLeft.y) / 5 // This is the amount of slots available let timePeriod // This will hold the current Time Period the user is at. let datetime // This will hold the current Datetime the user is at. @@ -415,6 +418,7 @@ function newPlotter () { try { if (timeLineCoordinateSystem.maxValue > 0) { return } // Already calculated. + /* First we calculate the default scale */ let minValue = { x: MIN_PLOTABLE_DATE.valueOf(), y: 0 @@ -431,6 +435,23 @@ function newPlotter () { thisObject.container.frame.width, thisObject.container.frame.height ) + + /* In case the plotter is configured to a certain slot, we calculate the slot coordinate system too. */ + if (productDefinition.referenceParent.code === undefined) { return } + plotterModuleConfig = JSON.parse(productDefinition.referenceParent.code) + if (plotterModuleConfig.slot === undefined) { return } + + slotCoordinateSystem = newTimeLineCoordinateSystem() + + minValue.y = plotterModuleConfig.slot.minValue + maxValue.y = plotterModuleConfig.slot.maxValue + + slotCoordinateSystem.initialize( + minValue, + maxValue, + thisObject.container.frame.width, + slotHeight + ) } catch (err) { if (ERROR_LOG === true) { logger.write('[ERROR] recalculateScale -> err = ' + err.stack) } } @@ -451,9 +472,9 @@ function newPlotter () { let record = records[i] if (i == 0) { - record.previous = record + record.previous = JSON.parse(JSON.stringify(record)) } else { - record.previous = records[i - 1] + record.previous = JSON.parse(JSON.stringify(records[i - 1])) } let beginPoint = { @@ -525,6 +546,13 @@ function newPlotter () { /* Store the data point at the local map */ dataPoints.set(point.id, dataPoint) + + if (plotterModuleConfig !== undefined) { + if (plotterModuleConfig.slot !== undefined) { + /* We reset the y coordinate since it will be transformed with another coordinate system to fit into a slot. */ + dataPoint.y = (-1) * y * slotCoordinateSystem.scale.y + (plotterModuleConfig.slot.number - 1) * slotHeight + } + } } } @@ -542,14 +570,16 @@ function newPlotter () { if (bodyStyle.opacity !== undefined) { fillStyle.opacity = bodyStyle.opacity } if (bodyStyle.paletteColor !== undefined) { fillStyle.paletteColor = eval(bodyStyle.paletteColor) } } - for (let k = 0; k < polygon.polygonBody.styleConditions.length; k++) { - let condition = polygon.polygonBody.styleConditions[k] - let value = eval(condition.code) - if (value === true) { - if (condition.style !== undefined) { - let bodyStyle = condition.style.code - if (bodyStyle.opacity !== undefined) { fillStyle.opacity = bodyStyle.opacity } - if (bodyStyle.paletteColor !== undefined) { fillStyle.paletteColor = eval(bodyStyle.paletteColor) } + if (polygon.polygonBody.styleConditions !== undefined) { + for (let k = 0; k < polygon.polygonBody.styleConditions.length; k++) { + let condition = polygon.polygonBody.styleConditions[k] + let value = eval(condition.code) + if (value === true) { + if (condition.style !== undefined) { + let bodyStyle = condition.style.code + if (bodyStyle.opacity !== undefined) { fillStyle.opacity = bodyStyle.opacity } + if (bodyStyle.paletteColor !== undefined) { fillStyle.paletteColor = eval(bodyStyle.paletteColor) } + } } } } @@ -570,16 +600,18 @@ function newPlotter () { if (borderStyle.lineWidth !== undefined) { strokeStyle.lineWidth = borderStyle.lineWidth } if (borderStyle.lineDash !== undefined) { strokeStyle.lineDash = borderStyle.lineDash } } - for (let k = 0; k < polygon.polygonBorder.styleConditions.length; k++) { - let condition = polygon.polygonBorder.styleConditions[k] - let value = eval(condition.code) - if (value === true) { - if (condition.style !== undefined) { - let borderStyle = condition.style.code - if (borderStyle.opacity !== undefined) { strokeStyle.opacity = borderStyle.opacity } - if (borderStyle.paletteColor !== undefined) { strokeStyle.paletteColor = eval(borderStyle.paletteColor) } - if (borderStyle.lineWidth !== undefined) { strokeStyle.lineWidth = borderStyle.lineWidth } - if (borderStyle.lineDash !== undefined) { strokeStyle.lineDash = borderStyle.lineDash } + if (polygon.polygonBorder.styleConditions !== undefined) { + for (let k = 0; k < polygon.polygonBorder.styleConditions.length; k++) { + let condition = polygon.polygonBorder.styleConditions[k] + let value = eval(condition.code) + if (value === true) { + if (condition.style !== undefined) { + let borderStyle = condition.style.code + if (borderStyle.opacity !== undefined) { strokeStyle.opacity = borderStyle.opacity } + if (borderStyle.paletteColor !== undefined) { strokeStyle.paletteColor = eval(borderStyle.paletteColor) } + if (borderStyle.lineWidth !== undefined) { strokeStyle.lineWidth = borderStyle.lineWidth } + if (borderStyle.lineDash !== undefined) { strokeStyle.lineDash = borderStyle.lineDash } + } } } } @@ -601,19 +633,19 @@ function newPlotter () { browserCanvasContext.closePath() /* Apply the fill style to the canvas object */ - browserCanvasContext.fillStyle = 'rgba(' + fillStyle.paletteColor + ', ' + fillStyle.opacity + ')' - browserCanvasContext.fill() + if (polygon.polygonBody !== undefined) { + browserCanvasContext.fillStyle = 'rgba(' + fillStyle.paletteColor + ', ' + fillStyle.opacity + ')' + browserCanvasContext.fill() + } /* Apply the stroke style to the canvas object */ - browserCanvasContext.lineWidth = strokeStyle.lineWidth - browserCanvasContext.setLineDash(strokeStyle.lineDash) - browserCanvasContext.strokeStyle = 'rgba(' + strokeStyle.paletteColor + ', ' + strokeStyle.opacity + ')' - browserCanvasContext.stroke() + if (polygon.polygonBorder !== undefined) { + browserCanvasContext.lineWidth = strokeStyle.lineWidth + browserCanvasContext.setLineDash(strokeStyle.lineDash) + browserCanvasContext.strokeStyle = 'rgba(' + strokeStyle.paletteColor + ', ' + strokeStyle.opacity + ')' + browserCanvasContext.stroke() + } } - - /* Some cleaning */ - record.previous = undefined - record = undefined } } catch (err) { if (ERROR_LOG === true) { logger.write('[ERROR] plotChart -> err = ' + err.stack) } diff --git a/ProductStorage.js b/ProductStorage.js index 8cd70d1b7..bdb862032 100644 --- a/ProductStorage.js +++ b/ProductStorage.js @@ -121,6 +121,8 @@ function newProductStorage (pName) { thisObject.fileSequences.push(fileSequences) } break + default: + if (ERROR_LOG === true) { logger.write('[WARN] initialize -> initialize -> dataset with no type defined. Data can not be retrieved. -> codeName = ' + thisSet.codeName) } } function onMarketFileReady (err, pCaller) { From 111749f2f13ca7838246daef8c27c0c1f6bc0133 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 12 Dec 2019 11:40:11 +0100 Subject: [PATCH 24/72] Recalculating Datapoints only when really needed --- Plotter.js | 50 ++++++++++++++++++++++++++++++++------------------ 1 file changed, 32 insertions(+), 18 deletions(-) diff --git a/Plotter.js b/Plotter.js index 71bcf34c6..1569dc143 100644 --- a/Plotter.js +++ b/Plotter.js @@ -35,6 +35,7 @@ function newPlotter () { let slotCoordinateSystem // Needed to be able to plot on a slot over the timeline. let plotterModuleConfig let slotHeight = (viewPort.visibleArea.bottomRight.y - viewPort.visibleArea.topLeft.y) / 5 // This is the amount of slots available + let mustRecalculateDataPoints = false let timePeriod // This will hold the current Time Period the user is at. let datetime // This will hold the current Datetime the user is at. @@ -214,6 +215,7 @@ function newPlotter () { function recalculate () { try { + console.log('Recalculating...') if (timePeriod >= _1_HOUR_IN_MILISECONDS) { recalculateUsingMarketFiles() } else { @@ -516,44 +518,53 @@ function newPlotter () { if (productDefinition.referenceParent.shapes.chartPoints === undefined) { continue } let dataPoints = new Map() - - for (let j = 0; j < productDefinition.referenceParent.shapes.chartPoints.points.length; j++) { - let point = productDefinition.referenceParent.shapes.chartPoints.points[j] - if (point.pointFormula !== undefined) { - let x = 0 - let y = 0 - eval(point.pointFormula.code) - let dataPoint = { - x: x, - y: y - } + if (record.dataPoints !== undefined && mustRecalculateDataPoints === false) { + /* We use the datapoints already calculated. */ + dataPoints = record.dataPoints + } else { + console.log('Recalculating Data Points...') + /* Only calculate the datapoints for this record, if we have not calculate it before. */ + for (let j = 0; j < productDefinition.referenceParent.shapes.chartPoints.points.length; j++) { + let point = productDefinition.referenceParent.shapes.chartPoints.points[j] + if (point.pointFormula !== undefined) { + let x = 0 + let y = 0 + eval(point.pointFormula.code) + let dataPoint = { + x: x, + y: y + } /* The information we store in files is independent from the charing system and its coordinate systems. That means that the first thing we allways need to do is to trasform these points to the coordinate system of the timeline. */ - dataPoint = timeLineCoordinateSystem.transformThisPoint(dataPoint) + dataPoint = timeLineCoordinateSystem.transformThisPoint(dataPoint) /* The browser canvas object does not care about our timeline and its coordinate system. In order to draw on a html canvas we need the points to be converted into the canvas coordinate system. Next we transform again to the screen coordinate system. */ - dataPoint = transformThisPoint(dataPoint, thisObject.container) + dataPoint = transformThisPoint(dataPoint, thisObject.container) /* We make sure the points do not fall outside the viewport visible area. This step allways need to be done. */ - dataPoint = viewPort.fitIntoVisibleArea(dataPoint) + dataPoint = viewPort.fitIntoVisibleArea(dataPoint) /* Store the data point at the local map */ - dataPoints.set(point.id, dataPoint) + dataPoints.set(point.id, dataPoint) - if (plotterModuleConfig !== undefined) { - if (plotterModuleConfig.slot !== undefined) { + if (plotterModuleConfig !== undefined) { + if (plotterModuleConfig.slot !== undefined) { /* We reset the y coordinate since it will be transformed with another coordinate system to fit into a slot. */ - dataPoint.y = (-1) * y * slotCoordinateSystem.scale.y + (plotterModuleConfig.slot.number - 1) * slotHeight + dataPoint.y = (-1) * y * slotCoordinateSystem.scale.y + (plotterModuleConfig.slot.number - 1) * slotHeight + } } } } + + /* Remember this datapoints, so that we do not need to calculate them again. */ + record.dataPoints = dataPoints } for (let j = 0; j < productDefinition.referenceParent.shapes.polygons.length; j++) { @@ -647,6 +658,8 @@ function newPlotter () { } } } + + mustRecalculateDataPoints = false } catch (err) { if (ERROR_LOG === true) { logger.write('[ERROR] plotChart -> err = ' + err.stack) } } @@ -670,6 +683,7 @@ function newPlotter () { function onOffsetChanged (event) { try { + mustRecalculateDataPoints = true if (event !== undefined) { if (event.recalculate === true) { recalculate() From 4b3b49855c75a15559c942f92ee693512cdfd9e2 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 12 Dec 2019 13:23:28 +0100 Subject: [PATCH 25/72] not recalculating styles when not needed --- Plotter.js | 95 ++++++++++++++++++++++++++++++++---------------------- 1 file changed, 57 insertions(+), 38 deletions(-) diff --git a/Plotter.js b/Plotter.js index 1569dc143..4905e5e46 100644 --- a/Plotter.js +++ b/Plotter.js @@ -215,7 +215,6 @@ function newPlotter () { function recalculate () { try { - console.log('Recalculating...') if (timePeriod >= _1_HOUR_IN_MILISECONDS) { recalculateUsingMarketFiles() } else { @@ -474,9 +473,9 @@ function newPlotter () { let record = records[i] if (i == 0) { - record.previous = JSON.parse(JSON.stringify(record)) + record.previous = record } else { - record.previous = JSON.parse(JSON.stringify(records[i - 1])) + record.previous = records[i - 1] } let beginPoint = { @@ -522,7 +521,6 @@ function newPlotter () { /* We use the datapoints already calculated. */ dataPoints = record.dataPoints } else { - console.log('Recalculating Data Points...') /* Only calculate the datapoints for this record, if we have not calculate it before. */ for (let j = 0; j < productDefinition.referenceParent.shapes.chartPoints.points.length; j++) { let point = productDefinition.referenceParent.shapes.chartPoints.points[j] @@ -569,31 +567,42 @@ function newPlotter () { for (let j = 0; j < productDefinition.referenceParent.shapes.polygons.length; j++) { let polygon = productDefinition.referenceParent.shapes.polygons[j] + let calculatedStyle /* Finding out the fill style */ let fillStyle = { // default values opacity: 1, paletteColor: UI_COLOR.BLACK } - if (polygon.polygonBody !== undefined) { - if (polygon.polygonBody.style !== undefined) { - let bodyStyle = polygon.polygonBody.style.code - if (bodyStyle.opacity !== undefined) { fillStyle.opacity = bodyStyle.opacity } - if (bodyStyle.paletteColor !== undefined) { fillStyle.paletteColor = eval(bodyStyle.paletteColor) } - } - if (polygon.polygonBody.styleConditions !== undefined) { - for (let k = 0; k < polygon.polygonBody.styleConditions.length; k++) { - let condition = polygon.polygonBody.styleConditions[k] - let value = eval(condition.code) - if (value === true) { - if (condition.style !== undefined) { - let bodyStyle = condition.style.code - if (bodyStyle.opacity !== undefined) { fillStyle.opacity = bodyStyle.opacity } - if (bodyStyle.paletteColor !== undefined) { fillStyle.paletteColor = eval(bodyStyle.paletteColor) } + if (record.fillStyle === undefined) { + record.fillStyle = new Map() + } + calculatedStyle = record.fillStyle.get(polygon.id) + if (calculatedStyle !== undefined) { + /* We use the already calculated style */ + fillStyle = calculatedStyle + } else { + if (polygon.polygonBody !== undefined) { + if (polygon.polygonBody.style !== undefined) { + let bodyStyle = polygon.polygonBody.style.code + if (bodyStyle.opacity !== undefined) { fillStyle.opacity = bodyStyle.opacity } + if (bodyStyle.paletteColor !== undefined) { fillStyle.paletteColor = eval(bodyStyle.paletteColor) } + } + if (polygon.polygonBody.styleConditions !== undefined) { + for (let k = 0; k < polygon.polygonBody.styleConditions.length; k++) { + let condition = polygon.polygonBody.styleConditions[k] + let value = eval(condition.code) + if (value === true) { + if (condition.style !== undefined) { + let bodyStyle = condition.style.code + if (bodyStyle.opacity !== undefined) { fillStyle.opacity = bodyStyle.opacity } + if (bodyStyle.paletteColor !== undefined) { fillStyle.paletteColor = eval(bodyStyle.paletteColor) } + } } } } } + record.fillStyle.set(polygon.id, fillStyle) } /* Finding out the stroke style */ @@ -603,29 +612,39 @@ function newPlotter () { lineWidth: 1, lineDash: [0, 0] } - if (polygon.polygonBorder !== undefined) { - if (polygon.polygonBorder.style !== undefined) { - let borderStyle = polygon.polygonBorder.style.code - if (borderStyle.opacity !== undefined) { strokeStyle.opacity = borderStyle.opacity } - if (borderStyle.paletteColor !== undefined) { strokeStyle.paletteColor = eval(borderStyle.paletteColor) } - if (borderStyle.lineWidth !== undefined) { strokeStyle.lineWidth = borderStyle.lineWidth } - if (borderStyle.lineDash !== undefined) { strokeStyle.lineDash = borderStyle.lineDash } - } - if (polygon.polygonBorder.styleConditions !== undefined) { - for (let k = 0; k < polygon.polygonBorder.styleConditions.length; k++) { - let condition = polygon.polygonBorder.styleConditions[k] - let value = eval(condition.code) - if (value === true) { - if (condition.style !== undefined) { - let borderStyle = condition.style.code - if (borderStyle.opacity !== undefined) { strokeStyle.opacity = borderStyle.opacity } - if (borderStyle.paletteColor !== undefined) { strokeStyle.paletteColor = eval(borderStyle.paletteColor) } - if (borderStyle.lineWidth !== undefined) { strokeStyle.lineWidth = borderStyle.lineWidth } - if (borderStyle.lineDash !== undefined) { strokeStyle.lineDash = borderStyle.lineDash } + if (record.strokeStyle === undefined) { + record.strokeStyle = new Map() + } + calculatedStyle = record.strokeStyle.get(polygon.id) + if (calculatedStyle !== undefined) { + /* We use the already calculated style */ + strokeStyle = calculatedStyle + } else { + if (polygon.polygonBorder !== undefined) { + if (polygon.polygonBorder.style !== undefined) { + let borderStyle = polygon.polygonBorder.style.code + if (borderStyle.opacity !== undefined) { strokeStyle.opacity = borderStyle.opacity } + if (borderStyle.paletteColor !== undefined) { strokeStyle.paletteColor = eval(borderStyle.paletteColor) } + if (borderStyle.lineWidth !== undefined) { strokeStyle.lineWidth = borderStyle.lineWidth } + if (borderStyle.lineDash !== undefined) { strokeStyle.lineDash = borderStyle.lineDash } + } + if (polygon.polygonBorder.styleConditions !== undefined) { + for (let k = 0; k < polygon.polygonBorder.styleConditions.length; k++) { + let condition = polygon.polygonBorder.styleConditions[k] + let value = eval(condition.code) + if (value === true) { + if (condition.style !== undefined) { + let borderStyle = condition.style.code + if (borderStyle.opacity !== undefined) { strokeStyle.opacity = borderStyle.opacity } + if (borderStyle.paletteColor !== undefined) { strokeStyle.paletteColor = eval(borderStyle.paletteColor) } + if (borderStyle.lineWidth !== undefined) { strokeStyle.lineWidth = borderStyle.lineWidth } + if (borderStyle.lineDash !== undefined) { strokeStyle.lineDash = borderStyle.lineDash } + } } } } } + record.strokeStyle.set(polygon.id, strokeStyle) } /* Draw the Polygon */ From f37da4dcca5641edaa045a25a2617cc4089b9576 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 12 Dec 2019 15:50:51 +0100 Subject: [PATCH 26/72] Performance Optimizations on Plotting --- Plotter.js | 114 +++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 88 insertions(+), 26 deletions(-) diff --git a/Plotter.js b/Plotter.js index 4905e5e46..58390e36e 100644 --- a/Plotter.js +++ b/Plotter.js @@ -36,6 +36,8 @@ function newPlotter () { let plotterModuleConfig let slotHeight = (viewPort.visibleArea.bottomRight.y - viewPort.visibleArea.topLeft.y) / 5 // This is the amount of slots available let mustRecalculateDataPoints = false + let atMousePositionFillStyles = new Map() + let atMousePositionStrokeStyles = new Map() let timePeriod // This will hold the current Time Period the user is at. let datetime // This will hold the current Datetime the user is at. @@ -78,6 +80,14 @@ function newPlotter () { marketFile = undefined fileCursor = undefined + + timeLineCoordinateSystem = undefined + slotCoordinateSystem = undefined + plotterModuleConfig = undefined + slotHeight = undefined + mustRecalculateDataPoints = undefined + atMousePositionFillStyles = undefined + atMousePositionStrokeStyles = undefined } catch (err) { if (ERROR_LOG === true) { logger.write('[ERROR] finalize -> err = ' + err.stack.stack) } } @@ -574,20 +584,26 @@ function newPlotter () { opacity: 1, paletteColor: UI_COLOR.BLACK } - if (record.fillStyle === undefined) { - record.fillStyle = new Map() - } - calculatedStyle = record.fillStyle.get(polygon.id) - if (calculatedStyle !== undefined) { + if (polygon.polygonBody !== undefined) { + if (record.fillStyle === undefined) { + record.fillStyle = new Map() + } + calculatedStyle = record.fillStyle.get(polygon.id) + if (calculatedStyle !== undefined) { /* We use the already calculated style */ - fillStyle = calculatedStyle - } else { - if (polygon.polygonBody !== undefined) { + fillStyle = calculatedStyle + } else { + /* Get the default style if exists */ if (polygon.polygonBody.style !== undefined) { - let bodyStyle = polygon.polygonBody.style.code - if (bodyStyle.opacity !== undefined) { fillStyle.opacity = bodyStyle.opacity } - if (bodyStyle.paletteColor !== undefined) { fillStyle.paletteColor = eval(bodyStyle.paletteColor) } + if (polygon.polygonBody.style.code !== undefined) { + if (polygon.polygonBody.style.code.default !== undefined) { + let bodyStyle = polygon.polygonBody.style.code.default + if (bodyStyle.opacity !== undefined) { fillStyle.opacity = bodyStyle.opacity } + if (bodyStyle.paletteColor !== undefined) { fillStyle.paletteColor = eval(bodyStyle.paletteColor) } + } + } } + /* Apply conditional styles */ if (polygon.polygonBody.styleConditions !== undefined) { for (let k = 0; k < polygon.polygonBody.styleConditions.length; k++) { let condition = polygon.polygonBody.styleConditions[k] @@ -601,8 +617,19 @@ function newPlotter () { } } } + /* Get the atMousePosition style if exists */ + if (polygon.polygonBody.style !== undefined) { + if (polygon.polygonBody.style.code.atMousePosition !== undefined) { + let atMousePositionStyleDefinition = polygon.polygonBody.style.code.atMousePosition + let atMousePositionStyle = {} + if (atMousePositionStyleDefinition.opacity !== undefined) { atMousePositionStyle.opacity = atMousePositionStyleDefinition.opacity } + if (atMousePositionStyleDefinition.paletteColor !== undefined) { atMousePositionStyle.paletteColor = eval(atMousePositionStyleDefinition.paletteColor) } + atMousePositionFillStyles.set(polygon.id, atMousePositionStyle) + } + } + + record.fillStyle.set(polygon.id, fillStyle) } - record.fillStyle.set(polygon.id, fillStyle) } /* Finding out the stroke style */ @@ -612,22 +639,28 @@ function newPlotter () { lineWidth: 1, lineDash: [0, 0] } - if (record.strokeStyle === undefined) { - record.strokeStyle = new Map() - } - calculatedStyle = record.strokeStyle.get(polygon.id) - if (calculatedStyle !== undefined) { + if (polygon.polygonBorder !== undefined) { + if (record.strokeStyle === undefined) { + record.strokeStyle = new Map() + } + calculatedStyle = record.strokeStyle.get(polygon.id) + if (calculatedStyle !== undefined) { /* We use the already calculated style */ - strokeStyle = calculatedStyle - } else { - if (polygon.polygonBorder !== undefined) { + strokeStyle = calculatedStyle + } else { + /* Get the default style if exists */ if (polygon.polygonBorder.style !== undefined) { - let borderStyle = polygon.polygonBorder.style.code - if (borderStyle.opacity !== undefined) { strokeStyle.opacity = borderStyle.opacity } - if (borderStyle.paletteColor !== undefined) { strokeStyle.paletteColor = eval(borderStyle.paletteColor) } - if (borderStyle.lineWidth !== undefined) { strokeStyle.lineWidth = borderStyle.lineWidth } - if (borderStyle.lineDash !== undefined) { strokeStyle.lineDash = borderStyle.lineDash } + if (polygon.polygonBorder.style.code !== undefined) { + if (polygon.polygonBorder.style.code.default !== undefined) { + let borderStyle = polygon.polygonBorder.style.code.default + if (borderStyle.opacity !== undefined) { strokeStyle.opacity = borderStyle.opacity } + if (borderStyle.paletteColor !== undefined) { strokeStyle.paletteColor = eval(borderStyle.paletteColor) } + if (borderStyle.lineWidth !== undefined) { strokeStyle.lineWidth = borderStyle.lineWidth } + if (borderStyle.lineDash !== undefined) { strokeStyle.lineDash = borderStyle.lineDash } + } + } } + /* Apply conditional styles */ if (polygon.polygonBorder.styleConditions !== undefined) { for (let k = 0; k < polygon.polygonBorder.styleConditions.length; k++) { let condition = polygon.polygonBorder.styleConditions[k] @@ -643,8 +676,21 @@ function newPlotter () { } } } + /* Get the atMousePosition style if exists */ + if (polygon.polygonBorder.style !== undefined) { + if (polygon.polygonBorder.style.code.atMousePosition !== undefined) { + let atMousePositionStyleDefinition = polygon.polygonBorder.style.code.atMousePosition + let atMousePositionStyle = {} + if (atMousePositionStyleDefinition.opacity !== undefined) { atMousePositionStyle.opacity = atMousePositionStyleDefinition.opacity } + if (atMousePositionStyleDefinition.paletteColor !== undefined) { atMousePositionStyle.paletteColor = eval(atMousePositionStyleDefinition.paletteColor) } + if (atMousePositionStyleDefinition.lineWidth !== undefined) { atMousePositionStyle.lineWidth = atMousePositionStyleDefinition.lineWidth } + if (atMousePositionStyleDefinition.lineDash !== undefined) { atMousePositionStyle.lineDash = atMousePositionStyleDefinition.lineDash } + atMousePositionStrokeStyles.set(polygon.id, atMousePositionStyle) + } + } + + record.strokeStyle.set(polygon.id, strokeStyle) } - record.strokeStyle.set(polygon.id, strokeStyle) } /* Draw the Polygon */ @@ -664,12 +710,28 @@ function newPlotter () { /* Apply the fill style to the canvas object */ if (polygon.polygonBody !== undefined) { + /* Replace the fill style if we are at mouse position */ + if (atMousePosition === true) { + let atMousePositionFillStyle = atMousePositionFillStyles.get(polygon.id) + if (atMousePositionFillStyle !== undefined) { + fillStyle = atMousePositionFillStyle + } + } + browserCanvasContext.fillStyle = 'rgba(' + fillStyle.paletteColor + ', ' + fillStyle.opacity + ')' browserCanvasContext.fill() } /* Apply the stroke style to the canvas object */ if (polygon.polygonBorder !== undefined) { + /* Replace the stroke style if we are at mouse position */ + if (atMousePosition === true) { + let atMousePositionStrokeStyle = atMousePositionStrokeStyles.get(polygon.id) + if (atMousePositionStrokeStyle !== undefined) { + strokeStyle = atMousePositionStrokeStyle + } + } + browserCanvasContext.lineWidth = strokeStyle.lineWidth browserCanvasContext.setLineDash(strokeStyle.lineDash) browserCanvasContext.strokeStyle = 'rgba(' + strokeStyle.paletteColor + ', ' + strokeStyle.opacity + ')' From 616665376e56bb3f083b029255248f11ce5c34a1 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 12 Dec 2019 16:34:02 +0100 Subject: [PATCH 27/72] reference line adjusted --- FloatingSpace/UiObject.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/FloatingSpace/UiObject.js b/FloatingSpace/UiObject.js index 8ab62c54f..7dfe95f48 100644 --- a/FloatingSpace/UiObject.js +++ b/FloatingSpace/UiObject.js @@ -1202,8 +1202,8 @@ function newUiObject () { browserCanvasContext.moveTo(position.x, position.y) browserCanvasContext.lineTo(targetPoint.x, targetPoint.y) browserCanvasContext.strokeStyle = 'rgba(' + LINE_STYLE + ', 1)' - browserCanvasContext.setLineDash([3, 47]) - browserCanvasContext.lineWidth = 4 + browserCanvasContext.setLineDash([1, 9]) + browserCanvasContext.lineWidth = 0.75 browserCanvasContext.stroke() browserCanvasContext.setLineDash([0, 0]) @@ -1211,8 +1211,8 @@ function newUiObject () { 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.setLineDash([1, 9, 2, 8, 3, 7, 4, 6, 0, 500]) + browserCanvasContext.lineWidth = 4 browserCanvasContext.stroke() browserCanvasContext.setLineDash([0, 0]) } From 94f18d0f38ff610657a81b9b2da2864b0e8743be Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 12 Dec 2019 17:01:45 +0100 Subject: [PATCH 28/72] lines styles adjusted --- FloatingSpace/UiObject.js | 12 ++++++------ Panels/PlotterPanel.js | 11 ++++++----- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/FloatingSpace/UiObject.js b/FloatingSpace/UiObject.js index 7dfe95f48..a77f0d05b 100644 --- a/FloatingSpace/UiObject.js +++ b/FloatingSpace/UiObject.js @@ -1202,8 +1202,8 @@ function newUiObject () { browserCanvasContext.moveTo(position.x, position.y) browserCanvasContext.lineTo(targetPoint.x, targetPoint.y) browserCanvasContext.strokeStyle = 'rgba(' + LINE_STYLE + ', 1)' - browserCanvasContext.setLineDash([1, 9]) - browserCanvasContext.lineWidth = 0.75 + browserCanvasContext.setLineDash([3, 47]) + browserCanvasContext.lineWidth = 3 browserCanvasContext.stroke() browserCanvasContext.setLineDash([0, 0]) @@ -1211,8 +1211,8 @@ function newUiObject () { 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, 0, 500]) - browserCanvasContext.lineWidth = 4 + browserCanvasContext.setLineDash([1, 9]) + browserCanvasContext.lineWidth = 1 browserCanvasContext.stroke() browserCanvasContext.setLineDash([0, 0]) } @@ -1259,7 +1259,7 @@ function newUiObject () { browserCanvasContext.lineTo(targetPoint.x, targetPoint.y) browserCanvasContext.strokeStyle = 'rgba(' + LINE_STYLE + ', 1)' browserCanvasContext.setLineDash([1, 9]) - browserCanvasContext.lineWidth = 1 + browserCanvasContext.lineWidth = 0.75 browserCanvasContext.stroke() browserCanvasContext.setLineDash([0, 0]) @@ -1267,7 +1267,7 @@ function newUiObject () { 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.setLineDash([1, 9, 2, 8, 3, 7, 4, 6, 0, 500]) browserCanvasContext.lineWidth = 4 browserCanvasContext.stroke() browserCanvasContext.setLineDash([0, 0]) diff --git a/Panels/PlotterPanel.js b/Panels/PlotterPanel.js index 493c41a05..92c3834fa 100644 --- a/Panels/PlotterPanel.js +++ b/Panels/PlotterPanel.js @@ -86,11 +86,12 @@ function newPlotterPanel () { if (currentRecord === undefined) { return } if (currentRecord.data === undefined) { return } - - try { - eval(panelNode.javascriptCode.code) - } catch (err) { - if (ERROR_LOG === true) { logger.write('[ERROR] finalize -> err = ' + err.stack) } + if (panelNode.javascriptCode !== undefined) { + try { + eval(panelNode.javascriptCode.code) + } catch (err) { + if (ERROR_LOG === true) { logger.write('[ERROR] finalize -> err = ' + err.stack) } + } } function printLabel (labelToPrint, x, y, opacity) { From 20b9b3420f8e935d1a998085708175a270d9ee27 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 12 Dec 2019 17:17:12 +0100 Subject: [PATCH 29/72] Bug Fixed --- DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js index 3d403db29..5a30a8cd2 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js +++ b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js @@ -2179,7 +2179,7 @@ function newUiObjectsFromNodes () { node.javascriptCode = { code: DEFAULT_CODE_TEXT } - createUiObject(true, 'Javascript Code', '', node.code, node, node) + createUiObject(true, 'Javascript Code', '', node.javascriptCode, node, node) } return node.javascriptCode From 66f853a305ef20b462b22ae495b067b39f757148 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 12 Dec 2019 18:11:37 +0100 Subject: [PATCH 30/72] Multiples Chart Points (array) --- .../FunctionLibraries/ChainAttachDetach.js | 7 ++- Plotter.js | 61 ++++++++++--------- 2 files changed, 36 insertions(+), 32 deletions(-) diff --git a/DesignerSpace/Workspace/FunctionLibraries/ChainAttachDetach.js b/DesignerSpace/Workspace/FunctionLibraries/ChainAttachDetach.js index 19bb15465..557e44e1c 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/ChainAttachDetach.js +++ b/DesignerSpace/Workspace/FunctionLibraries/ChainAttachDetach.js @@ -1163,10 +1163,11 @@ function newChainAttachDetach () { } break case 'array': { - let nodePropertyArray = node.payload.parentNode[property.name] - if (nodePropertyArray !== undefined) { - nodePropertyArray.push(node) + if (node.payload.parentNode[property.name] === undefined) { + node.payload.parentNode[property.name] = [] } + let nodePropertyArray = node.payload.parentNode[property.name] + nodePropertyArray.push(node) } break } diff --git a/Plotter.js b/Plotter.js index 58390e36e..405ac7c84 100644 --- a/Plotter.js +++ b/Plotter.js @@ -532,40 +532,43 @@ function newPlotter () { dataPoints = record.dataPoints } else { /* Only calculate the datapoints for this record, if we have not calculate it before. */ - for (let j = 0; j < productDefinition.referenceParent.shapes.chartPoints.points.length; j++) { - let point = productDefinition.referenceParent.shapes.chartPoints.points[j] - if (point.pointFormula !== undefined) { - let x = 0 - let y = 0 - eval(point.pointFormula.code) - let dataPoint = { - x: x, - y: y - } + for (let k = 0; k < productDefinition.referenceParent.shapes.chartPoints.length; k++) { + let chartPoints = productDefinition.referenceParent.shapes.chartPoints[k] + for (let j = 0; j < chartPoints.points.length; j++) { + let point = chartPoints.points[j] + if (point.pointFormula !== undefined) { + let x = 0 + let y = 0 + eval(point.pointFormula.code) + let dataPoint = { + x: x, + y: y + } - /* - The information we store in files is independent from the charing system and its coordinate systems. - That means that the first thing we allways need to do is to trasform these points to the coordinate system of the timeline. - */ - dataPoint = timeLineCoordinateSystem.transformThisPoint(dataPoint) + /* + The information we store in files is independent from the charing system and its coordinate systems. + That means that the first thing we allways need to do is to trasform these points to the coordinate system of the timeline. + */ + dataPoint = timeLineCoordinateSystem.transformThisPoint(dataPoint) - /* - The browser canvas object does not care about our timeline and its coordinate system. In order to draw on a html canvas we - need the points to be converted into the canvas coordinate system. - Next we transform again to the screen coordinate system. - */ - dataPoint = transformThisPoint(dataPoint, thisObject.container) + /* + The browser canvas object does not care about our timeline and its coordinate system. In order to draw on a html canvas we + need the points to be converted into the canvas coordinate system. + Next we transform again to the screen coordinate system. + */ + dataPoint = transformThisPoint(dataPoint, thisObject.container) - /* We make sure the points do not fall outside the viewport visible area. This step allways need to be done. */ - dataPoint = viewPort.fitIntoVisibleArea(dataPoint) + /* We make sure the points do not fall outside the viewport visible area. This step allways need to be done. */ + dataPoint = viewPort.fitIntoVisibleArea(dataPoint) - /* Store the data point at the local map */ - dataPoints.set(point.id, dataPoint) + /* Store the data point at the local map */ + dataPoints.set(point.id, dataPoint) - if (plotterModuleConfig !== undefined) { - if (plotterModuleConfig.slot !== undefined) { - /* We reset the y coordinate since it will be transformed with another coordinate system to fit into a slot. */ - dataPoint.y = (-1) * y * slotCoordinateSystem.scale.y + (plotterModuleConfig.slot.number - 1) * slotHeight + if (plotterModuleConfig !== undefined) { + if (plotterModuleConfig.slot !== undefined) { + /* We reset the y coordinate since it will be transformed with another coordinate system to fit into a slot. */ + dataPoint.y = (-1) * y * slotCoordinateSystem.scale.y + (plotterModuleConfig.slot.number - 1) * slotHeight + } } } } From de56425e84c285e26cb3eff07b50cd188d53c89d Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 12 Dec 2019 18:30:53 +0100 Subject: [PATCH 31/72] Titles from SCHEMA --- FloatingSpace/UiObjectTitle.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/FloatingSpace/UiObjectTitle.js b/FloatingSpace/UiObjectTitle.js index 25143c9a2..f1f979ba7 100644 --- a/FloatingSpace/UiObjectTitle.js +++ b/FloatingSpace/UiObjectTitle.js @@ -47,6 +47,7 @@ function newUiObjectTitle () { function initialize (payload) { thisObject.payload = payload + thisObject.allwaysVisible = false // Default value switch (payload.node.type) { case 'Definition': { thisObject.allwaysVisible = true @@ -145,7 +146,12 @@ function newUiObjectTitle () { break } default: { - thisObject.allwaysVisible = false + let nodeDefinition = APP_SCHEMA_MAP.get(thisObject.payload.node.type) + if (nodeDefinition !== undefined) { + if (nodeDefinition.isTitleAllwaysVisible === true) { + thisObject.allwaysVisible = true + } + } } } From d3a5e409488fc29090e94fcf5f821a4fbcdea9ce Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 12 Dec 2019 21:10:41 +0100 Subject: [PATCH 32/72] Panels with no coding --- .../FunctionLibraries/ChainAttachDetach.js | 18 ------ .../FunctionLibraries/NodeChildren.js | 17 ------ .../FunctionLibraries/NodeDeleter.js | 28 +--------- .../Workspace/FunctionLibraries/OnFocus.js | 12 ---- .../FunctionLibraries/ProtocolNode.js | 15 ----- .../FunctionLibraries/ShortcutKeys.js | 12 ---- .../FunctionLibraries/UiObjectsFromNodes.js | 22 -------- DesignerSpace/Workspace/Workspace.js | 9 --- FloatingSpace/UiObject.js | 4 -- FloatingSpace/UiObjectConstructor.js | 55 +------------------ FloatingSpace/UiObjectTitle.js | 4 -- Spaces/DesignerSpace.js | 3 +- 12 files changed, 3 insertions(+), 196 deletions(-) diff --git a/DesignerSpace/Workspace/FunctionLibraries/ChainAttachDetach.js b/DesignerSpace/Workspace/FunctionLibraries/ChainAttachDetach.js index 557e44e1c..c945827e6 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/ChainAttachDetach.js +++ b/DesignerSpace/Workspace/FunctionLibraries/ChainAttachDetach.js @@ -199,17 +199,6 @@ function newChainAttachDetach () { 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++) { @@ -745,13 +734,6 @@ function newChainAttachDetach () { 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 case 'Network Node': { node.payload.parentNode = attachToNode node.payload.chainParent = attachToNode diff --git a/DesignerSpace/Workspace/FunctionLibraries/NodeChildren.js b/DesignerSpace/Workspace/FunctionLibraries/NodeChildren.js index fd2456a0e..e27991ae5 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/NodeChildren.js +++ b/DesignerSpace/Workspace/FunctionLibraries/NodeChildren.js @@ -83,9 +83,6 @@ function newNodeChildren () { case 'Plotter Module': { return countChildrenPlotterModule(parentNode, childNode) } - case 'Plotter Panel': { - return countChildrenPlotterPanel(parentNode, childNode) - } case 'Network Node': { return countChildrenNetworkNode(parentNode, childNode) } @@ -754,20 +751,6 @@ function newNodeChildren () { return response } - function countChildrenPlotterPanel (parentNode, childNode) { - let response = { - childrenCount: 0, - childIndex: undefined - } - if (parentNode.javascriptCode !== undefined) { - response.childrenCount++ - if (parentNode.javascriptCode.id === childNode.id) { - response.childIndex = response.childrenCount - } - } - return response - } - function countChildrenNetworkNode (parentNode, childNode) { let response = { childrenCount: 0, diff --git a/DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js b/DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js index 1aed7ed81..75c6363a5 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js +++ b/DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js @@ -26,7 +26,6 @@ function newNodeDeleter () { deleteDatasetDefinition: deleteDatasetDefinition, deletePlotter: deletePlotter, deletePlotterModule: deletePlotterModule, - deletePlotterPanel: deletePlotterPanel, deleteSocialBots: deleteSocialBots, deleteSocialBot: deleteSocialBot, deleteAnnouncement: deleteAnnouncement, @@ -189,10 +188,6 @@ function newNodeDeleter () { deletePlotterModule(rootNode, rootNodes) break } - case 'Plotter Panel': { - deletePlotterPanel(rootNode, rootNodes) - break - } case 'Social Bots': { deleteSocialBots(rootNode, rootNodes) break @@ -1004,7 +999,7 @@ function newNodeDeleter () { if (node.panels !== undefined) { while (node.panels.length > 0) { - deletePlotterPanel(node.panels[0], rootNodes) + deleteUIObject(node.panels[0], rootNodes) } } @@ -1013,27 +1008,6 @@ function newNodeDeleter () { 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.javascriptCode !== undefined) { - deleteJavascriptCode(node.javascriptCode, rootNodes) - } - - completeDeletion(node, rootNodes) - destroyUiObject(node) - cleanNode(node) - } - function deleteSocialBots (node, rootNodes) { let payload = node.payload if (payload.parentNode !== undefined) { diff --git a/DesignerSpace/Workspace/FunctionLibraries/OnFocus.js b/DesignerSpace/Workspace/FunctionLibraries/OnFocus.js index d9581b2f3..2773fef45 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/OnFocus.js +++ b/DesignerSpace/Workspace/FunctionLibraries/OnFocus.js @@ -1075,18 +1075,6 @@ function newOnFocus () { return } } - case 'Plotter Panel': { - let child - child = getNodeThatIsOnFocus(node.javascriptCode) - if (child !== undefined) { - return child - } - if (node.payload.uiObject.isOnFocus === true) { - return node - } else { - return - } - } default: { let nodeDefinition = APP_SCHEMA_MAP.get(node.type) if (nodeDefinition !== undefined) { diff --git a/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js b/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js index 41ef0611b..1f6c067be 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js +++ b/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js @@ -1654,21 +1654,6 @@ function newProtocolNode () { } return object } - case 'Plotter Panel': { - let object = { - type: node.type, - subType: node.subType, - name: node.name, - javascriptCode: getProtocolNode(node.javascriptCode, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) - } - if (includeIds) { - object.id = node.id - } - if (includePayload) { - object.savedPayload = getSavedPayload(node, includeReferences) - } - return object - } default: { let nodeDefinition = APP_SCHEMA_MAP.get(node.type) diff --git a/DesignerSpace/Workspace/FunctionLibraries/ShortcutKeys.js b/DesignerSpace/Workspace/FunctionLibraries/ShortcutKeys.js index 8fba3e417..532d19bbe 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/ShortcutKeys.js +++ b/DesignerSpace/Workspace/FunctionLibraries/ShortcutKeys.js @@ -1054,18 +1054,6 @@ function newShortcutKeys () { return } } - case 'Plotter Panel': { - let child - child = getNodeByShortcutKey(node.javascriptCode, searchingKey) - if (child !== undefined) { - return child - } - if (node.payload.uiObject.shortcutKey === searchingKey) { - return node - } else { - return - } - } default: { let nodeDefinition = APP_SCHEMA_MAP.get(node.type) diff --git a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js index 5a30a8cd2..350fd55d9 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js +++ b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js @@ -28,7 +28,6 @@ function newUiObjectsFromNodes () { addDatasetDefinition: addDatasetDefinition, addPlotter: addPlotter, addPlotterModule: addPlotterModule, - addPlotterPanel: addPlotterPanel, addDefinition: addDefinition, addNetwork: addNetwork, addNetworkNode: addNetworkNode, @@ -1073,14 +1072,7 @@ function newUiObjectsFromNodes () { } return } - case 'Plotter Panel': { - createUiObject(false, node.type, node.name, node, parentNode, chainParent, node.type, positionOffset) - if (node.javascriptCode !== undefined) { - createUiObjectFromNode(node.javascriptCode, node, node, positionOffset) - } - return - } default: { /* Get node definition */ let nodeDefinition = APP_SCHEMA_MAP.get(node.type) @@ -1556,20 +1548,6 @@ function newUiObjectsFromNodes () { 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(true, object.type, object.name, object, node, node) - - return object - } - function addNetwork (node) { let network = { name: 'Superalgos' diff --git a/DesignerSpace/Workspace/Workspace.js b/DesignerSpace/Workspace/Workspace.js index aef9f4bc8..72550bd0d 100644 --- a/DesignerSpace/Workspace/Workspace.js +++ b/DesignerSpace/Workspace/Workspace.js @@ -483,11 +483,6 @@ function newWorkspace () { functionLibraryUiObjectsFromNodes.addPlotterModule(payload.node) } break - case 'Add Plotter Panel': - { - functionLibraryUiObjectsFromNodes.addPlotterPanel(payload.node) - } - break case 'Add Network': { functionLibraryUiObjectsFromNodes.addNetwork(payload.node) @@ -765,10 +760,6 @@ function newWorkspace () { 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 diff --git a/FloatingSpace/UiObject.js b/FloatingSpace/UiObject.js index a77f0d05b..1d4596695 100644 --- a/FloatingSpace/UiObject.js +++ b/FloatingSpace/UiObject.js @@ -345,10 +345,6 @@ function newUiObject () { compatibleTypes = '->' + 'Plotter' + '->' compatibleSubTypes = undefined break - case 'Plotter Panel': - compatibleTypes = '->' + 'Plotter Module' + '->' - compatibleSubTypes = undefined - break case 'Trading System': compatibleTypes = '->' + 'Definition' + '->' compatibleSubTypes = undefined diff --git a/FloatingSpace/UiObjectConstructor.js b/FloatingSpace/UiObjectConstructor.js index 589d323f4..8dae08e62 100644 --- a/FloatingSpace/UiObjectConstructor.js +++ b/FloatingSpace/UiObjectConstructor.js @@ -1657,7 +1657,7 @@ function newUiObjectConstructor () { ) menuItemsInitialValues.push( { - action: 'Add Plotter Panel', + action: 'Add UI Object', actionFunction: payload.onMenuItemClick, label: 'Add Plotter Panel', visible: true, @@ -1700,55 +1700,6 @@ function newUiObjectConstructor () { ) break } - case 'Plotter Panel': { - addLeftIcons(menuItemsInitialValues, floatingObject) - menuItemsInitialValues.push( - { - action: 'Add Code', - disableIfPropertyIsDefined: true, - propertyToCheckFor: 'code', - actionFunction: payload.onMenuItemClick, - label: 'Add Code', - visible: true, - relatedUiObject: 'Javascript Code', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -30 - } - ) - 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: 30 - } - ) - break - } case 'Network': { addLeftIcons(menuItemsInitialValues, floatingObject) menuItemsInitialValues.push( @@ -4864,10 +4815,6 @@ function newUiObjectConstructor () { level_2() break } - case 'Plotter Panel': { - level_3() - break - } case 'Network': { level_1() break diff --git a/FloatingSpace/UiObjectTitle.js b/FloatingSpace/UiObjectTitle.js index f1f979ba7..ace5efac0 100644 --- a/FloatingSpace/UiObjectTitle.js +++ b/FloatingSpace/UiObjectTitle.js @@ -93,10 +93,6 @@ function newUiObjectTitle () { thisObject.allwaysVisible = true break } - case 'Plotter Panel': { - thisObject.allwaysVisible = true - break - } case 'Network': { thisObject.allwaysVisible = true break diff --git a/Spaces/DesignerSpace.js b/Spaces/DesignerSpace.js index 6a33ede08..b90060ad8 100644 --- a/Spaces/DesignerSpace.js +++ b/Spaces/DesignerSpace.js @@ -109,8 +109,7 @@ function newDesignerSpace () { ['Record Property', 'record-property'], ['Dataset Definition', 'dataset-definition'], ['Plotter', 'plotter'], - ['Plotter Module', 'plotter-module'], - ['Plotter Panel', 'plotter-panel'] + ['Plotter Module', 'plotter-module'] ] for (let i = 0; i < relationshipArray.length; i++) { From b9b4830b333d48df8dad4467aaf5d6ab1d8f2a5c Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Fri, 13 Dec 2019 07:47:55 +0100 Subject: [PATCH 33/72] small fixes --- DesignerSpace/Workspace/Workspace.js | 2 +- Panels/PlotterPanel.js | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/DesignerSpace/Workspace/Workspace.js b/DesignerSpace/Workspace/Workspace.js index 72550bd0d..c36212303 100644 --- a/DesignerSpace/Workspace/Workspace.js +++ b/DesignerSpace/Workspace/Workspace.js @@ -316,7 +316,7 @@ function newWorkspace () { if (nodeName === undefined) { nodeName = '' } else { - nodeName = '.' + nodeName + nodeName = ' ' + nodeName } let fileName = 'Backup - ' + payload.node.type + ' - ' + nodeName + '.json' download(fileName, text) diff --git a/Panels/PlotterPanel.js b/Panels/PlotterPanel.js index 92c3834fa..e014bc4f1 100644 --- a/Panels/PlotterPanel.js +++ b/Panels/PlotterPanel.js @@ -86,6 +86,10 @@ function newPlotterPanel () { if (currentRecord === undefined) { return } if (currentRecord.data === undefined) { return } + + let record = currentRecord.data + + /* First we execute code if provided. */ if (panelNode.javascriptCode !== undefined) { try { eval(panelNode.javascriptCode.code) @@ -94,6 +98,8 @@ function newPlotterPanel () { } } + /* Second we go through the panel labels. */ + function printLabel (labelToPrint, x, y, opacity) { let labelPoint let fontSize = 10 From 418c574b289ea5721f009a1df823500818227181 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Fri, 13 Dec 2019 10:45:37 +0100 Subject: [PATCH 34/72] Panels without coding --- Panels/PlotterPanel.js | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/Panels/PlotterPanel.js b/Panels/PlotterPanel.js index e014bc4f1..1a54b7299 100644 --- a/Panels/PlotterPanel.js +++ b/Panels/PlotterPanel.js @@ -94,11 +94,33 @@ function newPlotterPanel () { try { eval(panelNode.javascriptCode.code) } catch (err) { - if (ERROR_LOG === true) { logger.write('[ERROR] finalize -> err = ' + err.stack) } + if (ERROR_LOG === true) { logger.write('[ERROR] plotCurrentRecordData -> err = ' + err.stack) } + if (ERROR_LOG === true) { logger.write('[ERROR] plotCurrentRecordData -> javascriptCode.code = ' + panelNode.javascriptCode.code) } } } - /* Second we go through the panel labels. */ + /* Second we go through the panel data. */ + for (let i = 0; i < panelNode.panelData.length; i++) { + let panelData = panelNode.panelData[i] + + let value = 'No value defined' + + if (panelData.dataFormula !== undefined) { + try { + value = eval(panelData.dataFormula.code) + } catch (err) { + if (ERROR_LOG === true) { logger.write('[ERROR] plotCurrentRecordData -> err = ' + err.stack) } + if (ERROR_LOG === true) { logger.write('[ERROR] plotCurrentRecordData -> dataFormula.code = ' + panelNode.dataFormula.code) } + } + } + + if (panelData.code.valueDecimals !== undefined) { + value = value.toFixed(panelData.code.valueDecimals) + } + + printLabel(panelData.code.labelText, X_AXIS, PANEL_HEIGHT * panelData.code.labelPosition / 100, '1') + printLabel(value, X_AXIS, PANEL_HEIGHT * panelData.code.valuePosition / 100, '0.50') + } function printLabel (labelToPrint, x, y, opacity) { let labelPoint @@ -126,4 +148,3 @@ function newPlotterPanel () { browserCanvasContext.fill() } } - From 4c6e2775f24df93461b262ea3f9c8fe77fcb931d Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Fri, 13 Dec 2019 11:04:16 +0100 Subject: [PATCH 35/72] more slots --- Plotter.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plotter.js b/Plotter.js index 405ac7c84..de9c938a0 100644 --- a/Plotter.js +++ b/Plotter.js @@ -34,7 +34,7 @@ function newPlotter () { let timeLineCoordinateSystem = newTimeLineCoordinateSystem() // Needed to be able to plot on the timeline. let slotCoordinateSystem // Needed to be able to plot on a slot over the timeline. let plotterModuleConfig - let slotHeight = (viewPort.visibleArea.bottomRight.y - viewPort.visibleArea.topLeft.y) / 5 // This is the amount of slots available + let slotHeight = (viewPort.visibleArea.bottomRight.y - viewPort.visibleArea.topLeft.y) / 10 // This is the amount of slots available let mustRecalculateDataPoints = false let atMousePositionFillStyles = new Map() let atMousePositionStrokeStyles = new Map() From 52d1127b93c61021137ac35465fca8f95b859dd0 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Fri, 13 Dec 2019 15:51:43 +0100 Subject: [PATCH 36/72] References can be deleted and automatically restablished --- .../FunctionLibraries/NodeDeleter.js | 21 -- .../Workspace/FunctionLibraries/OnFocus.js | 1 + .../FunctionLibraries/ProtocolNode.js | 29 +- .../ReferenceAttachDetach.js | 11 - .../FunctionLibraries/UiObjectsFromNodes.js | 351 ++---------------- DesignerSpace/Workspace/Workspace.js | 43 +-- FloatingSpace/UiObjectConstructor.js | 6 +- 7 files changed, 62 insertions(+), 400 deletions(-) diff --git a/DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js b/DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js index 75c6363a5..c5765dc79 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js +++ b/DesignerSpace/Workspace/FunctionLibraries/NodeDeleter.js @@ -445,14 +445,6 @@ function newNodeDeleter () { } } - /* Remove from Reference Children. */ - if (node.referenceChildren !== undefined) { - 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) @@ -468,10 +460,6 @@ function newNodeDeleter () { 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) @@ -1216,15 +1204,6 @@ 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) diff --git a/DesignerSpace/Workspace/FunctionLibraries/OnFocus.js b/DesignerSpace/Workspace/FunctionLibraries/OnFocus.js index 2773fef45..481e3983b 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/OnFocus.js +++ b/DesignerSpace/Workspace/FunctionLibraries/OnFocus.js @@ -1076,6 +1076,7 @@ function newOnFocus () { } } default: { + if (node.payload === undefined) { return } let nodeDefinition = APP_SCHEMA_MAP.get(node.type) if (nodeDefinition !== undefined) { /* First we ask the question to ourself */ diff --git a/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js b/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js index 1f6c067be..facc97d35 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js +++ b/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js @@ -1637,6 +1637,8 @@ function newProtocolNode () { followAncestors = true excludeChildren = true object.parentNode = getProtocolNode(node.payload.parentNode, removePersonalData, parseCode, includeIds, includePayload, includeReferences, followReferenceParent, includeParent, followAncestors, excludeChildren, excludeType) + followAncestors = false + includeParent = false } if (node.panels !== undefined) { for (let m = 0; m < node.panels.length; m++) { @@ -1753,9 +1755,7 @@ function newProtocolNode () { } function getSavedPayload (node, includeReferences) { - if (node.payload === undefined) { - console.log('HERE') - } + if (node.payload === undefined) { return } let savedPayload = { position: { x: node.payload.position.x, @@ -1778,24 +1778,6 @@ function newProtocolNode () { } 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 = { @@ -1804,6 +1786,11 @@ function newProtocolNode () { name: node.payload.referenceParent.name, id: node.payload.referenceParent.id } + } else { + /* The referenceParent property can be inherited from the previous saved payload. */ + if (node.savedPayload !== undefined) { + savedPayload.referenceParent = node.savedPayload.referenceParent + } } } return savedPayload diff --git a/DesignerSpace/Workspace/FunctionLibraries/ReferenceAttachDetach.js b/DesignerSpace/Workspace/FunctionLibraries/ReferenceAttachDetach.js index f0f6dc9df..cdf5385dc 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/ReferenceAttachDetach.js +++ b/DesignerSpace/Workspace/FunctionLibraries/ReferenceAttachDetach.js @@ -16,20 +16,9 @@ function newReferenceAttachDetach () { function completeAttachment (node, attachToNode) { node.payload.referenceParent = attachToNode - if (attachToNode.referenceChildren === undefined) { - attachToNode.referenceChildren = [] - } - attachToNode.referenceChildren.push(node) } function completeDetachment (node) { - 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 - } - } node.payload.referenceParent = undefined } } diff --git a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js index 350fd55d9..4c89e0007 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js +++ b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js @@ -1,6 +1,7 @@ function newUiObjectsFromNodes () { thisObject = { recreateWorkspace: recreateWorkspace, + tryToConnectChildrenWithReferenceParents: tryToConnectChildrenWithReferenceParents, createUiObjectFromNode: createUiObjectFromNode, addUIObject: addUIObject, addTeam: addTeam, @@ -68,44 +69,41 @@ function newUiObjectsFromNodes () { addJavascriptCode: addJavascriptCode } - let mapOfReferenceParents - let mapOfReferenceChildren + let mapOfReferenceChildren = new Map() + let mapOfNodes = new Map() return thisObject function recreateWorkspace (node) { - mapOfReferenceParents = new Map() - mapOfReferenceChildren = new Map() - let workspace = node - createUiObject(false, 'Workspace', workspace.name, workspace, undefined, undefined, 'Workspace') + /* Create the workspace UI OBject and then continue with the root nodes. */ + createUiObject(false, 'Workspace', node.name, node, 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) } } + + tryToConnectChildrenWithReferenceParents() + } + + function tryToConnectChildrenWithReferenceParents () { /* 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) { - if (parentNode.referenceChildren === undefined) { - parentNode.referenceChildren = [] + for (const [key, node] of mapOfNodes) { + if (node.payload.referenceParent !== undefined) { + if (node.payload.referenceParent.cleaned === true) { + node.payload.referenceParent = mapOfNodes.get(node.payload.referenceParent.id) + continue // We were referencing a deleted node, so we replace it potentially with a newly created one. + } else { + continue // In this case the reference is already good. + } } - 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) + if (node.savedPayload !== undefined) { + if (node.savedPayload.referenceParent !== undefined) { // these are children recreated + node.payload.referenceParent = mapOfNodes.get(node.savedPayload.referenceParent.id) } } - parentNode.savedPayload = undefined } - mapOfReferenceChildren = undefined - mapOfReferenceParents = undefined - - return } function createUiObjectFromNode (node, parentNode, chainParent, positionOffset) { @@ -444,14 +442,6 @@ function newUiObjectsFromNodes () { return } case 'Definition': { - let referenceChildren - if (mapOfReferenceParents !== undefined) { - if (node.savedPayload.referenceChildren !== undefined) { - referenceChildren = [] - mapOfReferenceParents.set(node.id, node) - referenceChildren = node.savedPayload.referenceChildren - } - } createUiObject(false, 'Definition', node.name, node, parentNode, chainParent, 'Definition', positionOffset) if (node.tradingSystem !== undefined) { createUiObjectFromNode(node.tradingSystem, node, node, positionOffset) @@ -459,16 +449,6 @@ function newUiObjectsFromNodes () { if (node.personalData !== undefined) { createUiObjectFromNode(node.personalData, node, node, positionOffset) } - if (node.referenceChildren === undefined) { - node.referenceChildren = [] - } - if (referenceChildren !== undefined) { - node.savedPayload = { - referenceChildren: referenceChildren - } - } else { - node.referenceChildren = [] - } return } case 'Network': { @@ -566,15 +546,6 @@ 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': { @@ -595,23 +566,9 @@ function newUiObjectsFromNodes () { if (node.session !== undefined) { createUiObjectFromNode(node.session, node, node, positionOffset) } - if (referenceParent !== undefined) { - node.savedPayload = { - referenceParent: referenceParent - } - } 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(false, 'Backtesting Session', node.name, node, parentNode, chainParent, 'Backtesting Session', positionOffset) if (node.parameters !== undefined) { createUiObjectFromNode(node.parameters, node, node, positionOffset) @@ -622,23 +579,9 @@ function newUiObjectsFromNodes () { if (node.socialBots !== undefined) { createUiObjectFromNode(node.socialBots, node, node, positionOffset) } - 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(false, 'Live Trading Session', node.name, node, parentNode, chainParent, 'Live Trading Session', positionOffset) if (node.parameters !== undefined) { createUiObjectFromNode(node.parameters, node, node, positionOffset) @@ -649,23 +592,9 @@ function newUiObjectsFromNodes () { if (node.socialBots !== undefined) { createUiObjectFromNode(node.socialBots, node, node, positionOffset) } - 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(false, 'Fordward Testing Session', node.name, node, parentNode, chainParent, 'Fordward Testing Session', positionOffset) if (node.parameters !== undefined) { createUiObjectFromNode(node.parameters, node, node, positionOffset) @@ -676,23 +605,9 @@ function newUiObjectsFromNodes () { if (node.socialBots !== undefined) { createUiObjectFromNode(node.socialBots, node, node, positionOffset) } - 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(false, 'Paper Trading Session', node.name, node, parentNode, chainParent, 'Paper Trading Session', positionOffset) if (node.parameters !== undefined) { createUiObjectFromNode(node.parameters, node, node, positionOffset) @@ -703,11 +618,6 @@ function newUiObjectsFromNodes () { if (node.socialBots !== undefined) { createUiObjectFromNode(node.socialBots, node, node, positionOffset) } - if (referenceParent !== undefined) { - node.savedPayload = { - referenceParent: referenceParent - } - } return } @@ -768,14 +678,6 @@ 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(false, node.type, node.name, node, parentNode, chainParent, node.type, positionOffset) if (node.processOutput !== undefined) { createUiObjectFromNode(node.processOutput, node, node, positionOffset) @@ -792,13 +694,6 @@ function newUiObjectsFromNodes () { if (node.executionFinishedEvent !== undefined) { createUiObjectFromNode(node.executionFinishedEvent, node, node, positionOffset) } - if (referenceChildren !== undefined) { - node.savedPayload = { - referenceChildren: referenceChildren - } - } else { - node.referenceChildren = [] - } return } case 'Process Output': { @@ -822,59 +717,15 @@ 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(false, node.type, node.name, node, parentNode, chainParent, node.type, positionOffset) - if (referenceChildren !== undefined) { - node.savedPayload = { - referenceChildren: referenceChildren - } - } else { - node.referenceChildren = [] - } 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(false, node.type, node.name, node, parentNode, chainParent, node.type, positionOffset) - if (referenceParent !== undefined) { - node.savedPayload = { - referenceParent: referenceParent - } - } 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(false, node.type, node.name, node, parentNode, chainParent, node.type, positionOffset) - if (referenceChildren !== undefined) { - node.savedPayload = { - referenceChildren: referenceChildren - } - } else { - node.referenceChildren = [] - } return } case 'Calculations Procedure': { @@ -914,69 +765,18 @@ 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(false, node.type, node.name, node, parentNode, chainParent, node.type, positionOffset) - if (referenceParent !== undefined) { - node.savedPayload = { - referenceParent: referenceParent - } - } 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(false, node.type, node.name, node, parentNode, chainParent, node.type, positionOffset) - if (referenceParent !== undefined) { - node.savedPayload = { - referenceParent: referenceParent - } - } 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(false, node.type, node.name, node, parentNode, chainParent, node.type, positionOffset) - if (referenceParent !== undefined) { - node.savedPayload = { - referenceParent: referenceParent - } - } return } case 'Product Definition': { - 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(false, node.type, node.name, node, parentNode, chainParent, node.type, positionOffset) if (node.record !== undefined) { createUiObjectFromNode(node.record, node, node, positionOffset) @@ -991,11 +791,6 @@ function newUiObjectsFromNodes () { if (node.dataBuilding !== undefined) { createUiObjectFromNode(node.dataBuilding, node, node, positionOffset) } - if (referenceParent !== undefined) { - node.savedPayload = { - referenceParent: referenceParent - } - } return } case 'Record Definition': { @@ -1014,22 +809,7 @@ function newUiObjectsFromNodes () { return } case 'Dataset Definition': { - let referenceChildren - if (mapOfReferenceParents !== undefined) { - if (node.savedPayload.referenceChildren !== undefined) { - referenceChildren = [] - mapOfReferenceParents.set(node.id, node) - referenceChildren = node.savedPayload.referenceChildren - } - } createUiObject(false, node.type, node.name, node, parentNode, chainParent, node.type, positionOffset) - if (referenceChildren !== undefined) { - node.savedPayload = { - referenceChildren: referenceChildren - } - } else { - node.referenceChildren = [] - } return } case 'Plotter': { @@ -1041,14 +821,6 @@ function newUiObjectsFromNodes () { return } case 'Plotter Module': { - let referenceChildren - if (mapOfReferenceParents !== undefined) { - if (node.savedPayload.referenceChildren !== undefined) { - referenceChildren = [] - mapOfReferenceParents.set(node.id, node) - referenceChildren = node.savedPayload.referenceChildren - } - } createUiObject(false, node.type, node.name, node, parentNode, chainParent, node.type, positionOffset) if (node.javascriptCode !== undefined) { @@ -1063,13 +835,6 @@ function newUiObjectsFromNodes () { let panel = node.panels[m] createUiObjectFromNode(panel, node, node, positionOffset) } - if (referenceChildren !== undefined) { - node.savedPayload = { - referenceChildren: referenceChildren - } - } else { - node.referenceChildren = [] - } return } @@ -1077,31 +842,6 @@ function newUiObjectsFromNodes () { /* Get node definition */ let nodeDefinition = APP_SCHEMA_MAP.get(node.type) if (nodeDefinition !== undefined) { - /* Open Check for reference Children. */ - let referenceChildren - if (nodeDefinition.isReferenceParent === true) { - if (mapOfReferenceParents !== undefined) { - if (node.savedPayload.referenceChildren !== undefined) { - referenceChildren = [] - mapOfReferenceParents.set(node.id, node) - referenceChildren = node.savedPayload.referenceChildren - } - } - } - - /* Open Check Reference Parent */ - let referenceParent - if (nodeDefinition.isReferenceChildren === true) { - if (mapOfReferenceChildren !== undefined) { - if (node.savedPayload.referenceParent !== undefined) { - if (node.savedPayload.referenceParent.id !== undefined) { - mapOfReferenceChildren.set(node.id, node) - referenceParent = node.savedPayload.referenceParent - } - } - } - } - /* Resolve Initial Values */ if (nodeDefinition.initialValues !== undefined) { if (nodeDefinition.initialValues.code !== undefined) { @@ -1136,29 +876,6 @@ function newUiObjectsFromNodes () { } } } - - /* Close Reference Children Check. */ - if (nodeDefinition.isReferenceParent === true) { - if (node.referenceChildren === undefined) { - node.referenceChildren = [] - } - if (referenceChildren !== undefined) { - node.savedPayload = { - referenceChildren: referenceChildren - } - } else { - node.referenceChildren = [] - } - } - - /* Close Reference Parent Check */ - if (nodeDefinition.isReferenceChildren === true) { - if (referenceParent !== undefined) { - node.savedPayload = { - referenceParent: referenceParent - } - } - } } return @@ -1281,8 +998,7 @@ function newUiObjectsFromNodes () { let object = { type: 'Process Definition', name: 'New Process Definition', - code: '{}', - referenceChildren: [] + code: '{}' } if (node.processes === undefined) { node.processes = [] @@ -1335,8 +1051,7 @@ function newUiObjectsFromNodes () { if (node.statusReport === undefined) { node.statusReport = { type: 'Status Report', - name: 'New Status Report', - referenceChildren: [] + name: 'New Status Report' } createUiObject(true, node.statusReport.type, node.statusReport.name, node.statusReport, node, node) } @@ -1358,8 +1073,7 @@ function newUiObjectsFromNodes () { if (node.executionFinishedEvent === undefined) { node.executionFinishedEvent = { type: 'Execution Finished Event', - name: 'New Execution Finished Event', - referenceChildren: [] + name: 'New Execution Finished Event' } createUiObject(true, node.executionFinishedEvent.type, node.executionFinishedEvent.name, node.executionFinishedEvent, node, node) } @@ -1504,8 +1218,7 @@ function newUiObjectsFromNodes () { let object = { type: 'Dataset Definition', name: 'New Dataset Definition', - code: '{}', - referenceChildren: [] + code: '{}' } if (node.datasets === undefined) { node.datasets = [] @@ -1765,8 +1478,7 @@ function newUiObjectsFromNodes () { function addDefinition (node) { let definition = { - name: 'New Definition', - referenceChildren: [] + name: 'New Definition' } node.rootNodes.push(definition) createUiObject(true, 'Definition', definition.name, definition, node, undefined, 'Definition') @@ -2250,6 +1962,15 @@ function newUiObjectsFromNodes () { if (payload.targetPosition.x === null) { payload.targetPosition.x = spawnPosition.x } if (payload.targetPosition.y === null) { payload.targetPosition.y = spawnPosition.y } + + /* Reference children connection to parents */ + if (node.savedPayload.referenceParent !== undefined) { + payload.referenceParent = mapOfNodes.get(node.savedPayload.referenceParent.id) + + if (payload.referenceParent !== undefined) { + mapOfReferenceChildren.set(node.id, node) + } + } } else { if (chainParent === undefined) { payload.targetPosition = { @@ -2289,5 +2010,7 @@ function newUiObjectsFromNodes () { node.payload = payload node.type = uiObjectType canvas.floatingSpace.uiObjectConstructor.createUiObject(userAddingNew, payload) + + mapOfNodes.set(node.id, node) } } diff --git a/DesignerSpace/Workspace/Workspace.js b/DesignerSpace/Workspace/Workspace.js index c36212303..dfae4f326 100644 --- a/DesignerSpace/Workspace/Workspace.js +++ b/DesignerSpace/Workspace/Workspace.js @@ -209,38 +209,17 @@ function newWorkspace () { canvas.chartSpace.finalize() canvas.chartSpace.initialize() return - } else { - 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) + /* 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) + functionLibraryUiObjectsFromNodes.tryToConnectChildrenWithReferenceParents() } catch (err) { if (ERROR_LOG === true) { logger.write('[ERROR] spawn -> err = ' + err.stack) } } @@ -285,7 +264,7 @@ function newWorkspace () { ) { text = JSON.stringify(functionLibraryProtocolNode.getProtocolNode(payload.node, true, false, true, true, true)) } else { - text = JSON.stringify(functionLibraryProtocolNode.getProtocolNode(payload.node, true)) + text = JSON.stringify(functionLibraryProtocolNode.getProtocolNode(payload.node, true, false, true, true, true)) } let nodeName = payload.node.name @@ -309,7 +288,7 @@ function newWorkspace () { ) { text = JSON.stringify(functionLibraryProtocolNode.getProtocolNode(payload.node, false, false, true, true, true)) } else { - text = JSON.stringify(functionLibraryProtocolNode.getProtocolNode(payload.node, false)) + text = JSON.stringify(functionLibraryProtocolNode.getProtocolNode(payload.node, false, false, true, true, true)) } let nodeName = payload.node.name diff --git a/FloatingSpace/UiObjectConstructor.js b/FloatingSpace/UiObjectConstructor.js index 8dae08e62..16952bd47 100644 --- a/FloatingSpace/UiObjectConstructor.js +++ b/FloatingSpace/UiObjectConstructor.js @@ -78,7 +78,6 @@ function newUiObjectConstructor () { payload.uiObject.shortcutKey = payload.node.savedPayload.uiObject.shortcutKey } } - payload.node.savedPayload = undefined floatingLayer.addFloatingObject(floatingObject) @@ -5149,5 +5148,10 @@ function newUiObjectConstructor () { payload.uiObject.finalize() payload.uiObject = undefined + + payload.referenceParent = undefined + payload.parent = undefined + payload.chainParent = undefined + payload.node.savedPayload = undefined } } From 3a51a3a02709c2610dc14c5c231bc0f941fa25ea Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Fri, 13 Dec 2019 16:37:06 +0100 Subject: [PATCH 37/72] Adding a backup with the same existing objects generates new ids --- .../FunctionLibraries/UiObjectsFromNodes.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js index 4c89e0007..3ffe8df8e 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js +++ b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js @@ -70,11 +70,13 @@ function newUiObjectsFromNodes () { } let mapOfReferenceChildren = new Map() - let mapOfNodes = new Map() + let mapOfNodes return thisObject function recreateWorkspace (node) { + mapOfNodes = new Map() + /* Create the workspace UI OBject and then continue with the root nodes. */ createUiObject(false, 'Workspace', node.name, node, undefined, undefined, 'Workspace') if (node.rootNodes !== undefined) { @@ -90,6 +92,7 @@ function newUiObjectsFromNodes () { function tryToConnectChildrenWithReferenceParents () { /* We reconstruct here the reference relationships. */ for (const [key, node] of mapOfNodes) { + if (node.payload === undefined) { continue } if (node.payload.referenceParent !== undefined) { if (node.payload.referenceParent.cleaned === true) { node.payload.referenceParent = mapOfNodes.get(node.payload.referenceParent.id) @@ -1943,6 +1946,15 @@ function newUiObjectsFromNodes () { function createUiObject (userAddingNew, uiObjectType, name, node, parentNode, chainParent, title, positionOffset) { let payload = {} + if (node.id === undefined) { + node.id = newUniqueId() + } else { + let testNode = mapOfNodes.get(node.id) + if (testNode !== undefined && testNode.cleaned !== true) { + node.id = newUniqueId() + } + } + if (name === '' || name === undefined) { name = 'My ' + uiObjectType } if (node.savedPayload !== undefined) { /* If there is a position offset, we apply it here. */ @@ -2004,9 +2016,6 @@ function newUiObjectsFromNodes () { payload.chainParent = chainParent payload.onMenuItemClick = canvas.designerSpace.workspace.onMenuItemClick - if (node.id === undefined) { - node.id = newUniqueId() - } node.payload = payload node.type = uiObjectType canvas.floatingSpace.uiObjectConstructor.createUiObject(userAddingNew, payload) From 14f0e787ee539214beeafad12bcd766df824176f Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sat, 14 Dec 2019 14:19:08 +0100 Subject: [PATCH 38/72] bug fixed --- .../Workspace/FunctionLibraries/UiObjectsFromNodes.js | 2 +- FloatingSpace/UiObjectConstructor.js | 8 ++++---- Panels/PlotterPanel.js | 1 + 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js index 3ffe8df8e..734b1517f 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js +++ b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js @@ -1145,7 +1145,7 @@ function newUiObjectsFromNodes () { let object = { type: 'Status Dependency', name: 'New Status Dependency', - code: '{ \n\"mainUtility\": \"Self Reference|Market Starting Point|Market Ending Point.\"\n}' + code: '{ \n\"mainUtility\": \"Self Reference|Market Starting Point|Market Ending Point\"\n}' } if (node.statusDependencies === undefined) { node.statusDependencies = [] diff --git a/FloatingSpace/UiObjectConstructor.js b/FloatingSpace/UiObjectConstructor.js index 16952bd47..3321d19e0 100644 --- a/FloatingSpace/UiObjectConstructor.js +++ b/FloatingSpace/UiObjectConstructor.js @@ -2261,7 +2261,7 @@ function newUiObjectConstructor () { addLeftIcons(menuItemsInitialValues, floatingObject) menuItemsInitialValues.push( { - action: 'Configure Sensor Bot Instance', + action: 'Configure Bot Instance', actionFunction: uiObject.configEditor.activate, label: 'Configure Sensor Bot Instance', visible: true, @@ -2328,9 +2328,9 @@ function newUiObjectConstructor () { addLeftIcons(menuItemsInitialValues, floatingObject) menuItemsInitialValues.push( { - action: 'Configure Indicator Bot Instance', + action: 'Configure Bot Instance', actionFunction: uiObject.configEditor.activate, - label: 'Configure Indicator Bot Instance', + label: 'Configure Bot Instance', visible: true, iconPathOn: 'html', iconPathOff: 'html', @@ -2395,7 +2395,7 @@ function newUiObjectConstructor () { addLeftIcons(menuItemsInitialValues, floatingObject) menuItemsInitialValues.push( { - action: 'Configure Trading Bot Instance', + action: 'Configure Bot Instance', actionFunction: uiObject.configEditor.activate, label: 'Configure Trading Bot Instance', visible: true, diff --git a/Panels/PlotterPanel.js b/Panels/PlotterPanel.js index 1a54b7299..b567cc9f4 100644 --- a/Panels/PlotterPanel.js +++ b/Panels/PlotterPanel.js @@ -100,6 +100,7 @@ function newPlotterPanel () { } /* Second we go through the panel data. */ + if (panelNode.panelData === undefined) { return } for (let i = 0; i < panelNode.panelData.length; i++) { let panelData = panelNode.panelData[i] From 6418b270c4fe10cbd7079fdc9cfba96424c0dd45 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sat, 14 Dec 2019 14:32:53 +0100 Subject: [PATCH 39/72] Panel with default properties --- Panels/PlotterPanel.js | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/Panels/PlotterPanel.js b/Panels/PlotterPanel.js index b567cc9f4..b8b22180c 100644 --- a/Panels/PlotterPanel.js +++ b/Panels/PlotterPanel.js @@ -104,7 +104,10 @@ function newPlotterPanel () { for (let i = 0; i < panelNode.panelData.length; i++) { let panelData = panelNode.panelData[i] - let value = 'No value defined' + let labelText = panelData.name + let labelPosition = i * 5 + 10 + let valuePosition = i * 5 + 15 + let value = 'No value defined.' if (panelData.dataFormula !== undefined) { try { @@ -119,8 +122,20 @@ function newPlotterPanel () { value = value.toFixed(panelData.code.valueDecimals) } - printLabel(panelData.code.labelText, X_AXIS, PANEL_HEIGHT * panelData.code.labelPosition / 100, '1') - printLabel(value, X_AXIS, PANEL_HEIGHT * panelData.code.valuePosition / 100, '0.50') + if (panelData.code.labelText !== undefined) { + labelText = panelData.code.labelText + } + + if (panelData.code.labelPosition !== undefined) { + labelPosition = panelData.code.labelPosition + } + + if (panelData.code.valuePosition !== undefined) { + valuePosition = panelData.code.valuePosition + } + + printLabel(labelText, X_AXIS, PANEL_HEIGHT * labelPosition / 100, '1') + printLabel(value, X_AXIS, PANEL_HEIGHT * valuePosition / 100, '0.50') } function printLabel (labelToPrint, x, y, opacity) { From c295a59f4b41c56dd7e806b5d6754ff24a317e94 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sat, 14 Dec 2019 15:34:26 +0100 Subject: [PATCH 40/72] plotter banners implemented --- Panels/ProductCard.js | 12 ++++++++++-- Panels/ProductsPanel.js | 2 ++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Panels/ProductCard.js b/Panels/ProductCard.js index a9c5b6d4f..0c51f0565 100644 --- a/Panels/ProductCard.js +++ b/Panels/ProductCard.js @@ -229,7 +229,15 @@ function newProductCard () { legacyPlotterBannerLoaded = true } - legacyPlotterBanner.src = window.canvasApp.urlPrefix + 'Images/' + PLOTTER_TEAM + '/' + PLOTTER_REPO + '/' + PLOTTER_PROFILE_PIC + if (PLOTTER_PROFILE_PIC !== undefined) { + legacyPlotterBanner.src = window.canvasApp.urlPrefix + 'Images/' + PLOTTER_TEAM + '/' + PLOTTER_REPO + '/' + PLOTTER_PROFILE_PIC + } else { + if (thisObject.product.plotter.banner !== undefined) { + legacyPlotterBanner.src = window.canvasApp.urlPrefix + 'Images/' + thisObject.product.plotter.banner + '-Banner.PNG' + } else { + legacyPlotterBanner.src = window.canvasApp.urlPrefix + 'Images/' + 'Default-Banner.PNG' + } + } const TEAM = thisObject.devTeam.codeName.toLowerCase() const BOT = thisObject.bot.codeName.toLowerCase() @@ -526,7 +534,7 @@ function newProductCard () { } } /* Third the Plotter's Profile Picture. */ - if (thisObject.product.plotter.profilePicture !== undefined) { + if (thisObject.product.plotter.profilePicture !== undefined || thisObject.product.plotter.legacy === false) { let plotterImagePoint = { x: thisObject.container.frame.width / 2 - plotterImageSize.width / 2, y: thisObject.container.frame.height / 2 - plotterImageSize.height / 2 diff --git a/Panels/ProductsPanel.js b/Panels/ProductsPanel.js index 4f52059ed..a28de7171 100644 --- a/Panels/ProductsPanel.js +++ b/Panels/ProductsPanel.js @@ -131,6 +131,7 @@ function newProductsPanel () { try { let code = JSON.parse(plotterModuleNode.code) plotterModule.codeName = code.codeName + plotterModule.banner = code.banner } catch (err) { continue } @@ -163,6 +164,7 @@ function newProductsPanel () { product.plotter = plotter product.plotter.devTeam = plotterTeam.codeName product.plotter.moduleName = plotterModule.codeName + product.plotter.banner = plotterModule.banner product.plotter.legacy = false product.plotter.module = { panels: [] } product.displayName = productNode.name From a736f5ce4d18a2b66e8fe6a6dcb02f353a83a195 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sun, 15 Dec 2019 15:34:15 +0100 Subject: [PATCH 41/72] More transparency --- Scales/Commons.js | 2 +- Scales/TimePeriodScale.js | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Scales/Commons.js b/Scales/Commons.js index 6e52c9c99..fa1c95fcd 100644 --- a/Scales/Commons.js +++ b/Scales/Commons.js @@ -4,7 +4,7 @@ function drawScaleDisplay (label1, label2, xExtraOffSet1, xExtraOffSet2, contain let fontSize2 = 10 const RED_LINE_HIGHT = 5 - const OPACITY = 1 + const OPACITY = 0.75 let params = { cornerRadius: 3, diff --git a/Scales/TimePeriodScale.js b/Scales/TimePeriodScale.js index 93d2cb81b..16cc50755 100644 --- a/Scales/TimePeriodScale.js +++ b/Scales/TimePeriodScale.js @@ -267,7 +267,7 @@ to be visible at the top of the viewPort. */ let fontSize2 = 10 const RED_LINE_HIGHT = 5 - const OPACITY = 1 + const OPACITY = 0.75 let centerPoint = { x: mouse.position.x, @@ -320,4 +320,3 @@ to be visible at the top of the viewPort. */ browserCanvasContext.fillText(label2, labelPoint2.x, labelPoint2.y) } } - From d72045a38616183dfae18fb5925570f4161c41ae Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sun, 15 Dec 2019 15:59:27 +0100 Subject: [PATCH 42/72] More on vertical scale --- Scales/RateScale.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Scales/RateScale.js b/Scales/RateScale.js index e44bbc241..56b2e34fa 100644 --- a/Scales/RateScale.js +++ b/Scales/RateScale.js @@ -6,7 +6,7 @@ function newRateScale () { rate: undefined, fitFunction: undefined, visible: true, - heightPercentage: 100, + heightPercentage: 150, physics: physics, draw: draw, getContainer: getContainer, @@ -70,7 +70,7 @@ function newRateScale () { if (thisObject.heightPercentage < STEP_SIZE) { thisObject.heightPercentage = STEP_SIZE } } else { thisObject.heightPercentage = thisObject.heightPercentage + STEP_SIZE - if (thisObject.heightPercentage > 100) { thisObject.heightPercentage = 100 } + if (thisObject.heightPercentage > 150) { thisObject.heightPercentage = 150 } } event.heightPercentage = thisObject.heightPercentage thisObject.container.eventHandler.raiseEvent('Height Percentage Changed', event) @@ -106,7 +106,7 @@ function newRateScale () { const DISTANCE_BETWEEN_ARROWS = 10 const MIN_DISTANCE_FROM_CENTER = 30 const CURRENT_VALUE_DISTANCE = MIN_DISTANCE_FROM_CENTER + thisObject.heightPercentage - const MAX_DISTANCE_FROM_CENTER = MIN_DISTANCE_FROM_CENTER + 115 + DISTANCE_BETWEEN_ARROWS + const MAX_DISTANCE_FROM_CENTER = MIN_DISTANCE_FROM_CENTER + 165 + DISTANCE_BETWEEN_ARROWS let ARROW_DIRECTION = 0 From cca5c85835b127c571f3ea1e086e302e78cc125a Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sun, 15 Dec 2019 16:14:41 +0100 Subject: [PATCH 43/72] Plotter now respecting viewport changes --- Plotter.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Plotter.js b/Plotter.js index de9c938a0..a5f4c93b5 100644 --- a/Plotter.js +++ b/Plotter.js @@ -558,9 +558,6 @@ function newPlotter () { */ dataPoint = transformThisPoint(dataPoint, thisObject.container) - /* We make sure the points do not fall outside the viewport visible area. This step allways need to be done. */ - dataPoint = viewPort.fitIntoVisibleArea(dataPoint) - /* Store the data point at the local map */ dataPoints.set(point.id, dataPoint) @@ -701,7 +698,13 @@ function newPlotter () { for (let k = 0; k < polygon.polygonVertexes.length; k++) { let polygonVertex = polygon.polygonVertexes[k] if (polygonVertex.referenceParent !== undefined) { - let dataPoint = dataPoints.get(polygonVertex.referenceParent.id) + let dataPointObject = dataPoints.get(polygonVertex.referenceParent.id) + let dataPoint = { + x: dataPointObject.x, + y: dataPointObject.y + } + /* We make sure the points do not fall outside the viewport visible area. This step allways need to be done. */ + dataPoint = viewPort.fitIntoVisibleArea(dataPoint) if (k === 0) { browserCanvasContext.moveTo(dataPoint.x, dataPoint.y) } else { From 5a0ac3a5320b293dbdeac284e103bb8c6878cf7b Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sun, 15 Dec 2019 16:41:38 +0100 Subject: [PATCH 44/72] Warm Up at the begining --- Spaces/FloatingSpace.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Spaces/FloatingSpace.js b/Spaces/FloatingSpace.js index b5dbad099..b82fde99e 100644 --- a/Spaces/FloatingSpace.js +++ b/Spaces/FloatingSpace.js @@ -41,6 +41,7 @@ function newFloatingSpace () { let devicePixelRatio = window.devicePixelRatio const SPACE_SIZE = 50000 + const WARM_UP_LIMIT = 10000 thisObject.container.frame.width = SPACE_SIZE thisObject.container.frame.height = SPACE_SIZE @@ -100,7 +101,7 @@ function newFloatingSpace () { After that we will start evaluating which ones are too far from the current user view. */ - if (warmingUpCounter < 10000) { + if (warmingUpCounter < WARM_UP_LIMIT) { warmingUpCounter++ return false } @@ -271,7 +272,7 @@ function newFloatingSpace () { } function physics () { - if (visible === true) { + if (visible === true || warmingUpCounter < WARM_UP_LIMIT) { browserZoomPhysics() thisObject.floatingLayer.physics() } From b2ff763c80757d3adfcc6254cb7aff7f7e359736 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sun, 15 Dec 2019 22:46:29 +0100 Subject: [PATCH 45/72] BUG FIXED with Zooming and the new Plotter module --- ChartsSpace/ViewPort.js | 2 ++ Panels/TimeControlPanel.js | 10 ++++++---- Plotter.js | 17 +++++++++++++++-- Scales/TimePeriodScale.js | 26 ++++++++++++++------------ 4 files changed, 37 insertions(+), 18 deletions(-) diff --git a/ChartsSpace/ViewPort.js b/ChartsSpace/ViewPort.js index b96904c80..129fe0071 100644 --- a/ChartsSpace/ViewPort.js +++ b/ChartsSpace/ViewPort.js @@ -290,6 +290,8 @@ function newViewPort () { x: 0, y: 0 } + + thisObject.eventHandler.raiseEvent('Zoom Changed') } function zoomFontSize (baseSize, level) { diff --git a/Panels/TimeControlPanel.js b/Panels/TimeControlPanel.js index 2f650b65c..55d1baa11 100644 --- a/Panels/TimeControlPanel.js +++ b/Panels/TimeControlPanel.js @@ -58,7 +58,9 @@ function newTimeControlPanel () { } function onZoomChanged (event) { - timePeriod = recalculatePeriod(event.newLevel) + if (event !== undefined) { // it is undefined when the level is just being animated. + timePeriod = recalculatePeriod(event.newLevel) + } } function getContainer (point) { @@ -115,7 +117,7 @@ function newTimeControlPanel () { labelPoint = thisObject.container.frame.frameThisPoint(labelPoint) - browserCanvasContext.font = fontSize + 'px ' + UI_FONT.PRIMARY + browserCanvasContext.font = fontSize + 'px ' + UI_FONT.PRIMARY browserCanvasContext.fillStyle = 'rgba(60, 60, 60, 0.50)' browserCanvasContext.fillText(label, labelPoint.x, labelPoint.y) @@ -132,7 +134,7 @@ function newTimeControlPanel () { labelPoint = thisObject.container.frame.frameThisPoint(labelPoint) - browserCanvasContext.font = fontSize + 'px ' + UI_FONT.PRIMARY + browserCanvasContext.font = fontSize + 'px ' + UI_FONT.PRIMARY browserCanvasContext.fillStyle = 'rgba(60, 60, 60, 0.50)' browserCanvasContext.fillText(label, labelPoint.x, labelPoint.y) @@ -151,7 +153,7 @@ function newTimeControlPanel () { labelPoint = thisObject.container.frame.frameThisPoint(labelPoint) - browserCanvasContext.font = fontSize + 'px ' + UI_FONT.PRIMARY + browserCanvasContext.font = fontSize + 'px ' + UI_FONT.PRIMARY browserCanvasContext.fillStyle = 'rgba(60, 60, 60, 0.50)' browserCanvasContext.fillText(label, labelPoint.x, labelPoint.y) } diff --git a/Plotter.js b/Plotter.js index a5f4c93b5..2cb4bb394 100644 --- a/Plotter.js +++ b/Plotter.js @@ -59,6 +59,7 @@ function newPlotter () { let marketFilesUpdatedEventSubscriptionId let dailyFilesUpdatedEventSubscriptionId + let logged = false return thisObject function finalize () { @@ -177,7 +178,7 @@ function newPlotter () { try { if (timePeriod !== pTimePeriod) { timePeriod = pTimePeriod - + mustRecalculateDataPoints = true if (timePeriod >= _1_HOUR_IN_MILISECONDS) { let newMarketFile = marketFiles.getFile(pTimePeriod) @@ -408,6 +409,14 @@ function newPlotter () { leftDate = new Date(leftDate.valueOf() - dateDiff * 1.5) rightDate = new Date(rightDate.valueOf() + dateDiff * 1.5) + for (let i = 0; i < records.length; i++) { + let record = records[i] + record.fillStyle = undefined + record.strokeStyle = undefined + record.dataPoints = undefined + record.previous = undefined + records[i] = {} + } records = [] /* Transform the current file content into an array of JSON objects */ @@ -428,7 +437,6 @@ function newPlotter () { function recalculateScale () { try { if (timeLineCoordinateSystem.maxValue > 0) { return } // Already calculated. - /* First we calculate the default scale */ let minValue = { x: MIN_PLOTABLE_DATE.valueOf(), @@ -531,6 +539,9 @@ function newPlotter () { /* We use the datapoints already calculated. */ dataPoints = record.dataPoints } else { + if (logged === false) { + logged = true + } /* Only calculate the datapoints for this record, if we have not calculate it before. */ for (let k = 0; k < productDefinition.referenceParent.shapes.chartPoints.length; k++) { let chartPoints = productDefinition.referenceParent.shapes.chartPoints[k] @@ -747,6 +758,7 @@ function newPlotter () { } mustRecalculateDataPoints = false + logged = false } catch (err) { if (ERROR_LOG === true) { logger.write('[ERROR] plotChart -> err = ' + err.stack) } } @@ -754,6 +766,7 @@ function newPlotter () { function onZoomChanged (event) { try { + mustRecalculateDataPoints = true recalculate() } catch (err) { if (ERROR_LOG === true) { logger.write('[ERROR] onZoomChanged -> err = ' + err.stack) } diff --git a/Scales/TimePeriodScale.js b/Scales/TimePeriodScale.js index 16cc50755..8909eeac7 100644 --- a/Scales/TimePeriodScale.js +++ b/Scales/TimePeriodScale.js @@ -83,21 +83,23 @@ function newTimePeriodScale () { } function onZoomChanged (event) { - let currentTimePeriod = thisObject.timePeriod - let timePeriod = recalculatePeriod(event.newLevel) - if (timePeriod !== currentTimePeriod) { - for (let i = 0; i < timePeriodsMasterArray.length; i++) { - let timePeriodArray = timePeriodsMasterArray[i] - for (let j = 0; j < timePeriodArray.length; j++) { - let record = timePeriodArray[j] - if (timePeriod === record[0]) { - filePeriodIndex = i - timePeriodIndex = j + if (event !== undefined) { // it is undefined when the level is just being animated. + let currentTimePeriod = thisObject.timePeriod + let timePeriod = recalculatePeriod(event.newLevel) + if (timePeriod !== currentTimePeriod) { + for (let i = 0; i < timePeriodsMasterArray.length; i++) { + let timePeriodArray = timePeriodsMasterArray[i] + for (let j = 0; j < timePeriodArray.length; j++) { + let record = timePeriodArray[j] + if (timePeriod === record[0]) { + filePeriodIndex = i + timePeriodIndex = j + } } } + saveObjectState() + newTimePeriod() } - saveObjectState() - newTimePeriod() } } From 2f734db56ea0a7f3192eb462556ddd22f0f5a7d3 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sun, 15 Dec 2019 22:54:24 +0100 Subject: [PATCH 46/72] more amplitude to the right scale --- Scales/RateScale.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Scales/RateScale.js b/Scales/RateScale.js index 56b2e34fa..dc675d4db 100644 --- a/Scales/RateScale.js +++ b/Scales/RateScale.js @@ -70,7 +70,7 @@ function newRateScale () { if (thisObject.heightPercentage < STEP_SIZE) { thisObject.heightPercentage = STEP_SIZE } } else { thisObject.heightPercentage = thisObject.heightPercentage + STEP_SIZE - if (thisObject.heightPercentage > 150) { thisObject.heightPercentage = 150 } + if (thisObject.heightPercentage > 150) { thisObject.heightPercentage = 200 } } event.heightPercentage = thisObject.heightPercentage thisObject.container.eventHandler.raiseEvent('Height Percentage Changed', event) @@ -106,7 +106,7 @@ function newRateScale () { const DISTANCE_BETWEEN_ARROWS = 10 const MIN_DISTANCE_FROM_CENTER = 30 const CURRENT_VALUE_DISTANCE = MIN_DISTANCE_FROM_CENTER + thisObject.heightPercentage - const MAX_DISTANCE_FROM_CENTER = MIN_DISTANCE_FROM_CENTER + 165 + DISTANCE_BETWEEN_ARROWS + const MAX_DISTANCE_FROM_CENTER = MIN_DISTANCE_FROM_CENTER + 215 + DISTANCE_BETWEEN_ARROWS let ARROW_DIRECTION = 0 From 2c54c8ff03633e7ec225b053f54711fa5b956d47 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 16 Dec 2019 09:46:46 +0100 Subject: [PATCH 47/72] when more data is available plotter needs to recalculate --- Plotter.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Plotter.js b/Plotter.js index 2cb4bb394..a4d5b8007 100644 --- a/Plotter.js +++ b/Plotter.js @@ -140,6 +140,7 @@ function newPlotter () { let newMarketFile = marketFiles.getFile(timePeriod) if (newMarketFile !== undefined) { marketFile = newMarketFile + mustRecalculateDataPoints = true recalculate() } } catch (err) { @@ -152,6 +153,7 @@ function newPlotter () { let newFileCursor = dailyFiles.getFileCursor(timePeriod) if (newFileCursor !== undefined) { fileCursor = newFileCursor + mustRecalculateDataPoints = true recalculate() } } catch (err) { From 94829ecafb76db8832aa8782ac8c79e83f7761d6 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 16 Dec 2019 10:18:12 +0100 Subject: [PATCH 48/72] Positioning of slot fixed --- Plotter.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plotter.js b/Plotter.js index a4d5b8007..bf5265a6c 100644 --- a/Plotter.js +++ b/Plotter.js @@ -577,7 +577,7 @@ function newPlotter () { if (plotterModuleConfig !== undefined) { if (plotterModuleConfig.slot !== undefined) { /* We reset the y coordinate since it will be transformed with another coordinate system to fit into a slot. */ - dataPoint.y = (-1) * y * slotCoordinateSystem.scale.y + (plotterModuleConfig.slot.number - 1) * slotHeight + dataPoint.y = (-1) * y * slotCoordinateSystem.scale.y + (plotterModuleConfig.slot.number - 1) * slotHeight + viewPort.visibleArea.topLeft.y } } } From 4c6720582fbd6f656f2c3521feca7e06bc96fce1 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 16 Dec 2019 10:47:29 +0100 Subject: [PATCH 49/72] Getting Menu Items into the APP SCHEMA --- Canvas.js | 7 +++++++ DesignerSpace/Workspace/Workspace.js | 10 ---------- FloatingSpace/UiObject.js | 10 ++++++++++ Utilities.js | 10 ++++++++++ 4 files changed, 27 insertions(+), 10 deletions(-) diff --git a/Canvas.js b/Canvas.js index 9c9a83214..776722a3f 100644 --- a/Canvas.js +++ b/Canvas.js @@ -224,6 +224,13 @@ function newCanvas () { } } + if ((event.ctrlKey === true || event.metaKey === true) && event.altKey === true && event.shiftKey === true && event.keyCode === 122) { // Regenerates APP SCHEMA FILE + let text = JSON.stringify(APP_SCHEMA_ARRAY) + let fileName = 'AppSchema.json' + download(fileName, text) + return + } + if (event.altKey === true && event.code === 'ArrowUp') { thisObject.cockpitSpace.toTop() return diff --git a/DesignerSpace/Workspace/Workspace.js b/DesignerSpace/Workspace/Workspace.js index dfae4f326..3d6ba1a3d 100644 --- a/DesignerSpace/Workspace/Workspace.js +++ b/DesignerSpace/Workspace/Workspace.js @@ -927,14 +927,4 @@ function newWorkspace () { } } - - function download (filename, text) { - let element = document.createElement('a') - element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text)) - element.setAttribute('download', filename) - element.style.display = 'none' - document.body.appendChild(element) - element.click() - document.body.removeChild(element) - } } diff --git a/FloatingSpace/UiObject.js b/FloatingSpace/UiObject.js index 1d4596695..eab5e52db 100644 --- a/FloatingSpace/UiObject.js +++ b/FloatingSpace/UiObject.js @@ -141,6 +141,16 @@ function newUiObject () { function initialize (payload, menuItemsInitialValues) { thisObject.payload = payload + let schemaNode = APP_SCHEMA_MAP.get(payload.node.type) + if (schemaNode === undefined) { + schemaNode = { + type: payload.node.type, + menuItems: menuItemsInitialValues + } + APP_SCHEMA_MAP.set(payload.node.type, schemaNode) + APP_SCHEMA_ARRAY.push(schemaNode) + } + /* Initialize the Menu */ thisObject.menu = newCircularMenu() diff --git a/Utilities.js b/Utilities.js index a72310054..4ab4c825a 100644 --- a/Utilities.js +++ b/Utilities.js @@ -1,4 +1,14 @@ +function download (filename, text) { + let element = document.createElement('a') + element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text)) + element.setAttribute('download', filename) + element.style.display = 'none' + document.body.appendChild(element) + element.click() + document.body.removeChild(element) +} + function transformThisPoint (point, container) { /* We make the point relative to the current frame */ From 6ea54b25924cb989c5fd6483719d8c027c15174c Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 16 Dec 2019 13:32:26 +0100 Subject: [PATCH 50/72] Menues Moved to App Schema --- Canvas.js | 6 + FloatingSpace/UiObject.js | 10 - FloatingSpace/UiObjectConstructor.js | 4600 +------------------------- 3 files changed, 73 insertions(+), 4543 deletions(-) diff --git a/Canvas.js b/Canvas.js index 776722a3f..e6686eb39 100644 --- a/Canvas.js +++ b/Canvas.js @@ -225,6 +225,12 @@ function newCanvas () { } if ((event.ctrlKey === true || event.metaKey === true) && event.altKey === true && event.shiftKey === true && event.keyCode === 122) { // Regenerates APP SCHEMA FILE + /* + for (let i = 0; i < APP_SCHEMA_ARRAY.length; i++) { + let schemaNode = APP_SCHEMA_ARRAY[i] + schemaNode.addLeftIcons = true + } + */ let text = JSON.stringify(APP_SCHEMA_ARRAY) let fileName = 'AppSchema.json' download(fileName, text) diff --git a/FloatingSpace/UiObject.js b/FloatingSpace/UiObject.js index eab5e52db..1d4596695 100644 --- a/FloatingSpace/UiObject.js +++ b/FloatingSpace/UiObject.js @@ -141,16 +141,6 @@ function newUiObject () { function initialize (payload, menuItemsInitialValues) { thisObject.payload = payload - let schemaNode = APP_SCHEMA_MAP.get(payload.node.type) - if (schemaNode === undefined) { - schemaNode = { - type: payload.node.type, - menuItems: menuItemsInitialValues - } - APP_SCHEMA_MAP.set(payload.node.type, schemaNode) - APP_SCHEMA_ARRAY.push(schemaNode) - } - /* Initialize the Menu */ thisObject.menu = newCircularMenu() diff --git a/FloatingSpace/UiObjectConstructor.js b/FloatingSpace/UiObjectConstructor.js index 3321d19e0..64c6aec2d 100644 --- a/FloatingSpace/UiObjectConstructor.js +++ b/FloatingSpace/UiObjectConstructor.js @@ -68,6 +68,26 @@ function newUiObjectConstructor () { uiObject.fitFunction = canvas.floatingSpace.fitIntoVisibleArea uiObject.isVisibleFunction = canvas.floatingSpace.isThisPointVisible let menuItemsInitialValues = getMenuItemsInitialValues(uiObject, floatingObject, payload) + + for (let i = 0; i < APP_SCHEMA_ARRAY.length; i++) { + let schemaNode = APP_SCHEMA_ARRAY[i] + if (schemaNode.type === payload.node.type) { + let menuItems = schemaNode.menuItems + for (let j = 0; j < menuItems.length; j++) { + let item = menuItems[j] + if (item.action.indexOf('Add ') >= 0) { + // item.action = 'Add UI Object' + } + if (item.action.indexOf('Delete ') >= 0) { + // item.action = 'Delete UI Object' + } + if (item.actionFunction === undefined) { + item.actionFunction = 'payload.onMenuItemClick' + } + } + } + } + uiObject.initialize(payload, menuItemsInitialValues) uiObject.container.connectToParent(floatingObject.container, false, false, true, true, false, false, true, true, true, true, true) @@ -167,4543 +187,57 @@ function newUiObjectConstructor () { function getMenuItemsInitialValues (uiObject, floatingObject, payload) { let menuItemsInitialValues = [] - switch (payload.node.type) { - case 'Workspace': { - floatingObject.isPinned = true - floatingObject.positionLocked = true - menuItemsInitialValues = [ - { - action: 'Pin / Unpin', - actionFunction: floatingObject.pinToggle, - actionStatus: floatingObject.getPinStatus, - currentStatus: true, - label: undefined, - visible: true, - iconPathOn: 'menu-fix-unpinned', - iconPathOff: 'menu-fix-pinned', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -135 - }, - { - action: 'Backup Workspace', - actionFunction: payload.onMenuItemClick, - label: undefined, - visible: true, - iconPathOn: 'menu-backup', - iconPathOff: 'menu-backup', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: 130 - }, - { - action: 'Add Definition', - actionFunction: payload.onMenuItemClick, - label: 'Add Definition', - visible: true, - relatedUiObject: 'Definition', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -30 - }, - { - action: 'Add Network', - actionFunction: payload.onMenuItemClick, - label: 'Add Network', - visible: true, - relatedUiObject: 'Network', - rawRadius: 8, - targetRadius: 0, - currentRadius: 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', - actionFunction: payload.onMenuItemClick, - label: 'Share', - visible: true, - iconPathOn: 'menu-share', - iconPathOff: 'menu-share', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: 30 - }] - break - } - case 'Definition': { - floatingObject.isPinned = true - floatingObject.positionLocked = true - addLeftIcons(menuItemsInitialValues, floatingObject) - menuItemsInitialValues.push( - { - action: 'Add Trading System', - disableIfPropertyIsDefined: true, - propertyToCheckFor: 'tradingSystem', - actionFunction: payload.onMenuItemClick, - label: 'Add Trading System', - visible: true, - relatedUiObject: 'Trading System', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -30 - } - ) - menuItemsInitialValues.push( - { - action: 'Add Personal Data', - disableIfPropertyIsDefined: true, - propertyToCheckFor: 'personalData', - actionFunction: payload.onMenuItemClick, - label: 'Add Personal Data', - visible: true, - relatedUiObject: 'Personal Data', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -10 - } - ) - menuItemsInitialValues.push( - { - action: 'Delete Definition', - askConfirmation: true, - confirmationLabel: 'Confirm to Delete', - actionFunction: payload.onMenuItemClick, - label: 'Delete Definition', - 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: 30 - } - ) - break - } - case 'Team': { - uiObject.configEditor = newConfigEditor() - uiObject.configEditor.isVisibleFunction = uiObject.isVisibleFunction - uiObject.configEditor.initialize() - uiObject.configEditor.container.connectToParent(uiObject.container, false, false, true, true, false, false, false, false) - addLeftIcons(menuItemsInitialValues, floatingObject) - menuItemsInitialValues.push( - { - action: 'Configure Team', - actionFunction: uiObject.configEditor.activate, - label: 'Configigure Team', - visible: true, - iconPathOn: 'html', - iconPathOff: 'html', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -75, - dontShowAtFullscreen: true - } - ) - 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: -40 - } - ) - 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: -20 - } - ) - 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: 0 - } - ) - menuItemsInitialValues.push( - { - action: 'Add Plotter', - actionFunction: payload.onMenuItemClick, - label: 'Add Plotter', - visible: true, - relatedUiObject: 'Plotter', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: 20 - } - ) - 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: 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 'Sensor Bot': { - uiObject.configEditor = newConfigEditor() - uiObject.configEditor.isVisibleFunction = uiObject.isVisibleFunction - uiObject.configEditor.initialize() - uiObject.configEditor.container.connectToParent(uiObject.container, false, false, true, true, false, false, false, false) - addLeftIcons(menuItemsInitialValues, floatingObject) - menuItemsInitialValues.push( - { - action: 'Configure Bot', - actionFunction: uiObject.configEditor.activate, - label: 'Configure Bot', - visible: true, - iconPathOn: 'html', - iconPathOff: 'html', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -45, - dontShowAtFullscreen: true - } - ) - 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: -20 - } - ) - 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: 0 - } - ) - 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: 45 - } - ) - break - } - case 'Indicator Bot': { - uiObject.configEditor = newConfigEditor() - uiObject.configEditor.isVisibleFunction = uiObject.isVisibleFunction - uiObject.configEditor.initialize() - uiObject.configEditor.container.connectToParent(uiObject.container, false, false, true, true, false, false, false, false) - addLeftIcons(menuItemsInitialValues, floatingObject) - menuItemsInitialValues.push( - { - action: 'Configure Bot', - actionFunction: uiObject.configEditor.activate, - label: 'Configure Bot', - visible: true, - iconPathOn: 'html', - iconPathOff: 'html', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -45, - dontShowAtFullscreen: true - } - ) - 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: -20 - } - ) - 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: 0 - } - ) - 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: 45 - } - ) - break - } - case 'Trading Bot': { - uiObject.configEditor = newConfigEditor() - uiObject.configEditor.isVisibleFunction = uiObject.isVisibleFunction - uiObject.configEditor.initialize() - uiObject.configEditor.container.connectToParent(uiObject.container, false, false, true, true, false, false, false, false) - addLeftIcons(menuItemsInitialValues, floatingObject) - menuItemsInitialValues.push( - { - action: 'Configure Bot', - actionFunction: uiObject.configEditor.activate, - label: 'Configure Bot', - visible: true, - iconPathOn: 'html', - iconPathOff: 'html', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -45, - dontShowAtFullscreen: true - } - ) - 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: -20 - } - ) - 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: 0 - } - ) - 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: 45 - } - ) - break - } - case 'Process Definition': { - uiObject.configEditor = newConfigEditor() - uiObject.configEditor.isVisibleFunction = uiObject.isVisibleFunction - uiObject.configEditor.initialize() - uiObject.configEditor.container.connectToParent(uiObject.container, false, false, true, true, false, false, false, false) - addLeftIcons(menuItemsInitialValues, floatingObject) - menuItemsInitialValues.push( - { - action: 'Configure Process', - actionFunction: uiObject.configEditor.activate, - label: 'Configure Process', - visible: true, - iconPathOn: 'html', - iconPathOff: 'html', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -60, - dontShowAtFullscreen: true - } - ) - menuItemsInitialValues.push( - { - action: 'Add Missing Process Definition Items', - actionFunction: payload.onMenuItemClick, - label: 'Add Missing Items', - visible: true, - relatedUiObject: 'Calculations Procedure', - 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: 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 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 - } - 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: -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 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( - { - 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: -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 'Calculations Procedure': { - addLeftIcons(menuItemsInitialValues, floatingObject) - menuItemsInitialValues.push( - { - action: 'Add Procedure Initialization', - disableIfPropertyIsDefined: true, - propertyToCheckFor: 'initialization', - actionFunction: payload.onMenuItemClick, - label: 'Add Procedure Initialization', - visible: true, - relatedUiObject: 'Procedure Initialization', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -45 - } - ) - menuItemsInitialValues.push( - { - action: 'Add Procedure Loop', - disableIfPropertyIsDefined: true, - propertyToCheckFor: 'loop', - actionFunction: payload.onMenuItemClick, - label: 'Add Procedure Loop', - visible: true, - relatedUiObject: 'Procedure Loop', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -15 - } - ) - 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: 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: 45 - } - ) - break - } - case 'Data Building Procedure': { - addLeftIcons(menuItemsInitialValues, floatingObject) - menuItemsInitialValues.push( - { - action: 'Add Procedure Initialization', - disableIfPropertyIsDefined: true, - propertyToCheckFor: 'initialization', - actionFunction: payload.onMenuItemClick, - label: 'Add Procedure Initialization', - visible: true, - relatedUiObject: 'Procedure Initialization', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -45 - } - ) - menuItemsInitialValues.push( - { - action: 'Add Procedure Loop', - disableIfPropertyIsDefined: true, - propertyToCheckFor: 'loop', - actionFunction: payload.onMenuItemClick, - label: 'Add Procedure Loop', - visible: true, - relatedUiObject: 'Procedure Loop', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -15 - } - ) - 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: 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: 45 - } - ) - break - } - case 'Procedure Initialization': { - addLeftIcons(menuItemsInitialValues, floatingObject) - menuItemsInitialValues.push( - { - action: 'Add Code', - disableIfPropertyIsDefined: true, - propertyToCheckFor: 'code', - actionFunction: payload.onMenuItemClick, - label: 'Add Code', - visible: true, - relatedUiObject: 'Javascript 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', - disableIfPropertyIsDefined: true, - propertyToCheckFor: 'code', - actionFunction: payload.onMenuItemClick, - label: 'Add Code', - visible: true, - relatedUiObject: 'Javascript 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': { - uiObject.configEditor = newConfigEditor() - uiObject.configEditor.isVisibleFunction = uiObject.isVisibleFunction - uiObject.configEditor.initialize() - uiObject.configEditor.container.connectToParent(uiObject.container, false, false, true, true, false, false, false, false) - addLeftIcons(menuItemsInitialValues, floatingObject) - menuItemsInitialValues.push( - { - action: 'Configure Status Dependency', - actionFunction: uiObject.configEditor.activate, - label: 'Configure Status Dependency', - visible: true, - iconPathOn: 'html', - iconPathOff: 'html', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -40, - dontShowAtFullscreen: true - } - ) - 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: 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 '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 'Product Definition': { - uiObject.configEditor = newConfigEditor() - uiObject.configEditor.isVisibleFunction = uiObject.isVisibleFunction - uiObject.configEditor.initialize() - uiObject.configEditor.container.connectToParent(uiObject.container, false, false, true, true, false, false, false, false) - addLeftIcons(menuItemsInitialValues, floatingObject) - menuItemsInitialValues.push( - { - action: 'Configure Product', - actionFunction: uiObject.configEditor.activate, - label: 'Configure Product', - visible: true, - iconPathOn: 'html', - iconPathOff: 'html', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -60, - dontShowAtFullscreen: true - } - ) - menuItemsInitialValues.push( - { - action: 'Add Record Definition', - disableIfPropertyIsDefined: true, - propertyToCheckFor: 'record', - actionFunction: payload.onMenuItemClick, - label: 'Add Record Definition', - visible: true, - relatedUiObject: 'Record Definition', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -30 - } - ) - 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: -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', - 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: 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: 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: -30 - } - ) - 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: 30 - } - ) - break - } - case 'Record Property': { - uiObject.configEditor = newConfigEditor() - uiObject.configEditor.isVisibleFunction = uiObject.isVisibleFunction - uiObject.configEditor.initialize() - uiObject.configEditor.container.connectToParent(uiObject.container, false, false, true, true, false, false, false, false) - addLeftIcons(menuItemsInitialValues, floatingObject) - menuItemsInitialValues.push( - { - action: 'Configure Property', - actionFunction: uiObject.configEditor.activate, - label: 'Configure Property', - visible: true, - iconPathOn: 'html', - iconPathOff: 'html', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -45, - dontShowAtFullscreen: true - } - ) - menuItemsInitialValues.push( - { - action: 'Add Formula', - disableIfPropertyIsDefined: true, - propertyToCheckFor: 'formula', - actionFunction: payload.onMenuItemClick, - label: 'Add Formula', - visible: true, - relatedUiObject: 'Formula', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -15 - } - ) - 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: 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: 45 - } - ) - break - } - case 'Dataset Definition': { - uiObject.configEditor = newConfigEditor() - uiObject.configEditor.isVisibleFunction = uiObject.isVisibleFunction - uiObject.configEditor.initialize() - uiObject.configEditor.container.connectToParent(uiObject.container, false, false, true, true, false, false, false, false) - addLeftIcons(menuItemsInitialValues, floatingObject) - menuItemsInitialValues.push( - { - action: 'Configure Definition', - actionFunction: uiObject.configEditor.activate, - label: 'Configure Definition', - visible: true, - iconPathOn: 'html', - iconPathOff: 'html', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -30, - dontShowAtFullscreen: true - } - ) - 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: 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 'Plotter': { - uiObject.configEditor = newConfigEditor() - uiObject.configEditor.isVisibleFunction = uiObject.isVisibleFunction - uiObject.configEditor.initialize() - uiObject.configEditor.container.connectToParent(uiObject.container, false, false, true, true, false, false, false, false) - addLeftIcons(menuItemsInitialValues, floatingObject) - menuItemsInitialValues.push( - { - action: 'Configure Plotter', - actionFunction: uiObject.configEditor.activate, - label: 'Configure Plotter', - visible: true, - iconPathOn: 'html', - iconPathOff: 'html', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -30, - dontShowAtFullscreen: true - } - ) - 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: -10 - } - ) - 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: 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: 30 - } - ) - break - } - case 'Plotter Module': { - uiObject.configEditor = newConfigEditor() - uiObject.configEditor.isVisibleFunction = uiObject.isVisibleFunction - uiObject.configEditor.initialize() - uiObject.configEditor.container.connectToParent(uiObject.container, false, false, true, true, false, false, false, false) - addLeftIcons(menuItemsInitialValues, floatingObject) - menuItemsInitialValues.push( - { - action: 'Configure Plotter Module', - actionFunction: uiObject.configEditor.activate, - label: 'Configure Plotter Module', - visible: true, - iconPathOn: 'html', - iconPathOff: 'html', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -60, - dontShowAtFullscreen: true - } - ) - menuItemsInitialValues.push( - { - action: 'Add Code', - disableIfPropertyIsDefined: true, - propertyToCheckFor: 'code', - actionFunction: payload.onMenuItemClick, - label: 'Add Code', - visible: true, - relatedUiObject: 'Javascript Code', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -30 - } - ) - menuItemsInitialValues.push( - { - action: 'Add UI Object', - disableIfPropertyIsDefined: true, - propertyToCheckFor: 'shapes', - actionFunction: payload.onMenuItemClick, - label: 'Add Shapes', - visible: true, - relatedUiObject: 'Shapes', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -10 - } - ) - menuItemsInitialValues.push( - { - action: 'Add UI Object', - actionFunction: payload.onMenuItemClick, - label: 'Add Plotter Panel', - visible: true, - relatedUiObject: 'Plotter Panel', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: 10 - } - ) - 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: 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: 60 - } - ) - break - } - case 'Network': { - addLeftIcons(menuItemsInitialValues, floatingObject) - menuItemsInitialValues.push( - { - action: 'Add Network Node', - actionFunction: payload.onMenuItemClick, - label: 'Add Network Node', - visible: true, - relatedUiObject: 'Network Node', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -40 - } - ) - menuItemsInitialValues.push( - { - action: 'Delete Network', - askConfirmation: true, - confirmationLabel: 'Confirm to Delete', - actionFunction: payload.onMenuItemClick, - label: 'Delete Network', - 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 Node': { - addLeftIcons(menuItemsInitialValues, floatingObject) - menuItemsInitialValues.push( - { - action: 'Add Task Manager', - actionFunction: payload.onMenuItemClick, - label: 'Add Task Manager', - visible: true, - relatedUiObject: 'Task Manager', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -40 - } - ) - menuItemsInitialValues.push( - { - action: 'Delete Network Node', - askConfirmation: true, - confirmationLabel: 'Confirm to Delete', - actionFunction: payload.onMenuItemClick, - label: 'Delete Network Node', - 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 'Social Bots': { - addLeftIcons(menuItemsInitialValues, floatingObject) - menuItemsInitialValues.push( - { - action: 'Add Telegram Bot', - actionFunction: payload.onMenuItemClick, - label: 'Add Telegram Bot', - visible: true, - relatedUiObject: 'Telegram Bot', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -40 - } - ) - menuItemsInitialValues.push( - { - action: 'Delete Social Bots', - askConfirmation: true, - confirmationLabel: 'Confirm to Delete', - actionFunction: payload.onMenuItemClick, - label: 'Delete Social Bots', - 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 'Telegram Bot': { - uiObject.configEditor = newConfigEditor() - uiObject.configEditor.isVisibleFunction = uiObject.isVisibleFunction - uiObject.configEditor.initialize() - uiObject.configEditor.container.connectToParent(uiObject.container, false, false, true, true, false, false, false, false) - addLeftIcons(menuItemsInitialValues, floatingObject) - menuItemsInitialValues.push( - { - action: 'Add Announcement', - actionFunction: payload.onMenuItemClick, - label: 'Add Announcement', - visible: true, - relatedUiObject: 'Announcement', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -60 - } - ) - menuItemsInitialValues.push( - { - action: 'Configure Telegram Bot', - actionFunction: uiObject.configEditor.activate, - label: 'Configure Telegram Bot', - visible: true, - iconPathOn: 'html', - iconPathOff: 'html', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -20, - dontShowAtFullscreen: true - } - ) - menuItemsInitialValues.push( - { - action: 'Delete Social Bot', - askConfirmation: true, - confirmationLabel: 'Confirm to Delete', - actionFunction: payload.onMenuItemClick, - label: 'Delete Telegram 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 'Announcement': { - uiObject.configEditor = newConfigEditor() - uiObject.configEditor.isVisibleFunction = uiObject.isVisibleFunction - uiObject.configEditor.initialize() - uiObject.configEditor.container.connectToParent(uiObject.container, false, false, true, true, false, false, false, false) - addLeftIcons(menuItemsInitialValues, floatingObject) - menuItemsInitialValues.push( - { - action: 'Add Formula', - disableIfPropertyIsDefined: true, - propertyToCheckFor: 'formula', - actionFunction: payload.onMenuItemClick, - label: 'Add Formula', - visible: true, - relatedUiObject: 'Formula', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -60 - } - ) - addLeftIcons(menuItemsInitialValues, floatingObject) - menuItemsInitialValues.push( - { - action: 'Configure Announcement', - actionFunction: uiObject.configEditor.activate, - label: 'Configure Announcement', - visible: true, - iconPathOn: 'html', - iconPathOff: 'html', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -20, - dontShowAtFullscreen: true - } - ) - menuItemsInitialValues.push( - { - action: 'Delete Announcement', - askConfirmation: true, - confirmationLabel: 'Confirm to Delete', - actionFunction: payload.onMenuItemClick, - label: 'Delete Announcement', - 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 'Layer Manager': { - addLeftIcons(menuItemsInitialValues, floatingObject) - menuItemsInitialValues.push( - { - action: 'Add Layer', - actionFunction: payload.onMenuItemClick, - label: 'Add Layer', - visible: true, - relatedUiObject: 'Layer', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -40 - } - ) - menuItemsInitialValues.push( - { - action: 'Delete Layer Manager', - askConfirmation: true, - confirmationLabel: 'Confirm to Delete', - actionFunction: payload.onMenuItemClick, - label: 'Delete Layer Manager', - 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 'Layer': { - uiObject.configEditor = newConfigEditor() - uiObject.configEditor.isVisibleFunction = uiObject.isVisibleFunction - uiObject.configEditor.initialize() - uiObject.configEditor.container.connectToParent(uiObject.container, false, false, true, true, false, false, false, false) - addLeftIcons(menuItemsInitialValues, floatingObject) - menuItemsInitialValues.push( - { - action: 'Configure Layer', - actionFunction: uiObject.configEditor.activate, - label: 'Configure Layer', - visible: true, - iconPathOn: 'html', - iconPathOff: 'html', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -40, - dontShowAtFullscreen: true - } - ) - menuItemsInitialValues.push( - { - action: 'Delete Layer', - askConfirmation: true, - confirmationLabel: 'Confirm to Delete', - actionFunction: payload.onMenuItemClick, - label: 'Delete Layer', - 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 'Task Manager': { - addLeftIcons(menuItemsInitialValues, floatingObject) - menuItemsInitialValues.push( - { - action: 'Run All Tasks', - actionFunction: payload.onMenuItemClick, - label: 'Run All Tasks', - visible: true, - iconPathOn: 'paper-plane', - iconPathOff: 'paper-plane', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -60 - } - ) - menuItemsInitialValues.push( - { - action: 'Stop All Tasks', - actionFunction: payload.onMenuItemClick, - label: 'Stop All Tasks', - visible: true, - iconPathOn: 'stop', - iconPathOff: 'stop', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -20 - } - ) - menuItemsInitialValues.push( - { - action: 'Add Task', - actionFunction: payload.onMenuItemClick, - label: 'Add Task', - visible: true, - relatedUiObject: 'Task Manager', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: 0 - } - ) - menuItemsInitialValues.push( - { - action: 'Delete Task Manager', - askConfirmation: true, - confirmationLabel: 'Confirm to Delete', - actionFunction: payload.onMenuItemClick, - label: 'Delete Task Manager', - 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 'Task': { - addLeftIcons(menuItemsInitialValues, floatingObject) - menuItemsInitialValues.push( - { - action: 'Run Task', - actionFunction: payload.onMenuItemClick, - label: 'Run', - workingLabel: 'Stop', - workDoneLabel: 'Task Running', - workFailedLabel: 'Task Cannot be Run', - secondaryAction: 'Stop Task', - secondaryLabel: 'Stop', - secondaryWorkingLabel: 'Stopping...', - secondaryWorkDoneLabel: 'Task Stopped', - secondaryWorkFailedLabel: 'Task Cannot be Stopped', - secondaryIcon: 'stop', - visible: true, - iconPathOn: 'paper-plane', - iconPathOff: 'paper-plane', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -75 - } - ) - menuItemsInitialValues.push( - { - action: 'Add Sensor Bot Instance', - disableIfPropertyIsDefined: true, - propertyToCheckFor: 'bot', - actionFunction: payload.onMenuItemClick, - label: 'Add Sensor Bot Instance', - visible: true, - relatedUiObject: 'Sensor Bot Instance', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -35 - } - ) - menuItemsInitialValues.push( - { - action: 'Add Indicator Bot Instance', - disableIfPropertyIsDefined: true, - propertyToCheckFor: 'bot', - actionFunction: payload.onMenuItemClick, - label: 'Add Indicator Bot Instance', - visible: true, - relatedUiObject: 'Indicator Bot Instance', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -12 - } - ) - menuItemsInitialValues.push( - { - action: 'Add Trading Bot Instance', - disableIfPropertyIsDefined: true, - propertyToCheckFor: 'bot', - actionFunction: payload.onMenuItemClick, - label: 'Add Trading Bot Instance', - visible: true, - relatedUiObject: 'Trading Bot Instance', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: 12 - } - ) - menuItemsInitialValues.push( - { - action: 'Delete Task', - askConfirmation: true, - confirmationLabel: 'Confirm to Delete', - actionFunction: payload.onMenuItemClick, - label: 'Delete Task', - visible: true, - iconPathOn: 'delete', - iconPathOff: 'delete', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: +35 - } - ) - 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 'Sensor Bot Instance': { - uiObject.configEditor = newConfigEditor() - uiObject.configEditor.isVisibleFunction = uiObject.isVisibleFunction - uiObject.configEditor.initialize() - uiObject.configEditor.container.connectToParent(uiObject.container, false, false, true, true, false, false, false, false) - addLeftIcons(menuItemsInitialValues, floatingObject) - menuItemsInitialValues.push( - { - action: 'Configure Bot Instance', - actionFunction: uiObject.configEditor.activate, - label: 'Configure Sensor Bot Instance', - visible: true, - iconPathOn: 'html', - iconPathOff: 'html', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - 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', - askConfirmation: true, - confirmationLabel: 'Confirm to Delete', - actionFunction: payload.onMenuItemClick, - label: 'Delete Sensor Bot Instance', - 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: 45 - } - ) - break - } - case 'Indicator Bot Instance': { - uiObject.configEditor = newConfigEditor() - uiObject.configEditor.isVisibleFunction = uiObject.isVisibleFunction - uiObject.configEditor.initialize() - uiObject.configEditor.container.connectToParent(uiObject.container, false, false, true, true, false, false, false, false) - - addLeftIcons(menuItemsInitialValues, floatingObject) - menuItemsInitialValues.push( - { - action: 'Configure Bot Instance', - actionFunction: uiObject.configEditor.activate, - label: 'Configure Bot Instance', - visible: true, - iconPathOn: 'html', - iconPathOff: 'html', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - 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', - askConfirmation: true, - confirmationLabel: 'Confirm to Delete', - actionFunction: payload.onMenuItemClick, - label: 'Delete Indicator Bot Instance', - 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: 45 - } - ) - break - } - case 'Trading Bot Instance': { - uiObject.configEditor = newConfigEditor() - uiObject.configEditor.isVisibleFunction = uiObject.isVisibleFunction - uiObject.configEditor.initialize() - uiObject.configEditor.container.connectToParent(uiObject.container, false, false, true, true, false, false, false, false) - - addLeftIcons(menuItemsInitialValues, floatingObject) - menuItemsInitialValues.push( - { - action: 'Configure Bot Instance', - actionFunction: uiObject.configEditor.activate, - label: 'Configure Trading Bot Instance', - visible: true, - iconPathOn: 'html', - iconPathOff: 'html', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - 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', - askConfirmation: true, - confirmationLabel: 'Confirm to Delete', - actionFunction: payload.onMenuItemClick, - label: 'Delete Trading Bot Instance', - 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: 45 - } - ) - break - } - case 'Process Instance': { - uiObject.configEditor = newConfigEditor() - uiObject.configEditor.isVisibleFunction = uiObject.isVisibleFunction - uiObject.configEditor.initialize() - uiObject.configEditor.container.connectToParent(uiObject.container, false, false, true, true, false, false, false, false) - - addLeftIcons(menuItemsInitialValues, floatingObject) - - switch (payload.node.subType) { - case 'Trading Process Instance': { - menuItemsInitialValues.push( - { - action: 'Add Backtesting Session', - disableIfPropertyIsDefined: true, - propertyToCheckFor: 'session', - actionFunction: payload.onMenuItemClick, - label: 'Add Backtesting', - visible: true, - relatedUiObject: 'Backtesting Session', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -75 - } - ) - menuItemsInitialValues.push( - { - action: 'Add Live Trading Session', - disableIfPropertyIsDefined: true, - propertyToCheckFor: 'session', - actionFunction: payload.onMenuItemClick, - label: 'Add Live Trading', - visible: true, - relatedUiObject: 'Live Trading Session', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -40 - } - ) - menuItemsInitialValues.push( - { - action: 'Add Fordward Testing Session', - disableIfPropertyIsDefined: true, - propertyToCheckFor: 'session', - actionFunction: payload.onMenuItemClick, - label: 'Add Fordward Testing', - visible: true, - relatedUiObject: 'Fordward Testing Session', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -20 - } - ) - menuItemsInitialValues.push( - { - action: 'Add Paper Trading Session', - disableIfPropertyIsDefined: true, - propertyToCheckFor: 'session', - actionFunction: payload.onMenuItemClick, - label: 'Add Paper Trading', - visible: true, - relatedUiObject: 'Paper Trading Session', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: 0 - } - ) - menuItemsInitialValues.push( - { - action: 'Configure Process Instance', - actionFunction: uiObject.configEditor.activate, - label: 'Configure Process Instance', - visible: true, - iconPathOn: 'html', - iconPathOff: 'html', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: 20, - dontShowAtFullscreen: true - } - ) - menuItemsInitialValues.push( - { - action: 'Delete Process Instance', - askConfirmation: true, - confirmationLabel: 'Confirm to Delete', - actionFunction: payload.onMenuItemClick, - label: 'Delete Process Instance', - 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 - } - default: { - menuItemsInitialValues.push( - { - action: 'Configure Process Instance', - actionFunction: uiObject.configEditor.activate, - label: 'Configure Process Instance', - visible: true, - iconPathOn: 'html', - iconPathOff: 'html', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -40, - dontShowAtFullscreen: true - } - ) - menuItemsInitialValues.push( - { - action: 'Delete Process Instance', - askConfirmation: true, - confirmationLabel: 'Confirm to Delete', - actionFunction: payload.onMenuItemClick, - label: 'Delete Process Instance', - 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 - } + let nodeDefinition = APP_SCHEMA_MAP.get(payload.node.type) + if (nodeDefinition !== undefined) { + if (nodeDefinition.editors !== undefined) { + if (nodeDefinition.editors.config === true) { + uiObject.configEditor = newConfigEditor() + uiObject.configEditor.isVisibleFunction = uiObject.isVisibleFunction + uiObject.configEditor.initialize() + uiObject.configEditor.container.connectToParent(uiObject.container, false, false, true, true, false, false, false, false) } - break - } - case 'Backtesting Session': { - uiObject.configEditor = newConfigEditor() - uiObject.configEditor.isVisibleFunction = uiObject.isVisibleFunction - uiObject.configEditor.initialize() - uiObject.configEditor.container.connectToParent(uiObject.container, false, false, true, true, false, false, false, false) - - addLeftIcons(menuItemsInitialValues, floatingObject) - menuItemsInitialValues.push( - { - action: 'Run Session', - actionFunction: payload.onMenuItemClick, - label: 'Run', - workingLabel: 'Run Request Sent', - workDoneLabel: 'Session Running', - workFailedLabel: 'Session Cannot be Run', - secondaryAction: 'Stop Session', - secondaryLabel: 'Stop', - secondaryWorkingLabel: 'Stopping...', - secondaryWorkDoneLabel: 'Session Stopped', - secondaryWorkFailedLabel: 'Session Cannot be Stopped', - secondaryIcon: 'stop', - visible: true, - iconPathOn: 'paper-plane', - iconPathOff: 'paper-plane', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -75 - } - ) - menuItemsInitialValues.push( - { - action: 'Add Layer Manager', - disableIfPropertyIsDefined: true, - propertyToCheckFor: 'layerManager', - actionFunction: payload.onMenuItemClick, - label: 'Add Layer Manager', - visible: true, - relatedUiObject: 'Layer Manager', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -40 - } - ) - menuItemsInitialValues.push( - { - action: 'Add Parameters', - disableIfPropertyIsDefined: true, - propertyToCheckFor: 'parameters', - actionFunction: payload.onMenuItemClick, - label: 'Add Parameters', - visible: true, - relatedUiObject: 'Parameters', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -20 - } - ) - menuItemsInitialValues.push( - { - action: 'Add Social Bots', - disableIfPropertyIsDefined: true, - propertyToCheckFor: 'socialBots', - actionFunction: payload.onMenuItemClick, - label: 'Add Social Bots', - visible: true, - relatedUiObject: 'Social Bots', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: 0 - } - ) - menuItemsInitialValues.push( - { - action: 'Configure Session', - actionFunction: uiObject.configEditor.activate, - label: 'Configure Session', - visible: true, - iconPathOn: 'html', - iconPathOff: 'html', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: 20, - dontShowAtFullscreen: true - } - ) - menuItemsInitialValues.push( - { - action: 'Delete Backtesting Session', - askConfirmation: true, - confirmationLabel: 'Confirm to Delete', - actionFunction: payload.onMenuItemClick, - label: 'Delete Session', - 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 'Live Trading Session': { - uiObject.configEditor = newConfigEditor() - uiObject.configEditor.isVisibleFunction = uiObject.isVisibleFunction - uiObject.configEditor.initialize() - uiObject.configEditor.container.connectToParent(uiObject.container, false, false, true, true, false, false, false, false) - - addLeftIcons(menuItemsInitialValues, floatingObject) - menuItemsInitialValues.push( - { - action: 'Run Session', - actionFunction: payload.onMenuItemClick, - label: 'Run', - workingLabel: 'Run Request Sent', - workDoneLabel: 'Session Running', - workFailedLabel: 'Session Cannot be Run', - secondaryAction: 'Stop Session', - secondaryLabel: 'Stop', - secondaryWorkingLabel: 'Stopping...', - secondaryWorkDoneLabel: 'Session Stopped', - secondaryWorkFailedLabel: 'Session Cannot be Stopped', - secondaryIcon: 'stop', - visible: true, - iconPathOn: 'paper-plane', - iconPathOff: 'paper-plane', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -75 - } - ) - menuItemsInitialValues.push( - { - action: 'Add Layer Manager', - disableIfPropertyIsDefined: true, - propertyToCheckFor: 'layerManager', - actionFunction: payload.onMenuItemClick, - label: 'Add Layer Manager', - visible: true, - relatedUiObject: 'Layer Manager', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -40 - } - ) - menuItemsInitialValues.push( - { - action: 'Add Parameters', - disableIfPropertyIsDefined: true, - propertyToCheckFor: 'parameters', - actionFunction: payload.onMenuItemClick, - label: 'Add Parameters', - visible: true, - relatedUiObject: 'Parameters', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -20 - } - ) - menuItemsInitialValues.push( - { - action: 'Add Social Bots', - disableIfPropertyIsDefined: true, - propertyToCheckFor: 'socialBots', - actionFunction: payload.onMenuItemClick, - label: 'Add Social Bots', - visible: true, - relatedUiObject: 'Social Bots', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: 0 - } - ) - menuItemsInitialValues.push( - { - action: 'Configure Session', - actionFunction: uiObject.configEditor.activate, - label: 'Configure Session', - visible: true, - iconPathOn: 'html', - iconPathOff: 'html', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: 20, - dontShowAtFullscreen: true - } - ) - menuItemsInitialValues.push( - { - action: 'Delete Live Trading Session', - askConfirmation: true, - confirmationLabel: 'Confirm to Delete', - actionFunction: payload.onMenuItemClick, - label: 'Delete Session', - 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 'Fordward Testing Session': { - uiObject.configEditor = newConfigEditor() - uiObject.configEditor.isVisibleFunction = uiObject.isVisibleFunction - uiObject.configEditor.initialize() - uiObject.configEditor.container.connectToParent(uiObject.container, false, false, true, true, false, false, false, false) - - addLeftIcons(menuItemsInitialValues, floatingObject) - menuItemsInitialValues.push( - { - action: 'Run Session', - actionFunction: payload.onMenuItemClick, - label: 'Run', - workingLabel: 'Run Request Sent', - workDoneLabel: 'Session Running', - workFailedLabel: 'Session Cannot be Run', - secondaryAction: 'Stop Session', - secondaryLabel: 'Stop', - secondaryWorkingLabel: 'Stopping...', - secondaryWorkDoneLabel: 'Session Stopped', - secondaryWorkFailedLabel: 'Session Cannot be Stopped', - secondaryIcon: 'stop', - visible: true, - iconPathOn: 'paper-plane', - iconPathOff: 'paper-plane', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -75 - } - ) - menuItemsInitialValues.push( - { - action: 'Add Layer Manager', - disableIfPropertyIsDefined: true, - propertyToCheckFor: 'layerManager', - actionFunction: payload.onMenuItemClick, - label: 'Add Layer Manager', - visible: true, - relatedUiObject: 'Layer Manager', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -40 - } - ) - menuItemsInitialValues.push( - { - action: 'Add Parameters', - disableIfPropertyIsDefined: true, - propertyToCheckFor: 'parameters', - actionFunction: payload.onMenuItemClick, - label: 'Add Parameters', - visible: true, - relatedUiObject: 'Parameters', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -20 - } - ) - menuItemsInitialValues.push( - { - action: 'Add Social Bots', - disableIfPropertyIsDefined: true, - propertyToCheckFor: 'socialBots', - actionFunction: payload.onMenuItemClick, - label: 'Add Social Bots', - visible: true, - relatedUiObject: 'Social Bots', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: 0 - } - ) - menuItemsInitialValues.push( - { - action: 'Configure Session', - actionFunction: uiObject.configEditor.activate, - label: 'Configure Session', - visible: true, - iconPathOn: 'html', - iconPathOff: 'html', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: 20, - dontShowAtFullscreen: true - } - ) - menuItemsInitialValues.push( - { - action: 'Delete Fordward Testing Session', - askConfirmation: true, - confirmationLabel: 'Confirm to Delete', - actionFunction: payload.onMenuItemClick, - label: 'Delete Session', - 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 'Paper Trading Session': { - uiObject.configEditor = newConfigEditor() - uiObject.configEditor.isVisibleFunction = uiObject.isVisibleFunction - uiObject.configEditor.initialize() - uiObject.configEditor.container.connectToParent(uiObject.container, false, false, true, true, false, false, false, false) - - addLeftIcons(menuItemsInitialValues, floatingObject) - menuItemsInitialValues.push( - { - action: 'Run Session', - actionFunction: payload.onMenuItemClick, - label: 'Run', - workingLabel: 'Run Request Sent', - workDoneLabel: 'Session Running', - workFailedLabel: 'Session Cannot be Run', - secondaryAction: 'Stop Session', - secondaryLabel: 'Stop', - secondaryWorkingLabel: 'Stopping...', - secondaryWorkDoneLabel: 'Session Stopped', - secondaryWorkFailedLabel: 'Session Cannot be Stopped', - secondaryIcon: 'stop', - visible: true, - iconPathOn: 'paper-plane', - iconPathOff: 'paper-plane', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -75 - } - ) - menuItemsInitialValues.push( - { - action: 'Add Layer Manager', - disableIfPropertyIsDefined: true, - propertyToCheckFor: 'layerManager', - actionFunction: payload.onMenuItemClick, - label: 'Add Layer Manager', - visible: true, - relatedUiObject: 'Layer Manager', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -40 - } - ) - menuItemsInitialValues.push( - { - action: 'Add Parameters', - disableIfPropertyIsDefined: true, - propertyToCheckFor: 'parameters', - actionFunction: payload.onMenuItemClick, - label: 'Add Parameters', - visible: true, - relatedUiObject: 'Parameters', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -20 - } - ) - menuItemsInitialValues.push( - { - action: 'Add Social Bots', - disableIfPropertyIsDefined: true, - propertyToCheckFor: 'socialBots', - actionFunction: payload.onMenuItemClick, - label: 'Add Social Bots', - visible: true, - relatedUiObject: 'Social Bots', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: 0 - } - ) - menuItemsInitialValues.push( - { - action: 'Configure Session', - actionFunction: uiObject.configEditor.activate, - label: 'Configure Session', - visible: true, - iconPathOn: 'html', - iconPathOff: 'html', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: 20, - dontShowAtFullscreen: true - } - ) - menuItemsInitialValues.push( - { - action: 'Delete Paper Trading Session', - askConfirmation: true, - confirmationLabel: 'Confirm to Delete', - actionFunction: payload.onMenuItemClick, - label: 'Delete Session', - 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 'Personal Data': { - addLeftIcons(menuItemsInitialValues, floatingObject) - menuItemsInitialValues.push( - { - action: 'Add Exchange Account', - actionFunction: payload.onMenuItemClick, - label: 'Add Exchange Account', - visible: true, - relatedUiObject: 'Exchange Account', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -20 - } - ) - menuItemsInitialValues.push( - { - action: 'Delete Personal Data', - askConfirmation: true, - confirmationLabel: 'Confirm to Delete', - actionFunction: payload.onMenuItemClick, - label: 'Delete Personal Data', - visible: true, - iconPathOn: 'delete', - iconPathOff: 'delete', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: +20 - } - ) - break - } - case 'Exchange Account': { - addLeftIcons(menuItemsInitialValues, floatingObject) - menuItemsInitialValues.push( - { - action: 'Add Exchange Account Asset', - actionFunction: payload.onMenuItemClick, - label: 'Add Asset', - visible: true, - relatedUiObject: 'Exchange Account Asset', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -40 - } - ) - menuItemsInitialValues.push( - { - action: 'Add Exchange Account Key', - actionFunction: payload.onMenuItemClick, - label: 'Add Key', - visible: true, - relatedUiObject: 'Exchange Account Key', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: 0 - } - ) - menuItemsInitialValues.push( - { - action: 'Delete Exchange Account', - askConfirmation: true, - confirmationLabel: 'Confirm to Delete', - actionFunction: payload.onMenuItemClick, - label: 'Delete This Account', - visible: true, - iconPathOn: 'delete', - iconPathOff: 'delete', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: 40 - } - ) - break - } - case 'Exchange Account Asset': { - addLeftIcons(menuItemsInitialValues, floatingObject) - menuItemsInitialValues.push( - { - action: 'Delete Exchange Account Asset', - askConfirmation: true, - confirmationLabel: 'Confirm to Delete', - actionFunction: payload.onMenuItemClick, - label: 'Delete This Asset', - visible: true, - iconPathOn: 'delete', - iconPathOff: 'delete', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: 0 - } - ) - break - } - case 'Exchange Account Key': { - uiObject.configEditor = newConfigEditor() - uiObject.configEditor.isVisibleFunction = uiObject.isVisibleFunction - uiObject.configEditor.initialize() - uiObject.configEditor.container.connectToParent(uiObject.container, false, false, true, true, false, false, false, false) - - addLeftIcons(menuItemsInitialValues, floatingObject) - menuItemsInitialValues.push( - { - action: 'Configure Key Value', - actionFunction: uiObject.configEditor.activate, - label: 'Configure Key Value', - visible: true, - iconPathOn: 'html', - iconPathOff: 'html', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -20, - dontShowAtFullscreen: true - } - ) - menuItemsInitialValues.push( - { - action: 'Delete Exchange Account Key', - askConfirmation: true, - confirmationLabel: 'Confirm to Delete', - actionFunction: payload.onMenuItemClick, - label: 'Delete This Key', - visible: true, - iconPathOn: 'delete', - iconPathOff: 'delete', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: 20 - } - ) - break - } - case 'Trading System': { - addLeftIcons(menuItemsInitialValues, floatingObject) - menuItemsInitialValues.push( - { - action: 'Add Strategy', - actionFunction: payload.onMenuItemClick, - label: 'Add Strategy', - visible: true, - relatedUiObject: 'Strategy', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -60 - } - ) - menuItemsInitialValues.push( - { - action: 'Add Parameters', - disableIfPropertyIsDefined: true, - propertyToCheckFor: 'parameters', - actionFunction: payload.onMenuItemClick, - label: 'Add Parameters', - visible: true, - relatedUiObject: 'Parameters', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -20 - } - ) - menuItemsInitialValues.push( - { - action: 'Delete Trading System', - askConfirmation: true, - confirmationLabel: 'Confirm to Delete', - actionFunction: payload.onMenuItemClick, - label: 'Delete Trading System', - 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 'Parameters': { - addLeftIcons(menuItemsInitialValues, floatingObject) - menuItemsInitialValues.push( - { - action: 'Add Missing Parameters', - actionFunction: payload.onMenuItemClick, - label: 'Add Missing Params', - visible: true, - relatedUiObject: 'Parameters', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -40 - } - ) - menuItemsInitialValues.push( - { - action: 'Delete Parameters', - askConfirmation: true, - confirmationLabel: 'Confirm to Delete', - actionFunction: payload.onMenuItemClick, - label: 'Delete Parameters', - 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 'Base Asset': { - uiObject.configEditor = newConfigEditor() - uiObject.configEditor.isVisibleFunction = uiObject.isVisibleFunction - uiObject.configEditor.initialize() - uiObject.configEditor.container.connectToParent(uiObject.container, false, false, true, true, false, false, false, false) - - addLeftIcons(menuItemsInitialValues, floatingObject) - menuItemsInitialValues.push( - { - action: 'Configure Base Asset', - actionFunction: uiObject.configEditor.activate, - label: 'Configure Base Asset', - visible: true, - iconPathOn: 'settings', - iconPathOff: 'settings', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -40 - } - ) - menuItemsInitialValues.push( - { - action: 'Delete Base Asset', - askConfirmation: true, - confirmationLabel: 'Confirm to Delete', - actionFunction: payload.onMenuItemClick, - label: 'Delete Base Asset', - 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 'Time Range': { - uiObject.configEditor = newConfigEditor() - uiObject.configEditor.isVisibleFunction = uiObject.isVisibleFunction - uiObject.configEditor.initialize() - uiObject.configEditor.container.connectToParent(uiObject.container, false, false, true, true, false, false, false, false) - - addLeftIcons(menuItemsInitialValues, floatingObject) - menuItemsInitialValues.push( - { - action: 'Configure Time Range', - actionFunction: uiObject.configEditor.activate, - label: 'Configure Time Range', - visible: true, - iconPathOn: 'settings', - iconPathOff: 'settings', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -40 - } - ) - menuItemsInitialValues.push( - { - action: 'Delete Time Range', - askConfirmation: true, - confirmationLabel: 'Confirm to Delete', - actionFunction: payload.onMenuItemClick, - label: 'Delete Time Range', - 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 'Time Period': { - uiObject.configEditor = newConfigEditor() - uiObject.configEditor.isVisibleFunction = uiObject.isVisibleFunction - uiObject.configEditor.initialize() - uiObject.configEditor.container.connectToParent(uiObject.container, false, false, true, true, false, false, false, false) - - addLeftIcons(menuItemsInitialValues, floatingObject) - menuItemsInitialValues.push( - { - action: 'Configure Time Period', - actionFunction: uiObject.configEditor.activate, - label: 'Configure Time Period', - visible: true, - iconPathOn: 'settings', - iconPathOff: 'settings', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -40 - } - ) - menuItemsInitialValues.push( - { - action: 'Delete Time Period', - askConfirmation: true, - confirmationLabel: 'Confirm to Delete', - actionFunction: payload.onMenuItemClick, - label: 'Delete Time Period', - 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 'Slippage': { - uiObject.configEditor = newConfigEditor() - uiObject.configEditor.isVisibleFunction = uiObject.isVisibleFunction - uiObject.configEditor.initialize() - uiObject.configEditor.container.connectToParent(uiObject.container, false, false, true, true, false, false, false, false) - - addLeftIcons(menuItemsInitialValues, floatingObject) - menuItemsInitialValues.push( - { - action: 'Configure Slippage', - actionFunction: uiObject.configEditor.activate, - label: 'Configure Slippage', - visible: true, - iconPathOn: 'settings', - iconPathOff: 'settings', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -40 - } - ) - menuItemsInitialValues.push( - { - action: 'Delete Slippage', - askConfirmation: true, - confirmationLabel: 'Confirm to Delete', - actionFunction: payload.onMenuItemClick, - label: 'Delete Slippage', - 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 'Fee Structure': { - uiObject.configEditor = newConfigEditor() - uiObject.configEditor.isVisibleFunction = uiObject.isVisibleFunction - uiObject.configEditor.initialize() - uiObject.configEditor.container.connectToParent(uiObject.container, false, false, true, true, false, false, false, false) - - addLeftIcons(menuItemsInitialValues, floatingObject) - menuItemsInitialValues.push( - { - action: 'Configure Fee Structure', - actionFunction: uiObject.configEditor.activate, - label: 'Configure Fee Structure', - visible: true, - iconPathOn: 'settings', - iconPathOff: 'settings', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -40 - } - ) - menuItemsInitialValues.push( - { - action: 'Delete Fee Structure', - askConfirmation: true, - confirmationLabel: 'Confirm to Delete', - actionFunction: payload.onMenuItemClick, - label: 'Delete Fee Structure', - 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 'Strategy': { - addLeftIcons(menuItemsInitialValues, floatingObject) - menuItemsInitialValues.push( - { - action: 'Add Missing Stages', - actionFunction: payload.onMenuItemClick, - label: 'Add Missing Stages', - visible: true, - relatedUiObject: 'Strategy', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -40 - } - ) - menuItemsInitialValues.push( - { - action: 'Delete Strategy', - askConfirmation: true, - confirmationLabel: 'Confirm to Delete', - actionFunction: payload.onMenuItemClick, - label: 'Delete This Strategy', - 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 'Trigger Stage': { - addLeftIcons(menuItemsInitialValues, floatingObject) - menuItemsInitialValues.push( - { - action: 'Add Missing Events', - actionFunction: payload.onMenuItemClick, - label: 'Add Missing Events', - visible: true, - relatedUiObject: 'Trigger Stage', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -40 - } - ) - menuItemsInitialValues.push( - { - action: 'Delete Trigger Stage', - askConfirmation: true, - confirmationLabel: 'Confirm to Delete', - actionFunction: payload.onMenuItemClick, - label: 'Delete This Stage', - 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 'Open Stage': { - addLeftIcons(menuItemsInitialValues, floatingObject) - menuItemsInitialValues.push( - { - action: 'Add Initial Definition', - disableIfPropertyIsDefined: true, - propertyToCheckFor: 'initialDefinition', - actionFunction: payload.onMenuItemClick, - label: 'Add Initial Definition', - visible: true, - relatedUiObject: 'Initial Definition', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -60 - } - ) - menuItemsInitialValues.push( - { - action: 'Add Open Execution', - disableIfPropertyIsDefined: true, - propertyToCheckFor: 'openExecution', - actionFunction: payload.onMenuItemClick, - label: 'Add Open Execution', - visible: true, - relatedUiObject: 'Open Execution', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -20 - } - ) - menuItemsInitialValues.push( - { - action: 'Delete Open Stage', - askConfirmation: true, - confirmationLabel: 'Confirm to Delete', - actionFunction: payload.onMenuItemClick, - label: 'Delete This Stage', - 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 'Manage Stage': { - addLeftIcons(menuItemsInitialValues, floatingObject) - menuItemsInitialValues.push( - { - action: 'Add Missing Items', - actionFunction: payload.onMenuItemClick, - label: 'Add Missing Items', - visible: true, - relatedUiObject: 'Manage Stage', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -40 - } - ) - menuItemsInitialValues.push( - { - action: 'Delete Manage Stage', - askConfirmation: true, - confirmationLabel: 'Confirm to Delete', - actionFunction: payload.onMenuItemClick, - label: 'Delete This Stage', - 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 'Close Stage': { - addLeftIcons(menuItemsInitialValues, floatingObject) - menuItemsInitialValues.push( - { - action: 'Add Close Execution', - disableIfPropertyIsDefined: true, - propertyToCheckFor: 'closeExecution', - actionFunction: payload.onMenuItemClick, - label: 'Add Close Execution', - visible: true, - relatedUiObject: 'Close Execution', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -40 - } - ) - menuItemsInitialValues.push( - { - action: 'Delete Close Stage', - askConfirmation: true, - confirmationLabel: 'Confirm to Delete', - actionFunction: payload.onMenuItemClick, - label: 'Delete This Stage', - 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 'Position Size': { - addLeftIcons(menuItemsInitialValues, floatingObject) - menuItemsInitialValues.push( - { - action: 'Add Formula', - disableIfPropertyIsDefined: true, - propertyToCheckFor: 'formula', - actionFunction: payload.onMenuItemClick, - label: 'Add Formula', - visible: true, - relatedUiObject: 'Formula', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -40 - } - ) - menuItemsInitialValues.push( - { - action: 'Delete Position Size', - askConfirmation: true, - confirmationLabel: 'Confirm to Delete', - actionFunction: payload.onMenuItemClick, - label: 'Delete Position Size', - 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 'Position Rate': { - addLeftIcons(menuItemsInitialValues, floatingObject) - menuItemsInitialValues.push( - { - action: 'Add Formula', - disableIfPropertyIsDefined: true, - propertyToCheckFor: 'formula', - actionFunction: payload.onMenuItemClick, - label: 'Add Formula', - visible: true, - relatedUiObject: 'Formula', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -40 - } - ) - menuItemsInitialValues.push( - { - action: 'Delete Position Rate', - askConfirmation: true, - confirmationLabel: 'Confirm to Delete', - actionFunction: payload.onMenuItemClick, - label: 'Delete Position Rate', - 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 'Trigger On Event': { - addLeftIcons(menuItemsInitialValues, floatingObject) - menuItemsInitialValues.push( - { - action: 'Add Situation', - actionFunction: payload.onMenuItemClick, - label: 'Add Situation', - visible: true, - relatedUiObject: 'Situation', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -40 - } - ) - menuItemsInitialValues.push( - { - action: 'Delete Event', - askConfirmation: true, - confirmationLabel: 'Confirm to Delete', - actionFunction: payload.onMenuItemClick, - label: 'Delete This Event', - 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 'Trigger Off Event': { - addLeftIcons(menuItemsInitialValues, floatingObject) - menuItemsInitialValues.push( - { - action: 'Add Situation', - actionFunction: payload.onMenuItemClick, - label: 'Add Situation', - visible: true, - relatedUiObject: 'Situation', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -40 - } - ) - menuItemsInitialValues.push( - { - action: 'Delete Event', - askConfirmation: true, - confirmationLabel: 'Confirm to Delete', - actionFunction: payload.onMenuItemClick, - label: 'Delete This Event', - 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 'Take Position Event': { - addLeftIcons(menuItemsInitialValues, floatingObject) - menuItemsInitialValues.push( - { - action: 'Add Situation', - actionFunction: payload.onMenuItemClick, - label: 'Add Situation', - visible: true, - relatedUiObject: 'Situation', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -40 - } - ) - menuItemsInitialValues.push( - { - action: 'Delete Event', - askConfirmation: true, - confirmationLabel: 'Confirm to Delete', - actionFunction: payload.onMenuItemClick, - label: 'Delete This Event', - 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 'Initial Definition': { - addLeftIcons(menuItemsInitialValues, floatingObject) - menuItemsInitialValues.push( - { - action: 'Add Missing Items', - actionFunction: payload.onMenuItemClick, - label: 'Add Missing Items', - visible: true, - relatedUiObject: 'Initial Definition', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -40 - } - ) - menuItemsInitialValues.push( - { - action: 'Delete Initial Definition', - askConfirmation: true, - confirmationLabel: 'Confirm to Delete', - actionFunction: payload.onMenuItemClick, - label: 'Delete This 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 'Open Execution': { - addLeftIcons(menuItemsInitialValues, floatingObject) - menuItemsInitialValues.push( - { - action: 'Delete Open Execution', - askConfirmation: true, - confirmationLabel: 'Confirm to Delete', - actionFunction: payload.onMenuItemClick, - label: 'Delete This', - 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 'Close Execution': { - addLeftIcons(menuItemsInitialValues, floatingObject) - menuItemsInitialValues.push( - { - action: 'Delete Close Execution', - askConfirmation: true, - confirmationLabel: 'Confirm to Delete', - actionFunction: payload.onMenuItemClick, - label: 'Delete This', - 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 'Stop': { - addLeftIcons(menuItemsInitialValues, floatingObject) - menuItemsInitialValues.push( - { - action: 'Add Phase', - actionFunction: payload.onMenuItemClick, - label: 'Add Phase', - visible: true, - relatedUiObject: 'Phase', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -40 - } - ) - menuItemsInitialValues.push( - { - action: 'Delete Managed Item', - askConfirmation: true, - confirmationLabel: 'Confirm to Delete', - actionFunction: payload.onMenuItemClick, - label: 'Delete This Item', - 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 'Take Profit': { - addLeftIcons(menuItemsInitialValues, floatingObject) - menuItemsInitialValues.push( - { - action: 'Add Phase', - actionFunction: payload.onMenuItemClick, - label: 'Add Phase', - visible: true, - relatedUiObject: 'Phase', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -40 - } - ) - menuItemsInitialValues.push( - { - action: 'Delete Managed Item', - askConfirmation: true, - confirmationLabel: 'Confirm to Delete', - actionFunction: payload.onMenuItemClick, - label: 'Delete This Item', - 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 'Phase': { - addLeftIcons(menuItemsInitialValues, floatingObject) - menuItemsInitialValues.push( - { - action: 'Add Formula', - disableIfPropertyIsDefined: true, - propertyToCheckFor: 'formula', - actionFunction: payload.onMenuItemClick, - label: 'Add Formula', - visible: true, - relatedUiObject: 'Formula', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -60 - } - ) - menuItemsInitialValues.push( - { - action: 'Add Next Phase Event', - disableIfPropertyIsDefined: true, - propertyToCheckFor: 'nextPhaseEvent', - actionFunction: payload.onMenuItemClick, - label: 'Add Next Phase Event', - visible: true, - relatedUiObject: 'Next Phase Event', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -20 - } - ) - menuItemsInitialValues.push( - { - action: 'Delete Phase', - askConfirmation: true, - confirmationLabel: 'Confirm to Delete', - actionFunction: payload.onMenuItemClick, - label: 'Delete This Phase', - 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 'Formula': { - uiObject.formulaEditor = newFormulaEditor() - uiObject.formulaEditor.isVisibleFunction = uiObject.isVisibleFunction - uiObject.formulaEditor.initialize() - uiObject.formulaEditor.container.connectToParent(uiObject.container, false, false, true, true, false, false, false, false) - - addLeftIcons(menuItemsInitialValues, floatingObject) - menuItemsInitialValues.push( - { - action: 'Edit Formula', - actionFunction: uiObject.formulaEditor.activate, - label: 'Edit Formula', - visible: true, - iconPathOn: 'html', - iconPathOff: 'html', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -40, - dontShowAtFullscreen: true - } - ) - menuItemsInitialValues.push( - { - action: 'Delete Formula', - askConfirmation: true, - confirmationLabel: 'Confirm to Delete', - actionFunction: payload.onMenuItemClick, - label: 'Delete This Formula', - 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 'Next Phase Event': { - addLeftIcons(menuItemsInitialValues, floatingObject) - menuItemsInitialValues.push( - { - action: 'Add Situation', - actionFunction: payload.onMenuItemClick, - label: 'Add Situation', - visible: true, - relatedUiObject: 'Situation', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -40 - } - ) - menuItemsInitialValues.push( - { - action: 'Delete Event', - askConfirmation: true, - confirmationLabel: 'Confirm to Delete', - actionFunction: payload.onMenuItemClick, - label: 'Delete This Event', - 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 'Situation': { - addLeftIcons(menuItemsInitialValues, floatingObject) - menuItemsInitialValues.push( - { - action: 'Add Condition', - actionFunction: payload.onMenuItemClick, - label: 'Add Condition', - visible: true, - relatedUiObject: 'Condition', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -40 - } - ) - menuItemsInitialValues.push( - { - action: 'Delete Situation', - askConfirmation: true, - confirmationLabel: 'Confirm to Delete', - actionFunction: payload.onMenuItemClick, - label: 'Delete This Situation', - 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 'Condition': { - uiObject.conditionEditor = newConditionEditor() - uiObject.conditionEditor.isVisibleFunction = uiObject.isVisibleFunction - uiObject.conditionEditor.initialize() - uiObject.conditionEditor.container.connectToParent(uiObject.container, false, false, true, true, false, false, false, false) - - addLeftIcons(menuItemsInitialValues, floatingObject) - menuItemsInitialValues.push( - { - action: 'Edit Condition', - actionFunction: uiObject.conditionEditor.activate, - label: 'Edit Condition', - visible: true, - iconPathOn: 'html', - iconPathOff: 'html', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -60, - dontShowAtFullscreen: true - } - ) - menuItemsInitialValues.push( - { - action: 'Add Code', - disableIfPropertyIsDefined: true, - propertyToCheckFor: 'code', - actionFunction: payload.onMenuItemClick, - label: 'Add Code', - visible: true, - relatedUiObject: 'Javascript Code', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -20 - } - ) - menuItemsInitialValues.push( - { - action: 'Delete Condition', - askConfirmation: true, - confirmationLabel: 'Confirm to Delete', - actionFunction: payload.onMenuItemClick, - label: 'Delete This Condition', - 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 'Javascript Code': { - 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: uiObject.codeEditor.activate, - label: 'Edit Code', - visible: true, - iconPathOn: 'html', - iconPathOff: 'html', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0, - angle: -40, - dontShowAtFullscreen: true - } - ) - menuItemsInitialValues.push( - { - action: 'Delete Code', - askConfirmation: true, - confirmationLabel: 'Confirm to Delete', - actionFunction: payload.onMenuItemClick, - label: 'Delete This Code', - 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 - } - default: { - let nodeDefinition = APP_SCHEMA_MAP.get(payload.node.type) - if (nodeDefinition !== undefined) { - if (nodeDefinition.editors !== undefined) { - if (nodeDefinition.editors.config === true) { - uiObject.configEditor = newConfigEditor() - uiObject.configEditor.isVisibleFunction = uiObject.isVisibleFunction - uiObject.configEditor.initialize() - uiObject.configEditor.container.connectToParent(uiObject.container, false, false, true, true, false, false, false, false) - } - if (nodeDefinition.editors.code === true) { - 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) - } - if (nodeDefinition.editors.formula === true) { - uiObject.formulaEditor = newFormulaEditor() - uiObject.formulaEditor.isVisibleFunction = uiObject.isVisibleFunction - uiObject.formulaEditor.initialize() - uiObject.formulaEditor.container.connectToParent(uiObject.container, false, false, true, true, false, false, false, false) - } - if (nodeDefinition.editors.condition === true) { - uiObject.conditionEditor = newConditionEditor() - uiObject.conditionEditor.isVisibleFunction = uiObject.isVisibleFunction - uiObject.conditionEditor.initialize() - uiObject.conditionEditor.container.connectToParent(uiObject.container, false, false, true, true, false, false, false, false) - } - } - - addLeftIcons(menuItemsInitialValues, floatingObject) - for (let i = 0; i < nodeDefinition.menuItems.length; i++) { - let menutItemDefinition = nodeDefinition.menuItems[i] - let newMenuItem = JSON.parse(JSON.stringify(menutItemDefinition)) - - /* We need to reference the real function based on its name */ - if (menutItemDefinition.actionFunction !== undefined) { - newMenuItem.actionFunction = eval(menutItemDefinition.actionFunction) - } - menuItemsInitialValues.push(newMenuItem) - } - } else { - if (ERROR_LOG === true) { logger.write('[ERROR] getMenuItemsInitialValues -> UI Object Type not Recognized -> type = ' + payload.node.type) } + if (nodeDefinition.editors.code === true) { + 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) + } + if (nodeDefinition.editors.formula === true) { + uiObject.formulaEditor = newFormulaEditor() + uiObject.formulaEditor.isVisibleFunction = uiObject.isVisibleFunction + uiObject.formulaEditor.initialize() + uiObject.formulaEditor.container.connectToParent(uiObject.container, false, false, true, true, false, false, false, false) + } + if (nodeDefinition.editors.condition === true) { + uiObject.conditionEditor = newConditionEditor() + uiObject.conditionEditor.isVisibleFunction = uiObject.isVisibleFunction + uiObject.conditionEditor.initialize() + uiObject.conditionEditor.container.connectToParent(uiObject.container, false, false, true, true, false, false, false, false) } } + if (nodeDefinition.addLeftIcons === true) { + addLeftIcons(menuItemsInitialValues, floatingObject) + } + if (nodeDefinition.isPinned === true) { + floatingObject.isPinned = true + } + if (nodeDefinition.positionLocked === true) { + floatingObject.positionLocked = true + } + + for (let i = 0; i < nodeDefinition.menuItems.length; i++) { + let menutItemDefinition = nodeDefinition.menuItems[i] + let newMenuItem = JSON.parse(JSON.stringify(menutItemDefinition)) + + /* We need to reference the real function based on its name */ + if (menutItemDefinition.actionFunction !== undefined) { + newMenuItem.actionFunction = eval(menutItemDefinition.actionFunction) + } + menuItemsInitialValues.push(newMenuItem) + } + } else { + if (ERROR_LOG === true) { logger.write('[ERROR] getMenuItemsInitialValues -> UI Object Type not Recognized -> type = ' + payload.node.type) } } return menuItemsInitialValues From 78dd9423949d7368c61374f8e85993a8d40f7478 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 16 Dec 2019 13:48:17 +0100 Subject: [PATCH 51/72] level at the app schema --- FloatingSpace/UiObjectConstructor.js | 293 +-------------------------- 1 file changed, 1 insertion(+), 292 deletions(-) diff --git a/FloatingSpace/UiObjectConstructor.js b/FloatingSpace/UiObjectConstructor.js index 64c6aec2d..dcbced3b2 100644 --- a/FloatingSpace/UiObjectConstructor.js +++ b/FloatingSpace/UiObjectConstructor.js @@ -252,298 +252,7 @@ function newUiObjectConstructor () { level_0() break } - case 'Definition': { - 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 'Process Output': { - level_3() - break - } - case 'Process Dependencies': { - level_3() - break - } - case 'Status Report': { - level_3() - break - } - case 'Execution Started Event': { - level_3() - break - } - case 'Execution Finished Event': { - level_3() - 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 'Network': { - level_1() - break - } - case 'Network Node': { - level_1() - break - } - case 'Social Bots': { - level_3() - break - } - case 'Telegram Bot': { - level_2() - break - } - case 'Announcement': { - level_4() - break - } - case 'Layer Manager': { - level_3() - break - } - case 'Layer': { - level_4() - break - } - case 'Task Manager': { - level_1() - break - } - case 'Task': { - level_3() - break - } - case 'Sensor Bot Instance': { - level_3() - break - } - case 'Indicator Bot Instance': { - level_3() - break - } - case 'Trading Bot Instance': { - level_3() - break - } - case 'Process Instance': { - level_2() - break - } - case 'Backtesting Session': { - level_2() - break - } - case 'Live Trading Session': { - level_2() - break - } - case 'Fordward Testing Session': { - level_2() - break - } - case 'Paper Trading Session': { - level_2() - break - } - case 'Exchange Account': { - level_1() - break - } - case 'Exchange Account Asset': { - level_3() - break - } - case 'Exchange Account Key': { - level_3() - break - } - case 'Personal Data': { - level_1() - break - } - case 'Trading System': { - level_1() - break - } - case 'Parameters': { - level_3() - break - } - case 'Base Asset': { - level_3() - break - } - case 'Time Range': { - level_3() - break - } - case 'Time Period': { - level_3() - break - } - case 'Slippage': { - level_3() - break - } - case 'Fee Structure': { - level_3() - break - } - case 'Strategy': { - level_1() - break - } - case 'Trigger Stage': { - level_2() - break - } - case 'Open Stage': { - level_2() - break - } - case 'Manage Stage': { - level_2() - break - } - case 'Close Stage': { - level_2() - break - } - case 'Position Size': { - level_3() - break - } - case 'Position Rate': { - level_3() - break - } - case 'Trigger On Event': { - level_3() - break - } - case 'Trigger Off Event': { - level_3() - break - } - case 'Take Position Event': { - level_3() - break - } - case 'Initial Definition': { - level_3() - break - } - case 'Open Execution': { - level_3() - break - } - case 'Close Execution': { - level_3() - break - } - case 'Stop': { - level_3() - break - } - case 'Take Profit': { - level_3() - break - } - case 'Phase': { - level_2() - break - } - case 'Formula': { - level_5() - break - } - case 'Next Phase Event': { - level_4() - break - } - case 'Situation': { - level_4() - break - } - case 'Condition': { - level_5() - break - } - case 'Javascript Code': { - level_5() - break - } + default: { let nodeDefinition = APP_SCHEMA_MAP.get(payload.node.type) if (nodeDefinition !== undefined) { From acc4c4fe5d7b27d5a8324d28634d8c87c13ef9ff Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 16 Dec 2019 14:02:41 +0100 Subject: [PATCH 52/72] Plotter Panel Bug --- Panels/PlotterPanel.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Panels/PlotterPanel.js b/Panels/PlotterPanel.js index b8b22180c..7677a0934 100644 --- a/Panels/PlotterPanel.js +++ b/Panels/PlotterPanel.js @@ -105,8 +105,8 @@ function newPlotterPanel () { let panelData = panelNode.panelData[i] let labelText = panelData.name - let labelPosition = i * 5 + 10 - let valuePosition = i * 5 + 15 + let labelPosition = i * 10 + 10 + let valuePosition = i * 10 + 15 let value = 'No value defined.' if (panelData.dataFormula !== undefined) { From 33055ab12b536bc5bdd2089586d84e6e6c6bcc42 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 17 Dec 2019 08:58:35 +0100 Subject: [PATCH 53/72] No transparency here --- Scales/Commons.js | 2 +- Scales/TimePeriodScale.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Scales/Commons.js b/Scales/Commons.js index fa1c95fcd..6e52c9c99 100644 --- a/Scales/Commons.js +++ b/Scales/Commons.js @@ -4,7 +4,7 @@ function drawScaleDisplay (label1, label2, xExtraOffSet1, xExtraOffSet2, contain let fontSize2 = 10 const RED_LINE_HIGHT = 5 - const OPACITY = 0.75 + const OPACITY = 1 let params = { cornerRadius: 3, diff --git a/Scales/TimePeriodScale.js b/Scales/TimePeriodScale.js index 8909eeac7..a93330788 100644 --- a/Scales/TimePeriodScale.js +++ b/Scales/TimePeriodScale.js @@ -269,7 +269,7 @@ to be visible at the top of the viewPort. */ let fontSize2 = 10 const RED_LINE_HIGHT = 5 - const OPACITY = 0.75 + const OPACITY = 1 let centerPoint = { x: mouse.position.x, From a7f5a4e6630c2be94ae77a605e3c5c6f46183c41 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 17 Dec 2019 09:21:20 +0100 Subject: [PATCH 54/72] Fixing bugs on menu at schema --- FloatingSpace/UiObjectConstructor.js | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/FloatingSpace/UiObjectConstructor.js b/FloatingSpace/UiObjectConstructor.js index dcbced3b2..2ac33c0dd 100644 --- a/FloatingSpace/UiObjectConstructor.js +++ b/FloatingSpace/UiObjectConstructor.js @@ -81,8 +81,28 @@ function newUiObjectConstructor () { if (item.action.indexOf('Delete ') >= 0) { // item.action = 'Delete UI Object' } + if (item.action.indexOf('Configure ') >= 0) { + if (schemaNode.editors.config === true) { + // item.actionFunction = 'uiObject.configEditor.activate' + } + } + if (item.action.indexOf('Edit ') >= 0) { + if (schemaNode.editors.condition === true) { + // item.actionFunction = 'uiObject.conditionEditor.activate' + } + } + if (item.action.indexOf('Edit ') >= 0) { + if (schemaNode.editors.formula === true) { + // item.actionFunction = 'uiObject.formulaEditor.activate' + } + } + if (item.action.indexOf('Edit ') >= 0) { + if (schemaNode.editors.code === true) { + // item.actionFunction = 'uiObject.codeEditor.activate' + } + } if (item.actionFunction === undefined) { - item.actionFunction = 'payload.onMenuItemClick' + // item.actionFunction = 'payload.onMenuItemClick' } } } From a026cfb3bbd7e8179d0c63c72a653a666f246544 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 17 Dec 2019 09:57:35 +0100 Subject: [PATCH 55/72] Panels overlapping or too short --- Dashboard.js | 2 +- Panels/PlotterPanel.js | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/Dashboard.js b/Dashboard.js index ff9e3d493..230c680bb 100644 --- a/Dashboard.js +++ b/Dashboard.js @@ -45,7 +45,7 @@ function newDashboard () { } APP_SCHEMA_MAP.set(key, nodeDefinition) } - console.log(APP_SCHEMA_MAP) + startCanvas() } diff --git a/Panels/PlotterPanel.js b/Panels/PlotterPanel.js index 7677a0934..b2d33194b 100644 --- a/Panels/PlotterPanel.js +++ b/Panels/PlotterPanel.js @@ -21,6 +21,7 @@ function newPlotterPanel () { container.frame.containerName = 'Plotter Panel' + let heightFactor = 1 let currentRecord let panelTabButton let panelNode @@ -34,8 +35,8 @@ function newPlotterPanel () { thisObject.container.frame.width = UI_PANEL.WIDTH.NORMAL thisObject.container.frame.height = UI_PANEL.HEIGHT.NORMAL - thisObject.container.frame.position.x = viewPort.visibleArea.topRight.x - thisObject.container.frame.width * 5 - thisObject.container.frame.position.y = viewPort.visibleArea.bottomLeft.y - thisObject.container.frame.height + thisObject.container.frame.position.x = viewPort.visibleArea.topRight.x - thisObject.container.frame.width - thisObject.container.frame.width * Math.random() * 8 + thisObject.container.frame.position.y = viewPort.visibleArea.bottomLeft.y - thisObject.container.frame.height - thisObject.container.frame.height * Math.random() * 1.5 panelTabButton = newPanelTabButton() panelTabButton.parentContainer = thisObject.container @@ -109,6 +110,11 @@ function newPlotterPanel () { let valuePosition = i * 10 + 15 let value = 'No value defined.' + if (valuePosition > 100) { + heightFactor = 2 + thisObject.container.frame.height = UI_PANEL.HEIGHT.NORMAL * heightFactor + } + if (panelData.dataFormula !== undefined) { try { value = eval(panelData.dataFormula.code) @@ -134,8 +140,8 @@ function newPlotterPanel () { valuePosition = panelData.code.valuePosition } - printLabel(labelText, X_AXIS, PANEL_HEIGHT * labelPosition / 100, '1') - printLabel(value, X_AXIS, PANEL_HEIGHT * valuePosition / 100, '0.50') + printLabel(labelText, X_AXIS, PANEL_HEIGHT * labelPosition / 100 / heightFactor, '1') + printLabel(value, X_AXIS, PANEL_HEIGHT * valuePosition / 100 / heightFactor, '0.50') } function printLabel (labelToPrint, x, y, opacity) { From f0ecff270d6464b2ad4c9a294e2ae5006fbe5bb8 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 17 Dec 2019 14:32:02 +0100 Subject: [PATCH 56/72] New Icons --- Spaces/DesignerSpace.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Spaces/DesignerSpace.js b/Spaces/DesignerSpace.js index b90060ad8..34c817aba 100644 --- a/Spaces/DesignerSpace.js +++ b/Spaces/DesignerSpace.js @@ -245,7 +245,9 @@ function newDesignerSpace () { 'shapes-polygon-body', 'chart-point-formula', 'style-condition', - 'shapes-polygon' + 'shapes-polygon', + 'data-entry', + 'data-formula' ] for (let i = 0; i < iconsNames.length; i++) { From 5cd22b8523114ca2c43c9cd1ae58bd400dd25624 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 17 Dec 2019 17:28:19 +0100 Subject: [PATCH 57/72] Back to the Platform --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 16ceca683..82b465066 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ The Canvas App provides a visual environment for the _Charting System_ and the _ **Installation (for developers):** To install the Canvas App, you need to install AAWeb, following [this guide](https://github.com/Superalgos/AAWeb/blob/develop/README.md). -> The workings of the Canvas App is documented in the [Superalgos Desktop App README](https://github.com/Superalgos/DesktopApp/blob/master/README.md). +> The workings of the Canvas App is documented in the [Superalgos Platform README](https://github.com/Superalgos/DesktopApp/blob/master/README.md). # Maintainer From 375dad7e1dcf3e64365e49dfe84aaa1fa3b10853 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 17 Dec 2019 17:45:33 +0100 Subject: [PATCH 58/72] More space for icons --- FloatingSpace/CircularMenuItem.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/FloatingSpace/CircularMenuItem.js b/FloatingSpace/CircularMenuItem.js index 92ff2d7c5..7d5fbac01 100644 --- a/FloatingSpace/CircularMenuItem.js +++ b/FloatingSpace/CircularMenuItem.js @@ -144,8 +144,15 @@ function newCircularMenuItem () { } } - thisObject.container.frame.position.x = thisObject.container.frame.radius * 3 / 7 * Math.cos(toRadians(thisObject.angle)) - thisObject.currentRadius * 1.5 - thisObject.container.frame.position.y = thisObject.container.frame.radius * 3 / 7 * Math.sin(toRadians(thisObject.angle)) - thisObject.container.frame.height / 2 + let radiousGrowthFactor + if (thisObject.type === 'Icon Only') { + radiousGrowthFactor = 5 + } else { + radiousGrowthFactor = 4 + } + + thisObject.container.frame.position.x = thisObject.container.frame.radius * radiousGrowthFactor / 7 * Math.cos(toRadians(thisObject.angle)) - thisObject.currentRadius * 1.5 + thisObject.container.frame.position.y = thisObject.container.frame.radius * radiousGrowthFactor / 7 * Math.sin(toRadians(thisObject.angle)) - thisObject.container.frame.height / 2 /* Temporary Status impacts on the label to use and the background of that label */ if (temporaryStatusCounter > 0) { From 932548f702c962eb95bef0ac7db85cd8b56eb93f Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 17 Dec 2019 19:24:12 +0100 Subject: [PATCH 59/72] Angles automatically generated for menu items --- FloatingSpace/CircularMenu.js | 35 ++++++++++++++++++++++++++++ FloatingSpace/UiObjectConstructor.js | 29 +++++++++++++++-------- Spaces/DesignerSpace.js | 3 ++- 3 files changed, 56 insertions(+), 11 deletions(-) diff --git a/FloatingSpace/CircularMenu.js b/FloatingSpace/CircularMenu.js index 5a63f51a4..4e3efd955 100644 --- a/FloatingSpace/CircularMenu.js +++ b/FloatingSpace/CircularMenu.js @@ -47,6 +47,9 @@ function newCircularMenu () { function initialize (menuItemsInitialValues, payload) { /* Create the array of Menu Items */ + let iconAndTextArray = [] + let iconOnlyArray = [] + for (let i = 0; i < menuItemsInitialValues.length; i++) { let menuItem = newCircularMenuItem() let menuItemInitialValue = menuItemsInitialValues[i] @@ -81,8 +84,10 @@ function newCircularMenu () { if (menuItem.label === undefined) { menuItem.type = 'Icon Only' + iconOnlyArray.push(menuItem) } else { menuItem.type = 'Icon & Text' + iconAndTextArray.push(menuItem) } menuItem.initialize(payload) @@ -90,6 +95,36 @@ function newCircularMenu () { menuItems.push(menuItem) } + /* Here we calculate the angles for each menu item, and then apply it if it was not previously defined. */ + let amplitud = 100 + let initialAngle = 230 + let step = amplitud / (iconOnlyArray.length - 1) + + for (let i = 0; i < iconOnlyArray.length; i++) { + let menuItem = iconOnlyArray[i] + let angle = initialAngle - step * i + if (menuItem.angle === undefined) { + menuItem.angle = angle + } + } + + amplitud = 140 + initialAngle = -70 + step = amplitud / 7 + let currentItem = (7 - iconAndTextArray.length) / 2 + 1 + for (let i = 0; i < iconAndTextArray.length; i++) { + let menuItem = iconAndTextArray[i] + let angle = initialAngle + step * (currentItem - 0.5) + currentItem++ + if (menuItem.angle === undefined) { + menuItem.angle = angle + } + } + + iconOnlyArray = undefined + iconAndTextArray = undefined + + /* Listen to events */ selfFocusEventSubscriptionId = thisObject.container.eventHandler.listenToEvent('onFocus', onFocus) selfNotFocuskEventSubscriptionId = thisObject.container.eventHandler.listenToEvent('onNotFocus', onNotFocus) } diff --git a/FloatingSpace/UiObjectConstructor.js b/FloatingSpace/UiObjectConstructor.js index 2ac33c0dd..0582f1756 100644 --- a/FloatingSpace/UiObjectConstructor.js +++ b/FloatingSpace/UiObjectConstructor.js @@ -75,6 +75,7 @@ function newUiObjectConstructor () { let menuItems = schemaNode.menuItems for (let j = 0; j < menuItems.length; j++) { let item = menuItems[j] + item.angle = undefined if (item.action.indexOf('Add ') >= 0) { // item.action = 'Add UI Object' } @@ -137,8 +138,7 @@ function newUiObjectConstructor () { iconPathOff: 'menu-fix-unpinned', rawRadius: 8, targetRadius: 0, - currentRadius: 0, - angle: -130 + currentRadius: 0 } ) menuItemsInitialValues.push( @@ -153,8 +153,7 @@ function newUiObjectConstructor () { iconPathOff: 'menu-tensor-free-angles', rawRadius: 8, targetRadius: 0, - currentRadius: 0, - angle: -155 + currentRadius: 0 } ) menuItemsInitialValues.push( @@ -169,8 +168,7 @@ function newUiObjectConstructor () { iconPathOff: 'menu-mobility-freeze', rawRadius: 8, targetRadius: 0, - currentRadius: 0, - angle: 180 + currentRadius: 0 } ) menuItemsInitialValues.push( @@ -185,8 +183,7 @@ function newUiObjectConstructor () { iconPathOff: 'menu-tree-minus', rawRadius: 8, targetRadius: 0, - currentRadius: 0, - angle: 155 + currentRadius: 0 } ) menuItemsInitialValues.push( @@ -199,10 +196,22 @@ function newUiObjectConstructor () { iconPathOff: 'menu-backup', rawRadius: 8, targetRadius: 0, - currentRadius: 0, - angle: 130 + currentRadius: 0 } ) + menuItemsInitialValues.push( + { + action: 'Clone', + actionFunction: floatingObject.payload.onMenuItemClick, + label: undefined, + visible: true, + iconPathOn: 'clone', + iconPathOff: 'clone', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0 + } + ) } function getMenuItemsInitialValues (uiObject, floatingObject, payload) { diff --git a/Spaces/DesignerSpace.js b/Spaces/DesignerSpace.js index 34c817aba..927444945 100644 --- a/Spaces/DesignerSpace.js +++ b/Spaces/DesignerSpace.js @@ -247,7 +247,8 @@ function newDesignerSpace () { 'style-condition', 'shapes-polygon', 'data-entry', - 'data-formula' + 'data-formula', + 'clone' ] for (let i = 0; i < iconsNames.length; i++) { From de60d72b76a2349677d1c56566c87ff48a616f48 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 17 Dec 2019 20:09:16 +0100 Subject: [PATCH 60/72] Increased icon size when selected --- FloatingSpace/CircularMenuItem.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FloatingSpace/CircularMenuItem.js b/FloatingSpace/CircularMenuItem.js index 7d5fbac01..5e9f7071b 100644 --- a/FloatingSpace/CircularMenuItem.js +++ b/FloatingSpace/CircularMenuItem.js @@ -70,7 +70,7 @@ function newCircularMenuItem () { let temporaryStatus = 0 let temporaryStatusCounter = 0 - const EXTRA_MOUSE_OVER_ICON_SIZE = 2 + const EXTRA_MOUSE_OVER_ICON_SIZE = 6 const STATUS_NO_ACTION_TAKEN_YET = 0 const STATUS_PRIMARY_ACTION_WORKING = -1 From c37d0b2c7fdaa4c5eeaa1ed319cbc15dcce0d0ae Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 17 Dec 2019 20:56:05 +0100 Subject: [PATCH 61/72] Icons from APP SCHEMA --- DesignerSpace/Workspace/Workspace.js | 33 ++++++------ Spaces/DesignerSpace.js | 77 +--------------------------- 2 files changed, 16 insertions(+), 94 deletions(-) diff --git a/DesignerSpace/Workspace/Workspace.js b/DesignerSpace/Workspace/Workspace.js index 3d6ba1a3d..26c8b91b3 100644 --- a/DesignerSpace/Workspace/Workspace.js +++ b/DesignerSpace/Workspace/Workspace.js @@ -256,16 +256,7 @@ function newWorkspace () { break case 'Share': { - 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, false, true, true, true)) - } + let text = JSON.stringify(functionLibraryProtocolNode.getProtocolNode(payload.node, true, false, true, true, true)) let nodeName = payload.node.name if (nodeName === undefined) { @@ -280,16 +271,22 @@ function newWorkspace () { break case 'Backup': { - 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)) + let text = JSON.stringify(functionLibraryProtocolNode.getProtocolNode(payload.node, false, false, true, true, true)) + + let nodeName = payload.node.name + if (nodeName === undefined) { + nodeName = '' } else { - text = JSON.stringify(functionLibraryProtocolNode.getProtocolNode(payload.node, false, false, true, true, true)) + nodeName = ' ' + nodeName } + let fileName = 'Backup - ' + payload.node.type + ' - ' + nodeName + '.json' + download(fileName, text) + } + + break + case 'Clone': + { + let text = JSON.stringify(functionLibraryProtocolNode.getProtocolNode(payload.node, false, false, true, true, true)) let nodeName = payload.node.name if (nodeName === undefined) { diff --git a/Spaces/DesignerSpace.js b/Spaces/DesignerSpace.js index 927444945..d50bd9bff 100644 --- a/Spaces/DesignerSpace.js +++ b/Spaces/DesignerSpace.js @@ -35,82 +35,7 @@ function newDesignerSpace () { } function buildIconByUiObjectTypeMap () { - const relationshipArray = [ - ['Definition', 'text'], - ['Network', 'network'], - ['Network Node', 'network-node'], - ['Social Bots', 'social-bot'], - ['Telegram Bot', 'paper-plane'], - ['Announcement', 'promotion'], - ['Layer Manager', 'layer-manager'], - ['Layer', 'attractive'], - ['Task Manager', 'task'], - ['Task', 'timeline'], - ['Sensor Bot Instance', 'bot-sensor'], - ['Indicator Bot Instance', 'bot-indicator'], - ['Trading Bot Instance', 'bot-trading'], - ['Process Instance', 'process'], - ['Backtesting Session', 'session-backtesting'], - ['Live Trading Session', 'session-live-trading'], - ['Fordward Testing Session', 'session-forward-testing'], - ['Paper Trading Session', 'session-paper-trading'], - ['Personal Data', 'security'], - ['Exchange Account', 'approve'], - ['Exchange Account Asset', 'paper-plane'], - ['Exchange Account Key', 'login'], - ['Workspace', 'design-tool'], - ['Trading System', 'analysis'], - ['Parameters', 'settings'], - ['Base Asset', 'loading'], - ['Time Range', 'schedule'], - ['Time Period', 'time-period'], - ['Slippage', 'support'], - ['Fee Structure', 'sitemap'], - ['Strategy', 'quality'], - ['Trigger Stage', 'stage-trigger'], - ['Open Stage', 'stage-open'], - ['Manage Stage', 'video-player'], - ['Close Stage', 'stage-close'], - ['Position Size', 'stage-open-position-size'], - ['Position Rate', 'stage-open-postion-rate'], - ['Trigger On Event', 'stage-trigger-trigger-on'], - ['Trigger Off Event', 'stage-trigger-trigger-off'], - ['Take Position Event', 'stage-trigger-take-position'], - ['Initial Definition', 'task'], - ['Open Execution', 'piggy-bank'], - ['Close Execution', 'piggy-bank'], - ['Stop', 'stop'], - ['Take Profit', 'stage-open-take-profit'], - ['Phase', 'placeholder'], - ['Formula', 'pipette'], - ['Next Phase Event', 'pantone'], - ['Situation', 'pyramid'], - ['Condition', 'testing'], - ['Javascript Code', 'html'], - ['Team', 'team'], - ['Sensor Bot', 'bot-sensor'], - ['Indicator Bot', 'bot-indicator'], - ['Trading Bot', 'bot-trading'], - ['Process Definition', 'process-definition'], - ['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'], - ['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', 'dataset-definition'], - ['Plotter', 'plotter'], - ['Plotter Module', 'plotter-module'] - ] + const relationshipArray = [] for (let i = 0; i < relationshipArray.length; i++) { let record = relationshipArray[i] From 1b2d5e52f84e74023a3ad328dfe2c0159964ad7a Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 17 Dec 2019 22:37:38 +0100 Subject: [PATCH 62/72] Default values at menu items --- FloatingSpace/UiObjectConstructor.js | 43 ++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/FloatingSpace/UiObjectConstructor.js b/FloatingSpace/UiObjectConstructor.js index 0582f1756..abe9a6904 100644 --- a/FloatingSpace/UiObjectConstructor.js +++ b/FloatingSpace/UiObjectConstructor.js @@ -105,6 +105,18 @@ function newUiObjectConstructor () { if (item.actionFunction === undefined) { // item.actionFunction = 'payload.onMenuItemClick' } + if (item.visible === true) { + item.visible = undefined + } + if (item.rawRadius === 8) { + item.rawRadius = undefined + } + if (item.targetRadius === 0) { + item.targetRadius = undefined + } + if (item.currentRadius === 0) { + item.currentRadius = undefined + } } } } @@ -212,6 +224,19 @@ function newUiObjectConstructor () { currentRadius: 0 } ) + menuItemsInitialValues.push( + { + action: 'XXShare', + actionFunction: floatingObject.payload.onMenuItemClick, + label: undefined, + visible: true, + iconPathOn: 'menu-share', + iconPathOff: 'menu-share', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0 + } + ) } function getMenuItemsInitialValues (uiObject, floatingObject, payload) { @@ -263,6 +288,24 @@ function newUiObjectConstructor () { if (menutItemDefinition.actionFunction !== undefined) { newMenuItem.actionFunction = eval(menutItemDefinition.actionFunction) } + + /* Adding default values */ + if (newMenuItem.visible === undefined) { + newMenuItem.visible = true + } + + if (newMenuItem.rawRadius === undefined) { + newMenuItem.rawRadius = 8 + } + + if (newMenuItem.targetRadius === undefined) { + newMenuItem.targetRadius = 0 + } + + if (newMenuItem.currentRadius === undefined) { + newMenuItem.currentRadius = 0 + } + menuItemsInitialValues.push(newMenuItem) } } else { From be2bbc8cf29942caf532b4f50c217c9391623878 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 18 Dec 2019 11:57:23 +0100 Subject: [PATCH 63/72] properties generated at APP SCHEMA --- .../FunctionLibraries/UiObjectsFromNodes.js | 83 +++++++++++++++++++ FloatingSpace/UiObjectConstructor.js | 22 ----- 2 files changed, 83 insertions(+), 22 deletions(-) diff --git a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js index 734b1517f..8a3d93a5a 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js +++ b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js @@ -110,6 +110,89 @@ function newUiObjectsFromNodes () { } function createUiObjectFromNode (node, parentNode, chainParent, positionOffset) { + /* + Object.keys(node).forEach(function (key, index) { + // key: the name of the object key + // index: the ordinal position of the key within the object + if (key !== 'savedPayload') { + if (node.type === 'Indicator Bot') { + console.log('HERE') + } + if (Array.isArray(node[key]) === false) { + if ((typeof node[key] === 'object') && (node[key] !== null)) { + // this property is an object + + for (let i = 0; i < APP_SCHEMA_ARRAY.length; i++) { + let schemaNode = APP_SCHEMA_ARRAY[i] + if (schemaNode.type === node.type) { + if (schemaNode.properties === undefined) { + schemaNode.properties = [] + } + + let properties = schemaNode.properties + let found = false + for (let j = 0; j < properties.length; j++) { + let property = properties[j] + if (property.name === key && property.childType === node[key].type) { + found = true + } + } + if (found === false) { + let newProperty = { + name: key, + type: 'node', + childType: node[key].type + } + properties.push(newProperty) + } + setPropertyNameAtParent(node[key], key) + } + } + } + } else { + let childArray = node[key] + if (childArray.length > 0) { + let childType = childArray[0].type + for (let i = 0; i < APP_SCHEMA_ARRAY.length; i++) { + let schemaNode = APP_SCHEMA_ARRAY[i] + if (schemaNode.type === node.type) { + if (schemaNode.properties === undefined) { + schemaNode.properties = [] + } + + let properties = schemaNode.properties + let found = false + for (let j = 0; j < properties.length; j++) { + let property = properties[j] + if (property.name === key && property.childType === childType) { + found = true + } + } + if (found === false) { + let newProperty = { + name: key, + type: 'array', + childType: childType + } + properties.push(newProperty) + } + setPropertyNameAtParent(childArray[0], key) + } + } + } + } + } + }) + + function setPropertyNameAtParent (node, propName) { + for (let i = 0; i < APP_SCHEMA_ARRAY.length; i++) { + let schemaNode = APP_SCHEMA_ARRAY[i] + if (schemaNode.type === node.type) { + schemaNode.propertyNameAtParent = propName + } + } + } +*/ switch (node.type) { case 'Javascript Code': { diff --git a/FloatingSpace/UiObjectConstructor.js b/FloatingSpace/UiObjectConstructor.js index abe9a6904..23d923168 100644 --- a/FloatingSpace/UiObjectConstructor.js +++ b/FloatingSpace/UiObjectConstructor.js @@ -87,16 +87,6 @@ function newUiObjectConstructor () { // item.actionFunction = 'uiObject.configEditor.activate' } } - if (item.action.indexOf('Edit ') >= 0) { - if (schemaNode.editors.condition === true) { - // item.actionFunction = 'uiObject.conditionEditor.activate' - } - } - if (item.action.indexOf('Edit ') >= 0) { - if (schemaNode.editors.formula === true) { - // item.actionFunction = 'uiObject.formulaEditor.activate' - } - } if (item.action.indexOf('Edit ') >= 0) { if (schemaNode.editors.code === true) { // item.actionFunction = 'uiObject.codeEditor.activate' @@ -105,18 +95,6 @@ function newUiObjectConstructor () { if (item.actionFunction === undefined) { // item.actionFunction = 'payload.onMenuItemClick' } - if (item.visible === true) { - item.visible = undefined - } - if (item.rawRadius === 8) { - item.rawRadius = undefined - } - if (item.targetRadius === 0) { - item.targetRadius = undefined - } - if (item.currentRadius === 0) { - item.currentRadius = undefined - } } } } From 31b074216cf1bdb0973ca974ed09bda3f72cded0 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 18 Dec 2019 13:29:41 +0100 Subject: [PATCH 64/72] Clonning Working --- .../FunctionLibraries/NodeCloning.js | 167 ++++++++++++++++++ DesignerSpace/Workspace/Workspace.js | 3 +- FloatingSpace/UiObjectConstructor.js | 32 ++-- 3 files changed, 186 insertions(+), 16 deletions(-) create mode 100644 DesignerSpace/Workspace/FunctionLibraries/NodeCloning.js diff --git a/DesignerSpace/Workspace/FunctionLibraries/NodeCloning.js b/DesignerSpace/Workspace/FunctionLibraries/NodeCloning.js new file mode 100644 index 000000000..79a791f6b --- /dev/null +++ b/DesignerSpace/Workspace/FunctionLibraries/NodeCloning.js @@ -0,0 +1,167 @@ +function newNodeCloning () { + const MODULE_NAME = 'Node Cloning' + const ERROR_LOG = true + const logger = newWebDebugLog() + logger.fileName = MODULE_NAME + + thisObject = { + getNodeClone: getNodeClone + } + return thisObject + + function getNodeClone (node) { + let idConversionMap = new Map() + + let inmatureClone = cloneNode(node) + let matureClone = redirectReferenceParents(inmatureClone) + + return matureClone + + function cloneNode (node) { + if (node === undefined) { return } + let nodeDefinition = APP_SCHEMA_MAP.get(node.type) + if (nodeDefinition !== undefined) { + let object = { + type: node.type, + subType: node.subType, + name: node.name, + code: node.code + } + + /* Children Nodes */ + if (nodeDefinition.properties !== undefined) { + for (let i = 0; i < nodeDefinition.properties.length; i++) { + let property = nodeDefinition.properties[i] + + switch (property.type) { + case 'node': { + if (node[property.name] !== undefined) { + object[property.name] = cloneNode(node[property.name]) + } + break + } + case 'array': { + if (node[property.name] !== undefined) { + let nodePropertyArray = node[property.name] + object[property.name] = [] + for (let m = 0; m < nodePropertyArray.length; m++) { + let protocolNode = cloneNode(nodePropertyArray[m]) + if (protocolNode !== undefined) { + object[property.name].push(protocolNode) + } + } + } + break + } + } + } + } + + object.id = newUniqueId() + idConversionMap.set(node.id, object.id) + + object.savedPayload = getSavedPayload(node) + + return object + } + } + + function redirectReferenceParents (node) { + if (node === undefined) { return } + let nodeDefinition = APP_SCHEMA_MAP.get(node.type) + if (nodeDefinition !== undefined) { + let object = { + type: node.type, + subType: node.subType, + name: node.name, + code: node.code + } + + /* Children Nodes */ + if (nodeDefinition.properties !== undefined) { + for (let i = 0; i < nodeDefinition.properties.length; i++) { + let property = nodeDefinition.properties[i] + + switch (property.type) { + case 'node': { + if (node[property.name] !== undefined) { + object[property.name] = redirectReferenceParents(node[property.name]) + } + break + } + case 'array': { + if (node[property.name] !== undefined) { + let nodePropertyArray = node[property.name] + object[property.name] = [] + for (let m = 0; m < nodePropertyArray.length; m++) { + let protocolNode = redirectReferenceParents(nodePropertyArray[m]) + if (protocolNode !== undefined) { + object[property.name].push(protocolNode) + } + } + } + break + } + } + } + } + + object.id = node.id + + object.savedPayload = node.savedPayload + + if (object.savedPayload !== undefined) { + if (object.savedPayload.referenceParent !== undefined) { + let newId = idConversionMap.get(object.savedPayload.referenceParent.id) + if (newId !== undefined) { + object.savedPayload.referenceParent.id = newId + } + } + } + + return object + } + } + } + + function getSavedPayload (node) { + if (node.payload === undefined) { return } + let savedPayload = { + position: { + x: node.payload.position.x, + y: node.payload.position.y + }, + targetPosition: { + x: node.payload.targetPosition.x, + y: node.payload.targetPosition.y + }, + floatingObject: { + isPinned: node.payload.floatingObject.isPinned, + isFrozen: (node.payload.floatingObject.isFrozen && node.payload.floatingObject.frozenManually), + isCollapsed: (node.payload.floatingObject.isCollapsed && node.payload.floatingObject.collapsedManually), + isTensed: (node.payload.floatingObject.isTensed && node.payload.floatingObject.tensedManually) + }, + uiObject: { + isRunning: node.payload.uiObject.isRunning, + shortcutKey: node.payload.uiObject.shortcutKey + } + } + + /* Next for the ones that have a reference parent, we include it */ + 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 + } + } else { + /* The referenceParent property can be inherited from the previous saved payload. */ + if (node.savedPayload !== undefined) { + savedPayload.referenceParent = node.savedPayload.referenceParent + } + } + + return savedPayload + } +} diff --git a/DesignerSpace/Workspace/Workspace.js b/DesignerSpace/Workspace/Workspace.js index 26c8b91b3..92f955605 100644 --- a/DesignerSpace/Workspace/Workspace.js +++ b/DesignerSpace/Workspace/Workspace.js @@ -51,6 +51,7 @@ function newWorkspace () { let functionLibraryNodeDeleter = newNodeDeleter() let functionLibraryUiObjectsFromNodes = newUiObjectsFromNodes() let functionLibraryProtocolNode = newProtocolNode() + let functionLibraryNodeCloning = newNodeCloning() let functionLibraryTaskFunctions = newTaskFunctions() let functionLibrarySessionFunctions = newSessionFunctions() let functionLibraryShortcutKeys = newShortcutKeys() @@ -286,7 +287,7 @@ function newWorkspace () { break case 'Clone': { - let text = JSON.stringify(functionLibraryProtocolNode.getProtocolNode(payload.node, false, false, true, true, true)) + let text = JSON.stringify(functionLibraryNodeCloning.getNodeClone(payload.node)) let nodeName = payload.node.name if (nodeName === undefined) { diff --git a/FloatingSpace/UiObjectConstructor.js b/FloatingSpace/UiObjectConstructor.js index 23d923168..00c0d4a65 100644 --- a/FloatingSpace/UiObjectConstructor.js +++ b/FloatingSpace/UiObjectConstructor.js @@ -115,7 +115,7 @@ function newUiObjectConstructor () { return } - function addLeftIcons (menuItemsInitialValues, floatingObject) { + function addLeftIcons (menuItemsInitialValues, floatingObject, isPersonalData) { menuItemsInitialValues.push( { action: 'Pin / Unpin', @@ -202,19 +202,21 @@ function newUiObjectConstructor () { currentRadius: 0 } ) - menuItemsInitialValues.push( - { - action: 'XXShare', - actionFunction: floatingObject.payload.onMenuItemClick, - label: undefined, - visible: true, - iconPathOn: 'menu-share', - iconPathOff: 'menu-share', - rawRadius: 8, - targetRadius: 0, - currentRadius: 0 - } - ) + if (isPersonalData !== true) { + menuItemsInitialValues.push( + { + action: 'Share', + actionFunction: floatingObject.payload.onMenuItemClick, + label: undefined, + visible: true, + iconPathOn: 'menu-share', + iconPathOff: 'menu-share', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0 + } + ) + } } function getMenuItemsInitialValues (uiObject, floatingObject, payload) { @@ -249,7 +251,7 @@ function newUiObjectConstructor () { } } if (nodeDefinition.addLeftIcons === true) { - addLeftIcons(menuItemsInitialValues, floatingObject) + addLeftIcons(menuItemsInitialValues, floatingObject, nodeDefinition.isPersonalData) } if (nodeDefinition.isPinned === true) { floatingObject.isPinned = true From 32e9b2b95f519f6aea6c7bd7d72a18493acbe065 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 18 Dec 2019 13:39:42 +0100 Subject: [PATCH 65/72] Delete background --- FloatingSpace/CircularMenuItem.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FloatingSpace/CircularMenuItem.js b/FloatingSpace/CircularMenuItem.js index 5e9f7071b..e8679ff6b 100644 --- a/FloatingSpace/CircularMenuItem.js +++ b/FloatingSpace/CircularMenuItem.js @@ -249,7 +249,7 @@ function newCircularMenuItem () { /* The first click ask for confirmation. */ if (temporaryStatus === STATUS_NO_ACTION_TAKEN_YET) { - setStatus(thisObject.confirmationLabel, UI_COLOR.GREY, 250, STATUS_WAITING_CONFIRMATION) + setStatus(thisObject.confirmationLabel, UI_COLOR.GOLDEN_ORANGE, 250, STATUS_WAITING_CONFIRMATION) return } /* A Click during confirmation executes the pre-defined action. */ From afbb31b50da06c88b1e984e13db49c1c3829d53b Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 19 Dec 2019 13:35:27 +0100 Subject: [PATCH 66/72] Name Change --- DesignerSpace/Workspace/Workspace.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DesignerSpace/Workspace/Workspace.js b/DesignerSpace/Workspace/Workspace.js index 92f955605..90659c367 100644 --- a/DesignerSpace/Workspace/Workspace.js +++ b/DesignerSpace/Workspace/Workspace.js @@ -295,7 +295,7 @@ function newWorkspace () { } else { nodeName = ' ' + nodeName } - let fileName = 'Backup - ' + payload.node.type + ' - ' + nodeName + '.json' + let fileName = 'Clone - ' + payload.node.type + ' - ' + nodeName + '.json' download(fileName, text) } From d94b42ffcfa7dee149b9813f0299d8a1fb3f5684 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 19 Dec 2019 13:40:52 +0100 Subject: [PATCH 67/72] possible bug fixed --- FloatingSpace/FloatingObject.js | 1 + 1 file changed, 1 insertion(+) diff --git a/FloatingSpace/FloatingObject.js b/FloatingSpace/FloatingObject.js index 4dacd262a..53f88ca5d 100644 --- a/FloatingSpace/FloatingObject.js +++ b/FloatingSpace/FloatingObject.js @@ -318,6 +318,7 @@ function newFloatingObject () { } function someoneAquiredFocus (container) { + if (container === undefined) { return } if (container.id !== thisObject.container.id) { removeFocus() } From c475ed065b2a71b183ac6a6d85cb8a8524997bf3 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 19 Dec 2019 14:38:24 +0100 Subject: [PATCH 68/72] Key can be added from parameters --- .../Workspace/FunctionLibraries/UiObjectsFromNodes.js | 7 ++++++- DesignerSpace/Workspace/Workspace.js | 7 +++++++ FloatingSpace/FloatingObject.js | 7 ++++++- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js index 8a3d93a5a..425cd8674 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js +++ b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js @@ -1623,7 +1623,12 @@ function newUiObjectsFromNodes () { name: 'New Key', 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) + if (exchangeAccount.keys !== undefined) { + exchangeAccount.keys.push(key) + } else { + exchangeAccount.key = key + } + createUiObject(true, 'Exchange Account Key', key.name, key, exchangeAccount, exchangeAccount, 'Account Key') return key diff --git a/DesignerSpace/Workspace/Workspace.js b/DesignerSpace/Workspace/Workspace.js index 90659c367..e3963f14a 100644 --- a/DesignerSpace/Workspace/Workspace.js +++ b/DesignerSpace/Workspace/Workspace.js @@ -203,12 +203,19 @@ function newWorkspace () { if (droppedNode.type === 'Workspace') { stopAllRunningTasks() + console.log(new Date()) functionLibraryNodeDeleter.deleteWorkspace(thisObject.workspaceNode, thisObject.workspaceNode.rootNodes) + console.log(new Date()) canvas.floatingSpace.warmUp() + console.log(new Date()) thisObject.workspaceNode = droppedNode + console.log(new Date()) functionLibraryUiObjectsFromNodes.recreateWorkspace(thisObject.workspaceNode) + console.log(new Date()) canvas.chartSpace.finalize() + console.log(new Date()) canvas.chartSpace.initialize() + console.log(new Date()) return } diff --git a/FloatingSpace/FloatingObject.js b/FloatingSpace/FloatingObject.js index 53f88ca5d..4c2eec098 100644 --- a/FloatingSpace/FloatingObject.js +++ b/FloatingSpace/FloatingObject.js @@ -318,7 +318,12 @@ function newFloatingObject () { } function someoneAquiredFocus (container) { - if (container === undefined) { return } + if (container === undefined) { + return + } + if (thisObject.container === undefined) { + return + } if (container.id !== thisObject.container.id) { removeFocus() } From 35150649bced49b2abacbd8ab9bf84b00b44364d Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 19 Dec 2019 17:04:27 +0100 Subject: [PATCH 69/72] Animation when a workspace is dropped --- Canvas.js | 2 +- DesignerSpace/Workspace/Workspace.js | 75 ++++++++++++++++++++++------ FloatingSpace/BusyProgressBar.js | 72 ++++++++++++++++++++++++++ FloatingSpace/CircularProgressBar.js | 2 + Spaces/DesignerSpace.js | 3 ++ 5 files changed, 137 insertions(+), 17 deletions(-) create mode 100644 FloatingSpace/BusyProgressBar.js diff --git a/Canvas.js b/Canvas.js index e6686eb39..9726c9d46 100644 --- a/Canvas.js +++ b/Canvas.js @@ -133,8 +133,8 @@ function newCanvas () { animation.addCallBackFunction('Panels Space', thisObject.panelsSpace.draw) animation.addCallBackFunction('ViewPort Animate', viewPort.animate) animation.addCallBackFunction('CockpitSpace Draw', thisObject.cockpitSpace.draw) + animation.addCallBackFunction('Designer Space Draw', thisObject.designerSpace.draw) animation.addCallBackFunction('Top Space Draw', thisObject.topSpace.draw) - animation.addCallBackFunction('Strategy Space Draw', thisObject.designerSpace.draw) animation.addCallBackFunction('Splash Screen Draw', splashScreen.draw) animation.start() } catch (err) { diff --git a/DesignerSpace/Workspace/Workspace.js b/DesignerSpace/Workspace/Workspace.js index e3963f14a..9dc406822 100644 --- a/DesignerSpace/Workspace/Workspace.js +++ b/DesignerSpace/Workspace/Workspace.js @@ -17,6 +17,7 @@ function newWorkspace () { stopAllRunningTasks: stopAllRunningTasks, onMenuItemClick: onMenuItemClick, physics: physics, + draw: draw, spawn: spawn, chainDetachNode: chainDetachNode, chainAttachNode: chainAttachNode, @@ -59,6 +60,11 @@ function newWorkspace () { thisObject.nodeChildren = newNodeChildren() + let workingAtTask = 0 + let circularProgressBar = newBusyProgressBar() + circularProgressBar.fitFunction = canvas.floatingSpace.fitIntoVisibleArea + let droppedNode + return thisObject function finalize () { @@ -66,6 +72,8 @@ function newWorkspace () { thisObject.container.finalize() thisObject.container = undefined thisObject.workspaceNode = undefined + circularProgressBar.finalize() + circularProgressBar = undefined } function initialize () { @@ -112,6 +120,46 @@ function newWorkspace () { let textToSave = stringifyWorkspace() window.localStorage.setItem(CANVAS_APP_NAME + '.' + 'Workspace', textToSave) + + if (workingAtTask > 0) { + circularProgressBar.physics() + + switch (workingAtTask) { + case 1: + stopAllRunningTasks() + workingAtTask++ + break + case 2: + functionLibraryNodeDeleter.deleteWorkspace(thisObject.workspaceNode, thisObject.workspaceNode.rootNodes) + workingAtTask++ + break + case 3: + thisObject.workspaceNode = droppedNode + droppedNode = undefined + workingAtTask++ + break + case 4: + functionLibraryUiObjectsFromNodes.recreateWorkspace(thisObject.workspaceNode) + workingAtTask++ + break + case 5: + canvas.chartSpace.finalize() + workingAtTask++ + break + case 6: + canvas.chartSpace.initialize() + workingAtTask = 0 + circularProgressBar.visible = false + break + + } + } + } + + function draw () { + if (circularProgressBar !== undefined) { + circularProgressBar.draw() + } } function stringifyWorkspace (removePersonalData) { @@ -193,29 +241,22 @@ function newWorkspace () { } } - function spawn (nodeText, point) { + function spawn (nodeText, mousePointer) { try { + let point = { + x: mousePointer.x, + y: mousePointer.y + } point = canvas.floatingSpace.container.frame.unframeThisPoint(point) spawnPosition.x = point.x spawnPosition.y = point.y - let droppedNode = JSON.parse(nodeText) + droppedNode = JSON.parse(nodeText) if (droppedNode.type === 'Workspace') { - stopAllRunningTasks() - console.log(new Date()) - functionLibraryNodeDeleter.deleteWorkspace(thisObject.workspaceNode, thisObject.workspaceNode.rootNodes) - console.log(new Date()) - canvas.floatingSpace.warmUp() - console.log(new Date()) - thisObject.workspaceNode = droppedNode - console.log(new Date()) - functionLibraryUiObjectsFromNodes.recreateWorkspace(thisObject.workspaceNode) - console.log(new Date()) - canvas.chartSpace.finalize() - console.log(new Date()) - canvas.chartSpace.initialize() - console.log(new Date()) + circularProgressBar.initialize(mousePointer) + circularProgressBar.visible = true + workingAtTask = 1 return } @@ -228,6 +269,8 @@ function newWorkspace () { thisObject.workspaceNode.rootNodes.push(droppedNode) functionLibraryUiObjectsFromNodes.createUiObjectFromNode(droppedNode, undefined, undefined, positionOffset) functionLibraryUiObjectsFromNodes.tryToConnectChildrenWithReferenceParents() + + droppedNode = undefined } catch (err) { if (ERROR_LOG === true) { logger.write('[ERROR] spawn -> err = ' + err.stack) } } diff --git a/FloatingSpace/BusyProgressBar.js b/FloatingSpace/BusyProgressBar.js new file mode 100644 index 000000000..a3c846b38 --- /dev/null +++ b/FloatingSpace/BusyProgressBar.js @@ -0,0 +1,72 @@ + +function newBusyProgressBar () { + const MODULE_NAME = 'Circular Progress Bar' + + let thisObject = { + container: undefined, + isDeployed: undefined, + visible: undefined, + physics: physics, + draw: draw, + finalize: finalize, + initialize: initialize + } + + let position + let addRadius + + let eventSubscriptionHeartbeat + + return thisObject + + function finalize () { + thisObject.payload = undefined + thisObject.fitFunction = undefined + } + + function initialize (pPosition) { + position = pPosition + + addRadius = 0 + } + + function physics () { + addRadius = addRadius + 20 + } + + function draw () { + if (thisObject.visible !== true) { return } + + let visiblePosition = { + x: position.x, + y: position.y + } + + visiblePosition = thisObject.fitFunction(visiblePosition) + + const RADIUS = 10 + addRadius + let OPACITY = 1 + + let initialAngle = 0 + let finalAngle = Math.PI * 2 + + browserCanvasContext.beginPath() + + browserCanvasContext.arc(visiblePosition.x, visiblePosition.y, RADIUS, initialAngle, finalAngle, false) + browserCanvasContext.closePath() + + browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.PATINATED_TURQUOISE + ', 1)' + + browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.GOLDEN_ORANGE + ', ' + OPACITY * 2 + ')' + browserCanvasContext.lineWidth = 15 + browserCanvasContext.setLineDash([3, 4]) + + browserCanvasContext.stroke() + + browserCanvasContext.strokeStyle = 'rgba(' + UI_COLOR.DARK_TURQUOISE + ', ' + OPACITY + ')' + browserCanvasContext.lineWidth = 10 + browserCanvasContext.setLineDash([3, 4]) + browserCanvasContext.stroke() + } +} + diff --git a/FloatingSpace/CircularProgressBar.js b/FloatingSpace/CircularProgressBar.js index 1fb58ce00..43a6e00c2 100644 --- a/FloatingSpace/CircularProgressBar.js +++ b/FloatingSpace/CircularProgressBar.js @@ -94,6 +94,8 @@ function newCircularProgressBar () { for (let i = 0; i < 60; i++) { let OPACITY = opacityCounters[i] / 1000 + if (OPACITY === 0) { continue } + let initialAngle = Math.PI * 2 / 60 * i - Math.PI / 2 let finalAngle = Math.PI * 2 / 60 * (i + 1) - Math.PI / 2 diff --git a/Spaces/DesignerSpace.js b/Spaces/DesignerSpace.js index d50bd9bff..3dff9ae53 100644 --- a/Spaces/DesignerSpace.js +++ b/Spaces/DesignerSpace.js @@ -223,5 +223,8 @@ function newDesignerSpace () { if (thisObject.sidePanel !== undefined) { thisObject.sidePanel.draw() } + if (thisObject.workspace !== undefined) { + thisObject.workspace.draw() + } } } From 4745acf6541ace3aa7dcf319a843ccd14249ebab Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Fri, 20 Dec 2019 06:53:00 +0100 Subject: [PATCH 70/72] Bug Fixed --- DesignerSpace/Workspace/Workspace.js | 6 ------ 1 file changed, 6 deletions(-) diff --git a/DesignerSpace/Workspace/Workspace.js b/DesignerSpace/Workspace/Workspace.js index 9dc406822..21b84ffd5 100644 --- a/DesignerSpace/Workspace/Workspace.js +++ b/DesignerSpace/Workspace/Workspace.js @@ -111,12 +111,6 @@ function newWorkspace () { function physics () { if (thisObject.enabled !== true) { return } - /* Here we will save all the workspace related objects into the local storage */ - let user = window.localStorage.getItem(LOGGED_IN_USER_LOCAL_STORAGE_KEY) - if (user === null) { - return - } - user = JSON.parse(user) let textToSave = stringifyWorkspace() window.localStorage.setItem(CANVAS_APP_NAME + '.' + 'Workspace', textToSave) From a71793353f02fdced2831c5aad9feb2a406b4ad6 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Fri, 20 Dec 2019 07:21:14 +0100 Subject: [PATCH 71/72] Keys respecting JSON --- DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js | 3 +++ .../Workspace/FunctionLibraries/UiObjectsFromNodes.js | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js b/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js index facc97d35..a48fe727b 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js +++ b/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js @@ -627,6 +627,9 @@ function newProtocolNode () { name: node.name, code: node.code } + if (parseCode) { + object.code = JSON.parse(node.code) + } if (includeIds) { object.id = node.id } diff --git a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js index 425cd8674..6aecaa64e 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js +++ b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js @@ -1621,7 +1621,7 @@ function newUiObjectsFromNodes () { let exchangeAccount = parentNode let key = { name: 'New Key', - 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.' + code: '{ \n\"name\": \"Paste your exchange API here\",\n"secret\": \"Paste your exchange API secret key here. Exchange keys are filtered out and NOT exported when using the SHARE menu option on any node at your workspace. Exchange keys ARE downloaded when using the DOWNLOAD button or the CLONE button.\"\n}' } if (exchangeAccount.keys !== undefined) { exchangeAccount.keys.push(key) @@ -1730,7 +1730,7 @@ function newUiObjectsFromNodes () { if (node.timePeriod === undefined) { node.timePeriod = { name: 'Time Period', - code: '01-hs' + code: '{ \n\"codeName\": \"01-hs\"\n}' } createUiObject(true, 'Time Period', '', node.timePeriod, node, node) } From 7d0e97b9ec99ce736ba5cc3e05eccb767ebd9750 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Fri, 20 Dec 2019 07:32:47 +0100 Subject: [PATCH 72/72] timePeriod JSON fix --- DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js | 3 +++ .../Workspace/FunctionLibraries/UiObjectsFromNodes.js | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js b/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js index a48fe727b..10038442a 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js +++ b/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js @@ -464,6 +464,9 @@ function newProtocolNode () { name: node.name, code: node.code } + if (parseCode) { + object.code = JSON.parse(node.code) + } if (includeIds) { object.id = node.id } diff --git a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js index 6aecaa64e..e0217f098 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js +++ b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js @@ -1730,7 +1730,7 @@ function newUiObjectsFromNodes () { if (node.timePeriod === undefined) { node.timePeriod = { name: 'Time Period', - code: '{ \n\"codeName\": \"01-hs\"\n}' + code: '{ \n\"value\": \"01-hs\"\n}' } createUiObject(true, 'Time Period', '', node.timePeriod, node, node) }