fixed some pr comments
This commit is contained in:
parent
e35290029b
commit
b795b50c84
@ -89,7 +89,7 @@
|
||||
|
||||
<iqser-circle-button
|
||||
(action)="annotationReferencesService.show(annotations)"
|
||||
*ngIf="annotationReferencesService.hasReferences(annotations) && !multiSelectService.isActive"
|
||||
*ngIf="referencesButtonEnabled"
|
||||
[tooltipPosition]="tooltipPosition"
|
||||
[tooltip]="'annotation-actions.see-references.label' | translate"
|
||||
[type]="buttonType"
|
||||
|
||||
@ -41,6 +41,7 @@ export class AnnotationActionsComponent implements OnChanges {
|
||||
@Input() @Required() file!: File;
|
||||
@Output() annotationsChanged = new EventEmitter<AnnotationWrapper>();
|
||||
annotationPermissions: AnnotationPermissions;
|
||||
referencesButtonEnabled = false;
|
||||
|
||||
constructor(
|
||||
private readonly _manualAnnotationService: ManualAnnotationService,
|
||||
@ -63,6 +64,8 @@ export class AnnotationActionsComponent implements OnChanges {
|
||||
@Input()
|
||||
set annotations(value: AnnotationWrapper[]) {
|
||||
this._annotations = value.filter(a => a !== undefined);
|
||||
this.referencesButtonEnabled =
|
||||
this.annotationReferencesService.hasReferences(this._annotations) && !this.multiSelectService.isActive;
|
||||
}
|
||||
|
||||
get viewerAnnotations() {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Component, Input } from '@angular/core';
|
||||
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';
|
||||
@ -7,6 +7,7 @@ import { MultiSelectService } from '../../services/multi-select.service';
|
||||
selector: 'redaction-annotation-card',
|
||||
templateUrl: './annotation-card.component.html',
|
||||
styleUrls: ['./annotation-card.component.scss'],
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
})
|
||||
export class AnnotationCardComponent {
|
||||
@Input() annotation: AnnotationWrapper;
|
||||
|
||||
@ -1,51 +1,29 @@
|
||||
import { Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges } from '@angular/core';
|
||||
import { ChangeDetectionStrategy, Component, EventEmitter, Input, OnChanges, Output, SimpleChanges } from '@angular/core';
|
||||
import { AnnotationWrapper } from '@models/file/annotation.wrapper';
|
||||
import { AnnotationReferencesService } from '../../services/annotation-references.service';
|
||||
import { File } from '@red/domain';
|
||||
import { PdfViewerDataService } from '../../../../services/pdf-viewer-data.service';
|
||||
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'],
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
})
|
||||
export class AnnotationReferencesDialogComponent implements OnInit, OnChanges {
|
||||
export class AnnotationReferencesDialogComponent implements OnChanges {
|
||||
@Input()
|
||||
annotation: AnnotationWrapper;
|
||||
@Input()
|
||||
file: File;
|
||||
@Input()
|
||||
fileData: FileDataModel;
|
||||
@Output()
|
||||
readonly referenceClicked = new EventEmitter<AnnotationWrapper>();
|
||||
fileData: FileDataModel;
|
||||
annotationReferences: AnnotationWrapper[];
|
||||
|
||||
constructor(
|
||||
readonly annotationReferencesService: AnnotationReferencesService,
|
||||
private readonly _fileDownloadService: PdfViewerDataService,
|
||||
) {}
|
||||
constructor(readonly annotationReferencesService: AnnotationReferencesService) {}
|
||||
|
||||
async ngOnInit(): Promise<void> {
|
||||
console.log(this.annotation);
|
||||
await this.setReferences();
|
||||
}
|
||||
|
||||
async ngOnChanges(changes: SimpleChanges): Promise<void> {
|
||||
await this.setReferences();
|
||||
}
|
||||
|
||||
async setReferences(): Promise<void> {
|
||||
await this._loadFileData(this.file);
|
||||
ngOnChanges(changes: SimpleChanges): void {
|
||||
this.annotationReferences = this.fileData.allAnnotations.filter(a => this.annotation.reference.includes(a.annotationId));
|
||||
}
|
||||
|
||||
private async _loadFileData(file: File): Promise<void> {
|
||||
const fileData = await this._fileDownloadService.loadDataFor(file, this.fileData).toPromise();
|
||||
|
||||
if (file.isPending) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.fileData = fileData;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,9 +1,10 @@
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { ChangeDetectionStrategy, 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;
|
||||
|
||||
@ -45,8 +45,9 @@
|
||||
</div>
|
||||
|
||||
<redaction-annotation-references-dialog
|
||||
(referenceClicked)="referenceClicked($event)"
|
||||
*ngIf="annotationReferencesService.annotation$ | async as annotation"
|
||||
[annotation]="annotation"
|
||||
[fileData]="fileData"
|
||||
[file]="file"
|
||||
(referenceClicked)="referenceClicked($event)"
|
||||
></redaction-annotation-references-dialog>
|
||||
|
||||
@ -4,6 +4,7 @@ import { FilterService, HelpModeService, IqserEventTarget } from '@iqser/common-
|
||||
import { File } from '@red/domain';
|
||||
import { MultiSelectService } from '../../services/multi-select.service';
|
||||
import { AnnotationReferencesService } from '../../services/annotation-references.service';
|
||||
import { FileDataModel } from '../../../../../../models/file/file-data.model';
|
||||
|
||||
@Component({
|
||||
selector: 'redaction-annotations-list',
|
||||
@ -13,6 +14,7 @@ import { AnnotationReferencesService } from '../../services/annotation-reference
|
||||
})
|
||||
export class AnnotationsListComponent implements OnChanges {
|
||||
@Input() file: File;
|
||||
@Input() fileData: FileDataModel;
|
||||
@Input() annotations: AnnotationWrapper[];
|
||||
@Input() selectedAnnotations: AnnotationWrapper[];
|
||||
@Input() annotationActionsTemplate: TemplateRef<unknown>;
|
||||
@ -54,18 +56,10 @@ export class AnnotationsListComponent implements OnChanges {
|
||||
referenceClicked(annotation: AnnotationWrapper): void {
|
||||
this.annotationClicked(annotation, null);
|
||||
if (this._filterService.filtersEnabled('primaryFilters')) {
|
||||
this.toggleFilterAndChildren(annotation);
|
||||
this._filterService.toggleFilter('primaryFilters', annotation.superType);
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@ -203,6 +203,7 @@
|
||||
[annotationActionsTemplate]="annotationActionsTemplate"
|
||||
[annotations]="(displayedAnnotations$ | async)?.get(activeViewerPage)"
|
||||
[canMultiSelect]="!isReadOnly"
|
||||
[fileData]="fileData"
|
||||
[file]="file"
|
||||
[selectedAnnotations]="selectedAnnotations"
|
||||
iqserHelpMode="workload-annotations-list"
|
||||
|
||||
@ -107,6 +107,7 @@
|
||||
[annotationActionsTemplate]="annotationActionsTemplate"
|
||||
[annotations]="visibleAnnotations"
|
||||
[dialogRef]="dialogRef"
|
||||
[fileData]="fileData"
|
||||
[file]="file"
|
||||
[selectedAnnotations]="selectedAnnotations"
|
||||
[viewer]="activeViewer"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user