summaryrefslogtreecommitdiffstats
path: root/configbackuprestore/vnfconfigbackupservice/src/main/webapp/js/sdnc-controller/sdnc-applyConfig-controller.js
diff options
context:
space:
mode:
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.js55
1 files changed, 34 insertions, 21 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