online Warnings and Info

This commit is contained in:
Luis Fernando Molina committed 2020-08-29 16:45:53 +02:00
1 parent 077b8cb865
commit ee4bb2a893
1 file changed
+37
+37
View File
@@ -127,8 +127,11 @@ function newUiObject() {
let rightDragging = false
let eventSubscriptionIdOnError
let eventSubscriptionIdOnWarning
let eventSubscriptionIdOnInfo
let eventSubscriptionIdOnRunning
let eventSubscriptionIdOnStopped
let lastHeartBeat
let onRunningCallBackFunction
let onRunningCallBackFunctionWasCalled = false
@@ -201,6 +204,12 @@ function newUiObject() {
if (eventSubscriptionIdOnError !== undefined) {
eventsServerClient.stopListening(key, eventSubscriptionIdOnError, 'UiObject')
}
if (eventSubscriptionIdOnWarning !== undefined) {
eventsServerClient.stopListening(key, eventSubscriptionIdOnWarning, 'UiObject')
}
if (eventSubscriptionIdOnInfo !== undefined) {
eventsServerClient.stopListening(key, eventSubscriptionIdOnInfo, 'UiObject')
}
}
}
@@ -955,6 +964,8 @@ function newUiObject() {
setupRunningEventListener(callBackFunction)
setupErrorEventListener(callBackFunction)
setupWarningEventListener()
setupInfoEventListener()
}
function setupRunningEventListener(callBackFunction) {
@@ -1017,6 +1028,32 @@ function newUiObject() {
}
}
function setupWarningEventListener() {
let key = thisObject.payload.node.name + '-' + thisObject.payload.node.type + '-' + thisObject.payload.node.id
eventsServerClient.listenToEvent(key, 'Warning', undefined, key, onResponse, onWarning)
function onResponse(message) {
eventSubscriptionIdOnWarning = message.eventSubscriptionId
}
function onWarning(message) {
setWarningMessage(message.event.warningMessage, 10)
}
}
function setupInfoEventListener() {
let key = thisObject.payload.node.name + '-' + thisObject.payload.node.type + '-' + thisObject.payload.node.id
eventsServerClient.listenToEvent(key, 'Info', undefined, key, onResponse, onInfo)
function onResponse(message) {
eventSubscriptionIdOnInfo = message.eventSubscriptionId
}
function onInfo(message) {
setInfoMessage(message.event.infoMessage, 10)
}
}
function stop(callBackFunction, event) {
/* We will wait to the event that the execution was terminated in order to call back the menu item */
let key = thisObject.payload.node.name + '-' + thisObject.payload.node.type + '-' + thisObject.payload.node.id