LCM supports GSO case

SDNO-1559

Change-Id: I5b05a1dfc189110a5605e9ec261729c7b222629c
Signed-off-by: seshukm <seshu.kumar.m@huawei.com>
diff --git a/lifecyclemgr/src/main/webapp/lifecyclemgr/js/app.js b/lifecyclemgr/src/main/webapp/lifecyclemgr/js/app.js
index 8803c62..066953a 100644
--- a/lifecyclemgr/src/main/webapp/lifecyclemgr/js/app.js
+++ b/lifecyclemgr/src/main/webapp/lifecyclemgr/js/app.js
@@ -111,13 +111,13 @@
                 controller : "inputDataCtrl"

             })

             .state("home.lcTabs.detailInfo.nfvoDetail", {

-                url : "/nfvoDetailInfo",

+                url : "/nfvoDetailInfo/:segmentId",

                 templateUrl: "templates/nfvoDetail.html",

                 controller: "nfvoDetailCtrl"

             })

 

             .state("home.lcTabs.detailInfo.vpnManager", {

-                url : "/vpnManager",

+                url : "/vpnManager/:segmentId",

                 templateUrl : "templates/vpnManager.html",

                 controller : "vpnManagerCtrl"

             })

@@ -558,7 +558,7 @@
 

     })

 

-    .controller('detailInfoCtrl', function($scope, $stateParams, $compile, DataService) {

+    .controller('detailInfoCtrl', function($scope, $stateParams, $compile, DataService, $log) {

         console.log("detailInfoCtrl --> $stateParams.id:: " + $stateParams.id);

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

 

@@ -567,42 +567,55 @@
         if(rowData.serviceType === "SDNO"){

             $scope.rightPanelHeader = "SDNO VPN Manager";

             jsonData[0] = {"id": $stateParams.id, "name": rowData.serviceType};

+            inializeAccordion(jsonData);

         }

         else if(rowData.serviceType === "NFVO"){

             //TODO - NFVO Pages should be loaded here

             $scope.rightPanelHeader = "NFVO VPN Manager";

             jsonData[0] = {"id": $stateParams.id, "name": rowData.serviceType};

+            inializeAccordion(jsonData);

         }

         else{

-            jsonData = DataService.loadServiceTopoSequence($stateParams.id);

+            DataService.loadServiceTopoSequence($stateParams.id)

+                .then(function (response) {

+                    console.log("Data Param Template :: ");

+                    $log.info(response);

+                    inializeAccordion(response);

+                }, function (reason) {

+                    $scope.error = "Error ! " + reason;

+                });

         }

-        $(".accordion").html("");

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

-            //console.log("jsonData Name: " + jsonData[i].name);

-            if (jsonData[i].name == "SDNO") {

-                //$("#sdnoLink").text(jsonData[i].name.toUpperCase());

-                //console.log("Adding Accordian to SDNO");

-                $(".accordion").append($compile(addAccordionData("sdno", jsonData[i].name.toUpperCase(), jsonData[i].id))($scope));

-            }

-            else if (jsonData[i].name == "NFVO") {

-                //console.log("Adding Accordian to NFVO");

-                $(".accordion").append($compile(addAccordionData("nfvo", jsonData[i].name.toUpperCase(), jsonData[i].id))($scope));

-            }

-            else {

 

+        function inializeAccordion(jsonData) {

+            $(".accordion").html("");

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

+                //console.log("jsonData Name: " + jsonData[i].name);

+                if (jsonData[i].name == "SDNO") {

+                    //$("#sdnoLink").text(jsonData[i].name.toUpperCase());

+                    //console.log("Adding Accordian to SDNO");

+                    $(".accordion").append($compile(addAccordionData("sdno", jsonData[i].name.toUpperCase(), jsonData[i].id))($scope));

+                }

+                else if (jsonData[i].name == "NFVO") {

+                    //console.log("Adding Accordian to NFVO");

+                    $(".accordion").append($compile(addAccordionData("nfvo", jsonData[i].name.toUpperCase(), jsonData[i].id))($scope));

+                }

+                else {

+

+                }

             }

         }

 

+

         function addAccordionData(type, text, id) {

             console.log("id:"+id);

             var content = '';

             content += '<div class="panel panel-default"><div class="panel-heading">';

             content += '<h6 class="panel-title">';

             if(type == "sdno") {

-                content += '<a style="text-decoration:none;" data-toggle="collapse" data-parent="#accordion" data-target="#collapseOne_' + type + '" ui-sref=".vpnManager" ui-sref-active="link_active_DetailInfo" href="#/home/lcTabs/' + id + '/detailInfo/vpnManager">';

+                content += '<a style="text-decoration:none;" data-toggle="collapse" data-parent="#accordion" data-target="#collapseOne_' + type + '" ui-sref=".vpnManager({segmentId: \'' + id + '\'})" ui-sref-active="link_active_DetailInfo" href="#/home/lcTabs/' + id + '/detailInfo/vpnManager">';

             }

             else if(type == "nfvo") {

-                content += '<a style="text-decoration:none;" data-toggle="collapse" data-parent="#accordion" data-target="#collapseOne_' + type + '" ui-sref=".nfvoDetail" ui-sref-active="link_active_DetailInfo" href="#/home/lcTabs/' + id + '/detailInfo/nfvoDetailInfo">';

+                content += '<a style="text-decoration:none;" data-toggle="collapse" data-parent="#accordion" data-target="#collapseOne_' + type + '" ui-sref=".nfvoDetail({segmentId: \'' + id + '\'})" ui-sref-active="link_active_DetailInfo" href="#/home/lcTabs/' + id + '/detailInfo/nfvoDetailInfo">';

             }

             content += '<span id="sdnoLink">'+text+'</span></a>';

             content += '</h6></div>';

@@ -662,6 +675,7 @@
     .controller("overlayVPNCtrl", function($scope, $rootScope, $stateParams, $compile, DataService, NgTableParams){

         $scope.message = "Overlay VPN";

         console.log("Service Id: "+ $stateParams.id);

+        console.log("Segment Id: "+ $stateParams.segmentId);

 

         $scope.init = function() {

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

@@ -717,6 +731,7 @@
     .controller("underlayVPNCtrl", function($scope, $rootScope, $stateParams, $compile, DataService, NgTableParams){

         $scope.message = "Underlay VPN";

         console.log("Service Id: "+ $stateParams.id);

+        console.log("Segment Id: "+ $stateParams.segmentId);

         $scope.tpTableShowing = false;

 

         $scope.init = function() {

@@ -791,6 +806,7 @@
 

     .controller('nfvoDetailCtrl', function($scope, $stateParams, $compile, DataService) {

         console.log("nfvoDetailCtrl --> $stateParams.id:: " + $stateParams.id);

+        console.log("nfvoDetailCtrl --> $stateParams.segmentId:: " + $stateParams.segmentId);

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

 

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