From d688a732912c59e424c3cf613ebd355e9444f8fa Mon Sep 17 00:00:00 2001 From: Edi Cziszter Date: Tue, 25 Jan 2022 20:27:36 +0200 Subject: [PATCH] fix rebase & reference dialog back in list component --- .../annotation-actions.component.html | 4 ++-- .../annotation-actions.component.ts | 4 ++++ .../annotation-card.component.html | 10 ---------- .../annotation-card/annotation-card.component.ts | 16 +--------------- .../annotations-list.component.html | 10 ++++++++++ .../annotations-list.component.ts | 7 +++++++ .../file-preview-screen.component.ts | 14 +------------- .../services/annotation-references.service.ts | 11 +++-------- 8 files changed, 28 insertions(+), 48 deletions(-) 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 ef03f9bd4..2e1736fe0 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-card/annotation-card.component.html b/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/annotation-card/annotation-card.component.html index aef4b4107..a23949aed 100644 --- a/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/annotation-card/annotation-card.component.html +++ b/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/annotation-card/annotation-card.component.html @@ -20,13 +20,3 @@ - - - - diff --git a/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/annotation-card/annotation-card.component.ts b/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/annotation-card/annotation-card.component.ts index 7a796d819..0ce73621e 100644 --- a/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/annotation-card/annotation-card.component.ts +++ b/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/annotation-card/annotation-card.component.ts @@ -2,31 +2,17 @@ import { ChangeDetectionStrategy, Component, Input } from '@angular/core'; import { AnnotationWrapper } from '../../../../../../models/file/annotation.wrapper'; import { File } from '@red/domain'; import { MultiSelectService } from '../../services/multi-select.service'; -import { AnnotationReferencesService } from '../../services/annotation-references.service'; @Component({ selector: 'redaction-annotation-card', templateUrl: './annotation-card.component.html', styleUrls: ['./annotation-card.component.scss'], changeDetection: ChangeDetectionStrategy.OnPush, - providers: [AnnotationReferencesService], }) export class AnnotationCardComponent { @Input() annotation: AnnotationWrapper; @Input() file: File; @Input() isSelected = false; - constructor( - readonly multiSelectService: MultiSelectService, - private readonly _annotationReferenceService: AnnotationReferencesService, - ) { - this._annotationReferenceService.setAnnotation([this.annotation]); - } - - /*referenceClicked(annotation: AnnotationWrapper): void { - this.annotationClicked(annotation, null); - if (this._filterService.filtersEnabled('primaryFilters')) { - this._filterService.toggleFilter('primaryFilters', annotation.superType, true); - } - }*/ + constructor(readonly multiSelectService: MultiSelectService) {} } 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 5a17cc189..c5541b38a 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 @@ -43,3 +43,13 @@ + + + + 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 57e31df57..19877e3bc 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 @@ -53,6 +53,13 @@ export class AnnotationsListComponent implements OnChanges { } } + referenceClicked(annotation: AnnotationWrapper): void { + this.annotationClicked(annotation, null); + if (this._filterService.filtersEnabled('primaryFilters')) { + this._filterService.toggleFilter('primaryFilters', annotation.superType, true); + } + } + isSelected(annotationId: string): boolean { return !!this.selectedAnnotations?.find(a => a?.annotationId === annotationId); } 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 77cfc792e..cdc234bc3 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 @@ -49,6 +49,7 @@ import { SkippedService } from './services/skipped.service'; import { AnnotationActionsService } from './services/annotation-actions.service'; import { FilePreviewStateService } from './services/file-preview-state.service'; import { FileDataModel } from '../../../../models/file/file-data.model'; +import { AnnotationReferencesService } from './services/annotation-references.service'; import Annotation = Core.Annotations.Annotation; import PDFNet = Core.PDFNet; @@ -154,19 +155,6 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni return this._stateService.fileData; } - private _setActiveViewerPage() { - const currentPage = this._instance?.Core.documentViewer?.getCurrentPage(); - if (!currentPage) { - this.activeViewerPage = 1; - } else { - this.activeViewerPage = this.viewModeService.isCompare - ? currentPage % 2 === 0 - ? currentPage / 2 - : (currentPage + 1) / 2 - : currentPage; - } - } - private get _viewDocumentInfo$() { return this.documentInfoService.shown$.pipe( tap(value => { 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 702f0124f..3cbeab42c 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 @@ -2,12 +2,10 @@ import { Injectable } from '@angular/core'; import { BehaviorSubject, Observable } from 'rxjs'; import { shareDistinctLast } from '@iqser/common-ui'; import { AnnotationWrapper } from '@models/file/annotation.wrapper'; -import { map } from 'rxjs/operators'; @Injectable() export class AnnotationReferencesService { readonly annotation$: Observable; - readonly hasReferences$: Observable; readonly showReferences$: Observable; private readonly _annotation$: BehaviorSubject = new BehaviorSubject(null); private readonly _showReferences$: BehaviorSubject = new BehaviorSubject(false); @@ -15,18 +13,15 @@ export class AnnotationReferencesService { constructor() { this.annotation$ = this._annotation$.asObservable().pipe(shareDistinctLast()); this.showReferences$ = this._showReferences$.asObservable().pipe(shareDistinctLast()); - this.hasReferences$ = this.annotation$.pipe(map(annotation => !!annotation.reference && annotation.reference.length !== 0)); } - setAnnotation(annotation: AnnotationWrapper[]): void { - this._annotation$.next(annotation[0]); - } - - show() { + show(annotations: AnnotationWrapper[]) { + this._annotation$.next(annotations[0]); this._showReferences$.next(true); } hide() { + this._annotation$.next(null); this._showReferences$.next(false); } }