From acc67cade4a3570d46c9328cf327bbb113422cc9 Mon Sep 17 00:00:00 2001 From: Edi Cziszter Date: Thu, 27 Jan 2022 13:39:03 +0200 Subject: [PATCH] fix pr comments --- .../src/app/models/file/annotation.wrapper.ts | 4 ++-- .../annotation-actions.component.html | 4 ++-- .../annotation-actions.component.ts | 6 ------ .../annotation-references-list.component.html} | 0 .../annotation-references-list.component.scss} | 0 .../annotation-references-list.component.ts} | 17 +++++++---------- ...ation-references-page-indicator.component.ts | 2 +- .../annotations-list.component.html | 5 ++--- .../file-preview-screen.component.ts | 12 ------------ .../file-preview-screen/file-preview.module.ts | 4 ++-- .../services/annotation-references.service.ts | 13 ++++--------- package.json | 14 +++++++------- 12 files changed, 27 insertions(+), 54 deletions(-) rename apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/{annotation-references-dialog/annotation-references-dialog.component.html => annotation-references-list/annotation-references-list.component.html} (100%) rename apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/{annotation-references-dialog/annotation-references-dialog.component.scss => annotation-references-list/annotation-references-list.component.scss} (100%) rename apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/{annotation-references-dialog/annotation-references-dialog.component.ts => annotation-references-list/annotation-references-list.component.ts} (68%) diff --git a/apps/red-ui/src/app/models/file/annotation.wrapper.ts b/apps/red-ui/src/app/models/file/annotation.wrapper.ts index 9c4ee46e7..6751a0812 100644 --- a/apps/red-ui/src/app/models/file/annotation.wrapper.ts +++ b/apps/red-ui/src/app/models/file/annotation.wrapper.ts @@ -46,7 +46,7 @@ export class AnnotationWrapper { rectangle?: boolean; hintDictionary?: boolean; section?: string; - reference?: Array; + reference: Array; manual?: boolean; @@ -260,7 +260,7 @@ export class AnnotationWrapper { annotationWrapper.manual = redactionLogEntry.manual; annotationWrapper.engines = redactionLogEntry.engines; annotationWrapper.section = redactionLogEntry.section; - annotationWrapper.reference = redactionLogEntry.reference; + annotationWrapper.reference = redactionLogEntry.reference || []; annotationWrapper.rectangle = redactionLogEntry.rectangle; annotationWrapper.hasBeenResized = redactionLogEntry.hasBeenResized; annotationWrapper.hasBeenRecategorized = redactionLogEntry.hasBeenRecategorized; diff --git a/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/annotation-actions/annotation-actions.component.html b/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/annotation-actions/annotation-actions.component.html index 2e1736fe0..6ce94bc3e 100644 --- a/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/annotation-actions/annotation-actions.component.html +++ b/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/annotation-actions/annotation-actions.component.html @@ -88,8 +88,8 @@ > a !== undefined); } - get hasReferences(): boolean { - return !!this.annotations[0].reference && this.annotations[0].reference.length !== 0; - } - get viewerAnnotations() { if (this.viewer?.Core.annotationManager) { return this._annotations.map(a => this.viewer?.Core.annotationManager?.getAnnotationById(a.id)); diff --git a/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/annotation-references-dialog/annotation-references-dialog.component.html b/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/annotation-references-list/annotation-references-list.component.html similarity index 100% rename from apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/annotation-references-dialog/annotation-references-dialog.component.html rename to apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/annotation-references-list/annotation-references-list.component.html diff --git a/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/annotation-references-dialog/annotation-references-dialog.component.scss b/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/annotation-references-list/annotation-references-list.component.scss similarity index 100% rename from apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/annotation-references-dialog/annotation-references-dialog.component.scss rename to apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/annotation-references-list/annotation-references-list.component.scss diff --git a/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/annotation-references-dialog/annotation-references-dialog.component.ts b/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/annotation-references-list/annotation-references-list.component.ts similarity index 68% rename from apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/annotation-references-dialog/annotation-references-dialog.component.ts rename to apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/annotation-references-list/annotation-references-list.component.ts index 60db300f1..892e6be51 100644 --- a/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/annotation-references-dialog/annotation-references-dialog.component.ts +++ b/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/annotation-references-list/annotation-references-list.component.ts @@ -5,18 +5,15 @@ import { File } from '@red/domain'; import { FileDataModel } from '@models/file/file-data.model'; @Component({ - selector: 'redaction-annotation-references-dialog', - templateUrl: './annotation-references-dialog.component.html', - styleUrls: ['./annotation-references-dialog.component.scss'], + selector: 'redaction-annotation-references-list', + templateUrl: './annotation-references-list.component.html', + styleUrls: ['./annotation-references-list.component.scss'], changeDetection: ChangeDetectionStrategy.OnPush, }) -export class AnnotationReferencesDialogComponent implements OnChanges { - @Input() - annotation: AnnotationWrapper; - @Input() - file: File; - @Input() - fileData: FileDataModel; +export class AnnotationReferencesListComponent implements OnChanges { + @Input() annotation: AnnotationWrapper; + @Input() file: File; + @Input() fileData: FileDataModel; @Output() readonly referenceClicked = new EventEmitter(); annotationReferences: AnnotationWrapper[]; diff --git a/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/annotation-references-page-indicator/annotation-references-page-indicator.component.ts b/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/annotation-references-page-indicator/annotation-references-page-indicator.component.ts index 1bb4e131a..55edb86bc 100644 --- a/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/annotation-references-page-indicator/annotation-references-page-indicator.component.ts +++ b/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/annotation-references-page-indicator/annotation-references-page-indicator.component.ts @@ -7,5 +7,5 @@ import { ChangeDetectionStrategy, Component, Input } from '@angular/core'; changeDetection: ChangeDetectionStrategy.OnPush, }) export class AnnotationReferencesPageIndicatorComponent { - @Input() number; + @Input() number: number; } 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 c5541b38a..8f11088a1 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 @@ -45,11 +45,10 @@ - + > 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 cdc234bc3..006d1700e 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 @@ -155,18 +155,6 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni return this._stateService.fileData; } - private get _viewDocumentInfo$() { - return this.documentInfoService.shown$.pipe( - tap(value => { - if (value) { - this.multiSelectService.deactivate(); - this.excludedPagesService.hide(); - } - }), - shareDistinctLast(), - ); - } - private get _canPerformAnnotationActions$() { return combineLatest([ this._stateService.fileData$.pipe(switchMap(fileData => fileData.file$)), diff --git a/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/file-preview.module.ts b/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/file-preview.module.ts index ee9ce8bf2..386d9c254 100644 --- a/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/file-preview.module.ts +++ b/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/file-preview.module.ts @@ -19,7 +19,7 @@ import { TypeAnnotationIconComponent } from './components/type-annotation-icon/t import { OverlayModule } from '@angular/cdk/overlay'; import { ViewSwitchComponent } from './components/view-switch/view-switch.component'; import { UserManagementComponent } from './components/user-management/user-management.component'; -import { AnnotationReferencesDialogComponent } from './components/annotation-references-dialog/annotation-references-dialog.component'; +import { AnnotationReferencesListComponent } from './components/annotation-references-list/annotation-references-list.component'; import { AcceptRecommendationDialogComponent } from './dialogs/accept-recommendation-dialog/accept-recommendation-dialog.component'; import { AnnotationCardComponent } from './components/annotation-card/annotation-card.component'; import { AnnotationReferencesPageIndicatorComponent } from './components/annotation-references-page-indicator/annotation-references-page-indicator.component'; @@ -49,7 +49,7 @@ const routes: Routes = [ ViewSwitchComponent, UserManagementComponent, AcceptRecommendationDialogComponent, - AnnotationReferencesDialogComponent, + AnnotationReferencesListComponent, AnnotationCardComponent, AnnotationReferencesPageIndicatorComponent, ], diff --git a/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/services/annotation-references.service.ts b/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/services/annotation-references.service.ts index 3cbeab42c..5cdca8162 100644 --- a/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/services/annotation-references.service.ts +++ b/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/services/annotation-references.service.ts @@ -6,22 +6,17 @@ import { AnnotationWrapper } from '@models/file/annotation.wrapper'; @Injectable() export class AnnotationReferencesService { readonly annotation$: Observable; - readonly showReferences$: Observable; - private readonly _annotation$: BehaviorSubject = new BehaviorSubject(null); - private readonly _showReferences$: BehaviorSubject = new BehaviorSubject(false); + private readonly _annotation$ = new BehaviorSubject(undefined); constructor() { this.annotation$ = this._annotation$.asObservable().pipe(shareDistinctLast()); - this.showReferences$ = this._showReferences$.asObservable().pipe(shareDistinctLast()); } - show(annotations: AnnotationWrapper[]) { - this._annotation$.next(annotations[0]); - this._showReferences$.next(true); + show(annotation: AnnotationWrapper) { + this._annotation$.next(annotation); } hide() { - this._annotation$.next(null); - this._showReferences$.next(false); + this._annotation$.next(undefined); } } diff --git a/package.json b/package.json index 329e0c1ab..150d95c88 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "@materia-ui/ngx-monaco-editor": "^6.0.0", "@ngx-translate/core": "^14.0.0", "@ngx-translate/http-loader": "^7.0.0", - "@nrwl/angular": "13.4.5", + "@nrwl/angular": "13.5.3", "@pdftron/webviewer": "8.2.0", "@swimlane/ngx-charts": "^20.0.1", "file-saver": "^2.0.5", @@ -70,12 +70,12 @@ "@angular/compiler-cli": "13.1.2", "@angular/language-service": "13.1.2", "@bartholomej/ngx-translate-extract": "^8.0.2", - "@nrwl/cli": "13.4.5", - "@nrwl/eslint-plugin-nx": "13.4.5", - "@nrwl/jest": "13.4.5", - "@nrwl/linter": "13.4.5", - "@nrwl/tao": "13.4.5", - "@nrwl/workspace": "13.4.5", + "@nrwl/cli": "13.5.3", + "@nrwl/eslint-plugin-nx": "13.5.3", + "@nrwl/jest": "13.5.3", + "@nrwl/linter": "13.5.3", + "@nrwl/tao": "13.5.3", + "@nrwl/workspace": "13.5.3", "@types/jest": "27.4.0", "@types/lodash": "^4.14.178", "@types/node": "17.0.9",