Make Logs view optional

This commit is contained in:
Justin Stephenson 2019-09-06 11:16:09 -04:00
parent 811b80fa27
commit feed483646
2 changed files with 20 additions and 7 deletions

View file

@ -947,7 +947,9 @@ export class Player extends React.Component {
} }
/* Send packet ts to the top */ /* Send packet ts to the top */
if (this.props.logsEnabled) {
this.props.onTsChange(this.pkt.pos); this.props.onTsChange(this.pkt.pos);
}
this.setState({currentTsPost: parseInt(this.pkt.pos)}); this.setState({currentTsPost: parseInt(this.pkt.pos)});
/* Output the packet */ /* Output the packet */

View file

@ -402,9 +402,11 @@ class Recording extends React.Component {
this.goBackToList = this.goBackToList.bind(this); this.goBackToList = this.goBackToList.bind(this);
this.handleTsChange = this.handleTsChange.bind(this); this.handleTsChange = this.handleTsChange.bind(this);
this.handleLogTsChange = this.handleLogTsChange.bind(this); this.handleLogTsChange = this.handleLogTsChange.bind(this);
this.handleLogsClick = this.handleLogsClick.bind(this);
this.state = { this.state = {
curTs: null, curTs: null,
logsTs: null, logsTs: null,
logsEnabled: false,
}; };
} }
@ -416,6 +418,10 @@ class Recording extends React.Component {
this.setState({logsTs: ts}); this.setState({logsTs: ts});
} }
handleLogsClick() {
this.setState({logsEnabled: !this.state.logsEnabled});
}
goBackToList() { goBackToList() {
if (cockpit.location.path[0]) { if (cockpit.location.path[0]) {
if ("search_rec" in cockpit.location.options) { if ("search_rec" in cockpit.location.options) {
@ -439,7 +445,8 @@ class Recording extends React.Component {
logsTs={this.logsTs} logsTs={this.logsTs}
search={this.props.search} search={this.props.search}
onTsChange={this.handleTsChange} onTsChange={this.handleTsChange}
recording={r} />); recording={r}
logsEnabled={this.state.logsEnabled} />);
return ( return (
<React.Fragment> <React.Fragment>
@ -451,16 +458,20 @@ class Recording extends React.Component {
<li className="active">{_("Session")}</li> <li className="active">{_("Session")}</li>
</ol> </ol>
</div> </div>
</div>
{player} {player}
</div> </div>
<div className="container-fluid">
<div className="row"> <div className="row">
<div className="col-md-12"> <div className="col-md-12">
<Logs recording={this.props.recording} curTs={this.state.curTs} <button className="btn btn-default" style={{"float":"left"}} onClick={this.handleLogsClick}>{_("Logs View")}</button>
jumpToTs={this.handleLogTsChange} />
</div> </div>
</div> </div>
{this.state.logsEnabled === true &&
<div className="row">
<div className="col-md-12">
<Logs recording={this.props.recording} curTs={this.state.curTs} jumpToTs={this.handleLogTsChange} />
</div>
</div>
}
</div> </div>
</React.Fragment> </React.Fragment>
); );