working flows

This commit is contained in:
Timo Bejan 2020-11-11 21:16:30 +02:00
parent 96a12cfc95
commit 108be7f225
6 changed files with 33 additions and 14 deletions

View File

@ -87,7 +87,7 @@ export class ManualAnnotationDialogComponent implements OnInit {
if (dictionaryData.hint) {
this.hintDictionaries.push(dictionaryData);
}
if (!dictionaryData.hint) {
if (!dictionaryData.hint && dictionaryData.type !== 'manual') {
this.redactionDictionaries.push(dictionaryData);
}
}

View File

@ -1,4 +1,4 @@
<div [class.visible]="menuOpen" *ngIf="canPerformAnnotationActions" class="annotation-actions">
<div [class.visible]="menuOpen" *ngIf="canPerformAnnotationActions" class="annotation-actions" [matTooltip]="json">
<button (click)="acceptSuggestion($event, annotation)" mat-icon-button *ngIf="canAcceptSuggestion">
<mat-icon svgIcon="red:check-alt"></mat-icon>
</button>
@ -12,7 +12,7 @@
</button>
<button (click)="suggestRemoveAnnotation($event, annotation, true)" mat-icon-button *ngIf="canDirectlySuggestToRemoveAnnotation">
<mat-icon svgIcon="red:close"></mat-icon>
<mat-icon svgIcon="red:trash"></mat-icon>
</button>
<button

View File

@ -36,11 +36,15 @@ export class AnnotationActionsComponent implements OnInit {
get canRejectSuggestion() {
// i can reject whatever i may not undo
return this.canAcceptSuggestion && !this.annotation.isDeclinedSuggestion && !this.canUndoAnnotation;
return (
!this.canUndoAnnotation &&
((this.canAcceptSuggestion && !this.annotation.isDeclinedSuggestion) ||
(this.annotation.isModifyDictionary && !this.annotation.isDeclinedSuggestion))
);
}
get canDirectlySuggestToRemoveAnnotation() {
return this.annotation.isHint || this.annotation.isManual;
return this.annotation.isHint || (this.annotation.isManual && this.permissionsService.isManagerAndOwner() && !this.canUndoAnnotation);
}
get requiresSuggestionRemoveMenu() {
@ -102,4 +106,8 @@ export class AnnotationActionsComponent implements OnInit {
get dictionaryColor() {
return this.appStateService.getDictionaryColor('suggestion-add-dictionary');
}
get json() {
return JSON.stringify(this.annotation, null, 2);
}
}

View File

@ -36,6 +36,7 @@ export class AnnotationWrapper {
hint: boolean;
redaction: boolean;
status: string;
dictionaryOperation: boolean;
positions: Rectangle[];
get isIgnored() {
@ -83,7 +84,7 @@ export class AnnotationWrapper {
}
get isModifyDictionary() {
return this.superType === 'suggestion-add-dictionary' || this.superType === 'suggestion-remove-dictionary';
return this.dictionaryOperation;
}
static fromData(
@ -95,6 +96,21 @@ export class AnnotationWrapper {
idRemoval?: IdRemoval,
comments?: Comment[]
) {
// manual annotations that have been undone
if (redactionLogEntry?.type === 'manual' && redactionLogEntry?.manual === true && !manualRedactionEntry) {
return;
}
// for declined manual add to dict requests
if (manualRedactionEntry?.status === 'DECLINED' && manualRedactionEntry?.type !== 'manual') {
manualRedactionEntry.addToDictionary = true;
}
// there has been an undo on a redaction remove
if (redactionLogEntry?.manualRedactionType === 'REMOVE' && !idRemoval) {
redactionLogEntry.redacted = true;
}
const annotationWrapper = new AnnotationWrapper();
annotationWrapper.comments = comments ? comments : [];
@ -138,6 +154,7 @@ export class AnnotationWrapper {
idRemoval?: IdRemoval
) {
if (idRemoval) {
annotationWrapper.dictionaryOperation = idRemoval.removeFromDictionary;
if (idRemoval.status === 'DECLINED') {
annotationWrapper.superType = 'declined-suggestion';
} else {
@ -151,6 +168,7 @@ export class AnnotationWrapper {
}
if (manualRedactionEntry) {
annotationWrapper.dictionaryOperation = manualRedactionEntry.addToDictionary;
if (manualRedactionEntry.status === 'DECLINED') {
annotationWrapper.superType = 'declined-suggestion';
} else {
@ -166,9 +184,6 @@ export class AnnotationWrapper {
if (!annotationWrapper.superType) {
annotationWrapper.superType = annotationWrapper.redaction ? 'redaction' : annotationWrapper.hint ? 'hint' : 'ignore';
}
if (annotationWrapper.superType === 'manual') {
console.log(annotationWrapper.superType, manualRedactionEntry, idRemoval);
}
}
private static _setTypeLabel(annotationWrapper: AnnotationWrapper) {

View File

@ -42,7 +42,7 @@ export class FileDownloadService {
map((data) => {
const fileData = new FileDataModel(this._appStateService.activeFile, ...data);
// lazy load redacted data
this.loadFile('ANNOTATED', this._appStateService.activeFileId).subscribe((redactedFileData) => (fileData.redactedFileData = redactedFileData));
this.loadFile('REDACTED', this._appStateService.activeFileId).subscribe((redactedFileData) => (fileData.redactedFileData = redactedFileData));
return fileData;
})
);

View File

@ -60,10 +60,6 @@ export class AppStateService {
activeFile: null
};
this._dictionaryControllerService.getDictionaryForType('hint_only').subscribe((data) => {
console.log(data);
});
timer(5000, 5000)
.pipe(
tap(() => {