Pull request #369: RED-4525 integrated default colors

Merge in RED/ui from RED-4525 to master

* commit 'ad1140dde500e75f137e5494aae09638cb385274':
  RED-4525 - fallback for missing manual type
  RED-4525 integrated default colors
This commit is contained in:
Timo Bejan 2022-07-11 21:46:54 +02:00
commit abcae0b93d
3 changed files with 37 additions and 23 deletions

View File

@ -14,7 +14,7 @@ export const SuperTypes = {
IgnoredHint: 'hint-ignored', IgnoredHint: 'hint-ignored',
Skipped: 'skipped', Skipped: 'skipped',
Redaction: 'redaction', Redaction: 'redaction',
ManualRedaction: 'manual-redaction', ManualRedaction: 'manual',
Recommendation: 'recommendation', Recommendation: 'recommendation',
Hint: 'hint', Hint: 'hint',
DeclinedSuggestion: 'suggestion-declined', DeclinedSuggestion: 'suggestion-declined',

View File

@ -237,29 +237,26 @@ export class DictionaryService extends EntitiesService<IDictionary, Dictionary>
}), }),
map(colors => { map(colors => {
const virtualTypes = [ const virtualTypes = [
{ hexColor: colors.notRedacted || FALLBACK_COLOR, type: SuperTypes.DeclinedSuggestion }, { hexColor: colors.skippedColor || 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 },
// dictionary actions // dictionary actions
{ hexColor: '#c5d3eb', type: SuperTypes.Recommendation }, { hexColor: colors.recommendationColor || FALLBACK_COLOR, type: SuperTypes.Recommendation },
{ hexColor: colors.analysisColor || FALLBACK_COLOR, type: 'remove-only-here' }, { hexColor: colors.analysisColor || FALLBACK_COLOR, type: 'remove-only-here' },
// generic suggestions // generic suggestions
{ hexColor: colors.requestAdd || FALLBACK_COLOR, type: 'suggestion' }, { hexColor: colors.requestAddColor || FALLBACK_COLOR, type: 'suggestion' },
{ hexColor: colors.requestAdd || FALLBACK_COLOR, type: SuperTypes.SuggestionAdd }, { hexColor: colors.requestAddColor || FALLBACK_COLOR, type: SuperTypes.SuggestionAdd },
// add suggestions // add suggestions
{ hexColor: colors.requestAdd || FALLBACK_COLOR, type: SuperTypes.SuggestionChangeLegalBasis }, { hexColor: colors.requestAddColor || FALLBACK_COLOR, type: SuperTypes.SuggestionChangeLegalBasis },
{ hexColor: colors.requestAdd || FALLBACK_COLOR, type: SuperTypes.SuggestionRecategorizeImage }, { hexColor: colors.requestAddColor || FALLBACK_COLOR, type: SuperTypes.SuggestionRecategorizeImage },
{ hexColor: colors.dictionaryRequestColor || FALLBACK_COLOR, type: SuperTypes.SuggestionAddDictionary }, { hexColor: colors.dictionaryRequestColor || FALLBACK_COLOR, type: SuperTypes.SuggestionAddDictionary },
{ hexColor: colors.dictionaryRequestColor || FALLBACK_COLOR, type: SuperTypes.SuggestionResize }, { 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.dictionaryRequestColor || FALLBACK_COLOR, type: SuperTypes.SuggestionRemoveDictionary },
{ hexColor: colors.notRedacted || FALLBACK_COLOR, type: SuperTypes.Skipped }, { hexColor: colors.skippedColor || FALLBACK_COLOR, type: SuperTypes.Skipped },
{ hexColor: colors.defaultColor || FALLBACK_COLOR, type: 'default' }, { hexColor: colors.requestAddColor || FALLBACK_COLOR, type: 'add' },
{ hexColor: colors.requestAdd || FALLBACK_COLOR, type: 'add' },
{ hexColor: colors.analysisColor || FALLBACK_COLOR, type: 'analysis' }, { hexColor: colors.analysisColor || FALLBACK_COLOR, type: 'analysis' },
{ hexColor: '#fa98f7', type: 'hint', hint: true }, { hexColor: colors.hintColor || FALLBACK_COLOR, type: SuperTypes.Hint, hint: true },
{ hexColor: colors.manualRedactionColor || FALLBACK_COLOR, type: 'redaction' }, { 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.previewColor || FALLBACK_COLOR, type: 'preview' },
{ hexColor: colors.updatedColor || FALLBACK_COLOR, type: 'updated' }, { hexColor: colors.updatedColor || FALLBACK_COLOR, type: 'updated' },
]; ];
@ -270,6 +267,22 @@ export class DictionaryService extends EntitiesService<IDictionary, Dictionary>
return forkJoin([types$, virtualTypes$]) return forkJoin([types$, virtualTypes$])
.pipe(map(([types, virtualTypes]: Dictionary[][]) => [...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))); .pipe(tap(dictionaries => this._dictionariesMapService.set(dossierTemplateId, dictionaries)));
} }

View File

@ -1,13 +1,14 @@
export interface IColors { export interface IColors {
analysisColor?: string;
defaultColor?: string;
dictionaryRequestColor?: string;
dossierTemplateId?: string; dossierTemplateId?: string;
manualRedactionColor?: string; requestAddColor?: string;
notRedacted?: string; requestRemoveColor?: string;
dictionaryRequestColor?: string;
previewColor?: string; previewColor?: string;
requestAdd?: string; analysisColor?: string;
requestRemove?: string;
updatedColor?: string; updatedColor?: string;
recommendationColor?: string;
hintColor?: string;
redactionColor?: string;
ignoredHintColor?: string; ignoredHintColor?: string;
skippedColor?: string;
} }