RED-7980 - displayed pending annotations with only a border in the analysis color
This commit is contained in:
parent
b180adad32
commit
39edbf69e2
@ -64,6 +64,7 @@ export class AnnotationWrapper implements IListable {
|
||||
hasBeenRemovedByManualOverride: boolean;
|
||||
isRemoved = false;
|
||||
isRemovedLocally = false;
|
||||
hiddenInWorkload = false;
|
||||
lastManualChange: ManualRedactionType;
|
||||
|
||||
get isRuleBased() {
|
||||
@ -222,7 +223,8 @@ export class AnnotationWrapper implements IListable {
|
||||
) {
|
||||
const annotationWrapper = new AnnotationWrapper();
|
||||
|
||||
annotationWrapper.id = logEntry.id;
|
||||
annotationWrapper.pending = logEntry.state === EntryStates.PENDING;
|
||||
annotationWrapper.id = logEntry.id + (annotationWrapper.pending ? '-pending' : '');
|
||||
annotationWrapper.isChangeLogEntry = logEntry.state === EntryStates.REMOVED || !!changeLogType;
|
||||
annotationWrapper.type = logEntry.type;
|
||||
annotationWrapper.value = logEntry.value;
|
||||
@ -273,7 +275,6 @@ export class AnnotationWrapper implements IListable {
|
||||
|
||||
const lastRelevantManualChange = logEntry.manualChanges?.at(-1);
|
||||
annotationWrapper.lastManualChange = lastRelevantManualChange?.manualRedactionType;
|
||||
annotationWrapper.pending = logEntry.state === EntryStates.PENDING;
|
||||
if (annotationWrapper.pending) {
|
||||
const removedEntry = allLogEntries.find((e: IEntityLogEntry) => e.id === annotationWrapper.id);
|
||||
logEntry.oldState = removedEntry?.state;
|
||||
@ -286,14 +287,14 @@ export class AnnotationWrapper implements IListable {
|
||||
|
||||
annotationWrapper.typeLabel = dictionary?.virtual ? undefined : dictionary?.label;
|
||||
|
||||
let colorKey = annotationEntityColorConfig[annotationWrapper.superType];
|
||||
if (annotationWrapper.pending && lastRelevantManualChange.manualRedactionType === ManualRedactionTypes.REMOVE_FROM_DICTIONARY) {
|
||||
colorKey = annotationWrapper.isHint
|
||||
? annotationEntityColorConfig[SuperTypes.IgnoredHint]
|
||||
: annotationEntityColorConfig[SuperTypes.Skipped];
|
||||
if (annotationWrapper.pending) {
|
||||
annotationWrapper.color = defaultColors[annotationDefaultColorConfig.analysis] as string;
|
||||
} else {
|
||||
const colorKey = annotationEntityColorConfig[annotationWrapper.superType];
|
||||
const defaultColor = annotationDefaultColorConfig[annotationWrapper.superType];
|
||||
annotationWrapper.color = dictionary ? (dictionary[colorKey] as string) : (defaultColors[defaultColor] as string);
|
||||
}
|
||||
const defaultColor = annotationDefaultColorConfig[annotationWrapper.superType];
|
||||
annotationWrapper.color = dictionary ? (dictionary[colorKey] as string) : (defaultColors[defaultColor] as string);
|
||||
|
||||
annotationWrapper['entry'] = logEntry;
|
||||
|
||||
return annotationWrapper;
|
||||
|
||||
@ -171,6 +171,10 @@ export class AnnotationActionsComponent implements OnChanges {
|
||||
}
|
||||
|
||||
get #annotationChangesAllowed() {
|
||||
return !this.#isDocumine || !this._state.file().excludedFromAutomaticAnalysis;
|
||||
return (!this.#isDocumine || !this._state.file().excludedFromAutomaticAnalysis) && !this.#somePending;
|
||||
}
|
||||
|
||||
get #somePending() {
|
||||
return this.#annotations.some(a => a.pending);
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,6 +10,7 @@
|
||||
|
||||
<div *ngIf="!annotation.item.isEarmark" class="actions-wrapper">
|
||||
<div
|
||||
*ngIf="!annotation.item.pending"
|
||||
(click)="showComments = !showComments"
|
||||
[matTooltip]="'comments.comments' | translate: { count: annotation.item.numberOfComments }"
|
||||
class="comments-counter"
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
</div>
|
||||
|
||||
<redaction-annotation-wrapper
|
||||
*ngIf="!annotation.item.hiddenInWorkload"
|
||||
(click)="annotationClicked(annotation.item, $event)"
|
||||
[annotation]="annotation"
|
||||
[id]="'annotation-' + annotation.item.id"
|
||||
|
||||
@ -124,7 +124,7 @@ export class AnnotationProcessingService {
|
||||
});
|
||||
|
||||
for (const filter of filters) {
|
||||
filter.children.sort((a, b) => a.id.localeCompare(b.id));
|
||||
filter.children.sort((a, b) => a.id?.localeCompare(b.id));
|
||||
handleCheckedValue(filter);
|
||||
if (filter.checked || filter.indeterminate) {
|
||||
filter.expanded = true;
|
||||
|
||||
@ -227,6 +227,7 @@ export class FileDataService extends EntitiesService<AnnotationWrapper, Annotati
|
||||
}
|
||||
|
||||
const changeType = this.#getChangeLogType(entry, file);
|
||||
|
||||
const annotation = AnnotationWrapper.fromData(
|
||||
entry,
|
||||
entityLog.entityLogEntry,
|
||||
@ -237,13 +238,11 @@ export class FileDataService extends EntitiesService<AnnotationWrapper, Annotati
|
||||
defaultColors,
|
||||
);
|
||||
|
||||
if (annotation.pending) {
|
||||
const oldAnnotationIndex = annotations.findIndex(a => a.id === annotation.id && !a.pending);
|
||||
annotations[oldAnnotationIndex] = annotation;
|
||||
continue;
|
||||
}
|
||||
|
||||
annotations.push(annotation);
|
||||
|
||||
if (annotation.pending) {
|
||||
this.#createPendingAnnotations(annotation, annotations);
|
||||
}
|
||||
}
|
||||
|
||||
return annotations;
|
||||
@ -292,4 +291,16 @@ export class FileDataService extends EntitiesService<AnnotationWrapper, Annotati
|
||||
this._viewedPagesMapService.delete(this._state.fileId, viewedPage);
|
||||
}
|
||||
}
|
||||
|
||||
#createPendingAnnotations(annotation: AnnotationWrapper, annotations: AnnotationWrapper[]) {
|
||||
for (let i = 0; i < annotation.positions.length; i++) {
|
||||
const pendingAnnotation = {
|
||||
...annotation,
|
||||
id: `${annotation.id}-${i}`,
|
||||
positions: [annotation.positions[i]],
|
||||
hiddenInWorkload: true,
|
||||
} as AnnotationWrapper;
|
||||
annotations.push(pendingAnnotation);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -396,8 +396,9 @@ export class PdfProxyService {
|
||||
}
|
||||
|
||||
const annotationChangesAllowed = !this.#isDocumine || !this._state.file().excludedFromAutomaticAnalysis;
|
||||
const somePending = annotationWrappers.some(a => a.pending);
|
||||
actions =
|
||||
this._multiSelectService.inactive() && !this._documentViewer.selectedText.length
|
||||
this._multiSelectService.inactive() && !this._documentViewer.selectedText.length && !somePending
|
||||
? [...actions, ...this._pdfAnnotationActionsService.get(annotationWrappers, annotationChangesAllowed)]
|
||||
: [];
|
||||
this._pdf.instance.UI.annotationPopup.update(actions);
|
||||
|
||||
@ -128,6 +128,29 @@ export class AnnotationDrawService {
|
||||
return;
|
||||
}
|
||||
|
||||
if (annotationWrapper.positions.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (annotationWrapper.pending) {
|
||||
const polylineAnnot = this._pdf.polyline();
|
||||
polylineAnnot.ReadOnly = true;
|
||||
polylineAnnot.StrokeColor = this.convertColor(annotationWrapper.color);
|
||||
polylineAnnot.StrokeThickness = 2;
|
||||
polylineAnnot.Id = annotationWrapper.id;
|
||||
polylineAnnot.PageNumber = pageNumber;
|
||||
polylineAnnot.Opacity = polylineAnnot.Id.endsWith('pending') ? 0 : 0.5;
|
||||
console.log(polylineAnnot.Id);
|
||||
console.log(polylineAnnot.Id.split('-'));
|
||||
|
||||
const points = this.#computePolylinePoints(annotationWrapper.positions, annotationWrapper.pageNumber);
|
||||
for (let i = 0; i < points.length; i++) {
|
||||
polylineAnnot.addPathPoint(points[i].x, points[i].y);
|
||||
}
|
||||
|
||||
return polylineAnnot;
|
||||
}
|
||||
|
||||
if (annotationWrapper.superType === SuperTypes.TextHighlight) {
|
||||
const rectangleAnnot = this._pdf.rectangle();
|
||||
const pageHeight = this._documentViewer.getHeight(pageNumber);
|
||||
@ -178,6 +201,24 @@ export class AnnotationDrawService {
|
||||
return annotation;
|
||||
}
|
||||
|
||||
#computePolylinePoints(positions: IRectangle[], pageNumber: number): IPoint[] {
|
||||
const pageHeight = this._documentViewer.getHeight(pageNumber);
|
||||
const points = [this.#topLeft(positions[0], pageHeight)];
|
||||
|
||||
for (let i = 0; i < positions.length; i++) {
|
||||
points.push(this.#topRight(positions[i], pageHeight));
|
||||
points.push(this.#bottomRight(positions[i], pageHeight));
|
||||
}
|
||||
|
||||
for (let i = positions.length - 1; i >= 0; i--) {
|
||||
points.push(this.#bottomLeft(positions[i], pageHeight));
|
||||
points.push(this.#topLeft(positions[i], pageHeight));
|
||||
}
|
||||
|
||||
points.push(this.#topRight(positions[0], pageHeight));
|
||||
return points;
|
||||
}
|
||||
|
||||
#rectanglesToQuads(positions: IRectangle[], pageNumber: number): Quad[] {
|
||||
const pageHeight = this._documentViewer.getHeight(pageNumber);
|
||||
return positions.map(p => this.#rectangleToQuad(p, pageHeight));
|
||||
|
||||
@ -243,6 +243,10 @@ export class PdfViewer {
|
||||
return new this.#instance.Core.Annotations.TextHighlightAnnotation();
|
||||
}
|
||||
|
||||
polyline() {
|
||||
return new this.#instance.Core.Annotations.PolylineAnnotation();
|
||||
}
|
||||
|
||||
isTextHighlight(annotation: Annotation): annotation is TextHighlightAnnotation {
|
||||
return annotation instanceof this.#instance.Core.Annotations.TextHighlightAnnotation;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user