diff options
| author | Georgios Andreadis <info@gandreadis.com> | 2020-07-07 09:55:10 +0200 |
|---|---|---|
| committer | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2020-08-24 19:47:25 +0200 |
| commit | b4bdf9fde013bb7ff9579693b64ff575f7b00e44 (patch) | |
| tree | 5e05ceba918849391a639bbeeab37d290a86523c /frontend/src/containers/app/sidebars | |
| parent | 7331e9baf2cfe7bdfb24effcf0a4801da1e7ea4d (diff) | |
Rename simulations to projects and remove experiment view
Diffstat (limited to 'frontend/src/containers/app/sidebars')
14 files changed, 6 insertions, 150 deletions
diff --git a/frontend/src/containers/app/sidebars/elements/LoadBarContainer.js b/frontend/src/containers/app/sidebars/elements/LoadBarContainer.js deleted file mode 100644 index 5c423490..00000000 --- a/frontend/src/containers/app/sidebars/elements/LoadBarContainer.js +++ /dev/null @@ -1,32 +0,0 @@ -import { connect } from 'react-redux' -import LoadBarComponent from '../../../../components/app/sidebars/elements/LoadBarComponent' -import { getStateLoad } from '../../../../util/simulation-load' - -const mapStateToProps = (state, ownProps) => { - let percent = 0 - let enabled = false - - const objectStates = state.states[ownProps.objectType] - if ( - objectStates[state.currentTick] && - objectStates[state.currentTick][ownProps.objectId] - ) { - percent = Math.floor( - 100 * - getStateLoad( - state.loadMetric, - objectStates[state.currentTick][ownProps.objectId], - ), - ) - enabled = true - } - - return { - percent, - enabled, - } -} - -const LoadBarContainer = connect(mapStateToProps)(LoadBarComponent) - -export default LoadBarContainer diff --git a/frontend/src/containers/app/sidebars/elements/LoadChartContainer.js b/frontend/src/containers/app/sidebars/elements/LoadChartContainer.js index 49962d57..61f95932 100644 --- a/frontend/src/containers/app/sidebars/elements/LoadChartContainer.js +++ b/frontend/src/containers/app/sidebars/elements/LoadChartContainer.js @@ -1,25 +1,9 @@ import { connect } from 'react-redux' import LoadChartComponent from '../../../../components/app/sidebars/elements/LoadChartComponent' -import { getStateLoad } from '../../../../util/simulation-load' const mapStateToProps = (state, ownProps) => { const data = [] - if (state.lastSimulatedTick !== -1) { - const objectStates = state.states[ownProps.objectType] - Object.keys(objectStates).forEach(tick => { - if (objectStates[tick][ownProps.objectId]) { - data.push({ - x: tick, - y: getStateLoad( - state.loadMetric, - objectStates[tick][ownProps.objectId], - ), - }) - } - }) - } - return { data, currentTick: state.currentTick, diff --git a/frontend/src/containers/app/sidebars/simulation/ExperimentMetadataContainer.js b/frontend/src/containers/app/sidebars/simulation/ExperimentMetadataContainer.js deleted file mode 100644 index 0dc20ea7..00000000 --- a/frontend/src/containers/app/sidebars/simulation/ExperimentMetadataContainer.js +++ /dev/null @@ -1,38 +0,0 @@ -import { connect } from 'react-redux' -import ExperimentMetadataComponent from '../../../../components/app/sidebars/simulation/ExperimentMetadataComponent' - -const mapStateToProps = state => { - if (!state.objects.experiment[state.currentExperimentId]) { - return { - experimentName: 'Loading experiment', - topologyName: '', - traceName: '', - schedulerName: '', - } - } - - const topology = - state.objects.topology[ - state.objects.experiment[state.currentExperimentId].topologyId - ] - const topologyName = topology.name - - return { - experimentName: state.objects.experiment[state.currentExperimentId].name, - topologyName, - traceName: - state.objects.trace[ - state.objects.experiment[state.currentExperimentId].traceId - ].name, - schedulerName: - state.objects.scheduler[ - state.objects.experiment[state.currentExperimentId].schedulerName - ].name, - } -} - -const ExperimentMetadataContainer = connect(mapStateToProps)( - ExperimentMetadataComponent, -) - -export default ExperimentMetadataContainer diff --git a/frontend/src/containers/app/sidebars/simulation/LoadMetricContainer.js b/frontend/src/containers/app/sidebars/simulation/LoadMetricContainer.js deleted file mode 100644 index a8654698..00000000 --- a/frontend/src/containers/app/sidebars/simulation/LoadMetricContainer.js +++ /dev/null @@ -1,12 +0,0 @@ -import { connect } from 'react-redux' -import LoadMetricComponent from '../../../../components/app/sidebars/simulation/LoadMetricComponent' - -const mapStateToProps = state => { - return { - loadMetric: state.loadMetric, - } -} - -const LoadMetricContainer = connect(mapStateToProps)(LoadMetricComponent) - -export default LoadMetricContainer diff --git a/frontend/src/containers/app/sidebars/topology/building/BuildingSidebarContainer.js b/frontend/src/containers/app/sidebars/topology/building/BuildingSidebarContainer.js index 8c8cb79b..a0b52e56 100644 --- a/frontend/src/containers/app/sidebars/topology/building/BuildingSidebarContainer.js +++ b/frontend/src/containers/app/sidebars/topology/building/BuildingSidebarContainer.js @@ -1,14 +1,5 @@ -import { connect } from 'react-redux' import BuildingSidebarComponent from '../../../../../components/app/sidebars/topology/building/BuildingSidebarComponent' -const mapStateToProps = state => { - return { - inSimulation: state.currentExperimentId !== '-1', - } -} - -const BuildingSidebarContainer = connect(mapStateToProps)( - BuildingSidebarComponent, -) +const BuildingSidebarContainer = BuildingSidebarComponent export default BuildingSidebarContainer diff --git a/frontend/src/containers/app/sidebars/topology/machine/MachineSidebarContainer.js b/frontend/src/containers/app/sidebars/topology/machine/MachineSidebarContainer.js index 3cff7cd1..868f26da 100644 --- a/frontend/src/containers/app/sidebars/topology/machine/MachineSidebarContainer.js +++ b/frontend/src/containers/app/sidebars/topology/machine/MachineSidebarContainer.js @@ -3,7 +3,6 @@ import MachineSidebarComponent from '../../../../../components/app/sidebars/topo const mapStateToProps = state => { return { - inSimulation: state.currentExperimentId !== '-1', machineId: state.objects.rack[ state.objects.tile[state.interactionLevel.tileId].rackId diff --git a/frontend/src/containers/app/sidebars/topology/machine/UnitContainer.js b/frontend/src/containers/app/sidebars/topology/machine/UnitContainer.js index 7c26b47f..bd629564 100644 --- a/frontend/src/containers/app/sidebars/topology/machine/UnitContainer.js +++ b/frontend/src/containers/app/sidebars/topology/machine/UnitContainer.js @@ -4,7 +4,6 @@ import UnitComponent from '../../../../../components/app/sidebars/topology/machi const mapStateToProps = (state, ownProps) => { return { - inSimulation: state.currentExperimentId !== '-1', unit: state.objects[ownProps.unitType][ownProps.unitId], } } diff --git a/frontend/src/containers/app/sidebars/topology/machine/UnitListContainer.js b/frontend/src/containers/app/sidebars/topology/machine/UnitListContainer.js index 2596c2bd..e3ad77fd 100644 --- a/frontend/src/containers/app/sidebars/topology/machine/UnitListContainer.js +++ b/frontend/src/containers/app/sidebars/topology/machine/UnitListContainer.js @@ -3,11 +3,10 @@ import UnitListComponent from '../../../../../components/app/sidebars/topology/m const mapStateToProps = (state, ownProps) => { return { - inSimulation: state.currentExperimentId !== '-1', unitIds: state.objects.machine[ state.objects.rack[ - state.objects.tile[state.interactionLevel.tileId].rackId + state.objects.tile[state.interactionLevel.tileId].rackId ].machineIds[state.interactionLevel.position - 1] ][ownProps.unitType + 'Ids'], } diff --git a/frontend/src/containers/app/sidebars/topology/machine/UnitTabsContainer.js b/frontend/src/containers/app/sidebars/topology/machine/UnitTabsContainer.js index 5c606de4..00fe4067 100644 --- a/frontend/src/containers/app/sidebars/topology/machine/UnitTabsContainer.js +++ b/frontend/src/containers/app/sidebars/topology/machine/UnitTabsContainer.js @@ -1,12 +1,5 @@ -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) +const UnitTabsContainer = UnitTabsComponent export default UnitTabsContainer diff --git a/frontend/src/containers/app/sidebars/topology/rack/EmptySlotContainer.js b/frontend/src/containers/app/sidebars/topology/rack/EmptySlotContainer.js index d580a3e0..ab287bac 100644 --- a/frontend/src/containers/app/sidebars/topology/rack/EmptySlotContainer.js +++ b/frontend/src/containers/app/sidebars/topology/rack/EmptySlotContainer.js @@ -2,19 +2,13 @@ import { connect } from 'react-redux' import { addMachine } from '../../../../../actions/topology/rack' import EmptySlotComponent from '../../../../../components/app/sidebars/topology/rack/EmptySlotComponent' -const mapStateToProps = state => { - return { - inSimulation: state.currentExperimentId !== '-1', - } -} - const mapDispatchToProps = (dispatch, ownProps) => { return { onAdd: () => dispatch(addMachine(ownProps.position)), } } -const EmptySlotContainer = connect(mapStateToProps, mapDispatchToProps)( +const EmptySlotContainer = connect(undefined, mapDispatchToProps)( EmptySlotComponent, ) diff --git a/frontend/src/containers/app/sidebars/topology/rack/MachineContainer.js b/frontend/src/containers/app/sidebars/topology/rack/MachineContainer.js index 43558329..6b0f0a04 100644 --- a/frontend/src/containers/app/sidebars/topology/rack/MachineContainer.js +++ b/frontend/src/containers/app/sidebars/topology/rack/MachineContainer.js @@ -1,29 +1,10 @@ import { connect } from 'react-redux' import { goFromRackToMachine } from '../../../../../actions/interaction-level' import MachineComponent from '../../../../../components/app/sidebars/topology/rack/MachineComponent' -import { getStateLoad } from '../../../../../util/simulation-load' const mapStateToProps = (state, ownProps) => { - const machine = state.objects.machine[ownProps.machineId] - const inSimulation = state.currentExperimentId !== '-1' - - let machineLoad = undefined - if (inSimulation) { - if ( - state.states.machine[state.currentTick] && - state.states.machine[state.currentTick][machine._id] - ) { - machineLoad = getStateLoad( - state.loadMetric, - state.states.machine[state.currentTick][machine._id], - ) - } - } - return { - machine, - inSimulation, - machineLoad, + machine: state.objects.machine[ownProps.machineId], } } diff --git a/frontend/src/containers/app/sidebars/topology/rack/RackNameContainer.js b/frontend/src/containers/app/sidebars/topology/rack/RackNameContainer.js index 1eb885fc..4d8e8936 100644 --- a/frontend/src/containers/app/sidebars/topology/rack/RackNameContainer.js +++ b/frontend/src/containers/app/sidebars/topology/rack/RackNameContainer.js @@ -6,7 +6,7 @@ const mapStateToProps = state => { return { rackName: state.objects.rack[ - state.objects.tile[state.interactionLevel.tileId].rackId + state.objects.tile[state.interactionLevel.tileId].rackId ].name, } } diff --git a/frontend/src/containers/app/sidebars/topology/rack/RackSidebarContainer.js b/frontend/src/containers/app/sidebars/topology/rack/RackSidebarContainer.js index 7f931979..d9be1e8b 100644 --- a/frontend/src/containers/app/sidebars/topology/rack/RackSidebarContainer.js +++ b/frontend/src/containers/app/sidebars/topology/rack/RackSidebarContainer.js @@ -4,7 +4,6 @@ import RackSidebarComponent from '../../../../../components/app/sidebars/topolog const mapStateToProps = state => { return { rackId: state.objects.tile[state.interactionLevel.tileId].rackId, - inSimulation: state.currentExperimentId !== '-1', } } diff --git a/frontend/src/containers/app/sidebars/topology/room/RoomSidebarContainer.js b/frontend/src/containers/app/sidebars/topology/room/RoomSidebarContainer.js index 413c8f21..a95e290d 100644 --- a/frontend/src/containers/app/sidebars/topology/room/RoomSidebarContainer.js +++ b/frontend/src/containers/app/sidebars/topology/room/RoomSidebarContainer.js @@ -3,7 +3,6 @@ import RoomSidebarComponent from '../../../../../components/app/sidebars/topolog const mapStateToProps = state => { return { - inSimulation: state.currentExperimentId !== '-1', roomId: state.interactionLevel.roomId, } } |
