diff options
author | 2018-09-06 12:46:04 +0530 | |
---|---|---|
committer | 2018-09-12 13:10:46 +0000 | |
commit | 43d4b00848ebd0567b020fe219f07d4f7049ff0b (patch) | |
tree | f5c09d0006348c82a94693605349e79db4889b71 /configbackuprestore/vnfconfigbackupservice/src/main/webapp/js/sdnc-controller/sdnc-applyConfig-controller.js | |
parent | 4e2db0d6e56bc19425e6afa3efc7011820942e9e (diff) |
Epic-231:versioning, and backup the configuration
Merging the sdnc jira stories- 255,256
Change-Id: Iacb9274dae93f534f1331c4eb7d0669896d379d4
Issue-ID: SDNC-256
Signed-off-by: DushyantSinghThakur <dt00503496@techmahindra.com>
Former-commit-id: 94d8b3d82b82dedfd5949da2e5d1ed348ab066e2
Diffstat (limited to 'configbackuprestore/vnfconfigbackupservice/src/main/webapp/js/sdnc-controller/sdnc-applyConfig-controller.js')
-rw-r--r-- | configbackuprestore/vnfconfigbackupservice/src/main/webapp/js/sdnc-controller/sdnc-applyConfig-controller.js | 93 |
1 files changed, 93 insertions, 0 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 new file mode 100644 index 00000000..faff3633 --- /dev/null +++ b/configbackuprestore/vnfconfigbackupservice/src/main/webapp/js/sdnc-controller/sdnc-applyConfig-controller.js @@ -0,0 +1,93 @@ +myApp.controller('ApplyConfigCtrl', ['$scope','$window', '$http', 'growl', 'deviceConfigService', 'ObjectDiff', function($scope, $http,$window, growl, deviceConfigService, ObjectDiff) { + + $scope.showResult = false; + + //THIS FUNCTION WILL BE CALLED ON PAGE LOAD + $scope.getAllVNFFromRc = function() { + + deviceConfigService.getAllVNFFromRc().then(function(data) { + if (data != null) { + console.log(data); + $scope.objvnfList = data; + console.log("CompareConfigCtrl:getAllVNFFromRc called" + $scope.objvnfList); + } else { + $scope.warningMessage = "No VNF is eligible for configuration!!!"; + growl.error($scope.warningMessage, { + title: 'Warning!', + globalDisableCloseButton: false, + ttl: 7000, + disableCountDown: true + }); + } + }); + }; + $scope.getAllVNFFromRc(); + + + + $scope.selectVnf = function(selectedValueVnf) { + + var vnfId = selectedValueVnf; + + $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){ + $scope.errorMessage = "VNF Id is different!!! Select different file and try again"; + growl.error($scope.errorMessage, { + title: 'Error!', + globalDisableCloseButton: false, + ttl: 7000, + disableCountDown: true + }); + } + else{ + + $scope.apply(); + + } + } + aReader.onerror = function (evt) { + $scope.fileContent = "error"; + } + } + $scope.successMessagebool1 = false; + $scope.apply = function() { + if (file) { + deviceConfigService.runApplyconfig(vnfId,result1); + $scope.successMessage = "File uploaded successfully"; + growl.success($scope.successMessage, { + title: 'Success!', + globalDisableCloseButton: false, + ttl: 7000, + disableCountDown: true + }); + $scope.successMessagebool1 = true; + + + } }; + + } + + } + + +}]); + |