mitchell852 commented on a change in pull request #5179:
URL: https://github.com/apache/trafficcontrol/pull/5179#discussion_r582959291
##########
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, this is when you cancel the dialog window. there is no error to
throw or log. i mean i could do this:
```
console.log('dialog dismissed')
```
and i considered that at one time but it pollutes the dev console. if you
feel strongly about not doing `do nothing`, maybe we can create an issue to fix
this globally?
----------------------------------------------------------------
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]