diff --git a/ng2-components/ng2-alfresco-userinfo/src/components/user-info.component.css b/ng2-components/ng2-alfresco-userinfo/src/components/user-info.component.css index ddda950182..0c25fe1069 100644 --- a/ng2-components/ng2-alfresco-userinfo/src/components/user-info.component.css +++ b/ng2-components/ng2-alfresco-userinfo/src/components/user-info.component.css @@ -7,6 +7,7 @@ cursor: pointer; border: 1px solid #999999; vertical-align: middle; + background-color:white;; } .button-profile { @@ -16,7 +17,6 @@ } .detail-user-profile-list-mdl{ - margin-right: 10px; padding: 0px 0; } @@ -24,6 +24,7 @@ max-height: 450px; min-width: 450px; overflow: auto; + padding:0px; } .header-profile{ @@ -53,3 +54,33 @@ span.role-label-user{ .truncate-long-names{ text-overflow: ellipsis; } +.demo-card-wide.mdl-card { + width: inherit; +} +.demo-card-wide > .mdl-card__title { + color: #fff; + height: 176px; +} +.demo-card-wide > .mdl-card__menu { + color: #fff; +} + +.card-title__option{ + height: 100px!important; +} + +img.profile-picture { + background-color: white; + background-size: cover; + border-radius: 50%; + box-shadow: inset 1px 1px 3px rgba(0,0,0,0.2), 1px 1px 4px rgba(0,0,0,0.3); + height: 80px; + width: 80px; + z-index: 3; + margin-left: 0px; + margin-right: 8px; +} + +.menu-container__items{ + +} diff --git a/ng2-components/ng2-alfresco-userinfo/src/components/user-info.component.html b/ng2-components/ng2-alfresco-userinfo/src/components/user-info.component.html index a5cccc1539..2e17fc6186 100644 --- a/ng2-components/ng2-alfresco-userinfo/src/components/user-info.component.html +++ b/ng2-components/ng2-alfresco-userinfo/src/components/user-info.component.html @@ -1,65 +1,74 @@
- {{ecmUser.firstName || ecmUser.lastName}} - - {{ formatValue(bpmUser.firstName) || - formatValue(bpmUser.lastName) || - formatValue(bpmUser.fullname) }} - -
- +
+
-
-
-
- BPM -
  • +
  • +
    + - +
    +
    + - - diff --git a/ng2-components/ng2-alfresco-userinfo/src/components/user-info.component.ts b/ng2-components/ng2-alfresco-userinfo/src/components/user-info.component.ts index e2d5968d75..a32c794c5b 100644 --- a/ng2-components/ng2-alfresco-userinfo/src/components/user-info.component.ts +++ b/ng2-components/ng2-alfresco-userinfo/src/components/user-info.component.ts @@ -61,12 +61,30 @@ export class UserInfoComponent implements OnInit { .subscribe((res) => { this.bpmUser = res; }); - this.bpmUserService.getCurrentUserProfileImage() - .subscribe( - (res) => { - this.bpmUserImage = res; - } - ); + this.bpmUserImage = this.bpmUserService.getCurrentUserProfileImage(); + } + } + + onImageLoadingError(event) { + if (event) { + let element = event.target; + element.src = this.anonymousImageUrl; + } + } + + stopClosing(event) { + event.stopPropagation(); + } + + getUserNameHeaderFor(env: 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); } } @@ -75,15 +93,15 @@ export class UserInfoComponent implements OnInit { } getUserAvatar() { - return this.ecmUserImage || this.bpmUserImage || this.anonymousImageUrl; + return this.ecmUserImage || this.bpmUserImage; } getBpmUserAvatar() { - return this.bpmUserImage || this.anonymousImageUrl; + return this.bpmUserImage; } getEcmUserAvatar() { - return this.ecmUserImage || this.anonymousImageUrl; + return this.ecmUserImage; } formatValue(value: string) { diff --git a/ng2-components/ng2-alfresco-userinfo/src/img/blueBanner.png b/ng2-components/ng2-alfresco-userinfo/src/img/blueBanner.png new file mode 100644 index 0000000000..923f00885d Binary files /dev/null and b/ng2-components/ng2-alfresco-userinfo/src/img/blueBanner.png differ diff --git a/ng2-components/ng2-alfresco-userinfo/src/img/orangeBanner.png b/ng2-components/ng2-alfresco-userinfo/src/img/orangeBanner.png new file mode 100644 index 0000000000..4a0a39ae5a Binary files /dev/null and b/ng2-components/ng2-alfresco-userinfo/src/img/orangeBanner.png differ diff --git a/ng2-components/ng2-alfresco-userinfo/src/services/bpm-user.service.spec.ts b/ng2-components/ng2-alfresco-userinfo/src/services/bpm-user.service.spec.ts index 177c05b30a..7833b60617 100644 --- a/ng2-components/ng2-alfresco-userinfo/src/services/bpm-user.service.spec.ts +++ b/ng2-components/ng2-alfresco-userinfo/src/services/bpm-user.service.spec.ts @@ -25,7 +25,7 @@ declare let jasmine: any; describe('Bpm User service', () => { - let service, injector, authService; + let service, injector, authService, apiService; beforeEach(() => { injector = ReflectiveInjector.resolveAndCreate([ @@ -39,6 +39,7 @@ describe('Bpm User service', () => { beforeEach(() => { service = injector.get(BpmUserService); authService = injector.get(AlfrescoAuthenticationService); + apiService = injector.get(AlfrescoApiService); jasmine.Ajax.install(); }); @@ -47,7 +48,7 @@ describe('Bpm User service', () => { }); it('can instantiate service with authorization', () => { - let serviceTest = new BpmUserService(authService); + let serviceTest = new BpmUserService(authService, apiService); expect(serviceTest instanceof BpmUserService).toBe(true, 'new service should be ok'); }); diff --git a/ng2-components/ng2-alfresco-userinfo/src/services/bpm-user.service.ts b/ng2-components/ng2-alfresco-userinfo/src/services/bpm-user.service.ts index 0f2f445f8e..d5d85eb18f 100644 --- a/ng2-components/ng2-alfresco-userinfo/src/services/bpm-user.service.ts +++ b/ng2-components/ng2-alfresco-userinfo/src/services/bpm-user.service.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { AlfrescoAuthenticationService } from 'ng2-alfresco-core'; +import { AlfrescoApiService, AlfrescoAuthenticationService } from 'ng2-alfresco-core'; import { Injectable } from '@angular/core'; import { Response } from '@angular/http'; import { Observable } from 'rxjs/Rx'; @@ -29,7 +29,8 @@ import { BpmUserModel } from '../models/bpm-user.model'; @Injectable() export class BpmUserService { - constructor(private authService: AlfrescoAuthenticationService) { + constructor(private authService: AlfrescoAuthenticationService, + private alfrescoJsApi: AlfrescoApiService) { } /** @@ -37,19 +38,13 @@ export class BpmUserService { * @param userName - the user name */ getCurrentUserInfo(): Observable { - return Observable.fromPromise(this.authService.getAlfrescoApi().activiti.profileApi.getProfile()) + return Observable.fromPromise(this.alfrescoJsApi.getInstance().activiti.profileApi.getProfile()) .map((data) => data) .catch(this.handleError); } - getCurrentUserProfileImage(): Observable { - return Observable.fromPromise(this.callGetProfilePictureApi()) - .map((data) => data) - .catch(this.handleError); - } - - private callGetProfilePictureApi() { - return this.authService.getAlfrescoApi().activiti.profileApi.getProfilePicture(); + getCurrentUserProfileImage(): string { + return this.alfrescoJsApi.getInstance().activiti.profileApi.getProfilePictureUrl(); } /**