Ext.define("EgCitrixDashCloud.view.HomeView",{extend:"Ext.panel.Panel",alias:"widget.homeview",itemId:"homeView",requires:["EgCitrixDashCloud.view.Components.UserExperienceGauge","EgCitrixDashCloud.view.Components.HealthChart","EgCitrixDashCloud.view.Components.SparkLines","EgCitrixDashCloud.view.Components.StackedArea","EgCitrixDashCloud.view.Components.SessionView","EgCitrixDashCloud.view.Components.UserImpact","EgCitrixDashCloud.view.Components.Logon","EgCitrixDashCloud.view.Components.Applications"],margin:10,updateView:function(){$.ajax({url:"/final/servlet/com.eg.EgCommonDashboardController?isFrom=KPIHome&iniName=eg_XenUserDetails&userBased=true&showConfig=true&dashboard_name=Citrix_Performance&selectedTab=Overview&user_name=admin&time_line=current&bala=true&zoneName="+queryReqParams.zoneName,type:"POST",success:function(b){if(!Ext.isEmpty(b)&&!Ext.isEmpty(b.loadViewDetails)){Ext.ComponentQuery.query("#sessionview")[0].updateView(b.loadViewDetails[0]);
Ext.ComponentQuery.query("#stackedSession")[0].updateChartValue({series:b.loadViewDetails[1].second_block[0].DataSet,chartType:"area"});Ext.ComponentQuery.query("#combinationLogin")[0].updateChartValue({series:b.loadViewDetails[1].second_block[1],});var c=Ext.ComponentQuery.query("#applications")[0];
if(!Ext.isEmpty(c)){try{var a=c.getValue();c.updateView(a);}catch(d){}}if(!Ext.isEmpty(interValId)){clearTimeout(interValId);}interValId=setInterval(function(){if(!Ext.isEmpty(c)){try{c.triggerComboChange(Ext.ComponentQuery.query("#applicationsCombo")[0]);}catch(e){}}},parseInt(topApplicationRefreshTime)*1000);
Ext.ComponentQuery.query("#industryBlock")[0].update('<div class="top">Industry ('+b.loadViewDetails[3].fourth_block[0].ind_std+"%)<i></i></div>");Ext.ComponentQuery.query("#uxgauge")[0].updateChartValue({uxRate:isNaN(parseInt(b.loadViewDetails[3].fourth_block[0].value))?0:parseInt(b.loadViewDetails[3].fourth_block[0].value),title:b.loadViewDetails[3].fourth_block[0].heading});
Ext.ComponentQuery.query("#userimpact")[0].update([b.loadViewDetails[3].fourth_block[1],b.loadViewDetails[3].fourth_block[2]]);Ext.ComponentQuery.query("#userimpact")[0].doComponentLayout();Ext.ComponentQuery.query("#stackedSessionCount")[0].updateChartValue({series:b.loadViewDetails[4].fifth_block[0].graphArr,chartType:"area"});
Ext.ComponentQuery.query("#healthchartAcess")[0].updateChartValue({backgroundColor:isNaN(parseInt(b.loadViewDetails[5].sixth_block[0].value))?"#cf3c28":(parseInt(b.loadViewDetails[5].sixth_block[0].value)>25)?"#4da24f":"#cf3c28",title:b.loadViewDetails[5].sixth_block[0].heading,series:[{name:"Healthy",data:[{y:isNaN(parseInt(b.loadViewDetails[5].sixth_block[0].value))?0:parseInt(b.loadViewDetails[5].sixth_block[0].value),color:isNaN(parseInt(b.loadViewDetails[5].sixth_block[0].value))?"#8f2817":(parseInt(b.loadViewDetails[5].sixth_block[0].value)>25)?"#2d663b":"#8f2817"}],}]});
Ext.ComponentQuery.query("#stackedareaAcess")[0].updateChartValue({series:b.loadViewDetails[5].sixth_block[1].DataSet,chartType:"line"});Ext.ComponentQuery.query("#healthchartControl")[0].updateChartValue({backgroundColor:isNaN(parseInt(b.loadViewDetails[6].seventh_block[0].value))?"#cf3c28":(parseInt(b.loadViewDetails[6].seventh_block[0].value)>25)?"#4da24f":"#cf3c28",title:b.loadViewDetails[6].seventh_block[0].heading,series:[{name:"Healthy",data:[{y:isNaN(parseInt(b.loadViewDetails[6].seventh_block[0].value))?0:parseInt(b.loadViewDetails[6].seventh_block[0].value),color:isNaN(parseInt(b.loadViewDetails[6].seventh_block[0].value))?"#8f2817":(parseInt(b.loadViewDetails[6].seventh_block[0].value)>25)?"#2d663b":"#8f2817"}],}]});
Ext.ComponentQuery.query("#stackedareaControl")[0].updateChartValue({series:b.loadViewDetails[6].seventh_block[1].DataSet,chartType:"area"});Ext.ComponentQuery.query("#healthchartResource")[0].updateChartValue({backgroundColor:isNaN(parseInt(b.loadViewDetails[7].eigth_block[0].value))?"#cf3c28":(parseInt(b.loadViewDetails[7].eigth_block[0].value)>25)?"#4da24f":"#cf3c28",title:b.loadViewDetails[7].eigth_block[0].heading,series:[{name:"Healthy",data:[{y:isNaN(parseInt(b.loadViewDetails[7].eigth_block[0].value))?0:parseInt(b.loadViewDetails[7].eigth_block[0].value),color:isNaN(parseInt(b.loadViewDetails[7].eigth_block[0].value))?"#8f2817":(parseInt(b.loadViewDetails[7].eigth_block[0].value)>25)?"#2d663b":"#8f2817"}],}]});
Ext.ComponentQuery.query("#sparklinesResource")[0].updateChartValue(b.loadViewDetails[7].eigth_block);}}});},layout:{type:"vbox",align:"stretch",},items:[{xtype:"panel",scroll:true,autoScroll:true,flex:1,layout:{type:"fit",align:"stretch",},defaults:{minHeight:690,},items:[{xtype:"panel",layout:{type:"hbox",align:"stretch",},flex:1,items:[{xtype:"container",flex:0.11},{xtype:"panel",flex:1,layout:{type:"vbox",align:"stretch"},frame:false,listeners:{boxready:function(c){var b=this;
var a=Ext.get(c.id).mask("Loading..");$.ajax({url:"/final/servlet/com.eg.EgCommonDashboardController?isFrom=KPIHome&iniName=eg_XenUserDetails&userBased=true&showConfig=true&dashboard_name=Citrix_Performance&selectedTab=Overview&user_name=admin&time_line=current&bala=true&zoneName="+queryReqParams.zoneName,type:"POST",success:function(d){if(!Ext.isEmpty(d)&&!Ext.isEmpty(d.loadViewDetails)){Ext.suspendLayouts();
Ext.get(c.id).unmask();b.add({xtype:"panel",flex:0.5,margin:"0 0 10 0",layout:{type:"hbox",align:"stretch",pack:"center"},defaults:{flex:1},title:"",items:[{xtype:"sessionview",itemId:"sessionview",flex:0.99,margin:"0 10 0 0",data:d.loadViewDetails[0]},{xtype:"container",margin:"0 10 0 0",flex:2,layout:{type:"vbox",align:"stretch",pack:"center"},defaults:{flex:1},items:[{xtype:"container",ui:"boxwidget",layout:{type:"vbox",align:"stretch"},items:[{xtype:"stackedarea",showXaxis:(!Ext.isEmpty(d.loadViewDetails[1].second_block[1].dataArray)&&!Ext.isEmpty(d.loadViewDetails[1].second_block[1].splineDataArray))?false:true,itemId:"stackedSession",cls:"borderB",margin:"0 10 0 10",flex:0.5,chartValue:{series:d.loadViewDetails[1].second_block[0].DataSet,chartType:"area"}},{xtype:"logon",margin:"0 10 0 10",itemId:"combinationLogin",ui:"boxwidget",listeners:{boxready:function(e){e.setChartValue({series:d.loadViewDetails[1].second_block[1]});
}},chartValue:{},flex:0.5}]},{xtype:"applications",margin:"10 0 0 0",itemId:"applications",triggerComboChange:function(j){if(!Ext.isEmpty(j)){var f=j.store.getCount();var h=j.getSelectedIndex();var e=j.getValue();if(!Ext.isEmpty(e)){h=h+1;if(h==f){h=0;}var g=j.getStore().getAt(h);var i=g.get("value");
if(!Ext.isEmpty(i)){Ext.ComponentQuery.query("#applicationsCombo")[0].setValue(i);Ext.ComponentQuery.query("#applications")[0].updateView(i);}}}},updateView:function(e){$.ajax({url:"/final/servlet/com.eg.EgCommonDashboardController?isFrom=KPIHome&iniName=eg_XenUserDetails&userBased=true&showConfig=true&dashboard_name=Citrix_Performance&selectedTab=Overview&user_name=admin&time_line=current&bala=true&zoneName="+queryReqParams.zoneName+"&selectedApplications="+e,type:"POST",success:function(f){var g=Ext.ComponentQuery.query("#applications")[0];
if(!Ext.isEmpty(f)&&!Ext.isEmpty(f.loadViewDetails)&&!Ext.isEmpty(g)){g.updateChartValue({xAxis:{max:(!Ext.isEmpty(f.loadViewDetails[0].dataArr[0].maxVal))?f.loadViewDetails[0].dataArr[0].maxVal:null,categories:f.loadViewDetails[0].dataArr[0].categories,title:"Applications"},yAxis:{title:f.loadViewDetails[0].dataArr[0].yaxisLabel},series:f.loadViewDetails[0].dataArr[0].DataSet});
}}});},tools:[{xtype:"combobox",cls:"dropdown",itemId:"applicationsCombo",store:Ext.create("Ext.data.Store",{fields:["name","value"],data:d.loadViewDetails[2].third_block[1].comboArray}),width:100,queryMode:"local",displayField:"name",valueField:"value",value:d.loadViewDetails[2].third_block[1].selectedComboValue,listeners:{"select":function(){if(!Ext.isEmpty(interValId)){clearTimeout(interValId);
}var f=this;var g=f.getValue();var e=Ext.ComponentQuery.query("#applications")[0];if(!Ext.isEmpty(e)){e.updateView(g);}interValId=setInterval(function(){if(!Ext.isEmpty(e)){try{e.triggerComboChange(f);}catch(h){}}},parseInt(topApplicationRefreshTime)*1000);}}}],listeners:{boxready:function(e){e.updateChartValue({xAxis:{max:(!Ext.isEmpty(d.loadViewDetails[2].third_block[0].dataArr[0].maxVal))?d.loadViewDetails[2].third_block[0].dataArr[0].maxVal:null,categories:d.loadViewDetails[2].third_block[0].dataArr[0].categories,title:"Applications"},yAxis:{title:d.loadViewDetails[2].third_block[0].dataArr[0].yaxisLabel},series:d.loadViewDetails[2].third_block[0].dataArr[0].DataSet});
if(!Ext.isEmpty(interValId)){clearTimeout(interValId);}interValId=setInterval(function(){if(!Ext.isEmpty(e)){try{e.triggerComboChange(Ext.ComponentQuery.query("#applicationsCombo")[0]);}catch(f){}}},parseInt(topApplicationRefreshTime)*1000);}}}]},{xtype:"container",flex:0.99,layout:{type:"vbox",align:"stretch",pack:"center"},defaults:{flex:1},items:[{xtype:"container",ui:"boxwidget",margin:"0 0 10 0",layout:{type:"vbox",align:"stretch",pack:"center"},items:[{xtype:"label",itemId:"industryBlock",margin:"0",style:{"text-align":"center"},html:'<div class="top">Industry ('+d.loadViewDetails[3].fourth_block[0].ind_std+"%)<i></i></div>"},{xtype:"uxgauge",itemId:"uxgauge",margin:"10 5 0 0",flex:1,chartValue:{},listeners:{boxready:function(e){e.updateChartValue({uxRate:isNaN(parseInt(d.loadViewDetails[3].fourth_block[0].value))?0:parseInt(d.loadViewDetails[3].fourth_block[0].value),title:d.loadViewDetails[3].fourth_block[0].heading});
}}},{xtype:"button",height:50,padding:"5 5",border:false,cls:"uxButton",scale:"large",iconCls:"uxIcon",iconAlign:"left",margin:"0 20 10 20",text:"See how to improve your UX Index",listeners:{resize:function(g,h,f,e,i){if($("#"+g.id+" .x-btn-inner").width()+40>h){$("#"+g.id+" .x-btn-inner").css({"fontSize":"12px","marginLeft":"44px"});
}else{$("#"+g.id+" .x-btn-inner").css({"fontSize":"13px","marginLeft":"55px"});}},click:function(){goToUxImproveAlarmPage();}}}]},{xtype:"userimpact",itemId:"userimpact",ui:"boxwidget",data:[d.loadViewDetails[3].fourth_block[1],d.loadViewDetails[3].fourth_block[2]],listeners:{boxready:function(e){e.update([d.loadViewDetails[3].fourth_block[1],d.loadViewDetails[3].fourth_block[2]]);
}}}]}]},{xtype:"panel",flex:0.3,layout:{type:"hbox",align:"stretch",},defaults:{flex:1,ui:"boxwidget"},items:[{xtype:"panel",bodyPadding:0,margin:"0 10 0 0",layout:{type:"vbox",align:"stretch",},title:'<span style="font-weight:500;"> USER LOAD</span>',ui:"chartPanel",header:{ui:"plainHeader",padding:"10 10 10 20"},items:[{xtype:"stackedarea",margin:0,flex:1,itemId:"stackedSessionCount",chartValue:{series:d.loadViewDetails[4].fifth_block[0].graphArr,chartType:"area",},}]},{xtype:"container",flex:1,layout:{type:"vbox",align:"stretch"},margin:"0 10 0 0",items:[{xtype:"healthchart",itemId:"healthchartAcess",chartXTitlePosition:20,chartYTitlePosition:15,dataLabelsYPosition:-5,chartTitleTransform:"uppercase",chartPosition:["20%","55%"],minHeight:110,flex:0.8,chartValue:{backgroundColor:isNaN(parseInt(d.loadViewDetails[5].sixth_block[0].value))?"#cf3c28":(parseInt(d.loadViewDetails[5].sixth_block[0].value)>25)?"#4da24f":"#cf3c28",title:d.loadViewDetails[5].sixth_block[0].heading,series:[{name:"Healthy",data:[{y:isNaN(parseInt(d.loadViewDetails[5].sixth_block[0].value))?0:parseInt(d.loadViewDetails[5].sixth_block[0].value),color:isNaN(parseInt(d.loadViewDetails[5].sixth_block[0].value))?"#8f2817":(parseInt(d.loadViewDetails[5].sixth_block[0].value)>25)?"#2d663b":"#8f2817"}],}]},},{xtype:"stackedarea",itemId:"stackedareaAcess",flex:1,chartValue:{series:d.loadViewDetails[5].sixth_block[1].DataSet,chartType:"line"},margin:"0 10 0 0"}]},{xtype:"container",margin:"0 10 0 0",flex:1,layout:{type:"vbox",align:"stretch"},items:[{xtype:"healthchart",itemId:"healthchartControl",chartXTitlePosition:20,chartYTitlePosition:15,chartPosition:["20%","55%"],dataLabelsYPosition:-5,minHeight:110,flex:0.8,chartTitleTransform:"uppercase",chartXTitlePosition:10,chartYTitlePosition:15,chartValue:{backgroundColor:isNaN(parseInt(d.loadViewDetails[6].seventh_block[0].value))?"#cf3c28":(parseInt(d.loadViewDetails[6].seventh_block[0].value)>25)?"#4da24f":"#cf3c28",title:d.loadViewDetails[6].seventh_block[0].heading,series:[{name:"Healthy",data:[{y:isNaN(parseInt(d.loadViewDetails[6].seventh_block[0].value))?0:parseInt(d.loadViewDetails[6].seventh_block[0].value),color:isNaN(parseInt(d.loadViewDetails[6].seventh_block[0].value))?"#8f2817":(parseInt(d.loadViewDetails[6].seventh_block[0].value)>25)?"#2d663b":"#8f2817"}],}]},},{xtype:"stackedarea",itemId:"stackedareaControl",flex:1,chartValue:{series:d.loadViewDetails[6].seventh_block[1].DataSet,chartType:"area"},margin:"0 10 0 0"}]},{xtype:"container",flex:1,layout:{type:"vbox",align:"stretch"},items:[{xtype:"healthchart",itemId:"healthchartResource",html:"healthchart",chartTitleTransform:"uppercase",chartXTitlePosition:20,chartYTitlePosition:15,dataLabelsYPosition:-5,chartMargin:[0,0,0,0],chartPosition:["20%","55%"],minHeight:110,flex:0.8,chartValue:{backgroundColor:isNaN(parseInt(d.loadViewDetails[7].eigth_block[0].value))?"#cf3c28":(parseInt(d.loadViewDetails[7].eigth_block[0].value)>25)?"#4da24f":"#cf3c28",title:d.loadViewDetails[7].eigth_block[0].heading,series:[{name:"Healthy",data:[{y:isNaN(parseInt(d.loadViewDetails[7].eigth_block[0].value))?0:parseInt(d.loadViewDetails[7].eigth_block[0].value),color:isNaN(parseInt(d.loadViewDetails[7].eigth_block[0].value))?"#8f2817":(parseInt(d.loadViewDetails[7].eigth_block[0].value)>25)?"#2d663b":"#8f2817"}],}]},margin:"0 0 0 0"},{xtype:"sparklines",itemId:"sparklinesResource",flex:1,data:d.loadViewDetails[7].eigth_block}]}]});
Ext.resumeLayouts(true);}}});}},items:[]},{xtype:"container",flex:0.11,}]}]}]});