From 64e8ce52427c739fa16067ce3a9b2a2944446db2 Mon Sep 17 00:00:00 2001 From: Timo Bejan Date: Thu, 30 Sep 2021 10:03:36 +0300 Subject: [PATCH] some more cleanup --- .../annotations-list.component.ts | 8 ++------ .../file-workload/file-workload.component.ts | 20 ++++++++----------- 2 files changed, 10 insertions(+), 18 deletions(-) diff --git a/apps/red-ui/src/app/modules/dossier/components/file-workload/components/annotations-list/annotations-list.component.ts b/apps/red-ui/src/app/modules/dossier/components/file-workload/components/annotations-list/annotations-list.component.ts index 3fd072640..391e02415 100644 --- a/apps/red-ui/src/app/modules/dossier/components/file-workload/components/annotations-list/annotations-list.component.ts +++ b/apps/red-ui/src/app/modules/dossier/components/file-workload/components/annotations-list/annotations-list.component.ts @@ -1,4 +1,4 @@ -import { ChangeDetectionStrategy, Component, EventEmitter, Input, OnChanges, Output, TemplateRef } from '@angular/core'; +import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output, TemplateRef } from '@angular/core'; import { AnnotationWrapper } from '@models/file/annotation.wrapper'; import { IqserEventTarget } from '@iqser/common-ui'; @@ -8,7 +8,7 @@ import { IqserEventTarget } from '@iqser/common-ui'; styleUrls: ['./annotations-list.component.scss'], changeDetection: ChangeDetectionStrategy.OnPush }) -export class AnnotationsListComponent implements OnChanges { +export class AnnotationsListComponent { @Input() annotations: AnnotationWrapper[]; @Input() selectedAnnotations: AnnotationWrapper[]; @Input() annotationActionsTemplate: TemplateRef; @@ -45,8 +45,4 @@ export class AnnotationsListComponent implements OnChanges { isSelected(annotationId: string): boolean { return !!this.selectedAnnotations?.find(a => a?.annotationId === annotationId); } - - ngOnChanges(changes: any): void { - console.log('changeeees', changes); - } } diff --git a/apps/red-ui/src/app/modules/dossier/components/file-workload/file-workload.component.ts b/apps/red-ui/src/app/modules/dossier/components/file-workload/file-workload.component.ts index 73fbe26a0..5370f44ed 100644 --- a/apps/red-ui/src/app/modules/dossier/components/file-workload/file-workload.component.ts +++ b/apps/red-ui/src/app/modules/dossier/components/file-workload/file-workload.component.ts @@ -8,7 +8,7 @@ import { FileDataModel } from '@models/file/file-data.model'; import { PermissionsService } from '@services/permissions.service'; import { WebViewerInstance } from '@pdftron/webviewer'; import { BehaviorSubject, combineLatest, Observable } from 'rxjs'; -import { map } from 'rxjs/operators'; +import { map, tap } from 'rxjs/operators'; const COMMAND_KEY_ARRAY = ['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown', 'Escape']; const ALL_HOTKEY_ARRAY = ['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown']; @@ -43,21 +43,22 @@ export class FileWorkloadComponent { @Output() readonly actionPerformed = new EventEmitter(); displayedPages: number[] = []; pagesPanelActive = true; - readonly displayedAnnotations$ = this._displayedAnnotations$; + private _annotations$ = new BehaviorSubject([]); @ViewChild('annotationsElement') private readonly _annotationsElement: ElementRef; @ViewChild('quickNavigation') private readonly _quickNavigationElement: ElementRef; - private _annotations$ = new BehaviorSubject([]); + readonly displayedAnnotations$: Observable>; constructor( private readonly _permissionsService: PermissionsService, private readonly _changeDetectorRef: ChangeDetectorRef, private readonly _filterService: FilterService, private readonly _annotationProcessingService: AnnotationProcessingService - ) {} + ) { + this.displayedAnnotations$ = this._displayedAnnotations$; + } @Input() set annotations(value: AnnotationWrapper[]) { - console.log(value); this._annotations$.next(value); } @@ -96,8 +97,8 @@ export class FileWorkloadComponent { private get _displayedAnnotations$(): Observable> { const primary$ = this._filterService.getFilterModels$('primaryFilters'); const secondary$ = this._filterService.getFilterModels$('secondaryFilters'); - console.log('============', primary$, secondary$); - return combineLatest([this._annotations$, primary$, secondary$]).pipe( + + return combineLatest([this._annotations$.asObservable(), primary$, secondary$]).pipe( map(([annotations, primary, secondary]) => this._filterAnnotations(annotations, primary, secondary)) ); } @@ -113,10 +114,6 @@ export class FileWorkloadComponent { } } - logAnnotation(annotation: AnnotationWrapper) { - console.log(annotation); - } - pageHasSelection(page: number) { return this.multiSelectActive && !!this.selectedAnnotations?.find(a => a.pageNumber === page); } @@ -233,7 +230,6 @@ export class FileWorkloadComponent { primary: INestedFilter[], secondary: INestedFilter[] = [] ): Map { - console.log(this.displayedAnnotations, this.displayedPages, this.annotations); if (!primary) { return; }