diff options
| author | Georgios Andreadis <g.andreadis@student.tudelft.nl> | 2017-09-22 21:20:54 +0200 |
|---|---|---|
| committer | Georgios Andreadis <g.andreadis@student.tudelft.nl> | 2017-09-23 10:06:18 +0200 |
| commit | bf7708f658cc6299a3b775afe24459b5a808c54d (patch) | |
| tree | 227520267968759e2a2f1e29e6f3edfeb4e3cf8a /src/containers/app/sidebars/topology/machine | |
| parent | e722cf117d0e3ebac20237f96764fb08cab49a62 (diff) | |
Restructure component and container directories
Diffstat (limited to 'src/containers/app/sidebars/topology/machine')
8 files changed, 137 insertions, 0 deletions
diff --git a/src/containers/app/sidebars/topology/machine/BackToRackContainer.js b/src/containers/app/sidebars/topology/machine/BackToRackContainer.js new file mode 100644 index 00000000..f0ac9220 --- /dev/null +++ b/src/containers/app/sidebars/topology/machine/BackToRackContainer.js @@ -0,0 +1,16 @@ +import {connect} from "react-redux"; +import {goDownOneInteractionLevel} from "../../../../../actions/interaction-level"; +import BackToRackComponent from "../../../../../components/app/sidebars/topology/machine/BackToRackComponent"; + +const mapDispatchToProps = dispatch => { + return { + onClick: () => dispatch(goDownOneInteractionLevel()), + }; +}; + +const BackToRackContainer = connect( + undefined, + mapDispatchToProps +)(BackToRackComponent); + +export default BackToRackContainer; diff --git a/src/containers/app/sidebars/topology/machine/DeleteMachineContainer.js b/src/containers/app/sidebars/topology/machine/DeleteMachineContainer.js new file mode 100644 index 00000000..bfdde179 --- /dev/null +++ b/src/containers/app/sidebars/topology/machine/DeleteMachineContainer.js @@ -0,0 +1,16 @@ +import {connect} from "react-redux"; +import {openDeleteMachineModal} from "../../../../../actions/modals/topology"; +import DeleteMachineComponent from "../../../../../components/app/sidebars/topology/machine/DeleteMachineComponent"; + +const mapDispatchToProps = dispatch => { + return { + onClick: () => dispatch(openDeleteMachineModal()), + }; +}; + +const DeleteMachineContainer = connect( + undefined, + mapDispatchToProps +)(DeleteMachineComponent); + +export default DeleteMachineContainer; diff --git a/src/containers/app/sidebars/topology/machine/MachineNameContainer.js b/src/containers/app/sidebars/topology/machine/MachineNameContainer.js new file mode 100644 index 00000000..9d23dcb6 --- /dev/null +++ b/src/containers/app/sidebars/topology/machine/MachineNameContainer.js @@ -0,0 +1,14 @@ +import {connect} from "react-redux"; +import MachineNameComponent from "../../../../../components/app/sidebars/topology/machine/MachineNameComponent"; + +const mapStateToProps = state => { + return { + position: state.interactionLevel.position, + }; +}; + +const MachineNameContainer = connect( + mapStateToProps +)(MachineNameComponent); + +export default MachineNameContainer; diff --git a/src/containers/app/sidebars/topology/machine/MachineSidebarContainer.js b/src/containers/app/sidebars/topology/machine/MachineSidebarContainer.js new file mode 100644 index 00000000..5c28248c --- /dev/null +++ b/src/containers/app/sidebars/topology/machine/MachineSidebarContainer.js @@ -0,0 +1,16 @@ +import {connect} from "react-redux"; +import MachineSidebarComponent from "../../../../../components/app/sidebars/topology/machine/MachineSidebarComponent"; + +const mapStateToProps = state => { + return { + inSimulation: state.currentExperimentId !== -1, + machineId: state.objects.rack[state.objects.tile[state.interactionLevel.tileId].objectId] + .machineIds[state.interactionLevel.position - 1], + }; +}; + +const MachineSidebarContainer = connect( + mapStateToProps +)(MachineSidebarComponent); + +export default MachineSidebarContainer; diff --git a/src/containers/app/sidebars/topology/machine/UnitAddContainer.js b/src/containers/app/sidebars/topology/machine/UnitAddContainer.js new file mode 100644 index 00000000..f194ebcf --- /dev/null +++ b/src/containers/app/sidebars/topology/machine/UnitAddContainer.js @@ -0,0 +1,22 @@ +import {connect} from "react-redux"; +import {addUnit} from "../../../../../actions/topology/machine"; +import UnitAddComponent from "../../../../../components/app/sidebars/topology/machine/UnitAddComponent"; + +const mapStateToProps = (state, ownProps) => { + return { + units: Object.values(state.objects[ownProps.unitType]), + }; +}; + +const mapDispatchToProps = (dispatch, ownProps) => { + return { + onAdd: (id) => dispatch(addUnit(ownProps.unitType, id)), + }; +}; + +const UnitAddContainer = connect( + mapStateToProps, + mapDispatchToProps +)(UnitAddComponent); + +export default UnitAddContainer; diff --git a/src/containers/app/sidebars/topology/machine/UnitContainer.js b/src/containers/app/sidebars/topology/machine/UnitContainer.js new file mode 100644 index 00000000..12024d5a --- /dev/null +++ b/src/containers/app/sidebars/topology/machine/UnitContainer.js @@ -0,0 +1,23 @@ +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 { + unit: state.objects[ownProps.unitType][ownProps.unitId], + inSimulation: state.currentExperimentId !== -1 + }; +}; + +const mapDispatchToProps = (dispatch, ownProps) => { + return { + onDelete: () => dispatch(deleteUnit(ownProps.unitType, ownProps.index)), + }; +}; + +const UnitContainer = connect( + mapStateToProps, + mapDispatchToProps +)(UnitComponent); + +export default UnitContainer; diff --git a/src/containers/app/sidebars/topology/machine/UnitListContainer.js b/src/containers/app/sidebars/topology/machine/UnitListContainer.js new file mode 100644 index 00000000..e351c63c --- /dev/null +++ b/src/containers/app/sidebars/topology/machine/UnitListContainer.js @@ -0,0 +1,16 @@ +import {connect} from "react-redux"; +import UnitListComponent from "../../../../../components/app/sidebars/topology/machine/UnitListComponent"; + +const mapStateToProps = (state, ownProps) => { + return { + unitIds: state.objects.machine[state.objects.rack[state.objects.tile[state.interactionLevel.tileId].objectId] + .machineIds[state.interactionLevel.position - 1]][ownProps.unitType + "Ids"], + inSimulation: state.currentExperimentId !== -1 + }; +}; + +const UnitListContainer = connect( + mapStateToProps +)(UnitListComponent); + +export default UnitListContainer; diff --git a/src/containers/app/sidebars/topology/machine/UnitTabsContainer.js b/src/containers/app/sidebars/topology/machine/UnitTabsContainer.js new file mode 100644 index 00000000..46952c74 --- /dev/null +++ b/src/containers/app/sidebars/topology/machine/UnitTabsContainer.js @@ -0,0 +1,14 @@ +import {connect} from "react-redux"; +import UnitTabsComponent from "../../../../../components/app/sidebars/topology/machine/UnitTabsComponent"; + +const mapStateToProps = state => { + return { + inSimulation: state.currentExperimentId !== -1, + }; +}; + +const UnitTabsContainer = connect( + mapStateToProps +)(UnitTabsComponent); + +export default UnitTabsContainer; |
