mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
#ADF-452-userinfo show full name on the banner (#1814)
* #ADF-452-userinfo show full name on the banner * #ADF-452 - added improvement from PR
This commit is contained in:
@@ -81,7 +81,7 @@ export class UserInfoComponent implements OnInit {
|
||||
if (this.authService.isEcmLoggedIn()) {
|
||||
this.ecmUserService.getCurrentUserInfo()
|
||||
.subscribe((res) => {
|
||||
this.ecmUser = <EcmUserModel> res;
|
||||
this.ecmUser = new EcmUserModel(res);
|
||||
this.getEcmAvatar();
|
||||
}
|
||||
);
|
||||
@@ -95,7 +95,7 @@ export class UserInfoComponent implements OnInit {
|
||||
if (this.authService.isBpmLoggedIn()) {
|
||||
this.bpmUserService.getCurrentUserInfo()
|
||||
.subscribe((res) => {
|
||||
this.bpmUser = <BpmUserModel> res;
|
||||
this.bpmUser = new BpmUserModel(res);
|
||||
});
|
||||
this.bpmUserImage = this.bpmUserService.getCurrentUserProfileImage();
|
||||
} else {
|
||||
@@ -115,32 +115,6 @@ export class UserInfoComponent implements OnInit {
|
||||
event.stopPropagation();
|
||||
}
|
||||
|
||||
getEcmFullName(): string {
|
||||
if (this.ecmUser) {
|
||||
return `${this.formatValue(this.ecmUser.firstName)} ${this.formatValue(this.ecmUser.lastName)}`.trim();
|
||||
}
|
||||
return 'N/A';
|
||||
}
|
||||
|
||||
getBpmFullName(): string {
|
||||
if (this.bpmUser) {
|
||||
return `${this.formatValue(this.bpmUser.firstName)} ${this.formatValue(this.bpmUser.lastName)}`.trim();
|
||||
}
|
||||
return 'N/A';
|
||||
}
|
||||
|
||||
getUserNameHeaderFor(env: string): string {
|
||||
if (this.ecmUser && env === 'ECM') {
|
||||
return this.ecmUser.firstName || this.ecmUser.lastName;
|
||||
}
|
||||
|
||||
if (this.bpmUser && env === 'BPM') {
|
||||
return this.formatValue(this.bpmUser.firstName) ||
|
||||
this.formatValue(this.bpmUser.lastName) ||
|
||||
this.formatValue(this.bpmUser.fullname);
|
||||
}
|
||||
}
|
||||
|
||||
private getEcmAvatar() {
|
||||
this.ecmUserImage = this.ecmUserService.getUserProfileImage(this.ecmUser.avatarId);
|
||||
}
|
||||
@@ -156,8 +130,4 @@ export class UserInfoComponent implements OnInit {
|
||||
getEcmUserAvatar() {
|
||||
return this.ecmUserImage;
|
||||
}
|
||||
|
||||
formatValue(value: string) {
|
||||
return value && value !== 'null' ? value : '';
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user