diff options
Diffstat (limited to 'ecomp-portal-FE-common/client/app/views/header')
-rw-r--r-- | ecomp-portal-FE-common/client/app/views/header/header.controller.js | 81 | ||||
-rw-r--r-- | ecomp-portal-FE-common/client/app/views/header/header.tpl.html | 61 |
2 files changed, 6 insertions, 136 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 33cb8454..2eba057c 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 @@ -20,7 +20,7 @@ 'use strict'; (function () { class HeaderCtrl { - constructor($log, $window, userProfileService, menusService, $scope, ECOMP_URL_REGEX, $cookies, $state,auditLogService,notificationService,recommendationService,ngDialog) { + constructor($log, $window, userProfileService, menusService, $scope, ECOMP_URL_REGEX, $cookies, $state,auditLogService,notificationService,ngDialog) { this.firstName = ''; this.lastName = ''; this.$log = $log; @@ -33,7 +33,6 @@ $scope.emptyFavorites = false; $scope.favoritesWindow = false; $scope.notificationCount=0; - $scope.recommendationCount=0; $scope.showNotification = true; $scope.hideMenus = false; @@ -47,7 +46,6 @@ }; $scope.megaMenuDataObject =[]; $scope.notificationCount= notificationService.notificationCount; - $scope.recommendationCount= recommendationService.recommendationCount; this.isLoading = true; this.ECOMP_URL_REGEX = ECOMP_URL_REGEX; @@ -474,85 +472,10 @@ } } - 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']; + HeaderCtrl.$inject = ['$log', '$window', 'userProfileService', 'menusService', '$scope', 'ECOMP_URL_REGEX','$cookies','$state','auditLogService','notificationService','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.tpl.html b/ecomp-portal-FE-common/client/app/views/header/header.tpl.html index 3d1d3305..ea7273b9 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 @@ -267,63 +267,10 @@ </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> + <li class="header__item recommendation" aria-haspopup="true" + class="recommendation-li"> + <div ng-include class="recommendation-detail-extension" src="'app/views/headerRecommendation/headerRecommendations.tpl.html'"></div> + </li> </div> </ul> </header> |