summaryrefslogtreecommitdiff
path: root/src/reducers
diff options
context:
space:
mode:
authorGeorgios Andreadis <g.andreadis@student.tudelft.nl>2017-09-21 10:20:50 +0200
committerGeorgios Andreadis <g.andreadis@student.tudelft.nl>2017-09-23 10:06:04 +0200
commitda861719c6433a1fc9346da958f0907e52d578ce (patch)
treeb171796fbfe17f0356bf6e32430223c67812a760 /src/reducers
parentf8f617c97fcb2df3dbefc9527d974151e367cb60 (diff)
Show experiment and trace data on left-hand sidebar
Diffstat (limited to 'src/reducers')
-rw-r--r--src/reducers/construction-mode.js3
-rw-r--r--src/reducers/interaction-level.js7
-rw-r--r--src/reducers/modals.js2
-rw-r--r--src/reducers/simulation-mode.js9
4 files changed, 21 insertions, 0 deletions
diff --git a/src/reducers/construction-mode.js b/src/reducers/construction-mode.js
index 3e0b7542..e97c817e 100644
--- a/src/reducers/construction-mode.js
+++ b/src/reducers/construction-mode.js
@@ -1,4 +1,5 @@
import {combineReducers} from "redux";
+import {OPEN_EXPERIMENT_SUCCEEDED} from "../actions/experiments";
import {
CANCEL_NEW_ROOM_CONSTRUCTION_SUCCEEDED,
FINISH_NEW_ROOM_CONSTRUCTION,
@@ -12,6 +13,7 @@ export function currentRoomInConstruction(state = -1, action) {
return action.roomId;
case CANCEL_NEW_ROOM_CONSTRUCTION_SUCCEEDED:
case FINISH_NEW_ROOM_CONSTRUCTION:
+ case OPEN_EXPERIMENT_SUCCEEDED:
return -1;
default:
return state;
@@ -23,6 +25,7 @@ export function inRackConstructionMode(state = false, action) {
case START_RACK_CONSTRUCTION:
return true;
case STOP_RACK_CONSTRUCTION:
+ case OPEN_EXPERIMENT_SUCCEEDED:
return false;
default:
return state;
diff --git a/src/reducers/interaction-level.js b/src/reducers/interaction-level.js
index a3f3de7f..282e5096 100644
--- a/src/reducers/interaction-level.js
+++ b/src/reducers/interaction-level.js
@@ -1,12 +1,19 @@
+import {OPEN_EXPERIMENT_SUCCEEDED} from "../actions/experiments";
import {
GO_DOWN_ONE_INTERACTION_LEVEL,
GO_FROM_BUILDING_TO_ROOM,
GO_FROM_RACK_TO_MACHINE,
GO_FROM_ROOM_TO_RACK
} from "../actions/interaction-level";
+import {OPEN_SIMULATION_SUCCEEDED} from "../actions/simulations";
export function interactionLevel(state = {mode: "BUILDING"}, action) {
switch (action.type) {
+ case OPEN_EXPERIMENT_SUCCEEDED:
+ case OPEN_SIMULATION_SUCCEEDED:
+ return {
+ mode: "BUILDING"
+ };
case GO_FROM_BUILDING_TO_ROOM:
return {
mode: "ROOM",
diff --git a/src/reducers/modals.js b/src/reducers/modals.js
index 9f73c6ec..3e9f0327 100644
--- a/src/reducers/modals.js
+++ b/src/reducers/modals.js
@@ -1,4 +1,5 @@
import {combineReducers} from "redux";
+import {OPEN_EXPERIMENT_SUCCEEDED} from "../actions/experiments";
import {CLOSE_NEW_EXPERIMENT_MODAL, OPEN_NEW_EXPERIMENT_MODAL} from "../actions/modals/experiments";
import {CLOSE_DELETE_PROFILE_MODAL, OPEN_DELETE_PROFILE_MODAL} from "../actions/modals/profile";
import {CLOSE_NEW_SIMULATION_MODAL, OPEN_NEW_SIMULATION_MODAL} from "../actions/modals/simulations";
@@ -21,6 +22,7 @@ function modal(openAction, closeAction) {
case openAction:
return true;
case closeAction:
+ case OPEN_EXPERIMENT_SUCCEEDED:
return false;
default:
return state;
diff --git a/src/reducers/simulation-mode.js b/src/reducers/simulation-mode.js
index 60084824..b13ecbcc 100644
--- a/src/reducers/simulation-mode.js
+++ b/src/reducers/simulation-mode.js
@@ -2,11 +2,14 @@ import {OPEN_EXPERIMENT_SUCCEEDED} from "../actions/experiments";
import {CHANGE_LOAD_METRIC} from "../actions/simulation/load-metric";
import {SET_PLAYING} from "../actions/simulation/playback";
import {GO_TO_TICK, SET_LAST_SIMULATED_TICK} from "../actions/simulation/tick";
+import {OPEN_SIMULATION_SUCCEEDED} from "../actions/simulations";
export function currentExperimentId(state = -1, action) {
switch (action.type) {
case OPEN_EXPERIMENT_SUCCEEDED:
return action.experimentId;
+ case OPEN_SIMULATION_SUCCEEDED:
+ return -1;
default:
return state;
}
@@ -16,6 +19,8 @@ export function currentTick(state = 0, action) {
switch (action.type) {
case GO_TO_TICK:
return action.tick;
+ case OPEN_EXPERIMENT_SUCCEEDED:
+ return 0;
default:
return state;
}
@@ -34,6 +39,8 @@ export function isPlaying(state = false, action) {
switch (action.type) {
case SET_PLAYING:
return action.playing;
+ case OPEN_EXPERIMENT_SUCCEEDED:
+ return false;
default:
return state;
}
@@ -43,6 +50,8 @@ export function lastSimulatedTick(state = -1, action) {
switch (action.type) {
case SET_LAST_SIMULATED_TICK:
return action.tick;
+ case OPEN_EXPERIMENT_SUCCEEDED:
+ return -1;
default:
return state;
}