Ext.define("MyDashBoard.view.DashBoardLayout",{extend:"Ext.panel.Panel",alias:"widget.dashboardLayout",requires:["MyDashBoard.view.DragToolbarItems","utilities.gridstackPanel"],border:false,frame:false,bodyPadding:"0 0 0 0",margin:"10px 0px 10px 5px",padding:0,cls:"dummyCLASS",id:"dashboardLayoutObj",autoScroll:true,profileName:"",mode:"edit",isSharedDashboard:false,isOneClickDashboard:false,isPredefinedLayout:false,isPublishedProfile:"false",isHomePage:"false",topChartIDMap:{},initComponent:function(){var a=this;
this.layout={type:"fit",};a.items={xtype:"gridstackpanel",id:"gridstackpanelObj",name:"gridstackpanelObj",padding:"0px 5px 1px 0px",margin:"0px 0px 0px 0px",listeners:{boxready:function(){if(!Ext.isEmpty(a)&&(!isPublishedDashboard&&!isTvMode&&!isMonitorHome&&!isComponentDashboard&&!isConsolidatedDashboard)){var k=a.isSharedDashboard;
var h=false;if(publicJson["myDashboardConfigDetails"]["isAllowedToEditSharedDashboard"]==true){h=true;}var d=a.IsOneClickDashboard;var j=Ext.getCmp("dashboarConfigTools");j.clearManagedListeners();dashboardToolsArr=j.items.items;var q=[];var l=true;var o=false;var g=dashboardToolsArr.length;var c=0;for(var e in dashboardToolsArr){var i=dashboardToolsArr[e];
l=true;o=false;c++;if(i!=null&&(i.hasOwnProperty("buttonId")&&i.buttonId.indexOf("tbsettingseperator")>-1)){i.hide();continue;}if(!k||(k&&h)){if(h){if(i.buttonId!=null&&(i.buttonId=="Change Background")){i.show();l=false;}}else{if(i.buttonId!=null&&(i.buttonId=="Modify Dashboard"||i.buttonId=="Change Background"||i.buttonId=="Clone Dashboard"||i.buttonId=="Delete Dashboard")){i.show();
l=false;}}if(i.buttonId=="Widgets_Gallery"){i.show();l=false;}else{if((i.buttonId=="AddWidget_New")||i.buttonId=="custom_layouts"){i.show();l=false;}else{if(i.buttonId=="Publish Dashboard"||(c<g&&i.buttonId=="tbsettingseperator")){l=false;}}}}if(i.itemId!=null&&i.itemId=="setAsHomeDashIcon"){l=false;
if(a.isHomePage!=null&&a.isHomePage=="true"){o=true;}}if(l){i.hide();}else{if(i!=null&&(i.hasOwnProperty("buttonId")&&i.buttonId.indexOf("tbsettingseperator")==-1)){q.push(i.id);}i.show();}if(o){i.setDisabled(true);}else{i.setDisabled(false);}}if(q!=null&&q.length>0){for(var n in q){var m=q[n];var f=Ext.getCmp(m+"_tbsettingseperator");
if(!Ext.isEmpty(f)){f.show();}}}}}},portlet:function(d,l,b,m,m){if($("#noData")){$("#noData").remove();}var t=this,n=d.id,k=d.id+"_inner",i=Ext.get(k).getWidth(),g=Ext.get(k).getHeight();var r=false;var o=false;if(l!=null&&l=="addWidget"){o=false;if(n.indexOf("ddTable")>-1){r=false;}}else{if(l!=null&&l=="loadWidget"){var f=[];
var c=publicJson["myDashboardConfigDetails"];if(c!=null&&c.hasOwnProperty("configuredWidgetsID")){f=c["configuredWidgetsID"];}if(f!=null){if(f.indexOf(n)>-1){o=true;if(n.indexOf("ddTable")>-1){r=true;}}else{o=false;r=false;}}}}var s=false;if(publicJson!=null&&publicJson["myDashboardConfigDetails"].hasOwnProperty("isSharedDashboard")){if(publicJson["myDashboardConfigDetails"]["isSharedDashboard"]=="true"){s=true;
}}var p="false";var e=false;if(publicJson!=null&&publicJson["myDashboardConfigDetails"].hasOwnProperty("IsOneClickDashboard")){if(publicJson["myDashboardConfigDetails"]["IsOneClickDashboard"]=="yes"){p="true";e=true;}}var j=Ext.create("MyDashBoard.view.Portlet",{closeAction:"destroy",title:d.widgetType,renderTo:k,relationTo:d.id,id:n,width:i,height:g,action:l,title:b,isSharedDashboard:s,isSharedDashboardresize:s,showCombo:r,isConfigured:o,isChart:showLegandPanelForWidgetsVal,isTopNChart:d.isTopNWidget,createLayoutOnStartup:showLegandPanelForWidgetsVal,isLastWidget:d.isLastWidget,widgetDetails:d,isExternalDataSourceWidget:d.isExternalDataSourceWidget});
if(l!=null&&l=="addWidget"&&(n!=null&&n.indexOf("Widget_")!=0)){var t=this;var h=new Array();h.push({xtype:"button",baseCls:"configButton",action:"configme",flex:1,html:'<div style="text-align:center;cursor:pointer"><span><img class="'+m+' "src="/final/images/clear.png" /></span></br><span>'+b+"</span></div>",handler:function(){myDashApp.getController("WidgetConfigurationController").openWidgetConfigurationWindow(this,n,"addWidget");
}});if(m=="widget_textWidget"){var q=Ext.create("Ext.container.Container",{flex:false,width:0,height:0,id:"TextWidgetClose"+maxBarChartId,style:{"position":"relative !important","top":"0px","width":"16px !important","height":"16px !important","right":"5px","background":"transparent","border":"none","z-index":9},items:[{xtype:"button",scale:"small",id:"close3223223",icon:"../images/"+strSkin+"/window_close.png",layout:"hbox",flex:false,layout:{type:"vbox",align:"stretch",pack:"right"},style:{"position":"absolute !important","top":"0px","width":"16px !important","height":"16px !important","right":"5px","background":"transparent","border":"none"},listeners:{click:function(v){Ext.MessageBox.confirm("Confirm","Are you sure want to delete ?",u);
function u(x){if(x=="yes"){var y=v.up("panel");var w=myDashApp.getController("Main").getGridstackpanel();w._removeWidget(y.id);}else{}}},afterrender:function(u){console.log("e===>",u);}}}],});j.add(q);}if(!isPublishedDashboard){j.add(h);}else{j.add({xtype:"panel",layout:{type:"fit",},html:'<div style="height:100%;width:100%;display:table"><div class="msgFont" style="display:table-cell;vertical-align:middle"> <div class="iconInformation" style="margin:0px auto"></div><div style="text-align:center">'+WidgetNotConfigMsg+"</div></div></div>"});
}}return j;},getResizePositions:function(d){var b=a.profileName;var c=a.isSharedDashboard;var e=this;if((!c||isAnonymousUserAccess||publicJson["myDashboardConfigDetails"]["isAllwoedtoEditSharedDashboard"]==true)){Ext.defer(function(){var f=d.target.id;if(f!=null&&f.indexOf("_outer")>-1){f=f.substring(0,f.indexOf("_outer"));
}var g=e._serializationStr();var i=$("#"+f+"_inner").outerWidth(true);var h=$("#"+f+"_inner").outerHeight(true);e.resizeFn(f,g,i,h);},200);}},getDragPositions:function(){var b=a.profileName;var c=a.isSharedDashboard;var d=this;if(!isAnonymousUserAccess&&(!c||publicJson["myDashboardConfigDetails"]["isAllwoedtoEditSharedDashboard"]==true)){Ext.defer(function(){var e=d._serializationStr();
myDashApp.getController("Main").saveFluidDashboardWindowResizeConfig(b,e);},200);}},resizeFn:function(C,p,l,S){if(!Ext.isEmpty(insideGrid.Grid)){if(insideGrid.Grid.parentGridId==C){Ext.defer(function(){insideGrid.Grid.setWidth($("#"+C+" .x-grid-table").width()-43);},200);}}var x="";if(C!=null&&C!="undefined"){if(C.indexOf("_")>0){x=C.substr(0,C.indexOf("_"));
}else{x=C;}}var m=Ext.getCmp(C);if(x!=null&&x=="TopNAnalysis"){x="BarChart";m.isTopNChart=true;}if(x!=null&&(x=="BarChart"||x=="TrendGraph"||x=="TimelineChart"||x=="CombinedTimelineChart"||x=="areaChart"||x=="combinationChart"||x=="pieChart"||x=="activityChart"||x=="incidentssummary")){if(m!=null&&m.isInitialResizeCompleted==false){return;
}}m.isWidgetResizeInProgress=false;var s=(Ext.getBody().getViewSize().width-40);var k=(l/s);k=Ext.util.Format.round(k,2);var j=(Ext.getBody().getViewSize().height-25);var M=(S/j);M=Ext.util.Format.round(M,2);switch(x){case"KpiWidget":if(m.kpiChartData!=null){var e=m.kpiChartData;for(var F in e){var R=e[F];
if(!Ext.isEmpty(R)){var u=R.chartType;var I=R.chartId;var K=R["errorMsg"];if(K=="-"){var P=$("#"+m.id)[0].offsetWidth-40;var q=Object.keys(e).length;var n=P/q;if(u=="dialChart"){var d=Ext.getCmp(C+"_"+I);var O=Ext.getCmp(C+"_"+I+"_chart");if(O.highChartObj!=null){var L=d.getWidth();if(O.highChartObj.hasOwnProperty("full_guage")&&O.highChartObj.full_guage==true){var h=O.highChartObj.highchart.chart;
var i=h.renderTo;var N=jQuery("#"+i).highcharts();d.dialHeight=$("#"+m.id)[0].offsetHeight-20;d.dialWidth=$("#"+m.id)[0].offsetWidth-20;N.setSize(L-20,$("#"+m.id)[0].offsetHeight-60,true);N.redraw();}else{var h=O.highChartObj.highchart.chart;var i=h.renderTo;var N=jQuery("#"+i).highcharts();d.dialHeight=$("#"+m.id)[0].offsetHeight-20;
d.dialWidth=$("#"+m.id)[0].offsetWidth-20;N.setSize(L-20,$("#"+m.id)[0].offsetHeight-60,true);N.redraw();}}else{if(!isHighchartForGauge){var d=Ext.getCmp(C+"_"+I);var O=Ext.getCmp(C+"_"+I+"_chart");var E=n-20;var v=m.getHeight();if(E<v){v=E-10;}if(!Ext.isEmpty(O)&&O.hasOwnProperty("renderGauge")){O.renderGauge(E,v-50);
}}}}}}}m.refreshData();}break;case"ScatterPlot":if(m.highChartObj!=null){var h=m.highChartObj.highchart.chart;var i=h.renderTo;var b=jQuery(i).outerWidth();var c=jQuery(i).outerHeight();if(h.container){h.width=l;h.height=S;}h.width=l;var D=m.scatterHeight;if(S>D){D=S-40;}h.height=S-45;h.width=l-30;m.scatterHeight=S-45;
m.highChartObj.drawChart();}break;case"incidentssummary":if(m.highChartObj!=null){var h=m.highChartObj.highchart.chart;var i=h.renderTo;var b=jQuery(i).outerWidth();var c=jQuery(i).outerHeight();if(h.container){h.width=l;h.height=S;}h.width=l;h.width=l-15;h.height=S-115;m.highChartObj.drawChart();}break;
case"dialChart":if(m.highChartObj!=null){var h=m.highChartObj.highchart.chart;var i=h.renderTo;var b=jQuery(i).outerWidth();var c=jQuery(i).outerHeight();if(m.highChartObj.hasOwnProperty("full_guage")&&m.highChartObj.full_guage==true){var N=jQuery("#"+i).highcharts();Ext.defer(function(){m.dialHeight=$("#"+m.id)[0].offsetHeight-40;
m.dialWidth=$("#"+m.id)[0].offsetWidth-35;N.setSize($("#"+m.id)[0].offsetWidth-35,$("#"+m.id)[0].offsetHeight-40,true);},200);}else{if(h.container){h.width=l-10;h.height=S-20;}h.width=l-200;h.height=S-20;Ext.select("#"+m.id+" .timelineDiv").setHeight(S-10);Ext.select("#"+m.id+" .timelineDiv > div").setHeight(S-10);
Ext.select("#"+m.id+" > .highcharts-container").setHeight(S-10);Ext.select("#"+m.id+" .highcharts-container > svg").setHeight(S-10);var N=jQuery("#"+i).highcharts();Ext.defer(function(){m.dialHeight=$("#"+m.id)[0].offsetHeight-20;m.dialWidth=$("#"+m.id)[0].offsetWidth-20;N.setSize($("#"+m.id)[0].offsetWidth-20,$("#"+m.id)[0].offsetHeight-20,true);
},200);}}else{if(!isHighchartForGauge){Ext.defer(function(){var V=m.getWidth();var U=m.getHeight()-35;if(V<U){U=V-10;}if(!Ext.isEmpty(m.items.items[0])&&m.items.items[0].hasOwnProperty("renderGauge")){m.items.items[0].renderGauge(V,U);}},200);}}break;case"TopNGaugeChart":if(m.highChartObj!=null){var h=m.highChartObj.highchart.chart;
var i=h.renderTo;var b=jQuery("#"+i).outerWidth();var c=jQuery("#"+i).outerHeight();if(m.highChartObj.hasOwnProperty("full_guage")&&m.highChartObj.full_guage==true){var N=jQuery("#"+i).highcharts();Ext.defer(function(){m.dialHeight=$("#"+m.id)[0].offsetHeight-40;m.dialWidth=$("#"+m.id)[0].offsetWidth-35;
N.setSize($("#"+m.id)[0].offsetWidth-35,$("#"+m.id)[0].offsetHeight-40,true);},200);}else{if(h.container){h.width=l-20;h.height=S-20;}var N=jQuery("#"+i).highcharts();Ext.defer(function(){m.dialHeight=$("#"+m.id)[0].offsetHeight-20;m.dialWidth=$("#"+m.id)[0].offsetWidth-20;N.setSize($("#"+m.id)[0].offsetWidth-20,$("#"+m.id)[0].offsetHeight-20,true);
},200);}}else{if(!isHighchartForGauge){Ext.defer(function(){var V=m.getWidth();var W=Ext.getCmp(C+"_chart");var U=m.getHeight()-70;V=V-20;if(V<U){U=V-10;}if(!Ext.isEmpty(W)&&!Ext.isEmpty(document.getElementById(C+"_Gauge"))){W.renderGauge(V,U);}},200);}}break;case"BarChart":if(m.highChartObj!=null){var h=m.highChartObj.highchart.chart;
var i=h.renderTo;var b=jQuery(i).outerWidth();var c=jQuery(i).outerHeight();if(h.container){h.width=l;h.height=S;}h.width=l;if(m.isTopNChart){if(m.chartType=="column"){h.height=S-65;}else{var g=m.barHeight;if(S>g){g=S-30;}h.height=g-35;h.width=l-50;}}else{if(m.chartType=="column"){h.width=l-25;h.height=S-65;
}else{var g=m.barHeight;if(S>g){g=S-30;}h.height=g-25;h.width=l-50;}}m.highChartObj.drawChart();}break;case"ddTable":if(m.highChartObj!=null){if(m.chartType=="Time Line"||m.chartType=="Area"){var h=m.highChartObj.highchart.chart;var i=h.renderTo;var b=jQuery(i).outerWidth();var c=jQuery(i).outerHeight();
h.width=l-15;if(m.isCurrentValAvail){Ext.defer(function(){myDashApp.getController("Main").loadSummaryDetailsForDD(m.id,m,m.chartData,m.hideLegend,false);var U=Ext.getCmp("ChartPnl_"+C).getHeight();h.height=U;m.highChartObj.drawChart();},200);}else{m.highChartObj.drawChart();}h.width=l-15;}else{if(m.chartType=="Bar Chart"){var h=m.highChartObj.highchart.chart;
var i=h.renderTo;var b=jQuery(i).outerWidth();var c=jQuery(i).outerHeight();if(h.container){h.width=l;h.height=S;}h.width=l;if(m.isTopNChart){if(m.viewType=="column"){h.height=S-55;}else{var g=m.barHeight;if(S>g){g=S-50;}h.height=g;h.width=l-54;}}else{if(m.viewType=="column"){h.width=l-70;h.height=S-75;
}else{var g=m.barHeight;if(S>g){g=S-30;}h.height=g-35;h.width=l-60;}}m.highChartObj.drawChart();}}}else{if(m.chartType=="Table"){isResize=true;var B=Ext.getCmp(C+"_Grid");if(!Ext.isEmpty(B)){var G=21;var T=(S/G);var t=T.toString();var H="";if(t.indexOf(".")>-1){H=t.split(".")[0];}else{H=T;}H=parseInt(H);
B.getStore().pageSize=H;B.store.load();B.getView().refresh();}}}break;case"TimelineChart":if(m.highChartObj!=null){var h=m.highChartObj.highchart.chart;var i=h.renderTo;var b=jQuery(i).outerWidth();var c=jQuery(i).outerHeight();h.width=l-20;if(m.isCurrentValAvail){Ext.defer(function(){myDashApp.getController("Main").loadSummaryDetails(m.id,m,m.chartData,m.hideLegend);
var U=Ext.getCmp("ChartPnl_"+C).getHeight();h.height=U;m.highChartObj.drawChart();},200);}else{m.highChartObj.drawChart();}h.width=l-20;}break;case"TrendGraph":if(m.highChartObj!=null){var h=m.highChartObj.highchart.chart;var i=h.renderTo;var b=jQuery(i).outerWidth();var c=jQuery(i).outerHeight();h.width=l-10;
if(m.isCurrentValAvail){Ext.defer(function(){myDashApp.getController("Main").loadSummaryDetails(m.id,m,m.chartData,m.hideLegend);var U=Ext.getCmp("ChartPnl_"+C).getHeight();h.height=U;m.highChartObj.drawChart();},200);}else{m.highChartObj.drawChart();}h.width=l-20;}break;case"areaChart":if(m.highChartObj!=null){var h=m.highChartObj.highchart.chart;
var i=h.renderTo;var b=jQuery(i).outerWidth();var c=jQuery(i).outerHeight();h.width=l-45;if(m.isCurrentValAvail){Ext.defer(function(){myDashApp.getController("Main").loadSummaryDetails(m.id,m,m.chartData,m.hideLegend);var U=Ext.getCmp("ChartPnl_"+C).getHeight();h.height=U;m.highChartObj.drawChart();},200);
}else{m.highChartObj.drawChart();}}break;case"combinationChart":if(m.highChartObj!=null){var h=m.highChartObj.highchart.chart;var i=h.renderTo;var b=jQuery(i).outerWidth();var c=jQuery(i).outerHeight();h.width=l-20;if(m.isCurrentValAvail){Ext.defer(function(){myDashApp.getController("Main").loadSummaryDetails(m.id,m,m.chartData,m.hideLegend);
var U=Ext.getCmp("ChartPnl_"+C).getHeight();h.height=U;m.highChartObj.drawChart();},200);}else{m.highChartObj.drawChart();}}break;case"CombinedTimelineChart":if(m.highChartObj!=null){var h=m.highChartObj.highchart.chart;var i=h.renderTo;var b=jQuery(i).outerWidth();var c=jQuery(i).outerHeight();if(h.container){h.width=l;
h.height=S;}h.width=l-35;h.height=S-60;Ext.select("#"+m.id+" .timelineDiv").setHeight(S);Ext.select("#"+m.id+" .timelineDiv > div").setHeight(S);Ext.select("#"+m.id+" > .highcharts-container").setHeight(S);Ext.select("#"+m.id+" .highcharts-container > svg").setHeight(S);m.highChartObj.drawChart();}break;
case"pieChart":if(m.highChartObj!=null){var h=m.highChartObj.highchart.chart;var i=h.renderTo;var b=jQuery(i).outerWidth();var c=jQuery(i).outerHeight();var r=Ext.getCmp("ChartPnl_"+C).getWidth();if(h.container){h.width=r;h.height=S;}h.width=r;h.height=S-90;Ext.select("#"+m.id+" .timelineDiv").setHeight(S);
Ext.select("#"+m.id+" .timelineDiv > div").setHeight(S);Ext.select("#"+m.id+" > .highcharts-container").setHeight(S);Ext.select("#"+m.id+" .highcharts-container > svg").setHeight(S);m.highChartObj.drawChart();}break;case"activityChart":if(m.highChartObj!=null){var h=m.highChartObj;Ext.defer(function(){getChartForActivityChart("ChartPnl_"+m.id,$("#"+m.id)[0].offsetHeight-20,$("#"+m.id)[0].offsetWidth-20,m.activeData);
},200);}break;case"servicehealth":if(m.highChartObj!=null){Ext.defer(function(){var W=m.highChartObj.highchart.chart;var X=W.renderTo;if(W.container){W.width=l;W.height=S;}W.width=l;if(m.hasOwnProperty("isInfraHealth")&&m.isInfraHealth==true){var V=Ext.getCmp(m.id+"healthPieChartDiv").getWidth();var U=Ext.getCmp(m.id+"healthPieChartDiv").getHeight();
W.height=U;W.width=V;}else{W.height=S-30;}m.highChartObj.drawChart();},200);}break;case"networkhealth":if(m.highChartObj!=null){Ext.defer(function(){var W=m.highChartObj.highchart.chart;var X=W.renderTo;var V=jQuery(X).outerWidth();var U=jQuery(X).outerHeight();W.width=l;if(m.hasOwnProperty("isnetworkHealth")&&m.isnetworkHealth==true){S=(S/2)-5;
l=(l/2)-5;W.height=S;W.width=l;}m.highChartObj.drawChart();},500);}break;case"table":isResize=true;var B=Ext.getCmp(C+"_Grid");if(!Ext.isEmpty(B)){B.store.filters.clear();var w=Ext.getCmp("searchTable_"+C);if(w!=null){w.disable();var J=w.value;if(J!=""){w.reset();}}var G=21;var T=(S/G);var t=T.toString();
var H="";if(t.indexOf(".")>-1){H=t.split(".")[0];}else{H=T;}H=parseInt(H);B.getStore().pageSize=H;B.store.load();B.getView().refresh();}break;case"mapwidget":isResize=true;var o=Ext.getCmp("dashboardLayoutObj").profileName;myDashApp.getController("Main").loadDataForBlock(m,o,C,false);break;case"proactivealerts":if(m.highChartObj!=null){Ext.defer(function(){var X=m.highChartObj.highchart.chart;
var Z=X.renderTo;var W=jQuery(Z).outerWidth();var U=jQuery(Z).outerHeight();var V=Ext.getCmp("proActiveChart-"+C).getWidth();if(X.container){X.width=V;X.height=S;}V=V;X.width=V;var Y=S-110;X.height=Y;m.highChartObj.drawChart();},200);}break;case"currentalarms":if(m.isPaginationNeeded){isResize=true;var B=Ext.getCmp("CurrentAlarms_Grid");
if(!Ext.isEmpty(B)){var A=m.getHeight()-125;if(m.alarmSummaryEnabled){A=A/2;}B.store.filters.clear();var G=21;var T=(S/G);var t=T.toString();var H="";if(t.indexOf(".")>-1){H=t.split(".")[0];}else{H=T;}H=parseInt(H);B.getStore().pageSize=H;B.store.load();B.getView().emptyText='<div style="height:'+A+'px;"><table width="100%" height="100%" style="margin:0% auto"><tr><td align="center" valign="middle"><div class="iconExclamation"></div><div styel="margin:10px auto">'+noAlarmFoundMsg+"</div></td></tr></table></div>";
B.getView().refresh();}}break;case"healthsummary":if(!m.isWidgetResizeInProgress){isResize=true;var f=Ext.getCmp("dashboardLayoutObj");var z=f.profileName;m.isWidgetResizeInProgress=true;myDashApp.getController("Main").loadDataForBlock(m,z,C,false);}break;delete elementObj1;}var y=a.profileName;var Q=a.isSharedDashboard;
if(!isAnonymousUserAccess&&(!Q||publicJson["myDashboardConfigDetails"]["isAllwoedtoEditSharedDashboard"]==true)){myDashApp.getController("Main").saveFluidDashboardWindowResizeConfig(y,p);}}};this.callParent();},listeners:{"afterrender":function(a){var b=Ext.getCmp("myDashMainPanel");if(!isTvMode){b.header.clearManagedListeners();
}}}});