mirror of
https://github.com/wavetermdev/waveterm.git
synced 2024-12-23 16:58:27 +01:00
use new history search api
This commit is contained in:
parent
aae5b81de0
commit
3eadd676ce
@ -258,6 +258,12 @@ class HistoryView extends React.Component<{}, {}> {
|
||||
})();
|
||||
}
|
||||
|
||||
@boundMethod
|
||||
resetAllFilters() : void {
|
||||
let hvm = GlobalModel.historyViewModel;
|
||||
hvm.resetAllFilters();
|
||||
}
|
||||
|
||||
render() {
|
||||
let isHidden = (GlobalModel.activeMainView.get() != "history");
|
||||
if (isHidden) {
|
||||
@ -354,6 +360,9 @@ class HistoryView extends React.Component<{}, {}> {
|
||||
<input type="date" onChange={this.handleFromTsChange} value={this.searchFromTsInputValue()} className="input is-small"/>
|
||||
</div>
|
||||
</div>
|
||||
<div onClick={this.resetAllFilters} className="reset-button">
|
||||
Reset All Filters
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -2249,7 +2249,7 @@ class MainSideBar extends React.Component<{}, {}> {
|
||||
})();
|
||||
return;
|
||||
}
|
||||
GlobalCommandRunner.historyView({});
|
||||
GlobalCommandRunner.historyView({offset: 0, rawOffset: 0, noMeta: true});
|
||||
}
|
||||
|
||||
@boundMethod
|
||||
|
20
src/model.ts
20
src/model.ts
@ -1803,6 +1803,7 @@ class HistoryViewModel {
|
||||
searchRemoteId : OV<string> = mobx.observable.box(null, {name: "historyview-searchRemoteId"});
|
||||
searchShowMeta : OV<boolean> = mobx.observable.box(false, {name: "historyview-searchShowMeta"});
|
||||
searchFromDate : OV<string> = mobx.observable.box(null, {name: "historyview-searchfromts"});
|
||||
nextRawOffset : number = 0;
|
||||
|
||||
historyItemLines : LineType[] = [];
|
||||
historyItemCmds : CmdDataType[] = [];
|
||||
@ -1916,6 +1917,7 @@ class HistoryViewModel {
|
||||
let offset = (newOffset != null ? newOffset : this.offset.get());
|
||||
let opts : HistorySearchParams = {
|
||||
offset: offset,
|
||||
rawOffset: offset,
|
||||
searchText: this.activeSearchText,
|
||||
searchSessionId: this.searchSessionId.get(),
|
||||
searchRemoteId: this.searchRemoteId.get(),
|
||||
@ -1934,6 +1936,19 @@ class HistoryViewModel {
|
||||
return opts;
|
||||
}
|
||||
|
||||
resetAllFilters() : void {
|
||||
mobx.action(() => {
|
||||
this.offset.set(0);
|
||||
this.activeSearchText = "";
|
||||
this.searchText.set("");
|
||||
this.searchSessionId.set(null);
|
||||
this.searchRemoteId.set(null);
|
||||
this.searchFromDate.set(null);
|
||||
this.searchShowMeta.set(false);
|
||||
})();
|
||||
GlobalCommandRunner.historyView(this._getSearchParams());
|
||||
}
|
||||
|
||||
setFromDate(fromDate : string) : void {
|
||||
if (this.searchFromDate.get() == fromDate) {
|
||||
return;
|
||||
@ -3304,9 +3319,8 @@ class CommandRunner {
|
||||
|
||||
historyView(params : HistorySearchParams) {
|
||||
let kwargs = {"nohist": "1"};
|
||||
if (params.offset != null) {
|
||||
kwargs["offset"] = String(params.offset);
|
||||
}
|
||||
kwargs["offset"] = String(params.offset);
|
||||
kwargs["rawoffset"] = String(params.rawOffset);
|
||||
if (params.searchText != null) {
|
||||
kwargs["text"] = params.searchText;
|
||||
}
|
||||
|
12
src/sh2.less
12
src/sh2.less
@ -288,6 +288,18 @@ body::-webkit-scrollbar {
|
||||
.fromts-text {
|
||||
}
|
||||
}
|
||||
|
||||
.reset-button {
|
||||
cursor: pointer;
|
||||
margin-left: 15px;
|
||||
font-size: 12px;
|
||||
border: 1px solid #777;
|
||||
padding: 5px 10px 5px 10px;
|
||||
|
||||
&:hover {
|
||||
background-color: #666;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -291,11 +291,12 @@ type ModelUpdateType = {
|
||||
};
|
||||
|
||||
type HistoryViewDataType = {
|
||||
offset : number,
|
||||
items : HistoryItem[],
|
||||
offset : number,
|
||||
nextrawoffset : number,
|
||||
hasmore : boolean,
|
||||
lines : LineType[],
|
||||
cmds : CmdDataType[],
|
||||
hasmore : boolean,
|
||||
};
|
||||
|
||||
type BookmarkType = {
|
||||
@ -428,7 +429,8 @@ type AlertMessageType = {
|
||||
};
|
||||
|
||||
type HistorySearchParams = {
|
||||
offset? : number,
|
||||
offset : number,
|
||||
rawOffset : number,
|
||||
searchText? : string,
|
||||
searchSessionId? : string,
|
||||
searchRemoteId? : string,
|
||||
|
Loading…
Reference in New Issue
Block a user