From 6f85ee585d0c2bb089ca0a59141e083afd4165c7 Mon Sep 17 00:00:00 2001 From: Valentin Date: Wed, 10 Nov 2021 15:12:51 +0200 Subject: [PATCH] replaced 'question mark' with 'SY' avatar and 'Unknown' with 'System' value on CREATED BY column for dossier templates listing --- .../dossier-templates-listing-screen.component.html | 1 + .../initials-avatar/initials-avatar.component.html | 2 +- .../components/initials-avatar/initials-avatar.component.ts | 2 ++ apps/red-ui/src/app/modules/shared/pipes/name.pipe.ts | 5 +++++ 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/apps/red-ui/src/app/modules/admin/screens/dossier-template-listing/dossier-templates-listing-screen.component.html b/apps/red-ui/src/app/modules/admin/screens/dossier-template-listing/dossier-templates-listing-screen.component.html index 9d80847a3..c80fd6ec0 100644 --- a/apps/red-ui/src/app/modules/admin/screens/dossier-template-listing/dossier-templates-listing-screen.component.html +++ b/apps/red-ui/src/app/modules/admin/screens/dossier-template-listing/dossier-templates-listing-screen.component.html @@ -80,6 +80,7 @@ [defaultValue]="'unknown' | translate" [user]="dossierTemplate.createdBy" [withName]="true" + [showSystem]="true" > diff --git a/apps/red-ui/src/app/modules/shared/components/initials-avatar/initials-avatar.component.html b/apps/red-ui/src/app/modules/shared/components/initials-avatar/initials-avatar.component.html index 538181b7c..c3cbbd9b6 100644 --- a/apps/red-ui/src/app/modules/shared/components/initials-avatar/initials-avatar.component.html +++ b/apps/red-ui/src/app/modules/shared/components/initials-avatar/initials-avatar.component.html @@ -4,7 +4,7 @@ [matTooltipPosition]="tooltipPosition" [matTooltip]="userName" > - {{ _user | name: { showInitials: true } }} + {{ _user | name: { showInitials: true, showSystem: showSystem } }}
{{ userName }} diff --git a/apps/red-ui/src/app/modules/shared/components/initials-avatar/initials-avatar.component.ts b/apps/red-ui/src/app/modules/shared/components/initials-avatar/initials-avatar.component.ts index 20f99feb5..3fee06b87 100644 --- a/apps/red-ui/src/app/modules/shared/components/initials-avatar/initials-avatar.component.ts +++ b/apps/red-ui/src/app/modules/shared/components/initials-avatar/initials-avatar.component.ts @@ -16,6 +16,7 @@ export class InitialsAvatarComponent extends AutoUnsubscribe implements OnInit, @Input() size: 'small' | 'large' = 'small'; @Input() withName = false; @Input() showYou = false; + @Input() showSystem = false; @Input() tooltipPosition: 'below' | 'above' = 'above'; @Input() defaultValue = this._translateService.instant('initials-avatar.unassigned'); colorClass: string; @@ -80,6 +81,7 @@ export class InitialsAvatarComponent extends AutoUnsubscribe implements OnInit, this.namePipeOptions = { showYou: this.showYou, defaultValue: this.defaultValue, + showSystem: this.showSystem, }; } } diff --git a/apps/red-ui/src/app/modules/shared/pipes/name.pipe.ts b/apps/red-ui/src/app/modules/shared/pipes/name.pipe.ts index aba1521d5..9d4239453 100644 --- a/apps/red-ui/src/app/modules/shared/pipes/name.pipe.ts +++ b/apps/red-ui/src/app/modules/shared/pipes/name.pipe.ts @@ -18,6 +18,7 @@ function getInitials(name: string) { export interface NamePipeOptions { showYou?: boolean; showInitials?: boolean; + showSystem?: boolean; defaultValue?: string; } @@ -32,6 +33,10 @@ export class NamePipe implements PipeTransform { transform(value?: User | string, options = this._defaultOptions): string { let name; + if (!value && options?.showSystem) { + value = 'system'; + } + if (!value && options?.showInitials) { return '?'; }