Session Concept Introduced into Product Storage

This commit is contained in:
Luis Fernando Molina committed 2019-10-07 14:51:58 +02:00
1 parent 5264885ab8
commit e4323deb83
5 files changed
+96 -8

No files matched your search

+1 -1
View File
@@ -335,7 +335,7 @@ function newPlottersManager () {
}
}
storage.initialize(pProductCard.devTeam, pProductCard.bot, pProductCard.product, exchange, market, datetime, timePeriod, onProductStorageInitialized)
storage.initialize(pProductCard.devTeam, pProductCard.bot, undefined, pProductCard.product, exchange, market, datetime, timePeriod, onProductStorageInitialized)
function onProductStorageInitialized (err) {
try {
+5 -5
View File
@@ -74,7 +74,7 @@ function newProductStorage (pName) {
}
}
function initialize (pDevTeam, pBot, pProduct, pExchange, pMarket, pDatetime, pTimePeriod, callBackFunction) {
function initialize (pDevTeam, pBot, pSession, pProduct, pExchange, pMarket, pDatetime, pTimePeriod, callBackFunction) {
try {
datetime = pDatetime
timePeriod = pTimePeriod
@@ -90,7 +90,7 @@ function newProductStorage (pName) {
dataSetsToLoad++
let marketFiles = newMarketFiles()
marketFiles.initialize(pDevTeam, pBot, pProduct, thisSet, pExchange, pMarket, onMarketFileReady)
marketFiles.initialize(pDevTeam, pBot, pSession, pProduct, thisSet, pExchange, pMarket, onMarketFileReady)
thisObject.marketFiles.push(marketFiles)
}
break
@@ -99,7 +99,7 @@ function newProductStorage (pName) {
dataSetsToLoad++
let dailyFiles = newDailyFiles()
dailyFiles.initialize(pDevTeam, pBot, pProduct, thisSet, pExchange, pMarket, pDatetime, pTimePeriod, onDailyFileReady)
dailyFiles.initialize(pDevTeam, pBot, pSession, pProduct, thisSet, pExchange, pMarket, pDatetime, pTimePeriod, onDailyFileReady)
thisObject.dailyFiles.push(dailyFiles)
}
break
@@ -108,7 +108,7 @@ function newProductStorage (pName) {
dataSetsToLoad++
let singleFile = newSingleFile()
singleFile.initialize(pDevTeam, pBot, pProduct, thisSet, pExchange, pMarket, onSingleFileReady)
singleFile.initialize(pDevTeam, pBot, pSession, pProduct, thisSet, pExchange, pMarket, onSingleFileReady)
thisObject.singleFile.push(singleFile)
}
break
@@ -117,7 +117,7 @@ function newProductStorage (pName) {
dataSetsToLoad++
let fileSequences = newFileSequence()
fileSequences.initialize(pDevTeam, pBot, pProduct, thisSet, pExchange, pMarket, onFileSequenceReady)
fileSequences.initialize(pDevTeam, pBot, pSession, pProduct, thisSet, pExchange, pMarket, onFileSequenceReady)
thisObject.fileSequences.push(fileSequences)
}
break
@@ -0,0 +1,61 @@
function newLayerFunctions () {
thisObject = {
turnLayerOn: turnLayerOn,
turnLayerOff: turnLayerOff,
turnAllLayersOn: turnAllLayersOn,
turnAllLayersOff: turnAllLayersOff
}
return thisObject
function turnLayerOn (node, functionLibraryProtocolNode, callBackFunction) {
/* Check if it is possible to turn on or not */
let code
try {
code = JSON.parse(node.code)
} catch (err) {
{
callBackFunction(GLOBAL.DEFAULT_FAIL_RESPONSE)
return
}
}
/* Ok, we are going to turn the layer on */
}
function turnLayerOff (node, functionLibraryProtocolNode, callBackFunction) {
let event = {
taskId: node.id,
taskName: node.name
}
systemEventHandler.raiseEvent('Layer Manager', 'Turn Layer Off', event)
node.payload.uiObject.stop(callBackFunction)
if (node.bot === undefined) { return }
if (node.bot.processes.length === 0) { return }
for (let i = 0; i < node.bot.processes.length; i++) {
let process = node.bot.processes[i]
process.payload.uiObject.stop()
}
}
function turnAllLayersOn (taskManager, functionLibraryProtocolNode) {
for (let i = 0; i < taskManager.tasks.length; i++) {
let node = taskManager.tasks[i]
let menu = node.payload.uiObject.menu
menu.internalClick('Turn Layer On')
}
}
function turnAllLayersOff (taskManager, functionLibraryProtocolNode) {
for (let i = 0; i < taskManager.tasks.length; i++) {
let node = taskManager.tasks[i]
let menu = node.payload.uiObject.menu
menu.internalClick('Turn Layer Off')
}
}
}
@@ -10,8 +10,14 @@ function newTaskFunctions () {
function runTask (node, functionLibraryProtocolNode, callBackFunction) {
/* Check if it is possible to Run or not */
if (node.bot === undefined) { return }
if (node.bot.processes.length === 0) { return }
if (node.bot === undefined) {
callBackFunction(GLOBAL.DEFAULT_FAIL_RESPONSE)
return
}
if (node.bot.processes.length === 0) {
callBackFunction(GLOBAL.DEFAULT_FAIL_RESPONSE)
return
}
for (let i = 0; i < node.bot.processes.length; i++) {
let process = node.bot.processes[i]
+21
View File
@@ -47,6 +47,7 @@ function newWorkspace () {
let functionLibraryProtocolNode = newProtocolNode()
let functionLibraryWorkspaceNodes = newStringifyNode()
let functionLibraryTaskFunctions = newTaskFunctions()
let functionLibraryLayerFunctions = newLayerFunctions()
let functionLibrarySessionFunctions = newSessionFunctions()
thisObject.nodeChildren = newNodeChildren()
@@ -233,6 +234,26 @@ function newWorkspace () {
download(fileName, text)
}
break
case 'Turn Layer On':
{
functionLibraryLayerFunctions.turnLayerOn(payload.node, functionLibraryProtocolNode, callBackFunction)
}
break
case 'Turn Layer Off':
{
functionLibraryLayerFunctions.turnLayerOff(payload.node, functionLibraryProtocolNode, callBackFunction)
}
break
case 'Turn All Layers On':
{
functionLibraryLayerFunctions.turnAllLayersOn(payload.node, functionLibraryProtocolNode)
}
break
case 'Turn All Layers Off':
{
functionLibraryLayerFunctions.turnAllLayersOff(payload.node, functionLibraryProtocolNode)
}
break
case 'Run Task':
{