From 9071527d13dfa6ab7e7b81a3a11c3c41c3d9aec9 Mon Sep 17 00:00:00 2001 From: c00149107 Date: Fri, 21 Apr 2017 14:55:51 +0800 Subject: Check ServiceType for details Check ServiceType for details Change-Id: I6ed1f19b6e91d01f19f664cd876d0b339cf767ad Issue-ID:CLIENT-192 Signed-off-by: c00149107 --- .../src/main/webapp/lifecyclemgr/js/DataService.js | 21 +++++++++++++++--- .../src/main/webapp/lifecyclemgr/js/app.js | 25 ++++++++++++---------- 2 files changed, 32 insertions(+), 14 deletions(-) (limited to 'lifecyclemgr/src/main') diff --git a/lifecyclemgr/src/main/webapp/lifecyclemgr/js/DataService.js b/lifecyclemgr/src/main/webapp/lifecyclemgr/js/DataService.js index 65189e4e..04394a22 100644 --- a/lifecyclemgr/src/main/webapp/lifecyclemgr/js/DataService.js +++ b/lifecyclemgr/src/main/webapp/lifecyclemgr/js/DataService.js @@ -62,7 +62,7 @@ app.factory("DataService", function($http, $log){ if(lcData) { for (var i = 0; i < lcData.length; i++) { if(lcData[i].serviceId == id) { - returnData = lcData[i].inputParameters; + returnData = lcData[i]; break; } } @@ -93,8 +93,23 @@ app.factory("DataService", function($http, $log){ return response.data; }); }, - loadServiceDetails : function(id) { - return JSON.parse('[{"id":"12345", "name":"sdno"}, {"id":"23456", "name":"gso"},{"id":"12345", "name":"nfvo"}]'); + loadServiceTopoSequence : function(id) { + return $http({ + url: '/openoapi/gso/v1/services/toposequence/' + id, + //url: 'http://localhost:5000/api/getOverlayVPNData', + method: 'GET', + headers: {'Content-Type': 'application/json'} + }).then(function(response){ + //$log.info(response); + var serviceToposequence = response.data; + var responseData = []; + for (var i = 0; i < serviceToposequence.service.segments.length; i++) { + var segment = serviceToposequence.service.segments[i]; + responseData[i] = {"id":segment.serviceSegmentId, "name":segment.serviceSegmentType}; + } + return responseData; + }); + //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"}]}'); diff --git a/lifecyclemgr/src/main/webapp/lifecyclemgr/js/app.js b/lifecyclemgr/src/main/webapp/lifecyclemgr/js/app.js index 053ee41d..e1dbdbed 100644 --- a/lifecyclemgr/src/main/webapp/lifecyclemgr/js/app.js +++ b/lifecyclemgr/src/main/webapp/lifecyclemgr/js/app.js @@ -536,23 +536,25 @@ var app = angular.module("lcApp", ["ui.router", "ngTable"])/*, 'ui.bootstrap', ' console.log("detailInfoCtrl --> $stateParams.id:: " + $stateParams.id); //$scope.currentId = $stateParams.id; $scope.rightPanelHeader = "VPN Manager"; - - var jsonData = DataService.loadServiceDetails($stateParams.id); + var rowData = DataService.getSavedLCData($stateParams.id); + var jsonData =[]; + if(rowData.serviceType === "SDNO" || rowData.serviceType === "NFVO"){ + jsonData[0] = {"id": $stateParams.id, "name": rowData.serviceType}; + } + else{ + jsonData = DataService.loadServiceTopoSequence($stateParams.id); + } $(".accordion").html(""); for (var i = 0; i < jsonData.length; i++) { //console.log("jsonData Name: " + jsonData[i].name); - if (jsonData[i].name == "sdno") { + 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(), $stateParams.id))($scope)); - } - else if (jsonData[i].name == "gso") { - //console.log("Adding Accordian to GSO"); - $(".accordion").append($compile(addAccordionData("gso", jsonData[i].name.toUpperCase(), $stateParams.id))($scope)); + $(".accordion").append($compile(addAccordionData("sdno", jsonData[i].name.toUpperCase(), jsonData[i].id))($scope)); } - else if (jsonData[i].name == "nfvo") { + else if (jsonData[i].name == "NFVO") { //console.log("Adding Accordian to NFVO"); - $(".accordion").append($compile(addAccordionData("nfvo", jsonData[i].name.toUpperCase(), $stateParams.id))($scope)); + $(".accordion").append($compile(addAccordionData("nfvo", jsonData[i].name.toUpperCase(), jsonData[i].id))($scope)); } else { @@ -716,7 +718,8 @@ var app = angular.module("lcApp", ["ui.router", "ngTable"])/*, 'ui.bootstrap', ' .controller('inputDataCtrl', function($scope, $stateParams, $log, DataService) { console.log("inputDataCtrl --> $stateParams.id:: " + $stateParams.id); - $scope.inputData = DataService.getSavedLCData($stateParams.id); + var rowData = DataService.getSavedLCData($stateParams.id); + $scope.inputData = rowData.inputParameters; $log.info($scope.inputData); $("div.inputDataElements").html(""); $("div.inputDataElements").append(convertInputsToUI('', 'show', $scope.inputData)); -- cgit 1.2.3-korg