var fromRunButton=true;Ext.define("citrixCapacityPrediction.controller.Main",{extend:"Ext.app.Controller",views:["Main"],refs:[{selector:"main",ref:"main"},{selector:"newUtilities",ref:"newUtilities"},{selector:"resultpanel",ref:"resultpanel"},{selector:"CitrixCapacityPredictionForm",ref:"CitrixCapacityPredictionForm"},{selector:"CitrixCapacityPredictionSettings",ref:"CitrixCapacityPredictionSettings"},{selector:"nomeasurepanel",ref:"nomeasurepanel"},{selector:"backGroundPanel",ref:"backGroundPanel"},{selector:"ReporterSettings",ref:"ReporterSettings"},],init:function(){this.control({'mainform button[id="panelinsidetoggle"]':{"click":this.toggleForm},"newUtilities":{"afterrender":this.loadTools},"CitrixCapacityPredictionSettings":{"afterrender":this.afterSettingsRender},"CitrixCapacityPredictionForm":{"boxready":this.afterCapacityFormRender},'CitrixCapacityPredictionForm combo[id="er_comptype"]':{"select":this.changeCompType},'CitrixCapacityPredictionForm combo[id="er_option"]':{"select":this.changeAnalysBy},'CitrixCapacityPredictionForm combo[id="er_site"]':{"select":this.changeBySite},'CitrixCapacityPredictionSettings combo[id="er_excwe"]':{"select":this.changeExcludeWeekEnd},'CitrixCapacityPredictionSettings combo[id="reportGeneration"]':{"select":this.changeReportGeneration},'CitrixCapacityPredictionSettings button[id="moreOptionCloseId"]':{"click":this.validateAndCloseSettings},'CitrixCapacityPredictionSettings button[id="submitViaSetting"]':{"click":this.closeAndSubmitSettings},'CitrixCapacityPredictionForm button[id="submit"]':{"click":this.submitReport},'CitrixCapacityPredictionForm button[name="save"]':{"click":this.goTo},"newUtilities > #saveTool > button":{"click":this.saveMe},"newUtilities > #printTool > button":{"click":this.printMe},"newUtilities > #mailTool > button":{"click":this.sendMail},"newUtilities > #scheduleTool > button":{"click":this.showSchedules},"newUtilities > #favoriteTool > button":{"click":this.showFavorites},});
},goTo:function(a){if(Ext.getCmp("er_timeline").getValue()=="Any"){Ext.MessageBox.show({title:alert_text,msg:timelineErrTxt,buttons:Ext.Msg.OK,icon:Ext.MessageBox.WARNING});return;}appConstants.formButtonId=a.getId();var b=appConstants.publicJSON["hiddens"];var c=b["fromFavoriteModify"];if((c!=null&&c=="Yes")){this.showFavorites();
}else{this.showSchedules();}},showFavorites:function(g){this.updateQueryString();var b=appConstants.queryString;var c=appConstants.publicJSON["hiddens"];var a=c["favorite_id"];var f="/final/servlet/com.eg.ErFavoriteC?"+b+"&cmd=client&er_view=GRAPH"+"&er_RmDispName="+appConstants.er_RmDispName+"&com.eg.CSRF_NONCE="+csrfToken;
if(f!=undefined&&f.indexOf("er_rtype")==-1){f+="&er_rtype=Citrix Servers";}if(appConstants.formButtonId=="save"){if((a=="null"||a=="undefined"||a==undefined)&&appConstants.favorite_id!="null"){a=appConstants.favorite_id;}f+="&showSchWindow=no"+"&FavoriteId="+a;var e=f.substr(0,f.indexOf("?"));var h=f.substr(f.indexOf("?")+1,f.length-1);
var d=Ext.create("Ext.form.Panel");d.submit({url:e,params:h,standardSubmit:true,method:"POST"});}else{parent.favouriteWindowFn(f);}},showSchedules:function(e){if(this.checkValidate(false)){this.updateQueryString();var a=appConstants.queryString;var d="/final/reporter/ErSaveSchedule.jsp?"+a+"&er_rtype=Citrix Server&com.eg.CSRF_NONCE="+csrfToken;
if(appConstants.formButtonId=="save"){d+="&showSchWindow=no";var c=d.substr(0,d.indexOf("?"));var f=d.substr(d.indexOf("?")+1,d.length-1);var b=Ext.create("Ext.form.Panel");b.submit({url:c,params:f,standardSubmit:true,method:"POST"});}else{parent.scheduleWindowFn(d);}}},sendMail:function(){Ext.widget("sendmail").show();
},saveMe:function(){var a=appConstants.publicJSON["PDF_URL"];if(Ext.getCmp("grid")!=undefined&&Ext.getCmp("grid").isHidden()){a+="&isSummaryView=yes";}else{if(Ext.getCmp("grid_Summary")!=undefined&&Ext.getCmp("grid_Summary").isHidden()){a+="&isSummaryView=no";}}if(Ext.isEmpty(appConstants.erUtils)){appConstants.erUtils=Ext.widget("erutils");
}appConstants.erUtils.savePDF(a);},bookletQuery:function(a){return appConstants.publicJSON["PDF_URL"];},bookletScheduleQuery:function(b){this.updateQueryString();var a=appConstants.queryString+"&er_rtype=Citrix Server";return a;},bookletPreview:function(){this.printMe();},printMe:function(){var a=appConstants.publicJSON["PRINT_URL"];
if(Ext.getCmp("grid")!=undefined&&Ext.getCmp("grid").isHidden()){a+="&isSummaryView=yes";}else{if(Ext.getCmp("grid_Summary")!=undefined&&Ext.getCmp("grid_Summary").isHidden()){a+="&isSummaryView=no";}}parent.printWindowFn(a);},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();}},changeReportGeneration:function(c){var b=this.getCitrixCapacityPredictionSettings().getForm();var d=b.findField("reportGeneration").getValue();var a=b.findField("bgReportName");if(d=="background"){a.show();
Ext.getCmp("moreOptionCloseId").hide();Ext.getCmp("submitViaSetting").show();}else{a.hide();Ext.getCmp("moreOptionCloseId").show();Ext.getCmp("submitViaSetting").hide();}if(!Ext.isEmpty(c)){this.hideResult();}},changeTimeline:function(f){var a=this.getCitrixCapacityPredictionForm().getForm();var c=a.findField("er_timeline").getValue();
var e=a.findField("er_stdate");var b=a.findField("er_enddate");var g=a.findField("er_sthr");var d=a.findField("er_endhr");if(c=="Any"){e.setDisabled(false);b.setDisabled(false);g.setDisabled(false);d.setDisabled(false);}else{e.setDisabled(true);b.setDisabled(true);g.setDisabled(true);d.setDisabled(true);
}},changeCompType:function(c){if(!Ext.isEmpty(c)){this.hideResult();this.getResultpanel().removeAll();var b="/final/reporter/ErCitrixCapacityPredictionReportJson.jsp";var a=Ext.getCmp("er_option").getValue();var d="er_option="+a;if(a!="Component"){d+="&er_site="+Ext.getCmp("er_site").getValue();}d+="&er_comptype="+Ext.getCmp("er_comptype").getValue();
this.callAjaxRequest(c,b,d);}},changeAnalysBy:function(c){var a=c.getValue();if(a!=undefined&&a=="Zone"){Ext.getCmp("er_componentname").hide();Ext.getCmp("er_site").show();}else{Ext.getCmp("er_componentname").show();Ext.getCmp("er_site").hide();}this.hideResult();this.getResultpanel().removeAll();var b="/final/reporter/ErCitrixCapacityPredictionReportJson.jsp";
var d="er_option="+Ext.getCmp("er_option").getValue();this.callAjaxRequest(c,b,d);},changeBySite:function(b){if(!Ext.isEmpty(b)){this.hideResult();this.getResultpanel().removeAll();var a="/final/reporter/ErCitrixCapacityPredictionReportJson.jsp";var c="er_option="+Ext.getCmp("er_option").getValue();c+="&er_site="+Ext.getCmp("er_site").getValue();
this.callAjaxRequest(b,a,c);}},callAjaxRequest:function(c,a,d){var b=this;initLdgMask.show();Ext.Ajax.request({url:a,params:d,method:"POST",success:function(e){if(e.status==200&&!Ext.isEmpty(e.responseText)){var f=e.responseText;appConstants.publicJSON=Ext.decode(f);initLdgMask.hide();b.loadAjaxSucess(c);
}}});},loadAjaxSucess:function(d){var a=this.getCitrixCapacityPredictionForm().getForm();if(d.id=="er_option"||d.id=="er_site"||d.id=="er_comptype"){var b=d.getValue();var f=appConstants.publicJSON["screenLabels"];var g=appConstants.publicJSON["selectedValues"];if(d.id=="er_option"){if(b!=undefined&&b!="Component"){var k=Ext.getCmp("er_site");
k.setFieldLabel(f["reporter.common.siteLabel"]);var h=appConstants.publicJSON["siteCombo"];var c=g["er_site"];if(!Ext.isEmpty(h)){this.setValueWithOptionInList(a,"er_site",h,c);}else{this.insertNotApplicable(a,"er_site");}}}if(d.id=="er_option"||d.id=="er_site"){var j=appConstants.publicJSON["compTypeCombo"];
var e=g["er_comptype"];if(!Ext.isEmpty(j)){this.setValueWithOptionInList(a,"er_comptype",j,e);}else{this.insertNotApplicable(a,"er_comptype");}}var l=appConstants.publicJSON["componentCombo"];var i=g["er_componentname"];if(!Ext.isEmpty(l)){this.setValueWithOptionInList(a,"er_componentname",l,i);}else{this.insertNotApplicable(a,"er_componentname");
}}},hideResult:function(){this.getResultpanel().hide();this.disableTools();},disableTools:function(){Ext.getCmp("scheduleTool").setDisabled(false);Ext.getCmp("favoriteTool").setDisabled(false);Ext.getCmp("bookletTool").setDisabled(true);Ext.getCmp("saveTool").setDisabled(true);Ext.getCmp("printTool").setDisabled(true);
Ext.getCmp("mailTool").setDisabled(true);},enableTools:function(){Ext.getCmp("scheduleTool").setDisabled(false);Ext.getCmp("favoriteTool").setDisabled(false);Ext.getCmp("bookletTool").setDisabled(false);Ext.getCmp("saveTool").setDisabled(false);Ext.getCmp("printTool").setDisabled(false);Ext.getCmp("mailTool").setDisabled(false);
},getHiddenQstr:function(){var c=appConstants.publicJSON["hiddens"];var a="";for(var b in c){if(b=="forwardto"){continue;}a+="&"+b+"="+encodeURIComponent(c[b]);}return a;},checkValidate:function(n){var m=this.getCitrixCapacityPredictionForm().getForm();var j=null;if(isSettingsEnabled){j=this.getCitrixCapacityPredictionSettings().getForm();
}var r=m.findField("er_site");var b=m.findField("er_componentname");var s=m.findField("er_option").getValue();if((s!=null||s!=undefined)&&s!="Component"){if(r.getValue()=="-1"){Ext.MessageBox.show({title:alert_text,msg:"Please select a valid Zone",buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});
return false;}}else{if((s!=null||s!=undefined)&&s=="Component"){if(b.getValue()=="-1"){Ext.MessageBox.show({title:alert_text,msg:"Please select a valid Component",buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});return false;}}}var l=m.findField("er_comptype");if(l.getValue()=="-1"){Ext.MessageBox.show({title:alert_text,msg:"Please select a valid Component Type",buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});
return false;}var i=appConstants.publicJSON["hiddens"];var u=i["er_usertimeline"];var d=i["getMaxDaysInMonth"];var h=m.findField("er_stdate").getValue();h.setHours(m.findField("er_sthr").getValue());var k=m.findField("er_enddate").getValue();k.setHours(m.findField("er_endhr").getValue());var o=this.getSettingsFieldValue(j,"timefrom",isSettingsEnabled,"timePeriodFromHrSelected");
var g=this.getSettingsFieldValue(j,"timeto",isSettingsEnabled,"timePeriodToHrSelected");var a=this.getSettingsFieldValue(j,"minfrom",isSettingsEnabled,"timePeriodFromMinSelected");var t=this.getSettingsFieldValue(j,"minto",isSettingsEnabled,"timePeriodToMinSelected");if(!checkTimePeriod(o,a,g,t)){return false;
}if(h.getTime()>k.getTime()){Ext.MessageBox.show({title:alert_text,msg:appConstants.dateValidateError,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});return false;}var f=i["limitforbg"];var e=this.getSettingsFieldValue(j,"reportGeneration",isSettingsEnabled,"reportGenSelected");var q=true;if(e!=null&&e=="foreground"){}else{var p=this.getSettingsFieldValue(j,"bgReportName",isSettingsEnabled,"reportName");
if(!validateTextBoxWithSpecialChars(p,"Attachment",true)){reportNameObj.focus();q=false;}}if(q){var c=Ext.getCmp("submit");c.setDisabled(false);return true;}},submitReport:function(h){var g=this;var c=this.getCitrixCapacityPredictionForm().getForm();var e=c.findField("er_stdate").getValue();var f=c.findField("er_sthr").getValue();
e.setHours(f);var b=c.findField("er_enddate").getValue();var d=c.findField("er_endhr").getValue();b.setHours(d);this.updateQueryString();appConstants.queryString+="&isSubmit=true&call=json";var a=checkDateTime(e,b);if(!a){return;}if(!g.checkValidate(true)){return;}this.generateResult();},generateResult:function(){var d=this;
var a=appConstants.queryString;var c=null;if(isSettingsEnabled){c=this.getCitrixCapacityPredictionSettings().getForm();}var e=this.getSettingsFieldValue(c,"reportGeneration",isSettingsEnabled,"reportGenSelected");var b="";if(e=="foreground"){b="/final/servlet/com.eg.ErCitrixCapacityPredictionReportC";
}else{b="/final/servlet/com.eg.ErStartBackGroundReportC";a+="&forwardto=ErCitrixCapacityPredictionReportJson";}this.getNomeasurepanel().hide();this.getBackGroundPanel().hide();initLdgMask.show();Ext.Ajax.request({url:b,params:a,method:"POST",success:function(g){if(g.status==200&&!Ext.isEmpty(g.responseText)){initLdgMask.hide();
var i=g.responseText;appConstants.publicJSON=Ext.decode(i);d.getResultpanel().removeAll();d.getResultpanel().show();var h=appConstants.publicJSON["RESULT_DATA"];var f=appConstants.publicJSON["NO_DATA"];if(e=="foreground"){if(!Ext.isEmpty(h)){if(f!=undefined&&f=="yes"){d.getNomeasurepanel().show();d.getResultpanel().hide();
}else{d.loadData(h);d.enableTools();}}else{d.getNomeasurepanel().show();d.getResultpanel().hide();}}else{h=appConstants.publicJSON["backgroundResults"];d.loadBackground(h);}}}});},updateQueryString:function(){var j="";var n=this.getCitrixCapacityPredictionForm().getForm();var l=null;if(isSettingsEnabled){l=this.getCitrixCapacityPredictionSettings().getForm();
}var m=n.findField("er_comptype").getValue();var q=n.findField("er_option").getValue();var u=n.findField("er_site").getValue();var s=n.findField("er_timeline").getValue();var c=n.findField("er_stdate").dataArray;var t=n.findField("er_enddate").dataArray;var b=n.findField("er_sthr").dataArray;var f=n.findField("er_endhr").dataArray;
var d=n.findField("er_mode").getValue();var g=n.findField("er_option").getValue();var k=n.findField("er_componentname").getValue();var e=this.getSettingsFieldValue(l,"er_excwe",isSettingsEnabled,"excludeWeekSelected");var h=this.getSettingsFieldValue(l,"timefrom",isSettingsEnabled,"timePeriodFromHrSelected");
var r=this.getSettingsFieldValue(l,"timeto",isSettingsEnabled,"timePeriodToHrSelected");var i=this.getSettingsFieldValue(l,"minfrom",isSettingsEnabled,"timePeriodFromMinSelected");var a=this.getSettingsFieldValue(l,"minto",isSettingsEnabled,"timePeriodToMinSelected");var o=this.getSettingsFieldValue(l,"reportGeneration",isSettingsEnabled,"reportGenSelected");
var p=this.getSettingsFieldValue(l,"bgReportName",isSettingsEnabled,"reportName");p=checkFileName(p);j+=this.getHiddenQstr();j+="&er_timeline="+encodeURIComponent(s)+"&startdate="+encodeURIComponent(c)+"&enddate="+encodeURIComponent(t)+"&starthr="+encodeURIComponent(b)+"&endhr="+encodeURIComponent(f)+"&startmin="+mgr_stmin+"&endmin="+mgr_enmin+"&timefrom="+encodeURIComponent(h)+"&timeto="+encodeURIComponent(r)+"&minfrom="+encodeURIComponent(i)+"&minto="+encodeURIComponent(a)+"&er_mode="+encodeURIComponent(d)+"&er_excwe="+encodeURIComponent(e)+"&er_reportgenration="+encodeURIComponent(o)+"&bg_reportname="+encodeURIComponent(p);
j+="&er_comptype="+encodeURIComponent(m);j+="&er_option="+encodeURIComponent(q);if(q!=null&&q=="Component"){j+="&er_component="+encodeURIComponent(k);}j+="&er_site="+encodeURIComponent(u);j+="&er_RmDispName="+encodeURIComponent(appConstants.er_RmDispName);if(!fromRunButton){j+="&fromRunButton=no";}else{j+="&fromRunButton=yes";
}if(Ext.getCmp("factorSlider")!=undefined){j+="&increaseBy="+Ext.getCmp("factorSlider").getValue();}appConstants.queryString=j;if(j!=undefined&&j.indexOf("er_rtype")==-1){appConstants.queryString+="&er_rtype=Citrix Report";}},loadBackground:function(c){var d=c;if(!Ext.isEmpty(d)){var b=this.getBackGroundPanel();
b.removeAll();var f=d["status"];var g=d["backgroundResponseText"];var a=d["backgroundResponseURLLink"];var e=d["backgroundResponseURLText"];var h="";if(f=="success"){h='<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="iconSuccess"></div></td><td><div style="line-height:1.5em" class="font_bold11">'+g+".</br>"+'<a class="backgroundMsgLink" href='+a+">"+e+"</a></div></td></tr></table></td></tr></table>";
}else{if(f=="duplicate"){h='<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="iconExclamation"></div></td><td><div style="line-height:1.5em" class="font_bold11">'+g+".</br>"+'<a class="backgroundMsgLink" href='+a+">"+e+"</a></div></td></tr></table></td></tr></table>";
}else{h='<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="iconExclamation"></div></td><td><div style="line-height:1.5em" class="font_bold11">'+g+"</div></td></tr></table></td></tr></table>";
}}b.add({xtype:"container",cls:"measuresErrorPanelBg",margin:0,bodyPadding:0,html:h,});b.doLayout();b.show();this.disableTools();}},loadData:function(c){var i=this;if(fromRunButton){Ext.getCmp("selectionDetails").setSelectionDetailsData(appConstants.publicJSON.selectionDetails);}fromRunButton=true;var e=Ext.getCmp("resultPanel");
e.removeAll();var f='<div style="padding: 5px 0px 0px 0px;" width="100%"><table width="100%" style="border:0px;"><tr >';f+='<td style="border-right:0px solid #e9e9e9;">';f+='<div style="margin:5px 0px 0px 10px" class="newFont_bold14">'+serverRequriedTxt+"</div>";f+='<div style="margin:5px 0px 0px 20px" class="newFont_bold13">'+Total_ServersTxt+"</div>";
f+='<div><table height="180px" align="center" valign="middle"><tr><td><div class="iconServerGray"/></td><td><div class="newFont_light50" style="text-align:center;margin-left:5px">'+c.TOTAL_SERVERS+"</div></td></tr></table></div>";f+="</td>";f+="</tr>";f+="<tr>";f+='<td style="background-color:#3f51b5;padding:0px" >';
f+='<div style="margin:14px 0px 0px 18px;color:#FFFFFF" class="newFont_bold13">'+Additonal_ServerRequriedTxt+"</div>";f+='<div><table height="170px" align="center" valign="middle"><tr><td><div class="iconServerWhite"/></td><td><div class="newFont_light50" style="text-align:center;color:#FFFFFF;margin-left:5px">'+c.ADDITIONAL_SERVER+"</div></td></tr></table></div>";
f+="</td>";f+="</tr></table></div>";var h="";var d=Ext.getCmp("er_option").getValue();if(d!="Component"){h=Ext.getCmp("er_site").getValue();}else{h=Ext.getCmp("er_componentname").getValue();}e.add({xtype:"panel",columnWidth:1,layout:{type:"column",align:"stretch"},ui:"newGraphPanel",margin:"10 10 10 10",items:[{xtype:"container",columnWidth:1,margin:"10 10 0 10",html:'<div style="display:flow-root;white-space:wrap"><span class="newFont_bold12">'+h+'</span><span class="newFont_normal12">&nbsp;'+Ext.getCmp("er_option").getRawValue()+'&nbsp;currently supports&nbsp;</span><span class="newFont_bold12">'+c.UNIQUE_USER_ORIGINAL+"&nbsp;users&nbsp;("+c.SESSIONS_ORIGINAL+' concurrent sessions)</span><span class="newFont_normal12"> on </span><span class="newFont_bold12">'+c.TOTAL_SERVERS_ORIGINAL+' servers.</span><span class="newFont_normal12"> To predict how resource usage will change based on variations in load, use the slider below.</span>&nbsp;&nbsp;&nbsp;</div>'},{xtype:"panel",columnWidth:1,padding:"5 0 0 20",layout:{type:"hbox",align:"stretch",pack:"center"},margin:"20 10 20 0",items:[{xtype:"container",layout:"hbox",margin:"5 0 5 0",items:[{xtype:"slider",cls:"mesrslider",id:"factorSlider",name:"factorSlider",fieldLabel:'<div class="newFont_bold14">'+loadTxt+"</div>",labelSeparator:"",labelAlign:"left",labelWidth:120,animate:true,increment:c.SliderRange,minValue:0,value:c.factorValue,maxValue:300,width:420,plugins:["fillslider"],tipText:function(k){var l="";
l="Increased by "+k.value+" %";return l;},listeners:{"changecomplete":function(){fromRunButton=false;i.submitReport();}}},{xtype:"container",margin:"1 10 0 20",html:'<div><span class="newFont_bold16">'+c.UNIQUE_USER+'&nbsp;</span><span class="newFont_normal14">'+usersTxt+"</span></div><div>(Increased by "+c.factorValue+"%)</div>"}]},{xtype:"container",margin:"2 10 5 0",html:'<div style="height:30px;width:100%;border-left:1px solid #e9e9e9">&nbsp;</div>'},{xtype:"container",html:'<div style="margin:7px 0px 5px 0px"><span class="newFont_bold16">'+c.SESSIONS+'</span><span class="newFont_normal14">&nbsp;'+numberOfSession+"<span></div>"}]},{xtype:"container",columnWidth:1,margin:"0 10 5 5",html:'<div class="newFont_normal10" style="font-style:italic;float:right">*Predictions are based on extrapolation of historical resource usage patterns.</div>'}]},{xtype:"panel",columnWidth:1,layout:"column",height:416,margin:"0 0 10 0",items:[{xtype:"container",layout:"column",height:415,ui:"newContainer",padding:10,margin:"0 10 10 10",columnWidth:0.6,items:[{xtype:"container",columnWidth:1,html:'<div class="newFont_bold14">Resource Usage Prediction</div>'},{xtype:"container",columnWidth:1,margin:"5 0 5 10",html:"<div>For the increased user load, what will be the predicted resource usage?</div>"},{xtype:"container",columnWidth:0.5,cls:"graphSeperatorLineBottomRight",html:'<div style="margin:10px 0px 0px 10px;"><div class="newFont_bold13">'+c.CPU_UTIL_CHART.title+'</div><div id="gaugeId_cpu" style="height:150px"></div></div>'},{xtype:"container",columnWidth:0.5,cls:"graphSeperatorLineBottom",html:'<div style="margin:10px 0px 0px 10px;"><div class="newFont_bold13">'+c.MEM_UTIL_CHART.title+'</div><div id="gaugeId_mem" style="height:150px"></div></div>'},{xtype:"container",columnWidth:0.5,cls:"graphSeperatorLineRight",html:'<div style="margin:20px 0px 0px 10px;"><div class="newFont_bold13">'+c.DISK_USAGE_CHART.title+'</div><div id="gaugeId_disk" style="height:150px"></div></div>'},{xtype:"container",columnWidth:0.5,html:'<div style=margin:20px 0px 0px 10px;"><div class="newFont_bold13">'+c.NETWORK_USAGE_CHART.title+'</div><div id="gaugeId_net" style="height:150px"></div></div>'}]},{xtype:"container",height:415,ui:"newContainer",padding:0,margin:"0 10 10 0",columnWidth:0.4,html:f}]});
var j={};j=jQuery.extend(true,{},getHighChartsGuage("gaugeId_cpu",c.CPU_UTIL_CHART,""),j);var b={};b=jQuery.extend(true,{},getHighChartsGuage("gaugeId_mem",c.MEM_UTIL_CHART,""),b);var g={};g=jQuery.extend(true,{},getHighChartsGuage("gaugeId_disk",c.DISK_USAGE_CHART,""),g);var a={};a=jQuery.extend(true,{},getHighChartsGuage("gaugeId_net",c.NETWORK_USAGE_CHART,""),a);
},loadTools:function(){this.getNewUtilities().loadIcon(true,true,true,false,false,true,true,false,false,false,true);},showConfigDropdown:function(){isSettingsEnabled=true;var a=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":"381px"}},{xtype:"container",html:a.apply(),cls:"containerHeader",style:{"top":"0px","margin":"0px"}},{xtype:"CitrixCapacityPredictionSettings",parent:this}],renderTo:"citrixcapacityForm"});
},afterSettingsRender:function(){Ext.getCmp("moreOptionCloseId").show();var c=appConstants.publicJSON["hiddens"];var k=c["favorite_id"];if(!Ext.isEmpty(k)){Ext.getCmp("reportGeneration").setDisabled(true);}var d=this.getCitrixCapacityPredictionSettings().getForm();var b=this.getCitrixCapacityPredictionForm().getForm();
var l=new Array();var h=appConstants.publicJSON["screenLabels"];l["er_excwe"]=h["reporter.common.excludeweekends"];l["timeperiodLbl"]=h["reporter.common.Timeperiod"];l["fromTimeLbl"]=h["reporter.common.From"];l["toTimeLbl"]=h["reporter.common.To"];l["fromHrsLbl"]=h["reporter.common.Hrs"];l["fromMinsLbl"]=h["reporter.common.Mins"];
l["toHrsLbl"]=h["reporter.common.Hrs"];l["toMinsLbl"]=h["reporter.common.Mins"];l["reportGeneration"]=h["reporter.consolidated.reportGeneration"];l["bgReportName"]=h["reporter.consolidated.reportName"];var f=this;Ext.get("closeSettings").on("click",function(){f.validateAndCloseSettings();});this.loadScreenLabels(d,l);
var i=appConstants.publicJSON["selectedValues"];var a=appConstants.publicJSON["excludeWeekCombo"];var j=i["excludeWeekSelected"];if(!Ext.isEmpty(a)){this.setValueWithOptionInList(d,"er_excwe",a,j);}var g=appConstants.publicJSON["excludeWeekEndMsg"];var m=Ext.getCmp("er_option").getValue();d.findField("timefrom").setValue(i["timePeriodFromHrSelected"]);
d.findField("minfrom").setValue(i["timePeriodFromMinSelected"]);d.findField("timeto").setValue(i["timePeriodToHrSelected"]);d.findField("minto").setValue(i["timePeriodToMinSelected"]);var n=appConstants.publicJSON["reportGenCombo"];var e=i["reportGenSelected"];if(!Ext.isEmpty(n)){this.setValueWithOptionInList(d,"reportGeneration",n,e);
this.changeReportGeneration();}},validateAndCloseSettings:function(){var a=this.validateSettings();if(a){Ext.get("configMod").animate({duration:500,to:{y:-500}});return true;}return false;},closeAndSubmitSettings:function(){if(this.validateAndCloseSettings()){this.submitReport();}},afterCapacityFormRender:function(){this.hideResult();
if(appConstants.er_RmDispName!=null&&appConstants.er_RmDispName!="null"&&appConstants.er_RmDispName!="undefined"){this.getMain().setTitle(appConstants.er_RmDispName);}else{this.getMain().setTitle(appConstants.publicJSON["TITLE"]);}var v=this.getCitrixCapacityPredictionForm().getForm();var d=appConstants.publicJSON["selectedValues"];
var w=appConstants.publicJSON["anlyzeCombo"];var k=d["er_option"];if(!Ext.isEmpty(w)){this.setValueWithOptionInList(v,"er_option",w,k);}var f=appConstants.publicJSON["screenLabels"];if(k!=undefined&&k!="Component"){var s=Ext.getCmp("er_site");s.setFieldLabel(f["reporter.common.siteLabel"]);var x=appConstants.publicJSON["siteCombo"];
var a=d["er_site"];if(!Ext.isEmpty(x)){this.setValueWithOptionInList(v,"er_site",x,a);}else{this.insertNotApplicable(v,"er_site");}Ext.getCmp("er_site").show();}else{Ext.getCmp("er_site").hide();}var o=appConstants.publicJSON["compTypeCombo"];var u=d["er_comptype"];if(!Ext.isEmpty(o)){this.setValueWithOptionInList(v,"er_comptype",o,u);
}var q=Ext.getCmp("er_option");if(q!=undefined){var l=q.getValue();if(l!=undefined&&l=="Component"){Ext.getCmp("er_componentname").show();}else{Ext.getCmp("er_componentname").hide();}}var y=appConstants.publicJSON["componentCombo"];var u=d["er_componentname"];if(!Ext.isEmpty(y)){this.setValueWithOptionInList(v,"er_componentname",y,u);
}appConstants.rawDataForComponents=appConstants.publicJSON["componentCombo"];var e=appConstants.publicJSON["timelineCombo"];var h=d["selectedTimeline"];if(!Ext.isEmpty(e)){this.setValueWithOptionInList(v,"er_timeline",e,h);this.changeTimeline();}v.findField("er_mode").setValue(d["selectedGraphMode"]);
var t=v.findField("er_stdate");var m=v.findField("er_enddate");var j=v.findField("er_sthr");var r=v.findField("er_endhr");t.setValue(d["startDateForDisplay"]);t.dataArray=d["startDate"];j.setValue(d["startHourForDisplay"]);j.dataArray=d["startHour"];m.setValue(d["endDateForDisplay"]);m.dataArray=d["endDate"];
r.setValue(d["endHourForDisplay"]);r.dataArray=d["endHour"];stmin=d["startMinForDisplay"];enmin=d["endMinForDisplay"];mgr_stmin=d["startmin"];mgr_enmin=d["endmin"];var n=appConstants.publicJSON["hiddens"];var p=n["fromScheduleModify"];var b=n["fromFavoriteModify"];if(!hideBackButton){Ext.getCmp("CitrixCapacityPredictionForm").add({xtype:"hidden",id:"ID",name:"ID",value:appConstants.publicJSON["ID"]});
}if((p!=null&&p=="Yes")||(b!=null&&b=="Yes")){this.getResultpanel().removeAll();this.getResultpanel().hide();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();
}var i=n["fromFavoriteModify"];if(appConstants.isSubmit=="true"&&i!="Yes"){this.getResultpanel().removeAll();this.getResultpanel().show();if(d["reportGenSelected"]=="foreground"){var c=appConstants.publicJSON["RESULT_DATA"];var g=appConstants.publicJSON["NO_DATA"];if(!Ext.isEmpty(c)){if(g!=undefined&&g=="yes"){this.getResultpanel().add({xtype:"container",height:270,margin:10,ui:"newContainer",html:'<table width="100%" height="100%"><tr><td align="center" valign="middle"><div class="iconExclamation" ></div><div class="commonErrorMsgText">No Measures Available </div></td></tr></table>'});
}else{this.loadData(c);this.enableTools();}}else{this.getResultpanel().add({xtype:"container",height:270,margin:10,ui:"newContainer",html:'<table width="100%" height="100%"><tr><td align="center" valign="middle"><div class="iconExclamation" ></div><div class="commonErrorMsgText">No Measures Available </div></td></tr></table>'});
}}else{var c=appConstants.publicJSON["backgroundResults"];this.loadBackground(c);}}else{if(appConstants.isForceSubmit=="true"){appConstants.isForceSubmit="false";this.submitReport(Ext.getCmp("submit"));}}},validateSettings:function(){var a=true;var b=this.getCitrixCapacityPredictionSettings().getForm();
var d=b.findField("reportGeneration").getValue();if(d!=null&&(d=="background"||d=="background")){var c=b.findField("bgReportName").getValue();if(!validateTextBoxWithSpecialChars(c,"Attachment",true)){reportNameObj.focus();return false;}}return a;},showResult:function(b){if(b=="yes"){this.generateResult();
}else{if(!isSettingsEnabled){this.getReporterSettings().down("button").fireHandler();}Ext.getCmp("reportGeneration").setValue("background");var a=Ext.getCmp("bgReportName");a.setValue("");a.show();var c=Ext.getCmp("bgReportName").getValue();if(!validateTextBoxWithSpecialChars(c,"Attachment",true)){a.focus();
isSettingsOk=false;}}},insertNotApplicable:function(a,c){var b=a.findField(c);b.getStore().removeAll();b.getStore().add({"displayField":appConstants.notApplicable,"valueField":"-1"});b.setValue("-1");},loadScreenLabels:function(c,a){var d="";for(var b in a){d=!Ext.isEmpty(c.findField(b))?c.findField(b):Ext.getCmp(b);
if(d.getXType()!="label"){Ext.getCmp(b).setFieldLabel(a[b]);}else{Ext.getCmp(b).setText(a[b]);}}},setValueWithOptionInList:function(a,d,c,b){if(!Ext.isEmpty(c)){a.findField(d).getStore().loadRawData(c);}a.findField(d).suspendEvents(false);if(!Ext.isEmpty(b)){a.findField(d).setValue(b);}else{a.findField(d).setValue(c[0].valueField);
}a.findField(d).resumeEvents();},getSettingsFieldValue:function(a,f,c,d){var e="";if(c){var b=a.findField(f);if(!Ext.isEmpty(b)){e=b.getValue();}}else{e=appConstants.publicJSON.selectedValues[d];}return e;}});