From dd065f3dbb499762a39bddf0afe794e9b4aa67ec Mon Sep 17 00:00:00 2001 From: Soumendu Sekhar Acharya Date: Tue, 25 Sep 2018 18:30:17 +0530 Subject: Refactor code and fix some ui issues Refactor code for SDNC-256 user story and fix some ui allignment issues Change-Id: I99811da092afc967d49ee7214c333d84ed458725 Issue-ID: SDNC-465 Signed-off-by: Soumendu Sekhar Acharya Former-commit-id: ec3d47bd91eb653a20c98a79a4d6af645f098aa3 --- .../sdnc-controller/sdnc-applyConfig-controller.js | 55 +++++++++++++--------- 1 file changed, 34 insertions(+), 21 deletions(-) (limited to 'configbackuprestore/vnfconfigbackupservice/src/main/webapp/js/sdnc-controller/sdnc-applyConfig-controller.js') 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 -- cgit 1.2.3-korg