mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-11-17 11:21:29 +00:00
Chorehancement: move all bulk operations to async hand-off (#14773)
This commit is contained in:
1 parent
28bb63824f
commit
de75249e51
39 files changed
+1633
-421
No files matched your search
@@ -0,0 +1,11 @@
|
||||
import { getDocumentOperationLabel } from './document-operation'
|
||||
|
||||
describe('Document Operation Utils', () => {
|
||||
it('should retrieve the document operation label correctly for an existing operation, null otherwise', () => {
|
||||
const result = getDocumentOperationLabel('modify_custom_fields')
|
||||
expect(result).toBe('Update custom fields')
|
||||
|
||||
const resultNull = getDocumentOperationLabel('non_existing_operation')
|
||||
expect(resultNull).toBeNull()
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,38 @@
|
||||
const OPERATION_LABELS: Record<string, string> = {
|
||||
set_correspondent: $localize`Set correspondent`,
|
||||
set_document_type: $localize`Set document type`,
|
||||
set_storage_path: $localize`Set storage path`,
|
||||
add_tag: $localize`Add tag`,
|
||||
remove_tag: $localize`Remove tag`,
|
||||
modify_tags: $localize`Update tags`,
|
||||
modify_custom_fields: $localize`Update custom fields`,
|
||||
set_permissions: $localize`Set permissions`,
|
||||
delete: $localize`Move to trash`,
|
||||
reprocess: $localize`Document reprocessing`,
|
||||
run_workflow: $localize`Run workflow`,
|
||||
rotate: $localize`Rotate documents`,
|
||||
merge: $localize`Merge documents`,
|
||||
merge_as_versions: $localize`Merge as versions`,
|
||||
split: $localize`Split documents`,
|
||||
delete_pages: $localize`Delete pages`,
|
||||
edit_pdf: $localize`Edit PDF`,
|
||||
remove_password: $localize`Remove password`,
|
||||
}
|
||||
|
||||
export function getDocumentOperationLabel(operation?: string): string | null {
|
||||
const label = operation ? OPERATION_LABELS[operation] : null
|
||||
return label ?? null
|
||||
}
|
||||
|
||||
// These operations queue processing in separate tasks
|
||||
export function documentOperationHasFollowUpTasks(operation?: string): boolean {
|
||||
return [
|
||||
'reprocess',
|
||||
'rotate',
|
||||
'merge',
|
||||
'split',
|
||||
'delete_pages',
|
||||
'edit_pdf',
|
||||
'remove_password',
|
||||
].includes(operation ?? '')
|
||||
}
|
||||
Reference in new issue
Block a user