From 1feb78fab7cbeaae5942c10dc5024c3f254d53b4 Mon Sep 17 00:00:00 2001 From: Kyrylo Gliebov Date: Tue, 2 Oct 2018 19:21:06 +0200 Subject: [PATCH] Recording page refactoring --- src/recordings.jsx | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/src/recordings.jsx b/src/recordings.jsx index 8ef6d63..8b2d1bc 100644 --- a/src/recordings.jsx +++ b/src/recordings.jsx @@ -333,6 +333,17 @@ class Logs extends React.Component { this.getLogs(); } + componentDidMount() { + if (this.props.recording) { + if (this.start === null && this.end === null) { + this.end = this.props.recording.start + 3600; + this.start = this.props.recording.start; + this.earlier_than = this.props.recording.start; + } + this.getLogs(); + } + } + componentDidUpdate() { if (this.props.recording) { if (this.start === null && this.end === null) { @@ -341,15 +352,18 @@ class Logs extends React.Component { this.earlier_than = this.props.recording.start; } this.getLogs(); - if (this.props.curTs) { - const ts = this.props.curTs; - this.loadForTs(ts); - } + } + if (this.props.curTs) { + const ts = this.props.curTs; + this.loadForTs(ts); } } render() { - if (this.props.recording) { + let r = this.props.recording; + if (r == null) { + return Loading...; + } else { return (
@@ -363,8 +377,6 @@ class Logs extends React.Component {
); - } else { - return (
Loading...
); } } }