summaryrefslogtreecommitdiff
path: root/src/components/timeline/TimelineComponent.js
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/components/timeline/TimelineComponent.js
parentf8f617c97fcb2df3dbefc9527d974151e367cb60 (diff)
Show experiment and trace data on left-hand sidebar
Diffstat (limited to 'src/components/timeline/TimelineComponent.js')
-rw-r--r--src/components/timeline/TimelineComponent.js43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/components/timeline/TimelineComponent.js b/src/components/timeline/TimelineComponent.js
new file mode 100644
index 00000000..b400a378
--- /dev/null
+++ b/src/components/timeline/TimelineComponent.js
@@ -0,0 +1,43 @@
+import React from "react";
+import TimelineControlsContainer from "../../containers/timeline/TimelineControlsContainer";
+import TimelineLabelsContainer from "../../containers/timeline/TimelineLabelsContainer";
+import "./Timeline.css";
+
+class TimelineComponent extends React.Component {
+ componentDidMount() {
+ this.interval = setInterval(() => {
+ if (!this.props.isPlaying) {
+ return;
+ }
+
+ if (this.props.currentTick < this.props.lastSimulatedTick) {
+ for (let i in this.props.sections.reverse()) {
+ if (this.props.currentTick + 1 >= this.props.sections[i].startTick) {
+ if (this.props.currentDatacenterId !== this.props.sections[i].datacenterId) {
+ this.props.setCurrentDatacenter(this.props.sections[i].datacenterId);
+ }
+ break;
+ }
+ }
+ this.props.incrementTick();
+ }
+ }, 1000);
+ }
+
+ componentWillUnmount() {
+ clearInterval(this.interval);
+ }
+
+ render() {
+ return (
+ <div className="timeline-bar">
+ <div className="timeline-container">
+ <TimelineLabelsContainer/>
+ <TimelineControlsContainer/>
+ </div>
+ </div>
+ );
+ }
+}
+
+export default TimelineComponent;