aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/resources/META-INF/resources/designer/scripts/OperationalPolicyCtrl.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/resources/META-INF/resources/designer/scripts/OperationalPolicyCtrl.js')
-rw-r--r--src/main/resources/META-INF/resources/designer/scripts/OperationalPolicyCtrl.js51
1 files changed, 44 insertions, 7 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 f474cf41..0f9b62ff 100644
--- a/src/main/resources/META-INF/resources/designer/scripts/OperationalPolicyCtrl.js
+++ b/src/main/resources/META-INF/resources/designer/scripts/OperationalPolicyCtrl.js
@@ -214,35 +214,47 @@ app
$("#formId" + formNum + " .guardProperties").find("#" + guardPropElemValue.id).val(
guardElemValue[guardPropElemValue.id]);
});
+ iniGuardPolicyType(guardElemId, formNum);
// And finally enable the flag
$("#formId" + formNum + " #enableGuardPolicy").prop("checked", true);
}
});
});
}
+ function iniGuardPolicyType (guardPolicyId, formNum) {
+ if(guardPolicyId.indexOf('guard.minmax.') !== -1) {
+ $("#formId" + formNum + " #minMaxGuardPolicyDiv").show();
+ $("#formId" + formNum + " #frequencyLimiterGuardPolicyDiv").hide();
+ $("#formId" + formNum + " #guardPolicyType").val("GUARD_MIN_MAX");
+ } else if (guardPolicyId.indexOf('guard.frequency.') !== -1) {
+ $("#formId" + formNum + " #minMaxGuardPolicyDiv").hide();
+ $("#formId" + formNum + " #frequencyLimiterGuardPolicyDiv").show();
+ $("#formId" + formNum + " #guardPolicyType").val("GUARD_YAML");
+ }
+ }
function initTargetResourceIdOptions (targetType, formNum) {
var recipe = $("#formId" + formNum + "#recipe").val();
- $("#formId" + formNum + " #resourceId").empty();
- $("#formId" + formNum + " #resourceId").append($('<option></option>').val("").html("-- choose an option --"));
+ $("#formId" + formNum + " #resourceID").empty();
+ $("#formId" + formNum + " #resourceID").append($('<option></option>').val("").html("-- choose an option --"));
var resourceVnf = getResourceDetailsVfProperty();
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));
+ $("#formId" + formNum + " #resourceID").append($('<option></option>').val(name).html(name));
}
}
var resourceVFModule = getResourceDetailsVfModuleProperty();
- if (targetType == "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) {
- $("#formId" + formNum + " #resourceId").append($('<option></option>').val(resourceVFModule[prop]["vfModuleModelName"]).html(resourceVFModule[prop]["vfModuleModelName"]));
+ $("#formId" + formNum + " #resourceID").append($('<option></option>').val(resourceVFModule[prop]["vfModuleModelName"]).html(resourceVFModule[prop]["vfModuleModelName"]));
}
}
} else {
for ( var prop in resourceVFModule) {
- $("#formId" + formNum + " #resourceId").append($('<option></option>').val(resourceVFModule[prop]["vfModuleModelName"]).html(resourceVFModule[prop]["vfModuleModelName"]));
+ $("#formId" + formNum + " #resourceID").append($('<option></option>').val(resourceVFModule[prop]["vfModuleModelName"]).html(resourceVFModule[prop]["vfModuleModelName"]));
}
}
}
@@ -263,6 +275,30 @@ app
initTargetResourceIdOptions(type, formNum);
}
+ $scope.changeGuardId = function(formItemActive) {
+ if (formItemActive === undefined) {
+ formItemActive = searchActiveFormId();
+ if (formItemActive === undefined) {
+ return;
+ }
+ }
+ var oldValue = $("#" + formItemActive.id + " .guardProperties #id").val();
+ // remove old prefix
+ if(oldValue.indexOf('guard.minmax.') !== -1) {
+ oldValue = oldValue.substr(oldValue.indexOf('guard.minmax.') + 13);
+ } else if (oldValue.indexOf('guard.frequency.') !== -1) {
+ oldValue = oldValue.substr(oldValue.indexOf('guard.frequency.') + 16);
+ }
+
+ var prefix = "guard.";
+ if ($("#" + formItemActive.id + " #guardPolicyType").val() === "GUARD_MIN_MAX") {
+ prefix = prefix + "minmax.";
+ } else if ($("#" + formItemActive.id + " #guardPolicyType").val() === "GUARD_YAML") {
+ prefix = prefix + "frequency.";
+ }
+ $("#" + formItemActive.id + " .guardProperties #id").val(prefix+oldValue);
+ }
+
$scope.changeTargetResourceId = function(event) {
var formNum = $(event.target).closest('.formId').attr('id').substring(6);
initTargetModelAttributes(formNum);
@@ -270,7 +306,7 @@ app
var resourceVFModule = getResourceDetailsVfModuleProperty();
var type = $("#formId" + formNum +" #type").val();
var recipe = $("#formId" + formNum +" #recipe").val();
- if (type == "VFModule" && (null !== resourceVFModule || undefined !== resourceVFModule)
+ if (type == "VFMODULE" && (null !== resourceVFModule || undefined !== resourceVFModule)
&& (recipe == 'VF Module Create' || recipe == 'VF Module Delete')) {
for ( var prop in resourceVFModule) {
if (prop == $(event.target).val()) {
@@ -298,6 +334,7 @@ app
$("#" + formItemActive.id + " #minMaxGuardPolicyDiv").hide();
$("#" + formItemActive.id + " #frequencyLimiterGuardPolicyDiv").show();
}
+ $scope.changeGuardId(formItemActive);
}
$scope.initPolicySelect = function() {