NFVO Detail information display wrong

Issue-id: CLIENT-205

Change-Id: Iab9dcf9f1cc8fabe0fda4bfb2287c06cd5f06491
Signed-off-by: Luji7 <lu.ji3@zte.com.cn>
diff --git a/lifecyclemgr/src/main/webapp/lifecyclemgr/js/DataService.js b/lifecyclemgr/src/main/webapp/lifecyclemgr/js/DataService.js
index 34c991f..0361864 100644
--- a/lifecyclemgr/src/main/webapp/lifecyclemgr/js/DataService.js
+++ b/lifecyclemgr/src/main/webapp/lifecyclemgr/js/DataService.js
@@ -195,8 +195,16 @@
             });

             //return JSON.parse('[{"id":"12345", "name":"sdno"}, {"id":"23456", "name":"gso"},{"id":"12345", "name":"nfvo"}]');

         },

-        loadNfvoServiceDetails : function(id) {

-            return JSON.parse('{"vnfInfoId": [{ "vnfInstanceId": "123", "vnfInstanceName": "vnf instance 1", "vnfProfileId": "321" }, { "vnfInstanceId": "123", "vnfInstanceName": "vnf instance 1", "vnfProfileId": "321" }],  "vlInfo": [{ "networkResource": {"resourceName": "network resource 1"}, "linkPortResource": { "resourceName": "link port resource 1"}}, { "networkResource": {"resourceName": "network resource 1"}, "linkPortResource": { "resourceName": "link port resource 1"}}], "vnffgInfo": [{"vnfId": "vnfid-123", "virtualLinkId": "virtual link 123", "cpId": "cp id 123", "nfp": "nfp 123"}, {"vnfId": "vnfid-123", "virtualLinkId": "virtual link 123", "cpId": "cp id 123", "nfp": "nfp 123"}]}');

+        loadNfvoServiceDetails : function(id, processFun) {

+            return $http({

+                url: url+'/openoapi/nslcm/v1/ns/' + id,

+                method: 'GET',

+                data: null,

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

+            }).then(function(response){

+                processFun(response.data);

+            });

+            // return JSON.parse('{"vnfInfoId": [{ "vnfInstanceId": "123", "vnfInstanceName": "vnf instance 1", "vnfProfileId": "321" }, { "vnfInstanceId": "123", "vnfInstanceName": "vnf instance 1", "vnfProfileId": "321" }],  "vlInfo": [{ "networkResource": {"resourceName": "network resource 1"}, "linkPortResource": { "resourceName": "link port resource 1"}}, { "networkResource": {"resourceName": "network resource 1"}, "linkPortResource": { "resourceName": "link port resource 1"}}], "vnffgInfo": [{"vnfId": "vnfid-123", "virtualLinkId": "virtual link 123", "cpId": "cp id 123", "nfp": "nfp 123"}, {"vnfId": "vnfid-123", "virtualLinkId": "virtual link 123", "cpId": "cp id 123", "nfp": "nfp 123"}]}');

         },

 

         generateTemplatesComponent : function() {

diff --git a/lifecyclemgr/src/main/webapp/lifecyclemgr/js/app.js b/lifecyclemgr/src/main/webapp/lifecyclemgr/js/app.js
index 8803c62..1d6114f 100644
--- a/lifecyclemgr/src/main/webapp/lifecyclemgr/js/app.js
+++ b/lifecyclemgr/src/main/webapp/lifecyclemgr/js/app.js
@@ -793,16 +793,18 @@
         console.log("nfvoDetailCtrl --> $stateParams.id:: " + $stateParams.id);

         //$scope.currentId = $stateParams.id;

 

-        var jsonData = DataService.loadNfvoServiceDetails($stateParams.id);

         var table_tpl = $(lcmModelTemplate).filter('#table').html();

-        var vnfData = fetchDataForVnf(jsonData);

-        $('#vnfInfoTable').html(Mustache.to_html(table_tpl, vnfData));

+        var processFun = function (jsonData) {

+            var vnfData = fetchDataForVnf(jsonData);

+            $('#vnfInfoTable').html(Mustache.to_html(table_tpl, vnfData));

 

-        var vlData = fetchDataForVl(jsonData);

-        $('#vlInfoTable').html(Mustache.to_html(table_tpl, vlData));

+            var vlData = fetchDataForVl(jsonData);

+            $('#vlInfoTable').html(Mustache.to_html(table_tpl, vlData));

 

-        var vnffgData = fetchDataForVnffg(jsonData);

-        $('#vnffgInfoTable').html(Mustache.to_html(table_tpl, vnffgData));

+            var vnffgData = fetchDataForVnffg(jsonData);

+            $('#vnffgInfoTable').html(Mustache.to_html(table_tpl, vnffgData));

+        };

+        DataService.loadNfvoServiceDetails($stateParams.id, processFun);

 

         function fetchDataForVnf(jsonData) {

             var header = ["Vnf instance Name"];