From 07195f3762b6a8a7dfb44c2231db58c5be13c43f Mon Sep 17 00:00:00 2001 From: Georgios Andreadis Date: Wed, 16 Aug 2017 22:55:16 +0300 Subject: Rename project to sim and enable sim-adding --- src/actions/object-stores.js | 24 ------------------ src/actions/objects.js | 24 ++++++++++++++++++ src/actions/projects.js | 46 ----------------------------------- src/actions/simulations.js | 58 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 82 insertions(+), 70 deletions(-) delete mode 100644 src/actions/object-stores.js create mode 100644 src/actions/objects.js delete mode 100644 src/actions/projects.js create mode 100644 src/actions/simulations.js (limited to 'src/actions') diff --git a/src/actions/object-stores.js b/src/actions/object-stores.js deleted file mode 100644 index 08f3f0bd..00000000 --- a/src/actions/object-stores.js +++ /dev/null @@ -1,24 +0,0 @@ -export const ADD_TO_SIMULATION_STORE = "ADD_TO_SIMULATION_STORE"; -export const ADD_TO_AUTHORIZATION_STORE = "ADD_TO_AUTHORIZATION_STORE"; -export const ADD_TO_USER_STORE = "ADD_TO_USER_STORE"; - -export function addToSimulationStore(simulation) { - return { - type: ADD_TO_SIMULATION_STORE, - simulation - }; -} - -export function addToAuthorizationStore(authorization) { - return { - type: ADD_TO_AUTHORIZATION_STORE, - authorization - }; -} - -export function addToUserStore(user) { - return { - type: ADD_TO_USER_STORE, - user - } -} diff --git a/src/actions/objects.js b/src/actions/objects.js new file mode 100644 index 00000000..08f3f0bd --- /dev/null +++ b/src/actions/objects.js @@ -0,0 +1,24 @@ +export const ADD_TO_SIMULATION_STORE = "ADD_TO_SIMULATION_STORE"; +export const ADD_TO_AUTHORIZATION_STORE = "ADD_TO_AUTHORIZATION_STORE"; +export const ADD_TO_USER_STORE = "ADD_TO_USER_STORE"; + +export function addToSimulationStore(simulation) { + return { + type: ADD_TO_SIMULATION_STORE, + simulation + }; +} + +export function addToAuthorizationStore(authorization) { + return { + type: ADD_TO_AUTHORIZATION_STORE, + authorization + }; +} + +export function addToUserStore(user) { + return { + type: ADD_TO_USER_STORE, + user + } +} diff --git a/src/actions/projects.js b/src/actions/projects.js deleted file mode 100644 index efbd15e9..00000000 --- a/src/actions/projects.js +++ /dev/null @@ -1,46 +0,0 @@ -export const SET_AUTH_VISIBILITY_FILTER = "SET_AUTH_VISIBILITY_FILTER"; -export const OPEN_NEW_PROJECT_MODAL = "OPEN_NEW_PROJECT_MODAL"; -export const CLOSE_NEW_PROJECT_MODAL = "CLOSE_PROJECT_POPUP"; -export const ADD_PROJECT = "ADD_PROJECT"; -export const DELETE_PROJECT = "DELETE_PROJECT"; -export const OPEN_PROJECT = "OPEN_PROJECT"; - -export function setAuthVisibilityFilter(filter) { - return { - type: SET_AUTH_VISIBILITY_FILTER, - filter: filter - }; -} - -export function openNewProjectModal() { - return { - type: OPEN_NEW_PROJECT_MODAL - }; -} - -export function closeNewProjectModal() { - return { - type: CLOSE_NEW_PROJECT_MODAL - }; -} - -export function addProject(name) { - return { - type: ADD_PROJECT, - name - }; -} - -export function deleteProject(id) { - return { - type: DELETE_PROJECT, - id - }; -} - -export function openProject(id) { - return { - type: OPEN_PROJECT, - id - }; -} diff --git a/src/actions/simulations.js b/src/actions/simulations.js new file mode 100644 index 00000000..314a2492 --- /dev/null +++ b/src/actions/simulations.js @@ -0,0 +1,58 @@ +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"; +export const OPEN_SIMULATION = "OPEN_SIMULATION"; + +export function setAuthVisibilityFilter(filter) { + return { + type: SET_AUTH_VISIBILITY_FILTER, + filter: 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(); + dispatch({ + type: ADD_SIMULATION, + name, + userId: auth.userId + }); + }; +} + +export function addSimulationSucceeded(authorization) { + return { + type: ADD_SIMULATION_SUCCEEDED, + authorization + }; +} + +export function deleteSimulation(id) { + return { + type: DELETE_SIMULATION, + id + }; +} + +export function openSimulation(id) { + return { + type: OPEN_SIMULATION, + id + }; +} -- cgit v1.2.3