From b2239894be073a68d18f96bbc7ee9fa1ebcf2456 Mon Sep 17 00:00:00 2001 From: ThamlurRaju Date: Thu, 4 Apr 2019 19:25:19 +0530 Subject: E2E Automation GUI modifications for operation policy Change-Id: Icd2ff83a991899efaa986b4f15549c2bfd82b63e Issue-ID: CLAMP-308 Signed-off-by: ThamlurRaju --- .../portfolios/operational_policy_window.html | 15 +++-- .../designer/scripts/OperationalPolicyCtrl.js | 66 ++++++++++++++++++---- .../designer/scripts/propertyController.js | 11 +++- 3 files changed, 74 insertions(+), 18 deletions(-) diff --git a/src/main/resources/META-INF/resources/designer/partials/portfolios/operational_policy_window.html b/src/main/resources/META-INF/resources/designer/partials/portfolios/operational_policy_window.html index cf9382bf8..53f1d94e1 100644 --- a/src/main/resources/META-INF/resources/designer/partials/portfolios/operational_policy_window.html +++ b/src/main/resources/META-INF/resources/designer/partials/portfolios/operational_policy_window.html @@ -158,7 +158,9 @@ label {
@@ -267,7 +269,8 @@ label {
- @@ -279,7 +282,9 @@ label { Target ResourceId
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 5a1ac538b..922220b10 100644 --- a/src/main/resources/META-INF/resources/designer/scripts/OperationalPolicyCtrl.js +++ b/src/main/resources/META-INF/resources/designer/scripts/OperationalPolicyCtrl.js @@ -54,17 +54,7 @@ app } console.log("No active formId found !"); } - function initTargetResourceId() { - if (vf_Services !== null && vf_Services !== 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($('').val(key).html(key)); - }); - } - } function add_one_more() { console.log("add one more"); @@ -212,6 +202,59 @@ app }); }); } + + $scope.initTargetResourceId = function() { + + var recipe = $(event.target).val(); + + var type = $(event.target).val(); + + $('#resourceId').empty(); + $("#resourceId") + .append( + $('').val("") + .html("")); + $("#resourceId").append( + $('').val("Other:") + .html("Other:")); + + var resourceVnf = getResourceDetailsProperty(); + if (type == "VNF" + && (null !== resourceVnf || undefined !== resourceVnf)) { + for ( var prop in resourceVnf) { + var name = resourceVnf[prop]["name"]; + $("#resourceId").append( + $('') + .val(name).html(name)); + } + + } + var resourceVfc = getResourceDetailsVfcProperty(); + if (type == "VFC" + && (null !== resourceVfc || undefined !== resourceVfc)) { + if (recipe == 'VF Module Create' + || recipe == 'VF Module Delete') { + for ( var prop in resourceVfc) { + if (resourceVfc[prop]["isBase"] == false) { + var name = resourceVfc[prop]["name"]; + $("#resourceId").append( + $('') + .val(name) + .html(name)); + } + } + } + else + { + for ( var prop in resourceVfc) { + var name = resourceVfc[prop]["name"]; + $("#resourceId").append( + $('') + .val(name).html(name)); + } + } + } + $scope.changeGuardPolicyType = function() { @@ -264,7 +307,6 @@ app angular.element(document.getElementById('formSpan')).scope().submitForm(allPolicies); $("#close_button").click(); }); - initTargetResourceId(); }); } $scope.init(); @@ -302,4 +344,4 @@ app }); }; - } ]); \ No newline at end of file + } ]); diff --git a/src/main/resources/META-INF/resources/designer/scripts/propertyController.js b/src/main/resources/META-INF/resources/designer/scripts/propertyController.js index 2b32f4d26..6c54a66d3 100644 --- a/src/main/resources/META-INF/resources/designer/scripts/propertyController.js +++ b/src/main/resources/META-INF/resources/designer/scripts/propertyController.js @@ -111,4 +111,13 @@ function getDeploymentStatusURL() { function setDeploymentStatusURL(deploymentStatusURL) { cl_props["dcaeDeploymentStatusUrl"] = deploymentStatusURL; } -module.exports = { getOperationalPolicyProperty,getGlobalProperty,getMsProperty,getMsUI,getLastUpdatedStatus,getDeploymentID,getDeploymentStatusURL }; \ No newline at end of file + +function getResourceDetailsProperty() { + return cl_props["modelPropertiesJson"]["resourceDetails"]["VF"]; +} + +function getResourceDetailsVfcProperty() { + return cl_props["modelPropertiesJson"]["resourceDetails"]["VFC"]; +} + +module.exports = { getOperationalPolicyProperty,getGlobalProperty,getMsProperty,getMsUI,getLastUpdatedStatus,getDeploymentID,getDeploymentStatusURL,getResourceDetailsProperty,getResourceDetailsVfcProperty }; \ No newline at end of file -- cgit 1.2.3-korg