From aa788a3ad18badfac8beaabdaffc88b9e52f9306 Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Wed, 7 Jul 2021 15:07:11 +0200 Subject: 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. --- opendc-web/opendc-web-ui/src/redux/actions/portfolios.js | 11 ++--------- opendc-web/opendc-web-ui/src/redux/actions/scenarios.js | 9 --------- opendc-web/opendc-web-ui/src/redux/actions/topologies.js | 3 ++- 3 files changed, 4 insertions(+), 19 deletions(-) (limited to 'opendc-web/opendc-web-ui/src/redux/actions') diff --git a/opendc-web/opendc-web-ui/src/redux/actions/portfolios.js b/opendc-web/opendc-web-ui/src/redux/actions/portfolios.js index d37886d8..923cd217 100644 --- a/opendc-web/opendc-web-ui/src/redux/actions/portfolios.js +++ b/opendc-web/opendc-web-ui/src/redux/actions/portfolios.js @@ -2,11 +2,11 @@ export const ADD_PORTFOLIO = 'ADD_PORTFOLIO' export const UPDATE_PORTFOLIO = 'UPDATE_PORTFOLIO' export const DELETE_PORTFOLIO = 'DELETE_PORTFOLIO' export const OPEN_PORTFOLIO_SUCCEEDED = 'OPEN_PORTFOLIO_SUCCEEDED' -export const SET_CURRENT_PORTFOLIO = 'SET_CURRENT_PORTFOLIO' -export function addPortfolio(portfolio) { +export function addPortfolio(projectId, portfolio) { return { type: ADD_PORTFOLIO, + projectId, portfolio, } } @@ -32,10 +32,3 @@ export function openPortfolioSucceeded(projectId, portfolioId) { portfolioId, } } - -export function setCurrentPortfolio(portfolioId) { - return { - type: SET_CURRENT_PORTFOLIO, - portfolioId, - } -} diff --git a/opendc-web/opendc-web-ui/src/redux/actions/scenarios.js b/opendc-web/opendc-web-ui/src/redux/actions/scenarios.js index c8a90762..644933d6 100644 --- a/opendc-web/opendc-web-ui/src/redux/actions/scenarios.js +++ b/opendc-web/opendc-web-ui/src/redux/actions/scenarios.js @@ -2,7 +2,6 @@ export const ADD_SCENARIO = 'ADD_SCENARIO' export const UPDATE_SCENARIO = 'UPDATE_SCENARIO' export const DELETE_SCENARIO = 'DELETE_SCENARIO' export const OPEN_SCENARIO_SUCCEEDED = 'OPEN_SCENARIO_SUCCEEDED' -export const SET_CURRENT_SCENARIO = 'SET_CURRENT_SCENARIO' export function addScenario(scenario) { return { @@ -33,11 +32,3 @@ export function openScenarioSucceeded(projectId, portfolioId, scenarioId) { scenarioId, } } - -export function setCurrentScenario(portfolioId, scenarioId) { - return { - type: SET_CURRENT_SCENARIO, - portfolioId, - scenarioId, - } -} diff --git a/opendc-web/opendc-web-ui/src/redux/actions/topologies.js b/opendc-web/opendc-web-ui/src/redux/actions/topologies.js index dcce3b7d..abfded7e 100644 --- a/opendc-web/opendc-web-ui/src/redux/actions/topologies.js +++ b/opendc-web/opendc-web-ui/src/redux/actions/topologies.js @@ -1,9 +1,10 @@ export const ADD_TOPOLOGY = 'ADD_TOPOLOGY' export const DELETE_TOPOLOGY = 'DELETE_TOPOLOGY' -export function addTopology(name, duplicateId) { +export function addTopology(projectId, name, duplicateId) { return { type: ADD_TOPOLOGY, + projectId, name, duplicateId, } -- cgit v1.2.3