removing the concept of subtypes

This commit is contained in:
Luis Fernando Molina committed 2020-01-24 10:45:43 +01:00
1 parent 031c532bf3
commit fa1345ce43
6 files changed
+16 -62

No files matched your search

+2 -6
View File
@@ -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)
}
@@ -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
}
@@ -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
}
@@ -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->' +
@@ -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]
}
}
}
}
+11 -48
View File
@@ -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()