LogsView bugfix

This commit is contained in:
Kyrylo Gliebov 2018-12-11 12:18:08 +01:00 committed by Kirill Glebov
parent 6f6c6b7714
commit 09039778c2

View file

@ -237,7 +237,6 @@ class Logs extends React.Component {
this.start = null; this.start = null;
this.end = null; this.end = null;
this.hostname = null; this.hostname = null;
this.earlier_than = null;
this.state = { this.state = {
serverTimeOffset: null, serverTimeOffset: null,
cursor: null, cursor: null,
@ -344,26 +343,14 @@ class Logs extends React.Component {
this.getServerTimeOffset(); this.getServerTimeOffset();
} }
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;
}
if (this.props.recording.hostname) {
this.hostname = this.props.recording.hostname;
}
this.getLogs();
}
}
componentDidUpdate() { componentDidUpdate() {
if (this.props.recording) { if (this.props.recording) {
if (this.start === null && this.end === null) { if (this.start === null && this.end === null) {
this.end = this.props.recording.start + 3600; this.end = this.props.recording.start + 3600;
this.start = this.props.recording.start; this.start = this.props.recording.start;
this.earlier_than = this.props.recording.start; }
if (this.props.recording.hostname) {
this.hostname = this.props.recording.hostname;
} }
this.getLogs(); this.getLogs();
} }
@ -373,6 +360,16 @@ class Logs extends React.Component {
} }
} }
componentWillUnmount() {
this.journalCtl.stop();
this.setState({
serverTimeOffset: null,
cursor: null,
after: null,
entries: [],
});
}
render() { render() {
let r = this.props.recording; let r = this.props.recording;
if (r == null) { if (r == null) {