summaryrefslogtreecommitdiff
path: root/opendc-web/opendc-web-ui/src/containers/app/sidebars/project
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2021-10-25 14:53:54 +0200
committerFabian Mastenbroek <mail.fabianm@gmail.com>2021-10-25 14:53:54 +0200
commitaa9b32f8cd1467e9718959f400f6777e5d71737d (patch)
treeb88bbede15108c6855d7f94ded4c7054df186a72 /opendc-web/opendc-web-ui/src/containers/app/sidebars/project
parenteb0e0a3bc557c05a70eead388797ab850ea87366 (diff)
parentb7a71e5b4aa77b41ef41deec2ace42b67a5a13a7 (diff)
merge: Integrate v2.1 progress into public repository
This pull request integrates the changes planned for the v2.1 release of OpenDC into the public Github repository in order to sync the progress of both repositories.
Diffstat (limited to 'opendc-web/opendc-web-ui/src/containers/app/sidebars/project')
-rw-r--r--opendc-web/opendc-web-ui/src/containers/app/sidebars/project/PortfolioListContainer.js45
-rw-r--r--opendc-web/opendc-web-ui/src/containers/app/sidebars/project/ProjectSidebarContainer.js10
-rw-r--r--opendc-web/opendc-web-ui/src/containers/app/sidebars/project/ScenarioListContainer.js41
-rw-r--r--opendc-web/opendc-web-ui/src/containers/app/sidebars/project/TopologyListContainer.js46
4 files changed, 0 insertions, 142 deletions
diff --git a/opendc-web/opendc-web-ui/src/containers/app/sidebars/project/PortfolioListContainer.js b/opendc-web/opendc-web-ui/src/containers/app/sidebars/project/PortfolioListContainer.js
deleted file mode 100644
index b32c8b1d..00000000
--- a/opendc-web/opendc-web-ui/src/containers/app/sidebars/project/PortfolioListContainer.js
+++ /dev/null
@@ -1,45 +0,0 @@
-import { connect } from 'react-redux'
-import { withRouter } from 'react-router-dom'
-import PortfolioListComponent from '../../../../components/app/sidebars/project/PortfolioListComponent'
-import { deletePortfolio, setCurrentPortfolio } from '../../../../actions/portfolios'
-import { openNewPortfolioModal } from '../../../../actions/modals/portfolios'
-import { getState } from '../../../../util/state-utils'
-import { setCurrentTopology } from '../../../../actions/topology/building'
-
-const mapStateToProps = (state) => {
- let portfolios = state.objects.project[state.currentProjectId]
- ? state.objects.project[state.currentProjectId].portfolioIds.map((t) => state.objects.portfolio[t])
- : []
- if (portfolios.filter((t) => !t).length > 0) {
- portfolios = []
- }
-
- return {
- currentProjectId: state.currentProjectId,
- currentPortfolioId: state.currentPortfolioId,
- portfolios,
- }
-}
-
-const mapDispatchToProps = (dispatch, ownProps) => {
- return {
- onNewPortfolio: () => {
- dispatch(openNewPortfolioModal())
- },
- onChoosePortfolio: (portfolioId) => {
- dispatch(setCurrentPortfolio(portfolioId))
- },
- onDeletePortfolio: async (id) => {
- if (id) {
- const state = await getState(dispatch)
- dispatch(deletePortfolio(id))
- dispatch(setCurrentTopology(state.objects.project[state.currentProjectId].topologyIds[0]))
- ownProps.history.push(`/projects/${state.currentProjectId}`)
- }
- },
- }
-}
-
-const PortfolioListContainer = withRouter(connect(mapStateToProps, mapDispatchToProps)(PortfolioListComponent))
-
-export default PortfolioListContainer
diff --git a/opendc-web/opendc-web-ui/src/containers/app/sidebars/project/ProjectSidebarContainer.js b/opendc-web/opendc-web-ui/src/containers/app/sidebars/project/ProjectSidebarContainer.js
deleted file mode 100644
index 49001099..00000000
--- a/opendc-web/opendc-web-ui/src/containers/app/sidebars/project/ProjectSidebarContainer.js
+++ /dev/null
@@ -1,10 +0,0 @@
-import React from 'react'
-import { withRouter } from 'react-router-dom'
-import ProjectSidebarComponent from '../../../../components/app/sidebars/project/ProjectSidebarComponent'
-import { isCollapsible } from '../../../../util/sidebar-space'
-
-const ProjectSidebarContainer = withRouter(({ location, ...props }) => (
- <ProjectSidebarComponent collapsible={isCollapsible(location)} {...props} />
-))
-
-export default ProjectSidebarContainer
diff --git a/opendc-web/opendc-web-ui/src/containers/app/sidebars/project/ScenarioListContainer.js b/opendc-web/opendc-web-ui/src/containers/app/sidebars/project/ScenarioListContainer.js
deleted file mode 100644
index 415e2792..00000000
--- a/opendc-web/opendc-web-ui/src/containers/app/sidebars/project/ScenarioListContainer.js
+++ /dev/null
@@ -1,41 +0,0 @@
-import { connect } from 'react-redux'
-import ScenarioListComponent from '../../../../components/app/sidebars/project/ScenarioListComponent'
-import { openNewScenarioModal } from '../../../../actions/modals/scenarios'
-import { deleteScenario, setCurrentScenario } from '../../../../actions/scenarios'
-import { setCurrentPortfolio } from '../../../../actions/portfolios'
-
-const mapStateToProps = (state, ownProps) => {
- let scenarios = state.objects.portfolio[ownProps.portfolioId]
- ? state.objects.portfolio[ownProps.portfolioId].scenarioIds.map((t) => state.objects.scenario[t])
- : []
- if (scenarios.filter((t) => !t).length > 0) {
- scenarios = []
- }
-
- return {
- currentProjectId: state.currentProjectId,
- currentScenarioId: state.currentScenarioId,
- scenarios,
- }
-}
-
-const mapDispatchToProps = (dispatch) => {
- return {
- onNewScenario: (currentPortfolioId) => {
- dispatch(setCurrentPortfolio(currentPortfolioId))
- dispatch(openNewScenarioModal())
- },
- onChooseScenario: (portfolioId, scenarioId) => {
- dispatch(setCurrentScenario(portfolioId, scenarioId))
- },
- onDeleteScenario: (id) => {
- if (id) {
- dispatch(deleteScenario(id))
- }
- },
- }
-}
-
-const ScenarioListContainer = connect(mapStateToProps, mapDispatchToProps)(ScenarioListComponent)
-
-export default ScenarioListContainer
diff --git a/opendc-web/opendc-web-ui/src/containers/app/sidebars/project/TopologyListContainer.js b/opendc-web/opendc-web-ui/src/containers/app/sidebars/project/TopologyListContainer.js
deleted file mode 100644
index e1de18f9..00000000
--- a/opendc-web/opendc-web-ui/src/containers/app/sidebars/project/TopologyListContainer.js
+++ /dev/null
@@ -1,46 +0,0 @@
-import { connect } from 'react-redux'
-import TopologyListComponent from '../../../../components/app/sidebars/project/TopologyListComponent'
-import { setCurrentTopology } from '../../../../actions/topology/building'
-import { openNewTopologyModal } from '../../../../actions/modals/topology'
-import { withRouter } from 'react-router-dom'
-import { getState } from '../../../../util/state-utils'
-import { deleteTopology } from '../../../../actions/topologies'
-
-const mapStateToProps = (state) => {
- let topologies = state.objects.project[state.currentProjectId]
- ? state.objects.project[state.currentProjectId].topologyIds.map((t) => state.objects.topology[t])
- : []
- if (topologies.filter((t) => !t).length > 0) {
- topologies = []
- }
-
- return {
- currentTopologyId: state.currentTopologyId,
- topologies,
- }
-}
-
-const mapDispatchToProps = (dispatch, ownProps) => {
- return {
- onChooseTopology: async (id) => {
- dispatch(setCurrentTopology(id))
- const state = await getState(dispatch)
- ownProps.history.push(`/projects/${state.currentProjectId}`)
- },
- onNewTopology: () => {
- dispatch(openNewTopologyModal())
- },
- onDeleteTopology: async (id) => {
- if (id) {
- const state = await getState(dispatch)
- dispatch(deleteTopology(id))
- dispatch(setCurrentTopology(state.objects.project[state.currentProjectId].topologyIds[0]))
- ownProps.history.push(`/projects/${state.currentProjectId}`)
- }
- },
- }
-}
-
-const TopologyListContainer = withRouter(connect(mapStateToProps, mapDispatchToProps)(TopologyListComponent))
-
-export default TopologyListContainer