E2E Automation 46/84246/1
authorThamlurRaju <TR00568434@TechMahindra.com>
Thu, 4 Apr 2019 13:55:19 +0000 (19:25 +0530)
committerThamlurRaju <TR00568434@TechMahindra.com>
Thu, 4 Apr 2019 13:55:19 +0000 (19:25 +0530)
GUI modifications for operation policy

Change-Id: Icd2ff83a991899efaa986b4f15549c2bfd82b63e
Issue-ID: CLAMP-308
Signed-off-by: ThamlurRaju <TR00568434@TechMahindra.com>
src/main/resources/META-INF/resources/designer/partials/portfolios/operational_policy_window.html
src/main/resources/META-INF/resources/designer/scripts/OperationalPolicyCtrl.js
src/main/resources/META-INF/resources/designer/scripts/propertyController.js

index cf9382b..53f1d94 100644 (file)
@@ -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>
index 5a1ac53..922220b 100644 (file)
@@ -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
+    } ]);
index 2b32f4d..6c54a66 100644 (file)
@@ -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