diff options
author | rb7147 <rb7147@att.com> | 2018-02-01 12:07:13 -0500 |
---|---|---|
committer | rb7147 <rb7147@att.com> | 2018-02-01 13:50:11 -0500 |
commit | 1148834bc4b10d00c1b1830b087357e63af8293f (patch) | |
tree | f3a6d166f8a86c8b2b0a9bc1b062f9fc87cd3d58 | |
parent | 066fc4529f36d210a4a4700e8dbfd2cb42f4dc66 (diff) |
Included Policy GUI Enhancements and validations
Added hover messages for all policy templates.
Resolved few sonar issues.
Added fixes for Policy GUI Validations.
Issue-ID: POLICY-597
Change-Id: I74abb92dd6ac8722d7869b6a316fad1d8db11d9c
Signed-off-by: rb7147 <rb7147@att.com>
49 files changed, 1230 insertions, 737 deletions
diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/util/AbstractPolicyCreation.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/util/AbstractPolicyCreation.java index aa33729c9..0c98a44a3 100644 --- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/util/AbstractPolicyCreation.java +++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/util/AbstractPolicyCreation.java @@ -44,6 +44,8 @@ public abstract class AbstractPolicyCreation { String formateDate = null; if(dateTTL.contains("/")){ formateDate = dateTTL.replace("/", "-"); + }else { + formateDate = dateTTL; } return formateDate; } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ClosedLoopFaultTrapDatas.java b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ClosedLoopFaultTrapDatas.java new file mode 100644 index 000000000..efbbf27a6 --- /dev/null +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ClosedLoopFaultTrapDatas.java @@ -0,0 +1,69 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP 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========================================================= + */ +package org.onap.policy.rest.adapter; + +import java.util.List; + +public class ClosedLoopFaultTrapDatas { + + private List<Object> trap1; + private List<Object> trap2; + private List<Object> trap3; + private List<Object> trap4; + private List<Object> trap5; + private List<Object> trap6; + public List<Object> getTrap1() { + return trap1; + } + public void setTrap1(List<Object> trap1) { + this.trap1 = trap1; + } + public List<Object> getTrap2() { + return trap2; + } + public void setTrap2(List<Object> trap2) { + this.trap2 = trap2; + } + public List<Object> getTrap3() { + return trap3; + } + public void setTrap3(List<Object> trap3) { + this.trap3 = trap3; + } + public List<Object> getTrap4() { + return trap4; + } + public void setTrap4(List<Object> trap4) { + this.trap4 = trap4; + } + public List<Object> getTrap5() { + return trap5; + } + public void setTrap5(List<Object> trap5) { + this.trap5 = trap5; + } + public List<Object> getTrap6() { + return trap6; + } + public void setTrap6(List<Object> trap6) { + this.trap6 = trap6; + } + +} diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/PolicyRestAdapter.java b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/PolicyRestAdapter.java index b4056a3a0..dfc6dff49 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/PolicyRestAdapter.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/PolicyRestAdapter.java @@ -98,6 +98,8 @@ public class PolicyRestAdapter { private String trapMaxAge; private String verificationclearTimeOut; private Map<String , String> dynamicLayoutMap; + private ClosedLoopFaultTrapDatas trapDatas; + private ClosedLoopFaultTrapDatas faultDatas; //FireWall private String fwPolicyType; @@ -893,4 +895,17 @@ public class PolicyRestAdapter { public void setPolicyJSON(Object policyJSON) { this.policyJSON = policyJSON; } + + public ClosedLoopFaultTrapDatas getTrapDatas() { + return trapDatas; + } + public void setTrapDatas(ClosedLoopFaultTrapDatas trapDatas) { + this.trapDatas = trapDatas; + } + public ClosedLoopFaultTrapDatas getFaultDatas() { + return faultDatas; + } + public void setFaultDatas(ClosedLoopFaultTrapDatas faultDatas) { + this.faultDatas = faultDatas; + } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/TermList.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/TermList.java index 099257c39..9c18343bf 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/TermList.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/TermList.java @@ -109,6 +109,20 @@ public class TermList implements Serializable { @JoinColumn(name="modified_by") private UserInfo userModifiedBy; + public Date getCreatedDate() { + return this.createdDate; + } + public void setCreatedDate(Date createdDate) { + this.createdDate = createdDate; + } + + public Date getModifiedDate() { + return this.modifiedDate; + } + public void setModifiedDate(Date modifiedDate) { + this.modifiedDate = modifiedDate; + } + public UserInfo getUserCreatedBy() { return userCreatedBy; } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/util/MSModelUtils.java b/ONAP-REST/src/main/java/org/onap/policy/rest/util/MSModelUtils.java index 3880b35d8..e96396e0c 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/util/MSModelUtils.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/util/MSModelUtils.java @@ -315,7 +315,11 @@ public class MSModelUtils { if (annotation && obj instanceof EReference) { EClass refType = ((EReference) obj).getEReferenceType(); if(!refType.toString().contains(eProxyURI)){ - subAttribute.put(eStrucClassifier.getName(), refType.getName()); + String required = ":required-false"; + if(eStrucClassifier.getLowerBound() == 1){ + required = ":required-true"; + } + subAttribute.put(eStrucClassifier.getName(), refType.getName() + required); } } } @@ -390,18 +394,28 @@ public class MSModelUtils { refAttribute.put(eStrucClassifier.getName(), refValue); } else { String array = arrayCheck(((EStructuralFeature) obj).getUpperBound()); - refAttribute.put(eStrucClassifier.getName(), refType.getName() + array); + String required = ":required-false"; + if(((EStructuralFeature) obj).getLowerBound() == 1){ + required = ":required-true"; + } + refAttribute.put(eStrucClassifier.getName(), refType.getName() + array + required); } } else if (annotation && obj instanceof EAttributeImpl){ EClassifier refType = ((EAttributeImpl) obj).getEType(); if (refType instanceof EEnumImpl){ String array = arrayCheck(((EStructuralFeature) obj).getUpperBound()); - refAttribute.put(eStrucClassifier.getName(), refType.getName() + array); } + String required = ":required-false"; + if(((EStructuralFeature) obj).getLowerBound() == 1){ + required = ":required-true"; + } + refAttribute.put(eStrucClassifier.getName(), refType.getName() + array + required); + } } } } } } + return refAttribute; } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/util/PolicyValidation.java b/ONAP-REST/src/main/java/org/onap/policy/rest/util/PolicyValidation.java index df4fbf62d..77dcbdc1d 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/util/PolicyValidation.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/util/PolicyValidation.java @@ -20,6 +20,8 @@ package org.onap.policy.rest.util; import java.io.IOException; +import java.io.StringReader; +import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedHashMap; @@ -27,6 +29,12 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; +import javax.json.Json; +import javax.json.JsonException; +import javax.json.JsonObject; +import javax.json.JsonReader; +import javax.json.JsonValue; + import org.apache.commons.lang.StringUtils; import org.json.JSONObject; import org.onap.policy.common.logging.flexlogger.FlexLogger; @@ -65,6 +73,8 @@ public class PolicyValidation { public static final String EMPTY_COMPONENT_ATTR = "Component Attributes: One or more Fields in Component Attributes is Empty."; private static Map<String, String> mapAttribute = new HashMap<>(); + private static Map<String, String> jsonRequestMap = new HashMap<>(); + private static List<String> modelRequiredFieldsList = new ArrayList<>(); private static CommonClassDao commonClassDao; @@ -90,21 +100,126 @@ public class PolicyValidation { if(policyData.getPolicyName() != null){ String policyNameValidate = PolicyUtils.policySpecialCharValidator(policyData.getPolicyName()); if(!policyNameValidate.contains(SUCCESS)){ - responseString.append("PolicyName:" + policyNameValidate + "<br>"); + responseString.append("<b>PolicyName</b>:<i>" + policyNameValidate + HTML_ITALICS_LNBREAK); valid = false; - }; + } }else{ - responseString.append( "PolicyName: PolicyName Should not be empty" + "<br>"); + responseString.append( "<b>PolicyName</b>: PolicyName Should not be empty" + HTML_ITALICS_LNBREAK); valid = false; } if(policyData.getPolicyDescription() != null){ String descriptionValidate = PolicyUtils.descriptionValidator(policyData.getPolicyDescription()); if(!descriptionValidate.contains(SUCCESS)){ - responseString.append("Description:" + descriptionValidate + "<br>"); + responseString.append("<b>Description</b>:<i>" + descriptionValidate + HTML_ITALICS_LNBREAK); valid = false; } } + if(!"API".equals(policyData.getApiflag()) && policyData.getAttributes() != null && !policyData.getAttributes().isEmpty()){ + for(Object attribute : policyData.getAttributes()){ + if(attribute instanceof LinkedHashMap<?, ?>){ + String value = null; + String key = null; + if(((LinkedHashMap<?, ?>) attribute).get("key") != null){ + key = ((LinkedHashMap<?, ?>) attribute).get("key").toString(); + if(!PolicyUtils.policySpecialCharValidator(key).contains("success")){ + responseString.append("<b>Attributes or Component Attributes</b>:<i>" + value + " : value has spaces or invalid characters</i><br>"); + valid = false; + } + }else{ + if(CONFIG_POLICY.equals(policyData.getPolicyType())){ + if("Base".equals(policyData.getConfigPolicyType())){ + responseString.append("<b>Attributes</b>:<i> has one missing Attribute key</i><br>"); + } + if("BRMS_Param".equals(policyData.getConfigPolicyType()) || "BRMS_Raw".equals(policyData.getConfigPolicyType())){ + responseString.append("<b>Rule Attributes</b>:<i> has one missing Attribute key</i><br>"); + } + }else{ + responseString.append("<b>Component Attributes</b>:<i> has one missing Component Attribute key</i><br>"); + } + valid = false; + } + if(((LinkedHashMap<?, ?>) attribute).get("value") != null){ + value = ((LinkedHashMap<?, ?>) attribute).get("value").toString(); + if(!PolicyUtils.policySpecialCharValidator(value).contains("success")){ + if(CONFIG_POLICY.equals(policyData.getPolicyType())){ + if("Base".equals(policyData.getConfigPolicyType())){ + responseString.append("<b>Attributes</b>:<i>" + value + " : value has spaces or invalid characters</i><br>"); + } + if("BRMS_Param".equals(policyData.getConfigPolicyType()) || "BRMS_Raw".equals(policyData.getConfigPolicyType())){ + responseString.append("<b>Rule Attributes</b>:<i>" + value + " : value has spaces or invalid characters</i><br>"); + } + }else{ + responseString.append("<b>Component Attributes</b>:<i>" + value + " : value has spaces or invalid characters</i><br>"); + } + valid = false; + } + }else{ + if(CONFIG_POLICY.equals(policyData.getPolicyType())){ + if("Base".equals(policyData.getConfigPolicyType())){ + responseString.append("<b>Attributes</b>:<i> has one missing Attribute value</i><br>"); + } + if("BRMS_Param".equals(policyData.getConfigPolicyType()) || "BRMS_Raw".equals(policyData.getConfigPolicyType())){ + responseString.append("<b>Rule Attributes</b>:<i> has one missing Attribute value</i><br>"); + } + }else{ + responseString.append("<b>Component Attributes</b>:<i> has one missing Component Attribute value</i><br>"); + } + valid = false; + } + } + } + } + + //Decision Policy Attributes Validation + if(!"API".equals(policyData.getApiflag()) && policyData.getSettings() != null && !policyData.getSettings().isEmpty()){ + for(Object attribute : policyData.getAttributes()){ + if(attribute instanceof LinkedHashMap<?, ?>){ + String value = null; + if(((LinkedHashMap<?, ?>) attribute).get("key") == null){ + responseString.append("<b>Settings Attributes</b>:<i> has one missing Attribute key</i><br>"); + valid = false; + } + if(((LinkedHashMap<?, ?>) attribute).get("value") != null){ + value = ((LinkedHashMap<?, ?>) attribute).get("value").toString(); + if(!PolicyUtils.policySpecialCharValidator(value).contains("success")){ + responseString.append("<b>Settings Attributes</b>:<i>" + value + " : value has spaces or invalid characters</i><br>"); + valid = false; + } + }else{ + responseString.append("<b>Settings Attributes</b>:<i> has one missing Attribute Value</i><br>"); + valid = false; + } + } + } + } + + if(!"API".equals(policyData.getApiflag()) && policyData.getRuleAlgorithmschoices() != null && !policyData.getRuleAlgorithmschoices().isEmpty()){ + for(Object attribute : policyData.getRuleAlgorithmschoices()){ + if(attribute instanceof LinkedHashMap<?, ?>){ + String label = ((LinkedHashMap<?, ?>) attribute).get("id").toString(); + if(((LinkedHashMap<?, ?>) attribute).get("dynamicRuleAlgorithmField1") == null){ + responseString.append("<b>Rule Algorithms</b>:<i>" + label + " : Field 1 value is not selected</i><br>"); + valid = false; + } + if(((LinkedHashMap<?, ?>) attribute).get("dynamicRuleAlgorithmCombo") == null){ + responseString.append("<b>Rule Algorithms</b>:<i>" + label + " : Field 2 value is not selected</i><br>"); + valid = false; + } + if(((LinkedHashMap<?, ?>) attribute).get("dynamicRuleAlgorithmField2") != null){ + String value = ((LinkedHashMap<?, ?>) attribute).get("dynamicRuleAlgorithmField2").toString(); + if(!PolicyUtils.policySpecialCharValidator(value).contains("success")){ + responseString.append("<b>Rule Algorithms</b>:<i>" + label + " : Field 3 value has special characters</i><br>"); + valid = false; + } + }else{ + responseString.append("<b>Rule Algorithms</b>:<i>" + label + " : Field 3 value is empty</i><br>"); + valid = false; + } + } + } + } + if(CONFIG_POLICY.equalsIgnoreCase(policyData.getPolicyType())){ if ("Base".equals(policyData.getConfigPolicyType()) || CLOSEDLOOP_POLICY.equals(policyData.getConfigPolicyType()) || CLOSEDLOOP_PM.equals(policyData.getConfigPolicyType()) || ENFORCER_CONFIG_POLICY.equals(policyData.getConfigPolicyType()) @@ -113,11 +228,11 @@ public class PolicyValidation { if(!Strings.isNullOrEmpty(policyData.getOnapName())) { String onapNameValidate = PolicyUtils.policySpecialCharValidator(policyData.getOnapName()); if(!onapNameValidate.contains(SUCCESS)){ - responseString.append("OnapName:" + onapNameValidate + "<br>"); + responseString.append("<b>OnapName</b>:<i>" + onapNameValidate + HTML_ITALICS_LNBREAK); valid = false; } }else{ - responseString.append("Onap Name: Onap Name Should not be empty" + "<br>"); + responseString.append("<b>Onap Name</b>: Onap Name Should not be empty" + HTML_ITALICS_LNBREAK); valid = false; } } @@ -125,33 +240,33 @@ public class PolicyValidation { if(!Strings.isNullOrEmpty(policyData.getRiskType())) { String riskTypeValidate = PolicyUtils.policySpecialCharValidator(policyData.getRiskType()); if(!riskTypeValidate.contains(SUCCESS)){ - responseString.append("RiskType:" + riskTypeValidate + "<br>"); + responseString.append("<b>RiskType</b>:<i>" + riskTypeValidate + HTML_ITALICS_LNBREAK); valid = false; } }else { - responseString.append("Risk Type: Risk Type Should not be Empty" + "<br>"); + responseString.append("<b>RiskType</b>: Risk Type Should not be Empty" + HTML_ITALICS_LNBREAK); valid = false; } if(!Strings.isNullOrEmpty(policyData.getRiskLevel())) { String validateRiskLevel = PolicyUtils.policySpecialCharValidator(policyData.getRiskLevel()); if(!validateRiskLevel.contains(SUCCESS)){ - responseString.append("RiskLevel:" + validateRiskLevel + "<br>"); + responseString.append("<b>RiskLevel</b>:<i>" + validateRiskLevel + HTML_ITALICS_LNBREAK); valid = false; } }else { - responseString.append("Risk Level: Risk Level Should not be Empty" + "<br>"); + responseString.append("<b>RiskLevel</b>: Risk Level Should not be Empty" + HTML_ITALICS_LNBREAK); valid = false; } if(!Strings.isNullOrEmpty(policyData.getGuard())) { String validateGuard = PolicyUtils.policySpecialCharValidator(policyData.getGuard()); if(!validateGuard.contains(SUCCESS)){ - responseString.append("Guard:" + validateGuard + "<br>"); + responseString.append("<b>Guard</b>:<i>" + validateGuard + HTML_ITALICS_LNBREAK); valid = false; } }else { - responseString.append("Guard: Guard Value Should not be Empty" + "<br>"); + responseString.append("<b>Guard</b>: Guard Value Should not be Empty" + HTML_ITALICS_LNBREAK); valid = false; } @@ -159,21 +274,21 @@ public class PolicyValidation { if(!Strings.isNullOrEmpty(policyData.getConfigName())) { String configNameValidate = PolicyUtils.policySpecialCharValidator(policyData.getConfigName()); if(!configNameValidate.contains(SUCCESS)){ - responseString.append("ConfigName:" + configNameValidate + "<br>"); + responseString.append("ConfigName:" + configNameValidate + HTML_ITALICS_LNBREAK); valid = false; } }else{ - responseString.append("Config Name: Config Name Should not be Empty" + "<br>"); + responseString.append("Config Name: Config Name Should not be Empty" + HTML_ITALICS_LNBREAK); valid = false; } if(!Strings.isNullOrEmpty(policyData.getConfigType())) { String configTypeValidate = PolicyUtils.policySpecialCharValidator(policyData.getConfigType()); if(!configTypeValidate.contains(SUCCESS)){ - responseString.append("ConfigType:" + configTypeValidate + "<br>"); + responseString.append("ConfigType:" + configTypeValidate + HTML_ITALICS_LNBREAK); valid = false; } }else{ - responseString.append("Config Type: Config Type Should not be Empty" + "<br>"); + responseString.append("Config Type: Config Type Should not be Empty" + HTML_ITALICS_LNBREAK); valid = false; } if(!Strings.isNullOrEmpty(policyData.getConfigBodyData())) { @@ -182,26 +297,26 @@ public class PolicyValidation { if (configType != null) { if ("JSON".equals(configType)) { if (!PolicyUtils.isJSONValid(configBodyData)) { - responseString.append("Config Body: JSON Content is not valid" + "<br>"); + responseString.append("Config Body: JSON Content is not valid" + HTML_ITALICS_LNBREAK); valid = false; } } else if ("XML".equals(configType)) { if (!PolicyUtils.isXMLValid(configBodyData)) { - responseString.append("Config Body: XML Content data is not valid" + "<br>"); + responseString.append("Config Body: XML Content data is not valid" + HTML_ITALICS_LNBREAK); valid = false; } } else if ("PROPERTIES".equals(configType)) { if (!PolicyUtils.isPropValid(configBodyData)||configBodyData.equals("")) { - responseString.append("Config Body: Property data is not valid" + "<br>"); + responseString.append("Config Body: Property data is not valid" + HTML_ITALICS_LNBREAK); valid = false; } } else if ("OTHER".equals(configType) && ("".equals(configBodyData))) { - responseString.append("Config Body: Config Body Should not be Empty" + "<br>"); + responseString.append("Config Body: Config Body Should not be Empty" + HTML_ITALICS_LNBREAK); valid = false; } } }else{ - responseString.append("Config Body: Config Body Should not be Empty" + "<br>"); + responseString.append("Config Body: Config Body Should not be Empty" + HTML_ITALICS_LNBREAK); valid = false; } } @@ -259,7 +374,7 @@ public class PolicyValidation { if(pmBody.getEmailAddress() != null){ String result = emailValidation(pmBody.getEmailAddress(), responseString.toString()); if(result != SUCCESS){ - responseString.append(result + "<br>"); + responseString.append(result + HTML_ITALICS_LNBREAK); valid = false; } } @@ -272,7 +387,7 @@ public class PolicyValidation { if(!result.contains(SUCCESS)){ responseString.append("<b>GeoLink</b>:<i>" + result + HTML_ITALICS_LNBREAK); valid = false; - }; + } } if(pmBody.getAttributes() != null && !pmBody.getAttributes().isEmpty()){ for(Entry<String, String> entry : pmBody.getAttributes().entrySet()){ @@ -283,7 +398,7 @@ public class PolicyValidation { if(!attributeValidate.contains(SUCCESS)){ responseString.append("<b>Attributes</b>:<i>" + key + " : value has spaces or invalid characters" + HTML_ITALICS_LNBREAK); valid = false; - }; + } } } } @@ -308,13 +423,28 @@ public class PolicyValidation { responseString.append("<b>Conditions</b>: <i>There were no conditions provided in configBody json" + HTML_ITALICS_LNBREAK); return responseString; } + }else{ + if(policyData.getTrapDatas().getTrap1() != null){ + if(policyData.getClearTimeOut() == null){ + responseString.append("<b>Trigger Clear TimeOut</b>: <i>Trigger Clear TimeOut is required when atleast One Trigger Signature is enabled</i><br>"); + valid = false; + } + if(policyData.getTrapMaxAge() == null){ + responseString.append("<b>Trap Max Age</b>: <i>Trap Max Age is required when atleast One Trigger Signature is enabled</i><br>"); + valid = false; + } + } + if(policyData.getFaultDatas().getTrap1() != null && policyData.getVerificationclearTimeOut() == null){ + responseString.append("<b>Fault Clear TimeOut</b>: <i>Fault Clear TimeOut is required when atleast One Fault Signature is enabled</i><br>"); + valid = false; + } } ClosedLoopFaultBody faultBody = mapper.readValue(policyData.getJsonBody(), ClosedLoopFaultBody.class); if(faultBody.getEmailAddress() != null && !faultBody.getEmailAddress().isEmpty()){ String result = emailValidation(faultBody.getEmailAddress(), responseString.toString()); - if(result != SUCCESS){ - responseString.append(result+ "<br>"); + if(!SUCCESS.equals(result)){ + responseString.append(result+ HTML_ITALICS_LNBREAK); valid = false; } } @@ -384,6 +514,8 @@ public class PolicyValidation { if (MICROSERVICES.equals(policyData.getConfigPolicyType())){ if(!Strings.isNullOrEmpty(policyData.getServiceType())){ + + modelRequiredFieldsList = new ArrayList<>(); pullJsonKeyPairs((JsonNode) policyData.getPolicyJSON()); String service; @@ -400,7 +532,12 @@ public class PolicyValidation { MicroServiceModels returnModel = getAttributeObject(service, version); if(returnModel != null) { + String annotation = returnModel.getAnnotation(); + String refAttributes = returnModel.getRef_attributes(); + String subAttributes = returnModel.getSub_attributes(); + String modelAttributes = returnModel.getAttributes(); + if (!Strings.isNullOrEmpty(annotation)){ Map<String, String> rangeMap = Splitter.on(",").withKeyValueSeparator("=").split(annotation); for (Entry<String, String> rMap : rangeMap.entrySet()){ @@ -431,18 +568,85 @@ public class PolicyValidation { } } + } else { + // Validate for configName, location, uuid, and policyScope if no annotations exist for this model + if(Strings.isNullOrEmpty(policyData.getMsLocation())){ + responseString.append("<b>Micro Service Model</b>:<i> location is required for this model" + HTML_ITALICS_LNBREAK); + valid = false; + } + + if(Strings.isNullOrEmpty(policyData.getConfigName())){ + responseString.append("<b>Micro Service Model</b>:<i> configName is required for this model" + HTML_ITALICS_LNBREAK); + valid = false; + } + + if(Strings.isNullOrEmpty(policyData.getUuid())){ + responseString.append("<b>Micro Service Model</b>:<i> uuid is required for this model" + HTML_ITALICS_LNBREAK); + valid = false; + } + + if(Strings.isNullOrEmpty(policyData.getPolicyScope())){ + responseString.append("<b>Micro Service Model</b>:<i> policyScope is required for this model" + HTML_ITALICS_LNBREAK); + valid = false; + } + } + + // get list of required fields from the sub_Attributes of the Model + if(!Strings.isNullOrEmpty(subAttributes)) { + JsonObject subAttributesJson = stringToJsonObject(subAttributes); + findRequiredFields(subAttributesJson); + } + + // get list of required fields from the attributes of the Model + if (!Strings.isNullOrEmpty(modelAttributes)) { + Map<String, String> modelAttributesMap = Splitter.on(",").withKeyValueSeparator("=").split(modelAttributes); + String json = new ObjectMapper().writeValueAsString(modelAttributesMap); + findRequiredFields(stringToJsonObject(json)); + } + + // get list of required fields from the ref_Attributes of the Model + if (!Strings.isNullOrEmpty(refAttributes)) { + Map<String, String> refAttributesMap = Splitter.on(",").withKeyValueSeparator("=").split(refAttributes); + String json = new ObjectMapper().writeValueAsString(refAttributesMap); + findRequiredFields(stringToJsonObject(json)); + } + + // Validate Required Fields in the Micro Service Model + if (modelRequiredFieldsList!=null || !modelRequiredFieldsList.isEmpty()) { + // create jsonRequestMap with all json keys and values from request + JsonNode rootNode = (JsonNode) policyData.getPolicyJSON(); + pullModelJsonKeyPairs(rootNode); + + // validate if the requiredFields are in the request + for(String requiredField : modelRequiredFieldsList) { + if (jsonRequestMap.containsKey(requiredField)) { + String value = jsonRequestMap.get(requiredField); + if(Strings.isNullOrEmpty(jsonRequestMap.get(requiredField)) || + "\"\"".equals(value) || + "".equals(jsonRequestMap.get(requiredField))){ + responseString.append("<b>Micro Service Model</b>:<i> " + requiredField + " is required" + HTML_ITALICS_LNBREAK); + valid = false; + } + } else { + responseString.append("<b>Micro Service Model</b>:<i> " + requiredField + " is required" + HTML_ITALICS_LNBREAK); + valid = false; + } + } } + + + } else { responseString.append("<b>Micro Service Model</b>:<i> Invalid Model. The model name, " + service + " of version, " + version + " was not found in the dictionary" + HTML_ITALICS_LNBREAK); valid = false; } } else { - responseString.append("<b>Micro Version</b>:<i> Micro Service Version is required" + HTML_ITALICS_LNBREAK); + responseString.append("<b>Micro Service Version</b>:<i> Micro Service Version is required" + HTML_ITALICS_LNBREAK); valid = false; } } else { - responseString.append("<b>Micro Service</b>:<i> Micro Service is required" + HTML_ITALICS_LNBREAK); + responseString.append("<b>Micro Service</b>:<i> Micro Service Model is required" + HTML_ITALICS_LNBREAK); valid = false; } @@ -456,11 +660,11 @@ public class PolicyValidation { if(!Strings.isNullOrEmpty(policyData.getOnapName())){ String onapNameValidate = PolicyUtils.policySpecialCharValidator(policyData.getOnapName()); if(!onapNameValidate.contains(SUCCESS)){ - responseString.append("OnapName:" + onapNameValidate + "<br>"); + responseString.append("OnapName:" + onapNameValidate + HTML_ITALICS_LNBREAK); valid = false; } }else{ - responseString.append("Onap Name: Onap Name Should not be empty" + "<br>"); + responseString.append("Onap Name: Onap Name Should not be empty" + HTML_ITALICS_LNBREAK); valid = false; } @@ -527,52 +731,52 @@ public class PolicyValidation { 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>"); + responseString.append("<b> Guard Params are Required </b>" + HTML_ITALICS_LNBREAK); valid = false; }else{ if(Strings.isNullOrEmpty(policyData.getYamlparams().getActor())){ - responseString.append("Guard Params <b>Actor</b> is Required " + "<br>"); + responseString.append("Guard Params <b>Actor</b> is Required " + HTML_ITALICS_LNBREAK); valid = false; } if(Strings.isNullOrEmpty(policyData.getYamlparams().getRecipe())){ - responseString.append("Guard Params <b>Recipe</b> is Required " + "<br>"); + responseString.append("Guard Params <b>Recipe</b> is Required " + HTML_ITALICS_LNBREAK); valid = false; } if(Strings.isNullOrEmpty(policyData.getYamlparams().getGuardActiveStart())){ - responseString.append("Guard Params <b>Guard Active Start</b> is Required " + "<br>"); + responseString.append("Guard Params <b>Guard Active Start</b> is Required " + HTML_ITALICS_LNBREAK); valid = false; } if(Strings.isNullOrEmpty(policyData.getYamlparams().getGuardActiveEnd())){ - responseString.append("Guard Params <b>Guard Active End</b> is Required " + "<br>"); + responseString.append("Guard Params <b>Guard Active End</b> is Required " + HTML_ITALICS_LNBREAK); valid = false; } if("GUARD_YAML".equals(policyData.getRuleProvider())){ if(Strings.isNullOrEmpty(policyData.getYamlparams().getLimit())){ - responseString.append(" Guard Params <b>Limit</b> is Required " + "<br>"); + responseString.append(" Guard Params <b>Limit</b> is Required " + HTML_ITALICS_LNBREAK); valid = false; }else if(!PolicyUtils.isInteger(policyData.getYamlparams().getLimit())){ - responseString.append(" Guard Params <b>Limit</b> Should be Integer " + "<br>"); + responseString.append(" Guard Params <b>Limit</b> Should be Integer " + HTML_ITALICS_LNBREAK); valid = false; } if(Strings.isNullOrEmpty(policyData.getYamlparams().getTimeWindow())){ - responseString.append("Guard Params <b>Time Window</b> is Required" + "<br>"); + responseString.append("Guard Params <b>Time Window</b> is Required" + HTML_ITALICS_LNBREAK); valid = false; }else if(!PolicyUtils.isInteger(policyData.getYamlparams().getTimeWindow())){ - responseString.append(" Guard Params <b>Time Window</b> Should be Integer " + "<br>"); + responseString.append(" Guard Params <b>Time Window</b> Should be Integer " + HTML_ITALICS_LNBREAK); valid = false; } if(Strings.isNullOrEmpty(policyData.getYamlparams().getTimeUnits())){ - responseString.append("Guard Params <b>Time Units</b> is Required" + "<br>"); + responseString.append("Guard Params <b>Time Units</b> is Required" + HTML_ITALICS_LNBREAK); valid = false; } }else if("GUARD_BL_YAML".equals(policyData.getRuleProvider())){ if(policyData.getYamlparams().getBlackList()==null || policyData.getYamlparams().getBlackList().isEmpty()){ - responseString.append(" Guard Params <b>BlackList</b> is Required " + "<br>"); + responseString.append(" Guard Params <b>BlackList</b> is Required " + HTML_ITALICS_LNBREAK); valid = false; }else{ for(String blackList: policyData.getYamlparams().getBlackList()){ if(blackList==null || !(SUCCESS.equals(PolicyUtils.policySpecialCharValidator(blackList)))){ - responseString.append(" Guard Params <b>BlackList</b> Should be valid String" + "<br>"); + responseString.append(" Guard Params <b>BlackList</b> Should be valid String" + HTML_ITALICS_LNBREAK); valid = false; break; } @@ -587,70 +791,24 @@ public class PolicyValidation { if(!Strings.isNullOrEmpty(policyData.getActionPerformer())){ String actionPerformer = PolicyUtils.policySpecialCharValidator(policyData.getActionPerformer()); if(!actionPerformer.contains(SUCCESS)){ - responseString.append("ActionPerformer:" + actionPerformer + "<br>"); + responseString.append("<b>ActionPerformer</b>:<i>" + actionPerformer + HTML_ITALICS_LNBREAK); valid = false; } }else{ - responseString.append("ActionPerformer: ActionPerformer Should not be empty" + "<br>"); - valid = false; - } - if(policyData.getAttributes() != null){ - for(Object attribute : policyData.getAttributes()){ - if(attribute instanceof LinkedHashMap<?, ?>){ - try{ - //This is for validation check if the value exists or not - String key = ((LinkedHashMap<?, ?>) attribute).get("key").toString(); - String value = ((LinkedHashMap<?, ?>) attribute).get("value").toString(); - if("".equals(key) || "".equals(value)){ - responseString.append(EMPTY_COMPONENT_ATTR + "<br>"); - valid = false; - break; - } - }catch(Exception e){ - LOGGER.error("This is a Policy Validation check" +e); - responseString.append(EMPTY_COMPONENT_ATTR + "<br>"); - valid = false; - break; - } - } - } - }else{ - responseString.append(EMPTY_COMPONENT_ATTR + "<br>"); + responseString.append("<b>ActionPerformer</b>:<i> ActionPerformer Should not be empty" + HTML_ITALICS_LNBREAK); valid = false; } + if(!Strings.isNullOrEmpty(policyData.getActionAttributeValue())){ String actionAttribute = PolicyUtils.policySpecialCharValidator(policyData.getActionAttributeValue()); if(!actionAttribute.contains(SUCCESS)){ - responseString.append("ActionAttribute:" + actionAttribute + "<br>"); + responseString.append("<b>ActionAttribute</b>:<i>" + actionAttribute + HTML_ITALICS_LNBREAK); valid = false; - }; + } }else{ - responseString.append("ActionAttribute: ActionAttribute Should not be empty" + "<br>"); + responseString.append("<b>ActionAttribute</b>:<i> ActionAttribute Should not be empty" + HTML_ITALICS_LNBREAK); valid = false; } - - if(!policyData.getRuleAlgorithmschoices().isEmpty()){ - for(Object attribute : policyData.getRuleAlgorithmschoices()){ - if(attribute instanceof LinkedHashMap<?, ?>){ - try{ - String label = ((LinkedHashMap<?, ?>) attribute).get("id").toString(); - String key = ((LinkedHashMap<?, ?>) attribute).get("dynamicRuleAlgorithmField1").toString(); - String rule = ((LinkedHashMap<?, ?>) attribute).get("dynamicRuleAlgorithmCombo").toString(); - String value = ((LinkedHashMap<?, ?>) attribute).get("dynamicRuleAlgorithmField2").toString(); - - if(Strings.isNullOrEmpty(label) || Strings.isNullOrEmpty(key) || Strings.isNullOrEmpty(rule) || Strings.isNullOrEmpty(value)){ - responseString.append("Rule Algorithms: One or more Fields in Rule Algorithms is Empty." + "<br>"); - valid = false; - } - }catch(Exception e){ - LOGGER.error("This is a Policy Validation check" +e); - responseString.append("Rule Algorithms: One or more Fields in Rule Algorithms is Empty." + "<br>"); - valid = false; - break; - } - } - } - } } if(CONFIG_POLICY.equals(policyData.getPolicyType())){ @@ -660,7 +818,7 @@ public class PolicyValidation { List<Object> spData = commonClassDao.getDataById(SafePolicyWarning.class, "riskType", policyData.getRiskType()); if (!spData.isEmpty()){ SafePolicyWarning safePolicyWarningData = (SafePolicyWarning) spData.get(0); - value = "Message:" + safePolicyWarningData.getMessage(); + value = "<b>Message</b>:<i>" + safePolicyWarningData.getMessage() +"</i>"; } } responseString.append(SUCCESS + "@#"+ value); @@ -729,5 +887,60 @@ public class PolicyValidation { } } } + + private void pullModelJsonKeyPairs(JsonNode rootNode) { + Iterator<Map.Entry<String, JsonNode>> fieldsIterator = rootNode.fields(); + + while (fieldsIterator.hasNext()) { + Map.Entry<String, JsonNode> field = fieldsIterator.next(); + final String key = field.getKey(); + final JsonNode value = field.getValue(); + + if (value.isContainerNode() && !value.isArray()) { + pullModelJsonKeyPairs(value); // RECURSIVE CALL + } else if (value.isArray()) { + try { + String stringValue = StringUtils.replaceEach(value.toString(), new String[]{"[", "]"}, new String[]{"",""}); + ObjectMapper mapper = new ObjectMapper(); + JsonNode newValue = mapper.readTree(stringValue); + pullModelJsonKeyPairs(newValue); + } catch (IOException e) { + LOGGER.info("PolicyValidation: Exception occurred while mapping string to JsonNode " + e); + } + } else { + jsonRequestMap.put(key, value.toString().trim()); + } + } + + } + + private JsonObject stringToJsonObject(String value) { + try(JsonReader jsonReader = Json.createReader(new StringReader(value))){ + return jsonReader.readObject(); + } catch(JsonException| IllegalStateException e){ + LOGGER.info(XACMLErrorConstants.ERROR_DATA_ISSUE+ "Improper JSON format... may or may not cause issues in validating the policy: " + value, e); + return null; + } + } + + private void findRequiredFields(JsonObject json) { + + for(Entry<String, JsonValue> keyMap : json.entrySet()){ + Object obj = keyMap.getValue(); + if(obj instanceof JsonObject){ + JsonObject jsonObj = (JsonObject)obj; + for(Entry<String, JsonValue> jsonMap : jsonObj.entrySet()){ + if(jsonMap.getValue().toString().contains("required-true")){ + modelRequiredFieldsList.add(jsonMap.getKey()); + } + } + } else { + if(keyMap.getValue().toString().contains("required-true")){ + modelRequiredFieldsList.add(keyMap.getKey()); + } + } + } + + } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/util/PolicyValidationRequestWrapper.java b/ONAP-REST/src/main/java/org/onap/policy/rest/util/PolicyValidationRequestWrapper.java index ac97fb0ee..4267ff9fc 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/util/PolicyValidationRequestWrapper.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/util/PolicyValidationRequestWrapper.java @@ -37,6 +37,7 @@ import org.onap.policy.api.AttributeType; import org.onap.policy.api.PolicyParameters; import org.onap.policy.common.logging.flexlogger.FlexLogger; import org.onap.policy.common.logging.flexlogger.Logger; +import org.onap.policy.rest.adapter.ClosedLoopFaultTrapDatas; import org.onap.policy.rest.adapter.PolicyRestAdapter; import org.onap.policy.rest.adapter.RainyDayParams; import org.onap.policy.rest.adapter.YAMLParams; @@ -55,12 +56,21 @@ public class PolicyValidationRequestWrapper { public PolicyRestAdapter populateRequestParameters(HttpServletRequest request) { PolicyRestAdapter policyData = null; - + ClosedLoopFaultTrapDatas trapDatas = null; + ClosedLoopFaultTrapDatas faultDatas = null; try { ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); JsonNode root = mapper.readTree(request.getReader()); policyData = mapper.readValue(root.get("policyData").toString(), PolicyRestAdapter.class); + if(root.get("trapData") != null){ + trapDatas = mapper.readValue(root.get("trapData").toString(), ClosedLoopFaultTrapDatas.class); + policyData.setTrapDatas(trapDatas); + } + if(root.get("faultData") != null){ + faultDatas = mapper.readValue(root.get("faultData").toString(), ClosedLoopFaultTrapDatas.class); + policyData.setFaultDatas(faultDatas); + } JsonObject json; json = stringToJsonObject(root.toString()); @@ -88,9 +98,15 @@ public class PolicyValidationRequestWrapper { /* * set policy adapter values for Building JSON object containing policy data */ - //Common among policy types + //Common Policy Fields policyData.setPolicyName(parameters.getPolicyName()); policyData.setOnapName(parameters.getOnapName()); + policyData.setPriority(parameters.getPriority()); //Micro Service + policyData.setConfigName(parameters.getConfigName()); //Base and Firewall + policyData.setRiskType(parameters.getRiskType()); //Safe parameters Attributes + policyData.setRiskLevel(parameters.getRiskLevel());//Safe parameters Attributes + policyData.setGuard(String.valueOf(parameters.getGuard()));//Safe parameters Attributes + policyData.setTtlDate(convertDate(parameters.getTtlDate()));//Safe parameters Attributes //Some policies require jsonObject conversion from String for configBody (i.e. MicroService and Firewall) JsonObject json = null; @@ -298,6 +314,26 @@ public class PolicyValidationRequestWrapper { String version = json.get("version").toString().replace("\"", ""); policyData.setVersion(version); } + if(json.containsKey("policyScope")){ + String policyScope = json.get("policyScope").toString().replace("\"", ""); + policyData.setPolicyScope(policyScope); + } + if(json.containsKey("riskType")){ + String riskType = json.get("riskType").toString().replace("\"", ""); + policyData.setRiskType(riskType); + } + if(json.containsKey("riskLevel")){ + String riskLevel = json.get("riskLevel").toString().replace("\"", ""); + policyData.setRiskLevel(riskLevel); + } + if(json.containsKey("guard")){ + String guard = json.get("guard").toString().replace("\"", ""); + policyData.setGuard(guard); + } + } else { + String message = XACMLErrorConstants.ERROR_DATA_ISSUE+ " improper JSON object : " + parameters.getConfigBody(); + LOGGER.error(message); + return null; } } else if("Fault".equals(parameters.getPolicyConfigType().toString())){ @@ -337,13 +373,6 @@ public class PolicyValidationRequestWrapper { } } - - policyData.setPriority(parameters.getPriority()); //Micro Service - policyData.setConfigName(parameters.getConfigName()); //Base and Firewall - policyData.setRiskType(parameters.getRiskType()); //Safe parameters Attributes - policyData.setRiskLevel(parameters.getRiskLevel());//Safe parameters Attributes - policyData.setGuard(String.valueOf(parameters.getGuard()));//Safe parameters Attributes - policyData.setTtlDate(convertDate(parameters.getTtlDate()));//Safe parameters Attributes return policyData; diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/adapter/ClosedLoopFaultTrapDatasTest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/adapter/ClosedLoopFaultTrapDatasTest.java new file mode 100644 index 000000000..bb8385bc3 --- /dev/null +++ b/ONAP-REST/src/test/java/org/onap/policy/rest/adapter/ClosedLoopFaultTrapDatasTest.java @@ -0,0 +1,50 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP Policy Engine + * ================================================================================ + * Copyright (C) 2018 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========================================================= + */ +package org.onap.policy.rest.adapter; + +import static org.junit.Assert.*; + +import java.util.ArrayList; +import java.util.List; + +import org.junit.Test; + +public class ClosedLoopFaultTrapDatasTest { + + @Test + public void testClosedLoopFaultTrapDatas(){ + List<Object> trap = new ArrayList<>(); + trap.add("Test"); + ClosedLoopFaultTrapDatas closedLoopTrapData = new ClosedLoopFaultTrapDatas(); + closedLoopTrapData.setTrap1(trap); + assertTrue("Test".equals(closedLoopTrapData.getTrap1().get(0))); + closedLoopTrapData.setTrap2(trap); + assertTrue("Test".equals(closedLoopTrapData.getTrap2().get(0))); + closedLoopTrapData.setTrap3(trap); + assertTrue("Test".equals(closedLoopTrapData.getTrap3().get(0))); + closedLoopTrapData.setTrap4(trap); + assertTrue("Test".equals(closedLoopTrapData.getTrap4().get(0))); + closedLoopTrapData.setTrap5(trap); + assertTrue("Test".equals(closedLoopTrapData.getTrap5().get(0))); + closedLoopTrapData.setTrap6(trap); + assertTrue("Test".equals(closedLoopTrapData.getTrap6().get(0))); + + } +} diff --git a/ONAP-SDK-APP/src/main/java/org/onap/portalapp/conf/ExternalAppConfig.java b/ONAP-SDK-APP/src/main/java/org/onap/portalapp/conf/ExternalAppConfig.java index ccc469166..20601724c 100644 --- a/ONAP-SDK-APP/src/main/java/org/onap/portalapp/conf/ExternalAppConfig.java +++ b/ONAP-SDK-APP/src/main/java/org/onap/portalapp/conf/ExternalAppConfig.java @@ -29,7 +29,6 @@ import org.onap.portalsdk.core.conf.AppConfig; import org.onap.portalsdk.core.conf.Configurable; import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; import org.onap.portalsdk.core.objectcache.AbstractCacheManager; -import org.onap.portalsdk.core.onboarding.exception.PortalAPIException; import org.onap.portalsdk.core.service.DataAccessService; import org.onap.portalsdk.core.util.CacheManager; import org.onap.portalsdk.core.util.SystemProperties; diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/AutoPushController.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/AutoPushController.java index 9ade81d17..e0388e5d6 100644 --- a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/AutoPushController.java +++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/AutoPushController.java @@ -52,6 +52,7 @@ import org.onap.policy.rest.adapter.AutoPushTabAdapter; import org.onap.policy.rest.dao.CommonClassDao; import org.onap.policy.rest.jpa.PolicyEntity; import org.onap.policy.rest.jpa.PolicyVersion; +import org.onap.policy.utils.PolicyUtils; import org.onap.policy.xacml.api.XACMLErrorConstants; import org.onap.policy.xacml.api.pap.OnapPDPGroup; import org.onap.policy.xacml.std.pap.StdPDPGroup; @@ -288,6 +289,7 @@ public class AutoPushController extends RestrictedBaseController{ updatedGroupObject.setOnapPdps(pdpGroup.getOnapPdps()); updatedGroupObject.setPipConfigs(pdpGroup.getPipConfigs()); updatedGroupObject.setStatus(pdpGroup.getStatus()); + updatedGroupObject.setOperation("push"); // replace the original set of Policies with the set from the // container (possibly modified by the user) @@ -334,7 +336,7 @@ public class AutoPushController extends RestrictedBaseController{ request.setCharacterEncoding("UTF-8"); PrintWriter out = response.getWriter(); logger.error(e); - out.write(e.getMessage()); + out.write(PolicyUtils.CATCH_EXCEPTION);; } return null; } @@ -369,6 +371,7 @@ public class AutoPushController extends RestrictedBaseController{ updatedGroupObject.setOnapPdps(group.getOnapPdps()); updatedGroupObject.setPipConfigs(group.getPipConfigs()); updatedGroupObject.setStatus(group.getStatus()); + updatedGroupObject.setOperation("delete"); this.container.updateGroup(updatedGroupObject); } @@ -390,7 +393,7 @@ public class AutoPushController extends RestrictedBaseController{ request.setCharacterEncoding("UTF-8"); PrintWriter out = response.getWriter(); logger.error(e); - out.write(e.getMessage()); + out.write(PolicyUtils.CATCH_EXCEPTION);; } return null; } diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateClosedLoopFaultController.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateClosedLoopFaultController.java index 158ea6248..7cfc4fed4 100644 --- a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateClosedLoopFaultController.java +++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateClosedLoopFaultController.java @@ -32,6 +32,7 @@ import java.util.Map; import org.onap.policy.common.logging.flexlogger.FlexLogger; import org.onap.policy.common.logging.flexlogger.Logger; import org.onap.policy.rest.adapter.ClosedLoopFaultBody; +import org.onap.policy.rest.adapter.ClosedLoopFaultTrapDatas; import org.onap.policy.rest.adapter.ClosedLoopFaultTriggerUISignatures; import org.onap.policy.rest.adapter.ClosedLoopSignatures; import org.onap.policy.rest.adapter.PolicyRestAdapter; @@ -62,27 +63,27 @@ import oasis.names.tc.xacml._3_0.core.schema.wd_17.TargetType; public class CreateClosedLoopFaultController extends RestrictedBaseController{ private static final Logger policyLogger = FlexLogger.getLogger(CreateClosedLoopFaultController.class); - + protected PolicyRestAdapter policyAdapter = null; - - + + private static CommonClassDao commonclassdao; - + @Autowired private CreateClosedLoopFaultController(CommonClassDao commonclassdao){ CreateClosedLoopFaultController.commonclassdao = commonclassdao; } - + public CreateClosedLoopFaultController(){ // Empty constructor } - + public PolicyRestAdapter setDataToPolicyRestAdapter(PolicyRestAdapter policyData, JsonNode root){ try{ ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - TrapDatas trapDatas = mapper.readValue(root.get("trapData").toString(), TrapDatas.class); - TrapDatas faultDatas = mapper.readValue(root.get("faultData").toString(), TrapDatas.class); + ClosedLoopFaultTrapDatas trapDatas = mapper.readValue(root.get("trapData").toString(), ClosedLoopFaultTrapDatas.class); + ClosedLoopFaultTrapDatas faultDatas = mapper.readValue(root.get("faultData").toString(), ClosedLoopFaultTrapDatas.class); ClosedLoopGridJSONData policyJsonData = mapper.readValue(root.get("policyData").get("policy").toString(), ClosedLoopGridJSONData.class); ClosedLoopFaultBody jsonBody = mapper.readValue(root.get("policyData").get("policy").get("jsonBodyData").toString(), ClosedLoopFaultBody.class); @@ -164,7 +165,7 @@ public class CreateClosedLoopFaultController extends RestrictedBaseController{ } return policyData; } - + @SuppressWarnings("unchecked") private String connectTriggerSignature(int index, ArrayList<Object> triggerSignatures, Object object) { @@ -241,17 +242,17 @@ public class CreateClosedLoopFaultController extends RestrictedBaseController{ return resultBody.toString(); } - + private String callTrap(String trap, Object object) { String signatureBody = ""; - TrapDatas trapDatas = (TrapDatas) object; - ArrayList<Object> attributeList = new ArrayList<>(); + ClosedLoopFaultTrapDatas trapDatas = (ClosedLoopFaultTrapDatas) object; + List<Object> attributeList = new ArrayList<>(); // Read the Trap if(! "nill".equals(trap)){ try{ if(trap.startsWith("Trap")){ if("Trap1".equals(trap)){ - attributeList = trapDatas.getTrap1(); + attributeList = trapDatas.getTrap1(); }else if("Trap2".equals(trap)){ attributeList = trapDatas.getTrap2(); }else if("Trap3".equals(trap)){ @@ -281,7 +282,7 @@ public class CreateClosedLoopFaultController extends RestrictedBaseController{ } } } catch(Exception e){ - policyLogger.warn("Error during callTrap" , e); + policyLogger.warn("Error during callTrap" , e); return "(" + trap + ")"; } }else{ @@ -294,9 +295,9 @@ public class CreateClosedLoopFaultController extends RestrictedBaseController{ signatureBody = signatureBody + "(" + readAttributes(attributeList, attributeList.size()-1) + ")"; return signatureBody; } - + @SuppressWarnings("unchecked") - private String readAttributes(ArrayList<Object> object, int index) { + private String readAttributes(List<Object> object, int index) { String attributes = ""; Map<String, String> trapSignatures = (Map<String, String>) object.get(index); // Read the Elements. @@ -365,144 +366,144 @@ public class CreateClosedLoopFaultController extends RestrictedBaseController{ } return attributes; } - + private String getVarbindOID(String attrib) { VarbindDictionary varbindId = null; try{ - varbindId = (VarbindDictionary) commonclassdao.getEntityItem(VarbindDictionary.class, "varbindName", attrib); - return varbindId.getVarbindOID(); + varbindId = (VarbindDictionary) commonclassdao.getEntityItem(VarbindDictionary.class, "varbindName", attrib); + return varbindId.getVarbindOID(); }catch(Exception e){ - policyLogger.error("Error during retrieving varbindName " + attrib, e); + policyLogger.error("Error during retrieving varbindName " + attrib, e); return attrib; } } - + //connect traps data set to JSON Body as String - @SuppressWarnings({ "unchecked", "rawtypes" }) - private String getUIConnectTraps(ArrayList<Object> connectTrapSignatures) { - StringBuilder resultBody = new StringBuilder(); - String connectMainBody = ""; - for(int j = 0; j < connectTrapSignatures.size(); j++){ - Map<String, String> connectTraps = (Map<String, String>)connectTrapSignatures.get(j); + @SuppressWarnings({ "unchecked", "rawtypes" }) + private String getUIConnectTraps(ArrayList<Object> connectTrapSignatures) { + StringBuilder resultBody = new StringBuilder(); + String connectMainBody = ""; + for(int j = 0; j < connectTrapSignatures.size(); j++){ + Map<String, String> connectTraps = (Map<String, String>)connectTrapSignatures.get(j); + String connectBody = ""; + Object object = connectTraps; + if(object instanceof LinkedHashMap<?, ?>){ + String notBox = ""; + String connectTrap1 = ""; + String trapCount1 = ""; + String operatorBox = ""; + String connectTrap2 = ""; + String trapCount2 = ""; + if(((LinkedHashMap) object).keySet().contains("notBox")){ + notBox = ((LinkedHashMap) object).get("notBox").toString(); + } + if(((LinkedHashMap) object).get("connectTrap1") != null){ + connectTrap1 = ((LinkedHashMap) object).get("connectTrap1").toString(); + } + if(((LinkedHashMap) object).get("trapCount1") != null){ + trapCount1 = ((LinkedHashMap) object).get("trapCount1").toString(); + } + if(((LinkedHashMap) object).get("operatorBox") != null){ + operatorBox = ((LinkedHashMap) object).get("operatorBox").toString(); + } + if(((LinkedHashMap) object).get("connectTrap2") != null){ + connectTrap2 = ((LinkedHashMap) object).get("connectTrap2").toString(); + } + if(((LinkedHashMap) object).get("trapCount2") != null){ + trapCount2 = ((LinkedHashMap) object).get("trapCount2").toString(); + } + connectBody = notBox + "@!" + connectTrap1 + "@!" + trapCount1 + "@!" + operatorBox + "@!" + connectTrap2 + "@!" + trapCount2 + "#!?!"; + } + resultBody.append(connectBody); + } + connectMainBody = connectMainBody + resultBody; + return connectMainBody; + } + + + + // get Trigger signature from JSON body + @SuppressWarnings({ "rawtypes", "unchecked" }) + private String getUITriggerSignature(String trap, Object object2) { + StringBuilder triggerBody = new StringBuilder(); + ClosedLoopFaultTrapDatas trapDatas = (ClosedLoopFaultTrapDatas) object2; + ArrayList<Object> attributeList = new ArrayList<>(); + // Read the Trap + if(trap.startsWith("Trap")){ + if(trapDatas.getTrap1()!= null){ + attributeList.add(trapDatas.getTrap1()); + } + if(trapDatas.getTrap2()!= null){ + attributeList.add(trapDatas.getTrap2()); + } + if(trapDatas.getTrap3()!= null){ + attributeList.add(trapDatas.getTrap3()); + } + if(trapDatas.getTrap4()!= null){ + attributeList.add(trapDatas.getTrap4()); + } + if(trapDatas.getTrap5()!= null){ + attributeList.add(trapDatas.getTrap5()); + } + if(trapDatas.getTrap6()!= null){ + attributeList.add(trapDatas.getTrap6()); + } + }else{ + if(trap.startsWith("Fault")){ + if(trapDatas.getTrap1()!= null){ + attributeList.add(trapDatas.getTrap1()); + } + if(trapDatas.getTrap2()!= null){ + attributeList.add(trapDatas.getTrap2()); + } + if(trapDatas.getTrap3()!= null){ + attributeList.add(trapDatas.getTrap3()); + } + if(trapDatas.getTrap4()!= null){ + attributeList.add(trapDatas.getTrap4()); + } + if(trapDatas.getTrap5()!= null){ + attributeList.add(trapDatas.getTrap5()); + } + if(trapDatas.getTrap6()!= null){ + attributeList.add(trapDatas.getTrap6()); + } + } + } + + for(int j = 0; j < attributeList.size(); j++){ + StringBuilder signatureBody = new StringBuilder(); + ArrayList<Object> connectTraps = (ArrayList<Object>) attributeList.get(j); + for(int i =0 ; i < connectTraps.size(); i++){ String connectBody = ""; - Object object = connectTraps; + Object object = connectTraps.get(i); if(object instanceof LinkedHashMap<?, ?>){ String notBox = ""; - String connectTrap1 = ""; - String trapCount1 = ""; + String trigger1 = ""; String operatorBox = ""; - String connectTrap2 = ""; - String trapCount2 = ""; + String trigger2 = ""; if(((LinkedHashMap) object).keySet().contains("notBox")){ notBox = ((LinkedHashMap) object).get("notBox").toString(); } - if(((LinkedHashMap) object).get("connectTrap1") != null){ - connectTrap1 = ((LinkedHashMap) object).get("connectTrap1").toString(); - } - if(((LinkedHashMap) object).get("trapCount1") != null){ - trapCount1 = ((LinkedHashMap) object).get("trapCount1").toString(); + if(((LinkedHashMap) object).get("trigger1") != null){ + trigger1 = ((LinkedHashMap) object).get("trigger1").toString(); } if(((LinkedHashMap) object).get("operatorBox") != null){ operatorBox = ((LinkedHashMap) object).get("operatorBox").toString(); } - if(((LinkedHashMap) object).get("connectTrap2") != null){ - connectTrap2 = ((LinkedHashMap) object).get("connectTrap2").toString(); + if(((LinkedHashMap) object).get("trigger2") != null){ + trigger2 = ((LinkedHashMap) object).get("trigger2").toString(); } - if(((LinkedHashMap) object).get("trapCount2") != null){ - trapCount2 = ((LinkedHashMap) object).get("trapCount2").toString(); - } - connectBody = notBox + "@!" + connectTrap1 + "@!" + trapCount1 + "@!" + operatorBox + "@!" + connectTrap2 + "@!" + trapCount2 + "#!?!"; + connectBody = notBox + "@!" + trigger1 + "@!" + operatorBox + "@!" + trigger2 + "#!"; } - resultBody.append(connectBody); + signatureBody.append(connectBody); } - connectMainBody = connectMainBody + resultBody; - return connectMainBody; + triggerBody.append(signatureBody + "?!"); } - - - // get Trigger signature from JSON body - @SuppressWarnings({ "rawtypes", "unchecked" }) - private String getUITriggerSignature(String trap, Object object2) { - StringBuilder triggerBody = new StringBuilder(); - TrapDatas trapDatas = (TrapDatas) object2; - ArrayList<Object> attributeList = new ArrayList<>(); - // Read the Trap - if(trap.startsWith("Trap")){ - if(trapDatas.getTrap1()!= null){ - attributeList.add(trapDatas.getTrap1()); - } - if(trapDatas.getTrap2()!= null){ - attributeList.add(trapDatas.getTrap2()); - } - if(trapDatas.getTrap3()!= null){ - attributeList.add(trapDatas.getTrap3()); - } - if(trapDatas.getTrap4()!= null){ - attributeList.add(trapDatas.getTrap4()); - } - if(trapDatas.getTrap5()!= null){ - attributeList.add(trapDatas.getTrap5()); - } - if(trapDatas.getTrap6()!= null){ - attributeList.add(trapDatas.getTrap6()); - } - }else{ - if(trap.startsWith("Fault")){ - if(trapDatas.getTrap1()!= null){ - attributeList.add(trapDatas.getTrap1()); - } - if(trapDatas.getTrap2()!= null){ - attributeList.add(trapDatas.getTrap2()); - } - if(trapDatas.getTrap3()!= null){ - attributeList.add(trapDatas.getTrap3()); - } - if(trapDatas.getTrap4()!= null){ - attributeList.add(trapDatas.getTrap4()); - } - if(trapDatas.getTrap5()!= null){ - attributeList.add(trapDatas.getTrap5()); - } - if(trapDatas.getTrap6()!= null){ - attributeList.add(trapDatas.getTrap6()); - } - } - } - - for(int j = 0; j < attributeList.size(); j++){ - StringBuilder signatureBody = new StringBuilder(); - ArrayList<Object> connectTraps = (ArrayList<Object>) attributeList.get(j); - for(int i =0 ; i < connectTraps.size(); i++){ - String connectBody = ""; - Object object = connectTraps.get(i); - if(object instanceof LinkedHashMap<?, ?>){ - String notBox = ""; - String trigger1 = ""; - String operatorBox = ""; - String trigger2 = ""; - if(((LinkedHashMap) object).keySet().contains("notBox")){ - notBox = ((LinkedHashMap) object).get("notBox").toString(); - } - if(((LinkedHashMap) object).get("trigger1") != null){ - trigger1 = ((LinkedHashMap) object).get("trigger1").toString(); - } - if(((LinkedHashMap) object).get("operatorBox") != null){ - operatorBox = ((LinkedHashMap) object).get("operatorBox").toString(); - } - if(((LinkedHashMap) object).get("trigger2") != null){ - trigger2 = ((LinkedHashMap) object).get("trigger2").toString(); - } - connectBody = notBox + "@!" + trigger1 + "@!" + operatorBox + "@!" + trigger2 + "#!"; - } - signatureBody.append(connectBody); - } - triggerBody.append(signatureBody + "?!"); - } - - return triggerBody.toString(); - } + return triggerBody.toString(); + } public void prePopulateClosedLoopFaultPolicyData(PolicyRestAdapter policyAdapter, PolicyEntity entity) { if (policyAdapter.getPolicyData() instanceof PolicyType) { @@ -515,7 +516,7 @@ public class CreateClosedLoopFaultController extends RestrictedBaseController{ try{ description = policy.getDescription().substring(0, policy.getDescription().indexOf("@CreatedBy:")); }catch(Exception e){ - policyLogger.error("Error during collecting the description tag info for createClosedLoopFault " + policyNameValue , e); + policyLogger.error("Error during collecting the description tag info for createClosedLoopFault " + policyNameValue , e); description = policy.getDescription(); } policyAdapter.setPolicyDescription(description); @@ -548,7 +549,7 @@ public class CreateClosedLoopFaultController extends RestrictedBaseController{ String value = (String) attributeValue.getContent().get(0); AttributeDesignatorType designator = match.getAttributeDesignator(); String attributeId = designator.getAttributeId(); - + // First match in the target is OnapName, so set that value. if ("ONAPName".equals(attributeId)) { policyAdapter.setOnapName(value); @@ -611,51 +612,6 @@ public class CreateClosedLoopFaultController extends RestrictedBaseController{ } -class TrapDatas{ - private ArrayList<Object> trap1; - private ArrayList<Object> trap2; - private ArrayList<Object> trap3; - private ArrayList<Object> trap4; - private ArrayList<Object> trap5; - private ArrayList<Object> trap6; - public ArrayList<Object> getTrap1() { - return trap1; - } - public void setTrap1(ArrayList<Object> trap1) { - this.trap1 = trap1; - } - public ArrayList<Object> getTrap2() { - return trap2; - } - public void setTrap2(ArrayList<Object> trap2) { - this.trap2 = trap2; - } - public ArrayList<Object> getTrap3() { - return trap3; - } - public void setTrap3(ArrayList<Object> trap3) { - this.trap3 = trap3; - } - public ArrayList<Object> getTrap4() { - return trap4; - } - public void setTrap4(ArrayList<Object> trap4) { - this.trap4 = trap4; - } - public ArrayList<Object> getTrap5() { - return trap5; - } - public void setTrap5(ArrayList<Object> trap5) { - this.trap5 = trap5; - } - public ArrayList<Object> getTrap6() { - return trap6; - } - public void setTrap6(ArrayList<Object> trap6) { - this.trap6 = trap6; - } -} - class ClosedLoopGridJSONData{ private String clearTimeOut; @@ -682,7 +638,7 @@ class ClosedLoopGridJSONData{ public void setVerificationclearTimeOut(String verificationclearTimeOut) { this.verificationclearTimeOut = verificationclearTimeOut; } - + public ArrayList<Object> getConnecttriggerSignatures() { return connecttriggerSignatures; diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateDcaeMicroServiceController.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateDcaeMicroServiceController.java index 431482d40..d1043f709 100644 --- a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateDcaeMicroServiceController.java +++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateDcaeMicroServiceController.java @@ -701,6 +701,7 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController { //List Datatype Set<String> keys= keyValues.keySet(); Iterator<String> itr=keys.iterator(); + boolean isDefinedType = false; while(itr.hasNext()){ String key= itr.next(); if(!("type").equals(key) ||("required").equals(key)) @@ -713,18 +714,19 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController { constraints.add(keyValues.get(key)); } }else{ - //This is user defined string + //This is user defined type String trimValue=value.substring(value.lastIndexOf('.')+1); StringBuilder referenceIndividualStringBuilder= new StringBuilder(); referenceIndividualStringBuilder.append(keySetString+"="+trimValue+":MANY-true"); referenceStringBuilder.append(referenceIndividualStringBuilder+","); + isDefinedType = true; } } } - if(keyValues.get("type").equalsIgnoreCase(LIST) && - (constraints == null || constraints.isEmpty()) ) { + if(!isDefinedType && keyValues.get("type").equalsIgnoreCase(LIST) && + (constraints == null || constraints.isEmpty()) ) { //type is list but no constraints defined. referenceStringBuilder.append(keySetString+"=MANY-true"+","); } }else{ diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/PDPController.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/PDPController.java index 7966af15b..a8a427970 100644 --- a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/PDPController.java +++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/PDPController.java @@ -348,8 +348,8 @@ public class PDPController extends RestrictedBaseController { PrintWriter out = response.getWriter(); refreshGroups(request); - String responseString = mapper.writeValueAsString(groups); - JSONObject j = new JSONObject("{pdpEntityDatas: " + responseString + "}"); + JsonMessage msg = new JsonMessage(mapper.writeValueAsString(groups)); + JSONObject j = new JSONObject(msg); out.write(j.toString()); } catch (Exception e){ diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/Dictionary/CLSiteDictionary.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/Dictionary/CLSiteDictionary.html index 569f7bf5d..02175f92e 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/Dictionary/CLSiteDictionary.html +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/Dictionary/CLSiteDictionary.html @@ -23,10 +23,6 @@ <div class="modal-content"> <div class="modal-header"> <h2 class="font-showcase-font-name" style="color : #157bb2">{{label}}</h2> - <div class="corner-button in"> - <button type="button" class="close" aria-label="Close" - ng-click="$dismiss('cancel')"></button> - </div> </div> <form name="formdata" ng-submit="saveCLSite(editCLSite);" novalidate> <div class="modal-body"> diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/Dictionary/CLVarbindDictionary.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/Dictionary/CLVarbindDictionary.html index 2271992b0..2858d9782 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/Dictionary/CLVarbindDictionary.html +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/Dictionary/CLVarbindDictionary.html @@ -23,10 +23,6 @@ <div class="modal-content"> <div class="modal-header"> <h2 class="font-showcase-font-name" style="color : #157bb2">{{label}}</h2> - <div class="corner-button in"> - <button type="button" class="close" aria-label="Close" - ng-click="$dismiss('cancel')"></button> - </div> </div> <form name="formdata" ng-submit="saveCLVarbind(editCLVarbind);" novalidate> <div class="modal-body"> diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/Dictionary/FWZoneDictionary.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/Dictionary/FWZoneDictionary.html index 194f4481f..380f22bb3 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/Dictionary/FWZoneDictionary.html +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/Dictionary/FWZoneDictionary.html @@ -23,10 +23,6 @@ <div class="modal-content"> <div class="modal-header"> <h2 class="font-showcase-font-name" style="color : #157bb2">{{label}}</h2> - <div class="corner-button in"> - <button type="button" class="close" aria-label="Close" - ng-click="$dismiss('cancel')"></button> - </div> </div> <form name="formdata" ng-submit="saveZoneName(editZoneName);" novalidate> <div class="modal-body"> diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/Dictionary/MSConfigNameDictionary.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/Dictionary/MSConfigNameDictionary.html index 0b89a3150..cfde1c2dd 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/Dictionary/MSConfigNameDictionary.html +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/Dictionary/MSConfigNameDictionary.html @@ -23,10 +23,6 @@ <div class="modal-content"> <div class="modal-header"> <h2 class="font-showcase-font-name" style="color : #157bb2">{{label}}</h2> - <div class="corner-button in"> - <button type="button" class="close" aria-label="Close" - ng-click="$dismiss('cancel')"></button> - </div> </div> <form name="formdata" ng-submit="saveMSConfig(editMSConfig);" novalidate> <div class="modal-body"> diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/Dictionary/MSDCAEUUIDDictionary.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/Dictionary/MSDCAEUUIDDictionary.html index 89e3aff1e..4fded51ec 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/Dictionary/MSDCAEUUIDDictionary.html +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/Dictionary/MSDCAEUUIDDictionary.html @@ -23,10 +23,6 @@ <div class="modal-content"> <div class="modal-header"> <h2 class="font-showcase-font-name" style="color : #157bb2">{{label}}</h2> - <div class="corner-button in"> - <button type="button" class="close" aria-label="Close" - ng-click="$dismiss('cancel')"></button> - </div> </div> <form name="formdata" ng-submit="saveDCAEUUID(editDCAEuuid);" novalidate> <div class="modal-body"> diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/Dictionary/MSLocationDictionary.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/Dictionary/MSLocationDictionary.html index a6919870f..609c9f326 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/Dictionary/MSLocationDictionary.html +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/Dictionary/MSLocationDictionary.html @@ -23,10 +23,6 @@ <div class="modal-content"> <div class="modal-header"> <h2 class="font-showcase-font-name" style="color : #157bb2">{{label}}</h2> - <div class="corner-button in"> - <button type="button" class="close" aria-label="Close" - ng-click="$dismiss('cancel')"></button> - </div> </div> <form name="formdata" ng-submit="saveMSLocation(editMSLocation);" novalidate> <div class="modal-body"> diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/Dictionary/MSModelsDictionary.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/Dictionary/MSModelsDictionary.html index 15a476040..fbdd8cd6c 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/Dictionary/MSModelsDictionary.html +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/Dictionary/MSModelsDictionary.html @@ -23,10 +23,6 @@ <div class="modal-content"> <div class="modal-header"> <h2 class="font-showcase-font-name" style="color : #157bb2">{{label}}</h2> - <div class="corner-button in"> - <button type="button" class="close" aria-label="Close" - ng-click="$dismiss('cancel')"></button> - </div> </div> <form name="formdata" ng-submit="saveMSModel(editMSmodelName);" novalidate> <div class="modal-body"> diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/Dictionary/ModelAttributeDictionary.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/Dictionary/ModelAttributeDictionary.html index 201e1ba52..0531a00ae 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/Dictionary/ModelAttributeDictionary.html +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/Dictionary/ModelAttributeDictionary.html @@ -24,7 +24,6 @@ <div class="modal-header"> <h2 class="font-showcase-font-name" style="color : #157bb2">{{label}}</h2> </div> - <div class="divider-container"><hr> </div> <form name="formdata" ng-submit="saveModelAttribute(editModelAttribute);" novalidate> <div class="modal-body"> <div class="form-group row"> diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/Edit_Roles_Window.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/Edit_Roles_Window.html index 11e960b51..7974d4e3f 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/Edit_Roles_Window.html +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/Edit_Roles_Window.html @@ -40,13 +40,13 @@ <div class="form-group row"> <div class="form-group col-sm-6" > <label><sup><b>*</b></sup>Scope:</label><br> - <select class="form-control" multiple ng-model="editRole.scope" ng-options="option for option in scopeDatas" ></select> + <select class="form-control" multiple ng-model="editRole.scope" ng-options="option for option in scopeDatas" title="Select the Scopes from the dropdown."></select> </div> </div> </div> <div class="modal-footer"> - <button class="btn btn-success" herf="javascript:void(0)" ng-click="saveRole(editRole);">Save</button> - <button class="btn btn-default" herf="javascript:void(0)" ng-click="close()">Close</button> + <button class="btn btn-success" herf="javascript:void(0)" ng-click="saveRole(editRole);" title="OnClick Policy Role is saved.">Save</button> + <button class="btn btn-default" herf="javascript:void(0)" ng-click="close()" title="OnClick Policy Role Window is closed.">Close</button> </div> </div> </div> diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/PDPTabWindows/AddorEditPDPtoGroup.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/PDPTabWindows/AddorEditPDPtoGroup.html index cbb617c6f..cc3d076c9 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/PDPTabWindows/AddorEditPDPtoGroup.html +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/PDPTabWindows/AddorEditPDPtoGroup.html @@ -28,34 +28,34 @@ <div class="form-group row"> <div class="form-group col-sm-6"> <label>PDP URL:<sup><b>*</b></sup> </label><br> - <input type="text" class="form-control" ng-model="editPDPInGroup.id" class="form-control" /> + <input type="text" class="form-control" ng-model="editPDPInGroup.id" class="form-control" title="Enter the valid PDP URL value."/> </div> </div> <div class="form-group row"> <div class="form-group col-sm-6"> <label>JMX Port:<sup><b>*</b></sup></label><br> <input type="text" class="form-control" ng-model="editPDPInGroup.jmxPort" - class="form-control" /> + class="form-control" title="Enter the valid PDP JMX Port Number."/> </div> </div> <div class="form-group row"> <div class="form-group col-sm-6"> <label>PDP Name:<sup><b>*</b></sup></label><br> <input type="text" class="form-control" ng-model="editPDPInGroup.name" - class="form-control" /> + class="form-control" title="Enter the PDP Name."/> </div> </div> <div class="form-group row"> <div class="form-group col-sm-6"> <label>PDP Description:</label><br> <input type="text" class="form-control" ng-model="editPDPInGroup.description" - class="form-control"/> + class="form-control" title="Enter the PDP Description."/> </div> </div> </div> <div class="modal-footer"> - <button class="btn btn-success" herf="javascript:void(0)" ng-click="savePDPInGroup(editPDPInGroup);">Save</button> - <button class="btn btn-default" herf="javascript:void(0)" ng-click="close()">Close</button> + <button class="btn btn-success" herf="javascript:void(0)" ng-click="savePDPInGroup(editPDPInGroup);" title="OnClick PDP Group is created.">Save</button> + <button class="btn btn-default" herf="javascript:void(0)" ng-click="close()" title="OnClick PDP Group Window is closed.">Close</button> </div> </div> </div> diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/PushtabWindow/removeGroupPoliciesWindow.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/PushtabWindow/removeGroupPoliciesWindow.html index d6bde6957..84c6c3f8c 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/PushtabWindow/removeGroupPoliciesWindow.html +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/PushtabWindow/removeGroupPoliciesWindow.html @@ -29,8 +29,8 @@ <div style="width: 100%; height:580px" ui-grid = "removePoliciesGrid" ui-grid-pagination ui-grid-selection ui-grid-exporter class= "grid"></div> </div> <div class="modal-footer"> - <button class="btn btn-success" herf="javascript:void(0)" ng-click="removePolicies();">Remove</button> - <button class="btn btn-default" herf="javascript:void(0)" ng-click="$close()">Close</button> + <button class="btn btn-success" herf="javascript:void(0)" ng-click="removePolicies();" title="OnClick Policy will be removed from PDP Group.">Remove</button> + <button class="btn btn-default" herf="javascript:void(0)" ng-click="$close()" title="OnClick Remove Policy Window is Closed.">Close</button> </div> </div> </div> diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/new_PDPGroup_Window.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/new_PDPGroup_Window.html index e13a140d9..8eae7a144 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/new_PDPGroup_Window.html +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/new_PDPGroup_Window.html @@ -28,19 +28,19 @@ <div class="form-group row"> <div class="form-group col-sm-6"> <label>Group Name:<sup><b>*</b></sup> </label><br> - <input type="text" class="form-control" ng-model="editPDPGroup.groupName"/> + <input type="text" class="form-control" ng-model="editPDPGroup.groupName" title="Enter the Valid PDP Group Name."/> </div> </div> <div class="form-group row"> <div class="form-group col-sm-6"> <label><sup><b></b></sup>Group Description:</label><br> - <input type="text" class="form-control" ng-model="editPDPGroup.description"/> + <input type="text" class="form-control" ng-model="editPDPGroup.description" title="Enter the Description"/> </div> </div> </div> <div class="modal-footer"> - <button class="btn btn-success" herf="javascript:void(0)" ng-click="savePDPGroup(editPDPGroup);">Save</button> - <button class="btn btn-default" herf="javascript:void(0)" ng-click="close()">Close</button> + <button class="btn btn-success" herf="javascript:void(0)" ng-click="savePDPGroup(editPDPGroup);" title="OnClick PDP Group is saved.">Save</button> + <button class="btn btn-default" herf="javascript:void(0)" ng-click="close()" title="OnClick PDP Group Window is closed.">Close</button> </div> </div> </div> @@ -58,11 +58,11 @@ <div class="form-group row"> <div class="form-group col-sm-6"> <label> Group Name:<sup><b>*</b></sup></label><br> - <input type="text" class="form-control" ng-model="editPDPGroup.name"/> + <input type="text" class="form-control" ng-model="editPDPGroup.name" title="Enter the Valid PDP Group Name."/> </div> <div class="form-group col-sm-6"> <label>Group Description:</label><br> - <input type="text" class="form-control" ng-model="editPDPGroup.description"/> + <input type="text" class="form-control" ng-model="editPDPGroup.description" title="Enter the Description"/> </div> </div> <div > @@ -75,8 +75,8 @@ </div> </div> <div class="modal-footer"> - <button class="btn btn-success" herf="javascript:void(0)" ng-click="savePDPGroup(editPDPGroup);">Save</button> - <button class="btn btn-default" herf="javascript:void(0)" ng-click="close()">Close</button> + <button class="btn btn-success" herf="javascript:void(0)" ng-click="savePDPGroup(editPDPGroup);" title="OnClick PDP Group is Updated.">Save</button> + <button class="btn btn-default" herf="javascript:void(0)" ng-click="close()" title="OnClick PDP Group Window is closed.">Close</button> </div> </div> </div> @@ -101,7 +101,7 @@ </div> </div> <div class="modal-footer"> - <button class="btn btn-default" herf="javascript:void(0)" ng-click="close()">Close</button> + <button class="btn btn-default" herf="javascript:void(0)" ng-click="close()" title="OnClick Show Policies PDP Group Window is closed.">Close</button> </div> </div> </div> diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/pdpController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/pdpController.js index cab5d26c0..966a0913e 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/pdpController.js +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/pdpController.js @@ -53,14 +53,7 @@ app.controller('pdpTabController', function ($scope, PolicyAppService, modalServ $scope.editPdpGroupId = true; } } - - PolicyAppService.getData('get_PDPGroupData').then(function(data){ - var j = data; - $scope.pdpdatas = JSON.parse(j.data); - console.log($scope.pdpdatas); - },function(error){ - console.log("failed"); - }); + getPDPGroups(); },function (error) { console.log("failed"); }); @@ -77,7 +70,6 @@ app.controller('pdpTabController', function ($scope, PolicyAppService, modalServ }; $scope.editPDPGroup = null; - var dialog = null; $scope.editPDPGroupFunctionPopup = function(pdpGroupData) { $scope.editPDPGroup = pdpGroupData; $( "#dialog" ).dialog({ @@ -87,8 +79,9 @@ app.controller('pdpTabController', function ($scope, PolicyAppService, modalServ $scope.editPDPGroupFunctionModalPopup = function(pdpGroupData) { $scope.editPDPGroup = pdpGroupData; + var modalInstance; if($scope.userRolesDatas[0] == 'super-guest' || $scope.userRolesDatas[0] == 'guest'){ - var modalInstance = $modal.open({ + modalInstance = $modal.open({ backdrop: 'static', keyboard: false, templateUrl: 'show_policies_pdp_group_popup.html', controller: 'editPDPGrouppopupController', @@ -102,7 +95,7 @@ app.controller('pdpTabController', function ($scope, PolicyAppService, modalServ } }); }else{ - var modalInstance = $modal.open({ + modalInstance = $modal.open({ backdrop: 'static', keyboard: false, templateUrl: 'edit_pdp_group_popup.html', controller: 'editPDPGrouppopupController', @@ -118,10 +111,20 @@ app.controller('pdpTabController', function ($scope, PolicyAppService, modalServ } modalInstance.result.then(function(response){ console.log('response', response); - $scope.pdpdatas=response.data; + getPDPGroups(); }); }; + function getPDPGroups(){ + PolicyAppService.getData('get_PDPGroupData').then(function(data){ + var j = data; + $scope.pdpdatas = JSON.parse(j.data); + console.log($scope.pdpdatas); + },function(error){ + console.log("failed"); + }); + } + $scope.addNewPDPGroupPopUpWindow = function(editPDPGroup) { $scope.editPDPGroup = null; var modalInstance = $modal.open({ @@ -161,9 +164,8 @@ app.controller('pdpTabController', function ($scope, PolicyAppService, modalServ dataType: 'json', contentType: 'application/json', data: JSON.stringify(postData), - success : function(data){ - $scope.$apply(function(){$scope.pdpdata=data.data;}); - $scope.pdpdatas=JSON.parse(data.data); + success : function(response){ + $scope.$apply(function(){$scope.pdpdatas=JSON.parse(response.data);}); }, error : function(data){ console.log(data); diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/pdpGroupPopUpController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/pdpGroupPopUpController.js index 4b2747635..0e28dc09f 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/pdpGroupPopUpController.js +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/pdpGroupPopUpController.js @@ -18,15 +18,16 @@ * ============LICENSE_END========================================================= */ app.controller('editPDPGrouppopupController' , function ($scope, $modalInstance, message, modalService, $modal, Notification){ - if(message.pdpGroupData==null) + if(message.pdpGroupData==null){ $scope.label='Add New PDP Group' - else{ - $scope.label='Edit PDP Group' - $scope.disableCd=true; - $scope.policies = message.pdpGroupData.policies; - $scope.pdps = message.pdpGroupData.pdps; - $scope.selectedPdp = message.pdpGroupData; - } + }else{ + $scope.label='Edit PDP Group' + $scope.disableCd=true; + $scope.policies = message.pdpGroupData.policies; + $scope.pdps = message.pdpGroupData.pdps; + $scope.selectedPdp = message.pdpGroupData; + } + $scope.editPDPGroup = message.pdpGroupData; $scope.policiesGrid = { @@ -76,7 +77,7 @@ app.controller('editPDPGrouppopupController' , function ($scope, $modalInstance }); modalInstance.result.then(function(response){ console.log('response', response); - $scope.data=response.data; + refreshPDPGroupDatas(response); }); }; @@ -98,34 +99,34 @@ app.controller('editPDPGrouppopupController' , function ($scope, $modalInstance }); modalInstance.result.then(function(response){ console.log('response', response); - $scope.data=response.data; + refreshPDPGroupDatas(response); }); }; $scope.deletePDPFromGroup = function(data){ modalService.popupConfirmWin("Confirm","You are about to delete the PDP Group : "+data.name+". Do you want to continue?", - function(){ - var uuu = "pdp_Group/remove_pdpFromGroup.htm"; - var postData={data: data, - activePDP : $scope.selectedPdp}; - $.ajax({ - type : 'POST', - url : uuu, - dataType: 'json', - contentType: 'application/json', - data: JSON.stringify(postData), - success : function(data){ - $scope.$apply(function(){$scope.data=data.data;}); - Notification.success("PDP Group Deleted Successfully"); - }, - error : function(data){ - console.log(data); - Notification.error("Error Occured While Deleting a PDP Group") - //modalService.showFailure("Fail","Error while deleting: "+ data.responseText); - } - }); - - }) + function(){ + var uuu = "pdp_Group/remove_pdpFromGroup.htm"; + var postData={data: data, + activePDP : $scope.selectedPdp}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + refreshPDPGroupDatas(data); + }); + Notification.success("PDP Group Deleted Successfully"); + }, + error : function(data){ + console.log(data); + Notification.error("Error Occured While Deleting a PDP Group"); + } + }); + }) }; $scope.statusOfPDP = function(status){ @@ -167,10 +168,23 @@ app.controller('editPDPGrouppopupController' , function ($scope, $modalInstance $modalInstance.close({data:$scope.data}); }, error : function(data){ - alert("Error while saving."); + Notification.error("Error while saving PDP Group."); } }); }; + + function refreshPDPGroupDatas(response){ + $scope.selectedPDPName = $scope.selectedPdp.id; + if(response != undefined){ + $scope.data = JSON.parse(response.data); + for(var i=0; i< $scope.data.length; i++){ + if($scope.data[i].id === $scope.selectedPDPName){ + $scope.policies = $scope.data[i].policies; + $scope.pdps = $scope.data[i].pdps; + } + } + } + }; $scope.close = function() { $modalInstance.close(); diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/BaseConfigPolicyController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/BaseConfigPolicyController.js index 7425c92d4..02e10bddd 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/BaseConfigPolicyController.js +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/BaseConfigPolicyController.js @@ -82,14 +82,6 @@ app.controller('baseConfigController', ['$scope', 'PolicyAppService', 'policyNav }, function (error) { console.log("failed"); }); - - - function extend(obj, src) { - for (var key in src) { - if (src.hasOwnProperty(key)) obj[key] = src[key]; - } - return obj; - } $scope.savePolicy = function(policy){ if(policy.itemContent != undefined){ diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/ClosedLoopFaultController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/ClosedLoopFaultController.js index 1015e7aac..ebc9001ab 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/ClosedLoopFaultController.js +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/ClosedLoopFaultController.js @@ -529,64 +529,73 @@ angular.module("abs").controller('clFaultController', ['$scope', '$window', 'Pol } }; - $scope.saveFaultPolicy = function(policy){ - if(policy.itemContent != undefined){ - $scope.refreshCheck = true; - $scope.policyNavigator = policy.itemContent; - policy.itemContent = ""; - } - $scope.savebutton = false; + function trapData(){ var data = {}; - var faultData = {}; if($scope.temp.policy.triggerTrapSignatures.length == 1 || $scope.temp.policy.triggerTrapSignatures["Trap1"] != null){ - var data = {trap1 : $scope.temp.policy.triggerTrapSignatures.Trap1 } + data = {trap1 : $scope.temp.policy.triggerTrapSignatures.Trap1 } } if($scope.temp.policy.triggerTrapSignatures.length == 2 || $scope.temp.policy.triggerTrapSignatures["Trap2"] != null){ - var data = {trap1 : $scope.temp.policy.triggerTrapSignatures.Trap1, trap2 : $scope.temp.policy.triggerTrapSignatures.Trap2} + data = {trap1 : $scope.temp.policy.triggerTrapSignatures.Trap1, trap2 : $scope.temp.policy.triggerTrapSignatures.Trap2} } if($scope.temp.policy.triggerTrapSignatures.length == 3 || $scope.temp.policy.triggerTrapSignatures["Trap3"] != null){ - var data = {trap1 : $scope.temp.policy.triggerTrapSignatures.Trap1, trap2 : $scope.temp.policy.triggerTrapSignatures.Trap2, + data = {trap1 : $scope.temp.policy.triggerTrapSignatures.Trap1, trap2 : $scope.temp.policy.triggerTrapSignatures.Trap2, trap3 : $scope.temp.policy.triggerTrapSignatures.Trap3} } if($scope.temp.policy.triggerTrapSignatures.length == 4 || $scope.temp.policy.triggerTrapSignatures["Trap4"] != null){ - var data = {trap1 : $scope.temp.policy.triggerTrapSignatures.Trap1, trap2 : $scope.temp.policy.triggerTrapSignatures.Trap2, + data = {trap1 : $scope.temp.policy.triggerTrapSignatures.Trap1, trap2 : $scope.temp.policy.triggerTrapSignatures.Trap2, trap3 : $scope.temp.policy.triggerTrapSignatures.Trap3, trap4 : $scope.temp.policy.triggerTrapSignatures.Trap4} } if($scope.temp.policy.triggerTrapSignatures.length == 5 || $scope.temp.policy.triggerTrapSignatures["Trap5"] != null){ - var data = {trap1 : $scope.temp.policy.triggerTrapSignatures.Trap1, trap2 : $scope.temp.policy.triggerTrapSignatures.Trap2, + data = {trap1 : $scope.temp.policy.triggerTrapSignatures.Trap1, trap2 : $scope.temp.policy.triggerTrapSignatures.Trap2, trap3 : $scope.temp.policy.triggerTrapSignatures.Trap3, trap4 : $scope.temp.policy.triggerTrapSignatures.Trap4, trap5 : $scope.temp.policy.triggerTrapSignatures.Trap5} } if($scope.temp.policy.triggerTrapSignatures.length == 6 || $scope.temp.policy.triggerTrapSignatures["Trap6"] != null){ - var data = {trap1 : $scope.temp.policy.triggerTrapSignatures.Trap1, trap2 : $scope.temp.policy.triggerTrapSignatures.Trap2, + data = {trap1 : $scope.temp.policy.triggerTrapSignatures.Trap1, trap2 : $scope.temp.policy.triggerTrapSignatures.Trap2, trap3 : $scope.temp.policy.triggerTrapSignatures.Trap3, trap4 : $scope.temp.policy.triggerTrapSignatures.Trap4, trap5 : $scope.temp.policy.triggerTrapSignatures.Trap5, trap6 : $scope.temp.policy.triggerTrapSignatures.Trap6} - } - + } + return data; + } + + function faultDatas(){ + var faultData = {}; if($scope.temp.policy.triggerfaultSignatures.length == 1 || $scope.temp.policy.triggerfaultSignatures["Fault1"] != null){ - var faultData = {trap1 : $scope.temp.policy.triggerfaultSignatures.Fault1 } + faultData = {trap1 : $scope.temp.policy.triggerfaultSignatures.Fault1 } } if($scope.temp.policy.triggerfaultSignatures.length == 2 || $scope.temp.policy.triggerfaultSignatures["Fault2"] != null){ - var faultData = {trap1 : $scope.temp.policy.triggerfaultSignatures.Fault1, trap2 : $scope.temp.policy.triggerfaultSignatures.Fault2} + faultData = {trap1 : $scope.temp.policy.triggerfaultSignatures.Fault1, trap2 : $scope.temp.policy.triggerfaultSignatures.Fault2} } if($scope.temp.policy.triggerfaultSignatures.length == 3 || $scope.temp.policy.triggerfaultSignatures["Fault3"] != null){ - var faultData = {trap1 : $scope.temp.policy.triggerfaultSignatures.Fault1, trap2 : $scope.temp.policy.triggerfaultSignatures.Fault2, + faultData = {trap1 : $scope.temp.policy.triggerfaultSignatures.Fault1, trap2 : $scope.temp.policy.triggerfaultSignatures.Fault2, trap3 : $scope.temp.policy.triggerfaultSignatures.Fault3} } if($scope.temp.policy.triggerTrapSignatures.length == 4 || $scope.temp.policy.triggerfaultSignatures["Fault4"] != null){ - var faultData = {trap1 : $scope.temp.policy.triggerfaultSignatures.Fault1, trap2 : $scope.temp.policy.triggerfaultSignatures.Fault2, + faultData = {trap1 : $scope.temp.policy.triggerfaultSignatures.Fault1, trap2 : $scope.temp.policy.triggerfaultSignatures.Fault2, trap3 : $scope.temp.policy.triggerfaultSignatures.Fault3, trap4 : $scope.temp.policy.triggerfaultSignatures.Fault4} } if($scope.temp.policy.triggerfaultSignatures.length == 5 || $scope.temp.policy.triggerfaultSignatures["Fault5"] != null){ - var faultData = {trap1 : $scope.temp.policy.triggerfaultSignatures.Fault1, trap2 : $scope.temp.policy.triggerfaultSignatures.Fault2, + faultData = {trap1 : $scope.temp.policy.triggerfaultSignatures.Fault1, trap2 : $scope.temp.policy.triggerfaultSignatures.Fault2, trap3 : $scope.temp.policy.triggerfaultSignatures.Fault3, trap4 : $scope.temp.policy.triggerfaultSignatures.Fault4, trap5 : $scope.temp.policy.triggerfaultSignatures.Fault5} } if($scope.temp.policy.triggerfaultSignatures.length == 6 || $scope.temp.policy.triggerfaultSignatures["Fault6"] != null){ - var faultData = {trap1 : $scope.temp.policy.triggerfaultSignatures.Fault1, trap2 : $scope.temp.policy.triggerfaultSignatures.Fault2, + faultData = {trap1 : $scope.temp.policy.triggerfaultSignatures.Fault1, trap2 : $scope.temp.policy.triggerfaultSignatures.Fault2, trap3 : $scope.temp.policy.triggerfaultSignatures.Fault3, trap4 : $scope.temp.policy.triggerfaultSignatures.Fault4, trap5 : $scope.temp.policy.triggerfaultSignatures.Fault5, trap6 : $scope.temp.policy.triggerfaultSignatures.Fault6} } + return faultData; + } + + $scope.saveFaultPolicy = function(policy){ + if(policy.itemContent != undefined){ + $scope.refreshCheck = true; + $scope.policyNavigator = policy.itemContent; + policy.itemContent = ""; + } + $scope.savebutton = false; + var data = trapData(); + var faultData = faultDatas(); var uuu = "policycreation/save_policy"; var postData={policyData: policy, trapData : data, @@ -627,7 +636,9 @@ angular.module("abs").controller('clFaultController', ['$scope', '$window', 'Pol console.log(policy); document.getElementById("validate").innerHTML = ""; var uuu = "policyController/validate_policy.htm"; - var postData={policyData: policy}; + var data = trapData(); + var faultData = faultDatas(); + var postData={policyData: policy, trapData : data, faultData : faultData}; $.ajax({ type : 'POST', url : uuu, diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/DCAEMicroServicePolicyController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/DCAEMicroServicePolicyController.js index 5ae453aef..2b3b743d4 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/DCAEMicroServicePolicyController.js +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/DCAEMicroServicePolicyController.js @@ -165,7 +165,7 @@ angular.module('abs').controller('dcaeMicroServiceController', ['$scope', '$wind $scope.choices = []; $scope.attributeDatas = [{"attributes" : $scope.choices}]; - + $scope.isInitEditTemplate = true; //just initially create the edit template, didn't click add button yet. $scope.addNewChoice = function(value) { console.log(value); if(value != undefined){ @@ -176,12 +176,23 @@ angular.module('abs').controller('dcaeMicroServiceController', ['$scope', '$wind var div = document.getElementById(value+"@0"); if(div != null){ var clone = div.cloneNode(true); - var addElement = parentElement.childElementCount + 1; + var addElement = parentElement.childElementCount; clone.id = ''+value+'@'+addElement; clone.value = ''; - clone.className += ' child_single'; //here cloned is single element - document.getElementById("div."+value).appendChild(clone); - plainAttributeKeys.push(''+value+'@'+addElement); + if($scope.temp.policy.editPolicy || $scope.temp.policy.readOnly){ //if it's view or edit + if($scope.temp.policy.ruleData[clone.id] || ($scope.temp.policy.editPolicy && !$scope.isInitEditTemplate)){ // Only append child if its value found in ruleData or edit mode + if($scope.temp.policy.ruleData[clone.id]){ + clone.value = $scope.temp.policy.ruleData[clone.id]; + } + clone.className += ' child_single'; //here cloned is single element + document.getElementById("div."+value).appendChild(clone); + plainAttributeKeys.push(''+value+'@'+addElement); + } + }else{ //not view or edit + clone.className += ' child_single'; //here cloned is single element + document.getElementById("div."+value).appendChild(clone); + plainAttributeKeys.push(''+value+'@'+addElement); + } }else{ div = document.getElementById("div."+value+"@0"); @@ -219,6 +230,7 @@ angular.module('abs').controller('dcaeMicroServiceController', ['$scope', '$wind plainAttributeKeys.push(inputs[i].id); } } else { +// removeValues.push(inputs[i].id); plainAttributeKeys.push(inputs[i].id); } }else { @@ -320,8 +332,9 @@ angular.module('abs').controller('dcaeMicroServiceController', ['$scope', '$wind var plainAttributeKeys = []; $scope.dcaeModelData = data[0].dcaeModelData; $scope.dcaeJsonDate = data[0].jsonValue; - $scope.allManyTrueKeys = data[0].allManyTrueKeys; - console.log("$scope.allManyTrueKeys: " + $scope.allManyTrueKeys); + if(data[0].allManyTrueKeys){ + console.log("$scope.allManyTrueKeys: " + $scope.allManyTrueKeys); + } console.log("$scope.dcaeJsonDate: " + $scope.dcaeJsonDate); var attributes = $scope.dcaeModelData.attributes; var refAttributes = $scope.dcaeModelData.ref_attributes; @@ -371,9 +384,15 @@ angular.module('abs').controller('dcaeMicroServiceController', ['$scope', '$wind }); - if($scope.temp.policy.editPolicy || $scope.temp.policy.readOnly){ + if($scope.temp.policy.editPolicy || $scope.temp.policy.readOnly){ // If it's veiw or edit + + if($scope.temp.policy.editPolicy){ + $scope.isInitEditTemplate = true; + } + var checkData = []; var data = []; + // If ruleData contains extra elements created by clicked add button if($scope.temp.policy.ruleData != null){ var propNames = Object.getOwnPropertyNames($scope.temp.policy.ruleData); propNames.forEach(function(name) { @@ -383,32 +402,36 @@ angular.module('abs').controller('dcaeMicroServiceController', ['$scope', '$wind var extraElements = data; if(plainAttributeKeys != null){ - for(b = 0; b < plainAttributeKeys.length; b++){ // remove already populated elements from extraElements array + for(b = 0; b < plainAttributeKeys.length; b++){ // Remove already populated elements from data array var newValue = plainAttributeKeys[b].split("*"); for(a = 0; a < data.length; a++){ - if(data[a] === newValue[0]){ + if(data[a] === newValue[0] || data[a] === (newValue[0]+"@0")){ extraElements.splice(a, 1); } } } - //--- populate these extral elements generated from clicking add button + //--- Populate these extra elements created by clicked add button for(a = 0; a < extraElements.length; a++){ if(extraElements[a].includes("@")){ var n = extraElements[a].lastIndexOf("@"); - var key = extraElements[a].substring(0, n+2); //include @x in key also by n+2 since x can be 1, or 2, or 3 - checkData.push(key); + if(n > 0){ + var key = extraElements[a].substring(0, n+2); //include @x in key also by n+2 since x can be 1, or 2, or 3 + checkData.push(key); + } } } var unique = checkData.filter(onlyUnique); for(i =0; i < unique.length; i++){ //remove @x and let addNewChoice add @1 or @2... var newKey = unique[i].substring(0, unique[i].length-2); + console.log("newKey: " + newKey); $scope.addNewChoice(newKey); } } } - + //After initially create the edit template, reset it to false. + $scope.isInitEditTemplate = false; } var ele = angular.element(document.getElementById("DynamicTemplate")); $compile(ele.contents())($scope); @@ -517,7 +540,7 @@ angular.module('abs').controller('dcaeMicroServiceController', ['$scope', '$wind if (lableList.length > 0){ array = true; } - if ( key=="0"){ + if ( key==="0"){ var newKey = lableList.pop(); $scope.labelLayout(baseLevel, newKey, array ); if (array){ @@ -597,7 +620,7 @@ angular.module('abs').controller('dcaeMicroServiceController', ['$scope', '$wind if (list.length===0){ //not dropdown element $scope.attributeBox(attributekey, array, attirbuteLabel, defaultValue, isRequired, "text"); }else{ - $scope.dropBoxLayout(attirbuteLabel, attributekey, array, dataTest[key], list); + $scope.dropBoxLayout(attirbuteLabel, attributekey, array, dataTest[key], list, isRequired); } break; } @@ -618,9 +641,9 @@ angular.module('abs').controller('dcaeMicroServiceController', ['$scope', '$wind var labeltext = null; var requiredLabName = ""; if (matching.includes(attibuteKey)){ - labeltext = document.createTextNode(attibuteKey + "*!"); + labeltext = document.createTextNode(attibuteKey + "*!"); + isRequired = true; //set required as true for matching element }else { - //var labeltext = document.createTextNode(refattributeLabel); if(isRequired){ requiredLabName = attibuteKey + " *"; labeltext = document.createTextNode(requiredLabName); @@ -656,7 +679,7 @@ angular.module('abs').controller('dcaeMicroServiceController', ['$scope', '$wind var checkKey; if(attributeManyKey){ checkKey = labelValue + attibuteKey+'@0'; - textField.setAttribute("id" , ''+labelValue + attibuteKey+'@0'+''); + textField.setAttribute("id" , ''+labelValue + attibuteKey+'@0'+''); var divTag = document.createElement("div"); divTag.setAttribute("id", "div."+ labelValue +attibuteKey); var addButton = document.createElement("BUTTON"); @@ -679,7 +702,10 @@ angular.module('abs').controller('dcaeMicroServiceController', ['$scope', '$wind var divTag = document.createElement("div"); divTag.setAttribute("id", id); document.getElementById(divID).appendChild(divTag); - textField.className += ' first_child'; + textField.className += ' first_child'; + if(isRequired){ + textField.setAttribute("required", "true"); + } divTag.appendChild(textField); document.getElementById(divID).appendChild(divTag); @@ -720,18 +746,6 @@ angular.module('abs').controller('dcaeMicroServiceController', ['$scope', '$wind if (attributeManyKey){ var newCheckKey = checkKey.replace(attibuteKey + '@0',attibuteKey); document.getElementById(newCheckKey +'@0').value = $scope.temp.policy.ruleData[newCheckKey +'@0']; - var i =1 ; - while(true){ - var newValue = $scope.temp.policy.ruleData[newCheckKey+'@'+i]; - if(newValue==null){ - break; - }else{ - $scope.addNewChoice(newCheckKey); - document.getElementById(newCheckKey+'@'+i).value = newValue; - i = i+1; - } - } - }else{ document.getElementById(checkKey).value = $scope.temp.policy.ruleData[checkKey]; } @@ -807,24 +821,24 @@ angular.module('abs').controller('dcaeMicroServiceController', ['$scope', '$wind var label = document.createElement("Label") + + var refAttributes = $scope.dcaeModelData.ref_attributes; + if(isRequired != true && refAttributes){ //check refAttributes also + var refAttributesList = refAttributes.split(splitComma); + for (k = 0; k < refAttributesList.length; k++){ + var refAttribute = refAttributesList[k].split(splitEqual); + if (attributeName == refAttribute[0].trim() && refAttribute[1].includes("required-true")){ + isRequired = true; + } + } + } + if (matching.includes(attributeName)){ var labeltext = document.createTextNode(attributeName + "*!"); label.appendChild(labeltext); + isRequired = true; //set required as true for matching element }else { - var labeltext = document.createTextNode(attributeName); - var isRequired = false; - var refAttributes = $scope.dcaeModelData.ref_attributes; - if(refAttributes){ - var refAttributesList = refAttributes.split(splitComma); - for (k = 0; k < refAttributesList.length; k++){ - var refAttribute = refAttributesList[k].split(splitEqual); - - if (attributeName == refAttribute[0].trim() && refAttribute[1].includes("required-true")){ - isRequired = true; - } - } - } - + var labeltext = document.createTextNode(attributeName); if(isRequired){ requiredLabName = attributeName+ " *"; labeltext = document.createTextNode(requiredLabName); @@ -844,9 +858,11 @@ angular.module('abs').controller('dcaeMicroServiceController', ['$scope', '$wind if(isRequired){ listField.setAttribute("required", true); } - var optionFirst = document.createElement('option'); - optionFirst.setAttribute('value', ""); - listField.appendChild(optionFirst); + if( many != true || isRequired != true){ // add an empty option for not required or not multiple select element + var optionFirst = document.createElement('option'); + optionFirst.setAttribute('value', ""); + listField.appendChild(optionFirst); + } for (i=0; i < listemunerateValues.length; i += 1) { option = document.createElement('option'); diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/ActionPolicyTemplate.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/ActionPolicyTemplate.html index 313015d8e..3aa0508d5 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/ActionPolicyTemplate.html +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/ActionPolicyTemplate.html @@ -7,12 +7,13 @@ class="form-control" ng-disabled="temp.policy.readOnly" ng-readonly="temp.policy.editPolicy" ng-model="temp.policy.policyName" required pattern="\S+" - title="Enter the Policy Name without any spaces" /> + title="Enter Policy Name without any spaces and special characters and will accept _." /> </div> <div class="form-group col-sm-6"> <label>Description:</label> <input type="text" class="form-control" ng-disabled="temp.policy.readOnly" - ng-model="temp.policy.policyDescription" /> + ng-model="temp.policy.policyDescription" + title="Description field will accept any type of data."/> </div> </div> <div class="well"> @@ -20,7 +21,7 @@ <div class="form-group col-sm-2"> <label>Component Attributes:<sup><b>*</b></sup></label><br> <button type="button" class="btn btn-default" - ng-disabled="temp.policy.readOnly" ng-click="addNewChoice()"> + ng-disabled="temp.policy.readOnly" ng-click="addNewChoice()" title="onClick Component Attribute row is added."> <i class="fa fa-plus"></i> </button> </div> @@ -31,18 +32,19 @@ <div class="form-group col-sm-3"> <select class="form-control" ng-disabled="temp.policy.readOnly" ng-model="choice.key" - ng-options="option for option in attributeDictionaryDatas track by option"> + ng-options="option for option in attributeDictionaryDatas track by option" + title="Select the dropdown value driven from Attribute (common)Dictionary."> <option value="">{{choice.key}}</option> </select> </div> <div class="form-group col-sm-3"> <input type="text" class="form-control" ng-disabled="temp.policy.readOnly" ng-model="choice.value" - placeholder="Attribute Value" /> + placeholder="Attribute Value" title="Enter the Attribute Value without any spaces and special characters"/> </div> <div class="form-group col-sm-1"> <button type="button" class="btn btn-default" ng-show="$last" - ng-disabled="temp.policy.readOnly" ng-click="removeChoice()"> + ng-disabled="temp.policy.readOnly" ng-click="removeChoice()" title="onClick will remove the last row"> <i class="fa fa-minus"></i> </button> </div> @@ -56,7 +58,7 @@ <div class="form-group col-sm-1"> <button type="button" class="btn btn-default" ng-disabled="temp.policy.readOnly" - ng-click="addNewRuleAlgorithm()"> + ng-click="addNewRuleAlgorithm()" title="onClick Rule Algorithms row is added."> <i class="fa fa-plus"></i> </button> </div> @@ -75,7 +77,7 @@ ng-disabled="temp.policy.readOnly" ng-model="ruleAlgorithmschoice.dynamicRuleAlgorithmField1" ng-options="option for option in attributeDictionaryDatas track by option" - name="dynamicRuleAlgorithmField1"> + name="dynamicRuleAlgorithmField1" title="Select the dropdown value driven from Attribute (common)Dictionary."> <option value="">{{ruleAlgorithmschoice.dynamicRuleAlgorithmField1}}</option> </select> </div> @@ -84,7 +86,7 @@ ng-disabled="temp.policy.readOnly" ng-model="ruleAlgorithmschoice.dynamicRuleAlgorithmCombo" ng-options="option for option in functionDefinitionDatas" - name="dynamicRuleAlgorithmCombo"> + name="dynamicRuleAlgorithmCombo" title="Select the dropdown value driven from FunctionDataType."> <option value="">{{ruleAlgorithmschoice.dynamicRuleAlgorithmCombo}}</option> </select> </div> @@ -92,12 +94,12 @@ <input type="text" class="form-control" ng-disabled="temp.policy.readOnly" ng-model="ruleAlgorithmschoice.dynamicRuleAlgorithmField2" - name="dynamicRuleAlgorithmField2" /> + name="dynamicRuleAlgorithmField2" title="Enter the Value without any spaces and special characters and for rule formation use A1, A2,..etc., based on above Rules."/> </div> <div class="form-group col-sm-1"> <button type="button" class="btn btn-default" ng-show="$last" ng-disabled="temp.policy.readOnly" - ng-click="removeRuleAlgorithm()"> + ng-click="removeRuleAlgorithm()" title="onClick will remove the last row"> <i class="fa fa-minus"></i> </button> </div> @@ -110,7 +112,7 @@ <div class="form-group col-sm-6"> <label>Action Performer:<sup><b>*</b></sup></label><BR> <select class="form-control" ng-disabled="temp.policy.readOnly" - ng-model="temp.policy.actionPerformer"> + ng-model="temp.policy.actionPerformer" title="Select the Action Performer values from dropdown."> <option>PEP</option> <option>PDP</option> </select> @@ -120,7 +122,7 @@ class="form-control" ng-disabled="temp.policy.readOnly" ng-model="temp.policy.actionAttributeValue" - ng-options="option for option in actionPolicyDictionaryDatas track by option"></select> + ng-options="option for option in actionPolicyDictionaryDatas track by option" title="Select the dropdown value driven from Action (Action)Dictionary."></select> </div> </div> </div> @@ -129,11 +131,11 @@ <div class="modal-footer"> <button class="btn btn-primary" herf="javascript:void(0)" ng-disabled="temp.policy.readOnly" - ng-click="validatePolicy(temp.policy);">Validate</button> + ng-click="validatePolicy(temp.policy);" title="Validate the data entered in the Policy fields.">Validate</button> <button class="btn btn-success" ng-disabled="savebutton" herf="javascript:void(0)" ng-disabled="temp.policy.readOnly" - ng-click="saveActionPolicy(temp);">Save</button> - <button type="button" class="btn btn-default" ng-click="refresh();">Close</button> + ng-click="saveActionPolicy(temp);" title="Save the Policy with validated data.">Save</button> + <button type="button" class="btn btn-default" ng-click="refresh();" title="Close the template.">Close</button> </div> </form> </div> diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/BRMSParamPolicyTemplate.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/BRMSParamPolicyTemplate.html index d941c2404..24994d3da 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/BRMSParamPolicyTemplate.html +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/BRMSParamPolicyTemplate.html @@ -8,12 +8,13 @@ class="form-control" ng-disabled="temp.policy.readOnly" ng-readonly="temp.policy.editPolicy" ng-model="temp.policy.policyName" required pattern="\S+" - title="Enter the Policy Name without any spaces" /> + title="Enter Policy Name without any spaces and special characters and will accept _." /> </div> <div class="form-group col-sm-6"> <label>Description:</label> <input type="text" class="form-control" ng-disabled="temp.policy.readOnly" - ng-model="temp.policy.policyDescription" /> + ng-model="temp.policy.policyDescription" + title="Description field will accept any type of data."/> </div> </div> <div class="form-group row"> @@ -22,13 +23,13 @@ class="form-control" ng-disabled="temp.policy.readOnly" ng-model="temp.policy.riskType" ng-options="option for option in riskTypeDictionaryDatas track by option" - required pattern="\S+" title="RiskType is required"></select> + required pattern="\S+" title="Select the dropdown value driven from RiskType (Safe Policy)Dictionary."></select> </div> <div class="form-group col-sm-3"> <label>Risk Level:<sup><b>*</b></sup></label> <select class="form-control" ng-disabled="temp.policy.readOnly" ng-model="temp.policy.riskLevel" - required pattern="\S+" title="RiskLevel is required"> + required pattern="\S+" title="Select the dropdown Risk level value."> <option>1</option> <option>2</option> <option>3</option> @@ -39,7 +40,7 @@ <label>Guard:<sup><b>*</b></sup></label> <select class="form-control" ng-disabled="temp.policy.readOnly" ng-model="temp.policy.guard" - required pattern="\S+" title="Guard is required"> + required pattern="\S+" title="Select the dropdown Guard value."> <option>True</option> <option>False</option></select> </div> @@ -48,19 +49,19 @@ <div class="form-group col-sm-3"> <label>Time to Live Date:</label> <input type="text" id="ttlDate" class="form-control" name="ttlDate" ng-disabled="temp.policy.readOnly" - ng-model="temp.policy.ttlDate" /> + ng-model="temp.policy.ttlDate" title="Select the date from calender onclick on the field."/> </div> <div class="form-group col-sm-3"> <label>Controller:<sup></sup></label> <select class="form-control" ng-disabled="temp.policy.readOnly" ng-model="temp.policy.brmsController" - ng-options="option for option in brmsControllerDatas track by option"></select> + ng-options="option for option in brmsControllerDatas track by option" title="Select the dropdown value driven from BRMS Controller (BRMS)Dictionary."></select> </div> <div class="form-group col-sm-3"> <label>Dependencies:<sup></sup></label> <select class="form-control" multiple ng-disabled="temp.policy.readOnly" ng-model="temp.policy.brmsDependency" - ng-options="option for option in brmsDependencyDatas track by option"></select> + ng-options="option for option in brmsDependencyDatas track by option" title="Select the dropdown value driven from BRMS Dependency (BRMS)Dictionary."></select> </div> </div> </div> @@ -69,7 +70,7 @@ <div class="form-group col-sm-2"> <label>Rule Attributes:<sup><b></b></sup></label> <button type="button" class="btn btn-default" - ng-disabled="temp.policy.readOnly" ng-click="addNewChoice()"> + ng-disabled="temp.policy.readOnly" ng-click="addNewChoice()" title="onClick Rule Attribute row is added."> <i class="fa fa-plus"></i> </button> </div> @@ -79,17 +80,17 @@ <div class="form-group row" style="margin-left: 2%"> <div class="form-group col-sm-3"> <input type="text" class="form-control" - ng-disabled="temp.policy.readOnly" ng-model="choice.key" + ng-disabled="temp.policy.readOnly" ng-model="choice.key" title="Enter the Rule Attribute Key without any spaces and special characters" placeholder="Attribute Key" /> </div> <div class="form-group col-sm-3"> <input type="text" class="form-control" - ng-disabled="temp.policy.readOnly" ng-model="choice.value" + ng-disabled="temp.policy.readOnly" ng-model="choice.value" title="Enter the Rule Attribute Value without any spaces and special characters" placeholder="Attribute Value" /> </div> <div class="form-group col-sm-1"> <button type="button" class="btn btn-default" ng-show="$last" - ng-disabled="temp.policy.readOnly" ng-click="removeChoice()"> + ng-disabled="temp.policy.readOnly" ng-click="removeChoice()" title="onClick will remove the last row"> <i class="fa fa-minus"></i> </button> </div> @@ -104,7 +105,7 @@ class="form-control" ng-disabled="temp.policy.readOnly" ng-model="temp.policy.ruleName" ng-options="option for option in brmsParamDictionaryDatas track by option" - ng-click="addDataToFields(temp.policy.ruleName);"> + ng-click="addDataToFields(temp.policy.ruleName);" title="Select the dropdown value driven from BRMSParamTemplate (BRMS)Dictionary"> <option value="">{{temp.policy.ruleName}}</option> </select> </div> @@ -129,7 +130,7 @@ <h2 class="font-showcase-font-name"> Rule Preview: </h2> <div class="divider-container"><hr> </div> <textarea type="text" style="width: 100%; height: 800px" ng-bind="datarule" ng-disabled="true"></textarea> - <button class="btn btn-default" herf="javascript:void(0)" ng-click="hideRule();">Hide Rule</button> + <button class="btn btn-default" herf="javascript:void(0)" ng-click="hideRule();" title="OnClick the BRMS Rule will be Hidden.">Hide Rule</button> </div> </div> <br> @@ -137,14 +138,14 @@ <div> <button class="btn btn-primary" herf="javascript:void(0)" ng-disabled="temp.policy.readOnly" - ng-click="validatePolicy(temp.policy);">Validate</button> + ng-click="validatePolicy(temp.policy);" title="Validate the data entered in the Policy fields.">Validate</button> <button class="btn btn-default" herf="javascript:void(0)" - ng-disabled="validateSuccess" ng-click="ShowRule(temp);">Show + ng-disabled="validateSuccess" ng-click="ShowRule(temp);" title="OnClick the BRMS Rule will be previewed.">Show Rule</button> <button class="btn btn-success" herf="javascript:void(0)" ng-disabled="savebutton" ng-disabled="temp.policy.readOnly" - ng-click="saveBrmsParamPolicy(temp);">Save</button> - <button type="button" class="btn btn-default" ng-click="refresh();">Close</button> + ng-click="saveBrmsParamPolicy(temp);" title="Save the Policy with validated data.">Save</button> + <button type="button" class="btn btn-default" ng-click="refresh();" title="Close the template.">Close</button> </div> </div> </form> diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/BRMSRawPolicyTemplate.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/BRMSRawPolicyTemplate.html index 8751768c0..bb94f33c5 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/BRMSRawPolicyTemplate.html +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/BRMSRawPolicyTemplate.html @@ -7,12 +7,13 @@ class="form-control" ng-disabled="temp.policy.readOnly" ng-readonly="temp.policy.editPolicy" ng-model="temp.policy.policyName" required pattern="\S+" - title="Enter the Policy Name without any spaces" /> + title="Enter Policy Name without any spaces and special characters and will accept _." /> </div> <div class="form-group col-sm-6"> <label>Description:</label> <input type="text" class="form-control" ng-disabled="temp.policy.readOnly" - ng-model="temp.policy.policyDescription" /> + ng-model="temp.policy.policyDescription" + title="Description field will accept any type of data."/> </div> </div> <div class="form-group row"> @@ -21,13 +22,13 @@ class="form-control" ng-disabled="temp.policy.readOnly" ng-model="temp.policy.riskType" ng-options="option for option in riskTypeDictionaryDatas track by option" - required pattern="\S+" title="RiskType is required"></select> + required pattern="\S+" title="Select the dropdown value driven from RiskType (Safe Policy)Dictionary."></select> </div> <div class="form-group col-sm-3"> <label>Risk Level:<sup><b>*</b></sup></label> <select class="form-control" ng-disabled="temp.policy.readOnly" ng-model="temp.policy.riskLevel" - required pattern="\S+" title="RiskLevel is required"> + required pattern="\S+" title="Select the dropdown Risk level value."> <option>1</option> <option>2</option> <option>3</option> @@ -38,7 +39,7 @@ <label>Guard:<sup><b>*</b></sup></label> <select class="form-control" ng-disabled="temp.policy.readOnly" ng-model="temp.policy.guard" - required pattern="\S+" title="Guard is required"> + required pattern="\S+" title="Select the dropdown Guard value."> <option>True</option> <option>False</option></select> </div> @@ -47,19 +48,19 @@ <div class="form-group col-sm-3"> <label>Time to Live Date:</label> <input type="text" id="ttlDate" class="form-control" name="ttlDate" ng-disabled="temp.policy.readOnly" - ng-model="temp.policy.ttlDate" /> + ng-model="temp.policy.ttlDate" title="Select the date from calender onclick on the field."/> </div> <div class="form-group col-sm-3"> <label>Controller:<sup></sup></label> <select class="form-control" ng-disabled="temp.policy.readOnly" ng-model="temp.policy.brmsController" - ng-options="option for option in brmsControllerDatas track by option"></select> + ng-options="option for option in brmsControllerDatas track by option" title="Select the dropdown value driven from BRMS Controller (BRMS)Dictionary."></select> </div> <div class="form-group col-sm-3"> <label>Dependencies:<sup></sup></label> <select class="form-control" multiple ng-disabled="temp.policy.readOnly" ng-model="temp.policy.brmsDependency" - ng-options="option for option in brmsDependencyDatas track by option"></select> + ng-options="option for option in brmsDependencyDatas track by option" title="Select the dropdown value driven from BRMS Dependency (BRMS)Dictionary."></select> </div> </div> </div> @@ -68,7 +69,7 @@ <div class="form-group col-sm-2"> <label>Rule Attributes:<sup></sup></label> <button type="button" class="btn btn-default" - ng-disabled="temp.policy.readOnly" ng-click="addNewChoice()"> + ng-disabled="temp.policy.readOnly" ng-click="addNewChoice()" title="onClick Rule Attribute row is added."> <i class="fa fa-plus"></i> </button> </div> @@ -78,17 +79,17 @@ <div class="form-group row" style="margin-left: 2%"> <div class="form-group col-sm-3"> <input type="text" class="form-control" - ng-disabled="temp.policy.readOnly" ng-model="choice.key" + ng-disabled="temp.policy.readOnly" ng-model="choice.key" title="Enter the Rule Attribute Key without any spaces and special characters" placeholder="Attribute Key" /> </div> <div class="form-group col-sm-3"> <input type="text" class="form-control" - ng-disabled="temp.policy.readOnly" ng-model="choice.value" + ng-disabled="temp.policy.readOnly" ng-model="choice.value" title="Enter the Rule Attribute Value without any spaces and special characters" placeholder="Attribute Value" /> </div> <div class="form-group col-sm-1"> <button type="button" class="btn btn-default" ng-show="$last" - ng-disabled="temp.policy.readOnly" ng-click="removeChoice()"> + ng-disabled="temp.policy.readOnly" ng-click="removeChoice()" title="onClick will remove the last row"> <i class="fa fa-minus"></i> </button> </div> @@ -101,7 +102,7 @@ <div class="form-group col-sm-12"> <label>Raw Rule:<sup><b>*</b></sup></label> <textarea class="form-control" - ng-model="temp.policy.configBodyData" + ng-model="temp.policy.configBodyData" title="Enter Valid BRMS Rule." ng-disabled="temp.policy.readOnly" style="height: 400px;" required></textarea> </div> </div> @@ -112,11 +113,11 @@ <div> <button class="btn btn-primary" herf="javascript:void(0)" ng-disabled="temp.policy.readOnly" - ng-click="validatePolicy(temp.policy);">Validate</button> + ng-click="validatePolicy(temp.policy);" title="Validate the data entered in the Policy fields.">Validate</button> <button class="btn btn-success" herf="javascript:void(0)" ng-disabled="savebutton" ng-disabled="temp.policy.readOnly" - ng-click="saveBrmsRawPolicy(temp);">Save</button> - <button type="button" class="btn btn-default" ng-click="refresh();">Close</button> + ng-click="saveBrmsRawPolicy(temp);" title="Save the Policy with validated data.">Save</button> + <button type="button" class="btn btn-default" ng-click="refresh();" title="Close the template.">Close</button> </div> </div> </form> diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/BasePolicyTemplate.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/BasePolicyTemplate.html index c81a98d9b..682abaada 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/BasePolicyTemplate.html +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/BasePolicyTemplate.html @@ -7,12 +7,13 @@ class="form-control" ng-disabled="temp.policy.readOnly" ng-readonly="temp.policy.editPolicy" ng-model="temp.policy.policyName" required pattern="\S+" - title="Enter the Policy Name without any spaces" /> + title="Enter Policy Name without any spaces and special characters and will accept _." /> </div> <div class="form-group col-sm-6"> <label>Description:</label> <input type="text" class="form-control" ng-disabled="temp.policy.readOnly" - ng-model="temp.policy.policyDescription" /> + ng-model="temp.policy.policyDescription" + title="Description field will accept any type of data." /> </div> </div> <div class="form-group row"> @@ -21,18 +22,20 @@ class="form-control" ng-disabled="temp.policy.readOnly" ng-model="temp.policy.onapName" ng-options="option for option in onapNameDictionaryDatas track by option" - required pattern="\S+" title="OnapName is required"></select> + required pattern="\S+" + title="Select the dropdown value driven from OnapName (common)Dictionary."></select> </div> <div class="form-group col-sm-3"> <label>Config Name:<sup><b>*</b></sup></label> <input type="text" class="form-control" ng-disabled="temp.policy.readOnly" ng-model="temp.policy.configName" required pattern="\S+" - title="Enter the Config Name without any spaces" /> + title="Enter the Config Name without any spaces and special characters." /> </div> <div class="form-group col-sm-3"> <label>Time to Live Date:</label> <input type="text" id="ttlDate" class="form-control" ng-disabled="temp.policy.readOnly" name="ttlDate" - ng-model="temp.policy.ttlDate" /> + ng-model="temp.policy.ttlDate" + title="Select the date from calender onclick on the field."/> </div> </div> @@ -42,13 +45,13 @@ class="form-control" ng-disabled="temp.policy.readOnly" ng-model="temp.policy.riskType" ng-options="option for option in riskTypeDictionaryDatas track by option" - required pattern="\S+" title="RiskType is required"></select> + required pattern="\S+" title="Select the dropdown value driven from RiskType (Safe Policy)Dictionary."></select> </div> <div class="form-group col-sm-3"> <label>Risk Level:<sup><b>*</b></sup></label> <select class="form-control" ng-disabled="temp.policy.readOnly" ng-model="temp.policy.riskLevel" - required pattern="\S+" title="RiskLevel is required"> + required pattern="\S+" title="Select the dropdown Risk level value."> <option>1</option> <option>2</option> <option>3</option> @@ -59,7 +62,7 @@ <label>Guard:<sup><b>*</b></sup></label> <select class="form-control" ng-disabled="temp.policy.readOnly" ng-model="temp.policy.guard" - required pattern="\S+" title="Guard is required"> + required pattern="\S+" title="Select the dropdown Guard value."> <option>True</option> <option>False</option></select> </div> @@ -70,7 +73,7 @@ <div class="form-group col-sm-1"> <label>Attributes:</label> <button type="button" class="btn btn-default" - ng-disabled="temp.policy.readOnly" ng-click="addNewChoice()"> + ng-disabled="temp.policy.readOnly" ng-click="addNewChoice()" title="onClick Attribute row is added."> <i class="fa fa-plus"></i> </button> </div> @@ -81,18 +84,19 @@ <div class="form-group col-sm-3"> <select class="form-control" required ng-disabled="temp.policy.readOnly" ng-model="choice.key" - ng-options="option for option in attributeDictionaryDatas track by option"></select> + ng-options="option for option in attributeDictionaryDatas track by option" + title="Select the dropdown value driven from Attribute (common)Dictionary."></select> </div> <div class="form-group col-sm-3"> <input type="text" class="form-control" ng-disabled="temp.policy.readOnly" ng-model="choice.value" placeholder="Attribute Value" required pattern="\S+" - title="Enter the Attribute Value without any spaces" /> + title="Enter the Attribute Value without any spaces and special characters" /> </div> <div class="form-group col-sm-1"> <button type="button" class="btn btn-default" ng-disabled="temp.policy.readOnly" ng-show="$last" - ng-click="removeChoice()"> + ng-click="removeChoice()" title="onClick will remove the last row"> <i class="fa fa-minus"></i> </button> </div> @@ -106,7 +110,7 @@ <label>Config Type:<sup><b>*</b></sup></label> <select class="form-control" ng-disabled="temp.policy.readOnly" ng-model="temp.policy.configType" required pattern="\S+" - title="ConfigType is required"> + title="Select the dropdown ConfigType value."> <option>JSON</option> <option>XML</option> <option>PROPERTIES</option> @@ -120,7 +124,7 @@ <label>Body:<sup><b>*</b></sup></label> <textarea class="form-control" ng-disabled="temp.policy.readOnly" ng-model="temp.policy.configBodyData" style="height: 400px;" - required title="ConfigBody is required"></textarea> + required title="Enter the ConfigBody based on ConfigType Selection"></textarea> </div> </div> </div> @@ -129,10 +133,10 @@ <div class="modal-footer"> <div> <button class="btn btn-primary" ng-disabled="temp.policy.readOnly" - herf="javascript:void(0)" ng-click="validatePolicy(temp.policy);">Validate</button> + herf="javascript:void(0)" ng-click="validatePolicy(temp.policy);" title="Validate the data entered in the Policy fields.">Validate</button> <button class="btn btn-success" ng-disabled="savebutton" - herf="javascript:void(0)" ng-click="savePolicy(temp);">Save</button> - <button type="button" class="btn btn-default" ng-click="refresh();">Close</button> + herf="javascript:void(0)" ng-click="savePolicy(temp);" title="Save the Policy with validated data.">Save</button> + <button type="button" class="btn btn-default" ng-click="refresh();" title="Close the template.">Close</button> </div> </div> </form> diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/ClosedLoopFaultPolicyTemplate.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/ClosedLoopFaultPolicyTemplate.html index 0912ac2eb..d3700c94b 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/ClosedLoopFaultPolicyTemplate.html +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/ClosedLoopFaultPolicyTemplate.html @@ -7,12 +7,13 @@ class="form-control" ng-disabled="temp.policy.readOnly" ng-readonly="temp.policy.editPolicy" ng-model="temp.policy.policyName" required pattern="\S+" - title="Enter the Policy Name without any spaces" /> + title="Enter Policy Name without any spaces and special characters and will accept _." /> </div> <div class="form-group col-sm-6"> <label>Description:</label> <input type="text" class="form-control" ng-disabled="temp.policy.readOnly" - ng-model="temp.policy.policyDescription" /> + ng-model="temp.policy.policyDescription" + title="Description field will accept any type of data."/> </div> </div> <div class="form-group row"> @@ -21,13 +22,13 @@ class="form-control" ng-disabled="temp.policy.readOnly" ng-model="temp.policy.riskType" ng-options="option for option in riskTypeDictionaryDatas track by option" - required pattern="\S+" title="RiskType is required"></select> + required pattern="\S+" title="Select the dropdown value driven from RiskType (Safe Policy)Dictionary."></select> </div> <div class="form-group col-sm-3"> <label>Risk Level:<sup><b>*</b></sup></label> <select class="form-control" ng-disabled="temp.policy.readOnly" ng-model="temp.policy.riskLevel" - required pattern="\S+" title="RiskLevel is required"> + required pattern="\S+" title="Select the dropdown Risk level value."> <option>1</option> <option>2</option> <option>3</option> @@ -38,7 +39,7 @@ <label>Guard:<sup><b>*</b></sup></label> <select class="form-control" ng-disabled="temp.policy.readOnly" ng-model="temp.policy.guard" - required pattern="\S+" title="Guard is required"> + required pattern="\S+" title="Select the dropdown Guard value."> <option>True</option> <option>False</option></select> </div> @@ -47,7 +48,7 @@ class="form-control" ng-disabled="temp.policy.readOnly" ng-model="temp.policy.onapName" ng-options="option for option in onapNameDictionaryDatas track by option" - required pattern="\S+" title="OnapName is required"></select> + required pattern="\S+" title="Select the dropdown value driven from OnapName (common)Dictionary."></select> </div> </div> <div class="form-group row"> @@ -55,7 +56,8 @@ <label>Vnf Type:<sup><b>*</b></sup></label> <select class="form-control" ng-disabled="temp.policy.readOnly" ng-model="temp.policy.jsonBodyData.vnfType" - ng-options="option for option in vnfTypeDictionaryDatas track by option"> + ng-options="option for option in vnfTypeDictionaryDatas track by option" + title="Select the dropdown value driven from VNF Type (ClosedLoop Policy)Dictionary."> <option value="">{{temp.policy.jsonBodyData.vnfType}}</option> </select> </div> @@ -63,7 +65,8 @@ <label>Policy Status:<sup><b>*</b></sup></label> <select class="form-control" ng-disabled="temp.policy.readOnly" ng-init="init(temp.policy.jsonBodyData);" - ng-model="temp.policy.jsonBodyData.closedLoopPolicyStatus"> + ng-model="temp.policy.jsonBodyData.closedLoopPolicyStatus" + title="Select the value from dropdown."> <option value="Active">Active</option> <option>InActive</option> </select> @@ -84,7 +87,7 @@ <div class="form-group col-sm-3"> <label>Time to Live Date:</label> <input type="text" id="ttlDate" class="form-control" name="ttlDate" ng-disabled="temp.policy.readOnly" - ng-model="temp.policy.ttlDate" /> + ng-model="temp.policy.ttlDate" title="Select the date from calender onclick on the field."/> </div> </div> </div> @@ -95,12 +98,14 @@ <div class="form-group row"> <div class="form-group col-sm-1"> <button type="button" class="btn btn-default" - ng-disabled="temp.policy.readOnly" ng-click="addTriggerButton()"> + ng-disabled="temp.policy.readOnly" ng-click="addTriggerButton()" + title="onClick Trigger Signature Trap row is added."> <i class="fa fa-plus"></i> </button> <button type="button" class="btn btn-default" ng-disabled="temp.policy.readOnly" - ng-click="removeTriggerButton()"> + ng-click="removeTriggerButton()" + title="onClick Trigger Signature Trap row is removed."> <i class="fa fa-minus"></i> </button> </div> @@ -112,12 +117,14 @@ <label ng-model="choice.label" name="label">{{choice.id}}</label> <button type="button" class="btn btn-default" ng-disabled="temp.policy.readOnly" - ng-click="addTrapTriggerButton(choice.id)"> + ng-click="addTrapTriggerButton(choice.id)" + title="onClick Trap Signature row is added."> <i class="fa fa-plus"></i> </button> <button type="button" class="btn btn-default" ng-disabled="temp.policy.readOnly" - ng-click="removeTrapTriggerButton(choice.id)"> + ng-click="removeTrapTriggerButton(choice.id)" + title="onClick Trap Signature row is removed."> <i class="fa fa-minus"></i> </button> </div> @@ -138,7 +145,8 @@ <select class="form-control" ng-disabled="temp.policy.readOnly" ng-model="choice.trigger1" - ng-options="option for option in varbindDictionaryDatas track by option"> + ng-options="option for option in varbindDictionaryDatas track by option" + title="Select the dropdown value driven from Varbind (ClosedLoop)Dictionary."> <option value="">{{choice.trigger1}}</option> </select> </div> @@ -152,7 +160,8 @@ <select class="form-control" ng-disabled="temp.policy.readOnly" ng-model="choice.trigger2" - ng-options="option for option in varbindDictionaryDatas track by option"> + ng-options="option for option in varbindDictionaryDatas track by option" + title="Select the dropdown value driven from Varbind (ClosedLoop)Dictionary."> <option value="">{{choice.trigger2}}</option> </select> </div> @@ -170,7 +179,7 @@ <div class="form-group col-sm-1"> <button type="button" class="btn btn-default" ng-disabled="temp.policy.readOnly" - ng-click="addTriggerConnectButton()"> + ng-click="addTriggerConnectButton()" title="onClick Connect Trap Trigger Signature row is added."> <i class="fa fa-plus"></i> </button> </div> @@ -189,7 +198,8 @@ <div class="form-group col-sm-1"> <select ng-disabled="temp.policy.readOnly" ng-model="choice.connectTrap1" class="form-control" - ng-options="option for option in connectTriggerTrapsList track by option"> + ng-options="option for option in connectTriggerTrapsList track by option" + title="Select the traps to form rule formation."> <option value="">{{choice.connectTrap1}}</option> </select> </div> @@ -206,7 +216,8 @@ <div class="form-group col-sm-1"> <select class="form-control" ng-disabled="temp.policy.readOnly" ng-model="choice.connectTrap2" - ng-options="option for option in connectTriggerTrapsList track by option"> + ng-options="option for option in connectTriggerTrapsList track by option" + title="Select the traps to form rule formation."> <option value="">{{choice.connectTrap2}}</option> </select> </div> @@ -218,7 +229,7 @@ <div class="form-group col-sm-1"> <button type="button" class="btn btn-default" ng-show="$last" ng-disabled="temp.policy.readOnly" - ng-click="removeTriggerConnectButton()"> + ng-click="removeTriggerConnectButton()" title="onClick Connect Trap Trigger Signature row is removed."> <i class="fa fa-minus"></i> </button> </div> @@ -228,16 +239,15 @@ </div> <div class="form-group row"> <div class="form-group col-sm-2"> - <label>Clear TimeOut:<sup><b>*</b></sup> + <label>Clear TimeOut: </label><br> <input type="text" ng-disabled="triggerdisabled" - ng-model="temp.policy.clearTimeOut" class="form-control" required /> + ng-model="temp.policy.clearTimeOut" class="form-control" title="Enter the Cleartimeout value and the value should be numeric."/> </div> <div class="form-group col-sm-2"> - <label>Trap Max Age:<sup><b>*</b></sup></label><br> <input + <label>Trap Max Age:</label><br> <input type="text" ng-disabled="triggerdisabled" ng-model="temp.policy.trapMaxAge" class="form-control" - ng-init="temp.policy.jsonBodyData.trapMaxAge='300'" value="300" - required /> + ng-init="temp.policy.jsonBodyData.trapMaxAge='300'" value="300" title="Enter the Trap Max Age value and the value should be numeric."/> </div> </div> </div> @@ -248,7 +258,8 @@ <label>vPRO Actions:<sup><b>*</b></sup></label><br> <select class="form-control" ng-disabled="temp.policy.readOnly" ng-model="temp.policy.jsonBodyData.actions" - ng-options="option for option in vsclActionDictionaryDatas track by option"> + ng-options="option for option in vsclActionDictionaryDatas track by option" + title="Select the dropdown value driven from VSCL Action (ClosedLoop)Dictionary."> <option value="">{{temp.policy.jsonBodyData.actions}}</option> </select> </div> @@ -256,25 +267,25 @@ <label>Time Interval:<sup><b>*</b></sup> </label><br> <input type="text" ng-disabled="temp.policy.readOnly" ng-model="temp.policy.jsonBodyData.timeInterval" - class="form-control" required /> + class="form-control" required title="Enter the Time Interval value and the value should be numeric."/> </div> <div class="form-group col-sm-2"> <label>App-C TimeOut:<sup><b>*</b></sup></label><br> <input type="text" ng-disabled="temp.policy.readOnly" ng-model="temp.policy.jsonBodyData.timeOutvPRO" - class="form-control" required /> + class="form-control" required title="Enter the App-C Timeout value and the value should be numeric."/> </div> <div class="form-group col-sm-2"> <label>TimeOut for Ruby:<sup><b>*</b></sup></label><br> <input type="text" ng-disabled="temp.policy.readOnly" ng-model="temp.policy.jsonBodyData.timeOutRuby" - class="form-control" required /> + class="form-control" required title="Enter the Timeout for Ruby value and the value should be numeric."/> </div> <div class="form-group col-sm-2"> <label>Number of Retries:<sup><b>*</b></sup></label><br> <input type="text" ng-disabled="temp.policy.readOnly" ng-model="temp.policy.jsonBodyData.retrys" class="form-control" - required /> + required title="Enter the Number of retries value and the value should be numeric."/> </div> </div> <div class="form-group row"> @@ -282,20 +293,20 @@ <label>Aging Window:<sup><b>*</b></sup> </label><br> <input type="text" ng-disabled="temp.policy.readOnly" ng-model="temp.policy.jsonBodyData.agingWindow" - class="form-control" required /> + class="form-control" required title="Enter the Aging Window value and the value should be numeric."/> </div> <div class="form-group col-sm-4"> <label>Text to Include in UEB messages for AOTS ticket and Geo Link:</label><br> <input type="text" ng-disabled="temp.policy.readOnly" ng-model="temp.policy.jsonBodyData.geoLink" class="form-control" - required /> + required title="Enter the UEB Message value."/> </div> <div class="form-group col-sm-4"> <label>Email Address:</label><br> <input type="text" ng-disabled="temp.policy.readOnly" ng-model="temp.policy.jsonBodyData.emailAddress" - class="form-control" required /> + class="form-control" required title="Enter the email address for multiple use comma seperated value."/> </div> </div> </div> @@ -307,7 +318,8 @@ class="form-control" ng-disabled="temp.policy.readOnly" ng-model="temp.policy.jsonBodyData.pepName" ng-options="option for option in pepOptionsDictionaryDatas track by option" - ng-change="getPepActionValues(temp.policy.jsonBodyData.pepName)"> + ng-change="getPepActionValues(temp.policy.jsonBodyData.pepName)" + title="Select the dropdown value driven from PEP Options (ClosedLoop)Dictionary."> <option value="">{{temp.policy.jsonBodyData.pepName}}</option> </select></select></select> </div> @@ -315,7 +327,8 @@ <label>Actions:<sup><b></b></sup></label><br> <select class="form-control" ng-disabled="temp.policy.readOnly" ng-model="temp.policy.jsonBodyData.pepAction" - ng-options="option for option in pepActionDictionaryDatas track by option"> + ng-options="option for option in pepActionDictionaryDatas track by option" + title="Select the dropdown value driven based on PEP Options selection from PEP Options (ClosedLoop)Dictionary."> <option value="">{{temp.policy.jsonBodyData.pepAction}}</option> </select> </div> @@ -329,12 +342,14 @@ <div class="form-group col-sm-1"> <button type="button" class="btn btn-default" ng-disabled="temp.policy.readOnly" - ng-click="addVerFaultButton()"> + ng-click="addVerFaultButton()" + title="onClick Verification Signature Fault row is added."> <i class="fa fa-plus"></i> </button> <button type="button" class="btn btn-default" ng-disabled="temp.policy.readOnly" - ng-click="removeVerFaultButton()"> + ng-click="removeVerFaultButton()" + title="onClick Verification Signature Fault row is removed."> <i class="fa fa-minus"></i> </button> </div> @@ -346,12 +361,14 @@ <label ng-model="choice.label" name="label">{{choice.id}}</label> <button type="button" class="btn btn-default" ng-disabled="temp.policy.readOnly" - ng-click="addVerTriggerButton(choice.id)"> + ng-click="addVerTriggerButton(choice.id)" + title="onClick Fault Signature row is added."> <i class="fa fa-plus"></i> </button> <button type="button" class="btn btn-default" ng-disabled="temp.policy.readOnly" - ng-click="removeVerTriggerButton(choice.id)"> + ng-click="removeVerTriggerButton(choice.id)" + title="onClick Fault Signature row is removed."> <i class="fa fa-minus"></i> </button> </div> @@ -372,7 +389,8 @@ <select class="form-control" ng-disabled="temp.policy.readOnly" ng-model="choice.trigger1" - ng-options="option for option in varbindDictionaryDatas track by option"> + ng-options="option for option in varbindDictionaryDatas track by option" + title="Select the dropdown value driven from Varbind (ClosedLoop)Dictionary."> <option value="">{{choice.trigger1}}</option> </select> </div> @@ -386,7 +404,8 @@ <select class="form-control" ng-disabled="temp.policy.readOnly" ng-model="choice.trigger2" - ng-options="option for option in varbindDictionaryDatas track by option"> + ng-options="option for option in varbindDictionaryDatas track by option" + title="Select the dropdown value driven from Varbind (ClosedLoop)Dictionary."> <option value="">{{choice.trigger2}}</option> </select> </div> @@ -403,7 +422,7 @@ <div class="form-group col-sm-1"> <button type="button" class="btn btn-default" ng-disabled="temp.policy.readOnly" - ng-click="addFaultConnectButton()"> + ng-click="addFaultConnectButton()" title="onClick Connect Fault Verification Signature row is added."> <i class="fa fa-plus"></i> </button> </div> @@ -422,7 +441,8 @@ <div class="form-group col-sm-1"> <select ng-disabled="temp.policy.readOnly" ng-model="choice.connectTrap1" class="form-control" - ng-options="option for option in connectTriggerFaultsList track by option"> + ng-options="option for option in connectTriggerFaultsList track by option" + title="Select the faults to form rule formation."> <option value="">{{choice.connectTrap1}}</option> </select> </div> @@ -439,7 +459,8 @@ <div class="form-group col-sm-1"> <select ng-disabled="temp.policy.readOnly" ng-model="choice.connectTrap2" class="form-control" - ng-options="option for option in connectTriggerFaultsList track by option"> + ng-options="option for option in connectTriggerFaultsList track by option" + title="Select the faults to form rule formation."> <option value="">{{choice.connectTrap2}}</option> </select> </div> @@ -451,7 +472,7 @@ <div class="form-group col-sm-1"> <button type="button" class="btn btn-default" ng-show="$last" ng-disabled="temp.policy.readOnly" - ng-click="removeFaultConnectButton()"> + ng-click="removeFaultConnectButton()" title="onClick Connect Fault Verification Signature row is removed."> <i class="fa fa-minus"></i> </button> </div> @@ -461,11 +482,11 @@ </div> <div class="form-group row"> <div class="form-group col-sm-2"> - <label>Clear TimeOut:<sup><b>*</b></sup></label><br> <input + <label>Clear TimeOut:</label><br> <input type="text" ng-disabled="verificationdisabled" ng-disabled="temp.policy.readOnly" ng-model="temp.policy.verificationclearTimeOut" - class="form-control" required /> + class="form-control" required title="Enter the Cleartimeout value and the value should be numeric."/> </div> </div> </div> @@ -493,11 +514,11 @@ <div class="modal-footer"> <button class="btn btn-primary" herf="javascript:void(0)" ng-disabled="temp.policy.readOnly" - ng-click="validatePolicy(temp.policy);">Validate</button> + ng-click="validatePolicy(temp.policy);" title="Validate the data entered in the Policy fields.">Validate</button> <button class="btn btn-success" herf="javascript:void(0)" ng-disabled="savebutton" ng-disabled="temp.policy.readOnly" - ng-click="saveFaultPolicy(temp);">Save</button> - <button type="button" class="btn btn-default" ng-click="refresh();">Close</button> + ng-click="saveFaultPolicy(temp);" title="Save the Policy with validated data.">Save</button> + <button type="button" class="btn btn-default" ng-click="refresh();" title="Close the template.">Close</button> </div> </form> </div>
\ No newline at end of file diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/ClosedLoopPMPolicyTemplate.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/ClosedLoopPMPolicyTemplate.html index 4e7cad3fd..b743224fb 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/ClosedLoopPMPolicyTemplate.html +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/ClosedLoopPMPolicyTemplate.html @@ -7,12 +7,13 @@ class="form-control" ng-disabled="temp.policy.readOnly" ng-readonly="temp.policy.editPolicy" ng-model="temp.policy.policyName" required pattern="\S+" - title="Enter the Policy Name without any spaces" /> + title="Enter Policy Name without any spaces and special characters and will accept _."/> </div> <div class="form-group col-sm-6"> <label>Description:</label> <input type="text" class="form-control" ng-disabled="temp.policy.readOnly" - ng-model="temp.policy.policyDescription" /> + ng-model="temp.policy.policyDescription" + title="Description field will accept any type of data."/> </div> </div> <div class="form-group row"> @@ -21,18 +22,18 @@ class="form-control" ng-disabled="temp.policy.readOnly" ng-model="temp.policy.onapName" ng-options="option for option in onapNameDictionaryDatas track by option" - required pattern="\S+" title="OnapName is required"></select> + required pattern="\S+" title="Select the dropdown value driven from OnapName (common)Dictionary."></select> </div> <div class="form-group col-sm-3"> <label>Time to Live Date:</label> <input type="text" id="ttlDate" class="form-control" name="ttlDate" ng-disabled="temp.policy.readOnly" - ng-model="temp.policy.ttlDate" /> + ng-model="temp.policy.ttlDate" title="Select the date from calender onclick on the field."/> </div> <div class="form-group col-sm-3"> <label>Guard:<sup><b>*</b></sup></label> <select class="form-control" ng-disabled="temp.policy.readOnly" ng-model="temp.policy.guard" - required pattern="\S+" title="Guard is required"> + required pattern="\S+" title="Select the dropdown Guard value."> <option>True</option> <option>False</option></select> </div> @@ -41,7 +42,7 @@ class="form-control" ng-disabled="temp.policy.readOnly" ng-model="temp.policy.riskType" ng-options="option for option in riskTypeDictionaryDatas track by option" - required pattern="\S+" title="RiskType is required"></select> + required pattern="\S+" title="Select the dropdown value driven from RiskType (Safe Policy)Dictionary."></select> </div> </div> <div class="form-group row"> @@ -49,7 +50,7 @@ <label>Risk Level:<sup><b>*</b></sup></label> <select class="form-control" ng-disabled="temp.policy.readOnly" ng-model="temp.policy.riskLevel" - required pattern="\S+" title="RiskLevel is required"> + required pattern="\S+" title="Select the dropdown Risk level value."> <option>1</option> <option>2</option> <option>3</option> @@ -74,7 +75,8 @@ <select style="width: 400px;" ng-disabled="temp.policy.readOnly" ng-model="temp.policy.serviceTypePolicyName" class="form-control" ng-options="option.serviceTypePolicyName for option in PMData track by option.serviceTypePolicyName" - ng-click="addDataToFields(temp.policy.serviceTypePolicyName);"></select> + ng-click="addDataToFields(temp.policy.serviceTypePolicyName);" + title="Select the Service Type PolicyName from dropdown value."></select> </div> </div> </div> @@ -125,7 +127,8 @@ <div> <input type="text" class="form-control" ng-disabled="temp.policy.readOnly" - ng-model="temp.policy.jsonBodyData.geoLink" /> + ng-model="temp.policy.jsonBodyData.geoLink" + title="Enter the UEB Message value."/> </div> </div> <div class="form-group col-sm-6"> @@ -133,7 +136,8 @@ <div> <input type="text" class="form-control" ng-disabled="temp.policy.readOnly" - ng-model="temp.policy.jsonBodyData.emailAddress" /> + ng-model="temp.policy.jsonBodyData.emailAddress" + title="Enter the email address and for multiple use comma seperated value."/> </div> </div> </div> @@ -144,11 +148,11 @@ <div> <button class="btn btn-primary" herf="javascript:void(0)" ng-disabled="temp.policy.readOnly" - ng-click="validatePolicy(temp.policy);">Validate</button> + ng-click="validatePolicy(temp.policy);" title="Validate the data entered in the Policy fields.">Validate</button> <button class="btn btn-success" herf="javascript:void(0)" ng-disabled="savebutton" ng-disabled="temp.policy.readOnly" - ng-click="saveCLPMPolicy(temp);">Save</button> - <button type="button" class="btn btn-default" ng-click="refresh();">Close</button> + ng-click="saveCLPMPolicy(temp);" title="Save the Policy with validated data.">Save</button> + <button type="button" class="btn btn-default" ng-click="refresh();" title="Close the template.">Close</button> </div> </div> </form> diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/DCAEMicroServicePolicyTemplate.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/DCAEMicroServicePolicyTemplate.html index 11472b96a..9ce936e4e 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/DCAEMicroServicePolicyTemplate.html +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/DCAEMicroServicePolicyTemplate.html @@ -7,12 +7,13 @@ class="form-control" ng-disabled="temp.policy.readOnly" ng-readonly="temp.policy.editPolicy" ng-model="temp.policy.policyName" required pattern="\S+" - title="Enter the Policy Name without any spaces" /> + title="Enter Policy Name without any spaces and special characters and will accept _." /> </div> <div class="form-group col-sm-6"> <label>Description:</label> <input type="text" class="form-control" ng-disabled="temp.policy.readOnly" - ng-model="temp.policy.policyDescription" /> + ng-model="temp.policy.policyDescription" + title="Description field will accept any type of data."/> </div> </div> <div class="form-group row"> @@ -21,18 +22,18 @@ class="form-control" ng-disabled="temp.policy.readOnly" ng-model="temp.policy.onapName" ng-options="option for option in onapNameDictionaryDatas track by option" - required pattern="\S+" title="OnapName is required"></select> + required pattern="\S+" title="Select the dropdown value driven from OnapName (common)Dictionary."></select> </div> <div class="form-group col-sm-3"> <label>Time to Live Date:</label> <input type="text" id="ttlDate" class="form-control" name="ttlDate" ng-disabled="temp.policy.readOnly" - ng-model="temp.policy.ttlDate" /> + ng-model="temp.policy.ttlDate" title="Select the date from calender onclick on the field."/> </div> <div class="form-group col-sm-3"> <label>Guard:<sup><b>*</b></sup></label> <select class="form-control" ng-disabled="temp.policy.readOnly" ng-model="temp.policy.guard" - required pattern="\S+" title="Guard is required"> + required pattern="\S+" title="Select the dropdown Guard value."> <option>True</option> <option>False</option></select> </div> @@ -41,7 +42,7 @@ class="form-control" ng-disabled="temp.policy.readOnly" ng-model="temp.policy.riskType" ng-options="option for option in riskTypeDictionaryDatas track by option" - required pattern="\S+" title="RiskType is required"></select> + required pattern="\S+" title="Select the dropdown value driven from RiskType (Safe Policy)Dictionary."></select> </div> </div> <div class="form-group row"> @@ -49,7 +50,7 @@ <label>Risk Level:<sup><b>*</b></sup></label> <select class="form-control" ng-disabled="temp.policy.readOnly" ng-model="temp.policy.riskLevel" - required pattern="\S+" title="RiskLevel is required"> + required pattern="\S+" title="Select the dropdown Risk level value."> <option>1</option> <option>2</option> <option>3</option> @@ -60,7 +61,7 @@ <label>Priority:<sup><b>*</b></sup></label> <select class="form-control" ng-disabled="temp.policy.readOnly" ng-model="temp.policy.priority" - ng-options="option for option in priorityDatas track by option"> + ng-options="option for option in priorityDatas track by option" title="Select the dropdown Priority value."> <option value="">{{temp.policy.priority}}</option> </select> </div> @@ -70,7 +71,8 @@ ng-model="temp.policy.serviceType" ng-options="option for option in microServiceModelsDictionaryDatas track by option" ng-init="pullVersion(temp.policy.serviceType);" - ng-click="pullVersion(temp.policy.serviceType);"></select> + ng-click="pullVersion(temp.policy.serviceType);" + title="Select the dropdown value driven from MicroService Models (MicroService Policy)Dictionary."></select> </div> <div class="form-group col-sm-3"> <label>Micro Service Version:<sup><b>*</b></sup></label> <select @@ -78,7 +80,8 @@ ng-model="temp.policy.version" ng-options="option for option in microServiceModelsDictionaryVersionDatas track by option" ng-init="addDataToFields(temp.policy.serviceType, temp.policy.version);" - ng-click="addDataToFields(temp.policy.serviceType, temp.policy.version);"></select> + ng-click="addDataToFields(temp.policy.serviceType, temp.policy.version);" + title="Select the dropdown value driven based on MicroService Models (MicroService Policy)Dictionary selection."></select> </div> </div> </div> @@ -93,26 +96,30 @@ class="form-control" class="form-control" ng-disabled="temp.policy.readOnly" ng-model="temp.policy.configName" - ng-options="option for option in microServiceCongigNameDictionaryDatas track by option" required="true"></select> + ng-options="option for option in microServiceCongigNameDictionaryDatas track by option" required="true" + title="Select the dropdown value driven from MicroService ConfigName (MicroService Policy)Dictionary."></select> </div> <div class="form-group col-sm-3" ng-show="isCheck"> <label>Location:<sup><b>*!</b></sup></label><br> <select class="form-control" class="form-control" ng-disabled="temp.policy.readOnly" ng-model="temp.policy.location" - ng-options="option for option in microServiceLocationDictionaryDatas track by option" required="true"></select> + ng-options="option for option in microServiceLocationDictionaryDatas track by option" required="true" + title="Select the dropdown value driven from MicroService Location (MicroService Policy)Dictionary."></select> </div> <div class="form-group col-sm-3" ng-show="isCheck"> <label>UUID:<sup><b>*!</b></sup></label><br> <select class="form-control" class="form-control" ng-disabled="temp.policy.readOnly" ng-model="temp.policy.uuid" - ng-options="option for option in dcaeUUIDDictionaryDatas track by option" required="true"></select> + ng-options="option for option in dcaeUUIDDictionaryDatas track by option" required="true" + title="Select the dropdown value driven from DCAE UUID (MicroService Policy)Dictionary."></select> </div> <div class="form-group col-sm-3" ng-show="isCheck"> <label>Policy Scope:<sup><b>*</b></sup></label><br> <select class="form-control" class="form-control" ng-disabled="temp.policy.readOnly" ng-model="temp.policy.policyScope" - ng-options="option for option in groupPolicyScopeListDatas track by option" required="true"></select> + ng-options="option for option in groupPolicyScopeListDatas track by option" required="true" + title="Select the dropdown value driven from Group Policy Scope (Policy Scope)Dictionary."></select> </div> </div> </div> @@ -122,11 +129,11 @@ <div class="modal-footer"> <button class="btn btn-primary" herf="javascript:void(0)" ng-disabled="temp.policy.readOnly" - ng-click="validatePolicy(temp.policy);">Validate</button> + ng-click="validatePolicy(temp.policy);" title="Validate the data entered in the Policy fields.">Validate</button> <button class="btn btn-success" herf="javascript:void(0)" ng-disabled="savebutton" ng-disabled="temp.policy.readOnly" - ng-click="savePolicy(temp);">Save</button> - <button type="button" class="btn btn-default" ng-click="refresh();">Close</button> + ng-click="savePolicy(temp);" title="Save the Policy with validated data.">Save</button> + <button type="button" class="btn btn-default" ng-click="refresh();" title="Close the template.">Close</button> </div> </form> </div> 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 60f3e6dc1..95bf68964 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 @@ -7,12 +7,13 @@ class="form-control" ng-disabled="temp.policy.readOnly" ng-readonly="temp.policy.editPolicy" ng-model="temp.policy.policyName" required pattern="\S+" - title="Enter the Policy Name without any spaces" /> + title="Enter Policy Name without any spaces and special characters and will accept _." /> </div> <div class="form-group col-sm-6"> <label>Description:</label> <input type="text" class="form-control" ng-disabled="temp.policy.readOnly" - ng-model="temp.policy.policyDescription" /> + ng-model="temp.policy.policyDescription" + title="Description field will accept any type of data."/> </div> </div> <div class="form-group row"> @@ -21,7 +22,7 @@ class="form-control" ng-disabled="temp.policy.readOnly" ng-model="temp.policy.onapName" ng-options="option for option in onapNameDictionaryDatas track by option" - required pattern="\S+" title="OnapName is required"></select> + required pattern="\S+" title="Select the dropdown value driven from OnapName (common)Dictionary."></select> </div> <div class="form-group col-sm-6"> <label>Rule Provider:<sup><b>*</b></sup></label><select @@ -48,7 +49,7 @@ <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" /> + placeholder="Service Type" title="Enter Service Type value."/> </div> <div class="form-group col-sm-1"> <label>VNF Type:<sup><b>*</b></sup></label> @@ -56,7 +57,7 @@ <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" /> + placeholder="VNF Type" title="Enter VNF Type value."/> </div> <div class="form-group col-sm-1"> <label>Building Block ID:<sup><b>*</b></sup></label> @@ -66,7 +67,7 @@ class="form-control" ng-disabled="temp.policy.readOnly" ng-model="temp.policy.rainyday.bbid" ng-options="option for option in rainyDayDictionaryDatas track by option" - ng-change="getWorkstepValues(temp.policy.rainyday.bbid)"> + ng-change="getWorkstepValues(temp.policy.rainyday.bbid)" title="Select the dropdown value driven from Rainday Allowed Treatments (Decision)Dictionary."> <option value="">{{temp.policy.rainyday.bbid}}</option> </select> </div> @@ -289,7 +290,7 @@ <div class="form-group col-sm-3"> <input type="text" class="form-control" ng-disabled="temp.policy.readOnly" ng-model="temp.policy.yamlparams.limit" - placeholder="Limit" /> + placeholder="Limit" title="Enter time limit value."/> </div> </div> <div class="form-group row" style="margin-left: 2%"> @@ -299,11 +300,11 @@ <div class="form-group col-sm-2"> <input type="text" class="form-control" ng-disabled="temp.policy.readOnly" ng-model="temp.policy.yamlparams.timeWindow" - placeholder="Time Window" /> + placeholder="Time Window" title="Enter time window value."/> </div> <div class="form-group col-sm-1"> <select class="form-control" ng-disabled="temp.policy.readOnly" - ng-model="temp.policy.yamlparams.timeUnits"> + ng-model="temp.policy.yamlparams.timeUnits" title="Select the Time Units value from dropdown options."> <option>minute</option> <option>hour</option> <option>day</option> @@ -319,7 +320,7 @@ </div> <div class="form-group col-sm-3"> <input type="text" class="form-control" - ng-disabled="temp.policy.readOnly" ng-model="temp.policy.yamlparams.guardActiveStart" + ng-disabled="temp.policy.readOnly" ng-model="temp.policy.yamlparams.guardActiveStart" title="Enter Guard Active Start value in following patren '00:00:00-05:00'." placeholder="00:00:00-05:00" /> </div> </div> @@ -329,7 +330,7 @@ </div> <div class="form-group col-sm-3"> <input type="text" class="form-control" - ng-disabled="temp.policy.readOnly" ng-model="temp.policy.yamlparams.guardActiveEnd" + ng-disabled="temp.policy.readOnly" ng-model="temp.policy.yamlparams.guardActiveEnd" title="Enter Guard Active End value in following patren '00:00:00-05:00'." placeholder="00:00:00-05:00" /> </div> </div> @@ -344,7 +345,7 @@ <div class="form-group col-sm-1"> <label>Component Attributes:</label><br> <button type="button" class="btn btn-default" - ng-disabled="temp.policy.readOnly" ng-click="addNewChoice()"> + ng-disabled="temp.policy.readOnly" ng-click="addNewChoice()" title="onClick Component Attribute row is added."> <i class="fa fa-plus"></i> </button> </div> @@ -355,18 +356,18 @@ <div class="form-group col-sm-3"> <select class="form-control" ng-disabled="temp.policy.readOnly" ng-model="choice.key" - ng-options="option for option in attributeDictionaryDatas track by option"> + ng-options="option for option in attributeDictionaryDatas track by option" title="Select the dropdown value driven from Attribute (common)Dictionary."> <option value="">{{choice.key}}</option> </select> </div> <div class="form-group col-sm-3"> <input type="text" class="form-control" ng-disabled="temp.policy.readOnly" ng-model="choice.value" - placeholder="Attribute Value" /> + placeholder="Attribute Value" title="Enter the Attribute Value without any spaces and special characters"/> </div> <div class="form-group col-sm-1"> <button type="button" class="btn btn-default" ng-show="$last" - ng-disabled="temp.policy.readOnly" ng-click="removeChoice()"> + ng-disabled="temp.policy.readOnly" ng-click="removeChoice()" title="onClick will remove the last row"> <i class="fa fa-minus"></i> </button> </div> @@ -383,7 +384,7 @@ <label>Settings Attributes:</label><br> <button type="button" class="btn btn-default" ng-disabled="temp.policy.readOnly" - ng-click="addNewSettingsChoice()"> + ng-click="addNewSettingsChoice()" title="onClick Settings Attribute row is added."> <i class="fa fa-plus"></i> </button> </div> @@ -394,19 +395,19 @@ <div class="form-group col-sm-3"> <select class="form-control" ng-disabled="temp.policy.readOnly" ng-model="settingschoice.key" - ng-options="option for option in settingsDictionaryDatas track by option"> + ng-options="option for option in settingsDictionaryDatas track by option" title="Select the dropdown value driven from Settings (Decision)Dictionary."> <option value="">{{settingschoice.key}}</option> </select> </div> <div class="form-group col-sm-3"> <input type="text" class="form-control" ng-disabled="temp.policy.readOnly" - ng-model="settingschoice.value" placeholder="Settings Value" /> + ng-model="settingschoice.value" placeholder="Settings Value" title="Enter the Settings Attribute Value without any spaces and special characters"/> </div> <div class="form-group col-sm-1"> <button type="button" class="btn btn-default" ng-show="$last" ng-disabled="temp.policy.readOnly" - ng-click="removeSettingsChoice()"> + ng-click="removeSettingsChoice()" title="onClick will remove the last row"> <i class="fa fa-minus"></i> </button> </div> @@ -423,7 +424,7 @@ <div class="form-group col-sm-1"> <button type="button" class="btn btn-default" ng-disabled="temp.policy.readOnly" - ng-click="addNewRuleAlgorithm()"> + ng-click="addNewRuleAlgorithm()" title="onClick Rule Algorithms row is added."> <i class="fa fa-plus"></i> </button> </div> @@ -442,7 +443,7 @@ ng-disabled="temp.policy.readOnly" ng-model="ruleAlgorithmschoice.dynamicRuleAlgorithmField1" ng-options="option for option in attributeDictionaryDatas track by option" - name="dynamicRuleAlgorithmField1"> + name="dynamicRuleAlgorithmField1" title="Select the dropdown value driven from Attribute (common)Dictionary or Settings (Decision)Dictionary."> <option value="">{{ruleAlgorithmschoice.dynamicRuleAlgorithmField1}}</option> </select> </div> @@ -451,18 +452,18 @@ ng-disabled="temp.policy.readOnly" ng-model="ruleAlgorithmschoice.dynamicRuleAlgorithmCombo" ng-options="option for option in functionDefinitionDatas track by option" - name="dynamicRuleAlgorithmCombo"></select> + name="dynamicRuleAlgorithmCombo" title="Select the dropdown value driven from FunctionDataType."></select> </div> <div class="form-group col-sm-3"> <input type="text" class="form-control" ng-disabled="temp.policy.readOnly" ng-model="ruleAlgorithmschoice.dynamicRuleAlgorithmField2" - name="dynamicRuleAlgorithmField2" /> + name="dynamicRuleAlgorithmField2" title="Enter the Value without any spaces and special characters and for rule formation use A1, A2,..etc., based on above Rules."/> </div> <div class="form-group col-sm-1"> <button type="button" class="btn btn-default" ng-disabled="temp.policy.readOnly" - ng-click="removeRuleAlgorithm()"> + ng-click="removeRuleAlgorithm()" title="onClick will remove the last row"> <i class="fa fa-minus"></i> </button> </div> @@ -477,11 +478,11 @@ <div class="modal-footer"> <button class="btn btn-primary" herf="javascript:void(0)" ng-disabled="temp.policy.readOnly" - ng-click="validatePolicy(temp.policy);">Validate</button> + ng-click="validatePolicy(temp.policy);" title="Validate the data entered in the Policy fields.">Validate</button> <button class="btn btn-success" herf="javascript:void(0)" ng-disabled="savebutton" ng-disabled="temp.policy.readOnly" - ng-click="saveDecisionPolicy(temp);">Save</button> - <button type="button" class="btn btn-default" ng-click="refresh();">Close</button> + ng-click="saveDecisionPolicy(temp);" title="Save the Policy with validated data.">Save</button> + <button type="button" class="btn btn-default" ng-click="refresh();" title="Close the template.">Close</button> </div> </form> </div>
\ No newline at end of file diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/FirewallPolicyTemplate.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/FirewallPolicyTemplate.html index 7f6a36b39..af1bea1d6 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/FirewallPolicyTemplate.html +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/FirewallPolicyTemplate.html @@ -7,12 +7,13 @@ class="form-control" ng-disabled="temp.policy.readOnly" ng-readonly="temp.policy.editPolicy" ng-model="temp.policy.policyName" required pattern="\S+" - title="Enter the Policy Name without any spaces" /> + title="Enter Policy Name without any spaces and special characters and will accept _." /> </div> <div class="form-group col-sm-6"> <label>Description:</label> <input type="text" class="form-control" ng-disabled="temp.policy.readOnly" - ng-model="temp.policy.policyDescription" /> + ng-model="temp.policy.policyDescription" + title="Description field will accept any type of data."/> </div> </div> <div class="form-group row"> @@ -21,13 +22,13 @@ class="form-control" ng-disabled="temp.policy.readOnly" ng-model="temp.policy.riskType" ng-options="option for option in riskTypeDictionaryDatas track by option" - required pattern="\S+" title="RiskType is required"></select> + required pattern="\S+" title="Select the dropdown value driven from RiskType (Safe Policy)Dictionary."></select> </div> <div class="form-group col-sm-3"> <label>Risk Level:<sup><b>*</b></sup></label> <select class="form-control" ng-disabled="temp.policy.readOnly" ng-model="temp.policy.riskLevel" - required pattern="\S+" title="RiskLevel is required"> + required pattern="\S+" title="Select the dropdown Risk level value."> <option>1</option> <option>2</option> <option>3</option> @@ -38,7 +39,7 @@ <label>Guard:<sup><b>*</b></sup></label> <select class="form-control" ng-disabled="temp.policy.readOnly" ng-model="temp.policy.guard" - required pattern="\S+" title="Guard is required"> + required pattern="\S+" title="Select the dropdown Guard value."> <option>True</option> <option>False</option></select> </div> @@ -47,18 +48,19 @@ <div class="form-group col-sm-3"> <label>Config Name:<sup><b>*</b></sup></label> <input type="text" class="form-control" ng-disabled="temp.policy.readOnly" - ng-model="temp.policy.configName" required /> + ng-model="temp.policy.configName" required title="Enter the Config Name without any spaces and special characters." /> </div> <div class="form-group col-sm-3"> <label>Time to Live Date:</label> <input type="text" id="ttlDate" class="form-control" name="ttlDate" ng-disabled="temp.policy.readOnly" - ng-model="temp.policy.ttlDate" /> + ng-model="temp.policy.ttlDate" title="Select the date from calender onclick on the field."/> </div> <div class="form-group col-sm-3"> <label>Security Zone:<sup><b>*</b></sup></label> <select class="form-control" ng-disabled="temp.policy.readOnly" ng-model="temp.policy.securityZone" - ng-options="option for option in securityZoneDictionaryDatas track by option"></select> + ng-options="option for option in securityZoneDictionaryDatas track by option" + title="Select the dropdown value driven from Security Zone (Firewall Policy)Dictionary."></select> </div> </div> </div> @@ -67,7 +69,7 @@ <div class="form-group col-sm-1"> <label>Rule Setup:</label><br> <button type="button" class="btn btn-default" - ng-disabled="temp.policy.readOnly" ng-click="addNewChoice()"> + ng-disabled="temp.policy.readOnly" ng-click="addNewChoice()" title="onClick Rule Setup row is added."> <i class="fa fa-plus"></i> </button> </div> @@ -78,19 +80,21 @@ <div class="form-group col-sm-3"> <select class="form-control" ng-model="choice.key" ng-disabled="temp.policy.readOnly" - ng-options="option for option in termListDictionaryDatas track by option"><option + ng-options="option for option in termListDictionaryDatas track by option" + title="Select the dropdown value driven from Term List (Firewall Policy)Dictionary."><option value="">{{choice.key}}</option></select> </div> <div class="form-group col-sm-3"> <select class="form-control" ng-model="choice.value" ng-disabled="temp.policy.readOnly" - ng-options="option for option in fwTagPickerDictionaryDatas track by option"><option + ng-options="option for option in fwTagPickerDictionaryDatas track by option" + title="Select the dropdown value driven from FW TagPicker (Firewall Policy)Dictionary."><option value="">{{choice.value}}</option></select> </div> <div class="form-group col-sm-1"> <button type="button" class="btn btn-default" ng-disabled="temp.policy.readOnly" ng-show="$last" - ng-click="removeChoice()"> + ng-click="removeChoice()" title="onClick will remove the last row"> <i class="fa fa-minus"></i> </button> </div> @@ -103,15 +107,15 @@ <br> <div class="modal-footer"> <button type="button" class="btn btn-default" - herf="javascript:void(0)" ng-click="viewFWRule(temp.policy);">Rule + herf="javascript:void(0)" ng-click="viewFWRule(temp.policy);" title="onClick Firewall Policy Rule is previewed based on the values entered in the template.">Rule Preview</button> <button class="btn btn-primary" herf="javascript:void(0)" ng-disabled="temp.policy.readOnly" - ng-click="validatePolicy(temp.policy);">Validate</button> + ng-click="validatePolicy(temp.policy);" title="Validate the data entered in the Policy fields.">Validate</button> <button class="btn btn-success" herf="javascript:void(0)" ng-disabled="savebutton" ng-disabled="temp.policy.readOnly" - ng-click="saveFWPolicy(temp);">Save</button> - <button type="button" class="btn btn-default" ng-click="refresh();">Close</button> + ng-click="saveFWPolicy(temp);" title="Save the Policy with validated data.">Save</button> + <button type="button" class="btn btn-default" ng-click="refresh();" title="Close the template.">Close</button> </div> </form> </div>
\ No newline at end of file diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/css/main.css b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/css/main.css index 317efd9fa..078e8297a 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/css/main.css +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/css/main.css @@ -373,4 +373,51 @@ table th > a:focus { .table.table-files .btn { display: none; } +} + +/* Tooltip container */ +.tooltip { + position: relative; + display: inline-block; + border-bottom: 1px dotted black; /* If you want dots under the hoverable text */ +} + +/* Tooltip text */ +.tooltip .tooltiptext { + visibility: hidden; + width: 120px; + background-color: #555; + color: #fff; + text-align: center; + padding: 5px 0; + border-radius: 6px; + + /* Position the tooltip text */ + position: absolute; + z-index: 1; + bottom: 125%; + left: 50%; + margin-left: -60px; + + /* Fade in tooltip */ + opacity: 0; + transition: opacity 1s; +} + +/* Tooltip arrow */ +.tooltip .tooltiptext::after { + content: ""; + position: absolute; + top: 100%; + left: 50%; + margin-left: -5px; + border-width: 5px; + border-style: solid; + border-color: #555 transparent transparent transparent; +} + +/* Show the tooltip text when you mouse over the tooltip container */ +.tooltip:hover .tooltiptext { + visibility: visible; + opacity: 1; }
\ No newline at end of file diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/js/controllers/policySearchManager.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/js/controllers/policySearchManager.js index f973a236a..42e6796cd 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/js/controllers/policySearchManager.js +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/js/controllers/policySearchManager.js @@ -157,35 +157,38 @@ app.controller('PolicySearchController', [ return currentPath.indexOf(path) !== -1; }; - $scope.searchPolicy = function(searchContent){ - var deferred = $q.defer(); - var uuu = "searchPolicy"; - var postData = {searchdata : searchContent}; - $.ajax({ - type : 'POST', - url : uuu, - dataType: 'json', - contentType: 'application/json', - data: JSON.stringify(postData), - success : function(data){ - $scope.$apply(function(){ - var searchdata = data.result; - if(searchdata.length > 0){ - if(searchdata[0] == "Elastic Search Server is down"){ - alert("Elastic Search Server is down."); - }else{ - $scope.policyNavigator.searchrefresh(searchdata); - } - }else{ - Notification.info("No Matches Found with your Search"); - } - }); - }, - error : function(data){ - alert("Error while Searching."); - } - }); - }; + $scope.searchPolicy = function(searchContent){ + if(searchContent != undefined){ + var uuu = "searchPolicy"; + var postData = {searchdata : searchContent}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + var searchdata = data.result; + if(searchdata.length > 0){ + if(searchdata[0] == "Exception"){ + Notification.error(searchdata[1]); + }else{ + $scope.policyNavigator.searchrefresh(searchdata); + } + }else{ + Notification.info("No Matches Found with your Search"); + } + }); + }, + error : function(data){ + Notification.error("Error while Searching."); + } + }); + }else{ + Notification.error("No data has been entered or selected to search"); + } + }; $scope.refresh = function(searchData){ $scope.policyNavigator.searchrefresh(null); diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/templates/item-context-menu.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/templates/item-context-menu.html index 3c41fbc1d..732b99baa 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/templates/item-context-menu.html +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/templates/item-context-menu.html @@ -27,7 +27,7 @@ </a> </li> <li ng-show="config.allowedActions.rename && temp.isFolder()"> - <a href="" tabindex="-1" data-toggle="modal" data-target="#move" ng-show="renameId"> + <a href="" tabindex="-1" data-toggle="modal" data-target="#moveScope" ng-show="renameId"> <i class="glyphicon glyphicon-edit"></i> Move Scope </a> </li> diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/templates/modals.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/templates/modals.html index 1c33839f2..e50802090 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/templates/modals.html +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/templates/modals.html @@ -13,8 +13,8 @@ <div ng-include data-src="'error-bar'" class="clearfix"></div> </div> <div class="modal-footer"> - <button type="button" class="btn btn-pedefault" data-dismiss="modal" ng-click="refresh();" ng-disabled="temp.inprocess">Cancel</button> - <button type="submit" class="btn btn-primary" ng-disabled="temp.inprocess" autofocus="autofocus">Delete</button> + <button type="button" class="btn btn-pedefault" data-dismiss="modal" ng-click="refresh();" ng-disabled="temp.inprocess" title="Close the Delete Scope Window.">Cancel</button> + <button type="submit" class="btn btn-primary" ng-disabled="temp.inprocess" autofocus="autofocus" title="OnClick you can delete the Scopes.">Delete</button> </div> </form> </div> @@ -42,8 +42,8 @@ <div ng-include data-src="'error-bar'" class="clearfix"></div> </div> <div class="modal-footer"> - <button type="button" class="btn btn-pedefault" data-dismiss="modal" ng-click="refresh();" ng-disabled="temp.inprocess">Cancel</button> - <button type="submit" class="btn btn-primary" ng-disabled="!temp.model.versions" autofocus="autofocus">Delete</button> + <button type="button" class="btn btn-pedefault" data-dismiss="modal" ng-click="refresh();" ng-disabled="temp.inprocess" title="Close the Delete Policy Window.">Cancel</button> + <button type="submit" class="btn btn-primary" ng-disabled="!temp.model.versions" autofocus="autofocus" title="OnClick you can delete the Policies.">Delete</button> </div> </form> </div> @@ -62,7 +62,7 @@ </div> <div class="modal-body"> <label class="radio">Enter New Name : <b>{{temp.model.name}}</b></label> - <input class="form-control" ng-model="temp.tempModel.name" autofocus="autofocus"> + <input class="form-control" ng-model="temp.tempModel.name" autofocus="autofocus" title="Enter the value without space or special characters."> <div ng-include data-src="'error-bar'" class="clearfix"></div> </div> @@ -119,6 +119,29 @@ </div> </div> +<div class="modal" id="moveScope" data-toggle="modal" data-backdrop="static" data-keyboard="false"> + <div class="modal-dialog"> + <div class="modal-content"> + <form ng-submit="move(temp)"> + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal"> + <span class="sr-only">Close</span> + </button> + <h4 class="modal-title">Move Scope</h4> + </div> + <div class="modal-body"> + <div ng-include data-src="'path-selector'" class="clearfix"></div> + <div ng-include data-src="'error-bar'" class="clearfix"></div> + </div> + <div class="modal-footer"> + <button type="button" class="btn btn-pedefault" data-dismiss="modal" ng-click="refresh();" ng-disabled="temp.inprocess">Cancel</button> + <button type="submit" class="btn btn-primary" ng-disabled="temp.inprocess">Move</button> + </div> + </form> + </div> + </div> +</div> + <div class="modal" id="switchVersion" data-toggle="modal" data-backdrop="static" data-keyboard="false"> <div class="modal-dialog"> <div class="modal-content"> @@ -131,16 +154,16 @@ </div> <div class="modal-body"> <label class="radio">Highest Version <b></b></label> - <input class="form-control" ng-disabled="true" ng-model="temp.tempModel.content.highestVersion" autofocus="autofocus"> + <input class="form-control" ng-disabled="true" ng-model="temp.tempModel.content.highestVersion" autofocus="autofocus" title="The Field shows highest version of Policy."> </div> <div class="modal-body"> <label class="radio">Active Version <b></b></label> - <select class="form-control" ng-model="temp.tempModel.content.activeVersion" ng-options="option for option in temp.tempModel.content.availableVersions" autofocus="autofocus"></select> + <select class="form-control" ng-model="temp.tempModel.content.activeVersion" ng-options="option for option in temp.tempModel.content.availableVersions" autofocus="autofocus" title="Enter the value not greater than highest version to switch policy."></select> <div ng-include data-src="'error-bar'" class="clearfix"></div> </div> <div class="modal-footer"> - <button type="button" class="btn btn-pedefault" data-dismiss="modal" ng-disabled="temp.inprocess">Cancel</button> - <button type="submit" class="btn btn-primary" ng-disabled="temp.tempModel.content.highestVersion === temp.tempModel.content.activeVersion">Save</button> + <button type="button" class="btn btn-pedefault" data-dismiss="modal" ng-disabled="temp.inprocess" title="OnClick SwitchVersion Window is closed.">Cancel</button> + <button type="submit" class="btn btn-primary" ng-disabled="temp.tempModel.content.highestVersion === temp.tempModel.content.activeVersion" title="OnClick Policy Version will be Switched.">Save</button> </div> </form> </div> @@ -159,12 +182,12 @@ </div> <div class="modal-body"> <label class="radio">Enter new Policy Name to Clone <b>{{temp.model.name}}</b></label> - <input class="form-control" ng-model="temp.tempModel.name" autofocus="autofocus"> + <input class="form-control" ng-model="temp.tempModel.name" autofocus="autofocus" title="Enter the PolicyName without space or special characters."> <div ng-include data-src="'error-bar'" class="clearfix"></div> </div> <div class="modal-footer"> - <button type="button" class="btn btn-pedefault" data-dismiss="modal" ng-disabled="temp.inprocess">Cancel</button> - <button type="submit" class="btn btn-primary" ng-disabled="temp.inprocess">Clone</button> + <button type="button" class="btn btn-pedefault" data-dismiss="modal" ng-disabled="temp.inprocess" title="OnClick Clone Window is closed.">Cancel</button> + <button type="submit" class="btn btn-primary" ng-disabled="temp.inprocess" title="OnClick the Policy will be cloned.">Clone</button> </div> </form> </div> @@ -183,12 +206,12 @@ </div> <div class="modal-body"> <label class="radio">Scope Name</label> - <input class="form-control" ng-model="temp.tempModel.name" autofocus="autofocus"> + <input class="form-control" ng-model="temp.tempModel.name" autofocus="autofocus" title="Enter the ScopeName without space or special characters."> <div ng-include data-src="'error-bar'" class="clearfix"></div> </div> <div class="modal-footer"> - <button id = "cancel" type="button" class="btn btn-pedefault" data-dismiss="modal" ng-disabled="temp.inprocess">Cancel</button> - <button type="submit" class="btn btn-primary" ng-disabled="temp.inprocess">Create</button> + <button id = "cancel" type="button" class="btn btn-pedefault" data-dismiss="modal" ng-disabled="temp.inprocess" title="OnClick Scope Window is closed.">Cancel</button> + <button type="submit" class="btn btn-primary" ng-disabled="temp.inprocess" title="OnClick Scope is created.">Create</button> </div> </form> </div> @@ -207,12 +230,12 @@ </div> <div class="modal-body"> <label class="radio">Scope Name</label> - <input class="form-control" ng-model="temp.tempModel.subScopename" autofocus="autofocus"> + <input class="form-control" ng-model="temp.tempModel.subScopename" autofocus="autofocus" title="Enter the SubScopeName without space or special characters."> <div ng-include data-src="'error-bar'" class="clearfix"></div> </div> <div class="modal-footer"> - <button type="button" class="btn btn-pedefault" data-dismiss="modal" ng-disabled="temp.inprocess">Cancel</button> - <button type="submit" class="btn btn-primary" ng-disabled="temp.inprocess">Create</button> + <button type="button" class="btn btn-pedefault" data-dismiss="modal" ng-disabled="temp.inprocess" title="OnClick SubScope Window is closed.">Cancel</button> + <button type="submit" class="btn btn-primary" ng-disabled="temp.inprocess" title="OnClick SubScope is created.">Create</button> </div> </form> </div> @@ -236,8 +259,8 @@ </div> <div class="modal-footer"> <div ng-show="!fileUploader.requesting"> - <button type="button" class="btn btn-pedefault" data-dismiss="modal">Cancel</button> - <button type="submit" class="btn btn-primary" ng-disabled="!uploadFileList.length || fileUploader.requesting">{{'upload' | translate}}</button> + <button type="button" class="btn btn-pedefault" data-dismiss="modal" title="OnClick Import window is closed.">Cancel</button> + <button type="submit" class="btn btn-primary" ng-disabled="!uploadFileList.length || fileUploader.requesting" title="OnClick Policy will be Imported.">{{'upload' | translate}}</button> </div> <div ng-show="fileUploader.requesting"> <span class="label label-warning">Uploading......</span> diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/templates/navbar.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/templates/navbar.html index dfac651ae..54c48da25 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/templates/navbar.html +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/templates/navbar.html @@ -10,10 +10,10 @@ <div class="form-group col-sm-5" style="margin-top: 2%"></div> <div class="form-group col-sm-4" style="margin-top: 2%" align="right" ng-hide="isDisabled"> <div class="btn-group"> - <button type="button" class="btn btn-primary" ng-show="superAdminId" data-toggle="modal" data-target="#newfolder" ng-click="touch()"><i class="glyphicon glyphicon-plus"></i>Add Scope</button> - <button type="button" class="btn btn-primary" ng-show="importPolicyId" data-toggle="modal" data-target="#uploadfile" ng-show="config.allowedActions.upload" ng-click="touch()"> <i class="glyphicon glyphicon-upload"></i>Import</button> - <button type="button" class="btn btn-primary" ng-show="exportPolicyId" data-toggle="modal" data-target="#exportPolicy" ng-show="config.allowedActions.exportPolicy"> <i class="glyphicon glyphicon-download"></i>Export</button> - <button class="btn btn-secondary" type="button" onClick="window.location='policy#/policy_SearchFilter';">Filter</button> + <button type="button" class="btn btn-primary" ng-show="superAdminId" data-toggle="modal" data-target="#newfolder" ng-click="touch()" title="Create Scope for adding policies"><i class="glyphicon glyphicon-plus"></i>Add Scope</button> + <button type="button" class="btn btn-primary" ng-show="importPolicyId" data-toggle="modal" data-target="#uploadfile" ng-show="config.allowedActions.upload" ng-click="touch()" title="On Click Popup will open to Import policies"> <i class="glyphicon glyphicon-upload"></i>Import</button> + <button type="button" class="btn btn-primary" ng-show="exportPolicyId" data-toggle="modal" data-target="#exportPolicy" ng-show="config.allowedActions.exportPolicy" title="On Click Popup will open to Export policies"> <i class="glyphicon glyphicon-download"></i>Export</button> + <button class="btn btn-secondary" type="button" onClick="window.location='policy#/policy_SearchFilter';" title="On Click Navigaate to Search window">Filter</button> </div> </div> </div> diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/templates/searchNavbar.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/templates/searchNavbar.html index 891e27b9c..f46c5b5dc 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/templates/searchNavbar.html +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/templates/searchNavbar.html @@ -58,7 +58,7 @@ body { <div class="input-group"> <div class="input-group" id="adv-search"> <input type="text" class="form-control" - placeholder="{{'search'}}..." ng-model="search.query" /> + placeholder="{{'search'}}..." ng-model="search.query" title="Enter the value to filter policies."/> <div class="input-group-btn"> <div class="btn-group" role="group"> <div class="dropdown dropdown-lg"> @@ -71,7 +71,7 @@ body { <div class="form-group row"> <div class="form-group col-sm-4"> <label for="filter">Policy Type:</label> <select - class="form-control" ng-model="search.policyType"> + class="form-control" ng-model="search.policyType" title="Select the PolicyType value."> <option>action</option> <option>config</option> <option>closedLoop</option> @@ -82,7 +82,7 @@ body { <div class="form-group col-sm-8"> <label for="filter">Descriptive Type:</label> <select class="form-control" ng-model="search.descriptiveScope" - ng-options="option for option in descriptiveScopeDictionaryDatas track by option"></select> + ng-options="option for option in descriptiveScopeDictionaryDatas track by option" title="Select Descriptive Scope value driven from Descriptive Scope dictionary."></select> </div> </div> <div ng-if="search.policyType == 'closedLoop'"> @@ -90,21 +90,21 @@ body { <div class="form-group col-sm-6"> <label>ClosedLoop Policy Type:</label><BR> <select class="form-control" - ng-model="search.closedLooppolicyType"> + ng-model="search.closedLooppolicyType" title="Select the ClosedLoop Policy Type value."> <option>Config_Fault</option> <option>Config_PM</option> </select> </div> <div class="form-group col-sm-6"> <label>Onap Name:</label><BR> <select - class="form-control" ng-model="search.onapName" + class="form-control" ng-model="search.onapName" title="Select the dropdown value driven from ONAP (Common)Dictionary." ng-options="option for option in onapNameDictionaryDatas track by option"></select> </div> </div> <div class="form-group row"> <div class="form-group col-sm-6" ng-if="search.closedLooppolicyType == 'Config_PM'"> <label>D2 Service:</label><BR> <select - class="form-control" ng-model="search.d2Service"> + class="form-control" ng-model="search.d2Service" title="Select the ClosedLoop D2 Service value."> <option>Hosted Voice(Trinity)</option> <option>vUSP</option> <option>MCR</option> @@ -115,7 +115,7 @@ body { <div class="form-group col-sm-6" ng-if="search.closedLooppolicyType == 'Config_PM'"> <label>Service Type:</label><BR> <select - class="form-control" ng-model="search.serviceType"> + class="form-control" ng-model="search.serviceType" title="Select the Service Type Value."> <option>Registration Failure(Trinity)</option> <option>International Fraud(Trinity)</option> <option>No Dial Tone(Trinity)</option> @@ -128,13 +128,13 @@ body { <div class="form-group col-sm-6" ng-if="search.closedLooppolicyType == 'Config_Fault'"> <label>VNF Type:</label><BR> <select - class="form-control" ng-model="search.vnfType" + class="form-control" ng-model="search.vnfType" title="Select the ClosedLoop VNF Type value." ng-options="option for option in vnfTypeDictionaryDatas track by option"></select> </div> <div class="form-group col-sm-6" ng-if="search.closedLooppolicyType == 'Config_Fault'"> <label>Policy Status:</label><BR> <select - class="form-control" ng-model="search.policyStatus"> + class="form-control" ng-model="search.policyStatus" title="Select the Policy Status value."> <option>Active</option> <option>InActive</option> </select> @@ -145,11 +145,11 @@ body { ng-if="search.closedLooppolicyType == 'Config_Fault'"> <label>vPRO Action:</label><BR> <select class="form-control" ng-model="search.vproAction" - ng-options="option for option in vsclActionDictionaryDatas track by option"></select> + ng-options="option for option in vsclActionDictionaryDatas track by option" title="Select vPRO Action value."></select> </div> <div class="form-group col-sm-6" ng-if="search.closedLooppolicyType == 'Config_Fault'"> <label>Bind Text Search to:</label><BR> <select - class="form-control" ng-model="search.bindTextSearch"> + class="form-control" ng-model="search.bindTextSearch" title="Select the Bind Text Search value."> <option>Email Address</option> <option>Trigger Signature</option> <option>Connect All Traps</option> @@ -167,11 +167,11 @@ body { </div> </div> <button type="button" class="btn btn-pedefault" - ng-click="refresh(search = null);"> + ng-click="refresh(search = null);" title="Clear the selected values."> <span aria-hidden="true">Clear</span> </button> <button type="button" class="btn btn-primary" - ng-click="searchPolicy(search);"> + ng-click="searchPolicy(search);" title="Click on the button to search for policies after entering the fields."> <span class="glyphicon glyphicon-search" aria-hidden="true"></span> </button> </div> @@ -183,8 +183,8 @@ body { </div> <div class="form-group col-sm-4" style="margin-top: 2%" align="right"> <div class="btn-group"> - <button class="btn btn-secondary" type="button" onClick="window.location='policy#/Editor';">Editor</button> - <button class="btn btn-primary" type="button" onClick="window.location='policy#/policy_SearchFilter';">Filter</button> + <button class="btn btn-secondary" type="button" onClick="window.location='policy#/Editor';" title="OnClick navigate to Editor tab.">Editor</button> + <button class="btn btn-primary" type="button" onClick="window.location='policy#/policy_SearchFilter';" title="Search Policy window">Filter</button> </div> </div> </div> diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/policy_AdminTab.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/policy_AdminTab.html index 75ad7ca93..caca4152c 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/policy_AdminTab.html +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/policy_AdminTab.html @@ -26,7 +26,7 @@ <div> <input type="checkbox" ng-click="saveLockDownValue(lockdowndata[0].lockdown);" - ng-model="lockdowndata[0].lockdown" b2b-switches> + ng-model="lockdowndata[0].lockdown" b2b-switches title="Click on the button to Lockdown Policy Application."> </div> </label> <div ng-show="isDisabled" class="icon-lock" 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 5086ccfdb..c4559a4ad 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 @@ -46,16 +46,16 @@ <div class="form-group col-sm-3"> <label>Policy Type Dictionary:</label> </br><select class="form-control" ng-model="option1" ng-options="option for option in options1" - ng-change="getOptions2()"></select> + ng-change="getOptions2()" title="Dropdown shows values specific to Policy type."></select> </div> <div class="form-group col-sm-3"> <label>Select Dictionary:</label></br> <select class="form-control" - ng-model="option2" ng-options="option for option in options2"></select> + ng-model="option2" ng-options="option for option in options2" title="Dictionary type values are shown based on specific Policy Type Dictionary selection."></select> </div> <div class="form-group col-sm-1"> <label></label></br> <button class="btn btn-primary btn-small" type="button" - herf="javascript:void(0)" ng-click="import();">Import + herf="javascript:void(0)" ng-click="import();" title="Import Dictionary's and the file ends with .csv format">Import Dictionary's</button> </div> </div> diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/policy_PDPManagement.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/policy_PDPManagement.html index 55e7a07cd..1a48e8cd4 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/policy_PDPManagement.html +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/policy_PDPManagement.html @@ -47,13 +47,13 @@ <div class="form-group row"> <div class="form-group col-sm-3"> <button class="btn btn-primary btn-small" type="button" - ng-click="addNewPDPGroupPopUpWindow();" ng-show="createPdpGroupId">Create + ng-click="addNewPDPGroupPopUpWindow();" ng-show="createPdpGroupId" title="Create PDP Group">Create Group</button> </div> <div class="form-group col-sm-6"> <input type="text" class="form-control" class="search" ng-disabled="isDisabled" - placeholder="{{'search'}}..." ng-model="search"> + placeholder="{{'search'}}..." ng-model="search" title="Filter the PDP Groups based on pdpname or pdp's"> </div> </div> @@ -102,13 +102,13 @@ </td> <td width="15%"> <div ng-click="editPDPGroupFunctionModalPopup(pdpdata);" - style="font-size: 20px;" ng-show="editPdpGroupId"> + style="font-size: 20px;" ng-show="editPdpGroupId" title="Edit PDP Group to create/update/delete pdp's and to see the active policies in PDP Group."> <span href="javascript:void(0)" class="glyphicon glyphicon-edit"></span> </div> </td> <td width="5%"> <div ng-click="removePDPGroup(pdpdata);" style="font-size: 20px;" - ng-show="deletePdpGroupId"> + ng-show="deletePdpGroupId" title="Delete PDP Group."> <span href="javascript:void(0)" class="glyphicon glyphicon-trash"></span> </div> </td> diff --git a/PolicyEngineUtils/src/main/java/org/onap/policy/utils/PolicyUtils.java b/PolicyEngineUtils/src/main/java/org/onap/policy/utils/PolicyUtils.java index fa23f4a31..c058a7997 100644 --- a/PolicyEngineUtils/src/main/java/org/onap/policy/utils/PolicyUtils.java +++ b/PolicyEngineUtils/src/main/java/org/onap/policy/utils/PolicyUtils.java @@ -53,12 +53,12 @@ import com.google.gson.JsonSyntaxException; public class PolicyUtils { private static final Logger LOGGER = FlexLogger.getLogger(PolicyUtils.class); - + public static final String CATCH_EXCEPTION = "PE500: An exception was caught."; public static final String EMAIL_PATTERN = "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@" + "[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$"; private static final String PACKAGE_ERROR = "mismatched input '{' expecting one of the following tokens: '[package"; - private static final String SUCCESS = "success"; + public static final String SUCCESS = "success"; private PolicyUtils(){ // Private Constructor @@ -276,6 +276,9 @@ public class PolicyUtils { * @return */ public static boolean isXMLValid(String data) { + if(data == null || data.isEmpty()){ + return false; + } SAXParserFactory factory = SAXParserFactory.newInstance(); factory.setValidating(false); factory.setNamespaceAware(true); |