From b47345187fec9c46eb834292ee8644cf6355f422 Mon Sep 17 00:00:00 2001 From: Jeremy Mitchell Date: Thu, 8 Jun 2017 15:44:00 -0600 Subject: [PATCH] failed to account for traffic monitors --- .../admin/cdns/config/ConfigController.js | 31 ++++++++++++++----- .../private/admin/cdns/config/config.tpl.html | 11 +++++++ 2 files changed, 35 insertions(+), 7 deletions(-) diff --git a/traffic_ops/experimental/ui/app/src/modules/private/admin/cdns/config/ConfigController.js b/traffic_ops/experimental/ui/app/src/modules/private/admin/cdns/config/ConfigController.js index deeac154ae..0615ea6cbc 100644 --- a/traffic_ops/experimental/ui/app/src/modules/private/admin/cdns/config/ConfigController.js +++ b/traffic_ops/experimental/ui/app/src/modules/private/admin/cdns/config/ConfigController.js @@ -22,22 +22,25 @@ var ConfigController = function(cdn, currentSnapshot, newSnapshot, $scope, $stat $scope.cdn = cdn; var oldConfig = currentSnapshot.config || null, - newConfig = newSnapshot.config; + newConfig = newSnapshot.config || null; var oldContentRouters = currentSnapshot.contentRouters || null, - newContentRouters = newSnapshot.contentRouters; + newContentRouters = newSnapshot.contentRouters || null; + + var oldMonitors = currentSnapshot.monitors || null, + newMonitors = newSnapshot.monitors || null; var oldContentServers = currentSnapshot.contentServers || null, - newContentServers = newSnapshot.contentServers; + newContentServers = newSnapshot.contentServers || null; var oldDeliveryServices = currentSnapshot.deliveryServices || null, - newDeliveryServices = newSnapshot.deliveryServices; + newDeliveryServices = newSnapshot.deliveryServices || null; var oldEdgeLocations = currentSnapshot.edgeLocations || null, - newEdgeLocations = newSnapshot.edgeLocations; + newEdgeLocations = newSnapshot.edgeLocations || null; var oldStats = currentSnapshot.stats || null, - newStats = newSnapshot.stats; + newStats = newSnapshot.stats || null; var performDiff = function(oldJSON, newJSON, destination) { var div = null, @@ -69,7 +72,7 @@ var ConfigController = function(cdn, currentSnapshot, newSnapshot, $scope, $stat display.innerHTML = ''; display.appendChild(fragment); } else { - display.innerHTML = 'Existing snapshot cannot be found. Please perform snapshot.'; + display.innerHTML = 'Diff failed. You may need to perform your first snapshot.'; } }; @@ -90,6 +93,12 @@ var ConfigController = function(cdn, currentSnapshot, newSnapshot, $scope, $stat templateUrl: 'crPopoverTemplate.html' }; + $scope.monitorsCount = { + added: 0, + removed: 0, + templateUrl: 'mPopoverTemplate.html' + }; + $scope.contentServersCount = { added: 0, removed: 0, @@ -128,6 +137,13 @@ var ConfigController = function(cdn, currentSnapshot, newSnapshot, $scope, $stat }, timeout); }; + $scope.diffMonitors = function(timeout) { + $('#monitors').html(' Generating diff...'); + $timeout(function() { + performDiff(oldMonitors, newMonitors, 'monitors'); + }, timeout); + }; + $scope.diffContentServers = function(timeout) { $('#contentServers').html(' Generating diff...'); $timeout(function() { @@ -183,6 +199,7 @@ var ConfigController = function(cdn, currentSnapshot, newSnapshot, $scope, $stat angular.element(document).ready(function () { $scope.diffConfig(0); $scope.diffContentRouters(0); + $scope.diffMonitors(0); $scope.diffContentServers(0); $scope.diffDeliveryServices(0); $scope.diffEdgeLocations(0); diff --git a/traffic_ops/experimental/ui/app/src/modules/private/admin/cdns/config/config.tpl.html b/traffic_ops/experimental/ui/app/src/modules/private/admin/cdns/config/config.tpl.html index 3e91a36494..75f26bb7a9 100644 --- a/traffic_ops/experimental/ui/app/src/modules/private/admin/cdns/config/config.tpl.html +++ b/traffic_ops/experimental/ui/app/src/modules/private/admin/cdns/config/config.tpl.html @@ -45,6 +45,12 @@

             
+            
+                
+                    Traffic Monitors [ {{monitorsCount.added}} | {{monitorsCount.removed}} ]
+                
+                

+            
Traffic Servers [ {{contentServersCount.added}} | {{contentServersCount.removed}} ] @@ -89,6 +95,11 @@
{{contentRoutersCount.removed}} removals (--)
+ +