diff --git a/apps/red-ui/src/app/modules/file-preview/components/annotation-card/annotation-card.component.html b/apps/red-ui/src/app/modules/file-preview/components/annotation-card/annotation-card.component.html
index c45f95a1f..88a1c413f 100644
--- a/apps/red-ui/src/app/modules/file-preview/components/annotation-card/annotation-card.component.html
+++ b/apps/red-ui/src/app/modules/file-preview/components/annotation-card/annotation-card.component.html
@@ -1,7 +1,7 @@
diff --git a/apps/red-ui/src/app/modules/file-preview/components/annotation-card/annotation-card.component.ts b/apps/red-ui/src/app/modules/file-preview/components/annotation-card/annotation-card.component.ts
index e864ad4ec..d32a7c768 100644
--- a/apps/red-ui/src/app/modules/file-preview/components/annotation-card/annotation-card.component.ts
+++ b/apps/red-ui/src/app/modules/file-preview/components/annotation-card/annotation-card.component.ts
@@ -1,4 +1,4 @@
-import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
+import { Component, Input } from '@angular/core';
import { AnnotationWrapper } from '@models/file/annotation.wrapper';
import { MultiSelectService } from '../../services/multi-select.service';
import { annotationTypesTranslations } from '@translations/annotation-types-translations';
@@ -8,7 +8,6 @@ import { ROLES } from '@users/roles';
selector: 'redaction-annotation-card',
templateUrl: './annotation-card.component.html',
styleUrls: ['./annotation-card.component.scss'],
- changeDetection: ChangeDetectionStrategy.OnPush,
})
export class AnnotationCardComponent {
readonly roles = ROLES;
diff --git a/apps/red-ui/src/app/modules/file-preview/components/annotation-reference/annotation-reference.component.ts b/apps/red-ui/src/app/modules/file-preview/components/annotation-reference/annotation-reference.component.ts
index b1296d397..1d0f135b1 100644
--- a/apps/red-ui/src/app/modules/file-preview/components/annotation-reference/annotation-reference.component.ts
+++ b/apps/red-ui/src/app/modules/file-preview/components/annotation-reference/annotation-reference.component.ts
@@ -1,4 +1,4 @@
-import { ChangeDetectionStrategy, ChangeDetectorRef, Component, HostBinding, Input, OnChanges, OnDestroy } from '@angular/core';
+import { ChangeDetectorRef, Component, HostBinding, Input, OnChanges, OnDestroy } from '@angular/core';
import { AnnotationWrapper } from '@models/file/annotation.wrapper';
import { BehaviorSubject, filter, Subscription } from 'rxjs';
import { switchMap, tap } from 'rxjs/operators';
@@ -7,7 +7,6 @@ import { AnnotationsListingService } from '../../services/annotations-listing.se
@Component({
selector: 'redaction-annotation-reference [annotation]',
templateUrl: './annotation-reference.component.html',
- changeDetection: ChangeDetectionStrategy.OnPush,
})
export class AnnotationReferenceComponent implements OnChanges, OnDestroy {
@Input() annotation: AnnotationWrapper;
@@ -16,16 +15,15 @@ export class AnnotationReferenceComponent implements OnChanges, OnDestroy {
readonly #subscription: Subscription;
constructor(private readonly _listingService: AnnotationsListingService, private readonly _changeRef: ChangeDetectorRef) {
- this.#subscription = this.#annotationChanged$
- .pipe(
- filter(annotation => !!annotation),
- switchMap(annotation => this._listingService.isSelected$(annotation)),
- tap((isSelected: boolean) => {
- this.isSelected = isSelected;
- this._changeRef.markForCheck();
- }),
- )
- .subscribe();
+ const annotationsChanged$ = this.#annotationChanged$.pipe(
+ filter(annotation => !!annotation),
+ switchMap(annotation => this._listingService.isSelected$(annotation)),
+ tap((isSelected: boolean) => {
+ this.isSelected = isSelected;
+ this._changeRef.markForCheck();
+ }),
+ );
+ this.#subscription = annotationsChanged$.subscribe();
}
ngOnChanges(): void {
diff --git a/apps/red-ui/src/app/modules/file-preview/components/annotation-references-list/annotation-references-list.component.html b/apps/red-ui/src/app/modules/file-preview/components/annotation-references-list/annotation-references-list.component.html
index 75c1de2de..ad8059702 100644
--- a/apps/red-ui/src/app/modules/file-preview/components/annotation-references-list/annotation-references-list.component.html
+++ b/apps/red-ui/src/app/modules/file-preview/components/annotation-references-list/annotation-references-list.component.html
@@ -2,10 +2,11 @@
+
diff --git a/apps/red-ui/src/app/modules/file-preview/components/annotation-references-list/annotation-references-list.component.ts b/apps/red-ui/src/app/modules/file-preview/components/annotation-references-list/annotation-references-list.component.ts
index dabf65b46..08dfaaf16 100644
--- a/apps/red-ui/src/app/modules/file-preview/components/annotation-references-list/annotation-references-list.component.ts
+++ b/apps/red-ui/src/app/modules/file-preview/components/annotation-references-list/annotation-references-list.component.ts
@@ -1,4 +1,4 @@
-import { ChangeDetectionStrategy, Component, EventEmitter, Output } from '@angular/core';
+import { Component, EventEmitter, Output } from '@angular/core';
import { AnnotationWrapper } from '@models/file/annotation.wrapper';
import { AnnotationReferencesService } from '../../services/annotation-references.service';
import { Observable, switchMap } from 'rxjs';
@@ -9,7 +9,6 @@ import { filter } from 'rxjs/operators';
selector: 'redaction-annotation-references-list',
templateUrl: './annotation-references-list.component.html',
styleUrls: ['./annotation-references-list.component.scss'],
- changeDetection: ChangeDetectionStrategy.OnPush,
})
export class AnnotationReferencesListComponent {
@Output() readonly referenceClicked = new EventEmitter
();
diff --git a/apps/red-ui/src/app/modules/file-preview/components/annotation-references-page-indicator/annotation-references-page-indicator.component.ts b/apps/red-ui/src/app/modules/file-preview/components/annotation-references-page-indicator/annotation-references-page-indicator.component.ts
index 55edb86bc..4b1ee0e31 100644
--- a/apps/red-ui/src/app/modules/file-preview/components/annotation-references-page-indicator/annotation-references-page-indicator.component.ts
+++ b/apps/red-ui/src/app/modules/file-preview/components/annotation-references-page-indicator/annotation-references-page-indicator.component.ts
@@ -1,10 +1,9 @@
-import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
+import { Component, Input } from '@angular/core';
@Component({
selector: 'redaction-annotation-references-page-indicator',
templateUrl: './annotation-references-page-indicator.component.html',
styleUrls: ['./annotation-references-page-indicator.component.scss'],
- changeDetection: ChangeDetectionStrategy.OnPush,
})
export class AnnotationReferencesPageIndicatorComponent {
@Input() number: number;
diff --git a/apps/red-ui/src/app/modules/file-preview/components/annotation-wrapper/annotation-wrapper.component.html b/apps/red-ui/src/app/modules/file-preview/components/annotation-wrapper/annotation-wrapper.component.html
index f64120c3e..51e8453d4 100644
--- a/apps/red-ui/src/app/modules/file-preview/components/annotation-wrapper/annotation-wrapper.component.html
+++ b/apps/red-ui/src/app/modules/file-preview/components/annotation-wrapper/annotation-wrapper.component.html
@@ -20,10 +20,13 @@
-
+
diff --git a/apps/red-ui/src/app/modules/file-preview/components/annotation-wrapper/annotation-wrapper.component.ts b/apps/red-ui/src/app/modules/file-preview/components/annotation-wrapper/annotation-wrapper.component.ts
index 78092c2dc..f6f52c154 100644
--- a/apps/red-ui/src/app/modules/file-preview/components/annotation-wrapper/annotation-wrapper.component.ts
+++ b/apps/red-ui/src/app/modules/file-preview/components/annotation-wrapper/annotation-wrapper.component.ts
@@ -1,46 +1,50 @@
-import { ChangeDetectionStrategy, ChangeDetectorRef, Component, HostBinding, Input, OnChanges, TemplateRef } from '@angular/core';
+import { Component, HostBinding, Input, OnChanges } from '@angular/core';
import { BehaviorSubject, Observable } from 'rxjs';
-import { switchMap, tap } from 'rxjs/operators';
+import { distinctUntilChanged, switchMap, tap } from 'rxjs/operators';
import { AnnotationWrapper } from '@models/file/annotation.wrapper';
import { MultiSelectService } from '../../services/multi-select.service';
import { AnnotationsListingService } from '../../services/annotations-listing.service';
+import { PdfProxyService } from '../../services/pdf-proxy.service';
+import { ScrollableParentViews } from '@iqser/common-ui';
+import { ActionsHelpModeKeys } from '../../utils/constants';
@Component({
- selector: 'redaction-annotation-wrapper [annotation] [annotationActionsTemplate]',
+ selector: 'redaction-annotation-wrapper [annotation]',
templateUrl: './annotation-wrapper.component.html',
styleUrls: ['./annotation-wrapper.component.scss'],
- changeDetection: ChangeDetectionStrategy.OnPush,
})
export class AnnotationWrapperComponent implements OnChanges {
@Input() annotation!: AnnotationWrapper;
- @Input() annotationActionsTemplate: TemplateRef
;
readonly isSelected$!: Observable;
@HostBinding('attr.annotation-id') annotationId: string;
- @HostBinding('attr.annotation-page') annotationPage: number;
- @HostBinding('class.active') active: boolean;
- private readonly _annotationChanged$ = new BehaviorSubject(undefined);
+ @HostBinding('class.active') active = false;
+ readonly scrollableParentView = ScrollableParentViews.ANNOTATIONS_LIST;
+ readonly #annotationChanged$ = new BehaviorSubject(undefined);
constructor(
- private readonly _changeRef: ChangeDetectorRef,
readonly listingService: AnnotationsListingService,
readonly multiSelectService: MultiSelectService,
+ readonly pdfProxyService: PdfProxyService,
) {
- this.isSelected$ = this._annotationChanged$.pipe(
- tap(annotation => {
- this.annotationId = annotation.id;
- this.annotationPage = annotation.pageNumber;
- this._changeRef.markForCheck();
- }),
+ this.isSelected$ = this.#annotationChanged$.pipe(
switchMap(entity => this.listingService.isSelected$(entity)),
- tap(isSelected => {
- this.active = isSelected;
- this._changeRef.markForCheck();
- }),
+ distinctUntilChanged(),
+ tap(isSelected => (this.active = isSelected)),
);
}
- ngOnChanges(): void {
- this._annotationChanged$.next(this.annotation);
+ ngOnChanges() {
+ this.#annotationChanged$.next(this.annotation);
+ this.annotationId = this.annotation.id;
+ }
+
+ getActionsHelpModeKey(annotation: AnnotationWrapper): string {
+ const type = annotation?.typeLabel?.split('.')[1];
+ const typeValue = annotation?.typeValue;
+ if (type === 'hint' && (typeValue === 'ocr' || typeValue === 'formula' || typeValue === 'image')) {
+ return ActionsHelpModeKeys[`${type}-${typeValue}`];
+ }
+ return ActionsHelpModeKeys[type];
}
}
diff --git a/apps/red-ui/src/app/modules/file-preview/components/annotations-list/annotations-list.component.html b/apps/red-ui/src/app/modules/file-preview/components/annotations-list/annotations-list.component.html
index 4d28f4d07..7637759e9 100644
--- a/apps/red-ui/src/app/modules/file-preview/components/annotations-list/annotations-list.component.html
+++ b/apps/red-ui/src/app/modules/file-preview/components/annotations-list/annotations-list.component.html
@@ -3,13 +3,10 @@
-
+
-
-
-
+
diff --git a/apps/red-ui/src/app/modules/file-preview/components/annotations-list/annotations-list.component.ts b/apps/red-ui/src/app/modules/file-preview/components/annotations-list/annotations-list.component.ts
index 84955a2e9..fa66e28c7 100644
--- a/apps/red-ui/src/app/modules/file-preview/components/annotations-list/annotations-list.component.ts
+++ b/apps/red-ui/src/app/modules/file-preview/components/annotations-list/annotations-list.component.ts
@@ -1,14 +1,4 @@
-import {
- ChangeDetectionStrategy,
- ChangeDetectorRef,
- Component,
- ElementRef,
- EventEmitter,
- Input,
- OnChanges,
- Output,
- TemplateRef,
-} from '@angular/core';
+import { ChangeDetectorRef, Component, ElementRef, EventEmitter, Input, OnChanges, Output } from '@angular/core';
import { AnnotationWrapper } from '@models/file/annotation.wrapper';
import { FilterService, HasScrollbarDirective, IqserEventTarget } from '@iqser/common-ui';
import { MultiSelectService } from '../../services/multi-select.service';
@@ -24,11 +14,9 @@ import { AnnotationsListingService } from '../../services/annotations-listing.se
selector: 'redaction-annotations-list',
templateUrl: './annotations-list.component.html',
styleUrls: ['./annotations-list.component.scss'],
- changeDetection: ChangeDetectionStrategy.OnPush,
})
export class AnnotationsListComponent extends HasScrollbarDirective implements OnChanges {
@Input() annotations: AnnotationWrapper[];
- @Input() annotationActionsTemplate: TemplateRef
;
@Output() readonly pagesPanelActive = new EventEmitter();
diff --git a/apps/red-ui/src/app/modules/file-preview/components/comments/comments.component.html b/apps/red-ui/src/app/modules/file-preview/components/comments/comments.component.html
index 37411ebe8..7d566fc69 100644
--- a/apps/red-ui/src/app/modules/file-preview/components/comments/comments.component.html
+++ b/apps/red-ui/src/app/modules/file-preview/components/comments/comments.component.html
@@ -1,9 +1,9 @@
; @@ -113,6 +112,6 @@ export class UserManagementComponent { this.loadingService.stop(); this.toaster.success(_('assignment.reviewer'), { params: { reviewerName, filename } }); - this.editingReviewer$.next(false); + this.editingReviewer = false; } } diff --git a/apps/red-ui/src/app/modules/file-preview/file-preview-screen.component.ts b/apps/red-ui/src/app/modules/file-preview/file-preview-screen.component.ts index 89bd74b12..8e2644b5d 100644 --- a/apps/red-ui/src/app/modules/file-preview/file-preview-screen.component.ts +++ b/apps/red-ui/src/app/modules/file-preview/file-preview-screen.component.ts @@ -1,6 +1,5 @@ import { AfterViewInit, - ChangeDetectionStrategy, ChangeDetectorRef, Component, ElementRef, @@ -78,7 +77,6 @@ const textActions = [TextPopups.ADD_DICTIONARY, TextPopups.ADD_FALSE_POSITIVE]; templateUrl: './file-preview-screen.component.html', styleUrls: ['./file-preview-screen.component.scss'], providers: filePreviewScreenProviders, - changeDetection: ChangeDetectionStrategy.OnPush, }) export class FilePreviewScreenComponent extends AutoUnsubscribe @@ -300,7 +298,7 @@ export class FilePreviewScreenComponent await firstValueFrom(reanalyzeFiles); } - this.pdfProxyService.loadViewer(); + this.pdfProxyService.configureElements(); } ngAfterViewInit() { diff --git a/apps/red-ui/src/app/modules/file-preview/services/file-data.service.ts b/apps/red-ui/src/app/modules/file-preview/services/file-data.service.ts index 0841d0ba5..42d695c72 100644 --- a/apps/red-ui/src/app/modules/file-preview/services/file-data.service.ts +++ b/apps/red-ui/src/app/modules/file-preview/services/file-data.service.ts @@ -5,7 +5,6 @@ import { IRedactionLog, IRedactionLogEntry, LogEntryStatuses, - ManualRedactionType, ViewedPage, ViewMode, ViewModes, diff --git a/apps/red-ui/src/app/modules/file-preview/services/manual-redaction.service.ts b/apps/red-ui/src/app/modules/file-preview/services/manual-redaction.service.ts index 9433ff52f..879e5a07e 100644 --- a/apps/red-ui/src/app/modules/file-preview/services/manual-redaction.service.ts +++ b/apps/red-ui/src/app/modules/file-preview/services/manual-redaction.service.ts @@ -12,7 +12,7 @@ import type { } from '@red/domain'; import { type AnnotationWrapper } from '@models/file/annotation.wrapper'; import { GenericService, IqserPermissionsService, List, RequiredParam, Toaster, Validate } from '@iqser/common-ui'; -import { map, tap } from 'rxjs/operators'; +import { tap } from 'rxjs/operators'; import { PermissionsService } from '@services/permissions.service'; import { dictionaryActionsTranslations, manualRedactionActionsTranslations } from '@translations/annotation-actions-translations'; import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker'; @@ -21,7 +21,7 @@ import { ActiveDossiersService } from '@services/dossiers/active-dossiers.servic import { type ManualRedactionEntryType } from '@models/file/manual-redaction-entry.wrapper'; import { NGXLogger } from 'ngx-logger'; import { ROLES } from '@users/roles'; -import { of } from 'rxjs'; +import { firstValueFrom, of } from 'rxjs'; function getResponseType(error: boolean, isConflict: boolean) { const isConflictError = isConflict ? 'conflictError' : 'error'; @@ -54,15 +54,16 @@ export class ManualRedactionService extends GenericService {
}
@Validate()
- addComment(@RequiredParam() comment: string, @RequiredParam() annotationId: string, dossierId: string, fileId: string) {
+ async addComment(@RequiredParam() comment: string, @RequiredParam() annotationId: string, dossierId: string, fileId: string) {
const url = `${this._defaultModelPath}/comment/add/${dossierId}/${fileId}/${annotationId}`;
- return this._post<{ commentId: string }>({ text: comment }, url).pipe(map(res => res.commentId));
+ const request = await firstValueFrom(this._post<{ commentId: string }>({ text: comment }, url));
+ return request.commentId;
}
@Validate()
deleteComment(@RequiredParam() commentId: string, @RequiredParam() annotationId: string, dossierId: string, fileId: string) {
const url = `${this._defaultModelPath}/comment/undo/${dossierId}/${fileId}/${annotationId}/${commentId}`;
- return super.delete({}, url);
+ return firstValueFrom(super.delete({}, url));
}
addRecommendation(annotations: AnnotationWrapper[], dossierId: string, fileId: string, comment = { text: 'Accepted Recommendation' }) {
diff --git a/apps/red-ui/src/app/modules/file-preview/services/pdf-proxy.service.ts b/apps/red-ui/src/app/modules/file-preview/services/pdf-proxy.service.ts
index f3b47a5bb..8592c8b3d 100644
--- a/apps/red-ui/src/app/modules/file-preview/services/pdf-proxy.service.ts
+++ b/apps/red-ui/src/app/modules/file-preview/services/pdf-proxy.service.ts
@@ -112,8 +112,10 @@ export class PdfProxyService {
this._changeDetectorRef.markForCheck();
}
- loadViewer() {
- this._configureElements();
+ configureElements() {
+ const hexColor = this._dictionariesMapService.get(this._state.dossierTemplateId, 'manual').hexColor;
+ const color = this._annotationDrawService.convertColor(hexColor);
+ this._documentViewer.setRectangleToolStyles(color);
}
#deactivateMultiSelect() {
@@ -185,12 +187,6 @@ export class PdfProxyService {
this._annotationsActionsService.cancelResize(null, wrapper).then();
}
- private _configureElements() {
- const hexColor = this._dictionariesMapService.get(this._state.dossierTemplateId, 'manual').hexColor;
- const color = this._annotationDrawService.convertColor(hexColor);
- this._documentViewer.setRectangleToolStyles(color);
- }
-
#configureAnnotationSpecificActions(viewerAnnotations: Annotation[]) {
if (!this.canPerformActions) {
return this._pdf.resetAnnotationActions();