diff --git a/apps/red-ui/src/app/modules/dossier/components/file-actions/file-actions.component.ts b/apps/red-ui/src/app/modules/dossier/components/file-actions/file-actions.component.ts index 331f285f0..63ef0cd50 100644 --- a/apps/red-ui/src/app/modules/dossier/components/file-actions/file-actions.component.ts +++ b/apps/red-ui/src/app/modules/dossier/components/file-actions/file-actions.component.ts @@ -132,8 +132,10 @@ export class FileActionsComponent extends AutoUnsubscribe implements OnInit, OnD }); } - reanalyseFile($event: MouseEvent) { - $event.stopPropagation(); + reanalyseFile($event?: MouseEvent) { + if ($event) { + $event.stopPropagation(); + } this.addSubscription = this._fileActionService.reanalyseFile(this.fileStatus).subscribe(() => { this.reloadDossiers('reanalyse'); }); diff --git a/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/file-preview-screen.component.html b/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/file-preview-screen.component.html index 661e8e458..e89ac5086 100644 --- a/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/file-preview-screen.component.html +++ b/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/file-preview-screen.component.html @@ -88,6 +88,7 @@
; + @ViewChild('fileActions') fileActions: FileActionsComponent; constructor( readonly appStateService: AppStateService, @@ -258,6 +260,10 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni this.displayPDFViewer = true; this._updateCanPerformActions(); this._subscribeToFileUpdates(); + + if (this.fileData?.fileStatus?.analysisRequired) { + this.fileActions.reanalyseFile(); + } } rebuildFilters(deletePreviousAnnotations = false): void { @@ -599,6 +605,7 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni private async _loadFileData(performUpdate = false): Promise { const fileData = await this._fileDownloadService.loadActiveFileData().toPromise(); + if (!fileData.fileStatus?.isPending && !fileData.fileStatus?.isError) { if (performUpdate) { this.fileData.redactionLog = fileData.redactionLog;