From 27cc62da7d4b93ead42dae80068d9b398ea6b50f Mon Sep 17 00:00:00 2001 From: c00149107 Date: Wed, 26 Apr 2017 17:37:33 +0800 Subject: 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 --- .../src/main/webapp/lifecyclemgr/js/DataService.js | 88 +++++++++++++++------- .../src/main/webapp/lifecyclemgr/js/app.js | 12 +-- .../lifecyclemgr/templates/underlayVPN_L3.html | 22 ++---- 3 files changed, 77 insertions(+), 45 deletions(-) (limited to 'lifecyclemgr/src') diff --git a/lifecyclemgr/src/main/webapp/lifecyclemgr/js/DataService.js b/lifecyclemgr/src/main/webapp/lifecyclemgr/js/DataService.js index 0718569a..34c991f8 100644 --- a/lifecyclemgr/src/main/webapp/lifecyclemgr/js/DataService.js +++ b/lifecyclemgr/src/main/webapp/lifecyclemgr/js/DataService.js @@ -74,32 +74,26 @@ app.factory("DataService", function($http, $log){ 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 @@ app.factory("DataService", function($http, $log){ 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 []; + } + }); + }, + getVpcListData : function() { + return $http({ + 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() { + getUnderlayData : function(id) { return $http({ - url: url+'/openoapi/sdnol3vpn/v1/l3vpns', + 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 bfc88337..529f1be9 100644 --- a/lifecyclemgr/src/main/webapp/lifecyclemgr/js/app.js +++ b/lifecyclemgr/src/main/webapp/lifecyclemgr/js/app.js @@ -665,9 +665,10 @@ var app = angular.module("lcApp", ["ui.router", "ngTable"])/*, 'ui.bootstrap', ' $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 @@ var app = angular.module("lcApp", ["ui.router", "ngTable"])/*, 'ui.bootstrap', ' //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 @@ var app = angular.module("lcApp", ["ui.router", "ngTable"])/*, 'ui.bootstrap', ' $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 @@ var app = angular.module("lcApp", ["ui.router", "ngTable"])/*, 'ui.bootstrap', ' .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 b91ec328..230e0dfe 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 @@ {{underlayData.name}} - - {{underlayData.thinCPE}} + + {{underlayData.operStatus}} {{underlayData.desc}} @@ -57,20 +57,14 @@
- - - - -
- {{tpDetailsData.tp_name}} + + {{tpDetailsData.name}} - {{tpDetailsData.pe_name}} + + {{tpDetailsData.operStatus}} - {{tpDetailsData.vlanId}} - - {{tpDetailsData.site_cidr}} - - {{tpDetailsData.ip}} + + {{tpDetailsData.type}}
-- cgit 1.2.3-korg