From eb208a7e2fd020ab5d07d11cc6d52d1e3dcfcc7c Mon Sep 17 00:00:00 2001 From: Georgios Andreadis Date: Sun, 17 Sep 2017 17:55:04 +0200 Subject: Add simulation mode framework Includes object states in the store (by tick), charting, and progress bars. --- src/reducers/current-ids.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/reducers/current-ids.js (limited to 'src/reducers/current-ids.js') diff --git a/src/reducers/current-ids.js b/src/reducers/current-ids.js new file mode 100644 index 00000000..c94d7861 --- /dev/null +++ b/src/reducers/current-ids.js @@ -0,0 +1,23 @@ +import {OPEN_SIMULATION_SUCCEEDED} from "../actions/simulations"; +import {FETCH_LATEST_DATACENTER_SUCCEEDED, RESET_CURRENT_DATACENTER} from "../actions/topology/building"; + +export function currentDatacenterId(state = -1, action) { + switch (action.type) { + case FETCH_LATEST_DATACENTER_SUCCEEDED: + return action.datacenterId; + case RESET_CURRENT_DATACENTER: + return -1; + default: + return state; + } +} + +export function currentSimulationId(state = -1, action) { + switch (action.type) { + case OPEN_SIMULATION_SUCCEEDED: + return action.id; + default: + return state; + } +} + -- cgit v1.2.3