var t=0;Ext.define("UxHistoryModel",{extend:"Ext.data.Model",fields:[{name:"duration",type:"string"},{name:"Avg",type:"string"},{name:"Max",type:"string"},{name:"Sum",type:"string"},{name:"func",type:"string"},{name:"functext",type:"string"},]});Ext.define("BandWidthUsageModel",{extend:"Ext.data.Model",fields:[{name:"state",type:"string"},{name:"heading",type:"string"},{name:"value",type:"number"},{name:"legend",type:"string"},{name:"linkUrl",type:"string"},{name:"changeTabView",type:"string"},{name:"linkurl",type:"string"},{name:"test_org",type:"string"},{name:"measure_org",type:"string"},{name:"handSymbol",type:"string"},{name:"DataSet"},{name:"data"},{name:"graphID",type:"string"}]});
Ext.define("widgets.ChartPanel",{extend:"Ext.panel.Panel",alias:"widget.chartpanel",border:true,flex:1,ui:"eg-x-panel",margin:"0 1 1 0",bodyPadding:"0 0 0 0",id:"",legendPosition:"bottom",chartType:"area",layout:{type:"vbox",align:"stretch"},config:{data:null},showMaxMin:true,data:[],items:[],isOdd:false,constructor:function(a){this.initConfig(a);
this.callParent(arguments);},addChartHistory:function(){var d=this,c=[];var b="";if(!d.ifUx){b=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;float:left;">',"<tpl else>",'<div class="b_box " style="border:0px solid red;width:50%;padding:0 25px 0 0 !important;float:left;">',"</tpl>",'<div class="font_normal9 fontStyleRobotRegular grayColor" style="padding:0px 0px 5px 0px"><span>{duration}</ span></div>','<div style="height:65px;width:100%" class="chartminmax"><div class="ctxSerRes_m_top" style="margin-top:8px;width:48%;float:left;text-align:center">','<div class="font_normal20" style="padding:7px 0 0 0">{Avg}</div><div class="font_normal11" style="margin-top:3px;">avg</div></div>','<div class="grayBoxDivider" style="float:left;height:44px;width:1px;float:left;margin-top:12px;float:left"></div>','<div class="ctxSerRes_m_top" style="margin-top:8px;width:48%;float:right;text-align:center"><div class="font_normal20" style="padding:7px 0 0 0">{Max}</div><div class="font_normal11" style="margin-top:3px;">max</div></div></div>',"</div>","</tpl>","</div>");
}else{b=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;float:left;">',"<tpl else>",'<div class="b_box " style="border:0px solid blue;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>','<tpl if="func != &quot;-&quot;">','<div style="height:65px;width:100%" class="chartminmax">','<div class="ctx_m_top" style="width:49%;float:left;text-align:center;padding-top:13px" ><div class="font_normal23">{func}</div>','<div class="crl">',"</div>",'<div class="font_normal12"style="margin-top:-4px">{functext}</div></div>','<div class="chartLegendDivider" style="width:1px;float:left;margin-top:12px"></div>','<div style="width:49%;float:left;">','<div style="margin:4px auto;display:table">','<div class="font_normal20" style="padding:3px 0 0 0">{Avg}<span class="font_normal11 d_m_l5">avg</span></div>','<div class="crl"></div>','<div class="font_normal20" style="padding:0px 0 0 0">{Max}<span class="font_normal11 d_m_l5">max</span></div>',"</div>","</div>","</div>","<tpl else>",'<div style="height:65px;width:100%" class="chartminmax">','<div class="font_normal23" style="margin:7px auto;width:25px">{count}</div>',"</div>","</tpl>","</div>","</tpl>","</div>");
}if(d.data.maxmin!=null&&d.data.maxmin!=undefined){var a={xtype:"dataview",border:false,id:d.id+"_history_grid_id",store:Ext.create("Ext.data.Store",{id:d.id+"_history_store_id",model:"UxHistoryModel",autoLoad:true,data:d.data.maxmin}),tpl:b};return a;}},addgridview:function(){var g=this;var i=false;
if(g.isAlerts!=undefined&&g.isAlerts!=null&&g.isAlerts){i=true;}var b=false;if(g.ifBro!=undefined&&g.ifBro!=null&&g.ifBro){b=true;}var a=181;var c=false;var h="0px";if(g.ifLogOn!=undefined&&g.ifLogOn!=null&&g.ifLogOn){c=true;a=210;}var f="0 15 15 15";var d="0 5 5 5";if(b){f=0;d=0;}var e=new Ext.Panel({xtype:"dataview",padding:d,layout:"fit",height:185,items:[{xtype:"container",layout:"fit",items:[{xtype:"commongrid",id:g.id+"_Grid",alignR:true,data:g.data,border:true,frame:false,layout:"fit",scroll:false,autoScroll:true,iSAlerts:i,iSLogon:c,iSBrro:b,margin:f,height:a}]}]});
return e;},addpieview:function(){var b=this;var d="";var c=(strSkin=="Dark")?"#6a6a6a":"#cdcdcd";if(b.ifUx){d=new Ext.XTemplate('<tpl for=".">','<div class="widgetholders {handSymbol}" style="border:0px solid red">','<div class="b_box1">','<div class="font_bold14"><img style="vertical-align:sub" src="/final/images/clear.png" class="stateIconRumAppFlow{state}" /> <span></ span></div>','<div  style="border:0px solid red;text-align:center;width:200px;margin:auto;height:188px;" id="'+b.id+'_bgDonut"></div>',"</div>",'<div class="sessions_legends" style="margin-top:15px !important">','<table style="margin:auto;width:50%"><tr>','<tpl for="DataSet">','<tpl for="data">','<tpl if="color !=&quot;'+c+'&quot;">','<td class="{handSymbol}" onclick="loadView(\'{changeTabView}\',\'{linkUrl}\',\'\',\'{test_org}\',\'{measure_org}\',\'{linkurl}\');" style="padding:8px;text-align:center"><div style="margin-left: 15px;" class="font_normal25">{value}</div><div class="crl"></div><div style="margin:auto;display:inline"><div style="display:table-cell;margin-top:-8px;margin-right:5px;color:{colorCode}"><h3 style="position:relative;top:-2px">.</h3></div><div  style="display:table-cell;" class="font_normal12">{text}</div></div></td><td class="font_normal11"></td>',"</tpl>","</tpl>","</tpl>","</tr></table>","</div>","</div>","</tpl>","</div>");
}else{if(b.ifLogOn){d=new Ext.XTemplate('<tpl for=".">','<div class="widgetholders">','<div class="b_box1" style="margin:auto;display:flex">','<div class="font_bold14"><img style="vertical-align:sub" src="/final/images/clear.png" class="stateIconRumAppFlow{state}" /> <span></ span></div>','<div  style="border:0px solid blue;margin-left: 20px;margin-top:0px;text-align:center;width:220px;height:200px;margin:auto auto" id="'+b.id+'_bgDonut"></div>','<div style="height:200px;border:0px solid red;display:flex;overflow:auto;margin:auto auto auto 0px">','<div style="display:flex;flex-direction:column;margin:auto auto auto 0px">','<tpl for="DataSet">','<tpl for="data">','<tpl if="color !=&quot;'+c+'&quot;">','<div onclick="loadView(\'{changeTabView}\',\'{linkUrl}\',\'\',\'{test_org}\',\'{measure_org}\',\'{linkurl}\');" style="padding:0px 0px 10px 0px !important;"><div style="display:table-cell;margin-top:-10px;margin-right:5px;color:{colorCode}"><h3 style="position:relative;top:-2px">.</h3></div><div  style="display:table-cell;" class="font_normal11"><div class="widgetholders {handSymbol}">{text}&nbsp;({value})</div></div></div></td><td class="font_normal11">',"</tpl>","</tpl>","</tpl>","</div>","</div>","</div>","</tpl>","</div>");
}else{d=new Ext.XTemplate('<tpl for=".">','<div class="widgetholders" style="margin-top:15px;border:0px solid blue !important">','<div class="b_box1" style="margin:auto;width:525px">','<div class="font_bold14"><img style="vertical-align:sub" src="/final/images/clear.png" class="stateIconRumAppFlow{state}" /> <span></ span></div>','<div  style="border:0px solid blue;margin-top:-12px;text-align:center;width:200px;height:170px;float:left" id="'+b.id+'_bgDonut"></div>','<div class="sessions_legends" style="float:left;margin-top:45px !important">','<table style="margin-right:0px;width:300px;"><tr>','<tpl for="DataSet">','<tpl for="data">','<tpl if="color !=&quot;'+c+'&quot;">','<td style="padding:8px;text-align:center"><div class="widgetholders {handSymbol}" onclick="loadView(\'{changeTabView}\',\'{linkUrl}\',\'\',\'{test_org}\',\'{measure_org}\',\'{linkurl}\');"><div class="font_normal25">{value}</div><div class="crl"></div><div style="margin:auto;display:inline"><div style="display:table-cell;margin-top:-8px;margin-right:5px;color:{colorCode}"><h3 style="position:relative;top:-2px;margin-left:0px !important">.</h3></div><div  style="display:table-cell;" class="font_normal12">{text}</div></div></td><td class="font_normal11"><div></td>',"</tpl>","</tpl>","</tpl>","</tr></table>","</div>","</div>","</tpl>","</div>");
}}var a={xtype:"dataview",padding:5,layout:{type:"vbox",pack:"center"},tpl:d,listeners:{viewready:function(){$("#"+b.id+"_bgDonut").highcharts(b.chartConfig(b.data,b.chartType));}},store:Ext.create("Ext.data.Store",{id:"BandWidthUsageModel_model_id",model:"BandWidthUsageModel",autoLoad:true,data:b.data}),};
return a;},addGraphtextPanel:function(h,i,c,d){var f="separator_measure";if(c==0){f="";}var e="#35c8c2";if(h.colorValue!=undefined){e=h.colorValue;}var g="widgetcon_line font_bold12";if(!Ext.isEmpty(d)&&d){g="font_bold12";}var b={xtype:"panel",baseCls:"panelHeader",margin:"0 0 0 0",bodyPadding:"13 0 0 0",autoScroll:true,flex:0.7,minWidth:165,items:[{xtype:"graphtext",cls:g,data:h,id:i,num:i,}],};
return b;},initComponent:function(){var s=this;s.mon(s,"boxready",s.loadChart,s);if(s.data.showMaxMin){var q="";var j="";var k="";var l="0 0 0 0";if(s.isOdd==true){q="20px";}if(s.isOdd==false){j="20px";}if(s.indexVal!=undefined&&s.indexVal!=null&&(s.indexVal==0||s.indexVal==1)){k="0px";}else{k="10px";
}if(s.ifUx){s.style={"padding":"20px 20px 20px 20px"};}else{s.style={"box-shadow":"none !important","border":"0px solid green !important","margin":l+" !important","padding-bottom":""+k+"","padding-right":""+q+"","padding-left":""+j+""};}var f=195;if(s.isSAP){f=175;}s.items=[s.addChartHistory(),{xtype:"container",cls:"chartholder",padding:"10 0 0 0",id:s.id+"_inner",height:f,layout:{type:"vbox",align:"stretch"},}];
}else{if(s.ifBro!=undefined&&s.ifBro!=null&&s.ifBro){var q="0px";var j="10px";var k="0px";var l="0 0 0 0";if(s.indexVal!=undefined&&s.indexVal!=null&&(s.indexVal==0||s.indexVal==1||s.indexVal==2)){k="0px";l="0 0 0 0";}else{k="10px";l="0 0 0 0";}if(s.ifUx){s.style={"padding":"20px 20px 20px 20px"};}else{s.style={"box-shadow":"none !important","border":"0px solid green !important","margin":l+" !important","padding-top":""+k+"","padding-right":""+q+"","padding-left":""+j+""};
}}}if(s.chartType!=undefined&&s.chartType!=null&&s.chartType=="donut"){var e=s.data.heading;if(e!=undefined&&e!=null&&(e.indexOf("(")!=-1&&e.indexOf(")")!=-1)){var h="";h=e.substring(e.indexOf("("),e.indexOf(")")+1);e=e.replace(h,"<span class='font_normal12 fontStyleRobotRegular'>"+h+"</span>");}s.title=e;
if(s.ifUx){s.padding="0px 0px 0px 20px";}else{s.padding="0px 0px 0px 0px";}s.items=[s.addpieview()];}if(s.chartType!=undefined&&s.chartType!=null&&(s.chartType=="grid"||s.chartType=="TopNGrid")){s.items=[s.addgridview()];}if(s.chartType!=undefined&&s.chartType!=null&&s.chartType=="GraphText"){var e=s.data.heading;
if(e!=undefined&&e!=null&&(e.indexOf("(")!=-1&&e.indexOf(")")!=-1)){var h="";h=e.substring(e.indexOf("("),e.indexOf(")")+1);e=e.replace(h,"<span class='font_normal12 fontStyleRobotRegular'>"+h+"</span>");}s.title=e;var s=this;var p=s.data;var i=false;var o=p["chart"];if(o!=undefined&&o!=null&&o=="GraphText"){var d=p.data;
var g=[];for(var r in d){var c=d[r]["chart"];if(c!=undefined&&c!=null&&c=="GraphText"){var n=c+"_GraphText_"+r;if(r==(d.length-1)){i=true;}var m=s.addGraphtextPanel(d[r],n,r,i);g.push(m);}}var b={xtype:"container",height:235,layout:{type:"hbox",align:"stretch"},items:g,};s.items=b;}}s.callParent(arguments);
s.mon(s,"resize",s.resizePanel,s);s.mon(s,"removed",s.destroyChart,s);},updateChart:function(c,g,i){var j=this;if(g.showMaxMin){if(g.maxmin!=null&&g.maxmin!=undefined){j.items.items[0].store.loadRawData(g.maxmin);}try{var k=g.DataSet[0].data[0];if(k.hasOwnProperty("Error")&&!Ext.isEmpty(k.Error)){Ext.getCmp(j.id+"_inner").update('<div style="display:table;height:100%;width:100%" ><div style="display:table-cell;vertical-align:middle;text-align:center;"><div style="margin:auto;" class="iconInformation"></div><div>'+k.Error+"</div></div></div>");
}else{$("#"+j.id+"_inner").highcharts(j.chartConfig(g,i));$("#"+j.id+"-body").width("100%");}}catch(p){Ext.getCmp(j.id+"_inner").update('<div style="display:table;height:100%;width:100%" ><div style="display:table-cell;vertical-align:middle;text-align:center;"><div style="margin:auto;" class="iconInformation"></div><div>No data Found!</div></div></div>');
}}else{if(g.chartType=="GraphText"){try{var f=g.data;for(var m in f){var o=f[m]["chart"];if(o!=undefined&&o!=null&&o=="GraphText"){var b=o+"_GraphText_"+m;var l=Ext.getCmp(b);l.updateData(f[m]);}}}catch(h){}}else{if(g.chartType=="grid"||g.chartType=="TopNGrid"){try{if(g!=null&&g!=undefined){Ext.getCmp(j.id+"_Grid").loadData(g);
}}catch(e){}}else{if(g.chartType=="donut"){if(g!=null&&g!=undefined){j.items.items[0].store.loadRawData(g);}try{$("#"+j.id+"_bgDonut").highcharts(j.chartConfig(g,g.chartType));}catch(n){}}else{try{var k=g.DataSet[0].data[0];if(k.hasOwnProperty("Error")&&!Ext.isEmpty(k.Error)){Ext.getCmp(j.id).update('<div style="display:table;height:100%;width:100%" ><div style="display:table-cell;vertical-align:middle;text-align:center;"><div style="margin:auto;" class="iconInformation"></div><div>'+k.Error+"</div></div></div>");
}else{$("#"+j.body.id).highcharts(j.chartConfig(g,g.chartType));}}catch(d){Ext.getCmp(j.id).update('<div style="display:table;height:100%;width:100%" ><div style="display:table-cell;vertical-align:middle;text-align:center;"><div style="margin:auto;" class="iconInformation"></div><div>No data Found!</div></div></div>');
}}}}}j.doLayout();j.doComponentLayout();},destroyChart:function(){try{var b=this,a=$("#"+b.body.id).highcharts();if(!Ext.isEmpty(a)){a.destroy();}}catch(c){}},resizePanel:function(){var b=this,a=$("#"+b.body.id).highcharts();if(!Ext.isEmpty(a)){a.reflow();}},loadChart:function(){var c=this;if(c.data.showMaxMin==undefined||c.data.showMaxMin==null){c.data.showMaxMin=false;
}if(c.data.showMaxMin){try{var a=c.data.DataSet[0].data[0];if(a.hasOwnProperty("Error")&&!Ext.isEmpty(a.Error)){Ext.getCmp(c.id+"_inner").update('<div style="display:table;height:100%;width:100%" ><div style="display:table-cell;vertical-align:middle;text-align:center;"><div style="margin:auto;" class="iconInformation"></div><div>'+a.Error+"</div></div></div>");
}else{$("#"+c.id+"_inner").highcharts(c.chartConfig(c.data,c.chartType));}}catch(d){Ext.getCmp(c.id+"_inner").update('<div style="display:table;height:100%;width:100%" ><div style="display:table-cell;vertical-align:middle;text-align:center;"><div style="margin:auto;" class="iconInformation"></div><div>No data Found!</div></div></div>');
}}else{if(c.chartType=="GraphText"){}else{if(c.chartType=="grid"||c.chartType=="TopNGrid"){}else{if(c.chartType=="donut"){}else{try{var a=c.data.DataSet[0].data[0];if(a.hasOwnProperty("Error")&&!Ext.isEmpty(a.Error)){Ext.getCmp(c.id).update('<div style="display:table;height:100%;width:100%" ><div style="display:table-cell;vertical-align:middle;text-align:center;"><div style="margin:auto;" class="iconInformation"></div><div>'+a.Error+"</div></div></div>");
}else{$("#"+c.body.id).highcharts(c.chartConfig(c.data,c.chartType));}}catch(b){Ext.getCmp(c.id).update('<div style="display:table;height:100%;width:100%" ><div style="display:table-cell;vertical-align:middle;text-align:center;"><div style="margin:auto;" class="iconInformation"></div><div>No data Found!</div></div></div>');
}}}}}c.doLayout();c.doComponentLayout();},chartLegendAlignment:function(b){var a=this,d,c=a.legendPosition;switch(c){case"top":d="center";c="top";Ext.apply(b,{align:d,verticalAlign:c,layout:"horizontal"});break;case"bottom":d="center";c="bottom";Ext.apply(b,{align:d,verticalAlign:c,layout:"horizontal"});
break;case"left":d="left";c="middle";Ext.apply(b,{align:d,verticalAlign:c,layout:"vertical"});break;case"right":d="right";c="middle";Ext.apply(b,{align:d,verticalAlign:c,layout:"vertical"});break;}},chartConfig:function(g,j){var k=this;var l=null;if(j=="Bar"){try{var h={};if(!Ext.isEmpty(k.body)||!Ext.isEmpty(k.body.id)){h=jQuery.extend(true,{},createBarforCtx(k.body.id,null,null),h);
}else{h=jQuery.extend(true,{},createBarforCtx(k.id,null,null),h);}if(g.hasOwnProperty("yAxisLabel")&&g["yAxisLabel"].indexOf("%")>-1){g["MaxValue"]=99;}if(g.hasOwnProperty("yAxisLabel")&&g["yAxisLabel"].toLowerCase().indexOf("mbps")>-1){var e=g.DataSet[0].data;var i=0;for(var m=0;m<e.length;m++){if(i<e[m].y){i=e[m].y;
}}if(i>0){if(i>1){g["MaxValue"]=i;}else{g["MaxValue"]=1;}}}h.setData(g,"","","bar");l=h.highchart;}catch(b){}}else{if(j=="donut"){try{var d={};var f=true;if(k.ifLogOn){f=false;g["outersize"]="110%";g["innersize"]="47%";g["setTitle"]=true;g["useHtml"]=true;}else{f=false;g["outersize"]="115%";g["innersize"]="30%";
g["borderWidth"]="0";}if(k.ifUx){g["innersize"]="30%";}else{if(f){g["innersize"]="42%";}}d=jQuery.extend(true,{},getDonutChartsInstance1(this.id,null,null),d);d.setData(g,"","","bgdonut");l=d.highchart;}catch(n){}}else{if(j=="combinationchart"){try{g["tick"]=false;g["isStateBar"]=false;g["ifLogonDashboard"]=true;
var c={};c=jQuery.extend(true,{},getCombinationChartforCitrixDashboard(g,null,null),c);c.setData(g,mgrDateFormat,"","","right");l=c.highchart;}catch(n){}}else{if(j=="StackedColumn"){try{g["isStateBar"]=false;g["isStackingNeeded"]=false;g["isStackedColumnLeg"]=true;g["showLegend"]=true;g["labelsNeeded"]=true;
g["ignoreHiddenSeriesFlag"]=false;g["tick"]=true;g["showYaxis"]=true;g["ifLogonDashboard"]=true;var h={};h=jQuery.extend(true,{},createBar1(this.id,null,null),h);h.setData(g,mgrDateFormat,"","stackedColumn");l=h.highchart;}catch(n){}}}}}return l;}});