diff options
| author | Georgios Andreadis <g.andreadis@student.tudelft.nl> | 2017-09-21 10:20:50 +0200 |
|---|---|---|
| committer | Georgios Andreadis <g.andreadis@student.tudelft.nl> | 2017-09-23 10:06:04 +0200 |
| commit | da861719c6433a1fc9346da958f0907e52d578ce (patch) | |
| tree | b171796fbfe17f0356bf6e32430223c67812a760 /src/containers/timeline/TimelineContainer.js | |
| parent | f8f617c97fcb2df3dbefc9527d974151e367cb60 (diff) | |
Show experiment and trace data on left-hand sidebar
Diffstat (limited to 'src/containers/timeline/TimelineContainer.js')
| -rw-r--r-- | src/containers/timeline/TimelineContainer.js | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/containers/timeline/TimelineContainer.js b/src/containers/timeline/TimelineContainer.js new file mode 100644 index 00000000..32756b6d --- /dev/null +++ b/src/containers/timeline/TimelineContainer.js @@ -0,0 +1,37 @@ +import {connect} from "react-redux"; +import {incrementTick} from "../../actions/simulation/tick"; +import {setCurrentDatacenter} from "../../actions/topology/building"; +import TimelineComponent from "../../components/timeline/TimelineComponent"; + +const mapStateToProps = state => { + let sections = []; + if (state.currentExperimentId !== -1) { + const sectionIds = state.objects.path[state.objects.experiment[state.currentExperimentId].pathId].sectionIds; + + if (sectionIds) { + sections = sectionIds.map(sectionId => state.objects.section[sectionId]); + } + } + + return { + isPlaying: state.isPlaying, + currentTick: state.currentTick, + lastSimulatedTick: state.lastSimulatedTick, + currentDatacenterId: state.currentDatacenterId, + sections, + }; +}; + +const mapDispatchToProps = dispatch => { + return { + incrementTick: () => dispatch(incrementTick()), + setCurrentDatacenter: id => dispatch(setCurrentDatacenter(id)) + }; +}; + +const TimelineContainer = connect( + mapStateToProps, + mapDispatchToProps +)(TimelineComponent); + +export default TimelineContainer; |
