summaryrefslogtreecommitdiff
path: root/frontend/src/actions
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/src/actions')
-rw-r--r--frontend/src/actions/auth.js28
-rw-r--r--frontend/src/actions/experiments.js42
-rw-r--r--frontend/src/actions/interaction-level.js70
-rw-r--r--frontend/src/actions/map.js134
-rw-r--r--frontend/src/actions/modals/experiments.js16
-rw-r--r--frontend/src/actions/modals/profile.js16
-rw-r--r--frontend/src/actions/modals/simulations.js16
-rw-r--r--frontend/src/actions/modals/topology.js80
-rw-r--r--frontend/src/actions/objects.js62
-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
-rw-r--r--frontend/src/actions/simulations.js68
-rw-r--r--frontend/src/actions/states.js12
-rw-r--r--frontend/src/actions/topology/building.js152
-rw-r--r--frontend/src/actions/topology/machine.js32
-rw-r--r--frontend/src/actions/topology/rack.js28
-rw-r--r--frontend/src/actions/topology/room.js60
-rw-r--r--frontend/src/actions/users.js52
19 files changed, 486 insertions, 486 deletions
diff --git a/frontend/src/actions/auth.js b/frontend/src/actions/auth.js
index 45e2eb35..38c1a782 100644
--- a/frontend/src/actions/auth.js
+++ b/frontend/src/actions/auth.js
@@ -1,23 +1,23 @@
-export const LOG_IN = "LOG_IN";
-export const LOG_IN_SUCCEEDED = "LOG_IN_SUCCEEDED";
-export const LOG_OUT = "LOG_OUT";
+export const LOG_IN = 'LOG_IN'
+export const LOG_IN_SUCCEEDED = 'LOG_IN_SUCCEEDED'
+export const LOG_OUT = 'LOG_OUT'
export function logIn(payload) {
- return {
- type: LOG_IN,
- payload
- };
+ return {
+ type: LOG_IN,
+ payload,
+ }
}
export function logInSucceeded(payload) {
- return {
- type: LOG_IN_SUCCEEDED,
- payload
- };
+ return {
+ type: LOG_IN_SUCCEEDED,
+ payload,
+ }
}
export function logOut() {
- return {
- type: LOG_OUT
- };
+ return {
+ type: LOG_OUT,
+ }
}
diff --git a/frontend/src/actions/experiments.js b/frontend/src/actions/experiments.js
index b5709981..d0eda331 100644
--- a/frontend/src/actions/experiments.js
+++ b/frontend/src/actions/experiments.js
@@ -1,34 +1,34 @@
export const FETCH_EXPERIMENTS_OF_SIMULATION =
- "FETCH_EXPERIMENTS_OF_SIMULATION";
-export const ADD_EXPERIMENT = "ADD_EXPERIMENT";
-export const DELETE_EXPERIMENT = "DELETE_EXPERIMENT";
-export const OPEN_EXPERIMENT_SUCCEEDED = "OPEN_EXPERIMENT_SUCCEEDED";
+ 'FETCH_EXPERIMENTS_OF_SIMULATION'
+export const ADD_EXPERIMENT = 'ADD_EXPERIMENT'
+export const DELETE_EXPERIMENT = 'DELETE_EXPERIMENT'
+export const OPEN_EXPERIMENT_SUCCEEDED = 'OPEN_EXPERIMENT_SUCCEEDED'
export function fetchExperimentsOfSimulation(simulationId) {
- return {
- type: FETCH_EXPERIMENTS_OF_SIMULATION,
- simulationId
- };
+ return {
+ type: FETCH_EXPERIMENTS_OF_SIMULATION,
+ simulationId,
+ }
}
export function addExperiment(experiment) {
- return {
- type: ADD_EXPERIMENT,
- experiment
- };
+ return {
+ type: ADD_EXPERIMENT,
+ experiment,
+ }
}
export function deleteExperiment(id) {
- return {
- type: DELETE_EXPERIMENT,
- id
- };
+ return {
+ type: DELETE_EXPERIMENT,
+ id,
+ }
}
export function openExperimentSucceeded(simulationId, experimentId) {
- return {
- type: OPEN_EXPERIMENT_SUCCEEDED,
- simulationId,
- experimentId
- };
+ return {
+ type: OPEN_EXPERIMENT_SUCCEEDED,
+ simulationId,
+ experimentId,
+ }
}
diff --git a/frontend/src/actions/interaction-level.js b/frontend/src/actions/interaction-level.js
index 31120146..ff6b1fa3 100644
--- a/frontend/src/actions/interaction-level.js
+++ b/frontend/src/actions/interaction-level.js
@@ -1,50 +1,50 @@
-export const GO_FROM_BUILDING_TO_ROOM = "GO_FROM_BUILDING_TO_ROOM";
-export const GO_FROM_ROOM_TO_RACK = "GO_FROM_ROOM_TO_RACK";
-export const GO_FROM_RACK_TO_MACHINE = "GO_FROM_RACK_TO_MACHINE";
-export const GO_DOWN_ONE_INTERACTION_LEVEL = "GO_DOWN_ONE_INTERACTION_LEVEL";
+export const GO_FROM_BUILDING_TO_ROOM = 'GO_FROM_BUILDING_TO_ROOM'
+export const GO_FROM_ROOM_TO_RACK = 'GO_FROM_ROOM_TO_RACK'
+export const GO_FROM_RACK_TO_MACHINE = 'GO_FROM_RACK_TO_MACHINE'
+export const GO_DOWN_ONE_INTERACTION_LEVEL = 'GO_DOWN_ONE_INTERACTION_LEVEL'
export function goFromBuildingToRoom(roomId) {
- return (dispatch, getState) => {
- const { interactionLevel } = getState();
- if (interactionLevel.mode !== "BUILDING") {
- return;
- }
+ return (dispatch, getState) => {
+ const { interactionLevel } = getState()
+ if (interactionLevel.mode !== 'BUILDING') {
+ return
+ }
- dispatch({
- type: GO_FROM_BUILDING_TO_ROOM,
- roomId
- });
- };
+ dispatch({
+ type: GO_FROM_BUILDING_TO_ROOM,
+ roomId,
+ })
+ }
}
export function goFromRoomToRack(tileId) {
- return (dispatch, getState) => {
- const { interactionLevel } = getState();
- if (interactionLevel.mode !== "ROOM") {
- return;
+ return (dispatch, getState) => {
+ const { interactionLevel } = getState()
+ if (interactionLevel.mode !== 'ROOM') {
+ return
+ }
+ dispatch({
+ type: GO_FROM_ROOM_TO_RACK,
+ tileId,
+ })
}
- dispatch({
- type: GO_FROM_ROOM_TO_RACK,
- tileId
- });
- };
}
export function goFromRackToMachine(position) {
- return (dispatch, getState) => {
- const { interactionLevel } = getState();
- if (interactionLevel.mode !== "RACK") {
- return;
+ return (dispatch, getState) => {
+ const { interactionLevel } = getState()
+ if (interactionLevel.mode !== 'RACK') {
+ return
+ }
+ dispatch({
+ type: GO_FROM_RACK_TO_MACHINE,
+ position,
+ })
}
- dispatch({
- type: GO_FROM_RACK_TO_MACHINE,
- position
- });
- };
}
export function goDownOneInteractionLevel() {
- return {
- type: GO_DOWN_ONE_INTERACTION_LEVEL
- };
+ return {
+ type: GO_DOWN_ONE_INTERACTION_LEVEL,
+ }
}
diff --git a/frontend/src/actions/map.js b/frontend/src/actions/map.js
index 82546c00..4ab767f7 100644
--- a/frontend/src/actions/map.js
+++ b/frontend/src/actions/map.js
@@ -1,93 +1,93 @@
import {
- MAP_MAX_SCALE,
- MAP_MIN_SCALE,
- MAP_SCALE_PER_EVENT,
- MAP_SIZE_IN_PIXELS
-} from "../components/app/map/MapConstants";
+ MAP_MAX_SCALE,
+ MAP_MIN_SCALE,
+ MAP_SCALE_PER_EVENT,
+ MAP_SIZE_IN_PIXELS,
+} from '../components/app/map/MapConstants'
-export const SET_MAP_POSITION = "SET_MAP_POSITION";
-export const SET_MAP_DIMENSIONS = "SET_MAP_DIMENSIONS";
-export const SET_MAP_SCALE = "SET_MAP_SCALE";
+export const SET_MAP_POSITION = 'SET_MAP_POSITION'
+export const SET_MAP_DIMENSIONS = 'SET_MAP_DIMENSIONS'
+export const SET_MAP_SCALE = 'SET_MAP_SCALE'
export function setMapPosition(x, y) {
- return {
- type: SET_MAP_POSITION,
- x,
- y
- };
+ return {
+ type: SET_MAP_POSITION,
+ x,
+ y,
+ }
}
export function setMapDimensions(width, height) {
- return {
- type: SET_MAP_DIMENSIONS,
- width,
- height
- };
+ return {
+ type: SET_MAP_DIMENSIONS,
+ width,
+ height,
+ }
}
export function setMapScale(scale) {
- return {
- type: SET_MAP_SCALE,
- scale
- };
+ return {
+ type: SET_MAP_SCALE,
+ scale,
+ }
}
export function zoomInOnCenter(zoomIn) {
- return (dispatch, getState) => {
- const state = getState();
+ return (dispatch, getState) => {
+ const state = getState()
- dispatch(
- zoomInOnPosition(
- zoomIn,
- state.map.dimensions.width / 2,
- state.map.dimensions.height / 2
- )
- );
- };
+ dispatch(
+ zoomInOnPosition(
+ zoomIn,
+ state.map.dimensions.width / 2,
+ state.map.dimensions.height / 2,
+ ),
+ )
+ }
}
export function zoomInOnPosition(zoomIn, x, y) {
- return (dispatch, getState) => {
- const state = getState();
+ return (dispatch, getState) => {
+ const state = getState()
- const centerPoint = {
- x: x / state.map.scale - state.map.position.x / state.map.scale,
- y: y / state.map.scale - state.map.position.y / state.map.scale
- };
- const newScale = zoomIn
- ? state.map.scale * MAP_SCALE_PER_EVENT
- : state.map.scale / MAP_SCALE_PER_EVENT;
- const boundedScale = Math.min(
- Math.max(MAP_MIN_SCALE, newScale),
- MAP_MAX_SCALE
- );
+ const centerPoint = {
+ x: x / state.map.scale - state.map.position.x / state.map.scale,
+ y: y / state.map.scale - state.map.position.y / state.map.scale,
+ }
+ const newScale = zoomIn
+ ? state.map.scale * MAP_SCALE_PER_EVENT
+ : state.map.scale / MAP_SCALE_PER_EVENT
+ const boundedScale = Math.min(
+ Math.max(MAP_MIN_SCALE, newScale),
+ MAP_MAX_SCALE,
+ )
- const newX = -(centerPoint.x - x / boundedScale) * boundedScale;
- const newY = -(centerPoint.y - y / boundedScale) * boundedScale;
+ const newX = -(centerPoint.x - x / boundedScale) * boundedScale
+ const newY = -(centerPoint.y - y / boundedScale) * boundedScale
- dispatch(setMapPositionWithBoundsCheck(newX, newY));
- dispatch(setMapScale(boundedScale));
- };
+ dispatch(setMapPositionWithBoundsCheck(newX, newY))
+ dispatch(setMapScale(boundedScale))
+ }
}
export function setMapPositionWithBoundsCheck(x, y) {
- return (dispatch, getState) => {
- const state = getState();
+ return (dispatch, getState) => {
+ const state = getState()
- const scaledMapSize = MAP_SIZE_IN_PIXELS * state.map.scale;
- const updatedX =
- x > 0
- ? 0
- : x < -scaledMapSize + state.map.dimensions.width
- ? -scaledMapSize + state.map.dimensions.width
- : x;
- const updatedY =
- y > 0
- ? 0
- : y < -scaledMapSize + state.map.dimensions.height
- ? -scaledMapSize + state.map.dimensions.height
- : y;
+ const scaledMapSize = MAP_SIZE_IN_PIXELS * state.map.scale
+ const updatedX =
+ x > 0
+ ? 0
+ : x < -scaledMapSize + state.map.dimensions.width
+ ? -scaledMapSize + state.map.dimensions.width
+ : x
+ const updatedY =
+ y > 0
+ ? 0
+ : y < -scaledMapSize + state.map.dimensions.height
+ ? -scaledMapSize + state.map.dimensions.height
+ : y
- dispatch(setMapPosition(updatedX, updatedY));
- };
+ dispatch(setMapPosition(updatedX, updatedY))
+ }
}
diff --git a/frontend/src/actions/modals/experiments.js b/frontend/src/actions/modals/experiments.js
index df939fa5..37f1922f 100644
--- a/frontend/src/actions/modals/experiments.js
+++ b/frontend/src/actions/modals/experiments.js
@@ -1,14 +1,14 @@
-export const OPEN_NEW_EXPERIMENT_MODAL = "OPEN_NEW_EXPERIMENT_MODAL";
-export const CLOSE_NEW_EXPERIMENT_MODAL = "CLOSE_EXPERIMENT_MODAL";
+export const OPEN_NEW_EXPERIMENT_MODAL = 'OPEN_NEW_EXPERIMENT_MODAL'
+export const CLOSE_NEW_EXPERIMENT_MODAL = 'CLOSE_EXPERIMENT_MODAL'
export function openNewExperimentModal() {
- return {
- type: OPEN_NEW_EXPERIMENT_MODAL
- };
+ return {
+ type: OPEN_NEW_EXPERIMENT_MODAL,
+ }
}
export function closeNewExperimentModal() {
- return {
- type: CLOSE_NEW_EXPERIMENT_MODAL
- };
+ return {
+ type: CLOSE_NEW_EXPERIMENT_MODAL,
+ }
}
diff --git a/frontend/src/actions/modals/profile.js b/frontend/src/actions/modals/profile.js
index ee52610c..39c72c03 100644
--- a/frontend/src/actions/modals/profile.js
+++ b/frontend/src/actions/modals/profile.js
@@ -1,14 +1,14 @@
-export const OPEN_DELETE_PROFILE_MODAL = "OPEN_DELETE_PROFILE_MODAL";
-export const CLOSE_DELETE_PROFILE_MODAL = "CLOSE_DELETE_PROFILE_MODAL";
+export const OPEN_DELETE_PROFILE_MODAL = 'OPEN_DELETE_PROFILE_MODAL'
+export const CLOSE_DELETE_PROFILE_MODAL = 'CLOSE_DELETE_PROFILE_MODAL'
export function openDeleteProfileModal() {
- return {
- type: OPEN_DELETE_PROFILE_MODAL
- };
+ return {
+ type: OPEN_DELETE_PROFILE_MODAL,
+ }
}
export function closeDeleteProfileModal() {
- return {
- type: CLOSE_DELETE_PROFILE_MODAL
- };
+ return {
+ type: CLOSE_DELETE_PROFILE_MODAL,
+ }
}
diff --git a/frontend/src/actions/modals/simulations.js b/frontend/src/actions/modals/simulations.js
index b11d356c..0ef1cbaa 100644
--- a/frontend/src/actions/modals/simulations.js
+++ b/frontend/src/actions/modals/simulations.js
@@ -1,14 +1,14 @@
-export const OPEN_NEW_SIMULATION_MODAL = "OPEN_NEW_SIMULATION_MODAL";
-export const CLOSE_NEW_SIMULATION_MODAL = "CLOSE_SIMULATION_MODAL";
+export const OPEN_NEW_SIMULATION_MODAL = 'OPEN_NEW_SIMULATION_MODAL'
+export const CLOSE_NEW_SIMULATION_MODAL = 'CLOSE_SIMULATION_MODAL'
export function openNewSimulationModal() {
- return {
- type: OPEN_NEW_SIMULATION_MODAL
- };
+ return {
+ type: OPEN_NEW_SIMULATION_MODAL,
+ }
}
export function closeNewSimulationModal() {
- return {
- type: CLOSE_NEW_SIMULATION_MODAL
- };
+ return {
+ type: CLOSE_NEW_SIMULATION_MODAL,
+ }
}
diff --git a/frontend/src/actions/modals/topology.js b/frontend/src/actions/modals/topology.js
index 7ee16522..bc59e579 100644
--- a/frontend/src/actions/modals/topology.js
+++ b/frontend/src/actions/modals/topology.js
@@ -1,70 +1,70 @@
-export const OPEN_EDIT_ROOM_NAME_MODAL = "OPEN_EDIT_ROOM_NAME_MODAL";
-export const CLOSE_EDIT_ROOM_NAME_MODAL = "CLOSE_EDIT_ROOM_NAME_MODAL";
-export const OPEN_DELETE_ROOM_MODAL = "OPEN_DELETE_ROOM_MODAL";
-export const CLOSE_DELETE_ROOM_MODAL = "CLOSE_DELETE_ROOM_MODAL";
-export const OPEN_EDIT_RACK_NAME_MODAL = "OPEN_EDIT_RACK_NAME_MODAL";
-export const CLOSE_EDIT_RACK_NAME_MODAL = "CLOSE_EDIT_RACK_NAME_MODAL";
-export const OPEN_DELETE_RACK_MODAL = "OPEN_DELETE_RACK_MODAL";
-export const CLOSE_DELETE_RACK_MODAL = "CLOSE_DELETE_RACK_MODAL";
-export const OPEN_DELETE_MACHINE_MODAL = "OPEN_DELETE_MACHINE_MODAL";
-export const CLOSE_DELETE_MACHINE_MODAL = "CLOSE_DELETE_MACHINE_MODAL";
+export const OPEN_EDIT_ROOM_NAME_MODAL = 'OPEN_EDIT_ROOM_NAME_MODAL'
+export const CLOSE_EDIT_ROOM_NAME_MODAL = 'CLOSE_EDIT_ROOM_NAME_MODAL'
+export const OPEN_DELETE_ROOM_MODAL = 'OPEN_DELETE_ROOM_MODAL'
+export const CLOSE_DELETE_ROOM_MODAL = 'CLOSE_DELETE_ROOM_MODAL'
+export const OPEN_EDIT_RACK_NAME_MODAL = 'OPEN_EDIT_RACK_NAME_MODAL'
+export const CLOSE_EDIT_RACK_NAME_MODAL = 'CLOSE_EDIT_RACK_NAME_MODAL'
+export const OPEN_DELETE_RACK_MODAL = 'OPEN_DELETE_RACK_MODAL'
+export const CLOSE_DELETE_RACK_MODAL = 'CLOSE_DELETE_RACK_MODAL'
+export const OPEN_DELETE_MACHINE_MODAL = 'OPEN_DELETE_MACHINE_MODAL'
+export const CLOSE_DELETE_MACHINE_MODAL = 'CLOSE_DELETE_MACHINE_MODAL'
export function openEditRoomNameModal() {
- return {
- type: OPEN_EDIT_ROOM_NAME_MODAL
- };
+ return {
+ type: OPEN_EDIT_ROOM_NAME_MODAL,
+ }
}
export function closeEditRoomNameModal() {
- return {
- type: CLOSE_EDIT_ROOM_NAME_MODAL
- };
+ return {
+ type: CLOSE_EDIT_ROOM_NAME_MODAL,
+ }
}
export function openDeleteRoomModal() {
- return {
- type: OPEN_DELETE_ROOM_MODAL
- };
+ return {
+ type: OPEN_DELETE_ROOM_MODAL,
+ }
}
export function closeDeleteRoomModal() {
- return {
- type: CLOSE_DELETE_ROOM_MODAL
- };
+ return {
+ type: CLOSE_DELETE_ROOM_MODAL,
+ }
}
export function openEditRackNameModal() {
- return {
- type: OPEN_EDIT_RACK_NAME_MODAL
- };
+ return {
+ type: OPEN_EDIT_RACK_NAME_MODAL,
+ }
}
export function closeEditRackNameModal() {
- return {
- type: CLOSE_EDIT_RACK_NAME_MODAL
- };
+ return {
+ type: CLOSE_EDIT_RACK_NAME_MODAL,
+ }
}
export function openDeleteRackModal() {
- return {
- type: OPEN_DELETE_RACK_MODAL
- };
+ return {
+ type: OPEN_DELETE_RACK_MODAL,
+ }
}
export function closeDeleteRackModal() {
- return {
- type: CLOSE_DELETE_RACK_MODAL
- };
+ return {
+ type: CLOSE_DELETE_RACK_MODAL,
+ }
}
export function openDeleteMachineModal() {
- return {
- type: OPEN_DELETE_MACHINE_MODAL
- };
+ return {
+ type: OPEN_DELETE_MACHINE_MODAL,
+ }
}
export function closeDeleteMachineModal() {
- return {
- type: CLOSE_DELETE_MACHINE_MODAL
- };
+ return {
+ type: CLOSE_DELETE_MACHINE_MODAL,
+ }
}
diff --git a/frontend/src/actions/objects.js b/frontend/src/actions/objects.js
index 80b56c0c..2b445c9d 100644
--- a/frontend/src/actions/objects.js
+++ b/frontend/src/actions/objects.js
@@ -1,48 +1,48 @@
-export const ADD_TO_STORE = "ADD_TO_STORE";
-export const ADD_PROP_TO_STORE_OBJECT = "ADD_PROP_TO_STORE_OBJECT";
+export const ADD_TO_STORE = 'ADD_TO_STORE'
+export const ADD_PROP_TO_STORE_OBJECT = 'ADD_PROP_TO_STORE_OBJECT'
export const ADD_ID_TO_STORE_OBJECT_LIST_PROP =
- "ADD_ID_TO_STORE_OBJECT_LIST_PROP";
+ 'ADD_ID_TO_STORE_OBJECT_LIST_PROP'
export const REMOVE_ID_FROM_STORE_OBJECT_LIST_PROP =
- "REMOVE_ID_FROM_STORE_OBJECT_LIST_PROP";
+ 'REMOVE_ID_FROM_STORE_OBJECT_LIST_PROP'
export function addToStore(objectType, object) {
- return {
- type: ADD_TO_STORE,
- objectType,
- object
- };
+ return {
+ type: ADD_TO_STORE,
+ objectType,
+ object,
+ }
}
export function addPropToStoreObject(objectType, objectId, propObject) {
- return {
- type: ADD_PROP_TO_STORE_OBJECT,
- objectType,
- objectId,
- propObject
- };
+ return {
+ type: ADD_PROP_TO_STORE_OBJECT,
+ objectType,
+ objectId,
+ propObject,
+ }
}
export function addIdToStoreObjectListProp(objectType, objectId, propName, id) {
- return {
- type: ADD_ID_TO_STORE_OBJECT_LIST_PROP,
- objectType,
- objectId,
- propName,
- id
- };
+ return {
+ type: ADD_ID_TO_STORE_OBJECT_LIST_PROP,
+ objectType,
+ objectId,
+ propName,
+ id,
+ }
}
export function removeIdFromStoreObjectListProp(
- objectType,
- objectId,
- propName,
- id
-) {
- return {
- type: REMOVE_ID_FROM_STORE_OBJECT_LIST_PROP,
objectType,
objectId,
propName,
- id
- };
+ id,
+) {
+ return {
+ type: REMOVE_ID_FROM_STORE_OBJECT_LIST_PROP,
+ objectType,
+ objectId,
+ propName,
+ id,
+ }
}
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,
+ }
}
diff --git a/frontend/src/actions/simulations.js b/frontend/src/actions/simulations.js
index 6da7aa3a..779e9b9e 100644
--- a/frontend/src/actions/simulations.js
+++ b/frontend/src/actions/simulations.js
@@ -1,52 +1,52 @@
-export const SET_AUTH_VISIBILITY_FILTER = "SET_AUTH_VISIBILITY_FILTER";
-export const ADD_SIMULATION = "ADD_SIMULATION";
-export const ADD_SIMULATION_SUCCEEDED = "ADD_SIMULATION_SUCCEEDED";
-export const DELETE_SIMULATION = "DELETE_SIMULATION";
-export const DELETE_SIMULATION_SUCCEEDED = "DELETE_SIMULATION_SUCCEEDED";
-export const OPEN_SIMULATION_SUCCEEDED = "OPEN_SIMULATION_SUCCEEDED";
+export const SET_AUTH_VISIBILITY_FILTER = 'SET_AUTH_VISIBILITY_FILTER'
+export const ADD_SIMULATION = 'ADD_SIMULATION'
+export const ADD_SIMULATION_SUCCEEDED = 'ADD_SIMULATION_SUCCEEDED'
+export const DELETE_SIMULATION = 'DELETE_SIMULATION'
+export const DELETE_SIMULATION_SUCCEEDED = 'DELETE_SIMULATION_SUCCEEDED'
+export const OPEN_SIMULATION_SUCCEEDED = 'OPEN_SIMULATION_SUCCEEDED'
export function setAuthVisibilityFilter(filter) {
- return {
- type: SET_AUTH_VISIBILITY_FILTER,
- filter
- };
+ return {
+ type: SET_AUTH_VISIBILITY_FILTER,
+ filter,
+ }
}
export function addSimulation(name) {
- return (dispatch, getState) => {
- const { auth } = getState();
- dispatch({
- type: ADD_SIMULATION,
- name,
- userId: auth.userId
- });
- };
+ return (dispatch, getState) => {
+ const { auth } = getState()
+ dispatch({
+ type: ADD_SIMULATION,
+ name,
+ userId: auth.userId,
+ })
+ }
}
export function addSimulationSucceeded(authorization) {
- return {
- type: ADD_SIMULATION_SUCCEEDED,
- authorization
- };
+ return {
+ type: ADD_SIMULATION_SUCCEEDED,
+ authorization,
+ }
}
export function deleteSimulation(id) {
- return {
- type: DELETE_SIMULATION,
- id
- };
+ return {
+ type: DELETE_SIMULATION,
+ id,
+ }
}
export function deleteSimulationSucceeded(id) {
- return {
- type: DELETE_SIMULATION_SUCCEEDED,
- id
- };
+ return {
+ type: DELETE_SIMULATION_SUCCEEDED,
+ id,
+ }
}
export function openSimulationSucceeded(id) {
- return {
- type: OPEN_SIMULATION_SUCCEEDED,
- id
- };
+ return {
+ type: OPEN_SIMULATION_SUCCEEDED,
+ id,
+ }
}
diff --git a/frontend/src/actions/states.js b/frontend/src/actions/states.js
index b3a355a2..430fbd09 100644
--- a/frontend/src/actions/states.js
+++ b/frontend/src/actions/states.js
@@ -1,9 +1,9 @@
-export const ADD_BATCH_TO_STATES = "ADD_BATCH_TO_STATES";
+export const ADD_BATCH_TO_STATES = 'ADD_BATCH_TO_STATES'
export function addBatchToStates(objectType, objects) {
- return {
- type: ADD_BATCH_TO_STATES,
- objectType,
- objects
- };
+ return {
+ type: ADD_BATCH_TO_STATES,
+ objectType,
+ objects,
+ }
}
diff --git a/frontend/src/actions/topology/building.js b/frontend/src/actions/topology/building.js
index c6381a07..2d4d399c 100644
--- a/frontend/src/actions/topology/building.js
+++ b/frontend/src/actions/topology/building.js
@@ -1,117 +1,117 @@
-export const SET_CURRENT_DATACENTER = "SET_CURRENT_DATACENTER";
-export const RESET_CURRENT_DATACENTER = "RESET_CURRENT_DATACENTER";
-export const START_NEW_ROOM_CONSTRUCTION = "START_NEW_ROOM_CONSTRUCTION";
+export const SET_CURRENT_DATACENTER = 'SET_CURRENT_DATACENTER'
+export const RESET_CURRENT_DATACENTER = 'RESET_CURRENT_DATACENTER'
+export const START_NEW_ROOM_CONSTRUCTION = 'START_NEW_ROOM_CONSTRUCTION'
export const START_NEW_ROOM_CONSTRUCTION_SUCCEEDED =
- "START_NEW_ROOM_CONSTRUCTION_SUCCEEDED";
-export const FINISH_NEW_ROOM_CONSTRUCTION = "FINISH_NEW_ROOM_CONSTRUCTION";
-export const CANCEL_NEW_ROOM_CONSTRUCTION = "CANCEL_NEW_ROOM_CONSTRUCTION";
+ 'START_NEW_ROOM_CONSTRUCTION_SUCCEEDED'
+export const FINISH_NEW_ROOM_CONSTRUCTION = 'FINISH_NEW_ROOM_CONSTRUCTION'
+export const CANCEL_NEW_ROOM_CONSTRUCTION = 'CANCEL_NEW_ROOM_CONSTRUCTION'
export const CANCEL_NEW_ROOM_CONSTRUCTION_SUCCEEDED =
- "CANCEL_NEW_ROOM_CONSTRUCTION_SUCCEEDED";
-export const START_ROOM_EDIT = "START_ROOM_EDIT";
-export const FINISH_ROOM_EDIT = "FINISH_ROOM_EDIT";
-export const ADD_TILE = "ADD_TILE";
-export const DELETE_TILE = "DELETE_TILE";
+ 'CANCEL_NEW_ROOM_CONSTRUCTION_SUCCEEDED'
+export const START_ROOM_EDIT = 'START_ROOM_EDIT'
+export const FINISH_ROOM_EDIT = 'FINISH_ROOM_EDIT'
+export const ADD_TILE = 'ADD_TILE'
+export const DELETE_TILE = 'DELETE_TILE'
export function setCurrentDatacenter(datacenterId) {
- return {
- type: SET_CURRENT_DATACENTER,
- datacenterId
- };
+ return {
+ type: SET_CURRENT_DATACENTER,
+ datacenterId,
+ }
}
export function resetCurrentDatacenter() {
- return {
- type: RESET_CURRENT_DATACENTER
- };
+ return {
+ type: RESET_CURRENT_DATACENTER,
+ }
}
export function startNewRoomConstruction() {
- return {
- type: START_NEW_ROOM_CONSTRUCTION
- };
+ return {
+ type: START_NEW_ROOM_CONSTRUCTION,
+ }
}
export function startNewRoomConstructionSucceeded(roomId) {
- return {
- type: START_NEW_ROOM_CONSTRUCTION_SUCCEEDED,
- roomId
- };
+ return {
+ type: START_NEW_ROOM_CONSTRUCTION_SUCCEEDED,
+ roomId,
+ }
}
export function finishNewRoomConstruction() {
- return (dispatch, getState) => {
- const { objects, construction } = getState();
- if (
- objects.room[construction.currentRoomInConstruction].tileIds.length === 0
- ) {
- dispatch(cancelNewRoomConstruction());
- return;
- }
+ return (dispatch, getState) => {
+ const { objects, construction } = getState()
+ if (
+ objects.room[construction.currentRoomInConstruction].tileIds.length === 0
+ ) {
+ dispatch(cancelNewRoomConstruction())
+ return
+ }
- dispatch({
- type: FINISH_NEW_ROOM_CONSTRUCTION
- });
- };
+ dispatch({
+ type: FINISH_NEW_ROOM_CONSTRUCTION,
+ })
+ }
}
export function cancelNewRoomConstruction() {
- return {
- type: CANCEL_NEW_ROOM_CONSTRUCTION
- };
+ return {
+ type: CANCEL_NEW_ROOM_CONSTRUCTION,
+ }
}
export function cancelNewRoomConstructionSucceeded() {
- return {
- type: CANCEL_NEW_ROOM_CONSTRUCTION_SUCCEEDED
- };
+ return {
+ type: CANCEL_NEW_ROOM_CONSTRUCTION_SUCCEEDED,
+ }
}
export function startRoomEdit() {
- return (dispatch, getState) => {
- const { interactionLevel } = getState();
- dispatch({
- type: START_ROOM_EDIT,
- roomId: interactionLevel.roomId
- });
- };
+ return (dispatch, getState) => {
+ const { interactionLevel } = getState()
+ dispatch({
+ type: START_ROOM_EDIT,
+ roomId: interactionLevel.roomId,
+ })
+ }
}
export function finishRoomEdit() {
- return {
- type: FINISH_ROOM_EDIT
- };
+ return {
+ type: FINISH_ROOM_EDIT,
+ }
}
export function toggleTileAtLocation(positionX, positionY) {
- return (dispatch, getState) => {
- const { objects, construction } = getState();
+ return (dispatch, getState) => {
+ const { objects, construction } = getState()
- const tileIds =
- objects.room[construction.currentRoomInConstruction].tileIds;
- for (let index in tileIds) {
- if (
- objects.tile[tileIds[index]].positionX === positionX &&
- objects.tile[tileIds[index]].positionY === positionY
- ) {
- dispatch(deleteTile(tileIds[index]));
- return;
- }
+ const tileIds =
+ objects.room[construction.currentRoomInConstruction].tileIds
+ for (let index in tileIds) {
+ if (
+ objects.tile[tileIds[index]].positionX === positionX &&
+ objects.tile[tileIds[index]].positionY === positionY
+ ) {
+ dispatch(deleteTile(tileIds[index]))
+ return
+ }
+ }
+ dispatch(addTile(positionX, positionY))
}
- dispatch(addTile(positionX, positionY));
- };
}
export function addTile(positionX, positionY) {
- return {
- type: ADD_TILE,
- positionX,
- positionY
- };
+ return {
+ type: ADD_TILE,
+ positionX,
+ positionY,
+ }
}
export function deleteTile(tileId) {
- return {
- type: DELETE_TILE,
- tileId
- };
+ return {
+ type: DELETE_TILE,
+ tileId,
+ }
}
diff --git a/frontend/src/actions/topology/machine.js b/frontend/src/actions/topology/machine.js
index 56968b7d..17ccce5d 100644
--- a/frontend/src/actions/topology/machine.js
+++ b/frontend/src/actions/topology/machine.js
@@ -1,25 +1,25 @@
-export const DELETE_MACHINE = "DELETE_MACHINE";
-export const ADD_UNIT = "ADD_UNIT";
-export const DELETE_UNIT = "DELETE_UNIT";
+export const DELETE_MACHINE = 'DELETE_MACHINE'
+export const ADD_UNIT = 'ADD_UNIT'
+export const DELETE_UNIT = 'DELETE_UNIT'
export function deleteMachine() {
- return {
- type: DELETE_MACHINE
- };
+ return {
+ type: DELETE_MACHINE,
+ }
}
export function addUnit(unitType, id) {
- return {
- type: ADD_UNIT,
- unitType,
- id
- };
+ return {
+ type: ADD_UNIT,
+ unitType,
+ id,
+ }
}
export function deleteUnit(unitType, index) {
- return {
- type: DELETE_UNIT,
- unitType,
- index
- };
+ return {
+ type: DELETE_UNIT,
+ unitType,
+ index,
+ }
}
diff --git a/frontend/src/actions/topology/rack.js b/frontend/src/actions/topology/rack.js
index 06988424..b117402e 100644
--- a/frontend/src/actions/topology/rack.js
+++ b/frontend/src/actions/topology/rack.js
@@ -1,23 +1,23 @@
-export const EDIT_RACK_NAME = "EDIT_RACK_NAME";
-export const DELETE_RACK = "DELETE_RACK";
-export const ADD_MACHINE = "ADD_MACHINE";
+export const EDIT_RACK_NAME = 'EDIT_RACK_NAME'
+export const DELETE_RACK = 'DELETE_RACK'
+export const ADD_MACHINE = 'ADD_MACHINE'
export function editRackName(name) {
- return {
- type: EDIT_RACK_NAME,
- name
- };
+ return {
+ type: EDIT_RACK_NAME,
+ name,
+ }
}
export function deleteRack() {
- return {
- type: DELETE_RACK
- };
+ return {
+ type: DELETE_RACK,
+ }
}
export function addMachine(position) {
- return {
- type: ADD_MACHINE,
- position
- };
+ return {
+ type: ADD_MACHINE,
+ position,
+ }
}
diff --git a/frontend/src/actions/topology/room.js b/frontend/src/actions/topology/room.js
index 4e0fc3a2..3476f0b6 100644
--- a/frontend/src/actions/topology/room.js
+++ b/frontend/src/actions/topology/room.js
@@ -1,48 +1,48 @@
-import { findTileWithPosition } from "../../util/tile-calculations";
+import { findTileWithPosition } from '../../util/tile-calculations'
-export const EDIT_ROOM_NAME = "EDIT_ROOM_NAME";
-export const DELETE_ROOM = "DELETE_ROOM";
-export const START_RACK_CONSTRUCTION = "START_RACK_CONSTRUCTION";
-export const STOP_RACK_CONSTRUCTION = "STOP_RACK_CONSTRUCTION";
-export const ADD_RACK_TO_TILE = "ADD_RACK_TO_TILE";
+export const EDIT_ROOM_NAME = 'EDIT_ROOM_NAME'
+export const DELETE_ROOM = 'DELETE_ROOM'
+export const START_RACK_CONSTRUCTION = 'START_RACK_CONSTRUCTION'
+export const STOP_RACK_CONSTRUCTION = 'STOP_RACK_CONSTRUCTION'
+export const ADD_RACK_TO_TILE = 'ADD_RACK_TO_TILE'
export function editRoomName(name) {
- return {
- type: EDIT_ROOM_NAME,
- name
- };
+ return {
+ type: EDIT_ROOM_NAME,
+ name,
+ }
}
export function startRackConstruction() {
- return {
- type: START_RACK_CONSTRUCTION
- };
+ return {
+ type: START_RACK_CONSTRUCTION,
+ }
}
export function stopRackConstruction() {
- return {
- type: STOP_RACK_CONSTRUCTION
- };
+ return {
+ type: STOP_RACK_CONSTRUCTION,
+ }
}
export function addRackToTile(positionX, positionY) {
- return (dispatch, getState) => {
- const { objects, interactionLevel } = getState();
- const currentRoom = objects.room[interactionLevel.roomId];
- const tiles = currentRoom.tileIds.map(tileId => objects.tile[tileId]);
- const tile = findTileWithPosition(tiles, positionX, positionY);
+ return (dispatch, getState) => {
+ const { objects, interactionLevel } = getState()
+ const currentRoom = objects.room[interactionLevel.roomId]
+ const tiles = currentRoom.tileIds.map(tileId => objects.tile[tileId])
+ const tile = findTileWithPosition(tiles, positionX, positionY)
- if (tile !== null) {
- dispatch({
- type: ADD_RACK_TO_TILE,
- tileId: tile.id
- });
+ if (tile !== null) {
+ dispatch({
+ type: ADD_RACK_TO_TILE,
+ tileId: tile.id,
+ })
+ }
}
- };
}
export function deleteRoom() {
- return {
- type: DELETE_ROOM
- };
+ return {
+ type: DELETE_ROOM,
+ }
}
diff --git a/frontend/src/actions/users.js b/frontend/src/actions/users.js
index dc393df9..cae7e211 100644
--- a/frontend/src/actions/users.js
+++ b/frontend/src/actions/users.js
@@ -1,41 +1,41 @@
export const FETCH_AUTHORIZATIONS_OF_CURRENT_USER =
- "FETCH_AUTHORIZATIONS_OF_CURRENT_USER";
+ 'FETCH_AUTHORIZATIONS_OF_CURRENT_USER'
export const FETCH_AUTHORIZATIONS_OF_CURRENT_USER_SUCCEEDED =
- "FETCH_AUTHORIZATIONS_OF_CURRENT_USER_SUCCEEDED";
-export const DELETE_CURRENT_USER = "DELETE_CURRENT_USER";
-export const DELETE_CURRENT_USER_SUCCEEDED = "DELETE_CURRENT_USER_SUCCEEDED";
+ 'FETCH_AUTHORIZATIONS_OF_CURRENT_USER_SUCCEEDED'
+export const DELETE_CURRENT_USER = 'DELETE_CURRENT_USER'
+export const DELETE_CURRENT_USER_SUCCEEDED = 'DELETE_CURRENT_USER_SUCCEEDED'
export function fetchAuthorizationsOfCurrentUser() {
- return (dispatch, getState) => {
- const { auth } = getState();
- dispatch({
- type: FETCH_AUTHORIZATIONS_OF_CURRENT_USER,
- userId: auth.userId
- });
- };
+ return (dispatch, getState) => {
+ const { auth } = getState()
+ dispatch({
+ type: FETCH_AUTHORIZATIONS_OF_CURRENT_USER,
+ userId: auth.userId,
+ })
+ }
}
export function fetchAuthorizationsOfCurrentUserSucceeded(
- authorizationsOfCurrentUser
+ authorizationsOfCurrentUser,
) {
- return {
- type: FETCH_AUTHORIZATIONS_OF_CURRENT_USER_SUCCEEDED,
- authorizationsOfCurrentUser
- };
+ return {
+ type: FETCH_AUTHORIZATIONS_OF_CURRENT_USER_SUCCEEDED,
+ authorizationsOfCurrentUser,
+ }
}
export function deleteCurrentUser() {
- return (dispatch, getState) => {
- const { auth } = getState();
- dispatch({
- type: DELETE_CURRENT_USER,
- userId: auth.userId
- });
- };
+ return (dispatch, getState) => {
+ const { auth } = getState()
+ dispatch({
+ type: DELETE_CURRENT_USER,
+ userId: auth.userId,
+ })
+ }
}
export function deleteCurrentUserSucceeded() {
- return {
- type: DELETE_CURRENT_USER_SUCCEEDED
- };
+ return {
+ type: DELETE_CURRENT_USER_SUCCEEDED,
+ }
}