diff options
author | 2018-04-03 16:17:54 -0500 | |
---|---|---|
committer | 2018-04-03 17:00:10 -0500 | |
commit | ff0146fb327dbe5f27b0bd29640f3ace54006d92 (patch) | |
tree | 751832c2d010ad43b5fbda75f3060cd5c16d8f56 /POLICY-SDK-APP/src/main/webapp/app/policyApp/controller | |
parent | 11eb39f53842dff62e81a38ab599ddbc97cf7b73 (diff) |
Add More Validations on TOSCA Model Format
Add more validations on TOSCA MS model file name and content format
Issue-ID: POLICY-721
Change-Id: Ic3dfe1887791be1e11bca5695866a77909334536
Signed-off-by: Wang,Frank(gw1218) <gw1218@att.com>
Diffstat (limited to 'POLICY-SDK-APP/src/main/webapp/app/policyApp/controller')
-rw-r--r-- | POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/MSModelsDictController.js | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/MSModelsDictController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/MSModelsDictController.js index 3165b1b98..262b2adea 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/MSModelsDictController.js +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/MSModelsDictController.js @@ -36,9 +36,16 @@ app.controller('editMSModelController' , function ($scope, $modalInstance, mess $scope.editMSmodelName = message.microServiceModelsDictionaryData; $scope.uploadFile = function(files) { + valid = true; var extn = files[0].name.substr(files[0].name.lastIndexOf('.')+1); if(extn == 'zip' || extn == 'xmi'|| extn == 'yml'){ - valid = true; + if(extn == 'yml'){ + if(!files[0].name.includes("-v")){ + Notification.error("File name should contain -v, such as myModel-v123.yml"); + valid = false; + return; + } + } var fd = new FormData(); fd.append("file", files[0]); $http.post("ms_dictionary/set_MSModelData", fd, { @@ -46,7 +53,7 @@ app.controller('editMSModelController' , function ($scope, $modalInstance, mess headers: {'Content-Type': undefined }, transformRequest: angular.identity }).success(function(data){ - if(data.errorMsg != undefined){ + if(data.errorMsg != undefined || data.errorMsg != null){ Notification.error(data.errorMsg); valid = false; return; @@ -62,7 +69,7 @@ app.controller('editMSModelController' , function ($scope, $modalInstance, mess } }).error( ); }else{ - Notification.error("Micro Service Model Upload file should ends with .zip or .xmi extension"); + Notification.error("Micro Service Model Upload file should ends with .zip .yml or .xmi extension"); valid = false; } |