From da861719c6433a1fc9346da958f0907e52d578ce Mon Sep 17 00:00:00 2001 From: Georgios Andreadis Date: Thu, 21 Sep 2017 10:20:50 +0200 Subject: Show experiment and trace data on left-hand sidebar --- src/components/timeline/Timeline.js | 15 ---------- src/components/timeline/TimelineComponent.js | 43 ++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 15 deletions(-) delete mode 100644 src/components/timeline/Timeline.js create mode 100644 src/components/timeline/TimelineComponent.js (limited to 'src/components/timeline') diff --git a/src/components/timeline/Timeline.js b/src/components/timeline/Timeline.js deleted file mode 100644 index a2a858eb..00000000 --- a/src/components/timeline/Timeline.js +++ /dev/null @@ -1,15 +0,0 @@ -import React from "react"; -import TimelineControlsContainer from "../../containers/timeline/TimelineControlsContainer"; -import TimelineLabelsContainer from "../../containers/timeline/TimelineLabelsContainer"; -import "./Timeline.css"; - -const Timeline = ({currentTick, lastSimulatedTick}) => ( -
-
- - -
-
-); - -export default Timeline; 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 ( +
+
+ + +
+
+ ); + } +} + +export default TimelineComponent; -- cgit v1.2.3