getready
This commit is contained in:
1 parent
76b68463ab
commit
3cf8e0a2ff
2 files changed
+38
-3
No files matched your search
@@ -1,5 +1,7 @@
|
||||
function newTaskFunctions() {
|
||||
thisObject = {
|
||||
getReady: getReady,
|
||||
|
||||
runTask: runTask,
|
||||
stopTask: stopTask,
|
||||
runAllTasks: runAllTasks,
|
||||
@@ -33,6 +35,39 @@ function newTaskFunctions() {
|
||||
|
||||
return thisObject
|
||||
|
||||
function getReady(node) {
|
||||
let networkNode = validations(node)
|
||||
if (networkNode === undefined) {
|
||||
/* Nodes that do not belong to a network can not get ready. */
|
||||
return
|
||||
}
|
||||
|
||||
let eventsServerClient = canvas.designSpace.workspace.eventsServerClients.get(networkNode.id)
|
||||
|
||||
/* First we setup everything so as to listen to the response from the Task Manger */
|
||||
let eventSubscriptionIdOnStatus
|
||||
let key = 'Task Client - ' + node.id
|
||||
eventsServerClient.listenToEvent(key, 'Task Status', undefined, node.id, onResponse, onStatus)
|
||||
|
||||
function onResponse(message) {
|
||||
eventSubscriptionIdOnStatus = message.eventSubscriptionId
|
||||
}
|
||||
|
||||
function onStatus(message) {
|
||||
eventsServerClient.stopListening(key, eventSubscriptionIdOnStatus, node.id)
|
||||
if (message.event.status === 'Task Process Running' ) {
|
||||
node.payload.uiObject.run()
|
||||
}
|
||||
}
|
||||
|
||||
/* Second we ask the Task Manager if this Task has a process Running. */
|
||||
let event = {
|
||||
taskId: node.id
|
||||
}
|
||||
|
||||
eventsServerClient.raiseEvent('Task Manager', 'Task Status', event)
|
||||
}
|
||||
|
||||
function runTask(node, functionLibraryProtocolNode, isDebugging, callBackFunction) {
|
||||
|
||||
let networkNode = validations(node)
|
||||
@@ -494,7 +529,7 @@ function newTaskFunctions() {
|
||||
let task = functionLibraryUiObjectsFromNodes.addUIObject(taskManager, 'Task')
|
||||
|
||||
if (tradingSystem !== undefined) {
|
||||
task.name = tradingSystem.name
|
||||
task.name = tradingSystem.name
|
||||
} else {
|
||||
task.name = bot.name
|
||||
}
|
||||
|
||||
@@ -914,10 +914,10 @@ function newTutorialSpace() {
|
||||
html = html + '<div class="tutorial-font-small tutorial-alert-success" role="alert"><i class="tutorial-fa tutorial-check-square-o"></i> <b>Tip:</b> ' + addToolTips(nodeConfig.tip) + '</div>'
|
||||
}
|
||||
if (nodeConfig.important !== undefined && nodeConfig.important !== '') {
|
||||
html = html + '<div class="tutorial-font-small tutorial-alert-warning" role="alert"><i class="tutorial-fa tutorial-warning"></i> <b>Important:</b> ' + addToolTips(nodeConfig.important) + '</div>'
|
||||
html = html + '<div class="tutorial-font-small tutorial-alert-important" role="alert"><i class="tutorial-fa tutorial-warning"></i> <b>Important:</b> ' + addToolTips(nodeConfig.important) + '</div>'
|
||||
}
|
||||
if (nodeConfig.warning !== undefined && nodeConfig.warning !== '') {
|
||||
html = html + '<div class="tutorial-font-small tutorial-alert-warning" role="alert"><i class="tutorial-fa tutorial-warning"></i> <b>Important:</b> ' + addToolTips(nodeConfig.warning) + '</div>'
|
||||
html = html + '<div class="tutorial-font-small tutorial-alert-warning" role="alert"><i class="tutorial-fa tutorial-warning"></i> <b>Warning:</b> ' + addToolTips(nodeConfig.warning) + '</div>'
|
||||
}
|
||||
html = html + '</div>'
|
||||
|
||||
|
||||
Reference in new issue
Block a user