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