Move run_zone_ocr to the new bulk operations pathway

This commit is contained in:
shamoon committed 2026-11-17 13:43:13 -08:00
1 parent 3153b118bd
commit 855b161407
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