Merge remote-tracking branch 'origin/RED-7069'

This commit is contained in:
Dan Percic 2023-08-18 11:01:03 +03:00
commit f25c7ac3e7
14 changed files with 60 additions and 72 deletions

View File

@ -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"

View File

@ -1,6 +1,6 @@
<section class="dialog">
<form (submit)="save()" [formGroup]="form">
<div [translate]="'edit-redaction.dialog.title-edit-text'" class="dialog-header heading-l"></div>
<div [translate]="'edit-redaction.dialog.title'" class="dialog-header heading-l"></div>
<div class="dialog-content redaction">
<div *ngIf="redactedText" class="iqser-input-group w-450">

View File

@ -1,13 +1,8 @@
<section class="dialog">
<form (submit)="save()" [formGroup]="form">
<div
[translate]="
isImage
? 'edit-redaction.dialog.title-edit-image'
: isHint
? 'edit-redaction.dialog.title-hint'
: 'edit-redaction.dialog.title-edit-text'
"
[translateParams]="{ type: isImage ? 'image' : isHint ? 'hint' : 'redaction' }"
[translate]="'edit-redaction.dialog.title'"
class="dialog-header heading-l"
></div>
@ -36,8 +31,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 +52,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>

View File

@ -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;
@ -49,29 +48,13 @@ export class EditRedactionDialogComponent
this.#applyToAllDossiers = this.data.applyToAllDossiers;
const annotations = this.data.annotations;
const firstEntry = annotations[0];
this.isImage = IMAGE_CATEGORIES.includes(firstEntry.type);
this.isImage = [...IMAGE_CATEGORIES, 'ocr'].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.isImage || this.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(),
// )
// .subscribe();
}
get displayedDictionaryLabel() {
@ -109,9 +92,8 @@ export class EditRedactionDialogComponent
save(): void {
const value = this.form.value;
this.dialogRef.close({
typeChanged: this.#initialType !== value.type,
legalBasis: value.reason?.legalBasis ?? null,
this.close({
legalBasis: value.reason?.legalBasis ?? '',
section: value.section,
comment: value.comment,
type: value.type,
@ -120,7 +102,12 @@ export class EditRedactionDialogComponent
}
#setTypes() {
this.dictionaries = this._dictionaryService.getEditableRedactionTypes(this.#dossier.dossierTemplateId, this.isImage, this.isHint);
this.dictionaries = this._dictionaryService.getEditableRedactionTypes(
this.#dossier.dossierTemplateId,
this.isImage,
this.isHint,
this.data.annotations[0].isOCR,
);
}
#setOptions(type: string, reasonChanged = false) {

View File

@ -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,6 +134,10 @@ export class AnnotationActionsService {
requests.push(this._manualRedactionService.recategorizeRedactions(recategorizeBody, dossierId, fileId));
}
if (!requests.length) {
return;
}
if (result.comment) {
requests.push(
from(Promise.all(annotations.map(a => this._manualRedactionService.addComment(result.comment, a.id, dossierId, fileId)))),

View File

@ -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),
);

View File

@ -35,7 +35,6 @@ export interface RedactRecommendationResult {
}
export interface EditRedactResult {
typeChanged: boolean;
legalBasis: string;
section: string;
comment: string;

View File

@ -166,15 +166,17 @@ export class DictionaryService extends EntitiesService<IDictionary, Dictionary>
return dictionaries.sort((a, b) => a.label.localeCompare(b.label));
}
getEditableRedactionTypes(dossierTemplateId: string, isImage: boolean, isHint: boolean): Dictionary[] {
return this._dictionariesMapService
getEditableRedactionTypes(dossierTemplateId: string, isImage: boolean, isHint: boolean, isOCR: boolean): Dictionary[] {
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,
? (isOCR ? [...IMAGE_CATEGORIES, 'ocr'] : IMAGE_CATEGORIES).includes(d.type)
: (isHint ? d.hint : !d.hint) && !d.virtual && ![...IMAGE_CATEGORIES, 'ocr'].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[] {

View File

@ -1,7 +1,7 @@
{
"ADMIN_CONTACT_NAME": null,
"ADMIN_CONTACT_URL": null,
"API_URL": "https://dev-08.iqser.cloud",
"API_URL": "https://dan.iqser.cloud",
"APP_NAME": "RedactManager",
"IS_DOCUMINE": false,
"RULE_EDITOR_DEV_ONLY": false,
@ -13,7 +13,7 @@
"MAX_RETRIES_ON_SERVER_ERROR": 3,
"OAUTH_CLIENT_ID": "redaction",
"OAUTH_IDP_HINT": null,
"OAUTH_URL": "https://dev-08.iqser.cloud/auth",
"OAUTH_URL": "https://dan.iqser.cloud/auth",
"RECENT_PERIOD_IN_HOURS": 24,
"SELECTION_MODE": "structural",
"MANUAL_BASE_URL": "https://docs.redactmanager.com/preview",

View File

@ -1239,9 +1239,7 @@
"section": "",
"type": ""
},
"title-edit-image": "",
"title-edit-text": "",
"title-hint": ""
"title": ""
}
},
"entities-listing": {
@ -1927,6 +1925,7 @@
"search": ""
}
},
"toggle-layers": "{active, select, true{Disable} false{Enable} other{}} layers",
"toggle-readable-redactions": "",
"toggle-tooltips": "{active, select, true{Disable} false{Enable} other{}} Kurzinfos für Anmerkungen",
"toggle-layers": "{active, select, true{Disable} false{Enable} other{}} layout grid"
@ -1958,8 +1957,7 @@
"auto-expand-filters-on-action": "",
"load-all-annotations-warning": "",
"open-structured-view-by-default": "",
"table-extraction-type": "",
"unapproved-suggestions-warning": ""
"table-extraction-type": ""
},
"label": "",
"title": "",

View File

@ -1239,9 +1239,7 @@
"section": "Paragraph / Location",
"type": "Type"
},
"title-edit-image": "Edit image redaction",
"title-edit-text": "Edit redaction",
"title-hint": "Edit hint"
"title": "Edit {type, select, image{Image} hint{Hint} other{Redaction}}"
}
},
"entities-listing": {
@ -1927,6 +1925,7 @@
"search": "Search for selection"
}
},
"toggle-layers": "{active, select, true{Disable} false{Enable} other{}} layers",
"toggle-readable-redactions": "Show redactions {active, select, true{as in final document} false{in preview color} other{}}",
"toggle-tooltips": "{active, select, true{Disable} false{Enable} other{}} annotation tooltips",
"toggle-layers": "{active, select, true{Disable} false{Enable} other{}} layout grid"
@ -1958,8 +1957,7 @@
"auto-expand-filters-on-action": "Auto-expand filters on my actions",
"load-all-annotations-warning": "Warning regarding loading all annotations at once in file preview",
"open-structured-view-by-default": "Display structured component management modal by default",
"table-extraction-type": "Table extraction type",
"unapproved-suggestions-warning": "Warning regarding unapproved suggestions in document Preview mode"
"table-extraction-type": "Table extraction type"
},
"label": "Preferences",
"title": "Edit preferences",

View File

@ -1239,9 +1239,7 @@
"section": "",
"type": ""
},
"title-edit-image": "",
"title-edit-text": "",
"title-hint": ""
"title": ""
}
},
"entities-listing": {
@ -1927,6 +1925,7 @@
"search": ""
}
},
"toggle-layers": "{active, select, true{Disable} false{Enable} other{}} layers grid",
"toggle-readable-redactions": "",
"toggle-tooltips": "{active, select, true{Disable} false{Enable} other{}} Kurzinfos für Anmerkungen",
"toggle-layers": "{active, select, true{Disable} false{Enable} other{}} layout grid"
@ -1958,8 +1957,7 @@
"auto-expand-filters-on-action": "",
"load-all-annotations-warning": "",
"open-structured-view-by-default": "",
"table-extraction-type": "",
"unapproved-suggestions-warning": ""
"table-extraction-type": ""
},
"label": "",
"title": "",

View File

@ -1239,9 +1239,7 @@
"section": "",
"type": "Type"
},
"title-edit-image": "",
"title-edit-text": "Edit annotation",
"title-hint": ""
"title": "Edit annotation"
}
},
"entities-listing": {
@ -1927,6 +1925,7 @@
"search": "Search for selection"
}
},
"toggle-layers": "{active, select, true{Disable} false{Enable} other{}} layers grid",
"toggle-readable-redactions": "Show components {active, select, true{as in final document} false{in preview color} other{}}",
"toggle-tooltips": "{active, select, true{Disable} false{Enable} other{}} annotation tooltips",
"toggle-layers": "{active, select, true{Disable} false{Enable} other{}} layout grid"
@ -1958,8 +1957,7 @@
"auto-expand-filters-on-action": "Auto expand filters on my actions",
"load-all-annotations-warning": "Warning regarding loading all annotations at once in file preview",
"open-structured-view-by-default": "Display Component View by default when opening a document",
"table-extraction-type": "Table extraction type",
"unapproved-suggestions-warning": "Warning regarding unapproved suggestions in document Preview mode"
"table-extraction-type": "Table extraction type"
},
"label": "Preferences",
"title": "Edit preferences",

@ -1 +1 @@
Subproject commit db37aa6257764e20a3c2ba602fc5cf875200d987
Subproject commit fed7c6a180745043c5bfdbaf8b7eecaed03eca5e