2 * ================================================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ================================================================================
20 var menuStructureConvert = function(menuItems) {
21 var megaMenuDataObjectTemp = [
30 url:"javascript:angular.element('[ng-controller=headerController]').scope().redirectLink('contact');"
34 url:"javascript:angular.element('[ng-controller=headerController]').scope().redirectLink('access');"
38 return megaMenuDataObjectTemp;
40 var unflatten = function( array, parent, tree ){
41 tree = typeof tree !== 'undefined' ? tree : [];
42 parent = typeof parent !== 'undefined' ? parent : { menuId: null };
43 var children = _.filter( array, function(child){ return child.parentMenuId == parent.menuId; });
45 if( !_.isEmpty( children ) ){
46 if( parent.menuId === null ){
49 parent['children'] = children
51 _.each( children, function( child ){ unflatten( array, child ) } );
56 app.service('HeaderService', function ($http,$log, $q,UserInfoService) {
59 getUserNameFromSession : function(){
60 UserInfoService.getFunctionalMenuStaticDetailSession()
61 .then(function (res) {
62 $scope.userName = res.userName;
63 $scope.redirectUrl = res.portalUrl;
66 getTopMenuStaticInfo:function() {
67 var promise = UserInfoService.getFunctionalMenuStaticDetailShareContext();
70 if(res==null || res==''){
71 $log.info('failed getting static User information');
72 this.getUserNameFromSession();
74 $log.info('Received static User information');
76 $scope.inputUserInfo(resData);
77 $scope.userProfile.fullName = $scope.userProfile.firstName+ ' '+ $scope.userProfile.lastName;
78 return $scope.userProfile;
82 $log.info('failed getting static User information');