From cd0b45627f0d8da8c8dc4edde223f3c36e9bcfbf Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Sun, 25 Apr 2021 16:01:14 +0200 Subject: build: Migrate to flat project structure This change updates the project structure to become flattened. Previously, the simulator, frontend and API each lived into their own directory. With this change, all modules of the project live in the top-level directory of the repository. This should improve discoverability of modules of the project. --- .../app/sidebars/topology/rack/AddPrefabContainer.js | 13 +++++++++++++ .../app/sidebars/topology/rack/BackToRoomContainer.js | 13 +++++++++++++ .../app/sidebars/topology/rack/DeleteRackContainer.js | 13 +++++++++++++ .../app/sidebars/topology/rack/EmptySlotContainer.js | 13 +++++++++++++ .../app/sidebars/topology/rack/MachineContainer.js | 19 +++++++++++++++++++ .../sidebars/topology/rack/MachineListContainer.js | 12 ++++++++++++ .../app/sidebars/topology/rack/RackNameContainer.js | 19 +++++++++++++++++++ .../sidebars/topology/rack/RackSidebarContainer.js | 12 ++++++++++++ 8 files changed, 114 insertions(+) create mode 100644 opendc-web/opendc-web-ui/src/containers/app/sidebars/topology/rack/AddPrefabContainer.js create mode 100644 opendc-web/opendc-web-ui/src/containers/app/sidebars/topology/rack/BackToRoomContainer.js create mode 100644 opendc-web/opendc-web-ui/src/containers/app/sidebars/topology/rack/DeleteRackContainer.js create mode 100644 opendc-web/opendc-web-ui/src/containers/app/sidebars/topology/rack/EmptySlotContainer.js create mode 100644 opendc-web/opendc-web-ui/src/containers/app/sidebars/topology/rack/MachineContainer.js create mode 100644 opendc-web/opendc-web-ui/src/containers/app/sidebars/topology/rack/MachineListContainer.js create mode 100644 opendc-web/opendc-web-ui/src/containers/app/sidebars/topology/rack/RackNameContainer.js create mode 100644 opendc-web/opendc-web-ui/src/containers/app/sidebars/topology/rack/RackSidebarContainer.js (limited to 'opendc-web/opendc-web-ui/src/containers/app/sidebars/topology/rack') diff --git a/opendc-web/opendc-web-ui/src/containers/app/sidebars/topology/rack/AddPrefabContainer.js b/opendc-web/opendc-web-ui/src/containers/app/sidebars/topology/rack/AddPrefabContainer.js new file mode 100644 index 00000000..c941e745 --- /dev/null +++ b/opendc-web/opendc-web-ui/src/containers/app/sidebars/topology/rack/AddPrefabContainer.js @@ -0,0 +1,13 @@ +import { connect } from 'react-redux' +import { addPrefab } from '../../../../../actions/prefabs' +import AddPrefabComponent from '../../../../../components/app/sidebars/topology/rack/AddPrefabComponent' + +const mapDispatchToProps = (dispatch) => { + return { + onClick: () => dispatch(addPrefab('name')), + } +} + +const AddPrefabContainer = connect(undefined, mapDispatchToProps)(AddPrefabComponent) + +export default AddPrefabContainer diff --git a/opendc-web/opendc-web-ui/src/containers/app/sidebars/topology/rack/BackToRoomContainer.js b/opendc-web/opendc-web-ui/src/containers/app/sidebars/topology/rack/BackToRoomContainer.js new file mode 100644 index 00000000..58c3b082 --- /dev/null +++ b/opendc-web/opendc-web-ui/src/containers/app/sidebars/topology/rack/BackToRoomContainer.js @@ -0,0 +1,13 @@ +import { connect } from 'react-redux' +import { goDownOneInteractionLevel } from '../../../../../actions/interaction-level' +import BackToRoomComponent from '../../../../../components/app/sidebars/topology/rack/BackToRoomComponent' + +const mapDispatchToProps = (dispatch) => { + return { + onClick: () => dispatch(goDownOneInteractionLevel()), + } +} + +const BackToRoomContainer = connect(undefined, mapDispatchToProps)(BackToRoomComponent) + +export default BackToRoomContainer diff --git a/opendc-web/opendc-web-ui/src/containers/app/sidebars/topology/rack/DeleteRackContainer.js b/opendc-web/opendc-web-ui/src/containers/app/sidebars/topology/rack/DeleteRackContainer.js new file mode 100644 index 00000000..8229a359 --- /dev/null +++ b/opendc-web/opendc-web-ui/src/containers/app/sidebars/topology/rack/DeleteRackContainer.js @@ -0,0 +1,13 @@ +import { connect } from 'react-redux' +import { openDeleteRackModal } from '../../../../../actions/modals/topology' +import DeleteRackComponent from '../../../../../components/app/sidebars/topology/rack/DeleteRackComponent' + +const mapDispatchToProps = (dispatch) => { + return { + onClick: () => dispatch(openDeleteRackModal()), + } +} + +const DeleteRackContainer = connect(undefined, mapDispatchToProps)(DeleteRackComponent) + +export default DeleteRackContainer diff --git a/opendc-web/opendc-web-ui/src/containers/app/sidebars/topology/rack/EmptySlotContainer.js b/opendc-web/opendc-web-ui/src/containers/app/sidebars/topology/rack/EmptySlotContainer.js new file mode 100644 index 00000000..cf341da9 --- /dev/null +++ b/opendc-web/opendc-web-ui/src/containers/app/sidebars/topology/rack/EmptySlotContainer.js @@ -0,0 +1,13 @@ +import { connect } from 'react-redux' +import { addMachine } from '../../../../../actions/topology/rack' +import EmptySlotComponent from '../../../../../components/app/sidebars/topology/rack/EmptySlotComponent' + +const mapDispatchToProps = (dispatch, ownProps) => { + return { + onAdd: () => dispatch(addMachine(ownProps.position)), + } +} + +const EmptySlotContainer = connect(undefined, mapDispatchToProps)(EmptySlotComponent) + +export default EmptySlotContainer diff --git a/opendc-web/opendc-web-ui/src/containers/app/sidebars/topology/rack/MachineContainer.js b/opendc-web/opendc-web-ui/src/containers/app/sidebars/topology/rack/MachineContainer.js new file mode 100644 index 00000000..fe12827d --- /dev/null +++ b/opendc-web/opendc-web-ui/src/containers/app/sidebars/topology/rack/MachineContainer.js @@ -0,0 +1,19 @@ +import { connect } from 'react-redux' +import { goFromRackToMachine } from '../../../../../actions/interaction-level' +import MachineComponent from '../../../../../components/app/sidebars/topology/rack/MachineComponent' + +const mapStateToProps = (state, ownProps) => { + return { + machine: state.objects.machine[ownProps.machineId], + } +} + +const mapDispatchToProps = (dispatch, ownProps) => { + return { + onClick: () => dispatch(goFromRackToMachine(ownProps.position)), + } +} + +const MachineContainer = connect(mapStateToProps, mapDispatchToProps)(MachineComponent) + +export default MachineContainer diff --git a/opendc-web/opendc-web-ui/src/containers/app/sidebars/topology/rack/MachineListContainer.js b/opendc-web/opendc-web-ui/src/containers/app/sidebars/topology/rack/MachineListContainer.js new file mode 100644 index 00000000..bc5a285a --- /dev/null +++ b/opendc-web/opendc-web-ui/src/containers/app/sidebars/topology/rack/MachineListContainer.js @@ -0,0 +1,12 @@ +import { connect } from 'react-redux' +import MachineListComponent from '../../../../../components/app/sidebars/topology/rack/MachineListComponent' + +const mapStateToProps = (state) => { + return { + machineIds: state.objects.rack[state.objects.tile[state.interactionLevel.tileId].rackId].machineIds, + } +} + +const MachineListContainer = connect(mapStateToProps)(MachineListComponent) + +export default MachineListContainer diff --git a/opendc-web/opendc-web-ui/src/containers/app/sidebars/topology/rack/RackNameContainer.js b/opendc-web/opendc-web-ui/src/containers/app/sidebars/topology/rack/RackNameContainer.js new file mode 100644 index 00000000..504dbc61 --- /dev/null +++ b/opendc-web/opendc-web-ui/src/containers/app/sidebars/topology/rack/RackNameContainer.js @@ -0,0 +1,19 @@ +import { connect } from 'react-redux' +import { openEditRackNameModal } from '../../../../../actions/modals/topology' +import RackNameComponent from '../../../../../components/app/sidebars/topology/rack/RackNameComponent' + +const mapStateToProps = (state) => { + return { + rackName: state.objects.rack[state.objects.tile[state.interactionLevel.tileId].rackId].name, + } +} + +const mapDispatchToProps = (dispatch) => { + return { + onEdit: () => dispatch(openEditRackNameModal()), + } +} + +const RackNameContainer = connect(mapStateToProps, mapDispatchToProps)(RackNameComponent) + +export default RackNameContainer diff --git a/opendc-web/opendc-web-ui/src/containers/app/sidebars/topology/rack/RackSidebarContainer.js b/opendc-web/opendc-web-ui/src/containers/app/sidebars/topology/rack/RackSidebarContainer.js new file mode 100644 index 00000000..453d7e41 --- /dev/null +++ b/opendc-web/opendc-web-ui/src/containers/app/sidebars/topology/rack/RackSidebarContainer.js @@ -0,0 +1,12 @@ +import { connect } from 'react-redux' +import RackSidebarComponent from '../../../../../components/app/sidebars/topology/rack/RackSidebarComponent' + +const mapStateToProps = (state) => { + return { + rackId: state.objects.tile[state.interactionLevel.tileId].rackId, + } +} + +const RackSidebarContainer = connect(mapStateToProps)(RackSidebarComponent) + +export default RackSidebarContainer -- cgit v1.2.3