diff --git a/apps/red-ui/src/app/modules/file-preview/dialogs/resize-annotation-dialog/resize-annotation-dialog.component.html b/apps/red-ui/src/app/modules/file-preview/dialogs/resize-annotation-dialog/resize-annotation-dialog.component.html index dcdc1d4e3..3d03e1bb7 100644 --- a/apps/red-ui/src/app/modules/file-preview/dialogs/resize-annotation-dialog/resize-annotation-dialog.component.html +++ b/apps/red-ui/src/app/modules/file-preview/dialogs/resize-annotation-dialog/resize-annotation-dialog.component.html @@ -7,6 +7,12 @@ + +
+ + {{ 'resize-annotation-dialog.content.update-dictionary' | translate: { text: this.text } }} + +
@@ -17,5 +23,5 @@
- + diff --git a/apps/red-ui/src/app/modules/file-preview/dialogs/resize-annotation-dialog/resize-annotation-dialog.component.ts b/apps/red-ui/src/app/modules/file-preview/dialogs/resize-annotation-dialog/resize-annotation-dialog.component.ts index 9df0e5e81..630415ce5 100644 --- a/apps/red-ui/src/app/modules/file-preview/dialogs/resize-annotation-dialog/resize-annotation-dialog.component.ts +++ b/apps/red-ui/src/app/modules/file-preview/dialogs/resize-annotation-dialog/resize-annotation-dialog.component.ts @@ -1,8 +1,8 @@ import { Component, Inject, Injector, OnInit } from '@angular/core'; import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; import { FormBuilder } from '@angular/forms'; -import { Dossier } from '@red/domain'; import { BaseDialogComponent } from '@iqser/common-ui'; +import { AnnotationWrapper } from '@models/file/annotation.wrapper'; @Component({ templateUrl: './resize-annotation-dialog.component.html', @@ -12,7 +12,7 @@ export class ResizeAnnotationDialogComponent extends BaseDialogComponent impleme private readonly _formBuilder: FormBuilder, protected readonly _injector: Injector, protected readonly _dialogRef: MatDialogRef, - @Inject(MAT_DIALOG_DATA) private readonly _data: { dossier: Dossier }, + @Inject(MAT_DIALOG_DATA) private readonly _data: { annotation: AnnotationWrapper; text?: string }, ) { super(_injector, _dialogRef); } @@ -21,16 +21,24 @@ export class ResizeAnnotationDialogComponent extends BaseDialogComponent impleme return !this.valid; } + get text(): string { + return this._data.text; + } + ngOnInit() { super.ngOnInit(); - this.form = this._formBuilder.group({ comment: [null] }); + const controlsConfig = { comment: [null] }; + + if (this._data.annotation.isModifyDictionary) { + controlsConfig['updateDictionary'] = [false]; + } + + this.form = this._formBuilder.group(controlsConfig); this.initialFormValue = this.form.getRawValue(); } save() { - this._dialogRef.close({ - comment: this.form.get('comment').value, - }); + this._dialogRef.close(this.form.getRawValue()); } } diff --git a/apps/red-ui/src/app/modules/file-preview/services/annotation-actions.service.ts b/apps/red-ui/src/app/modules/file-preview/services/annotation-actions.service.ts index d83263d47..d17b230d7 100644 --- a/apps/red-ui/src/app/modules/file-preview/services/annotation-actions.service.ts +++ b/apps/red-ui/src/app/modules/file-preview/services/annotation-actions.service.ts @@ -217,8 +217,8 @@ export class AnnotationActionsService { img: this._convertPath('/assets/icons/general/check.svg'), title: this._translateService.instant('annotation-actions.resize-accept.label'), onClick: () => - this._ngZone.run(() => { - this.acceptResize(null, firstAnnotation); + this._ngZone.run(async () => { + await this.acceptResize(null, firstAnnotation); }), }); availableActions.push({ @@ -412,22 +412,21 @@ export class AnnotationActionsService { this._pdf.annotationManager.selectAnnotation(viewerAnnotation); } - acceptResize($event: MouseEvent, annotationWrapper: AnnotationWrapper) { - const data = { dossier: this._dossier }; + async acceptResize($event: MouseEvent, annotation: AnnotationWrapper): Promise { const fileId = this._state.fileId; - this._dialogService.openDialog('resizeAnnotation', $event, data, async (result: { comment: string }) => { - const textAndPositions = await this._extractTextAndPositions(annotationWrapper.id); - const text = - annotationWrapper.value === 'Rectangle' ? 'Rectangle' : annotationWrapper.isImage ? 'Image' : textAndPositions.text; - + const textAndPositions = await this._extractTextAndPositions(annotation.id); + const text = annotation.value === 'Rectangle' ? 'Rectangle' : annotation.isImage ? 'Image' : textAndPositions.text; + const data = { annotation, text }; + this._dialogService.openDialog('resizeAnnotation', $event, data, async (result: { comment: string; updateDictionary: boolean }) => { const resizeRequest: IResizeRequest = { - annotationId: annotationWrapper.id, + annotationId: annotation.id, comment: result.comment, positions: textAndPositions.positions, value: text, + updateDictionary: result.updateDictionary, }; - this._processObsAndEmit(this._manualRedactionService.resizeOrSuggestResize([resizeRequest], data.dossier.id, fileId)); + this._processObsAndEmit(this._manualRedactionService.resizeOrSuggestResize([resizeRequest], this._dossier.id, fileId)); }); } @@ -559,8 +558,6 @@ export class AnnotationActionsService { words.push(...quadWords); } - console.log(words.join(' ')); - return { text: words.join(' '), positions: rectangles, diff --git a/apps/red-ui/src/app/modules/file-preview/services/annotations-listing.service.ts b/apps/red-ui/src/app/modules/file-preview/services/annotations-listing.service.ts index 657a30297..241920272 100644 --- a/apps/red-ui/src/app/modules/file-preview/services/annotations-listing.service.ts +++ b/apps/red-ui/src/app/modules/file-preview/services/annotations-listing.service.ts @@ -1,4 +1,4 @@ -import { AnnotationWrapper } from '../../../models/file/annotation.wrapper'; +import { AnnotationWrapper } from '@models/file/annotation.wrapper'; import { Injectable } from '@angular/core'; import { EntitiesService, FilterService, ListingService, SearchService } from '@iqser/common-ui'; import { filter, tap } from 'rxjs/operators'; diff --git a/apps/red-ui/src/app/modules/file-preview/services/file-data.service.ts b/apps/red-ui/src/app/modules/file-preview/services/file-data.service.ts index 730cb77bf..6bbedecda 100644 --- a/apps/red-ui/src/app/modules/file-preview/services/file-data.service.ts +++ b/apps/red-ui/src/app/modules/file-preview/services/file-data.service.ts @@ -1,7 +1,7 @@ import { ChangeType, File, IRedactionLog, IRedactionLogEntry, IViewedPage, ViewMode, ViewModes } from '@red/domain'; -import { AnnotationWrapper } from '../../../models/file/annotation.wrapper'; +import { AnnotationWrapper } from '@models/file/annotation.wrapper'; import { BehaviorSubject, firstValueFrom, iif, Observable, Subject } from 'rxjs'; -import { RedactionLogEntry } from '../../../models/file/redaction-log.entry'; +import { RedactionLogEntry } from '@models/file/redaction-log.entry'; import { Injectable, Injector } from '@angular/core'; import { FilePreviewStateService } from './file-preview-state.service'; import { ViewedPagesService } from '@services/files/viewed-pages.service'; diff --git a/apps/red-ui/src/app/services/files/text-highlight.service.ts b/apps/red-ui/src/app/services/files/text-highlight.service.ts index 4c55dba23..b921265d9 100644 --- a/apps/red-ui/src/app/services/files/text-highlight.service.ts +++ b/apps/red-ui/src/app/services/files/text-highlight.service.ts @@ -3,7 +3,7 @@ import { GenericService, RequiredParam, Toaster, Validate } from '@iqser/common- import { Highlight, TextHighlightOperation, TextHighlightResponse } from '@red/domain'; import { catchError, map, tap } from 'rxjs/operators'; import { Observable, of } from 'rxjs'; -import { AnnotationWrapper } from '../../models/file/annotation.wrapper'; +import { AnnotationWrapper } from '@models/file/annotation.wrapper'; import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker'; @Injectable({ diff --git a/apps/red-ui/src/assets/config/config.json b/apps/red-ui/src/assets/config/config.json index 322276d2f..f9a12cdad 100644 --- a/apps/red-ui/src/assets/config/config.json +++ b/apps/red-ui/src/assets/config/config.json @@ -1,7 +1,7 @@ { "ADMIN_CONTACT_NAME": null, "ADMIN_CONTACT_URL": null, - "API_URL": "https://dev-08.iqser.cloud/redaction-gateway-v1", + "API_URL": "https://dev-05.iqser.cloud/redaction-gateway-v1", "APP_NAME": "RedactManager", "AUTO_READ_TIME": 3, "BACKEND_APP_VERSION": "4.4.40", @@ -16,7 +16,7 @@ "MAX_RETRIES_ON_SERVER_ERROR": 3, "OAUTH_CLIENT_ID": "redaction", "OAUTH_IDP_HINT": null, - "OAUTH_URL": "https://dev-08.iqser.cloud/auth/realms/redaction", + "OAUTH_URL": "https://dev-05.iqser.cloud/auth/realms/redaction", "RECENT_PERIOD_IN_HOURS": 24, "SELECTION_MODE": "structural", "MANUAL_BASE_URL": "https://docs.redactmanager.com/preview" diff --git a/apps/red-ui/src/assets/i18n/de.json b/apps/red-ui/src/assets/i18n/de.json index 228749f47..a067e33ca 100644 --- a/apps/red-ui/src/assets/i18n/de.json +++ b/apps/red-ui/src/assets/i18n/de.json @@ -1815,7 +1815,8 @@ "save": "Änderungen speichern" }, "content": { - "comment": "Kommentar" + "comment": "Kommentar", + "update-dictionary": "" }, "header": "Schwärzung ändern" }, diff --git a/apps/red-ui/src/assets/i18n/en.json b/apps/red-ui/src/assets/i18n/en.json index 73a430802..2062802b5 100644 --- a/apps/red-ui/src/assets/i18n/en.json +++ b/apps/red-ui/src/assets/i18n/en.json @@ -1815,7 +1815,8 @@ "save": "Save Changes" }, "content": { - "comment": "Comment" + "comment": "Comment", + "update-dictionary": "Update dictionary: {text}" }, "header": "Resize Redaction" }, diff --git a/libs/red-domain/src/lib/redaction-log/resize.request.ts b/libs/red-domain/src/lib/redaction-log/resize.request.ts index faf9331f8..1d89f755b 100644 --- a/libs/red-domain/src/lib/redaction-log/resize.request.ts +++ b/libs/red-domain/src/lib/redaction-log/resize.request.ts @@ -5,4 +5,5 @@ export interface IResizeRequest { comment: string; positions: IRectangle[]; value: string; + updateDictionary?: boolean; }