Add Search
This commit is contained in:
parent
09039778c2
commit
66998cafa8
5 changed files with 301 additions and 124 deletions
|
|
@ -404,6 +404,9 @@ class Recording extends React.Component {
|
|||
|
||||
goBackToList() {
|
||||
if (cockpit.location.path[0]) {
|
||||
if ("search_rec" in cockpit.location.options) {
|
||||
delete cockpit.location.options.search_rec;
|
||||
}
|
||||
cockpit.location.go([], cockpit.location.options);
|
||||
} else {
|
||||
cockpit.location.go('/');
|
||||
|
|
@ -420,7 +423,9 @@ class Recording extends React.Component {
|
|||
ref="player"
|
||||
matchList={this.props.recording.matchList}
|
||||
logsTs={this.props.logsTs}
|
||||
onTsChange={this.props.onTsChange} />);
|
||||
search={this.props.search}
|
||||
onTsChange={this.props.onTsChange}
|
||||
recording={r} />);
|
||||
|
||||
return (
|
||||
<div className="container-fluid">
|
||||
|
|
@ -432,58 +437,7 @@ class Recording extends React.Component {
|
|||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
<div className="row">
|
||||
{player}
|
||||
<div className="col-md-6">
|
||||
<div className="panel panel-default">
|
||||
<div className="panel-heading">
|
||||
<span>{_("Recording")}</span>
|
||||
</div>
|
||||
<div className="panel-body">
|
||||
<table className="form-table-ct">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>{_("ID")}</td>
|
||||
<td>{r.id}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{_("Hostname")}</td>
|
||||
<td>{r.hostname}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{_("Boot ID")}</td>
|
||||
<td>{r.boot_id}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{_("Session ID")}</td>
|
||||
<td>{r.session_id}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{_("PID")}</td>
|
||||
<td>{r.pid}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{_("Start")}</td>
|
||||
<td>{formatDateTime(r.start)}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{_("End")}</td>
|
||||
<td>{formatDateTime(r.end)}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{_("Duration")}</td>
|
||||
<td>{formatDuration(r.end - r.start)}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{_("User")}</td>
|
||||
<td>{r.user}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{player}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
@ -645,6 +599,7 @@ class View extends React.Component {
|
|||
date_until: cockpit.location.options.date_until || "",
|
||||
username: cockpit.location.options.username || "",
|
||||
hostname: cockpit.location.options.hostname || "",
|
||||
search: cockpit.location.options.search || "",
|
||||
/* filter values end */
|
||||
error_tlog_uid: false,
|
||||
diff_hosts: false,
|
||||
|
|
@ -671,6 +626,7 @@ class View extends React.Component {
|
|||
date_until: cockpit.location.options.date_until || "",
|
||||
username: cockpit.location.options.username || "",
|
||||
hostname: cockpit.location.options.hostname || "",
|
||||
search: cockpit.location.options.search || "",
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -763,7 +719,7 @@ class View extends React.Component {
|
|||
* Assumes journalctl is not running.
|
||||
*/
|
||||
journalctlStart() {
|
||||
let matches = ["_UID=" + this.uid, "+", "_EXE=/usr/bin/tlog-rec-session", "+", "_EXE=/usr/bin/tlog-rec", "+", "SYSLOG_IDENTIFIER=\"-tlog-rec-session\""];
|
||||
let matches = ["_UID=" + this.uid, "+", "_EXE=/usr/bin/tlog-rec-session", "+", "_EXE=/usr/bin/tlog-rec", "+", "SYSLOG_IDENTIFIER=-tlog-rec-session"];
|
||||
if (this.state.username && this.state.username !== "") {
|
||||
matches.push("TLOG_USER=" + this.state.username);
|
||||
}
|
||||
|
|
@ -781,7 +737,12 @@ class View extends React.Component {
|
|||
options['until'] = this.state.date_until;
|
||||
}
|
||||
|
||||
if (this.state.search && this.state.search !== "" && this.state.recordingID === null) {
|
||||
options["grep"] = this.state.search;
|
||||
}
|
||||
|
||||
if (this.state.recordingID !== null) {
|
||||
delete options["grep"];
|
||||
matches.push("TLOG_REC=" + this.state.recordingID);
|
||||
}
|
||||
|
||||
|
|
@ -894,7 +855,8 @@ class View extends React.Component {
|
|||
if (this.state.date_since !== prevState.date_since ||
|
||||
this.state.date_until !== prevState.date_until ||
|
||||
this.state.username !== prevState.username ||
|
||||
this.state.hostname !== prevState.hostname
|
||||
this.state.hostname !== prevState.hostname ||
|
||||
this.state.search !== prevState.search
|
||||
) {
|
||||
this.clearRecordings();
|
||||
this.journalctlRestart();
|
||||
|
|
@ -929,7 +891,16 @@ class View extends React.Component {
|
|||
<Datetimepicker value={this.state.date_until} onChange={this.handleDateUntilChange} />
|
||||
</td>
|
||||
<td className="top">
|
||||
<label className="control-label" htmlFor="username">{_("Username")}</label>
|
||||
<label className="control-label" htmlFor="search">Search</label>
|
||||
</td>
|
||||
<td>
|
||||
<div className="input-group">
|
||||
<input type="text" className="form-control" name="search" value={this.state.search}
|
||||
onChange={this.handleInputChange} />
|
||||
</div>
|
||||
</td>
|
||||
<td className="top">
|
||||
<label className="control-label" htmlFor="username">Username</label>
|
||||
</td>
|
||||
<td>
|
||||
<div className="input-group">
|
||||
|
|
@ -972,7 +943,7 @@ class View extends React.Component {
|
|||
} else {
|
||||
return (
|
||||
<React.Fragment>
|
||||
<Recording recording={this.recordingMap[this.state.recordingID]} onTsChange={this.handleTsChange} logsTs={this.state.logsTs} />
|
||||
<Recording recording={this.recordingMap[this.state.recordingID]} onTsChange={this.handleTsChange} logsTs={this.state.logsTs} search={this.state.search} />
|
||||
<div className="container-fluid">
|
||||
<div className="row">
|
||||
<div className="col-md-12">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue