diff --git a/docs/api.md b/docs/api.md index 8a440545ff..a03357e4eb 100644 --- a/docs/api.md +++ b/docs/api.md @@ -285,6 +285,12 @@ The API supports various bulk-editing operations which are executed asynchronous ### Documents +Document bulk operations, including the dedicated document action endpoints, return +`{"result":"OK","task_id":"…"}` when queued. Use `/api/tasks/?task_id={uuid}` +to check the task outcome. Actions that create or reprocess files may start further +consumption or reprocessing tasks and completion of the bulk task means those tasks +were scheduled, not that their file processing has finished. + For bulk operations on documents, use the endpoint `/api/documents/bulk_edit/` which accepts a json payload of the format: diff --git a/docs/changelog.md b/docs/changelog.md index b2b45bc1e4..fb112dcd61 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -1,5 +1,97 @@ # Changelog +## paperless-ngx 3.5.0 + +### Features / Enhancements + +- Chorehancement: move all bulk operations to async hand-off [@shamoon](https://github.com/shamoon) ([#14773](https://github.com/paperless-ngx/paperless-ngx/pull/14773)) +- Enhancement: render document notes as markdown [@zwif](https://github.com/zwif) ([#14626](https://github.com/paperless-ngx/paperless-ngx/pull/14626)) +- Feature: manual workflow trigger [@shamoon](https://github.com/shamoon) ([#14704](https://github.com/paperless-ngx/paperless-ngx/pull/14704)) +- Enhancement: make bulk metadata operations run async [@shamoon](https://github.com/shamoon) ([#14711](https://github.com/paperless-ngx/paperless-ngx/pull/14711)) +- Fixhancement: add automatic clearing of sessions [@shamoon](https://github.com/shamoon) ([#14722](https://github.com/paperless-ngx/paperless-ngx/pull/14722)) +- Tweak: chat reference tweaks [@shamoon](https://github.com/shamoon) ([#14723](https://github.com/paperless-ngx/paperless-ngx/pull/14723)) +- Fixhancement: rework saved view widget queue processing to expected [@shamoon](https://github.com/shamoon) ([#14699](https://github.com/paperless-ngx/paperless-ngx/pull/14699)) + +### Bug Fixes + +- Fix: use a constant password mask and consolidate the no-change check [@stumpylog](https://github.com/stumpylog) ([#14784](https://github.com/paperless-ngx/paperless-ngx/pull/14784)) +- Fix: use a PostgreSQL-compatible regex for scheduled workflow filename filters [@stumpylog](https://github.com/stumpylog) ([#14783](https://github.com/paperless-ngx/paperless-ngx/pull/14783)) +- Fix: get users for saved view create dialog [@shamoon](https://github.com/shamoon) ([#14769](https://github.com/paperless-ngx/paperless-ngx/pull/14769)) +- Fix: Allow AI chat filters over more than 32700 documents [@stumpylog](https://github.com/stumpylog) ([#14754](https://github.com/paperless-ngx/paperless-ngx/pull/14754)) +- Fix: Enforce CRLF when writing an email message to the file [@stumpylog](https://github.com/stumpylog) ([#14745](https://github.com/paperless-ngx/paperless-ngx/pull/14745)) +- Fix: restore image without archive version thumbnail generation [@shamoon](https://github.com/shamoon) ([#14741](https://github.com/paperless-ngx/paperless-ngx/pull/14741)) +- Fix: Blacklist certain OCR user arguments that paperless itself uses [@stumpylog](https://github.com/stumpylog) ([#14734](https://github.com/paperless-ngx/paperless-ngx/pull/14734)) +- Fix: remove redundant ui task text filters [@shamoon](https://github.com/shamoon) ([#14736](https://github.com/paperless-ngx/paperless-ngx/pull/14736)) +- Fix: fix allowed\_hosts default [@shamoon](https://github.com/shamoon) ([#14735](https://github.com/paperless-ngx/paperless-ngx/pull/14735)) +- Fixhancement: add automatic clearing of sessions [@shamoon](https://github.com/shamoon) ([#14722](https://github.com/paperless-ngx/paperless-ngx/pull/14722)) +- Fix: two dropdown-related UI fixes [@shamoon](https://github.com/shamoon) ([#14717](https://github.com/paperless-ngx/paperless-ngx/pull/14717)) +- Fix: use filtered documents for statistics ASN max [@shamoon](https://github.com/shamoon) ([#14710](https://github.com/paperless-ngx/paperless-ngx/pull/14710)) +- Fix: make config view permissions consistent [@shamoon](https://github.com/shamoon) ([#14709](https://github.com/paperless-ngx/paperless-ngx/pull/14709)) +- Fix: release the LLM index read lock before streaming the chat answer [@stumpylog](https://github.com/stumpylog) ([#14674](https://github.com/paperless-ngx/paperless-ngx/pull/14674)) +- Fix: retrieve once per document chat question [@stumpylog](https://github.com/stumpylog) ([#14673](https://github.com/paperless-ngx/paperless-ngx/pull/14673)) +- Fixhancement: rework saved view widget queue processing to expected [@shamoon](https://github.com/shamoon) ([#14699](https://github.com/paperless-ngx/paperless-ngx/pull/14699)) +- Fix: apply PDF/A conversion once for mail archives [@shamoon](https://github.com/shamoon) ([#14698](https://github.com/paperless-ngx/paperless-ngx/pull/14698)) +- Fix default MFA trusted AMR setting [@shamoon](https://github.com/shamoon) ([#14693](https://github.com/paperless-ngx/paperless-ngx/pull/14693)) +- Fix: check descendant tag permissions on delete [@shamoon](https://github.com/shamoon) ([#14687](https://github.com/paperless-ngx/paperless-ngx/pull/14687)) +- Fix: lock rows for first-user signup [@shamoon](https://github.com/shamoon) ([#14688](https://github.com/paperless-ngx/paperless-ngx/pull/14688)) +- Fix: prevent ID badge wrapping under title on mobile [@shamoon](https://github.com/shamoon) ([#14682](https://github.com/paperless-ngx/paperless-ngx/pull/14682)) + +### Maintenance + +- Chore(deps): Bump the actions group across 1 directory with 17 updates @[dependabot[bot]](https://github.com/apps/dependabot) ([#14691](https://github.com/paperless-ngx/paperless-ngx/pull/14691)) + +### Dependencies + +
+4 changes + +- Chore(deps): Bump the pre-commit-dependencies group with 4 updates @[dependabot[bot]](https://github.com/apps/dependabot) ([#14636](https://github.com/paperless-ngx/paperless-ngx/pull/14636)) +- Chore(deps): Bump the actions group across 1 directory with 17 updates @[dependabot[bot]](https://github.com/apps/dependabot) ([#14691](https://github.com/paperless-ngx/paperless-ngx/pull/14691)) +- docker(deps): bump astral-sh/uv from 0.13.5-python3.14-trixie-slim to 0.13.7-python3.14-trixie-slim @[dependabot[bot]](https://github.com/apps/dependabot) ([#14635](https://github.com/paperless-ngx/paperless-ngx/pull/14635)) +- chore(deps): bump django-allauth to 65.21.1 [@stumpylog](https://github.com/stumpylog) ([#14672](https://github.com/paperless-ngx/paperless-ngx/pull/14672)) + +
+ +### All App Changes + +
+32 changes + +- Chorehancement: move all bulk operations to async hand-off [@shamoon](https://github.com/shamoon) ([#14773](https://github.com/paperless-ngx/paperless-ngx/pull/14773)) +- Fix: use a constant password mask and consolidate the no-change check [@stumpylog](https://github.com/stumpylog) ([#14784](https://github.com/paperless-ngx/paperless-ngx/pull/14784)) +- Fix: use a PostgreSQL-compatible regex for scheduled workflow filename filters [@stumpylog](https://github.com/stumpylog) ([#14783](https://github.com/paperless-ngx/paperless-ngx/pull/14783)) +- Fix: get users for saved view create dialog [@shamoon](https://github.com/shamoon) ([#14769](https://github.com/paperless-ngx/paperless-ngx/pull/14769)) +- Enhancement: render document notes as markdown [@zwif](https://github.com/zwif) ([#14626](https://github.com/paperless-ngx/paperless-ngx/pull/14626)) +- Feature: manual workflow trigger [@shamoon](https://github.com/shamoon) ([#14704](https://github.com/paperless-ngx/paperless-ngx/pull/14704)) +- Fix: Allow AI chat filters over more than 32700 documents [@stumpylog](https://github.com/stumpylog) ([#14754](https://github.com/paperless-ngx/paperless-ngx/pull/14754)) +- Fix: Enforce CRLF when writing an email message to the file [@stumpylog](https://github.com/stumpylog) ([#14745](https://github.com/paperless-ngx/paperless-ngx/pull/14745)) +- Enhancement: make bulk metadata operations run async [@shamoon](https://github.com/shamoon) ([#14711](https://github.com/paperless-ngx/paperless-ngx/pull/14711)) +- Performance: load a cached Hugging Face embedding model without contacting the Hub [@stumpylog](https://github.com/stumpylog) ([#14728](https://github.com/paperless-ngx/paperless-ngx/pull/14728)) +- Fix: restore image without archive version thumbnail generation [@shamoon](https://github.com/shamoon) ([#14741](https://github.com/paperless-ngx/paperless-ngx/pull/14741)) +- Fix: Blacklist certain OCR user arguments that paperless itself uses [@stumpylog](https://github.com/stumpylog) ([#14734](https://github.com/paperless-ngx/paperless-ngx/pull/14734)) +- Fix: remove redundant ui task text filters [@shamoon](https://github.com/shamoon) ([#14736](https://github.com/paperless-ngx/paperless-ngx/pull/14736)) +- Fix: fix allowed\_hosts default [@shamoon](https://github.com/shamoon) ([#14735](https://github.com/paperless-ngx/paperless-ngx/pull/14735)) +- Fixhancement: add automatic clearing of sessions [@shamoon](https://github.com/shamoon) ([#14722](https://github.com/paperless-ngx/paperless-ngx/pull/14722)) +- Tweak: chat reference tweaks [@shamoon](https://github.com/shamoon) ([#14723](https://github.com/paperless-ngx/paperless-ngx/pull/14723)) +- Fix: two dropdown-related UI fixes [@shamoon](https://github.com/shamoon) ([#14717](https://github.com/paperless-ngx/paperless-ngx/pull/14717)) +- Fix: use filtered documents for statistics ASN max [@shamoon](https://github.com/shamoon) ([#14710](https://github.com/paperless-ngx/paperless-ngx/pull/14710)) +- Fix: make config view permissions consistent [@shamoon](https://github.com/shamoon) ([#14709](https://github.com/paperless-ngx/paperless-ngx/pull/14709)) +- Performance: stop embedding every document ID in selection\_data queries [@stumpylog](https://github.com/stumpylog) ([#14597](https://github.com/paperless-ngx/paperless-ngx/pull/14597)) +- Performance: replace django-treenode with adjacency-list tags [@shamoon](https://github.com/shamoon) ([#14612](https://github.com/paperless-ngx/paperless-ngx/pull/14612)) +- Performance: use small vec0 chunks and larger pages for the LLM index [@stumpylog](https://github.com/stumpylog) ([#14678](https://github.com/paperless-ngx/paperless-ngx/pull/14678)) +- Fix: release the LLM index read lock before streaming the chat answer [@stumpylog](https://github.com/stumpylog) ([#14674](https://github.com/paperless-ngx/paperless-ngx/pull/14674)) +- Fix: retrieve once per document chat question [@stumpylog](https://github.com/stumpylog) ([#14673](https://github.com/paperless-ngx/paperless-ngx/pull/14673)) +- Fixhancement: rework saved view widget queue processing to expected [@shamoon](https://github.com/shamoon) ([#14699](https://github.com/paperless-ngx/paperless-ngx/pull/14699)) +- Fix: apply PDF/A conversion once for mail archives [@shamoon](https://github.com/shamoon) ([#14698](https://github.com/paperless-ngx/paperless-ngx/pull/14698)) +- Fix default MFA trusted AMR setting [@shamoon](https://github.com/shamoon) ([#14693](https://github.com/paperless-ngx/paperless-ngx/pull/14693)) +- Fix: check descendant tag permissions on delete [@shamoon](https://github.com/shamoon) ([#14687](https://github.com/paperless-ngx/paperless-ngx/pull/14687)) +- Fix: lock rows for first-user signup [@shamoon](https://github.com/shamoon) ([#14688](https://github.com/paperless-ngx/paperless-ngx/pull/14688)) +- Fix: prevent ID badge wrapping under title on mobile [@shamoon](https://github.com/shamoon) ([#14682](https://github.com/paperless-ngx/paperless-ngx/pull/14682)) +- chore(deps): bump django-allauth to 65.21.1 [@stumpylog](https://github.com/stumpylog) ([#14672](https://github.com/paperless-ngx/paperless-ngx/pull/14672)) +- chore(deps): bump dev tooling [@stumpylog](https://github.com/stumpylog) ([#14671](https://github.com/paperless-ngx/paperless-ngx/pull/14671)) + +
+ ## paperless-ngx 3.4.2 ### Bug Fixes diff --git a/docs/usage.md b/docs/usage.md index fd4fa22da8..bb6eea22ae 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -587,9 +587,10 @@ documents from the web UI: - From the document list, select one or more documents and choose **Run workflow** from the "Actions" menu. - From an individual document, choose **Run workflow** from the "Actions" menu. -You will be asked which workflow to run. By default the workflow's trigger filters still apply, so documents that do -not match are skipped. You can instead choose to **run on all selected documents**, which ignores the trigger filters -and runs the workflow's actions on every selected document. +You will be asked which workflow to run. From the document list, the workflow's trigger filters apply by default, so +documents that do not match are skipped. You can choose to **run on all selected documents** to ignore the filters. +From an individual document, the option to ignore trigger filters is selected by default. Clear it to run the workflow +only if the document matches its trigger filters. Manual runs happen in the background. As with scheduled workflows, the document list is not refreshed automatically when they finish, so you may need to reload the list to see the results. diff --git a/pyproject.toml b/pyproject.toml index cef735f65a..ecb0c74f13 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "paperless-ngx" -version = "3.4.2" +version = "3.5.0" description = """\ A community-supported supercharged document management system: scan, index and archive all your physical documents\ """ @@ -151,8 +151,9 @@ typing = [ required-version = ">=0.9.0" prerelease = "disallow" environments = [ - "sys_platform == 'darwin'", - "sys_platform == 'linux'", + "sys_platform == 'darwin' and platform_machine == 'arm64' and platform_python_implementation == 'CPython'", + "sys_platform == 'linux' and platform_machine == 'aarch64' and platform_python_implementation == 'CPython'", + "sys_platform == 'linux' and platform_machine == 'x86_64' and platform_python_implementation == 'CPython'", ] package = false [tool.uv.sources] diff --git a/src-ui/messages.xlf b/src-ui/messages.xlf index a6f38b976e..3b76c91ef1 100644 --- a/src-ui/messages.xlf +++ b/src-ui/messages.xlf @@ -1366,7 +1366,7 @@ src/app/components/document-detail/document-detail.component.ts - 1971 + 1981 @@ -1940,6 +1940,10 @@ src/app/components/common/permissions-dialog/permissions-dialog.component.ts 45 + + src/app/components/document-list/save-view-config-dialog/save-view-config-dialog.component.ts + 59 + Error retrieving groups @@ -1989,15 +1993,15 @@ src/app/components/app-frame/app-frame.component.ts - 260 + 255 src/app/components/app-frame/app-frame.component.ts - 378 + 373 src/app/components/app-frame/app-frame.component.ts - 407 + 402 @@ -2052,7 +2056,7 @@ src/app/components/admin/tasks/tasks.component.ts - 60 + 64 src/app/components/common/custom-fields-query-dropdown/custom-fields-query-dropdown.component.html @@ -2098,7 +2102,7 @@ src/app/components/admin/tasks/tasks.component.ts - 227 + 231 @@ -2109,7 +2113,7 @@ src/app/components/admin/tasks/tasks.component.ts - 239 + 243 @@ -2178,7 +2182,7 @@ src/app/components/admin/tasks/tasks.component.ts - 54 + 58 src/app/components/admin/trash/trash.component.html @@ -2449,37 +2453,51 @@ 50 + + () + + src/app/components/admin/tasks/tasks.component.html + 182,184 + + + + {VAR_PLURAL, plural, =1 {1 document} other { documents}} + + src/app/components/admin/tasks/tasks.component.html + 182 + + click for full output src/app/components/admin/tasks/tasks.component.html - 209 + 215 View task details src/app/components/admin/tasks/tasks.component.html - 215 + 221 Dismiss src/app/components/admin/tasks/tasks.component.html - 222 + 228 src/app/components/admin/tasks/tasks.component.ts - 340 + 344 src/app/components/admin/tasks/tasks.component.ts - 374 + 378 src/app/components/document-detail/document-detail.component.ts - 721 + 723 src/app/components/document-detail/document-version-dropdown/document-version-dropdown.component.html @@ -2490,28 +2508,28 @@ Open Document src/app/components/admin/tasks/tasks.component.html - 227 + 233 Result message src/app/components/admin/tasks/tasks.component.html - 240,241 + 246,247 Duplicate src/app/components/admin/tasks/tasks.component.html - 247,248 + 253,254 Open src/app/components/admin/tasks/tasks.component.html - 255 + 261 src/app/components/app-frame/global-search/global-search.component.html @@ -2542,84 +2560,84 @@ Input data src/app/components/admin/tasks/tasks.component.html - 265,266 + 271,272 Result data src/app/components/admin/tasks/tasks.component.html - 271,272 + 277,278 No tasks match the current filters. src/app/components/admin/tasks/tasks.component.html - 293,295 + 299,301 Result src/app/components/admin/tasks/tasks.component.ts - 55 + 59 Task ID src/app/components/admin/tasks/tasks.component.ts - 56 + 60 Needs attention src/app/components/admin/tasks/tasks.component.ts - 61 + 65 In progress src/app/components/admin/tasks/tasks.component.ts - 62 + 66 Recently completed src/app/components/admin/tasks/tasks.component.ts - 63 + 67 Consume File src/app/components/admin/tasks/tasks.component.ts - 72 + 76 Train Classifier src/app/components/admin/tasks/tasks.component.ts - 76 + 80 Sanity Check src/app/components/admin/tasks/tasks.component.ts - 80 + 84 Mail Fetch src/app/components/admin/tasks/tasks.component.ts - 82 + 86 src/app/components/common/edit-dialog/workflow-edit-dialog/workflow-edit-dialog.component.ts @@ -2630,63 +2648,63 @@ LLM Index src/app/components/admin/tasks/tasks.component.ts - 83 + 87 Empty Trash src/app/components/admin/tasks/tasks.component.ts - 86 + 90 Check Workflows src/app/components/admin/tasks/tasks.component.ts - 90 + 94 Bulk Update src/app/components/admin/tasks/tasks.component.ts - 94 + 98 Reprocess Document src/app/components/admin/tasks/tasks.component.ts - 98 + 102 Build Share Link src/app/components/admin/tasks/tasks.component.ts - 102 + 106 Bulk Delete src/app/components/admin/tasks/tasks.component.ts - 106 + 110 Apply AI Suggestions src/app/components/admin/tasks/tasks.component.ts - 110 + 114 Scheduled src/app/components/admin/tasks/tasks.component.ts - 120 + 124 src/app/components/common/edit-dialog/workflow-edit-dialog/workflow-edit-dialog.component.ts @@ -2697,7 +2715,7 @@ Web UI src/app/components/admin/tasks/tasks.component.ts - 122 + 126 src/app/components/common/edit-dialog/workflow-edit-dialog/workflow-edit-dialog.component.ts @@ -2708,7 +2726,7 @@ API Upload src/app/components/admin/tasks/tasks.component.ts - 125 + 129 src/app/components/common/edit-dialog/workflow-edit-dialog/workflow-edit-dialog.component.ts @@ -2719,28 +2737,28 @@ Folder Consume src/app/components/admin/tasks/tasks.component.ts - 129 + 133 Email Consume src/app/components/admin/tasks/tasks.component.ts - 133 + 137 System src/app/components/admin/tasks/tasks.component.ts - 135 + 139 Manual src/app/components/admin/tasks/tasks.component.ts - 136 + 140 src/app/components/common/edit-dialog/workflow-edit-dialog/workflow-edit-dialog.component.ts @@ -2751,78 +2769,99 @@ Dismiss selected src/app/components/admin/tasks/tasks.component.ts - 251 + 255 Dismiss visible src/app/components/admin/tasks/tasks.component.ts - 252 + 256 Confirm Dismiss src/app/components/admin/tasks/tasks.component.ts - 337 + 341 Dismiss tasks? src/app/components/admin/tasks/tasks.component.ts - 338 + 342 Error dismissing tasks src/app/components/admin/tasks/tasks.component.ts - 349 + 353 src/app/components/admin/tasks/tasks.component.ts - 383 + 387 Error dismissing task src/app/components/admin/tasks/tasks.component.ts - 361 + 365 Confirm Dismiss All src/app/components/admin/tasks/tasks.component.ts - 371 + 375 Dismiss all tasks? src/app/components/admin/tasks/tasks.component.ts - 372 + 376 + + + + Bulk operation: + + src/app/components/admin/tasks/tasks.component.ts + 426 Success. New document id created src/app/components/admin/tasks/tasks.component.ts - 431 + 454 Duplicate of document # src/app/components/admin/tasks/tasks.component.ts - 441 + 464 src/app/components/admin/tasks/tasks.component.ts - 475 + 507 + + + + Submitted for processing + + src/app/components/admin/tasks/tasks.component.ts + 477 + + + + Completed + + src/app/components/admin/tasks/tasks.component.ts + 478 @@ -3180,7 +3219,7 @@ src/app/services/trash.service.ts - 60 + 87 @@ -3191,7 +3230,7 @@ src/app/services/trash.service.ts - 67 + 94 @@ -3282,6 +3321,10 @@ src/app/components/common/input/permissions/permissions-form/permissions-form.component.html 55,56 + + src/app/components/document-notes/document-notes.component.html + 25,26 + src/app/components/manage/document-attributes/custom-fields/custom-fields.component.html 31,32 @@ -3412,27 +3455,27 @@ src/app/components/document-detail/document-detail.component.ts - 1552 + 1554 src/app/components/document-detail/document-detail.component.ts - 1972 + 1982 src/app/components/document-list/bulk-editor/bulk-editor.component.ts - 1019 + 1012 src/app/components/document-list/bulk-editor/bulk-editor.component.ts - 1058 + 1052 src/app/components/document-list/bulk-editor/bulk-editor.component.ts - 1081 + 1076 src/app/components/document-list/bulk-editor/bulk-editor.component.ts - 1117 + 1109 src/app/components/manage/document-attributes/custom-fields/custom-fields.component.ts @@ -3775,46 +3818,25 @@ 418 - - Bulk operation completed. - - src/app/components/app-frame/app-frame.component.ts - 202 - - - - Bulk operation revoked. - - src/app/components/app-frame/app-frame.component.ts - 204 - - - - Bulk operation failed. Some changes may already have been applied. - - src/app/components/app-frame/app-frame.component.ts - 207 - - Sidebar views updated src/app/components/app-frame/app-frame.component.ts - 543 + 538 Error updating sidebar views src/app/components/app-frame/app-frame.component.ts - 546 + 541 An error occurred while saving update checking settings. src/app/components/app-frame/app-frame.component.ts - 567 + 562 @@ -4129,14 +4151,14 @@ Ask a question about this document... src/app/components/chat/chat/chat.component.ts - 83 + 87 Ask a question about a document... src/app/components/chat/chat/chat.component.ts - 84 + 88 @@ -4191,7 +4213,7 @@ src/app/components/document-detail/document-detail.component.ts - 1501 + 1503 src/app/components/document-list/bulk-editor/bulk-editor.component.ts @@ -4335,7 +4357,7 @@ src/app/components/document-detail/document-detail.component.ts - 2025 + 2036 @@ -4346,7 +4368,7 @@ src/app/components/document-detail/document-detail.component.ts - 2026 + 2037 @@ -4357,7 +4379,7 @@ src/app/components/document-detail/document-detail.component.ts - 2027 + 2038 @@ -4409,18 +4431,32 @@ 13,14 + + Run on this document regardless of trigger filters + + src/app/components/common/confirm-dialog/run-workflow-confirm-dialog/run-workflow-confirm-dialog.component.html + 22,23 + + + + Ignore the workflow's trigger filters for this document. + + src/app/components/common/confirm-dialog/run-workflow-confirm-dialog/run-workflow-confirm-dialog.component.html + 23,24 + + Run on all selected documents src/app/components/common/confirm-dialog/run-workflow-confirm-dialog/run-workflow-confirm-dialog.component.html - 21,22 + 25,26 Ignore the workflow's trigger filters and run on every selected document. src/app/components/common/confirm-dialog/run-workflow-confirm-dialog/run-workflow-confirm-dialog.component.html - 22,23 + 26,27 @@ -5763,6 +5799,10 @@ src/app/components/document-detail/document-detail.component.html 358,359 + + src/app/components/document-notes/document-notes.component.html + 27,28 + Path test failed @@ -6642,12 +6682,16 @@ src/app/components/document-detail/document-detail.component.ts - 1505 + 1507 src/app/components/document-list/bulk-editor/bulk-editor.component.ts 957 + + src/app/utils/document-operation.ts + 10 + Remote OCR @@ -7197,6 +7241,10 @@ src/app/components/common/input/tags/tags.component.html 19 + + src/app/utils/document-operation.ts + 5 + Remove tag @@ -7204,6 +7252,10 @@ src/app/components/common/input/tags/tags.component.html 24 + + src/app/utils/document-operation.ts + 6 + Filter documents with these Tags @@ -7373,6 +7425,10 @@ src/app/components/common/permissions-dialog/permissions-dialog.component.ts 51 + + src/app/utils/document-operation.ts + 9 + Edit permissions for @@ -8744,7 +8800,7 @@ src/app/components/document-detail/document-detail.component.ts - 1586 + 1590 src/app/components/document-list/bulk-editor/bulk-editor.component.html @@ -8752,7 +8808,11 @@ src/app/components/document-list/bulk-editor/bulk-editor.component.ts - 318 + 315 + + + src/app/utils/document-operation.ts + 12 @@ -9039,113 +9099,113 @@ Error retrieving metadata src/app/components/document-detail/document-detail.component.ts - 471 + 473 An error occurred loading content: src/app/components/document-detail/document-detail.component.ts - 574,576 + 576,578 src/app/components/document-detail/document-detail.component.ts - 1069,1071 + 1071,1073 Document was updated src/app/components/document-detail/document-detail.component.ts - 716 + 718 Document was updated at . src/app/components/document-detail/document-detail.component.ts - 717 + 719 Reload to discard your local unsaved edits and load the latest remote version. src/app/components/document-detail/document-detail.component.ts - 718 + 720 Reload src/app/components/document-detail/document-detail.component.ts - 720 + 722 Document reloaded with latest changes. src/app/components/document-detail/document-detail.component.ts - 776 + 778 Document reloaded. src/app/components/document-detail/document-detail.component.ts - 787 + 789 Next document src/app/components/document-detail/document-detail.component.ts - 903 + 905 Previous document src/app/components/document-detail/document-detail.component.ts - 913 + 915 Close document src/app/components/document-detail/document-detail.component.ts - 921 + 923 src/app/services/open-documents.service.ts - 151 + 157 Save document src/app/components/document-detail/document-detail.component.ts - 928 + 930 Save and close / next src/app/components/document-detail/document-detail.component.ts - 937 + 939 Error retrieving version content src/app/components/document-detail/document-detail.component.ts - 1051 + 1053 Unsaved Changes src/app/components/document-detail/document-detail.component.ts - 1095 + 1097 src/app/guards/dirty-form.guard.ts @@ -9157,85 +9217,85 @@ src/app/services/open-documents.service.ts - 143 + 149 src/app/services/open-documents.service.ts - 170 + 176 You have unsaved changes to the content of this version. src/app/components/document-detail/document-detail.component.ts - 1096 + 1098 Switching versions will discard them. src/app/components/document-detail/document-detail.component.ts - 1097 + 1099 Discard and switch src/app/components/document-detail/document-detail.component.ts - 1099 + 1101 Save and switch src/app/components/document-detail/document-detail.component.ts - 1101 + 1103 Error retrieving suggestions. src/app/components/document-detail/document-detail.component.ts - 1144 + 1146 Document "" saved successfully. src/app/components/document-detail/document-detail.component.ts - 1375 + 1377 src/app/components/document-detail/document-detail.component.ts - 1403 + 1405 Error saving document "" src/app/components/document-detail/document-detail.component.ts - 1409 + 1411 Error saving document src/app/components/document-detail/document-detail.component.ts - 1464 + 1466 Do you really want to move the document "" to the trash? src/app/components/document-detail/document-detail.component.ts - 1502 + 1504 Documents can be restored prior to permanent deletion. src/app/components/document-detail/document-detail.component.ts - 1503 + 1505 src/app/components/document-list/bulk-editor/bulk-editor.component.ts @@ -9246,156 +9306,184 @@ Moved "" to the trash src/app/components/document-detail/document-detail.component.ts - 1521 + 1523 Error deleting document src/app/components/document-detail/document-detail.component.ts - 1528 + 1530 Reprocess confirm src/app/components/document-detail/document-detail.component.ts - 1548 + 1550 src/app/components/document-list/bulk-editor/bulk-editor.component.ts - 1015 + 1008 This operation will permanently recreate the archive file for this document. src/app/components/document-detail/document-detail.component.ts - 1549 + 1551 The archive file will be re-generated with the current settings. src/app/components/document-detail/document-detail.component.ts - 1550 + 1552 - - Reprocess operation for "" will begin in the background. + + Document reprocessing queued. src/app/components/document-detail/document-detail.component.ts - 1563 + 1566 + + + + Document submitted for reprocessing. + + src/app/components/document-detail/document-detail.component.ts + 1567 Error executing operation src/app/components/document-detail/document-detail.component.ts - 1574 + 1578 src/app/components/document-detail/document-detail.component.ts - 1607 + 1617 Run a workflow on "". src/app/components/document-detail/document-detail.component.ts - 1587 + 1591 Run src/app/components/document-detail/document-detail.component.ts - 1588 + 1592 src/app/components/document-list/bulk-editor/bulk-editor.component.ts - 320 + 317 - - Workflow will run on "" in the background. + + Workflow queued. src/app/components/document-detail/document-detail.component.ts - 1600 + 1607 + + + + Workflow completed. + + src/app/components/document-detail/document-detail.component.ts + 1609 Error downloading document src/app/components/document-detail/document-detail.component.ts - 1671 + 1681 Page Fit src/app/components/document-detail/document-detail.component.ts - 1749 + 1759 - - PDF edit operation for "" will begin in the background. + + PDF edit queued. src/app/components/document-detail/document-detail.component.ts - 1992 + 2003 + + + + PDF edit submitted for processing. + + src/app/components/document-detail/document-detail.component.ts + 2005 Error executing PDF edit operation src/app/components/document-detail/document-detail.component.ts - 2004 + 2015 Please enter the current password before attempting to remove it. src/app/components/document-detail/document-detail.component.ts - 2015 + 2026 - - Password removal operation for "" will begin in the background. + + Password removal queued. src/app/components/document-detail/document-detail.component.ts - 2049 + 2061 + + + + Password removal submitted for processing. + + src/app/components/document-detail/document-detail.component.ts + 2063 Error executing password removal operation src/app/components/document-detail/document-detail.component.ts - 2063 + 2073 Print failed. src/app/components/document-detail/document-detail.component.ts - 2113 + 2123 Error loading document for printing. src/app/components/document-detail/document-detail.component.ts - 2122 + 2132 An error occurred loading tiff: src/app/components/document-detail/document-detail.component.ts - 2205 + 2215 src/app/components/document-detail/document-detail.component.ts - 2211 + 2221 @@ -9529,60 +9617,67 @@ Error deleting version src/app/components/document-detail/document-version-dropdown/document-version-dropdown.component.ts - 164 + 166 Error updating version label src/app/components/document-detail/document-version-dropdown/document-version-dropdown.component.ts - 197 + 199 Uploading new version. Processing will happen in the background. src/app/components/document-detail/document-version-dropdown/document-version-dropdown.component.ts - 219 + 221 Missing task ID. src/app/components/document-detail/document-version-dropdown/document-version-dropdown.component.ts - 232 + 234 Upload failed. src/app/components/document-detail/document-version-dropdown/document-version-dropdown.component.ts - 254 + 256 src/app/components/document-detail/document-version-dropdown/document-version-dropdown.component.ts - 278 + 280 Error uploading new version src/app/components/document-detail/document-version-dropdown/document-version-dropdown.component.ts - 281 + 283 + + + + Existing document queued to be added as a version. + + src/app/components/document-detail/document-version-dropdown/document-version-dropdown.component.ts + 321 Existing document added as a version. src/app/components/document-detail/document-version-dropdown/document-version-dropdown.component.ts - 324 + 322 Error adding existing document as a version src/app/components/document-detail/document-version-dropdown/document-version-dropdown.component.ts - 329 + 327 @@ -9679,7 +9774,11 @@ src/app/components/document-list/bulk-editor/bulk-editor.component.ts - 1115 + 1107 + + + src/app/utils/document-operation.ts + 15 @@ -9714,21 +9813,56 @@ Run a workflow on selected document(s). src/app/components/document-list/bulk-editor/bulk-editor.component.ts - 319 + 316 - - Bulk operation queued. + + Workflow will run on the selected documents in the background. src/app/components/document-list/bulk-editor/bulk-editor.component.ts - 358 + 333 - - View task + + Bulk operation '' submitted for processing. src/app/components/document-list/bulk-editor/bulk-editor.component.ts - 362 + 373 + + + + Operation '' submitted for processing. + + src/app/components/document-list/bulk-editor/bulk-editor.component.ts + 374 + + + + Bulk operation '' completed. + + src/app/components/document-list/bulk-editor/bulk-editor.component.ts + 376 + + + + Operation '' completed. + + src/app/components/document-list/bulk-editor/bulk-editor.component.ts + 377 + + + + Bulk operation '' queued. + + src/app/components/document-list/bulk-editor/bulk-editor.component.ts + 381 + + + + Operation '' queued. + + src/app/components/document-list/bulk-editor/bulk-editor.component.ts + 382 @@ -9935,95 +10069,74 @@ 954 - - Moved document(s) to the trash - - src/app/components/document-list/bulk-editor/bulk-editor.component.ts - 981 - - This operation will permanently recreate the archive files for selected document(s). src/app/components/document-list/bulk-editor/bulk-editor.component.ts - 1016 + 1009 The archive files will be re-generated with the current settings. src/app/components/document-list/bulk-editor/bulk-editor.component.ts - 1017 + 1010 Rotate confirm src/app/components/document-list/bulk-editor/bulk-editor.component.ts - 1055 + 1049 This operation will add rotated versions of the document(s). src/app/components/document-list/bulk-editor/bulk-editor.component.ts - 1056 + 1050 Merge confirm src/app/components/document-list/bulk-editor/bulk-editor.component.ts - 1079 + 1074 This operation will merge selected documents into a new document. src/app/components/document-list/bulk-editor/bulk-editor.component.ts - 1080 - - - - Merged document will be queued for consumption. - - src/app/components/document-list/bulk-editor/bulk-editor.component.ts - 1103 + 1075 The selected documents will become versions of the root document. src/app/components/document-list/bulk-editor/bulk-editor.component.ts - 1116 - - - - Documents merged as versions. - - src/app/components/document-list/bulk-editor/bulk-editor.component.ts - 1131 + 1108 Error updating custom fields. src/app/components/document-list/bulk-editor/bulk-editor.component.ts - 1161 + 1150 Share link bundle creation requested. src/app/components/document-list/bulk-editor/bulk-editor.component.ts - 1209 + 1198 Share link bundle creation is not available yet. src/app/components/document-list/bulk-editor/bulk-editor.component.ts - 1216 + 1205 @@ -10830,50 +10943,78 @@ 23 - - Enter note + + Note src/app/components/document-notes/document-notes.component.html 5 + + Enter note (Markdown is supported) + + src/app/components/document-notes/document-notes.component.html + 5 + + + + Note preview + + src/app/components/document-notes/document-notes.component.html + 7 + + + + Nothing to preview + + src/app/components/document-notes/document-notes.component.html + 11,12 + + Please enter a note. src/app/components/document-notes/document-notes.component.html - 7 + 16,17 + + + + Note input mode + + src/app/components/document-notes/document-notes.component.html + 23 Add note src/app/components/document-notes/document-notes.component.html - 14,15 + 29,30 Delete note src/app/components/document-notes/document-notes.component.html - 25 + 46 src/app/components/document-notes/document-notes.component.html - 27,28 + 48,49 Error saving note src/app/components/document-notes/document-notes.component.ts - 83 + 94 Error deleting note src/app/components/document-notes/document-notes.component.ts - 97 + 108 @@ -13001,7 +13142,7 @@ src/app/services/open-documents.service.ts - 171 + 177 @@ -13141,28 +13282,28 @@ You have unsaved changes to the document src/app/services/open-documents.service.ts - 145 + 151 Are you sure you want to close this document? src/app/services/open-documents.service.ts - 149 + 155 Are you sure you want to close all documents? src/app/services/open-documents.service.ts - 172 + 178 Close documents src/app/services/open-documents.service.ts - 174 + 180 @@ -13452,11 +13593,88 @@ 745 + + Operation + + src/app/services/task-notification.service.ts + 86 + + + + submitted for processing + + src/app/services/task-notification.service.ts + 89 + + + + completed + + src/app/services/task-notification.service.ts + 90 + + + + Operation '' revoked. + + src/app/services/task-notification.service.ts + 94 + + + + Operation revoked. + + src/app/services/task-notification.service.ts + 95 + + + + Operation '' failed. Some changes may already have been applied. + + src/app/services/task-notification.service.ts + 98 + + + + Operation failed. Some changes may already have been applied. + + src/app/services/task-notification.service.ts + 99 + + + + View task + + src/app/services/task-notification.service.ts + 118 + + + + Bulk move to trash queued. + + src/app/services/trash.service.ts + 28 + + + + Move to trash queued. + + src/app/services/trash.service.ts + 29 + + + + Moved document(s) to the trash + + src/app/services/trash.service.ts + 31 + + Undo src/app/services/trash.service.ts - 51 + 76 @@ -13603,6 +13821,90 @@ 44 + + Set correspondent + + src/app/utils/document-operation.ts + 2 + + + + Set document type + + src/app/utils/document-operation.ts + 3 + + + + Set storage path + + src/app/utils/document-operation.ts + 4 + + + + Update tags + + src/app/utils/document-operation.ts + 7 + + + + Update custom fields + + src/app/utils/document-operation.ts + 8 + + + + Document reprocessing + + src/app/utils/document-operation.ts + 11 + + + + Rotate documents + + src/app/utils/document-operation.ts + 13 + + + + Merge documents + + src/app/utils/document-operation.ts + 14 + + + + Split documents + + src/app/utils/document-operation.ts + 16 + + + + Delete pages + + src/app/utils/document-operation.ts + 17 + + + + Edit PDF + + src/app/utils/document-operation.ts + 18 + + + + Remove password + + src/app/utils/document-operation.ts + 19 + + Prev diff --git a/src-ui/package.json b/src-ui/package.json index bd61a91818..0b8515b5a9 100644 --- a/src-ui/package.json +++ b/src-ui/package.json @@ -1,6 +1,6 @@ { "name": "paperless-ngx-ui", - "version": "3.4.2", + "version": "3.5.0", "scripts": { "preinstall": "npx only-allow pnpm", "ng": "ng", 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 7424668d21..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,7 +175,13 @@ -
{{ 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 }} 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 887e690982..694b729b2e 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 @@ -895,6 +895,117 @@ describe('TasksComponent', () => { expect(sanityTaskRow.nativeElement.textContent).toContain('System') }) + it.each([ + ['modify_tags', 12, 'Bulk operation: Update tags', '(12 documents)'], + ['run_workflow', 1, 'Run workflow', null], + ['delete', 3, 'Bulk operation: Move to trash', '(3 documents)'], + ['reprocess', 2, 'Bulk operation: Document reprocessing', '(2 documents)'], + ])( + 'shows the operation, document count and outcome for %s', + (operation, count, label, summary) => { + const task: PaperlessTask = { + ...tasks[4], + task_type: + operation === 'delete' + ? PaperlessTaskType.BulkDelete + : PaperlessTaskType.BulkUpdate, + task_type_display: + operation === 'delete' ? 'Bulk Delete' : 'Bulk Update', + trigger_source: PaperlessTaskTriggerSource.WebUI, + trigger_source_display: 'Web UI', + input_data: { operation, document_count: count }, + result_data: { operation, document_count: count }, + } + component.setSection(TaskSection.Completed) + flushTaskLists(25, 1, [task]) + fixture.detectChanges() + + const name = fixture.nativeElement.querySelector('tbody .name-col') + expect(name.textContent).toContain(label) + 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( + name.closest('tr').querySelector('.results-col').textContent + ).toContain( + [ + 'reprocess', + 'rotate', + 'merge', + 'split', + 'delete_pages', + 'edit_pdf', + 'remove_password', + ].includes(operation) + ? 'Submitted for processing' + : 'Completed' + ) + } + ) + + it('shows operation context while work is pending without reporting completion', () => { + const task = { + ...tasks[2], + task_type: PaperlessTaskType.BulkUpdate, + task_type_display: 'Bulk Update', + input_data: { operation: 'reprocess', document_count: 1 }, + } + component.setSection(TaskSection.InProgress) + flushTaskLists(25, 1, [task]) + fixture.detectChanges() + + const name = fixture.nativeElement.querySelector('tbody .name-col') + expect(name.textContent).toContain('Document reprocessing') + expect(name.textContent).not.toContain('Bulk operation:') + expect(name.querySelector('small')).toBeNull() + expect(component.taskResultMessage(task)).toBeNull() + }) + + it.each([{}, { operation: 'future_operation' }])( + 'preserves the fallback for legacy or unknown operation data: %j', + (input_data) => { + const task = { + ...tasks[4], + task_type: PaperlessTaskType.BulkUpdate, + task_type_display: 'Bulk Update', + input_data, + result_data: {}, + } + expect(component.taskDisplayName(task)).toBe('Bulk Update') + expect(component.taskDocumentCount(task)).toBeNull() + expect(component.taskResultMessage(task)).toBeNull() + } + ) + + it.each([-1, 1.5, '2', null, undefined])( + 'does not display an invalid document count: %s', + (document_count) => { + expect( + component.taskDocumentCount({ + ...tasks[4], + input_data: { operation: 'modify_tags', document_count }, + }) + ).toBeNull() + } + ) + + it('retains error details for failed operation tasks', () => { + expect( + component.taskResultMessage({ + ...tasks[0], + input_data: { operation: 'modify_tags', document_count: 12 }, + result_data: { error_message: 'Insufficient permissions' }, + }) + ).toBe('Insufficient permissions') + }) + it('should filter tasks by result', () => { component.setSection(TaskSection.NeedsAttention) component.filterTargetID = 1 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 ad8793ef85..87ec037785 100644 --- a/src-ui/src/app/components/admin/tasks/tasks.component.ts +++ b/src-ui/src/app/components/admin/tasks/tasks.component.ts @@ -33,6 +33,10 @@ import { IfPermissionsDirective } from 'src/app/directives/if-permissions.direct import { CustomDatePipe } from 'src/app/pipes/custom-date.pipe' import { TasksService } from 'src/app/services/tasks.service' import { ToastService } from 'src/app/services/toast.service' +import { + documentOperationHasFollowUpTasks, + getDocumentOperationLabel, +} from 'src/app/utils/document-operation' import { ConfirmDialogComponent } from '../../common/confirm-dialog/confirm-dialog.component' import { PageHeaderComponent } from '../../common/page-header/page-header.component' import { LoadingComponentWithPermissions } from '../../loading-component/loading.component' @@ -414,11 +418,30 @@ export class TasksComponent } taskDisplayName(task: PaperlessTask): string { - return task.input_data?.filename?.toString() || 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 { - return this.taskDisplayName(task) !== task.task_type_display + return ( + !this.taskOperationLabel(task) && + this.taskDisplayName(task) !== task.task_type_display + ) + } + + private taskOperationLabel(task: PaperlessTask): string | null { + return getDocumentOperationLabel(task.input_data?.operation) + } + + taskDocumentCount(task: PaperlessTask): number | null { + const count = task.input_data?.document_count + return Number.isInteger(count) && count >= 0 ? count : null } taskResultMessage(task: PaperlessTask): string | null { @@ -446,6 +469,15 @@ export class TasksComponent return errorMessage } + if ( + task.status === PaperlessTaskStatus.Success && + this.taskOperationLabel(task) + ) { + return documentOperationHasFollowUpTasks(task.input_data?.operation) + ? $localize`Submitted for processing` + : $localize`Completed` + } + return null } diff --git a/src-ui/src/app/components/app-frame/app-frame.component.spec.ts b/src-ui/src/app/components/app-frame/app-frame.component.spec.ts index 85b16547c7..3d0e9b4e0a 100644 --- a/src-ui/src/app/components/app-frame/app-frame.component.spec.ts +++ b/src-ui/src/app/components/app-frame/app-frame.component.spec.ts @@ -33,6 +33,7 @@ import { RemoteVersionService } from 'src/app/services/rest/remote-version.servi import { SavedViewService } from 'src/app/services/rest/saved-view.service' import { SearchService } from 'src/app/services/rest/search.service' import { SettingsService } from 'src/app/services/settings.service' +import { TaskNotificationService } from 'src/app/services/task-notification.service' import { TasksService } from 'src/app/services/tasks.service' import { ToastService } from 'src/app/services/toast.service' import { UploadDocumentsService } from 'src/app/services/upload-documents.service' @@ -198,14 +199,14 @@ describe('AppFrameComponent', () => { fixture.detectChanges() }) - it('refreshes and notifies on completion without client-side task tracking', () => { + it('refreshes and updates the task notification on completion', () => { const list = TestBed.inject(DocumentListViewService) const reload = jest.spyOn(list, 'reload').mockImplementation(() => {}) jest.spyOn(list, 'reduceSelectionToFilter').mockImplementation(() => {}) const tasksReload = jest .spyOn(tasksService, 'reload') .mockImplementation(() => {}) - const success = jest.spyOn(toastService, 'showSuccess') + const success = jest.spyOn(toastService, 'show') const refresh = jest .spyOn(openDocumentsService, 'refreshDocument') .mockImplementation(() => {}) @@ -230,7 +231,12 @@ describe('AppFrameComponent', () => { expect(refresh).toHaveBeenCalledWith(document.id) expect(maybeRefreshSpy).toHaveBeenCalledTimes(1) expect(tasksReload).toHaveBeenCalledTimes(1) - expect(success).toHaveBeenCalledWith('Bulk operation completed.') + expect(success).toHaveBeenCalledWith( + expect.objectContaining({ + id: 'task-bulk-task', + content: "Operation 'Set permissions' completed.", + }) + ) fixture.destroy() bulkEvents.next({ task_id: 'bulk-task', @@ -245,14 +251,14 @@ describe('AppFrameComponent', () => { const reload = jest.spyOn(list, 'reload').mockImplementation(() => {}) jest.spyOn(list, 'reduceSelectionToFilter').mockImplementation(() => {}) jest.spyOn(tasksService, 'reload').mockImplementation(() => {}) - const error = jest.spyOn(toastService, 'showError') + const error = jest.spyOn(toastService, 'show') const success = jest.spyOn(toastService, 'showSuccess') for (const status of [ PaperlessTaskStatus.Failure, PaperlessTaskStatus.Revoked, ]) { bulkEvents.next({ - task_id: 'bulk-task', + task_id: `${status}-task`, operation: 'set_permissions', status, error: @@ -262,11 +268,36 @@ describe('AppFrameComponent', () => { }) } expect(reload).toHaveBeenCalledTimes(2) - expect(error).toHaveBeenCalledWith(expect.any(String), 'Could not update') expect(error).toHaveBeenCalledWith( - 'Bulk operation revoked.', - 'Task expired before execution.' + expect.objectContaining({ + content: + "Operation 'Set permissions' failed. Some changes may already have been applied.", + error: 'Could not update', + }) ) + expect(error).toHaveBeenCalledWith( + expect.objectContaining({ + content: "Operation 'Set permissions' revoked.", + error: 'Task expired before execution.', + }) + ) + expect(success).not.toHaveBeenCalled() + }) + + it('passes delete completion to the shared task notification handler', () => { + const success = jest.spyOn(toastService, 'showSuccess') + const notifications = TestBed.inject(TaskNotificationService) + const handleStatus = jest.spyOn(notifications, 'complete') + bulkEvents.next({ + task_id: 'delete-1', + operation: 'delete', + status: PaperlessTaskStatus.Success, + }) + expect(handleStatus).toHaveBeenCalledWith({ + task_id: 'delete-1', + operation: 'delete', + status: PaperlessTaskStatus.Success, + }) expect(success).not.toHaveBeenCalled() }) diff --git a/src-ui/src/app/components/app-frame/app-frame.component.ts b/src-ui/src/app/components/app-frame/app-frame.component.ts index beae9bb4f6..e47e13ab04 100644 --- a/src-ui/src/app/components/app-frame/app-frame.component.ts +++ b/src-ui/src/app/components/app-frame/app-frame.component.ts @@ -57,6 +57,7 @@ import { } from 'src/app/services/rest/remote-version.service' import { SavedViewService } from 'src/app/services/rest/saved-view.service' import { SettingsService } from 'src/app/services/settings.service' +import { TaskNotificationService } from 'src/app/services/task-notification.service' import { TasksService } from 'src/app/services/tasks.service' import { ToastService } from 'src/app/services/toast.service' import { UploadDocumentsService } from 'src/app/services/upload-documents.service' @@ -115,6 +116,7 @@ export class AppFrameComponent settingsService = inject(SettingsService) tasksService = inject(TasksService) private readonly toastService = inject(ToastService) + private readonly taskNotifications = inject(TaskNotificationService) private modalService = inject(NgbModal) permissionsService = inject(PermissionsService) private djangoMessagesService = inject(DjangoMessagesService) @@ -182,9 +184,11 @@ export class AppFrameComponent ), takeUntilDestroyed(this.destroyRef) ) - .subscribe(({ status, error }) => { + .subscribe((result) => { this.documentList.reload(null, false) - this.documentList.reduceSelectionToFilter() + if (!this.documentList.allSelected) { + this.documentList.reduceSelectionToFilter() + } // maybe someday we can optimize to only refresh affected documents this.openDocumentsService.getOpenDocuments().forEach((doc) => { this.openDocumentsService.refreshDocument(doc.id) @@ -198,16 +202,7 @@ export class AppFrameComponent ) { this.tasksService.reload() } - if (status === PaperlessTaskStatus.Success) { - this.toastService.showSuccess($localize`Bulk operation completed.`) - } else if (status === PaperlessTaskStatus.Revoked) { - this.toastService.showError($localize`Bulk operation revoked.`, error) - } else { - this.toastService.showError( - $localize`Bulk operation failed. Some changes may already have been applied.`, - error - ) - } + this.taskNotifications.complete(result) }) this.lastScrollY = window.scrollY diff --git a/src-ui/src/app/components/chat/chat/chat.component.spec.ts b/src-ui/src/app/components/chat/chat/chat.component.spec.ts index b38cef7efa..5c6ec39e52 100644 --- a/src-ui/src/app/components/chat/chat/chat.component.spec.ts +++ b/src-ui/src/app/components/chat/chat/chat.component.spec.ts @@ -188,6 +188,62 @@ describe('ChatComponent', () => { expect(component.loading()).toBe(false) }) + it('should reveal a complete answer within one second', () => { + component.input.set('Hello') + component.sendMessage() + + const answer = 'A'.repeat(660) + mockStream$.next(answer) + mockStream$.complete() + + expect(component.messages()[1].content.length).toBeGreaterThan(0) + expect(component.messages()[1].content.length).toBeLessThan(answer.length) + expect(component.loading()).toBe(true) + + jest.advanceTimersByTime(800) + expect(component.messages()[1].content).toBe(answer) + expect(component.loading()).toBe(false) + }) + + it('should give a long answer more time to reveal', () => { + component.input.set('Hello') + component.sendMessage() + + const answer = 'A'.repeat(3000) + mockStream$.next(answer) + mockStream$.complete() + + jest.advanceTimersByTime(800) + expect(component.messages()[1].content.length).toBeLessThan(answer.length) + expect(component.loading()).toBe(true) + + jest.advanceTimersByTime(2500) + expect(component.messages()[1].content).toBe(answer) + expect(component.loading()).toBe(false) + }) + + it('should reveal fast incoming chunks without making them pop in', () => { + component.input.set('Hello') + component.sendMessage() + + let answer = '' + for (let i = 0; i < 20; i++) { + answer += 'A'.repeat(100) + const visibleBefore = component.messages()[1].content.length + mockStream$.next(answer) + jest.advanceTimersByTime(10) + expect( + component.messages()[1].content.length - visibleBefore + ).toBeLessThan(100) + } + expect(component.messages()[1].content.length).toBeLessThan(answer.length) + + mockStream$.complete() + jest.advanceTimersByTime(5200) + expect(component.messages()[1].content).toBe(answer) + expect(component.loading()).toBe(false) + }) + it('should show a slow response message while waiting', () => { component.input.set('Hello') component.sendMessage() diff --git a/src-ui/src/app/components/chat/chat/chat.component.ts b/src-ui/src/app/components/chat/chat/chat.component.ts index cdd3f8473d..cfa0855696 100644 --- a/src-ui/src/app/components/chat/chat/chat.component.ts +++ b/src-ui/src/app/components/chat/chat/chat.component.ts @@ -21,6 +21,9 @@ import { import { pngxPopperOptions } from 'src/app/utils/popper-options' const SLOW_RESPONSE_DELAY_MS = 8000 +const TYPEWRITER_MIN_DURATION_MS = 750 +const TYPEWRITER_MAX_DURATION_MS = 3000 +const TYPEWRITER_INTERVAL_MS = 16 @Component({ selector: 'pngx-chat', @@ -73,6 +76,7 @@ export class ChatComponent implements OnInit { private typewriterBuffer: string[] = [] private typewriterActive = false private typewriterTimeout: ReturnType + private typewriterDeadline = 0 private streamSubscription: Subscription private streamingMessage: ChatMessage private streamFinished = false @@ -134,7 +138,7 @@ export class ChatComponent implements OnInit { if (nextResponse.content.length < lastVisibleContent.length) { this.resetTypewriter(assistantMessage, nextResponse.content) lastVisibleContent = nextResponse.content - } else { + } else if (nextResponse.content.length > lastVisibleContent.length) { const visibleDelta = nextResponse.content.substring( lastVisibleContent.length ) @@ -214,6 +218,12 @@ export class ChatComponent implements OnInit { if (!chunk) return this.typewriterBuffer.push(...chunk.split('')) + // Longer bursts need more time to remain readable as the chat scrolls. + const revealDuration = Math.min( + TYPEWRITER_MAX_DURATION_MS, + Math.max(TYPEWRITER_MIN_DURATION_MS, this.typewriterBuffer.length) + ) + this.typewriterDeadline = Date.now() + revealDuration if (!this.typewriterActive) { this.typewriterActive = true @@ -222,19 +232,29 @@ export class ChatComponent implements OnInit { } playTypewriter(message: ChatMessage): void { - if (this.typewriterBuffer.length === 0) { - this.typewriterActive = false - if (this.streamFinished) this.finishStreaming(message) - return - } - - const nextChar = this.typewriterBuffer.shift() - message.content += nextChar + // Spread the queued text across the updates left before the deadline + const remainingUpdates = Math.max( + 1, + Math.ceil((this.typewriterDeadline - Date.now()) / TYPEWRITER_INTERVAL_MS) + ) + const charactersToShow = Math.ceil( + this.typewriterBuffer.length / remainingUpdates + ) + message.content += this.typewriterBuffer + .splice(0, charactersToShow) + .join('') this.notifyMessagesChanged() this.scrollToBottom() - // 10ms per character - this.typewriterTimeout = setTimeout(() => this.playTypewriter(message), 10) + if (this.typewriterBuffer.length === 0) { + this.typewriterActive = false + if (this.streamFinished) this.finishStreaming(message) + } else { + this.typewriterTimeout = setTimeout( + () => this.playTypewriter(message), + TYPEWRITER_INTERVAL_MS + ) + } } private notifyMessagesChanged(): void { diff --git a/src-ui/src/app/components/common/confirm-dialog/run-workflow-confirm-dialog/run-workflow-confirm-dialog.component.html b/src-ui/src/app/components/common/confirm-dialog/run-workflow-confirm-dialog/run-workflow-confirm-dialog.component.html index e46d3454be..e6cf5e7109 100644 --- a/src-ui/src/app/components/common/confirm-dialog/run-workflow-confirm-dialog/run-workflow-confirm-dialog.component.html +++ b/src-ui/src/app/components/common/confirm-dialog/run-workflow-confirm-dialog/run-workflow-confirm-dialog.component.html @@ -18,8 +18,13 @@
- -
Ignore the workflow's trigger filters and run on every selected document.
+ @if (singleDocument) { + +
Ignore the workflow's trigger filters for this document.
+ } @else { + +
Ignore the workflow's trigger filters and run on every selected document.
+ }