Only update SNMP fields if changed

Use ng-change to determine if the SNMP fields, Address and Port,
have changed and should be updated.

Tested: Only see the rest calls when the fields have changed.
Change-Id: I324c9c422a8b6dfb8816925167953e16099f8044
Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
diff --git a/app/configuration/controllers/snmp-controller.js b/app/configuration/controllers/snmp-controller.js
index 782ee1c..a2f5e2b 100644
--- a/app/configuration/controllers/snmp-controller.js
+++ b/app/configuration/controllers/snmp-controller.js
@@ -26,7 +26,9 @@
               $scope.managers.push({
                 path: key,
                 port: data.data[key].Port,
-                address: data.data[key].Address
+                update_port: false,
+                address: data.data[key].Address,
+                update_address: false
               })
             }
           },
@@ -85,11 +87,14 @@
             promises.push(addManager(
                 $scope.managers[i].address, $scope.managers[i].port));
           } else {
-            // TODO: Check if we actually need to update the existing managers
-            promises.push(setManagerAddress(
-                $scope.managers[i].path, $scope.managers[i].address));
-            promises.push(setManagerPort(
-                $scope.managers[i].path, $scope.managers[i].port));
+            if ($scope.managers[i].update_address) {
+              promises.push(setManagerAddress(
+                  $scope.managers[i].path, $scope.managers[i].address));
+            }
+            if ($scope.managers[i].update_port) {
+              promises.push(setManagerPort(
+                  $scope.managers[i].path, $scope.managers[i].port));
+            }
           }
         }