diff options
author | ThamlurRaju <TR00568434@TechMahindra.com> | 2019-04-04 19:25:19 +0530 |
---|---|---|
committer | ThamlurRaju <TR00568434@TechMahindra.com> | 2019-04-04 19:25:19 +0530 |
commit | b2239894be073a68d18f96bbc7ee9fa1ebcf2456 (patch) | |
tree | f434185252596cb9753361cf31dde8ba3e837016 | |
parent | 3772c8513f618f9b76fc7bfa55fa140eb60f2a4b (diff) |
E2E Automation
GUI modifications for operation policy
Change-Id: Icd2ff83a991899efaa986b4f15549c2bfd82b63e
Issue-ID: CLAMP-308
Signed-off-by: ThamlurRaju <TR00568434@TechMahindra.com>
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 { <label class="col-sm-4 control-label" for="recipe">Recipe</label> <div class="col-sm-8"> <select class="form-control" name="recipe" id="recipe" - enableFilter="true" ng-click="updateGuardRecipe($event)"> + enableFilter="true" + ng-click="updateGuardRecipe($event);initTargetResourceId()" + ng-model="recipe"> <option value="Restart">Restart</option> <option value="Rebuild">Rebuild</option> <option value="Migrate">Migrate</option> @@ -195,8 +197,8 @@ label { <option value="APPC">APPC</option> <option value="SO">SO</option> <option value="VFC">VFC</option> - <option value="SDNC">SDNC</option>° - <option value="SDNR">SDNR</option>° + <option value="SDNC">SDNC</option>° + <option value="SDNR">SDNR</option>° </select> </div> @@ -267,7 +269,8 @@ label { <label for="type" class="col-sm-4 control-label"> Target Type</label> <div class="col-sm-8"> - <select class="form-control" name="type" id="type"> + <select class="form-control" name="type" id="type" + ng-click="initTargetResourceId()" ng-model="type"> <option value="VFC">VFC</option> <option value="VM">VM</option> <option value="VNF">VNF</option> @@ -279,7 +282,9 @@ label { Target ResourceId</label> <div class="col-sm-8"> <select class="form-control" name="resourceId" id="resourceId" - enableFilter="true"> + enableFilter="true" ng-model="resourceId"> + <option value=""></option> + <option value="Other:">Other:</option> </select> </div> </div> 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($('<option></option>').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( + $('<option></option>').val("") + .html("")); + $("#resourceId").append( + $('<option></option>').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( + $('<option></option>') + .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( + $('<option></option>') + .val(name) + .html(name)); + } + } + } + else + { + for ( var prop in resourceVfc) { + var name = resourceVfc[prop]["name"]; + $("#resourceId").append( + $('<option></option>') + .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 |