user-info fixes and performance improvements (#1171)

* #1167 document-list improvements

- allow setting custom root path
- document-list module now re-exports datatable module (no need
importing it separately if document-list is already used)
- documentation updates and fixes

* readme updates and unit test

* user-info fixes and performance improvements

- setup live reloads for user-info (demo shell)
- optimise user-info template (single *ngIf, [mdl] directive for
‘user-profile-lists’ instead of CPU-hungry `ngAfterViewChecked`)
This commit is contained in:
Denys Vuika
2016-11-29 13:26:41 +00:00
committed by Eugenio Romano
parent 9066ce49e0
commit 5c401007f2
3 changed files with 76 additions and 81 deletions

View File

@@ -6,6 +6,7 @@
"node_modules/ng2-alfresco-login/dist/**/*.{html,css,js}",
"node_modules/ng2-alfresco-search/dist/**/*.{html,css,js}",
"node_modules/ng2-alfresco-upload/dist/**/*.{html,css,js}",
"node_modules/ng2-alfresco-userinfo/dist/**/*.{html,css,js}",
"node_modules/ng2-alfresco-viewer/dist/**/*.{html,css,js}",
"node_modules/ng2-alfresco-webscript/dist/**/*.{html,css,js}",
"node_modules/ng2-activiti-form/dist/**/*.{html,css,js}",

View File

@@ -1,13 +1,13 @@
<div id="userinfo_container" *ngIf="isLoggedIn()">
<div *ngIf="ecmUser || bpmUser" class="button-profile" id="user-profile" data-automation-id="user-profile">
<div *ngIf="ecmUser || bpmUser">
<div class="button-profile" id="user-profile" data-automation-id="user-profile">
<img id="logged-user-img"
[src]="getUserAvatar()"
alt="user-info-profile-button"
(error)="onImageLoadingError($event)"
class="profile-image"/>
</div>
<div *ngIf="ecmUser || bpmUser" id="user-profile-lists" class="user-profile-list-mdl
mdl-menu mdl-js-menu mdl-js-ripple-effect"
<div mdl id="user-profile-lists" class="user-profile-list-mdl mdl-menu mdl-js-menu mdl-js-ripple-effect"
[class.mdl-menu--bottom-left]="menuOpenType === 'left'? true : false"
[class.mdl-menu--bottom-right]="menuOpenType === 'right'? true : false"
for="user-profile" (click)="stopClosing($event)">
@@ -81,3 +81,4 @@
</div>
</div>
</div>

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { Component, OnInit, Input, AfterViewChecked } from '@angular/core';
import { Component, OnInit, Input } from '@angular/core';
import { EcmUserModel } from './../models/ecm-user.model';
import { BpmUserModel } from './../models/bpm-user.model';
import { EcmUserService } from './../services/ecm-user.service';
@@ -30,7 +30,7 @@ declare let componentHandler: any;
styleUrls: ['./user-info.component.css'],
templateUrl: './user-info.component.html'
})
export class UserInfoComponent implements AfterViewChecked, OnInit {
export class UserInfoComponent implements OnInit {
@Input()
ecmBackgroundImage: string;
@@ -69,13 +69,6 @@ export class UserInfoComponent implements AfterViewChecked, OnInit {
});
}
ngAfterViewChecked() {
// workaround for MDL issues with dynamic components
if (componentHandler) {
componentHandler.upgradeAllRegistered();
}
}
ngOnInit() {
this.getUserInfo();
}