Ext.define("VirtualMachinesDetailsApp.controller.Main",{extend:"Ext.app.Controller",gridColStateParam:"ASC",gridColIndexParam:-1,refs:[{selector:"main",ref:"main"},{selector:"newUtilities",ref:"newUtilities"},{selector:"virtualmachinesdetailsmainform",ref:"virtualmachinesdetailsmainform"},{selector:"virtualmachinesdetailssettings",ref:"virtualmachinesdetailssettings"},{selector:"nomeasurepanel",ref:"nomeasurepanel"},{selector:"backGroundPanel",ref:"backGroundPanel"},{selector:"ReporterSettings",ref:"ReporterSettings"}],init:function(){this.control({"main newUtilities":{"afterrender":this.hideTools},"main":{"boxready":this.boxready},"virtualmachinesdetailsmainform":{"afterrender":this.loadDefaults},"virtualmachinesdetailssettings":{"afterrender":this.loadSettingsData},'virtualmachinesdetailsmainform combo[name="selectionCombo"]':{"select":this.changeSelection},'virtualmachinesdetailsmainform combo[name="compTypeCombo"]':{"select":this.groupComboChange},'virtualmachinesdetailsmainform combo[name="virtualMachineCombo"]':{"select":this.groupComboChange},'virtualmachinesdetailsmainform combo[name="virtualCenterCombo"]':{"select":this.groupComboChange},'virtualmachinesdetailsmainform combo[name="reportTypeCombo"]':{"select":this.groupComboChange},'egcomponent button[id="expandSelector"]':{"click":this.expandMe},'virtualmachinesdetailssettings combo[id="showDataCombo"]':{"select":this.getTrendTimeLineOnChange},'virtualmachinesdetailssettings button[id="moreOptionCloseId"]':{"click":this.validateAndCloseSettings},'virtualmachinesdetailssettings button[id="submitViaSetting"]':{"click":this.closeAndSubmitSettings},'reportgeneration combo[name="reportGeneration"]':{"select":this.showBackgroundReport},'mainform button[name="submit"]':{"click":this.beforeReportSubmit},'mainform button[name="save"]':{"click":this.addTo},"newUtilities > #printTool > button":{"click":this.printReport},"newUtilities > #saveTool > button":{"click":this.savePdf},"newUtilities > #favoriteTool > button":{"click":this.addTo},"newUtilities > #scheduleTool > button":{"click":this.addTo},"newUtilities > #csvTool > button":{"click":this.saveAsCSV},"newUtilities > #mailTool > button":{"click":this.sendMail},'timeline combo[name="er_mode"]':{"select":this.changeEr_mode},'egcomponent trigger[id="compSearch"]':{"change":this.filterMultiselect},'mainform button[id="panelinsidetoggle"]':{"click":this.toggleForm}});
},showConfigDropdown:function(){isSettingsEnabled=true;var b=new Ext.XTemplate('<div style="float:left;margin:0px 0px 0px 0px" >'+settings+'</div><div style="text-align:right;float:right;"><div class="iconCloseNew" id="closeSettings"></div></div>');Ext.create("Ext.container.Container",{width:565,id:"configMod",ui:"settingsWindowContainer",items:[{xtype:"container",cls:"configMode_popupArrow",style:{"top":"-14px","left":"355px"}},{xtype:"container",cls:"containerHeader",html:b.apply(),style:{"top":"0px","margin":"0px"}},{xtype:"virtualmachinesdetailssettings",itemId:"settingsForm",parent:this}],renderTo:"virtualmachinesdetails-body"});
var a=this;Ext.get("closeSettings").on("click",function(){a.validateAndCloseSettings();});},closeAndSubmitSettings:function(){if(this.validateAndCloseSettings()){this.beforeReportSubmit();}},loadSettingsData:function(){Ext.getCmp("moreOptionCloseId").show();var m=appConstants.publicJsonData["hiddenParams"];
var g=appConstants.publicJsonData["hiddenParams"]["favorite_id"];if(!Ext.isEmpty(g)){Ext.getCmp("reportGeneration").setDisabled(true);}var x=this.getVirtualmachinesdetailssettings().getForm();var i=appConstants.publicJsonData.screenLabels["reporter.common.Hrs"];var e=appConstants.publicJsonData.screenLabels["reporter.common.From"];
var d=appConstants.publicJsonData.screenLabels["reporter.common.To"];var f=appConstants.publicJsonData.screenLabels["reporter.common.Time period"];var w=appConstants.publicJsonData.screenLabels["reporter.common.Report Generation"];var k=appConstants.publicJsonData.screenLabels["reporter.common.Report Name"];
var p=appConstants.publicJsonData.screenLabels["reporter.common.Graph"];var a=Ext.getCmp("timeperiodLbl");a.setText(f);var r=Ext.getCmp("fromTimeLbl");r.setText(e);var s=Ext.getCmp("fromHrsLbl");s.setText(i);var l=Ext.getCmp("toTimeLbl");l.setText(d);var h=Ext.getCmp("toHrsLbl");h.setText(i);var n=appConstants.publicJsonData["repGenOpts"];
var q=x.findField("reportGeneration");q.getStore().loadRawData(n);q.setValue(appConstants.publicJsonData.pageParams["er_reportgenration"]);q.setFieldLabel(w);if(appConstants.publicJsonData.pageParams["er_reportgenration"]=="foreground"){Ext.getCmp("moreOptionCloseId").show();Ext.getCmp("submitViaSetting").hide();
}else{Ext.getCmp("moreOptionCloseId").hide();Ext.getCmp("submitViaSetting").show();}var c=x.findField("bgReportName");c.setFieldLabel(k);var v=x.findField("timefrom");v.setValue(appConstants.publicJsonData.pageParams.Hourfrom);var b=x.findField("minfrom");b.setValue(appConstants.publicJsonData.pageParams.Minfrom);
var u=x.findField("timeto");u.setValue(appConstants.publicJsonData.pageParams.Hourto);var t=x.findField("minto");t.setValue(appConstants.publicJsonData.pageParams.Minto);var o=appConstants.publicJsonData["pageParams"]["showDataCombo"];if(o!=null&&o=="true"){var j=x.findField("showDataCombo");j.getStore().loadRawData(appConstants.publicJsonData["dataOpts"]);
j.setValue(appConstants.publicJsonData["pageParams"]["selectedShowDataOption"]);j.setFieldLabel(appConstants.publicJsonData["screenLabels"]["reporter.common.Show Data"]);j.show();}var y=x.findField("er_excwe");y.getStore().loadRawData(appConstants.publicJsonData["yesNoOpts"]);y.setValue("No");y.setFieldLabel(appConstants.publicJsonData["screenLabels"]["reporter.common.Exclude weekends"]);
updatingAppSettings();},sendMail:function(){var a=Ext.widget("sendmail");a.show();},filterMultiselect:function(a){if(Ext.isEmpty(appConstants.erUtils)){appConstants.erUtils=Ext.widget("erutils");}a.toggleTriggger();appConstants.erUtils.filterComboStore(a,Ext.getCmp("er_component"),appConstants.rawDataForComponents);
},changeEr_mode:function(c){var a=appConstants.publicJsonData["hiddenParams"]["favorite_id"];var b=appConstants.publicJsonData["hiddenParams"]["fromScheduleModify"];if(!(a=="undefined"||a==undefined)||!(b==null||b=="null")){return;}if(Ext.get("configMod")!=null){Ext.get("configMod").animate({duration:250,to:{y:-530}});
}this.beforeReportSubmit();},saveAsCSV:function(){var a="../servlet/egurkha.reporter.SaveInCSVFormat?";if(Ext.isEmpty(appConstants.erUtils)){appConstants.erUtils=Ext.widget("erutils");}appConstants.erUtils.savePDF(a);},addTo:function(e){var a=this.getVirtualmachinesdetailsmainform().getForm();var n=this.validateForm();
if(n){var h=a.findField("er_timeline").getValue();var j="";var g;var k;var m=e.getId();this.updateQueryString("FavOrSchedule");var d=appConstants.publicJsonData["hiddenParams"];var c=d["fromFavoriteModify"];if((m!=null&&m=="scheduleImg")||(appConstants.fromSchModify!=null&&appConstants.fromSchModify=="Yes")){j="/final/reporter/ErSaveSchedule.jsp?isSchedule=true&"+appConstants.queryString+"&com.eg.CSRF_NONCE="+csrfToken;
if(appConstants.menuForVM=="true"){j+="&menuForVM=true";}if(m=="save"){j+="&showSchWindow=no";var f=j.substr(0,j.indexOf("?"));var b=j.substr(j.indexOf("?")+1,j.length-1);var i=Ext.create("Ext.form.Panel");i.submit({url:f,params:b,standardSubmit:true,method:"POST"});}else{if(appConstants.menuForVM=="true"){scheduleWindowFn(j);
}else{parent.scheduleWindowFn(j);}}}else{var d=appConstants.publicJsonData["hiddenParams"];var l=d["favorite_id"];j="../servlet/com.eg.ErFavoriteC?er_view=GRAPH&cmd=client&"+appConstants.queryString+"&er_RmDispName="+appConstants.er_RmDispName+"&com.eg.CSRF_NONCE="+csrfToken;if(appConstants.menuForVM=="true"){j+="&menuForVM=true";
}if(m=="save"){j+="&showSchWindow=no"+"&FavoriteId="+l;var f=j.substr(0,j.indexOf("?"));var b=j.substr(j.indexOf("?")+1,j.length-1);var i=Ext.create("Ext.form.Panel");i.submit({url:f,params:b,standardSubmit:true,method:"POST"});}else{if(appConstants.menuForVM=="true"){favouriteWindowFn(j);}else{parent.favouriteWindowFn(j);
}}}}},printReport:function(){var u=this.getVirtualmachinesdetailsmainform().getForm();var B=u.findField("selectionCombo").getValue();var C=u.findField("reportTypeCombo").getValue();var s=u.findField("compTypeCombo").getValue();var D=u.findField("virtualMachineCombo").getValue();var y=u.findField("virtualCenterCombo").getValue();
var f="er_type="+C+"&ervm_disp="+B+"&select_vm="+encodeURIComponent(D)+"&er_virtualcenter="+y;if(appConstants.isUserVmReport=="yes"){f+="&er_comptype="+appConstants.publicJsonData.selectedComptype+"&selectedCompType="+appConstants.publicJsonData.selectedComptype;}else{f+="&er_comptype="+s;}if(C!=null&&C=="Yes"){var d=u.findField("measure_group").getValue();
f=f+"&er_measure="+d;}var b=new Array();b=Ext.getCmp("er_component").getValue();if(appConstants.isUserVmReport=="yes"){b=appConstants.publicJsonData.selectedComponents;}for(var v=0;v<b.length;v++){f=f+"&er_component="+encodeURIComponent(b[v]);}var z=appConstants.publicJsonData.pageParams.Hourfrom;var c=appConstants.publicJsonData.pageParams.Minfrom;
var m=appConstants.publicJsonData.pageParams.Hourto;var k=appConstants.publicJsonData.pageParams.Minto;var w=appConstants.publicJsonData.pageParams["er_reportgenration"];var n=appConstants.publicJsonData["pageParams"]["selectedShowDataOption"];var r="No";if(isSettingsEnabled){settingsForm=this.getVirtualmachinesdetailssettings().getForm();
z=settingsForm.findField("timefrom").getValue();c=settingsForm.findField("minfrom").getValue();m=settingsForm.findField("timeto").getValue();k=settingsForm.findField("minto").getValue();w=settingsForm.findField("reportGeneration").getValue();n=settingsForm.findField("showDataCombo").getValue();r=settingsForm.findField("er_excwe").getValue();
}var A=u.findField("er_stdate").dataArray;var p=u.findField("er_enddate").dataArray;var t=new Date(Ext.Date.parse(A,mgrDateFormat));var a=new Date(Ext.Date.parse(p,mgrDateFormat));var x=Ext.Date.dateFormat(t,getExtjsDateFormat("dd-MM-yyyy"));var j=Ext.Date.dateFormat(a,getExtjsDateFormat("dd-MM-yyyy"));
var o=u.findField("er_sthr").dataArray;var e=u.findField("er_endhr").dataArray;var q=u.findField("er_timeline").getValue();if(Ext.isEmpty(q)){q="1 day";}var l=appConstants.publicJsonData["hiddenParams"];f=f+"&startdate="+encodeURIComponent(A)+"&enddate="+encodeURIComponent(p)+"&starthr="+encodeURIComponent(o)+"&endhr="+encodeURIComponent(e)+"&Hourto="+m+"&Minto="+k+"&er_excwe="+r+"&Hourfrom="+z+"&Minfrom="+c+"&er_reportgenration="+w+"&er_timeline="+encodeURIComponent(q);
f=f+"&er_trenddata="+n+"&pdfPrint=yes&"+"&sortduration="+encodeURIComponent(appConstants.publicJsonData["sortduration"])+"&startmin="+mgr_stmin+"&endmin="+mgr_enmin;if(Ext.getCmp("showLegend")!=undefined){var h=Ext.getCmp("showLegend").getValue();f=f+"&showLegend="+h;}var g="/final/reporter/ErVMDetailsPrint.jsp?"+f+"&isOnlyVMAssigned="+appConstants.publicJsonData.hiddenParams.isOnlyVMAssigned;
if(appConstants.menuForVM=="true"){printWindowFn(g);}else{parent.printWindowFn(g);}},savePdf:function(){var t=this.getVirtualmachinesdetailsmainform().getForm();var A=t.findField("selectionCombo").getValue();var B=t.findField("reportTypeCombo").getValue();var r=t.findField("compTypeCombo").getValue();
var C=t.findField("virtualMachineCombo").getValue();var x=t.findField("virtualCenterCombo").getValue();var f="er_type="+B+"&ervm_disp="+A+"&select_vm="+encodeURIComponent(C)+"&er_virtualcenter="+x;if(appConstants.isUserVmReport=="yes"){f+="&er_comptype="+appConstants.publicJsonData.selectedComptype+"&selectedCompType="+appConstants.publicJsonData.selectedComptype;
}else{f+="&er_comptype="+r;}if(B!=null&&B=="Yes"){var d=t.findField("measure_group").getValue();f=f+"&er_measure="+d;}var b=new Array();b=Ext.getCmp("er_component").getValue();if(appConstants.isUserVmReport=="yes"){b=appConstants.publicJsonData.selectedComponents;}for(var u=0;u<b.length;u++){f=f+"&er_component="+encodeURIComponent(b[u]);
}var y=appConstants.publicJsonData.pageParams.Hourfrom;var c=appConstants.publicJsonData.pageParams.Minfrom;var l=appConstants.publicJsonData.pageParams.Hourto;var k=appConstants.publicJsonData.pageParams.Minto;var v=appConstants.publicJsonData.pageParams["er_reportgenration"];var m=appConstants.publicJsonData["pageParams"]["selectedShowDataOption"];
var q="No";if(isSettingsEnabled){settingsForm=this.getVirtualmachinesdetailssettings().getForm();y=settingsForm.findField("timefrom").getValue();c=settingsForm.findField("minfrom").getValue();l=settingsForm.findField("timeto").getValue();k=settingsForm.findField("minto").getValue();v=settingsForm.findField("reportGeneration").getValue();
m=settingsForm.findField("showDataCombo").getValue();q=settingsForm.findField("er_excwe").getValue();}var z=t.findField("er_stdate").dataArray;var o=t.findField("er_enddate").dataArray;var s=new Date(Ext.Date.parse(z,mgrDateFormat));var a=new Date(Ext.Date.parse(o,mgrDateFormat));var w=Ext.Date.dateFormat(s,getExtjsDateFormat("dd-MM-yyyy"));
var j=Ext.Date.dateFormat(a,getExtjsDateFormat("dd-MM-yyyy"));var n=t.findField("er_sthr").dataArray;var e=t.findField("er_endhr").dataArray;var p=t.findField("er_timeline").getValue();if(Ext.isEmpty(p)){p="1 day";}f=f+"&startdate="+encodeURIComponent(z)+"&enddate="+encodeURIComponent(o)+"&starthr="+encodeURIComponent(n)+"&endhr="+encodeURIComponent(e)+"&Hourto="+l+"&Minto="+k+"&er_excwe="+q+"&Hourfrom="+y+"&Minfrom="+c+"&er_reportgenration="+v+"&er_timeline="+encodeURIComponent(p);
f=f+"&er_trenddata="+m+"&sortduration="+encodeURIComponent(appConstants.publicJsonData["sortduration"])+"&startmin="+mgr_stmin+"&endmin="+mgr_enmin;if(Ext.getCmp("showLegend")!=undefined){var h=Ext.getCmp("showLegend").getValue();f=f+"&showLegend="+h;}var g="../reporter/ErHtmlToSavePdf.jsp?"+f+"&inidate="+iniDateFormat+"&isOnlyVMAssigned="+appConstants.publicJsonData.hiddenParams.isOnlyVMAssigned;
if(Ext.isEmpty(appConstants.erUtils)){appConstants.erUtils=Ext.widget("erutils");}appConstants.erUtils.savePDF(g);},bookletQuery:function(n){var u=this.getVirtualmachinesdetailsmainform().getForm();var B=u.findField("selectionCombo").getValue();var C=u.findField("reportTypeCombo").getValue();var s=u.findField("compTypeCombo").getValue();
var D=u.findField("virtualMachineCombo").getValue();var y=u.findField("virtualCenterCombo").getValue();var f="er_type="+C+"&ervm_disp="+B+"&select_vm="+encodeURIComponent(D)+"&er_virtualcenter="+y;if(appConstants.isUserVmReport=="yes"){f+="&er_comptype="+appConstants.publicJsonData.selectedComptype+"&selectedCompType="+appConstants.publicJsonData.selectedComptype;
}else{f+="&er_comptype="+s;}if(C!=null&&C=="Yes"){var d=u.findField("measure_group").getValue();f=f+"&er_measure="+d;}var b=new Array();b=Ext.getCmp("er_component").getValue();if(appConstants.isUserVmReport=="yes"){b=appConstants.publicJsonData.selectedComponents;}for(var v=0;v<b.length;v++){f=f+"&er_component="+encodeURIComponent(b[v]);
}if(Ext.getCmp("showLegend")!=undefined){var j=Ext.getCmp("showLegend").getValue();f=f+"&showLegend="+j;}var z=appConstants.publicJsonData.pageParams.Hourfrom;var c=appConstants.publicJsonData.pageParams.Minfrom;var m=appConstants.publicJsonData.pageParams.Hourto;var k=appConstants.publicJsonData.pageParams.Minto;
var w=appConstants.publicJsonData.pageParams["er_reportgenration"];var l=appConstants.publicJsonData["pageParams"]["selectedShowDataOption"];var r="No";if(isSettingsEnabled){settingsForm=this.getVirtualmachinesdetailssettings().getForm();z=settingsForm.findField("timefrom").getValue();c=settingsForm.findField("minfrom").getValue();
m=settingsForm.findField("timeto").getValue();k=settingsForm.findField("minto").getValue();w=settingsForm.findField("reportGeneration").getValue();l=settingsForm.findField("showDataCombo").getValue();r=settingsForm.findField("er_excwe").getValue();}var A=u.findField("er_stdate").dataArray;var p=u.findField("er_enddate").dataArray;
var t=new Date(Ext.Date.parse(A,mgrDateFormat));var a=new Date(Ext.Date.parse(p,mgrDateFormat));var x=Ext.Date.dateFormat(t,getExtjsDateFormat("dd-MM-yyyy"));var h=Ext.Date.dateFormat(a,getExtjsDateFormat("dd-MM-yyyy"));var o=u.findField("er_sthr").dataArray;var e=u.findField("er_endhr").dataArray;var q=u.findField("er_timeline").getValue();
if(Ext.isEmpty(q)){q="1 day";}f=f+"&startdate="+encodeURIComponent(A)+"&enddate="+encodeURIComponent(p)+"&starthr="+encodeURIComponent(o)+"&endhr="+encodeURIComponent(e)+"&Hourto="+m+"&Minto="+k+"&er_excwe="+r+"&Hourfrom="+z+"&Minfrom="+c+"&er_reportgenration="+w+"&er_timeline="+encodeURIComponent(q);
f=f+"&er_trenddata="+l+"&sortduration="+encodeURIComponent(appConstants.publicJsonData["sortduration"])+"&startmin="+mgr_stmin+"&endmin="+mgr_enmin;var g=f+"&inidate="+iniDateFormat+"&isOnlyVMAssigned="+appConstants.publicJsonData.hiddenParams.isOnlyVMAssigned;return g;},bookletScheduleQuery:function(b){var a=appConstants.queryString;
return a;},bookletPreview:function(){this.printReport();},validateAndCloseSettings:function(){var l=this.getVirtualmachinesdetailsmainform().getForm();var j=this.getVirtualmachinesdetailssettings().getForm();var q=j.findField("timefrom").getValue();var a=j.findField("minfrom").getValue();var h=j.findField("timeto").getValue();
var g=j.findField("minto").getValue();var p=l.findField("er_stdate").getValue();var f=l.findField("er_enddate").getValue();p.setHours(l.findField("er_sthr").getValue());f.setHours(l.findField("er_endhr").getValue());if(!checkTimePeriod(q,a,h,g)){return;}var i=l.findField("er_timeline").getValue();if(Ext.isEmpty(i)){i="1 day";
}var o=j.findField("reportGeneration").getValue();var e=appConstants.publicJsonData["hiddenParams"]["getMaxDaysInMonth"];var k="";if(!Ext.isEmpty(e)){k=e;}var r="";var c=appConstants.publicJsonData["hiddenParams"]["er_usertimeline"];if(!Ext.isEmpty(c)){r=c;}if(r!=null&&r!="-1"){if(!isUserTimelineLimitExceeded(r,k,p,f)){return false;
}}var n=true;if(o=="background"||o=="background-csv"){var b=j.findField("bgReportName");var m=b.getValue();if(!validateTextBoxWithSpecialChars(m,"Attachment",true)){b.focus();return false;}}if(n){var d=Ext.getCmp("submit");d.setDisabled(false);Ext.get("configMod").animate({duration:500,to:{y:-500}});
}return n;},showResult:function(c){if(c=="yes"){var a=Ext.getCmp("submit");a.setDisabled(false);if(Ext.get("configMod")!=null){Ext.get("configMod").animate({duration:250,to:{y:-530}});}this.submitReport();}else{this.getReporterSettings().down("button").fireHandler();var d=this.getVirtualmachinesdetailssettings().getForm();
d.findField("reportGeneration").setValue("background");var b=d.findField("bgReportName");b.show();b.focus(false,1000);b.setValue("");Ext.getCmp("submitViaSetting").show();Ext.getCmp("moreOptionCloseId").hide();validateTextBoxWithSpecialChars(b.getValue(),"Attachment",true);return false;}},disableTools:function(){Ext.getCmp("saveTool").setDisabled(true);
Ext.getCmp("bookletTool").setDisabled(true);Ext.getCmp("printTool").setDisabled(true);Ext.getCmp("mailTool").setDisabled(true);Ext.getCmp("csvTool").setDisabled(true);},getTrendTimeLineOnChange:function(e){var a=this.getVirtualmachinesdetailsmainform().getForm();var f=a.findField("er_timeline").getValue();
var i=e.getValue();var m=this;var f=Ext.getCmp("er_timeline").getValue();var b="true";if(b=="true"){var c="F=gettimeline&U=123444&C=jsrs1&P0=["+i+"]";Ext.Ajax.request({url:"/final/servlet/com.eg.ErRemoteScriptingServlet",params:c,scope:this,async:true,success:function(r){var v=r.responseText;var t=Ext.decode(v);
var p=t.combo;var u=t.combo;var o=Ext.getCmp("er_timeline");o.getStore().removeAll();o.getStore().loadRawData(t.combo);var q=false;for(var s=0;s<p.length;s++){if(p[s].valueField==f){q=true;}}if(q){o.setValue(f);}else{o.setValue("1 day");}}});var d=Ext.getCmp("er_timeline").getValue();var h=Ext.getCmp("er_stdate").dataArray;
var l=Ext.getCmp("er_enddate").dataArray;var k=Ext.getCmp("er_sthr").dataArray;var n=Ext.getCmp("er_endhr").dataArray;var j=appConstants.publicJsonData["hiddenParams"]["inidate"];if(d=="Any"){Ext.getCmp("er_stdate").setDisabled(false);Ext.getCmp("er_enddate").setDisabled(false);Ext.getCmp("er_sthr").setDisabled(false);
Ext.getCmp("er_endhr").setDisabled(false);}else{Ext.getCmp("er_stdate").setDisabled(true);Ext.getCmp("er_enddate").setDisabled(true);Ext.getCmp("er_sthr").setDisabled(true);Ext.getCmp("er_endhr").setDisabled(true);}var g="";if(i=="No"){isTrend=false;g="F=getTime&U=123444&C=jsrs1&P0=["+d+"]&P1=["+h+"]&P2=["+l+"]&P3=["+k+"]&P4=["+n+"]&P5=["+j+"]";
}else{isTrend=true;if(d=="Any"){g="F=getTime&U=123444&C=jsrs1&P0=["+d+"]&P1=["+h+"]&P2=["+l+"]&P3=["+k+"]&P4=["+n+"]&P5=["+j+"]";}else{g="F=getTrendTime&U=123444&C=jsrs1&P0=["+d+"]&P1=["+h+"]&P2=["+l+"]&P3=["+k+"]&P4=["+n+"]&P5=["+mgr_stmin+"]&P6=["+mgr_enmin+"]&P7=["+j+"]";}}Ext.Ajax.request({url:"/final/servlet/com.eg.ErRemoteScriptingServlet",params:g,scope:this,async:true,success:function(p){var r=p.responseText;
var q=Ext.decode(r);var o=q.timeline;Ext.getCmp("er_stdate").dataArray=o[0];Ext.getCmp("er_enddate").dataArray=o[1];Ext.getCmp("er_sthr").dataArray=o[2];Ext.getCmp("er_endhr").dataArray=o[3];mgr_stmin=o[4];mgr_enmin=o[5];Ext.getCmp("er_stdate").setValue(o[6]);Ext.getCmp("er_enddate").setValue(o[7]);Ext.getCmp("er_sthr").setValue(o[8]);
Ext.getCmp("er_endhr").setValue(o[9]);stmin=o[10];enmin=o[11];}});}},callRemoteScript:function(c,g,a,d,e){var b=this;var f="F="+e+"&C=jsrs1"+d+"&debug=true&U="+new Date().getTime()+"&fromajax=true";if(g=="statustCombo"){f=f+"&statusCombo=true";}Ext.Ajax.request({url:a,method:"POST",async:false,params:f,success:function(i){if(i.status==200&&!Ext.isEmpty(i.responseText)){var l=i.responseText;
var j=Ext.decode(l);var h=j["combo"];if(!Ext.isEmpty(h)){var k=c.findField(g).getStore();k.loadRawData(h);if(k.getCount()>1){k.insert(0,{"displayField":allOptionMsg,"valueField":"-1"});c.findField(g).setValue("-1");}else{c.findField(g).setValue(h[0]["valueField"]);}}else{c.findField(g).setValue(appConstants.notApplicableLbl);
}}}});},expandMe:function(a){if(Ext.isEmpty(appConstants.erUtils)){appConstants.erUtils=Ext.widget("erutils");}appConstants.erUtils.expandMultiComboButton(Ext.getCmp("er_component"),"Physical Servers",a);},validateForm:function(){var a=this.getVirtualmachinesdetailsmainform().getForm();var j=a.findField("selectionCombo").getValue();
var f=a.findField("reportTypeCombo").getValue();var c=a.findField("compTypeCombo").getValue();var b=a.findField("virtualMachineCombo").getValue();var l=a.findField("virtualCenterCombo").getValue();if(f!=null&&f=="Yes"){var k=a.findField("measure_group").getValue();if(k!=null&&(k=="Not Applicable"||k=="-1")){Ext.MessageBox.show({title:"Alert",msg:appConstants.invalidMeasureGrpMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});
return false;}}if(j!=null&&j=="Not Applicable"){Ext.MessageBox.show({title:"Alert",msg:appConstants.invalidSelectionMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});return false;}if(f!=null&&f=="Not Applicable"){Ext.MessageBox.show({title:"Alert",msg:appConstants.invalidReportTypeMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});
return false;}if(c!=null&&(c=="Not Applicable"||c=="-1")&&appConstants.isUserVmReport!="yes"){Ext.MessageBox.show({title:"Alert",msg:appConstants.invalidCompTypeMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});return false;}if(b!=null&&(b=="Not Applicable"||b=="-1")){Ext.MessageBox.show({title:"Alert",msg:appConstants.invalidVmMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});
return false;}if(l!=null&&(l=="Not Applicable"||l=="-1")){Ext.MessageBox.show({title:"Alert",msg:appConstants.invalidVcMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});return false;}var d="";var g=new Array();g=Ext.getCmp("er_component").getValue();var h="";if(g!=null&&(g!=""&&g!="null")){for(var e=0;
e<g.length;e++){d+=g[e];}}d=d.substring(0,d.length-1);if(d!=null&&(d=="-1"||d=="")&&appConstants.isUserVmReport!="yes"&&c!="Virtual_Machine"){Ext.MessageBox.show({title:"Alert",msg:appConstants.invalidComponentMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});return false;}return true;},beforeReportSubmit:function(){Ext.getCmp("panelinsidetoggle").setDisabled(false);
var h=Ext.getCmp("er_stdate").getValue();var j=Ext.getCmp("er_sthr").getValue();h.setHours(j);var b=Ext.getCmp("er_enddate").getValue();var a=Ext.getCmp("er_endhr").getValue();b.setHours(a);var k=checkDateTime(h,b);if(!k){return;}var f=this.validateForm();if(f){var g=appConstants.publicJsonData["hiddenParams"]["fromSchedule"];
if(g!=null&&g=="Yes"){this.addTo(Ext.getCmp("scheduleImg"),null,null);}else{var d=appConstants.publicJsonData.pageParams["er_reportgenration"];if(isSettingsEnabled){d=Ext.getCmp("reportGeneration").getValue();}if(d!=null&&d=="foreground"){var e=appConstants.publicJsonData["hiddenParams"]["limitforbg"];
if(!Ext.isEmpty(e)){var i=appConstants.publicJsonData["hiddenParams"]["getMaxDaysInMonth"];var c="";if(!Ext.isEmpty(i)){c=i;}if(!checkTimeLineForBgLimit(e,c,h,b)){Ext.MessageBox.confirm("Confirm",appConstants.forGrdReportConfirmMsg,this.showResult,this);}else{this.submitReport();}}else{this.submitReport();
}}else{this.submitReport();}}}},submitReport:function(g){var a=this.getVirtualmachinesdetailsmainform().getForm();var c=a.findField("reportTypeCombo").getValue();if(c=="Yes"){Ext.getCmp("showLegend").show();}var f=appConstants.publicJsonData.pageParams["er_reportgenration"];var e;if(isSettingsEnabled){e=this.getVirtualmachinesdetailssettings().getForm();
f=Ext.getCmp("reportGeneration").getValue();}var b=this;if(f!=null&&(f=="background"||f=="background-csv")){var d=e.findField("bgReportName");var h=d.getValue();if(!validateTextBox(h)){this.showResult();}}this.updateQueryString("submit");if(f!=null&&f=="foreground"){appConstants.queryString=appConstants.queryString+"&responseType=json&screenWidth="+(Ext.getBody().getViewSize().width)+"&screenHeight="+(Ext.getBody().getViewSize().height);
}appConstants.queryString+="&er_RmDispName="+appConstants.er_RmDispName;appConstants.initLdgMask.show();Ext.Ajax.request({url:appConstants.urlForSubmit,params:appConstants.queryString,timeout:180000,scope:this,success:function(i){var k=i.responseText;if(!Ext.isEmpty(k)){appConstants.initLdgMask.hide();
var j=Ext.decode(k);appConstants.publicJsonData=j;b.loadVmDetailsReportData(j);}}});},loadVmDetailsReportData:function(ax){var O=this;var t=appConstants.publicJsonData.pageParams["er_reportgenration"];if(isSettingsEnabled){t=Ext.getCmp("reportGeneration").getValue();}var ap=Ext.getCmp("resultPanel");
var ar=Ext.getCmp("resultCont");ap.removeAll();ar.removeAll();ap.hide();ar.hide();this.getNomeasurepanel().hide();this.getBackGroundPanel().hide();if(t!=null&&(t=="background"||t=="background-csv")){Ext.getCmp("saveTool").setDisabled(false);Ext.getCmp("bookletTool").setDisabled(false);Ext.getCmp("printTool").setDisabled(false);
Ext.getCmp("mailTool").setDisabled(false);Ext.getCmp("csvTool").setDisabled(false);var I=ax.pageParams["bggroundStr"];var J=ax.pageParams["status"];var aa=ax.pageParams["bgLangSupportStr"];var at=ax.pageParams["bgLinkUrl"];var j=ax.pageParams["bgLinkMsg"];var m="";var aF="iconSuccess";if(J!=null&&(J=="duplicate"||J=="exceedLimit")){aF="iconExclamation";
}var am='<table border="0px" width="100%" height="100%"><tr><td align="center" valign="middle"><table style="width:480px;"border="0px"><tr><td><div style="margin:0px 10px 0px 0px;display:block;width:32px;height:32px;float:right;" class="'+aF+'"></div></td><td><div style="line-height:1.5em" class="font_bold11">'+aa+".</br>"+'<a class="backgroundMsgLink" href='+at+">"+j+"</a></div></td></tr></table></td></tr></table>";
this.getBackGroundPanel().update(am);this.getBackGroundPanel().show();}else{var C=ax["dataAvailable"];if(C!=null&&C=="true"){Ext.getCmp("selectionDetails").setSelectionDetailsData(ax.selDetailsJson);var E=ax["pageParams"]["er_type"];if(E!=null&&E=="Yes"){var l=ax["pageParams"]["showUtilities"];ar.hide();
if(l!=null&&l=="Yes"){Ext.getCmp("saveTool").setDisabled(false);Ext.getCmp("bookletTool").setDisabled(false);Ext.getCmp("printTool").setDisabled(false);Ext.getCmp("mailTool").setDisabled(false);Ext.getCmp("csvTool").setDisabled(true);}else{Ext.getCmp("saveTool").setDisabled(true);Ext.getCmp("bookletTool").setDisabled(true);
Ext.getCmp("printTool").setDisabled(true);Ext.getCmp("mailTool").setDisabled(true);Ext.getCmp("csvTool").setDisabled(true);}var ad=ax["graphJsonObj"];var B=ad["graphMainTitle"];ap.setTitle(B);var aD=new Array();var e=ad["graphsObj"];var q=ax["chartType"];var an=new Array();var h=new Array();var ak=new Array();
var w=new Array();var Z=new Array();var y='<div  style="width:100%"><table width="100%" border="0" class="htmlGraphTable"><col width="50%"><col width="50%"><tr>';var z=0;for(var Q in e){var d=false;var R=e[Q];var ae=R["graphUrl"];var u=R["graphCsvUrl"];var ay=R["graphDataUrl"];var L=R["graphDrillDownUrl"];
var H=R["graphHeight"];var k=R["graphWidth"];var W=R["graphTitle"];var p=R["graphTitleToolTip"];w.push(ae);if(z==2){z=0;y+="</tr>";y+="<tr>";}if(Q==0){if(e.length>2){y+='<td style="padding:0px 5px 5px 10px">';}else{if(e.length==2){y+='<td style="padding:0px 5px 10px 10px">';}else{y+='<td style="padding:0px 10px 10px 10px">';
}}}else{if(Q==1){if(e.length>2){y+='<td style="padding:0px 10px 5px 5px">';}else{y+='<td style="padding:0px 10px 10px 5px">';}}else{if((Q%2)==0){if(Q==e.length-1){d=true;y+='<td style="padding:5px 5px 10px 10px">';}else{if(Q==e.length-2){y+='<td style="padding:5px 5px 10px 10px">';}else{y+='<td style="padding:5px 5px 5px 10px">';
}}}else{if((Q%2)!=0){if(Q==e.length-1){y+='<td style="padding:5px 10px 10px 5px">';}else{y+='<td style="padding:5px 10px 5px 5px">';}}}}}y+='<div width="100%" class="graphMainDiv">';y+='<div class="htmlGraphTableHeader"><div style="float:left;width:75%" >';y+=W;y+="</div>";y+='<div style="float:right;margin:3px 0px 4px 5px">';
y+='<div style="float:right;cursor:pointer;margin:0px 0px 0px 5px;" class="iconMaximize" onclick="javascript:loadUrlInDrillDown(\''+L+"');\"></div>";y+='<div style="float:right;cursor:pointer;margin:0px 5px 0px 5px;" class="iconCsv" onclick="javascript:loadCSVWindow(\''+u+"');\"></div>";y+='<div style="float:right;cursor:pointer;margin:0px 5px 0px 5px;" class="iconData" onclick="javascript:loadDataWindow(\''+ay+"');\"></div>";
y+="</div></div>";y+='<div class="headerBottomBorder"></div>';var r="img_"+Q;Z.push(r);y+='<div id="'+r+'" style="height:225px" class="htmlGraphTableBody showDiv" >';if(q!="highchart"){y+='<img src="'+ae+'"></img>';}y+="</div>";y+='<div style="height:60px;margin-right: 10px;" id="commonLeg_'+r+'" class="showDiv commonLeg">';
y+='<div id="'+r+'_legend" style="height:55px;width:100%;overflow:hidden;display:inline-block; vertical-align: middle;" class="showDiv">';y+="</div></div>";y+="</div></td>";if(d){y+='<td style="padding:5px 10px 10px 5px;">&nbsp;</td>';}z++;}if(z==2){y+="</tr>";}y+="</table></div>";ap.add({columnWidth:1,cls:"newChk",html:y,listeners:{boxready:function(){var g=Ext.getCmp("showLegend").getValue();
if(g=="false"||g==false){var aJ=document.getElementsByClassName("commonLeg");for(var aI=0;aI<aJ.length;aI++){var aH=aJ[aI].id;var v=document.getElementById(aH);if(v!=null&&v!=undefined){v.className=v.className.replace("showDiv","hideDiv");}}}}}});if(q=="highchart"){for(var X in w){reportHighStockChart(w[X]+"&chartType="+q,Z[X],"","","");
}}ap.doLayout();ap.show();}else{ar.show();var l=ax["pageParams"]["showUtilities"];if(l!=null&&l=="Yes"){Ext.getCmp("saveTool").setDisabled(false);Ext.getCmp("bookletTool").setDisabled(false);Ext.getCmp("printTool").setDisabled(false);Ext.getCmp("mailTool").setDisabled(false);Ext.getCmp("csvTool").setDisabled(false);
}else{Ext.getCmp("saveTool").setDisabled(true);Ext.getCmp("bookletTool").setDisabled(true);Ext.getCmp("printTool").setDisabled(true);Ext.getCmp("mailTool").setDisabled(true);Ext.getCmp("csvTool").setDisabled(true);}var aB=ax["gridJson"];if(!Ext.isEmpty(aB)){var c=new Array();for(var af in aB){var o=aB[af];
var V=o["gridTitle"];var a=o["gridColumns"];var aA=o["columnCount"];var Y=o["gridData"];var aw=0;for(var G in Y[0]){if(G.indexOf("_LINK")==-1){aw++;}}var al=0;var aC=new Array();var A=new Array();var b=0.2;var N=100;var n="";if(aA!=null&&aA==2){b=0.5;N=600;}if(aA!=null&&aA<=5){for(var X in a){var av=X;
if(av!=null&&av=="COLUMN_0"){A.push("DATAIND_0");if(appConstants.isUserVmReport!="yes"){A.push("DATAIND_0_LINK");}var T=a[X];aC.push({header:"<div class="+T+"></div>",sortable:false,dataIndex:"DATAIND_0",renderer:function(aI,i,g,aL,aH,v,aK){var aJ=g.get("DATAIND_"+aH+"_LINK");i.tdAttr='data-qclass=yellowTip data-qtip="'+aI+'"';
if(aJ!=null&&aJ!="undefined"&&aJ!="-"){aI='<a class="anchorLinkDefault" href="'+aJ+'">'+aI+"</a>";}return aI;},doSort:function(i){var g=this.up("grid").store;var v=this.getSortParam();g.sort({property:v,direction:i,sorterFn:function(aI,aH){if(aI.index==0){return;}aI=aI.get(v);aH=aH.get(v);aI=Ext.isNumber(aI)?aI:parseFloat(String(aI),10);
aI=isNaN(aI)?0:aI;aH=Ext.isNumber(aH)?aH:parseFloat(String(aH),10);aH=isNaN(aH)?0:aH;return aI>aH?1:(aI<aH?-1:0);}});}});al++;}else{var s=a[av];var az=s["Column_Name"];var x=s["Unit"];var ag=s["subColumnsLevel2"];var ah=new Array();var aj=new Array();var S="";var P=0;var ab=az;var ai=ab.split(" ");var f=0;
for(P=0;P<ai.length;P++){f=f+ai[P].length;if(f>16){S=S+" <br />";f=0;}S=S+" "+ai[P];az=S;}if(!Ext.isEmpty(ag)&&ag!="-"){for(var ao in ag){var U=ag[ao];aC.push({header:az+"<br/>"+U+"  "+x,sortable:true,dataIndex:"DATAIND_"+al,align:"center",renderer:function(aI,i,g,aL,aH,v,aK){i.tdAttr='data-qclass=yellowTip data-qtip="'+aI+'"';
var aJ=g.get("DATAIND_"+aH+"_LINK");if(aJ!=null&&aJ!="undefined"&&aJ!="-"&&aJ!=""){aI='<a href="javascript:void(0);" onclick="javascript:openNew(\''+aJ+"')\">"+Ext.getCmp("gridId"+af).getDecimalAlignFormat(aI,true)+"</a>";}aI=Ext.getCmp("gridId"+af).getDecimalAlignFormat(aI);return aI;},doSort:function(i){var g=this.up("grid").store;
var v=this.getSortParam();g.sort({property:v,direction:i,sorterFn:function(aI,aH){if(aI.index==0){return;}aI=aI.get(v);aH=aH.get(v);aI=Ext.isNumber(aI)?aI:parseFloat(String(aI),10);aI=isNaN(aI)?0:aI;aH=Ext.isNumber(aH)?aH:parseFloat(String(aH),10);aH=isNaN(aH)?0:aH;return aI>aH?1:(aI<aH?-1:0);}});}});
A.push("DATAIND_"+al);A.push("DATAIND_"+al+"_LINK");al++;}}else{A.push("DATAIND_"+al+"_LINK");A.push("DATAIND_"+al);aC.push({header:az+"<br/>"+"  "+x,sortable:true,dataIndex:"DATAIND_"+al,renderer:function(aI,i,g,aL,aH,v,aK){i.tdAttr='data-qclass=yellowTip data-qtip="'+aI+'"';var aJ=g.get("DATAIND_"+aH+"_LINK");
if(aJ!=null&&aJ!="undefined"&&aJ!="-"&&aJ!=""){aI='<a  href="javascript:void(0);" onclick="javascript:openNew(\''+aJ+"')\">"+Ext.getCmp("gridId"+af).getDecimalAlignFormat(aI,true)+"</a>";}aI=Ext.getCmp("gridId"+af).getDecimalAlignFormat(aI);return aI;},doSort:function(i){var g=this.up("grid").store;var v=this.getSortParam();
g.sort({property:v,direction:i,sorterFn:function(aI,aH){if(aI.index==0){return;}aI=aI.get(v);aH=aH.get(v);return aI>aH?1:(aI<aH?-1:0);}});},});al++;}}}}else{for(var X in a){var av=X;if(av!=null&&av=="COLUMN_0"){A.push("DATAIND_0");A.push("DATAIND_0_LINK");var T=a[X];aC.push({header:"<div class="+T+"></div>",sortable:false,locked:true,dataIndex:"DATAIND_0",renderer:function(aI,i,g,aL,aH,v,aK){var aJ=g.get("DATAIND_"+aH+"_LINK");
i.tdAttr='data-qclass=yellowTip data-qtip="'+aI+'"';if(aJ!=null&&aJ!="undefined"&&aJ!="-"){aI='<a class="anchorLinkDefault" href="'+aJ+'">'+aI+"</a>";}return aI;},doSort:function(i){var g=this.up("grid").store;var v=this.getSortParam();g.sort({property:v,direction:i,sorterFn:function(aI,aH){if(aI.index==0){return;
}aI=aI.get(v);aH=aH.get(v);aI=Ext.isNumber(aI)?aI:parseFloat(String(aI),10);aI=isNaN(aI)?0:aI;aH=Ext.isNumber(aH)?aH:parseFloat(String(aH),10);aH=isNaN(aH)?0:aH;return aI>aH?1:(aI<aH?-1:0);}});}});al++;}else{var s=a[av];var az=s["Column_Name"];var x=s["Unit"];var ag=s["subColumnsLevel2"];var ah=new Array();
var aj=new Array();if(!Ext.isEmpty(ag)&&ag!="-"){for(var ao in ag){var U=ag[ao];aj.push({header:U+"  "+x,sortable:true,dataIndex:"DATAIND_"+al,align:"center",renderer:function(aI,i,g,aL,aH,v,aK){i.tdAttr='data-qclass=yellowTip data-qtip="'+aI+'"';var aJ=g.get("DATAIND_"+aH+"_LINK");if(aJ!=null&&aJ!="undefined"&&aJ!="-"&&aJ!=""){aI='<a href="javascript:void(0);" onclick="javascript:openNew(\''+aJ+"')\">"+Ext.getCmp("gridId"+af).getDecimalAlignFormat(aI,true)+"</a>";
}aI=Ext.getCmp("gridId"+af).getDecimalAlignFormat(aI);return aI;},doSort:function(i){var g=this.up("grid").store;var v=this.getSortParam();g.sort({property:v,direction:i,sorterFn:function(aI,aH){if(aI.index==0){return;}aI=aI.get(v);aH=aH.get(v);aI=Ext.isNumber(aI)?aI:parseFloat(String(aI),10);aI=isNaN(aI)?0:aI;
aH=Ext.isNumber(aH)?aH:parseFloat(String(aH),10);aH=isNaN(aH)?0:aH;return aI>aH?1:(aI<aH?-1:0);}});}});A.push("DATAIND_"+al);A.push("DATAIND_"+al+"_LINK");al++;}}else{A.push("DATAIND_"+al+"_LINK");A.push("DATAIND_"+al);aj.push({header:x,sortable:true,dataIndex:"DATAIND_"+al,renderer:function(aI,i,g,aL,aH,v,aK){i.tdAttr='data-qclass=yellowTip data-qtip="'+aI+'"';
var aJ=g.get("DATAIND_"+aH+"_LINK");if(aJ!=null&&aJ!="undefined"&&aJ!="-"&&aJ!=""){aI='<a href="javascript:void(0);" onclick="javascript:openNew(\''+aJ+"')\">"+Ext.getCmp("gridId"+af).getDecimalAlignFormat(aI,true)+"</a>";}aI=Ext.getCmp("gridId"+af).getDecimalAlignFormat(aI);return aI;},doSort:function(i){var g=this.up("grid").store;
var v=this.getSortParam();g.sort({property:v,direction:i,sorterFn:function(aI,aH){if(aI.index==0){return;}aI=aI.get(v);aH=aH.get(v);return aI>aH?1:(aI<aH?-1:0);}});},});al++;}aC.push({header:az,locked:false,sortable:true,columns:aj});}}}var aq=new Ext.data.Store({fields:A,data:Y});marginVal="0 0 10 0";
var F=Ext.widget("customgrid",{store:aq,border:true,dispDataCount:aw,title:V,frame:false,id:"gridId"+af,forceFit:true,padding:"0 10 10 10",needtoFixColumn:true,margin:marginVal,popUpData:"noToolTip",ui:"newGridPanel withHeader",columns:aC,forceFitColsCount:9,viewConfig:{getRowClass:function(g,aH,v,i){if(aH==0){return"firstRowClass";
}}},listeners:{sortchange:function(i,v,aH,g){O.gridColIndexParam=v.getIndex();O.gridColStateParam=v.sortState;}},});c.push(F);}ar.add(c);ar.doLayout();}var ac=ax["pageParams"]["ervm_disp"];if((ac!=null&&ac=="true")||(ac!=null&&ac=="Yes")){var o=ax["gridObj"];if(o!=undefined){var V=o["gridTitle"];var D=o["columns"];
var Y=o["gridData"];var aw=0;for(var G in Y[0]){if(G.indexOf("_LINK")==-1){aw++;}}var K=0;var aC=new Array();var A=new Array();var b=0.2;var N=100;var aE=D["ColumnName"];var au=D["Unit"];for(var X in aE){var av=X;if(av!=null&&av=="COLUMN_0"){var x=au[av+"_SUBCOLUMN"];var az=aE[av];var ah=new Array();
A.push("COLUMN_0");A.push("COLUMN_0_URL");var T=D[X];aC.push({header:"<div class=vmotion></div>",sortable:true,dataIndex:"COLUMN_"+K,renderer:function(aI,i,g,aL,aH,v,aK){var aJ=g.get("COLUMN_"+aH+"_URL");if(aJ!=null&&aJ!="undefined"&&aJ!="-"){aI='<a class="anchorLinkDefault" href="'+aJ+'">'+aI+"</a>";
}return aI;},doSort:function(i){var g=this.up("grid").store;var v=this.getSortParam();g.sort({property:v,direction:i,sorterFn:function(aI,aH){if(aI.index==0){return;}aI=aI.get(v);aH=aH.get(v);aI=Ext.isNumber(aI)?aI:parseFloat(String(aI),10);aI=isNaN(aI)?0:aI;aH=Ext.isNumber(aH)?aH:parseFloat(String(aH),10);
aH=isNaN(aH)?0:aH;return aI>aH?1:(aI<aH?-1:0);}});}});K++;}else{var M=new Array();var ag=aE[av];var aG=au[av+"_SUBCOLUMN"];aC.push({header:ag+" <br /> "+aG,sortable:true,dataIndex:"COLUMN_"+K,align:"center",doSort:function(i){var g=this.up("grid").store;var v=this.getSortParam();g.sort({property:v,direction:i,sorterFn:function(aI,aH){if(aI.index==0){return;
}aI=aI.get(v);aH=aH.get(v);aI=Ext.isNumber(aI)?aI:parseFloat(String(aI),10);aI=isNaN(aI)?0:aI;aH=Ext.isNumber(aH)?aH:parseFloat(String(aH),10);aH=isNaN(aH)?0:aH;return aI>aH?1:(aI<aH?-1:0);}});},renderer:function(g){g=Ext.getCmp("gridId_1").getDecimalAlignFormat(g);return g;}});A.push("COLUMN_"+K);A.push("COLUMN_"+K+"_URL");
K++;}}var aq=new Ext.data.Store({fields:A,data:Y});var F=Ext.widget("customgrid",{store:aq,title:V,frame:false,id:"gridId_1",border:true,dispDataCount:aw,needtoFixColumn:true,ui:"newGridPanel withHeader",stripeRows:false,columns:aC,forceFitColsCount:9,listeners:{sortchange:function(i,v,aH,g){O.gridColIndexParam=v.getIndex();
O.gridColStateParam=v.sortState;}}});ar.add(F);}}ar.doLayout();}}else{ar.hide();ap.hide();this.getNomeasurepanel().show();}}},showBackgroundReport:function(c){Ext.getCmp("resultPanel").hide();this.disableTools();var b=this.getVirtualmachinesdetailssettings().getForm();var d=c.getValue();var a=b.findField("bgReportName");
if(d=="background"){a.show();Ext.getCmp("moreOptionCloseId").hide();Ext.getCmp("submitViaSetting").show();}else{if(d=="background-csv"){a.show();Ext.getCmp("moreOptionCloseId").hide();Ext.getCmp("submitViaSetting").show();}else{a.hide();Ext.getCmp("moreOptionCloseId").show();Ext.getCmp("submitViaSetting").hide();
}}},toggleForm:function(b){Ext.getCmp("panelinsidetoggle").show();var a=Ext.getCmp("mainform");if(a.isHidden()){a.show();Ext.getCmp("selectionDetails").hide();}else{a.hide();Ext.getCmp("selectionDetails").show();}},groupComboChange:function(e){var a=this.getVirtualmachinesdetailsmainform().getForm();
var d=e.getId();this.updateQueryString(d);var m=a.findField("virtualMachineCombo");var j=a.findField("virtualCenterCombo");var h=a.findField("measure_group");var f=Ext.getCmp("er_component");var i=a.findField("reportTypeCombo").getValue();if(i=="No"){Ext.getCmp("showLegend").hide();}if(d!=null&&d=="reportTypeCombo"){h.hide();
}var c=appConstants.publicJsonData["hiddenParams"];var b=c["fromFavoriteModify"];var l=c["favorite_id"];var g=c["fromScheduleModify"];var k=c["er_favorite"];appConstants.queryString+="&fromFavoriteModify="+b+"&fromScheduleModify="+g;if(k!=undefined){appConstants.queryString+="&er_favorite="+k;}if(l!=undefined){appConstants.queryString+="&id="+l;
}Ext.Ajax.request({url:"/final/reporter/ErEsxGuestReportJson.jsp?er_type="+i,params:appConstants.queryString+"&action=loadControls",scope:this,success:function(r){var n=r.responseText;var t=Ext.decode(n);appConstants.reporGene=t;appConstants.publicJsonData=t;if(isSettingsEnabled){var p=Ext.getCmp("reportGeneration");
var w=t.repGenOpts;var v=t.repGenOpts[0].valueField;p.setFieldLabel(t["screenLabels"]["reporter.common.Report Generation"]);p.getStore().loadRawData(w);if(v=="foreground"){Ext.getCmp("moreOptionCloseId").show();Ext.getCmp("submitViaSetting").hide();}else{Ext.getCmp("moreOptionCloseId").hide();Ext.getCmp("submitViaSetting").show();
}p.setValue(v);var s=Ext.getCmp("bgReportName");if(v!=undefined&&v!=null&&v=="foreground"){s.hide();}else{s.show();}}if(d!=null&&d=="reportTypeCombo"){var u=a.findField("compTypeCombo");u.getStore().clearFilter(true);u.getStore().loadRawData(t["compTypeJson"]);u.setValue(t["pageParams"]["selectedCompType"]);
m.getStore().clearFilter(true);m.getStore().loadRawData(t["vmOptsJson"]);m.setValue(t["pageParams"]["selectedVM"]);var q=t["pageParams"]["showVcCombo"];if(q!=null&&q=="true"){j.getStore().loadRawData(t["vcOptsJson"]);j.setValue(t["pageParams"]["selectedVc"]);j.setFieldLabel(t["screenLabels"]["reporter.thin.Virtual Center"]);
j.show();}else{j.hide();}var o=appConstants.publicJsonData["pageParams"]["er_type"];if(o!=null&&o=="Yes"){h.getStore().clearFilter(true);h.getStore().loadRawData(t["measureGroupOptsJson"]);h.setValue(t["pageParams"]["selectedMeasureGrp"]);h.setFieldLabel(t["screenLabels"]["reporter.vmdetails.Measure group"]);
h.show();}appConstants.rawDataForComponents=t["physicalServersOptsJson"];f.getStore().loadRawData(t["physicalServersOptsJson"]);f.setValue(appConstants.publicJsonData["pageParams"]["selectedPhyServers"]);}else{if(d!=null&&d=="compTypeCombo"){m.getStore().clearFilter(true);m.getStore().loadRawData(t["vmOptsJson"]);
m.setValue(t["pageParams"]["selectedVM"]);var q=t["pageParams"]["showVcCombo"];if(q!=null&&q=="true"){j.getStore().loadRawData(t["vcOptsJson"]);j.setValue(t["pageParams"]["selectedVc"]);j.setFieldLabel(t["screenLabels"]["reporter.thin.Virtual Center"]);j.show();}else{j.hide();}var o=appConstants.publicJsonData["pageParams"]["er_type"];
if(o!=null&&o=="Yes"){h.getStore().clearFilter(true);h.getStore().loadRawData(t["measureGroupOptsJson"]);h.setValue(t["pageParams"]["selectedMeasureGrp"]);h.setFieldLabel(t["screenLabels"]["reporter.vmdetails.Measure group"]);h.show();}appConstants.rawDataForComponents=t["physicalServersOptsJson"];f.getStore().loadRawData(t["physicalServersOptsJson"]);
f.setValue(appConstants.publicJsonData["pageParams"]["selectedPhyServers"]);}else{if(d!=null&&d=="virtualMachineCombo"){var q=t["pageParams"]["showVcCombo"];if(q!=null&&q=="true"){j.getStore().loadRawData(t["vcOptsJson"]);j.setValue(t["pageParams"]["selectedVc"]);j.setFieldLabel(t["screenLabels"]["reporter.thin.Virtual Center"]);
j.show();}else{j.hide();}var o=appConstants.publicJsonData["pageParams"]["er_type"];if(o!=null&&o=="Yes"){h.getStore().clearFilter(true);h.getStore().loadRawData(t["measureGroupOptsJson"]);h.show();}appConstants.rawDataForComponents=t["physicalServersOptsJson"];f.getStore().loadRawData(t["physicalServersOptsJson"]);
f.setValue(appConstants.publicJsonData["pageParams"]["selectedPhyServers"]);}else{if(d!=null&&d=="virtualCenterCombo"){var o=appConstants.publicJsonData["pageParams"]["er_type"];if(o!=null&&o=="Yes"){h.getStore().clearFilter(true);h.getStore().loadRawData(t["measureGroupOptsJson"]);h.setValue(t["pageParams"]["selectedMeasureGrp"]);
h.setFieldLabel(t["screenLabels"]["reporter.vmdetails.Measure group"]);h.show();}appConstants.rawDataForComponents=t["physicalServersOptsJson"];f.getStore().loadRawData(t["physicalServersOptsJson"]);f.setValue(appConstants.publicJsonData["pageParams"]["selectedPhyServers"]);}}}}}});},updateQueryString:function(v){var w=this.getVirtualmachinesdetailsmainform().getForm();
var E=w.findField("selectionCombo").getValue();var F=w.findField("reportTypeCombo").getValue();var t=w.findField("compTypeCombo").getValue();var G=w.findField("virtualMachineCombo").getValue();var B=w.findField("virtualCenterCombo").getValue();if(v!=null&&v=="FavOrSchedule"){if(G.indexOf("&")>-1){G=G.replace(/&/g,"|amp|");
}if(G.indexOf("%")>-1){G=G.replace(/%/g,"|pct|");}if(G.indexOf("+")>-1){G=G.replace(/\+/g,"|plus|");}if(G.indexOf("#")>-1){G=G.replace(/#/g,"|hash|");}}if(appConstants.isUserVmReport=="yes"){t=appConstants.publicJsonData.selectedComptype;}var h="er_type="+F+"&ervm_disp="+E+"&er_comptype="+t;if(v=="reportTypeCombo"||v=="virtualMachineCombo"||v=="submit"||v=="FavOrSchedule"){h=h+"&select_vm="+encodeURIComponent(G);
}if(v=="reportTypeCombo"||v=="virtualCenterCombo"||v=="submit"||v=="FavOrSchedule"){h=h+"&er_virtualcenter="+B;var c=new Array();c=Ext.getCmp("er_component").getValue();if(appConstants.isUserVmReport=="yes"){c=appConstants.publicJsonData.selectedComponents;}for(var x=0;x<c.length;x++){h=h+"&er_component="+encodeURIComponent(c[x]);
}if(F!=null&&F=="Yes"){var f=w.findField("measure_group").getValue();h=h+"&er_measure="+f;}}var C=appConstants.publicJsonData.pageParams.Hourfrom;var d=appConstants.publicJsonData.pageParams.Minfrom;var n=appConstants.publicJsonData.pageParams.Hourto;var l=appConstants.publicJsonData.pageParams.Minto;
var z=appConstants.publicJsonData.pageParams["er_reportgenration"];var o=appConstants.publicJsonData["pageParams"]["selectedShowDataOption"];var s="No";if(isSettingsEnabled){settingsForm=this.getVirtualmachinesdetailssettings().getForm();C=settingsForm.findField("timefrom").getValue();d=settingsForm.findField("minfrom").getValue();
n=settingsForm.findField("timeto").getValue();l=settingsForm.findField("minto").getValue();z=settingsForm.findField("reportGeneration").getValue();o=settingsForm.findField("showDataCombo").getValue();s=settingsForm.findField("er_excwe").getValue();}var D=w.findField("er_stdate").dataArray;var q=w.findField("er_enddate").dataArray;
var p=w.findField("er_sthr").dataArray;var g=w.findField("er_endhr").dataArray;var r=w.findField("er_timeline").getValue();var u=new Date(Ext.Date.parse(D,mgrDateFormat));var b=new Date(Ext.Date.parse(q,mgrDateFormat));var A=Ext.Date.dateFormat(u,getExtjsDateFormat("dd-MM-yyyy"));var j=Ext.Date.dateFormat(b,getExtjsDateFormat("dd-MM-yyyy"));
if(Ext.isEmpty(r)){r="1 day";}h=h+"&er_stdate="+encodeURIComponent(D)+"&er_enddate="+encodeURIComponent(q)+"&er_sthr="+encodeURIComponent(p)+"&er_endhr="+encodeURIComponent(g)+"&st_date="+A+"&en_date="+j+"&starthr="+p+"&endhr="+g+"&timeto="+n+"&minto="+l+"&er_excwe="+s+"&timefrom="+C+"&minfrom="+d+"&er_reportgenration="+z+"&er_timeline="+encodeURIComponent(r)+"&startmin="+mgr_stmin+"&endmin="+mgr_enmin;
h=h+"&er_trenddata="+o;var a="";var m=appConstants.publicJsonData["hiddenParams"];for(var e in m){a+="&"+e+"="+encodeURIComponent(m[e]);}if(a!=null&&(a!="null"&&a!="undefined")){h=h+a;}if(z!=null&&z=="background"){var y=settingsForm.findField("bgReportName").getValue();y=checkFileName(y);h=h+"&forwardto=ErEsxGuestReportJson&bg_reportname="+encodeURIComponent(y);
appConstants.urlForSubmit="../servlet/com.eg.ErStartBackGroundReportC?isSubmit=true";}else{if(z!=null&&z=="background-csv"){var y=settingsForm.findField("bgReportName").getValue();y=checkFileName(y);h=h+"&forwardto=ErEsxGuestReportJson&bg_reportname="+encodeURIComponent(y);appConstants.urlForSubmit="../servlet/com.eg.ErStartBackGroundReportC?isSubmit=true&SaveFormat=CSV";
}else{h=h+"&forwardto=ErEsxGuestReport";appConstants.urlForSubmit="../servlet/com.eg.ErEsxVMServerReportC?isSubmit=true";}}if(Ext.getCmp("showLegend")!=undefined){var k=Ext.getCmp("showLegend").getValue();h=h+"&showLegend="+k;}appConstants.queryString=h;},changeSelection:function(){var t=this.getVirtualmachinesdetailsmainform().getForm();
var y=t.findField("selectionCombo");var f=t.findField("reportTypeCombo");var m=t.findField("compTypeCombo");var d=t.findField("virtualMachineCombo");var c=t.findField("virtualCenterCombo");var e=t.findField("measure_group");var b=Ext.getCmp("er_component");var A=y.getValue();var q=f.getValue();var r=m.getValue();
var k=d.getValue();var u="er_type="+q+"&ervm_disp="+A+"&select_vm="+encodeURIComponent(k)+"&er_comptype="+r;var x=t.findField("er_stdate").dataArray;var j=t.findField("er_enddate").dataArray;var z=t.findField("er_stdate").dataArray;var o=t.findField("er_enddate").dataArray;var s=new Date(Ext.Date.parse(z,mgrDateFormat));
var a=new Date(Ext.Date.parse(o,mgrDateFormat));var v=Ext.Date.dateFormat(s,getExtjsDateFormat("dd-MM-yyyy"));var i=Ext.Date.dateFormat(a,getExtjsDateFormat("dd-MM-yyyy"));var p=t.findField("er_timeline").getValue();if(Ext.isEmpty(p)){p="1 day";}u=u+"&er_stdate="+z+"&er_enddate="+o+"&er_stdate="+z+"&er_enddate="+o+"&st_date="+v+"&en_date="+i+"&er_timeline="+p;
var l=appConstants.publicJsonData["hiddenParams"];var h=l["fromFavoriteModify"];var g=l["favorite_id"];var n=l["fromScheduleModify"];var w=l["er_favorite"];u+="&fromFavoriteModify="+h+"&fromScheduleModify="+n;if(w!=undefined){qstr+="&er_favorite="+w;}if(g!=undefined){u+="&id="+g;}Ext.getCmp("resultPanel").hide();
this.disableTools();Ext.Ajax.request({url:"/final/reporter/ErEsxGuestReportJson.jsp",params:u+"&action=loadControls",scope:this,success:function(D){var F=D.responseText;var E=Ext.decode(F);appConstants.publicJsonData=E;y.getStore().loadRawData(E["selectionOptsJson"]);y.setValue(E["pageParams"]["ervm_disp"]);
f.getStore().loadRawData(E["repTypeOptsJson"]);f.setValue(E["pageParams"]["er_type"]);m.getStore().clearFilter(true);m.getStore().loadRawData(E["compTypeJson"]);m.setValue(E["pageParams"]["selectedCompType"]);d.getStore().clearFilter(true);d.getStore().loadRawData(E["vmOptsJson"]);d.setValue(E["pageParams"]["selectedVM"]);
var C=E["pageParams"]["showVcCombo"];if(C!=null&&C=="true"){c.getStore().loadRawData(E["vcOptsJson"]);c.setValue(E["pageParams"]["selectedVc"]);c.setFieldLabel(E["screenLabels"]["reporter.thin.Virtual Center"]);c.show();}else{c.hide();}var B=appConstants.publicJsonData["pageParams"]["er_type"];if(B!=null&&B=="Yes"){e.getStore().clearFilter(true);
e.getStore().loadRawData(E["measureGroupOptsJson"]);e.setValue(E["pageParams"]["selectedMeasureGrp"]);e.setFieldLabel(E["screenLabels"]["reporter.vmdetails.Measure group"]);e.show();}b.getStore().loadRawData(E["physicalServersOptsJson"]);b.setValue(appConstants.publicJsonData["pageParams"]["selectedPhyServers"]);
}});},boxready:function(){var a=this;if(appConstants.er_RmDispName!=null&&appConstants.er_RmDispName!="null"&&appConstants.er_RmDispName!="undefined"){this.getMain().setTitle(appConstants.er_RmDispName);}else{this.getMain().setTitle(appConstants.publicJsonData["screenLabels"]["pageTitle"]);}if(appConstants.isSubmit!=null&&appConstants.isSubmit=="true"){var b=appConstants.publicJsonData["pageParams"]["er_reportgenration"];
if(b!=null&&(b!="background"||b!="background")){a.loadVmDetailsReportData(appConstants.publicJsonData);}}else{if(appConstants.isForceSubmit=="true"){appConstants.isForceSubmit="false";this.beforeReportSubmit();}}},loadDefaults:function(){var b=this;Ext.getCmp("er_mode").hide();var c=appConstants.publicJsonData["hiddenParams"];
var d=c["fromScheduleModify"];var a=c["fromFavoriteModify"];if(appConstants.isUserVmReport!="yes"){Ext.getCmp("selectionCombo").show();Ext.getCmp("compTypeCombo").show();Ext.getCmp("compContainer").show();}if((d!=null&&d=="Yes")||(a!=null&&a=="Yes")){Ext.getCmp("submit").hide();Ext.getCmp("save").show();
Ext.getCmp("favoriteTool").setDisabled(true);Ext.getCmp("scheduleTool").setDisabled(true);}else{Ext.getCmp("submit").show();Ext.getCmp("save").hide();}this.getVirtualmachinesdetailsmainform().loadData();if(appConstants.publicJsonData["pageParams"]["selectedShowDataOption"]=="Yes"){isTrend=true;}stmin=appConstants.publicJsonData["pageParams"]["startMinForDisplay"];
enmin=appConstants.publicJsonData["pageParams"]["endMinForDisplay"];mgr_enmin=appConstants.publicJsonData["pageParams"]["endmin"];mgr_stmin=appConstants.publicJsonData["pageParams"]["startmin"];if(!hideBackButton){Ext.getCmp("virtualmachinesdetailsmainform").add({xtype:"hidden",id:"ID",name:"ID",value:appConstants.publicJsonData["ID"]});
}if(Ext.getCmp("showLegend")!=undefined){if(appConstants.isshowLegend=="true"||appConstants.isshowLegend==true){Ext.getCmp("showLegend").setValue(true);}}},refreshReportData:function(){if(appConstants.isSubmit!=null&&appConstants.isSubmit=="true"){appConstants.initLdgMask.show();this.loadReportData(appConstants.publicjsonData);
}},fillFormFields:function(e){var c=e.screenLabels;var f;var j;var o;f=e.anlyzeCombo;j=e.er_type;o=Ext.getCmp("er_option");o.setFieldLabel(c["reporter.common.Analyze by"]);o.getStore().loadRawData(f);if(!Ext.isEmpty(j)){o.setValue(j);}else{o.setValue(f[0].valueField);}f=e.compTypeCombo;j=e.er_comptype;
o=Ext.getCmp("er_comptype");o.setFieldLabel(c["reporter.common.Component Type"]);o.getStore().clearFilter(true);o.getStore().loadRawData(f);if(!Ext.isEmpty(j)){o.setValue(j);}else{o.setValue(f[0].valueField);}f=e.componentCombo;j=e.er_component;o=Ext.getCmp("er_component");Ext.getCmp("componentsLbl").setText(c["reporter.common.Component"]);
o.getStore().loadRawData(f);if(!Ext.isEmpty(j)){o.setValue(j);}else{o.setValue(f[0].valueField);}f=e.showVmCombo;j=e.er_showVms;o=Ext.getCmp("er_showVms");o.setFieldLabel(c["reporter.common.Show VMs"]);o.getStore().clearFilter(true);o.getStore().loadRawData(f);if(!Ext.isEmpty(j)){o.setValue(j);}else{o.setValue(f[0].valueField);
}Ext.getCmp("lowLimitLbl").setFieldLabel(c["reporter.common.Low Utilization Limit"]);Ext.getCmp("underMinimum").setValue(e.underMinimum);Ext.getCmp("underMinimum").setFieldLabel(c["reporter.common.Minor"]);Ext.getCmp("underMajor").setValue(e.underMajor);Ext.getCmp("underMajor").setFieldLabel(c["reporter.common.Major"]);
Ext.getCmp("underCritical").setValue(e.underCritical);Ext.getCmp("underCritical").setFieldLabel(c["reporter.common.Critical"]);Ext.getCmp("highLimitLbl").setFieldLabel(c["reporter.common.High Utilization Limit"]);Ext.getCmp("upperminimum").setValue(e.upperminimum);Ext.getCmp("upperminimum").setFieldLabel(c["reporter.common.Minor"]);
Ext.getCmp("uppermajor").setValue(e.uppermajor);Ext.getCmp("uppermajor").setFieldLabel(c["reporter.common.Major"]);Ext.getCmp("upperCritical").setValue(e.upperCritical);Ext.getCmp("upperCritical").setFieldLabel(c["reporter.common.Critical"]);f=e.applylimitCombo;j=e.er_utilizationFor;o=Ext.getCmp("er_utilizationFor");
Ext.getCmp("applylimitlbl").setText(c["reporter.common.Apply Limits"]);o.getStore().loadRawData(f);if(!Ext.isEmpty(j)){o.setValue(j);}else{o.setValue(f[0].valueField);}Ext.getCmp("timeperiodLbl").setText(c["reporter.common.Time period"]);Ext.getCmp("timefrom").setValue(e.selectedTimeFrom);Ext.getCmp("minfrom").setValue(e.selectedMinsFrom);
Ext.getCmp("timeto").setValue(e.selectedTimeTo);Ext.getCmp("minto").setValue(e.selectedMinsTo);var s=e.timelineCombo;var g=e.selectedTimeline;var p=Ext.getCmp("er_timeline");p.getStore().loadRawData(s);if(!Ext.isEmpty(s)){if(!Ext.isEmpty(g)){p.setValue(g);}else{p.setValue(s[0].valueField);}}var m=e.startHour;
var k=e.endHour;var d=e.startDate;var a=e.endDate;var h=Ext.getCmp("er_stdate");h.setValue(d);var r=Ext.getCmp("er_sthr");r.setValue(m);var l=Ext.getCmp("er_enddate");l.setValue(a);var q=Ext.getCmp("er_endhr");q.setValue(k);var n=appConstants.repoGene.reportGenerationCombo;var i=appConstants.repoGene.reportGeneration;
var b=Ext.getCmp("reportGeneration");b.setFieldLabel(c["reporter.common.Report Generation"]);b.getStore().loadRawData(n);b.setValue(i);if(i=="foreground"){Ext.getCmp("moreOptionCloseId").show();Ext.getCmp("submitViaSetting").hide();}else{Ext.getCmp("moreOptionCloseId").hide();Ext.getCmp("submitViaSetting").show();
}},hideTools:function(){this.getNewUtilities().loadIcon(true,true,true,false,true,true,true,false,false,false,true);Ext.getCmp("scheduleTool").setDisabled(false);Ext.getCmp("favoriteTool").setDisabled(false);}});