var isConfigSupported="";Ext.define("ICTest.controller.AddTestCtrlr",{extend:"Ext.app.Controller",views:["AddNewTest","AddHelp"],requires:["ICTest.view.AddNewTest"],refs:[{selector:"addnewtest",ref:"addnewtest"},{selector:"customgenerate",ref:"customgenerate"},{selector:"scriptgenerate",ref:"scriptgenerate"},{selector:"sqlgenerate",ref:"sqlgenerate"},{selector:"perfmongenerate",ref:"perfmongenerate"},{selector:"snmpgenerate",ref:"snmpgenerate"},{selector:"jmxgenerate",ref:"jmxgenerate"},{selector:"addhelp",ref:"addhelp"},{selector:"defaultthresholds",ref:"defaultthresholds"},{selector:"addhelp #formContainer",ref:"testHelpApp"}],init:function(){addctrler=this;
this.buildMainData();isConfigSupported=publicJSON.isConfigSupported;this.control({"addnewtest":{"afterrender":this.afterMainRender},'addnewtest button[id="add"]':{"click":this.addTest},'addnewtest radiogroup[id="duplicatetest"]':{"change":this.duplicateSelection},'addnewtest button[id="backButton"]':{"click":this.goBack},'addnewtest combo[id="testType"]':{"select":this.testTypeSelection},'addnewtest combo[id="type"]':{"select":this.typeSelection},'addnewtest combo[id="nonDupTest"]':{"select":this.duplicateComboChange},'addnewtest button[id="addNewParam"]':{"click":this.showAddNewParam},'addnewtest button[id="addNewMeasure"]':{"click":this.showAddMeasure},'addnewtest button[id="configureMetricsBtn"]':{"click":this.showConfigMetricsPopup},'addnewtest button[id="chooseClass"]':{"click":this.showClassFileUpload},'addnewtest button[id="chooselLib"]':{"click":this.showLibFileUpload},'addnewtest button[id="generate"]':{"click":this.generateTest},'addnewtest button[id="ddChooseClass"]':{"click":this.showDDClassFileUpload},'addnewtest button[id="ddChooselLib"]':{"click":this.showDDLibFileUpload},'addnewtest button[id="ddGenerate"]':{"click":this.generateDDTest},'addnewtest button[id="addNewDDMeasure"]':{"click":this.showAddNewDDMeasure},'addnewtest button[id="chooseScript"]':{"click":this.showScriptFileUpload},'addnewtest combo[id="tempgroup"]':{"select":this.loadHelpTemplate}});
},buildMainData:function(){Ext.Ajax.request({url:"ICTest/data/EgAddUDTestJson.jsp",method:"POST",async:false,success:function(a){if(a.status==200&&!Ext.isEmpty(a.responseText)){var b=a.responseText;publicJSON=Ext.decode(b);}}});},tabchange:function(c){var b=c.getActiveTab().id;var a=Ext.getCmp("testType").getValue();
if(a=="Script/Batch File"){a="ScriptBatchFile";}else{if(a.toLowerCase()=="sql query"){a="SqlQuery";}}Ext.Ajax.request({url:"ICTest/data/ictesthelpJson.jsp?selectTab="+b+"&testType="+a,method:"POST",async:false});},tabHelp:function(){var b=Ext.getCmp("newtest").getActiveTab().id;var a=Ext.getCmp("testType").getValue();
if(a=="Script/Batch File"){a="ScriptBatchFile";}else{if(a.toLowerCase()=="sql query"){a="SqlQuery";}}Ext.Ajax.request({url:"ICTest/data/ictesthelpJson.jsp?selectTab="+b+"&testType="+a,method:"POST",async:false});},afterMainRender:function(){var c=this;var a=Ext.getCmp("testType");a.getStore().loadRawData(publicJSON.testTypes);
a.setValue(publicJSON.testTypeSelected);var d=Ext.getCmp("type");d.hide();if(isConfigSupported){d.show();d.getStore().loadRawData(publicJSON.types);d.setValue(publicJSON.typeSelected);}Ext.getCmp("test").setValue("_ex");var b=Ext.getCmp("duplicatetest");if(publicJSON.showDuplicate){b.show();b.enable();
}else{b.hide();b.disable();}c.tabHelp();},goBack:function(){window.location.href="/final/admin/EgUDTest.jsp";},duplicateSelection:function(){var e=Ext.getCmp("duplicatetest").getValue().duprb;var d=Ext.getCmp("nonDupTest");var c=Ext.getCmp("elmtsCntnr");var b=Ext.getCmp("testTypeLabel");var a=Ext.getCmp("test").getValue();
var f=Ext.getCmp("type").getValue();if(a.indexOf("_ex")>-1&&(f==undefined||f==null||f=="Performance")){f="Performance";}else{if(a.indexOf("_cf_ex")==-1||f=="Configuration"){f="Configuration";}}Ext.Ajax.request({url:"ICTest/data/EgAddUDTestJson.jsp?testtype="+f,method:"POST",async:false,success:function(g){if(g.status==200&&!Ext.isEmpty(g.responseText)){var h=g.responseText;
publicJSON=Ext.decode(h);}}});if(e=="Yes"){d.show();d.enable();d.getStore().removeAll();d.getStore().loadRawData(publicJSON.dupTestList);d.setValue(publicJSON.selectedDupeTest);c.hide();c.disable();b.hide();}else{d.hide();d.disable();b.hide();c.show();c.enable();}},duplicateComboChange:function(){var d=Ext.getCmp("test").getValue();
var a=Ext.getCmp("nonDupTest").getValue();var c="EgAddUDTestJson.jsp?test="+d+"&duplicateTest=true&testToBeDuplicated="+a;Ext.Ajax.request({url:"ICTest/data/"+c,method:"POST",async:false,success:function(e){if(e.status==200&&!Ext.isEmpty(e.responseText)){var f=e.responseText;publicJSON=Ext.decode(f);
}}});Ext.getCmp("test").setValue(d);if(publicJSON.testTypeAsLabel){var b=Ext.getCmp("testTypeLabel");b.show();b.setValue(publicJSON.testType);}},testTypeSelection:function(){var b=Ext.getCmp("testType").getValue();var c=Ext.getCmp("ostype");var a=Ext.getCmp("dbType");if(b=="Script/Batch File"){c.show();
c.enable();a.hide();a.disable();Ext.getCmp("newtest").getTabBar().items.items[2].hide();}else{if(b.toLowerCase()=="sql query"){a.show();a.enable();c.hide();c.disable();this.buildMainData();a.getStore().loadRawData(publicJSON.dbTypes);a.setValue(publicJSON.dbTypeSelected);Ext.getCmp("newtest").getTabBar().items.items[2].hide();
}else{if(b=="REST"){Ext.getCmp("newtest").getTabBar().items.items[2].show();}else{a.hide();a.disable();c.hide();c.disable();Ext.getCmp("newtest").getTabBar().items.items[2].hide();}}}},typeSelection:function(){var a=Ext.getCmp("type").getValue();var b=Ext.getCmp("duplicatetest").getValue().duprb;var c=Ext.getCmp("nonDupTest");
if(b=="Yes"){Ext.Ajax.request({url:"ICTest/data/EgAddUDTestJson.jsp?testtype="+a,method:"POST",async:false,success:function(d){if(d.status==200&&!Ext.isEmpty(d.responseText)){var e=d.responseText;rootJson=Ext.decode(e);}}});c.getStore().loadRawData(rootJson.dupTestList);c.setValue(rootJson.selectedDupeTest);
}if(a=="Performance"){Ext.getCmp("test").setValue("_ex");Ext.getCmp("test").focus(false,200);}else{if(a=="Configuration"){Ext.getCmp("test").setValue("_cf_ex");Ext.getCmp("test").focus(false,200);}}},addTest:function(){isModifyTest=false;if(testTabLoad){this.testModifyAlone();return;}var i=this;if(this.validate()==false){return;
}var g=Ext.getCmp("duplicatetest").getValue().duprb;if(g=="Yes"){this.doDuplicate();return;}var h=Ext.getCmp("test").getValue();var j=Ext.getCmp("type").getValue();var c=Ext.getCmp("testType").getValue();var d=Ext.getCmp("port").getValue().portrb;var e=Ext.getCmp("execution").getValue().exerb;if(h.indexOf("_ex")>-1&&(j==undefined||j==null||j=="Performance")){j="Performance";
}else{if(h.indexOf("_cf_ex")==-1&&j=="Configuration"){j="Configuration";}}var f="EgaddudtestpJson.jsp?add=test&test="+h+"&typeVal="+j+"&testtype="+c+"&port="+d+"&type="+e;if(c.toLowerCase()=="sql query"){var b=Ext.getCmp("dbType").getValue();f+="&dbType="+b;}else{if(c=="Script/Batch File"){var a=Ext.getCmp("ostype").getValue().ostyperb;
f+="&os="+a;}}if(h.indexOf("_cf_ex")>-1){isConfigTest=true;}Ext.Ajax.request({url:"ICTest/data/"+f,method:"POST",async:false,success:function(k){if(k.status==200&&!Ext.isEmpty(k.responseText)){var l=k.responseText;publicJSON=Ext.decode(l);}}});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,buttons:Ext.Msg.OK,icon:"iconInformation",width:300,fn:function(k){if(k=="ok"){Ext.getCmp("addMeasureTab").enable();if(c!=null&&c=="REST"){Ext.getCmp("newtest").getTabBar().items.items[2].enable();
Ext.getCmp("datasetTab").enable();Ext.getCmp("newtest").getTabBar().items.items[1].hide();Ext.getCmp("newtest").getTabBar().items.items[4].hide();Ext.getCmp("newtest").setActiveTab(2);isRESTTestType=true;}else{Ext.getCmp("addParamTab").enable();Ext.getCmp("newtest").setActiveTab(1);Ext.getCmp("addMeasureTab").enable();
Ext.getCmp("newtest").getTabBar().items.items[2].disable();Ext.getCmp("datasetTab").disable();var l=publicJSON.forwardURL;i.loadAddParamTab(l);}}}});}}i.tabHelp();},doDuplicate:function(){var b=Ext.getCmp("test").getValue();var a=Ext.getCmp("type").getValue();if(b.indexOf("_ex")>-1&&(a==undefined||a==null||a=="Performance")){a="Performance";
}else{if(b.indexOf("_cf_ex")==-1&&a=="Configuration"){a="Configuration";}}var d=Ext.getCmp("testTypeLabel").getValue();var c=Ext.getCmp("nonDupTest").getValue();var e="EgDuplicateTestJson.jsp?testName="+c+"&testType="+d+"&duplicate="+b+"&typeVal="+a;Ext.Ajax.request({url:"ICTest/data/"+e,method:"POST",async:false,success:function(f){if(f.status==200&&!Ext.isEmpty(f.responseText)){var g=f.responseText;
publicJSON=Ext.decode(g);}}});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,buttons:Ext.Msg.OK,icon:"iconInformation",fn:function(f){if(f=="ok"){window.location.href="/final/admin/EgUDTest.jsp";
}}});}}},validate:function(){var b=Ext.getCmp("test");var g=Ext.getCmp("type");var f=b.getValue();var d=g.getValue();var c=c=f.charAt(0);if(c>="0"&&c<="9"){Ext.Msg.show({title:pageTitle1,msg:alertMsg1,buttons:Ext.Msg.OK,icon:"iconExclamation"});b.focus(true);return false;}else{if(!checkblank(f)){Ext.Msg.show({title:pageTitle1,msg:alertMsg2,buttons:Ext.Msg.OK,icon:"iconExclamation"});
b.focus(true);return false;}else{if(checkspaceExtjs(f)!="0"){Ext.Msg.show({title:pageTitle1,msg:_checkblank,buttons:Ext.Msg.OK,icon:"iconExclamation"});b.focus(true);return false;}else{if(!checkspecialnomess(f,"`~!@#$%^&*()+=-/?'\"]{}[\\|;:.,><")){Ext.Msg.show({title:pageTitle1,msg:alertMsg3,buttons:Ext.Msg.OK,icon:"iconExclamation"});
b.focus(true);return false;}else{if(!checkForNameWithEx(f)){Ext.Msg.show({title:pageTitle1,msg:alertMsg2,buttons:Ext.Msg.OK,icon:"iconExclamation"});b.focus(true);return false;}else{if(f.indexOf("_cf_ex")>-1&&(d==undefined||d==null||d=="Performance")){Ext.Msg.show({title:pageTitle1,msg:"Performance test name should end with _ex.",buttons:Ext.Msg.OK,icon:"iconExclamation"});
b.focus(true);return false;}else{if(f.indexOf("_cf_ex")==-1&&d=="Configuration"){Ext.Msg.show({title:pageTitle1,msg:"Configuration test name should end with _cf_ex.",buttons:Ext.Msg.OK,icon:"iconExclamation"});b.focus(true);return false;}else{if(f.indexOf("_cf_ex")>-1&&isConfigSupported=="false"){Ext.Msg.show({title:pageTitle1,msg:alertMsg4,buttons:Ext.Msg.OK,icon:"iconExclamation"});
b.focus(true);return false;}else{if(!validateSingleByte(f)){Ext.Msg.show({title:pageTitle1,msg:alertMsg5,buttons:Ext.Msg.OK,icon:"iconExclamation"});b.focus(true);return false;}}}}}}}}}var a=Ext.getCmp("duplicatetest").getValue().duprb;if(a=="Yes"){var e=Ext.getCmp("nonDupTest").getValue();if(e=="-1"){Ext.Msg.show({title:pageTitle1,msg:alertMsg6,buttons:Ext.Msg.OK,icon:"iconExclamation"});
return false;}}return true;},loadAddParamTab:function(d){var b=this;Ext.getCmp("addParam").show();Ext.Ajax.request({url:"ICTest/data/"+d,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.showNewTetsParams){Ext.getCmp("addParam").show();}else{Ext.getCmp("addParam").hide();}b.tabHelp();},showAddNewParam:function(){var a=this;Ext.create("Ext.window.Window",{title:newParam,padding:"3 10 10 10",height:175,width:350,id:"addParamWindow",layout:{type:"vbox",pack:"center",align:"center"},modal:true,resizable:false,items:[{xtype:"textfield",fieldLabel:param,labelSeparator:" ",cls:"textbox",id:"param",name:"param",width:300,margin:"10 0 0 0"},{xtype:"textfield",fieldLabel:defVal,cls:"textbox",labelSeparator:" ",id:"value",name:"value",value:"unconfigured",width:300,margin:"10 0 0 0"},{xtype:"button",text:add,ui:"newButtonSmall",id:"addParamButton",width:80,listeners:{click:{fn:function(b){a.doAddNewParam();
}}},margin:"20 0 20 0"}]}).show();},doAddNewParam:function(){var i=this;jmxCtrlr=this.getController("ICTest.controller.AddJmxTestCtrlr");var e=Ext.getCmp("param").getValue();var j=Ext.getCmp("value").getValue();var h=Ext.getCmp("test").getValue();var c=Ext.getCmp("testType").getValue();var d=Ext.getCmp("port").getValue().portrb;
var f=Ext.getCmp("execution").getValue().exerb;if(!this.paramValidation(e,j,c)){return;}var g="EgaddudtestpJson.jsp?param="+encodeURIComponent(parent.filterEncode(e))+"&value="+encodeURIComponent(filterEncode(j))+"&add=param&test="+h+"&testtype="+c+"&port="+d+"&type="+f;if(c.toLowerCase()=="sql query"){var b=Ext.getCmp("dbType").getValue();
g+="&dbType="+b;}else{if(c=="Script/Batch File"){var a=Ext.getCmp("ostype").getValue().ostyperb;g+="&os="+a;}}var k=new Ext.LoadMask(Ext.getBody(),{msg:updating+"..."});k.show();Ext.Ajax.request({url:"ICTest/data/"+g,method:"POST",async:false,success:function(l){k.hide();if(l.status==200&&!Ext.isEmpty(l.responseText)){var m=l.responseText;
publicJSON=Ext.decode(m);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+" "+"Would you like to add more parameters for this test?",buttons:Ext.Msg.YESNO,icon:"iconInformation",fn:function(n){if(n=="yes"){Ext.getCmp("addParamWindow").close();
Ext.getCmp("addParamTab").enable();var p=publicJSON.forwardURL;i.loadAddParamTab(p);i.showAddNewParam();}else{if(n=="no"){Ext.getCmp("addParamWindow").destroy();var p=publicJSON.forwardURL;i.loadAddParamTab(p);jmxCtrlr.loadAddMeasureTab(p);var o="EgConfigJmxMeasureJson.jsp?test="+h;Ext.getCmp("newtest").setActiveTab(3);
}}}});}}}},failure:function(l){k.hide();}});i.tabHelp();},paramValidation:function(f,e,a){var c=true;if(isDouble=="false"){c=validateSingleByte(e);}var d=icTestParamValidation(f,e,a);var b=Ext.getCmp("param");var g=Ext.getCmp("value");if(!checkblank(f)){Ext.Msg.show({title:pageTitle1,msg:alertMsg7,buttons:Ext.Msg.OK,icon:"iconExclamation"});
b.focus(true);return false;}else{if(!checkspecialnomess(f,"`~!@#$%^&*+=-/?'\"]{}[\\|;:.,><")){Ext.Msg.show({title:pageTitle1,msg:alertMsg3,buttons:Ext.Msg.OK,icon:"iconExclamation"});b.focus(true);return false;}else{if(!checkblank(e)){g.focus(true);return false;}else{if(!checkspace(e)){g.focus(true);
return false;}else{if(f=="host"){Ext.Msg.show({title:pageTitle1,msg:alertMsg9,buttons:Ext.Msg.OK,icon:"iconExclamation"});b.focus(true);return false;}else{if(f=="info"){Ext.Msg.show({title:pageTitle1,msg:alertMsg10,buttons:Ext.Msg.OK,icon:"iconExclamation"});b.focus(true);return false;}else{if(f=="scriptfile"){Ext.Msg.show({title:pageTitle1,msg:alertMsg56,buttons:Ext.Msg.OK,icon:"iconExclamation"});
b.focus(true);return false;}else{if(f=="port"){Ext.Msg.show({title:pageTitle1,msg:alertMsg11,buttons:Ext.Msg.OK,icon:"iconExclamation"});b.focus(true);return false;}else{if(!validateSingleByte(f)){Ext.Msg.show({title:pageTitle1,msg:alertMsg12,buttons:Ext.Msg.OK,icon:"iconExclamation"});b.focus(true);
return false;}else{if(!c){Ext.Msg.show({title:pageTitle1,msg:alertMsg13,buttons:Ext.Msg.OK,icon:"iconExclamation"});g.focus(true);return false;}else{if(!d){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"});
b.focus(true);return false;}else{b.focus(true);return false;}}}}}}}}}}}}return true;},loadMeasureTab:function(){var e=Ext.getCmp("test").getValue();var a=Ext.getCmp("testType").getValue();if(a=="Jmx"){a="JMX";}var b=this;if(a=="Custom"){var c="EgConfigTestMeasureJson.jsp?test="+e+"&unit=";customCtrlr=this.getController("ICTest.controller.AddCustomTestCtrlr");
customCtrlr.loadAddMeasureTab(c);}else{if(a=="Script/Batch File"){var c="EgConfigScriptMeasureJson.jsp?test="+e;scriptCtrlr=this.getController("ICTest.controller.AddScriptTestCtrlr");scriptCtrlr.loadAddMeasureTab(c);}else{if(a.toLowerCase()=="sql query"){var c="EgConfigSqlMeasureJson.jsp?test="+e;sqlCtrlr=this.getController("ICTest.controller.AddSqlTestCtrlr");
sqlCtrlr.loadAddMeasureTab(c);}else{if(a=="Perfmon"){var c="EgConfigPerfmonMeasureJson.jsp?test="+e;perfmonCtrlr=this.getController("ICTest.controller.AddPerfmonTestCtrlr");perfmonCtrlr.loadAddMeasureTab(c);}else{if(a=="Snmp"){var c="EgConfigSnmpMeasureJson.jsp?test="+e;snmpCtrlr=this.getController("ICTest.controller.AddSnmpTestCtrlr");
snmpCtrlr.init();snmpCtrlr.loadAddMeasureTab(c);}else{if(a=="JMX"){var d="EgMBeanDiscoveryJson.jsp?test="+e;jmxCtrlr=this.getController("ICTest.controller.AddJmxTestCtrlr");jmxCtrlr.init();jmxCtrlr.loadAddMeasureTab(d);}else{if(a=="REST"){if(Ext.isEmpty(datasetCtrlr)){datasetCtrlr=this.getController("ICTest.controller.DatasetController");
datasetCtrlr.init();}var c="EgConfigRESTMeasureJson.jsp?test="+e;datasetCtrlr.loadAddMeasureTab(c);}}}}}}}},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);},showAddMeasure:function(){var a=Ext.getCmp("testType").getValue();if(a=="Jmx"){a="JMX";}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");jmxCtrlr.showAddNewMeasure();}else{if(a=="REST"){if(Ext.isEmpty(datasetCtrlr)){datasetCtrlr=this.getController("ICTest.controller.DatasetController");
}datasetCtrlr.showAddNewMeasure();}}}}}}}},showClassFileUpload:function(){addctrler.showFileUpload("loadClass");},showLibFileUpload:function(){addctrler.showFileUpload("loadLib");},showScriptFileUpload:function(){addctrler.showFileUpload("loadScript");},showDDClassFileUpload:function(){addctrler.showFileUpload("loadDDClass");
},showDDLibFileUpload:function(){addctrler.showFileUpload("loadDDLib");},showFileUpload:function(b){var a=this;var c=Ext.getCmp("test").getValue();Ext.widget("window",{title:fileUpload,width:350,height:150,id:"file",name:"file",resizable:"false",padding:"0 10 10 10",items:[{xtype:"form",id:"uploadform",name:"uploadform",url:"../servlet/com.eg.EgUploadServlet",height:150,items:[{xtype:"fileuploadfield",cls:"fileupload",id:"file1",name:"file1",labelSeparator:"",emptyText:noFileSel,fieldLabel:file2Upload,labelAlign:"top",width:290,buttonText:"Browse",margin:"15 0 0 15",},{xtype:"button",text:upload,id:"upload",name:"upload",action:"upload",ui:"newButtonSmall",align:"center",margin:"15 0 0 140",handler:function(f,h){var g=Ext.getCmp("uploadform").getForm().findField("file1").getValue();
var i=true;if(!validateSingleByte(g)){Ext.Msg.show({title:fileUpload,msg:alertMsg23,buttons:Ext.Msg.OK,icon:"iconExclamation"});Ext.getCmp("file1").focus(true);i=false;}else{if(g==""){Ext.Msg.show({title:fileUpload,msg:alertMsg24,buttons:Ext.Msg.OK,icon:"iconExclamation"});Ext.getCmp("file1").focus(true);
i=false;}else{if(b=="loadClass"){if(g.indexOf(".class")==-1){Ext.Msg.show({title:fileUpload,msg:alertMsg25,buttons:Ext.Msg.OK,icon:"iconExclamation"});Ext.getCmp("file1").focus(true);i=false;}}}}if(!i){return false;}else{var d=Ext.getCmp("uploadform").getForm();if(d.isValid()){d.submit({method:"POST",success:function(k,m){var l=m.response.responseText;
var n=Ext.decode(l);if(!Ext.isEmpty(n.uploadStatus)&&n.uploadStatus=="true"){if(b=="loadClass"){Ext.getCmp("path").setValue(n.classPath);}else{if(b=="loadLib"){var j=Ext.getCmp("lib");var e=j.getValue();if(e!=null&&e!=""){e=e+","+n.libPath;}else{e=n.libPath;}j.setValue(e);}else{if(b=="loadDDClass"){Ext.getCmp("ddPath").setValue(n.classPath);
}else{if(b=="loadDDLib"){var j=Ext.getCmp("ddLib");var e=j.getValue();if(e!=null&&e!=""){e=e+","+n.libPath;}else{e=n.libPath;}j.setValue(e);}else{if(b=="loadScript"){Ext.getCmp("scriptPath").setValue(n.scriptPath);}}}}}f.up(".window").close();}},failure:function(e,j){Ext.Msg.alert(fileUpload,"File upload failure");
}});}else{}}}}],listeners:{afterrender:function(){var d=b;if(b=="loadDDClass"){d="loadClass";}else{if(b=="loadDDLib"){d="loadLib";}}a.uploadWindowData(c,d);},}}]}).show();},uploadWindowData:function(c,b){var a=Ext.getCmp("uploadform");a.add({xtype:"hidden",name:"test",value:c});if(b=="loadScript"){a.add({xtype:"hidden",name:"uploadScript",value:"true"});
}else{a.add({xtype:"hidden",name:"uploadType",value:b});}},generateTest:function(){var a=Ext.getCmp("testType").getValue();if(a=="Jmx"){a="JMX";}if(a=="Custom"){customCtrlr=this.getController("ICTest.controller.AddCustomTestCtrlr");customCtrlr.init();customCtrlr.generateCustomTest();}else{if(a=="Script/Batch File"){scriptCtrlr=this.getController("ICTest.controller.AddScriptTestCtrlr");
scriptCtrlr.init();scriptCtrlr.generateScriptTest();}else{if(a.toLowerCase()=="sql query"){sqlCtrlr=this.getController("ICTest.controller.AddSqlTestCtrlr");sqlCtrlr.generateSqlTest();}else{if(a=="Perfmon"){perfmonCtrlr=this.getController("ICTest.controller.AddPerfmonTestCtrlr");perfmonCtrlr.generatePerfmonTest();
}else{if(a=="Snmp"){snmpCtrlr=this.getController("ICTest.controller.AddSnmpTestCtrlr");snmpCtrlr.generateSnmpTest();}else{if(a=="JMX"){jmxCtrlr=this.getController("ICTest.controller.AddJmxTestCtrlr");jmxCtrlr.generateJmxTest();}else{if(a=="REST"){if(Ext.isEmpty(datasetCtrlr)){datasetCtrlr=this.getController("ICTest.controller.DatasetController");
}datasetCtrlr.generateRESTTest();}}}}}}}},generateDDTest:function(){var h=Ext.getCmp("test").getValue();var c=Ext.getCmp("ddPath");var a=c.getValue();if(a.indexOf(h+"_DD.class")==-1){Ext.Msg.show({title:generate,msg:alertMsg31,buttons:Ext.Msg.OK,icon:"iconExclamation"});c.focus(true);return;}var g=Ext.getCmp("ddLib").getValue();
var b=Ext.getCmp("ddLoadLib").getValue();var f="no";if(b){f="yes";}var e="ICTest/data/EgdiagnosisformatpJson.jsp?action=generate&test="+h+"&path="+a+"&lib="+g+"&loadLib="+f;Ext.Ajax.request({url:e,method:"POST",async:false,success:function(i){if(i.status==200&&!Ext.isEmpty(i.responseText)){var j=i.responseText;
publicJSON=Ext.decode(j);}}});if(publicJSON.AlertType=="Error"){Ext.Msg.show({title:publicJSON.AlertTitle,msg:publicJSON.AlertMsg,buttons:Ext.Msg.OK,icon:"iconExclamation"});}if(!Ext.isEmpty(publicJSON.forwardURL)){this.getController("ICTest.controller.ThresholdCtrlr").init();var d=Ext.getCmp("ddgenerateCntnr");
d.removeAll();var e=publicJSON.forwardURL;qString="ICTest/data/"+e;d.add({xtype:"defaultthresholds"});}},loadDDMeasureTab:function(){var b=Ext.getCmp("test").getValue();var a="EgDiagnosisFormatJson.jsp?test="+b;this.loadAddDDMeasureTab(a);},loadAddDDMeasureTab:function(d){var g=this;Ext.Ajax.request({url:"ICTest/data/"+d,method:"POST",async:false,success:function(j){if(j.status==200&&!Ext.isEmpty(j.responseText)){var k=j.responseText;
publicJSON=Ext.decode(k);}}});var c=publicJSON.measuresList;var f=Ext.getCmp("addDDMeasureCntnr");f.removeAll();if(publicJSON.noMeasuresFnd){Ext.getCmp("noDDMeasureFnd").show();Ext.getCmp("addDDMeasureCntnr").hide();}else{Ext.getCmp("noDDMeasureFnd").hide();Ext.getCmp("addDDMeasureCntnr").show();for(var b=0;
b<c.length;b++){var a=c[b];if(param.paramName=="password"){f.add({xtype:"fieldset",title:"<b>"+param.paramName+"</b>",layout:{type:"vbox",align:"left"},width:650,items:[{xtype:"displayfield",fieldLabel:defVal,inputType:"password",labelSeparator:"",value:param.paramValue,flex:1,renderer:function(q,l,o,s,m,r,j){var p="&#8226;";
for(var n=1;n<q.length;n++){p=p+"&#8226;";}return"<h1>"+p+"</h1>";}},{xtype:"container",layour:{type:"hbox",pack:"left"},margin:"10 0 10 0",items:[{xtype:"button",ui:"newButtonSmall",text:modifyTooltip,modifyURL:param.modifyURL,width:80,handler:function(){g.showModifyParam(this.modifyURL);},},{xtype:"button",ui:"newButtonSmall",text:deleteTooltip,hidden:param.hideDelete,deleteURL:param.deleteURL,paramName:param.paramName,width:80,handler:function(){g.deleteParam(this.deleteURL,this.paramName);
},margin:"0 0 0 20"}]}]});}else{f.add({xtype:"fieldset",title:"<b>"+a.measure+"</b>",width:500,height:150,items:[{xtype:"container",layout:{type:"vbox",align:"left",pack:"center"},defaults:{labelSeparator:" ",margin:5,labelWidth:200},items:[{xtype:"displayfield",fieldLabel:column,value:a.column},{xtype:"displayfield",fieldLabel:desc,value:a.description}]},{xtype:"container",layout:{type:"hbox",align:"center",pack:"center"},defaults:{width:70,margin:10},items:[{xtype:"button",ui:"newButtonSmall",text:modifyTooltip,modifyInfo:a.modifyInfo,handler:function(){g.showModifyDDMeasure(this.modifyInfo);
}},{xtype:"button",ui:"newButtonSmall",text:deleteTooltip,deleteURL:a.deleteURL,handler:function(){g.deleteDDMeasure(this.deleteURL);}}]}]});}}var i=publicJSON.hiddens.classPath;if(i!=null&&i!=""){Ext.getCmp("ddPath").setValue(i);}var h=publicJSON.hiddens.libraryPath;var e=publicJSON.loadLibChecked;if(h!=null&&h!=""){Ext.getCmp("ddLib").setValue(h);
}if(e){Ext.getCmp("ddLoadLib").setValue(true);}}},loadDDTab:function(){isDDLoaded=true;var b=Ext.getCmp("test").getValue();var a="EgDiagnosisFormatJson.jsp?test="+b;this.loadAddDDMeasureTab(a);},showAddNewDDMeasure:function(){var b=this;Ext.create("Ext.window.Window",{title:meas4DD,padding:"3 10 10 10",height:400,width:400,id:"addDDMeasureWindow",layout:{type:"vbox",pack:"start",align:"center"},defaults:{margin:10},items:[{xtype:"scrollcombo",cls:"dropdown",id:"ddMeasure",name:"ddMeasure",fieldLabel:meas4Test,store:new Ext.data.Store({fields:["displayField","valueField"],data:[]}),displayField:"displayField",valueField:"valueField",queryMode:"local",labelAlign:"top",labelSeparator:" ",width:300,editable:false},{xtype:"textareafield",cls:"text-area",grow:true,labelAlign:"top",labelSeparator:" ",width:300,height:100,name:"ddColTitles",id:"ddColTitles",fieldLabel:colHeads},{xtype:"textareafield",cls:"text-area",grow:true,labelAlign:"top",labelSeparator:" ",width:300,height:100,name:"ddDesc",id:"ddDesc",fieldLabel:descDD},{xtype:"button",ui:"newButtonSmall",text:add,id:"addMeasureButton",width:80,listeners:{click:{fn:function(c){addctrler.doAddNewDDMeasure();
}}}}]}).show();var a=Ext.getCmp("ddMeasure");a.getStore().loadRawData(publicJSON.measures);a.setValue(publicJSON.selectedMeasure);Ext.getCmp("ddColTitles").setValue(publicJSON.columnValue);Ext.getCmp("ddDesc").setValue(publicJSON.descriptionValue);},deleteDDMeasure:function(b){var a=this;Ext.Msg.show({title:tab5DD,msg:alertMsg37,buttons:Ext.Msg.OKCANCEL,icon:"iconConfirmation",fn:function(c){if(c=="ok"){Ext.Ajax.request({url:"ICTest/data/"+b,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("addDDMeasureTab").enable();var e=publicJSON.forwardURL;a.loadAddDDMeasureTab(e);}}});}}}});
},showModifyDDMeasure:function(a){var b=a.split("#^#");var c="EgDiagnosisFormatJson.jsp?test="+b[0]+"&measure="+b[1]+"&column="+b[2]+"&desc="+b[3];Ext.Ajax.request({url:"ICTest/data/"+c,method:"POST",async:false,success:function(d){if(d.status==200&&!Ext.isEmpty(d.responseText)){var e=d.responseText;
publicJSON=Ext.decode(e);}}});this.showAddNewDDMeasure();},doAddNewDDMeasure:function(){var c=this;var g=publicJSON.hiddens.test;var a=Ext.getCmp("ddMeasure").getValue();var b=Ext.getCmp("ddColTitles").getValue();var f=Ext.getCmp("ddDesc").getValue();var d="ICTest/data/EgdiagnosisformatpJson.jsp?action=add&ddColTitles="+encodeURIComponent(b)+"&ddDesc="+f+"&measure="+a+"&test="+g;
if(!this.ddMeasureValidation(a,b,f)){return;}Ext.Ajax.request({url:d,method:"POST",async:false,success:function(h){if(h.status==200&&!Ext.isEmpty(h.responseText)){var i=h.responseText;publicJSON=Ext.decode(i);}}});if(publicJSON.AlertType=="Error"){Ext.Msg.show({title:error+": "+publicJSON.AlertTitle,msg:publicJSON.AlertMsg,buttons:Ext.Msg.OK,icon:"iconExclamation"});
}if(publicJSON.forwardPage){Ext.getCmp("addDDMeasureWindow").close();Ext.getCmp("addDDMeasureTab").enable();var e=publicJSON.forwardURL;c.loadAddDDMeasureTab(e);Ext.getCmp("ddGenerateTab").enable();}},ddMeasureValidation:function(a,b,e){var f=Ext.getCmp("ddMeasure");var c=Ext.getCmp("ddColTitles");var d=Ext.getCmp("ddDesc");
if(a==-1){Ext.Msg.show({title:generate,msg:alertMsg32,buttons:Ext.Msg.OK,icon:"iconExclamation"});f.focus(true);return false;}else{if(b==""){Ext.Msg.show({title:generate,msg:alertMsg33,buttons:Ext.Msg.OK,icon:"iconExclamation"});c.focus(true);return false;}else{if(b.indexOf(" ")>0){Ext.Msg.show({title:generate,msg:alertMsg34,buttons:Ext.Msg.OK,icon:"iconExclamation"});
c.focus(true);return false;}else{if(e==""){Ext.Msg.show({title:generate,msg:alertMsg35,buttons:Ext.Msg.OK,icon:"iconExclamation"});d.focus(true);return false;}else{if(e.indexOf(",")>-1){Ext.Msg.show({title:generate,msg:alertMsg356,buttons:Ext.Msg.OK,icon:"iconExclamation"});d.focus(true);return false;
}}}}}return true;},loadGenerateTab:function(){var h=Ext.getCmp("test").getValue();var b=Ext.getCmp("testType").getValue();var g=Ext.getCmp("generateCntnr");var i=this;g.removeAll();if(b=="Jmx"){b="JMX";}if(b=="Custom"){var e="EgConfigTestMeasureJson.jsp?test="+h;this.postURL(e);g.add({xtype:"customgenerate"});
if(isConfigTest){var c=Ext.getCmp("isDescriptorBasedTest");c.show();if(publicJSON.descriptorBasedTestCheck=="checked"){c.setValue(true);}}else{if(ddEnabled=="true"){Ext.getCmp("ddForMeasure").show();if(publicJSON.ddForMeasureCheck=="checked"){Ext.getCmp("ddForMeasure").setValue(true);Ext.getCmp("newtest").child("#tab5DD").tab.show();
}}}Ext.getCmp("path").setValue(publicJSON.path);Ext.getCmp("lib").setValue(publicJSON.libFile);if(publicJSON.loadLibChecked){Ext.getCmp("loadLib").setValue(true);}if(isConfigTest){var d=Ext.getCmp("dbSizeGen");d.show();d.getStore().loadRawData(publicJSON.dbColSizeList);d.setValue(publicJSON.dbColSizeSelected);
}else{var f=Ext.getCmp("descCheckBox");f.hide();}}else{if(b=="Script/Batch File"){var e="EgConfigScriptMeasureJson.jsp?test="+h;this.postURL(e);g.add({xtype:"scriptgenerate"});Ext.getCmp("scriptPath").setValue(publicJSON.path);if(isConfigTest){var d=Ext.getCmp("dbSizeGen");var j=Ext.getCmp("isDescriptorBasedTestScript");
d.show();j.show();d.getStore().loadRawData(publicJSON.dbColSizeList);d.setValue(publicJSON.dbColSizeSelected);if(publicJSON.descriptorBasedTestCheck=="checked"){j.setValue(true);}}else{var f=Ext.getCmp("descCheckBox");f.hide();}}else{if(b.toLowerCase()=="sql query"){var e="EgConfigSqlMeasureJson.jsp?test="+h;
this.postURL(e);g.add({xtype:"sqlgenerate"});Ext.getCmp("query").setValue(publicJSON.query);if(isConfigTest){var d=Ext.getCmp("dbSizeGen");var j=Ext.getCmp("isDescriptorBasedTestSql");d.show();j.show();d.getStore().loadRawData(publicJSON.dbColSizeList);d.setValue(publicJSON.dbColSizeSelected);if(publicJSON.descriptorBasedTestCheck=="checked"){j.setValue(true);
}}else{var f=Ext.getCmp("descCheckBox");f.hide();}}else{if(b=="Perfmon"){var e="EgConfigPerfmonMeasureJson.jsp?test="+h;this.postURL(e);g.add({xtype:"perfmongenerate"});Ext.getCmp("object").setValue(publicJSON.objectName);Ext.getCmp("instances").setValue(publicJSON.instancesIncluded);Ext.getCmp("instances_neg").setValue(publicJSON.instancesExcluded);
if(isConfigTest){var d=Ext.getCmp("dbSizeGen");var j=Ext.getCmp("isDescriptorBasedTestPerfmon");d.show();j.show();d.getStore().loadRawData(publicJSON.dbColSizeList);d.setValue(publicJSON.dbColSizeSelected);if(publicJSON.descriptorBasedTestCheck=="checked"){j.setValue(true);}}else{var f=Ext.getCmp("descCheckBox");
f.hide();}}else{if(b=="Snmp"){var e="EgConfigSnmpMeasureJson.jsp?test="+h;this.postURL(e);g.add({xtype:"snmpgenerate"});this.getController("ICTest.controller.AddSnmpTestCtrlr").init();Ext.getCmp("elements").getStore().loadRawData(publicJSON.elemntCategoery);var a=Ext.getCmp("multiGroup");if(publicJSON.multipleChecked){Ext.getCmp("elements").setValue("Multiple Elements");
a.show();a.enable();Ext.getCmp("elementOid").setValue(publicJSON.elementID);Ext.getCmp("validOid").setValue(publicJSON.elementStatus);Ext.getCmp("validValue").setValue(publicJSON.elementValidStatus);Ext.getCmp("rediscPeriod").setValue(publicJSON.rediscoveryPeriod);snmpElmtID=publicJSON.elementID;snmpElmtStatus=publicJSON.elementStatus;
}else{a.hide();a.disable();Ext.getCmp("elements").setValue("Single Element");var f=Ext.getCmp("descCheckBox");f.hide();}if(isConfigTest){var d=Ext.getCmp("dbSizeGen");var j=Ext.getCmp("isDescriptorBasedTestSnmp");var f=Ext.getCmp("descCheckBox");d.show();d.getStore().loadRawData(publicJSON.dbColSizeList);
d.setValue(publicJSON.dbColSizeSelected);if(publicJSON.descriptorBasedTestCheck=="checked"||publicJSON.multipleChecked){j.show();f.show();j.setValue(true);}j.setReadOnly(true);}else{var f=Ext.getCmp("descCheckBox");f.hide();}}else{if(b=="JMX"){var e="EgConfigJmxMeasureJson.jsp?test="+h;this.postURL(e);
g.add({xtype:"jmxgenerate"});Ext.getCmp("object").setValue(publicJSON.domainName);Ext.getCmp("object").setReadOnly(true);Ext.getCmp("instances").setValue(publicJSON.mBeansIncluded);Ext.getCmp("instances_neg").setValue(publicJSON.mBeansExcluded);if(isConfigTest){var d=Ext.getCmp("dbSizeGen");var j=Ext.getCmp("isDescriptorBasedTestJmx");
d.show();j.show();d.getStore().loadRawData(publicJSON.dbColSizeList);d.setValue(publicJSON.dbColSizeSelected);j.setValue(true);if(publicJSON.descriptorBasedTestCheck=="checked"){j.setValue(true);}j.setReadOnly(true);}else{var f=Ext.getCmp("descCheckBox");f.hide();}}else{if(b=="REST"){var e="EgConfigRESTMeasureJson.jsp?test="+h;
this.postURL(e);g.add({xtype:"restgenerate"});if(Ext.isEmpty(datasetCtrlr)){this.getController("ICTest.controller.DatasetController").init();}if(publicJSON!=null&&publicJSON.hasOwnProperty("descriptorNode")){if(!Ext.isEmpty(publicJSON["descriptorNode"])){Ext.getCmp("DescriptorRequired").setValue(true);
Ext.getCmp("descriptorDataRestFld").setValue(publicJSON["descriptorNode"]);if(publicJSON!=null&&publicJSON.hasOwnProperty("descriptorParentNode")){if(!Ext.isEmpty(publicJSON["descriptorParentNode"])){Ext.getCmp("descriptorDataRestFld").dataFieldParentNode=publicJSON["descriptorParentNode"];}}}}else{Ext.getCmp("DescriptorRequired").setValue(false);
}}}}}}}}i.tabHelp();},postURL:function(a){Ext.Ajax.request({url:"ICTest/data/"+a,method:"POST",async:false,success:function(b){if(b.status==200&&!Ext.isEmpty(b.responseText)){var c=b.responseText;publicJSON=Ext.decode(c);}}});},helpOptionChange:function(a){if(a=="usetemplate"){Ext.getCmp("addUseTmpl").show();
Ext.getCmp("addUseTmpl").enable();Ext.getCmp("uploadHelpPage").hide();Ext.getCmp("uploadHelpPage").disable();}else{if(a=="upload"){Ext.getCmp("uploadHelpPage").show();Ext.getCmp("uploadHelpPage").enable();Ext.getCmp("addUseTmpl").hide();Ext.getCmp("addUseTmpl").disable();}}},loadHelpTab:function(){this.loadAddHelpTab();
},loadAddHelpTab:function(){var e="add";var f=Ext.getCmp("test").getValue();var a;var d;var b;if(publicJSON.hiddens!=null){f=publicJSON.hiddens.test;a=publicJSON.hiddens.dir;d=publicJSON.hiddens.help1;b=publicJSON.hiddens.help2;}if(d==null||d=="undefined"){d="";}if(b==null||b=="undefined"){b="";}if(a==null||a=="undefined"){a="";
}var c="ICTest/data/EgTemplateUpload.jsp?test="+f+"&addormodify="+e+"&helpf1="+d+"&help2="+b+"&dir="+a;Ext.Ajax.request({url:c,method:"POST",success:function(g){if(g.status==200&&!Ext.isEmpty(g.responseText)){var i=g.responseText;publicJSON=Ext.decode(i);var j=Ext.getCmp("tempgroup");j.setFieldLabel(avlTemplete);
j.getStore().loadRawData(publicJSON.optList);j.setValue(publicJSON.optSelected);var h=Ext.getCmp("filetest");h.setFieldLabel(templCont);h.setValue(publicJSON.textAreaValue);}}});},loadModifyHelpTab:function(){var f=publicJSON.hiddens.test;var a="modify";var c=publicJSON.hiddens.dir;var j=publicJSON.hiddens.help1;
var i=publicJSON.hiddens.help2;if(j==null||j=="undefined"){j="";}if(i==null||i=="undefined"){i="";}if(c==null||c=="undefined"){c="";}var e="ICTest/data/EgTemplateUpload.jsp?test="+f+"&addormodify="+a+"&helpf1="+j+"&helpf2="+i+"&dir="+c;Ext.Ajax.request({url:e,method:"POST",async:false,success:function(k){if(k.status==200&&!Ext.isEmpty(k.responseText)){var l=k.responseText;
publicJSON=Ext.decode(l);}}});var d=Ext.getCmp("addHelpCntnr");d.removeAll();d=Ext.getCmp("modifyHelpTab");d.removeAll();d.add({xtype:"addhelp"});var h=Ext.getCmp("tempgroup");h.setFieldLabel(avlHelpPages);h.getStore().loadRawData(publicJSON.optList);h.setValue(publicJSON.optSelected);var g=Ext.getCmp("filetest");
g.setFieldLabel(hlpPageCont);g.setValue(publicJSON.textAreaValue);var b=Ext.getCmp("createHelp");b.setText(modifyHlp);this.helpOptionChange("usetemplate");},updateTestTemplates:function(){var a=this;var c=a.getTestHelpApp().getComponent("adHlp");var b=a.getTestHelpApp().getComponent("monHlp");if(a.isFileSelected()){a.uploadHelp();
}else{if(!a.isFileSelected()&&Ext.isEmpty(Ext.getCmp("filetest").getValue())){Ext.Msg.show({title:useTemplete,msg:alertMsg77,buttons:Ext.Msg.OK,fn:function(d){if(d=="ok"){return;}}});}else{a.createHelp();}}},filterFormFields:function(a){if(a=="usetemplate"){Ext.getCmp("templateCt").enable();Ext.getCmp("formContainer").disable();
}else{Ext.getCmp("templateCt").disable();Ext.getCmp("formContainer").enable();}},elableAllFiedls:function(){Ext.getCmp("templateCt").enable();Ext.getCmp("formContainer").enable();},isFileSelected:function(){var a=this;var c=a.getTestHelpApp().getComponent("adHlp").getValue();var b=a.getTestHelpApp().getComponent("monHlp").getValue();
if(Ext.isEmpty(c)&&Ext.isEmpty(b)){return false;}return true;},createHelp:function(){var c=this;var d=Ext.getCmp("filetest").getValue();if(d.trim()==""){Ext.Msg.show({title:useTemplete,msg:alertMsg77,buttons:Ext.Msg.OK,fn:function(f){if(f=="ok"){return;}}});}else{var e=Ext.getCmp("helpuploadform");e.add({xtype:"hidden",name:"tempup",value:"tempupload"});
c.loadHiddenParams();var b=e.getForm();if(b.isValid()){c.filterFormFields("usetemplate");var a=new Ext.LoadMask(Ext.getBody(),{msg:updating+"..."});a.show();b.submit({method:"POST",params:{uploadType:"loadHelp"},headers:{"Content-Type":"multipart/form-data"},success:function(f,h){a.hide();var g=h.response.responseText;
var i=Ext.decode(g);if(i.uploadStatus=="true"){Ext.Msg.show({title:createHlp,msg:alertMsg58,buttons:Ext.Msg.OK,icon:"iconInformation",fn:function(j){if(j=="ok"){window.location.href="/final/admin/EgUDTest.jsp";}}});}c.elableAllFiedls();}});}}},loadHiddenParams:function(){var b=Ext.getCmp("hiddenContainer");
b.removeAll();var a=publicJSON.hiddens;for(var c in a){b.add({xtype:"hidden",name:c,value:a[c]});}},uploadHelp:function(){var e=this;var d=Ext.getCmp("adHlp").getValue();var c=Ext.getCmp("monHlp").getValue();var f="";var i=d.lastIndexOf(".");if(i>0){f=d.substring(i);}f=f.toLowerCase();var b="";var g=c.lastIndexOf(".");
if(g>0){b=c.substring(g);}b=b.toLowerCase();if(d==""&&c==""){Ext.Msg.show({title:createHlp,msg:alertMsg59,buttons:Ext.Msg.OK,icon:"iconExclamation"});return;}else{if(d!=""&&f!=".html"){Ext.Msg.show({title:createHlp,msg:alertMsg60,buttons:Ext.Msg.OK,icon:"iconExclamation"});return;}}if(c!=""&&b!=".html"){Ext.Msg.show({title:createHlp,msg:alertMsg61,buttons:Ext.Msg.OK,icon:"iconExclamation"});
return;}var h=Ext.getCmp("helpuploadform").getForm();e.loadHiddenParams();var a=Ext.getCmp("hiddenContainer");a.add({xtype:"hidden",name:"helpf1",value:d});a.add({xtype:"hidden",name:"helpf2",value:c});if(h.isValid()){e.filterFormFields("file");var j=new Ext.LoadMask(Ext.getBody(),{msg:updating+"..."});
j.show();h.submit({method:"POST",params:{uploadType:"loadHelp"},headers:{"Content-Type":"multipart/form-data"},success:function(k,m){j.hide();var l=m.response.responseText;var n=Ext.decode(l);if(n.uploadStatus=="true"){Ext.Msg.show({title:createHlp,msg:alertMsg58,buttons:Ext.Msg.OK,icon:"iconInformation"});
}e.elableAllFiedls();}});}},loadHelpTemplate:function(){var a=Ext.getCmp("tempgroup").getValue();if(a=="-1"){Ext.getCmp("filetest").setValue("");}else{if(a=="Admin Not Available"){Ext.Msg.show({title:useTemplete,msg:alertMsg78+" 'Admin'",buttons:Ext.Msg.OK,icon:"iconInformation",fn:function(e){if(e=="ok"){return;
}}});Ext.getCmp("tempgroup").setValue("-1");Ext.getCmp("filetest").setValue("");}else{if(a=="Monitor Not Available"){Ext.Msg.show({title:useTemplete,msg:alertMsg78+" 'Monitor'",buttons:Ext.Msg.OK,icon:"iconInformation",fn:function(e){if(e=="ok"){return;}}});Ext.getCmp("tempgroup").setValue("-1");Ext.getCmp("filetest").setValue("");
}else{var d=Ext.getCmp("test").getValue();var c=publicJSON.hiddens.dir+a;var b="ICTest/data/EgTemplateUpload.jsp?path="+c+"&test="+d+"&dir="+publicJSON.hiddens.dir;b+="&tempName="+a+"&addormodify="+publicJSON.hiddens.addormodify;Ext.Ajax.request({url:b,method:"POST",async:false,success:function(e){if(e.status==200&&!Ext.isEmpty(e.responseText)){var f=e.responseText;
publicJSON=Ext.decode(f);}}});Ext.getCmp("tempgroup").getStore().loadRawData(publicJSON.optList);Ext.getCmp("filetest").setValue(publicJSON.textAreaValue);if(a.indexOf("_ex_")!=-1){Ext.getCmp("filetest").setFieldLabel(publicJSON.htmlViewContent1);}else{Ext.getCmp("filetest").setFieldLabel(publicJSON.htmlViewContent0);
}}}}},loadTestTab:function(){isConfigSupported=publicJSON.isConfigSupported;var a=Ext.getCmp("test");var h=a.getValue();var j=Ext.getCmp("type");var d;var i;if(h!=null&&h!=""&&h!="_ex"&&h!="_cf_ex"){testTabLoad=true;a.setReadOnly(true);var b=Ext.getCmp("testType");d=b.getValue();b.setReadOnly(true);j.setReadOnly(true);
Ext.getCmp("add").setText(modifyTooltip);if(!isConfigSupported){j.hide();}if(h.indexOf("_cf_ex")>-1){isConfigTest=true;}else{isConfigTest=false;}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;
}if(d.toLowerCase()=="sql query"){c=Ext.getCmp("dbType").getValue();}tmpTest=h;tmpTestType=d;tmpOs=g;tmpExecu=f;tmpPort=e;tmpDbType=c;}},testModifyAlone:function(){var g=Ext.getCmp("test").getValue();var b=Ext.getCmp("testType").getValue();Ext.getCmp("duplicatetest").hide();Ext.getCmp("nonDupTest").hide();
var f=Ext.getCmp("execution").getValue().exerb;var a=Ext.getCmp("port").getValue().portrb;var c="";var e="";if(b=="Script/Batch File"){c=Ext.getCmp("ostype").getValue().ostyperb;}else{if(b.toLowerCase()=="sql query"){e=Ext.getCmp("dbType").getValue();}}var d="EgconfigtestparampJson.jsp?index=test&test="+g+"&testtype="+b+"&type="+f+"&port="+a+"&os="+c+"&dbtype="+e+"&mod=modify_test"+"&$_type="+tmpExecu+"&$_port="+tmpPort+"&$_os="+tmpOs+"&$_dbtype="+tmpDbType;
Ext.Ajax.request({url:"ICTest/data/"+d,method:"POST",async:false,success:function(h){if(h.status==200&&!Ext.isEmpty(h.responseText)){var i=h.responseText;publicJSON=Ext.decode(i);}}});if(publicJSON.AlertType=="Error"){Ext.Msg.show({title:error+": "+publicJSON.AlertTitle,msg:publicJSON.AlertMsg,buttons:Ext.Msg.OK,icon:"iconExclamation"});
}else{if(publicJSON.AlertType=="Result"){Ext.Msg.show({title:publicJSON.AlertTitle,msg:publicJSON.AlertMsg+" "+"Would you like to add more parameters for this test?",buttons:Ext.Msg.YESNO,icon:"iconInformation",fn:function(h){if(h=="yes"){Ext.getCmp("addParamTab").enable();Ext.getCmp("newtest").setActiveTab(1);
Ext.getCmp("addMeasureTab").enable();var j=publicJSON.forwardURL;me.loadAddParamTab(j);}else{if(h=="no"){var j=publicJSON.forwardURL;me.loadAddParamTab(j);jmxCtrlr.loadAddMeasureTab(j);var i="EgConfigJmxMeasureJson.jsp?test="+g;Ext.getCmp("newtest").setActiveTab(3);}}}});}}},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(){jmxCtrlr=this.getController("ICTest.controller.AddJmxTestCtrlr");Ext.getCmp("addParam").show();var g=this;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+" "+"Would you like to add more parameters for this test?",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").destroy();var n=publicJSON.forwardURL;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=="Jmx"){a="JMX";}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(c,b){var a=this;Ext.getCmp("addParam").show();Ext.Msg.show({title:delParam,msg:alertMsg57+" '"+b+"'?",buttons:Ext.Msg.OKCANCEL,icon:"iconConfirmation",fn:function(d){if(d=="ok"){Ext.Ajax.request({url:"ICTest/data/"+c+"&index=paramTab",method:"POST",async:false,success:function(e){if(e.status==200&&!Ext.isEmpty(e.responseText)){var f=e.responseText;
publicJSON=Ext.decode(f);}}});if(publicJSON.AlertType=="Result"){Ext.Msg.show({title:publicJSON.AlertTitle,msg:publicJSON.AlertMsg,buttons:Ext.Msg.OK,icon:"iconInformation",fn:function(e){if(e=="ok"){Ext.getCmp("addParamTab").enable();var f=publicJSON.forwardURL;a.loadAddParamTab(f);}}});}}}});}});