annotation flows
This commit is contained in:
parent
d323bbcb96
commit
55c8706a9d
@ -4,7 +4,7 @@
|
||||
<button (click)="acceptSuggestion($event, annotation, annotation.modifyDictionary)" *ngIf="annotation.isSuggestion" mat-icon-button>
|
||||
<mat-icon svgIcon="red:check-alt"></mat-icon>
|
||||
</button>
|
||||
<button (click)="rejectSuggestion($event, annotation)" *ngIf="annotation.isSuggestion" mat-icon-button>
|
||||
<button (click)="rejectSuggestion($event, annotation)" *ngIf="annotation.isSuggestion && !canUndoAnnotation()" mat-icon-button>
|
||||
<mat-icon svgIcon="red:close"></mat-icon>
|
||||
</button>
|
||||
</ng-container>
|
||||
@ -17,14 +17,14 @@
|
||||
<!-- Everyone can suggest to remove annotations, manager will remove directly while user will make a suggestion-->
|
||||
|
||||
<!-- For Suggesting Removal, in case of hints, the user can suggest removal from dictionary -->
|
||||
<button (click)="suggestRemoveAnnotation($event, annotation, true)" *ngIf="annotation.superType === 'hint'" mat-icon-button>
|
||||
<button (click)="suggestRemoveAnnotation($event, annotation, true)" *ngIf="annotation.superType === 'hint' && !canUndoAnnotation()" mat-icon-button>
|
||||
<mat-icon svgIcon="red:trash"></mat-icon>
|
||||
</button>
|
||||
|
||||
<!-- For Suggesting Removal, in case of redactions, the user can suggest only-here or everywhere-->
|
||||
<button
|
||||
(click)="openMenu($event)"
|
||||
*ngIf="annotation.superType === 'redaction'"
|
||||
*ngIf="annotation.superType === 'redaction' && !canUndoAnnotation()"
|
||||
[class.active]="menuOpen"
|
||||
[matMenuTriggerFor]="menu"
|
||||
class="confirm"
|
||||
@ -34,11 +34,11 @@
|
||||
</button>
|
||||
<mat-menu #menu="matMenu" (closed)="onMenuClosed()" xPosition="before">
|
||||
<div (click)="suggestRemoveAnnotation($event, annotation, true)" mat-menu-item>
|
||||
<redaction-type-annotation-icon [annotation]="annotation"></redaction-type-annotation-icon>
|
||||
<redaction-annotation-icon [type]="'rhombus'" [label]="'S'" [color]="dictionaryColor"></redaction-annotation-icon>
|
||||
<div [translate]="'file-preview.tabs.annotations.remove-annotation.remove-from-dict'"></div>
|
||||
</div>
|
||||
<div (click)="suggestRemoveAnnotation($event, annotation, false)" mat-menu-item>
|
||||
<redaction-type-annotation-icon [annotation]="annotation"></redaction-type-annotation-icon>
|
||||
<redaction-annotation-icon [type]="'rhombus'" [label]="'S'" [color]="suggestionColor"></redaction-annotation-icon>
|
||||
<div translate="file-preview.tabs.annotations.remove-annotation.only-here"></div>
|
||||
</div>
|
||||
</mat-menu>
|
||||
|
||||
@ -80,4 +80,12 @@ export class AnnotationActionsComponent implements OnInit {
|
||||
this.annotation.manual && this.annotation.userId === this.permissionsService.currentUserId && this.permissionsService.isManagerAndOwner();
|
||||
return isSuggestionOfCurrentUser || isManualAnnotationOfCurrentUser;
|
||||
}
|
||||
|
||||
get suggestionColor() {
|
||||
return this.appStateService.getDictionaryColor('suggestion');
|
||||
}
|
||||
|
||||
get dictionaryColor() {
|
||||
return this.appStateService.getDictionaryColor('suggestion-dictionary');
|
||||
}
|
||||
}
|
||||
|
||||
@ -61,6 +61,9 @@ export class AnnotationWrapper {
|
||||
// do not draw if it is no longer in the manual redactions
|
||||
annotationWrapper.shouldDraw = false;
|
||||
}
|
||||
if (manualRedactionEntry) {
|
||||
annotationWrapper.shouldDraw = manualRedactionEntry.status === 'REQUESTED' || manualRedactionEntry.status === 'APPROVED';
|
||||
}
|
||||
}
|
||||
|
||||
annotationWrapper.id = redactionLogEntry.id;
|
||||
@ -74,7 +77,6 @@ export class AnnotationWrapper {
|
||||
// either marked as manual or idRemove or manualRedactionEntry exists
|
||||
annotationWrapper.manual = redactionLogEntry.manual;
|
||||
annotationWrapper.modifyDictionary = !!manualRedactionEntry?.addToDictionary || !!idRemoval?.removeFromDictionary;
|
||||
AnnotationWrapper._setSuperType(annotationWrapper, redactionLogEntry, manualRedactionEntry, idRemoval);
|
||||
} else {
|
||||
const dictionary = dictionaryData[manualRedactionEntry.type];
|
||||
annotationWrapper.id = manualRedactionEntry.id;
|
||||
@ -86,12 +88,13 @@ export class AnnotationWrapper {
|
||||
annotationWrapper.positions = manualRedactionEntry.positions;
|
||||
annotationWrapper.content = manualRedactionEntry.addToDictionary ? null : AnnotationWrapper.createContent(manualRedactionEntry);
|
||||
annotationWrapper.manual = true;
|
||||
annotationWrapper.shouldDraw = manualRedactionEntry.status === 'REQUESTED' || manualRedactionEntry.status === 'APPROVED';
|
||||
annotationWrapper.comments = comments[manualRedactionEntry.id] ? comments[manualRedactionEntry.id] : [];
|
||||
annotationWrapper.userId = manualRedactionEntry.user;
|
||||
annotationWrapper.modifyDictionary = manualRedactionEntry.addToDictionary;
|
||||
AnnotationWrapper._setSuperType(annotationWrapper, redactionLogEntry, manualRedactionEntry, idRemoval);
|
||||
}
|
||||
|
||||
AnnotationWrapper._setSuperType(annotationWrapper, redactionLogEntry, manualRedactionEntry, idRemoval);
|
||||
AnnotationWrapper._setTypeLabel(annotationWrapper);
|
||||
|
||||
return annotationWrapper;
|
||||
@ -103,6 +106,25 @@ export class AnnotationWrapper {
|
||||
manualRedactionEntry?: ManualRedactionEntry,
|
||||
idRemoval?: IdRemoval
|
||||
) {
|
||||
if (idRemoval && manualRedactionEntry) {
|
||||
const handleManualRedactionFirst = new Date(idRemoval.requestDate).getTime() > new Date(manualRedactionEntry.requestDate).getTime();
|
||||
if (handleManualRedactionFirst) {
|
||||
AnnotationWrapper._handleManualRedaction(annotationWrapper, manualRedactionEntry);
|
||||
AnnotationWrapper._handleIdRemoval(annotationWrapper, idRemoval);
|
||||
} else {
|
||||
AnnotationWrapper._handleIdRemoval(annotationWrapper, idRemoval);
|
||||
AnnotationWrapper._handleManualRedaction(annotationWrapper, manualRedactionEntry);
|
||||
}
|
||||
} else {
|
||||
AnnotationWrapper._handleIdRemoval(annotationWrapper, idRemoval);
|
||||
AnnotationWrapper._handleManualRedaction(annotationWrapper, manualRedactionEntry);
|
||||
}
|
||||
if (!annotationWrapper.superType) {
|
||||
annotationWrapper.superType = annotationWrapper.redaction ? 'redaction' : annotationWrapper.hint ? 'hint' : 'ignore';
|
||||
}
|
||||
}
|
||||
|
||||
private static _handleIdRemoval(annotationWrapper: AnnotationWrapper, idRemoval?: IdRemoval) {
|
||||
if (idRemoval) {
|
||||
if (idRemoval.status === 'REQUESTED') {
|
||||
annotationWrapper.superType = 'suggestion-remove';
|
||||
@ -111,6 +133,9 @@ export class AnnotationWrapper {
|
||||
annotationWrapper.superType = 'ignore';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static _handleManualRedaction(annotationWrapper: AnnotationWrapper, manualRedactionEntry?: ManualRedactionEntry) {
|
||||
if (manualRedactionEntry) {
|
||||
if (manualRedactionEntry.status === 'REQUESTED') {
|
||||
annotationWrapper.superType = 'suggestion';
|
||||
@ -119,9 +144,6 @@ export class AnnotationWrapper {
|
||||
annotationWrapper.superType = annotationWrapper.redaction ? 'redaction' : annotationWrapper.hint ? 'hint' : 'ignore';
|
||||
}
|
||||
}
|
||||
if (!annotationWrapper.superType) {
|
||||
annotationWrapper.superType = annotationWrapper.redaction ? 'redaction' : annotationWrapper.hint ? 'hint' : 'ignore';
|
||||
}
|
||||
}
|
||||
|
||||
private static _setTypeLabel(annotationWrapper: AnnotationWrapper) {
|
||||
|
||||
@ -52,23 +52,31 @@ export class FileDataModel {
|
||||
const pairs: AnnotationPair[] = [];
|
||||
|
||||
this.redactionLog.redactionLogEntry.forEach((rdl) => {
|
||||
pairs.push({
|
||||
redactionLogEntry: rdl,
|
||||
manualRedactionEntry: this.manualRedactions.entriesToAdd.find((eta) => eta.id === rdl.id),
|
||||
idRemoval: this.manualRedactions.idsToRemove.find((idr) => idr.id === rdl.id),
|
||||
comments: this.manualRedactions.comments[rdl.id]
|
||||
});
|
||||
if (rdl.status !== 'DECLINED') {
|
||||
pairs.push({
|
||||
redactionLogEntry: rdl,
|
||||
// only not declined
|
||||
manualRedactionEntry: this.manualRedactions.entriesToAdd.find((eta) => eta.id === rdl.id && eta.status !== 'DECLINED'),
|
||||
// only not declined
|
||||
idRemoval: this.manualRedactions.idsToRemove.find((idr) => idr.id === rdl.id && idr.status !== 'DECLINED'),
|
||||
comments: this.manualRedactions.comments[rdl.id]
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
this.manualRedactions.entriesToAdd.forEach((eta) => {
|
||||
const redactionLogEntry = this.redactionLog.redactionLogEntry.find((rdl) => rdl.id === eta.id);
|
||||
if (!redactionLogEntry) {
|
||||
pairs.push({
|
||||
redactionLogEntry: null,
|
||||
manualRedactionEntry: eta,
|
||||
idRemoval: this.manualRedactions.idsToRemove.find((idr) => idr.id === eta.id),
|
||||
comments: this.manualRedactions.comments[eta.id]
|
||||
});
|
||||
// only not declined
|
||||
if (eta.status !== 'DECLINED') {
|
||||
const redactionLogEntry = this.redactionLog.redactionLogEntry.find((rdl) => rdl.id === eta.id);
|
||||
if (!redactionLogEntry) {
|
||||
pairs.push({
|
||||
redactionLogEntry: null,
|
||||
manualRedactionEntry: eta,
|
||||
// only not declined
|
||||
idRemoval: this.manualRedactions.idsToRemove.find((idr) => idr.id === eta.id && idr.status !== 'DECLINED'),
|
||||
comments: this.manualRedactions.comments[eta.id]
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@ -57,37 +57,39 @@ export class AnnotationProcessingService {
|
||||
flatFilters.push(...filter.filters);
|
||||
});
|
||||
for (const annotation of annotations) {
|
||||
const pageNumber = annotation.pageNumber;
|
||||
const type = annotation.superType;
|
||||
if (annotation.shouldDraw) {
|
||||
const pageNumber = annotation.pageNumber;
|
||||
const type = annotation.superType;
|
||||
|
||||
if (hasActiveFilters) {
|
||||
let found = false;
|
||||
for (const filter of flatFilters) {
|
||||
if (
|
||||
filter.checked &&
|
||||
((filter.key === annotation.dictionary && (annotation.superType === 'hint' || annotation.superType === 'redaction')) ||
|
||||
filter.key === annotation.superType)
|
||||
) {
|
||||
found = true;
|
||||
break;
|
||||
if (hasActiveFilters) {
|
||||
let found = false;
|
||||
for (const filter of flatFilters) {
|
||||
if (
|
||||
filter.checked &&
|
||||
((filter.key === annotation.dictionary && (annotation.superType === 'hint' || annotation.superType === 'redaction')) ||
|
||||
filter.key === annotation.superType)
|
||||
) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (!obj[pageNumber]) {
|
||||
obj[pageNumber] = {
|
||||
annotations: [],
|
||||
hint: 0,
|
||||
redaction: 0,
|
||||
request: 0,
|
||||
ignore: 0
|
||||
};
|
||||
if (!obj[pageNumber]) {
|
||||
obj[pageNumber] = {
|
||||
annotations: [],
|
||||
hint: 0,
|
||||
redaction: 0,
|
||||
request: 0,
|
||||
ignore: 0
|
||||
};
|
||||
}
|
||||
obj[pageNumber].annotations.push(annotation);
|
||||
obj[pageNumber][type]++;
|
||||
}
|
||||
obj[pageNumber].annotations.push(annotation);
|
||||
obj[pageNumber][type]++;
|
||||
}
|
||||
|
||||
Object.keys(obj).map((page) => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user