From 0f37e525d7ef4d1574be466f4ecdd14219272991 Mon Sep 17 00:00:00 2001 From: Kyrylo Gliebov Date: Tue, 9 Oct 2018 18:55:01 +0200 Subject: [PATCH] Fix Logs view --- src/recordings.jsx | 36 ++++++++---------------------------- 1 file changed, 8 insertions(+), 28 deletions(-) diff --git a/src/recordings.jsx b/src/recordings.jsx index b0d82fe..af04b9d 100644 --- a/src/recordings.jsx +++ b/src/recordings.jsx @@ -233,14 +233,12 @@ class Logs extends React.Component { this.journalctlPrepend = this.journalctlPrepend.bind(this); this.getLogs = this.getLogs.bind(this); this.loadLater = this.loadLater.bind(this); - this.loadEarlier = this.loadEarlier.bind(this); this.loadForTs = this.loadForTs.bind(this); this.journalCtl = null; this.entries = []; this.start = null; this.end = null; this.earlier_than = null; - this.load_earlier = false; this.state = { cursor: null, after: null, @@ -263,19 +261,11 @@ class Logs extends React.Component { } journalctlIngest(entryList) { - if (this.load_earlier === true) { - entryList.push(...this.entries); - this.entries = entryList; - this.setState({entries: this.entries}); - this.load_earlier = false; - this.scrollToTop(); - } else { - if (entryList.length > 0) { - this.entries.push(...entryList); - const after = this.entries[this.entries.length - 1].__CURSOR; - this.setState({entries: this.entries, after: after}); - this.scrollToBottom(); - } + if (entryList.length > 0) { + this.entries.push(...entryList); + const after = this.entries[this.entries.length - 1].__CURSOR; + this.setState({entries: this.entries, after: after}); + this.scrollToBottom(); } } @@ -300,9 +290,7 @@ class Logs extends React.Component { count: "all", }; - if (this.load_earlier === true) { - options["until"] = formatDateTime(this.earlier_than); - } else if (this.state.after != null) { + if (this.state.after != null) { options["after"] = this.state.after; delete options.since; } @@ -316,12 +304,6 @@ class Logs extends React.Component { } } - loadEarlier() { - this.load_earlier = true; - this.start = this.start - 3600; - this.getLogs(); - } - loadLater() { this.start = this.end; this.end = this.end + 3600; @@ -368,13 +350,11 @@ class Logs extends React.Component {
Logs - +
-
- -
+
); }