blob: 227a4fd5536bcd6e5471a918683c0c264a7c0ca9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
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,
};
};
const LoadChartContainer = connect(
mapStateToProps
)(LoadChartComponent);
export default LoadChartContainer;
|