From 39277c91281dbc7bd40bdffabc5b5675e9ede483 Mon Sep 17 00:00:00 2001 From: Georgios Andreadis Date: Fri, 3 Jul 2020 10:34:05 +0200 Subject: Get basic topology change working --- frontend/src/containers/modals/ChangeTopologyModal.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'frontend/src/containers') diff --git a/frontend/src/containers/modals/ChangeTopologyModal.js b/frontend/src/containers/modals/ChangeTopologyModal.js index bd364194..a1db9032 100644 --- a/frontend/src/containers/modals/ChangeTopologyModal.js +++ b/frontend/src/containers/modals/ChangeTopologyModal.js @@ -2,6 +2,7 @@ import { connect } from 'react-redux' import ChangeTopologyModalComponent from '../../components/modals/custom-components/ChangeTopologyModalComponent' import { closeChangeTopologyModal } from '../../actions/modals/topology' import { addTopology, deleteTopology } from '../../actions/topologies' +import { setCurrentTopology } from '../../actions/topology/building' const mapStateToProps = state => { let topologies = state.objects.simulation[state.currentSimulationId] ? state.objects.simulation[state.currentSimulationId].topologyIds.map(t => ( @@ -12,17 +13,24 @@ const mapStateToProps = state => { } return { - show: state.modals.newExperimentModalVisible, + show: state.modals.changeTopologyModalVisible, + currentTopologyId: state.currentTopologyId, topologies, } } const mapDispatchToProps = dispatch => { return { + onChooseTopology: (id) => { + dispatch( + setCurrentTopology(id) + ) + dispatch(closeChangeTopologyModal()) + }, onCreateTopology: (name) => { if (name) { dispatch( - addTopology({name}) + addTopology({name, rooms: []}) ) } dispatch(closeChangeTopologyModal()) @@ -31,7 +39,7 @@ const mapDispatchToProps = dispatch => { if (name) { // TODO different handling here dispatch( - addTopology({name}) + addTopology({name, rooms: []}) ) } dispatch(closeChangeTopologyModal()) -- cgit v1.2.3