RED-7069, fix issues, test type filtering, improvements.
This commit is contained in:
parent
688157f39f
commit
20722dbd3d
@ -35,7 +35,12 @@
|
||||
|
||||
<iqser-circle-button
|
||||
(action)="annotationActionsService.editRedaction(annotations)"
|
||||
*ngIf="annotationPermissions.canChangeLegalBasis || annotationPermissions.canRecategorizeAnnotation"
|
||||
*ngIf="
|
||||
annotationPermissions.canChangeLegalBasis ||
|
||||
annotationPermissions.canRecategorizeAnnotation ||
|
||||
annotationPermissions.canForceRedaction ||
|
||||
annotationPermissions.canForceHint
|
||||
"
|
||||
[tooltipPosition]="tooltipPosition"
|
||||
[tooltip]="'annotation-actions.edit-redaction.label' | translate"
|
||||
[type]="buttonType"
|
||||
|
||||
@ -36,8 +36,7 @@
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
<!-- <iqser-details-radio *ngIf="options?.length" [options]="options" formControlName="option"></iqser-details-radio>-->
|
||||
<ng-container *ngIf="showLegalReason">
|
||||
<ng-container *ngIf="showExtras">
|
||||
<div class="iqser-input-group required w-450">
|
||||
<label [translate]="'edit-redaction.dialog.content.reason'"></label>
|
||||
<mat-form-field>
|
||||
@ -58,12 +57,12 @@
|
||||
<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>
|
||||
<input formControlName="section" name="section" type="text" />
|
||||
</div>
|
||||
<div class="iqser-input-group w-450">
|
||||
<label [translate]="'edit-redaction.dialog.content.section'"></label>
|
||||
<input formControlName="section" name="section" type="text" />
|
||||
</div>
|
||||
</ng-container>
|
||||
|
||||
<div class="iqser-input-group w-450">
|
||||
<label [translate]="'edit-redaction.dialog.content.comment'"></label>
|
||||
|
||||
@ -27,13 +27,12 @@ export class EditRedactionDialogComponent
|
||||
readonly isManualRedaction: boolean;
|
||||
readonly showLegalReason: boolean;
|
||||
readonly isHint: boolean;
|
||||
readonly showExtras: boolean;
|
||||
|
||||
options: DetailsRadioOption<RedactOrHintOption>[] | undefined;
|
||||
legalOptions: LegalBasisOption[] = [];
|
||||
dictionaries: Dictionary[] = [];
|
||||
form: UntypedFormGroup;
|
||||
readonly #initialType: string;
|
||||
readonly #initialReason: string;
|
||||
readonly #dossier: Dossier;
|
||||
|
||||
#applyToAllDossiers: boolean;
|
||||
@ -51,27 +50,11 @@ export class EditRedactionDialogComponent
|
||||
const firstEntry = annotations[0];
|
||||
this.isImage = IMAGE_CATEGORIES.includes(firstEntry.type);
|
||||
this.redactedText = annotations.length === 1 && !this.isImage ? firstEntry.value : null;
|
||||
this.#initialReason = firstEntry.legalBasis;
|
||||
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.isImage);
|
||||
this.showExtras = this.isManualRedaction || ((firstEntry.isRedacted || firstEntry.isSkipped) && firstEntry.dictionaryOperation);
|
||||
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(),
|
||||
// )
|
||||
// .subscribe();
|
||||
}
|
||||
|
||||
get displayedDictionaryLabel() {
|
||||
@ -110,8 +93,7 @@ export class EditRedactionDialogComponent
|
||||
save(): void {
|
||||
const value = this.form.value;
|
||||
this.dialogRef.close({
|
||||
typeChanged: this.#initialType !== value.type,
|
||||
legalBasis: value.reason?.legalBasis ?? null,
|
||||
legalBasis: value.reason?.legalBasis ?? '',
|
||||
section: value.section,
|
||||
comment: value.comment,
|
||||
type: value.type,
|
||||
|
||||
@ -117,7 +117,7 @@ export class AnnotationActionsService {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.#isDocumine) {
|
||||
if (!this.#isDocumine && result.legalBasis !== annotations[0].legalBasis) {
|
||||
const changeLegalBasisBody = annotations.map(annotation => ({
|
||||
annotationId: annotation.id,
|
||||
legalBasis: result.legalBasis,
|
||||
@ -126,7 +126,7 @@ export class AnnotationActionsService {
|
||||
}));
|
||||
requests.push(this._manualRedactionService.changeLegalBasis(changeLegalBasisBody, dossierId, fileId));
|
||||
}
|
||||
if (result.typeChanged || this.#isDocumine) {
|
||||
if (result.type !== annotations[0].type || this.#isDocumine) {
|
||||
const recategorizeBody: List<IRecategorizationRequest> = annotations.map(({ id }) => ({
|
||||
annotationId: id,
|
||||
type: result.type,
|
||||
@ -134,7 +134,7 @@ export class AnnotationActionsService {
|
||||
requests.push(this._manualRedactionService.recategorizeRedactions(recategorizeBody, dossierId, fileId));
|
||||
}
|
||||
|
||||
if (result.comment) {
|
||||
if (result.comment && requests.length) {
|
||||
requests.push(
|
||||
from(Promise.all(annotations.map(a => this._manualRedactionService.addComment(result.comment, a.id, dossierId, fileId)))),
|
||||
);
|
||||
|
||||
@ -51,7 +51,12 @@ export class PdfAnnotationActionsService {
|
||||
availableActions.push(resizeButton);
|
||||
}
|
||||
|
||||
if (permissions.canChangeLegalBasis || permissions.canRecategorizeAnnotation) {
|
||||
if (
|
||||
permissions.canChangeLegalBasis ||
|
||||
permissions.canRecategorizeAnnotation ||
|
||||
permissions.canForceHint ||
|
||||
permissions.canForceRedaction
|
||||
) {
|
||||
const editButton = this.#getButton('edit', _('annotation-actions.edit-redaction.label'), () =>
|
||||
this.#annotationActionsService.editRedaction(annotations),
|
||||
);
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { List, ValuesOf } from '@iqser/common-ui/lib/utils';
|
||||
|
||||
export const IMAGE_CATEGORIES: readonly string[] = ['signature', 'logo', 'formula', 'image'];
|
||||
export const IMAGE_CATEGORIES: readonly string[] = ['signature', 'logo', 'formula', 'image', 'ocr'];
|
||||
export const ActionsHelpModeKeys = {
|
||||
redaction: 'redaction',
|
||||
'manual-redaction': 'redaction',
|
||||
|
||||
@ -35,7 +35,6 @@ export interface RedactRecommendationResult {
|
||||
}
|
||||
|
||||
export interface EditRedactResult {
|
||||
typeChanged: boolean;
|
||||
legalBasis: string;
|
||||
section: string;
|
||||
comment: string;
|
||||
|
||||
@ -167,14 +167,16 @@ export class DictionaryService extends EntitiesService<IDictionary, Dictionary>
|
||||
}
|
||||
|
||||
getEditableRedactionTypes(dossierTemplateId: string, isImage: boolean, isHint: boolean): Dictionary[] {
|
||||
return this._dictionariesMapService
|
||||
const types = [];
|
||||
this._dictionariesMapService
|
||||
.get(dossierTemplateId)
|
||||
.filter(d =>
|
||||
isImage
|
||||
? IMAGE_CATEGORIES.includes(d.type)
|
||||
: (isHint ? d.hint : !d.hint) && !d.systemManaged && !d.virtual && d.hasDictionary,
|
||||
: (isHint ? d.hint : !d.hint) && !d.virtual && !IMAGE_CATEGORIES.includes(d.type),
|
||||
)
|
||||
.sort((a, b) => a.label.localeCompare(b.label));
|
||||
.forEach(d => !types.find(t => t.id === d.id) && types.push(d));
|
||||
return types.sort((a, b) => a.label.localeCompare(b.label));
|
||||
}
|
||||
|
||||
getAddHintDictionaries(dossierTemplateId: string, dossierDictionaryOnly: boolean, dictionaryRequest: boolean): Dictionary[] {
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
"ADMIN_CONTACT_URL": null,
|
||||
"API_URL": "https://qa2.iqser.cloud",
|
||||
"APP_NAME": "RedactManager",
|
||||
"IS_DOCUMINE": true,
|
||||
"IS_DOCUMINE": false,
|
||||
"RULE_EDITOR_DEV_ONLY": false,
|
||||
"AUTO_READ_TIME": 3,
|
||||
"BACKEND_APP_VERSION": "4.4.40",
|
||||
|
||||
@ -1239,7 +1239,7 @@
|
||||
"section": "Paragraph / Location",
|
||||
"type": "Type"
|
||||
},
|
||||
"title-edit-image": "Edit image redaction",
|
||||
"title-edit-image": "Edit image",
|
||||
"title-edit-text": "Edit redaction",
|
||||
"title-hint": "Edit hint"
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user