RED-7069, removed scope select. Fix some bugs.
This commit is contained in:
parent
c39f3087fa
commit
fd7093524f
@ -34,9 +34,9 @@ export const canRemoveRedaction = (annotations: AnnotationWrapper[], permissions
|
||||
export const canChangeLegalBasis = (annotation: AnnotationWrapper, canAddRedaction: boolean) =>
|
||||
canAddRedaction && annotation.isRedacted && !annotation.pending;
|
||||
|
||||
export const canRecategorizeImage = (annotation: AnnotationWrapper, canRecategorize: boolean) =>
|
||||
export const canRecategorizeAnnotation = (annotation: AnnotationWrapper, canRecategorize: boolean) =>
|
||||
canRecategorize &&
|
||||
((annotation.isImage && !annotation.isSuggestion) || annotation.isSuggestionRecategorizeImage) &&
|
||||
((annotation.isImage && !annotation.isSuggestion) || annotation.isSuggestionRecategorizeImage || annotation.hintDictionary) &&
|
||||
!annotation.pending;
|
||||
|
||||
export const canResizeAnnotation = (annotation: AnnotationWrapper, canAddRedaction: boolean) =>
|
||||
|
||||
@ -9,7 +9,7 @@ import {
|
||||
canForceHint,
|
||||
canForceRedaction,
|
||||
canMarkAsFalsePositive,
|
||||
canRecategorizeImage,
|
||||
canRecategorizeAnnotation,
|
||||
canRemoveFromDictionary,
|
||||
canRemoveOnlyHere,
|
||||
canRemoveRedaction,
|
||||
@ -27,7 +27,7 @@ export class AnnotationPermissions {
|
||||
canForceRedaction = true;
|
||||
canChangeLegalBasis = true;
|
||||
canResizeAnnotation = true;
|
||||
canRecategorizeImage = true;
|
||||
canRecategorizeAnnotation = true;
|
||||
canForceHint = true;
|
||||
|
||||
static forUser(
|
||||
@ -56,7 +56,7 @@ export class AnnotationPermissions {
|
||||
permissions.canRemoveFromDictionary = canRemoveFromDictionary(annotation);
|
||||
permissions.canRemoveRedaction = canRemoveRedaction(annotations, permissions);
|
||||
permissions.canChangeLegalBasis = canChangeLegalBasis(annotation, canAddRedaction);
|
||||
permissions.canRecategorizeImage = canRecategorizeImage(annotation, canAddRedaction);
|
||||
permissions.canRecategorizeAnnotation = canRecategorizeAnnotation(annotation, canAddRedaction);
|
||||
permissions.canResizeAnnotation = canResizeAnnotation(annotation, canAddRedaction);
|
||||
|
||||
summedPermissions._merge(permissions);
|
||||
|
||||
@ -35,7 +35,7 @@
|
||||
|
||||
<iqser-circle-button
|
||||
(action)="annotationActionsService.editRedaction(annotations)"
|
||||
*ngIf="annotationPermissions.canChangeLegalBasis || annotationPermissions.canRecategorizeImage"
|
||||
*ngIf="annotationPermissions.canChangeLegalBasis || annotationPermissions.canRecategorizeAnnotation"
|
||||
[tooltipPosition]="tooltipPosition"
|
||||
[tooltip]="'annotation-actions.edit-redaction.label' | translate"
|
||||
[type]="buttonType"
|
||||
@ -87,15 +87,6 @@
|
||||
icon="red:undo"
|
||||
></iqser-circle-button>
|
||||
|
||||
<!-- <iqser-circle-button-->
|
||||
<!-- (action)="annotationActionsService.recategorizeImages(annotations)"-->
|
||||
<!-- *ngIf="annotationPermissions.canRecategorizeImage"-->
|
||||
<!-- [tooltipPosition]="tooltipPosition"-->
|
||||
<!-- [tooltip]="'annotation-actions.recategorize-image' | translate"-->
|
||||
<!-- [type]="buttonType"-->
|
||||
<!-- icon="red:thumb-down"-->
|
||||
<!-- ></iqser-circle-button>-->
|
||||
|
||||
<iqser-circle-button
|
||||
(action)="annotationReferencesService.show(annotations[0])"
|
||||
*ngIf="multiSelectService.inactive() && annotations[0].reference.length"
|
||||
|
||||
@ -1,7 +1,13 @@
|
||||
<section class="dialog">
|
||||
<form (submit)="save()" [formGroup]="form">
|
||||
<div
|
||||
[translate]="isImage ? 'edit-redaction.dialog.title-edit-image' : 'edit-redaction.dialog.title-edit-text'"
|
||||
[translate]="
|
||||
isImage
|
||||
? 'edit-redaction.dialog.title-edit-image'
|
||||
: isHint
|
||||
? 'edit-redaction.dialog.title-hint'
|
||||
: 'edit-redaction.dialog.title-edit-text'
|
||||
"
|
||||
class="dialog-header heading-l"
|
||||
></div>
|
||||
|
||||
@ -30,28 +36,29 @@
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
<iqser-details-radio *ngIf="options?.length" [options]="options" formControlName="option"></iqser-details-radio>
|
||||
<!-- <iqser-details-radio *ngIf="options?.length" [options]="options" formControlName="option"></iqser-details-radio>-->
|
||||
<ng-container *ngIf="showLegalReason">
|
||||
<div class="iqser-input-group required w-450">
|
||||
<label [translate]="'edit-redaction.dialog.content.reason'"></label>
|
||||
<mat-form-field>
|
||||
<mat-select class="full-width" formControlName="reason">
|
||||
<mat-option
|
||||
*ngFor="let option of legalOptions"
|
||||
[matTooltip]="option.description"
|
||||
[value]="option"
|
||||
matTooltipPosition="after"
|
||||
>
|
||||
{{ option.label }}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
<div class="iqser-input-group required w-450">
|
||||
<label [translate]="'edit-redaction.dialog.content.reason'"></label>
|
||||
<mat-form-field>
|
||||
<mat-select class="full-width" formControlName="reason">
|
||||
<mat-option
|
||||
*ngFor="let option of legalOptions"
|
||||
[matTooltip]="option.description"
|
||||
[value]="option"
|
||||
matTooltipPosition="after"
|
||||
>
|
||||
{{ option.label }}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
<div class="iqser-input-group w-450">
|
||||
<label [translate]="'edit-redaction.dialog.content.legal-basis'"></label>
|
||||
<input [value]="form.get('reason').value?.legalBasis" disabled type="text" />
|
||||
</div>
|
||||
<div class="iqser-input-group w-450">
|
||||
<label [translate]="'edit-redaction.dialog.content.legal-basis'"></label>
|
||||
<input [value]="form.get('reason').value?.legalBasis" disabled type="text" />
|
||||
</div>
|
||||
</ng-container>
|
||||
|
||||
<div class="iqser-input-group w-450">
|
||||
<label [translate]="'edit-redaction.dialog.content.section'"></label>
|
||||
@ -73,7 +80,7 @@
|
||||
|
||||
<div class="dialog-actions">
|
||||
<iqser-icon-button
|
||||
[disabled]="disabled"
|
||||
[disabled]="showLegalReason && disabled"
|
||||
[label]="'edit-redaction.dialog.actions.save' | translate"
|
||||
[submit]="true"
|
||||
[type]="iconButtonTypes.primary"
|
||||
|
||||
@ -11,8 +11,6 @@ import { DictionaryService } from '@services/entity-services/dictionary.service'
|
||||
import { getEditRedactionOptions, RedactOrHintOption } from '../../utils/dialog-options';
|
||||
import { EditRedactionData, EditRedactResult } from '../../utils/dialog-types';
|
||||
import { IMAGE_CATEGORIES } from '../../utils/constants';
|
||||
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||
import { tap } from 'rxjs/operators';
|
||||
|
||||
@Component({
|
||||
templateUrl: './edit-redaction-dialog.component.html',
|
||||
@ -27,15 +25,19 @@ export class EditRedactionDialogComponent
|
||||
readonly isModifyDictionary: boolean;
|
||||
readonly isImage: boolean;
|
||||
readonly isManualRedaction: boolean;
|
||||
readonly showLegalReason: boolean;
|
||||
readonly isHint: boolean;
|
||||
|
||||
options: DetailsRadioOption<RedactOrHintOption>[] | undefined;
|
||||
legalOptions: LegalBasisOption[] = [];
|
||||
dictionaries: Dictionary[] = [];
|
||||
form: UntypedFormGroup;
|
||||
readonly #initialType: string;
|
||||
readonly #initialReason: string;
|
||||
#applyToAllDossiers: boolean;
|
||||
readonly #dossier: Dossier;
|
||||
|
||||
#applyToAllDossiers: boolean;
|
||||
|
||||
constructor(
|
||||
private readonly _justificationsService: JustificationsService,
|
||||
private readonly _activeDossiersService: ActiveDossiersService,
|
||||
@ -53,21 +55,23 @@ export class EditRedactionDialogComponent
|
||||
this.#initialType = firstEntry.type;
|
||||
this.isModifyDictionary = firstEntry.isModifyDictionary;
|
||||
this.isManualRedaction = firstEntry.type === SuperTypes.ManualRedaction;
|
||||
this.isHint = firstEntry.isHint;
|
||||
this.showLegalReason = !(firstEntry.isSkipped || firstEntry.isHint);
|
||||
this.form = this.#getForm();
|
||||
console.log(firstEntry);
|
||||
|
||||
this.form.valueChanges
|
||||
.pipe(
|
||||
tap(value => {
|
||||
const reasonChanged = this.#initialReason !== value?.reason?.legalBasis;
|
||||
const typeChanged = this.#initialType !== value?.type;
|
||||
if (typeChanged || reasonChanged) {
|
||||
this.#setOptions(value.type, reasonChanged);
|
||||
}
|
||||
}),
|
||||
takeUntilDestroyed(),
|
||||
)
|
||||
// eslint-disable-next-line rxjs/no-ignored-subscription
|
||||
.subscribe();
|
||||
// this.form.valueChanges
|
||||
// .pipe(
|
||||
// tap(value => {
|
||||
// const reasonChanged = this.#initialReason !== value?.reason?.legalBasis;
|
||||
// const typeChanged = this.#initialType !== value?.type;
|
||||
// if (typeChanged || reasonChanged) {
|
||||
// this.#setOptions(value.type, reasonChanged);
|
||||
// }
|
||||
// }),
|
||||
// takeUntilDestroyed(),
|
||||
// )
|
||||
// .subscribe();
|
||||
}
|
||||
|
||||
get displayedDictionaryLabel() {
|
||||
@ -107,7 +111,7 @@ export class EditRedactionDialogComponent
|
||||
const value = this.form.value;
|
||||
this.dialogRef.close({
|
||||
typeChanged: this.#initialType !== value.type,
|
||||
legalBasis: value.reason.legalBasis,
|
||||
legalBasis: value.reason?.legalBasis ?? null,
|
||||
section: value.section,
|
||||
comment: value.comment,
|
||||
type: value.type,
|
||||
|
||||
@ -51,20 +51,13 @@ export class PdfAnnotationActionsService {
|
||||
availableActions.push(resizeButton);
|
||||
}
|
||||
|
||||
if (permissions.canChangeLegalBasis || permissions.canRecategorizeImage) {
|
||||
if (permissions.canChangeLegalBasis || permissions.canRecategorizeAnnotation) {
|
||||
const editButton = this.#getButton('edit', _('annotation-actions.edit-redaction.label'), () =>
|
||||
this.#annotationActionsService.editRedaction(annotations),
|
||||
);
|
||||
availableActions.push(editButton);
|
||||
}
|
||||
|
||||
// if (permissions.canRecategorizeImage) {
|
||||
// const recategorizeButton = this.#getButton('thumb-down', _('annotation-actions.recategorize-image'), () =>
|
||||
// this.#annotationActionsService.editRedaction(annotations),
|
||||
// );
|
||||
// availableActions.push(recategorizeButton);
|
||||
// }
|
||||
|
||||
if (permissions.canAcceptRecommendation) {
|
||||
const acceptRecommendationButton = this.#getButton('check', _('annotation-actions.accept-recommendation.label'), () =>
|
||||
this.#annotationActionsService.convertRecommendationToAnnotation(annotations),
|
||||
@ -113,7 +106,7 @@ export class PdfAnnotationActionsService {
|
||||
return {
|
||||
canResize: permissions.length === 1 && permissions[0].canResizeAnnotation,
|
||||
canChangeLegalBasis: permissions.reduce((acc, next) => acc && next.canChangeLegalBasis, true),
|
||||
canRecategorizeImage: permissions.reduce((acc, next) => acc && next.canRecategorizeImage, true),
|
||||
canRecategorizeAnnotation: permissions.reduce((acc, next) => acc && next.canRecategorizeAnnotation, true),
|
||||
canRemoveFromDictionary: permissions.reduce((acc, next) => acc && next.canRemoveFromDictionary, true),
|
||||
canAcceptRecommendation: permissions.reduce((acc, next) => acc && next.canAcceptRecommendation, true),
|
||||
canMarkAsFalsePositive: permissions.reduce((acc, next) => acc && next.canMarkAsFalsePositive, true),
|
||||
|
||||
@ -1234,7 +1234,8 @@
|
||||
"type": ""
|
||||
},
|
||||
"title-edit-image": "",
|
||||
"title-edit-text": ""
|
||||
"title-edit-text": "",
|
||||
"title-hint": ""
|
||||
}
|
||||
},
|
||||
"entities-listing": {
|
||||
|
||||
@ -1234,7 +1234,8 @@
|
||||
"type": "Type"
|
||||
},
|
||||
"title-edit-image": "Edit image redaction",
|
||||
"title-edit-text": "Edit redaction"
|
||||
"title-edit-text": "Edit redaction",
|
||||
"title-hint": "Edit hint"
|
||||
}
|
||||
},
|
||||
"entities-listing": {
|
||||
|
||||
@ -1234,7 +1234,8 @@
|
||||
"type": ""
|
||||
},
|
||||
"title-edit-image": "",
|
||||
"title-edit-text": ""
|
||||
"title-edit-text": "",
|
||||
"title-hint": ""
|
||||
}
|
||||
},
|
||||
"entities-listing": {
|
||||
|
||||
@ -1234,7 +1234,8 @@
|
||||
"type": "Type"
|
||||
},
|
||||
"title-edit-image": "",
|
||||
"title-edit-text": "Edit annotation"
|
||||
"title-edit-text": "Edit annotation",
|
||||
"title-hint": ""
|
||||
}
|
||||
},
|
||||
"entities-listing": {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user