Business Card Integration
[portal.git] / portal-FE-common / src / app / layout / components / header / header.component.ts
index cb6bdd3..429587d 100644 (file)
@@ -39,6 +39,7 @@ import { Component, OnInit } from '@angular/core';
 import { Router, NavigationEnd } from '@angular/router';
 import { UserProfileService, MenusService } from 'src/app/shared/services';
 import { CookieService } from 'ngx-cookie-service';
+import { environment } from 'src/environments/environment';
 
 @Component({
     selector: 'app-header',
@@ -55,6 +56,10 @@ export class HeaderComponent implements OnInit {
     userapproles: any[];
     displayUserAppRoles: any;
     isLoading: boolean;
+    api = environment.api;
+    brandName: string;
+    brandLogoImagePath: string;
+    isSystemUser: boolean = false;
 
     constructor(public router: Router, private userProfileService: UserProfileService, private menusService: MenusService, private cookieService: CookieService) {
 
@@ -72,11 +77,21 @@ export class HeaderComponent implements OnInit {
     ngOnInit() {
         this.pushRightClass = 'push-right';
         this.getUserInformation();
+        
+        this.brandName = "ONAP Portal";
+        if(this.api.brandName != ''){
+            this.brandName = this.api.brandName;
+         }
+
+        this.brandLogoImagePath = "assets/images/global.logo";
+        if(this.api.brandLogoImagePath != ''){
+           this.brandLogoImagePath = this.api.brandLogoImagePath;
+        }
     }
 
     getUserInformation() {
         this.userProfileService.getFunctionalMenuStaticInfo().toPromise().then((res: any) => {
-            if (res == null || res.firstName == null || res.firstName == '' || res.lastName == null || res.lastName == '') {
+            if (res === null || res.firstName === null || res.firstName === '' || res.lastName === null || res.lastName === '') {
                 // $log.info('HeaderCtrl: failed to get all required data, trying user profile');
                 this.userProfileService.getUserProfile().toPromise().then((profile: any) => {
                     this.firstName = profile.firstName;
@@ -91,6 +106,9 @@ export class HeaderComponent implements OnInit {
                 this.loginSnippetUserid = res.userId;
                 this.lastLogin = Date.parse(res.last_login);
             }
+            if(res != null && res.isSystemUser === 'true'){
+                this.isSystemUser = true;
+            }
             sessionStorage.userId = res.userId;
             this.menusService.getFunctionalMenuForUser().toPromise().then((jsonHeaderMenu: any) => {
                 // $scope.menuItems = unflatten(jsonHeaderMenu);