1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
import { connect } from 'react-redux'
import { addExperiment } from '../../actions/experiments'
import { closeNewExperimentModal } from '../../actions/modals/experiments'
import NewExperimentModalComponent from '../../components/modals/custom-components/NewExperimentModalComponent'
const mapStateToProps = state => {
return {
show: state.modals.newExperimentModalVisible,
topologies: state.objects.project[state.currentProjectId].topologyIds.map(t => (
state.objects.topology[t]
)),
traces: Object.values(state.objects.trace),
schedulers: Object.values(state.objects.scheduler),
}
}
const mapDispatchToProps = dispatch => {
return {
callback: (name, topologyId, traceId, schedulerName) => {
if (name) {
dispatch(
addExperiment({
name,
topologyId,
traceId,
schedulerName,
}),
)
}
dispatch(closeNewExperimentModal())
},
}
}
const NewExperimentModal = connect(mapStateToProps, mapDispatchToProps)(
NewExperimentModalComponent,
)
export default NewExperimentModal
|