remove requests
This commit is contained in:
parent
fba043fc43
commit
dcb65e0b05
@ -1,3 +1,4 @@
|
||||
<div class="icon" [class.hint]="typeValue.hint" [style.background-color]="typeValue.hexColor">
|
||||
<span>{{ typeValue.type[0] }}</span>
|
||||
<div class="icon" [class.hint]="typeValue?.hint" [style.background-color]="typeValue?.hexColor">
|
||||
<span>{{ (typeValue?.type)[0] }}</span>
|
||||
<!-- {{typeValue | json }}-->
|
||||
</div>
|
||||
|
||||
@ -178,7 +178,8 @@
|
||||
(click)="openAcceptSuggestionMenu($event, annotation)"
|
||||
*ngIf="
|
||||
appStateService.isActiveProjectOwnerAndManager &&
|
||||
annotation.superType === 'request'
|
||||
(annotation.superType === 'request' ||
|
||||
annotation.superType === 'request-remove')
|
||||
"
|
||||
[class.active]="isAnnotationMenuOpen(annotation)"
|
||||
[matMenuTriggerFor]="menu"
|
||||
@ -219,7 +220,10 @@
|
||||
</mat-menu>
|
||||
<button
|
||||
(click)="rejectSuggestion($event, annotation)"
|
||||
*ngIf="annotation.superType === 'request'"
|
||||
*ngIf="
|
||||
annotation.superType === 'request' ||
|
||||
annotation.superType === 'request-remove'
|
||||
"
|
||||
mat-icon-button
|
||||
>
|
||||
<mat-icon svgIcon="red:trash"></mat-icon>
|
||||
|
||||
@ -138,7 +138,7 @@ export class FilePreviewScreenComponent implements OnInit {
|
||||
const manualRedactionAnnotations = this.fileData.entriesToAdd.map((mr) =>
|
||||
AnnotationWrapper.fromManualRedaction(
|
||||
mr,
|
||||
this.fileData.manualRedactions.comments,
|
||||
this.fileData.manualRedactions,
|
||||
this.appStateService.dictionaryData
|
||||
)
|
||||
);
|
||||
@ -308,7 +308,9 @@ export class FilePreviewScreenComponent implements OnInit {
|
||||
$event,
|
||||
annotation,
|
||||
() => {
|
||||
annotation.superType = 'ignore';
|
||||
annotation.superType = this.appStateService.isActiveProjectOwnerAndManager
|
||||
? 'ignore'
|
||||
: 'request-remove';
|
||||
this._cleanupAndRedrawManualAnnotations();
|
||||
}
|
||||
);
|
||||
|
||||
@ -8,7 +8,7 @@ import {
|
||||
} from '@redaction/red-ui-http';
|
||||
|
||||
export class AnnotationWrapper {
|
||||
superType: 'request' | 'redaction' | 'hint' | 'ignore';
|
||||
superType: 'request' | 'redaction' | 'hint' | 'ignore' | 'request-remove';
|
||||
dictionary: string;
|
||||
color: string;
|
||||
comments: Comment[] = [];
|
||||
@ -25,20 +25,17 @@ export class AnnotationWrapper {
|
||||
) {
|
||||
const comments: { [key: string]: Array<Comment> } = manualRedactions.comments;
|
||||
const annotationWrapper = new AnnotationWrapper();
|
||||
annotationWrapper.id = redactionLogEntry.id;
|
||||
annotationWrapper.superType = redactionLogEntry.redacted
|
||||
? 'redaction'
|
||||
: redactionLogEntry.hint
|
||||
? 'hint'
|
||||
: 'ignore';
|
||||
annotationWrapper.superType = manualRedactions.idsToRemove.find(
|
||||
(toRemove) => toRemove.id === redactionLogEntry.id
|
||||
)
|
||||
? 'ignore'
|
||||
: annotationWrapper.superType;
|
||||
|
||||
AnnotationWrapper._handleRemoveSuperType(annotationWrapper, manualRedactions);
|
||||
annotationWrapper.dictionary = redactionLogEntry.type;
|
||||
annotationWrapper.firstTopLeftPoint = redactionLogEntry.positions[0]?.topLeft;
|
||||
annotationWrapper.pageNumber = redactionLogEntry.positions[0]?.page;
|
||||
annotationWrapper.id = redactionLogEntry.id;
|
||||
annotationWrapper.manual = false;
|
||||
annotationWrapper.content =
|
||||
annotationWrapper.superType === 'redaction' || annotationWrapper.superType === 'ignore'
|
||||
@ -52,19 +49,21 @@ export class AnnotationWrapper {
|
||||
|
||||
static fromManualRedaction(
|
||||
manualRedactionEntry: ManualRedactionEntry,
|
||||
comments: { [p: string]: Array<Comment> },
|
||||
manualRedactions: ManualRedactions,
|
||||
dictionaryData: { [p: string]: TypeValue }
|
||||
) {
|
||||
console.log(manualRedactionEntry);
|
||||
const comments: { [key: string]: Array<Comment> } = manualRedactions.comments;
|
||||
const annotationWrapper = new AnnotationWrapper();
|
||||
annotationWrapper.id = manualRedactionEntry.id;
|
||||
annotationWrapper.superType = AnnotationWrapper.getManualRedactionSuperType(
|
||||
manualRedactionEntry,
|
||||
dictionaryData
|
||||
);
|
||||
|
||||
AnnotationWrapper._handleRemoveSuperType(annotationWrapper, manualRedactions);
|
||||
annotationWrapper.dictionary = manualRedactionEntry.type;
|
||||
annotationWrapper.firstTopLeftPoint = manualRedactionEntry.positions[0]?.topLeft;
|
||||
annotationWrapper.pageNumber = manualRedactionEntry.positions[0]?.page;
|
||||
annotationWrapper.id = manualRedactionEntry.id;
|
||||
annotationWrapper.content = manualRedactionEntry.addToDictionary
|
||||
? null
|
||||
: AnnotationWrapper.createAnnotationContentForManualRedaction(manualRedactionEntry);
|
||||
@ -75,6 +74,24 @@ export class AnnotationWrapper {
|
||||
return annotationWrapper;
|
||||
}
|
||||
|
||||
private static _handleRemoveSuperType(
|
||||
annotationWrapper: AnnotationWrapper,
|
||||
manualRedactions: ManualRedactions
|
||||
) {
|
||||
const toRemove = manualRedactions.idsToRemove.find(
|
||||
(trm) => trm.id === annotationWrapper.id
|
||||
);
|
||||
|
||||
// change super-type based on toRemove
|
||||
annotationWrapper.superType = toRemove
|
||||
? toRemove.status === 'REQUESTED'
|
||||
? 'request-remove'
|
||||
: toRemove.status === 'APPROVED'
|
||||
? 'ignore'
|
||||
: annotationWrapper.superType
|
||||
: annotationWrapper.superType;
|
||||
}
|
||||
|
||||
static getManualRedactionSuperType(
|
||||
manualRedactionEntry: ManualRedactionEntry,
|
||||
dictionaryData: { [p: string]: TypeValue }
|
||||
|
||||
@ -18,9 +18,10 @@ export class FileDataModel {
|
||||
return this.manualRedactions.entriesToAdd.filter(
|
||||
(e) =>
|
||||
e.status !== 'DECLINED' &&
|
||||
!this.redactionLog.redactionLogEntry.find((r) => r.id === e.id) &&
|
||||
new Date(e.processedDate).getTime() >
|
||||
new Date(this.fileStatus.lastUpdated).getTime()
|
||||
!this.redactionLog.redactionLogEntry.find((r) => r.id === e.id)
|
||||
// &&
|
||||
// new Date(e.processedDate).getTime() >
|
||||
// new Date(this.fileStatus.lastUpdated).getTime()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -39,7 +39,7 @@ export class AnnotationDrawService {
|
||||
);
|
||||
const color =
|
||||
superType === 'request'
|
||||
? this._appStateService.getDictionaryColor('request')
|
||||
? this._appStateService.getDictionaryColor(superType)
|
||||
: this._appStateService.getDictionaryColor(manualRedactionEntry.type);
|
||||
|
||||
const rgbColor = hexToRgb(color);
|
||||
|
||||
@ -411,6 +411,11 @@ export class AppStateService {
|
||||
type: 'request',
|
||||
virtual: true
|
||||
};
|
||||
this._dictionaryData['request-remove'] = {
|
||||
hexColor: colors.requestRemove,
|
||||
type: 'request-remove',
|
||||
virtual: true
|
||||
};
|
||||
this._dictionaryData['ignore'] = {
|
||||
hexColor: colors.notRedacted,
|
||||
type: 'ignore',
|
||||
@ -426,11 +431,6 @@ export class AppStateService {
|
||||
type: 'add',
|
||||
virtual: true
|
||||
};
|
||||
this._dictionaryData['remove'] = {
|
||||
hexColor: colors.requestRemove,
|
||||
type: 'remove',
|
||||
virtual: true
|
||||
};
|
||||
})
|
||||
);
|
||||
|
||||
@ -460,7 +460,11 @@ export class AppStateService {
|
||||
}
|
||||
|
||||
getDictionaryTypeValueForAnnotation(annotation: AnnotationWrapper) {
|
||||
if (annotation.superType === 'request' || annotation.superType === 'ignore') {
|
||||
if (
|
||||
annotation.superType === 'request' ||
|
||||
annotation.superType === 'ignore' ||
|
||||
annotation.superType === 'request-remove'
|
||||
) {
|
||||
return this._dictionaryData[annotation.superType];
|
||||
}
|
||||
if (annotation.superType === 'redaction' || annotation.superType === 'hint') {
|
||||
|
||||
@ -299,6 +299,7 @@
|
||||
"redaction": "Redaction",
|
||||
"hint": "Hint",
|
||||
"request": "Redaction Request",
|
||||
"request-remove": "Remove Redaction Request",
|
||||
"ignore": "Ignored redaction"
|
||||
}
|
||||
},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user