RED-4051: Update dictionary option when resizing annotation
This commit is contained in:
parent
bde56e7ada
commit
6435931682
@ -7,6 +7,12 @@
|
|||||||
<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>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div *ngIf="form.get('updateDictionary')" class="iqser-input-group">
|
||||||
|
<mat-checkbox color="primary" formControlName="updateDictionary">
|
||||||
|
{{ 'resize-annotation-dialog.content.update-dictionary' | translate: { text: this.text } }}
|
||||||
|
</mat-checkbox>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="dialog-actions">
|
<div class="dialog-actions">
|
||||||
@ -17,5 +23,5 @@
|
|||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<iqser-circle-button class="dialog-close" icon="iqser:close" (action)="close()"></iqser-circle-button>
|
<iqser-circle-button (action)="close()" class="dialog-close" icon="iqser:close"></iqser-circle-button>
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
import { Component, Inject, Injector, OnInit } from '@angular/core';
|
import { Component, Inject, Injector, OnInit } from '@angular/core';
|
||||||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
||||||
import { FormBuilder } from '@angular/forms';
|
import { FormBuilder } from '@angular/forms';
|
||||||
import { Dossier } from '@red/domain';
|
|
||||||
import { BaseDialogComponent } from '@iqser/common-ui';
|
import { BaseDialogComponent } from '@iqser/common-ui';
|
||||||
|
import { AnnotationWrapper } from '@models/file/annotation.wrapper';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
templateUrl: './resize-annotation-dialog.component.html',
|
templateUrl: './resize-annotation-dialog.component.html',
|
||||||
@ -12,7 +12,7 @@ export class ResizeAnnotationDialogComponent extends BaseDialogComponent impleme
|
|||||||
private readonly _formBuilder: FormBuilder,
|
private readonly _formBuilder: FormBuilder,
|
||||||
protected readonly _injector: Injector,
|
protected readonly _injector: Injector,
|
||||||
protected readonly _dialogRef: MatDialogRef<ResizeAnnotationDialogComponent>,
|
protected readonly _dialogRef: MatDialogRef<ResizeAnnotationDialogComponent>,
|
||||||
@Inject(MAT_DIALOG_DATA) private readonly _data: { dossier: Dossier },
|
@Inject(MAT_DIALOG_DATA) private readonly _data: { annotation: AnnotationWrapper; text?: string },
|
||||||
) {
|
) {
|
||||||
super(_injector, _dialogRef);
|
super(_injector, _dialogRef);
|
||||||
}
|
}
|
||||||
@ -21,16 +21,24 @@ export class ResizeAnnotationDialogComponent extends BaseDialogComponent impleme
|
|||||||
return !this.valid;
|
return !this.valid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get text(): string {
|
||||||
|
return this._data.text;
|
||||||
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
super.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();
|
this.initialFormValue = this.form.getRawValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
save() {
|
save() {
|
||||||
this._dialogRef.close({
|
this._dialogRef.close(this.form.getRawValue());
|
||||||
comment: this.form.get('comment').value,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -217,8 +217,8 @@ export class AnnotationActionsService {
|
|||||||
img: this._convertPath('/assets/icons/general/check.svg'),
|
img: this._convertPath('/assets/icons/general/check.svg'),
|
||||||
title: this._translateService.instant('annotation-actions.resize-accept.label'),
|
title: this._translateService.instant('annotation-actions.resize-accept.label'),
|
||||||
onClick: () =>
|
onClick: () =>
|
||||||
this._ngZone.run(() => {
|
this._ngZone.run(async () => {
|
||||||
this.acceptResize(null, firstAnnotation);
|
await this.acceptResize(null, firstAnnotation);
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
availableActions.push({
|
availableActions.push({
|
||||||
@ -412,22 +412,21 @@ export class AnnotationActionsService {
|
|||||||
this._pdf.annotationManager.selectAnnotation(viewerAnnotation);
|
this._pdf.annotationManager.selectAnnotation(viewerAnnotation);
|
||||||
}
|
}
|
||||||
|
|
||||||
acceptResize($event: MouseEvent, annotationWrapper: AnnotationWrapper) {
|
async acceptResize($event: MouseEvent, annotation: AnnotationWrapper): Promise<void> {
|
||||||
const data = { dossier: this._dossier };
|
|
||||||
const fileId = this._state.fileId;
|
const fileId = this._state.fileId;
|
||||||
this._dialogService.openDialog('resizeAnnotation', $event, data, async (result: { comment: string }) => {
|
const textAndPositions = await this._extractTextAndPositions(annotation.id);
|
||||||
const textAndPositions = await this._extractTextAndPositions(annotationWrapper.id);
|
const text = annotation.value === 'Rectangle' ? 'Rectangle' : annotation.isImage ? 'Image' : textAndPositions.text;
|
||||||
const text =
|
const data = { annotation, text };
|
||||||
annotationWrapper.value === 'Rectangle' ? 'Rectangle' : annotationWrapper.isImage ? 'Image' : textAndPositions.text;
|
this._dialogService.openDialog('resizeAnnotation', $event, data, async (result: { comment: string; updateDictionary: boolean }) => {
|
||||||
|
|
||||||
const resizeRequest: IResizeRequest = {
|
const resizeRequest: IResizeRequest = {
|
||||||
annotationId: annotationWrapper.id,
|
annotationId: annotation.id,
|
||||||
comment: result.comment,
|
comment: result.comment,
|
||||||
positions: textAndPositions.positions,
|
positions: textAndPositions.positions,
|
||||||
value: text,
|
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);
|
words.push(...quadWords);
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(words.join(' '));
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
text: words.join(' '),
|
text: words.join(' '),
|
||||||
positions: rectangles,
|
positions: rectangles,
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { AnnotationWrapper } from '../../../models/file/annotation.wrapper';
|
import { AnnotationWrapper } from '@models/file/annotation.wrapper';
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { EntitiesService, FilterService, ListingService, SearchService } from '@iqser/common-ui';
|
import { EntitiesService, FilterService, ListingService, SearchService } from '@iqser/common-ui';
|
||||||
import { filter, tap } from 'rxjs/operators';
|
import { filter, tap } from 'rxjs/operators';
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import { ChangeType, File, IRedactionLog, IRedactionLogEntry, IViewedPage, ViewMode, ViewModes } from '@red/domain';
|
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 { 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 { Injectable, Injector } from '@angular/core';
|
||||||
import { FilePreviewStateService } from './file-preview-state.service';
|
import { FilePreviewStateService } from './file-preview-state.service';
|
||||||
import { ViewedPagesService } from '@services/files/viewed-pages.service';
|
import { ViewedPagesService } from '@services/files/viewed-pages.service';
|
||||||
|
|||||||
@ -3,7 +3,7 @@ import { GenericService, RequiredParam, Toaster, Validate } from '@iqser/common-
|
|||||||
import { Highlight, TextHighlightOperation, TextHighlightResponse } from '@red/domain';
|
import { Highlight, TextHighlightOperation, TextHighlightResponse } from '@red/domain';
|
||||||
import { catchError, map, tap } from 'rxjs/operators';
|
import { catchError, map, tap } from 'rxjs/operators';
|
||||||
import { Observable, of } from 'rxjs';
|
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';
|
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"ADMIN_CONTACT_NAME": null,
|
"ADMIN_CONTACT_NAME": null,
|
||||||
"ADMIN_CONTACT_URL": 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",
|
"APP_NAME": "RedactManager",
|
||||||
"AUTO_READ_TIME": 3,
|
"AUTO_READ_TIME": 3,
|
||||||
"BACKEND_APP_VERSION": "4.4.40",
|
"BACKEND_APP_VERSION": "4.4.40",
|
||||||
@ -16,7 +16,7 @@
|
|||||||
"MAX_RETRIES_ON_SERVER_ERROR": 3,
|
"MAX_RETRIES_ON_SERVER_ERROR": 3,
|
||||||
"OAUTH_CLIENT_ID": "redaction",
|
"OAUTH_CLIENT_ID": "redaction",
|
||||||
"OAUTH_IDP_HINT": null,
|
"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,
|
"RECENT_PERIOD_IN_HOURS": 24,
|
||||||
"SELECTION_MODE": "structural",
|
"SELECTION_MODE": "structural",
|
||||||
"MANUAL_BASE_URL": "https://docs.redactmanager.com/preview"
|
"MANUAL_BASE_URL": "https://docs.redactmanager.com/preview"
|
||||||
|
|||||||
@ -1815,7 +1815,8 @@
|
|||||||
"save": "Änderungen speichern"
|
"save": "Änderungen speichern"
|
||||||
},
|
},
|
||||||
"content": {
|
"content": {
|
||||||
"comment": "Kommentar"
|
"comment": "Kommentar",
|
||||||
|
"update-dictionary": ""
|
||||||
},
|
},
|
||||||
"header": "Schwärzung ändern"
|
"header": "Schwärzung ändern"
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1815,7 +1815,8 @@
|
|||||||
"save": "Save Changes"
|
"save": "Save Changes"
|
||||||
},
|
},
|
||||||
"content": {
|
"content": {
|
||||||
"comment": "Comment"
|
"comment": "Comment",
|
||||||
|
"update-dictionary": "Update dictionary: {text}"
|
||||||
},
|
},
|
||||||
"header": "Resize Redaction"
|
"header": "Resize Redaction"
|
||||||
},
|
},
|
||||||
|
|||||||
@ -5,4 +5,5 @@ export interface IResizeRequest {
|
|||||||
comment: string;
|
comment: string;
|
||||||
positions: IRectangle[];
|
positions: IRectangle[];
|
||||||
value: string;
|
value: string;
|
||||||
|
updateDictionary?: boolean;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user