Ext.define("widgets.SessionsParentPanel",{extend:"Ext.panel.Panel",alias:"widget.sessionsparentpanel",requires:["widgets.ChartPanel","citrixDashboard.view.OverviewPanel","citrixDashboard.view.GeoStaticPanel","citrixDashboard.view.SessionsConnected","citrixDashboard.view.EstablishedSessions","citrixDashboard.view.SessionsState","citrixDashboard.view.CommonGrid","citrixDashboard.view.SessionMapDetails"],margin:"0 0 0 0",defaults:{columnWidth:0.5,},layout:"column",manageOverflow:2,config:{data:null},constructor:function(a){this.initConfig(a);
this.callParent(arguments);},initComponent:function(){var b=this,a=[];b.callParent(arguments);},updatePanelData:function(a){var e="";if(!Ext.isEmpty(a)&&a.length==4){this.renderSessions("",e,a[1].Sessions_Block_1_Value,true);var g=a[2].Sessions_Block_2_Value[1].resultArray;var b=a[2].Sessions_Block_2_Value[1].resultArray.length;
var d=false;if(b>0){for(var f=0;f<b;f++){if(g[f]["Info"]!="+Unknown"){d=true;}}}if(g!=null&&b>0&&d){this.renderUsersConnected("",e,a[2].Sessions_Block_2_Value,true);}this.renderSessionsLogging("",e,a[3].Sessions_Block_3_Value,true);}},listeners:{"afterrender":function(d){var f="";var a=this.data;if(!Ext.isEmpty(a)&&a.length==4){this.renderSessions(d,f,a[1].Sessions_Block_1_Value);
var h=a[2].Sessions_Block_2_Value[1].resultArray;var b=a[2].Sessions_Block_2_Value[1].resultArray.length;var e=false;if(b>0){for(var g=0;g<b;g++){if(h[g]["Info"]!="+Unknown"){e=true;}}}if(h!=null&&b>0&&e){this.renderUsersConnected(d,f,a[2].Sessions_Block_2_Value);}this.renderSessionsLogging(d,f,a[3].Sessions_Block_3_Value);
}},},renderSessions:function(c,d,i,e){if(!Ext.isEmpty(e)&&e){try{var a=Ext.getCmp("renderSessions_sessionsconnected_Id");var g=Ext.getCmp("renderSessions_establishedsessions_id");var f=Ext.getCmp("renderSessions_sessionsstate_Id");if(!Ext.isEmpty(i[0].chartType)&&i[0].chartType=="StackedArea"){if(!Ext.isEmpty(a)){a.updateData(i[0]);
}}else{if(!Ext.isEmpty(i[0][0])){var b=Ext.getCmp("renderSessions_sessionsconnected_header_Id");if(!Ext.isEmpty(b)){b.setTitle('<span style="text-transform:capitalize !important;color:#2a292a;font-size: 15px;line-height:17px;">'+i[0][0].name+"</span>");}if(!Ext.isEmpty(a)){a.loadData(i[0][0]);}}}if(!Ext.isEmpty(g)){g.updateData(i[1][0]);
}if(!Ext.isEmpty(f)){f.updateData(i[2][0]);}}catch(h){}}else{var j=new Ext.Panel({columnWidth:1,layout:"column",border:false,frame:false,margin:"0 2 8 0",height:300,autoScroll:false,scroll:false,items:[{xtype:"container",padding:0,columnWidth:0.75,items:[{xtype:"container",ui:"eg-container",layout:"column",columnWidth:1,padding:0,border:false,frame:false,margin:"0 10 4 0",autoScroll:false,scroll:false,items:[],listeners:{"afterrender":function(l){if(!Ext.isEmpty(i)&&i.length==3){var k=this;
if(!Ext.isEmpty(i[0].chartType)&&i[0].chartType=="StackedArea"){k.add({xtype:"sessionsconnected",id:"renderSessions_sessionsconnected_Id",ui:"eg-x-panel",cls:"removePanelShadow",title:i[0].heading,data:i[0],height:298,columnWidth:0.7,});}else{if(!Ext.isEmpty(i[0][0])){k.add({xtype:"container",height:298,columnWidth:0.7,layout:{type:"vbox",align:"stretch"},listeners:{"afterrender":function(){var m=this;
m.add({xtype:"commongrid",id:"renderSessions_sessionsconnected_Id",ui:"eg-x-panel",cls:"removePanelShadow",height:275,columnWidth:0.7,ifSessions:true,data:i[0][0],margin:"10 10 0 10"});}}});}}k.add({xtype:"establishedsessions",ifSess:true,ui:"eg-x-panel",cls:"removePanelShadow",id:"renderSessions_establishedsessions_id",title:"<center><span>"+i[1][0].heading+"</span></center>",height:298,columnWidth:0.3,data:i[1][0]});
}}}}]},{xtype:"container",ui:"eg-container",columnWidth:0.25,border:false,frame:false,margin:"0 0 2 0",autoScroll:false,scroll:false,items:[],listeners:{"afterrender":function(l){var k=this;k.add({xtype:"sessionsstate",id:"renderSessions_sessionsstate_Id",ui:"eg-x-panel",layout:"fit",padding:"0 10 0 5",cls:"removePanelShadow",height:298,title:i[2][0].heading,Jdata:i[2][0],data:i[2][0]});
}}}]});this.add(j);}},renderUsersConnected:function(b,e,f,g){if(!Ext.isEmpty(g)&&g){try{var a=Ext.getCmp("renderUsersConnected_establisheduserConn_id");var d=Ext.getCmp("geo_static_panel_forSessions");var c=Ext.getCmp("session_id_mapdetails");if(!Ext.isEmpty(a)){a.updateData(f[0][0]);}if(!Ext.isEmpty(d)){d.updateData(f[1]);
}if(!Ext.isEmpty(c)){c.updateData(f[1]);}}catch(i){console.log("e1=-=->",i);}}else{var h=new Ext.Panel({xtype:"panel",ui:"eg-x-panel",columnWidth:1,layout:"hbox",border:false,frame:false,margin:"0 2 8 0",padding:"0 20 5 0",height:380,autoScroll:false,scroll:false,items:[],listeners:{"afterrender":function(k){var j=this;
try{j.add({xtype:"establishedsessions",ifSess:true,title:f[0][0].heading,ui:"eg-x-panel",cls:"removePanelShadow",id:"renderUsersConnected_establisheduserConn_id",height:380,bodyPadding:"50 0 0 0",flex:0.25,padValue:50,data:f[0][0]},{xtype:"geostaticpanel",id:"geo_static_panel_forSessions",height:380,flex:0.55,padding:"40 40 30 0",jsonData:f[1],mapStyle:strRumSkin=="Dark"?"dark":"light",mapType:"styled_map",markers:[{lat:35.682805,lng:139.756735,title:"Tokyo",url:"-"}],center:{lat:35.605568,lng:139.335907}},{flex:0.2,xtype:"sessionmapdetails",height:250,id:"session_id_mapdetails",jsonData:f[1],});
}catch(l){}}}});this.add(h);}},renderSessionsLogging:function(a,c,h,d){if(!Ext.isEmpty(d)&&d){try{var g=Ext.getCmp("sessionsPanel_headerId");var l=Ext.getCmp("sessionsconnected_minmax_history_grid_id1");var b=Ext.getCmp("renderSessionsLogging_Id");var f=Ext.getCmp("renderSessionsLoggingGrid_Id");var k=Ext.getCmp("sessionsPanel1_headerId");
var e=Ext.getCmp("sessionsgrid_minmax_history_grid_id1");var i=Ext.getCmp("sesionCompletedId1_id");if(!Ext.isEmpty(h[0].chartType)&&h[0].chartType=="StackedArea"){if(!Ext.isEmpty(g)){g.setTitle(h[0].heading);}if(!Ext.isEmpty(l)){l.store.loadRawData(h[0].maxmin);}if(!Ext.isEmpty(b)){b.updateData(h[0]);
}}else{if(!Ext.isEmpty(h[0][0])){if(!Ext.isEmpty(g)){g.setTitle(h[0][0].name);}if(!Ext.isEmpty(l)){l.store.loadRawData(h[0][0].maxmin);}if(!Ext.isEmpty(f)){f.loadData(h[0][0]);}}}if(!Ext.isEmpty(k)){k.setTitle(h[1][0].name);}if(!Ext.isEmpty(e)){e.store.loadRawData(h[1][0].maxmin);}if(!Ext.isEmpty(i)){i.loadData(h[1][0]);
}}catch(j){}}else{var m=new Ext.Panel({xtype:"panel",columnWidth:1,layout:"column",border:false,frame:false,margin:"0 1 0 0",autoScroll:false,scroll:false,id:"sessionsPanel",items:[{xtype:"panel",ui:"eg-x-panel",height:373,bodyPadding:"10 20 0 20",margin:"0 8 2 0",columnWidth:0.5,layout:{type:"vbox",align:"stretch"},items:[],listeners:{"afterrender":function(o){var n=this;
if(!Ext.isEmpty(h[0].chartType)&&h[0].chartType=="StackedArea"){n.setTitle(h[0].heading);n.add(addChartHistorytemp(h[0],"sessionsconnected_minmax"),{xtype:"sessionsconnected",height:205,id:"renderSessionsLogging_Id",ifHeaderNeeded:false,data:h[0],margin:"10 0 0 0"});}else{if(!Ext.isEmpty(h[0][0])){n.setTitle(h[0][0].name);
try{n.add(addChartHistorytemp(h[0][0],"sessionsconnected_minmax"),{xtype:"commongrid",height:190,header:true,cls:"",title:h[0][0].chartTopNTitle,ifSessions:true,id:"renderSessionsLoggingGrid_Id",data:h[0][0],margin:"20 0 0 0"});}catch(p){}}}}}},{xtype:"panel",ui:"eg-x-panel",height:373,title:h[1][0].name,bodyPadding:"10 20 10 20",margin:"0 2 2 0",columnWidth:0.5,items:[],layout:{type:"vbox",align:"stretch"},listeners:{"afterrender":function(o){var n=this;
n.add(addChartHistorytemp(h[1][0],"sessionsgrid_minmax"),{xtype:"commongrid",height:190,header:true,title:h[1][0].chartTopNTitle,ifSessions:true,id:"sesionCompletedId1_id",data:h[1][0],margin:"20 0 0 0"});}}}]});this.add(m);}}});function addChartHistorytemp(h,d){var f=this,e=[];var a="";var g=false;try{if(!Ext.isEmpty(h.maxmin[0].Sum)&&h.maxmin[0].Sum!=undefined&&h.maxmin[0].Sum!=null){g=true;
}}catch(b){}if(!g){a=new Ext.XTemplate('<div class="widgetholders">','<tpl for=".">','<tpl if="xindex % 2 === 0">','<div class="b_box " style="border:0px solid red;width:50%;padding:0 0 0 0 !important;float:left;">',"<tpl else>",'<div class="b_box " style="border:0px solid red;width:50%;padding:0 25 0 0 !important;float:left;">',"</tpl>",'<div class="font_normal9 fontStyleRobotRegular grayColor" style="padding:0px 0px 5px 0px"><span>{duration}</ span></div>','<div style="padding-top:14px;height:65px;width:100%" class="chartminmax"><div style="width:48%;float:left;text-align:center">','<div class="font_normal19">{Avg}</div><div class="font_normal11" style="margin-top:3px;">avg</div></div>','<div class="grayBoxDivider" style="height:39px;width:1px;float:left;margin-top:0px;float:left"></div>','<div style="width:48%;float:right;text-align:center"><div class="font_normal19">{Max}</div><div class="font_normal11" style="margin-top:3px;">max</div></div></div>',"</div>","</tpl>","</div>");
}else{a=new Ext.XTemplate('<div class="widgetholders">','<tpl for=".">','<tpl if="xindex % 2 === 0">','<div class="b_box " style="border:0px solid red;width:50%;padding:0 125 0 0 !important;float:left;">',"<tpl else>",'<div class="b_box " style="border:0px solid red;width:50%;padding:0 0 0 125 !important;float:left;">',"</tpl>",'<div class="font_normal9 fontStyleRobotRegular grayColor" style="padding:0px 0px 5px 0px"><span>{duration}</ span></div>','<div style="padding-top:20px;height:65px;width:70%" class="chartminmax"><div style="width:100%;float:left;text-align:center">','<div class="font_normal19">{Sum}</div></div>',"</div>","</div>","</tpl>","</div>");
}if(h.maxmin!=null&&h.maxmin!=undefined){var c={xtype:"dataview",border:false,id:d+"_history_grid_id1",store:Ext.create("Ext.data.Store",{model:"UxHistoryModel",autoLoad:true,data:h.maxmin}),tpl:a};return c;}}