From 45a4b6a9309c29dc07d9e3e7bd301c950d1636b8 Mon Sep 17 00:00:00 2001 From: Timo Bejan Date: Mon, 11 Jul 2022 22:38:14 +0300 Subject: [PATCH 1/2] RED-4525 integrated default colors --- .../red-ui/src/app/models/file/super-types.ts | 2 +- .../entity-services/dictionary.service.ts | 27 +++++++++---------- .../red-domain/src/lib/dictionaries/colors.ts | 15 ++++++----- 3 files changed, 21 insertions(+), 23 deletions(-) diff --git a/apps/red-ui/src/app/models/file/super-types.ts b/apps/red-ui/src/app/models/file/super-types.ts index 23e1e7483..c3baeb418 100644 --- a/apps/red-ui/src/app/models/file/super-types.ts +++ b/apps/red-ui/src/app/models/file/super-types.ts @@ -14,7 +14,7 @@ export const SuperTypes = { IgnoredHint: 'hint-ignored', Skipped: 'skipped', Redaction: 'redaction', - ManualRedaction: 'manual-redaction', + ManualRedaction: 'manual', Recommendation: 'recommendation', Hint: 'hint', DeclinedSuggestion: 'suggestion-declined', diff --git a/apps/red-ui/src/app/services/entity-services/dictionary.service.ts b/apps/red-ui/src/app/services/entity-services/dictionary.service.ts index 72101acb6..971a3aa49 100644 --- a/apps/red-ui/src/app/services/entity-services/dictionary.service.ts +++ b/apps/red-ui/src/app/services/entity-services/dictionary.service.ts @@ -237,29 +237,26 @@ export class DictionaryService extends EntitiesService }), map(colors => { const virtualTypes = [ - { hexColor: colors.notRedacted || FALLBACK_COLOR, type: SuperTypes.DeclinedSuggestion }, - { hexColor: colors.manualRedactionColor || FALLBACK_COLOR, type: 'manual' }, - { hexColor: colors.ignoredHintColor || FALLBACK_COLOR, type: SuperTypes.IgnoredHint }, - { hexColor: colors.manualRedactionColor || FALLBACK_COLOR, type: SuperTypes.ManualRedaction }, + { hexColor: colors.skippedColor || FALLBACK_COLOR, type: SuperTypes.DeclinedSuggestion }, // dictionary actions - { hexColor: '#c5d3eb', type: SuperTypes.Recommendation }, + { hexColor: colors.recommendationColor || FALLBACK_COLOR, type: SuperTypes.Recommendation }, { hexColor: colors.analysisColor || FALLBACK_COLOR, type: 'remove-only-here' }, // generic suggestions - { hexColor: colors.requestAdd || FALLBACK_COLOR, type: 'suggestion' }, - { hexColor: colors.requestAdd || FALLBACK_COLOR, type: SuperTypes.SuggestionAdd }, + { hexColor: colors.requestAddColor || FALLBACK_COLOR, type: 'suggestion' }, + { hexColor: colors.requestAddColor || FALLBACK_COLOR, type: SuperTypes.SuggestionAdd }, // add suggestions - { hexColor: colors.requestAdd || FALLBACK_COLOR, type: SuperTypes.SuggestionChangeLegalBasis }, - { hexColor: colors.requestAdd || FALLBACK_COLOR, type: SuperTypes.SuggestionRecategorizeImage }, + { hexColor: colors.requestAddColor || FALLBACK_COLOR, type: SuperTypes.SuggestionChangeLegalBasis }, + { hexColor: colors.requestAddColor || FALLBACK_COLOR, type: SuperTypes.SuggestionRecategorizeImage }, { hexColor: colors.dictionaryRequestColor || FALLBACK_COLOR, type: SuperTypes.SuggestionAddDictionary }, { hexColor: colors.dictionaryRequestColor || FALLBACK_COLOR, type: SuperTypes.SuggestionResize }, - { hexColor: colors.requestRemove || FALLBACK_COLOR, type: SuperTypes.SuggestionRemove }, + { hexColor: colors.requestRemoveColor || FALLBACK_COLOR, type: SuperTypes.SuggestionRemove }, { hexColor: colors.dictionaryRequestColor || FALLBACK_COLOR, type: SuperTypes.SuggestionRemoveDictionary }, - { hexColor: colors.notRedacted || FALLBACK_COLOR, type: SuperTypes.Skipped }, - { hexColor: colors.defaultColor || FALLBACK_COLOR, type: 'default' }, - { hexColor: colors.requestAdd || FALLBACK_COLOR, type: 'add' }, + { hexColor: colors.skippedColor || FALLBACK_COLOR, type: SuperTypes.Skipped }, + { hexColor: colors.requestAddColor || FALLBACK_COLOR, type: 'add' }, { hexColor: colors.analysisColor || FALLBACK_COLOR, type: 'analysis' }, - { hexColor: '#fa98f7', type: 'hint', hint: true }, - { hexColor: colors.manualRedactionColor || FALLBACK_COLOR, type: 'redaction' }, + { hexColor: colors.hintColor || FALLBACK_COLOR, type: SuperTypes.Hint, hint: true }, + { hexColor: colors.ignoredHintColor || FALLBACK_COLOR, type: SuperTypes.IgnoredHint, hint: true }, + { hexColor: colors.redactionColor || FALLBACK_COLOR, type: SuperTypes.Redaction }, { hexColor: colors.previewColor || FALLBACK_COLOR, type: 'preview' }, { hexColor: colors.updatedColor || FALLBACK_COLOR, type: 'updated' }, ]; diff --git a/libs/red-domain/src/lib/dictionaries/colors.ts b/libs/red-domain/src/lib/dictionaries/colors.ts index bb34f3369..ea39086e2 100644 --- a/libs/red-domain/src/lib/dictionaries/colors.ts +++ b/libs/red-domain/src/lib/dictionaries/colors.ts @@ -1,13 +1,14 @@ export interface IColors { - analysisColor?: string; - defaultColor?: string; - dictionaryRequestColor?: string; dossierTemplateId?: string; - manualRedactionColor?: string; - notRedacted?: string; + requestAddColor?: string; + requestRemoveColor?: string; + dictionaryRequestColor?: string; previewColor?: string; - requestAdd?: string; - requestRemove?: string; + analysisColor?: string; updatedColor?: string; + recommendationColor?: string; + hintColor?: string; + redactionColor?: string; ignoredHintColor?: string; + skippedColor?: string; } From ad1140dde500e75f137e5494aae09638cb385274 Mon Sep 17 00:00:00 2001 From: Timo Bejan Date: Mon, 11 Jul 2022 22:46:41 +0300 Subject: [PATCH 2/2] RED-4525 - fallback for missing manual type --- .../entity-services/dictionary.service.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/apps/red-ui/src/app/services/entity-services/dictionary.service.ts b/apps/red-ui/src/app/services/entity-services/dictionary.service.ts index 971a3aa49..74127b448 100644 --- a/apps/red-ui/src/app/services/entity-services/dictionary.service.ts +++ b/apps/red-ui/src/app/services/entity-services/dictionary.service.ts @@ -267,6 +267,22 @@ export class DictionaryService extends EntitiesService return forkJoin([types$, virtualTypes$]) .pipe(map(([types, virtualTypes]: Dictionary[][]) => [...types, ...virtualTypes])) + .pipe( + map(dictionaries => { + let manualTypeExists = false; + for (const dictionary of dictionaries) { + if (dictionary.type === SuperTypes.ManualRedaction) { + manualTypeExists = true; + break; + } + } + if (!manualTypeExists) { + dictionaries.push(new Dictionary({ hexColor: FALLBACK_COLOR, type: SuperTypes.ManualRedaction }, true)); + } + + return dictionaries; + }), + ) .pipe(tap(dictionaries => this._dictionariesMapService.set(dossierTemplateId, dictionaries))); }