RED-10132: save comment value for bulkLocal as well.
This commit is contained in:
parent
bf7fab3600
commit
16a8d91815
@ -105,14 +105,6 @@ export class EditRedactionDialogComponent
|
||||
super();
|
||||
}
|
||||
|
||||
extraOptionChanged(option: DetailsRadioOption<EditRedactionOption | RectangleRedactOption>): void {
|
||||
if (option.value === RectangleRedactOptions.MULTIPLE_PAGES) {
|
||||
setTimeout(() => {
|
||||
this.form.get('option')?.updateValueAndValidity();
|
||||
}, 0);
|
||||
}
|
||||
}
|
||||
|
||||
get displayedDictionaryLabel() {
|
||||
const selectedDictionaryType = this.form.controls.type.value;
|
||||
if (selectedDictionaryType) {
|
||||
@ -164,6 +156,14 @@ export class EditRedactionDialogComponent
|
||||
return this.annotations.every(annotation => annotation.type === this.annotations[0].type);
|
||||
}
|
||||
|
||||
extraOptionChanged(option: DetailsRadioOption<EditRedactionOption | RectangleRedactOption>): void {
|
||||
if (option.value === RectangleRedactOptions.MULTIPLE_PAGES) {
|
||||
setTimeout(() => {
|
||||
this.form.get('option')?.updateValueAndValidity();
|
||||
}, 0);
|
||||
}
|
||||
}
|
||||
|
||||
async ngOnInit() {
|
||||
this.#setTypes();
|
||||
const data = await firstValueFrom(this._justificationsService.loadAll(this.#dossier.dossierTemplateId));
|
||||
|
||||
@ -77,7 +77,7 @@ export class RectangleAnnotationDialog
|
||||
private readonly _toaster: Toaster,
|
||||
) {
|
||||
super();
|
||||
this.#dossier = activeDossiersService.find(this.data.dossierId);
|
||||
this.#dossier = this.activeDossiersService.find(this.data.dossierId);
|
||||
|
||||
this.options = getRectangleRedactOptions();
|
||||
|
||||
@ -85,6 +85,10 @@ export class RectangleAnnotationDialog
|
||||
this.initialFormValue = this.form.getRawValue();
|
||||
}
|
||||
|
||||
get #isMultiplePages() {
|
||||
return this.form.get('option').value.value === RectangleRedactOptions.MULTIPLE_PAGES;
|
||||
}
|
||||
|
||||
extraOptionChanged(option: DetailsRadioOption<RectangleRedactOption>): void {
|
||||
if (option.value === RectangleRedactOptions.MULTIPLE_PAGES) {
|
||||
setTimeout(() => {
|
||||
@ -109,11 +113,8 @@ export class RectangleAnnotationDialog
|
||||
save() {
|
||||
this.#enhanceManualRedaction(this.data.manualRedactionEntryWrapper.manualRedactionEntry);
|
||||
try {
|
||||
const annotation = (
|
||||
this.form.get('option').value.value === RectangleRedactOptions.MULTIPLE_PAGES
|
||||
? this.#multiplePagesRectangle
|
||||
: this.data.manualRedactionEntryWrapper
|
||||
).manualRedactionEntry;
|
||||
const annotation = (this.#isMultiplePages ? this.#multiplePagesRectangle : this.data.manualRedactionEntryWrapper)
|
||||
.manualRedactionEntry;
|
||||
super.close({
|
||||
annotation,
|
||||
});
|
||||
@ -143,7 +144,7 @@ export class RectangleAnnotationDialog
|
||||
|
||||
addRedactionRequest.addToDictionary = false;
|
||||
const commentValue = this.form.get('comment').value;
|
||||
addRedactionRequest.comment = commentValue ? { text: commentValue } : null;
|
||||
addRedactionRequest.comment = commentValue ? (this.#isMultiplePages ? commentValue : { text: commentValue }) : null;
|
||||
addRedactionRequest.section = this.form.get('section').value;
|
||||
addRedactionRequest.value = this.form.get('classification').value;
|
||||
}
|
||||
|
||||
@ -102,6 +102,10 @@ export class RedactRecommendationDialogComponent
|
||||
this.form.controls.option.setValue(this.options[0]);
|
||||
}
|
||||
|
||||
get isBulkLocal(): boolean {
|
||||
return this.form.controls.option.value.value === ResizeOptions.IN_DOCUMENT;
|
||||
}
|
||||
|
||||
get displayedDictionaryLabel() {
|
||||
const dictType = this.form.controls.dictionary.value;
|
||||
if (dictType) {
|
||||
@ -153,7 +157,7 @@ export class RedactRecommendationDialogComponent
|
||||
this.close({
|
||||
redaction,
|
||||
isMulti: this.isMulti,
|
||||
bulkLocal: this.form.controls.option.value.value === ResizeOptions.IN_DOCUMENT,
|
||||
bulkLocal: this.isBulkLocal,
|
||||
});
|
||||
}
|
||||
|
||||
@ -181,7 +185,7 @@ export class RedactRecommendationDialogComponent
|
||||
}
|
||||
|
||||
const commentValue = this.form.controls.comment.value;
|
||||
addRedactionRequest.comment = commentValue ? { text: commentValue } : null;
|
||||
addRedactionRequest.comment = commentValue ? (this.isBulkLocal ? commentValue : { text: commentValue }) : null;
|
||||
addRedactionRequest.addToAllDossiers = this.data.isApprover && this.dictionaryRequest && this.#applyToAllDossiers;
|
||||
return addRedactionRequest;
|
||||
}
|
||||
|
||||
@ -10,7 +10,7 @@ import { DetailsRadioOption } from '@common-ui/inputs/details-radio/details-radi
|
||||
import { DetailsRadioComponent } from '@common-ui/inputs/details-radio/details-radio.component';
|
||||
import { CircleButtonComponent, HasScrollbarDirective, IconButtonComponent, IconButtonTypes, IqserDialogComponent } from '@iqser/common-ui';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { Dictionary, IAddRedactionRequest, SuperTypes } from '@red/domain';
|
||||
import { Dictionary, SuperTypes } from '@red/domain';
|
||||
import { ActiveDossiersService } from '@services/dossiers/active-dossiers.service';
|
||||
import { DictionaryService } from '@services/entity-services/dictionary.service';
|
||||
import { JustificationsService } from '@services/entity-services/justifications.service';
|
||||
@ -116,6 +116,10 @@ export class RedactTextDialogComponent
|
||||
);
|
||||
}
|
||||
|
||||
get isBulkLocal() {
|
||||
return this.form.controls.option.value.value === ResizeOptions.IN_DOCUMENT;
|
||||
}
|
||||
|
||||
get isSystemDefault(): boolean {
|
||||
return this._userPreferences.getAddRedactionDefaultOption() === SystemDefaultOption.SYSTEM_DEFAULT;
|
||||
}
|
||||
@ -182,7 +186,7 @@ export class RedactTextDialogComponent
|
||||
this.close({
|
||||
redaction,
|
||||
dictionary: this.dictionaries.find(d => d.type === this.form.controls.dictionary.value),
|
||||
bulkLocal: this.form.controls.option.value.value === ResizeOptions.IN_DOCUMENT,
|
||||
bulkLocal: this.isBulkLocal,
|
||||
});
|
||||
}
|
||||
|
||||
@ -259,6 +263,7 @@ export class RedactTextDialogComponent
|
||||
comment: this.form.controls.comment.value,
|
||||
isApprover: this.data.isApprover,
|
||||
applyToAllDossiers: this.#applyToAllDossiers,
|
||||
bulkLocal: this.isBulkLocal,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@ -26,7 +26,6 @@ import {
|
||||
} from '../../components/selected-annotations-table/selected-annotations-table.component';
|
||||
import { getRectangleRedactOptions, getRemoveRedactionOptions } from '../../utils/dialog-options';
|
||||
import {
|
||||
EditRedactionOption,
|
||||
RectangleRedactOption,
|
||||
RectangleRedactOptions,
|
||||
RemoveRedactionData,
|
||||
@ -35,6 +34,7 @@ import {
|
||||
RemoveRedactionResult,
|
||||
ResizeOptions,
|
||||
} from '../../utils/dialog-types';
|
||||
import { isJustOne } from '@common-ui/utils';
|
||||
import { validatePageRange } from '../../utils/form-validators';
|
||||
import { parseRectanglePosition, parseSelectedPageNumbers } from '../../utils/enhance-manual-redaction-request.utils';
|
||||
|
||||
@ -157,7 +157,7 @@ export class RemoveRedactionDialogComponent extends IqserDialogComponent<
|
||||
}
|
||||
|
||||
get isBulk() {
|
||||
return this.data.redactions.length > 1;
|
||||
return !isJustOne(this.data.redactions);
|
||||
}
|
||||
|
||||
get redactedTextsAreaHeight() {
|
||||
|
||||
@ -51,7 +51,6 @@ import { FilePreviewStateService } from './file-preview-state.service';
|
||||
import { ManualRedactionService } from './manual-redaction.service';
|
||||
import { SkippedService } from './skipped.service';
|
||||
import { NON_READABLE_CONTENT } from '../dialogs/rectangle-annotation-dialog/rectangle-annotation-dialog.component';
|
||||
import { result } from 'lodash-es';
|
||||
|
||||
@Injectable()
|
||||
export class AnnotationActionsService {
|
||||
@ -86,7 +85,7 @@ export class AnnotationActionsService {
|
||||
const { dossierId, fileId } = this._state;
|
||||
const data = { dossier: this._state.dossier(), annotations, hint };
|
||||
this._dialogService.openDialog('forceAnnotation', data, (request: ILegalBasisChangeRequest) => {
|
||||
let obs$;
|
||||
let obs$: Observable<unknown>;
|
||||
if (request.option === ForceAnnotationOptions.ONLY_HERE) {
|
||||
obs$ = this._manualRedactionService.bulkForce(
|
||||
annotations.map(a => ({ ...request, annotationId: a.id })),
|
||||
@ -158,6 +157,7 @@ export class AnnotationActionsService {
|
||||
rectangle: annotations[0].AREA,
|
||||
pageNumbers: result.pageNumbers,
|
||||
position: result.position,
|
||||
comment: result.comment,
|
||||
};
|
||||
}
|
||||
|
||||
@ -487,7 +487,9 @@ export class AnnotationActionsService {
|
||||
for (let i = 0; i < splitNumber; i++) {
|
||||
splitRequests.push(requests.slice(i * maximumNumberEntries, (i + 1) * maximumNumberEntries));
|
||||
}
|
||||
splitRequests.push(requests.slice(splitNumber * maximumNumberEntries, splitNumber * maximumNumberEntries + remainder));
|
||||
if (remainder) {
|
||||
splitRequests.push(requests.slice(splitNumber * maximumNumberEntries, splitNumber * maximumNumberEntries + remainder));
|
||||
}
|
||||
|
||||
const promises = [];
|
||||
for (const split of splitRequests) {
|
||||
@ -601,12 +603,14 @@ export class AnnotationActionsService {
|
||||
originTypes: [redaction.entry.type],
|
||||
pageNumbers: dialogResult.pageNumbers,
|
||||
position: dialogResult.position,
|
||||
comment: dialogResult.comment,
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
value: redaction.value,
|
||||
rectangle: false,
|
||||
comment: dialogResult.comment,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -12,6 +12,7 @@ export interface EnhanceRequestData {
|
||||
readonly comment: string;
|
||||
readonly isApprover: boolean;
|
||||
readonly applyToAllDossiers: boolean;
|
||||
readonly bulkLocal: boolean;
|
||||
}
|
||||
|
||||
interface MultiplePagesRectangleData {
|
||||
@ -43,7 +44,7 @@ export const enhanceManualRedactionRequest = (addRedactionRequest: IAddRedaction
|
||||
addRedactionRequest.reason = 'Dictionary Request';
|
||||
}
|
||||
const commentValue = data.comment;
|
||||
addRedactionRequest.comment = commentValue ? { text: commentValue } : null;
|
||||
addRedactionRequest.comment = commentValue ? (data.bulkLocal ? commentValue : { text: commentValue }) : null;
|
||||
addRedactionRequest.addToAllDossiers = data.isApprover && data.dictionaryRequest && data.applyToAllDossiers;
|
||||
};
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@ import { DictionaryEntryType } from './dictionary-entry-types';
|
||||
export interface IAddRedactionRequest {
|
||||
addToDictionary?: boolean;
|
||||
dictionaryEntryType?: DictionaryEntryType;
|
||||
comment?: { text: string };
|
||||
comment?: { text: string } | string;
|
||||
legalBasis?: string;
|
||||
positions?: List<IRectangle>;
|
||||
reason?: string;
|
||||
|
||||
@ -19,4 +19,5 @@ export interface IBulkRecategorizationRequest {
|
||||
readonly rectangle: boolean;
|
||||
readonly position?: IEntityLogEntryPosition;
|
||||
readonly pageNumbers?: number[];
|
||||
readonly comment?: string;
|
||||
}
|
||||
|
||||
@ -16,4 +16,5 @@ export interface IBulkLocalRemoveRequest {
|
||||
originTypes?: string[];
|
||||
originLegalBases?: string[];
|
||||
pageNumbers?: number[];
|
||||
comment?: string;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user