1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/web/ synced 2025-03-09 00:00:01 +01:00

Deals with issues #44 and #50

This commit is contained in:
Ricardo Hernandez-Montoya 2017-04-26 10:51:27 +02:00
parent 584a9e68d4
commit c31f6ea42c

View file

@ -31,6 +31,18 @@ class SimulatorStore extends ArrayStore {
return super.reduce(state, action);
case 'simulators/start-edit':
// An update will be requested, stop the 'runningDetection' already
SimulatorsDataManager.stopRunningDetection(action.data);
return super.reduce(state, action);
case 'simulators/edited':
// The update was done, resume the 'runningDetection'
SimulatorsDataManager.startRunningDetection(action.data);
return super.reduce(state, action);
case 'simulators/loaded':
// get simulator running state
if (Array.isArray(action.data)) {
@ -47,7 +59,7 @@ class SimulatorStore extends ArrayStore {
// check if simulator running state changed
simulator = state.find(element => element._id === action.simulator._id );
// only update if state changed
// is this simulator still in the state? update it only if state changed
if (simulator && simulator.running !== action.simulator.running) {
state = this.updateElements(state, [ action.simulator ]);
}