X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=ecomp-portal-FE-common%2Fclient%2Fapp%2Fviews%2Fheader%2Fheader.controller.js;h=6b5be7453dfcb0f5b32ed1f36bca435066565954;hb=978dbcf0a196acbafad72fe1e2478ec0e384f02f;hp=33cb84546d2b322e8ed10609ec78587968b56b18;hpb=627badaf69987c01811c477219fd943757a635f5;p=portal.git 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..6b5be745 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,$modal) { 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; @@ -350,7 +348,7 @@ } } class NotificationCtrl{ - constructor($log, $scope, $cookies, $timeout, sessionService,notificationService,$interval,ngDialog) { + constructor($log, $scope, $cookies, $timeout, sessionService,notificationService,$interval,ngDialog,$modal) { $scope.notifications=[]; var intervalPromise = null; $scope.notificationCount= notificationService.notificationCount; @@ -374,11 +372,12 @@ var data = res.data.response[i]; var notification ={ id:data.notificationId, - title:data.msgHeader, + msgHeader:data.msgHeader, message:data.msgDescription, - source:data.msgSource, + msgSource:data.msgSource, time:data.createdDate, - priority:data.priority + priority:data.priority, + notificationHyperlink:data.notificationHyperlink }; $scope.notifications.push(notification); } @@ -408,41 +407,27 @@ notificationService.getMessageRecipients(selectedAdminNotification.id).then(res =>{ $scope.messageRecipients = res; var messageObject=JSON.parse(selectedAdminNotification.message); - var html=""; - html+='

'+'Message Source'+' : '+selectedAdminNotification.source+'

'; - html+='

'+'Message Title'+' : '+selectedAdminNotification.title+'

'; - html+='

'+'Message Recipient'+' : '+$scope.messageRecipients+'

'; - - for(var field in messageObject){ - if(field=='eventDate'||field=='lastModifiedDate'){ - html+='

'+field+' : '+new Date(+messageObject[field])+'

'; - - }else{ - html+='

'+field+' : '+messageObject[field]+'

'; - - } - } - - 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; - }); + var modalInstance = $modal.open({ + templateUrl: 'app/views/user-notifications-admin/user.notifications.json.details.modal.page.html', + controller: 'userNotificationCtrl', + sizeClass: 'modal-large', + resolve: { + items: function () { + var items = { + title: '', + selectedAdminNotification:selectedAdminNotification,messageObject:messageObject,messageRecipients:$scope.messageRecipients + + }; + return items; + } + } + }) + + + }).catch(err => { + $log.error('userNotificationsCtrl:getMessageRecipients:: error ', err); + $scope.isLoadingTable = false; + }); }; notificationService.getNotificationRate().then(res=> { @@ -474,85 +459,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 { - $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']; + NotificationCtrl.$inject = ['$log', '$scope', '$cookies', '$timeout', 'sessionService','notificationService','$interval','ngDialog','$modal']; 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','$modal']; angular.module('ecompApp').controller('HeaderCtrl', HeaderCtrl); angular.module('ecompApp').controller('loginSnippetCtrl', LoginSnippetCtrl); angular.module('ecompApp').controller('notificationCtrl', NotificationCtrl); - angular.module('ecompApp').controller('recommendationCtrl', RecommendationCtrl); - })();