fix issue:GSO-89
authorc00149107 <chenchuanyu@huawei.com>
Mon, 31 Oct 2016 09:13:05 +0000 (17:13 +0800)
committerc00149107 <chenchuanyu@huawei.com>
Mon, 31 Oct 2016 09:13:05 +0000 (17:13 +0800)
Change-Id: I67c5e24d6bbd82f7e1340c9e93d19b9cc1e929b9
Signed-off-by: c00149107 <chenchuanyu@huawei.com>
openo-portal/portal-lifecyclemgr/src/main/webapp/lifecyclemgr/InputData.html
openo-portal/portal-lifecyclemgr/src/main/webapp/lifecyclemgr/js/rest.js

index d76182c..b5a2d98 100644 (file)
                                                var name = key;\r
                                                if(name.includes('.'))\r
                                                {\r
-                                                       name = key.substring(key.lastInexOf('.')+1,key.length);\r
+                                                       name = key.substring(key.lastIndexOf('.')+1,key.length);\r
                                                }\r
-                        $("body").append('<div class="mT15 form-group row" style="margin-top:35px;margin-left:25%"><div class="col-sm-6" align="right"><label class="control-label"><span style="font-size:16px;">'+ name + ':</span></label></div><div class="col-sm-6"><input  type="text" name="" maxlength="256" style="margin-left:10px;width:250px;" data-toggle="tooltip" data-placement="top" title="'+ jsonData.inputParameters[key] + '" value="'+ jsonData.inputParameters[key] + '" readonly disabled/></div></div>');\r
+                                           var paramValue = jsonData.inputParameters[key];\r
+                                               if(name.indexOf('location') != -1) {\r
+                                                   var vimObj  = getVimNameById(paramValue);\r
+                                                       if(vimObj != undefined){\r
+                                                               paramValue = vimObj.name;\r
+                                                       }\r
+                                               }\r
+                                               else if(name.indexOf('sdncontroller') != -1){\r
+                                                       var sdnControllerObj  = getSdnControllerNameById(paramValue);\r
+                                                       if(sdnControllerObj != undefined){\r
+                                                               paramValue = sdnControllerObj.name;\r
+                                                       }\r
+                                               }       \r
+                        $("body").append('<div class="mT15 form-group row" style="margin-top:35px;margin-left:25%"><div class="col-sm-6" align="right"><label class="control-label"><span style="font-size:16px;">'+ name + ':</span></label></div><div class="col-sm-6"><input  type="text" name="" maxlength="256" style="margin-left:10px;width:250px;" data-toggle="tooltip" data-placement="top" title="'+ paramValue + '" value="'+ paramValue + '" readonly disabled/></div></div>');\r
                     }\r
                 }\r
 \r
index a6e2eba..ddeabf7 100644 (file)
@@ -220,6 +220,54 @@ function loadServiceDetails(serviceId){
     return returnObj;\r
 }\r
 \r
+//get the vim name by id.\r
+function getVimNameById(vimId){\r
+   \r
+   // TODO re-confirm the latest url.\r
+    var requestUrl ="/openoapi/extsys/v1/vims/" + vimId;\r
+    var returnObj;\r
+    $\r
+        .ajax({\r
+            type : "GET",\r
+            async: false,\r
+            url : requestUrl,\r
+            contentType : "application/json",\r
+            success : function(jsonobj) {\r
+                // TODO return according to the json data received.\r
+               returnObj = jsonobj;\r
+            },\r
+            error : function(xhr, ajaxOptions, thrownError) {\r
+                alert("Error on getting link data : " + xhr.responseText);\r
+            }\r
+        });\r
+    return returnObj;\r
+}\r
+\r
+// get the sdn controller name by id.\r
+function getSdnControllerNameById(sdnControllerId){\r
+   \r
+   // TODO re-confirm the latest url.\r
+    var requestUrl ="/openoapi/extsys/v1/sdncontrollers/" + sdnControllerId;\r
+    var returnObj;\r
+    $\r
+        .ajax({\r
+            type : "GET",\r
+            async: false,\r
+            url : requestUrl,\r
+            contentType : "application/json",\r
+            success : function(jsonobj) {\r
+                // TODO return according to the json data received.\r
+               returnObj = jsonobj;\r
+            },\r
+            error : function(xhr, ajaxOptions, thrownError) {\r
+                alert("Error on getting link data : " + xhr.responseText);\r
+            }\r
+        });\r
+    return returnObj;\r
+}\r
+\r
+\r
+\r
 function anchorClick(serviceId){\r
     var jsonData = loadServiceDetails(serviceId);\r
     //TODO populate the modal according to json response\r