X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=POLICY-SDK-APP%2Fsrc%2Fmain%2Fwebapp%2Fapp%2FpolicyApp%2Fcontroller%2FdictionaryController%2FMSModelsDictController.js;h=abecfdbbdb6763d11892c6bc2939e35dde3d4e0e;hb=a61c10945456dde51397d354379257c7d0d01fb2;hp=3165b1b9828a223e37d0821bde693098696061c0;hpb=cb802d83533ff13886f08b6b9ecb8827bb86d90c;p=policy%2Fengine.git 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..abecfdbbd 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 @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP Policy Engine * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -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; @@ -58,11 +65,12 @@ app.controller('editMSModelController' , function ($scope, $modalInstance, mess $scope.modalDatas = data.modelDatas; $scope.modelType= data.modelType; $scope.dataOrderInfo= data.dataOrderInfo; + $scope.ruleFormation = data.ruleFormation; 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; } @@ -71,7 +79,7 @@ app.controller('editMSModelController' , function ($scope, $modalInstance, mess $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, dataOrderInfo:$scope.dataOrderInfo}; + var postData={microServiceModelsDictionaryData: microServiceModelsDictionaryData, userid: userid, classMap: $scope.modalDatas,modelType:$scope.modelType, dataOrderInfo:$scope.dataOrderInfo, ruleFormation:$scope.ruleFormation}; $.ajax({ type : 'POST', url : uuu, @@ -101,4 +109,4 @@ app.controller('editMSModelController' , function ($scope, $modalInstance, mess $scope.close = function() { $modalInstance.close(); }; -}); \ No newline at end of file +});