mirror of
https://github.com/wavetermdev/waveterm.git
synced 2025-01-25 22:12:12 +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() {
|
render() {
|
||||||
let isHidden = (GlobalModel.activeMainView.get() != "history");
|
let isHidden = (GlobalModel.activeMainView.get() != "history");
|
||||||
if (isHidden) {
|
if (isHidden) {
|
||||||
@ -354,6 +360,9 @@ class HistoryView extends React.Component<{}, {}> {
|
|||||||
<input type="date" onChange={this.handleFromTsChange} value={this.searchFromTsInputValue()} className="input is-small"/>
|
<input type="date" onChange={this.handleFromTsChange} value={this.searchFromTsInputValue()} className="input is-small"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div onClick={this.resetAllFilters} className="reset-button">
|
||||||
|
Reset All Filters
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -2249,7 +2249,7 @@ class MainSideBar extends React.Component<{}, {}> {
|
|||||||
})();
|
})();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
GlobalCommandRunner.historyView({});
|
GlobalCommandRunner.historyView({offset: 0, rawOffset: 0, noMeta: true});
|
||||||
}
|
}
|
||||||
|
|
||||||
@boundMethod
|
@boundMethod
|
||||||
|
18
src/model.ts
18
src/model.ts
@ -1803,6 +1803,7 @@ class HistoryViewModel {
|
|||||||
searchRemoteId : OV<string> = mobx.observable.box(null, {name: "historyview-searchRemoteId"});
|
searchRemoteId : OV<string> = mobx.observable.box(null, {name: "historyview-searchRemoteId"});
|
||||||
searchShowMeta : OV<boolean> = mobx.observable.box(false, {name: "historyview-searchShowMeta"});
|
searchShowMeta : OV<boolean> = mobx.observable.box(false, {name: "historyview-searchShowMeta"});
|
||||||
searchFromDate : OV<string> = mobx.observable.box(null, {name: "historyview-searchfromts"});
|
searchFromDate : OV<string> = mobx.observable.box(null, {name: "historyview-searchfromts"});
|
||||||
|
nextRawOffset : number = 0;
|
||||||
|
|
||||||
historyItemLines : LineType[] = [];
|
historyItemLines : LineType[] = [];
|
||||||
historyItemCmds : CmdDataType[] = [];
|
historyItemCmds : CmdDataType[] = [];
|
||||||
@ -1916,6 +1917,7 @@ class HistoryViewModel {
|
|||||||
let offset = (newOffset != null ? newOffset : this.offset.get());
|
let offset = (newOffset != null ? newOffset : this.offset.get());
|
||||||
let opts : HistorySearchParams = {
|
let opts : HistorySearchParams = {
|
||||||
offset: offset,
|
offset: offset,
|
||||||
|
rawOffset: offset,
|
||||||
searchText: this.activeSearchText,
|
searchText: this.activeSearchText,
|
||||||
searchSessionId: this.searchSessionId.get(),
|
searchSessionId: this.searchSessionId.get(),
|
||||||
searchRemoteId: this.searchRemoteId.get(),
|
searchRemoteId: this.searchRemoteId.get(),
|
||||||
@ -1934,6 +1936,19 @@ class HistoryViewModel {
|
|||||||
return opts;
|
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 {
|
setFromDate(fromDate : string) : void {
|
||||||
if (this.searchFromDate.get() == fromDate) {
|
if (this.searchFromDate.get() == fromDate) {
|
||||||
return;
|
return;
|
||||||
@ -3304,9 +3319,8 @@ class CommandRunner {
|
|||||||
|
|
||||||
historyView(params : HistorySearchParams) {
|
historyView(params : HistorySearchParams) {
|
||||||
let kwargs = {"nohist": "1"};
|
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) {
|
if (params.searchText != null) {
|
||||||
kwargs["text"] = params.searchText;
|
kwargs["text"] = params.searchText;
|
||||||
}
|
}
|
||||||
|
12
src/sh2.less
12
src/sh2.less
@ -288,6 +288,18 @@ body::-webkit-scrollbar {
|
|||||||
.fromts-text {
|
.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 = {
|
type HistoryViewDataType = {
|
||||||
offset : number,
|
|
||||||
items : HistoryItem[],
|
items : HistoryItem[],
|
||||||
|
offset : number,
|
||||||
|
nextrawoffset : number,
|
||||||
|
hasmore : boolean,
|
||||||
lines : LineType[],
|
lines : LineType[],
|
||||||
cmds : CmdDataType[],
|
cmds : CmdDataType[],
|
||||||
hasmore : boolean,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
type BookmarkType = {
|
type BookmarkType = {
|
||||||
@ -428,7 +429,8 @@ type AlertMessageType = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
type HistorySearchParams = {
|
type HistorySearchParams = {
|
||||||
offset? : number,
|
offset : number,
|
||||||
|
rawOffset : number,
|
||||||
searchText? : string,
|
searchText? : string,
|
||||||
searchSessionId? : string,
|
searchSessionId? : string,
|
||||||
searchRemoteId? : string,
|
searchRemoteId? : string,
|
||||||
|
Loading…
Reference in New Issue
Block a user