mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-11-18 03:41:24 +00:00
Move run_zone_ocr to the new bulk operations pathway
This commit is contained in:
13 files changed
+193
-47
No files matched your search
@@ -1387,6 +1387,10 @@ describe('BulkEditorComponent', () => {
|
||||
})
|
||||
|
||||
it('should support run zone ocr', () => {
|
||||
const queued = jest
|
||||
.spyOn(TestBed.inject(TaskNotificationService), 'showQueued')
|
||||
.mockImplementation(() => {})
|
||||
const reload = jest.spyOn(documentListViewService, 'reload')
|
||||
let modal: NgbModalRef
|
||||
modalService.activeInstances.subscribe((m) => (modal = m[0]))
|
||||
jest.spyOn(permissionsService, 'currentUserCan').mockReturnValue(true)
|
||||
@@ -1406,10 +1410,17 @@ describe('BulkEditorComponent', () => {
|
||||
let req = httpTestingController.expectOne(
|
||||
`${environment.apiBaseUrl}documents/run_zone_ocr/`
|
||||
)
|
||||
req.flush(true)
|
||||
req.flush({ result: 'OK', task_id: 'zone-ocr-1' })
|
||||
expect(req.request.body).toEqual({
|
||||
documents: [3, 4],
|
||||
from_webui: true,
|
||||
})
|
||||
expect(queued).toHaveBeenLastCalledWith(
|
||||
'zone-ocr-1',
|
||||
"Bulk operation 'Run zone OCR' queued.",
|
||||
{ content: "Bulk operation 'Run zone OCR' completed." }
|
||||
)
|
||||
expect(reload).not.toHaveBeenCalled()
|
||||
|
||||
component.runZoneOcrSelected()
|
||||
modal.componentInstance.template = 3
|
||||
@@ -1417,11 +1428,17 @@ describe('BulkEditorComponent', () => {
|
||||
req = httpTestingController.expectOne(
|
||||
`${environment.apiBaseUrl}documents/run_zone_ocr/`
|
||||
)
|
||||
req.flush(true)
|
||||
req.flush({ result: 'OK', task_id: 'zone-ocr-2' })
|
||||
expect(req.request.body).toEqual({
|
||||
documents: [3, 4],
|
||||
template: 3,
|
||||
from_webui: true,
|
||||
})
|
||||
expect(queued).toHaveBeenLastCalledWith(
|
||||
'zone-ocr-2',
|
||||
"Bulk operation 'Run zone OCR' queued.",
|
||||
{ content: "Bulk operation 'Run zone OCR' completed." }
|
||||
)
|
||||
httpTestingController.match(
|
||||
`${environment.apiBaseUrl}ocr_templates/?page=1&page_size=100000`
|
||||
) // template list
|
||||
|
||||
@@ -1042,6 +1042,7 @@ export class BulkEditorComponent
|
||||
dialog.buttonsEnabled.set(false)
|
||||
this.executeDocumentAction(
|
||||
modal,
|
||||
'run_zone_ocr',
|
||||
this.documentService.runZoneOcrDocuments(
|
||||
this.getSelectionQuery(),
|
||||
dialog.template
|
||||
|
||||
Reference in new issue
Block a user