Ext.define("ICTest.controller.ModifyTestCtrlr",{extend:"Ext.app.Controller",views:["AddNewTest"],requires:["ICTest.view.AddNewTest"],refs:[{selector:"addnewtest",ref:"addnewtest"}],init:function(b,a){modifyCtrler=this;snmpCtrlr=this.getController("ICTest.controller.AddSnmpTestCtrlr");this.getController("DatasetController").init();
this.buildMainData(b,a,"test");this.control({"addnewtest":{"afterrender":this.afterMainRender},'addnewtest button[id="backButton"]':{"click":this.goBack},'addnewtest button[id="add"]':{"click":this.modifyTest},'addnewtest button[id="addNewParam"]':{"click":this.showAddNewParam},'addnewtest button[id="addNewMeasure"]':{"click":this.showAddMeasure},'addnewtest combo[id="tempgroup"]':{"select":addctrler.loadHelpTemplate},'addnewtest button[id="chooseClass"]':{"click":addctrler.showClassFileUpload},'addnewtest button[id="chooselLib"]':{"click":addctrler.showLibFileUpload},'addnewtest button[id="generate"]':{"click":addctrler.generateTest},'addnewtest button[id="configureMetricsBtn"]':{"click":this.showConfigMetricsPopup},'addnewtest button[id="ddChooseClass"]':{"click":addctrler.showDDClassFileUpload},'addnewtest button[id="ddChooselLib"]':{"click":addctrler.showDDLibFileUpload},'addnewtest button[id="ddGenerate"]':{"click":addctrler.generateDDTest},'addnewtest button[id="addNewDDMeasure"]':{"click":addctrler.showAddNewDDMeasure},'addnewtest button[id="chooseScript"]':{"click":addctrler.showScriptFileUpload},'addnewtest radiogroup[id="elements"]':{"change":snmpCtrlr.elementsSelection}});
},showConfigMetricsPopup:function(c){if(Ext.isEmpty(datasetCtrlr)){datasetCtrlr=this.getController("ICTest.controller.DatasetController");}var b=Ext.getCmp("test").getValue();var a="EgConfigRESTMeasureJson.jsp?test="+b;datasetCtrlr.loadAddMeasureTab(a);datasetCtrlr.addRESTDataFields(publicJSON["restDSNName"],c);
},buildMainData:function(c,a,b){Ext.Ajax.request({url:"ICTest/data/EgConfigTestParamJson.jsp?test="+c+"&testtype="+a+"&index="+b,method:"POST",async:false,success:function(d){if(d.status==200&&!Ext.isEmpty(d.responseText)){var e=d.responseText;publicJSON=Ext.decode(e);}}});},afterMainRender:function(){var h=this;
Ext.getCmp("addParamTab").enable();Ext.getCmp("addMeasureTab").enable();if(publicJSON.showGenerateTab){Ext.getCmp("generateCntnr").enable();Ext.getCmp("ddGenerateTab").enable();Ext.getCmp("tab6Help").enable();if(publicJSON.ddEnabled){Ext.getCmp("newtest").child("#tab5DD").tab.show();}}else{Ext.getCmp("generateCntnr").disable();
Ext.getCmp("ddGenerateTab").disable();Ext.getCmp("tab6Help").disable();}var b=Ext.getCmp("test");b.setValue(publicJSON.test);b.setReadOnly(true);var d=publicJSON.testType;var c=Ext.getCmp("testType");c.setValue(d);c.setReadOnly(true);var j=publicJSON.typeValue;var k=Ext.getCmp("type");k.setRawValue(j);
if(publicJSON.internalChecked){Ext.getCmp("execIn").setValue(true);}else{if(publicJSON.externalChecked){Ext.getCmp("execEx").setValue(true);}}if(publicJSON.portBasedYes){Ext.getCmp("portYes").setValue(true);}else{Ext.getCmp("portNo").setValue(true);}if(d=="Script/Batch File"){Ext.getCmp("ostype").show();
if(publicJSON.unixChecked){Ext.getCmp("osUnix").setValue(true);}else{if(publicJSON.winChecked){Ext.getCmp("osWin").setValue(true);}}}else{Ext.getCmp("ostype").hide();}var i=Ext.getCmp("dbType");if(d.toLowerCase()=="sql query"){i.show();i.getStore().loadRawData(publicJSON.dbTypes);i.setValue(publicJSON.dbTypeSelected);
}else{i.hide();}if(d=="REST"){Ext.getCmp("datasetTab").enable();Ext.getCmp("newtest").getTabBar().items.items[2].enable();Ext.getCmp("newtest").getTabBar().items.items[2].show();}else{Ext.getCmp("datasetTab").disable();Ext.getCmp("newtest").getTabBar().items.items[2].disable();Ext.getCmp("newtest").getTabBar().items.items[2].hide();
}Ext.getCmp("add").setText(modifyTooltip);var g=Ext.getCmp("addParamCntnr");g.removeAll();var f=publicJSON.paramList;if(f.length==0){Ext.getCmp("noParamsFnd").show();Ext.getCmp("addParamCntnr").hide();}else{Ext.getCmp("noParamsFnd").hide();Ext.getCmp("addParamCntnr").show();for(var a=0;a<f.length;a++){var e=f[a];
if(e.paramName=="password"){g.add({xtype:"fieldset",title:"<b>"+e.paramName+"</b>",layout:{type:"vbox",align:"left"},width:650,items:[{xtype:"displayfield",fieldLabel:defVal,inputType:"password",labelSeparator:"",value:e.paramValue,flex:1,renderer:function(r,m,p,t,n,s,l){var q="&#8226;";for(var o=1;o<r.length;
o++){q=q+"&#8226;";}return"<h1>"+q+"</h1>";}},{xtype:"container",layour:{type:"hbox",pack:"left"},margin:"10 0 10 0",items:[{xtype:"button",ui:"newButtonSmall",text:modifyTooltip,modifyURL:e.modifyURL,width:80,handler:function(){h.showModifyParam(this.modifyURL);},},{xtype:"button",ui:"newButtonSmall",text:deleteTooltip,hidden:e.hideDelete,deleteURL:e.deleteURL,paramName:e.paramName,width:80,handler:function(){h.deleteParam(this.deleteURL,this.paramName);
},margin:"0 0 0 20"}]}]});}else{g.add({xtype:"fieldset",title:"<b>"+e.paramName+"</b>",layout:{type:"vbox",align:"left"},width:650,height:100,items:[{xtype:"container",layout:{type:"hbox",pack:"start"},items:[{xtype:"displayfield",fieldLabel:defVal,labelSeparator:"",value:e.paramValue,margin:"0 0 0 10"}]},{xtype:"container",layour:{type:"hbox",pack:"center"},margin:10,items:[{xtype:"button",ui:"newButtonSmall",text:modifyTooltip,modifyURL:e.modifyURL,width:80,handler:function(){var p=this.modifyURL;
var o=p.indexOf("&value=");if(o>-1){var l=p.substring(0,o);var n=p.substring(o);var m=n.substring(n.indexOf("=")+1);}var q=l+"&value="+encodeURIComponent(filterEncode(m));h.showModifyParam(q);},},{xtype:"button",ui:"newButtonSmall",text:deleteTooltip,hidden:e.hideDelete,deleteURL:e.deleteURL,paramName:e.paramName,width:80,handler:function(){h.deleteParam(this.deleteURL,this.paramName);
},margin:"0 0 0 20"}]}]});}}}if(d=="REST"){Ext.getCmp("newtest").getTabBar().items.items[1].hide();Ext.getCmp("newtest").getTabBar().items.items[4].hide();isRESTTestType=true;}else{if(publicJSON.showAddNewParam){Ext.getCmp("addParam").show();}else{Ext.getCmp("addParam").hide();}}},goBack:function(){window.location.href="/final/admin/EgUDTest.jsp";
},modifyTest:function(){var j=this;var i=publicJSON.test;var d=publicJSON.testType;if(i==null||i==undefined){i=Ext.getCmp("test").getValue();d=Ext.getCmp("testType").getValue();}var f=Ext.getCmp("execution").getValue().exerb;var e=Ext.getCmp("port").getValue().portrb;var g="";var c="";if(d=="Script/Batch File"){g=Ext.getCmp("ostype").getValue().ostyperb;
}else{if(d.toLowerCase()=="sql query"){c=Ext.getCmp("dbType").getValue();}}var l=publicJSON.$execution;var a=publicJSON.$port;var b=publicJSON.$os;var k=publicJSON.$dbType;var h="EgconfigtestparampJson.jsp?index=test&test="+i+"&testtype="+d+"&type="+f+"&port="+e+"&os="+g+"&dbtype="+c+"&mod=modify_test"+"&$_type="+l+"&$_port="+a+"&$_os="+b+"&$_dbtype="+k;
Ext.Ajax.request({url:"ICTest/data/"+h,method:"POST",async:false,success:function(m){if(m.status==200&&!Ext.isEmpty(m.responseText)){var n=m.responseText;publicJSON=Ext.decode(n);}}});if(publicJSON.AlertType=="Error"){Ext.Msg.show({title:error+": "+publicJSON.AlertTitle,msg:publicJSON.AlertMsg,buttons:Ext.Msg.OK,icon:"iconError"});
}else{if(publicJSON.AlertType=="Result"){Ext.Msg.show({title:publicJSON.AlertTitle,msg:publicJSON.AlertMsg,closable:false,icon:"iconInformation",buttons:Ext.Msg.OK,fn:function(m){if(m=="ok"){j.buildMainData(i,d,"test");j.afterMainRender();}}});}}},showAddNewParam:function(){var a=this;Ext.create("Ext.window.Window",{padding:"3 10 10 10",title:newParam,height:175,width:350,id:"addParamWindow",layout:{type:"vbox",pack:"start",align:"center"},modal:true,resizable:false,items:[{xtype:"textfield",cls:"textbox",fieldLabel:param,labelSeparator:" ",id:"param",name:"param",width:300,margin:"10 0 0 0"},{xtype:"textfield",cls:"textbox",fieldLabel:defVal,labelSeparator:" ",id:"value",name:"value",value:"unconfigured",width:300,margin:"10 0 0 0"},{xtype:"button",ui:"newButtonSmall",text:add,id:"addParamButton",width:80,listeners:{click:{fn:function(b){a.doAddNewParam();
}}},margin:"20 0 20 0"}]}).show();},doAddNewParam:function(){var g=this;jmxCtrlr=this.getController("ICTest.controller.AddJmxTestCtrlr");var c=Ext.getCmp("param").getValue();var h=Ext.getCmp("value").getValue();var f=Ext.getCmp("test").getValue();var b=Ext.getCmp("testType").getValue();var d="";var a="";
if(b=="Script/Batch File"){d=Ext.getCmp("ostype").getValue().ostyperb;}else{if(b.toLowerCase()=="sql query"){a=Ext.getCmp("dbType").getValue();}}if(!this.paramValidation(c,h,b)){return;}var e="EgconfigtestparampJson.jsp?index=paramTab&param="+encodeURIComponent(parent.filterEncode(c))+"&value="+h+"&mod=param&test="+f+"&os="+d+"&dbtype="+a+"&testtype="+b;
var i=new Ext.LoadMask(Ext.getBody(),{msg:updating+"..."});i.show();Ext.Ajax.request({url:"ICTest/data/"+e,method:"POST",async:false,success:function(j){i.hide();if(j.status==200&&!Ext.isEmpty(j.responseText)){var k=j.responseText;publicJSON=Ext.decode(k);if(publicJSON.AlertType=="Error"){Ext.Msg.show({title:error+": "+publicJSON.AlertTitle,msg:publicJSON.AlertMsg,buttons:Ext.Msg.OK,icon:"iconError"});
}else{if(publicJSON.AlertType=="Result"){Ext.Msg.show({title:publicJSON.AlertTitle,msg:publicJSON.AlertMsg+"."+addParamAlert,buttons:Ext.Msg.YESNO,icon:"iconInformation",fn:function(l){if(l=="yes"){Ext.getCmp("addParamWindow").close();Ext.getCmp("addParamTab").enable();var n=publicJSON.forwardURL;g.loadAddParamTab(n);
g.showAddNewParam();}else{if(l=="no"){Ext.getCmp("addParamWindow").destroy();var n=publicJSON.forwardURL;g.loadAddParamTab(n);jmxCtrlr.loadAddMeasureTab(n);var m="EgConfigJmxMeasureJson.jsp?test="+f;jmxCtrlr.showAddedMeasures(m);Ext.getCmp("newtest").setActiveTab(3);}}}});}}}},failure:function(j){i.hide();
}});},paramValidation:function(f,e,a){var c=true;if(isDouble=="false"){c=validateSingleByte(e);}var b=Ext.getCmp("param");var g=Ext.getCmp("value");if(b==null||b==undefined){b=Ext.getCmp("modParam");g=Ext.getCmp("modValue");}var d=icTestParamValidationExtJS(f,e,a);if(d=="1"){Ext.Msg.show({title:pageTitle1,msg:_checkempty,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(h){if(h=="ok"){g.focus(true);
}}});return false;}else{if(d=="2"){Ext.Msg.show({title:pageTitle1,msg:_tcKeyword,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(h){if(h=="ok"){g.focus(true);}}});return false;}else{if(d=="3"){Ext.Msg.show({title:pageTitle1,msg:_checkspecial,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(h){if(h=="ok"){g.focus(true);
}}});return false;}else{if(d=="5"){Ext.Msg.show({title:pageTitle1,msg:_checkdots,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(h){if(h=="ok"){g.focus(true);}}});return false;}else{if(d=="6"){Ext.Msg.show({title:pageTitle1,msg:_checkSpaces,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(h){if(h=="ok"){g.focus(true);
}}});return false;}else{if(d=="7"){Ext.Msg.show({title:pageTitle1,msg:_snmpcomma,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(h){if(h=="ok"){g.focus(true);}}});return false;}else{if(d=="8"){Ext.Msg.show({title:pageTitle1,msg:_checkfordecimal,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(h){if(h=="ok"){g.focus(true);
}}});return false;}else{if(d=="9"){Ext.Msg.show({title:pageTitle1,msg:_checkforobjectname,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(h){if(h=="ok"){g.focus(true);}}});return false;}else{if(d=="11"){Ext.Msg.show({title:pageTitle1,msg:_checkInt,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(h){if(h=="ok"){g.focus(true);
}}});return false;}else{if(d=="12"){Ext.Msg.show({title:pageTitle1,msg:_valInt,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(h){if(h=="ok"){g.focus(true);}}});return false;}else{if(d=="13"){Ext.Msg.show({title:pageTitle1,msg:_checkport,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(h){if(h=="ok"){g.focus(true);
}}});return false;}else{if(d=="14"){Ext.Msg.show({title:pageTitle1,msg:_validatePort,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(h){if(h=="ok"){g.focus(true);}}});return false;}else{if(d=="16"){Ext.Msg.show({title:pageTitle1,msg:_alphabetsOnly,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(h){if(h=="ok"){g.focus(true);
}}});return false;}else{if(d=="17"){Ext.Msg.show({title:pageTitle1,msg:_validDDPattern,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(h){if(h=="ok"){g.focus(true);}}});return false;}else{if(d=="19"){Ext.Msg.show({title:pageTitle1,msg:_checkmail,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(h){if(h=="ok"){g.focus(true);
}}});return false;}else{if(d=="19"){Ext.Msg.show({title:pageTitle1,msg:_checkmail,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(h){if(h=="ok"){g.focus(true);}}});return false;}else{if(d=="20"){Ext.Msg.show({title:pageTitle1,msg:_invalidUrl,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(h){if(h=="ok"){g.focus(true);
}}});return false;}else{if(d=="21"){Ext.Msg.show({title:pageTitle1,msg:_invalidWebsite,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(h){if(h=="ok"){g.focus(true);}}});return false;}else{if(d=="22"){Ext.Msg.show({title:pageTitle1,msg:_invalidVersion,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(h){if(h=="ok"){g.focus(true);
}}});return false;}else{if(d=="23"){Ext.Msg.show({title:pageTitle1,msg:_contentvalidation,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(h){if(h=="ok"){g.focus(true);}}});return false;}else{if(d=="24"){Ext.Msg.show({title:pageTitle1,msg:_checkcomma,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(h){if(h=="ok"){g.focus(true);
}}});return false;}else{if(d=="25"){Ext.Msg.show({title:pageTitle1,msg:_checkMethod,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(h){if(h=="ok"){g.focus(true);}}});return false;}else{if(d=="26"){Ext.Msg.show({title:pageTitle1,msg:_valMethod,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(h){if(h=="ok"){g.focus(true);
}}});return false;}else{if(d=="27"){Ext.Msg.show({title:pageTitle1,msg:_validProtocol,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(h){if(h=="ok"){g.focus(true);}}});return false;}}}}}}}}}}}}}}}}}}}}}}}}if(!checkblank(f)){Ext.Msg.show({title:pageTitle1,msg:alertMsg7,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(h){if(h=="ok"){b.focus(true);
}}});return false;}else{if(!checkspecialnomess(f,"`~!@#$%^&*+=-/?'\"]{}[\\|;:.,><")){Ext.Msg.show({title:pageTitle1,msg:alertMsg3,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(h){if(h=="ok"){b.focus(true);}}});return false;}else{if(checkspaceExtjs(e)=="17"){Ext.Msg.show({title:pageTitle1,msg:_checkblank,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(h){if(h=="ok"){g.focus(true);
}}});return false;}else{if(f=="host"){Ext.Msg.show({title:pageTitle1,msg:alertMsg9,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(h){if(h=="ok"){b.focus(true);}}});return false;}else{if(f=="info"){Ext.Msg.show({title:pageTitle1,msg:alertMsg10,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(h){if(h=="ok"){b.focus(true);
}}});return false;}else{if(f=="scriptfile"){Ext.Msg.show({title:pageTitle1,msg:alertMsg56,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(h){if(h=="ok"){b.focus(true);}}});return false;}else{if(f=="port"){Ext.Msg.show({title:pageTitle1,msg:alertMsg11,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(h){if(h=="ok"){b.focus(true);
}}});return false;}else{if(!validateSingleByte(f)){Ext.Msg.show({title:pageTitle1,msg:alertMsg12,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(h){if(h=="ok"){b.focus(true);}}});return false;}else{if(!c){Ext.Msg.show({title:pageTitle1,msg:alertMsg13,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(h){if(h=="ok"){g.focus(true);
}}});return false;}else{if(a!="Snmp"&&a!="Custom"&&(f.toLowerCase()=="snmpport"||f.toLowerCase()=="snmpversion"||f.toLowerCase()=="snmpcommunity")){Ext.Msg.show({title:pageTitle1,msg:_snmpParams,buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(h){if(h=="ok"){b.focus(true);}}});return false;}else{return true;
}}}}}}}}}}return true;},loadAddParamTab:function(d){var b=this;Ext.Ajax.request({url:"ICTest/data/"+d+"&index=paramTab",method:"POST",async:false,success:function(g){if(g.status==200&&!Ext.isEmpty(g.responseText)){var h=g.responseText;publicJSON=Ext.decode(h);}}});var f=Ext.getCmp("addParamCntnr");f.removeAll();
var a=publicJSON.paramList;if(a.length==0){Ext.getCmp("noParamsFnd").show();Ext.getCmp("addParamCntnr").hide();}else{Ext.getCmp("noParamsFnd").hide();Ext.getCmp("addParamCntnr").show();for(var c=0;c<a.length;c++){var e=a[c];if(e.paramName=="password"){f.add({xtype:"fieldset",title:"<b>"+e.paramName+"</b>",layout:{type:"vbox",align:"left"},width:650,items:[{xtype:"displayfield",fieldLabel:defVal,inputType:"password",labelSeparator:"",value:e.paramValue,flex:1,renderer:function(n,h,l,p,i,o,g){var m="&#8226;";
for(var j=1;j<n.length;j++){m=m+"&#8226;";}return"<h1>"+m+"</h1>";}},{xtype:"container",layour:{type:"hbox",pack:"left"},margin:"10 0 10 0",items:[{xtype:"button",ui:"newButtonSmall",text:modifyTooltip,modifyURL:e.modifyURL,width:80,handler:function(){b.showModifyParam(this.modifyURL);},},{xtype:"button",ui:"newButtonSmall",text:deleteTooltip,hidden:e.hideDelete,deleteURL:e.deleteURL,paramName:e.paramName,width:80,handler:function(){b.deleteParam(this.deleteURL,this.paramName);
},margin:"0 0 0 20"}]}]});}else{f.add({xtype:"fieldset",title:"<b>"+e.paramName+"</b>",layout:{type:"vbox",align:"left"},width:650,items:[{xtype:"displayfield",fieldLabel:defVal,labelSeparator:"",value:e.paramValue,flex:1,},{xtype:"container",layour:{type:"hbox",pack:"left"},margin:"10 0 10 0",items:[{xtype:"button",ui:"newButtonSmall",text:modifyTooltip,modifyURL:e.modifyURL,width:80,handler:function(){var k=this.modifyURL;
var j=k.indexOf("&value=");if(j>-1){var g=k.substring(0,j);var i=k.substring(j);var h=i.substring(i.indexOf("=")+1);}var l=g+"&value="+encodeURIComponent(filterEncode(h));b.showModifyParam(l);},},{xtype:"button",ui:"newButtonSmall",text:deleteTooltip,hidden:e.hideDelete,deleteURL:e.deleteURL,paramName:e.paramName,width:80,handler:function(){b.deleteParam(this.deleteURL,this.paramName);
},margin:"0 0 0 20"}]}]});}}}if(publicJSON.showAddNewParam){Ext.getCmp("addParam").show();}else{Ext.getCmp("addParam").hide();}},showModifyParam:function(d){var c=this;Ext.Ajax.request({url:"ICTest/data/"+d,method:"POST",async:false,success:function(e){if(e.status==200&&!Ext.isEmpty(e.responseText)){var f=e.responseText;
publicJSON=Ext.decode(f);}}});var a=Ext.WindowManager.getActive();if(a){a.close();}var b;if(publicJSON.paramName=="password"){b=Ext.create("Ext.window.Window",{title:modParam,padding:"3 10 10 10",height:200,width:350,id:"modParamWindow",layout:{type:"vbox",pack:"start",align:"center"},defaults:{margin:10},items:[{xtype:"textfield",cls:"textbox",fieldLabel:param,labelAlign:"top",labelSeparator:" ",id:"modParam",name:"modParam",value:publicJSON.paramName,width:250},{xtype:"textfield",cls:"textbox",fieldLabel:defVal,labelAlign:"top",labelSeparator:" ",inputType:"password",id:"modValue",name:"modValue",value:publicJSON.paramValue,width:250},{xtype:"button",ui:"newButtonSmall",text:modifyTooltip,id:"modParamButton",width:80,listeners:{click:{fn:function(e){c.doModifyParam();
}}}}]});}else{b=Ext.create("Ext.window.Window",{title:modParam,padding:"3 10 10 10",height:200,width:350,id:"modParamWindow",layout:{type:"vbox",pack:"start",align:"center"},defaults:{margin:10},items:[{xtype:"textfield",cls:"textbox",fieldLabel:param,labelAlign:"top",labelSeparator:" ",id:"modParam",name:"modParam",value:publicJSON.paramName,width:250},{xtype:"textfield",cls:"textbox",fieldLabel:defVal,labelAlign:"top",labelSeparator:" ",id:"modValue",name:"modValue",value:publicJSON.paramValue,width:250},{xtype:"button",ui:"newButtonSmall",text:modifyTooltip,id:"modParamButton",width:80,listeners:{click:{fn:function(e){c.doModifyParam();
}}}}]});}b.show();if(publicJSON.isSnmpParam||publicJSON.isJmxParam){Ext.getCmp("modParam").setReadOnly(true);}else{Ext.getCmp("modParam").setReadOnly(false);}},doModifyParam:function(){var g=this;jmxCtrlr=this.getController("ICTest.controller.AddJmxTestCtrlr");var c="";var a="";var f=Ext.getCmp("test").getValue();
var b=Ext.getCmp("testType").getValue();var d=Ext.getCmp("modParam").getValue();var h=Ext.getCmp("modValue").getValue();if(b=="Script/Batch File"){c=Ext.getCmp("ostype").getValue().ostyperb;}else{if(b.toLowerCase()=="sql query"){a=Ext.getCmp("dbType").getValue();}}if(!this.paramValidation(d,h,b)){return;
}var e="EgconfigtestparampJson.jsp?index=paramTab&mod=modify_params&one="+encodeURIComponent(d)+"&two="+encodeURIComponent(filterEncode(h))+"&test="+f;e+="&org_param="+encodeURIComponent(filterEncode(publicJSON.hiddens.org_param))+"&os="+c+"&dbtype="+a+"&testtype="+b;var i=new Ext.LoadMask(Ext.getBody(),{msg:updating+"..."});
i.show();Ext.Ajax.request({url:"ICTest/data/"+e,method:"POST",async:false,success:function(j){i.hide();if(j.status==200&&!Ext.isEmpty(j.responseText)){var k=j.responseText;publicJSON=Ext.decode(k);if(publicJSON.AlertType=="Error"){Ext.Msg.show({title:error+": "+publicJSON.AlertTitle,msg:publicJSON.AlertMsg,buttons:Ext.Msg.OK,icon:"iconError"});
}else{if(publicJSON.AlertType=="Result"){Ext.Msg.show({title:publicJSON.AlertTitle,msg:publicJSON.AlertMsg+"."+modifyParamAlert,buttons:Ext.Msg.YESNO,icon:"iconInformation",fn:function(l){if(l=="yes"){Ext.getCmp("modParamWindow").close();Ext.getCmp("addParamTab").enable();var n=publicJSON.forwardURL;
g.loadAddParamTab(n);}else{if(l=="no"){Ext.getCmp("modParamWindow").close();var n=publicJSON.forwardURL;g.loadAddParamTab(n);jmxCtrlr.loadAddMeasureTab(n);var m="EgConfigJmxMeasureJson.jsp?test="+f;Ext.getCmp("newtest").setActiveTab(3);}}}});}}}},failure:function(j){i.hide();}});},showAddMeasure:function(){var a=Ext.getCmp("testType").getValue();
if(a=="Custom"){customCtrlr=this.getController("ICTest.controller.AddCustomTestCtrlr");customCtrlr.showAddNewMeasure();}else{if(a=="Script/Batch File"){scriptCtrlr=this.getController("ICTest.controller.AddScriptTestCtrlr");scriptCtrlr.showAddNewMeasure();}else{if(a.toLowerCase()=="sql query"){sqlCtrlr=this.getController("ICTest.controller.AddSqlTestCtrlr");
sqlCtrlr.showAddNewMeasure();}else{if(a=="Perfmon"){perfmonCtrlr=this.getController("ICTest.controller.AddPerfmonTestCtrlr");perfmonCtrlr.showAddNewMeasure();}else{if(a=="Snmp"){snmpCtrlr=this.getController("ICTest.controller.AddSnmpTestCtrlr");snmpCtrlr.showAddNewMeasure();}else{if(a=="JMX"){jmxCtrlr=this.getController("ICTest.controller.AddJmxTestCtrlr");
var c="Yes";var b="No";jmxCtrlr.showAddNewMeasure(c,b);}else{if(a=="REST"){if(Ext.isEmpty(datasetCtrlr)){datasetCtrlr=this.getController("ICTest.controller.DatasetController");}datasetCtrlr.showAddNewMeasure();}}}}}}}},deleteParam:function(b,a){Ext.Msg.show({title:delParam,msg:alertMsg57+" '"+a+"'?",buttons:Ext.Msg.OKCANCEL,icon:"iconConfirmation",fn:function(c){if(c=="ok"){Ext.Ajax.request({url:"ICTest/data/"+b+"&index=paramTab",method:"POST",async:false,success:function(d){if(d.status==200&&!Ext.isEmpty(d.responseText)){var e=d.responseText;
publicJSON=Ext.decode(e);}}});if(publicJSON.AlertType=="Result"){Ext.Msg.show({title:publicJSON.AlertTitle,msg:publicJSON.AlertMsg,buttons:Ext.Msg.OK,icon:"iconInformation",fn:function(d){if(d=="ok"){Ext.getCmp("addParamTab").enable();var e=publicJSON.forwardURL;modifyCtrler.loadAddParamTab(e);}}});}}}});
}});