diff --git a/src/history.tsx b/src/history.tsx
index 7830a6f4..9550a04b 100644
--- a/src/history.tsx
+++ b/src/history.tsx
@@ -258,6 +258,14 @@ class HistoryView extends React.Component<{}, {}> {
})();
}
+ @boundMethod
+ toggleFilterCmds() : void {
+ let hvm = GlobalModel.historyViewModel;
+ mobx.action(() => {
+ hvm.setSearchFilterCmds(!hvm.searchFilterCmds.get());
+ })();
+ }
+
@boundMethod
resetAllFilters() : void {
let hvm = GlobalModel.historyViewModel;
@@ -305,9 +313,9 @@ class HistoryView extends React.Component<{}, {}> {
HISTORY
-
+
-
Show MetaCmds
+
Show MetaCmds
+
- Reset All Filters
+ Reset All
diff --git a/src/main.tsx b/src/main.tsx
index 830fa12e..f07e3f19 100644
--- a/src/main.tsx
+++ b/src/main.tsx
@@ -2249,7 +2249,7 @@ class MainSideBar extends React.Component<{}, {}> {
})();
return;
}
- GlobalCommandRunner.historyView({offset: 0, rawOffset: 0, noMeta: true});
+ GlobalModel.historyViewModel.reSearch();
}
@boundMethod
diff --git a/src/model.ts b/src/model.ts
index 54a92dab..0aa2c79b 100644
--- a/src/model.ts
+++ b/src/model.ts
@@ -1803,7 +1803,9 @@ class HistoryViewModel {
searchRemoteId : OV = mobx.observable.box(null, {name: "historyview-searchRemoteId"});
searchShowMeta : OV = mobx.observable.box(false, {name: "historyview-searchShowMeta"});
searchFromDate : OV = mobx.observable.box(null, {name: "historyview-searchfromts"});
+ searchFilterCmds : OV = mobx.observable.box(true, {name: "historyview-filtercmds"});
nextRawOffset : number = 0;
+ curRawOffset : number = 0;
historyItemLines : LineType[] = [];
historyItemCmds : CmdDataType[] = [];
@@ -1913,11 +1915,12 @@ class HistoryViewModel {
})();
}
- _getSearchParams(newOffset? : number) : HistorySearchParams {
+ _getSearchParams(newOffset? : number, newRawOffset? : number) : HistorySearchParams {
let offset = (newOffset != null ? newOffset : this.offset.get());
+ let rawOffset = (newRawOffset != null ? newRawOffset : this.curRawOffset);
let opts : HistorySearchParams = {
offset: offset,
- rawOffset: offset,
+ rawOffset: rawOffset,
searchText: this.activeSearchText,
searchSessionId: this.searchSessionId.get(),
searchRemoteId: this.searchRemoteId.get(),
@@ -1933,20 +1936,27 @@ class HistoryViewModel {
let ts = d.getTime()-1;
opts.fromTs = ts;
}
+ if (this.searchFilterCmds.get()) {
+ opts.filterCmds = true;
+ }
return opts;
}
+ reSearch() : void {
+ GlobalCommandRunner.historyView(this._getSearchParams());
+ }
+
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);
+ this.searchFilterCmds.set(true);
})();
- GlobalCommandRunner.historyView(this._getSearchParams());
+ GlobalCommandRunner.historyView(this._getSearchParams(0, 0));
}
setFromDate(fromDate : string) : void {
@@ -1956,14 +1966,27 @@ class HistoryViewModel {
mobx.action(() => {
this.searchFromDate.set(fromDate);
})();
- GlobalCommandRunner.historyView(this._getSearchParams(0));
+ GlobalCommandRunner.historyView(this._getSearchParams(0, 0));
+ }
+
+ setSearchFilterCmds(filter : boolean) : void {
+ if (this.searchFilterCmds.get() == filter) {
+ return;
+ }
+ mobx.action(() => {
+ this.searchFilterCmds.set(filter);
+ })();
+ GlobalCommandRunner.historyView(this._getSearchParams(0, 0));
}
setSearchShowMeta(show : boolean) : void {
+ if (this.searchShowMeta.get() == show) {
+ return;
+ }
mobx.action(() => {
this.searchShowMeta.set(show);
})();
- GlobalCommandRunner.historyView(this._getSearchParams(0));
+ GlobalCommandRunner.historyView(this._getSearchParams(0, 0));
}
setSearchSessionId(sessionId : string) : void {
@@ -1973,7 +1996,7 @@ class HistoryViewModel {
mobx.action(() => {
this.searchSessionId.set(sessionId);
})();
- GlobalCommandRunner.historyView(this._getSearchParams(0));
+ GlobalCommandRunner.historyView(this._getSearchParams(0, 0));
}
setSearchRemoteId(remoteId : string) : void {
@@ -1983,7 +2006,7 @@ class HistoryViewModel {
mobx.action(() => {
this.searchRemoteId.set(remoteId);
})();
- GlobalCommandRunner.historyView(this._getSearchParams(0));
+ GlobalCommandRunner.historyView(this._getSearchParams(0, 0));
}
goPrev() : void {
@@ -1992,14 +2015,14 @@ class HistoryViewModel {
if (offset < 0) {
offset = 0;
}
- let params = this._getSearchParams(offset);
+ let params = this._getSearchParams(offset, 0);
GlobalCommandRunner.historyView(params);
}
goNext() : void {
let offset = this.offset.get();
offset += HistoryPageSize;
- let params = this._getSearchParams(offset);
+ let params = this._getSearchParams(offset, (this.nextRawOffset ?? 0));
GlobalCommandRunner.historyView(params);
}
@@ -2007,12 +2030,11 @@ class HistoryViewModel {
mobx.action(() => {
this.hasMore.set(false);
this.items.replace([]);
- this.offset.set(0);
this.activeSearchText = this.searchText.get();
this.historyItemLines = [];
this.historyItemCmds = [];
})();
- GlobalCommandRunner.historyView(this._getSearchParams());
+ GlobalCommandRunner.historyView(this._getSearchParams(0, 0));
}
handleDocKeyDown(e : any) : void {
@@ -2029,6 +2051,8 @@ class HistoryViewModel {
this.hasMore.set(data.hasmore);
this.items.replace(data.items || []);
this.offset.set(data.offset);
+ this.nextRawOffset = data.nextrawoffset;
+ this.curRawOffset = data.rawoffset;
this.historyItemLines = (data.lines ?? []);
this.historyItemCmds = (data.cmds ?? []);
this.selectedItems.clear();
@@ -3336,6 +3360,9 @@ class CommandRunner {
if (params.noMeta) {
kwargs["meta"] = "0";
}
+ if (params.filterCmds) {
+ kwargs["filter"] = "1";
+ }
GlobalModel.submitCommand("history", "viewall", null, kwargs, true);
}
diff --git a/src/sh2.less b/src/sh2.less
index 23270ab2..7950eba5 100644
--- a/src/sh2.less
+++ b/src/sh2.less
@@ -226,8 +226,15 @@ body::-webkit-scrollbar {
flex-grow: 1;
margin-top: 5px;
margin-left: 15px;
- .field {
- width: 80%;
+
+ .main-search {
+ .field {
+ width: 80%;
+ }
+
+ input::placeholder {
+ color: #777;
+ }
}
.advanced-search {
@@ -254,7 +261,7 @@ body::-webkit-scrollbar {
margin-left: 15px;
}
- .allow-meta {
+ .search-checkbox {
margin-left: 15px;
border: 1px solid #777;
padding: 5px 10px 5px 10px;
@@ -272,7 +279,7 @@ body::-webkit-scrollbar {
top: 2px;
}
- .meta-text {
+ .checkbox-text {
padding-left: 8px;
cursor: pointer;
}
diff --git a/src/types.ts b/src/types.ts
index 4c3b837e..1c5cbc04 100644
--- a/src/types.ts
+++ b/src/types.ts
@@ -293,6 +293,7 @@ type ModelUpdateType = {
type HistoryViewDataType = {
items : HistoryItem[],
offset : number,
+ rawoffset : number,
nextrawoffset : number,
hasmore : boolean,
lines : LineType[],
@@ -436,6 +437,7 @@ type HistorySearchParams = {
searchRemoteId? : string,
fromTs? : number,
noMeta? : boolean,
+ filterCmds? : boolean,
};
type RenderModeType = "normal" | "collapsed";