From ce3c4e08550877110afd738879cae4c22a5fc92c Mon Sep 17 00:00:00 2001 From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Sat, 14 Nov 2026 08:56:55 -0800 Subject: [PATCH] Yay make the task list useful --- .../admin/tasks/tasks.component.html | 13 +++++++------ .../admin/tasks/tasks.component.spec.ts | 18 +++++++++++++----- .../components/admin/tasks/tasks.component.ts | 13 ++++++++----- 3 files changed, 28 insertions(+), 16 deletions(-) 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 cd2089c88b..b5322b89c4 100644 --- a/src-ui/src/app/components/admin/tasks/tasks.component.html +++ b/src-ui/src/app/components/admin/tasks/tasks.component.html @@ -175,16 +175,17 @@ -
{{ taskDisplayName(task) }}
+ @let documentCount = taskDocumentCount(task); +
+ {{ taskDisplayName(task) }} + @if (documentCount !== null && documentCount > 1) { + ({documentCount, plural, =1 {1 document} other {{{ documentCount }} documents}}) + } +
@if (taskShowsSeparateTypeLabel(task)) { {{ task.task_type_display }} } - @let documentCount = taskDocumentCount(task); - @if (documentCount !== null) { - {documentCount, plural, =1 {1 document} other {{{ documentCount }} documents}} - - } {{ task.trigger_source_display }}
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 fd4ede26c5..906ce93f28 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 @@ -896,9 +896,9 @@ describe('TasksComponent', () => { }) it.each([ - ['modify_tags', 12, 'Update tags', '12 documents'], - ['run_workflow', 1, 'Run workflow', '1 document'], - ['delete', 3, 'Move to trash', '3 documents'], + ['modify_tags', 12, 'Bulk operation: Update tags', '(12 documents)'], + ['run_workflow', 1, 'Run workflow', null], + ['delete', 3, 'Bulk operation: Move to trash', '(3 documents)'], ])( 'shows the operation, document count and outcome for %s', (operation, count, label, summary) => { @@ -921,7 +921,14 @@ describe('TasksComponent', () => { const name = fixture.nativeElement.querySelector('tbody .name-col') expect(name.textContent).toContain(label) - expect(name.textContent).toContain(summary) + const countLabel = name.querySelector('small.text-muted') + if (summary) { + expect(countLabel.textContent).toContain(summary) + } else { + expect(countLabel).toBeNull() + expect(name.textContent).not.toContain('Bulk operation:') + } + expect(name.textContent).not.toContain('ยท') expect(name.textContent).toContain('Web UI') expect(name.textContent).not.toContain(task.task_type_display) expect( @@ -943,7 +950,8 @@ describe('TasksComponent', () => { const name = fixture.nativeElement.querySelector('tbody .name-col') expect(name.textContent).toContain('Document reprocessing') - expect(name.textContent).toContain('1 document') + expect(name.textContent).not.toContain('Bulk operation:') + expect(name.querySelector('small')).toBeNull() expect(component.taskResultMessage(task)).toBeNull() }) 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 568ce5daef..730b7d8f50 100644 --- a/src-ui/src/app/components/admin/tasks/tasks.component.ts +++ b/src-ui/src/app/components/admin/tasks/tasks.component.ts @@ -435,11 +435,14 @@ export class TasksComponent } taskDisplayName(task: PaperlessTask): string { - return ( - task.input_data?.filename?.toString() || - this.taskOperationLabel(task) || - task.task_type_display - ) + const filename = task.input_data?.filename?.toString() + if (filename) return filename + const operation = this.taskOperationLabel(task) + const count = this.taskDocumentCount(task) + if (operation && count !== null && count > 1) { + return $localize`Bulk operation: ${operation}` + } + return operation || task.task_type_display } taskShowsSeparateTypeLabel(task: PaperlessTask): boolean {