DM-333: Filtered default colors on documine.
This commit is contained in:
parent
9ce22246a6
commit
ec307c8bd2
@ -3,6 +3,7 @@ import { DefaultColorTypes, DOSSIER_TEMPLATE_ID, User } from '@red/domain';
|
||||
import { AdminDialogService } from '../../services/admin-dialog.service';
|
||||
import {
|
||||
CircleButtonTypes,
|
||||
getConfig,
|
||||
IListable,
|
||||
ListingComponent,
|
||||
listingProvidersFactory,
|
||||
@ -30,7 +31,6 @@ interface ListItem extends IListable {
|
||||
providers: listingProvidersFactory(DefaultColorsScreenComponent),
|
||||
})
|
||||
export class DefaultColorsScreenComponent extends ListingComponent<ListItem> implements OnInit {
|
||||
readonly #dossierTemplateId = getParam(DOSSIER_TEMPLATE_ID);
|
||||
readonly circleButtonTypes = CircleButtonTypes;
|
||||
readonly currentUser = getCurrentUser<User>();
|
||||
readonly roles = Roles;
|
||||
@ -41,6 +41,9 @@ export class DefaultColorsScreenComponent extends ListingComponent<ListItem> imp
|
||||
{ label: _('default-colors-screen.table-col-names.color'), class: 'flex-center' },
|
||||
];
|
||||
readonly context$;
|
||||
readonly #dossierTemplateId = getParam(DOSSIER_TEMPLATE_ID);
|
||||
readonly #documineDefaultColors = ['recommendationColor', 'skippedColor', 'redactionColor'];
|
||||
readonly #isDocumine = getConfig().IS_DOCUMINE;
|
||||
|
||||
constructor(
|
||||
private readonly _dialogService: AdminDialogService,
|
||||
@ -52,7 +55,15 @@ export class DefaultColorsScreenComponent extends ListingComponent<ListItem> imp
|
||||
this.context$ = combineLatest([this._defaultColorsService.all$]).pipe(
|
||||
map(([allDefaultColors]) => {
|
||||
const color = allDefaultColors.find(c => c.id === this.#dossierTemplateId);
|
||||
return DefaultColorTypes.map(key => ({ id: key, key, searchKey: key, value: color[key] }));
|
||||
const defaultColors = this.#isDocumine
|
||||
? DefaultColorTypes.filter(key => this.#documineDefaultColors.includes(key))
|
||||
: DefaultColorTypes;
|
||||
return defaultColors.map(key => ({
|
||||
id: key,
|
||||
key,
|
||||
searchKey: key,
|
||||
value: color[key],
|
||||
}));
|
||||
}),
|
||||
tap(colors => this.entitiesService.setEntities(colors)),
|
||||
);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user