Ext.define("CitrixConnectionDetail.controller.CitrixConnectionDetail",{extend:"Ext.app.Controller",views:["Main","EgComponent"],refs:[{selector:"main",ref:"main"},{selector:"newUtilities",ref:"newUtilities"},{selector:"egcomponent",ref:"egcomponent"},{selector:"CitrixConnectionDetailForm",ref:"CitrixConnectionDetailForm"},{selector:"mainform",ref:"mainform"},{selector:"resultpanel",ref:"resultpanel"},{selector:"nomeasurepanel",ref:"nomeasurepanel"},{selector:"CitrixConnectionDetailSettings",ref:"CitrixConnectionDetailSettings"},{selector:"citrixConnectionDetailPie",ref:"citrixConnectionDetailPie"},{selector:"ReporterSettings",ref:"ReporterSettings"}],init:function(){this.control({"newUtilities":{"afterrender":this.loadTools},"main":{"afterrender":this.afterMainRender,},'mainform button[name="submit"]':{"click":this.submitReport},'mainform button[name="save"]':{"click":this.modifyScheduleFavorite},"newUtilities > #saveTool > button":{"click":this.saveReportAsPDF},"newUtilities > #printTool > button":{"click":this.printReport},"newUtilities > #mailTool > button":{"click":this.sendMail},"newUtilities > #csvTool > button":{"click":this.saveCsv},"newUtilities > #favoriteTool > button":{"click":this.saveFavorite},"newUtilities > #scheduleTool > button":{"click":this.saveSchedule},'mainform button[id="expandSelector"]':{"click":this.expandMe},'mainform button[id="expandSelectorUser"]':{"click":this.expandMeUser},'CitrixConnectionDetailForm combo[id="er_option"]':{"select":this.onSelectReportBy},'CitrixConnectionDetailForm combo[id="select_farm"]':{"select":this.onSelectReportSubType},'CitrixConnectionDetailForm combo[id="erOsMachine_type"]':{"select":this.onSelectMachineType},'CitrixConnectionDetailForm combo[name="er_comptype"]':{"select":this.ComponentTypeOnChange},'egcomponent multiselectfield[name="er_server"]':{"change":this.ComponentOnChange},'mainform trigger[id="compSearch"]':{"change":this.compMultiselect},'erapplication trigger[id="userSearch"]':{"change":this.filterMultiselect},"CitrixConnectionDetailSettings":{"afterrender":this.closeSetting},'CitrixConnectionDetailSettings combo[name="reportGeneration"]':{"select":this.reportGenChange},'CitrixConnectionDetailSettings button[id="moreOptionCloseId"]':{"click":this.validateAndCloseSettings},'CitrixConnectionDetailSettings button[id="submitViaSetting"]':{"click":this.closeSettingAndSubmit},'CitrixConnectionDetailSettings combo[id="er_excwe"]':{"select":this.excludeWeekendsChange},'mainform button[id="panelinsidetoggle"]':{"click":this.toggleForm}});
},loadTools:function(){this.getNewUtilities().loadIcon(true,true,true,false,false,true,true,false,false,false,true);Ext.getCmp("favoriteTool").setDisabled(false);Ext.getCmp("scheduleTool").setDisabled(false);},afterMainRender:function(){this.getMain().setTitle(appConstants.defaultLoadData.reportTitle);
var c=appConstants.defaultLoadData;this.setErOptionData(c);if(enableDeliveryDetails){this.setMachineTypeData(c);this.setDeliveryGroupData(c);this.setMeasurementData(c);}this.setSelectFarmData(c);this.setSelectCompTypeData(c);this.setServerData(c);var f=Ext.getCmp("er_timeline");f.getStore().loadRawData(c["timelineCombo"]);
f.setValue(c["selectedTimeline"]);var b=Ext.getCmp("er_stdate");b.setValue(c.startDateForDisplay);b.dataArray=c.startDate;var e=Ext.getCmp("er_sthr");e.setValue(c.startHourForDisplay);e.dataArray=c.startHour;var a=Ext.getCmp("er_enddate");a.setValue(c.endDateForDisplay);a.dataArray=c.endDate;var d=Ext.getCmp("er_endhr");
d.setValue(c.endHourForDisplay);d.dataArray=c.endHour;mgr_stmin=appConstants.defaultLoadData.startmin;mgr_enmin=appConstants.defaultLoadData.endmin;Ext.getCmp("CitrixConnectionDetailForm").add({xtype:"hidden",id:"ID",name:"ID",value:c["ID"]});},expandMe:function(a){if(Ext.isEmpty(appConstants.erUtils)){appConstants.erUtils=Ext.widget("erutils");
}appConstants.erUtils.expandMultiComboButton(Ext.getCmp("er_server"),Ext.getCmp("compLbl").text,a);},expandMeUser:function(a){if(Ext.isEmpty(appConstants.erUtils)){appConstants.erUtils=Ext.widget("erutils");}appConstants.erUtils.expandMultiComboButton(Ext.getCmp("er_application"),Ext.getCmp("appLbl").text,a);
},setErOptionData:function(b){var a=Ext.getCmp("er_option");a.getStore().loadRawData(b["reportBy"]);a.setValue(b["selectedreportBy"]);},setDeliveryGroupData:function(b){var a=Ext.getCmp("er_deliverGrup");a.getStore().loadRawData(b["deliveryGroupArrry"]);a.setValue(b["selectedDeliveryGroup"]);},setMachineTypeData:function(b){var a=Ext.getCmp("erOsMachine_type");
a.getStore().loadRawData(b["MachineTypeTypeArry"]);a.setValue(b["selectedMachineType"]);},setMeasurementData:function(b){var a=Ext.getCmp("er_measureBy");a.getStore().loadRawData(b["measureCombo"]);a.setValue(b["selectedMeasure"]);},setSelectFarmData:function(b){var c=b.screenLabelJson;var a=Ext.getCmp("select_farm");
a.setFieldLabel(c["reportByLabel"]);a.getStore().clearFilter(true);a.getStore().loadRawData(b["zoneCombo"]);a.setValue(b["selectedreportBySubType"]);},setSelectCompTypeData:function(b){var c=b.screenLabelJson;var a=Ext.getCmp("er_comptype");a.setFieldLabel(c["compTypeLabel"]);a.getStore().clearFilter(true);
a.getStore().loadRawData(b["compTypeCombo"]);a.setValue(b["selectedCompType"]);},setServerData:function(a){var b=Ext.getCmp("er_server");b.getStore().clearFilter(true);b.getStore().loadRawData(a["serverCombo"]);if(!Ext.isEmpty(a["selectedServer"])&&a["selectedServer"]!=undefined){b.setValue(a["selectedServer"]);
}else{b.setValue(a["serverCombo"][0].valueField);}},onSelectReportBy:function(c){var d=Ext.getCmp("er_option").getValue();var b="reportBy="+d;var a=this;appConstants.LoadingMask.show();Ext.Ajax.request({url:"/final/reporter/ErCitrixConnectionDetailJson.jsp",scope:this,method:"POST",params:b,success:function(e){var g=e.responseText;
var f=Ext.decode(g);appConstants.defaultLoadData=f;if(d=="Component"){Ext.getCmp("select_farm").hide();}else{Ext.getCmp("select_farm").show();a.setSelectFarmData(f);}a.setSelectCompTypeData(f);a.setServerData(f);appConstants.LoadingMask.hide();}});},onSelectMachineType:function(c){var b=c.getValue();
var d="erOsMachine_type="+b+"&method=getMachines";var e="&comptype="+Ext.getCmp("er_comptype").getValue();var a=this;appConstants.LoadingMask.show();Ext.Ajax.request({url:"/final/reporter/ErCitrixConnectionDetailJson.jsp",scope:this,method:"POST",params:d+e,success:function(f){var h=f.responseText;var g=Ext.decode(h);
appConstants.defaultLoadData=g;a.setDeliveryGroupData(g);appConstants.LoadingMask.hide();}});},onSelectReportSubType:function(c){var b=Ext.getCmp("er_option").getValue();var e=Ext.getCmp("select_farm").getValue();var d="reportBy="+b+"&reportBySubType="+e;var a=this;appConstants.LoadingMask.show();Ext.Ajax.request({url:"/final/reporter/ErCitrixConnectionDetailJson.jsp",scope:this,method:"POST",params:d,success:function(f){var h=f.responseText;
var g=Ext.decode(h);appConstants.defaultLoadData=g;a.setSelectCompTypeData(g);a.setServerData(g);appConstants.LoadingMask.hide();}});},ComponentTypeOnChange:function(d){var b=Ext.getCmp("er_option").getValue();var f=Ext.getCmp("select_farm").getValue();var c=Ext.getCmp("er_comptype").getValue();var e="reportBy="+b+"&reportBySubType="+f+"&comptype="+c;
var a=this;appConstants.LoadingMask.show();Ext.Ajax.request({url:"/final/reporter/ErCitrixConnectionDetailJson.jsp",scope:this,method:"POST",params:e,success:function(g){var i=g.responseText;var h=Ext.decode(i);appConstants.defaultLoadData=h;a.setServerData(h);appConstants.LoadingMask.hide();}});},ComponentOnChange:function(h,b,a,k){if(b.length>1&&b.indexOf("All")>-1){this.showMessage("Chosen component group not allowed");
return;}if(Ext.isEmpty(a)||a==undefined){return false;}var d=Ext.getCmp("er_option").getValue();var n=Ext.getCmp("select_farm").getValue();var c=Ext.getCmp("er_server").getValue();var g=Ext.getCmp("erOsMachine_type");var e=Ext.getCmp("er_deliverGrup");var l="";var j="&component=";for(var o=0;o<c.length;
o++){l+=j+c[o];}var f="reportBy="+d+"&reportBySubType="+n+l;if(g!=undefined){f+="&erOsMachine_type="+g.getValue();}if(e!=undefined){f+="&er_deliverGrup="+e.getValue();}var m="&comptype="+Ext.getCmp("er_comptype").getValue();var i=this;appConstants.LoadingMask.show();Ext.Ajax.request({url:"/final/reporter/ErCitrixConnectionDetailJson.jsp",scope:this,method:"POST",params:f+m,success:function(p){var r=p.responseText;
var q=Ext.decode(r);appConstants.defaultLoadData=q;i.setDeliveryGroupData(q);appConstants.LoadingMask.hide();}});},userOnChange:function(d,c,a,b){if(c.length>1&&c.indexOf("All")>-1){this.showMessage("Chosen user group not allowed");return;}},saveReportAsPDF:function(){var a="../reporter/ErHtmlToSavePdf.jsp?";
if(Ext.isEmpty(appConstants.erUtils)){appConstants.erUtils=Ext.widget("erutils");}appConstants.erUtils.savePDF(a);},bookletQuery:function(b){var a="er_rtype=CitrixConnectionDetail";return a;},bookletScheduleQuery:function(b){var a=this.getQueryString();a+="&er_rtype=CitrixConnectionDetail&er_trgttype=Citrix_Connection_Detail&er_ViewName=ErCitrixConnectionDetail.jsp&er_RmDispName=Citrix_Connection_Detail";
return a;},bookletPreview:function(){this.printReport();},printReport:function(){var a="/final/reporter/ErCitrixConnectionDetailPrint.jsp?&pdfPrint=yes&inidate="+appConstants.defaultLoadData.inidate;parent.printWindowFn(a);},sendMail:function(){Ext.widget("sendmail").show();},saveCsv:function(){window.location="../servlet/com.eg.ErCitrixConnectionDetailReportC?er_view=CSV";
},saveSchedule:function(b){var c=this.getQueryString();var a="/final/reporter/ErSaveSchedule.jsp?er_rtype=CitrixConnectionDetail&er_trgttype=Citrix_Connection_Detail&er_ViewName=ErCitrixConnectionDetail.jsp&er_RmDispName=Citrix_Connection_Detail&"+c+"&com.eg.CSRF_NONCE="+csrfToken;if(Ext.getCmp("er_timeline").getValue()=="Any"){this.showMessage("Chosen timeline not allowed");
return;}parent.scheduleWindowFn(a);},saveFavorite:function(){var b=this.getQueryString();var a="/final/reporter/ErSaveFavorite.jsp?er_trgttype=Citrix_Connection_Detail&er_rtype=CitrixConnectionDetail&er_ViewName=ErCitrixConnectionDetail.jsp&er_RmDispName=Citrix_Connection_Detail&"+b+"&com.eg.CSRF_NONCE="+csrfToken;
parent.favouriteWindowFn(a);},modifyScheduleFavorite:function(){var d=this.getQueryString();var c="&er_trgttype=Citrix_Connection_Detail&er_rtype=CitrixConnectionDetail&er_ViewName=ErCitrixConnectionDetail.jsp&er_RmDispName=Citrix_Connection_Detail&fromFavoriteModify=Yes&cmd=client";var a="&schedule_id="+appConstants.scheduleID+"&fromScheduleModify=Yes";
var b="&FavoriteId="+appConstants.favoriteID+"&fromFavoriteModify=Yes&er_favorite="+appConstants.erFavorite+"&er_rtype=CitrixConnectionDetail";var f="";if(appConstants.isModifyFavorite=="Yes"){f="/final/reporter/ErSaveFavorite.jsp?showSchWindow=no";d+=c+b;}else{f="/final/reporter/ErSaveSchedule.jsp?showSchWindow=no";
d+=c+a;}var e=Ext.create("Ext.form.Panel");e.submit({url:f,params:d,standardSubmit:true,method:"POST"});},compMultiselect:function(a){if(Ext.isEmpty(appConstants.erUtils)){appConstants.erUtils=Ext.widget("erutils");}a.toggleTriggger();appConstants.erUtils.filterComboStore(a,Ext.getCmp("er_server"),appConstants.defaultLoadData["serverCombo"]);
},filterMultiselect:function(a){if(Ext.isEmpty(appConstants.erUtils)){appConstants.erUtils=Ext.widget("erutils");}a.toggleTriggger();appConstants.erUtils.filterComboStore(a,Ext.getCmp("er_application"),appConstants.defaultLoadData["userCombo"]);},submitReport:function(k){Ext.getCmp("panelinsidetoggle").setDisabled(false);
var e="";if(appConstants.isSubmit!=null&&appConstants.isSubmit=="true"){e=this.getQueryString();}else{e=this.getQueryString();if(e==false){return;}}var g=this;var h="foreground";if(isSettingsEnabled){h=Ext.getCmp("reportGeneration").getValue();}if(h=="foreground"){var f=this;var d=appConstants.defaultLoadData.limitforbg;
var i=appConstants.defaultLoadData.maxDays;var j=Ext.getCmp("er_stdate").getValue();var b=Ext.getCmp("er_sthr").getValue();var a=Ext.getCmp("er_enddate").getValue();var c=Ext.getCmp("er_endhr").getValue();j.setHours(b);a.setHours(c);if(!checkTimeLineForBgLimit(d,i,j,a)){Ext.Msg.confirm("Confirm",appConstants.forGrdReportConfirmMsg,function(m){if(m==="no"){this.getReporterSettings().down("button").fireHandler();
Ext.getCmp("reportGeneration").setValue("background");var l=Ext.getCmp("bgReportName");l.show();l.focus(false,1000);Ext.getCmp("submitViaSetting").show();Ext.getCmp("moreOptionCloseId").hide();validateTextBoxWithSpecialChars(l.getValue(),"Attachment",true);return false;}else{if(m==="yes"){f.submitReportByAjaxCall(e);
}}},this);}else{f.submitReportByAjaxCall(e);}}else{e+="&servletName=ErCitrixConnectionDetailReportC&er_rtype=CitrixConnectionDetail&er_ViewName=ErCitrixConnectionDetail.jsp&er_RmDispName=Citrix_Connection_Detail";e+="&er_trgttype=Citrix_Connection_Detail&forwardto=CitrixConnectionDetail&er_bgreportfrom=CitrixConnectionDetail&bgenabled=Yes&savereport=save";
if(h=="background"){bgUrl="/final/servlet/com.eg.ErStartBackGroundReportC";}else{if(h=="background-csv"){bgUrl="../servlet/com.eg.ErStartBackGroundReportC?SaveFormat=CSV";}}appConstants.LoadingMask.show();Ext.Ajax.request({url:bgUrl,scope:this,method:"POST",params:e,success:function(m){var n=Ext.getCmp("backGroundPanel");
appConstants.LoadingMask.hide();var p=m.responseText;var o=Ext.decode(p);var q=o.reportVal;var l=q.status;var r="";if(l=="success"){r='<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">'+q.bgstr1+".</br>"+'<a class="backgroundMsgLink" href="'+q.queryString+'">'+q.bgstr2+"</a></div></td></tr></table></td></tr></table>";
}else{if(l=="duplicate"){r='<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">'+q.bgstr1+".</br>"+'<a class="backgroundMsgLink" href="'+q.queryString+'">'+q.bgstr2+"</a></div></td></tr></table></td></tr></table>";
}else{r='<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">'+q.bgstr1+"</div></td></tr></table></td></tr></table>";
}}n.update(r);n.show();}});}},submitReportByAjaxCall:function(b){appConstants.LoadingMask.show();b+="&er_view=submit";var a=this;Ext.Ajax.request({url:"/final/servlet/com.eg.ErCitrixConnectionDetailReportC",scope:this,method:"POST",params:b,success:function(g){var K=Ext.getCmp("resultPanel");var o=0;
K.removeAll();var D=Ext.getCmp("resultPie");D.show();D.removeAll();Ext.getCmp("bookletTool").setDisabled(false);Ext.getCmp("saveTool").setDisabled(false);Ext.getCmp("printTool").setDisabled(false);Ext.getCmp("mailTool").setDisabled(false);var m=g.responseText;var L=Ext.decode(m);Ext.getCmp("selectionDetails").setSelectionDetailsData(L.selectionDetails);
var Y;var q="";var e="";var p="";var W="";if(appConstants.reportFor=="ConnectionFailers"){if(L["isDataFoundCon"]==true){p+='<div id="leftChartContent" style="overflow:auto;padding:0px 0px 0px 20px" >';p+="</div>";W+='<div id="connectionContentBar" style="height:312px;width:100% !important;overflow:auto;padding:0px" class="htmlTableBody">';
W+="</div>";Y=L.userConnection.DataSet[0].data;q+="<div><table>";e+="<div><table>";for(var X=0;X<Y.length;X++){q+='<tr><td><div style="background-color:'+Y[X].color+';" class="legendCircleNew">&nbsp;</div></td><td style="padding:2px 20px 2px 5px;float:left" class="pieLegendFont"><div id="customLeg'+o+'" style="cursor:pointer">'+Y[X].name+"</div></td></tr>";
}q+="</table></div>";Y=L.connectionBar.DataSet;for(var X=0;X<Y.length;X=X+2){if(X%2==0){e+="<tr>";}e+='<td><div style="background-color:'+Y[X].color+';" class="legendSquare">&nbsp;</div></td><td style="padding:2px 20px 2px 5px;float:left" class="pieLegendFont"><div id="customLeg'+o+'" style="cursor:pointer">'+Y[X].name+"</div></td>";
o=o+1;if((X+1)<Y.length){e+='<td><div style="background-color:'+Y[X+1].color+';" class="legendSquare">&nbsp;</div></td><td style="padding:2px 20px 2px 5px;float:left" class="pieLegendFont"><div id="customLeg'+o+'" style="cursor:pointer">'+Y[X+1].name+"</div></td></tr>";o=o+1;}else{if(Y.length==1){e+="</tr>";
}else{e+="<td></td><td></td></tr>";}}}e+="</table></div>";}else{p=appConstants.defaultLoadData["noFailMSG"];W=appConstants.defaultLoadData["noFailMSG"];}}var A="";var C="";var h="";var E="";var r="";if(L["isDataFoundServer"]==true){A+='<div id="leftChartContent1" style="height:220px;width:450px !important;overflow:auto;padding:0px" class="htmlTableBody">';
A+="</div>";h+='<div id="serverByDeliveryGp" style="height:220px;width:100%;overflow-y:auto;overflow-x:hidden;padding:0px" class="htmlTableBody">';h+="</div>";C+='<div id="serverContentBar" style="height:250px;width:500px !important;overflow:auto;padding:12px" class="htmlTableBody showDiv">';C+='<div style="height:60px;margin-right:10px;" id="commonLeg_serverContentBar" class="showDiv commonLeg">';
C+='<div id="serverContentBar_legend" style="height:51px;width:100%;overflow:hidden;display:inline-block;vertical-align: middle;" class="showDiv"></div></div></div>';Y=L.serverOSChart.DataSet[0].data;E+="<div><table>";r+="<div><table>";for(var X=0;X<Y.length;X++){E+='<tr><td><div style="background-color:'+Y[X].color+';" class="legendSquare">&nbsp;</div></td><td style="padding:2px 20px 2px 5px;float:left" class="pieLegendFont"><div id="customLeg'+o+'" style="cursor:pointer">'+Y[X].name+"</div></td></tr>";
}E+="</table></div>";Y=L.serverOSBar.DataSet;for(var X=0;X<Y.length;X++){r+='<tr><td><div style="background-color:'+Y[X].color+';" class="legendSquare">&nbsp;</div></td><td style="padding:2px 20px 2px 5px;float:left" class="pieLegendFont"><div id="customLeg'+o+'" style="cursor:pointer">'+Y[X].name+"</div></td></tr>";
}r+="</table></div>";}else{A='<div class="egFlexCenterByColumnWise" style="height:220px"> <div class="iconNoalarms"></div> <div class="commonErrorMsgText">'+appConstants.defaultLoadData["noFailMSG"]+"</div> </div>";h='<div class="egFlexCenterByColumnWise" style="height:220px"> <div class="iconNoalarms"></div> <div class="commonErrorMsgText">'+appConstants.defaultLoadData["noFailMSG"]+"</div> </div>";
C='<div class="egFlexCenterByColumnWise" style="height:250px;"> <div class="iconNoalarms"></div> <div class="commonErrorMsgText">'+appConstants.defaultLoadData["noFailMSG"]+"</div> </div>";}var y="";var Q="";var c="";var G="";var H="";if(L["isDataFoundDesktop"]==true){y+='<div id="leftChartContent2" style="height:220px;width:100%;padding:0px" class="htmlTableBody">';
y+="</div>";c+='<div id="desktopByDeliveryGp" style="height:220px;width:100%;overflow-y:auto;overflow-x:hidden;padding:0px" class="htmlTableBody">';c+="</div>";Q+='<div id="desktopContentBar" style="height:250px;width:100%;padding:12px" class="htmlTableBody showDiv">';Q+='<div style="height:60px;margin-right: 10px;" id="commonLeg_desktopContentBar" class="showDiv commonLeg">';
Q+='<div id="desktopContentBar_legend" style="height:51px;width:100%;overflow:hidden;display:inline-block;vertical-align: middle;" class="showDiv"></div>';Q+="</div></div>";Y=L.desktopOSChart.DataSet[0].data;G+="<div><table>";H+="<div><table>";for(var X=0;X<Y.length;X++){G+='<tr><td><div style="background-color:'+Y[X].color+';" class="legendSquare">&nbsp;</div></td><td style="padding:2px 20px 2px 5px;float:left" class="pieLegendFont"><div id="customLeg'+o+'" style="cursor:pointer">'+Y[X].name+"</div></td></tr>";
}G+="</table></div>";Y=L.desktopOSBar.DataSet;for(var X=0;X<Y.length;X=X+2){if(X%2==0){H+="<tr>";}H+='<td><div style="background-color:'+Y[X].color+';" class="legendSquare">&nbsp;</div></td><td style="padding:2px 20px 2px 5px;float:left" class="pieLegendFont"><div id="customLeg'+o+'" style="cursor:pointer">'+Y[X].name+"</div></td>";
o=o+1;if((X+1)<Y.length){H+='<td><div style="background-color:'+Y[X+1].color+';" class="legendSquare">&nbsp;</div></td><td style="padding:2px 20px 2px 5px;float:left" class="pieLegendFont"><div id="customLeg'+o+'" style="cursor:pointer">'+Y[X+1].name+"</div></td></tr>";o=o+1;}else{if(Y.length==1){H+="</tr>";
}else{H+="<td></td><td></td></tr>";}}}H+="</table></div>";}else{y='<div class="egFlexCenterByColumnWise" style="height:220px"> <div class="iconNoalarms"></div> <div class="commonErrorMsgText">'+appConstants.defaultLoadData["noFailMSG"]+"</div> </div>";c='<div class="egFlexCenterByColumnWise" style="height:220px"> <div class="iconNoalarms"></div> <div class="commonErrorMsgText">'+appConstants.defaultLoadData["noFailMSG"]+"</div> </div>";
Q='<div class="egFlexCenterByColumnWise" style="height:250px;"> <div class="iconNoalarms"></div> <div class="commonErrorMsgText">'+appConstants.defaultLoadData["noFailMSG"]+"</div> </div>";}var R=15;var w=false;if(appConstants.reportFor=="ConnectionFailers"){if(L.connectionData.length<R){w=true;}else{w=false;
}}var x=1;var N=new Array();if(!Ext.isEmpty(L.heading_1)&&L.heading_1!=undefined){var T=0;for(var v in L.heading_1){N[T]=v;T++;}}N[T]="dataDetails";var aa=L.colLength;var F="";var f="";if(L["expandFoundCon"]!=""){f=[{ptype:"rowexpander",selectRowOnExpand:true,expandOnDblClick:false,expandOnEnter:false,collapsible:true,animCollapse:false,rowBodyTpl:['<div style="padding:10px 20px 10px 10px;" >{dataDetails}</div>']}];
}if(appConstants.reportFor=="ConnectionFailers"){var z=new Array();for(var J in L.heading_1){z.push({header:L.heading_1[J],sortable:true,dataIndex:J,align:J=="info"?"left":"center",width:J=="clientConnFailures"?200:160,renderer:function(ad,s,i,af,ac,ab,ae){ad=a.getNumberFormat(ad.toString());return ad;
}});}var d=Ext.create("Ext.data.Store",{fields:N,data:L.connectionData,pageSize:R,autoLoad:true,proxy:{type:"pagingmemory"}});if(L["isDataFoundCon"]==true){F=Ext.create("Ext.container.Container",{layout:"column",margin:"0 0 0 0",items:[{xtype:"container",columnWidth:0.4,margin:"5 0 5 0",layout:"column",items:[{xtype:"panel",title:"Total User Connection Failures",ui:"newGraphPanel",columnWidth:1,align:"stretch",margin:"0 10 5 0",padding:"0 0 0 0",html:'<table align="center" ><tr><td align="center" nowrap><div style="display:flex;justify-content:center;align-items:center"><div class="iconFailedSimulations"/></div><div class="newFont_bold28" style="margin:5px;">'+L["total"]+'</div></div></td></tr><tr><td align="center"  width="100%" style="padding:0px 5px 10px 5px"><span class="newFont_normal13">Number</span></td></tr></table>'},{xtype:"panel",title:"Types of User Connection Failures",ui:"newGraphPanel",flex:1,layout:{type:"hbox",align:"stretch",},columnWidth:1,margin:"5 10 5 0",items:[{xtype:"container",html:p,},{xtype:"container",margin:"0 0 10 0",flex:1,layout:{type:"fit",align:"stretch",pack:"center"},cls:"egFlexCenterByColumnWise",html:q}]}]},{xtype:"panel",ui:"newGraphPanel",title:"User Connection Failures Trend",margin:"5 2 5 0",columnWidth:0.6,html:W}]});
}else{F=Ext.create("Ext.panel.Panel",{title:"Total User Connection Failures",ui:"newGraphPanel",margin:"5 2 10 0",height:200,layout:"fit",items:[{xtype:"container",cls:"egFlexCenterByColumnWise",flex:1,html:'<div class="iconNoalarms"></div><div class="commonErrorMsgText">'+appConstants.defaultLoadData["noFailMSG"]+"</div>"}],});
}K.add(F);if(L["isDataFoundCon"]==true){F=Ext.create("Ext.panel.Panel",{title:"Types of User Connection Failures by Delivery Group",ui:"newGraphPanel",margin:"0 2 10 0",items:[{xtype:"customgrid",sortableColumns:true,ui:"newGridPanel noHoverColor",id:"grid0",margin:"0 10 10 10",border:true,scroll:true,autoScroll:true,forceFit:true,store:d,columns:z,plugins:f,viewConfig:{stripeRows:true,getRowClass:function(i,ac,ab,s){if(i.raw.dataDetails==""){return"hidePlus";
}else{return;}},listeners:{sortchange:function(ab,ac,ad,s,i){a.gridColIndexParam=ac.getIndex();a.gridColStateParam=ac.sortState;this.getStore().loadPage(x);}}},dockedItems:[{xtype:"pagingtoolbar",cls:"newPagination",dock:"bottom",displayInfo:true,store:d,hidden:w,displayInfo:true,displayMsg:"Displaying {0} - {1} of {2}",emptyMsg:"No topics to display",listeners:{change:function(i,s){if(!Ext.isEmpty(s)){x=s.currentPage;
}else{x=1;}}}}]}]});}else{F=Ext.create("Ext.panel.Panel",{ui:"newGraphPanel",title:"User Connection Failures",margin:"0 2 2 0",height:400,html:'<div class="egFlexCenterByColumnWise" style="height:100%"> <div class="iconNoalarms"></div> <div class="commonErrorMsgText">'+appConstants.defaultLoadData["noFailMSG"]+"</div> </div>"});
}K.add(F);}K.show();if(L["isDataFoundCon"]==true){var S={};S=jQuery.extend(true,{},getHighChartsBarInstance("leftChartContent",200,170),S);S.setData(L.userConnection,"<%=currentDateFormat%>","");S.drawChart();var M={};M=jQuery.extend(true,{},getHighChartsBarInstance("connectionContentBar",290,600),M);
M.setData(L.connectionBar,"<%=currentDateFormat%>","");M.drawChart();}var k=false;if(appConstants.reportFor=="MachineFailers"||appConstants.reportFor=="MachineFailersDetail"){if(appConstants.reportFor=="MachineFailers"){var V=L["isDataFoundDesktop"]==true?false:true;var I="";I=Ext.create("Ext.container.Container",{layout:"column",margin:"5 2 10 0",items:[{xtype:"panel",margin:"0 10 0 0",columnWidth:0.5,ui:"newGraphPanel",title:"Server OS Failures By Type",html:A,},{xtype:"panel",columnWidth:0.5,ui:"newGraphPanel",title:"Desktop OS Failures By Type",html:y},]});
K.add(I);if(L["isDataFoundServer"]==true){var P={};P=jQuery.extend(true,{},getHighChartsBarInstance("leftChartContent1",210,400),P);P.setData(L.serverOSChart,"<%=currentDateFormat%>","");P.drawChart();}if(L["isDataFoundDesktop"]==true){var O={};O=jQuery.extend(true,{},getHighChartsBarInstance("leftChartContent2",210,400),O);
O.setData(L.desktopOSChart,"<%=currentDateFormat%>","");O.drawChart();}var B="";B=Ext.create("Ext.container.Container",{layout:"column",margin:"10 2 10 0",items:[{xtype:"panel",ui:"newGraphPanel",margin:"0 10 0 0",columnWidth:0.5,title:"Server OS Failures By Delivery Group",html:h,},{xtype:"panel",ui:"newGraphPanel",title:"Desktop OS Failures By Delivery Group",columnWidth:0.5,html:c,},]});
K.add(B);if(L["isDataFoundServer"]==true){var P={};P=jQuery.extend(true,{},getHighChartsBarInstance("serverByDeliveryGp",L.serverOSFailByDeliveryGroup.chartHeight,400),P);P.setData(L.serverOSFailByDeliveryGroup,"<%=currentDateFormat%>","");P.drawChart();}if(L["isDataFoundDesktop"]==true){var O={};O=jQuery.extend(true,{},getHighChartsBarInstance("desktopByDeliveryGp",L.desktopOSFailByDeliveryGroup.chartHeight,400),O);
O.setData(L.desktopOSFailByDeliveryGroup,"<%=currentDateFormat%>","");O.drawChart();}var n="";n=Ext.create("Ext.container.Container",{layout:"column",margin:"10 2 10 0",items:[{xtype:"panel",ui:"newGraphPanel",margin:"0 10 0 0",columnWidth:0.5,title:"Server OS Failures Trend",items:[{xtype:"container",id:"serverContentBar_GraphPanel",margin:"0 5 0 0",html:'<div id="serverContentBar" style="height:270px;margin-left:10px"> </div>',},{xtype:"container",margin:"0 10 10 0",height:53,id:"serverContentBar_legendPanel",style:{"overflow":"hidden"}}]},{xtype:"panel",ui:"newGraphPanel",title:"Desktop OS Failures Trend",columnWidth:0.5,items:[{xtype:"container",id:"desktopContentBar_GraphPanel",margin:"0 5 0 0",html:'<div id="desktopContentBar" style="height:270px;margin-left:10px"> </div>',},{xtype:"container",margin:"0 10 10 0",height:53,id:"desktopContentBar_legendPanel",style:{"overflow":"hidden"}}]},]});
K.add(n);if(L["isDataFoundDesktop"]==true){reportForHighChart("desktopContentBar",L.desktopOSBar);}else{Ext.get("desktopContentBar").update('<table width="100%" height="100%"><tr><td align="center" valign="middle"><div class="iconNoalarms" ></div><div class="commonErrorMsgText">'+appConstants.defaultLoadData["noFailMSG"]+"</div></td></tr></table>");
}if(L["isDataFoundServer"]==true){reportForHighChart("serverContentBar",L.serverOSBar);}else{Ext.get("serverContentBar").update('<table width="100%" height="100%"><tr><td align="center" valign="middle"><div class="iconNoalarms" ></div><div class="commonErrorMsgText">'+appConstants.defaultLoadData["noFailMSG"]+"</div></td></tr></table>");
}}if(appConstants.reportFor=="MachineFailersDetail"){var t=L.detailDataLine;var Z=false;var j="";if(L.isDetailLineEnable){Z=true;j+='<div id="detailLineId" style="height:300px;width:97% !important;overflow:auto;padding:10px" class="htmlTableBody">';j+="</div>";}else{j='<div class="egFlexCenterByColumnWise" style="height:400px"> <div class="iconNoalarms"></div> <div class="commonErrorMsgText">'+appConstants.defaultLoadData["noFailMSG"]+"</div> </div>";
}var U="";U=Ext.create("Ext.container.Container",{layout:"column",margin:"5 2 10 0",items:[{xtype:"panel",ui:"newGraphPanel",title:L.lineChartTitle,columnWidth:1,items:[{xtype:"container",id:"detailLineId_GraphPanel",margin:"0 5 0 0",html:j,},{xtype:"container",margin:"0 10 10 0",height:53,id:"detailLineId_legendPanel",style:{"overflow":"hidden"}}]}],});
K.add(U);if(Z){reportForHighChart("detailLineId",t);}var u="";if(!L["isDetailTableEnable"]){u=Ext.create("Ext.panel.Panel",{ui:"newGraphPanel",title:L.gridTitle,height:400,html:'<div class="egFlexCenterByColumnWise" style="height:100%"> <div class="iconNoalarms"></div> <div class="commonErrorMsgText">'+appConstants.defaultLoadData["noFailMSG"]+"</div> </div>"});
}else{var l=new Array();l.push(this.getGrid_machineFail_detail(L));u=Ext.create("Ext.panel.Panel",{layout:"column",ui:"newGraphPanel",title:L.gridTitle,id:"machinFailId",margin:"5 2 10 0",tools:[{xtype:"container",id:"machinToolId",html:'<img src="/final/images/spacer.gif" class="iconMagnify" id="callTooltip" style="vertical-align:middle;margin:5px 3px 0px 3px;" border="0px" onclick="javascript:openSmallPopupWindow(\''+L.headingSelCol+"','"+L.heading+"');\"/>"}],items:l});
}K.add(u);}}K.doLayout();appConstants.LoadingMask.hide();}});},openSmallPopupWindow:function(e,j){if(Ext.isEmpty(Ext.getCmp("GenericWindowId"))){var d=[];var i=this;var k=j.split(",");var f=k;if(e!=undefined&&e!="undefined"&&e.length>0){f=e.split(",");}for(var b in k){var a=k[b];var h=false;if(f.includes(a)){h=true;
}var c=a;if(c.indexOf("$")!=-1){c=c.substring(0,c.indexOf("$"));}if(c.indexOf("|")!=-1){c=c.substring(c.indexOf("|")+1);}d.push({xtype:"checkbox",cls:"checkbt",boxLabel:c,name:a,inputValue:a,checked:h,style:{"overflow-x":"hidden","white-space":"nowrap","margin-right":"12px"},});}var g=Ext.create("Ext.tip.ToolTip",{anchor:"top",anchorToTarget:true,anchorOffset:470,target:"callTooltip",scroll:false,layout:"fit",autoHide:false,border:false,width:540,maxWidth:540,height:246,id:"GenericWindowId",closeAction:"destroy",closable:true,ui:"newTooltipPopup",title:"Select Required Columns",listeners:{hide:function(){if(!Ext.isEmpty(Ext.getCmp("GenericWindowId"))){Ext.getCmp("GenericWindowId").doClose();
}},el:{"mouseenter":function(){if(!Ext.isEmpty(Ext.getCmp("GenericWindowId"))){Ext.getCmp("GenericWindowId").show();}},"mouseleave":function(){if(!Ext.isEmpty(Ext.getCmp("GenericWindowId"))){Ext.getCmp("GenericWindowId").doClose();}}}},items:[{xtype:"container",id:"chkPanel",layout:{type:"vbox",align:"center"},items:[{xtype:"panel",id:"chekboxAllCitrixCol",style:{"overflow-x":"hidden"},items:[{xtype:"checkboxgroup",columns:3,vertical:true,margin:6,labelAlign:"right",id:"multiColCitrixchkboxgroup",items:d,}]},{xtype:"button",text:"Update",id:"updateBtn",itemId:"Update",margin:"0 0 0 0",ui:"newButtonSmall",listeners:{"click":function(){var o=Ext.getCmp("multiColCitrixchkboxgroup").getChecked();
colm_2=new Array();colWidth=150;colName="";var m=Ext.getCmp("machinFailId");m.removeAll();var l=[];appConstants.selectedGridColumns="";Ext.each(o,function(q,p){l.push(q.getSubmitValue());appConstants.selectedGridColumns+=q.getSubmitValue();if(p<o.length-1){appConstants.selectedGridColumns+=",";}});var n="gridChange=yes&selColArry="+Ext.encode(l)+"&selectedGridColumns="+appConstants.selectedGridColumns;
Ext.Ajax.request({url:"/final/reporter/ErCitrixConnectionDetailJson.jsp",params:n,scope:this,method:"POST",success:function(p){var r=p.responseText;var q=Ext.decode(r);m.add(i.getGrid_machineFail_detail(q));if(!Ext.isEmpty(Ext.getCmp("GenericWindowId"))){Ext.getCmp("GenericWindowId").doClose();}Ext.getCmp("machinToolId").update('<img src="" class="iconMagnify" id="callTooltip" style="vertical-align:middle;margin:5px 0px 0px 3px;" onclick="javascript:openSmallPopupWindow(\''+q.headingSelCol+"','"+q.heading+"');\"/>");
}});}}}]}]}).show();}},getGrid_machineFail_detail:function(k){var m=[];var j=this;var h=false;var c=15;if(k.detailData.length<c){h=true;}else{h=false;}var g=k.heading;if(k.headingSelCol!=undefined&&k.headingSelCol.length>0){g=k.headingSelCol;}var f=Ext.create("Ext.data.Store",{fields:g,data:k.detailData,pageSize:c,autoLoad:true,proxy:{type:"pagingmemory",reader:{type:"array"}}});
var a=new Array();var e=150;var l="";for(var d in g){l=g[d];if(l!=undefined&&l.indexOf("$")!=-1){e=l.substring(l.indexOf("$")+1);l=l.substring(0,l.indexOf("$"));}if(l.indexOf("|")!=-1){l=l.substring(l.indexOf("|")+1);}e=parseFloat(e);a.push({header:l,sortable:true,dataIndex:g[d],align:"left",sortable:true,customWidth:e,renderer:function(r,o,n,t,q,p,s){return r;
}});}var b=8;var i=true;if(b<g.length){i=false;}return{xtype:"customgrid_builder",columnWidth:1,sortableColumns:true,ui:"newGridPanel",frame:false,border:true,scroll:true,autoScroll:true,needtoFixColumn:true,forceFit:i,layout:"fit",align:"stretch",id:"grid1",margin:"0 10 10 10",hidden:!k["isDetailTableEnable"],store:f,columns:a,dockedItems:[{xtype:"pagingtoolbar",cls:"newPagination",dock:"bottom",displayInfo:true,store:f,hidden:h,displayInfo:true,displayMsg:"Displaying {0} - {1} of {2}",emptyMsg:"No topics to display",listeners:{change:function(n,o){if(!Ext.isEmpty(o)){activePageServer=o.currentPage;
}else{activePageServer=1;}}}}]};},showConfigDropdown:function(){isSettingsEnabled=true;var c=new Ext.XTemplate('<div style="float:left;margin:0px 0px 0px 0px">More Options</div><div style="text-align:right;float:right;"><div class="iconCloseNew" id="closeSettings"></div></div>');Ext.create("Ext.container.Container",{width:569,id:"configMod",ui:"settingsWindowContainer",items:[{xtype:"container",cls:"configMode_popupArrow",style:{"top":"-14px","left":"385px"}},{xtype:"container",html:c.apply(),cls:"containerHeader",style:{"top":"0px","margin":"0px"}},{xtype:"CitrixConnectionDetailSettings",parent:this}],renderTo:"viewMain"});
var g=Ext.getCmp("timefrom");g.setValue(appConstants.defaultLoadData.sHrForSetting);var a=Ext.getCmp("minfrom");a.setValue(appConstants.defaultLoadData.sMinForSetting);var d=Ext.getCmp("timeto");d.setValue(appConstants.defaultLoadData.eHourForSetting);var f=Ext.getCmp("minto");f.setValue(appConstants.defaultLoadData.eMinForSetting);
var e=Ext.getCmp("er_excwe");e.getStore().loadRawData(appConstants.defaultLoadData.excludeWeekCombo);e.setValue(appConstants.defaultLoadData.sExclweekUI);Ext.getCmp("glduration").hide();Ext.getCmp("duraSelect").hide();Ext.getCmp("duration").hide();var b=Ext.getCmp("reportGeneration");b.getStore().loadRawData(appConstants.defaultLoadData.reportGenerationCombo);
b.setValue(appConstants.defaultLoadData.sRepGenType);},closeSetting:function(){Ext.getCmp("moreOptionCloseId").show();var a=this;Ext.get("closeSettings").on("click",function(){a.validateAndCloseSettings();});},validateAndCloseSettings:function(){if(Ext.getCmp("reportGeneration").getValue()=="background"&&!validateTextBoxWithSpecialChars(Ext.getCmp("bgReportName").getValue(),"Attachment",true)){return false;
}Ext.get("configMod").animate({duration:500,to:{y:-500}});return true;},closeSettingAndSubmit:function(){if(this.validateAndCloseSettings()){this.submitReport();}},getQueryString:function(){var z=true;var t=Ext.getCmp("er_option").getValue();var n=Ext.getCmp("er_deliverGrup").getValue();var f=Ext.getCmp("erOsMachine_type").getValue();
var g=Ext.getCmp("er_measureBy").getValue();var s=Ext.getCmp("select_farm").getValue();var q=Ext.getCmp("er_server").getValue();if(t=="-1"){this.showMessage("Report By is Not Applicable");return false;}else{if(!(t=="Component")&&s=="-1"){this.showMessage(t+"is Not Applicable");return false;}else{if(q.length==0||q[0]=="-1"){this.showMessage("Components is Not Applicable");
return false;}}}if(q.length>1&&q.indexOf("All")>-1){this.showMessage("Chosen component group not allowed");return false;}if(n=="-1"){this.showMessage("Delivery Groups is Not Applicable");return false;}var p="";var m="";var i="&component=";var D="&usr=";for(var o=0;o<q.length;o++){p+=i+q[o];}var B="reportBy="+t+"&reportBySubType="+s+p;
if(enableDeliveryDetails){B+="&er_deliverGrup="+n+"&er_measureBy="+g+"&erOsMachine_type="+f;}var h=Ext.getCmp("er_timeline").getValue();var e=Ext.getCmp("er_stdate").getValue();var C=Ext.getCmp("er_sthr").getValue();var w=Ext.getCmp("er_enddate").getValue();var c=Ext.getCmp("er_endhr").getValue();e.setHours(C);
w.setHours(c);if(!checkDateTime(e,w)){return false;}e=Ext.getCmp("er_stdate").dataArray;C=Ext.getCmp("er_sthr").dataArray;w=Ext.getCmp("er_enddate").dataArray;c=Ext.getCmp("er_endhr").dataArray;var y="&er_timeline="+h+"&startdate="+e+"&enddate="+w+"&starthr="+C+"&endhr="+c+"&startmin="+mgr_stmin+"&endmin="+mgr_enmin+"&inidate="+appConstants.defaultLoadData.inidate;
var v="";if(isSettingsEnabled){var u=Ext.getCmp("timefrom").getValue();var d=Ext.getCmp("minfrom").getValue();var j=Ext.getCmp("timeto").getValue();var F=Ext.getCmp("minto").getValue();var b=Ext.getCmp("er_excwe").getValue();var k=Ext.getCmp("glduration").getValue();var a=Ext.getCmp("duration").getValue().toString();
var r=Ext.getCmp("duraSelect").getValue();var E=Ext.getCmp("reportGeneration").getValue();var x="";if(!checkTimePeriod(u,d,j,F)){return false;}if(E!="foreground"){x=Ext.getCmp("bgReportName").getValue();if(!validateTextBoxWithSpecialChars(x,"Attachment",true)){return false;}}v="&hourFromUI="+u+"&minFromUI="+d+"&hourToUI="+j+"&minToUI="+F+"&exclweek="+b+"&rGenType="+E+"&bg_reportname="+x;
v+="&er_reportgenration="+E+"&bg_reportname="+x;}var A="&userID="+appConstants.defaultLoadData.loginid;var l="&comptype="+Ext.getCmp("er_comptype").getValue();B+=y;B+=v;B+=A;B+=l;B+="&selectedGridColumns="+encodeURIComponent(appConstants.selectedGridColumns);B+="&er_reportFor="+appConstants.reportFor;
return B;},reportGenChange:function(){Ext.getCmp("resultPanel").hide();var a=Ext.getCmp("reportGeneration").getValue();if(a!="foreground"){Ext.getCmp("bgReportName").setValue("");Ext.getCmp("bgReportName").show();Ext.getCmp("submitViaSetting").show();Ext.getCmp("moreOptionCloseId").hide();}else{Ext.getCmp("bgReportName").hide();
Ext.getCmp("submitViaSetting").hide();Ext.getCmp("moreOptionCloseId").show();}},showMessage:function(a){Ext.MessageBox.show({title:"User log no summary",msg:a,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});},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();}},getNumberFormat:function(a){if(!isNaN(a)&&!isNaN(parseFloat(a))||a=="-"){if(a!=null&&a.indexOf(".")>-1){strDecimal=a.substring(a.indexOf("."));str=a.substring(0,a.indexOf("."));a='<span class="decimal-align">'+str+'</span><span class="decimal-align2">'+strDecimal+"</span>";
}else{a='<span class="decimal-align">'+a+"</span>";}}return a;}});