summaryrefslogtreecommitdiff
path: root/src/actions/topology.js
diff options
context:
space:
mode:
authorGeorgios Andreadis <g.andreadis@student.tudelft.nl>2017-09-01 16:42:13 +0200
committerGeorgios Andreadis <g.andreadis@student.tudelft.nl>2017-09-23 10:05:56 +0200
commit17ae0a3fafd806a5a533bf1d51a3ac708a8cf978 (patch)
treec3687bd08891ef3698f4773e44a6920856229dfe /src/actions/topology.js
parenteea529f57e3ee39d2f492062688b2848ced0a747 (diff)
Implement room name edit
Diffstat (limited to 'src/actions/topology.js')
-rw-r--r--src/actions/topology.js27
1 files changed, 16 insertions, 11 deletions
diff --git a/src/actions/topology.js b/src/actions/topology.js
index 76b1ef27..79f1bfb5 100644
--- a/src/actions/topology.js
+++ b/src/actions/topology.js
@@ -1,4 +1,4 @@
-import {addIdToStoreObjectListProp, removeIdFromStoreObjectListProp} from "./objects";
+import {addIdToStoreObjectListProp, addPropToStoreObject, removeIdFromStoreObjectListProp} from "./objects";
export const FETCH_TOPOLOGY_OF_DATACENTER = "FETCH_TOPOLOGY_OF_DATACENTER";
export const FETCH_TOPOLOGY_OF_DATACENTER_SUCCEEDED = "FETCH_TOPOLOGY_OF_DATACENTER_SUCCEEDED";
@@ -10,9 +10,8 @@ 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 ADD_TILE = "ADD_TILE";
-export const ADD_TILE_SUCCEEDED = "ADD_TILE_SUCCEEDED";
export const DELETE_TILE = "DELETE_TILE";
-export const DELETE_TILE_SUCCEEDED = "DELETE_TILE_SUCCEEDED";
+export const EDIT_ROOM_NAME = "EDIT_ROOM_NAME";
export function fetchLatestDatacenter() {
return (dispatch, getState) => {
@@ -107,10 +106,6 @@ export function addTileSucceeded(tileId) {
return (dispatch, getState) => {
const {currentRoomInConstruction} = getState();
dispatch(addIdToStoreObjectListProp("room", currentRoomInConstruction, "tileIds", tileId));
- dispatch({
- type: ADD_TILE_SUCCEEDED,
- tileId
- });
};
}
@@ -125,9 +120,19 @@ export function deleteTileSucceeded(tileId) {
return (dispatch, getState) => {
const {currentRoomInConstruction} = getState();
dispatch(removeIdFromStoreObjectListProp("room", currentRoomInConstruction, "tileIds", tileId));
- dispatch({
- type: DELETE_TILE_SUCCEEDED,
- tileId
- });
+ };
+}
+
+export function editRoomName(name) {
+ return {
+ type: EDIT_ROOM_NAME,
+ name
+ };
+}
+
+export function editRoomNameSucceeded(name) {
+ return (dispatch, getState) => {
+ const {interactionLevel} = getState();
+ dispatch(addPropToStoreObject("room", interactionLevel.roomId, {name}));
};
}