Pull request #308: VM/RED-2698

Merge in RED/ui from VM/RED-2698 to master

* commit '6f85ee585d0c2bb089ca0a59141e083afd4165c7':
  replaced 'question mark' with 'SY' avatar and 'Unknown' with 'System' value on CREATED BY column for dossier templates listing
This commit is contained in:
Valentin-Gabriel Mihai 2021-11-10 14:17:04 +01:00
commit 815a28d0c0
4 changed files with 9 additions and 1 deletions

View File

@ -80,6 +80,7 @@
[defaultValue]="'unknown' | translate" [defaultValue]="'unknown' | translate"
[user]="dossierTemplate.createdBy" [user]="dossierTemplate.createdBy"
[withName]="true" [withName]="true"
[showSystem]="true"
></redaction-initials-avatar> ></redaction-initials-avatar>
</div> </div>

View File

@ -4,7 +4,7 @@
[matTooltipPosition]="tooltipPosition" [matTooltipPosition]="tooltipPosition"
[matTooltip]="userName" [matTooltip]="userName"
> >
{{ _user | name: { showInitials: true } }} {{ _user | name: { showInitials: true, showSystem: showSystem } }}
</div> </div>
<div *ngIf="withName" [class.disabled]="disabled" class="clamp-2 username"> <div *ngIf="withName" [class.disabled]="disabled" class="clamp-2 username">
{{ userName }} {{ userName }}

View File

@ -16,6 +16,7 @@ export class InitialsAvatarComponent extends AutoUnsubscribe implements OnInit,
@Input() size: 'small' | 'large' = 'small'; @Input() size: 'small' | 'large' = 'small';
@Input() withName = false; @Input() withName = false;
@Input() showYou = false; @Input() showYou = false;
@Input() showSystem = false;
@Input() tooltipPosition: 'below' | 'above' = 'above'; @Input() tooltipPosition: 'below' | 'above' = 'above';
@Input() defaultValue = this._translateService.instant('initials-avatar.unassigned'); @Input() defaultValue = this._translateService.instant('initials-avatar.unassigned');
colorClass: string; colorClass: string;
@ -80,6 +81,7 @@ export class InitialsAvatarComponent extends AutoUnsubscribe implements OnInit,
this.namePipeOptions = { this.namePipeOptions = {
showYou: this.showYou, showYou: this.showYou,
defaultValue: this.defaultValue, defaultValue: this.defaultValue,
showSystem: this.showSystem,
}; };
} }
} }

View File

@ -18,6 +18,7 @@ function getInitials(name: string) {
export interface NamePipeOptions { export interface NamePipeOptions {
showYou?: boolean; showYou?: boolean;
showInitials?: boolean; showInitials?: boolean;
showSystem?: boolean;
defaultValue?: string; defaultValue?: string;
} }
@ -32,6 +33,10 @@ export class NamePipe implements PipeTransform {
transform(value?: User | string, options = this._defaultOptions): string { transform(value?: User | string, options = this._defaultOptions): string {
let name; let name;
if (!value && options?.showSystem) {
value = 'system';
}
if (!value && options?.showInitials) { if (!value && options?.showInitials) {
return '?'; return '?';
} }