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) { reanalyseFile($event?: MouseEvent) {
if ($event) {
$event.stopPropagation(); $event.stopPropagation();
}
this.addSubscription = this._fileActionService.reanalyseFile(this.fileStatus).subscribe(() => { this.addSubscription = this._fileActionService.reanalyseFile(this.fileStatus).subscribe(() => {
this.reloadDossiers('reanalyse'); this.reloadDossiers('reanalyse');
}); });

View File

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

View File

@ -43,6 +43,7 @@ import { TranslateService } from '@ngx-translate/core';
import { fileStatusTranslations } from '../../translations/file-status-translations'; import { fileStatusTranslations } from '../../translations/file-status-translations';
import { handleFilterDelta } from '@utils/filter-utils'; import { handleFilterDelta } from '@utils/filter-utils';
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker'; import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
import { FileActionsComponent } from '../../components/file-actions/file-actions.component';
import Annotation = Core.Annotations.Annotation; import Annotation = Core.Annotations.Annotation;
const ALL_HOTKEY_ARRAY = ['Escape', 'F', 'f']; const ALL_HOTKEY_ARRAY = ['Escape', 'F', 'f'];
@ -79,6 +80,7 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
static: true static: true
}) })
private readonly _filterTemplate: TemplateRef<NestedFilter>; private readonly _filterTemplate: TemplateRef<NestedFilter>;
@ViewChild('fileActions') fileActions: FileActionsComponent;
constructor( constructor(
readonly appStateService: AppStateService, readonly appStateService: AppStateService,
@ -258,6 +260,10 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
this.displayPDFViewer = true; this.displayPDFViewer = true;
this._updateCanPerformActions(); this._updateCanPerformActions();
this._subscribeToFileUpdates(); this._subscribeToFileUpdates();
if (this.fileData?.fileStatus?.analysisRequired) {
this.fileActions.reanalyseFile();
}
} }
rebuildFilters(deletePreviousAnnotations = false): void { rebuildFilters(deletePreviousAnnotations = false): void {
@ -599,6 +605,7 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
private async _loadFileData(performUpdate = false): Promise<void> { private async _loadFileData(performUpdate = false): Promise<void> {
const fileData = await this._fileDownloadService.loadActiveFileData().toPromise(); const fileData = await this._fileDownloadService.loadActiveFileData().toPromise();
if (!fileData.fileStatus?.isPending && !fileData.fileStatus?.isError) { if (!fileData.fileStatus?.isPending && !fileData.fileStatus?.isError) {
if (performUpdate) { if (performUpdate) {
this.fileData.redactionLog = fileData.redactionLog; this.fileData.redactionLog = fileData.redactionLog;