Code Review
/
policy
/
engine.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Add More Validations on TOSCA Model Format
[policy/engine.git]
/
POLICY-SDK-APP
/
src
/
main
/
webapp
/
app
/
policyApp
/
controller
/
dictionaryController
/
MSModelsDictController.js
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
105225a
..
262b2ad
100644
(file)
--- 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) {
$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'){
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, {
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){
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;
Notification.error(data.errorMsg);
valid = false;
return;
@@
-57,11
+64,12
@@
app.controller('editMSModelController' , function ($scope, $modalInstance, mess
$scope.classListDatas=data.classListDatas;
$scope.modalDatas = data.modelDatas;
$scope.modelType= data.modelType;
$scope.classListDatas=data.classListDatas;
$scope.modalDatas = data.modelDatas;
$scope.modelType= data.modelType;
+ $scope.dataOrderInfo= data.dataOrderInfo;
console.log($scope.classListDatas);
}
}).error( );
}else{
console.log($scope.classListDatas);
}
}).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;
}
valid = false;
}
@@
-70,7
+78,7
@@
app.controller('editMSModelController' , function ($scope, $modalInstance, mess
$scope.saveMSModel = function(microServiceModelsDictionaryData) {
if(valid){
var uuu = "saveDictionary/ms_dictionary/save_model";
$scope.saveMSModel = function(microServiceModelsDictionaryData) {
if(valid){
var uuu = "saveDictionary/ms_dictionary/save_model";
- var postData={microServiceModelsDictionaryData: microServiceModelsDictionaryData, userid: userid, classMap: $scope.modalDatas,modelType:$scope.modelType};
+ var postData={microServiceModelsDictionaryData: microServiceModelsDictionaryData, userid: userid, classMap: $scope.modalDatas,modelType:$scope.modelType
, dataOrderInfo:$scope.dataOrderInfo
};
$.ajax({
type : 'POST',
url : uuu,
$.ajax({
type : 'POST',
url : uuu,