#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:
Vito
2017-04-12 04:03:50 -07:00
committed by Mario Romano
parent 1eea3c2983
commit 26da797398
9 changed files with 253 additions and 302 deletions

View File

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