From 4acab8a05bcb6b79a1dfce30b1d4fc13b5a6b510 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adina=20=C8=9Aeudan?= Date: Mon, 4 Jul 2022 14:23:54 +0300 Subject: [PATCH] RED-4416: Ignored hints color --- .../src/app/models/file/annotation.wrapper.ts | 2 +- .../add-edit-entity.component.html | 2 +- .../add-edit-entity.component.ts | 25 ++++++++++++++----- .../type-annotation-icon.component.ts | 4 +-- .../services/annotation-draw.service.ts | 1 + apps/red-ui/src/assets/i18n/en.json | 6 +---- 6 files changed, 25 insertions(+), 15 deletions(-) diff --git a/apps/red-ui/src/app/models/file/annotation.wrapper.ts b/apps/red-ui/src/app/models/file/annotation.wrapper.ts index 198f90aaa..5637c9531 100644 --- a/apps/red-ui/src/app/models/file/annotation.wrapper.ts +++ b/apps/red-ui/src/app/models/file/annotation.wrapper.ts @@ -88,7 +88,7 @@ export class AnnotationWrapper implements IListable, Record { } get isSuperTypeBasedColor() { - return this.isSuggestion || this.isDeclinedSuggestion || this.isIgnoredHint; + return this.isSuggestion || this.isDeclinedSuggestion; } get isSkipped() { diff --git a/apps/red-ui/src/app/modules/admin/shared/components/add-edit-entity/add-edit-entity.component.html b/apps/red-ui/src/app/modules/admin/shared/components/add-edit-entity/add-edit-entity.component.html index 29236f29d..bb8c35c8e 100644 --- a/apps/red-ui/src/app/modules/admin/shared/components/add-edit-entity/add-edit-entity.component.html +++ b/apps/red-ui/src/app/modules/admin/shared/components/add-edit-entity/add-edit-entity.component.html @@ -13,7 +13,7 @@
- + ; - colors: { label: string; placeholder: string; controlName: string; hasColor$: Observable }[]; + colors: { + label: string; + placeholder: string; + controlName: string; + hasColor$: Observable; + labelParams: () => Record; + }[]; constructor( private readonly _dictionariesMapService: DictionariesMapService, @@ -46,6 +52,10 @@ export class AddEditEntityComponent extends BaseFormComponent implements OnInit return { value: !!this.entity?.addToDictionaryAction, disabled: this.#isSystemManaged }; } + get #isHint(): boolean { + return this.form.get('hint').value; + } + revert(): void { this.form.patchValue(this.initialFormValue); } @@ -81,19 +91,22 @@ export class AddEditEntityComponent extends BaseFormComponent implements OnInit this.colors = [ { label: _('add-edit-entity.form.color'), + labelParams: () => ({ type: this.#isHint ? 'hint' : 'redaction' }), placeholder: _('add-edit-entity.form.color-placeholder'), controlName: 'hexColor', hasColor$: this._colorEmpty$(form, 'hexColor'), }, { - label: _('add-edit-entity.form.recommendation-color'), - placeholder: _('add-edit-entity.form.recommendation-color-placeholder'), + label: _('add-edit-entity.form.color'), + labelParams: () => ({ type: 'recommendation' }), + placeholder: _('add-edit-entity.form.color-placeholder'), controlName: 'recommendationHexColor', hasColor$: this._colorEmpty$(form, 'recommendationHexColor'), }, { - label: _('add-edit-entity.form.skipped-color'), - placeholder: _('add-edit-entity.form.skipped-color-placeholder'), + label: _('add-edit-entity.form.color'), + labelParams: () => ({ type: this.#isHint ? 'ignored' : 'skipped' }), + placeholder: _('add-edit-entity.form.color-placeholder'), controlName: 'skippedHexColor', hasColor$: this._colorEmpty$(form, 'skippedHexColor'), }, @@ -192,7 +205,7 @@ export class AddEditEntityComponent extends BaseFormComponent implements OnInit hexColor: this.form.get('hexColor').value, recommendationHexColor: this.form.get('recommendationHexColor').value, skippedHexColor: this.form.get('skippedHexColor').value, - hint: this.form.get('hint').value, + hint: this.#isHint, rank: this.form.get('rank').value, dossierTemplateId: this.dossierTemplateId, caseInsensitive: !this.form.get('caseSensitive').value, diff --git a/apps/red-ui/src/app/modules/file-preview/components/type-annotation-icon/type-annotation-icon.component.ts b/apps/red-ui/src/app/modules/file-preview/components/type-annotation-icon/type-annotation-icon.component.ts index e81375668..422939eab 100644 --- a/apps/red-ui/src/app/modules/file-preview/components/type-annotation-icon/type-annotation-icon.component.ts +++ b/apps/red-ui/src/app/modules/file-preview/components/type-annotation-icon/type-annotation-icon.component.ts @@ -35,8 +35,8 @@ export class TypeAnnotationIconComponent implements OnChanges { this.color = this._dictionariesMapService.getDictionaryColor( type, this._dossierTemplateId, - this.annotation.isRecommendation, - this.annotation.isSkipped, + isRecommendation, + isSkipped || isIgnoredHint, ); } diff --git a/apps/red-ui/src/app/modules/pdf-viewer/services/annotation-draw.service.ts b/apps/red-ui/src/app/modules/pdf-viewer/services/annotation-draw.service.ts index f12c02eb4..7a8fe5224 100644 --- a/apps/red-ui/src/app/modules/pdf-viewer/services/annotation-draw.service.ts +++ b/apps/red-ui/src/app/modules/pdf-viewer/services/annotation-draw.service.ts @@ -75,6 +75,7 @@ export class AnnotationDrawService { color = this._dictionariesMapService.getDictionaryColor(dictionary, dossierTemplateId, true); break; case SuperTypes.Skipped: + case SuperTypes.IgnoredHint: color = this._dictionariesMapService.getDictionaryColor(dictionary, dossierTemplateId, false, true); break; default: diff --git a/apps/red-ui/src/assets/i18n/en.json b/apps/red-ui/src/assets/i18n/en.json index 2db7d003a..28d71da17 100644 --- a/apps/red-ui/src/assets/i18n/en.json +++ b/apps/red-ui/src/assets/i18n/en.json @@ -86,7 +86,7 @@ "form": { "add-to-dictionary-action": "Enable 'Add to dictionary'", "case-sensitive": "Case Sensitive", - "color": "Hex Color", + "color": "{type, select, redaction{Redaction} hint{Hint} recommendation{Recommendation} skipped{Skipped Redaction} ignored{Ignored Hint} other{}} Color", "color-placeholder": "#", "default-reason": "Default Reason", "default-reason-placeholder": "No Default Reason", @@ -98,11 +98,7 @@ "name-placeholder": "Enter Name", "rank": "Rank", "rank-placeholder": "1000", - "recommendation-color": "Recommendation Hex Color", - "recommendation-color-placeholder": "#", "redaction": "Redaction", - "skipped-color": "Skipped Hex Color", - "skipped-color-placeholder": "#", "technical-name": "Technical Name", "technical-name-hint": "{type, select, edit{Autogenerated based on the initial display name.} create{Autogenerates based on the display name and cannot be edited after saving.} other{}}" },