diff options
Diffstat (limited to 'configbackuprestore/vnfconfigbackupservice/src/main/webapp/js')
3 files changed, 67 insertions, 65 deletions
diff --git a/configbackuprestore/vnfconfigbackupservice/src/main/webapp/js/sdnc-controller/sdnc-applyConfig-controller.js b/configbackuprestore/vnfconfigbackupservice/src/main/webapp/js/sdnc-controller/sdnc-applyConfig-controller.js index faff3633..ed6733e5 100644 --- a/configbackuprestore/vnfconfigbackupservice/src/main/webapp/js/sdnc-controller/sdnc-applyConfig-controller.js +++ b/configbackuprestore/vnfconfigbackupservice/src/main/webapp/js/sdnc-controller/sdnc-applyConfig-controller.js @@ -5,10 +5,10 @@ myApp.controller('ApplyConfigCtrl', ['$scope','$window', '$http', 'growl', 'devi //THIS FUNCTION WILL BE CALLED ON PAGE LOAD $scope.getAllVNFFromRc = function() { - deviceConfigService.getAllVNFFromRc().then(function(data) { + deviceConfigService.getAllVnfIds().then(function(data) { if (data != null) { console.log(data); - $scope.objvnfList = data; + $scope.objvnfList= data['vnfDisplayList']; console.log("CompareConfigCtrl:getAllVNFFromRc called" + $scope.objvnfList); } else { $scope.warningMessage = "No VNF is eligible for configuration!!!"; @@ -24,29 +24,27 @@ myApp.controller('ApplyConfigCtrl', ['$scope','$window', '$http', 'growl', 'devi $scope.getAllVNFFromRc(); - + $scope.ShowResult=false; $scope.selectVnf = function(selectedValueVnf) { - + if (selectedValueVnf != null && selectedValueVnf != "") { + $scope.ShowResult=true; var vnfId = selectedValueVnf; - - $scope.fileContent = ''; + $scope.successMessagebool1 = false; + $scope.fileContent = ''; $scope.fileSize = 0; $scope.fileName = ''; - + $scope.submit = function () { var file = document.getElementById("myFileInput").files[0]; $scope.result1={}; - if (file) { var aReader = new FileReader(); aReader.readAsText(file, "UTF-8"); aReader.onload = function (evt) { - // $scope.fileContent = aReader.result; $scope.fileName = document.getElementById("myFileInput").files[0].name; $scope.fileSize = document.getElementById("myFileInput").files[0].size; var id= vnfId; result1=JSON.parse(aReader.result); - /*var item = JSON.parse(result1);*/ $scope.fileContent = aReader.result.search(id); $scope.successMessagebool = false; if( $scope.fileContent == -1){ @@ -58,17 +56,24 @@ myApp.controller('ApplyConfigCtrl', ['$scope','$window', '$http', 'growl', 'devi disableCountDown: true }); } - else{ - + else{ $scope.apply(); - } } aReader.onerror = function (evt) { $scope.fileContent = "error"; } - } - $scope.successMessagebool1 = false; + + }else{ + $scope.errorMessage = "Please select file!!!!"; + growl.error($scope.errorMessage, { + title: 'Error!', + globalDisableCloseButton: false, + ttl: 7000, + disableCountDown: true + }); + } + $scope.apply = function() { if (file) { deviceConfigService.runApplyconfig(vnfId,result1); @@ -80,14 +85,22 @@ myApp.controller('ApplyConfigCtrl', ['$scope','$window', '$http', 'growl', 'devi disableCountDown: true }); $scope.successMessagebool1 = true; - - } }; - } + }; } else { + $scope.ShowResult = false; + $scope.showCompare = false; + $scope.showResult = false; + $scope.errorMessage = "Please select a VNF!!!"; + growl.error($scope.errorMessage, { + title: 'Error!', + globalDisableCloseButton: false, + ttl: 7000, + disableCountDown: true + }); + } - } + }; -}]); - +}]);
\ No newline at end of file diff --git a/configbackuprestore/vnfconfigbackupservice/src/main/webapp/js/sdnc-controller/sdnc-compareConfig-controller.js b/configbackuprestore/vnfconfigbackupservice/src/main/webapp/js/sdnc-controller/sdnc-compareConfig-controller.js index 91584b00..9884862c 100644 --- a/configbackuprestore/vnfconfigbackupservice/src/main/webapp/js/sdnc-controller/sdnc-compareConfig-controller.js +++ b/configbackuprestore/vnfconfigbackupservice/src/main/webapp/js/sdnc-controller/sdnc-compareConfig-controller.js @@ -29,6 +29,10 @@ myApp.controller('CompareConfigCtrl', ['$scope','$filter', '$http','$window', 'g $scope.itemsPerPage = 5; $scope.pagedItems = []; $scope.currentPage = 0; + $scope.version1=false; + $scope.version2=false; + $scope.version3=false; + $scope.version4=false; //THIS FUNCTION WILL BE CALLED ON PAGE LOAD $scope.getAllVNF = function() { @@ -54,9 +58,6 @@ myApp.controller('CompareConfigCtrl', ['$scope','$filter', '$http','$window', 'g if (selectedValueVnf != null && selectedValueVnf != "") { console.log("selectedvnf Value", selectedValueVnf); - //selectedItem = selectedValueVnf.split("%"); -// var vnfName = selectedItem[0]; -// var vnfType = selectedItem[1]; var vnfId = selectedValueVnf; $scope.getVersionList(vnfId); } else { @@ -278,9 +279,6 @@ myApp.controller('CompareConfigCtrl', ['$scope','$filter', '$http','$window', 'g $scope.versionsSelected = []; angular.forEach(objVersion, function(item) { angular.forEach($scope.objVersionModel, function(val, index) { - /* if (item.vnfversion == val['vnfversion'] && item.selected == false) { - $scope.objVersionModel.splice(index, 1); - }*/ if (item.selected) { if ($scope.versionsSelected.indexOf(item) == -1) $scope.versionsSelected.push(item); @@ -295,11 +293,11 @@ myApp.controller('CompareConfigCtrl', ['$scope','$filter', '$http','$window', 'g versionDetails.vnfversion = item['vnfversion']; versionDetails.vnfName = item['vnfname']; var vnfid = item['vnfid']; - // var config = JSON.parse(item['configinfo']); var config = item['configinfo']; var config1=JSON.parse(config); console.log("CompareConfigCtrl::createCompareModel::objCompareModel1", config1); deviceConfigService.runApplyconfig(vnfid,config1); + $scope.showResult = false; $scope.successMessage = "File uploaded successfully"; growl.success($scope.successMessage, { title: 'Success!', @@ -349,9 +347,6 @@ myApp.controller('CompareConfigCtrl', ['$scope','$filter', '$http','$window', 'g $scope.versionsSelected = []; angular.forEach(objVersion, function(item) { angular.forEach($scope.objVersionModel, function(val, index) { - /*if (item.vnfversion == val['vnfversion'] && item.selected == false) { - $scope.objVersionModel.splice(index, 1); - }*/ if (item.selected) { if ($scope.versionsSelected.indexOf(item) == -1) $scope.versionsSelected.push(item); @@ -372,7 +367,6 @@ myApp.controller('CompareConfigCtrl', ['$scope','$filter', '$http','$window', 'g versionObj.versionDetails = versionDetails; //fetch all the other topology/network,opertaion status for the vnf - // versionObj.topologyInfo = $scope.fetchConfigDetails(item); versionObj.topologyInfo = $scope.fetchTopologyInfo(item); versionObj.vnfIdInfo = $scope.fetchVnfId(item); versionObj.serviceStatusInfo= $scope.fetchServiceStatus(item); @@ -440,9 +434,6 @@ myApp.controller('CompareConfigCtrl', ['$scope','$filter', '$http','$window', 'g $scope.versionsSelected = []; angular.forEach(objVersion, function(item) { angular.forEach($scope.objVersionModel, function(val, index) { - /*if ((item.vnfversion == val['vnfversion']) && item.selected == false) { - // $scope.objVersionModel.splice(index, 1); - }*/ if (item.selected) { if ($scope.versionsSelected.indexOf(item) == -1) $scope.versionsSelected.push(item); @@ -456,13 +447,10 @@ myApp.controller('CompareConfigCtrl', ['$scope','$filter', '$http','$window', 'g var versionObj = {}; var versionDetails = {}; versionDetails.vnfversion = item.vnfversion; - /*versionDetails.vnfName = item['vnfname']; - versionDetails.vnfid = item['vnfid'];*/ versionDetails.timeStamp = item.createdAt; versionObj.versionDetails = versionDetails; //fetch all the other topology/network,opertaion status for the vnf - // versionObj.topologyInfo = $scope.fetchConfigDetails(item); versionObj.topologyInfo = $scope.fetchTopologyInfo(item); versionObj.vnfIdInfo = $scope.fetchVnfId(item); versionObj.serviceStatusInfo= $scope.fetchServiceStatus(item); @@ -475,9 +463,20 @@ myApp.controller('CompareConfigCtrl', ['$scope','$filter', '$http','$window', 'g if ((versionObj.versionDetails.vnfversion == $scope.versionsSelected[0].vnfversion)) { $scope.objCompareModel1 = versionObj; + $scope.version1=true; } else if ((versionObj.versionDetails.vnfversion == $scope.versionsSelected[1].vnfversion)) {$scope.objCompareModel2 = versionObj; - } + $scope.version2=true; + $scope.version3=false; + $scope.version4=false; + }else if((versionObj.versionDetails.vnfversion == $scope.versionsSelected[2].vnfversion)){ + $scope.objCompareModel3 = versionObj; + $scope.version3=true; + $scope.version4=false; + }else if((versionObj.versionDetails.vnfversion == $scope.versionsSelected[3].vnfversion)){ + $scope.objCompareModel4 = versionObj; + $scope.version4=true; + } document.getElementById("view").style.display = "none"; } ); $scope.showResult = true; diff --git a/configbackuprestore/vnfconfigbackupservice/src/main/webapp/js/sdnc-services/sdnc-compareConfig-service.js b/configbackuprestore/vnfconfigbackupservice/src/main/webapp/js/sdnc-services/sdnc-compareConfig-service.js index 7b5c688e..42bafcd9 100644 --- a/configbackuprestore/vnfconfigbackupservice/src/main/webapp/js/sdnc-services/sdnc-compareConfig-service.js +++ b/configbackuprestore/vnfconfigbackupservice/src/main/webapp/js/sdnc-services/sdnc-compareConfig-service.js @@ -34,8 +34,7 @@ myApp.service('deviceConfigService', ['$http','VNF_API_BASE', function($http, VN }); }; - - + this.getAllVNF = function() { var testlist = {}; return $http.get('/getAllBackupVnfIds') @@ -51,11 +50,24 @@ myApp.service('deviceConfigService', ['$http','VNF_API_BASE', function($http, VN }; + this.getAllVnfIds = function() { + var rctestlist = {}; + return $http.get('/getAllVnfIds') + .then(function(response) { + console.log("---validationTestService::getAllVNF From Restconf::TestResponse---" + JSON.stringify(response)); + vnflist = response.data; + return vnflist; + }, + function(response) { + console.log("validationTestService::getAllVNF From Restconf::Status Code", response.status); + return response; + }); + + }; + this.getVersions = function(vnfId) { var data = {}; -// data.selectedVnfName = vnfName; -// data.selectedVnfType = vnfType; data.vnfId = vnfId; var config = { params: data, @@ -67,15 +79,9 @@ myApp.service('deviceConfigService', ['$http','VNF_API_BASE', function($http, VN console.log("deviceConfigService::getVersions::config", JSON.stringify(config)); var baseUrl = VNF_API_BASE; - // var baseApi='runtest'; - // var apiUrl= baseUrl + baseApi; - - // Call the pre validation service var request = { method: 'GET', url: '/configDetailsById/'+vnfId, - //url: 'sdnc-stubs/getAllConfigForVNF.json', - //data: data, headers: { 'Content-Type': 'application/json', @@ -144,22 +150,6 @@ myApp.service('deviceConfigService', ['$http','VNF_API_BASE', function($http, VN console.log("validationTestService::getAllVNF::Status Code", response); return newConfig; }); - /*.then(function (response) { - if (response.data) - { $scope.successMessage1 = "Put Data Method Executed Successfully!"; - return response; - } - var status= response.status; - if (status == 200){ - $window.alert("applyed successfully "); - } - var successMessage1 = "Put Data Method Executed Successfully!"; - }, - function (response) { - var successMessage1 = "Service not Exists"; - }); - - */ }; |