diff options
Diffstat (limited to 'ecomp-portal-FE-common/client/app/views/header')
4 files changed, 954 insertions, 741 deletions
diff --git a/ecomp-portal-FE-common/client/app/views/header/header.controller.js b/ecomp-portal-FE-common/client/app/views/header/header.controller.js index 961362a5..33cb8454 100644 --- a/ecomp-portal-FE-common/client/app/views/header/header.controller.js +++ b/ecomp-portal-FE-common/client/app/views/header/header.controller.js @@ -1,449 +1,558 @@ -/*-
- * ================================================================================
- * ECOMP Portal
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ================================================================================
- */
-'use strict';
-(function () {
- class HeaderCtrl {
- constructor($log, $window, userProfileService, menusService, $scope, ECOMP_URL_REGEX, $cookies, $state,auditLogService,notificationService) {
- this.firstName = '';
- this.lastName = '';
- this.$log = $log;
- this.menusService = menusService;
- this.$scope = $scope;
- this.favoritesMenuItems = '';
- $scope.favoriteItemsCount = 0;
- $scope.favoritesMenuItems = '';
- $scope.showFavorites = false;
- $scope.emptyFavorites = false;
- $scope.favoritesWindow = false;
- $scope.notificationCount=0;
- $scope.showNotification = true;
-
- $scope.hideMenus = false;
-
- $scope.menuItems = [];
- $scope.activeClickSubMenu = {
- x: ''
- };
- $scope.activeClickMenu = {
- x: ''
- };
- $scope.megaMenuDataObject =[];
- $scope.notificationCount= notificationService.notificationCount;
- this.isLoading = true;
- this.ECOMP_URL_REGEX = ECOMP_URL_REGEX;
-
- var unflatten = function( array, parent, tree ){
-
- tree = typeof tree !== 'undefined' ? tree : [];
- parent = typeof parent !== 'undefined' ? parent : { menuId: null };
- var children = _.filter( array, function(child){ return child.parentMenuId == parent.menuId; });
-
- if( !_.isEmpty( children ) ){
- if( parent.menuId === null ){
- tree = children;
- }else{
- parent['children'] = children
- }
- _.each( children, function( child ){ unflatten( array, child ) } );
- }
-
- return tree;
- }
-
- userProfileService.getFunctionalMenuStaticInfo()
- .then(res=> {
- // $log.debug('HeaderCtrl::getFunctionalMenuStaticInfo: getting Functional Menu Static Info init');
- if(res==null || res.firstName==null || res.firstName=='' || res.lastName==null || res.lastName=='' ){
- // $log.info('HeaderCtrl::getFunctionalMenuStaticInfo: failed getting userinfo from shared context.. ');
- $log.info('HeaderCtrl: failed to get all required data, trying user profile');
- userProfileService.getUserProfile()
- .then(profile=> {
- // $log.debug('HeaderCtrl:: getting userinfo from session success');
- this.firstName = profile.firstName;
- this.lastName = profile.lastName;
- // $log.debug('HeaderCtrl::getFunctionalMenuStaticInfo: user has the following roles: ' + profile.roles);
- }).catch(err=> {
- $log.error('Header Controller:: getUserProfile() failed: ' + err);
- });
- } else {
- // $log.debug('HeaderCtrl: fetched Functional Menu Static Info successfully',res);
- this.firstName = res.firstName;
- this.lastName = res.lastName;
- }
-
- menusService.GetFunctionalMenuForUser()
- .then(jsonHeaderMenu=> {
- $scope.menuItems = unflatten( jsonHeaderMenu );
- $scope.megaMenuDataObject = $scope.menuItems;
- }).catch(err=> {
- $log.error('HeaderCtrl::GetFunctionalMenuForUser: HeaderCtrl json returned: ' + err);
- });
-
- }).catch(err=> {
- $log.error('HeaderCtrl::getFunctionalMenuStaticInfo failed: ' + err);
- });
-
- //store audit log
- $scope.auditLog = function(app,type) {
- var comment = 'type: '+type+ ',title: '+app.text+",url: "+app.url;
- auditLogService.storeAudit(app.appid,'functional',comment);
- };
-
- $scope.loadFavorites = function () {
- $scope.hideMenus = false;
- // $log.debug('HeaderCtrl::loadFavorites: loadFavorites has happened.');
- if ($scope.favoritesMenuItems == '') {
- generateFavoriteItems();
- // $log.debug('HeaderCtrl::loadFavorites: loadFavorites is calling generateFavoriteItems()');
- } else {
- // $log.debug('HeaderCtrl::loadFavorites: loadFavorites is NOT calling generateFavoriteItems()');
- }
- }
-
- $scope.goToUrl = (item) => {
- // $log.error('HeaderCtrl::goToUrl has started',item);
- let url = item.url;
- let restrictedApp = item.restrictedApp;
- if (!url) {
- $log.warn('HeaderCtrl::goToUrl: No url found for this application, doing nothing..');
- return;
- }
- if (restrictedApp) {
- $window.open(url, '_blank');
- } else {
- if(item.url=="getAccess" || item.url=="contactUs"){
- // if (url = window.location.href)
- $state.go("root."+url);
- } else {
- var tabContent = { id: new Date(), title: item.text, url: item.url,appId:item.appid };
- $cookies.putObject('addTab', tabContent );
- }
- // $log.debug('HeaderCtrl::goToUrl: url = ', url);
- }
- $scope.hideMenus = true;
- }
-
-
-
- $scope.submenuLevelAction = function(index, column) {
- if ($scope.favoritesMenuItems == '') {
- generateFavoriteItems();
- // $log.debug('HeaderCtrl::submenuLevelAction: submenuLevelAction is calling generateFavoriteItems()');
- } else {
- // $log.debug('submenuLevelAction is NOT calling generateFavoriteItems()');
- }
- // $log.debug('item hovered: ' + index + '; column = ' + column);
- // if (column == 2) { // 2 is Design
- // // This is an admitted hack. See aw3218 for reasons why
- // $log.debug('submenuLevelAction column == 2');
- // $scope.favoritesWindow = false;
- // $scope.showFavorites = false;
- // $scope.emptyFavorites = false;
- // }
- if (index=='Favorites' && $scope.favoriteItemsCount != 0) {
- // $log.debug('HeaderCtrl::submenuLevelAction: Showing Favorites window');
- // generateFavoriteItems();
- $scope.favoritesWindow = true;
- $scope.showFavorites = true;
- $scope.emptyFavorites = false;
- }
- if (index=='Favorites' && $scope.favoriteItemsCount == 0) {
- // $log.debug('HeaderCtrl::submenuLevelAction: Hiding Favorites window in favor of No Favorites Window');
- // generateFavoriteItems();
- $scope.favoritesWindow = true;
- $scope.showFavorites = false;
- $scope.emptyFavorites = true;
- }
- if (index!='Favorites' ) {
- $scope.favoritesWindow = false;
- $scope.showFavorites = false;
- $scope.emptyFavorites = false;
- }
-
- };
-
- $scope.hideFavoritesWindow = function() {
- $scope.showFavorites = false;
- $scope.emptyFavorites = false;
- // $scope.thirdFourthMenus = true;
- }
-
- $scope.isUrlFavorite = function (menuId) {
- // $log.debug('array objects in menu favorites = ' + $scope.favoriteItemsCount + '; menuId=' + menuId);
- var jsonMenu = JSON.stringify($scope.favoritesMenuItems);
- var isMenuFavorite = jsonMenu.indexOf('menuId\":' + menuId);
- // $log.debug('jsonMenu.indexOf(menuId:' + jsonMenu.indexOf('menuId\":'+menuId));
- // $log.debug('isMenuFavorite= ' + isMenuFavorite);
- if (isMenuFavorite==-1) {
- return false;
- } else {
- return true;
- }
-
- }
-
- let generateFavoriteItems = () => {
- menusService.getFavoriteItems()
- .then(favorites=> {
- // $log.debug('HeaderCtrl.getFavoriteItems:: ' + JSON.stringify(favorites));
- $scope.favoritesMenuItems = favorites;
- $scope.favoriteItemsCount = Object.keys(favorites).length;
- // $log.info('HeaderCtrl.getFavoriteItems:: number of favorite menus: ' + $scope.favoriteItemsCount);
- }).catch(err=> {
- $log.error('HeaderCtrl.getFavoriteItems:: Error retrieving Favorites menus: ' + err);
- });
- }
-
- $scope.setAsFavoriteItem = function(event, menuId){
- var jsonMenuID = angular.toJson({'menuId': + menuId });
- // $log.debug('HeaderCtrl::setFavoriteItems: ' + jsonMenuID + " - " + event.target.id);
-
- menusService.setFavoriteItem(jsonMenuID)
- .then(() => {
- // var elementId = '#'+ event.currentTarget.id;
- angular.element('#' + event.target.id).css('color', '#fbb313');
- generateFavoriteItems();
- }).catch(err=> {
- $log.error('HeaderCtrl::setFavoriteItems:: API setFavoriteItem error: ' + err);
- });
- };
-
- $scope.removeAsFavoriteItem = function(event, menuId){
- // $log.debug('-----------------------------removeAsFavoriteItem: ' + menuId + " - " + event.target.id);
- menusService.removeFavoriteItem(menuId)
- .then(() => {
- angular.element('#' + event.target.id).css('color', '#666666');
- generateFavoriteItems();
- }).catch(err=> {
- $log.error('HeaderCtrl::removeAsFavoriteItem: API removeFavoriteItem error: ' + err);
- });
- };
-
- $scope.goToPortal = (headerText, url) => {
- if (!url) {
- $log.warn('HeaderCtrl::goToPortal: No url found for this application, doing nothing..');
- return;
- }
- if (!ECOMP_URL_REGEX.test(url)) {
- url = 'http://' + url;
- }
-
- if(headerText.startsWith("vUSP")) {
- window.open(url, '_blank');//, '_self'
- }
- else {
- var tabContent = { id: new Date(), title: headerText, url: url };
- $cookies.putObject('addTab', tabContent );
- }
- };
-
- }
- }
- class LoginSnippetCtrl {
- constructor($log, $scope, $cookies, $timeout, userProfileService, sessionService) {
- $scope.firstName="";
- $scope.lastName="";
- $scope.displayUserAppRoles=false;
- $scope.allAppsLogout = function(){
-
- var cookieTabs = $cookies.getObject('visInVisCookieTabs');
- if(cookieTabs!=null){
- for(var t in cookieTabs){
-
- var url = cookieTabs[t].content;
- if(url != "") {
- sessionService.logout(url);
- }
- }
- }
- // wait for individual applications to log out before the portal logout
- $timeout(function() {
- window.location = "logout.htm";
- }, 2000);
- }
-
-
- try {
- userProfileService.getFunctionalMenuStaticInfo()
- .then(res=> {
- // $log.info('HeaderCtrl::LoginSnippetCtrl: Login information: ' + JSON.stringify(res));
- $scope.firstName = res.firstName;
- $scope.lastName = res.lastName;
- $scope.loginSnippetEmail = res.email;
- $scope.loginSnippetUserid = res.userId;
- $scope.lastLogin = res.last_login;
- }).catch(err=> {
- $log.error('HeaderCtrl::LoginSnippetCtrl: failed in getFunctionalMenuStaticInfo: ' + err);
- });
- } catch (err) {
- $log.error('HeaderCtrl::LoginSnippetCtrl caught exception: ' + err);
- }
-
- $scope.getUserApplicationRoles= function(){
- $scope.userapproles = [];
- if($scope.displayUserAppRoles)
- $scope.displayUserAppRoles = false;
- else
- $scope.displayUserAppRoles = true;
-
- userProfileService.getUserAppRoles($scope.loginSnippetUserid)
- .then(res=>{
-
- for(var i=0;i<res.length;i++){
- var userapprole ={
- App:res[i].appName,
- Roles:res[i].roleNames,
- };
-
- $scope.userapproles.push(userapprole);
- }
-
- });
-
- }
- }
- }
- class NotificationCtrl{
- constructor($log, $scope, $cookies, $timeout, sessionService,notificationService,$interval,ngDialog) {
- $scope.notifications=[];
- var intervalPromise = null;
- $scope.notificationCount= notificationService.notificationCount;
-
- $scope.getNotification = function(){
- notificationService.getNotification()
- .then(res=> {
- notificationService.decrementRefreshCount();
- var count = notificationService.getRefreshCount();
- if (res==null || res.data==null || res.data.message!='success') {
- $log.error('NotificationCtrl::updateNotifications: failed to get notifications');
- if (intervalPromise != null)
- $interval.cancel(intervalPromise);
- } else if(count<=0){
- if (intervalPromise != null)
- $interval.cancel(intervalPromise);
- } else {
- $scope.notifications = [];
- notificationService.setNotificationCount(res.data.response.length);
- for(var i=0;i<res.data.response.length;i++){
- var data = res.data.response[i];
- var notification ={
- id:data.notificationId,
- title:data.msgHeader,
- message:data.msgDescription,
- source:data.msgSource,
- time:data.createdDate,
- priority:data.priority
- };
- $scope.notifications.push(notification);
- }
- }
- }).catch(err=> {
- $log.error('NotificationCtrl::getNotification: caught exception: ' + err);
- if (intervalPromise != null)
- $interval.cancel(intervalPromise);
- });
- }
- $scope.getNotification();
- function updateNotifications() {
- $scope.getNotification();
- }
- $scope.start = function(rate) {
- // stops any running interval to avoid two intervals running at the same time
- $scope.stop();
- // store the interval promise
- intervalPromise = $interval(updateNotifications, rate);
- };
-
- $scope.stop = function() {
- $interval.cancel(intervalPromise);
- };
-
-
- $scope.showDetailedJsonMessage=function (selectedAdminNotification) {
- if (selectedAdminNotification.source!=='EP'){
- var messageObject=JSON.parse(selectedAdminNotification.message);
- var html="";
- html+='<p>'+'Message Source'+' : '+selectedAdminNotification.source+'</p>';
- html+='<p>'+'Message Title'+' : '+selectedAdminNotification.title+'</p>';
- for(var field in messageObject){
- if(field=='eventDate'||field=='lastModifiedDate'){
- html+='<p>'+field+' : '+new Date(+messageObject[field])+'</p>';
-
- }else{
- html+='<p>'+field+' : '+messageObject[field]+'</p>';
-
- }
- }
-
- var modalInstance = ngDialog.open({
- templateUrl: 'app/views/user-notifications-admin/user.notifications.Json.details.modal.page.html',
- controller: 'userNotificationCtrl',
- resolve: {
- message: function () {
- var message = {
- title: '',
- text: html
-
- };
- return message;
- },
-
- }
- });
-
- }
- };
-
- notificationService.getNotificationRate().then(res=> {
- if (res == null || res.response == null) {
- $log.error('NotificationCtrl: failed to notification update rate or duration, check system.properties file.');
- } else {
- var rate = parseInt(res.response.updateRate);
- var duration = parseInt(res.response.updateDuration);
- notificationService.setMaxRefreshCount(parseInt(duration/rate)+1);
- notificationService.setRefreshCount(notificationService.maxCount);
- if (rate != NaN && duration != NaN) {
- $scope.updateRate=rate;
- $scope.start($scope.updateRate);
- }
- }
- }).catch(err=> {
- $log.error('NotificationCtrl: getNotificationRate() failed: ' + err);
- });
-
- $scope.deleteNotification = function(index){
- if ($scope.notifications[index].id == null || $scope.notifications[index].id == '') {
- $log.error('NotificationCtrl: failed to delete Notification.');
- return;
- }
- notificationService.setNotificationRead($scope.notifications[index].id);
- $scope.notifications.splice(index,1);
- notificationService.setNotificationCount($scope.notifications.length);
- }
- }
- }
- NotificationCtrl.$inject = ['$log', '$scope', '$cookies', '$timeout', 'sessionService','notificationService','$interval','ngDialog'];
- LoginSnippetCtrl.$inject = ['$log', '$scope', '$cookies', '$timeout','userProfileService', 'sessionService'];
- HeaderCtrl.$inject = ['$log', '$window', 'userProfileService', 'menusService', '$scope', 'ECOMP_URL_REGEX','$cookies','$state','auditLogService','notificationService'];
- angular.module('ecompApp').controller('HeaderCtrl', HeaderCtrl);
- angular.module('ecompApp').controller('loginSnippetCtrl', LoginSnippetCtrl);
- angular.module('ecompApp').controller('notificationCtrl', NotificationCtrl);
-
-})();
+/*- + * ================================================================================ + * ECOMP Portal + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +'use strict'; +(function () { + class HeaderCtrl { + constructor($log, $window, userProfileService, menusService, $scope, ECOMP_URL_REGEX, $cookies, $state,auditLogService,notificationService,recommendationService,ngDialog) { + this.firstName = ''; + this.lastName = ''; + this.$log = $log; + this.menusService = menusService; + this.$scope = $scope; + this.favoritesMenuItems = ''; + $scope.favoriteItemsCount = 0; + $scope.favoritesMenuItems = ''; + $scope.showFavorites = false; + $scope.emptyFavorites = false; + $scope.favoritesWindow = false; + $scope.notificationCount=0; + $scope.recommendationCount=0; + $scope.showNotification = true; + + $scope.hideMenus = false; + + $scope.menuItems = []; + $scope.activeClickSubMenu = { + x: '' + }; + $scope.activeClickMenu = { + x: '' + }; + $scope.megaMenuDataObject =[]; + $scope.notificationCount= notificationService.notificationCount; + $scope.recommendationCount= recommendationService.recommendationCount; + this.isLoading = true; + this.ECOMP_URL_REGEX = ECOMP_URL_REGEX; + + var unflatten = function( array, parent, tree ){ + + tree = typeof tree !== 'undefined' ? tree : []; + parent = typeof parent !== 'undefined' ? parent : { menuId: null }; + var children = _.filter( array, function(child){ return child.parentMenuId == parent.menuId; }); + + if( !_.isEmpty( children ) ){ + if( parent.menuId === null ){ + tree = children; + }else{ + parent['children'] = children + } + _.each( children, function( child ){ unflatten( array, child ) } ); + } + + return tree; + } + + userProfileService.getFunctionalMenuStaticInfo() + .then(res=> { + // $log.debug('HeaderCtrl::getFunctionalMenuStaticInfo: getting Functional Menu Static Info init'); + if(res==null || res.firstName==null || res.firstName=='' || res.lastName==null || res.lastName=='' ){ + // $log.info('HeaderCtrl::getFunctionalMenuStaticInfo: failed getting userinfo from shared context.. '); + $log.info('HeaderCtrl: failed to get all required data, trying user profile'); + userProfileService.getUserProfile() + .then(profile=> { + // $log.debug('HeaderCtrl:: getting userinfo from session success'); + this.firstName = profile.firstName; + this.lastName = profile.lastName; + // $log.debug('HeaderCtrl::getFunctionalMenuStaticInfo: user has the following roles: ' + profile.roles); + }).catch(err=> { + $log.error('Header Controller:: getUserProfile() failed: ' + err); + }); + } else { + // $log.debug('HeaderCtrl: fetched Functional Menu Static Info successfully',res); + this.firstName = res.firstName; + this.lastName = res.lastName; + } + + menusService.GetFunctionalMenuForUser() + .then(jsonHeaderMenu=> { + $scope.menuItems = unflatten( jsonHeaderMenu ); + $scope.megaMenuDataObject = $scope.menuItems; + }).catch(err=> { + $log.error('HeaderCtrl::GetFunctionalMenuForUser: HeaderCtrl json returned: ' + err); + }); + + }).catch(err=> { + $log.error('HeaderCtrl::getFunctionalMenuStaticInfo failed: ' + err); + }); + + //store audit log + $scope.auditLog = function(app,type) { + var comment = 'type: '+type+ ',title: '+app.text+",url: "+app.url; + auditLogService.storeAudit(app.appid,'functional',comment); + }; + + $scope.loadFavorites = function () { + $scope.hideMenus = false; + // $log.debug('HeaderCtrl::loadFavorites: loadFavorites has happened.'); + if ($scope.favoritesMenuItems == '') { + generateFavoriteItems(); + // $log.debug('HeaderCtrl::loadFavorites: loadFavorites is calling generateFavoriteItems()'); + } else { + // $log.debug('HeaderCtrl::loadFavorites: loadFavorites is NOT calling generateFavoriteItems()'); + } + } + + $scope.goToUrl = (item) => { + // $log.error('HeaderCtrl::goToUrl has started',item); + let url = item.url; + let restrictedApp = item.restrictedApp; + if (!url) { + $log.warn('HeaderCtrl::goToUrl: No url found for this application, doing nothing..'); + return; + } + if (restrictedApp) { + $window.open(url, '_blank'); + } else { + if(item.url=="getAccess" || item.url=="contactUs"){ + // if (url = window.location.href) + $state.go("root."+url); + } else { + var tabContent = { id: new Date(), title: item.text, url: item.url,appId:item.appid }; + $cookies.putObject('addTab', tabContent ); + } + // $log.debug('HeaderCtrl::goToUrl: url = ', url); + } + $scope.hideMenus = true; + } + + + + $scope.submenuLevelAction = function(index, column) { + if ($scope.favoritesMenuItems == '') { + generateFavoriteItems(); + // $log.debug('HeaderCtrl::submenuLevelAction: submenuLevelAction is calling generateFavoriteItems()'); + } else { + // $log.debug('submenuLevelAction is NOT calling generateFavoriteItems()'); + } + // $log.debug('item hovered: ' + index + '; column = ' + column); + // if (column == 2) { // 2 is Design + // // This is an admitted hack. See aw3218 for reasons why + // $log.debug('submenuLevelAction column == 2'); + // $scope.favoritesWindow = false; + // $scope.showFavorites = false; + // $scope.emptyFavorites = false; + // } + if (index=='Favorites' && $scope.favoriteItemsCount != 0) { + // $log.debug('HeaderCtrl::submenuLevelAction: Showing Favorites window'); + // generateFavoriteItems(); + $scope.favoritesWindow = true; + $scope.showFavorites = true; + $scope.emptyFavorites = false; + } + if (index=='Favorites' && $scope.favoriteItemsCount == 0) { + // $log.debug('HeaderCtrl::submenuLevelAction: Hiding Favorites window in favor of No Favorites Window'); + // generateFavoriteItems(); + $scope.favoritesWindow = true; + $scope.showFavorites = false; + $scope.emptyFavorites = true; + } + if (index!='Favorites' ) { + $scope.favoritesWindow = false; + $scope.showFavorites = false; + $scope.emptyFavorites = false; + } + + }; + + $scope.hideFavoritesWindow = function() { + $scope.showFavorites = false; + $scope.emptyFavorites = false; + // $scope.thirdFourthMenus = true; + } + + $scope.isUrlFavorite = function (menuId) { + // $log.debug('array objects in menu favorites = ' + $scope.favoriteItemsCount + '; menuId=' + menuId); + var jsonMenu = JSON.stringify($scope.favoritesMenuItems); + var isMenuFavorite = jsonMenu.indexOf('menuId\":' + menuId); + // $log.debug('jsonMenu.indexOf(menuId:' + jsonMenu.indexOf('menuId\":'+menuId)); + // $log.debug('isMenuFavorite= ' + isMenuFavorite); + if (isMenuFavorite==-1) { + return false; + } else { + return true; + } + + } + + /*Getting Ecomp portal Title*/ + + let getEcompPortalTitle = () => { + menusService.getEcompPortalTitle() + .then(title=> { + $scope.ecompTitle = title.response; + }).catch(err=> { + $log.error('HeaderCtrl.getEcompPortalTitle:: Error retrieving ECMOP portal title: ' + err); + }); + } + getEcompPortalTitle(); + + let generateFavoriteItems = () => { + menusService.getFavoriteItems() + .then(favorites=> { + // $log.debug('HeaderCtrl.getFavoriteItems:: ' + JSON.stringify(favorites)); + $scope.favoritesMenuItems = favorites; + $scope.favoriteItemsCount = Object.keys(favorites).length; + // $log.info('HeaderCtrl.getFavoriteItems:: number of favorite menus: ' + $scope.favoriteItemsCount); + }).catch(err=> { + $log.error('HeaderCtrl.getFavoriteItems:: Error retrieving Favorites menus: ' + err); + }); + } + + $scope.setAsFavoriteItem = function(event, menuId){ + var jsonMenuID = angular.toJson({'menuId': + menuId }); + // $log.debug('HeaderCtrl::setFavoriteItems: ' + jsonMenuID + " - " + event.target.id); + + menusService.setFavoriteItem(jsonMenuID) + .then(() => { + // var elementId = '#'+ event.currentTarget.id; + angular.element('#' + event.target.id).css('color', '#fbb313'); + generateFavoriteItems(); + }).catch(err=> { + $log.error('HeaderCtrl::setFavoriteItems:: API setFavoriteItem error: ' + err); + }); + }; + + $scope.removeAsFavoriteItem = function(event, menuId){ + // $log.debug('-----------------------------removeAsFavoriteItem: ' + menuId + " - " + event.target.id); + menusService.removeFavoriteItem(menuId) + .then(() => { + angular.element('#' + event.target.id).css('color', '#666666'); + generateFavoriteItems(); + }).catch(err=> { + $log.error('HeaderCtrl::removeAsFavoriteItem: API removeFavoriteItem error: ' + err); + }); + }; + + $scope.goToPortal = (headerText, url) => { + if (!url) { + $log.warn('HeaderCtrl::goToPortal: No url found for this application, doing nothing..'); + return; + } + if (!ECOMP_URL_REGEX.test(url)) { + url = 'http://' + url; + } + + if(headerText.startsWith("vUSP")) { + window.open(url, '_blank');//, '_self' + } + else { + var tabContent = { id: new Date(), title: headerText, url: url }; + $cookies.putObject('addTab', tabContent ); + } + }; + + $scope.editProfile = () => { + let data = null; + + ngDialog.open({ + templateUrl: 'app/views/header/profile-edit-dialogs/profile-edit.modal.html', + controller: 'EditProfileModalCtrl', + controllerAs: 'profileDetail', + data: '' + }).closePromise.then(needUpdate => { + if(needUpdate.value === true){ + // $log.debug('AdminsCtrl:openAddNewAdminModal:: updating table data...'); + updateTableData(); + } + }); + }; + } + } + class LoginSnippetCtrl { + constructor($log, $scope, $cookies, $timeout, userProfileService, sessionService) { + $scope.firstName=""; + $scope.lastName=""; + $scope.displayUserAppRoles=false; + $scope.allAppsLogout = function(){ + + var cookieTabs = $cookies.getObject('visInVisCookieTabs'); + if(cookieTabs!=null){ + for(var t in cookieTabs){ + + var url = cookieTabs[t].content; + if(url != "") { + sessionService.logout(url); + } + } + } + // wait for individual applications to log out before the portal logout + $timeout(function() { + window.location = "logout.htm"; + }, 2000); + } + + + try { + userProfileService.getFunctionalMenuStaticInfo() + .then(res=> { + // $log.info('HeaderCtrl::LoginSnippetCtrl: Login information: ' + JSON.stringify(res)); + $scope.firstName = res.firstName; + $scope.lastName = res.lastName; + $scope.loginSnippetEmail = res.email; + $scope.loginSnippetUserid = res.userId; + $scope.lastLogin = res.last_login; + }).catch(err=> { + $log.error('HeaderCtrl::LoginSnippetCtrl: failed in getFunctionalMenuStaticInfo: ' + err); + }); + } catch (err) { + $log.error('HeaderCtrl::LoginSnippetCtrl caught exception: ' + err); + } + + $scope.getUserApplicationRoles= function(){ + $scope.userapproles = []; + if($scope.displayUserAppRoles) + $scope.displayUserAppRoles = false; + else + $scope.displayUserAppRoles = true; + + userProfileService.getUserAppRoles($scope.loginSnippetUserid) + .then(res=>{ + + for(var i=0;i<res.length;i++){ + var userapprole ={ + App:res[i].appName, + Roles:res[i].roleNames, + }; + + $scope.userapproles.push(userapprole); + } + + }); + + } + } + } + class NotificationCtrl{ + constructor($log, $scope, $cookies, $timeout, sessionService,notificationService,$interval,ngDialog) { + $scope.notifications=[]; + var intervalPromise = null; + $scope.notificationCount= notificationService.notificationCount; + + $scope.getNotification = function(){ + notificationService.getNotification() + .then(res=> { + notificationService.decrementRefreshCount(); + var count = notificationService.getRefreshCount(); + if (res==null || res.data==null || res.data.message!='success') { + $log.error('NotificationCtrl::updateNotifications: failed to get notifications'); + if (intervalPromise != null) + $interval.cancel(intervalPromise); + } else if(count<=0){ + if (intervalPromise != null) + $interval.cancel(intervalPromise); + } else { + $scope.notifications = []; + notificationService.setNotificationCount(res.data.response.length); + for(var i=0;i<res.data.response.length;i++){ + var data = res.data.response[i]; + var notification ={ + id:data.notificationId, + title:data.msgHeader, + message:data.msgDescription, + source:data.msgSource, + time:data.createdDate, + priority:data.priority + }; + $scope.notifications.push(notification); + } + } + }).catch(err=> { + $log.error('NotificationCtrl::getNotification: caught exception: ' + err); + if (intervalPromise != null) + $interval.cancel(intervalPromise); + }); + } + $scope.getNotification(); + function updateNotifications() { + $scope.getNotification(); + } + $scope.start = function(rate) { + // stops any running interval to avoid two intervals running at the same time + $scope.stop(); + // store the interval promise + intervalPromise = $interval(updateNotifications, rate); + }; + + $scope.stop = function() { + $interval.cancel(intervalPromise); + }; + + $scope.showDetailedJsonMessage=function (selectedAdminNotification) { + notificationService.getMessageRecipients(selectedAdminNotification.id).then(res =>{ + $scope.messageRecipients = res; + var messageObject=JSON.parse(selectedAdminNotification.message); + var html=""; + html+='<p>'+'Message Source'+' : '+selectedAdminNotification.source+'</p>'; + html+='<p>'+'Message Title'+' : '+selectedAdminNotification.title+'</p>'; + html+='<p>'+'Message Recipient'+' : '+$scope.messageRecipients+'</p>'; + + for(var field in messageObject){ + if(field=='eventDate'||field=='lastModifiedDate'){ + html+='<p>'+field+' : '+new Date(+messageObject[field])+'</p>'; + + }else{ + html+='<p>'+field+' : '+messageObject[field]+'</p>'; + + } + } + + var modalInstance = ngDialog.open({ + templateUrl: 'app/views/user-notifications-admin/user.notifications.Json.details.modal.page.html', + controller: 'userNotificationCtrl', + resolve: { + message: function () { + var message = { + title: '', + text: html + + }; + return message; + }, + + } + }); + + }).catch(err => { + $log.error('userNotificationsCtrl:getMessageRecipients:: error ', err); + $scope.isLoadingTable = false; + }); + }; + + notificationService.getNotificationRate().then(res=> { + if (res == null || res.response == null) { + $log.error('NotificationCtrl: failed to notification update rate or duration, check system.properties file.'); + } else { + var rate = parseInt(res.response.updateRate); + var duration = parseInt(res.response.updateDuration); + notificationService.setMaxRefreshCount(parseInt(duration/rate)+1); + notificationService.setRefreshCount(notificationService.maxCount); + if (rate != NaN && duration != NaN) { + $scope.updateRate=rate; + $scope.start($scope.updateRate); + } + } + }).catch(err=> { + $log.error('NotificationCtrl: getNotificationRate() failed: ' + err); + }); + + $scope.deleteNotification = function(index){ + if ($scope.notifications[index].id == null || $scope.notifications[index].id == '') { + $log.error('NotificationCtrl: failed to delete Notification.'); + return; + } + notificationService.setNotificationRead($scope.notifications[index].id); + $scope.notifications.splice(index,1); + notificationService.setNotificationCount($scope.notifications.length); + } + } + } + + class RecommendationCtrl{ + constructor($log, $scope, $cookies, $timeout, sessionService,recommendationService,notificationService,$interval,ngDialog) { + $scope.recommendations=[]; + var intervalPromise = null; + $scope.recommendationCount= recommendationService.recommendationCount; + console.log("$",$); + $scope.getRecommendations = function(){ + $("#recommendation-bulb").removeClass('icon-misc-bulbL').addClass('icon-misc-bulb') + recommendationService.getRecommendations() + + .then(res=> { + $("#recommendation-bulb").removeClass('icon-misc-bulb').addClass('icon-misc-bulbL') + recommendationService.decrementRefreshCount(); + var count = recommendationService.getRefreshCount(); + if ( res.data==null) { + $log.error('RecommendationCtrl::update Recommendation: failed to get recommendation'); + if (intervalPromise != null) + $interval.cancel(intervalPromise); + } else if(count>=0){ + if (intervalPromise != null) + $interval.cancel(intervalPromise); + } else { + $scope.recommendations = []; + recommendationService.setRecommendationCount(res.data.recommendations.length); + for(var i=0;i<res.data.recommendations.length;i++){ + var data = res.data.recommendations[i]; + var recommendations ={ + + recommendation:data + }; + $scope.recommendations.push(recommendations); + } + } + }).catch(err=> { + $log.error('RecommendationCtrl::gatRecommendations: caught exception: ' + err); + if (intervalPromise != null) + $interval.cancel(intervalPromise); + }); + } + $scope.getRecommendations(); + + function updateRecommendations() { + $scope.getRecommendations(); + } + + notificationService.getNotificationRate().then(res=> { + if (res == null || res.response == null) { + $log.error('NotificationCtrl: failed to notification update rate or duration, check system.properties file.'); + } else { + var rate = parseInt(res.response.updateRate); + var duration = parseInt(res.response.updateDuration); + notificationService.setMaxRefreshCount(parseInt(duration/rate)+1); + notificationService.setRefreshCount(notificationService.maxCount); + if (rate != NaN && duration != NaN) { + $scope.updateRate=rate; + setInterval(function(){$scope.getRecommendations();},rate); + + } + } + }).catch(err=> { + $log.error('NotificationCtrl: getNotificationRate() failed: ' + err); + }); + $scope.deleteRecommendation = function(index){ + if ($scope.recommendations[index] == null || $scope.recommendations[index] == '') { + $log.error('RecommendationCtrl: failed to delete Recommendation.'); + return; + } + $scope.recommendations.splice(index,1); + recommendationService.setRecommendationCount($scope.recommendations.length); + } + } + } + NotificationCtrl.$inject = ['$log', '$scope', '$cookies', '$timeout', 'sessionService','notificationService','$interval','ngDialog']; + RecommendationCtrl.$inject = ['$log', '$scope', '$cookies', '$timeout', 'sessionService','recommendationService','notificationService','$interval','ngDialog']; + LoginSnippetCtrl.$inject = ['$log', '$scope', '$cookies', '$timeout','userProfileService', 'sessionService']; + HeaderCtrl.$inject = ['$log', '$window', 'userProfileService', 'menusService', '$scope', 'ECOMP_URL_REGEX','$cookies','$state','auditLogService','notificationService','recommendationService','ngDialog']; + angular.module('ecompApp').controller('HeaderCtrl', HeaderCtrl); + angular.module('ecompApp').controller('loginSnippetCtrl', LoginSnippetCtrl); + angular.module('ecompApp').controller('notificationCtrl', NotificationCtrl); + angular.module('ecompApp').controller('recommendationCtrl', RecommendationCtrl); + +})(); diff --git a/ecomp-portal-FE-common/client/app/views/header/header.controller.spec.js b/ecomp-portal-FE-common/client/app/views/header/header.controller.spec.js index 3841a2b3..32cc3a1f 100644 --- a/ecomp-portal-FE-common/client/app/views/header/header.controller.spec.js +++ b/ecomp-portal-FE-common/client/app/views/header/header.controller.spec.js @@ -1,19 +1,19 @@ -/*-
- * ================================================================================
- * ECOMP Portal
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ================================================================================
- */
+/*- + * ================================================================================ + * ECOMP Portal + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ diff --git a/ecomp-portal-FE-common/client/app/views/header/header.less b/ecomp-portal-FE-common/client/app/views/header/header.less index ec57812c..b553cebb 100644 --- a/ecomp-portal-FE-common/client/app/views/header/header.less +++ b/ecomp-portal-FE-common/client/app/views/header/header.less @@ -197,6 +197,21 @@ width: 16px; } + .recommendations-count + { + .border-radius(50%); + background:#db3434; + color: @colorWhite; + font-size: 10px; + padding-top: 2px; + height: 16px; + position: absolute; + right: -7px; + text-align: center; + top: -8px; + width: 16px; + } + .notification-header{ border-bottom: 1px solid #b4b4b4; padding: 10px 40px 0px 40px; @@ -291,7 +306,7 @@ .normal { .border-radius(50%); - background: @colorPeterRiver; + background: steelblue; content: ''; height: 8px; width: 8px; @@ -324,7 +339,7 @@ .button-dismiss { - color: @colorSilver; + color: black; font-size: 15px; &:hover, @@ -399,7 +414,7 @@ } .b2b-header-tabs .header__items{ - width:90%; + width:98%; } .b2b-header-tabs .header-secondary, .b2b-header-tabs .header-tertiary{ @@ -407,6 +422,12 @@ } +.b2b-header-tabs .header__item.profile{ + margin-right:70px; + float:right; + position: static; +} + .third-level-menu{ column-count: 4; line-height: 12px; @@ -426,10 +447,11 @@ column-count: 4; .b2b-header-tabs .third-level-menu li a { color: #333; - display: inline-grid; + display: inline-flex; padding: 7px 15px; - max-width: 228px; font-family:"Omnes-ECOMP-W02", Arial; + margin-top:5px; + margin-bottom:5px; } .b2b-header-tabs .third-level-menu li{ @@ -491,6 +513,24 @@ column-count: 4; width:100%; } -.display-userAppRoles-label span{ +.display-userAppRoles-label{ font-family:"Omnes-ECOMP-W02", Arial; -}
\ No newline at end of file + white-space:nowrap; +} + +.profile-detail-extension{ + display:inline-block; +} + +.logout-btn-div{ + display:inline-block; + padding-top: 8px; + +} + +.onap-title-logo{ + position: relative; + top: 7px; + width: 126.8px; + height: 28px; +} diff --git a/ecomp-portal-FE-common/client/app/views/header/header.tpl.html b/ecomp-portal-FE-common/client/app/views/header/header.tpl.html index 65a34ed1..3d1d3305 100644 --- a/ecomp-portal-FE-common/client/app/views/header/header.tpl.html +++ b/ecomp-portal-FE-common/client/app/views/header/header.tpl.html @@ -1,266 +1,330 @@ -<!--
- ================================================================================
- ECOMP Portal
- ================================================================================
- Copyright (C) 2017 AT&T Intellectual Property
- ================================================================================
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- ================================================================================
- -->
-<div style="position:fixed;width: 100%;top: 0px;left: 0;background-color: #222;z-index:9999">
- <header class="b2b-header-tabs" b2b-header-responsive>
- <ul class="header__items" role="navigation">
-<!-- Menu Icon and name -->
- <li class="header__item icon__item" onclick="window.location = 'applicationsHome'">
- <span id="logo-image" class="icon-primary-att-globe"></span>
- <span id="portal-title" class="portal-title" >OpenECOMP Portal</span>
- </li>
-<!-- First Level menu -->
- <li b2b-header-menu
- id="megaMenu-{{item.text.split(' ').join('-')}}"
- class="header__item b2b-headermenu"
- ng-repeat="item in megaMenuDataObject"
- ng-mousedown="loadFavorites(item.text)"
- role="presentation">
-
- <a href="javascript:void(0);"
- id="parentmenu-tabs"
- class="menu__item"
- role="menuitem">{{item.text}}</a>
-
- <div class="header-secondary-wrapper" ng-if="item.active_yn=='Y'">
- <ul class="header-secondary" role="menu">
-<!-- Second Level menu -->
- <li class="header-subitem"
- id="subItem-{{subItem.text.split(' ').join('-')}}"
- b2b-header-submenu
- ng-repeat="i in item.children | orderBy : 'column'"
- ng-mousemove="submenuLevelAction(i.text,i.column)"
- role="presentation">
- <!-- Favorites -->
- <div ng-if="i.text=='Favorites'" >
- <a href="javascript:void(0);" class="menu__item" role="menuitem">{{i.text}}</a>
- <i id="favorite-star" data-size="large" class="icon-star favorites-icon-active"></i>
- <div class="header-columns-div" ng-show='favoritesWindow' ng-mouseleave="hideFavoritesWindow()" >
- <div class="header-tertiary-wrapper" id="header-favorites">
- <ul class="header-tertiary" role="menu">
- <li role="presentation">
- <div
- ng-repeat="subItem in favoritesMenuItems"
- ng-show="showFavorites"
- ng-hide="hideMenus"
- id="favoritesMenuItems-{{subItem.text.split(' ').join('-')}}">
- <div class="fav-links">
- <i id="favorite-selector-favorites-list"
- class="icon-star favorites-icon-active"
- data-ng-click="removeAsFavoriteItem($event, subItem.menuId)"
- ng-mousedown="removeAsFavoriteItem($event, subItem.menuId)">
- </i>
- <a id="favorites-list" aria-label="{{subItem.text}}" ng-click="goToUrl(subItem)">{{subItem.text}}</a>
- </div>
- </div>
-
- <div id="favorites-empty" class="favorites-window-empty" ng-show="emptyFavorites">
- <p id="p-no-favs-icon" class="no-fav-icon">
- <span class="icon-star" ></span>
- </p>
- <p id="p-no-favs" class="largeText">No Favorites</p>
- <p id="p-no-favs-desc" class="normal">Add your favorite items for quick access.</p>
- </div>
- </li>
- </ul>
- </div>
- </div>
- </div>
- <!-- Support or Help -->
- <div ng-if="item.text=='Support' || item.text=='Help'" id="second-level-menus-help">
- <a href="javascript:void(0);" ng-click="goToUrl(i);auditLog(i,'Support')" class="menu__item" role="menuitem">{{i.text| elipsis: 50}}</a>
- </div>
- <!-- Others -->
- <div ng-if="i.text!='Favorites' && (item.text!='Support' && item.text!='Help')" >
- <a href="javascript:void(0);" class="menu__item" role="menuitem">{{i.text| elipsis: 50}}</a>
- <div class="header-tertiary-wrapper" >
- <ul class="third-level-menu" role="menu" id="third-level-menus">
-<!-- Third Level menu -->
-
- <li b2b-header-tertiarymenu ng-repeat="link in i.children | orderBy : 'column'" role="presentation" >
- <i id="level3-star-inactive-{{link.menuId}}" ng-cloak
- class="icon-star favorites-icon-inactive" data-size="large"
- data-ng-click="setAsFavoriteItem($event, link.menuId)"
- ng-if="link.url.length > 1 && isUrlFavorite(link.menuId)==false">
- </i>
- <i id="level3-star-active-{{link.menuId}}" ng-cloak
- ng-if="link.url.length > 1 && isUrlFavorite(link.menuId)"
- class="icon-star favorites-icon-active ng-cloak" data-size="large"
- data-ng-click="removeAsFavoriteItem($event, link.menuId)">
- </i>
-
- <a class="third-level-title"
- aria-label="{{link.text | elipsis: 50}}"
- ng-click="goToUrl(link);auditLog(link,'application')">{{link.text| elipsis: 50}}</a>
-<!-- Fourth Level menu -->
- <div b2b-tertiary-link ng-repeat="title in link.children" >
- <i id="level4-star-inactive-{{title.menuId}}" ng-cloak
- class="icon-star favorites-icon-inactive"
- data-ng-click="setAsFavoriteItem($event, title.menuId)"
- ng-if="title.url.length > 1 && isUrlFavorite(title.menuId)==false">
- </i>
- <i id="level4-star-active-{{title.menuId}}" ng-cloak
- class="icon-star favorites-icon-active"
- data-ng-click="removeAsFavoriteItem($event, title.menuId)"
- ng-if="title.url.length > 1 && isUrlFavorite(title.menuId)">
- </i>
- <a href="javascript:void(0);" class="header-tertiaryitem" ng-class="{'disabled': title.disabled}" role="menuitem" ng-click="goToUrl(title);auditLog(title,'functional')">{{title.text | elipsis: 50}}</a>
- </div>
- </li>
-
-
-
-
- </ul>
- </div>
- </div>
-
- </li>
- </ul>
- </div>
- </li>
-<!-- Right side of the Menu - User Icon and Notification flag -->
- <div class="login-section">
- <!-- User Icon -->
- <li class="header__item profile" aria-haspopup="true">
- <b2b-flyout>
- <div b2b-flyout-toggler >
- <div class="icon-people-oneperson" id="header-user-icon" tabindex="0" b2b-accessibility-click="13,32" aria-label="notifications" aria-haspopup="true" aria-expanded="{{flyoutOpened}}" role="button"></div>
- <div id="login-snippet-text" class="login-snippet-text">{{header.isGuest ? 'Guest' : header.firstName}}</div>
- </div>
- <b2b-flyout-content horizontal-placement="center" vertical-placement="below">
- <div ng-controller="loginSnippetCtrl" >
- <div id="reg-header-snippet">
- <div tabindex="0" class="reg-profileDetails" id="reg-profiledetails-id">
- <ul class="reg-Details-table">
- <li>
- <div class="reg-userName-table">
- <div id="reg-userName-table-row">
- <div id="reg-userName-table-cell">
- <h3 >
- {{firstName}} {{lastName}} </h3>
- <span> </span>
- </div>
- </div>
- </div>
- </li>
- <li><div class="reg-userEmail-label"><span class="reg-userEmail-label-spn" style=font-weight:bold>Email<span class="visuallyhidden">:
- </span></span></div></li>
- <li><div class="reg-userEmail-value"><span class="reg-userEmail-value-spn">
- {{loginSnippetEmail}}</span></div></li>
- <li> </li>
- <li><div class="reg-userRole-label"><span class="reg-userRole-label-spn" style=font-weight:bold>
- User Id<span class="visuallyhidden">:</span></span></div></li>
- <li><div class="reg-userRole-value"><span class="reg-userRole-value-spn">
- {{loginSnippetUserid}}<span class="visuallyhidden"></span></span></div></li>
- <li> </li>
- <li><div class="reg-userLastLogin-label"><span class="reg-userLastLogin-label-spn" style=font-weight:bold>
- Last login<span class="visuallyhidden">:</span></span></div></li>
- <li><div class="reg-userLastLogin-value"><span class="reg-userLastLogin-value-spn">
- {{lastLogin}}<span class="visuallyhidden"></span></span></div></li>
- <li> </li>
- <li>
- <div class="display-userAppRoles-label">
- <a href="javascript:void(0);" ng-click="getUserApplicationRoles()" class="icon-controls-add-maximize" ><span>Applications and Roles</span></a>
- </div>
-
- <div class="display-userAppRoles-label" ng-show="displayUserAppRoles" style="height:200px; overflow-y:auto;">
- <div ng-repeat="ua in userapproles track by $index">
- <div class="reg-userApp-value">
- <span class="reg-userApp-value-spn" style=font-weight:bold>{{ua.App}}<span class="visuallyhidden">:</span></span>
- </div>
- <div ng-repeat="role in ua.Roles track by $index" class="reg-userAppRoles-value" >
- <span class="reg-userAppRoles-value-spn">{{role}}</span>
- </div>
- </div>
- </div>
- </li>
- </ul>
- <div id="reg-logout-div" style="padding-top: 8px">
- <button href="javascript:void(0)" id="allLogout" ng-click="allAppsLogout()" class="btn btn-alt btn-small">
- Log out
- </button>
- </div>
- </div>
- </div>
- </div>
- </b2b-flyout-content>
- </b2b-flyout>
- </li>
- <!-- Notification flag -->
- <li class="header__item notification" aria-haspopup="true" class="notification-li">
- <b2b-flyout>
- <div b2b-flyout-toggler class="notification-div">
- <div class="notifications-count" ng-hide="notificationCount.count==0" ng-bind="notificationCount.count"></div>
- <div class="icon-content-flag megamenu-notification-overrides" class="b2b-flyout-icon" tabindex="0" b2b-accessibility-click="13,32" aria-label="notifications" aria-haspopup="true" aria-expanded="{{flyoutOpened}}" role="button"></div>
- </div>
- <b2b-flyout-content horizontal-placement="center" vertical-placement="below">
- <div class="notification-content" ng-controller="notificationCtrl" >
- <div class="ng-scope">
- <div id="notification" class="notificationBox ">
- <div align ="right">
- <a ui-sref="root.notificationHistory" style="font-size: 14px"> View All Recent Notifications </a>
- </div>
- <div class="notification-header">
- <div style="float:left;">
- <p class="notification-heading">Notifications</p>
- </div>
- <div style="clear:both;"></div>
- </div>
- <div ng-show="notifications.length==0">
- <div class="notification-main">
- <div style="height:113px;">
- <div align="center" class="icon-information notification-info-icon"></div>
- </div>
- <div>
- <p class="notification-text">No New Notifications.</p>
- </div>
-
- </div>
- </div>
- <div class="notification-main" ng-show="notifications.length>0">
- <ul class="notifications-list">
- <li class="item" data-id="5" ng-repeat="item in notifications">
- <div class="icon">
- <span class="important" ng-show="item.priority==2"/>
- <span class="normal" ng-show="item.priority==1"/>
- </div>
- <div class="details">
- <span class="title" ng-bind="item.title"></span>
- <span class="message-body" ng-bind="item.message"></span>
- <!-- <span class="date" ng-bind="item.time" ></span> -->
- <mydate>{{item.time | date:'MM/dd/yyyy hh:mm:ss a Z'}}</mydate>
- </div>
- <button type="button" ng-click="deleteNotification($index)" class="button-default button-dismiss js-dismiss">x</button>
- </li>
- </ul>
- </div>
- <div class="notification-footer">
- <div class="notification-links">
- <div style="clear:both;"></div>
- </div>
- </div>
- </div>
- </b2b-flyout-content>
- </b2b-flyout>
- </li>
- </div>
- </ul>
- </header>
-</div>
+<!-- + ================================================================================ + ECOMP Portal + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ================================================================================ + --> +<div style="position:fixed;width: 100%;top: 0px;left: 0;background-color: #222;z-index:9999"> + <header class="b2b-header-tabs" b2b-header-responsive> + <ul class="header__items" role="navigation"> +<!-- Menu Icon and name --> + <li class="header__item icon__item" onclick="window.location = 'applicationsHome'"> + <div ng-include class="profile-detail-extension" src="'app/views/header/header-logo.html'"></div> + <span id="portal-title" class="portal-title" ng-bind="ecompTitle"></span> + </li> +<!-- First Level menu --> + <li b2b-header-menu + id="megaMenu-{{item.text.split(' ').join('-')}}" + class="header__item b2b-headermenu" + ng-repeat="item in megaMenuDataObject" + ng-mousedown="loadFavorites(item.text)" + role="presentation"> + + <a href="javascript:void(0);" + id="parentmenu-{{item.text.split(' ').join('-')}}-tabs" + class="menu__item" + role="menuitem">{{item.text}}</a> + + <div class="header-secondary-wrapper" ng-if="item.active_yn=='Y'" ng-hide="hideMenus"> + <ul class="header-secondary" role="menu"> +<!-- Second Level menu --> + <li class="header-subitem" + id="subItem-{{subItem.text.split(' ').join('-')}}" + b2b-header-submenu + ng-repeat="i in item.children | orderBy : 'column'" + ng-mousemove="submenuLevelAction(i.text,i.column)" + role="presentation"> + <!-- Favorites --> + <div ng-if="i.text=='Favorites'" > + <a href="javascript:void(0);" class="menu__item" role="menuitem">{{i.text}}</a> + <i id="favorite-star" data-size="large" class="icon-star favorites-icon-active"></i> + <div class="header-columns-div" ng-show='favoritesWindow' ng-mouseleave="hideFavoritesWindow()" > + <div class="header-tertiary-wrapper" id="header-favorites"> + <ul class="header-tertiary" role="menu"> + <li role="presentation"> + <div + ng-repeat="subItem in favoritesMenuItems" + ng-show="showFavorites" + + id="favoritesMenuItems-{{subItem.text.split(' ').join('-')}}"> + <div class="fav-links"> + <i id="favorite-selector-favorites-list" + class="icon-star favorites-icon-active" + data-ng-click="removeAsFavoriteItem($event, subItem.menuId)" + ng-mousedown="removeAsFavoriteItem($event, subItem.menuId)"> + </i> + <a id="favorites-list" aria-label="{{subItem.text}}" ng-click="goToUrl(subItem)">{{subItem.text}}</a> + </div> + </div> + + <div id="favorites-empty" class="favorites-window-empty" ng-show="emptyFavorites"> + <p id="p-no-favs-icon" class="no-fav-icon"> + <span class="icon-star" ></span> + </p> + <p id="p-no-favs" class="largeText">No Favorites</p> + <p id="p-no-favs-desc" class="normal">Add your favorite items for quick access.</p> + </div> + </li> + </ul> + </div> + </div> + </div> + <!-- Support or Help --> + <div ng-if="item.text=='Support' || item.text=='Help'" id="second-level-menus-help"> + <a id="second-level-menus-{{i.text.split(' ').join('-')}}-help" href="javascript:void(0);" ng-click="goToUrl(i);auditLog(i,'Support')" class="menu__item" role="menuitem">{{i.text| elipsis: 50}}</a> + </div> + <!-- Others --> + <div ng-if="i.text!='Favorites' && (item.text!='Support' && item.text!='Help')" > + <a href="javascript:void(0);" class="menu__item" role="menuitem">{{i.text| elipsis: 50}}</a> + <div class="header-tertiary-wrapper" > + <ul class="third-level-menu" role="menu" id="third-level-menus"> +<!-- Third Level menu --> + + <li b2b-header-tertiarymenu ng-repeat="link in i.children | orderBy : 'column'" role="presentation" > + <i id="level3-star-inactive-{{link.menuId}}" ng-cloak + class="icon-star favorites-icon-inactive" data-size="large" + data-ng-click="setAsFavoriteItem($event, link.menuId)" + ng-if="link.url.length > 1 && isUrlFavorite(link.menuId)==false"> + </i> + <i id="level3-star-active-{{link.menuId}}" ng-cloak + ng-if="link.url.length > 1 && isUrlFavorite(link.menuId)" + class="icon-star favorites-icon-active ng-cloak" data-size="large" + data-ng-click="removeAsFavoriteItem($event, link.menuId)"> + </i> + + <a class="third-level-title" + aria-label="{{link.text | elipsis: 50}}" + ng-click="goToUrl(link);auditLog(link,'application')">{{link.text| elipsis: 50}}</a> +<!-- Fourth Level menu --> + <div b2b-tertiary-link ng-repeat="title in link.children" > + <i id="level4-star-inactive-{{title.menuId}}" ng-cloak + class="icon-star favorites-icon-inactive" + data-ng-click="setAsFavoriteItem($event, title.menuId)" + ng-if="title.url.length > 1 && isUrlFavorite(title.menuId)==false"> + </i> + <i id="level4-star-active-{{title.menuId}}" ng-cloak + class="icon-star favorites-icon-active" + data-ng-click="removeAsFavoriteItem($event, title.menuId)" + ng-if="title.url.length > 1 && isUrlFavorite(title.menuId)"> + </i> + <a href="javascript:void(0);" class="header-tertiaryitem" ng-class="{'disabled': title.disabled}" role="menuitem" ng-click="goToUrl(title);auditLog(title,'functional')">{{title.text | elipsis: 50}}</a> + </div> + </li> + + + + + </ul> + </div> + </div> + + </li> + </ul> + </div> + </li> +<!-- Right side of the Menu - User Icon and Notification flag --> + <div class="login-section"> + <!-- User Icon --> + <li class="header__item profile" aria-haspopup="true"> + <b2b-flyout> + <div b2b-flyout-toggler > + <div class="icon-people-oneperson" id="header-user-icon" tabindex="0" b2b-accessibility-click="13,32" aria-label="notifications" aria-haspopup="true" aria-expanded="{{flyoutOpened}}" role="button"></div> + <div id="login-snippet-text" class="login-snippet-text">{{header.isGuest ? 'Guest' : header.firstName}}</div> + </div> + <b2b-flyout-content horizontal-placement="center" vertical-placement="below"> + <div ng-controller="loginSnippetCtrl" > + <div id="reg-header-snippet"> + <div tabindex="0" class="reg-profileDetails" id="reg-profiledetails-id"> + <ul class="reg-Details-table"> + <li> + <div class="reg-userName-table"> + <div id="reg-userName-table-row"> + <div id="reg-userName-table-cell"> + <h3 > + {{firstName}} {{lastName}} </h3> + <span> </span> + </div> + </div> + </div> + </li> + <li><div class="reg-userEmail-label"><span class="reg-userEmail-label-spn" style=font-weight:bold>Email<span class="visuallyhidden">: + </span></span></div></li> + <li><div class="reg-userEmail-value"><span class="reg-userEmail-value-spn"> + {{loginSnippetEmail}}</span></div></li> + <li> </li> + <li><div class="reg-userRole-label"><span class="reg-userRole-label-spn" style=font-weight:bold> + User Id<span class="visuallyhidden">:</span></span></div></li> + <li><div class="reg-userRole-value"><span class="reg-userRole-value-spn"> + {{loginSnippetUserid}}<span class="visuallyhidden"></span></span></div></li> + <li> </li> + <li><div class="reg-userLastLogin-label"><span class="reg-userLastLogin-label-spn" style=font-weight:bold> + Last login<span class="visuallyhidden">:</span></span></div></li> + <li><div class="reg-userLastLogin-value"><span class="reg-userLastLogin-value-spn"> + {{lastLogin}}<span class="visuallyhidden"></span></span></div></li> + <li> </li> + <li> + <div class="display-userAppRoles-label"> + <a href="javascript:void(0);" ng-click="getUserApplicationRoles()" class="icon-primary-accordion-plus" ng-class="{true: 'icon-primary-accordion-plus', false: 'icon-primary-accordion-minus'}[ !displayUserAppRoles]" >Applications and Roles</a> + </div> + <br> + <div class="display-userAppRoles-label" ng-show="displayUserAppRoles" style="height:200px; overflow-y:auto;"> + <div ng-repeat="ua in userapproles track by $index"> + <div class="reg-userApp-value"> + <span class="reg-userApp-value-spn" style=font-weight:bold>{{ua.App}}<span class="visuallyhidden">:</span></span> + </div> + <div ng-repeat="role in ua.Roles track by $index" class="reg-userAppRoles-value" > + <span class="reg-userAppRoles-value-spn">{{role}}</span> + </div> + <br> + </div> + </div> + </li> + </ul> + <div ng-include class="profile-detail-extension" src="'app/views/header/header-extension.tpl.html'"></div> + <div id="reg-logout-div" class="logout-btn-div"> + <button href="javascript:void(0)" id="allLogout" ng-click="allAppsLogout()" class="btn btn-alt btn-small"> + Log out + </button> + </div> + </div> + </div> + </div> + </b2b-flyout-content> + </b2b-flyout> + </li> + <!-- Notification flag --> + <li class="header__item notification" aria-haspopup="true" class="notification-li"> + <b2b-flyout> + <div b2b-flyout-toggler class="notification-div"> + <div class="notifications-count" ng-hide="notificationCount.count==0" ng-bind="notificationCount.count"></div> + <div id="megamenu-notification-button" class="icon-content-flag megamenu-notification-overrides" class="b2b-flyout-icon" tabindex="0" b2b-accessibility-click="13,32" aria-label="notifications" aria-haspopup="true" aria-expanded="{{flyoutOpened}}" role="button"></div> + </div> + <b2b-flyout-content horizontal-placement="center" vertical-placement="below"> + <div class="notification-content" ng-controller="notificationCtrl" > + <div class="ng-scope"> + <div id="notification" class="notificationBox "> + <div align ="right"> + <a id="notification-history-link" ui-sref="root.notificationHistory" style="font-size: 14px"> View All Recent Notifications </a> + </div> + <div class="notification-header"> + <div style="float:left;"> + <p class="notification-heading">Notifications</p> + </div> + <div style="clear:both;"></div> + </div> + <div ng-show="notifications.length==0"> + <div class="notification-main"> + <div style="height:113px;"> + <div align="center" class="icon-information notification-info-icon"></div> + </div> + <div> + <p class="notification-text">No New Notifications.</p> + </div> + + </div> + </div> + <div class="notification-main" ng-show="notifications.length>0"> + <ul class="notifications-list"> + <li class="item" data-id="5" ng-repeat="item in notifications"> + <div class="icon"> + <span class="important" ng-show="item.priority==2"/> + <span class="normal" ng-show="item.priority==1"/> + </div> + <div class="details" ng-click="showDetailedJsonMessage(item)"> + <span class="title" ng-bind="item.source"></span> <span + class="title" ng-bind="item.title"></span> <span + class="message-body" ng-if="item.source==='EP'" + ng-bind="item.message"></span> <span class="message-body" + ng-if="item.source!=='EP'" + ng-bind="item.message| elipsis: 27"> </span> + <!-- <span class="date" ng-bind="item.time" ></span> --> + <mydate>{{item.time | date:'MM/dd/yyyy hh:mm:ss a Z'}}</mydate> + + </div> + <button type="button" ng-click="deleteNotification($index)" class="button-default button-dismiss js-dismiss">x</button> + </li> + </ul> + </div> + <div class="notification-footer"> + <div class="notification-links"> + <div style="clear:both;"></div> + </div> + </div> + </div> + </b2b-flyout-content> + </b2b-flyout> + </li> + + <!-- Recommendation Bulb --> + + <li class="header__item recommendation" aria-haspopup="true" class="recommendation-li"> + <b2b-flyout> + <div b2b-flyout-toggler class="recommendation-div"> + <div class="recommendations-count" ng-hide="recommendationCount.count==0" ng-bind="recommendationCount.count"></div> +<div class="icon-misc-bulbL megamenu-recommendation-overrides" id="recommendation-bulb" tabindex="0" b2b-accessibility-click="13,32" aria-label="recommendation" aria-haspopup="true" aria-expanded="{{flyoutOpened}}" style="font-size: 22px;"role="button"></div> </div> + <b2b-flyout-content horizontal-placement="center" vertical-placement="below"> + <div class="recommendation-content" ng-controller="recommendationCtrl" > + <div class="ng-scope"> + <div id="recommendation" class="notificationBox "> + <!-- <div align ="right"> + <a ui-sref="root.recommendationsHistory" style="font-size: 14px"> View All Recent Notifications </a> + </div> --> + <div class="notification-header"> + <div style="float:left;"> + <p class="notification-heading">Recommendations</p> + </div> + <div style="clear:both;"></div> + </div> + <div ng-show="recommendations.length==0"> + <div class="notification-main"> + <div style="height:113px;"> + <div align="center" class="icon-information notification-info-icon"></div> + </div> + <div> + <p class="notification-text">No New Recommendations</p> + </div> + + </div> + </div> + <div class="notification-main" ng-show="recommendations.length>0"> + <ul class="notifications-list"> + <li class="item" data-id="5" ng-repeat="item in recommendations"> + <div class="icon"> + <span class="normal" ng-show="item.recommendation"/> + </div> + <div class="details"> + + <span class="message-body" ng-bind="item.recommendation"></span> + + + </div> + <button type="button" ng-click="deleteRecommendation($index)" class="button-default button-dismiss js-dismiss">x</button> + </li> + </ul> + </div> + <div class="notification-footer"> + <div class="notification-links"> + <div style="clear:both;"></div> + </div> + </div> + </div> + </b2b-flyout-content> + </b2b-flyout> + </li> + </div> + </ul> + </header> +</div> |