From 1148834bc4b10d00c1b1830b087357e63af8293f Mon Sep 17 00:00:00 2001 From: rb7147 Date: Thu, 1 Feb 2018 12:07:13 -0500 Subject: 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 --- .../onap/policy/controller/AutoPushController.java | 7 +- .../CreateClosedLoopFaultController.java | 310 +++++++++------------ .../CreateDcaeMicroServiceController.java | 8 +- .../org/onap/policy/controller/PDPController.java | 4 +- .../Windows/Dictionary/CLSiteDictionary.html | 4 - .../Windows/Dictionary/CLVarbindDictionary.html | 4 - .../Windows/Dictionary/FWZoneDictionary.html | 4 - .../Windows/Dictionary/MSConfigNameDictionary.html | 4 - .../Windows/Dictionary/MSDCAEUUIDDictionary.html | 4 - .../Windows/Dictionary/MSLocationDictionary.html | 4 - .../Windows/Dictionary/MSModelsDictionary.html | 4 - .../Dictionary/ModelAttributeDictionary.html | 1 - .../app/policyApp/Windows/Edit_Roles_Window.html | 6 +- .../Windows/PDPTabWindows/AddorEditPDPtoGroup.html | 12 +- .../PushtabWindow/removeGroupPoliciesWindow.html | 4 +- .../app/policyApp/Windows/new_PDPGroup_Window.html | 18 +- .../app/policyApp/controller/pdpController.js | 32 ++- .../controller/pdpGroupPopUpController.js | 80 +++--- .../BaseConfigPolicyController.js | 8 - .../ClosedLoopFaultController.js | 57 ++-- .../DCAEMicroServicePolicyController.js | 114 ++++---- .../PolicyTemplates/ActionPolicyTemplate.html | 34 +-- .../PolicyTemplates/BRMSParamPolicyTemplate.html | 37 +-- .../PolicyTemplates/BRMSRawPolicyTemplate.html | 33 +-- .../Editor/PolicyTemplates/BasePolicyTemplate.html | 38 +-- .../ClosedLoopFaultPolicyTemplate.html | 119 ++++---- .../ClosedLoopPMPolicyTemplate.html | 30 +- .../DCAEMicroServicePolicyTemplate.html | 41 +-- .../PolicyTemplates/DecisionPolicyTemplate.html | 55 ++-- .../PolicyTemplates/FirewallPolicyTemplate.html | 36 +-- .../policyApp/policy-models/Editor/css/main.css | 47 ++++ .../Editor/js/controllers/policySearchManager.js | 61 ++-- .../Editor/templates/item-context-menu.html | 2 +- .../policy-models/Editor/templates/modals.html | 63 +++-- .../policy-models/Editor/templates/navbar.html | 8 +- .../Editor/templates/searchNavbar.html | 30 +- .../policyApp/policy-models/policy_AdminTab.html | 2 +- .../policyApp/policy-models/policy_Dictionary.html | 6 +- .../policy-models/policy_PDPManagement.html | 8 +- 39 files changed, 712 insertions(+), 627 deletions(-) (limited to 'POLICY-SDK-APP/src') 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 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 attributeList = new ArrayList<>(); + ClosedLoopFaultTrapDatas trapDatas = (ClosedLoopFaultTrapDatas) object; + List 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, int index) { + private String readAttributes(List object, int index) { String attributes = ""; Map trapSignatures = (Map) 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 connectTrapSignatures) { - StringBuilder resultBody = new StringBuilder(); - String connectMainBody = ""; - for(int j = 0; j < connectTrapSignatures.size(); j++){ - Map connectTraps = (Map)connectTrapSignatures.get(j); + @SuppressWarnings({ "unchecked", "rawtypes" }) + private String getUIConnectTraps(ArrayList connectTrapSignatures) { + StringBuilder resultBody = new StringBuilder(); + String connectMainBody = ""; + for(int j = 0; j < connectTrapSignatures.size(); j++){ + Map connectTraps = (Map)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 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 connectTraps = (ArrayList) 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 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 connectTraps = (ArrayList) 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 trap1; - private ArrayList trap2; - private ArrayList trap3; - private ArrayList trap4; - private ArrayList trap5; - private ArrayList trap6; - public ArrayList getTrap1() { - return trap1; - } - public void setTrap1(ArrayList trap1) { - this.trap1 = trap1; - } - public ArrayList getTrap2() { - return trap2; - } - public void setTrap2(ArrayList trap2) { - this.trap2 = trap2; - } - public ArrayList getTrap3() { - return trap3; - } - public void setTrap3(ArrayList trap3) { - this.trap3 = trap3; - } - public ArrayList getTrap4() { - return trap4; - } - public void setTrap4(ArrayList trap4) { - this.trap4 = trap4; - } - public ArrayList getTrap5() { - return trap5; - } - public void setTrap5(ArrayList trap5) { - this.trap5 = trap5; - } - public ArrayList getTrap6() { - return trap6; - } - public void setTrap6(ArrayList 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 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 keys= keyValues.keySet(); Iterator 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 @@ 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 _." />
+ ng-model="temp.policy.policyDescription" + title="Description field will accept any type of data."/>
@@ -20,7 +21,7 @@

@@ -31,18 +32,19 @@
+ placeholder="Attribute Value" title="Enter the Attribute Value without any spaces and special characters"/>
@@ -56,7 +58,7 @@
@@ -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.">
@@ -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."> @@ -92,12 +94,12 @@ + name="dynamicRuleAlgorithmField2" title="Enter the Value without any spaces and special characters and for rule formation use A1, A2,..etc., based on above Rules."/>
@@ -110,7 +112,7 @@

@@ -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"> + ng-options="option for option in actionPolicyDictionaryDatas track by option" title="Select the dropdown value driven from Action (Action)Dictionary.">
@@ -129,11 +131,11 @@ 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 _." />
+ ng-model="temp.policy.policyDescription" + title="Description field will accept any type of data."/>
@@ -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"> + required pattern="\S+" title="Select the dropdown value driven from RiskType (Safe Policy)Dictionary.">
+ required pattern="\S+" title="Select the dropdown Guard value.">
@@ -48,19 +49,19 @@
+ ng-model="temp.policy.ttlDate" title="Select the date from calender onclick on the field."/>
+ ng-options="option for option in brmsControllerDatas track by option" title="Select the dropdown value driven from BRMS Controller (BRMS)Dictionary.">
+ ng-options="option for option in brmsDependencyDatas track by option" title="Select the dropdown value driven from BRMS Dependency (BRMS)Dictionary.">
@@ -69,7 +70,7 @@
@@ -79,17 +80,17 @@
@@ -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">
@@ -129,7 +130,7 @@

Rule Preview:


- +
@@ -137,14 +138,14 @@
+ ng-click="validatePolicy(temp.policy);" title="Validate the data entered in the Policy fields.">Validate - + ng-click="saveBrmsParamPolicy(temp);" title="Save the Policy with validated data.">Save +
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 _." />
+ ng-model="temp.policy.policyDescription" + title="Description field will accept any type of data."/>
@@ -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"> + required pattern="\S+" title="Select the dropdown value driven from RiskType (Safe Policy)Dictionary.">
+ required pattern="\S+" title="Select the dropdown Guard value.">
@@ -47,19 +48,19 @@
+ ng-model="temp.policy.ttlDate" title="Select the date from calender onclick on the field."/>
+ ng-options="option for option in brmsControllerDatas track by option" title="Select the dropdown value driven from BRMS Controller (BRMS)Dictionary.">
+ ng-options="option for option in brmsDependencyDatas track by option" title="Select the dropdown value driven from BRMS Dependency (BRMS)Dictionary.">
@@ -68,7 +69,7 @@
@@ -78,17 +79,17 @@
@@ -101,7 +102,7 @@
@@ -112,11 +113,11 @@
+ ng-click="validatePolicy(temp.policy);" title="Validate the data entered in the Policy fields.">Validate - + ng-click="saveBrmsRawPolicy(temp);" title="Save the Policy with validated data.">Save +
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 _." />
+ ng-model="temp.policy.policyDescription" + title="Description field will accept any type of data." />
@@ -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"> + required pattern="\S+" + title="Select the dropdown value driven from OnapName (common)Dictionary.">
+ title="Enter the Config Name without any spaces and special characters." />
+ ng-model="temp.policy.ttlDate" + title="Select the date from calender onclick on the field."/>
@@ -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"> + required pattern="\S+" title="Select the dropdown value driven from RiskType (Safe Policy)Dictionary.">
+ required pattern="\S+" title="Select the dropdown Guard value.">
@@ -70,7 +73,7 @@
@@ -81,18 +84,19 @@
+ ng-options="option for option in attributeDictionaryDatas track by option" + title="Select the dropdown value driven from Attribute (common)Dictionary.">
+ title="Enter the Attribute Value without any spaces and special characters" />
@@ -106,7 +110,7 @@ + required title="Enter the ConfigBody based on ConfigType Selection"> @@ -129,10 +133,10 @@ 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 _." />
+ ng-model="temp.policy.policyDescription" + title="Description field will accept any type of data."/>
@@ -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"> + required pattern="\S+" title="Select the dropdown value driven from RiskType (Safe Policy)Dictionary.">
+ required pattern="\S+" title="Select the dropdown Guard value.">
@@ -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"> + required pattern="\S+" title="Select the dropdown value driven from OnapName (common)Dictionary.">
@@ -55,7 +56,8 @@
@@ -63,7 +65,8 @@ @@ -84,7 +87,7 @@
+ ng-model="temp.policy.ttlDate" title="Select the date from calender onclick on the field."/>
@@ -95,12 +98,14 @@
@@ -112,12 +117,14 @@
@@ -138,7 +145,8 @@ @@ -152,7 +160,8 @@ @@ -170,7 +179,7 @@
@@ -189,7 +198,8 @@
@@ -206,7 +216,8 @@
@@ -218,7 +229,7 @@
@@ -228,16 +239,15 @@
-
-
Trap Max Age:
+ ng-init="temp.policy.jsonBodyData.trapMaxAge='300'" value="300" title="Enter the Trap Max Age value and the value should be numeric."/>
@@ -248,7 +258,8 @@
@@ -256,25 +267,25 @@
+ class="form-control" required title="Enter the Time Interval value and the value should be numeric."/>

+ class="form-control" required title="Enter the App-C Timeout value and the value should be numeric."/>

+ class="form-control" required title="Enter the Timeout for Ruby value and the value should be numeric."/>

+ required title="Enter the Number of retries value and the value should be numeric."/>
@@ -282,20 +293,20 @@
+ class="form-control" required title="Enter the Aging Window value and the value should be numeric."/>

+ required title="Enter the UEB Message value."/>

+ class="form-control" required title="Enter the email address for multiple use comma seperated value."/>
@@ -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."> @@ -315,7 +327,8 @@
@@ -329,12 +342,14 @@
@@ -346,12 +361,14 @@ @@ -372,7 +389,8 @@ @@ -386,7 +404,8 @@ @@ -403,7 +422,7 @@
@@ -422,7 +441,8 @@
@@ -439,7 +459,8 @@
@@ -451,7 +472,7 @@
@@ -461,11 +482,11 @@
-
Clear TimeOut:
+ class="form-control" required title="Enter the Cleartimeout value and the value should be numeric."/>
@@ -493,11 +514,11 @@ \ 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 _."/>
+ ng-model="temp.policy.policyDescription" + title="Description field will accept any type of data."/>
@@ -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"> + required pattern="\S+" title="Select the dropdown value driven from OnapName (common)Dictionary.">
+ ng-model="temp.policy.ttlDate" title="Select the date from calender onclick on the field."/>
@@ -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"> + required pattern="\S+" title="Select the dropdown value driven from RiskType (Safe Policy)Dictionary.">
@@ -49,7 +50,7 @@ + ng-click="addDataToFields(temp.policy.serviceTypePolicyName);" + title="Select the Service Type PolicyName from dropdown value.">
@@ -125,7 +127,8 @@
+ ng-model="temp.policy.jsonBodyData.geoLink" + title="Enter the UEB Message value."/>
@@ -133,7 +136,8 @@
+ ng-model="temp.policy.jsonBodyData.emailAddress" + title="Enter the email address and for multiple use comma seperated value."/>
@@ -144,11 +148,11 @@
+ ng-click="validatePolicy(temp.policy);" title="Validate the data entered in the Policy fields.">Validate - + ng-click="saveCLPMPolicy(temp);" title="Save the Policy with validated data.">Save +
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 _." />
+ ng-model="temp.policy.policyDescription" + title="Description field will accept any type of data."/>
@@ -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"> + required pattern="\S+" title="Select the dropdown value driven from OnapName (common)Dictionary.">
+ ng-model="temp.policy.ttlDate" title="Select the date from calender onclick on the field."/>
@@ -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"> + required pattern="\S+" title="Select the dropdown value driven from RiskType (Safe Policy)Dictionary.">
@@ -49,7 +50,7 @@ + ng-options="option for option in priorityDatas track by option" title="Select the dropdown Priority value.">
@@ -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);"> + ng-click="pullVersion(temp.policy.serviceType);" + title="Select the dropdown value driven from MicroService Models (MicroService Policy)Dictionary.">
+ ng-click="addDataToFields(temp.policy.serviceType, temp.policy.version);" + title="Select the dropdown value driven based on MicroService Models (MicroService Policy)Dictionary selection.">
@@ -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"> + ng-options="option for option in microServiceCongigNameDictionaryDatas track by option" required="true" + title="Select the dropdown value driven from MicroService ConfigName (MicroService Policy)Dictionary.">

+ ng-options="option for option in microServiceLocationDictionaryDatas track by option" required="true" + title="Select the dropdown value driven from MicroService Location (MicroService Policy)Dictionary.">

+ ng-options="option for option in dcaeUUIDDictionaryDatas track by option" required="true" + title="Select the dropdown value driven from DCAE UUID (MicroService Policy)Dictionary.">

+ 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.">
@@ -122,11 +129,11 @@ 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 _." />
+ ng-model="temp.policy.policyDescription" + title="Description field will accept any type of data."/>
@@ -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"> + required pattern="\S+" title="Select the dropdown value driven from OnapName (common)Dictionary.">
+ placeholder="Service Type" title="Enter Service Type value."/>
@@ -56,7 +57,7 @@
+ placeholder="VNF Type" title="Enter VNF Type value."/>
@@ -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.">
@@ -289,7 +290,7 @@
+ placeholder="Limit" title="Enter time limit value."/>
@@ -299,11 +300,11 @@
+ placeholder="Time Window" title="Enter time window value."/>
@@ -329,7 +330,7 @@
@@ -344,7 +345,7 @@

@@ -355,18 +356,18 @@
+ placeholder="Attribute Value" title="Enter the Attribute Value without any spaces and special characters"/>
@@ -383,7 +384,7 @@
@@ -394,19 +395,19 @@
+ ng-model="settingschoice.value" placeholder="Settings Value" title="Enter the Settings Attribute Value without any spaces and special characters"/>
@@ -423,7 +424,7 @@
@@ -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."> @@ -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"> + name="dynamicRuleAlgorithmCombo" title="Select the dropdown value driven from FunctionDataType.">
+ name="dynamicRuleAlgorithmField2" title="Enter the Value without any spaces and special characters and for rule formation use A1, A2,..etc., based on above Rules."/>
@@ -477,11 +478,11 @@ \ 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 _." />
+ ng-model="temp.policy.policyDescription" + title="Description field will accept any type of data."/>
@@ -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"> + required pattern="\S+" title="Select the dropdown value driven from RiskType (Safe Policy)Dictionary.">
+ required pattern="\S+" title="Select the dropdown Guard value.">
@@ -47,18 +48,19 @@
+ ng-model="temp.policy.configName" required title="Enter the Config Name without any spaces and special characters." />
+ ng-model="temp.policy.ttlDate" title="Select the date from calender onclick on the field."/>
+ ng-options="option for option in securityZoneDictionaryDatas track by option" + title="Select the dropdown value driven from Security Zone (Firewall Policy)Dictionary.">
@@ -67,7 +69,7 @@

@@ -78,19 +80,21 @@
@@ -103,15 +107,15 @@
\ 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 @@
  • - + Move Scope
  • 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 @@
    @@ -42,8 +42,8 @@
    @@ -62,7 +62,7 @@ @@ -119,6 +119,29 @@ + + @@ -183,12 +206,12 @@ @@ -207,12 +230,12 @@ @@ -236,8 +259,8 @@