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=72b6f06ca227661d196e474d51a34f1a5decfb65;hb=e92ff832cf993db876f22b2d27562fedf59f5043;hp=4b5a990efd9625582778774204011717bccc70aa;hpb=570290dc6ba8198e653022c2f6f8e5d01cfa8d1b;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 4b5a990ef..72b6f06ca 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,6 +80,26 @@ angular.module('abs').controller('decisionPolicyController', ['$scope', 'PolicyA console.log("failed"); }); + PolicyAppService.getData('getDictionary/get_RainyDayDictionaryDataByName').then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.rainyDayDictionaryDatas = JSON.parse($scope.data.rainyDayDictionaryDatas); + console.log($scope.rainyDayDictionaryDatas); + }, function (error) { + console.log("failed"); + }); + + PolicyAppService.getData('getDictionary/get_RainyDayDictionaryData').then(function (data) { + var j = data; + $scope.data = JSON.parse(j.data); + console.log($scope.data); + $scope.rainyDayDictionaryDataEntity = JSON.parse($scope.data.rainyDayDictionaryDatas); + console.log($scope.rainyDayDictionaryDatasEntity); + }, function (error) { + console.log("failed"); + }); + function extend(obj, src) { for (var key in src) { if (src.hasOwnProperty(key)) obj[key] = src[key]; @@ -166,6 +186,9 @@ angular.module('abs').controller('decisionPolicyController', ['$scope', 'PolicyA if(!$scope.temp.policy.yamlparams){ $scope.temp.policy.yamlparams = {}; } + if(!$scope.temp.policy.yamlparams.targets){ + $scope.temp.policy.yamlparams.targets = []; + } if(!$scope.temp.policy.yamlparams.blackList){ $scope.temp.policy.yamlparams.blackList = []; } @@ -178,7 +201,7 @@ angular.module('abs').controller('decisionPolicyController', ['$scope', 'PolicyA }else if($scope.temp.policy.ruleProvider=="Custom"){ if($scope.temp.policy.attributes.length == 0){ - $scope.temp.policy.attributes = []; + $scope.temp.policy.attributes = []; } if($scope.temp.policy.settings.length == 0){ $scope.temp.policy.settings = []; @@ -190,6 +213,10 @@ angular.module('abs').controller('decisionPolicyController', ['$scope', 'PolicyA if($scope.temp.policy.yamlparams.blackList.length==0){ $scope.temp.policy.yamlparams.blackList = []; } + }else if($scope.temp.policy.ruleProvider=="GUARD_YAML"){ + if($scope.temp.policy.yamlparams.targets.length==0){ + $scope.temp.policy.yamlparams.targets = []; + } }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 = []; @@ -215,6 +242,14 @@ angular.module('abs').controller('decisionPolicyController', ['$scope', 'PolicyA $scope.temp.policy.settings.splice(lastItem); }; + $scope.addNewTarget = function(){ + $scope.temp.policy.yamlparams.targets.push(''); + }; + $scope.removeTarget = function(){ + var lastItem = $scope.temp.policy.yamlparams.targets.length-1; + $scope.temp.policy.yamlparams.targets.splice(lastItem); + }; + $scope.addNewBL = function() { $scope.temp.policy.yamlparams.blackList.push(''); }; @@ -232,6 +267,29 @@ angular.module('abs').controller('decisionPolicyController', ['$scope', 'PolicyA $scope.temp.policy.rainyday.treatmentTableChoices.splice(lastItem); }; + $scope.workstepDictionaryDatas = []; + $scope.getWorkstepValues = function(bbidValue){ + for (var i = 0; i < $scope.rainyDayDictionaryDataEntity.length; ++i) { + var obj = $scope.rainyDayDictionaryDataEntity[i]; + if (obj.bbid == bbidValue){ + $scope.workstepDictionaryDatas.push(obj.workstep); + } + } + }; + + $scope.allowedTreatmentsDatas = []; + $scope.getTreatmentValues = function(bbidValue, workstepValue){ + for (var i = 0; i < $scope.rainyDayDictionaryDataEntity.length; ++i) { + var obj = $scope.rainyDayDictionaryDataEntity[i]; + if (obj.bbid == bbidValue && obj.workstep == workstepValue){ + var splitAlarm = obj.treatments.split(','); + for (var j = 0; j < splitAlarm.length; ++j) { + $scope.allowedTreatmentsDatas.push(splitAlarm[j]); + } + } + } + }; + $scope.ItemNo = 0; $scope.ruleAlgorithmDatas = [{"ruleAlgorithms" : $scope.temp.policy.ruleAlgorithmschoices }];