summaryrefslogtreecommitdiff
path: root/frontend/src/actions/simulation
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/src/actions/simulation')
-rw-r--r--frontend/src/actions/simulation/load-metric.js10
-rw-r--r--frontend/src/actions/simulation/playback.js18
-rw-r--r--frontend/src/actions/simulation/tick.js76
3 files changed, 52 insertions, 52 deletions
diff --git a/frontend/src/actions/simulation/load-metric.js b/frontend/src/actions/simulation/load-metric.js
index c59e3596..c59338ed 100644
--- a/frontend/src/actions/simulation/load-metric.js
+++ b/frontend/src/actions/simulation/load-metric.js
@@ -1,8 +1,8 @@
-export const CHANGE_LOAD_METRIC = "CHANGE_LOAD_METRIC";
+export const CHANGE_LOAD_METRIC = 'CHANGE_LOAD_METRIC'
export function changeLoadMetric(metric) {
- return {
- type: CHANGE_LOAD_METRIC,
- metric
- };
+ return {
+ type: CHANGE_LOAD_METRIC,
+ metric,
+ }
}
diff --git a/frontend/src/actions/simulation/playback.js b/frontend/src/actions/simulation/playback.js
index 8e913914..5d7d8af2 100644
--- a/frontend/src/actions/simulation/playback.js
+++ b/frontend/src/actions/simulation/playback.js
@@ -1,15 +1,15 @@
-export const SET_PLAYING = "SET_PLAYING";
+export const SET_PLAYING = 'SET_PLAYING'
export function playSimulation() {
- return {
- type: SET_PLAYING,
- playing: true
- };
+ return {
+ type: SET_PLAYING,
+ playing: true,
+ }
}
export function pauseSimulation() {
- return {
- type: SET_PLAYING,
- playing: false
- };
+ return {
+ type: SET_PLAYING,
+ playing: false,
+ }
}
diff --git a/frontend/src/actions/simulation/tick.js b/frontend/src/actions/simulation/tick.js
index a629b340..72387d24 100644
--- a/frontend/src/actions/simulation/tick.js
+++ b/frontend/src/actions/simulation/tick.js
@@ -1,49 +1,49 @@
-import { getDatacenterIdOfTick } from "../../util/timeline";
-import { setCurrentDatacenter } from "../topology/building";
+import { getDatacenterIdOfTick } from '../../util/timeline'
+import { setCurrentDatacenter } from '../topology/building'
-export const GO_TO_TICK = "GO_TO_TICK";
-export const SET_LAST_SIMULATED_TICK = "SET_LAST_SIMULATED_TICK";
+export const GO_TO_TICK = 'GO_TO_TICK'
+export const SET_LAST_SIMULATED_TICK = 'SET_LAST_SIMULATED_TICK'
export function incrementTick() {
- return (dispatch, getState) => {
- const { currentTick } = getState();
- dispatch(goToTick(currentTick + 1));
- };
+ return (dispatch, getState) => {
+ const { currentTick } = getState()
+ dispatch(goToTick(currentTick + 1))
+ }
}
export function goToTick(tick) {
- return (dispatch, getState) => {
- const state = getState();
-
- let sections = [];
- if (state.currentExperimentId !== -1) {
- const sectionIds =
- state.objects.path[
- state.objects.experiment[state.currentExperimentId].pathId
- ].sectionIds;
-
- if (sectionIds) {
- sections = sectionIds.map(
- sectionId => state.objects.section[sectionId]
- );
- }
- }
-
- const newDatacenterId = getDatacenterIdOfTick(tick, sections);
- if (state.currentDatacenterId !== newDatacenterId) {
- dispatch(setCurrentDatacenter(newDatacenterId));
+ return (dispatch, getState) => {
+ const state = getState()
+
+ let sections = []
+ if (state.currentExperimentId !== -1) {
+ const sectionIds =
+ state.objects.path[
+ state.objects.experiment[state.currentExperimentId].pathId
+ ].sectionIds
+
+ if (sectionIds) {
+ sections = sectionIds.map(
+ sectionId => state.objects.section[sectionId],
+ )
+ }
+ }
+
+ const newDatacenterId = getDatacenterIdOfTick(tick, sections)
+ if (state.currentDatacenterId !== newDatacenterId) {
+ dispatch(setCurrentDatacenter(newDatacenterId))
+ }
+
+ dispatch({
+ type: GO_TO_TICK,
+ tick,
+ })
}
-
- dispatch({
- type: GO_TO_TICK,
- tick
- });
- };
}
export function setLastSimulatedTick(tick) {
- return {
- type: SET_LAST_SIMULATED_TICK,
- tick
- };
+ return {
+ type: SET_LAST_SIMULATED_TICK,
+ tick,
+ }
}