ocket8888 commented on a change in pull request #5179:
URL: https://github.com/apache/trafficcontrol/pull/5179#discussion_r583054518



##########
File path: traffic_portal/app/src/common/modules/header/HeaderController.js
##########
@@ -64,6 +78,68 @@ var HeaderController = function($rootScope, $scope, $state, 
$uibModal, $location
         trafficPortalService.dbDump();
     };
 
+    $scope.toggleNotification = function(cdn) {
+        if (cdn.notificationCreatedBy) {
+            confirmDeleteNotification(cdn);
+        } else {
+            confirmCreateNotification(cdn);
+        }
+    };
+
+    let confirmCreateNotification = function(cdn) {
+        const params = {
+            title: 'Create Global ' + cdn.name + ' Notification',
+            message: 'What is the content of your global notification for the 
' + cdn.name + ' CDN?'
+        };
+        const modalInstance = $uibModal.open({
+            templateUrl: 'common/modules/dialog/input/dialog.input.tpl.html',
+            controller: 'DialogInputController',
+            size: 'md',
+            resolve: {
+                params: function () {
+                    return params;
+                }
+            }
+        });
+        modalInstance.result.then(function(notification) {
+            cdnService.createNotification(cdn, notification).
+                then(
+                    function() {
+                        
$rootScope.$broadcast('headerController::notificationCreated');
+                    }
+                );
+        }, function () {
+            // do nothing

Review comment:
       Oh, I thought this was related to the `cdnService.createNotification` 
call. But it is not. Nvm.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to