From a8c2a0b1e2b352e9841f8b6733b8c18c83f93325 Mon Sep 17 00:00:00 2001 From: Eugenio Romano Date: Mon, 13 Jan 2020 11:24:03 +0100 Subject: [PATCH] [AAE-1174] select first user info when open the first time (#5345) * select first info user when open * add early check to build the tabs * fix lint * try different solution --- e2e/core/user-info-component.e2e.ts | 1 - .../components/user-info.component.html | 123 ++++++++++-------- .../components/user-info.component.ts | 10 +- .../src/lib/core/pages/user-info.page.ts | 17 +-- 4 files changed, 86 insertions(+), 65 deletions(-) diff --git a/e2e/core/user-info-component.e2e.ts b/e2e/core/user-info-component.e2e.ts index 5c4cf18302..a72f88198f 100644 --- a/e2e/core/user-info-component.e2e.ts +++ b/e2e/core/user-info-component.e2e.ts @@ -74,7 +74,6 @@ describe('User Info component', () => { await userInfoPage.clickUserProfile(); await userInfoPage.dialogIsDisplayed(); - await userInfoPage.clickOnContentServicesTab(); await userInfoPage.checkContentServicesTabIsSelected(); await expect(await userInfoPage.getContentHeaderTitle()).toEqual(contentUserModel.firstName + ' ' + contentUserModel.lastName); diff --git a/lib/core/userinfo/components/user-info.component.html b/lib/core/userinfo/components/user-info.component.html index 91cf4ae4e2..29f7a109ac 100644 --- a/lib/core/userinfo/components/user-info.component.html +++ b/lib/core/userinfo/components/user-info.component.html @@ -1,20 +1,22 @@
+ class="adf-userinfo-container" *ngIf="isLoggedIn"> - {{identityUser | fullName}} + {{identityUser | fullName}} {{ecmUser | fullName}} + class="adf-userinfo-name">{{ecmUser | fullName}} {{bpmUser | fullName}} + class="adf-userinfo-name">{{bpmUser | fullName}} - - - - - - -
+ + + + + +
ecm-profile-image + alt="ecm-profile-image" [src]="getEcmAvatar(ecmUser.avatarId)"/>
-
+
-
{{ecmUser | fullName}}
+
{{ecmUser | fullName}}
-
- {{ecmUser | fullName}} - {{ecmUser.email}} -
-
+
+ {{ecmUser | fullName}} + {{ecmUser.email}} +
+
{{ 'USER_PROFILE.LABELS.ECM.JOB_TITLE' | translate }} {{ ecmUser.jobTitle ? ecmUser.jobTitle : 'N/A' }} -
+
- - - - bpm-profile-image - -
-
-
{{bpmUser | fullName}}
-
- -
+ + + + bpm-profile-image + +
+
+
{{bpmUser | fullName}}
+
+ +
- {{ bpmUser | fullName }} + {{ bpmUser | fullName }} {{bpmUser.email}}
@@ -97,24 +110,26 @@ {{ bpmUser.tenantName ? bpmUser.tenantName : '' }}
-
-
-
+
+
+
- - - + + +
-
{{identityUser | fullName}}
+
{{identityUser | fullName}}
-
- {{identityUser | fullName}} - {{identityUser.email}} -
+
+ {{identityUser | fullName}} + {{identityUser.email}} +
diff --git a/lib/core/userinfo/components/user-info.component.ts b/lib/core/userinfo/components/user-info.component.ts index 70f63de659..46e1aab2cc 100644 --- a/lib/core/userinfo/components/user-info.component.ts +++ b/lib/core/userinfo/components/user-info.component.ts @@ -62,6 +62,8 @@ export class UserInfoComponent implements OnInit { @Input() namePosition: string = 'right'; + mode: string; + ecmUser$: Observable; bpmUser$: Observable; identityUser$: Observable; @@ -80,13 +82,17 @@ export class UserInfoComponent implements OnInit { getUserInfo() { if (this.authService.isOauth()) { this.loadIdentityUserInfo(); + this.mode = 'SSO'; } else if (this.authService.isEcmLoggedIn() && this.authService.isBpmLoggedIn()) { this.loadEcmUserInfo(); this.loadBpmUserInfo(); + this.mode = 'ALL'; } else if (this.authService.isEcmLoggedIn()) { this.loadEcmUserInfo(); + this.mode = 'CONTENT'; } else if (this.authService.isBpmLoggedIn()) { this.loadBpmUserInfo(); + this.mode = 'PROCESS'; } } @@ -95,7 +101,7 @@ export class UserInfoComponent implements OnInit { } private closeUserModal($event: KeyboardEvent) { - if ($event.keyCode === 27 ) { + if ($event.keyCode === 27) { this.trigger.closeMenu(); } } @@ -120,7 +126,7 @@ export class UserInfoComponent implements OnInit { event.stopPropagation(); } - getEcmAvatar(avatarId: any ): string { + getEcmAvatar(avatarId: any): string { return this.ecmUserService.getUserProfileImage(avatarId); } diff --git a/lib/testing/src/lib/core/pages/user-info.page.ts b/lib/testing/src/lib/core/pages/user-info.page.ts index 334899e4b7..fe4e64d1bb 100644 --- a/lib/testing/src/lib/core/pages/user-info.page.ts +++ b/lib/testing/src/lib/core/pages/user-info.page.ts @@ -39,6 +39,11 @@ export class UserInfoPage { userInfoSsoTitle: ElementFinder = element(by.css('.adf-userinfo__detail-title')); ssoEmail: ElementFinder = element(by.id('identity-email')); userProfileButton: ElementFinder = element(by.css('button[data-automation-id="adf-user-profile"]')); + tabsPage: TabsPage; + + constructor() { + this.tabsPage = new TabsPage(); + } async dialogIsDisplayed(): Promise { await BrowserVisibility.waitUntilElementIsVisible(this.dialog); @@ -53,23 +58,19 @@ export class UserInfoPage { } async clickOnContentServicesTab(): Promise { - const tabsPage = new TabsPage(); - await tabsPage.clickTabByTitle('Content Services'); + await this.tabsPage.clickTabByTitle('Content Services'); } async checkProcessServicesTabIsSelected(): Promise { - const tabsPage = new TabsPage; - await tabsPage.checkTabIsSelectedByTitle('Process Services'); + await this.tabsPage.checkTabIsSelectedByTitle('Process Services'); } async checkContentServicesTabIsSelected(): Promise { - const tabsPage = new TabsPage; - await tabsPage.checkTabIsSelectedByTitle('Content Services'); + await this.tabsPage.checkTabIsSelectedByTitle('Content Services'); } async clickOnProcessServicesTab(): Promise { - const tabsPage = new TabsPage; - await tabsPage.clickTabByTitle('Process Services'); + await this.tabsPage.clickTabByTitle('Process Services'); } async userImageIsDisplayed(): Promise {