reload annotations on reanalysis
This commit is contained in:
parent
8c2d75e873
commit
570b525636
@ -1,5 +1,5 @@
|
||||
<ng-container *ngIf="stateService.dossier$ | async as dossier">
|
||||
<section *ngIf="stateService.file$ | async as file" [class.fullscreen]="fullScreen">
|
||||
<section *ngIf="file$ | async as file" [class.fullscreen]="fullScreen">
|
||||
<div class="page-header">
|
||||
<div class="flex flex-1">
|
||||
<redaction-view-switch (switchView)="switchView($event)"></redaction-view-switch>
|
||||
|
||||
@ -73,6 +73,7 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
|
||||
readonly canPerformAnnotationActions$: Observable<boolean>;
|
||||
readonly fileId = this.stateService.fileId;
|
||||
readonly dossierId = this.stateService.dossierId;
|
||||
readonly file$ = this.stateService.file$.pipe(tap(file => this._fileUpdated(file)));
|
||||
ready = false;
|
||||
private _instance: WebViewerInstance;
|
||||
private _lastPage: string;
|
||||
@ -147,6 +148,10 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
|
||||
}
|
||||
|
||||
async updateViewMode(): Promise<void> {
|
||||
if (!this._instance?.Core.documentViewer.getDocument()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const ocrAnnotationIds = this._fileData.allAnnotations.filter(a => a.isOCR).map(a => a.id);
|
||||
const annotations = this._getAnnotations(a => a.getCustomData('redact-manager'));
|
||||
const redactions = annotations.filter(a => a.getCustomData('redaction'));
|
||||
@ -305,6 +310,7 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
|
||||
for (const page of distinctPages) {
|
||||
await this._reloadAnnotationsForPage(page);
|
||||
}
|
||||
await this.updateViewMode();
|
||||
}
|
||||
},
|
||||
);
|
||||
@ -524,11 +530,6 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
|
||||
}
|
||||
|
||||
private _subscribeToFileUpdates(): void {
|
||||
this.addActiveScreenSubscription = this._filesMapService
|
||||
.watch$(this.dossierId, this.fileId)
|
||||
.pipe(switchMap(file => this._fileUpdated(file)))
|
||||
.subscribe();
|
||||
|
||||
this.addActiveScreenSubscription = timer(0, 5000)
|
||||
.pipe(switchMap(() => this._filesService.reload(this.dossierId, this.fileId)))
|
||||
.subscribe();
|
||||
@ -581,6 +582,7 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
|
||||
private async _reloadAnnotations() {
|
||||
this._deleteAnnotations();
|
||||
await this._cleanupAndRedrawAnnotations();
|
||||
await this.updateViewMode();
|
||||
}
|
||||
|
||||
private async _reloadAnnotationsForPage(page: number) {
|
||||
@ -623,7 +625,8 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
|
||||
this.rebuildFilters();
|
||||
|
||||
const startTime = new Date().getTime();
|
||||
const newAnnotations = newAnnotationsFilter ? this.visibleAnnotations.filter(newAnnotationsFilter) : this.visibleAnnotations;
|
||||
const annotations = this._fileData.allAnnotations;
|
||||
const newAnnotations = newAnnotationsFilter ? annotations.filter(newAnnotationsFilter) : annotations;
|
||||
|
||||
if (currentFilters) {
|
||||
this._handleDeltaAnnotationFilters(currentFilters, this.visibleAnnotations);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user