aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/directives/user-header-details
diff options
context:
space:
mode:
authorTal Gitelman <tg851x@intl.att.com>2017-12-10 18:55:03 +0200
committerTal Gitelman <tg851x@intl.att.com>2017-12-10 19:33:38 +0200
commit51d50f0ef642e0f996a1c8b8d2ef4838bdfec892 (patch)
tree3ac236a864d74d19b0f5c9020891a7a7e5c31b44 /catalog-ui/src/app/directives/user-header-details
parentb5cc2e0695f195716d6ccdc65e73807a6632ec70 (diff)
Final commit to master merge from
Change-Id: Ib464f9a8828437c86fe6def8af238aaf83473507 Issue-ID: SDC-714 Signed-off-by: Tal Gitelman <tg851x@intl.att.com>
Diffstat (limited to 'catalog-ui/src/app/directives/user-header-details')
-rw-r--r--catalog-ui/src/app/directives/user-header-details/user-header-details-directive.ts26
1 files changed, 11 insertions, 15 deletions
diff --git a/catalog-ui/src/app/directives/user-header-details/user-header-details-directive.ts b/catalog-ui/src/app/directives/user-header-details/user-header-details-directive.ts
index eadca96bfa..1367906e21 100644
--- a/catalog-ui/src/app/directives/user-header-details/user-header-details-directive.ts
+++ b/catalog-ui/src/app/directives/user-header-details/user-header-details-directive.ts
@@ -19,21 +19,17 @@
*/
'use strict';
-import {User, IUser, IAppConfigurtaion} from "app/models";
-import {IUserResourceClass, IUserResource} from "app/services";
+import {User, IUser, IAppConfigurtaion, IUserProperties} from "app/models";
+import { UserService } from "../../ng2/services/user.service";
export interface IUserHeaderDetailsScope extends ng.IScope {
- name:string;
- role:string;
iconUrl:string;
- UserResourceClass:IUserResourceClass;
user:IUser;
- sdcConfig:IAppConfigurtaion;
initUser:Function;
}
export class UserHeaderDetailsDirective implements ng.IDirective {
- constructor(private $http:ng.IHttpService, private sdcConfig:IAppConfigurtaion, private UserResourceClass:IUserResourceClass) {
+ constructor(private $http:ng.IHttpService, private sdcConfig:IAppConfigurtaion, private userService:UserService) {
}
scope = {
@@ -50,23 +46,23 @@ export class UserHeaderDetailsDirective implements ng.IDirective {
scope.initUser = ():void => {
let defaultUserId:string;
- let user:IUserResource = this.UserResourceClass.getLoggedinUser();
- if (!user) {
+ let userInfo:IUserProperties = this.userService.getLoggedinUser();
+ if (!userInfo) {
defaultUserId = this.$http.defaults.headers.common[this.sdcConfig.cookie.userIdSuffix];
- user = this.UserResourceClass.get({id: defaultUserId}, ():void => {
- scope.user = new User(user);
+ this.userService.getUser(defaultUserId).subscribe((defaultUserInfo):void => {
+ scope.user = new User(defaultUserInfo);
});
} else {
- scope.user = new User(user);
+ scope.user = new User(userInfo);
}
};
scope.initUser();
};
- public static factory = ($http:ng.IHttpService, sdcConfig:IAppConfigurtaion, UserResourceClass:IUserResourceClass)=> {
- return new UserHeaderDetailsDirective($http, sdcConfig, UserResourceClass);
+ public static factory = ($http:ng.IHttpService, sdcConfig:IAppConfigurtaion, userService:UserService)=> {
+ return new UserHeaderDetailsDirective($http, sdcConfig, userService);
};
}
-UserHeaderDetailsDirective.factory.$inject = ['$http', 'sdcConfig', 'Sdc.Services.UserResourceService'];
+UserHeaderDetailsDirective.factory.$inject = ['$http', 'sdcConfig', 'UserServiceNg2'];