diff --git a/ChartsSpace/PlottersManager.js b/ChartsSpace/PlottersManager.js index ef59d597b..13d85f703 100644 --- a/ChartsSpace/PlottersManager.js +++ b/ChartsSpace/PlottersManager.js @@ -462,11 +462,12 @@ function newPlottersManager () { canvas.panelsSpace.destroyPanel(productPlotters[i].panels[j]) } /* Finally the Storage Objects */ - productPlotters[i].storage.finalize() + if (productPlotters[i].plotter.finalize !== undefined) { productPlotters[i].plotter.container.finalize() productPlotters[i].plotter.finalize() } + productPlotters[i].storage.finalize() productPlotters.splice(i, 1) // Delete item from array. return // We already found the product woth changes and processed it. } @@ -530,4 +531,3 @@ function newPlottersManager () { } } } - diff --git a/CockpitSpace/RestartSimulation.js b/CockpitSpace/RestartSimulation.js index 16198d49e..b73e1a75e 100644 --- a/CockpitSpace/RestartSimulation.js +++ b/CockpitSpace/RestartSimulation.js @@ -36,7 +36,7 @@ function newRestartSimulation () { let executionFocusExists = false let idleLabel = '' let isRunning = false - let eventSubscriptionIdSimulationFilesUpdated + let eventSubscriptionIdProcessStopped return thisObject @@ -46,8 +46,8 @@ function newRestartSimulation () { thisObject.container.eventHandler.stopListening(selfMouseClickEventSubscriptionId) thisObject.container.eventHandler.stopListening(selfMouseNotOverEventSubscriptionId) - systemEventHandler.stopListening('Jason-Multi-Period', eventSubscriptionIdSimulationFilesUpdated) systemEventHandler.stopListening('Jason-Multi-Period', eventSubscriptionIdProcessStopped) + systemEventHandler.deleteEventHandler('Cockpit-Restart-Button') thisObject.container.finalize() thisObject.container = undefined @@ -65,19 +65,12 @@ function newRestartSimulation () { systemEventHandler.createEventHandler('Cockpit-Restart-Button') - /* - We will start listening to the event that is triggered when the simulation process finishes processing one day in the case - of daily files or the whole market in the case of market files. - */ - eventSubscriptionIdSimulationFilesUpdated = systemEventHandler.listenToEvent('Jason-Multi-Period', 'Simulation Files Updated', undefined, undefined, undefined, onFilesUpdated) + systemEventHandler.listenToEvent('Jason-Multi-Period', 'Process Stopped', undefined, 'Cockpit-Restart-Button', onResponse, onProcessStopped) - function onFilesUpdated (message) { - turnOffProductCards() - turnOnProductCards() + function onResponse (message) { + eventSubscriptionIdProcessStopped = message.eventSubscriptionId } - eventSubscriptionIdProcessStopped = systemEventHandler.listenToEvent('Jason-Multi-Period', 'Process Stopped', undefined, undefined, undefined, onProcessStopped) - function onProcessStopped (message) { thisObject.status = 'Ready' isRunning = false diff --git a/FloatingSpace/CircularProgressBar.js b/FloatingSpace/CircularProgressBar.js index 9977d4068..a28c0ea68 100644 --- a/FloatingSpace/CircularProgressBar.js +++ b/FloatingSpace/CircularProgressBar.js @@ -23,11 +23,14 @@ function newCircularProgressBar () { let opacityCounters = [] + let eventSubscriptionHeartbeat + return thisObject function finalize () { - thisObject.container = undefined + systemEventHandler.stopListening('Jason-Heartbeat-Period', eventSubscriptionHeartbeat) + thisObject.container = undefined thisObject.payload = undefined thisObject.fitFunction = undefined } @@ -40,8 +43,11 @@ function newCircularProgressBar () { } let key = thisObject.payload.node.name + '-' + thisObject.payload.node.type + '-' + thisObject.payload.node.id - // systemEventHandler.createEventHandler(key) - systemEventHandler.listenToEvent(key, 'Heartbeat', undefined, key, undefined, onHeartBeat) + systemEventHandler.listenToEvent(key, 'Heartbeat', undefined, key, onResponse, onHeartBeat) + + function onResponse (message) { + eventSubscriptionIdHeartbeat = message.eventSubscriptionId + } } function onHeartBeat (message) {