Lighting Paths Implemented with Tasks

This commit is contained in:
Luis Fernando Molina committed 2019-12-22 14:25:27 +01:00
1 parent 8a06a8b080
commit c2f94e84ac
3 files changed
+64 -23

No files matched your search

+5 -5
View File
@@ -184,17 +184,17 @@ function newPlottersManager () {
/* We take a snapwhot of the current product definition to be used by the plotter. */
let functionLibraryProtocolNode = newProtocolNode()
let lightingPath = 'Product Definition->' +
'Record Definition->Record Property->' +
'Data Building Procedure->Procedure Loop->Javascript Code->' +
'Calculations Procedure->Procedure Initialization->Javascript Code->' +
let lightingPath = '->Product Definition->' +
'Record Definition->Record Property->Formula->' +
'Data Building Procedure->Procedure Loop->Javascript Code->Procedure Initialization->Javascript Code->' +
'Calculations Procedure->Procedure Loop->Javascript Code->Procedure Initialization->Javascript Code->' +
'Plotter Module->Shapes->' +
'Chart Points->Point->Point Formula->' +
'Polygon->Polygon Body->Style->Style Condition->Style->' +
'Polygon Border->Style->Style Condition->Style->' +
'Polygon Vertex->Point->' +
'Plotter Panel->Javascript Code->Panel Data->Data Formula->'
productDefinition = functionLibraryProtocolNode.getProtocolNode(pProductCard.product.node, false, true, true, false, lightingPath)
productDefinition = functionLibraryProtocolNode.getProtocolNode(pProductCard.product.node, false, true, true, false, false, lightingPath)
} else {
plotter = getNewPlotter(pProductCard.product.plotter.devTeam, pProductCard.product.plotter.codeName, pProductCard.product.plotter.moduleName)
}
@@ -9,7 +9,7 @@ function newProtocolNode () {
}
return thisObject
function getProtocolNode (node, removePersonalData, parseCode, includeIds, includePayload, lightingPath) {
function getProtocolNode (node, removePersonalData, parseCode, includeIds, includePayload, includeReferencesInSavedPayload, lightingPath) {
if (node === undefined) { return }
let nodeDefinition = APP_SCHEMA_MAP.get(node.type)
@@ -30,25 +30,40 @@ function newProtocolNode () {
switch (property.type) {
case 'node': {
if (node[property.name] !== undefined) {
let newLightingPath = getNreLightingPath(lightingPath, node.type, property.childType)
if (newLightingPath !== undefined) {
object[property.name] = getProtocolNode(node[property.name], removePersonalData, parseCode, includeIds, includePayload, newLightingPath)
if (lightingPath === undefined) {
object[property.name] = getProtocolNode(node[property.name], removePersonalData, parseCode, includeIds, includeReferencesInSavedPayload, includePayload)
} else {
let newLightingPath = getNewLightingPath(lightingPath, node.type, property.childType)
if (newLightingPath !== undefined) {
object[property.name] = getProtocolNode(node[property.name], removePersonalData, parseCode, includeIds, includePayload, includeReferencesInSavedPayload, newLightingPath)
}
}
}
break
}
case 'array': {
if (node[property.name] !== undefined) {
let newLightingPath = getNreLightingPath(lightingPath, node.type, property.childType)
if (newLightingPath !== undefined) {
if (lightingPath === undefined) {
let nodePropertyArray = node[property.name]
object[property.name] = []
for (let m = 0; m < nodePropertyArray.length; m++) {
let protocolNode = getProtocolNode(nodePropertyArray[m], removePersonalData, parseCode, includeIds, includePayload, newLightingPath)
let protocolNode = getProtocolNode(nodePropertyArray[m], removePersonalData, parseCode, includeIds, includeReferencesInSavedPayload, includePayload)
if (protocolNode !== undefined) {
object[property.name].push(protocolNode)
}
}
} else {
let newLightingPath = getNewLightingPath(lightingPath, node.type, property.childType)
if (newLightingPath !== undefined) {
let nodePropertyArray = node[property.name]
object[property.name] = []
for (let m = 0; m < nodePropertyArray.length; m++) {
let protocolNode = getProtocolNode(nodePropertyArray[m], removePersonalData, parseCode, includeIds, includePayload, includeReferencesInSavedPayload, newLightingPath)
if (protocolNode !== undefined) {
object[property.name].push(protocolNode)
}
}
}
}
}
break
@@ -59,15 +74,15 @@ function newProtocolNode () {
/* Parent Nodes */
if (node.payload.parentNode !== undefined) {
let newLightingPath = getNreLightingPath(lightingPath, node.type, node.payload.parentNode.type)
let newLightingPath = getNewLightingPath(lightingPath, node.type, node.payload.parentNode.type)
if (newLightingPath !== undefined) {
object.parentNode = getProtocolNode(node.payload.parentNode, removePersonalData, parseCode, includeIds, includePayload, newLightingPath)
object.parentNode = getProtocolNode(node.payload.parentNode, removePersonalData, parseCode, includeIds, includePayload, includeReferencesInSavedPayload, newLightingPath)
}
}
if (node.payload.referenceParent !== undefined) {
let newLightingPath = getNreLightingPath(lightingPath, node.type, node.payload.referenceParent.type)
let newLightingPath = getNewLightingPath(lightingPath, node.type, node.payload.referenceParent.type)
if (newLightingPath !== undefined) {
object.referenceParent = getProtocolNode(node.payload.referenceParent, removePersonalData, parseCode, includeIds, includePayload, newLightingPath)
object.referenceParent = getProtocolNode(node.payload.referenceParent, removePersonalData, parseCode, includeIds, includePayload, includeReferencesInSavedPayload, newLightingPath)
}
}
@@ -89,21 +104,21 @@ function newProtocolNode () {
object.id = node.id
}
if (includePayload) {
object.savedPayload = getSavedPayload(node, includeReferences)
object.savedPayload = getSavedPayload(node, includeReferencesInSavedPayload)
}
return object
}
}
function getNreLightingPath (lightingPath, currentNodeType, nextNodeType) {
function getNewLightingPath (lightingPath, currentNodeType, nextNodeType) {
if (lightingPath === undefined) { return }
if (currentNodeType === undefined) { return }
if (nextNodeType === undefined) { return }
let currentNodePosition = lightingPath.indexOf(currentNodeType)
let nextNodePosition = lightingPath.indexOf(nextNodeType)
let currentNodePosition = lightingPath.indexOf('->' + currentNodeType + '->')
let nextNodePosition = lightingPath.indexOf('->' + nextNodeType + '->')
let newLightingPath = lightingPath.substring(nextNodePosition, lightingPath.length + 1)
@@ -114,7 +129,7 @@ function newProtocolNode () {
}
}
function getSavedPayload (node, includeReferences) {
function getSavedPayload (node, includeReferencesInSavedPayload) {
if (node.payload === undefined) { return }
let savedPayload = {
position: {
@@ -137,7 +152,7 @@ function newProtocolNode () {
}
}
if (includeReferences) {
if (includeReferencesInSavedPayload) {
/* Next for the ones that have a reference parent, we include it */
if (node.payload.referenceParent !== undefined) {
savedPayload.referenceParent = {
@@ -24,10 +24,36 @@ function newTaskFunctions () {
process.payload.uiObject.run()
}
let lightingPath = '->Task->' +
'Sensor Bot Instance->' +
'Indicator Bot Instance->' +
'Trading Bot Instance->' +
'Process Instance->Process Definition->' +
'Process Output->Output Dataset->Dataset Definition->Product Definition->' +
'Process Dependencies->' +
'Status Dependency->Status Report->Process Definition->' +
'Data Dependency->Dataset Definition->Product Definition->' +
'Record Definition->Record Property->Formula->' +
'Data Building Procedure->' +
'Procedure Initialization->Javascript Code->' +
'Procedure Loop->Javascript Code->' +
'Calculations Procedure->' +
'Procedure Initialization->Javascript Code->' +
'Procedure Loop->Javascript Code->' +
'Status Report->' +
'Execution Finished Event->' +
'Execution Started Event->Execution Finished Event->Process Definition->' +
'Sensor Bot->' +
'Indicator Bot->' +
'Trading Bot->' +
'Team->'
let definition = functionLibraryProtocolNode.getProtocolNode(node, false, true, true, false, false, lightingPath)
let event = {
taskId: node.id,
taskName: node.name,
definition: JSON.stringify(functionLibraryProtocolNode.getProtocolNode(node, false, true, true, false, false, true, true)) // <- We need to do this workaround in order no to send unescaped charactars to the taskManager.
definition: JSON.stringify(definition) // <- We need to do this workaround in order no to send unescaped charactars to the taskManager.
}
if (node.payload.parentNode === undefined) {