From d8e2ab9e71676574673d133e9a1ecf3e58238fde Mon Sep 17 00:00:00 2001
From: shamoon <4887959+shamoon@users.noreply.github.com>
Date: Mon, 20 Apr 2026 14:00:36 -0700
Subject: [PATCH] Add a reset filters
---
.../admin/tasks/tasks.component.html | 5 +++++
.../admin/tasks/tasks.component.spec.ts | 18 ++++++++++++++++++
.../components/admin/tasks/tasks.component.ts | 17 +++++++++++++++++
3 files changed, 40 insertions(+)
diff --git a/src-ui/src/app/components/admin/tasks/tasks.component.html b/src-ui/src/app/components/admin/tasks/tasks.component.html
index 6c3ebcaa6..5529d600a 100644
--- a/src-ui/src/app/components/admin/tasks/tasks.component.html
+++ b/src-ui/src/app/components/admin/tasks/tasks.component.html
@@ -5,6 +5,11 @@
i18n-info
>
+ @if (isFiltered) {
+
+ }
diff --git a/src-ui/src/app/components/admin/tasks/tasks.component.spec.ts b/src-ui/src/app/components/admin/tasks/tasks.component.spec.ts
index 0b7101144..c09b54378 100644
--- a/src-ui/src/app/components/admin/tasks/tasks.component.spec.ts
+++ b/src-ui/src/app/components/admin/tasks/tasks.component.spec.ts
@@ -249,6 +249,24 @@ describe('TasksComponent', () => {
).toBe(PaperlessTaskTriggerSource.EmailConsume)
})
+ it('should reset all active filters together', () => {
+ component.setSection(TaskSection.InProgress)
+ component.setTaskType(PaperlessTaskType.SanityCheck)
+ component.setTriggerSource(PaperlessTaskTriggerSource.System)
+ component.filterText = 'system'
+ jest.advanceTimersByTime(150)
+
+ expect(component.isFiltered).toBe(true)
+
+ component.resetFilters()
+
+ expect(component.selectedSection).toBe(ALL_TASK_SECTIONS)
+ expect(component.selectedTaskType).toBe(ALL_FILTER_VALUE)
+ expect(component.selectedTriggerSource).toBe(ALL_FILTER_VALUE)
+ expect(component.filterText).toBe('')
+ expect(component.isFiltered).toBe(false)
+ })
+
it('should expose stable task type options and disable empty ones', () => {
expect(component.taskTypeOptions.map((option) => option.value)).toContain(
PaperlessTaskType.TrainClassifier
diff --git a/src-ui/src/app/components/admin/tasks/tasks.component.ts b/src-ui/src/app/components/admin/tasks/tasks.component.ts
index 5d30993bd..14ecb1c17 100644
--- a/src-ui/src/app/components/admin/tasks/tasks.component.ts
+++ b/src-ui/src/app/components/admin/tasks/tasks.component.ts
@@ -215,6 +215,15 @@ export class TasksComponent
)
}
+ get isFiltered(): boolean {
+ return (
+ this.selectedSection !== ALL_TASK_SECTIONS ||
+ this.selectedTaskType !== ALL_FILTER_VALUE ||
+ this.selectedTriggerSource !== ALL_FILTER_VALUE ||
+ this._filterText.length > 0
+ )
+ }
+
ngOnInit() {
this.tasksService.reload()
timer(5000, 5000)
@@ -431,6 +440,14 @@ export class TasksComponent
this._filterText = ''
}
+ public resetFilters() {
+ this.selectedSection = ALL_TASK_SECTIONS
+ this.selectedTaskType = ALL_FILTER_VALUE
+ this.selectedTriggerSource = ALL_FILTER_VALUE
+ this.resetFilter()
+ this.clearSelection()
+ }
+
filterInputKeyup(event: KeyboardEvent) {
if (event.key == 'Enter') {
this._filterText = (event.target as HTMLInputElement).value