RED-3721: Refresh highlights after removal
This commit is contained in:
parent
358b30866b
commit
2614d5fa1e
@ -78,7 +78,7 @@
|
||||
></iqser-circle-button>
|
||||
|
||||
<iqser-circle-button
|
||||
(action)="annotationActionsService.convertHighlights(annotations)"
|
||||
(action)="annotationActionsService.convertHighlights(annotations, annotationsChanged)"
|
||||
*ngIf="(viewModeService.viewMode$ | async) === 'TEXT_HIGHLIGHTS'"
|
||||
[tooltipPosition]="tooltipPosition"
|
||||
[tooltip]="'annotation-actions.convert-highlights.label' | translate"
|
||||
@ -87,7 +87,7 @@
|
||||
></iqser-circle-button>
|
||||
|
||||
<iqser-circle-button
|
||||
(action)="annotationActionsService.removeHighlights(annotations)"
|
||||
(action)="annotationActionsService.removeHighlights(annotations, annotationsChanged)"
|
||||
*ngIf="(viewModeService.viewMode$ | async) === 'TEXT_HIGHLIGHTS'"
|
||||
[tooltipPosition]="tooltipPosition"
|
||||
[tooltip]="'annotation-actions.remove-highlights.label' | translate"
|
||||
|
||||
@ -1,6 +1,10 @@
|
||||
<ng-container *ngFor="let annotation of annotations; let idx = index">
|
||||
<div *ngIf="showHighlightGroup(idx) as highlightGroup" class="workload-separator">
|
||||
<redaction-highlights-separator [annotation]="annotation" [highlightGroup]="highlightGroup"></redaction-highlights-separator>
|
||||
<redaction-highlights-separator
|
||||
(annotationsChanged)="annotationsChanged.emit($event)"
|
||||
[annotation]="annotation"
|
||||
[highlightGroup]="highlightGroup"
|
||||
></redaction-highlights-separator>
|
||||
</div>
|
||||
|
||||
<redaction-annotation-wrapper
|
||||
|
||||
@ -33,6 +33,7 @@ export class AnnotationsListComponent extends HasScrollbarDirective implements O
|
||||
|
||||
@Output() readonly pagesPanelActive = new EventEmitter<boolean>();
|
||||
@Output() readonly selectAnnotations = new EventEmitter<AnnotationWrapper[]>();
|
||||
@Output() readonly annotationsChanged = new EventEmitter<AnnotationWrapper[]>();
|
||||
|
||||
highlightGroups$ = new BehaviorSubject<TextHighlightsGroup[]>([]);
|
||||
|
||||
|
||||
@ -213,6 +213,7 @@
|
||||
</ng-container>
|
||||
|
||||
<redaction-annotations-list
|
||||
(annotationsChanged)="annotationsChanged.emit($event)"
|
||||
(pagesPanelActive)="pagesPanelActive = $event"
|
||||
(selectAnnotations)="selectAnnotations.emit($event)"
|
||||
[activeViewerPage]="activeViewerPage"
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
|
||||
import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output } from '@angular/core';
|
||||
import { CircleButtonTypes } from '@iqser/common-ui';
|
||||
import { TextHighlightOperation, TextHighlightsGroup } from '@red/domain';
|
||||
import { FilePreviewStateService } from '../../services/file-preview-state.service';
|
||||
@ -15,6 +15,7 @@ import { FileDataService } from '../../services/file-data.service';
|
||||
export class HighlightsSeparatorComponent {
|
||||
@Input() highlightGroup: TextHighlightsGroup;
|
||||
@Input() annotation: AnnotationWrapper;
|
||||
@Output() readonly annotationsChanged = new EventEmitter<AnnotationWrapper[]>();
|
||||
|
||||
readonly circleButtonTypes = CircleButtonTypes;
|
||||
readonly isWritable$ = this._state.isWritable$;
|
||||
@ -44,6 +45,7 @@ export class HighlightsSeparatorComponent {
|
||||
operation,
|
||||
highlights,
|
||||
pageNumber: this.annotation.pageNumber,
|
||||
annotationsChanged: this.annotationsChanged,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Component, Inject, Injector } from '@angular/core';
|
||||
import { Component, EventEmitter, Inject, Injector } from '@angular/core';
|
||||
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
||||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
||||
import { TextHighlightOperation, TextHighlightOperationPages } from '@red/domain';
|
||||
@ -15,6 +15,7 @@ export interface HighlightActionData {
|
||||
readonly fileId: string;
|
||||
readonly highlights: AnnotationWrapper[];
|
||||
readonly pageNumber: number;
|
||||
readonly annotationsChanged?: EventEmitter<AnnotationWrapper[]>;
|
||||
}
|
||||
|
||||
@Component({
|
||||
@ -49,6 +50,9 @@ export class HighlightActionDialogComponent extends BaseDialogComponent {
|
||||
|
||||
const ids = filteredHighlights.map(h => h.id);
|
||||
await firstValueFrom(this._textHighlightService.performHighlightsAction(ids, dossierId, fileId, operation));
|
||||
if (this.data.annotationsChanged) {
|
||||
this.data.annotationsChanged.emit(highlights);
|
||||
}
|
||||
this._loadingService.stop();
|
||||
this._dialogRef.close(true);
|
||||
}
|
||||
|
||||
@ -72,13 +72,13 @@ export class AnnotationActionsService {
|
||||
);
|
||||
}
|
||||
|
||||
removeHighlights(highlights: AnnotationWrapper[]): void {
|
||||
const data = this._getHighlightOperationData(TextHighlightOperation.REMOVE, highlights);
|
||||
removeHighlights(highlights: AnnotationWrapper[], annotationsChanged: EventEmitter<AnnotationWrapper[]>): void {
|
||||
const data = this._getHighlightOperationData(TextHighlightOperation.REMOVE, highlights, annotationsChanged);
|
||||
this._dialogService.openDialog('highlightAction', null, data);
|
||||
}
|
||||
|
||||
convertHighlights(highlights: AnnotationWrapper[]): void {
|
||||
const data = this._getHighlightOperationData(TextHighlightOperation.CONVERT, highlights);
|
||||
convertHighlights(highlights: AnnotationWrapper[], annotationsChanged: EventEmitter<AnnotationWrapper[]>): void {
|
||||
const data = this._getHighlightOperationData(TextHighlightOperation.CONVERT, highlights, annotationsChanged);
|
||||
this._dialogService.openDialog('highlightAction', null, data);
|
||||
}
|
||||
|
||||
@ -496,12 +496,17 @@ export class AnnotationActionsService {
|
||||
this._processObsAndEmit(this._manualRedactionService.addAnnotation(requests, dossierId, fileId), annotations, annotationsChanged);
|
||||
}
|
||||
|
||||
private _getHighlightOperationData(operation: TextHighlightOperation, highlights: AnnotationWrapper[]) {
|
||||
private _getHighlightOperationData(
|
||||
operation: TextHighlightOperation,
|
||||
highlights: AnnotationWrapper[],
|
||||
annotationsChanged: EventEmitter<AnnotationWrapper[]>,
|
||||
) {
|
||||
return {
|
||||
dossierId: this._state.dossierId,
|
||||
fileId: this._state.fileId,
|
||||
operation,
|
||||
highlights,
|
||||
annotationsChanged,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -1443,7 +1443,7 @@
|
||||
"save": "Remove Highlights",
|
||||
"title": "Remove highlights"
|
||||
},
|
||||
"success": "{operation, select, convert{Converting} delete{Removing} other{}} highlights in progress...",
|
||||
"success": "{operation, select, convert{Converting highlights in progress...} delete{Successfully removed highlights!} other{}} ",
|
||||
"this-page": "Only for this page"
|
||||
},
|
||||
"highlights": "{color} - {length} {length, plural, one{highlight} other{highlights}}",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user