Skip to content

Commit 06a894f

Browse files
committed
Add a 'pinned' filter
1 parent b5df6a3 commit 06a894f

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

src/model/filters/search-filters.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,25 @@ class ErrorFilter extends Filter {
392392
}
393393
}
394394

395+
class PinnedFilter extends Filter {
396+
397+
static filterSyntax = [new FixedStringSyntax("pinned")] as const;
398+
399+
static filterName = "pinned";
400+
401+
static filterDescription(value: string) {
402+
return "exchanges that are pinned";
403+
}
404+
405+
matches(event: CollectedEvent): boolean {
406+
return event.pinned;
407+
}
408+
409+
toString() {
410+
return `Pinned`;
411+
}
412+
}
413+
395414
class CategoryFilter extends Filter {
396415

397416
static filterSyntax = [
@@ -1151,6 +1170,7 @@ const BaseSearchFilterClasses: FilterClass[] = [
11511170
PendingFilter,
11521171
AbortedFilter,
11531172
ErrorFilter,
1173+
PinnedFilter,
11541174
CategoryFilter,
11551175
PortFilter,
11561176
ProtocolFilter,

test/unit/model/filters/search-filter-integration.spec.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ describe("Search filter model integration test:", () => {
7171
{ index: 0, showAs: "pending" },
7272
{ index: 0, showAs: "aborted" },
7373
{ index: 0, showAs: "errored" },
74+
{ index: 0, showAs: "pinned" },
7475
{ index: 0, showAs: "category" },
7576
{ index: 0, showAs: "port" },
7677
{ index: 0, showAs: "protocol" },
@@ -99,6 +100,7 @@ describe("Search filter model integration test:", () => {
99100
"requests that are still waiting for a response",
100101
"requests that aborted before receiving a response",
101102
"requests that weren't transmitted successfully",
103+
"exchanges that are pinned",
102104
"exchanges by their general category",
103105
"requests sent to a given port",
104106
"exchanges using HTTP, HTTPS, WS or WSS",
@@ -1155,6 +1157,7 @@ describe("Search filter model integration test:", () => {
11551157
{ index: 3, showAs: "pending" },
11561158
{ index: 3, showAs: "aborted" },
11571159
{ index: 3, showAs: "errored" },
1160+
{ index: 3, showAs: "pinned" },
11581161
{ index: 3, showAs: "category" },
11591162
{ index: 3, showAs: "port" },
11601163
{ index: 3, showAs: "protocol" },
@@ -1207,6 +1210,7 @@ describe("Search filter model integration test:", () => {
12071210
{ index: 14, showAs: "pending)" },
12081211
{ index: 14, showAs: "aborted)" },
12091212
{ index: 14, showAs: "errored)" },
1213+
{ index: 14, showAs: "pinned)" },
12101214
{ index: 14, showAs: "category" },
12111215
{ index: 14, showAs: "port" },
12121216
{ index: 14, showAs: "protocol" },
@@ -1335,6 +1339,7 @@ describe("Search filter model integration test:", () => {
13351339
{ index: 4, showAs: "pending)" },
13361340
{ index: 4, showAs: "aborted)" },
13371341
{ index: 4, showAs: "errored)" },
1342+
{ index: 4, showAs: "pinned)" },
13381343
{ index: 4, showAs: "category" },
13391344
{ index: 4, showAs: "port" },
13401345
{ index: 4, showAs: "protocol" },

0 commit comments

Comments
 (0)