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',
Skipped: 'skipped',
Redaction: 'redaction',
ManualRedaction: 'manual-redaction',
ManualRedaction: 'manual',
Recommendation: 'recommendation',
Hint: 'hint',
DeclinedSuggestion: 'suggestion-declined',

View File

@ -237,29 +237,26 @@ export class DictionaryService extends EntitiesService<IDictionary, Dictionary>
}),
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' },
];
@ -270,6 +267,22 @@ export class DictionaryService extends EntitiesService<IDictionary, Dictionary>
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)));
}

View File

@ -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;
}