diff options
author | Sébastien Determe <sd378r@intl.att.com> | 2018-05-18 13:50:36 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-05-18 13:50:36 +0000 |
commit | 0742bc095be9c554e3c43f7a0928aa4ea78091c0 (patch) | |
tree | f1a9396f64449d4239cde50378f0c0a5062490f4 | |
parent | f172e9d4656c960e81f72cc6d6e52770271df9c9 (diff) | |
parent | 4e68a4d91db14f6495c3a255bd422b50ff99c841 (diff) |
Merge changes from topics 'bugfix/improve-UI-op-policy', 'bugfix/op-policy', 'bugfix/update-2.0.1'
* changes:
Help added to targetResourceId
Fix op policy
Update version to 2.0.1
8 files changed, 74 insertions, 30 deletions
diff --git a/docs/release-notes.rst b/docs/release-notes.rst index 2e6fd4793..fa5d8b6a0 100644 --- a/docs/release-notes.rst +++ b/docs/release-notes.rst @@ -5,7 +5,7 @@ Release Notes ============= -Version: 2.0.0 +Version: 2.0.1 -------------- :Release Date: 2018-06-25 @@ -26,7 +26,7 @@ <modelVersion>4.0.0</modelVersion> <groupId>org.onap.clamp</groupId> <artifactId>clds</artifactId> - <version>2.0.0-SNAPSHOT</version> + <version>2.0.1-SNAPSHOT</version> <name>clamp</name> <parent> diff --git a/src/main/java/org/onap/clamp/clds/model/properties/PolicyItem.java b/src/main/java/org/onap/clamp/clds/model/properties/PolicyItem.java index bb14b235f..337a97633 100644 --- a/src/main/java/org/onap/clamp/clds/model/properties/PolicyItem.java +++ b/src/main/java/org/onap/clamp/clds/model/properties/PolicyItem.java @@ -48,17 +48,17 @@ import java.util.List; * "targetResourceId","value":["Eace933104d443b496b8.nodes.heat.vpg"]}]]}] */ public class PolicyItem implements Cloneable { - protected static final EELFLogger logger = EELFManager.getInstance().getLogger(PolicyItem.class); - protected static final EELFLogger auditLogger = EELFManager.getInstance().getAuditLogger(); - private String id; - private String recipe; - private int maxRetries; - private int retryTimeLimit; - private String parentPolicy; - private List<String> parentPolicyConditions; - private String actor; - private String targetResourceId; + protected static final EELFLogger logger = EELFManager.getInstance().getLogger(PolicyItem.class); + protected static final EELFLogger auditLogger = EELFManager.getInstance().getAuditLogger(); + private String id; + private String recipe; + private int maxRetries; + private int retryTimeLimit; + private String parentPolicy; + private List<String> parentPolicyConditions; + private String actor; + private String targetResourceId; /** * Parse Policy given json node. @@ -73,7 +73,9 @@ public class PolicyItem implements Cloneable { parentPolicy = AbstractModelElement.getValueByName(node, "parentPolicy"); parentPolicyConditions = AbstractModelElement.getValuesByName(node, "parentPolicyConditions"); targetResourceId = AbstractModelElement.getValueByName(node, "targetResourceId"); - + if (targetResourceId != null && targetResourceId.isEmpty()) { + this.setTargetResourceId(null); + } } /** diff --git a/src/main/resources/META-INF/resources/designer/partials/portfolios/PolicyWindow_properties.html b/src/main/resources/META-INF/resources/designer/partials/portfolios/PolicyWindow_properties.html index 7dd2c4dd7..f63fb53a9 100644 --- a/src/main/resources/META-INF/resources/designer/partials/portfolios/PolicyWindow_properties.html +++ b/src/main/resources/META-INF/resources/designer/partials/portfolios/PolicyWindow_properties.html @@ -286,9 +286,13 @@ label { <label for="targetResourceId" class="col-sm-4 control-label"> Target ResourceId</label> <div class="col-sm-8"> - <input type="text" class="form-control" id="targetResourceId" - name="targetResourceId"> </input> + <select class="form-control" name="targetResourceId" id="targetResourceId" enableFilter="true" onchange="changeTargetResourceIdOther();"> + <option value=""></option> + <option value="Other:">Other:</option> + </select> </div> + <input type="text" style="display:none" class="form-control" id="targetResourceIdOther" + name="targetResourceIdOther" value=""></input> </div> </div> </form> @@ -304,6 +308,14 @@ label { </div> <script> + function changeTargetResourceIdOther() { + if ($("#targetResourceId").val()==="Other:") { + $("#targetResourceIdOther").show(); + } else { + $("#targetResourceIdOther").hide(); + $("#targetResourceIdOther").val(""); + } + } //Basically this method will add a new form. All forms share the same class. When you want one form to show(active form) the other forms get the // css attribute display:none $("#add_one_more").click(function(event) { @@ -345,6 +357,11 @@ label { $(".formId").remove(); if (policyObj !== undefined) { + // Set all the Resource Invariant UUID in the target resource ID list (+Empty and other) + Object.keys(vf_Services["shared"]["byVf"]).forEach(function(key){ + $('#targetResourceId').append($('<option></option>').val(key).html(key)); + }); + var el = policyObj[id][3]['policyConfigurations'] for (var i = 0; i < el.length; i++) { loadingId=true; @@ -360,7 +377,13 @@ label { parent_policy[num]=el[i][j].value if(el[i][j].name==='recipe' && el[i][j].value.toString()!==''){ $("#go_properties_tab"+num).text(el[i][j].value) - } + } + if(el[i][j].name==="targetResourceIdOther" && el[i][j].value.toString()!=='') { + // Add the entry and set it + $('#targetResourceId').append($('<option></option>').val($('#targetResourceIdOther').val()).html($('#targetResourceIdOther').val())); + $('#targetResourceId').val($('#targetResourceIdOther').val()); + } + } } } @@ -385,13 +408,14 @@ label { $("#formId"+k+" #parentPolicy").change(); } + // Now load all component with the right value defined in policyObj JSON for (headInd in policyObj[id]){ if (!(policyObj[id][headInd].hasOwnProperty("policyConfigurations"))){ $("#" + policyObj[id][headInd].name).val(policyObj[id][headInd].value); } } } - + setMultiSelect(); if (readMOnly){ @@ -454,6 +478,10 @@ label { } $("#savePropsBtn").click(function(event) { + if($("#targetResourceIdOther").is(":visible")) { + $('#targetResourceId').append($('<option></option>').val($("#targetResourceIdOther").val()).html($("#targetResourceIdOther").val())) + $("#targetResourceId").val($("#targetResourceIdOther").val()); + } $(".idError").hide(); if ($("#policyTable .highlight td").html() !== $("#pname").val()){ //repeated name @@ -483,7 +511,7 @@ label { finalSaveList[tableVal] = allPolicies[tableVal]; } }); - + saveProperties(finalSaveList); $("#close_button").click(); }) diff --git a/src/test/resources/example/model-properties/policy/modelBpmnProperties.json b/src/test/resources/example/model-properties/policy/modelBpmnProperties.json index 5c2214e84..0ef387529 100644 --- a/src/test/resources/example/model-properties/policy/modelBpmnProperties.json +++ b/src/test/resources/example/model-properties/policy/modelBpmnProperties.json @@ -100,7 +100,14 @@ "name": "targetResourceId", "value": [ - "resource-id" + "" + ] + }, + { + "name": "targetResourceIdOther", + "value": + [ + "" ] } ], @@ -162,6 +169,13 @@ [ "resource-id" ] + }, + { + "name": "targetResourceIdOther", + "value": + [ + "resource-idOther" + ] } ] ] @@ -227,13 +241,6 @@ [ "" ] - }, - { - "name": "targetResourceId", - "value": - [ - "resource-id" - ] } ], @@ -294,6 +301,13 @@ [ "resource-id" ] + }, + { + "name": "targetResourceIdOther", + "value": + [ + "resource-idOther" + ] } ] ] diff --git a/src/test/resources/example/operational-policy/yaml-policy-chain-1.yaml b/src/test/resources/example/operational-policy/yaml-policy-chain-1.yaml index fec0e1e6c..3d0252a00 100644 --- a/src/test/resources/example/operational-policy/yaml-policy-chain-1.yaml +++ b/src/test/resources/example/operational-policy/yaml-policy-chain-1.yaml @@ -31,7 +31,7 @@ policies: retry: 3 success: <generatedId> target: - resourceID: resource-id + resourceID: null type: VM timeout: 180 - actor: APPC diff --git a/src/test/resources/example/operational-policy/yaml-policy-chain-2.yaml b/src/test/resources/example/operational-policy/yaml-policy-chain-2.yaml index fec0e1e6c..3d0252a00 100644 --- a/src/test/resources/example/operational-policy/yaml-policy-chain-2.yaml +++ b/src/test/resources/example/operational-policy/yaml-policy-chain-2.yaml @@ -31,7 +31,7 @@ policies: retry: 3 success: <generatedId> target: - resourceID: resource-id + resourceID: null type: VM timeout: 180 - actor: APPC diff --git a/version.properties b/version.properties index a81893c7a..93dca4bb4 100644 --- a/version.properties +++ b/version.properties @@ -2,7 +2,7 @@ # ============LICENSE_START======================================================= # ONAP CLAMP # ================================================================================ -# Copyright (C) 2017 AT&T Intellectual Property. All rights +# Copyright (C) 2017-2018 AT&T Intellectual Property. All rights # reserved. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); @@ -27,7 +27,7 @@ major=2 minor=0 -patch=0 +patch=1 base_version=${major}.${minor}.${patch} |