Fix fields corruption on save 25/16325/1
authorAnaël Closson <ac2550@intl.att.com>
Thu, 28 Sep 2017 09:45:36 +0000 (11:45 +0200)
committerAnaël Closson <ac2550@intl.att.com>
Thu, 28 Sep 2017 10:24:39 +0000 (12:24 +0200)
Change-Id: I02c8fe662698ce943ce3eed8cd1e0b78b1311cc8
Issue-ID: CLAMP-58
Signed-off-by: Anaël Closson <ac2550@intl.att.com>
src/main/resources/META-INF/resources/designer/partials/portfolios/tca_properties.html
src/main/resources/clds/globalClds.properties

index cfb4432..238e37a 100644 (file)
                                                                <input class="form-control" onkeydown="return false;" type="text" id="tuuid" name="tuuid"></input>
                                                        </div>
                                                </div>
-                                               
-                                               <div class="col-sm-8 form-group" style="display:none;">
-                                                       <label class="col-sm-3"> NF Code </label>
-                                                       <div class="col-sm-9" style="padding:0px;">
-                                                               <input class="form-control" onkeydown="return false;" type="text" id="tnfc" name="tnfc"></input>
-                                                       </div>
-                                               </div>
-                                               
                                        </div>
                                        <div class="row">
                                                <div class="col-sm-8 form-group">
 
 
     var propertiesToString = function(formIdNum) {
-      return $('#formId'+formIdNum+' #fieldPathM').val() + ' ' +
+      return $('#formId'+formIdNum+' #fieldPathM').find(':selected').text() + ' ' +
                                $('#formId'+formIdNum+' #operator').val() + ' ' +
                                $('#formId'+formIdNum+' #threshold').val() + ' ' +
         $('#formId'+formIdNum+' #controlLoopSchema').val() + ' ' +
                                }
                        }
                }
-               
+
+               var fieldPathMLabel2Value = function(label) {
+                       return Object.keys(defaults_props['tca']['fieldPathM']).find(key => defaults_props['tca']['fieldPathM'][key] == label)
+               }
+               var fieldPathMValue2Label = function(value) {
+                       return defaults_props['tca']['fieldPathM'][value];
+               }
+
                setASDCFields();
-               
-               //load metrics dropdown
-               if (elementMap["global"]){
-                       for (var i = 0; i < (elementMap["global"].length); i++){
-                               if ((elementMap["global"][i]["name"]) == "vf"){
-                                       var vfSel = elementMap["global"][i]["value"];   
-                                       if (vf_Services["shared"]["byVf"][vfSel]["kpi"]){
-                                               $.each((vf_Services["shared"]["byVf"][vfSel]["kpi"]), function(val, text) {
-                                       $('#fieldPathM').append(
-                                           $('<option></option>').val(val).html(text)
-                                       );
-                                   });
-                                       }
-                                       break;
-                               };
-                       };
-               };
 
                var arr = elementMap[lastElementSelected];
-               
+
                if (arr !== undefined) {
                        for (var x in arr){
                                var num = add_one_more();
                                        if (arr[x][i].hasOwnProperty('serviceConfigurations')){
                                                for (var j=0; j<arr[x][i]["serviceConfigurations"].length; j++){
                                                        $("#formId" + num + " #tcaTable").prepend("<tr><td>"
-                                                                       +arr[x][i]["serviceConfigurations"][j][0]+" "
-                                                                       +(Object.keys(defaults_props['tca']['operator']).find(key => defaults_props['tca']['operator'][key] == (arr[x][i]["serviceConfigurations"][j][1])))+ " " 
+                                                                       +fieldPathMValue2Label(arr[x][i]["serviceConfigurations"][j][0])+ " "
+                                                                       +(Object.keys(defaults_props['tca']['operator']).find(key => defaults_props['tca']['operator'][key] == (arr[x][i]["serviceConfigurations"][j][1])))+ " "
                                                                        +arr[x][i]["serviceConfigurations"][j][2]+" "
                                                                        +arr[x][i]["serviceConfigurations"][j][3]+" "
                                                                        +arr[x][i]["serviceConfigurations"][j][4]+"</td></tr>");
                                        var header = $(this).find('.tcaParentItems').serializeArray();
                                        var sconf = {};
                                        var sconfa = [];
-                                       var checkNF = true;
                                        $('#formId' +count+' #tcaTable tr').each(function(){
                                                $('td', this).each(function(){
                                                        var splitTd = $(this).text().split(' ');
+              splitTd[0]=fieldPathMLabel2Value(splitTd[0]);
                                                        splitTd[1]=defaults_props['tca']['operator'][splitTd[1]];
-                                                       var checkByKpi = vf_Services["shared"]["byKpi"][splitTd[0].replace(/\s/g, "")];
-                                                       if (checkByKpi["fieldPath"]){
-                                                               splitTd.push(Object.keys(vf_Services["shared"]["byKpi"][splitTd[0].replace(/\s/g, "")]["fieldPath"])[0]);
-                                                       };
-                                                       if ((checkByKpi["nfNamingCode"]) && (checkNF)){
-                                                               $.grep(header, function(e,i){ 
-                                                                       if (e.name == "tnfc"){
-                                                                               header[i]["value"] = (Object.keys(checkByKpi["nfNamingCode"])[0]);
-                                                                       }
-                                                               });
-                                                               checkNF = false;
-                                                       }
                                                        sconfa.push(splitTd);
                                                });
                                                
                                        var str = $(this).text().split(' ');
                                        $('#formId'+count + ' #properties_tab').visible();
                                        if (str.length == 5){
-                                               $('#formId'+count+' #fieldPathM').val(str[0]).multiselect('refresh');
+                                               $('#formId'+count+' #fieldPathM').val(fieldPathMLabel2Value(str[0])).multiselect('refresh');
                                                $('#formId'+count+' #operator').val(str[1]).multiselect('refresh');
                                                $('#formId'+count+' #threshold').val(str[2]);
             $('#formId'+count+' #controlLoopSchema').val(str[3]).multiselect('refresh');
                                        $('#formId'+count+' #fieldPathM').prop("selectedIndex", 0).multiselect('refresh');
                                        $('#formId'+count+' #operator').prop("selectedIndex", 0).multiselect('refresh');
                                        $('#formId'+count+' #threshold').val("");
-          $('#formId'+count+' #controlLoopSchema').prop("selectedIndex", 0).multiselect('refresh');
-          $('#formId'+count+' #closedLoopEventStatus').prop("selectedIndex", 0).multiselect('refresh');
-                                       
+                                       $('#formId'+count+' #controlLoopSchema').prop("selectedIndex", 0).multiselect('refresh');
+                                       $('#formId'+count+' #closedLoopEventStatus').prop("selectedIndex", 0).multiselect('refresh');
+
                                        if ($('#formId'+count + ' #deleteThresh').prop('disabled')) {
                                                $('#formId'+count + ' #deleteThresh').prop('disabled', false);
                                        }
index fe5aeaf..d21afbc 100644 (file)
@@ -21,4 +21,4 @@
 # ECOMP is a trademark and service mark of AT&T Intellectual Property.
 ###
 
-globalCldsProps ={"tca":{"tname":"New_Set","tcaInt":"1","tcaVio":"1","tcaSev":{"NORMAL":"NORMAL","CRITICAL":"CRITICAL","MAJOR":"MAJOR","MINOR":"MINOR","WARNING":"WARNING"},"fieldPath":{"FIELDPATH_test_1":"FIELDPATH_test_1","FIELDPATH_test_2":"FIELDPATH_test_2"},"operator":{">":"GREATER",">=":"GREATER_OR_EQUAL","=":"EQUAL","<=":"LESS_OR_EQUAL","<":"LESS"},"opsPolicy":{"POLICY_test_X":"POLICY_test_X","POLICY_test_Y":"POLICY_test_Y"},"controlLoopSchema":{"":"","VM":"VM","VNF":"VNF"},"closedLoopEventStatus":{"":"","ONSET":"ONSET","ABATED":"ABATED"}},"global":{"actionSet":{"vnfRecipe":"VNF", "enbRecipe":"eNodeB"},"location":{"SNDGCA64":"San Diego SAN3","ALPRGAED":"Alpharetta PDK1","LSLEILAA":"Lisle DPA3","MDTWNJC1":"FTL_C_location1","MDTWNJC2":"FTL_C_location2","MDTWNJ21":"FTL_L_location1","MDTWNJ22":"FTL_L_location2","RDM2WAGPLCP":"ISTFTL_location","RDM3":"RDM3WAGPLCP"}},"policy":{"pname":"0","timeout":345,"vnfRecipe":{"":"","restart":"Restart","rebuild":"Rebuild","migrate":"Migrate","healthCheck":"Health Check"},"enbRecipe":{"":"","reset":"Reset"},"maxRetries":"3","retryTimeLimit":180,"resource":{"vCTS":"vCTS","v3CDB":"v3CDB","vUDR":"vUDR","vCOM":"vCOM","vRAR":"vRAR","vLCS":"vLCS","vUDR-BE":"vUDR-BE","vDBE":"vDBE"},"parentPolicyConditions":{"Failure_Retries":"Failure: Max Retries Exceeded","Failure_Timeout":"Failure: Time Limit Exceeded","Failure_Guard":"Failure: Guard","Failure_Exception":"Failure: Exception","Failure":"Failure: Other","Success":"Success"}},"shared":{"byService":{"":{"vf":{"":""},"location":{"":""},"alarmCondition":{"":""}}},"byVf":{"":{"vfc":{"":""}}}}}
+globalCldsProps ={"tca":{"tname":"New_Set","tcaInt":"1","tcaVio":"1","eventName":{"vCPEvGMUXPacketLoss":"vCPEvGMUXPacketLoss","vLoadBalancer":"vLoadBalancer","vFirewallBroadcastPackets":"vFirewallBroadcastPackets"},"fieldPathM":{"$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated":"receivedBroadcastPacketsAccumulated","$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsDelta":"receivedDiscardedPacketsDelta"},"operator":{">":"GREATER",">=":"GREATER_OR_EQUAL","=":"EQUAL","<=":"LESS_OR_EQUAL","<":"LESS"},"opsPolicy":{"POLICY_test_X":"POLICY_test_X","POLICY_test_Y":"POLICY_test_Y"},"controlLoopSchema":{"":"","VM":"VM","VNF":"VNF"},"closedLoopEventStatus":{"":"","ONSET":"ONSET","ABATED":"ABATED"}},"global":{"actionSet":{"vnfRecipe":"VNF", "enbRecipe":"eNodeB"},"location":{"SNDGCA64":"San Diego SAN3","ALPRGAED":"Alpharetta PDK1","LSLEILAA":"Lisle DPA3","MDTWNJC1":"FTL_C_location1","MDTWNJC2":"FTL_C_location2","MDTWNJ21":"FTL_L_location1","MDTWNJ22":"FTL_L_location2","RDM2WAGPLCP":"ISTFTL_location","RDM3":"RDM3WAGPLCP"}},"policy":{"pname":"0","timeout":345,"vnfRecipe":{"":"","restart":"Restart","rebuild":"Rebuild","migrate":"Migrate","healthCheck":"Health Check"},"enbRecipe":{"":"","reset":"Reset"},"maxRetries":"3","retryTimeLimit":180,"resource":{"vCTS":"vCTS","v3CDB":"v3CDB","vUDR":"vUDR","vCOM":"vCOM","vRAR":"vRAR","vLCS":"vLCS","vUDR-BE":"vUDR-BE","vDBE":"vDBE"},"parentPolicyConditions":{"Failure_Retries":"Failure: Max Retries Exceeded","Failure_Timeout":"Failure: Time Limit Exceeded","Failure_Guard":"Failure: Guard","Failure_Exception":"Failure: Exception","Failure":"Failure: Other","Success":"Success"}},"shared":{"byService":{"":{"vf":{"":""},"location":{"":""},"alarmCondition":{"":""}}},"byVf":{"":{"vfc":{"":""}}}}}