mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[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
This commit is contained in:
@@ -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);
|
||||
|
@@ -2,7 +2,8 @@
|
||||
class="adf-userinfo-container" *ngIf="isLoggedIn">
|
||||
|
||||
<ng-container *ngIf="showName">
|
||||
<span *ngIf="identityUser$ | async as identityUser; else showBpmAndEcmUserFullNames" id="adf-userinfo-identity-name-display"
|
||||
<span *ngIf="identityUser$ | async as identityUser; else showBpmAndEcmUserFullNames"
|
||||
id="adf-userinfo-identity-name-display"
|
||||
class="adf-userinfo-name">{{identityUser | fullName}}</span>
|
||||
<ng-template #showBpmAndEcmUserFullNames>
|
||||
<span *ngIf="ecmUser$ | async as ecmUser; else showBpmUserFullName" id="adf-userinfo-ecm-name-display"
|
||||
@@ -14,7 +15,8 @@
|
||||
</ng-template>
|
||||
</ng-container>
|
||||
|
||||
<button mat-button [matMenuTriggerFor]="menu" class="adf-userinfo-menu_button" data-automation-id="adf-user-profile">
|
||||
<button mat-button [matMenuTriggerFor]="menu" class="adf-userinfo-menu_button"
|
||||
data-automation-id="adf-user-profile">
|
||||
<div class="adf-userinfo-button-profile" id="user-profile">
|
||||
<div *ngIf="identityUser$ | async as identityUser; else showBpmAndEcmUserImage" id="identity-user-image">
|
||||
<div [outerHTML]="identityUser | usernameInitials:'adf-userinfo-pic'"></div>
|
||||
@@ -43,18 +45,23 @@
|
||||
</ng-template>
|
||||
</div>
|
||||
</button>
|
||||
<mat-menu #menu="matMenu" id="user-profile-lists" [xPosition]="menuPositionX" [yPosition]="menuPositionY" [overlapTrigger]="false" class="adf-userinfo-menu">
|
||||
<mat-tab-group id="tab-group-env" (click)="stopClosing($event)"
|
||||
<mat-menu #menu="matMenu" id="user-profile-lists" [xPosition]="menuPositionX" [yPosition]="menuPositionY"
|
||||
[overlapTrigger]="false" class="adf-userinfo-menu">
|
||||
<mat-tab-group id="tab-group-env" (click)="stopClosing($event)" selectedIndex="0"
|
||||
class="adf-userinfo-tab" [class.adf-hide-tab]="!(bpmUser$ | async) || !(ecmUser$ | async)">
|
||||
<mat-tab id="ecm-panel" label="{{ 'USER_PROFILE.TAB.CS' | translate }}" *ngIf="ecmUser$ | async as ecmUser">
|
||||
<mat-card class="adf-userinfo-card">
|
||||
<mat-card-header class="adf-userinfo-card-header" [style.background-image]="'url(' + ecmBackgroundImage + ')'">
|
||||
<div *ngIf="ecmUser.avatarId; else initialTemplate" class="adf-userinfo-profile-container adf-hide-small">
|
||||
<mat-tab id="ecm-panel" label="{{ 'USER_PROFILE.TAB.CS' | translate }}"
|
||||
*ngIf="mode==='CONTENT' || mode==='ALL'">
|
||||
<mat-card class="adf-userinfo-card" *ngIf="ecmUser$ | async as ecmUser">
|
||||
<mat-card-header class="adf-userinfo-card-header"
|
||||
[style.background-image]="'url(' + ecmBackgroundImage + ')'">
|
||||
<div *ngIf="ecmUser.avatarId; else initialTemplate"
|
||||
class="adf-userinfo-profile-container adf-hide-small">
|
||||
<img class="adf-userinfo-profile-picture" id="ecm-user-detail-image"
|
||||
alt="ecm-profile-image" [src]="getEcmAvatar(ecmUser.avatarId)" />
|
||||
alt="ecm-profile-image" [src]="getEcmAvatar(ecmUser.avatarId)"/>
|
||||
</div>
|
||||
<ng-template #initialTemplate>
|
||||
<div [outerHTML]="ecmUser | usernameInitials:'adf-userinfo-profile-initials adf-hide-small'"></div>
|
||||
<div
|
||||
[outerHTML]="ecmUser | usernameInitials:'adf-userinfo-profile-initials adf-hide-small'"></div>
|
||||
</ng-template>
|
||||
|
||||
<div class="adf-userinfo-title" id="ecm-username">{{ecmUser | fullName}}</div>
|
||||
@@ -62,7 +69,8 @@
|
||||
<mat-card-content>
|
||||
<div class="adf-userinfo-supporting-text">
|
||||
<div class="adf-userinfo-detail">
|
||||
<span id="ecm-full-name" class="adf-userinfo__detail-title">{{ecmUser | fullName}}</span>
|
||||
<span id="ecm-full-name"
|
||||
class="adf-userinfo__detail-title">{{ecmUser | fullName}}</span>
|
||||
<span class="adf-userinfo__detail-profile" id="ecm-email"> {{ecmUser.email}} </span>
|
||||
</div>
|
||||
<div class="adf-userinfo-detail">
|
||||
@@ -75,20 +83,25 @@
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
</mat-tab>
|
||||
<mat-tab id="bpm-panel" label="{{ 'USER_PROFILE.TAB.PS' | translate }}" *ngIf="bpmUser$ | async as bpmUser">
|
||||
<mat-card class="adf-userinfo-card">
|
||||
<mat-card-header class="adf-userinfo-card-header" [style.background-image]="'url(' + bpmBackgroundImage + ')'">
|
||||
<img *ngIf="bpmUser.pictureId; else initialTemplate" class="adf-userinfo-profile-picture adf-hide-small" id="bpm-user-detail-image"
|
||||
<mat-tab id="bpm-panel" label="{{ 'USER_PROFILE.TAB.PS' | translate }}"
|
||||
*ngIf="mode==='PROCESS' || mode==='ALL'">
|
||||
<mat-card class="adf-userinfo-card" *ngIf="bpmUser$ | async as bpmUser">
|
||||
<mat-card-header class="adf-userinfo-card-header"
|
||||
[style.background-image]="'url(' + bpmBackgroundImage + ')'">
|
||||
<img *ngIf="bpmUser.pictureId; else initialTemplate"
|
||||
class="adf-userinfo-profile-picture adf-hide-small" id="bpm-user-detail-image"
|
||||
alt="bpm-profile-image" [src]="getBpmUserImage()"/>
|
||||
<ng-template #initialTemplate>
|
||||
<div [outerHTML]="bpmUser | usernameInitials:'adf-userinfo-profile-initials adf-hide-small'"></div>
|
||||
<div
|
||||
[outerHTML]="bpmUser | usernameInitials:'adf-userinfo-profile-initials adf-hide-small'"></div>
|
||||
</ng-template>
|
||||
<div class="adf-userinfo-title" id="bpm-username">{{bpmUser | fullName}}</div>
|
||||
</mat-card-header>
|
||||
<mat-card-content>
|
||||
<div class="adf-userinfo-supporting-text">
|
||||
<div class="adf-userinfo-detail">
|
||||
<span id="bpm-full-name" class="adf-userinfo__detail-title">{{ bpmUser | fullName }}</span>
|
||||
<span id="bpm-full-name"
|
||||
class="adf-userinfo__detail-title">{{ bpmUser | fullName }}</span>
|
||||
<span class="adf-userinfo__detail-profile" id="bpm-email"> {{bpmUser.email}} </span>
|
||||
</div>
|
||||
<div class="adf-userinfo-detail">
|
||||
@@ -101,9 +114,10 @@
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
</mat-tab>
|
||||
<mat-tab id="identity-panel" *ngIf="identityUser$ | async as identityUser">
|
||||
<mat-card class="adf-userinfo-card">
|
||||
<mat-card-header class="adf-userinfo-card-header" [style.background-image]="'url(' + bpmBackgroundImage + ')'">
|
||||
<mat-tab id="identity-panel" *ngIf="mode==='SSO'">
|
||||
<mat-card class="adf-userinfo-card" *ngIf="identityUser$ | async as identityUser">
|
||||
<mat-card-header class="adf-userinfo-card-header"
|
||||
[style.background-image]="'url(' + bpmBackgroundImage + ')'">
|
||||
<div
|
||||
[outerHTML]="identityUser | usernameInitials:'adf-userinfo-profile-initials adf-hide-small'">
|
||||
</div>
|
||||
@@ -113,7 +127,8 @@
|
||||
<div class="adf-userinfo-supporting-text">
|
||||
<div class="adf-userinfo-detail">
|
||||
<span id="identity-full-name" class="adf-userinfo__detail-title">{{identityUser | fullName}}</span>
|
||||
<span class="adf-userinfo__detail-profile" id="identity-email"> {{identityUser.email}} </span>
|
||||
<span class="adf-userinfo__detail-profile"
|
||||
id="identity-email"> {{identityUser.email}} </span>
|
||||
</div>
|
||||
</div>
|
||||
</mat-card-content>
|
||||
|
@@ -62,6 +62,8 @@ export class UserInfoComponent implements OnInit {
|
||||
@Input()
|
||||
namePosition: string = 'right';
|
||||
|
||||
mode: string;
|
||||
|
||||
ecmUser$: Observable<EcmUserModel>;
|
||||
bpmUser$: Observable<BpmUserModel>;
|
||||
identityUser$: Observable<IdentityUserModel>;
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
@@ -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<void> {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.dialog);
|
||||
@@ -53,23 +58,19 @@ export class UserInfoPage {
|
||||
}
|
||||
|
||||
async clickOnContentServicesTab(): Promise<void> {
|
||||
const tabsPage = new TabsPage();
|
||||
await tabsPage.clickTabByTitle('Content Services');
|
||||
await this.tabsPage.clickTabByTitle('Content Services');
|
||||
}
|
||||
|
||||
async checkProcessServicesTabIsSelected(): Promise<void> {
|
||||
const tabsPage = new TabsPage;
|
||||
await tabsPage.checkTabIsSelectedByTitle('Process Services');
|
||||
await this.tabsPage.checkTabIsSelectedByTitle('Process Services');
|
||||
}
|
||||
|
||||
async checkContentServicesTabIsSelected(): Promise<void> {
|
||||
const tabsPage = new TabsPage;
|
||||
await tabsPage.checkTabIsSelectedByTitle('Content Services');
|
||||
await this.tabsPage.checkTabIsSelectedByTitle('Content Services');
|
||||
}
|
||||
|
||||
async clickOnProcessServicesTab(): Promise<void> {
|
||||
const tabsPage = new TabsPage;
|
||||
await tabsPage.clickTabByTitle('Process Services');
|
||||
await this.tabsPage.clickTabByTitle('Process Services');
|
||||
}
|
||||
|
||||
async userImageIsDisplayed(): Promise<void> {
|
||||
|
Reference in New Issue
Block a user