aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSébastien Determe <sebastien.determe@intl.att.com>2019-05-14 13:24:55 +0000
committerGerrit Code Review <gerrit@onap.org>2019-05-14 13:24:55 +0000
commitb38821c4136369ef50680b24c55d76ec3898af54 (patch)
tree8c9e1d2c89e7d058280d274fb54631a1c10d1dd5
parent3d5f3d9824cfd2c5e0216976b6716d3def184401 (diff)
parenta2cbc6a4ab4bd16c1601a7e95a48f0a171e50b26 (diff)
Merge "Fix targetResourceId issue"4.0.2
-rw-r--r--src/main/resources/META-INF/resources/designer/scripts/OperationalPolicyCtrl.js45
1 files changed, 26 insertions, 19 deletions
diff --git a/src/main/resources/META-INF/resources/designer/scripts/OperationalPolicyCtrl.js b/src/main/resources/META-INF/resources/designer/scripts/OperationalPolicyCtrl.js
index f5a93cb9..f474cf41 100644
--- a/src/main/resources/META-INF/resources/designer/scripts/OperationalPolicyCtrl.js
+++ b/src/main/resources/META-INF/resources/designer/scripts/OperationalPolicyCtrl.js
@@ -190,11 +190,15 @@ app
$("#formId" + formNum + " .policyProperties").find("#" + opPolicyPropValue.id).val(
allPolicies['operational_policy']['policies'][opPolicyElemIndex][opPolicyPropValue.id]);
});
+
+ // Initial TargetResourceId options
+ initTargetResourceIdOptions(allPolicies['operational_policy']['policies'][opPolicyElemIndex]['target']['type'], formNum);
$.each($('.policyTarget').find('.form-control'), function(opPolicyTargetPropIndex, opPolicyTargetPropValue) {
$("#formId" + formNum + " .policyTarget").find("#" + opPolicyTargetPropValue.id).val(
allPolicies['operational_policy']['policies'][opPolicyElemIndex]['target'][opPolicyTargetPropValue.id]);
});
+
// update the current tab label
$("#go_properties_tab" + formNum).text(
allPolicies['operational_policy']['policies'][opPolicyElemIndex]['id']);
@@ -216,30 +220,20 @@ app
});
});
}
- $scope.initTargetResourceId = function(event) {
- var formNum = $(event.target).closest('.formId').attr('id').substring(6);
-
- var type = $(event.target).val();
+ function initTargetResourceIdOptions (targetType, formNum) {
var recipe = $("#formId" + formNum + "#recipe").val();
- $("#formId" + formNum + " #modelName").val("");
- $("#formId" + formNum + " #modelInvariantId").val("");
- $("#formId" + formNum + " #modelVersionId").val("");
- $("#formId" + formNum + " #modelVersion").val("");
- $("#formId" + formNum + " #modelCustomizationId").val("");
$("#formId" + formNum + " #resourceId").empty();
$("#formId" + formNum + " #resourceId").append($('<option></option>').val("").html("-- choose an option --"));
- if (type == "VM" || type == "" || type == "VNF") {
- $("#formId" + formNum + " #metadata *").prop('disabled', true);
- }
+
var resourceVnf = getResourceDetailsVfProperty();
- if (type == "VNF" && (null !== resourceVnf || undefined !== resourceVnf)) {
+ if (targetType == "VNF" && (null !== resourceVnf || undefined !== resourceVnf)) {
for ( var prop in resourceVnf) {
var name = resourceVnf[prop]["name"];
$("#formId" + formNum + " #resourceId").append($('<option></option>').val(name).html(name));
}
}
var resourceVFModule = getResourceDetailsVfModuleProperty();
- if (type == "VFModule" && (null !== resourceVFModule || undefined !== resourceVFModule)) {
+ if (targetType == "VFModule" && (null !== resourceVFModule || undefined !== resourceVFModule)) {
if (recipe == 'VF Module Create' || recipe == 'VF Module Delete') {
for ( var prop in resourceVFModule) {
if (resourceVFModule[prop]["isBase"] == false) {
@@ -253,13 +247,26 @@ app
}
}
}
+
+ function initTargetModelAttributes (formNum) {
+ $("#formId" + formNum + " #modelName").val("");
+ $("#formId" + formNum + " #modelInvariantId").val("");
+ $("#formId" + formNum + " #modelVersionId").val("");
+ $("#formId" + formNum + " #modelVersion").val("");
+ $("#formId" + formNum + " #modelCustomizationId").val("");
+ }
+
+ $scope.initTargetResourceId = function(event) {
+ var formNum = $(event.target).closest('.formId').attr('id').substring(6);
+ initTargetModelAttributes(formNum);
+ var type = $(event.target).val();
+ initTargetResourceIdOptions(type, formNum);
+ }
+
$scope.changeTargetResourceId = function(event) {
var formNum = $(event.target).closest('.formId').attr('id').substring(6);
- $("#formId" + formNum +" #modelName").val("");
- $("#formId" + formNum +" #modelInvariantId").val("");
- $("#formId" + formNum +" #modelVersionId").val("");
- $("#formId" + formNum +" #modelVersion").val("");
- $("#formId" + formNum +" #modelCustomizationId").val("");
+ initTargetModelAttributes(formNum);
+
var resourceVFModule = getResourceDetailsVfModuleProperty();
var type = $("#formId" + formNum +" #type").val();
var recipe = $("#formId" + formNum +" #recipe").val();