change roadm app to support EDFA/ROADM/OPS devices, add OPS PowerConfig/LambdaQuery behaviour

Change-Id: Ieb6de727e766fdeb63740c0704f83fd11e44b935
diff --git a/apps/roadm/src/main/resources/app/view/roadmFlow/roadmFlow.js b/apps/roadm/src/main/resources/app/view/roadmFlow/roadmFlow.js
index ad9bf76e..b5d8baf 100644
--- a/apps/roadm/src/main/resources/app/view/roadmFlow/roadmFlow.js
+++ b/apps/roadm/src/main/resources/app/view/roadmFlow/roadmFlow.js
@@ -7,6 +7,8 @@
     var DELETE_FLOW_REQ = "roadmDeleteFlowRequest";
     var CREATE_FLOW_REQ = "roadmCreateFlowRequest";
     var CREATE_FLOW_RESP = "roadmCreateFlowResponse";
+    var SHOW_ITEMS_REQ = "roadmShowFlowItemsRequest";
+    var SHOW_ITEMS_RESP = "roadmShowFlowItemsResponse";
 
     // injected references
     var $log, $scope, $location, fs, tbs, wss, ns;
@@ -24,6 +26,19 @@
             });
     }
 
+    function queryShowItems() {
+        wss.sendEvent(SHOW_ITEMS_REQ,
+            {
+                devId: $scope.devId,
+            });
+    }
+    
+    function showItemsCb(data) {
+        $scope.showChannel = data.showChannel;
+        $scope.showAttenuation = data.showAttenuation;
+        $scope.$apply();
+    }
+
     function attenuationCb(data) {
         flowCbTable[data.flowId](data.valid, data.message);
     }
@@ -55,13 +70,13 @@
             $scope.addFlowTip = 'Create a flow';
             $scope.deviceTip = 'Show device table';
             $scope.flowTip = 'Show flow view for this device';
-            $scope.groupTip = 'Show group view for this device';
-            $scope.meterTip = 'Show meter view for selected device';
+            $scope.portTip = 'Show port view for this device';
 
             $scope.showFlowForm = false;
 
             var handlers = {};
             handlers[SET_ATT_RESP] = attenuationCb;
+            handlers[SHOW_ITEMS_RESP] = showItemsCb;
             wss.bindHandlers(handlers);
 
             params = $location.search();
@@ -83,6 +98,8 @@
                 $scope.showFlowForm = false;
             }
 
+            $scope.queryShowItems = queryShowItems;
+
             $scope.setAttenuation = setAttenuation;
 
             $scope.deleteFlow = function ($event, row) {
@@ -149,7 +166,7 @@
             controller: function($scope, $timeout) {
                 $scope.enableEdit = function() {
                     // connection must support attenuation to be editable
-                    if ($scope.editMode === false) {
+                    if ($scope.currItem.hasAttenuation === 'true' && $scope.editMode === false) {
                         // Ensure that the entry being edited remains the same even
                         // if the table entries are shifted around.
                         $scope.targetItem = $scope.currItem;
@@ -228,7 +245,7 @@
         //this.flow.outPort = 2;
         this.flow.spacing = this.spacings[1];
         //this.flow.multiplier = 0;
-        this.flow.includeAttenuation = true;
+        this.flow.channelFrequency = "";
         this.flow.attenuation = 0;
 
         var parent = this;
@@ -250,15 +267,18 @@
                 parent.spacingMessage = data.spacing.message;
                 parent.spacingError = true;
             }
-            if (!data.multiplier.valid) {
-                parent.multiplierMessage = data.multiplier.message;
-                parent.multiplierError = true;
+            if ($scope.includeChannel)
+            {
+                if (!data.multiplier.valid) {
+                    parent.multiplierMessage = data.multiplier.message;
+                    parent.multiplierError = true;
+                }
+                if (!data.channelAvailable.valid) {
+                    parent.channelMessage = data.channelAvailable.message;
+                    parent.channelError = true;
+                }
             }
-            if (!data.channelAvailable.valid) {
-                parent.channelMessage = data.channelAvailable.message;
-                parent.channelError = true;
-            }
-            if (data.includeAttenuation && !data.attenuation.valid) {
+            if ($scope.includeAttenuation && !data.attenuation.valid) {
                 parent.attenuationMessage = data.attenuation.message;
                 parent.attenuationError = true;
             }
@@ -270,7 +290,6 @@
         var handlers = {}
         handlers[CREATE_FLOW_RESP] = createFlowCb;
         wss.bindHandlers(handlers);
-
         this.createFlow = function(connection) {
             this.clearErrors();
 
@@ -295,12 +314,12 @@
                 this.outPortError = true;
                 error = true;
             }
-            if (!isInteger(connection.multiplier)) {
+            if ($scope.includeChannel && !isInteger(connection.multiplier)) {
                 this.multiplierMessage = notIntegerError;
                 this.multiplierError = true;
                 error = true;
             }
-            if (connection.includeAttenuation && !isInteger(connection.attenuation)) {
+            if ($scope.includeAttenuation && !isInteger(connection.attenuation)) {
                 this.attenuationMessage = notIntegerError;
                 this.attenuationError = true;
                 error = true;