X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=POLICY-SDK-APP%2Fsrc%2Fmain%2Fwebapp%2Fapp%2FpolicyApp%2Fpolicy-models%2FEditor%2FPolicyTemplateController%2FDecisionPolicyController.js;h=4b5a990efd9625582778774204011717bccc70aa;hb=eb654437ee2815028602daa943d0a939a5bee3cd;hp=e7858d7b5c4d65b6e08c4699de75d18bc305f1ea;hpb=bb927b5325d7b82cdc65bf25aa217ad7c56a46b3;p=policy%2Fengine.git diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/DecisionPolicyController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/DecisionPolicyController.js index e7858d7b5..4b5a990ef 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/DecisionPolicyController.js +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/DecisionPolicyController.js @@ -80,8 +80,6 @@ angular.module('abs').controller('decisionPolicyController', ['$scope', 'PolicyA console.log("failed"); }); - - function extend(obj, src) { for (var key in src) { if (src.hasOwnProperty(key)) obj[key] = src[key]; @@ -171,6 +169,13 @@ angular.module('abs').controller('decisionPolicyController', ['$scope', 'PolicyA if(!$scope.temp.policy.yamlparams.blackList){ $scope.temp.policy.yamlparams.blackList = []; } + if(!$scope.temp.policy.rainyday){ + $scope.temp.policy.rainyday = {}; + } + if(!$scope.temp.policy.rainyday.treatmentTableChoices){ + $scope.temp.policy.rainyday.treatmentTableChoices = []; + } + }else if($scope.temp.policy.ruleProvider=="Custom"){ if($scope.temp.policy.attributes.length == 0){ $scope.temp.policy.attributes = []; @@ -182,8 +187,12 @@ angular.module('abs').controller('decisionPolicyController', ['$scope', 'PolicyA $scope.temp.policy.ruleAlgorithmschoices = []; } }else if($scope.temp.policy.ruleProvider=="GUARD_BL_YAML"){ - if($scope.temp.policy.yamlparams.blackList.length==0){ - $scope.temp.policy.yamlparams.blackList = []; + if($scope.temp.policy.yamlparams.blackList.length==0){ + $scope.temp.policy.yamlparams.blackList = []; + } + }else if($scope.temp.policy.ruleProvider=="Rainy_Day"){ + if($scope.temp.policy.rainyday.treatmentTableChoices == null || $scope.temp.policy.rainyday.treatmentTableChoices.length == 0){ + $scope.temp.policy.rainyday.treatmentTableChoices = []; } } $scope.attributeDatas = [{"attributes" : $scope.temp.policy.attributes}]; @@ -196,7 +205,6 @@ angular.module('abs').controller('decisionPolicyController', ['$scope', 'PolicyA $scope.temp.policy.attributes.splice(lastItem); }; - $scope.settingsDatas = [{"settings" : $scope.temp.policy.settings}]; $scope.addNewSettingsChoice = function() { var newItemNo = $scope.temp.policy.settings.length+1; @@ -215,6 +223,15 @@ angular.module('abs').controller('decisionPolicyController', ['$scope', 'PolicyA $scope.temp.policy.yamlparams.blackList.splice(lastItem); }; + $scope.treatmentDatas = [{"treatmentValues" : $scope.temp.policy.rainyday.treatmentTableChoices}]; + $scope.addNewTreatment = function() { + $scope.temp.policy.rainyday.treatmentTableChoices.push({}); + }; + $scope.removeTreatment = function() { + var lastItem = $scope.temp.policy.rainyday.treatmentTableChoices.length-1; + $scope.temp.policy.rainyday.treatmentTableChoices.splice(lastItem); + }; + $scope.ItemNo = 0; $scope.ruleAlgorithmDatas = [{"ruleAlgorithms" : $scope.temp.policy.ruleAlgorithmschoices }];