Skip to content

Commit 33afa53

Browse files
committed
feat: allow filtering based on batch title
1 parent c0d4d96 commit 33afa53

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/module/apps/quench-results.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ export class QuenchResults extends HandlebarsApplicationMixin(ApplicationV2)<Que
182182
* @internal
183183
* @param event - The click event
184184
*/
185-
static async _onExpander(event: Event, target: HTMLElement) {
185+
static async _onExpander(this: QuenchResults, event: Event, target: HTMLElement) {
186186
const expander = target;
187187
if (!expander.matches(".expander")) return;
188188
event.preventDefault();
@@ -298,8 +298,18 @@ export class QuenchResults extends HandlebarsApplicationMixin(ApplicationV2)<Que
298298
};
299299

300300
for (const batchLi of html?.children ?? []) {
301+
const batchLabel = batchLi.querySelector(".test-batch > label")?.textContent;
302+
const batchMatchesQuery = batchLabel
303+
? rgx.test(SearchFilter.cleanQuery(batchLabel))
304+
: undefined;
305+
let batchHasQuery = batchMatchesQuery || false;
301306
for (const element of batchLi.querySelector(".runnable-list")?.children ?? []) {
302-
checkElement(element as HTMLElement);
307+
batchHasQuery = checkElement(element as HTMLElement, batchMatchesQuery) || batchHasQuery;
308+
}
309+
if (!batchHasQuery) {
310+
batchLi.classList.add("disabled", "filtered");
311+
} else {
312+
batchLi.classList.remove("disabled", "filtered");
303313
}
304314
}
305315
}

0 commit comments

Comments
 (0)