RED-7155 & DM-344 update resize dialog
This commit is contained in:
parent
c3868d6a17
commit
e5585290d0
@ -4,30 +4,15 @@
|
|||||||
|
|
||||||
<div class="dialog-content redaction">
|
<div class="dialog-content redaction">
|
||||||
<div class="iqser-input-group w-450">
|
<div class="iqser-input-group w-450">
|
||||||
<label class="selected-text" [translate]="'resize-annotation.dialog.content.original-text'"></label>
|
<label [translate]="'resize-annotation.dialog.content.original-text'" class="selected-text"></label>
|
||||||
{{ redaction.value }}
|
{{ redaction.value }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="iqser-input-group w-450">
|
<div class="iqser-input-group w-450">
|
||||||
<label class="selected-text" [translate]="'resize-annotation.dialog.content.resized-text'"></label>
|
<label [translate]="'resize-annotation.dialog.content.resized-text'" class="selected-text"></label>
|
||||||
{{ data.text }}
|
{{ data.text }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ng-container *deny="roles.getRss">
|
|
||||||
<div class="iqser-input-group required w-450">
|
|
||||||
<label [translate]="'resize-annotation.dialog.content.type'"></label>
|
|
||||||
|
|
||||||
<mat-form-field>
|
|
||||||
<mat-select formControlName="dictionary">
|
|
||||||
<mat-select-trigger>{{ displayedDictionaryLabel }}</mat-select-trigger>
|
|
||||||
<mat-option [value]="redaction.entity.type">
|
|
||||||
<span> {{ redaction.entity.label }} </span>
|
|
||||||
</mat-option>
|
|
||||||
</mat-select>
|
|
||||||
</mat-form-field>
|
|
||||||
</div>
|
|
||||||
</ng-container>
|
|
||||||
|
|
||||||
<div class="iqser-input-group w-450">
|
<div class="iqser-input-group w-450">
|
||||||
<label [translate]="'resize-annotation.dialog.content.comment'"></label>
|
<label [translate]="'resize-annotation.dialog.content.comment'"></label>
|
||||||
<textarea formControlName="comment" iqserHasScrollbar name="comment" rows="4" type="text"></textarea>
|
<textarea formControlName="comment" iqserHasScrollbar name="comment" rows="4" type="text"></textarea>
|
||||||
|
|||||||
@ -1,10 +1,9 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
import { FormBuilder } from '@angular/forms';
|
||||||
import { IconButtonTypes, IqserDialogComponent } from '@iqser/common-ui';
|
import { IconButtonTypes, IqserDialogComponent } from '@iqser/common-ui';
|
||||||
import { FormBuilder, FormControl, UntypedFormGroup } from '@angular/forms';
|
|
||||||
import { AnnotationWrapper } from '@models/file/annotation.wrapper';
|
import { AnnotationWrapper } from '@models/file/annotation.wrapper';
|
||||||
import { ActiveDossiersService } from '@services/dossiers/active-dossiers.service';
|
|
||||||
import { Dictionary, Dossier } from '@red/domain';
|
import { Dictionary, Dossier } from '@red/domain';
|
||||||
import { Roles } from '@users/roles';
|
import { ActiveDossiersService } from '@services/dossiers/active-dossiers.service';
|
||||||
import { DictionariesMapService } from '@services/entity-services/dictionaries-map.service';
|
import { DictionariesMapService } from '@services/entity-services/dictionaries-map.service';
|
||||||
import { ResizeAnnotationData, ResizeAnnotationResult } from '../../../utils/dialog-types';
|
import { ResizeAnnotationData, ResizeAnnotationResult } from '../../../utils/dialog-types';
|
||||||
|
|
||||||
@ -15,25 +14,20 @@ export class ResizeAnnotationDialogComponent
|
|||||||
extends IqserDialogComponent<ResizeAnnotationDialogComponent, ResizeAnnotationData, ResizeAnnotationResult>
|
extends IqserDialogComponent<ResizeAnnotationDialogComponent, ResizeAnnotationData, ResizeAnnotationResult>
|
||||||
implements OnInit
|
implements OnInit
|
||||||
{
|
{
|
||||||
readonly roles = Roles;
|
readonly #dossier: Dossier;
|
||||||
readonly iconButtonTypes = IconButtonTypes;
|
readonly iconButtonTypes = IconButtonTypes;
|
||||||
|
|
||||||
dictionaries: Dictionary[] = [];
|
dictionaries: Dictionary[] = [];
|
||||||
redaction: AnnotationWrapper;
|
redaction: AnnotationWrapper;
|
||||||
form!: UntypedFormGroup;
|
readonly form = this.#getForm();
|
||||||
|
|
||||||
readonly #dossier: Dossier;
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private readonly _activeDossiersService: ActiveDossiersService,
|
activeDossiersService: ActiveDossiersService,
|
||||||
private readonly _dictionariesMapService: DictionariesMapService,
|
private readonly _dictionariesMapService: DictionariesMapService,
|
||||||
private readonly _formBuilder: FormBuilder,
|
private readonly _formBuilder: FormBuilder,
|
||||||
) {
|
) {
|
||||||
super();
|
super();
|
||||||
this.#dossier = _activeDossiersService.find(this.data.dossierId);
|
this.#dossier = activeDossiersService.find(this.data.dossierId);
|
||||||
this.redaction = this.data.redaction;
|
this.redaction = this.data.redaction;
|
||||||
|
|
||||||
this.form = this.#getForm();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get displayedDictionaryLabel() {
|
get displayedDictionaryLabel() {
|
||||||
@ -44,23 +38,23 @@ export class ResizeAnnotationDialogComponent
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
async ngOnInit() {
|
ngOnInit() {
|
||||||
this.dictionaries = this._dictionariesMapService.get(this.#dossier.dossierTemplateId);
|
this.dictionaries = this._dictionariesMapService.get(this.#dossier.dossierTemplateId);
|
||||||
}
|
}
|
||||||
|
|
||||||
#getForm(): UntypedFormGroup {
|
save() {
|
||||||
return this._formBuilder.group({
|
const formValue = this.form.getRawValue();
|
||||||
comment: [null],
|
|
||||||
dictionary: new FormControl({ value: this.redaction.entity.type, disabled: true }),
|
this.close({
|
||||||
|
comment: formValue.comment,
|
||||||
|
updateDictionary: this.redaction.entity.hasDictionary,
|
||||||
|
addToAllDossiers: this.redaction.entity.hasDictionary,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
save(): void {
|
#getForm() {
|
||||||
const formValue = this.form.getRawValue();
|
return this._formBuilder.group({
|
||||||
|
comment: [null],
|
||||||
this.dialogRef.close({
|
|
||||||
comment: formValue.comment,
|
|
||||||
updateDictionary: this.redaction.entity.hasDictionary,
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,18 +7,17 @@
|
|||||||
|
|
||||||
<div class="dialog-content redaction">
|
<div class="dialog-content redaction">
|
||||||
<div class="iqser-input-group w-450">
|
<div class="iqser-input-group w-450">
|
||||||
<label class="selected-text" [translate]="'resize-redaction.dialog.content.original-text'"></label>
|
<label [translate]="'resize-redaction.dialog.content.original-text'" class="selected-text"></label>
|
||||||
{{ redaction.value }}
|
{{ redaction.value }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="iqser-input-group w-450">
|
<div class="iqser-input-group w-450">
|
||||||
<label class="selected-text" [translate]="'resize-redaction.dialog.content.resized-text'"></label>
|
<label [translate]="'resize-redaction.dialog.content.resized-text'" class="selected-text"></label>
|
||||||
{{ data.text }}
|
{{ data.text }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<iqser-details-radio [options]="options" formControlName="option"></iqser-details-radio>
|
<iqser-details-radio [options]="options" formControlName="option"></iqser-details-radio>
|
||||||
|
|
||||||
<ng-container *deny="roles.getRss">
|
|
||||||
<div class="iqser-input-group required w-450">
|
<div class="iqser-input-group required w-450">
|
||||||
<label [translate]="'resize-redaction.dialog.content.type'"></label>
|
<label [translate]="'resize-redaction.dialog.content.type'"></label>
|
||||||
|
|
||||||
@ -31,7 +30,6 @@
|
|||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</div>
|
</div>
|
||||||
</ng-container>
|
|
||||||
|
|
||||||
<div class="iqser-input-group w-450">
|
<div class="iqser-input-group w-450">
|
||||||
<label [translate]="'resize-redaction.dialog.content.comment'"></label>
|
<label [translate]="'resize-redaction.dialog.content.comment'"></label>
|
||||||
|
|||||||
@ -1,13 +1,13 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
import { FormBuilder, FormControl, FormGroup } from '@angular/forms';
|
||||||
import { DetailsRadioOption, IconButtonTypes, IqserDialogComponent, IqserPermissionsService } from '@iqser/common-ui';
|
import { DetailsRadioOption, IconButtonTypes, IqserDialogComponent, IqserPermissionsService } from '@iqser/common-ui';
|
||||||
import { ResizeRedactionData, ResizeRedactionResult } from '../../utils/dialog-types';
|
|
||||||
import { FormBuilder, FormControl, UntypedFormGroup } from '@angular/forms';
|
|
||||||
import { AnnotationWrapper } from '@models/file/annotation.wrapper';
|
import { AnnotationWrapper } from '@models/file/annotation.wrapper';
|
||||||
import { getResizeRedactionOptions, ResizeOptions, ResizeRedactionOption } from '../../utils/dialog-options';
|
|
||||||
import { ActiveDossiersService } from '@services/dossiers/active-dossiers.service';
|
|
||||||
import { Dictionary, Dossier } from '@red/domain';
|
import { Dictionary, Dossier } from '@red/domain';
|
||||||
import { Roles } from '@users/roles';
|
import { ActiveDossiersService } from '@services/dossiers/active-dossiers.service';
|
||||||
import { DictionariesMapService } from '@services/entity-services/dictionaries-map.service';
|
import { DictionariesMapService } from '@services/entity-services/dictionaries-map.service';
|
||||||
|
import { Roles } from '@users/roles';
|
||||||
|
import { getResizeRedactionOptions, ResizeOptions, ResizeRedactionOption } from '../../utils/dialog-options';
|
||||||
|
import { ResizeRedactionData, ResizeRedactionResult } from '../../utils/dialog-types';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
templateUrl: './resize-redaction-dialog.component.html',
|
templateUrl: './resize-redaction-dialog.component.html',
|
||||||
@ -16,18 +16,18 @@ export class ResizeRedactionDialogComponent
|
|||||||
extends IqserDialogComponent<ResizeRedactionDialogComponent, ResizeRedactionData, ResizeRedactionResult>
|
extends IqserDialogComponent<ResizeRedactionDialogComponent, ResizeRedactionData, ResizeRedactionResult>
|
||||||
implements OnInit
|
implements OnInit
|
||||||
{
|
{
|
||||||
readonly roles = Roles;
|
readonly #applyToAllDossiers = this.data.applyToAllDossiers ?? true;
|
||||||
readonly iconButtonTypes = IconButtonTypes;
|
|
||||||
readonly options: DetailsRadioOption<ResizeRedactionOption>[];
|
|
||||||
|
|
||||||
dictionaries: Dictionary[] = [];
|
|
||||||
redaction: AnnotationWrapper;
|
|
||||||
form!: UntypedFormGroup;
|
|
||||||
|
|
||||||
#applyToAllDossiers: boolean;
|
|
||||||
|
|
||||||
readonly #dossier: Dossier;
|
readonly #dossier: Dossier;
|
||||||
readonly #isRss = this._iqserPermissionsService.has(Roles.getRss);
|
readonly #isRss = this._iqserPermissionsService.has(Roles.getRss);
|
||||||
|
readonly iconButtonTypes = IconButtonTypes;
|
||||||
|
readonly options: DetailsRadioOption<ResizeRedactionOption>[];
|
||||||
|
dictionaries: Dictionary[] = [];
|
||||||
|
redaction: AnnotationWrapper;
|
||||||
|
form: FormGroup<{
|
||||||
|
comment: FormControl<string>;
|
||||||
|
dictionary: FormControl<string>;
|
||||||
|
option: FormControl<DetailsRadioOption<ResizeRedactionOption>>;
|
||||||
|
}>;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private readonly _activeDossiersService: ActiveDossiersService,
|
private readonly _activeDossiersService: ActiveDossiersService,
|
||||||
@ -37,7 +37,6 @@ export class ResizeRedactionDialogComponent
|
|||||||
) {
|
) {
|
||||||
super();
|
super();
|
||||||
this.#dossier = _activeDossiersService.find(this.data.dossierId);
|
this.#dossier = _activeDossiersService.find(this.data.dossierId);
|
||||||
this.#applyToAllDossiers = this.data.applyToAllDossiers ?? true;
|
|
||||||
this.redaction = this.data.redaction;
|
this.redaction = this.data.redaction;
|
||||||
this.options = getResizeRedactionOptions(
|
this.options = getResizeRedactionOptions(
|
||||||
this.redaction,
|
this.redaction,
|
||||||
@ -57,25 +56,26 @@ export class ResizeRedactionDialogComponent
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
async ngOnInit() {
|
ngOnInit() {
|
||||||
this.dictionaries = this._dictionariesMapService.get(this.#dossier.dossierTemplateId);
|
this.dictionaries = this._dictionariesMapService.get(this.#dossier.dossierTemplateId);
|
||||||
}
|
}
|
||||||
|
|
||||||
#getForm(): UntypedFormGroup {
|
save() {
|
||||||
return this._formBuilder.group({
|
|
||||||
comment: [null],
|
|
||||||
dictionary: new FormControl({ value: this.redaction.entity.type, disabled: true }),
|
|
||||||
option: [this.options[0]],
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
save(): void {
|
|
||||||
const formValue = this.form.getRawValue();
|
const formValue = this.form.getRawValue();
|
||||||
const updateDictionary = formValue.option.value === ResizeOptions.IN_DOSSIER;
|
const updateDictionary = formValue.option.value === ResizeOptions.IN_DOSSIER;
|
||||||
|
|
||||||
this.dialogRef.close({
|
super.close({
|
||||||
comment: formValue.comment,
|
comment: formValue.comment,
|
||||||
updateDictionary,
|
updateDictionary,
|
||||||
|
addToAllDossiers: !!formValue.option?.extraOption?.checked,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
#getForm() {
|
||||||
|
return this._formBuilder.group({
|
||||||
|
comment: [null],
|
||||||
|
dictionary: new FormControl({ value: this.redaction.entity.type, disabled: true }),
|
||||||
|
option: this.options[0],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { ManualRedactionService } from './manual-redaction.service';
|
import { IqserDialog } from '@common-ui/dialog/iqser-dialog.service';
|
||||||
|
import { getConfig } from '@iqser/common-ui';
|
||||||
|
import { List, log } from '@iqser/common-ui/lib/utils';
|
||||||
import { AnnotationWrapper } from '@models/file/annotation.wrapper';
|
import { AnnotationWrapper } from '@models/file/annotation.wrapper';
|
||||||
import { firstValueFrom, from, Observable, zip } from 'rxjs';
|
|
||||||
import { getFirstRelevantTextPart } from '../../../utils';
|
|
||||||
import { Core } from '@pdftron/webviewer';
|
import { Core } from '@pdftron/webviewer';
|
||||||
import {
|
import {
|
||||||
DictionaryEntryTypes,
|
DictionaryEntryTypes,
|
||||||
@ -12,37 +12,35 @@ import {
|
|||||||
IRectangle,
|
IRectangle,
|
||||||
IResizeRequest,
|
IResizeRequest,
|
||||||
} from '@red/domain';
|
} from '@red/domain';
|
||||||
import { toPosition } from '../utils/pdf-calculation.utils';
|
|
||||||
import { AnnotationDrawService } from '../../pdf-viewer/services/annotation-draw.service';
|
|
||||||
import { getConfig } from '@iqser/common-ui';
|
|
||||||
import { MatDialog } from '@angular/material/dialog';
|
|
||||||
import { FilePreviewStateService } from './file-preview-state.service';
|
|
||||||
import { FilePreviewDialogService } from './file-preview-dialog.service';
|
|
||||||
import { FileDataService } from './file-data.service';
|
|
||||||
import { PdfViewer } from '../../pdf-viewer/services/pdf-viewer.service';
|
|
||||||
import { REDAnnotationManager } from '../../pdf-viewer/services/annotation-manager.service';
|
|
||||||
import { SkippedService } from './skipped.service';
|
|
||||||
import { REDDocumentViewer } from '../../pdf-viewer/services/document-viewer.service';
|
|
||||||
import { RemoveRedactionDialogComponent } from '../dialogs/remove-redaction-dialog/remove-redaction-dialog.component';
|
|
||||||
import { IqserDialog } from '@common-ui/dialog/iqser-dialog.service';
|
|
||||||
import { DossierTemplatesService } from '@services/dossier-templates/dossier-templates.service';
|
import { DossierTemplatesService } from '@services/dossier-templates/dossier-templates.service';
|
||||||
import { List, log } from '@iqser/common-ui/lib/utils';
|
|
||||||
import { PermissionsService } from '@services/permissions.service';
|
import { PermissionsService } from '@services/permissions.service';
|
||||||
|
import { firstValueFrom, from, Observable, zip } from 'rxjs';
|
||||||
|
import { getFirstRelevantTextPart } from '../../../utils';
|
||||||
|
import { AnnotationDrawService } from '../../pdf-viewer/services/annotation-draw.service';
|
||||||
|
import { REDAnnotationManager } from '../../pdf-viewer/services/annotation-manager.service';
|
||||||
|
import { REDDocumentViewer } from '../../pdf-viewer/services/document-viewer.service';
|
||||||
|
import { PdfViewer } from '../../pdf-viewer/services/pdf-viewer.service';
|
||||||
|
import { EditAnnotationDialogComponent } from '../dialogs/docu-mine/edit-annotation-dialog/edit-annotation-dialog.component';
|
||||||
|
import { RemoveAnnotationDialogComponent } from '../dialogs/docu-mine/remove-annotation-dialog/remove-annotation-dialog.component';
|
||||||
|
import { ResizeAnnotationDialogComponent } from '../dialogs/docu-mine/resize-annotation-dialog/resize-annotation-dialog.component';
|
||||||
|
import { EditRedactionDialogComponent } from '../dialogs/edit-redaction-dialog/edit-redaction-dialog.component';
|
||||||
|
import { RedactRecommendationDialogComponent } from '../dialogs/redact-recommendation-dialog/redact-recommendation-dialog.component';
|
||||||
|
import { RemoveRedactionDialogComponent } from '../dialogs/remove-redaction-dialog/remove-redaction-dialog.component';
|
||||||
|
import { ResizeRedactionDialogComponent } from '../dialogs/resize-redaction-dialog/resize-redaction-dialog.component';
|
||||||
|
import { RemoveRedactionOptions } from '../utils/dialog-options';
|
||||||
import {
|
import {
|
||||||
EditRedactionData,
|
EditRedactionData,
|
||||||
RemoveRedactionData,
|
RemoveRedactionData,
|
||||||
RemoveRedactionPermissions,
|
RemoveRedactionPermissions,
|
||||||
RemoveRedactionResult,
|
RemoveRedactionResult,
|
||||||
ResizeRedactionData,
|
ResizeRedactionData,
|
||||||
ResizeRedactionResult,
|
|
||||||
} from '../utils/dialog-types';
|
} from '../utils/dialog-types';
|
||||||
import { RemoveRedactionOptions } from '../utils/dialog-options';
|
import { toPosition } from '../utils/pdf-calculation.utils';
|
||||||
import { RemoveAnnotationDialogComponent } from '../dialogs/docu-mine/remove-annotation-dialog/remove-annotation-dialog.component';
|
import { FileDataService } from './file-data.service';
|
||||||
import { ResizeRedactionDialogComponent } from '../dialogs/resize-redaction-dialog/resize-redaction-dialog.component';
|
import { FilePreviewDialogService } from './file-preview-dialog.service';
|
||||||
import { ResizeAnnotationDialogComponent } from '../dialogs/docu-mine/resize-annotation-dialog/resize-annotation-dialog.component';
|
import { FilePreviewStateService } from './file-preview-state.service';
|
||||||
import { EditRedactionDialogComponent } from '../dialogs/edit-redaction-dialog/edit-redaction-dialog.component';
|
import { ManualRedactionService } from './manual-redaction.service';
|
||||||
import { EditAnnotationDialogComponent } from '../dialogs/docu-mine/edit-annotation-dialog/edit-annotation-dialog.component';
|
import { SkippedService } from './skipped.service';
|
||||||
import { RedactRecommendationDialogComponent } from '../dialogs/redact-recommendation-dialog/redact-recommendation-dialog.component';
|
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class AnnotationActionsService {
|
export class AnnotationActionsService {
|
||||||
@ -51,7 +49,6 @@ export class AnnotationActionsService {
|
|||||||
constructor(
|
constructor(
|
||||||
private readonly _manualRedactionService: ManualRedactionService,
|
private readonly _manualRedactionService: ManualRedactionService,
|
||||||
private readonly _dialogService: FilePreviewDialogService,
|
private readonly _dialogService: FilePreviewDialogService,
|
||||||
private readonly _dialog: MatDialog,
|
|
||||||
private readonly _iqserDialog: IqserDialog,
|
private readonly _iqserDialog: IqserDialog,
|
||||||
private readonly _pdf: PdfViewer,
|
private readonly _pdf: PdfViewer,
|
||||||
private readonly _documentViewer: REDDocumentViewer,
|
private readonly _documentViewer: REDDocumentViewer,
|
||||||
@ -119,6 +116,7 @@ export class AnnotationActionsService {
|
|||||||
if (!result) {
|
if (!result) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.#isDocumine) {
|
if (!this.#isDocumine) {
|
||||||
const changeLegalBasisBody = annotations.map(annotation => ({
|
const changeLegalBasisBody = annotations.map(annotation => ({
|
||||||
annotationId: annotation.id,
|
annotationId: annotation.id,
|
||||||
@ -157,7 +155,7 @@ export class AnnotationActionsService {
|
|||||||
const data = {
|
const data = {
|
||||||
redaction,
|
redaction,
|
||||||
dossier: this._state.dossier(),
|
dossier: this._state.dossier(),
|
||||||
falsePositiveContext: this._getFalsePositiveText(redaction),
|
falsePositiveContext: this.#getFalsePositiveText(redaction),
|
||||||
permissions: removePermissions,
|
permissions: removePermissions,
|
||||||
applyToAllDossiers: isApprover ? dossierTemplate.applyDictionaryUpdatesToAllDossiersByDefault : false,
|
applyToAllDossiers: isApprover ? dossierTemplate.applyDictionaryUpdatesToAllDossiersByDefault : false,
|
||||||
isApprover,
|
isApprover,
|
||||||
@ -165,7 +163,10 @@ export class AnnotationActionsService {
|
|||||||
|
|
||||||
const result = await this.#getRemoveRedactionDialog(data).result();
|
const result = await this.#getRemoveRedactionDialog(data).result();
|
||||||
|
|
||||||
if (result) {
|
if (!result) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
result.option.value === RemoveRedactionOptions.FALSE_POSITIVE ||
|
result.option.value === RemoveRedactionOptions.FALSE_POSITIVE ||
|
||||||
result.option.value === RemoveRedactionOptions.DO_NOT_RECOMMEND
|
result.option.value === RemoveRedactionOptions.DO_NOT_RECOMMEND
|
||||||
@ -175,7 +176,6 @@ export class AnnotationActionsService {
|
|||||||
this.#removeRedaction(redaction, result);
|
this.#removeRedaction(redaction, result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
recategorizeImages(annotations: AnnotationWrapper[]) {
|
recategorizeImages(annotations: AnnotationWrapper[]) {
|
||||||
const data = { annotations, dossier: this._state.dossier() };
|
const data = { annotations, dossier: this._state.dossier() };
|
||||||
@ -208,7 +208,6 @@ export class AnnotationActionsService {
|
|||||||
const data = this.#getRedactRecommendationDialogData(recommendations);
|
const data = this.#getRedactRecommendationDialogData(recommendations);
|
||||||
const dialog = this._iqserDialog.openDefault(RedactRecommendationDialogComponent, { data });
|
const dialog = this._iqserDialog.openDefault(RedactRecommendationDialogComponent, { data });
|
||||||
const result = await dialog.result();
|
const result = await dialog.result();
|
||||||
console.log(result);
|
|
||||||
if (!result) {
|
if (!result) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -217,7 +216,9 @@ export class AnnotationActionsService {
|
|||||||
this.cancelResize(recommendations[0]).then();
|
this.cancelResize(recommendations[0]).then();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.#processObsAndEmit(this._manualRedactionService.addRecommendation(recommendations, result.redaction, dossierId, fileId));
|
return this.#processObsAndEmit(
|
||||||
|
this._manualRedactionService.addRecommendation(recommendations, result.redaction, dossierId, fileId),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
async resize(annotationWrapper: AnnotationWrapper) {
|
async resize(annotationWrapper: AnnotationWrapper) {
|
||||||
@ -264,23 +265,26 @@ export class AnnotationActionsService {
|
|||||||
dossierId: dossier.dossierId,
|
dossierId: dossier.dossierId,
|
||||||
};
|
};
|
||||||
|
|
||||||
const result: ResizeRedactionResult = await this.#getResizeRedactionDialog(data).result();
|
const result = await this.#getResizeRedactionDialog(data).result();
|
||||||
|
|
||||||
|
if (!result) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (result) {
|
|
||||||
const resizeRequest: IResizeRequest = {
|
const resizeRequest: IResizeRequest = {
|
||||||
annotationId: annotation.id,
|
annotationId: annotation.id,
|
||||||
comment: result.comment,
|
comment: result.comment,
|
||||||
positions: textAndPositions.positions,
|
positions: textAndPositions.positions,
|
||||||
value: text,
|
value: text,
|
||||||
updateDictionary: result.updateDictionary,
|
updateDictionary: result.updateDictionary,
|
||||||
|
addToAllDossiers: result.addToAllDossiers,
|
||||||
};
|
};
|
||||||
|
|
||||||
this.cancelResize(annotation).then();
|
await this.cancelResize(annotation);
|
||||||
|
|
||||||
const { fileId, dossierId } = this._state;
|
const { fileId, dossierId } = this._state;
|
||||||
const request = this._manualRedactionService.resizeOrSuggestResize([resizeRequest], dossierId, fileId);
|
const request = this._manualRedactionService.resize([resizeRequest], dossierId, fileId);
|
||||||
this.#processObsAndEmit(request);
|
return this.#processObsAndEmit(request);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async cancelResize(annotationWrapper: AnnotationWrapper) {
|
async cancelResize(annotationWrapper: AnnotationWrapper) {
|
||||||
@ -330,7 +334,7 @@ export class AnnotationActionsService {
|
|||||||
.catch(() => this._fileDataService.annotationsChanged());
|
.catch(() => this._fileDataService.annotationsChanged());
|
||||||
}
|
}
|
||||||
|
|
||||||
private _getFalsePositiveText(annotation: AnnotationWrapper) {
|
#getFalsePositiveText(annotation: AnnotationWrapper) {
|
||||||
if (!annotation.canBeMarkedAsFalsePositive) {
|
if (!annotation.canBeMarkedAsFalsePositive) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -421,7 +425,7 @@ export class AnnotationActionsService {
|
|||||||
#setAsFalsePositive(redaction: AnnotationWrapper, dialogResult: RemoveRedactionResult) {
|
#setAsFalsePositive(redaction: AnnotationWrapper, dialogResult: RemoveRedactionResult) {
|
||||||
const request = {
|
const request = {
|
||||||
sourceId: redaction.id,
|
sourceId: redaction.id,
|
||||||
value: this._getFalsePositiveText(redaction),
|
value: this.#getFalsePositiveText(redaction),
|
||||||
type: redaction.type,
|
type: redaction.type,
|
||||||
positions: redaction.positions,
|
positions: redaction.positions,
|
||||||
addToDictionary: true,
|
addToDictionary: true,
|
||||||
|
|||||||
@ -1,4 +1,10 @@
|
|||||||
|
import { HttpErrorResponse, HttpStatusCode } from '@angular/common/http';
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
|
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||||
|
import { GenericService, IqserPermissionsService, Toaster } from '@iqser/common-ui';
|
||||||
|
import { List } from '@iqser/common-ui/lib/utils';
|
||||||
|
import { type AnnotationWrapper } from '@models/file/annotation.wrapper';
|
||||||
|
import { type ManualRedactionEntryType } from '@models/file/manual-redaction-entry.wrapper';
|
||||||
import type {
|
import type {
|
||||||
DictionaryActions,
|
DictionaryActions,
|
||||||
Dossier,
|
Dossier,
|
||||||
@ -10,19 +16,13 @@ import type {
|
|||||||
IResizeRequest,
|
IResizeRequest,
|
||||||
ManualRedactionActions,
|
ManualRedactionActions,
|
||||||
} from '@red/domain';
|
} from '@red/domain';
|
||||||
import { type AnnotationWrapper } from '@models/file/annotation.wrapper';
|
import { ActiveDossiersService } from '@services/dossiers/active-dossiers.service';
|
||||||
import { GenericService, IqserPermissionsService, Toaster } from '@iqser/common-ui';
|
|
||||||
import { tap } from 'rxjs/operators';
|
|
||||||
import { PermissionsService } from '@services/permissions.service';
|
import { PermissionsService } from '@services/permissions.service';
|
||||||
import { dictionaryActionsTranslations, manualRedactionActionsTranslations } from '@translations/annotation-actions-translations';
|
import { dictionaryActionsTranslations, manualRedactionActionsTranslations } from '@translations/annotation-actions-translations';
|
||||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
|
||||||
import { HttpErrorResponse, HttpStatusCode } from '@angular/common/http';
|
|
||||||
import { ActiveDossiersService } from '@services/dossiers/active-dossiers.service';
|
|
||||||
import { type ManualRedactionEntryType } from '@models/file/manual-redaction-entry.wrapper';
|
|
||||||
import { NGXLogger } from 'ngx-logger';
|
|
||||||
import { Roles } from '@users/roles';
|
import { Roles } from '@users/roles';
|
||||||
|
import { NGXLogger } from 'ngx-logger';
|
||||||
import { firstValueFrom, of } from 'rxjs';
|
import { firstValueFrom, of } from 'rxjs';
|
||||||
import { List } from '@iqser/common-ui/lib/utils';
|
import { tap } from 'rxjs/operators';
|
||||||
|
|
||||||
function getResponseType(error: boolean, isConflict: boolean) {
|
function getResponseType(error: boolean, isConflict: boolean) {
|
||||||
const isConflictError = isConflict ? 'conflictError' : 'error';
|
const isConflictError = isConflict ? 'conflictError' : 'error';
|
||||||
@ -120,10 +120,6 @@ export class ManualRedactionService extends GenericService<IManualAddResponse> {
|
|||||||
return this.undo(annotationIds, dossierId, fileId).pipe(this.#showToast('undo', modifyDictionary));
|
return this.undo(annotationIds, dossierId, fileId).pipe(this.#showToast('undo', modifyDictionary));
|
||||||
}
|
}
|
||||||
|
|
||||||
resizeOrSuggestResize(requests: List<IResizeRequest>, dossierId: string, fileId: string) {
|
|
||||||
return this.resize(requests, dossierId, fileId);
|
|
||||||
}
|
|
||||||
|
|
||||||
removeRedaction(body: List<IRemoveRedactionRequest>, dossierId: string, fileId: string, removeFromDictionary = false, isHint = false) {
|
removeRedaction(body: List<IRemoveRedactionRequest>, dossierId: string, fileId: string, removeFromDictionary = false, isHint = false) {
|
||||||
return this.remove(body, dossierId, fileId).pipe(this.#showToast(!isHint ? 'remove' : 'remove-hint', removeFromDictionary));
|
return this.remove(body, dossierId, fileId).pipe(this.#showToast(!isHint ? 'remove' : 'remove-hint', removeFromDictionary));
|
||||||
}
|
}
|
||||||
@ -149,10 +145,6 @@ export class ManualRedactionService extends GenericService<IManualAddResponse> {
|
|||||||
return this._post(body, `${this.#bulkRedaction}/recategorize/${dossierId}/${fileId}`).pipe(this.#log('Recategorize', body));
|
return this._post(body, `${this.#bulkRedaction}/recategorize/${dossierId}/${fileId}`).pipe(this.#log('Recategorize', body));
|
||||||
}
|
}
|
||||||
|
|
||||||
requestRecategorize(body: List<IRecategorizationRequest>, dossierId: string, fileId: string) {
|
|
||||||
return this._post(body, `${this.#bulkRequest}/recategorize/${dossierId}/${fileId}`).pipe(this.#log('Request recategorize', body));
|
|
||||||
}
|
|
||||||
|
|
||||||
legalBasisChange(body: List<ILegalBasisChangeRequest>, dossierId: string, fileId: string) {
|
legalBasisChange(body: List<ILegalBasisChangeRequest>, dossierId: string, fileId: string) {
|
||||||
return this._post(body, `${this.#bulkRedaction}/legalBasisChange/${dossierId}/${fileId}`).pipe(
|
return this._post(body, `${this.#bulkRedaction}/legalBasisChange/${dossierId}/${fileId}`).pipe(
|
||||||
this.#log('Legal basis change', body),
|
this.#log('Legal basis change', body),
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
|
import { DetailsRadioOption } from '@iqser/common-ui';
|
||||||
|
import { AnnotationWrapper } from '@models/file/annotation.wrapper';
|
||||||
import { ManualRedactionEntryWrapper } from '@models/file/manual-redaction-entry.wrapper';
|
import { ManualRedactionEntryWrapper } from '@models/file/manual-redaction-entry.wrapper';
|
||||||
import { Dictionary, Dossier, File, IAddRedactionRequest, IManualRedactionEntry } from '@red/domain';
|
import { Dictionary, Dossier, File, IAddRedactionRequest, IManualRedactionEntry } from '@red/domain';
|
||||||
import { AnnotationWrapper } from '@models/file/annotation.wrapper';
|
|
||||||
import { DetailsRadioOption } from '@iqser/common-ui';
|
|
||||||
import { RemoveRedactionOption } from './dialog-options';
|
import { RemoveRedactionOption } from './dialog-options';
|
||||||
|
|
||||||
export interface RedactTextData {
|
export interface RedactTextData {
|
||||||
@ -60,6 +60,7 @@ export interface ResizeRedactionData extends ResizeAnnotationData {
|
|||||||
export interface ResizeAnnotationResult {
|
export interface ResizeAnnotationResult {
|
||||||
comment: string;
|
comment: string;
|
||||||
updateDictionary: boolean;
|
updateDictionary: boolean;
|
||||||
|
addToAllDossiers?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type ResizeRedactionResult = ResizeAnnotationResult;
|
export type ResizeRedactionResult = ResizeAnnotationResult;
|
||||||
|
|||||||
@ -6,4 +6,5 @@ export interface IResizeRequest {
|
|||||||
positions: IRectangle[];
|
positions: IRectangle[];
|
||||||
value: string;
|
value: string;
|
||||||
updateDictionary?: boolean;
|
updateDictionary?: boolean;
|
||||||
|
addToAllDossiers?: boolean;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user