summaryrefslogtreecommitdiff
path: root/frontend/src/containers/app
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/src/containers/app')
-rw-r--r--frontend/src/containers/app/map/RackContainer.js20
-rw-r--r--frontend/src/containers/app/map/TileContainer.js17
-rw-r--r--frontend/src/containers/app/sidebars/elements/LoadBarContainer.js32
-rw-r--r--frontend/src/containers/app/sidebars/elements/LoadChartContainer.js16
-rw-r--r--frontend/src/containers/app/sidebars/simulation/ExperimentMetadataContainer.js38
-rw-r--r--frontend/src/containers/app/sidebars/simulation/LoadMetricContainer.js12
-rw-r--r--frontend/src/containers/app/sidebars/topology/building/BuildingSidebarContainer.js11
-rw-r--r--frontend/src/containers/app/sidebars/topology/machine/MachineSidebarContainer.js1
-rw-r--r--frontend/src/containers/app/sidebars/topology/machine/UnitContainer.js1
-rw-r--r--frontend/src/containers/app/sidebars/topology/machine/UnitListContainer.js3
-rw-r--r--frontend/src/containers/app/sidebars/topology/machine/UnitTabsContainer.js9
-rw-r--r--frontend/src/containers/app/sidebars/topology/rack/EmptySlotContainer.js8
-rw-r--r--frontend/src/containers/app/sidebars/topology/rack/MachineContainer.js21
-rw-r--r--frontend/src/containers/app/sidebars/topology/rack/RackNameContainer.js2
-rw-r--r--frontend/src/containers/app/sidebars/topology/rack/RackSidebarContainer.js1
-rw-r--r--frontend/src/containers/app/sidebars/topology/room/RoomSidebarContainer.js1
-rw-r--r--frontend/src/containers/app/timeline/PlayButtonContainer.js24
-rw-r--r--frontend/src/containers/app/timeline/TimelineContainer.js26
-rw-r--r--frontend/src/containers/app/timeline/TimelineControlsContainer.js22
-rw-r--r--frontend/src/containers/app/timeline/TimelineLabelsContainer.js15
20 files changed, 7 insertions, 273 deletions
diff --git a/frontend/src/containers/app/map/RackContainer.js b/frontend/src/containers/app/map/RackContainer.js
index 34e7bbab..40077608 100644
--- a/frontend/src/containers/app/map/RackContainer.js
+++ b/frontend/src/containers/app/map/RackContainer.js
@@ -1,27 +1,9 @@
import { connect } from 'react-redux'
import RackGroup from '../../../components/app/map/groups/RackGroup'
-import { getStateLoad } from '../../../util/simulation-load'
-
-const mapStateToProps = (state, ownProps) => {
- const inSimulation = state.currentExperimentId !== '-1'
-
- let rackLoad = undefined
- if (inSimulation) {
- if (
- state.states.rack[state.currentTick] &&
- state.states.rack[state.currentTick][ownProps.tile.rackId]
- ) {
- rackLoad = getStateLoad(
- state.loadMetric,
- state.states.rack[state.currentTick][ownProps.tile.rackId],
- )
- }
- }
+const mapStateToProps = (state) => {
return {
interactionLevel: state.interactionLevel,
- inSimulation,
- rackLoad,
}
}
diff --git a/frontend/src/containers/app/map/TileContainer.js b/frontend/src/containers/app/map/TileContainer.js
index 28289206..ddef097c 100644
--- a/frontend/src/containers/app/map/TileContainer.js
+++ b/frontend/src/containers/app/map/TileContainer.js
@@ -1,30 +1,13 @@
import { connect } from 'react-redux'
import { goFromRoomToRack } from '../../../actions/interaction-level'
import TileGroup from '../../../components/app/map/groups/TileGroup'
-import { getStateLoad } from '../../../util/simulation-load'
const mapStateToProps = (state, ownProps) => {
const tile = state.objects.tile[ownProps.tileId]
- const inSimulation = state.currentExperimentId !== '-1'
-
- let roomLoad = undefined
- if (inSimulation) {
- if (
- state.states.room[state.currentTick] &&
- state.states.room[state.currentTick][tile.roomId]
- ) {
- roomLoad = getStateLoad(
- state.loadMetric,
- state.states.room[state.currentTick][tile.roomId],
- )
- }
- }
return {
interactionLevel: state.interactionLevel,
tile,
- inSimulation,
- roomLoad,
}
}
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,
}
}
diff --git a/frontend/src/containers/app/timeline/PlayButtonContainer.js b/frontend/src/containers/app/timeline/PlayButtonContainer.js
deleted file mode 100644
index 9662d753..00000000
--- a/frontend/src/containers/app/timeline/PlayButtonContainer.js
+++ /dev/null
@@ -1,24 +0,0 @@
-import { connect } from 'react-redux'
-import { pauseSimulation, playSimulation } from '../../../actions/simulation/playback'
-import PlayButtonComponent from '../../../components/app/timeline/PlayButtonComponent'
-
-const mapStateToProps = state => {
- return {
- isPlaying: state.isPlaying,
- currentTick: state.currentTick,
- lastSimulatedTick: state.lastSimulatedTick,
- }
-}
-
-const mapDispatchToProps = dispatch => {
- return {
- onPlay: () => dispatch(playSimulation()),
- onPause: () => dispatch(pauseSimulation()),
- }
-}
-
-const PlayButtonContainer = connect(mapStateToProps, mapDispatchToProps)(
- PlayButtonComponent,
-)
-
-export default PlayButtonContainer
diff --git a/frontend/src/containers/app/timeline/TimelineContainer.js b/frontend/src/containers/app/timeline/TimelineContainer.js
deleted file mode 100644
index 9b196a1b..00000000
--- a/frontend/src/containers/app/timeline/TimelineContainer.js
+++ /dev/null
@@ -1,26 +0,0 @@
-import { connect } from 'react-redux'
-import { pauseSimulation } from '../../../actions/simulation/playback'
-import { incrementTick } from '../../../actions/simulation/tick'
-import TimelineComponent from '../../../components/app/timeline/TimelineComponent'
-
-const mapStateToProps = state => {
- return {
- isPlaying: state.isPlaying,
- currentTick: state.currentTick,
- lastSimulatedTick: state.lastSimulatedTick,
- currentTopologyId: state.currentTopologyId,
- }
-}
-
-const mapDispatchToProps = dispatch => {
- return {
- incrementTick: () => dispatch(incrementTick()),
- pauseSimulation: () => dispatch(pauseSimulation()),
- }
-}
-
-const TimelineContainer = connect(mapStateToProps, mapDispatchToProps)(
- TimelineComponent,
-)
-
-export default TimelineContainer
diff --git a/frontend/src/containers/app/timeline/TimelineControlsContainer.js b/frontend/src/containers/app/timeline/TimelineControlsContainer.js
deleted file mode 100644
index 91aba98d..00000000
--- a/frontend/src/containers/app/timeline/TimelineControlsContainer.js
+++ /dev/null
@@ -1,22 +0,0 @@
-import { connect } from 'react-redux'
-import { goToTick } from '../../../actions/simulation/tick'
-import TimelineControlsComponent from '../../../components/app/timeline/TimelineControlsComponent'
-
-const mapStateToProps = state => {
- return {
- currentTick: state.currentTick,
- lastSimulatedTick: state.lastSimulatedTick,
- }
-}
-
-const mapDispatchToProps = dispatch => {
- return {
- goToTick: tick => dispatch(goToTick(tick)),
- }
-}
-
-const TimelineControlsContainer = connect(mapStateToProps, mapDispatchToProps)(
- TimelineControlsComponent,
-)
-
-export default TimelineControlsContainer
diff --git a/frontend/src/containers/app/timeline/TimelineLabelsContainer.js b/frontend/src/containers/app/timeline/TimelineLabelsContainer.js
deleted file mode 100644
index 192d21c3..00000000
--- a/frontend/src/containers/app/timeline/TimelineLabelsContainer.js
+++ /dev/null
@@ -1,15 +0,0 @@
-import { connect } from 'react-redux'
-import TimelineLabelsComponent from '../../../components/app/timeline/TimelineLabelsComponent'
-
-const mapStateToProps = state => {
- return {
- currentTick: state.currentTick,
- lastSimulatedTick: state.lastSimulatedTick,
- }
-}
-
-const TimelineLabelsContainer = connect(mapStateToProps)(
- TimelineLabelsComponent,
-)
-
-export default TimelineLabelsContainer