Pull request #286: VM/AutomaticReanalysis

Merge in RED/ui from VM/AutomaticReanalysis2 to master

* commit '9e6f1c2233e0587646f75d0f8182e4c8fc1fd11f':
  Triggered automatic reanalysis on document opening when 'analysRequired = true'
This commit is contained in:
Valentin-Gabriel Mihai 2021-09-21 20:07:49 +02:00
commit 076fa42194
3 changed files with 12 additions and 2 deletions

View File

@ -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');
});

View File

@ -88,6 +88,7 @@
<div class="vertical-line"></div>
<redaction-file-actions
#fileActions
(actionPerformed)="fileActionPerformed($event)"
[activeDocumentInfo]="viewDocumentInfo"
[activeExcludePages]="excludePages"

View File

@ -43,6 +43,7 @@ import { TranslateService } from '@ngx-translate/core';
import { fileStatusTranslations } from '../../translations/file-status-translations';
import { handleFilterDelta } from '@utils/filter-utils';
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
import { FileActionsComponent } from '../../components/file-actions/file-actions.component';
import Annotation = Core.Annotations.Annotation;
const ALL_HOTKEY_ARRAY = ['Escape', 'F', 'f'];
@ -79,6 +80,7 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
static: true
})
private readonly _filterTemplate: TemplateRef<NestedFilter>;
@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<void> {
const fileData = await this._fileDownloadService.loadActiveFileData().toPromise();
if (!fileData.fileStatus?.isPending && !fileData.fileStatus?.isError) {
if (performUpdate) {
this.fileData.redactionLog = fileData.redactionLog;