summaryrefslogtreecommitdiff
path: root/src/containers/timeline
diff options
context:
space:
mode:
authorGeorgios Andreadis <g.andreadis@student.tudelft.nl>2017-09-21 10:20:50 +0200
committerGeorgios Andreadis <g.andreadis@student.tudelft.nl>2017-09-23 10:06:04 +0200
commitda861719c6433a1fc9346da958f0907e52d578ce (patch)
treeb171796fbfe17f0356bf6e32430223c67812a760 /src/containers/timeline
parentf8f617c97fcb2df3dbefc9527d974151e367cb60 (diff)
Show experiment and trace data on left-hand sidebar
Diffstat (limited to 'src/containers/timeline')
-rw-r--r--src/containers/timeline/TimelineContainer.js37
-rw-r--r--src/containers/timeline/TimelineControlsContainer.js4
2 files changed, 40 insertions, 1 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;
diff --git a/src/containers/timeline/TimelineControlsContainer.js b/src/containers/timeline/TimelineControlsContainer.js
index e5c89060..1afd336a 100644
--- a/src/containers/timeline/TimelineControlsContainer.js
+++ b/src/containers/timeline/TimelineControlsContainer.js
@@ -5,7 +5,9 @@ const mapStateToProps = state => {
let sectionTicks = [];
if (state.currentExperimentId !== -1) {
const sectionIds = state.objects.path[state.objects.experiment[state.currentExperimentId].pathId].sectionIds;
- sectionTicks = sectionIds.map(sectionId => state.objects.section[sectionId].startTick);
+ if (sectionIds) {
+ sectionTicks = sectionIds.map(sectionId => state.objects.section[sectionId].startTick);
+ }
}
return {