Fix detail and resmgr issues in CMCC

Fix detail and resmgr issues in CMCC

Change-Id: Ic4cb0217aadd7e0ca8c124a974788386a230f319
Issue-ID:CLIENT-200
Signed-off-by: c00149107 <chenchuanyu@huawei.com>
diff --git a/lifecyclemgr/src/main/webapp/lifecyclemgr/js/DataService.js b/lifecyclemgr/src/main/webapp/lifecyclemgr/js/DataService.js
index 0718569..34c991f 100644
--- a/lifecyclemgr/src/main/webapp/lifecyclemgr/js/DataService.js
+++ b/lifecyclemgr/src/main/webapp/lifecyclemgr/js/DataService.js
@@ -74,32 +74,26 @@
             else

                 return null;

         },

-        getOverlayData : function() {

+        getOverlayData : function(id) {

             return $http({

-                url: url+'/openoapi/sdnooverlayvpn/v1/site2dc-vpn',

+                url: url+'/openoapi/sdnooverlay/v1/vpns/' + id,

                 //url: 'http://localhost:5000/api/getOverlayVPNData',

                 method: 'GET',

                 data: null,

                 headers: {'Content-Type': 'application/json'}

             }).then(function(response){

                 //$log.info(response);

-                overLayData = response.data.overlayData;

+                overLayData = response.data;

                 return response.data;

             });

         },

         getOverlayVPNConnData : function(id, type){

             var returnData = null;

             if(overLayData) {

-                for (var i = 0; i < overLayData.length; i++) {

-                    if(overLayData[i].id == id) {

-                        returnData = overLayData[i][type];

-                        break;

-                    }

-                }

-                return returnData;

+                return overLayData[type];

             }

             else

-                return null;

+                return [];

         },

         getSiteListData : function() {

             return $http({

@@ -109,36 +103,78 @@
                 data: null,

                 headers: {'Content-Type': 'application/json'}

             }).then(function(response){

-                //$log.info(response);

-                return response.data;

+                if(overLayData) {

+                    var sites = [];

+                    var index = 0;

+                    for(var i = 0 ; i < response.data.length; i++){

+                        var isContains = false;

+                        for(var j = 0; j < overLayData.siteList.length; j++){

+                            if(response.data[i].id == overLayData.siteList[j]){

+                                isContains = true;

+                            }

+                        }

+                        if(isContains){

+                            sites[index] = response.data[i];

+                            index ++;

+                        }

+                    }

+                    return sites;

+                }

+                else {

+                    return [];

+                }

             });

         },

-        getUnderlayData : function() {

+        getVpcListData : function() {

             return $http({

-                url: url+'/openoapi/sdnol3vpn/v1/l3vpns',

+                url: url+'/openoapi/sdnovpc/v1/vpcs',

+                //url: 'http://localhost:5000/api/getOverlayVPNData',

+                method: 'GET',

+                data: null,

+                headers: {'Content-Type': 'application/json'}

+            }).then(function(response){

+                if(overLayData) {

+                    var vpcs = [];

+                    var index = 0;

+                    for(var i = 0 ; i < response.data.length; i++){

+                        var isContains = false;

+                        for(var j = 0; j < overLayData.vpcList.length; j++){

+                            if(response.data[i].id == overLayData.vpcList[j]){

+                                isContains = true;

+                            }

+                        }

+                        if(isContains){

+                            vpcs[index] = response.data[i];

+                            index ++;

+                        }

+                    }

+                    return vpcs;

+                }

+                else {

+                    return [];

+                }

+            });

+        },

+        getUnderlayData : function(id) {

+            return $http({

+                url: url+'/openoapi/sdnol3vpn/v1/l3vpns/' + id,

                 //url: 'http://localhost:5000/api/getUnderlayVPNData',

                 method: 'GET',

                 data: null,

                 headers: {'Content-Type': 'application/json'}

             }).then(function(response){

                 //$log.info(response);

-                underlayData = response.data.data.underlayVPN;

+                underlayData = response.data;

                 return response.data;

             });

         },

-	getTPLinkData : function(id){

+	getTPLinkData : function(){

             var returnData = null;

-            if(underlayData) {

-                for (var i = 0; i < underlayData.length; i++) {

-                    if(underlayData[i].id == id) {

-                        returnData = underlayData[i].tp_details;

-                        break;

-                    }

-                }

-                return returnData;

+            if(underlayData) {                

+                return underlayData.accessPointList;

             }

             else

-                return null;

+                return [];

         },

         loadServiceTopoSequence : function(id) {

             return $http({

diff --git a/lifecyclemgr/src/main/webapp/lifecyclemgr/js/app.js b/lifecyclemgr/src/main/webapp/lifecyclemgr/js/app.js
index bfc8833..529f1be 100644
--- a/lifecyclemgr/src/main/webapp/lifecyclemgr/js/app.js
+++ b/lifecyclemgr/src/main/webapp/lifecyclemgr/js/app.js
@@ -665,9 +665,10 @@
 

         $scope.init = function() {

             //console.log("Overlay VPN... ng-init + " +  $rootScope.lcmModelTemplate);

-            DataService.getOverlayData()

+            DataService.getOverlayData($stateParams.id)

                 .then(function(data){

-                    $scope.overlayData = data.overlayData;

+                    $scope.overlayData = [];

+                    $scope.overlayData[0] = data;

                     console.log("Data: ");

                     loadButtons();

                 }, function(reason){

@@ -722,7 +723,8 @@
             //console.log("Underlay VPN... ng-init + " +  $rootScope.lcmModelTemplate);

             DataService.getUnderlayData()

                 .then(function(response){

-                    $scope.underlayVPN = response.data.underlayVPN;

+                    $scope.underlayVPN = [];

+                    $scope.underlayVPN[0] = response;

                     console.log("Data: ");

                     loadButtons();

                 }, function(reason){

@@ -765,7 +767,7 @@
             $scope.selectedRow = row;

             $scope.tpTableShowing = true;

             console.log("Underlay table row click");

-            var tp_detData = DataService.getTPLinkData(id);

+            var tp_detData = DataService.getTPLinkData();

             $scope.tableParams_tpDetails = new NgTableParams({count: 5, sorting: {id: 'asc'}    //{page: 1,count: 10,filter: {name: 'M'},sorting: {name: 'desc'}

             }, { counts:[5, 10], dataset: tp_detData});

         }

@@ -861,7 +863,7 @@
 

     .controller('vpcListCtrl', function($scope, $stateParams, NgTableParams, DataService) {

         $scope.message = "VPN List";

-        var rowData = DataService.getOverlayVPNConnData($stateParams.overlayId, "vpcList");

+        var rowData = DataService.getVpcListData();

         $scope.vpcListTable = new NgTableParams({count: 5, sorting: {id: 'asc'}    //{page: 1,count: 10,filter: {name: 'M'},sorting: {name: 'desc'}

         }, { counts:[5, 10], dataset: rowData});

     })

diff --git a/lifecyclemgr/src/main/webapp/lifecyclemgr/templates/underlayVPN_L3.html b/lifecyclemgr/src/main/webapp/lifecyclemgr/templates/underlayVPN_L3.html
index b91ec32..230e0df 100644
--- a/lifecyclemgr/src/main/webapp/lifecyclemgr/templates/underlayVPN_L3.html
+++ b/lifecyclemgr/src/main/webapp/lifecyclemgr/templates/underlayVPN_L3.html
@@ -33,8 +33,8 @@
         <td title="'Name'" filter="{ name: 'text'}" sortable="'name'">

             {{underlayData.name}}

         </td>

-        <td title="'State'" filter="{ thinCPE: 'text'}" sortable="'thinCPE'">

-            {{underlayData.thinCPE}}

+        <td title="'Status'" filter="{ operStatus: 'text'}" sortable="'operStatus'">

+            {{underlayData.operStatus}}

         </td>

         <td title="'Description'" filter="{ desc: 'text'}" sortable="'desc'">

             {{underlayData.desc}}

@@ -57,20 +57,14 @@
     <div class="panel panel-default">

     <table ng-table="tableParams_tpDetails" class="table table table-striped table-hover table-bordered lctable" show-filter="true">

         <tr ng-repeat="tpDetailsData in $data" ng-class="{rowSelected:$index==selectedRow}" ng-click="rowHighilited($index)">

-            <td title="'TP Name'" filter="{ tp_name: 'text'}" sortable="'tp_name'">

-                {{tpDetailsData.tp_name}}

+            <td title="'Name'" filter="{ name: 'text'}" sortable="'name'">

+                {{tpDetailsData.name}}

             </td>

-            <td title="'PE Name'" filter="{ pe_name: 'text'}" sortable="'pe_name'">

-                {{tpDetailsData.pe_name}}

+            <td title="'Status'" filter="{ operStatus: 'text'}" sortable="'operStatus'">

+                {{tpDetailsData.operStatus}}

             </td>

-            <td title="'VLAN ID'" filter="{ vlanId: 'text'}" sortable="'vlanId'">

-                {{tpDetailsData.vlanId}}

-            </td>

-            <td title="'Site CIDR'" filter="{ site_cidr: 'text'}" sortable="'site_cidr'">

-                {{tpDetailsData.site_cidr}}

-            </td>

-            <td title="'IP'" filter="{ ip: 'text'}" sortable="'ip'">

-                {{tpDetailsData.ip}}

+            <td title="'Type'" filter="{ type: 'text'}" sortable="'type'">

+                {{tpDetailsData.type}}

             </td>

         </tr>

     </table>

diff --git a/resmgr/src/main/webapp/resmgr/js/app.js b/resmgr/src/main/webapp/resmgr/js/app.js
index be8f20f..968f79a 100644
--- a/resmgr/src/main/webapp/resmgr/js/app.js
+++ b/resmgr/src/main/webapp/resmgr/js/app.js
@@ -1380,8 +1380,10 @@
             $("#myModal").modal({}).draggable();

         }

         $scope.saveData = function(id) {

-            $scope.ne.controller = $('#medropdown').val();

-            $scope.ne.siteID = $('#siteIdDropdown').val();

+            $scope.ne.controllerID = [];

+            $scope.ne.controllerID[0] = $('#medropdown').val();

+            $scope.ne.siteID = [];

+            $scope.ne.siteID[0] = $('#siteIdDropdown').val();

 

             if (!$scope.textboxErrName && !$scope.textboxErrIP) {