diff --git a/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/annotation-references-list/annotation-references-list.component.ts b/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/annotation-references-list/annotation-references-list.component.ts
index 6657f3c96..05513e07e 100644
--- a/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/annotation-references-list/annotation-references-list.component.ts
+++ b/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/annotation-references-list/annotation-references-list.component.ts
@@ -1,7 +1,6 @@
import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output } from '@angular/core';
import { AnnotationWrapper } from '@models/file/annotation.wrapper';
import { AnnotationReferencesService } from '../../services/annotation-references.service';
-import { File } from '@red/domain';
import { FilePreviewStateService } from '../../services/file-preview-state.service';
import { combineLatest, Observable } from 'rxjs';
import { filter, map } from 'rxjs/operators';
@@ -13,7 +12,6 @@ import { filter, map } from 'rxjs/operators';
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class AnnotationReferencesListComponent {
- @Input() file: File;
@Input() selectedAnnotations: AnnotationWrapper[];
@Output() readonly referenceClicked = new EventEmitter
();
references$ = this._annotationReferences;
diff --git a/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/annotations-list/annotations-list.component.html b/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/annotations-list/annotations-list.component.html
index 0ad1cdb71..06aa91c83 100644
--- a/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/annotations-list/annotations-list.component.html
+++ b/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/annotations-list/annotations-list.component.html
@@ -13,7 +13,6 @@
diff --git a/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/annotations-list/annotations-list.component.ts b/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/annotations-list/annotations-list.component.ts
index 14ffc25bf..d812af678 100644
--- a/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/annotations-list/annotations-list.component.ts
+++ b/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/annotations-list/annotations-list.component.ts
@@ -1,7 +1,6 @@
import { ChangeDetectionStrategy, Component, EventEmitter, Input, OnChanges, Output, SimpleChanges, TemplateRef } from '@angular/core';
import { AnnotationWrapper } from '@models/file/annotation.wrapper';
import { FilterService, HelpModeService, IqserEventTarget } from '@iqser/common-ui';
-import { File } from '@red/domain';
import { MultiSelectService } from '../../services/multi-select.service';
import { AnnotationReferencesService } from '../../services/annotation-references.service';
import { ViewModeService } from '../../services/view-mode.service';
@@ -13,7 +12,6 @@ import { ViewModeService } from '../../services/view-mode.service';
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class AnnotationsListComponent implements OnChanges {
- @Input() file: File;
@Input() annotations: AnnotationWrapper[];
@Input() selectedAnnotations: AnnotationWrapper[];
@Input() annotationActionsTemplate: TemplateRef;
@@ -39,7 +37,6 @@ export class AnnotationsListComponent implements OnChanges {
}
annotationClicked(annotation: AnnotationWrapper, $event: MouseEvent): void {
- console.log(annotation);
if (($event?.target as IqserEventTarget)?.localName === 'input') {
return;
}
diff --git a/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/file-workload/file-workload.component.html b/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/file-workload/file-workload.component.html
index 4f1b7424d..e36aef21a 100644
--- a/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/file-workload/file-workload.component.html
+++ b/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/file-workload/file-workload.component.html
@@ -201,7 +201,6 @@
[annotationActionsTemplate]="annotationActionsTemplate"
[annotations]="(displayedAnnotations$ | async)?.get(activeViewerPage)"
[canMultiSelect]="!isReadOnly"
- [file]="file"
[selectedAnnotations]="selectedAnnotations"
iqserHelpMode="workload-annotations-list"
>
diff --git a/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/type-annotation-icon/type-annotation-icon.component.ts b/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/type-annotation-icon/type-annotation-icon.component.ts
index b5d73dba2..3f372b561 100644
--- a/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/type-annotation-icon/type-annotation-icon.component.ts
+++ b/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/type-annotation-icon/type-annotation-icon.component.ts
@@ -1,8 +1,7 @@
import { Component, Input, OnChanges } from '@angular/core';
import { AnnotationWrapper } from '@models/file/annotation.wrapper';
import { AppStateService } from '@state/app-state.service';
-import { DossiersService } from '@services/entity-services/dossiers.service';
-import { File } from '@red/domain';
+import { FilePreviewStateService } from '../../services/file-preview-state.service';
@Component({
selector: 'redaction-type-annotation-icon',
@@ -11,39 +10,32 @@ import { File } from '@red/domain';
})
export class TypeAnnotationIconComponent implements OnChanges {
@Input() annotation: AnnotationWrapper;
- @Input() file: File;
label: string;
color: string;
type: 'square' | 'rhombus' | 'circle' | 'hexagon';
- constructor(private _appStateService: AppStateService, private readonly _dossiersService: DossiersService) {}
+ constructor(private _appStateService: AppStateService, readonly screenStateService: FilePreviewStateService) {}
private get _dossierTemplateId(): string {
- return this._dossiersService.find(this.file.dossierId).dossierTemplateId;
+ return this.screenStateService.dossierTemplateId;
}
ngOnChanges(): void {
- if (this.annotation) {
- if (this.annotation.isSuperTypeBasedColor) {
- this.color = this._appStateService.getDictionaryColor(this.annotation.superType, this._dossierTemplateId);
- } else {
- this.color = this._appStateService.getDictionaryColor(this.annotation.type, this._dossierTemplateId);
- }
- this.type =
- this.annotation.isSuggestion || this.annotation.isDeclinedSuggestion
- ? 'rhombus'
- : this.annotation.isHint || this.annotation.isIgnoredHint
- ? 'circle'
- : this.annotation.isRecommendation
- ? 'hexagon'
- : 'square';
- this.label =
- this.annotation.isSuggestion || this.annotation.isDeclinedSuggestion
- ? 'S'
- : this.annotation.isSkipped
- ? 'S'
- : this.annotation.type[0].toUpperCase();
+ if (!this.annotation) {
+ return;
}
+
+ const { isSuggestion, isRecommendation, isSkipped, isDeclinedSuggestion, isHint, isIgnoredHint } = this.annotation;
+
+ if (this.annotation.isSuperTypeBasedColor) {
+ this.color = this._appStateService.getDictionaryColor(this.annotation.superType, this._dossierTemplateId);
+ } else {
+ this.color = this._appStateService.getDictionaryColor(this.annotation.type, this._dossierTemplateId);
+ }
+
+ this.type =
+ isSuggestion || isDeclinedSuggestion ? 'rhombus' : isHint || isIgnoredHint ? 'circle' : isRecommendation ? 'hexagon' : 'square';
+ this.label = isSuggestion || isDeclinedSuggestion ? 'S' : isSkipped ? 'S' : this.annotation.type[0].toUpperCase();
}
}
diff --git a/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/file-preview-screen.component.ts b/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/file-preview-screen.component.ts
index 664365c19..e78c87c5f 100644
--- a/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/file-preview-screen.component.ts
+++ b/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/file-preview-screen.component.ts
@@ -36,7 +36,7 @@ import { handleFilterDelta } from '@utils/filter-utils';
import { FilesService } from '@services/entity-services/files.service';
import { DossiersService } from '@services/entity-services/dossiers.service';
import { FileManagementService } from '@services/entity-services/file-management.service';
-import { catchError, filter, map, switchMap, tap } from 'rxjs/operators';
+import { catchError, map, switchMap, tap } from 'rxjs/operators';
import { FilesMapService } from '@services/entity-services/files-map.service';
import { WatermarkService } from '@shared/services/watermark.service';
import { ExcludedPagesService } from './services/excluded-pages.service';
@@ -404,7 +404,7 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
async annotationsChangedByReviewAction(annotation: AnnotationWrapper) {
this.multiSelectService.deactivate();
- await this._reloadAnnotationsForPage(annotation?.pageNumber || this.activeViewerPage);
+ await firstValueFrom(this._filesService.reload(this.dossierId, this.fileId));
}
closeFullScreen() {
@@ -518,10 +518,7 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
private _subscribeToFileUpdates(): void {
this.addActiveScreenSubscription = this._filesMapService
.watch$(this.dossierId, this.fileId)
- .pipe(
- filter(f => !!f),
- switchMap(file => this._fileUpdated(file)),
- )
+ .pipe(switchMap(file => this._fileUpdated(file)))
.subscribe();
this.addActiveScreenSubscription = timer(0, 5000)
@@ -579,7 +576,7 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
}
private async _reloadAnnotationsForPage(page: number) {
- const file = await firstValueFrom(this._filesService.reload(this.dossierId, this.fileId));
+ const file = await this.stateService.file;
// if this action triggered a re-processing,
// we don't want to redraw for this page since they will get redrawn as soon as processing ends;
if (file.isProcessing) {
diff --git a/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/services/file-preview-state.service.ts b/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/services/file-preview-state.service.ts
index 72e6a597b..c698ce8a4 100644
--- a/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/services/file-preview-state.service.ts
+++ b/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/services/file-preview-state.service.ts
@@ -12,6 +12,7 @@ export class FilePreviewStateService {
readonly file$: Observable;
readonly dossier$: Observable;
readonly dossierId: string;
+ readonly dossierTemplateId: string;
readonly fileId: string;
private readonly _fileData$ = new BehaviorSubject(undefined);
@@ -21,6 +22,7 @@ export class FilePreviewStateService {
activatedRoute: ActivatedRoute,
) {
this.dossierId = activatedRoute.snapshot.paramMap.get('dossierId');
+ this.dossierTemplateId = this._dossiersService.find(this.dossierId).dossierTemplateId;
this.dossier$ = _dossiersService.getEntityChanged$(this.dossierId);
this.fileId = activatedRoute.snapshot.paramMap.get('fileId');
diff --git a/apps/red-ui/src/app/services/entity-services/files-map.service.ts b/apps/red-ui/src/app/services/entity-services/files-map.service.ts
index 151c33723..07936d006 100644
--- a/apps/red-ui/src/app/services/entity-services/files-map.service.ts
+++ b/apps/red-ui/src/app/services/entity-services/files-map.service.ts
@@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
import { BehaviorSubject, Observable, Subject } from 'rxjs';
import { File } from '@red/domain';
import { filter, startWith } from 'rxjs/operators';
-import { shareLast } from '@iqser/common-ui';
+import { RequiredParam, shareLast, Validate } from '@iqser/common-ui';
@Injectable({ providedIn: 'root' })
export class FilesMapService {
@@ -74,7 +74,8 @@ export class FilesMapService {
}
}
- watch$(key: string, entityId: string): Observable {
+ @Validate()
+ watch$(@RequiredParam() key: string, @RequiredParam() entityId: string): Observable {
return this._entityChanged$.pipe(
filter(entity => entity.id === entityId),
startWith(this.get(key, entityId)),