summaryrefslogtreecommitdiff
path: root/src/actions
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
parenteea529f57e3ee39d2f492062688b2848ced0a747 (diff)
Implement room name edit
Diffstat (limited to 'src/actions')
-rw-r--r--src/actions/modals/profile.js14
-rw-r--r--src/actions/modals/simulations.js14
-rw-r--r--src/actions/modals/topology.js14
-rw-r--r--src/actions/profile.js13
-rw-r--r--src/actions/simulations.js14
-rw-r--r--src/actions/topology.js27
6 files changed, 59 insertions, 37 deletions
diff --git a/src/actions/modals/profile.js b/src/actions/modals/profile.js
new file mode 100644
index 00000000..421e7602
--- /dev/null
+++ b/src/actions/modals/profile.js
@@ -0,0 +1,14 @@
+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
+ };
+}
+
+export function closeDeleteProfileModal() {
+ return {
+ type: CLOSE_DELETE_PROFILE_MODAL
+ };
+}
diff --git a/src/actions/modals/simulations.js b/src/actions/modals/simulations.js
new file mode 100644
index 00000000..53d2c565
--- /dev/null
+++ b/src/actions/modals/simulations.js
@@ -0,0 +1,14 @@
+export const OPEN_NEW_SIMULATION_MODAL = "OPEN_NEW_SIMULATION_MODAL";
+export const CLOSE_NEW_SIMULATION_MODAL = "CLOSE_SIMULATION_POPUP";
+
+export function openNewSimulationModal() {
+ return {
+ type: OPEN_NEW_SIMULATION_MODAL
+ };
+}
+
+export function closeNewSimulationModal() {
+ return {
+ type: CLOSE_NEW_SIMULATION_MODAL
+ };
+}
diff --git a/src/actions/modals/topology.js b/src/actions/modals/topology.js
new file mode 100644
index 00000000..5e3fc803
--- /dev/null
+++ b/src/actions/modals/topology.js
@@ -0,0 +1,14 @@
+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 function openEditRoomNameModal() {
+ return {
+ type: OPEN_EDIT_ROOM_NAME_MODAL
+ };
+}
+
+export function closeEditRoomNameModal() {
+ return {
+ type: CLOSE_EDIT_ROOM_NAME_MODAL
+ };
+}
diff --git a/src/actions/profile.js b/src/actions/profile.js
index 421e7602..b28b04f6 100644
--- a/src/actions/profile.js
+++ b/src/actions/profile.js
@@ -1,14 +1,3 @@
-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
- };
-}
-export function closeDeleteProfileModal() {
- return {
- type: CLOSE_DELETE_PROFILE_MODAL
- };
-}
+
diff --git a/src/actions/simulations.js b/src/actions/simulations.js
index 2e722d16..145ceab2 100644
--- a/src/actions/simulations.js
+++ b/src/actions/simulations.js
@@ -1,6 +1,4 @@
export const SET_AUTH_VISIBILITY_FILTER = "SET_AUTH_VISIBILITY_FILTER";
-export const OPEN_NEW_SIMULATION_MODAL = "OPEN_NEW_SIMULATION_MODAL";
-export const CLOSE_NEW_SIMULATION_MODAL = "CLOSE_SIMULATION_POPUP";
export const ADD_SIMULATION = "ADD_SIMULATION";
export const ADD_SIMULATION_SUCCEEDED = "ADD_SIMULATION_SUCCEEDED";
export const DELETE_SIMULATION = "DELETE_SIMULATION";
@@ -14,18 +12,6 @@ export function setAuthVisibilityFilter(filter) {
};
}
-export function openNewSimulationModal() {
- return {
- type: OPEN_NEW_SIMULATION_MODAL
- };
-}
-
-export function closeNewSimulationModal() {
- return {
- type: CLOSE_NEW_SIMULATION_MODAL
- };
-}
-
export function addSimulation(name) {
return (dispatch, getState) => {
const {auth} = getState();
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}));
};
}