summaryrefslogtreecommitdiff
path: root/frontend/src/containers/app/sidebars/topology/machine/UnitContainer.js
blob: 7c26b47f502e71000cbdf9b771a119cdd3fb3bdb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import { connect } from 'react-redux'
import { deleteUnit } from '../../../../../actions/topology/machine'
import UnitComponent from '../../../../../components/app/sidebars/topology/machine/UnitComponent'

const mapStateToProps = (state, ownProps) => {
    return {
        inSimulation: state.currentExperimentId !== '-1',
        unit: state.objects[ownProps.unitType][ownProps.unitId],
    }
}

const mapDispatchToProps = (dispatch, ownProps) => {
    return {
        onDelete: () => dispatch(deleteUnit(ownProps.unitType, ownProps.index)),
    }
}

const UnitContainer = connect(mapStateToProps, mapDispatchToProps)(
    UnitComponent,
)

export default UnitContainer