diff options
| author | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2021-07-07 15:07:11 +0200 |
|---|---|---|
| committer | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2021-07-07 15:07:11 +0200 |
| commit | aa788a3ad18badfac8beaabdaffc88b9e52f9306 (patch) | |
| tree | 2046d0a401ca0853d5e85de9d6360edcb79f7ebd /opendc-web/opendc-web-ui/src/redux/reducers | |
| parent | 1ce8bf170cda2afab334cd330325cd4fbb97dab4 (diff) | |
ui: Remove current ids state from Redux
This change removes the current active identifiers from the Redux state.
Instead, we use the router query to track the active project, portfolio
and topology.
Diffstat (limited to 'opendc-web/opendc-web-ui/src/redux/reducers')
| -rw-r--r-- | opendc-web/opendc-web-ui/src/redux/reducers/current-ids.js | 44 | ||||
| -rw-r--r-- | opendc-web/opendc-web-ui/src/redux/reducers/index.js | 5 |
2 files changed, 1 insertions, 48 deletions
diff --git a/opendc-web/opendc-web-ui/src/redux/reducers/current-ids.js b/opendc-web/opendc-web-ui/src/redux/reducers/current-ids.js index 9b46aa60..c0baf567 100644 --- a/opendc-web/opendc-web-ui/src/redux/reducers/current-ids.js +++ b/opendc-web/opendc-web-ui/src/redux/reducers/current-ids.js @@ -1,7 +1,4 @@ -import { OPEN_PORTFOLIO_SUCCEEDED, SET_CURRENT_PORTFOLIO } from '../actions/portfolios' -import { OPEN_PROJECT_SUCCEEDED } from '../actions/projects' import { SET_CURRENT_TOPOLOGY } from '../actions/topology/building' -import { OPEN_SCENARIO_SUCCEEDED, SET_CURRENT_SCENARIO } from '../actions/scenarios' export function currentTopologyId(state = '-1', action) { switch (action.type) { @@ -11,44 +8,3 @@ export function currentTopologyId(state = '-1', action) { return state } } - -export function currentProjectId(state = '-1', action) { - switch (action.type) { - case OPEN_PROJECT_SUCCEEDED: - return action.id - case OPEN_PORTFOLIO_SUCCEEDED: - case OPEN_SCENARIO_SUCCEEDED: - return action.projectId - default: - return state - } -} - -export function currentPortfolioId(state = '-1', action) { - switch (action.type) { - case OPEN_PORTFOLIO_SUCCEEDED: - case SET_CURRENT_PORTFOLIO: - case SET_CURRENT_SCENARIO: - return action.portfolioId - case OPEN_SCENARIO_SUCCEEDED: - return action.portfolioId - case OPEN_PROJECT_SUCCEEDED: - case SET_CURRENT_TOPOLOGY: - return '-1' - default: - return state - } -} -export function currentScenarioId(state = '-1', action) { - switch (action.type) { - case OPEN_SCENARIO_SUCCEEDED: - case SET_CURRENT_SCENARIO: - return action.scenarioId - case OPEN_PORTFOLIO_SUCCEEDED: - case SET_CURRENT_TOPOLOGY: - case OPEN_PROJECT_SUCCEEDED: - return '-1' - default: - return state - } -} diff --git a/opendc-web/opendc-web-ui/src/redux/reducers/index.js b/opendc-web/opendc-web-ui/src/redux/reducers/index.js index b143d417..9f556d18 100644 --- a/opendc-web/opendc-web-ui/src/redux/reducers/index.js +++ b/opendc-web/opendc-web-ui/src/redux/reducers/index.js @@ -1,6 +1,6 @@ import { combineReducers } from 'redux' import { construction } from './construction-mode' -import { currentPortfolioId, currentProjectId, currentScenarioId, currentTopologyId } from './current-ids' +import { currentTopologyId } from './current-ids' import { interactionLevel } from './interaction-level' import { map } from './map' import { objects } from './objects' @@ -11,10 +11,7 @@ const rootReducer = combineReducers({ projects, construction, map, - currentProjectId, currentTopologyId, - currentPortfolioId, - currentScenarioId, interactionLevel, }) |
