From fa1345ce43231f257b49beef7038e22ed74762ea Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Fri, 24 Jan 2020 10:45:43 +0100 Subject: [PATCH] removing the concept of subtypes --- Dashboard.js | 8 +-- .../FunctionLibraries/NodeCloning.js | 3 - .../FunctionLibraries/ProtocolNode.js | 2 - .../FunctionLibraries/TaskFunctions.js | 2 +- .../FunctionLibraries/UiObjectsFromNodes.js | 4 +- FloatingSpace/UiObject.js | 59 ++++--------------- 6 files changed, 16 insertions(+), 62 deletions(-) diff --git a/Dashboard.js b/Dashboard.js index 16e514b82..80373e057 100644 --- a/Dashboard.js +++ b/Dashboard.js @@ -32,12 +32,8 @@ function newDashboard () { APP_SCHEMA_ARRAY = getAppSchema() for (let i = 0; i < APP_SCHEMA_ARRAY.length; i++) { let nodeDefinition = APP_SCHEMA_ARRAY[i] - let key - if (nodeDefinition.subType !== undefined) { - key = nodeDefinition.type + '-' + nodeDefinition.subType - } else { - key = nodeDefinition.type - } + let key = nodeDefinition.type + APP_SCHEMA_MAP.set(key, nodeDefinition) } diff --git a/DesignerSpace/Workspace/FunctionLibraries/NodeCloning.js b/DesignerSpace/Workspace/FunctionLibraries/NodeCloning.js index 66fb01a3d..ab81e42a6 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/NodeCloning.js +++ b/DesignerSpace/Workspace/FunctionLibraries/NodeCloning.js @@ -23,7 +23,6 @@ function newNodeCloning () { if (nodeDefinition !== undefined) { let object = { type: node.type, - subType: node.subType, name: node.name, code: node.code } @@ -76,7 +75,6 @@ function newNodeCloning () { if (nodeDefinition !== undefined) { let object = { type: node.type, - subType: node.subType, name: node.name, code: node.code } @@ -159,7 +157,6 @@ function newNodeCloning () { 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 } diff --git a/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js b/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js index 63e6ffb08..dc5ef92de 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js +++ b/DesignerSpace/Workspace/FunctionLibraries/ProtocolNode.js @@ -18,7 +18,6 @@ function newProtocolNode () { if (removePersonalData === true && nodeDefinition.isPersonalData === true) { return } let object = { type: node.type, - subType: node.subType, name: node.name, code: node.code } @@ -174,7 +173,6 @@ function newProtocolNode () { 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 } diff --git a/DesignerSpace/Workspace/FunctionLibraries/TaskFunctions.js b/DesignerSpace/Workspace/FunctionLibraries/TaskFunctions.js index 3a1d3ca57..9d248f052 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/TaskFunctions.js +++ b/DesignerSpace/Workspace/FunctionLibraries/TaskFunctions.js @@ -28,7 +28,7 @@ function newTaskFunctions () { 'Sensor Bot Instance->' + 'Indicator Bot Instance->' + 'Trading Bot Instance->' + - 'Process Instance->' + + 'Sensor Process Instance->Indicator Process Instance->Trading Process Instance->' + 'Market Reference->Market->Exchange Markets->Crypto Exchange->' + 'Market Base Asset->Market Quoted Asset->Asset->' + 'Backtesting Session->Live Trading Session->Paper Trading Session->Fordward Testing Session->' + diff --git a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js index 9278eaa6a..591efb69a 100644 --- a/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js +++ b/DesignerSpace/Workspace/FunctionLibraries/UiObjectsFromNodes.js @@ -76,8 +76,8 @@ function newUiObjectsFromNodes () { for (let j = 0; j < nodeChildren.length; j++) { if (node.id === nodeChildren[j].id) { if (j > 0) { - chainParent = nodeChildren[j - 1] - } + chainParent = nodeChildren[j - 1] + } } } } diff --git a/FloatingSpace/UiObject.js b/FloatingSpace/UiObject.js index 0ebf646e7..2337df4aa 100644 --- a/FloatingSpace/UiObject.js +++ b/FloatingSpace/UiObject.js @@ -282,40 +282,18 @@ function newUiObject () { let nearbyFloatingObjects = thisObject.payload.floatingObject.nearbyFloatingObjects let compatibleTypes - let compatibleSubTypes - switch (thisObject.payload.node.type) { - case 'Process Instance': - switch (thisObject.payload.node.subType) { - case 'Sensor Process Instance': { - compatibleTypes = '->' + 'Sensor Bot Instance' + '->' - break - } - case 'Indicator Process Instance': { - compatibleTypes = '->' + 'Indicator Bot Instance' + '->' - break - } - case 'Trading Process Instance': { - compatibleTypes = '->' + 'Trading Bot Instance' + '->' - break - } - } - compatibleSubTypes = undefined - break - - default: - let nodeDefinition = APP_SCHEMA_MAP.get(thisObject.payload.node.type) - if (nodeDefinition !== undefined) { - if (nodeDefinition.chainAttachesTo !== undefined) { - compatibleTypes = nodeDefinition.chainAttachesTo.compatibleTypes - compatibleSubTypes = nodeDefinition.chainAttachesTo.compatibleSubTypes - } else { - return - } - } else { - return - } + let nodeDefinition = APP_SCHEMA_MAP.get(thisObject.payload.node.type) + if (nodeDefinition !== undefined) { + if (nodeDefinition.chainAttachesTo !== undefined) { + compatibleTypes = nodeDefinition.chainAttachesTo.compatibleTypes + } else { + return + } + } else { + return } + let foundCompatible = false chainAttachToNode = undefined isChainAttaching = false @@ -327,7 +305,7 @@ function newUiObject () { let nearbyNode = floatingObject.payload.node 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) + nodeDefinition = APP_SCHEMA_MAP.get(thisObject.payload.node.type) if (nodeDefinition !== undefined) { let mustContinue = false let parentNodeDefinition = APP_SCHEMA_MAP.get(nearbyNode.type) @@ -355,12 +333,6 @@ function newUiObject () { if (mustContinue === true) { continue } } - /* Here we check if the subtypes are compatible. */ - if (nearbyNode.subType !== undefined && compatibleSubTypes !== undefined) { - if (compatibleSubTypes.indexOf('->' + nearbyNode.subType + '->') < 0) { - continue - } - } /* Discard Phases without partent */ if (thisObject.payload.node.type === 'Phase' && nearbyNode.type === 'Phase' && nearbyNode.payload.parentNode === undefined) { continue } /* Control maxPhases */ @@ -463,13 +435,11 @@ function newUiObject () { let nearbyFloatingObjects = thisObject.payload.floatingObject.nearbyFloatingObjects let compatibleTypes - let compatibleSubTypes 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 } @@ -487,13 +457,6 @@ function newUiObject () { let floatingObject = nearby[1] let nearbyNode = floatingObject.payload.node if (compatibleTypes.indexOf('->' + nearbyNode.type + '->') >= 0) { - /* Here we check if the subtypes are compatible. */ - if (nearbyNode.subType !== undefined && compatibleSubTypes !== undefined) { - if (compatibleSubTypes.indexOf('->' + nearbyNode.subType + '->') < 0) { - continue - } - } - if (foundCompatible === false) { if (distance < thisObject.container.frame.radius * 1.5 + floatingObject.container.frame.radius * 1.5) { nearbyNode.payload.uiObject.getReadyToReferenceAttach()