Fix Logs view
This commit is contained in:
parent
2fe77ec1da
commit
0f37e525d7
1 changed files with 8 additions and 28 deletions
|
|
@ -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,13 +261,6 @@ 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;
|
||||
|
|
@ -277,7 +268,6 @@ class Logs extends React.Component {
|
|||
this.scrollToBottom();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
journalctlPrepend(entryList) {
|
||||
entryList.push(...this.entries);
|
||||
|
|
@ -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 {
|
|||
<div className="panel panel-default">
|
||||
<div className="panel-heading">
|
||||
<span>Logs</span>
|
||||
<button className="btn btn-default" style={{"float":"right"}} onClick={this.loadEarlier}>Load earlier entries</button>
|
||||
<button className="btn btn-default" style={{"float":"right"}} onClick={this.loadLater}>Load later entries</button>
|
||||
</div>
|
||||
<LogsView entries={this.state.entries} start={this.props.recording.start}
|
||||
end={this.props.recording.end} jumpToTs={this.props.jumpToTs} />
|
||||
<div className="panel-heading">
|
||||
<button className="btn btn-default" onClick={this.loadLater}>Load later entries</button>
|
||||
</div>
|
||||
<div className="panel-heading" />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue