summaryrefslogtreecommitdiff
path: root/src/actions
diff options
context:
space:
mode:
Diffstat (limited to 'src/actions')
-rw-r--r--src/actions/modals/topology.js14
-rw-r--r--src/actions/topology.js17
2 files changed, 31 insertions, 0 deletions
diff --git a/src/actions/modals/topology.js b/src/actions/modals/topology.js
index 5e3fc803..ded8771a 100644
--- a/src/actions/modals/topology.js
+++ b/src/actions/modals/topology.js
@@ -1,5 +1,7 @@
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 function openEditRoomNameModal() {
return {
@@ -12,3 +14,15 @@ export function closeEditRoomNameModal() {
type: CLOSE_EDIT_ROOM_NAME_MODAL
};
}
+
+export function openDeleteRoomModal() {
+ return {
+ type: OPEN_DELETE_ROOM_MODAL
+ };
+}
+
+export function closeDeleteRoomModal() {
+ return {
+ type: CLOSE_DELETE_ROOM_MODAL
+ };
+}
diff --git a/src/actions/topology.js b/src/actions/topology.js
index 1f111f06..ec614c1c 100644
--- a/src/actions/topology.js
+++ b/src/actions/topology.js
@@ -1,4 +1,5 @@
import {findTileWithPosition} from "../util/tile-calculations";
+import {goDownOneInteractionLevel} from "./interaction-level";
import {addIdToStoreObjectListProp, addPropToStoreObject, removeIdFromStoreObjectListProp} from "./objects";
export const FETCH_TOPOLOGY_OF_DATACENTER = "FETCH_TOPOLOGY_OF_DATACENTER";
@@ -14,6 +15,7 @@ export const CANCEL_NEW_ROOM_CONSTRUCTION_SUCCEEDED = "CANCEL_NEW_ROOM_CONSTRUCT
export const ADD_TILE = "ADD_TILE";
export const DELETE_TILE = "DELETE_TILE";
export const EDIT_ROOM_NAME = "EDIT_ROOM_NAME";
+export const DELETE_ROOM = "DELETE_ROOM";
export const START_OBJECT_CONSTRUCTION = "START_OBJECT_CONSTRUCTION";
export const STOP_OBJECT_CONSTRUCTION = "STOP_OBJECT_CONSTRUCTION";
export const ADD_RACK_TO_TILE = "ADD_RACK_TO_TILE";
@@ -183,3 +185,18 @@ export function addRackToTileSucceeded(tileId, rackId) {
dispatch(addPropToStoreObject("tile", tileId, {objectId: rackId}));
};
}
+
+export function deleteRoom() {
+ return {
+ type: DELETE_ROOM
+ };
+}
+
+export function deleteRoomSucceeded() {
+ return (dispatch, getState) => {
+ const {currentDatacenterId, interactionLevel} = getState();
+ const currentRoomId = interactionLevel.roomId;
+ dispatch(goDownOneInteractionLevel());
+ dispatch(removeIdFromStoreObjectListProp("datacenter", currentDatacenterId, "roomIds", currentRoomId));
+ };
+}