From 22b9a51210e83e466cbfc4876f9ee579e1106580 Mon Sep 17 00:00:00 2001 From: Edi Cziszter Date: Fri, 14 Jan 2022 15:24:04 +0200 Subject: [PATCH] apply filters when reference is clicked --- ...annotation-references-dialog.component.scss | 2 ++ .../annotations-list.component.html | 2 +- .../annotations-list.component.ts | 18 +++++++++++++++++- 3 files changed, 20 insertions(+), 2 deletions(-) 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-dialog/annotation-references-dialog.component.scss index 6fc20e682..f54b24b62 100644 --- 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-dialog/annotation-references-dialog.component.scss @@ -4,6 +4,7 @@ position: fixed; margin: 0; width: 280px; + max-height: 380px; right: 370px; top: 165px; @@ -15,6 +16,7 @@ .annotations-container { flex-direction: column; + overflow: auto; .annotation-container { width: 100%; 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 ed812c15b..1a9e22ec7 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 @@ -48,5 +48,5 @@ *ngIf="annotationReferencesService.annotation$ | async as annotation" [annotation]="annotation" [file]="file" - (referenceClicked)="annotationClicked($event, null)" + (referenceClicked)="referenceClicked($event)" > 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 16ad21f1e..a3583836d 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,6 +1,6 @@ import { ChangeDetectionStrategy, Component, EventEmitter, Input, OnChanges, Output, SimpleChanges, TemplateRef } from '@angular/core'; import { AnnotationWrapper } from '@models/file/annotation.wrapper'; -import { HelpModeService, IqserEventTarget } from '@iqser/common-ui'; +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'; @@ -27,6 +27,7 @@ export class AnnotationsListComponent implements OnChanges { readonly multiSelectService: MultiSelectService, readonly helpModeService: HelpModeService, readonly annotationReferencesService: AnnotationReferencesService, + private readonly _filterService: FilterService, ) {} ngOnChanges(changes: SimpleChanges): void { @@ -50,6 +51,21 @@ export class AnnotationsListComponent implements OnChanges { } } + referenceClicked(annotation: AnnotationWrapper): void { + this.annotationClicked(annotation, null); + if (this._filterService.filtersEnabled('primaryFilters')) { + this.toggleFilterAndChildren(annotation); + } + } + + toggleFilterAndChildren(annotation: AnnotationWrapper): void { + const primaryFilters = this._filterService.getGroup('primaryFilters'); + const filter = primaryFilters.filters.find(f => f.id === annotation.superType); + filter.checked = true; + filter.children.forEach(f => (f.checked = true)); + this._filterService.refresh(); + } + isSelected(annotationId: string): boolean { return !!this.selectedAnnotations?.find(a => a?.annotationId === annotationId); }