aboutsummaryrefslogtreecommitdiffstats
path: root/POLICY-SDK-APP/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'POLICY-SDK-APP/src/main')
-rw-r--r--POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/DecisionPolicyController.java51
-rw-r--r--POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/PolicyValidationController.java29
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/Dictionary/DecisionRainyDayDictionary.html73
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/DictionaryController.js2
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/DecisionRainyDayDictController.js100
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/DecisionRainyDayDictGridController.js153
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/main/policyEditor.html3
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Dictionary/DecisionRainyDayDictionary.html22
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/DecisionPolicyController.js27
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/DecisionPolicyTemplate.html93
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/policy_Dictionary.html1
11 files changed, 546 insertions, 8 deletions
diff --git a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/DecisionPolicyController.java b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/DecisionPolicyController.java
index 28278062d..ef43135c2 100644
--- a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/DecisionPolicyController.java
+++ b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/DecisionPolicyController.java
@@ -32,12 +32,15 @@ import javax.xml.bind.JAXBElement;
import org.openecomp.policy.common.logging.flexlogger.FlexLogger;
import org.openecomp.policy.common.logging.flexlogger.Logger;
import org.openecomp.policy.rest.adapter.PolicyRestAdapter;
+import org.openecomp.policy.rest.adapter.RainyDayParams;
import org.openecomp.policy.rest.adapter.YAMLParams;
import org.openecomp.policy.rest.jpa.PolicyEntity;
import org.openecomp.portalsdk.core.controller.RestrictedBaseController;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
+import oasis.names.tc.xacml._3_0.core.schema.wd_17.AdviceExpressionType;
+import oasis.names.tc.xacml._3_0.core.schema.wd_17.AdviceExpressionsType;
import oasis.names.tc.xacml._3_0.core.schema.wd_17.AllOfType;
import oasis.names.tc.xacml._3_0.core.schema.wd_17.AnyOfType;
import oasis.names.tc.xacml._3_0.core.schema.wd_17.ApplyType;
@@ -63,6 +66,7 @@ public class DecisionPolicyController extends RestrictedBaseController {
private ArrayList<Object> attributeList;
private ArrayList<Object> decisionList;
private ArrayList<Object> ruleAlgorithmList;
+ private ArrayList<Object> treatmentList = null;
protected LinkedList<Integer> ruleAlgoirthmTracker;
public static final String FUNCTION_NOT = "urn:oasis:names:tc:xacml:1.0:function:not";
@@ -71,7 +75,10 @@ public class DecisionPolicyController extends RestrictedBaseController {
attributeList = new ArrayList<>();
decisionList = new ArrayList<>();
ruleAlgorithmList = new ArrayList<>();
+ treatmentList = new ArrayList<>();
+
if (policyAdapter.getPolicyData() instanceof PolicyType) {
+ RainyDayParams rainydayParams = new RainyDayParams();
Object policyData = policyAdapter.getPolicyData();
PolicyType policy = (PolicyType) policyData;
policyAdapter.setOldPolicyFileName(policyAdapter.getPolicyName());
@@ -133,6 +140,24 @@ public class DecisionPolicyController extends RestrictedBaseController {
}
}
}
+ // Setting rainy day attributes to the parameters object if they exist
+ if(!attributeList.isEmpty()) {
+ for(int i=0; i<attributeList.size() ; i++){
+ Map<String, String> map = (Map<String,String>)attributeList.get(i);
+ if(map.get("key").equals("WorkStep")){
+ rainydayParams.setWorkstep(map.get("value"));
+ }else if(map.get("key").equals("BB_ID")){
+ rainydayParams.setBbid(map.get("value"));
+ }else if(map.get("key").equals("ServiceType")){
+ rainydayParams.setServiceType(map.get("value"));
+ }else if(map.get("key").equals("VNFType")){
+ rainydayParams.setVnfType(map.get("value"));
+ }
+ }
+ }
+
+ policyAdapter.setRuleProvider("Rainy_Day");
+
}
List<Object> ruleList = policy.getCombinerParametersOrRuleCombinerParametersOrVariableDefinition();
@@ -203,15 +228,40 @@ public class DecisionPolicyController extends RestrictedBaseController {
prePopulateDecisionCompoundRuleAlgorithm(index, decisionApply);
policyAdapter.setRuleAlgorithmschoices(ruleAlgorithmList);
}
+ } else if (((RuleType) object).getEffect().equals(EffectType.PERMIT)) {
+
+ TargetType ruleTarget = ((RuleType) object).getTarget();
+ AdviceExpressionsType adviceExpression = ((RuleType) object).getAdviceExpressions();
+
+ String errorcode = ruleTarget.getAnyOf().get(0).getAllOf().get(0).getMatch().
+ get(1).getAttributeValue().getContent().get(0).toString();
+ JAXBElement<AttributeValueType> tempTreatmentObj = (JAXBElement<AttributeValueType>) adviceExpression.getAdviceExpression().
+ get(0).getAttributeAssignmentExpression().get(0).getExpression();
+ String treatment = tempTreatmentObj.getValue().getContent().get(0).toString();
+
+ prePopulateRainyDayTreatments(errorcode, treatment);
+
}
}
}
}
+
+ rainydayParams.setTreatmentTableChoices(treatmentList);
+ policyAdapter.setRainyday(rainydayParams);
policyAdapter.setSettings(decisionList);
}
}
+ private void prePopulateRainyDayTreatments(String errorcode, String treatment) {
+ Map<String, String> ruleMap = new HashMap<>();
+
+ ruleMap.put("errorcode", errorcode);
+ ruleMap.put("treatment", treatment);
+ treatmentList.add(ruleMap);
+
+ }
+
private void prePopulateDecisionRuleAlgorithms(int index, ApplyType decisionApply, List<JAXBElement<?>> jaxbDecisionTypes) {
Map<String, String> ruleMap = new HashMap<>();
ruleMap.put("id", "A" + (index +1));
@@ -293,6 +343,7 @@ public class DecisionPolicyController extends RestrictedBaseController {
ruleAlgorithmList.add(rule);
index++;
}
+
return index;
}
}
diff --git a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/PolicyValidationController.java b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/PolicyValidationController.java
index ed47fd949..cc6903b91 100644
--- a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/PolicyValidationController.java
+++ b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/PolicyValidationController.java
@@ -438,6 +438,35 @@ public class PolicyValidationController extends RestrictedBaseController {
responseString.append("Ecomp Name: Ecomp Name Should not be empty" + "<br>");
valid = false;
}
+
+ if("Rainy_Day".equals(policyData.getRuleProvider())){
+ if(policyData.getRainyday()==null){
+ responseString.append("<b> Rainy Day Parameters are Required </b><br>");
+ valid = false;
+ }else{
+ if(policyData.getRainyday().getServiceType()==null){
+ responseString.append("Rainy Day <b>Service Type</b> is Required<br>");
+ valid = false;
+ }
+ if(policyData.getRainyday().getVnfType()==null){
+ responseString.append("Rainy Day <b>VNF Type</b> is Required<br>");
+ valid = false;
+ }
+ if(policyData.getRainyday().getBbid()==null){
+ responseString.append("Rainy Day <b>Building Block ID</b> is Required<br>");
+ valid = false;
+ }
+ if(policyData.getRainyday().getWorkstep()==null){
+ responseString.append("Rainy Day <b>Work Step</b> is Required<br>");
+ valid = false;
+ }
+ if(policyData.getRainyday().getServiceType()==null){
+ responseString.append("Rainy Day <b>Error Code</b> is Required<br>");
+ valid = false;
+ }
+ }
+ }
+
if("GUARD_YAML".equals(policyData.getRuleProvider()) || "GUARD_BL_YAML".equals(policyData.getRuleProvider())){
if(policyData.getYamlparams()==null){
responseString.append("<b> Guard Params are Required </b>" + "<br>");
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/Dictionary/DecisionRainyDayDictionary.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/Dictionary/DecisionRainyDayDictionary.html
new file mode 100644
index 000000000..62f5a4800
--- /dev/null
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/Dictionary/DecisionRainyDayDictionary.html
@@ -0,0 +1,73 @@
+<!--/*-
+ * ============LICENSE_START=======================================================
+ * ECOMP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */-->
+<script type="text/ng-template" id="add_RainyDayDict_popup.html">
+<div class="modal" tabindex="-1">
+ <div class="modal-dialog modal-lg">
+ <div class="modal-content">
+ <div class="modal-header ng-scope in">
+ <h2 class="font-showcase-font-name" style="color: #157bb2">{{label}}</h2>
+ </div>
+ <form name="formdata" ng-submit="saveDecisionTreatments(editRainyDayTreatment);" novalidate>
+ <div class="modal-body ng-scope ng-isolate-scope in">
+ <div class="form-group row">
+ <div class="form-group col-sm-6" ng-class="{ 'has-error' : formdata.bbid.$invalid && !formdata.bbid.$pristine }">
+ <label>Building Block ID:<sup><b>*</b></sup></label><br>
+ <input class="form-control" type="text" ng-model="editRainyDayTreatment.bbid" name="bbid" required />
+ <p ng-show="formdata.bbid.$invalid && !formdata.bbid.$pristine" class="help-block">Building Block ID is required.</p>
+ </div>
+ </div>
+ <div class="form-group row">
+ <div class="form-group col-sm-6" ng-class="{ 'has-error' : formdata.workstep.$invalid && !formdata.workstep.$pristine }">
+ <label>Work Step:<sup><b>*</b></sup></label><br>
+ <input type="text" ng-model="editRainyDayTreatment.workstep" class="form-control" />
+ <p ng-show="formdata.workstep.$invalid && !formdata.workstep.$pristine" class="help-block">Work Step is required.</p>
+ </div>
+ </div>
+ <div class="form-group row">
+ <div class="form-group col-sm-4">
+ <label>Allowed Treatments<sup><b>*</b></sup></label><br>
+ <button type="button" class="btn btn-secondary btn-small" ng-click="addNewTreatment()"><i class="fa fa-plus"></i></button>
+ </div>
+ </div>
+ <div class="form-group">
+ <div data-ng-repeat="choice in treatments">
+ <div class="form-group row">
+ <div class="form-group col-sm-5" ng-class="{ 'has-error' : formdata.treatment.$invalid && !formdata.treatment.$pristine }">
+ <input type="text" class="form-control" ng-model="choice.treatment" maxlength="30" name="treatment" required />
+ <p ng-show="formdata.treatment.$invalid && !formdata.treatment.$pristine" class="help-block">Treatment Value is required.</p>
+ </div>
+ <div class="form-group col-sm-1">
+ <button type="button" class="btn btn-secondary btn-small" ng-show="$last" ng-click="removeTreatment()"><i class="fa fa-minus"></i></button>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ <div class="modal-footer">
+ <button class="btn btn-success" type="submit" ng-disabled="formdata.$invalid">Save</button>
+ <button type="button" class="btn btn-default" ng-click="$dismiss('cancel')">Close</button>
+ </div>
+ </form>
+</div>
+</div>
+</div>
+</div>
+</div>
+</script>
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/DictionaryController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/DictionaryController.js
index 243591f22..cf0d0961c 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/DictionaryController.js
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/DictionaryController.js
@@ -24,7 +24,7 @@ var subDictionarys = [["Action Dictionary"],
["BRMS Controller" , "BRMS Dependency", "BRMS Param Template"],
["Attribute Dictionary","EcompName Dictionary"],
["PEP Options","Site Dictionary","Service Dictionary","Varbind Dictionary", "VNF Type","VSCL Action"],
- ["Settings Dictionary"],
+ ["Settings Dictionary","Rainy Day Allowed Treatments"],
["Descriptive Scope"],
["Action List", "Address Group", "Parent Dictionary List", "Port List", "Prefix List", "Protocol List", "Security Zone", "Service Group", "Service List", "Tag List", "Tag Picker List", "Term List", "Zone"],
["DCAE UUID","MicroService ConfigName","MicroService Location", "MicroService Models", "MicroService Dictionary"],
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/DecisionRainyDayDictController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/DecisionRainyDayDictController.js
new file mode 100644
index 000000000..fc34fa7ca
--- /dev/null
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/DecisionRainyDayDictController.js
@@ -0,0 +1,100 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ECOMP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+app.controller('editRainyDayDictController' , function ($scope, $modalInstance, message, UserInfoServiceDS2, Notification){
+
+ if(message.rainyDayDictionaryData==null)
+ $scope.label='Add Allowed Treatments',
+ $scope.treatments = [];
+ else{
+ $scope.treatments = [];
+ $scope.label='Edit Treatment'
+ $scope.disableCd=true;
+ var headers = message.rainyDayDictionaryData.treatments;
+ var splitEqual = ',';
+ if(headers != null && headers != ""){
+ if (headers.indexOf(splitEqual) >= 0) {
+ var splitValue = headers.split(splitEqual);
+ for(i = 0; i < splitValue.length; i++){
+ var key = splitValue[i];
+ $scope.treatments.push({'treatment': key});
+ }
+ }else{
+ var key = headers;
+ $scope.treatments.push({'treatment': key});
+ }
+ }
+ }
+
+
+ /*getting user info from session*/
+ var userid = null;
+ UserInfoServiceDS2.getFunctionalMenuStaticDetailSession()
+ .then(function (response) {
+ userid = response.userid;
+ });
+
+ $scope.editRainyDayTreatment = message.rainyDayDictionaryData;
+ $scope.saveDecisionTreatments = function(rainyDayDictionaryData) {
+ var finalData = extend(rainyDayDictionaryData, $scope.treatmentDatas[0]);
+ var uuu = "saveDictionary/decision_dictionary/save_RainyDay";
+ var postData={rainyDayDictionaryData: rainyDayDictionaryData, userid: userid};
+ $.ajax({
+ type : 'POST',
+ url : uuu,
+ dataType: 'json',
+ contentType: 'application/json',
+ data: JSON.stringify(postData),
+ success : function(data){
+ $scope.$apply(function(){
+ $scope.rainyDayDictionaryDatas=data.rainyDayDictionaryDatas;});
+ if($scope.rainyDayDictionaryDatas == "Duplicate"){
+ Notification.error("Allowed Treatments Dictionary exists with Same Building Block and Workstep.")
+ }else{
+ console.log($scope.rainyDayDictionaryDatas);
+ $modalInstance.close({rainyDayDictionaryDatas:$scope.rainyDayDictionaryDatas});
+ }
+ },
+ error : function(data){
+ alert("Error while saving.");
+ }
+ });
+ };
+
+ function extend(obj, src) {
+ for (var key in src) {
+ if (src.hasOwnProperty(key)) obj[key] = src[key];
+ }
+ return obj;
+ }
+
+ $scope.treatmentDatas = [{"userDataTypeValues" : $scope.treatments}];
+ $scope.addNewTreatment = function() {
+ $scope.treatments.push({});
+ };
+ $scope.removeTreatment = function() {
+ var lastItem = $scope.treatments.length-1;
+ $scope.treatments.splice(lastItem);
+ };
+
+
+ $scope.close = function() {
+ $modalInstance.close();
+ };
+}); \ No newline at end of file
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/DecisionRainyDayDictGridController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/DecisionRainyDayDictGridController.js
new file mode 100644
index 000000000..e4fa18645
--- /dev/null
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/DecisionRainyDayDictGridController.js
@@ -0,0 +1,153 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ECOMP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+app.controller('decisionRainyDayDictGridController', function ($scope, PolicyAppService, modalService, $modal){
+ $( "#dialog" ).hide();
+
+ PolicyAppService.getData('getDictionary/get_RainyDayDictionaryData').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('get_LockDownData').then(function(data){
+ var j = data;
+ $scope.data = JSON.parse(j.data);
+ $scope.lockdowndata = JSON.parse($scope.data.lockdowndata);
+ if($scope.lockdowndata[0].lockdown == true){
+ $scope.decisionRainyDayDictionaryGrid.columnDefs[0].visible = false;
+ $scope.gridApi.grid.refresh();
+ }else{
+ $scope.decisionRainyDayDictionaryGrid.columnDefs[0].visible = true;
+ $scope.gridApi.grid.refresh();
+ }
+ },function(error){
+ console.log("failed");
+ });
+ $scope.decisionRainyDayDictionaryGrid = {
+ data : 'rainyDayDictionaryDatas',
+ enableFiltering: true,
+ exporterCsvFilename: 'AllowedTreatments.csv',
+ enableGridMenu: true,
+ enableSelectAll: true,
+ columnDefs: [{
+ field: 'id', enableFiltering: false, headerCellTemplate: '' +
+ '<button id=\'New\' ng-click="grid.appScope.createNewRainyDayDictWindow()" class="btn btn-success">' + 'Create</button>',
+ cellTemplate:
+ '<button type="button" class="btn btn-primary" ng-click="grid.appScope.editRainyDayDictWindow(row.entity)"><i class="fa fa-pencil-square-o"></i></button> ' +
+ '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deleteRainyDayDict(row.entity)" ><i class="fa fa-trash-o"></i></button> ', width: '8%'
+ },
+ {field: 'bbid', displayName : 'Building Block ID', sort: { direction: 'asc', priority: 0 }},
+ {field: 'workstep', displayName : 'Work Step' },
+ {field: 'treatments', displayName : 'Allowed Treatments'}
+ ],
+ exporterMenuPdf: false,
+ exporterPdfDefaultStyle: {fontSize: 9},
+ exporterPdfTableStyle: {margin: [30, 30, 30, 30]},
+ exporterPdfTableHeaderStyle: {fontSize: 10, bold: true, italics: true, color: 'red'},
+ exporterPdfHeader: { text: "My Header", style: 'headerStyle' },
+ exporterPdfFooter: function ( currentPage, pageCount ) {
+ return { text: currentPage.toString() + ' of ' + pageCount.toString(), style: 'footerStyle' };
+ },
+ exporterPdfCustomFormatter: function ( docDefinition ) {
+ docDefinition.styles.headerStyle = { fontSize: 22, bold: true };
+ docDefinition.styles.footerStyle = { fontSize: 10, bold: true };
+ return docDefinition;
+ },
+ exporterPdfOrientation: 'portrait',
+ exporterPdfPageSize: 'LETTER',
+ exporterPdfMaxGridWidth: 500,
+ exporterCsvLinkElement: angular.element(document.querySelectorAll(".custom-csv-link-location")),
+ onRegisterApi: function(gridApi){
+ $scope.gridApi = gridApi;
+ }
+ };
+
+ $scope.editRainyDayTreatment = null;
+ $scope.createNewRainyDayDictWindow = function(){
+ $scope.editRainyDayTreatment = null;
+ var modalInstance = $modal.open({
+ backdrop: 'static', keyboard: false,
+ templateUrl : 'add_RainyDayDict_popup.html',
+ controller: 'editRainyDayDictController',
+ resolve: {
+ message: function () {
+ var message = {
+ rainyDayDictionaryDatas: $scope.editRainyDayTreatment
+ };
+ return message;
+ }
+ }
+ });
+ modalInstance.result.then(function(response){
+ console.log('response', response);
+ $scope.rainyDayDictionaryDatas=response.rainyDayDictionaryDatas;
+ });
+ };
+
+ $scope.editRainyDayDictWindow = function(rainyDayDictionaryData) {
+ $scope.editRainyDayTreatment = rainyDayDictionaryData;
+ var modalInstance = $modal.open({
+ backdrop: 'static', keyboard: false,
+ templateUrl : 'add_RainyDayDict_popup.html',
+ controller: 'editRainyDayDictController',
+ resolve: {
+ message: function () {
+ var message = {
+ rainyDayDictionaryData: $scope.editRainyDayTreatment
+ };
+ return message;
+ }
+ }
+ });
+ modalInstance.result.then(function(response){
+ console.log('response', response);
+ $scope.rainyDayDictionaryDatas = response.rainyDayDictionaryDatas;
+ });
+ };
+
+ $scope.deleteRainyDayDict = function(data) {
+ modalService.popupConfirmWin("Confirm","You are about to delete the Rainy Day Allowed Treatment Dictionary "+data.allowedTreatments+". Do you want to continue?",
+ function(){
+ var uuu = "deleteDictionary/decision_dictionary/remove_rainyDay";
+ var postData={data: data};
+ $.ajax({
+ type : 'POST',
+ url : uuu,
+ dataType: 'json',
+ contentType: 'application/json',
+ data: JSON.stringify(postData),
+ success : function(data){
+ $scope.$apply(function(){$scope.rainyDayDictionaryDatas=data.rainyDayDictionaryDatas;});
+ },
+ error : function(data){
+ console.log(data);
+ modalService.showFailure("Fail","Error while deleting: "+ data.responseText);
+ }
+ });
+
+ })
+ };
+
+
+}); \ No newline at end of file
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/main/policyEditor.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/main/policyEditor.html
index fe822d4c3..50a1e53f5 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/main/policyEditor.html
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/main/policyEditor.html
@@ -134,6 +134,7 @@
<script src= "app/policyApp/controller/dictionaryGridController/CLVnfTypeDictGridController.js"></script>
<script src= "app/policyApp/controller/dictionaryGridController/CLVsclActionDictGridController.js"></script>
<script src= "app/policyApp/controller/dictionaryGridController/DecisionSettingsDictGridController.js"></script>
+ <script src= "app/policyApp/controller/dictionaryGridController/DecisionRainyDayDictGridController.js"></script>
<script src= "app/policyApp/controller/dictionaryGridController/DescriptiveScopeDictGridController.js"></script>
<script src= "app/policyApp/controller/dictionaryGridController/EnforcerTypeDictGridController.js"></script>
<script src= "app/policyApp/controller/dictionaryGridController/FWActionListDictGridController.js"></script>
@@ -176,6 +177,7 @@
<script src= "app/policyApp/controller/dictionaryController/CLVnfTypeDictController.js"></script>
<script src= "app/policyApp/controller/dictionaryController/CLVsclActionDictController.js"></script>
<script src= "app/policyApp/controller/dictionaryController/DecisionSettingsDictController.js"></script>
+ <script src= "app/policyApp/controller/dictionaryController/DecisionRainyDayDictController.js"></script>
<script src= "app/policyApp/controller/dictionaryController/DescriptiveSearchDictController.js"></script>
<script src= "app/policyApp/controller/dictionaryController/EnforcerDictController.js"></script>
<script src= "app/policyApp/controller/dictionaryController/FWActionListDictController.js"></script>
@@ -240,6 +242,7 @@
<div ng-include src="'app/policyApp/Windows/Dictionary/CLVnfTypeDictionary.html'"></div>
<div ng-include src="'app/policyApp/Windows/Dictionary/CLVsclActionDictionary.html'"></div>
<div ng-include src="'app/policyApp/Windows/Dictionary/DecisionSettingsDictionary.html'"></div>
+ <div ng-include src="'app/policyApp/Windows/Dictionary/DecisionRainyDayDictionary.html'"></div>
<div ng-include src="'app/policyApp/Windows/Dictionary/DescriptiveScopeDictionary.html'"></div>
<div ng-include src="'app/policyApp/Windows/Dictionary/EcompNameDictionary.html'"></div>
<div ng-include src="'app/policyApp/Windows/Dictionary/EnforcerTypeDictionary.html'"></div>
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Dictionary/DecisionRainyDayDictionary.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Dictionary/DecisionRainyDayDictionary.html
new file mode 100644
index 000000000..a81111518
--- /dev/null
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Dictionary/DecisionRainyDayDictionary.html
@@ -0,0 +1,22 @@
+<!--/*-
+ * ============LICENSE_START=======================================================
+ * ECOMP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */-->
+<div ng-app ng-controller = "decisionRainyDayDictGridController">
+ <div ui-grid = "decisionRainyDayDictionaryGrid" ui-grid-pagination ui-grid-selection ui-grid-resize-columns ui-grid-exporter class= "grid"></div>
+</div> \ No newline at end of file
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 }];
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/DecisionPolicyTemplate.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/DecisionPolicyTemplate.html
index 637ecff03..49fc70df4 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/DecisionPolicyTemplate.html
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/DecisionPolicyTemplate.html
@@ -31,13 +31,102 @@
ng-click="providerListener(temp.policy.ruleProvider);">
<option>Custom</option>
<option>AAF</option>
+ <option>Rainy_Day</option>
<option>GUARD_YAML</option>
<option>GUARD_BL_YAML<option>
</select>
</div>
</div>
</div>
-
+ <div ng-if="temp.policy.ruleProvider == 'Rainy_Day'">
+ <div class="well">
+ <div class="form-group row">
+ <div class="form-group row">
+ <div class="form-group col-sm-1">
+ <label>Service Type:<sup><b>*</b></sup></label>
+ </div>
+ <div class="form-group col-sm-2">
+ <input type="text" class="form-control"
+ ng-disabled="temp.policy.readOnly" ng-model="temp.policy.rainyday.serviceType"
+ placeholder="Service Type" />
+ </div>
+ <div class="form-group col-sm-1">
+ <label>VNF Type:<sup><b>*</b></sup></label>
+ </div>
+ <div class="form-group col-sm-2">
+ <input type="text" class="form-control"
+ ng-disabled="temp.policy.readOnly" ng-model="temp.policy.rainyday.vnfType"
+ placeholder="VNF Type" />
+ </div>
+ <div class="form-group col-sm-1">
+ <label>Building Block ID:<sup><b>*</b></sup></label>
+ </div>
+ <div class="form-group col-sm-2">
+ <input type="text" class="form-control"
+ ng-disabled="temp.policy.readOnly" ng-model="temp.policy.rainyday.bbid"
+ placeholder="Building Block ID" />
+ </div>
+ <div class="form-group col-sm-1">
+ <label>Work Step:<sup><b>*</b></sup></label>
+ </div>
+ <div class="form-group col-sm-2">
+ <input type="text" class="form-control"
+ ng-disabled="temp.policy.readOnly" ng-model="temp.policy.rainyday.workstep"
+ placeholder="Work Step" />
+ </div>
+ </div>
+ <div class="form-group row">
+ <div class="form-group col-sm-3">
+ <label>Desired Automated Treatments:</label>
+ <button type="button" class="btn btn-default"
+ ng-disabled="temp.policy.readOnly"
+ ng-click="addNewTreatment()">
+ <i class="fa fa-plus"></i>
+ </button>
+ </div>
+ </div>
+ <div class="form-group row">
+ <div data-ng-repeat="treatmentTableChoice in temp.policy.rainyday.treatmentTableChoices">
+ <div class="form-group row" style="margin-left: 2%">
+ <div class="form-group col-sm-1">
+ <label>Error Code:<sup><b>*</b></sup></label>
+ </div>
+ <div class="form-group col-sm-3">
+ <input type="text" class="form-control"
+ ng-disabled="temp.policy.readOnly"
+ ng-model="treatmentTableChoice.errorcode"
+ placeholder="Error Code" />
+ </div>
+ <div class="form-group col-sm-1">
+ <label>Desired Treatment:<sup><b>*</b></sup></label>
+ </div>
+ <div class="form-group col-sm-3">
+ <select class="form-control" id="mySelect"
+ ng-disabled="temp.policy.readOnly"
+ ng-model="treatmentTableChoice.treatment"
+ placeholder="Desired Treatment">
+<!-- <option value="">{{tableChoice.desiredtreatment}}</option> -->
+ <option>Rollback</option>
+ <option>Manual Handling</option>
+ <option>Abort</option>
+ <option>Auto Rollback</option>
+ <option>Retry</option>
+ <option>Skip</option>
+ </select>
+ </div>
+ <div class="form-group col-sm-1">
+ <button type="button" class="btn btn-default"
+ ng-disabled="temp.policy.readOnly"
+ ng-click="removeTreatment()">
+ <i class="fa fa-minus"></i>
+ </button>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
<div ng-if="temp.policy.ruleProvider == 'GUARD_BL_YAML'">
<div class="well">
<div class="form-group row">
@@ -344,4 +433,4 @@
<button type="button" class="btn btn-default" ng-click="refresh();">Close</button>
</div>
</form>
-</div>
+</div> \ No newline at end of file
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/policy_Dictionary.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/policy_Dictionary.html
index 2eaf98cd9..7d7793617 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/policy_Dictionary.html
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/policy_Dictionary.html
@@ -79,6 +79,7 @@
<div ng-if="option2 == 'BRMS Controller'" ng-include = "'app/policyApp/policy-models/Dictionary/BRMSControllerDictionary.html'"></div>
<!--Decision Policy Dictionary's-->
<div ng-if="option2 == 'Settings Dictionary'" ng-include = "'app/policyApp/policy-models/Dictionary/DecisionSettingsDictionary.html'"></div>
+ <div ng-if="option2 == 'Rainy Day Allowed Treatments'" ng-include = "'app/policyApp/policy-models/Dictionary/DecisionRainyDayDictionary.html'"></div>
<!--Descriptive Scope Dictionary-->
<div ng-if="option2 == 'Descriptive Scope'" ng-include = "'app/policyApp/policy-models/Dictionary/DescriptiveScopeDictionary.html'"></div>
<!--Enforcer Policy Dictionary-->