summaryrefslogtreecommitdiff
path: root/frontend/src/containers/modals
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/src/containers/modals')
-rw-r--r--frontend/src/containers/modals/ChangeTopologyModal.js56
-rw-r--r--frontend/src/containers/modals/EditRackNameModal.js2
-rw-r--r--frontend/src/containers/modals/NewExperimentModal.js10
3 files changed, 62 insertions, 6 deletions
diff --git a/frontend/src/containers/modals/ChangeTopologyModal.js b/frontend/src/containers/modals/ChangeTopologyModal.js
new file mode 100644
index 00000000..bd364194
--- /dev/null
+++ b/frontend/src/containers/modals/ChangeTopologyModal.js
@@ -0,0 +1,56 @@
+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'
+
+const mapStateToProps = state => {
+ let topologies = state.objects.simulation[state.currentSimulationId] ? state.objects.simulation[state.currentSimulationId].topologyIds.map(t => (
+ state.objects.topology[t]
+ )) : []
+ if (topologies.filter(t => !t).length > 0) {
+ topologies = []
+ }
+
+ return {
+ show: state.modals.newExperimentModalVisible,
+ topologies,
+ }
+}
+
+const mapDispatchToProps = dispatch => {
+ return {
+ onCreateTopology: (name) => {
+ if (name) {
+ dispatch(
+ addTopology({name})
+ )
+ }
+ dispatch(closeChangeTopologyModal())
+ },
+ onDuplicateTopology: (name) => {
+ if (name) {
+ // TODO different handling here
+ dispatch(
+ addTopology({name})
+ )
+ }
+ dispatch(closeChangeTopologyModal())
+ },
+ onDeleteTopology: (id) => {
+ if (id) {
+ dispatch(
+ deleteTopology(id)
+ )
+ }
+ },
+ onCancel: () => {
+ dispatch(closeChangeTopologyModal())
+ },
+ }
+}
+
+const ChangeTopologyModal = connect(mapStateToProps, mapDispatchToProps)(
+ ChangeTopologyModalComponent,
+)
+
+export default ChangeTopologyModal
diff --git a/frontend/src/containers/modals/EditRackNameModal.js b/frontend/src/containers/modals/EditRackNameModal.js
index e5c87e35..495c107b 100644
--- a/frontend/src/containers/modals/EditRackNameModal.js
+++ b/frontend/src/containers/modals/EditRackNameModal.js
@@ -20,7 +20,7 @@ const mapStateToProps = state => {
previousName:
state.interactionLevel.mode === 'RACK'
? state.objects.rack[
- state.objects.tile[state.interactionLevel.tileId].objectId
+ state.objects.tile[state.interactionLevel.tileId].rackId
].name
: '',
}
diff --git a/frontend/src/containers/modals/NewExperimentModal.js b/frontend/src/containers/modals/NewExperimentModal.js
index db60f088..2ac5a4b8 100644
--- a/frontend/src/containers/modals/NewExperimentModal.js
+++ b/frontend/src/containers/modals/NewExperimentModal.js
@@ -6,9 +6,9 @@ import NewExperimentModalComponent from '../../components/modals/custom-componen
const mapStateToProps = state => {
return {
show: state.modals.newExperimentModalVisible,
- paths: Object.values(state.objects.path).filter(
- path => path.simulationId === state.currentSimulationId,
- ),
+ topologies: state.objects.simulation[state.currentSimulationId].topologyIds.map(t => (
+ state.objects.topology[t]
+ )),
traces: Object.values(state.objects.trace),
schedulers: Object.values(state.objects.scheduler),
}
@@ -16,12 +16,12 @@ const mapStateToProps = state => {
const mapDispatchToProps = dispatch => {
return {
- callback: (name, pathId, traceId, schedulerName) => {
+ callback: (name, topologyId, traceId, schedulerName) => {
if (name) {
dispatch(
addExperiment({
name,
- pathId,
+ topologyId,
traceId,
schedulerName,
}),