summaryrefslogtreecommitdiff
path: root/src/actions/topology/machine.js
diff options
context:
space:
mode:
authorGeorgios Andreadis <g.andreadis@student.tudelft.nl>2017-09-07 22:15:17 +0200
committerGeorgios Andreadis <g.andreadis@student.tudelft.nl>2017-09-23 10:05:58 +0200
commit1b5d2658f9ec06308b2a5ed062f6f5b4798ed733 (patch)
tree84d35684a50f897fc4c5f460bed595adf22c9e66 /src/actions/topology/machine.js
parent8218c3d3c21bfa7c4f3ee4872722b9b1261576fb (diff)
Reorganize actions and state tree
Diffstat (limited to 'src/actions/topology/machine.js')
-rw-r--r--src/actions/topology/machine.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/actions/topology/machine.js b/src/actions/topology/machine.js
new file mode 100644
index 00000000..af258a6f
--- /dev/null
+++ b/src/actions/topology/machine.js
@@ -0,0 +1,21 @@
+import {goDownOneInteractionLevel} from "../interaction-level";
+import {addPropToStoreObject} from "../objects";
+
+export const DELETE_MACHINE = "DELETE_MACHINE";
+
+export function deleteMachine() {
+ return {
+ type: DELETE_MACHINE
+ };
+}
+
+export function deleteMachineSucceeded() {
+ return (dispatch, getState) => {
+ const {interactionLevel, objects} = getState();
+ const rack = objects.rack[objects.tile[interactionLevel.tileId].objectId];
+ const machineIds = [...rack.machineIds];
+ machineIds[interactionLevel.position - 1] = null;
+ dispatch(goDownOneInteractionLevel());
+ dispatch(addPropToStoreObject("rack", rack.id, {machineIds}));
+ };
+}