Ext.define("TemplateBuilder.controller.Main",{extend:"Ext.app.Controller",requires:["TemplateBuilder.view.ListView","TemplateBuilder.view.CreateTemplate","TemplateBuilder.view.UserDefinedWidgetWindow","TemplateBuilder.view.ConfigLayout","TemplateBuilder.view.TemplateLayout","utilities.gridstackPanel","TemplateBuilder.view.TemplateGeneralSettings","TemplateBuilder.view.TemplateTools","TemplateBuilder.view.Portlet","TemplateBuilder.view.ComparisonTable","TemplateBuilder.view.WidgetLibrary","TemplateBuilder.view.IconLibrary","utilities.gridstackPanel","TemplateBuilder.view.AddWidgetWindowNew"],refs:[{ref:"main",selector:"main"},{ref:"viewport",selector:"viewport"},{ref:"templateBuilderList",selector:"templateBuilderList"},{ref:"createTemplate",selector:"createTemplate"},{ref:"userDefinedWidgetWindow",selector:"userDefinedWidgetWindow"},{ref:"widgetLibrary",selector:"widgetLibrary"},{ref:"templatetools",selector:"templatetools"},{ref:"templategeneralsettings",selector:"templategeneralsettings"},{ref:"portlet",selector:"portlet"},{ref:"comparisontable",selector:"comparisontable"},{ref:"gridstackpanel",selector:"gridstackpanel"},{ref:"excludeincludeconfiguration",selector:"excludeincludeconfiguration"},{ref:"addwidgetwindownew",selector:"addwidgetwindownew"}],init:function(){var a=this;
Ext.getBody().on("click",function(){Ext.getCmp("WidgetNametextField").show();var b=$("#userDefinedWidgetNameLbl").text();Ext.getCmp("WidgetNametextField").setValue(b);Ext.getCmp("userDefinedWidgetNameLbl").setText("");Ext.getCmp("userDefinedWidgetNameLbl").hide();$("#iconRename").hide();},null,{delegate:"#iconRename"});
Ext.getBody().on("click",function(){a.createWidget();Ext.defer(function(){configPopup("block"+maxBlockId,"addWidget",loginUser);},100);var b=a.getWidgetLibrary();if(Ext.isEmpty(b)){b=Ext.widget("widgetLibrary");}if(b!=null&&!Ext.isEmpty(b)){b.close();}},null,{delegate:"#addWidgtFrmWidgtLib"});this.control({"main":{"boxready":this.loadDefaultView},'main checkbox[id="selectAllTemplates"]':{"change":this.checkboxClick},'main button[id="DeleteListOfTemplates"]':{"click":this.deleteSelectedTemplates},'main button[id="createTemplateButton"]':{"click":this.createTemplateView},'templatetools button[id="addTemplate"]':{"click":this.createTemplateView},'createTemplate  button[buttonId="selectExpand"]':{"click":this.expandMe},'createTemplate  combo[id="infraTypeCombo"]':{"select":this.getOptionsForType},'templategeneralsettings button[buttonId="Delete Template"]':{"click":this.deleteTemplate},'templategeneralsettings button[buttonId="Clone Template"]':{"click":this.cloneMyTemplate},'templategeneralsettings button[buttonId="AddWidget"]':{"click":this.createWidget},'templategeneralsettings button[buttonId="ModifyTemplate"]':{"click":this.editMyTemplate},'createTemplate  button[id="CreateTemplateBtn"]':{"click":this.saveTemplate},'templatetools  button[id="listBtn"]':{"click":this.goToTemplateListPage},'main combo[id="templateListCombo"]':{"select":this.showSelectedTemplate},'userDefinedWidgetWindow radiogroup[id="addToWidgetLibRadioBtn"]':{"change":this.addToWidgetLibRadioEvent},'userDefinedWidgetWindow combo[id="widgetGrpCombo"]':{"change":this.onWidgetGrpComboChange},'userDefinedWidgetWindow combo[id="testCombo"]':{"change":this.onTestComboChange},'userDefinedWidgetWindow radiogroup[id="showAggOpt"]':{"change":this.showAggOptions},'userDefinedWidgetWindow radiogroup[id="ChartDistribution"]':{"change":this.chartDistributionEvent},'userDefinedWidgetWindow button[id="addtoGridBtn"]':{"click":this.addMeasuresToGrid},'userDefinedWidgetWindow combo[id="GraphicalType"]':{"change":this.doTopNEvent},'userDefinedWidgetWindow combo[id="widgetType"]':{"change":this.loadOptionsForwidgetTypeChangeEvent},'userDefinedWidgetWindow combo[id="measureListCombo"]':{"change":this.loadDDColumns},'templategeneralsettings button[buttonId="Widgets_Gallery"]':{"click":this.showWidgetGallery},'userDefinedWidgetWindow checkbox[id="ChartSummaryEnabled"]':{"change":this.enableChartTypes},'userDefinedWidgetWindow checkbox[id="ShowIcon"]':{"change":this.showIconControl},'userDefinedWidgetWindow combo[id="Duration"]':{"select":this.durationComboOnChange},'userDefinedWidgetWindow checkboxgroup[id="Stacked"]':{"change":this.showStackedChart},'createTemplate  combo[id="compTypeFilterComboObj"]':{"select":this.loadComponentsForSelection},'createTemplate  combo[id="templateInfraElementsSingleCombo"]':{"select":this.loadComponentsForSelection},'createTemplate  button[id="excludeServers"]':{"click":this.excludeComponents},'userDefinedWidgetWindow checkbox[id="EnableMeasureStateColor"]':{"change":this.enableStateColorOnChange},'userDefinedWidgetWindow combo[id="categoryOpts"]':{"select":this.categoryOnChange},'userDefinedWidgetWindow combo[id="healthCenterCompTypeCombo"]':{"select":this.changeHealthCenterCompTypeScrollCombo},'userDefinedWidgetWindow combo[id="healthCenterTestScrollCombo"]':{"select":this.changeHealthCenterTestScrollCombo},'userDefinedWidgetWindow combo[id="graphicalTypeId"]':{"select":this.onChangeDDChartType}});
},loadOptionsForwidgetTypeChangeEvent:function(c){var a=c.getValue();if(a!=null&&a=="tableview"){var b=Ext.getCmp("UseStateColorForBackground");if(!Ext.isEmpty(b)){b.hide();}}else{var b=Ext.getCmp("UseStateColorForBackground");if(!Ext.isEmpty(b)){b.show();}}},categoryOnChange:function(f){var g=f.getValue();
var k=Ext.getCmp("healthCenterTestScrollCombo");var d=Ext.getCmp("healthCenterCompContiner");var h=Ext.getCmp("healthCenterCompTypeCombo");var p=Ext.getCmp("healthCenterComponentComboLbl");var o=Ext.getCmp("templateLayoutObj");var q=o.profileName;if(g!=null&&g=="-1"){Ext.getCmp("selectionDetailsLbl").hide();
Ext.getCmp("addtoGridBtn").hide();Ext.getCmp("configTableGrid").hide();if(!Ext.isEmpty(k)){k.hide();}if(!Ext.isEmpty(d)){d.hide();}if(!Ext.isEmpty(h)){h.hide();}}else{if(g=="vms|desktop|users"){Ext.getCmp("selectionDetailsLbl").hide();Ext.getCmp("addtoGridBtn").hide();Ext.getCmp("configTableGrid").hide();
this.loadHealthCenterCompType(g);p.setText("Components");if(!Ext.isEmpty(k)){k.hide();}if(!Ext.isEmpty(d)){d.hide();}if(!Ext.isEmpty(h)){h.show();}}else{if(g!=null&&(g=="Zone"||g=="Segment"||g=="Service")){Ext.getCmp("selectionDetailsLbl").hide();Ext.getCmp("addtoGridBtn").hide();Ext.getCmp("configTableGrid").hide();
if(!Ext.isEmpty(k)){k.hide();}if(!Ext.isEmpty(d)){d.show();}if(!Ext.isEmpty(h)){h.hide();}var j=g+":Template";var n="C=true&P0={"+encodeURIComponent(j)+"}&P1={"+encodeURIComponent(q)+"}&calljson=true&F=getCategoryOptionsForTypeJSON";var m=this;Ext.Ajax.request({url:"/final/servlet/com.eg.EgMonRemoteScriptingServlet",method:"POST",params:n,scope:this,async:true,success:function(r){var u=r.responseText;
if(u!=null&&u!=""){var s=Ext.decode(u);var t=Ext.getCmp("healthCenterComponentCombo");if(!Ext.isEmpty(t)){t.suspendEvents(true);t.getStore().removeAll();t.getStore().loadRawData(s["optionsForType"]);t.resumeEvents();t.setValue(s["selectedTypeValue"]);p.setText(g+"s");}s=null;delete s;}u=null;delete u;
}});}else{if(g!=null&&g=="Components"){Ext.getCmp("selectionDetailsLbl").hide();Ext.getCmp("addtoGridBtn").hide();Ext.getCmp("configTableGrid").hide();this.loadHealthCenterCompType(g);p.setText("Components");if(!Ext.isEmpty(k)){k.hide();}if(!Ext.isEmpty(d)){d.hide();}if(!Ext.isEmpty(h)){h.show();}}else{if(g!=null&&g=="Descriptors"){Ext.getCmp("addtoGridBtn").hide();
Ext.getCmp("configTableGrid").show();Ext.getCmp("selectionDetailsLbl").show();this.loadHealthCenterCompType(g);p.setText("Descriptors");if(!Ext.isEmpty(h)){h.show();}if(!Ext.isEmpty(k)){k.hide();}if(!Ext.isEmpty(d)){d.hide();}var b=false;var i=false;var e=Ext.getCmp("configTableGrid");for(var l=1;l<e.columns.length;
l++){if(e.columns[l].text=="Component Type"){b=true;}if(e.columns[l].text=="Descriptor"){i=true;}}if(!b){var c=Ext.create("Ext.grid.column.Column",{text:"Component Type",dataIndex:"componentType",flex:0.4,hidden:false,renderer:function(s,r){r.tdAttr='data-qclass=yellowTip data-qtip="'+s+'"';return s;
}});e.headerCt.insert(1,c);}for(var l=1;l<e.columns.length;l++){if(e.columns[l].text=="Measure"){e.headerCt.remove(l);e.getView().refresh();break;}}if(!i){var a=Ext.create("Ext.grid.column.Column",{text:"Descriptor",dataIndex:"Descriptor",flex:0.4,hidden:false,renderer:function(s,r){r.tdAttr='data-qclass=yellowTip data-qtip="'+s+'"';
return s;}});e.headerCt.insert(3,a);}e.getView().refresh();}}}}}},loadHealthCenterCompType:function(d){var b=Ext.getCmp("templateLayoutObj");var a=b.profileName;var c=a;if(!Ext.isEmpty(c)){c=this.filterEncode(c);}var e="comesFrom=myDashboard&action=loadComponentTypesForTemplateDataHealth&profileName="+encodeURIComponent(c)+"&selectedCategory="+encodeURIComponent(d);
Ext.Ajax.request({url:"/final/servlet/com.eg.EgMonitorRequestDispatcher",params:e,scope:this,method:"POST",success:function(h){var l=h.responseText;var j=Ext.decode(l);if(!Ext.isEmpty(j)){if(j!=null&&j.hasOwnProperty("comptypes")){var g=j["comptypes"];if(g!=null&&g.hasOwnProperty("availCompTypes")){var f=Ext.getCmp("healthCenterCompTypeCombo");
f.suspendEvents(true);f.getStore().loadRawData(g["availCompTypes"]);var i=f.getStore();var k=Ext.getCmp("categoryOpts");if(d!="Descriptors"){i.insert(1,{displayField:"All types",valueField:"allServers"});}f.setValue("-1");f.resumeEvents();}else{if(d=="vms|desktop|users"){var f=Ext.getCmp("healthCenterCompTypeCombo");
f.suspendEvents(true);f.getStore().loadRawData(g);var i=f.getStore();if(g.length==0){i.insert(0,{displayField:notApplicable,valueField:"-1"});}else{i.insert(0,{displayField:compTypAlertMsg,valueField:"-1"});}f.setValue("-1");f.resumeEvents();}}}else{var f=Ext.getCmp("healthCenterCompTypeCombo");f.suspendEvents(true);
var i=f.getStore();i.removeAll();i.insert(0,{displayField:compTypAlertMsg,valueField:"-1"});f.setValue("-1");f.resumeEvents();}}}});},changeHealthCenterCompTypeScrollCombo:function(h){var g=Ext.getCmp("categoryOpts");var e=g.getValue();if(e!=null&&e=="Components"){return;}else{if(e!=null&&e=="vms|desktop|users"){this.loadVms();
return;}}var f=h.getValue();var a=Ext.getCmp("healthCenterTestScrollCombo");if(f!="-1"){var d="C=true&F=getTestsForComponentJSON&P0={"+f+"}&calljson=true";var c=this;Ext.Ajax.request({url:"/final/servlet/com.eg.EgMonRemoteScriptingServlet",method:"POST",params:d,scope:this,async:true,success:function(i){var k=i.responseText;
if(k!=null&&k!=""){var j=Ext.decode(k);if(!Ext.isEmpty(a)){a.suspendEvents(true);a.getStore().removeAll();a.getStore().loadRawData(j["TEST_VALUES"]);a.resumeEvents();a.setValue("-1");}j=null;delete j;}k=null;delete k;}});a.show();}else{if(!Ext.isEmpty(a)){a.suspendEvents(true);var b=a.getStore();b.removeAll();
b.insert(0,{displayField:notApplicable,valueField:"-1"});a.setValue("-1");a.resumeEvents();a.show();}}},loadVms:function(){var k=Ext.getCmp("categoryOpts");var b=k.getValue();var a=Ext.getCmp("healthCenterCompContiner");var j=Ext.getCmp("healthCenterComponentComboLbl");if(!Ext.isEmpty(a)){a.show();}var c=Ext.getCmp("healthCenterCompTypeCombo");
var g=c.getValue();if(g!="-1"){var i="C=true&F=getVmsForSelectedHyperVisorType&P0={"+g+"}&calljson=true";var f="";if(c!=null&&c.hasOwnProperty("vmData")){var e=c["vmData"];if(e!=null&&e.hasOwnProperty("selectedVMs")){f=e["selectedVMs"];}}var h=this;Ext.Ajax.request({url:"/final/servlet/com.eg.EgMonRemoteScriptingServlet",method:"POST",params:i,scope:this,async:true,success:function(l){var o=l.responseText;
if(o!=null&&o!=""){var m=Ext.decode(o);if(m!=null&&m.hasOwnProperty("descriptorsList")){var n=Ext.getCmp("healthCenterComponentCombo");if(!Ext.isEmpty(n)){n.suspendEvents(true);n.getStore().removeAll();n.getStore().loadRawData(m["descriptorsList"]);n.getStore().insert(0,{displayField:allVms,valueField:"allVms"});
n.resumeEvents();j.setText("VM");}}m=null;delete m;}o=null;delete o;}});}else{var d=Ext.getCmp("healthCenterComponentCombo");if(!Ext.isEmpty(d)){d.suspendEvents(true);d.getStore().removeAll();d.getStore().insert(0,{displayField:notApplicable,valueField:"-1"});d.resumeEvents();d.setValue("-1");j.setText("VM");
}}},changeHealthCenterTestScrollCombo:function(e){var a=e.getValue();var h=Ext.getCmp("categoryOpts");var b=h.getValue();var c=Ext.getCmp("healthCenterCompTypeCombo");var d=c.getValue();var i="";if(d!="-1"){var g="C=true&F=getComponentsForType&P0={"+d+"}&calljson=true";var f=this;Ext.Ajax.request({url:"/final/servlet/com.eg.EgMonRemoteScriptingServlet",method:"POST",params:g,scope:this,async:true,success:function(j){var n=j.responseText;
if(n!=null&&n!=""){var m=Ext.decode(n);if(m!=null&&m.hasOwnProperty("compOptsJson")){var o=m["compOptsJson"];}for(var k in o){var l=o[k].valueField;if(l!=null&&l.indexOf(":")==-1){l=l+":"+"NULL";}l=d+":"+l;i=i+","+l;}if(i!=null&&i.indexOf(",")==0){i=i.substring(i.indexOf(",")+1);}this.loadDescriptorsForTest(d,i,a);
m=null;delete m;}n=null;delete n;}});}},loadDescriptorsForTest:function(f,c,a){var b=Ext.getCmp("healthCenterCompContiner");var e="C=true&F=getDescriptorsForServersJSON&P0={"+f+"}&P1={"+c+"}&P2={"+a+"}&calljson=true";var d=this;Ext.Ajax.request({url:"/final/servlet/com.eg.EgMonRemoteScriptingServlet",method:"POST",params:e,scope:this,async:true,success:function(g){var j=g.responseText;
if(j!=null&&j!=""){var h=Ext.decode(j);if(h!=null&&h.hasOwnProperty("descriptorsList")){Ext.getCmp("addtoGridBtn").show();if(!Ext.isEmpty(b)){b.show();}var i=Ext.getCmp("healthCenterComponentCombo");if(!Ext.isEmpty(i)){if(h["descriptorsList"].length==1&&h["descriptorsList"][0].valueField=="-1"){i.suspendEvents(true);
i.getStore().removeAll();i.getStore().loadRawData(h["descriptorsList"]);i.resumeEvents();i.setValue("-1");}else{i.suspendEvents(true);i.getStore().removeAll();i.getStore().loadRawData(h["descriptorsList"]);i.getStore().insert(0,{displayField:allDescriptors,valueField:"allDescriptors"});i.resumeEvents();
i.setValue("-1");}}}h=null;delete h;}j=null;delete j;}});},reloadAdvanceOptions:function(f){var g=Ext.getCmp("Aggregation_Function");if(f!=null&&!Ext.isEmpty(g)&&(f=="TopNGaugeChart"||f=="TopNDigitalChart")){var d="";var a=this.getComparisontable();var b=a.getStore();var j=a.getStore().getCount();if(j!=0){for(var c=0;
c<j;c++){var h=a.getStore().getAt(c).get("hidVal");var e=h.substr(0,h.indexOf(":"));d=e;}}if(d!=null&&(d.endsWith("_ag")||d.endsWith("_agx"))){if(!Ext.isEmpty(g)){g.hide();}}else{if(!Ext.isEmpty(g)){g.show();}}}},loadExcludeIncludeDefaultData:function(a,b){return loadExcludeIncludeDefaultData(a,b,false);
},loadExcludeIncludeDefaultData:function(k,j,d){var c=k["excludeIncludeOptions"];var i=Ext.getCmp("serverdescripCombo");if(!Ext.isEmpty(i)){i.suspendEvents(true);i.getStore().removeAll();i.getStore().loadRawData(c);i.resumeEvents();i.setValue("None");}var h=Ext.getCmp("compTypeCombo");if(!Ext.isEmpty(h)){var b=[];
b.push({"displayField":"Not Available","valueField":"-1"});h.getStore().removeAll();h.getStore().loadRawData(b);h.setValue("-1");}var g=Ext.getCmp("compFilterItmSel");if(!Ext.isEmpty(g)){g.suspendEvents(true);g.getStore().removeAll();g.reset();}var a=Ext.getCmp("excIncludeRadioOpt");if(!Ext.isEmpty(a)){a.hide();
}if(d){Ext.getCmp("descriptorItemSel").hide();Ext.getCmp("descriptorTextFieldObj").show();}else{var m=Ext.getCmp("descMultiselect");if(!Ext.isEmpty(m)){m.suspendEvents(true);m.getStore().removeAll();m.reset();}var e=Ext.getCmp("descriptorTextFieldObj");if(!Ext.isEmpty(e)){Ext.getCmp("descriptorTextFieldObj").hide();
}}var l=Ext.getCmp("descriptorItemSel");if(!Ext.isEmpty(l)){l.hide();}if(!Ext.isEmpty(g)){g.show();}var n=Ext.getCmp("updateExcludeInclude");if(!Ext.isEmpty(n)){n.setText(screenLabelsObj["Exclude"]+"&#47;"+screenLabelsObj["Include"]);}var f=Ext.getCmp("testComboValue");if(!Ext.isEmpty(f)){f.hide();}},onTypeCombochange:function(q){var m=this.getUserDefinedWidgetWindow();
if(Ext.isEmpty(m)){m=Ext.widget("userDefinedWidgetWindow");}var c=m.chartType;if(c==""){c=m.configuredDataValue.DisplayType;}if(c==""||c==undefined){c="TopNGaugeChart";}var h=q.getValue();if(h=="Descriptor"&&(c=="TopNGaugeChart"||c=="TopNDigitalChart"||c=="TopN"||c=="TopNTabularView"||c=="TopNBarChart"||c=="liveMeasuresBox"||c=="DDTable")){var n=Ext.getCmp("compFilterItmSel");
if(!Ext.isEmpty(n)){n.hide();}if(m.showDescriptorTextBox==true){Ext.getCmp("descriptorItemSel").hide();Ext.getCmp("descriptorTextFieldObj").show();}else{var r=Ext.getCmp("descriptorItemSel");if(!Ext.isEmpty(r)){r.show();}}this.loadDescriptorsForTopNWidgets();}else{if(h=="Descriptor"){var p=Ext.getCmp("compTypeCombo");
p.hide();var a=Ext.getCmp("compFilterItmSel");if(!Ext.isEmpty(a)){a.suspendEvents(true);a.getStore().removeAll();a.reset();}if(!Ext.isEmpty(a)){a.hide();}if(m.showDescriptorTextBox==true){Ext.getCmp("descriptorItemSel").hide();Ext.getCmp("descriptorTextFieldObj").show();}else{var r=Ext.getCmp("descriptorItemSel");
if(!Ext.isEmpty(r)){r.show();}var g=Ext.getCmp("descMultiselect");if(!Ext.isEmpty(g)){g.suspendEvents(true);g.getStore().removeAll();g.reset();}}var d=this.getComparisontable();var j=d.getStore();var f=d.getStore().getCount();if(f==0){Ext.Msg.show({title:templatesAlertLbl,msg:measureAlertMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});
return;}var s="";for(var o=0;o<f;o++){var b=d.getStore().getAt(o).get("hidVal");var e=b.substr(0,b.indexOf(":"));if(s==""){s=s+e;}else{s=s+","+e;}}this.loadDescriptorsForTopNWidgets(s);}else{var p=Ext.getCmp("compTypeCombo");p.show();var a=Ext.getCmp("compFilterItmSel");if(!Ext.isEmpty(a)){a.suspendEvents(true);
a.getStore().removeAll();a.reset();}if(!Ext.isEmpty(a)){a.show();}Ext.getCmp("descriptorTextFieldObj").hide();var r=Ext.getCmp("descriptorItemSel");if(!Ext.isEmpty(r)){r.hide();}var k=Ext.getCmp("excIncludeRadioOpt");if(!Ext.isEmpty(k)){k.hide();}var g=Ext.getCmp("descMultiselect");if(!Ext.isEmpty(g)){g.suspendEvents(true);
g.getStore().removeAll();g.reset();}var l=Ext.getCmp("updateExcludeInclude");if(!Ext.isEmpty(l)){l.setText(screenLabelsObj["Exclude"]+"&#47;"+screenLabelsObj["Include"]);}this.loadDefaultExcludeIncludeConfig(q);}}},loadDefaultExcludeIncludeConfig:function(v){var k=v.getValue();if(k=="Component"||k=="None"){var n=Ext.getCmp("testComboValue");
if(!Ext.isEmpty(n)){n.getStore().removeAll();n.hide();}}var b=Ext.getCmp("compFilterItmSel");if(!Ext.isEmpty(b)){b.suspendEvents(true);b.getStore().removeAll();b.reset();}var t=Ext.getCmp("compTypeCombo");if(!Ext.isEmpty(t)){var o=[];o.push({"displayField":"Not Available","valueField":"-1"});t.getStore().removeAll();
Ext.suspendLayouts();t.getStore().loadRawData(o);t.setValue("-1");Ext.resumeLayouts(false);}var g="";if(k=="Component"||k=="Descriptor"){g=g+"action=loadComponentTypeCombo";}else{return;}var a=Ext.getCmp("templateLayoutObj");var e=a.profileName;var p=e;if(!Ext.isEmpty(p)){p=this.filterEncode(p);g=g+"&profileName="+encodeURIComponent(p);
}var k=v.getValue();if(k!=null&&k==""){g=g+"&selectType="+k;}var m=this.getUserDefinedWidgetWindow();if(Ext.isEmpty(m)){m=Ext.widget("userDefinedWidgetWindow");}var f=m.chartType;if(f==""){f=m.configuredDataValue.DisplayType;}if(f==""||f==undefined){f="TopNGaugeChart";}var c=[];if(f!=null&&f=="DDTable"){var n=Ext.getCmp("testCombo");
if(!Ext.isEmpty(n)){var w=n.getValue();if(w==null||w=="-1"){Ext.Msg.show({title:templatesAlertLbl,msg:testAlertMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});return;}c[0]=w;}var s=Ext.getCmp("measureListCombo");if(!Ext.isEmpty(s)){var u=s.getValue();if(u==null||u=="-1"){Ext.Msg.show({title:templatesAlertLbl,msg:measureAlertMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});
return;}}}else{var h=this.getComparisontable();var l=h.getStore();var j=h.getStore().getCount();if(j==0){Ext.Msg.show({title:templatesAlertLbl,msg:measureAlertMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});return;}for(var q=0;q<j;q++){var d=h.getStore().getAt(q).get("hidVal");var r=d.substr(0,d.indexOf(":"));
c[q]=r;}}if(!Ext.isEmpty(c)){g=g+"&testList="+encodeURIComponent(c);}Ext.Ajax.request({url:"/final/servlet/com.eg.EgTemplateBuilderController",params:g,scope:this,method:"POST",success:function(y){var B=y.responseText;var A=Ext.decode(B);if(!Ext.isEmpty(A)){var i=A["componentTypeComboData"];var x=i["availCompTypes"];
var z=Ext.getCmp("compTypeCombo");if(!Ext.isEmpty(z)&&x!=null&&x!=""){z.suspendEvents(true);z.getStore().removeAll();z.getStore().loadRawData(x);z.setValue("-1");z.resumeEvents();}}}});},loadComponentsForCompType:function(b){var g=Ext.getCmp("serverdescripCombo");var c=g.getValue();if(b.getValue()=="-1"){var e=Ext.getCmp("compFilterItmSel");
if(!Ext.isEmpty(e)){e.suspendEvents(true);e.getStore().removeAll();e.reset();}return;}var e=Ext.getCmp("compFilterItmSel");if(!Ext.isEmpty(e)){e.suspendEvents(true);e.getStore().removeAll();e.reset();}var f="";f=Ext.getCmp("WidgetNametextField").getValue();var a=Ext.getCmp("userDefinedWidgetNameLbl");
if(a!=null&&a.isVisible()){f=$("#userDefinedWidgetNameLbl").text();}f.trim();var h="action=getExcludeAndIncludeServers&selectedCompType="+b.getValue();var i=Ext.getCmp("templateLayoutObj");var j=i.profileName;var d=j;if(!Ext.isEmpty(d)){d=this.filterEncode(d);h=h+"&profileName="+encodeURIComponent(d);
}if(!Ext.isEmpty(c)){h=h+"&selectedType="+encodeURIComponent(c);}if(!Ext.isEmpty(f)){h=h+"&widgetName="+encodeURIComponent(f);}Ext.Ajax.request({url:"/final/servlet/com.eg.EgTemplateBuilderController",params:h,scope:this,method:"POST",success:function(k){var o=k.responseText;var l=Ext.decode(o);if(!Ext.isEmpty(l)){var m=l["serverOptsJson"];
if(!Ext.isEmpty(m)){if(c=="Component"){var n=Ext.getCmp("compFilterItmSel");if(!Ext.isEmpty(n)){n.suspendEvents(true);n.getStore().removeAll();n.reset();n.getStore().loadRawData(m["componentsOptsJson"]);n.setValue(m["excludedComponents"]);n.resumeEvents();preExcludedComponents=m["excludedComponents"];
}}else{if(!Ext.isEmpty(componentsComboFilterObj)){componentsComboFilterObj.suspendEvents(true);componentsComboFilterObj.getStore().removeAll();componentsComboFilterObj.getStore().loadRawData(m["componentsOptsJson"]);componentsComboFilterObj.setValue("-1");componentsComboFilterObj.resumeEvents();}}}}l=null;
o=null;n=null;}});},saveExcludeIncludeWidgetConfig:function(){var s=this.getUserDefinedWidgetWindow();if(Ext.isEmpty(s)){s=Ext.widget("userDefinedWidgetWindow");}var d="";d=Ext.getCmp("WidgetNametextField").getValue();var v=Ext.getCmp("userDefinedWidgetNameLbl");if(v!=null&&v.isVisible()){d=$("#userDefinedWidgetNameLbl").text();
}d.trim();if(Ext.isEmpty(d)){Ext.Msg.show({title:templatesAlertLbl,msg:widgetBlankNameAlertMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});return;}var n="";var e=Ext.getCmp("serverdescripCombo");var E=e.getValue();if(E=="Component"){n="action=saveExcludeIncludeComponentConfig";var w=Ext.getCmp("templateLayoutObj");
var b=w.profileName;var W=b;if(!Ext.isEmpty(W)){W=this.filterEncode(W);n=n+"&profileName="+encodeURIComponent(W);}if(!Ext.isEmpty(d)){d=this.filterEncode(d);n=n+"&widgetName="+encodeURIComponent(d);}var K=Ext.getCmp("compTypeCombo");var B=K.getValue();if(!Ext.isEmpty(B)){n=n+"&compType="+encodeURIComponent(B);
}var p="";var x=Ext.getCmp("compFilterItmSel").getValue();if(!reGenerateCompsFromExclude){var H=preExcludedComponents.split(",");if(H.length==x.length){for(var S=0;S<x.length;S++){if(!H.includes(x[S])){reGenerateCompsFromExclude=true;break;}}}else{reGenerateCompsFromExclude=true;}}if(x!=null&&!Ext.isEmpty(x)&&x!=""){x=this.filterEncode(x);
n=n+"&excludedComponents="+encodeURIComponent(x);}else{n=n+"&excludedComponents=";}var Q=Ext.getCmp("compFilterItmSel").fromField.getStore().getRange();var F=[];Ext.each(Q,function(j,i){F[i]=j.getData().valueField;});if(F=="-1"||x=="-1"){Ext.Msg.show({title:templatesAlertLbl,msg:noElementsAvail,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});
return;}var P=this.getUserDefinedWidgetWindow();if(Ext.isEmpty(P)){P=Ext.widget("userDefinedWidgetWindow");}var T="";T=P.widgetAction;if(T=="modify Widget"){var U=P.internalId;if(U!=null&&U!=""){U=this.filterEncode(U);n=n+"&prevWidgetName="+encodeURIComponent(U);}}n=n+"&actionOnWidget="+encodeURIComponent(T);
var J=[];var R=0;for(var S=0;S<L;S++){var D=k.getStore().getAt(S).get("hidVal");var h=D.substr(0,D.indexOf(":"));var y=D.substr(0,D.indexOf("!!!"));var c=y.substr(y.indexOf(":")+1);var o="";if(c.indexOf("$!")>-1){var z=c.split("$!");for(var q in z){var o=z[q];if(t==h){J[R]=o;R++;}}}else{o=c;if(t==h){J[R]=o;
R++;}}}n=n+"&measList="+encodeURIComponent(J);}else{if(E=="Descriptor"){var C=s.chartType;if(C==""){C=s.configuredDataValue.DisplayType;}if(C==""||C==undefined){C="TopNGaugeChart";}if(C!=null&&C=="DDTable"){var l=Ext.getCmp("testCombo");if(!Ext.isEmpty(l)){var t=l.getValue();if(t==null||t=="-1"){Ext.Msg.show({title:templatesAlertLbl,msg:testAlertMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});
return;}h=t;}var V=Ext.getCmp("measureListCombo");if(!Ext.isEmpty(V)){var u=V.getValue();if(u==null||u=="-1"){Ext.Msg.show({title:templatesAlertLbl,msg:measureAlertMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});return;}}}else{var k=this.getComparisontable();var A=k.getStore();var L=k.getStore().getCount();
if(L==0){Ext.Msg.show({title:templatesAlertLbl,msg:measureAlertMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});return;}}var P=this.getUserDefinedWidgetWindow();if(Ext.isEmpty(P)){P=Ext.widget("userDefinedWidgetWindow");}var C=P.chartType;if(C==""){C=P.configuredDataValue.DisplayType;}if(C==""||C==undefined){C="TopNGaugeChart";
}n="action=saveExcludeIncludeTopNDescriptorConfig";var f="";if(s.showDescriptorTextBox==true){f=Ext.getCmp("descriptorTextFieldObj").getValue();if(this.checkBlankSpc(f)){var M=Ext.Msg;M.show({title:templatesAlertLbl,msg:descriptorExcludeEmptyAlertMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});
return;}var G="";var I=Ext.getCmp("excIncludeRadioOpt");if(!Ext.isEmpty(I)){G=I.getValue().descOpt;}if(G!=null&&G=="Exclude"&&f!=null&&(f.indexOf("*")>-1||f.indexOf("*.*")>-1)){Ext.Msg.show({title:templatesAlertLbl,msg:descriptorExcludeAlertMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});
return;}else{if(G!=null&&G=="Include"&&f!=null&&(f.indexOf("None")>-1||f.indexOf("none")>-1)){Ext.Msg.show({title:templatesAlertLbl,msg:descriptorIncludeAlertMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});return;}}}else{f=Ext.getCmp("descMultiselect").getValue();}if(!reGenerateCompsFromExclude){if(preExcludedDescriptors.length==f.length){for(var S in f){if(!preExcludedDescriptors.includes(f[S])){reGenerateCompsFromExclude=true;
break;}}}else{reGenerateCompsFromExclude=true;}}var r=false;var g=false;var m="";for(var O in f){var N=f[O];if(N=="None"&&f.length>1){r=true;}if(N=="allDescriptors"&&f.length>1){g=true;}m=m+","+N;}if(!Ext.isEmpty(m)&&m.indexOf(",")==0){m=m.substr(1);}if(g){Ext.Msg.show({title:templatesAlertLbl,msg:allDescAlertMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});
return;}if(r){Ext.Msg.show({title:templatesAlertLbl,msg:noneDescAlertMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});return;}var a="";var I=Ext.getCmp("excIncludeRadioOpt");if(!Ext.isEmpty(I)){a=I.getValue().descOpt;n=n+"&actionOnDescriptors="+a;}if(f==null||f==-1||f.length==0){Ext.Msg.show({title:templatesAlertLbl,msg:noElementsAvail,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});
return;}var w=Ext.getCmp("templateLayoutObj");var b=w.profileName;var W=b;if(!Ext.isEmpty(W)){W=this.filterEncode(W);n=n+"&profileName="+encodeURIComponent(W);}d=this.filterEncode(d);if(!Ext.isEmpty(d)){n=n+"&widgetName="+encodeURIComponent(d);}if(s.showDescriptorTextBox==true&&!Ext.isEmpty(f)){m=this.filterEncode(f);
}else{m=this.filterEncode(m);}if(m!=null&&!Ext.isEmpty(m)&&m!=""&&m!="-1"){n=n+"&descriptorsForUpdate="+encodeURIComponent(m);}else{n=n+"&descriptorsForUpdate=";}var T="";T=P.widgetAction;if(T=="modify Widget"){var U=P.internalId;if(U!=null&&U!=""){U=this.filterEncode(U);n=n+"&prevWidgetName="+encodeURIComponent(U);
}}n=n+"&actionOnWidget="+encodeURIComponent(T);n=n+"&chartType="+encodeURIComponent(C);if(C!=null&&C=="DDTable"){var l=Ext.getCmp("testCombo");if(!Ext.isEmpty(l)){var t=l.getValue();if(t==null||t=="-1"){Ext.Msg.show({title:templatesAlertLbl,msg:testAlertMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});
return;}h=t;}var V=Ext.getCmp("measureListCombo");if(!Ext.isEmpty(V)){var u=V.getValue();if(u==null||u=="-1"){Ext.Msg.show({title:templatesAlertLbl,msg:measureAlertMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});return;}}}else{var k=this.getComparisontable();var A=k.getStore();var L=k.getStore().getCount();
if(L==0){Ext.Msg.show({title:templatesAlertLbl,msg:measureAlertMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});return;}}}}Ext.Ajax.request({url:"/final/servlet/com.eg.EgTemplateBuilderController",params:n,scope:this,method:"POST",success:function(i){var Z=i.responseText;var X=Ext.decode(Z);
if(!Ext.isEmpty(X)){var j=X["updated"];if(j){Ext.Msg.show({title:templatesAlertLbl,msg:"Exclude/Include Element Saved Successfuly",buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});}var Y=Ext.getCmp("descriptorItemSel");Y.settedValues=f;}X=null;Z=null;componentsFilterObj=null;}});},loadDescForSelectedTest:function(b){var d=b.getValue();
if(d=="-1"){var c=Ext.getCmp("compFilterItmSel");if(!Ext.isEmpty(c)){c.suspendEvents(true);c.getStore().removeAll();c.reset();}var a=Ext.getCmp("descMultiselect");if(!Ext.isEmpty(a)){a.suspendEvents(true);a.getStore().removeAll();a.reset();}return;}},loadDescriptorsForTopNWidgets:function(q){var n=this.getUserDefinedWidgetWindow();
if(Ext.isEmpty(n)){n=Ext.widget("userDefinedWidgetWindow");}var g=n.chartType;if(g==""){g=n.configuredDataValue.DisplayType;}if(g==""||g==undefined){g="TopNGaugeChart";}var s=Ext.getCmp("compTypeCombo");s.hide();var d=Ext.getCmp("compFilterItmSel");if(!Ext.isEmpty(d)){d.suspendEvents(true);d.getStore().removeAll();
d.reset();}var k=Ext.getCmp("descMultiselect");if(!Ext.isEmpty(k)){k.suspendEvents(true);k.getStore().removeAll();k.reset();}if(g!=null&&g=="DDTable"){var o=Ext.getCmp("testCombo");if(!Ext.isEmpty(o)){var u=o.getValue();if(u==null||u=="-1"){Ext.Msg.show({title:templatesAlertLbl,msg:testAlertMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});
return;}q=u;}var r=Ext.getCmp("measureListCombo");if(!Ext.isEmpty(r)){var t=r.getValue();if(t==null||t=="-1"){Ext.Msg.show({title:templatesAlertLbl,msg:measureAlertMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});return;}}}else{var h=this.getComparisontable();var l=h.getStore();var j=h.getStore().getCount();
if(j==0){Ext.Msg.show({title:templatesAlertLbl,msg:measureAlertMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});return;}if(q==""||q==undefined){for(var p=0;p<j;p++){var e=h.getStore().getAt(p).get("hidVal");q=e.substr(0,e.indexOf(":"));}}}var a=Ext.getCmp("templateLayoutObj");var f=a.profileName;
var c="";c=Ext.getCmp("WidgetNametextField").getValue();var m=Ext.getCmp("userDefinedWidgetNameLbl");if(m!=null&&m.isVisible()){c=$("#userDefinedWidgetNameLbl").text();}c.trim();var b="C=true&F=getDescriptorsForTBTopNWidget&P0={"+q+"}&P1={"+f+"}&P2={"+c+"}&calljson=true";Ext.Ajax.request({url:"/final/servlet/com.eg.EgMonRemoteScriptingServlet",method:"POST",params:b+"&screenWidth="+(Ext.getBody().getViewSize().width)+"&screenHeight="+(Ext.getBody().getViewSize().height),scope:this,async:true,success:function(y){var v=y.responseText;
if(v!=null&&v!=""){var B=Ext.decode(v);var w=false;if(B!=null&&(B.hasOwnProperty("showDescriptorTextField"))){w=B["showDescriptorTextField"];}if(w){var z=Ext.getCmp("descriptorTextFieldObj");if(!Ext.isEmpty(z)){var A=B["selectedDescriptor"];var x=B.actionOnDesc;if(Ext.isEmpty(x)){x="Exclude";}if(Ext.isEmpty(A)){if(x=="Exclude"){A="None";
}else{if(x=="Include"){A="*";}}}n.showDescriptorTextBox=true;z.setValue(A);z.show();Ext.getCmp("descriptorItemSel").hide();}}else{n.showDescriptorTextBox=false;Ext.getCmp("descriptorTextFieldObj").hide();Ext.getCmp("descriptorItemSel").show();var D=Ext.getCmp("descMultiselect");if(!Ext.isEmpty(D)&&!Ext.isEmpty(B["descriptorsList"])){Ext.suspendLayouts();
D.suspendEvents(true);D.getStore().removeAll();D.reset();D.getStore().loadRawData(B["descriptorsList"]);D.setValue(B["selectedDescriptor"]);D.resumeEvents();var C=Ext.getCmp("descriptorItemSel");C.settedValues=B["selectedDescriptor"];preExcludedDescriptors=B["selectedDescriptor"];Ext.resumeLayouts(false);
}}var x=B.actionOnDesc;var E=Ext.getCmp("updateExcludeInclude");if(!Ext.isEmpty(E)){if(x=="Include"){E.setText(screenLabelsObj["Include"]);}else{if(x=="Exclude"){E.setText(screenLabelsObj["Exclude"]);}}}var i=Ext.getCmp("excIncludeRadioOpt");if(!Ext.isEmpty(i)){i.suspendEvents(false);i.setValue({descOpt:x});
i.resumeEvents();i.show();i=null;delete i;}}}});},loadConfiguredTests:function(){var d=this.getComparisontable();var c=d.getStore();var h=d.getStore().getCount();if(h==0){Ext.Msg.show({title:templatesAlertLbl,msg:measureAlertMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});return;}var b=[];
for(var a=0;a<h;a++){var f=d.getStore().getAt(a).get("hidVal");var g=f.substr(0,f.indexOf(":"));b[a]=g;}var e="action=getDataForTestCombo";if(!Ext.isEmpty(b)){e=e+"&testList="+encodeURIComponent(b);}Ext.Ajax.request({url:"/final/servlet/com.eg.EgTemplateBuilderController",method:"POST",params:e,scope:this,async:true,success:function(i){var l=i.responseText;
if(l!=null&&l!=""){var j=Ext.decode(l);var k=Ext.getCmp("testComboValue");var m=j["defaultTestComboData"];if(!Ext.isEmpty(k)){k.suspendEvents(true);k.getStore().removeAll();k.getStore().loadRawData(m["availTests"]);k.setValue("-1");k.resumeEvents();k.show();}}}});},loadComponentTypeFilter:function(e){var n=e.getValue();
var k=Ext.getCmp("infraTypeCombo");if(Ext.isEmpty(n)){var b=[];b.push({"displayField":"Not Available","valueField":"-1"});var m=Ext.getCmp("compTypeFilterComboObj");if(!Ext.isEmpty(m)){m.getStore().removeAll();m.getStore().loadRawData(b);m.setValue("-1");}}else{var a=k.getValue();if(a!=null&&a=="components"){var f=e.getStore();
var h="";var b=[];b.push({"displayField":"Please choose a component type","valueField":"-1"});for(var i in n){var l=n[i];var d=f.findRecord(e.valueField,l,0,false,true,true);b.push({"displayField":d.get("displayField"),"valueField":l});}var m=Ext.getCmp("compTypeFilterComboObj");if(!Ext.isEmpty(m)){m.suspendEvents(true);
m.getStore().removeAll();m.getStore().loadRawData(b);m.setValue("-1");m.resumeEvents();}}else{var j="action=getServersForInfraType&selectedInfraType="+k.getValue()+"&selectedElements="+e.getValue();var c=Ext.getCmp("templateName").getValue();var g=c;if(!Ext.isEmpty(g)){g=this.filterEncode(g);j=j+"&profileName="+encodeURIComponent(g);
}Ext.Ajax.request({url:"/final/servlet/com.eg.EgTemplateBuilderController",params:j,scope:this,method:"POST",success:function(p){var s=p.responseText;var r=Ext.decode(s);if(!Ext.isEmpty(r)){var o=r["compTypeJson"];var q=Ext.getCmp("compTypeFilterComboObj");if(!Ext.isEmpty(q)){q.suspendEvents(true);q.getStore().removeAll();
q.getStore().loadRawData(o);q.resumeEvents();}}}});}}},loadComponentsForSelection:function(d){var c="action=getServersForType&selectedCompType="+d.getValue();var b=Ext.getCmp("templateName").getValue();var a=b;if(!Ext.isEmpty(a)){a=this.filterEncode(a);c=c+"&profileName="+encodeURIComponent(b);}if(d.getValue()=="-1"){return;
}Ext.Ajax.request({url:"/final/servlet/com.eg.EgTemplateBuilderController",params:c,scope:this,method:"POST",success:function(e){var i=e.responseText;var g=Ext.decode(i);if(!Ext.isEmpty(g)){var f=g["compOptsJson"];if(!Ext.isEmpty(f)){var h=Ext.getCmp("componentsFilterItmSel");if(!Ext.isEmpty(h)){h.suspendEvents(true);
h.getStore().removeAll();h.reset();h.getStore().loadRawData(f["componentsOptsJson"]);h.setValue(f["excludedServers"]);h.resumeEvents();}}}g=null;i=null;}});},excludeComponents:function(e){var b=Ext.getCmp("templateName").getValue();if(Ext.isEmpty(b)){Ext.Msg.show({title:templatesAlertLbl,msg:templateBlankNameAlertMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});
return;}var d=Ext.getCmp("componentsFilterItmSel").getValue();if(Ext.getCmp("componentsFilterItmSel").toField.getStore().getCount()<=0){Ext.Msg.show({title:templatesAlertLbl,msg:excludeServerAlertMsgs,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});return;}var a=b;if(!Ext.isEmpty(a)){a=this.filterEncode(a);
}var c="action=saveExcludeServer&excludedComponents="+encodeURIComponent(d)+"&profileName="+encodeURIComponent(a);Ext.Ajax.request({url:"/final/servlet/com.eg.EgTemplateBuilderController",params:c,scope:this,method:"POST",success:function(f){var h=f.responseText;var g=Ext.decode(h);if(!Ext.isEmpty(g)){if(g["update"]=="success"){Ext.Msg.show({title:templatesAlertLbl,msg:"Components excluded successfully",buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});
}}}});},showStackedChart:function(j){if(!Ext.isEmpty(j)){var f=this.getUserDefinedWidgetWindow();var b=f.getComponent("configForm").getForm();var e=j.getChecked();if(!Ext.isEmpty(e)){var h=e[0].inputValue;if(h!=null&&h=="Yes"){var i=b.findField("showAggOpt");if(!Ext.isEmpty(i)){b.findField("showAggOpt").hide();
b.findField("AggrfnCombo").show();var d=b.findField("AggrfnCombo").getValue();if(Ext.isEmpty(d)){b.findField("AggrfnCombo").setValue("avg");}}}else{var i=b.findField("showAggOpt");if(!Ext.isEmpty(i)){var a=i.getChecked();var c=a[0].inputValue;if(c!=null&&c=="yes"){b.findField("AggrfnCombo").show();var g=b.findField("AggrfnCombo").getValue();
if(Ext.isEmpty(g)){b.findField("AggrfnCombo").setValue("avg");}}else{b.findField("AggrfnCombo").hide();}i.show();}}}}},durationComboOnChange:function(c){var d=Ext.getCmp("Timeline");var a=c.getValue();var b=d.getValue();if(a!=null&&a.toLowerCase()==("h")){b="24 hours";}else{if(a!=null&&a.toLowerCase()==("d")){b="1 week";
}else{if(a!=null&&a.toLowerCase()==("m")){b="6 months";}}}var e="comesFrom=templateBuilder&action=TrendDurationChanged&time="+b+"&period="+a;Ext.Ajax.request({url:"/final/servlet/com.eg.EgMonitorRequestDispatcher",params:e,scope:this,method:"POST",success:function(f){var i=f.responseText;var h=Ext.decode(i);
if(!Ext.isEmpty(h)){var g=Ext.getCmp("Timeline");g.getStore().loadRawData(h["timelinedetails"]["timeline"]);g.setValue(b);}}});},createWidget:function(){var c=this;var a=4;var h=5;var b=0;var g=publicJson["templateConfigDetails"];var f=g["layout"];var e=false;if(widgetsforTemplateView>0){if(f!=null&&f=="Tabular"){if(widgetsforTemplateView%2==1){a=9;
}else{a=4;}}else{if(f!=null&&f=="Relative"){a=12;}}}else{if(f!=null&&f=="Relative"){a=12;}}if(f!=null&&f=="Custom"){e=false;}widgetsforTemplateView=parseInt(widgetsforTemplateView);widgetsforTemplateView=widgetsforTemplateView+1;maxBlockId=parseInt(maxBlockId);maxBlockId=maxBlockId+1;var g=publicJson["templateConfigDetails"];
if(g!=null&&g.hasOwnProperty("dashboardLayoutType")){if(g["dashboardLayoutType"]!=null&&g["dashboardLayoutType"]=="Custom"){a=null;}}var d={"x":0,"y":0,"width":a,"height":h,"id":"block"+maxBlockId,"widgetType":"","noResize":e,"internalId":"","widget_name":"block"+maxBlockId,"widgetNum":"Widget "+maxBlockId,"autoPosition":true};
$(".grid-stack").data("gridstack").batchUpdate();Ext.getCmp("gridstackpanelObj")._addWidget(d,"addWidget","Widget "+maxBlockId,"configureWidgetDefaultIcon","configureWidgetDefaultIcon");$(".grid-stack").data("gridstack").commit();},loadDDColumns:function(a){this.loadManualDDColumns(a,"","");},loadManualDDColumns:function(a,e,c){if(a.isManualLoading&&e==""&&c==""){a.isManualLoading=false;
return;}if(tempSelectedGraph!=null&&tempSelectedGraph=="DDTable"){var i=this;var k=Ext.getCmp("testCombo").getValue();var f=a.getValue();var b=Ext.getCmp("ddcolumnsMultiSelect");var d=Ext.getCmp("graphicalTypeId");var g=Ext.getCmp("summarizeDDColumnCombo");if(f!=null&&k!=null&&k!="-1"&&f!="-1"){Ext.Ajax.request({url:"/final/servlet/com.eg.EgTemplateBuilderController",method:"POST",params:"action=getDDColumnsJSON&selectedTest="+encodeURIComponent(k)+"&selectedMeasure="+f,scope:this,success:function(n){var q=n.responseText;
if(q!=null&&q!=""){var m=Ext.decode(q);var r=m["DDColumns"]["ddColumns"];if(r!=null&&!Ext.isEmpty(r)){var o=b.getStore();o.removeAll();o.loadRawData(r);if(e!=null&&e!=""){a.isManualLoading=false;b.setValue(e);}if(a.isVisible()){Ext.getCmp("ddcolumnsLbl").show();b.show();}if(!Ext.isEmpty(d)){if(!Ext.isEmpty(g)){var p=g.getStore();
p.removeAll();p.loadRawData(r);p.insert(0,{displayField:"Please choose a dd column",valueField:"-1"});if(c!=null&&c!=""){g.setValue(c);}else{g.setValue("-1");}}var l=d.getValue();if(l!=null&&l!="Table"){g.show();}}}else{if(Ext.isEmpty(r)){var o=b.getStore();o.removeAll();o.insert(0,{displayField:notApplicable,valueField:"-1"});
b.setValue("-1");if(a.isVisible()){Ext.getCmp("ddcolumnsLbl").show();b.show();}if(!Ext.isEmpty(g)){var p=g.getStore();p.removeAll();p.insert(0,{displayField:notApplicable,valueField:"-1"});g.setValue("-1");}}}}}});}else{var j=b.getStore();j.removeAll();j.insert(0,{displayField:notApplicable,valueField:"-1"});
b.setValue("-1");if(a.isVisible()){Ext.getCmp("ddcolumnsLbl").show();b.show();}if(!Ext.isEmpty(g)){var h=g.getStore();h.removeAll();h.insert(0,{displayField:notApplicable,valueField:"-1"});g.setValue("-1");}}}},showAggOptions:function(b){var d=b.getChecked();var c=d[0].inputValue;if(c!=null&&c=="yes"){Ext.getCmp("AggrfnCombo").show();
Ext.getCmp("AggrfnCombo").setValue("avg");if(tempSelectedGraph!=null&&tempSelectedGraph=="TabularView"){if(!Ext.isEmpty(Ext.getCmp("EnableMeasureStateColor"))){Ext.getCmp("EnableMeasureStateColor").hide();Ext.getCmp("SetStateColorOn").hide();}}}else{Ext.getCmp("AggrfnCombo").hide();if(tempSelectedGraph!=null&&tempSelectedGraph=="TabularView"){if(!Ext.isEmpty(Ext.getCmp("EnableMeasureStateColor"))){Ext.getCmp("EnableMeasureStateColor").show();
var a=Ext.getCmp("EnableMeasureStateColor").getValue();if(a!=null&&a==true){Ext.getCmp("SetStateColorOn").setDisabled(false);Ext.getCmp("SetStateColorOn").show();}else{Ext.getCmp("SetStateColorOn").setDisabled(true);Ext.getCmp("SetStateColorOn").hide();}}}}},chartDistributionEvent:function(b){var a=b.getChecked();
var c=a[0].inputValue;if(c!=null&&c=="Multiple"){Ext.getCmp("showAggOpt").hide();Ext.getCmp("AggrfnCombo").hide();Ext.getCmp("Legend Display").hide();}else{Ext.getCmp("showAggOpt").show();Ext.getCmp("showAggOpt").setValue({showAgg:"no"});Ext.getCmp("Legend Display").show();}},showWidgetGallery:function(a){var b=this.getAddwidgetwindownew();
if(Ext.isEmpty(b)){b=Ext.widget("addwidgetwindownew");}b.show();b=null;delete b;},widgetToogleFn:function(f,e,d,g,b,a,c){if(f!=null&&f=="AddWidget"){return this.addWidgetFromWidgetGallery(e,g,b,a,true,c);}else{return this.deleteTemplateWidget(d,a,g,true,c);}},showAddWidgetGallerysWindow:function(c){var b=Ext.getCmp("templateLayoutObj");
var a=b.profileName;var e=a;if(!Ext.isEmpty(e)){e=this.filterEncode(e);}var d="comesFrom=templateBuilder&action=loadWidgetGallery&profileName="+encodeURIComponent(e);var f=this;Ext.Ajax.request({url:"/final/servlet/com.eg.EgMonitorRequestDispatcher",method:"POST",params:d,scope:this,success:function(g){var i=g.responseText;
if(i!=null&&i!=""){var h=Ext.decode(i);widGallerywindow=Ext.create("TemplateBuilder.view.WidgetLibrary",{windowMode:"small",url:"/final/servlet/com.eg.EgTemplateBuilderController?action=loadWidgetGalleryData&fromPaging=true&profileName="+encodeURIComponent(e)}).show();}},failure:function(g,h){console.log("Exception loading widget Gallery");
}});},loadDefaultView:function(){var f=this;var b=this.getMain();var e=publicJson["action"];if(e==null||e==""||e=="null"){e="loadMyTemplateListPage";}var c=Ext.getCmp("gridstackpanelObj");if(!Ext.isEmpty(c)){c._removeAllWidget();}if(e!=null&&e=="loadMyTemplateListPage"){f.loadListPage();}else{if(e!=null&&e=="loadTemplateConfigView"){if(!isMonitorHome){Ext.getCmp("templateListCombo").show();
this.loadTemplateListCombo(publicJson["templateComboList"],publicJson["templateConfigDetails"]["profileName"]);Ext.getCmp("listPageHeaderMenu").hide();}Ext.getCmp("searchTemplate").hide();var g=publicJson["templateConfigDetails"];b.setTitle("");b.add({xtype:"templateLayout",profileName:publicJson["templateConfigDetails"]["profileName"],isSharedTemplate:(publicJson["templateConfigDetails"]["isSharedTemplate"]=="true"),isDefaultTemplate:(publicJson["templateConfigDetails"]["isDefaultTemplate"]=="true"),layoutchoosen:publicJson["templateConfigDetails"]["layout"]});
var d=this.getTemplategeneralsettings();if(publicJson["templateConfigDetails"]["isSharedTemplate"]=="false"&&!isMonitorHome){if(publicJson["templateConfigDetails"]["isDefaultTemplate"]=="false"){Ext.getCmp("templateConfigTools").show();}}else{Ext.getCmp("templateConfigTools").hide();}var a=this.getTemplatetools();
a.show();a.getComponent("listBtnContainer").show();a=null;delete a;b.doLayout();this.loadTemplateConfigurationView();}}},fluidWindowModifyClick:function(h,e){var g=h;var b=Ext.getCmp(g).internalId;var a=g;if(e=="addWidget"){if(g!=null){var d=g.substring(g.indexOf("block")+5);a=screenLabelsObj["Widget"];
}}if(b!=null&&b!=""){a=b;}if(a!=null&&a.indexOf("|GRP|")>0){a=a.substring(0,a.indexOf("|GRP|"));}a=a+" "+screenLabelsObj["Configuration"];if(e=="loadWidget"){e="modify Widget";}var f=this.getUserDefinedWidgetWindow();if(!Ext.isEmpty(f)){Ext.EventManager.removeAll("userDefinedWindowaa");f.destroy();f=null;
}f=Ext.widget("userDefinedWidgetWindow",{blockId:g,internalId:b,widgetAction:e,isFluidWindowConfigPopup:true});if(f!=null){f.setTitle(a);f.show();}},removeWidgetFromGroup:function(a,b){var d=this;if(a!=null&&a!=""&&b!=null){var c=this.getWidgetLibrary();if(Ext.isEmpty(c)){c=Ext.widget("widgetLibrary");
}Ext.Msg.show({title:templatesAlertLbl,msg:widgetDelAlertMsg,buttons:Ext.Msg.YESNO,icon:"iconConfirmation",fn:function(e){if(e=="yes"){a=d.filterEncode(a);Ext.Ajax.request({url:"/final/servlet/com.eg.EgTemplateBuilderController",method:"POST",params:"action=deleteWidgetFromGrp&internalId="+encodeURIComponent(a)+"&templateName="+b,scope:this,success:function(g){var h=g.responseText;
if(h!=null&&h!=""){var f=Ext.decode(h);if(f["updated"]=="true"){Ext.Msg.show({title:templatesAlertLbl,msg:"widget removed from Group successfully",buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});if(c!=null&&!Ext.isEmpty(c)){c.close();}}}h=null;delete h;}});}else{return;}}});}},deleteWidgetGroup:function(c,b){if(c!=null&&c!=""&&b!=null&&b!=""){var a=this.getWidgetLibrary();
if(Ext.isEmpty(a)){a=Ext.widget("widgetLibrary");}Ext.Msg.show({title:templatesAlertLbl,msg:widgetGrpDeleteAlertMsg,buttons:Ext.Msg.YESNO,icon:"iconConfirmation",fn:function(d){if(d=="yes"){Ext.Ajax.request({url:"/final/servlet/com.eg.EgTemplateBuilderController",method:"POST",params:"action=deleteWidgetGrp&groupName="+c+"&groupOwner="+b,scope:this,success:function(f){var g=f.responseText;
if(g!=null&&g!=""){var e=Ext.decode(g);if(e["updated"]=="true"){Ext.Msg.show({title:templatesAlertLbl,msg:"Group removed successfully",buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});if(a!=null&&!Ext.isEmpty(a)){a.close();}}}g=null;delete g;}});}else{return;}}});}},addToWidgetLibRadioEvent:function(e){e.suspendEvents(true);
var d=e.getChecked();var b=d[0].inputValue;var g=this.getUserDefinedWidgetWindow();var a=g.getComponent("configForm").getForm();var f=Ext.getCmp("WidgetGrpFieldCont");if(b!=null&&b=="yes"){f.show();var c=a.findField("widgetGrpCombo");c.suspendEvents(true);c.getStore().removeAll();Ext.Ajax.request({url:"/final/servlet/com.eg.EgTemplateBuilderController",method:"POST",params:"action=getAvailbleWidgetGrps&comesFrom=widgetConfiguration",scope:this,success:function(h){var j=h.responseText;
if(j!=null&&j!=""){var i=Ext.decode(j);widgtgrpArr=i["AvailWidgetGrps"];if(widgtgrpArr!=null&&!Ext.isEmpty(widgtgrpArr)){c.getStore().loadRawData(widgtgrpArr);if(associatedGrp!=null&&associatedGrp!=""){c.setValue(associatedGrp);}else{c.setValue("-1");}}}j=null;delete j;}});c.resumeEvents();}else{if(b!=null&&b=="no"){f.hide();
}}e.resumeEvents();e=null;delete e;f=null;delete f;},onWidgetGrpComboChange:function(d){d.suspendEvents(true);var c=this.getUserDefinedWidgetWindow();var a=c.getComponent("configForm").getForm();var b=a.findField("NewGrptxtField");var e=d.getValue();if(e!=null&&e!="undefined"){if(e=="Other"){b.show();
}else{b.hide();}}d.resumeEvents();c=null;delete c;a=null;delete a;b=null;delete b;},onTestComboChange:function(a){this.onDefaultTestComboChange(a);},onDefaultTestComboChange:function(c){var i=c.getValue();var a=c.isModification;var d=Ext.getCmp("measureListCombo");var g=Ext.getCmp("measurelist");var f=this.getUserDefinedWidgetWindow();
var b=f.getComponent("configForm").getForm();if(i!=null){if(i!="-1"){Ext.Ajax.request({url:"/final/servlet/com.eg.EgTemplateBuilderController",method:"POST",params:"action=getMeasuresForTest&comesFrom=widgetConfiguration&selectedTest="+encodeURIComponent(i)+"&selectedGraph="+tempSelectedGraph,scope:this,success:function(m){var k=m.responseText;
if(k!=null&&k!=""){var r=Ext.decode(k);var l=null;if(tempSelectedGraph!=null&&tempSelectedGraph=="DDTable"){l=r["Measures"]["ddMeasureOpts"];}else{l=r["Measures"]["measureOpts"];}if(l!=null&&!Ext.isEmpty(l)){if(tempSelectedGraph!=null&&tempSelectedGraph!=""){if(tempSelectedGraph=="DDTable"){Ext.getCmp("addtoGridBtn").hide();
}else{Ext.getCmp("addtoGridBtn").show();}Ext.getCmp("measureLbl").show();if(tempSelectedGraph=="TopNGaugeChart"||tempSelectedGraph=="TopNDigitalChart"||tempSelectedGraph=="DDTable"||tempSelectedGraph=="TopN"){b.findField("measurelist").hide();b.findField("metricsSearchTextBox").hide();var n=b.findField("measureListCombo");
n.suspendEvents(true);var p=n.getStore();p.removeAll();p.loadRawData(l);p.insert(0,{displayField:"Please Choose Measure",valueField:"-1"});if(tempSelectedGraph=="DDTable"){if(!a){n.setValue("-1");p.resumeEvents();n.show();}}else{n.setValue("-1");p.resumeEvents();n.show();}c.isModification=false;}else{b.findField("measureListCombo").hide();
var s=b.findField("measurelist");s.suspendEvents(true);var o=s.getStore();o.removeAll();o.loadRawData(l);s.resumeEvents();s.show();b.findField("metricsSearchTextBox").show();}}}else{if(tempSelectedGraph!=null&&tempSelectedGraph=="DDTable"){Ext.getCmp("measureLbl").show();var n=b.findField("measureListCombo");
n.suspendEvents(true);var p=n.getStore();p.removeAll();p.insert(0,{displayField:notApplicable,valueField:"-1"});if(!a){n.setValue("-1");n.resumeEvents();n.show();}c.isModification=false;var j=b.findField("ddcolumnsMultiSelect");j.suspendEvents(true);var q=j.getStore();q.removeAll();q.insert(0,{displayField:notApplicable,valueField:"-1"});
j.setValue("-1");j.resumeEvents();}}}}});}else{var h=b.findField("measurelist");h.suspendEvents(true);var e=h.getStore();e.removeAll();e.insert(0,{displayField:notApplicable,valueField:"-1"});h.setValue("-1");h.resumeEvents();}}f=null;delete f;},doTopNEvent:function(e){var d=e.getValue();if(d!=null&&d!=""){if(d=="TopNTabularView"){var f=Ext.getCmp("Legend Display");
var b=Ext.getCmp("colorPlt");var a=Ext.getCmp("ViewType");if(a!=null&&!Ext.isEmpty(a)&&a!="undefined"){Ext.getCmp("advancedOptionWidgetSlider").remove(a);}if(f!=null&&!Ext.isEmpty(f)&&f!="undefined"){Ext.getCmp("advancedOptionWidgetSlider").remove(f);}if(b!=null&&!Ext.isEmpty(b)&&b!="undefined"){Ext.getCmp("advancedOptionWidgetSlider").remove(b);
}}else{if(d=="TopNBarChart"){var c=Ext.getCmp("Display");if(c!=null&&!Ext.isEmpty(c)&&c!="undefined"){Ext.getCmp("advancedOptionWidgetSlider").remove(c);}}}Ext.Ajax.request({url:"/final/servlet/com.eg.EgTemplateBuilderController",method:"POST",params:"action=getTopNOptionsForGraph&&selectedGraph="+encodeURIComponent(d),scope:this,success:function(g){var j=g.responseText;
if(j!=null&&j!=""){var h=Ext.decode(j);var i=h["TopNOptions"]["advanceControls"];if(i!=null&&!Ext.isEmpty(i)){Ext.getCmp("advancedOptionWidgetSlider").add(this.createFilters(i));Ext.getCmp("advancedOptionWidgetSlider").doLayout();}h=null;delete h;}j=null;delete j;}});}},enableChartTypes:function(){var a=Ext.getCmp("ChartSummaryEnabled").getValue();
if(a!=null&&a==true){Ext.getCmp("SummaryGraphType").setDisabled(false);Ext.getCmp("ShowIcon").setDisabled(false);}else{Ext.getCmp("SummaryGraphType").setDisabled(true);Ext.getCmp("ShowIcon").setDisabled(true);Ext.getCmp("ShowIcon").setValue(false);}},enableStateColorOnChange:function(){var a=Ext.getCmp("EnableMeasureStateColor").getValue();
if(a!=null&&a==true){Ext.getCmp("SetStateColorOn").setDisabled(false);Ext.getCmp("SetStateColorOn").show();}else{Ext.getCmp("SetStateColorOn").setDisabled(true);Ext.getCmp("SetStateColorOn").hide();}},showIconControl:function(){var a=Ext.getCmp("ShowIcon").getValue();if(a!=null&&a==true){Ext.getCmp("imgIcon").setDisabled(false);
}else{Ext.getCmp("imgIcon").setDisabled(true);}},loadListPage:function(){var a=this.getMain();a.removeAll();var d=publicJson["myTemplateList"];var b=d["personalSharingData"];Ext.getCmp("listPageHeaderMenu").show();var c="No Templates available";if(b!=null&&b!="-"){Ext.getCmp("selectAllTemplates").show();
Ext.getCmp("searchTemplate").show();a.add({xtype:"templateBuilderList",autoscroll:true,scroll:true,height:(a.getHeight()-55),dataforView:b});a.doLayout();}else{Ext.getCmp("selectAllTemplates").hide();Ext.getCmp("searchTemplate").hide();a.add({xtype:"container",autoscroll:true,scroll:true,height:(a.getHeight()-55),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">'+c+"</div></div></div>"});
}},uploadIconImage:function(d,f){var e=this;var c="No";if(f!=null&&f){c="yes";}var a=Ext.getCmp("FILE_1").getValue();var b=Ext.getCmp("hiddenFile_dstFile");var e=this;var a=Ext.getCmp("FILE_1").getValue();if(a!=null&&a!="undefined"){a=a.toLowerCase();}if(a.lastIndexOf(".png")==-1&&a.lastIndexOf(".jpg")==-1&&a.lastIndexOf(".gif")==-1){Ext.Msg.show({title:templatesAlertLbl,msg:invalidImageTypeAlert,buttons:Ext.Msg.OK,icon:Ext.Msg.WARNING});
Ext.getCmp("FILE_1").reset();Ext.getCmp("FILE_1").focus();return;}Ext.Msg.show({title:templatesAlertLbl,msg:uploadProfileMsgAlert+"?",buttons:Ext.Msg.YESNO,icon:"iconConfirmation",fn:function(k){if(k=="yes"){var l=Ext.getCmp("FILE_1").getValue();var h=Ext.getCmp("fileUploadFormId").getForm();if(h.isValid()){if(l!=null&&l.lastIndexOf("/")>0){l=l.substring(l.lastIndexOf("/")+1);
}else{if(l!=null&&l.lastIndexOf("\\")>0){l=l.substring(l.lastIndexOf("\\")+1);}}var g=Ext.getCmp("FILE_1_dstFile");if(g!=null){g.setValue("manager/tomcat/webapps/final/images/icon-library/"+loginUser+"/"+l);}var j=d;if(!Ext.isEmpty(j)){j=e.filterEncode(j);}var i="/final/servlet/com.eg.EgFileUpload?title=Uploading Template Background&dispCaption=MyTemplate Bg Image&requestFrom=EgTemplateList.jsp&uploadFor=MyTemplateImg&uploadDir=manager/tomcat/webapps/final/images/icon-library/"+loginUser+"/"+l+"&fileExt=jpg&fileUpload=yes&profileName="+encodeURIComponent(j)+"&isFromTemplateList="+c;
Ext.getCmp("fileUploadFormId").submit({url:i,method:"POST",success:function(n,q){var p=Ext.getCmp("windowId");if(!Ext.isEmpty(p)){p.destroy();p=null;delete p;}var u=Ext.getCmp("iconLibWindow");if(!Ext.isEmpty(u)){u.destroy();u=null;delete u;}var o=q.response.responseText;if(l.indexOf(" ")>0){for(var s=0;
s<l.length;s++){l=l.replace(" ","");}}var o=q.response.responseText;if(l.indexOf(" ")>0){for(var s=0;s<l.length;s++){l=l.replace(" ","");}}var r="/final/images/icon-library/"+loginUser+"/"+l;if(c=="No"){Ext.getCmp("imgcont").update('<div id="listViewImgDefault" class="listViewImgDefault"><div style="width:64px;height:64px;overflow:hidden;position: absolute;top:0%;left: 0%;right: 0%;margin: auto;bottom: 0%;"><img id="templateImageIcon"  src="'+r+'" style="position: absolute;top:0%;left: 0%;right: 0%;margin: auto;bottom: 0%;" border="0px"/><div id="settingOver" class="settingOver"></div></div></div>');
}var m=Ext.getCmp("fileUploadFormId");if(c=="yes"){var t=Ext.getCmp("templateBuilderListPageView");if(t!=null&&!Ext.isEmpty(t)){t.removeAll();t.setLoading(false);t.doLayout();}e.goToTemplateListPage();}},failure:function(m,n){}});}}}});},editMyTemplate:function(){var c=Ext.getCmp("templateLayoutObj").profileName;
var b=c;if(!Ext.isEmpty(b)){b=this.filterEncode(b);}var a="comesFrom=templateBuilder&action=modifyTemplateSettings&profileName="+encodeURIComponent(b);this.loadCreateTemplateViewPopup("modifyTemplate",a);a=null;delete a;},checkboxClick:function(d,b,a,f){var c=Ext.query("div.addCheckBox");var j=d.getValue();
if(j){Ext.getCmp("tmplheadrtab").show();for(var e=0;e<c.length;e++){var k=Ext.getCmp("cc_"+e);var h=k.SharedData;var g=k.defaultData;if(h=="false"&&g=="false"){k.setValue(true);k.show();}}Ext.getCmp("DeleteListOfTemplates").show();}else{Ext.getCmp("tmplheadrtab").hide();for(var e=0;e<c.length;e++){var k=Ext.getCmp("cc_"+e);
k.setValue(false);k.hide();}Ext.getCmp("DeleteListOfTemplates").hide();}},goToTemplateListPage:function(){var a="/final/servlet/com.eg.EgMonitorRequestDispatcher?comesFrom=templateBuilder&action=loadMyTemplateListPage";this.goToPage(a,"loadMyTemplateListPage");},editTemplateSettings:function(a){this.loadCreateTemplateViewPopup("modifyTemplate",a);
},goToPage:function(b,d){if(b!=null&&b.indexOf("?")>0){b=b.substr(b.indexOf("?")+1);}Ext.getCmp("custom_layouts").defaultState();if(d=="modifyTemplateSettings"){this.editTemplateSettings(b);}else{if(isAnonymousUserAccess){b=b+"&anonymousUser=true";}else{if(isMonitorHome){b=b+"&setMonitorHome=true";}}var c=this;
var a=this.getMain();Ext.getCmp("templateMainPanel").getHeader().show();Ext.Ajax.request({url:"/final/servlet/com.eg.EgMonitorRequestDispatcher",method:"POST",params:b+"&screenWidth="+(Ext.getBody().getViewSize().width)+"&screenHeight="+(Ext.getBody().getViewSize().height),scope:this,success:function(g){var l=g.responseText;
if(!Ext.isEmpty(l)){publicJson=Ext.decode(l);if(d!=null){if(d=="loadMyTemplateListPage"){var f=Ext.getCmp("gridstackpanelObj");if(!Ext.isEmpty(f)){f._removeAllWidget();}a.remove("templateBuilderListPageView",true);a.remove("dataViewId",true);a.removeAll("dataViewId",true);a.clearManagedListeners();a.remove("templateLayout",true);
a.remove("templateLayoutObj",true);Ext.EventManager.removeAll("templateLayoutObj");Ext.EventManager.removeAll("templateBuilderListPageView");Ext.EventManager.removeAll("dataViewId");Ext.getCmp("selectAllTemplates").setValue(false);Ext.getCmp("templateListCombo").hide();Ext.getCmp("templateConfigTools").hide();
var e=this.getTemplatetools();e.hide();c.loadListPage();}else{if(d=="loadTemplateConfigView"){var k=this.getCreateTemplate();if(Ext.isEmpty(k)){k=Ext.widget("createTemplate");}if(k!=null&&!Ext.isEmpty(k)){k.close();}publicJson["action"]="loadTemplateConfigView";var i=publicJson["templateConfigDetails"]["isSharedTemplate"];
if(i!=null&&i=="true"){i=true;}else{i=false;}var j=publicJson["templateConfigDetails"]["isDefaultTemplate"];if(j!=null&&j=="true"){j=true;}else{j=false;}var f=Ext.getCmp("gridstackpanelObj");if(!Ext.isEmpty(f)){f._removeAllWidget();}Ext.getCmp("listPageHeaderMenu").hide();Ext.getCmp("searchTemplate").hide();
a.remove("templateBuilderListPageView",true);a.remove("dataViewId",true);a.clearManagedListeners();a.removeAll("dataViewId",true);a.remove("templateLayout",true);a.remove("templateLayoutObj",true);Ext.EventManager.removeAll("templateLayoutObj");Ext.EventManager.removeAll("templateBuilderListPageView");
Ext.EventManager.removeAll("dataViewId");a.add({xtype:"templateLayout",profileName:publicJson["templateConfigDetails"]["profileName"],isSharedTemplate:i,isDefaultTemplate:j,layoutchoosen:publicJson["templateConfigDetails"]["layout"]});Ext.getCmp("templateListCombo").show();Ext.getCmp("templateConfigTools").hide();
var h=this.getTemplategeneralsettings();if(publicJson["templateConfigDetails"]["isSharedTemplate"]=="false"&&!isMonitorHome){if(!j){Ext.getCmp("templateConfigTools").show();}}else{Ext.getCmp("templateConfigTools").hide();}var e=this.getTemplatetools();e.show();e.getComponent("listBtnContainer").show();
e=null;delete e;this.loadTemplateListCombo(publicJson["templateComboList"],publicJson["templateConfigDetails"]["profileName"]);a.doLayout();this.loadTemplateConfigurationView();}}}}}});}},replaceHtmlTag:function(a,d,c){if(a.indexOf(d)>0){for(var b=0;b<a.length;b++){a=a.replace(d,c);}}if(a.indexOf(d)>0){for(var b=0;
b<a.length;b++){a=a.replace(d,c);}}return a;},loadDataForBlock:function(g,e,b,a){var f=this;g.setLoading(true,Ext.get(b));var d=e;if(!Ext.isEmpty(d)){d=this.filterEncode(d);}if(!Ext.isEmpty(a)){a=this.filterEncode(a);}var c="&action=loadBlockData&profileName="+encodeURIComponent(d)+"&blockId="+encodeURIComponent(a);
Ext.Ajax.request({url:"/final/servlet/com.eg.EgTemplateBuilderController",method:"POST",params:c,scope:this,success:function(h){var j=h.responseText;var i=Ext.decode(j);if(i!=null){f.showDataForBlock(g,i,b);}i=null;delete i;j=null;delete j;}});},loadTemplateConfigurationView:function(){return loadTemplateConfigurationView("","","");
},loadTemplateConfigurationView:function(ax,am,ah){var al=this;var C=null;var K=false;var f=false;var m="";var av="";tempblockid="";widgetsforTemplateView=0;var an=Ext.getCmp("templateLayoutObj");an.suspendEvents(true);var c=publicJson["templateConfigDetails"];var b=c["templateconfigured"];var ap=c["isSharedTemplate"];
var ar=c["isDefaultTemplate"];var Q=false;if(ar!=null&&(ar==true||ar=="true"||ar=="yes")){Q=true;}var S=false;if(ap!=null&&(ap==true||ap=="true"||ap=="yes")){S=true;}currWidgetsForUser=c["widgetsForUserArr"];var s=c["configIds"];var D=Ext.getCmp("gridstackpanelObj");if(!Ext.isEmpty(D)){D._removeAllWidget();
}var ad=false;var T=false;if(ax!=null&&ax=="changePreDefinedLayout"){T=true;ad=true;}var d=false;var t=publicJson["templateConfigDetails"]["layout"];if(t!=null&&t=="Custom"){d=false;}if(Q){d=true;}var w=false;if(!T&&(c!=null&&c.hasOwnProperty("dashboardLayoutType"))){if(c["dashboardLayoutType"]!=null&&c["dashboardLayoutType"]=="Custom"){w=true;
}else{if(c["dashboardLayoutType"]!=null&&c["dashboardLayoutType"]=="Pre-defined"){ad=true;}}}if((b!=null&&b=="true"&&!Ext.isEmpty(s))||ad||w){var O="loadWidget";var y=c["blockPositionsArr"];var ay=c["blockPositionsMapping"];maxBlockId=c["maxBlockId"];maxBlockId=parseInt(maxBlockId);var ak=0;var L=false;
if(y!=null){widgetsforTemplateView=y.length;ak=widgetsforTemplateView;y=_.sortBy(y,"row");}if(!T&&(c!=null&&c.hasOwnProperty("dashboardLayoutType"))){if(c["dashboardLayoutType"]!=null&&c["dashboardLayoutType"]=="Custom"){var r=publicJson["templateConfigDetails"]["customLayoutColumn"];Ext.getCmp("gridstackpanelObj").selectTemplate=r;
D.gridStackObjRef().setGridWidth(c["customLayoutColumn"],false);L=true;}else{if(c["dashboardLayoutType"]!=null&&c["dashboardLayoutType"]=="Pre-defined"){D.gridStackObjRef().setGridWidth(12,false);var r=publicJson["templateConfigDetails"]["preDefinedLayout"];Ext.getCmp("gridstackpanelObj").selectTemplate=r;
}}}if(T==true){D.gridStackObjRef().setGridWidth(12,false);selectedLayoutArr=_.sortBy(ah,"y");var a=selectedLayoutArr.length;if(ak<a){maxBlockId=selectedLayoutArr.length;for(var E=0;E<a;E++){var aj=selectedLayoutArr[E];if(!Ext.isEmpty(aj)){var U=aj["widgetID"];var ai=0,H=0,B=0,A=0;var au="";if(E<ak){var af=y[E];
if(!Ext.isEmpty(af)){ai=af["col"];H=af["row"];B=af["size_x"];A=af["size_y"];U=ay[ai+","+H+":"+B+","+A];}}ai=aj["x"];H=aj["y"];B=aj["width"];A=aj["height"];var az=s[U];var g=U;var P="addWidget";var M="configureWidgetDefaultIcon";if(az!=null&&az!="undefined"&&az!=""){g=az;P="loadWidget";M="";}var q=false;
var Y=["currentalarms","tierhealth","servicehealth","networkhealth","news","weather","USEREXPERIENCE","Citrix-USERLATENCY","VMAlerts","incidentssummary","proactivealerts"];for(var n in Y){var at=Y[n];if(az!=null&&az==at){q=true;break;}}if(Q){q=true;}var aw=false;if(isLayoutChanged){ai=0;H=0;aw=true;}if(w){B=null;
}var aa={"x":ai,"y":H,"width":B,"height":A,"id":U,"widgetType":g,"widgetNum":"","widget_name":g,"noResize":d,"internalId":az,"isDefaultWidget":q,"autoPosition":aw};$(".grid-stack").data("gridstack").batchUpdate();Ext.getCmp("gridstackpanelObj")._addWidget(aa,P,"","",M);$(".grid-stack").data("gridstack").commit();
}}}else{maxBlockId=y.length;var h=0;var ao=false;var J=false;var N=[];for(var Z in y){var af=y[Z];var ai=af["col"];var H=af["row"];var B=af["size_x"];var A=af["size_y"];var U=ay[ai+","+H+":"+B+","+A];if(h<a){var aj=selectedLayoutArr[h];if(!Ext.isEmpty(aj)){if(ao){ai=0;H=0;B="default";A="default";L=true;
J=true;}else{ai=aj["x"];H=aj["y"];B=aj["width"];A=aj["height"];}h++;if(h>a){h=0;ao=true;}}}var az=s[U];var g=U;var P="addWidget";var M="configureWidgetDefaultIcon";if(az!=null&&az!="undefined"&&az!=""){g=az;P="loadWidget";M="";}var q=false;var Y=["currentalarms","tierhealth","servicehealth","networkhealth","news","weather","USEREXPERIENCE","Citrix-USERLATENCY","VMAlerts","incidentssummary","proactivealerts"];
for(var n in Y){var at=Y[n];if(az!=null&&az==at){q=true;break;}}if(Q){q=true;}var aw=false;if(isLayoutChanged){ai=0;H=0;aw=true;}if(w){B=null;}var aa={"x":ai,"y":H,"width":B,"height":A,"id":U,"widgetType":g,"widgetNum":"","widget_name":g,"noResize":d,"internalId":az,"isDefaultWidget":q,"autoPosition":aw};
if(J){N.push(aa);}else{$(".grid-stack").data("gridstack").batchUpdate();Ext.getCmp("gridstackpanelObj")._addWidget(aa,P,"","",M);$(".grid-stack").data("gridstack").commit();}}if(!Ext.isEmpty(N)){for(var z in N){var k=N[z];var au=configBlocksTitleConfig[k.id];$(".grid-stack").data("gridstack").batchUpdate();
D._addWidget(k,"loadWidget",au,"","");$(".grid-stack").data("gridstack").commit();}}}}else{for(var Z in y){var af=y[Z];var ai=af["col"];var H=af["row"];var B=af["size_x"];var A=af["size_y"];var U=ay[ai+","+H+":"+B+","+A];var az=s[U];var g=U;var P="addWidget";var M="configureWidgetDefaultIcon";if(az!=null&&az!="undefined"&&az!=""){g=az;
P="loadWidget";M="";}var q=false;var Y=["currentalarms","tierhealth","servicehealth","networkhealth","news","weather","USEREXPERIENCE","Citrix-USERLATENCY","VMAlerts","incidentssummary","proactivealerts"];for(var n in Y){var at=Y[n];if(az!=null&&az==at){q=true;break;}}if(Q){q=true;}if(w){B=null;}var aw=false;
if(isLayoutChanged||L){ai=0;H=0;aw=true;}var aa={"x":ai,"y":H,"width":B,"height":A,"id":U,"widgetType":g,"widgetNum":"","widget_name":g,"noResize":d,"internalId":az,"isDefaultWidget":q,"autoPosition":aw};Ext.getCmp("gridstackpanelObj")._addWidget(aa,P,"","",M);}}if(isLayoutChanged){var V=Ext.getCmp("templateLayoutObj");
var ac=V.profileName;var ae=Ext.getCmp("gridstackpanelObj");var F=ae.getTBPanelPositions();al.saveFluidTemplateWindowResizeConfig(ac,F);}if((ap!=null&&ap=="false")||(ar!=null&&ar=="false")){var ab=c["extraBlockPositionsMapping"];if(ab!=null&&!Ext.isEmpty(ab)){widgetsforTemplateView=parseInt(widgetsforTemplateView);
widgetsforTemplateView=widgetsforTemplateView+ab.length;var R="";for(var j in ab){var ag=ab[j];if(ag!=null&&ag.indexOf("$")>0){var u=ag.substring(0,ag.indexOf("$"));var W=ag.substring(ag.indexOf("$")+1);if(W!=null&&W!=""){var X=W.split(",");var p=X[0];p=parseInt(p);var o=X[1];o=parseInt(o);var aa={"x":0,"y":0,"width":B,"height":A,"id":u,"widgetType":"","widget_name":u,"widgetNum":"","noResize":d,"internalId":R,"autoPosition":true};
Ext.getCmp("gridstackpanelObj")._addWidget(aa,"addWidget",u,"configureWidgetDefaultIcon","configureWidgetDefaultIcon");}}}}}}else{if(b!=null&&b=="false"){var x="";if((ap!=null&&ap=="false")||(ar!=null&&ar=="false")){var ay=c["blockPositionsMapping"];var t=c["layout"];maxBlockId=c["maxBlockId"];maxBlockId=parseInt(maxBlockId);
if(ay!=null&&!Ext.isEmpty(ay)){var e=Object.keys(ay).length;widgetsforTemplateView=e;for(var G=1;G<=e;G++){var I=ay["widget_"+G];if(I!=null&&I!=""){var aq=I.split(",");var B=aq[0];B=parseInt(B);var A=aq[1];A=parseInt(A);var aa={"x":0,"y":0,"width":B,"height":A,"id":"block"+G,"widgetType":"","widget_name":"block"+G,"noResize":d,"internalId":x,"widgetNum":"widgetNum_"+G,"autoPosition":true};
Ext.getCmp("gridstackpanelObj")._addWidget(aa,"addWidget","block"+G,"","configureWidgetDefaultIcon");}}}}}}an.resumeEvents();},showSelectedTemplate:function(d){if(d.getValue()!=null&&d.getValue()!="undefined"){var b=d.getValue();if(!Ext.isEmpty(b)){b=this.filterEncode(b);}var a=publicJson["action"];var a=publicJson["action"];
if(a!=null&&a=="loadTemplateConfigView"){var c="/final/servlet/com.eg.EgMonitorRequestDispatcher?comesFrom=templateBuilder&action=loadTemplateConfigView&profileName="+encodeURIComponent(b);this.goToPage(c,"loadTemplateConfigView");}}},loadTemplateListCombo:function(f,d){var c=Ext.getCmp("templateListCombo");
var g=f["personaTemplate"];var e=f["sharedTemplate"];var b=f["defaultTemplate"];if(f["sharingDataAvailable"]=="true"){if(f["defaultDataAvailable"]=="true"){e=e.concat(b);}var a=null;if(g!=null&&g!="undefined"){if(g.length>0){a=g.concat(e);}else{a=e;}}else{a=e;}c.getStore().loadRawData(a);if(d!=null&&d!="undefined"){c.setValue(d);
}else{c.setValue("");}}else{if(f["defaultDataAvailable"]=="true"){if(f["sharingDataAvailable"]=="true"){b=b.concat(e);}var a=null;if(g!=null&&g!="undefined"){if(g.length>0){a=g.concat(b);}else{a=b;}}else{a=b;}c.getStore().loadRawData(a);if(d!=null&&d!="undefined"){c.setValue(d);}else{c.setValue("");}}else{c.getStore().loadRawData(g);
if(d!=null&&d!="undefined"){c.setValue(d);}else{c.setValue("");}}}},deleteSingleTemplate:function(b,d){var c=this;var a=Ext.getCmp("dataViewId");var b=b;Ext.Msg.show({title:templatesAlertLbl,msg:deleteTemplateMsg+"?",buttons:Ext.Msg.YESNO,icon:"iconConfirmation",fn:function(f){if(f=="yes"){var g=b;var e=g;
if(!Ext.isEmpty(e)){e=c.filterEncode(e);}Ext.Ajax.request({url:"/final/servlet/com.eg.EgTemplateBuilderController",method:"POST",params:"action=DeleteTemplate&profileNames="+encodeURIComponent(e)+"&screenWidth="+(Ext.getBody().getViewSize().width)+"&screenHeight="+(Ext.getBody().getViewSize().height),scope:this,success:function(h){var i=h.responseText;
Ext.Msg.show({title:templatesAlertLbl,msg:singleTemplateDeleteMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});c.goToTemplateListPage();},failure:function(h){console.log("failed");}});}}});},deleteTemplate:function(){var b=this;var a=Ext.getCmp("templateLayoutObj").profileName;Ext.Msg.show({title:templatesAlertLbl,msg:deleteTemplateMsg+"?",buttons:Ext.Msg.YESNO,icon:"iconConfirmation",fn:function(d){if(d=="yes"){var e=a;
var c=e;if(!Ext.isEmpty(c)){c=b.filterEncode(c);}Ext.Ajax.request({url:"/final/servlet/com.eg.EgTemplateBuilderController",method:"POST",params:"action=DeleteTemplate&profileNames="+encodeURIComponent(c)+"&screenWidth="+(Ext.getBody().getViewSize().width)+"&screenHeight="+(Ext.getBody().getViewSize().height),scope:this,success:function(f){var g=f.responseText;
if(!Ext.isEmpty(g)){Ext.Msg.show({title:templatesAlertLbl,msg:singleTemplateDeleteMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});b.goToTemplateListPage();}}});}else{if(d=="no"||d=="cancel"){Ext.getCmp("deleteTemplate").defaultState();}}}});},deleteSelectedTemplates:function(){var e=Ext.getCmp("templateBuilderListPageView");
var f=this;var b="";var a=Ext.query("div.addCheckBox");for(var d=0;d<a.length;d++){var g=Ext.getCmp("cc_"+d);if(g.checked){b+="+"+g.data;}if(b!=null&&b.indexOf("+")==0){b=b.substr(1);}}if(b.length>0){var c=deleteTemplateMsg;if(b.length>1){c=deleteMultiTemplateMsg;}Ext.Msg.show({title:templatesAlertLbl,msg:c+"?",buttons:Ext.Msg.YESNO,icon:"iconConfirmation",fn:function(i){if(i=="yes"){var h=b;
if(!Ext.isEmpty(h)){h=f.filterEncode(h);}Ext.Ajax.request({url:"/final/servlet/com.eg.EgTemplateBuilderController",method:"POST",params:"action=DeleteTemplate&profileNames="+encodeURIComponent(h),scope:this,success:function(j){var k=j.responseText;Ext.getCmp("selectAllTemplates").setValue(false);e.removeAll();
e.setLoading(false);e.doLayout();f.goToTemplateListPage();}});}}});}else{Ext.Msg.show({title:templatesAlertLbl,msg:deleteAlertMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});return;}},saveWidgetConfiguration:function(N){mec=this;var cd=mec.getUserDefinedWidgetWindow();if(Ext.isEmpty(cd)){cd=Ext.widget("userDefinedWidgetWindow");
}var S="";S=Ext.getCmp("templateLayoutObj").profileName;var a6="";a6=Ext.getCmp("WidgetNametextField").getValue();var aO=Ext.getCmp("userDefinedWidgetNameLbl");if(aO!=null&&aO.isVisible()){a6=$("#userDefinedWidgetNameLbl").text();}a6=a6.trim();if(this.checkBlankSpc(a6)){var b8=Ext.Msg;b8.show({title:templatesAlertLbl,msg:widgetBlankNameAlertMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});
return;}if(this.checkSpace(a6)){var b8=Ext.Msg;b8.show({title:templatesAlertLbl,msg:widgetBlankNameAlertMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});return;}if(a6!=null&&a6.indexOf(" ")==0){Ext.Msg.show({title:templatesAlertLbl,msg:widgetNameStartsWithSpacMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});
return;}if(this.checkSpecialCharacter(a6)){Ext.Msg.show({title:templatesAlertLbl,msg:widgetSplCharacterAlertMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});return;}var bf=[];bf=mec.getGridstackpanel()._serialization();var aG=cd.internalId;if(aG!=null&&aG.indexOf("|GRP|")>0){aG=aG.substring(0,aG.indexOf("|GRP|"));
}if(currWidgetsForUser!=null&&currWidgetsForUser!=""&&currWidgetsForUser.indexOf(a6)>-1){if(cd.widgetAction=="modify Widget"){if(aG!=a6){Ext.Msg.show({title:templatesAlertLbl,msg:widgetExistAlertMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});return;}}else{Ext.Msg.show({title:templatesAlertLbl,msg:widgetExistAlertMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});
return;}}var bC="";var l=bf.length;var V=l.toString();bC="gridsterLength="+V;var bE=$("#widgetImageIcon");var A=bE[0].src;var b4=null;if(A!=null&&A.lastIndexOf("/")>0&&A.lastIndexOf("clear.png")==-1){b4=A.substring(0,A.lastIndexOf("/"));A=A.substring(A.lastIndexOf("/")+1);}else{if(A!=null&&A.lastIndexOf("\\")>0&&A.lastIndexOf("clear.png")==-1){b4=A.substring(0,A.lastIndexOf("\\"));
A=A.substring(A.lastIndexOf("\\")+1);}else{A=bE[0].className;}}var J=Ext.getCmp("addToWidgetLibRadioBtn").getChecked();addToWidgetLibr=J[0].inputValue;var bZ="";if(addToWidgetLibr!=null&&addToWidgetLibr=="yes"){var av=Ext.getCmp("widgetGrpCombo").getValue();if(av!=null&&av=="Other"){bZ=Ext.getCmp("NewGrptxtField").getValue();
bZ.trim();if(this.checkBlankSpc(bZ)){Ext.Msg.show({title:templatesAlertLbl,msg:widgetGrpBlankNameAlertMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});return;}if(this.checkSpace(bZ)){Ext.Msg.show({title:templatesAlertLbl,msg:widgetGrpBlankNameAlertMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});
return;}if(bZ!=null&&bZ.indexOf(" ")==0){Ext.Msg.show({title:templatesAlertLbl,msg:grpNameStartsWithSpacMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});return;}if(this.checkSpecialCharacter(bZ)){Ext.Msg.show({title:templatesAlertLbl,msg:widgetGrpSplCharacterAlertMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});
return;}if(widgtgrpArr!=null&&!Ext.isEmpty(widgtgrpArr)){for(var bx=0;bx<defaultWidgetsArr.length;bx++){var m=defaultWidgetsArr[bx];if(m["valueField"]==bZ){Ext.Msg.show({title:templatesAlertLbl,msg:grpNameExistsMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});return;}}for(var bx=0;bx<widgtgrpArr.length;
bx++){var m=widgtgrpArr[bx];if(m["valueField"]==bZ){Ext.Msg.show({title:templatesAlertLbl,msg:grpNameExistsMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});return;}}}}else{bZ=av;if(bZ!=null&&bZ=="-1"){Ext.Msg.show({title:templatesAlertLbl,msg:widgetGrpAlertMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});
return;}}}var bL=a6;if(bZ!=null&&bZ!=""){var aU="";if(widgtgrpArr!=null&&!Ext.isEmpty(widgtgrpArr)){for(var bt=0;bt<widgtgrpArr.length;bt++){var bo=widgtgrpArr[bt];if(bo["valueField"]==bZ){aU=bo[bZ];break;}}}a6=a6+"|GRP|"+loginUser+"#"+bZ;}a6=this.filterEncode(a6);var W=S;if(!Ext.isEmpty(W)){W=this.filterEncode(W);
}bC=bC+"&action=saveWidgetConfig&profileName="+encodeURIComponent(W)+"&widgetName="+a6;var d="";var bD="";var u="";var aN="";var bU="";var ap="";if(tempSelectedGraph!=null&&tempSelectedGraph!="servicehealth"&&tempSelectedGraph!="DDTable"){var bl=mec.getComparisontable();var cg=bl.getStore();var b7=bl.getStore().getCount();
if(b7==0){Ext.Msg.show({title:templatesAlertLbl,msg:measureAlertMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});return;}for(var bs=0;bs<b7;bs++){var ar=bl.getStore().getAt(bs).get("hidVal");d=d+","+ar;if(tempSelectedGraph!=null&&tempSelectedGraph=="CombinationChart"){var aq=bl.getStore().getAt(bs).get("chartType");
d=d+"~^~"+aq;}else{if(tempSelectedGraph!=null&&tempSelectedGraph=="DDTable"){var a5=bl.getStore().getAt(bs).get("ddHidVal");d=d+"|"+a5;}}}if(d!=null&&d.indexOf(",")==0){d=d.substring(1);}}else{if(tempSelectedGraph!=null&&tempSelectedGraph=="DDTable"){var bz=Ext.getCmp("testCombo");var s=Ext.getCmp("measureListCombo");
var aA=Ext.getCmp("summarizeDDColumnCombo");var o=Ext.getCmp("ddcolumnsMultiSelect");var bF=Ext.getCmp("graphicalTypeId");var bX=bF.getValue();var X="";var L="";var F="";var bM="";if(!Ext.isEmpty(bz)){X=bz.getValue();}if(!Ext.isEmpty(s)){L=s.getValue();}if(!Ext.isEmpty(aA)){F=aA.getValue();}if(!Ext.isEmpty(o)){bM=o.getValue();
}if(X!=null&&X=="-1"){Ext.Msg.show({title:templatesAlertLbl,msg:testAlertMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});return;}else{if(L!=null&&(L==""||L=="-1")){Ext.Msg.show({title:templatesAlertLbl,msg:measureAlertMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});return;}else{if(bM!=null&&bM=="-1"){Ext.Msg.show({title:templatesAlertLbl,msg:ddColsnotApplicableAlertMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});
return;}else{if(bM!=null&&bM==""){Ext.Msg.show({title:templatesAlertLbl,msg:noDDColSelectedAlertMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});return;}}}}if(bX!=null&&bX=="Table"){var ad="";if(!Ext.isEmpty(s)){var ab=s.getStore();var aL=ab.findRecord(s.valueField,L,0,false,true,true);var q=ab.indexOf(aL);
var bT=ab.getAt(q).get("displayField");ad=X+":"+L;ad=ad+"!!!"+bT;}var ch="";var az="";for(var bK in bM){var al=bM[bK];var aX=o.getStore();var a7=aX.findRecord(o.valueField,al,0,false,true,true);var q=aX.indexOf(a7);var be=aX.getAt(q).get("displayField");ch=ch+","+be;az=az+","+al+":"+be;}if(az!=null&&az.indexOf(",")==0){az=az.substr(1);
}if(ch!=null&&ch.indexOf(",")==0){ch=ch.substr(1);}var h=ad+"|"+az;d=bX+"$"+h;bD=bX;u=X;aN=L;bU="";ap=az;}else{if(F!=null&&(F==""||F=="-1")){Ext.Msg.show({title:templatesAlertLbl,msg:measureAlertMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});return;}var ad="";if(!Ext.isEmpty(s)){var ab=s.getStore();
var aL=ab.findRecord(s.valueField,L,0,false,true,true);var q=ab.indexOf(aL);var bT=ab.getAt(q).get("displayField");ad=X+":"+L;ad=ad+"!!!"+bT;}var aC="";var ch="";var az="";for(var bK in bM){var al=bM[bK];var aX=o.getStore();var a7=aX.findRecord(o.valueField,al,0,false,true,true);var q=aX.indexOf(a7);
var be=aX.getAt(q).get("displayField");ch=ch+","+be;aC=aC+","+al;az=az+","+al+":"+be;}if(az!=null&&az.indexOf(",")==0){az=az.substr(1);}if(ch!=null&&ch.indexOf(",")==0){ch=ch.substr(1);}if(aC!=null&&aC.indexOf(",")==0){aC=aC.substr(1);}var ah=F;var ai=aA.getRawValue();F=F+":"+ai;var h=ad+"|"+az+"|^|"+F;
d=bX+"$"+h;bD=bX;u=X;aN=L;bU=ah;ap=aC;var cb=az.split(",");for(var au in cb){var b9=cb[au];if(b9==F){Ext.Msg.show({title:templatesAlertLbl,msg:alreadyExistLbl,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});return;}}}}else{var bR=Ext.getCmp("categoryOpts");var ax="";if(!Ext.isEmpty(bR)){ax=bR.getValue();
}if(ax=="-1"){var bl=mec.getComparisontable();var cg=bl.getStore();var b7=bl.getStore().getCount();if(b7>0){ax="Descriptors";}}if(ax!=null&&(ax=="Zone"||ax=="Segment"||ax=="Service")){var e=Ext.getCmp("healthCenterComponentCombo").getValue();if(Ext.isEmpty(e)||e==""||e=="-1"){Ext.Msg.show({title:templatesAlertLbl,msg:"Please choose "+ax,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});
return;}if(e.includes("ALL")&&e.length>1){Ext.Msg.show({title:templatesAlertLbl,msg:"Individual "+ax+"s cannot be added if ALL option selected",buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});return;}d=ax+"|$|"+e;}else{if(ax!=null&&ax=="Components"){var b2="";var b=Ext.getCmp("healthCenterCompTypeCombo");
if(!Ext.isEmpty(b)){b2=b.getValue();}if(b2!=null&&b2=="-1"){Ext.Msg.show({title:templatesAlertLbl,msg:compTypAlertMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});return;}d=ax+"|$|"+b2;}else{if(ax!=null&&ax=="Descriptors"){var bl=mec.getComparisontable();var cg=bl.getStore();var b7=bl.getStore().getCount();
if(b7==0){Ext.Msg.show({title:templatesAlertLbl,msg:descriptorAddAlertMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});return;}for(var bs=0;bs<b7;bs++){var ar=bl.getStore().getAt(bs).get("hidVal");d=d+","+ar;}if(d!=null&&d.indexOf(",")==0){d=d.substring(1);}}else{if(ax!=null&&ax=="vms|desktop|users"){var b2="";
var b=Ext.getCmp("healthCenterCompTypeCombo");var e=Ext.getCmp("healthCenterComponentCombo").getValue();if(!Ext.isEmpty(b)){b2=b.getValue();}if(b2!=null&&b2=="-1"){Ext.Msg.show({title:templatesAlertLbl,msg:compTypAlertMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});return;}if(Ext.isEmpty(e)||e==""||e=="-1"){Ext.Msg.show({title:templatesAlertLbl,msg:"Please choose vm.",buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});
return;}if(e.includes("allVms")&&e.length>1){Ext.Msg.show({title:templatesAlertLbl,msg:"Individual vm's cannot be added if 'All VMs' option selected.",buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});return;}d="vms|$|"+b2+"!^!"+e;}else{Ext.Msg.show({title:templatesAlertLbl,msg:categoryAlertMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});
return;}}}}}}d=this.filterEncode(d);bC=bC+"&configuredMeasures="+encodeURIComponent(d);var bw="";bw=cd.widgetAction;var ce=false;var C=false;var bv={};var B=false;if(tempSelectedGraph!=null&&tempSelectedGraph=="CombinationChart"){B=true;}if(bw=="modify Widget"){C=true;var aY=false;var ci=this.getUserDefinedWidgetWindow();
bv=ci.configuredDataValue;var k=bv["gridData"];if(k!=null&&!Ext.isEmpty(k)){if(k.length!=b7){aY=true;}else{var aK=new Array();var bW=new Array();var bP=new Array();var Q=new Array();for(var bs=0;bs<b7;bs++){var ar=bl.getStore().getAt(bs).get("hidVal");aK.push(ar);if(B){var aq=bl.getStore().getAt(bs).get("chartType");
bP.push(aq);}}for(var bs=0;bs<k.length;bs++){var bj=k[bs].hidVal;bW.push(bj);if(B){var a0=k[bs].chartType;Q.push(a0);}}var bu=false;for(var bs=0;bs<aK.length;bs++){var bd=aK[bs];if(bu){break;}for(var br=0;br<bW.length;br++){var ak=bW[br];if(bd==ak){if(B){var aF=bP[bs];var a0=Q[br];if(aF==a0){break;}}else{break;
}}if(bW.length-1==br){aY=true;bu=true;}}}}}if(tempSelectedGraph=="DDTable"){var aZ=bv["selectedChartType"];var E=bv["selectedTest"];var z=bv["selectedMeasure"];var a8=bv["selectedDDColumns"];var aT=bv["summarizedDDColumn"];if((bD!=aZ)||(u!=E)||(aN!=z)||(ap!=a8)||(bU!=aT)){aY=true;}}if(aY==true){ce=true;
}else{if(reGenerateCompsFromExclude){ce=true;}}var aJ=cd.internalId;if(aJ!=null&&aJ!=""){aJ=this.filterEncode(aJ);bC=bC+"&prevWidgetName="+encodeURIComponent(aJ);}}bC=bC+"&actionOnWidget="+encodeURIComponent(bw);var a9="";if(b4!=null&&!b4.endsWith("/final/images/"+strSkin)){a9=a9+"Custom#"+A;}else{if(b4==null){a9=a9+"Default#"+A;
}}var aW="no";if(tempSelectedGraph!=null&&tempSelectedGraph!=""){if(tempSelectedGraph=="TabularView"){var aw=Ext.getCmp("ShowValues").getChecked();if(aw!=null&&!Ext.isEmpty(aw)){showValueOptVal=aw[0].inputValue;if(showValueOptVal!=null){a9=a9+","+"ShowValues#"+showValueOptVal;}}}var bG="";if(tempSelectedGraph=="TopN"){bG=Ext.getCmp("GraphicalType").getValue();
if(bG!=null&&bG!=""){a9=a9+","+"DisplayType#"+bG;}}if(bw=="modify Widget"){if(isTopNWidget&&bG!=""){if(topNVal!=null&&topNVal!=""&&topNVal!=bG){bC=bC+"&graphicalTypeChanged=yes";}}else{if(grapForWidget!=""&&tempSelectedGraph!=grapForWidget){bC=bC+"&graphicalTypeChanged=yes";}}}grapForWidget="";isTopNWidget=false;
topNVal="";if(a9.indexOf("DisplayType#")<0){a9=a9+","+"DisplayType#"+tempSelectedGraph;}var M=Ext.getCmp("showAggOpt");if(M!=null&&!Ext.isEmpty(M)&&M.isVisible()){var aQ=M.getChecked();aW=aQ[0].inputValue;if(aW!=null&&aW=="yes"){var bh=Ext.getCmp("AggrfnCombo");var D=bh.getValue();if(D!=null&&D!=""){a9=a9+","+"Aggregation#Yes|"+D;
if(C&&!Ext.isEmpty(bv["AggregateOptions"])&&bv["AggregateOptions"].hasOwnProperty("AggrConfiguration")){var cf=bv["AggregateOptions"]["AggrConfiguration"]["isAaggregationEnabled"];if(cf!=null&&("Yes|"+D)!=cf){ce=true;}}}}else{a9=a9+","+"Aggregation#No";if(C&&!Ext.isEmpty(bv["AggregateOptions"])&&bv["AggregateOptions"].hasOwnProperty("AggrConfiguration")){var cf=bv["AggregateOptions"]["AggrConfiguration"]["isAaggregationEnabled"];
if(cf!=null&&cf.startsWith("Yes|")){ce=true;}}}}if(tempSelectedGraph=="TopNGaugeChart"||tempSelectedGraph=="TopNDigitalChart"){var cc="";if(b7!=0){for(var bs=0;bs<b7;bs++){var ar=bl.getStore().getAt(bs).get("hidVal");var y=ar.substr(0,ar.indexOf(":"));cc=y;}}if(cc!=null&&(cc.endsWith("_ag")||cc.endsWith("_agx"))){var a1=Ext.getCmp("Aggregation_Function");
var bg="avg";if(!Ext.isEmpty(a1)){var r=a1.getValue();if(!Ext.isEmpty(r)){bg=r;}}a9=a9+","+"Aggregation#No|"+bg;}else{var a1=Ext.getCmp("Aggregation_Function");var bg="avg";if(!Ext.isEmpty(a1)){var r=a1.getValue();if(!Ext.isEmpty(r)){bg=r;}}a9=a9+","+"Aggregation#Yes|"+bg;if(C&&!Ext.isEmpty(bv["AggregateOptions"])&&bv["AggregateOptions"].hasOwnProperty("AggrConfiguration")){var cf=bv["AggregateOptions"]["AggrConfiguration"]["isAaggregationEnabled"];
if(cf!=null&&("Yes|"+D)!=cf){ce=true;}}}}var H=Ext.getCmp("DescriptorsOpt");var aS="no";var ba="no";if(H!=null&&!Ext.isEmpty(H)){var b6=H.getValue();if(b6!=null&&b6==true){aS="yes";}}var bb=Ext.getCmp("ServersOpt");if(bb!=null&&!Ext.isEmpty(bb)){var t=bb.getValue();if(t!=null&&t==true){ba="yes";}}var aH="";
if(aS=="yes"){aH=aH+"$"+"Descriptors";}if(ba=="yes"){aH=aH+"$"+"Servers";}if(aH!=null&&aH.indexOf("$")==0){aH=aH.substring(1);}if(tempSelectedGraph=="TopN"){var T=Ext.getCmp("Timeline");if(T!=null&&T!="undefined"&&!Ext.isEmpty(T)){var aE=Ext.getCmp("Timeline").getValue();if(aE!=null&&aE!=""){a9=a9+","+"Timeline#"+aE;
}}var aM=Ext.getCmp("Priority").getValue();if(aM!=null&&aM!=""){a9=a9+","+"Priority#"+aM;}var bq="no";var bk=Ext.getCmp("WeightedAverage").getChecked();if(bk!=null&&!Ext.isEmpty(bk)){bq=bk[0].inputValue;if(bq!=null){a9=a9+","+"WeightedAverage#"+bq;}}}if(tempSelectedGraph=="TabularView"||tempSelectedGraph=="TopN"||tempSelectedGraph=="BarChart"){if(aH!=null&&aH==""){Ext.Msg.show({title:templatesAlertLbl,msg:displayTypeAlertMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});
return;}if(tempSelectedGraph=="BarChart"||bG=="TopNBarChart"){a9=a9+","+"Legend Display#"+aH;}else{a9=a9+","+"Display#"+aH;}if(bG=="TopNBarChart"){var Z=$("#palleteID");if(Z!=null&&Z!="undefined"&&!Ext.isEmpty(Z)){var b0=Z[0];if(b0!=null&&b0!="undefined"){var aj=b0.value;a9=a9+","+"ColorPalette#"+aj;
}}}}else{var bp=Ext.getCmp("MetricsOpt");var am="no";if(bp!=null&&!Ext.isEmpty(bp)){var bH=bp.getValue();if(bH!=null&&bH==true){am="yes";}}if(ba=="no"&&aS=="no"){var a4=Ext.getCmp("YesOpt");if(a4!=null&&!Ext.isEmpty(a4)){var Y=a4.getValue();if(Y!=null&&Y==true){am="yes";}}}if(am=="yes"){aH=aH+"$"+"Metrics";
if(aH!=null&&aH.indexOf("$")==0){aH=aH.substring(1);}if(aH!=null&&aH==""){Ext.Msg.show({title:templatesAlertLbl,msg:displayTypeAlertMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});return;}}var v=false;var w=Ext.getCmp("Legend Display");if(w!=null&&!Ext.isEmpty(w)&&w.isVisible()){v=true;}if(tempSelectedGraph=="PieChart"||tempSelectedGraph=="activityChart"){if(aH==null||aH==""){aH="Metrics";
}v=true;}if(aH!=null&&aH!=""){if(v){a9=a9+","+"Legend Display#"+aH;}else{a9=a9+","+"Legend Display#none";}}else{a9=a9+","+"Legend Display#none";}}if(tempSelectedGraph=="liveMeasuresBox"||bG=="TopNBarChart"||tempSelectedGraph=="BarChart"){if(tempSelectedGraph=="liveMeasuresBox"){var ae="Vertical";var bN=Ext.getCmp("UseStateColorForBackground").getValue();
var bi="no";if(ae!=null&&!Ext.isEmpty(ae)){var O=ae[0].inputValue;if(O!=null){a9=a9+","+"ViewType#"+O;}}if(bN!=null&&bN==true){bi="yes";}a9=a9+","+"UseStateColorForBackground#"+bi;var an=Ext.getCmp("widgetType").getValue();if(an!=null&&!Ext.isEmpty(an)){a9=a9+","+"widgetType#"+an;}}else{var ae=Ext.getCmp("ViewType").getChecked();
if(ae!=null&&!Ext.isEmpty(ae)){var O=ae[0].inputValue;if(O!=null){a9=a9+","+"ViewType#"+O;}}}}if(tempSelectedGraph=="AreaChart"||tempSelectedGraph=="BarChart"){var aR=Ext.getCmp("Stacked").getChecked();if(aR!=null&&!Ext.isEmpty(aR)){var bS=aR[0].inputValue;if(bS!=null){a9=a9+","+"Stacked#"+bS;if(tempSelectedGraph=="BarChart"&&bS=="Yes"){var bh=Ext.getCmp("AggrfnCombo");
var D=bh.getValue();if(D!=null&&D!=""){a9=a9+","+"Aggregation#Yes|"+D;if(C&&!Ext.isEmpty(bv["AggregateOptions"])&&bv["AggregateOptions"].hasOwnProperty("AggrConfiguration")){var cf=bv["AggregateOptions"]["AggrConfiguration"]["isAaggregationEnabled"];if(cf!=null&&("Yes|"+D)!=cf){ce=true;}}}}}}}if(tempSelectedGraph=="TimelineChart"||tempSelectedGraph=="TrendGraph"){var f=Ext.getCmp("Chart Type").getValue();
if(f!=null&&!Ext.isEmpty(f)){a9=a9+","+"chartType#"+f;}}if(tempSelectedGraph=="TrendGraph"){var aI=Ext.getCmp("Statistics").getValue();if(aI!=null&&!Ext.isEmpty(aI)){a9=a9+","+"graph#"+aI;}var bA=Ext.getCmp("Duration").getValue();if(bA!=null&&!Ext.isEmpty(bA)){a9=a9+","+"period#"+bA;}}if(tempSelectedGraph=="TimelineChart"||tempSelectedGraph=="TrendGraph"||tempSelectedGraph=="AreaChart"||tempSelectedGraph=="CombinationChart"){var ag="No";
var a4=Ext.getCmp("YesOpt");if(a4!=null&&!Ext.isEmpty(a4)){var Y=a4.getValue();if(Y!=null&&Y==true){ag="Yes";}}a9=a9+","+"showChartSummary#"+ag;var P=Ext.getCmp("SortByPriority");if(!Ext.isEmpty(P)){var I=P.getValue();var aM=Ext.getCmp("Priority").getValue();if(!Ext.isEmpty(I)&&I==true){if(aM!=null&&aM!=""){a9=a9+","+"SortByPriority#yes";
a9=a9+","+"Priority#"+aM;}else{a9=a9+","+"SortByPriority#no";}}else{a9=a9+","+"SortByPriority#no";if(aM!=null&&aM!=""){a9=a9+","+"Priority#"+aM;}}}else{a9=a9+","+"SortByPriority#no";}}if(tempSelectedGraph=="PieChart"||tempSelectedGraph=="activityChart"){var aa=Ext.getCmp("showDistprcnt").getChecked();
if(aa!=null&&!Ext.isEmpty(aa)){var ao=aa[0].inputValue;if(ao!=null){a9=a9+","+"showDistprcnt#"+ao;}}var af=Ext.getCmp("ChartDistribution").getChecked();if(af!=null&&!Ext.isEmpty(af)){var bY=af[0].inputValue;if(bY!=null&&bY=="Multiple"){a9=a9+","+"Aggregation#Yes|avg";}if(bY!=null){a9=a9+","+"ChartDistribution#"+bY;
}if(C&&!Ext.isEmpty(bv["advanceControlArr"])){var K=bv["advanceControlArr"][2];var p=K["selectedValue"];if(p!=null&&p!=bY){ce=true;}}}}if(tempSelectedGraph=="TopNDigitalChart"){var bO=Ext.getCmp("SummaryGraphType").getValue();var aB=Ext.getCmp("ChartSummaryEnabled").getValue();var U=Ext.getCmp("ShowIcon").getValue();
var bN=Ext.getCmp("UseStateColorForFonts").getValue();if(U!=null&&U==true){var b1=$("#digitalChartImgIcon");var A=b1[0].src;var b4=null;if(A!=null&&A.lastIndexOf("/")>0){b4=A.substring(0,A.lastIndexOf("/"));A=A.substring(A.lastIndexOf("/")+1);}else{if(A!=null&&A.lastIndexOf("\\")>0){b4=A.substring(0,A.lastIndexOf("\\"));
A=A.substring(A.lastIndexOf("\\")+1);}else{A=b1[0].className;}}}var n="no";var aD="no";var ca="no";if(aB!=null&&aB==true){n="yes";}else{bO="None";}if(U!=null&&U==true){aD="yes";}if(bN!=null&&bN==true){ca="yes";}a9=a9+","+"ChartSummaryEnabled#"+n;a9=a9+","+"SummaryGraphType#"+bO;a9=a9+","+"ShowIcon#"+aD;
if(U!=null&&U==true){if(b4!=null&&!b4.endsWith("/final/images/"+strSkin)){a9=a9+","+"imgIcon#"+"Custom#"+A;}else{if(b4==null){a9=a9+","+"imgIcon#"+"Default#"+A;}}}else{a9=a9+","+"imgIcon#"+"";}a9=a9+","+"UseStateColorForFonts#"+ca;}if(tempSelectedGraph=="TopNGaugeChart"){var a3=Ext.getCmp("ShowGaugeCircle").getValue();
if(a3!=null&&!Ext.isEmpty(a3)&&a3==true){a3="yes";}else{a3="no";}a9=a9+","+"ShowGaugeCircle#"+a3;var at=Ext.getCmp("UseStateColorForGauge").getValue();if(at!=null&&!Ext.isEmpty(at)&&at==true){at="yes";}else{at="no";}a9=a9+","+"UseStateColorForGauge#"+at;}if(tempSelectedGraph!="TopN"){if(tempSelectedGraph!="DDTable"){var T=Ext.getCmp("Timeline");
if(T!=null&&T!="undefined"&&!Ext.isEmpty(T)){var aE=Ext.getCmp("Timeline").getValue();if(aE!=null&&aE!=""){a9=a9+","+"Timeline#"+aE;}}}var Z=$("#palleteID");if(Z!=null&&Z!="undefined"&&!Ext.isEmpty(Z)){var b0=Z[0];if(b0!=null&&b0!="undefined"){var aj=b0.value;if(tempSelectedGraph=="TopNGaugeChart"){a9=a9+","+"selectedGaugeColor#"+aj;
}else{a9=a9+","+"ColorPalette#"+aj;}}}}if(tempSelectedGraph=="TabularView"){var ac=Ext.getCmp("EnableMeasureStateColor").getValue();var ay="no";if(ac!=null&&ac==true){ay="yes";}a9=a9+","+"EnableMeasureStateColor#"+ay;if(ay!=null&&ay=="yes"){var bI=Ext.getCmp("SetStateColorOn");var bV=bI.getValue();if(bV!=null&&bV!=""){a9=a9+","+"SetStateColorOn#"+bV;
}}else{a9=a9+","+"SetStateColorOn#None";}}if(tempSelectedGraph=="servicehealth"){var cj=Ext.getCmp("enableLegendOpt");var bn="";if(cj!=null&&cj!=""&&cj!=undefined){bn=cj.getValue();}var b5="";if(bn!=null&&bn==true){b5="yes";}else{b5="no";}a9=a9+",showLegends#"+encodeURIComponent(b5);}if(tempSelectedGraph=="DDTable"){var bX="";
var aP=Ext.getCmp("graphicalTypeId");if(!Ext.isEmpty(aP)){bX=aP.getValue();}if(bX!=null&&bX=="Bar Chart"){var ae=Ext.getCmp("ViewType").getChecked();if(ae!=null&&!Ext.isEmpty(ae)){var O=ae[0].inputValue;if(O!=null){a9=a9+","+"ViewType#"+O;}}}else{if(bX!=null&&(bX=="Table"||bX=="Time Line"||bX=="Area")){var T=Ext.getCmp("Timeline");
if(T!=null&&T!="undefined"&&!Ext.isEmpty(T)){var aE=Ext.getCmp("Timeline").getValue();if(aE!=null&&aE!=""){a9=a9+","+"Timeline#"+aE;}}var ag="No";var a4=Ext.getCmp("YesOpt");if(a4!=null&&!Ext.isEmpty(a4)){var Y=a4.getValue();if(Y!=null&&Y==true){ag="Yes";}}a9=a9+","+"showChartSummary#"+ag;}}}var bc=Ext.getCmp("widgetDescrText").getValue();
bc.trim();if(!this.checkBlankSpc(bc)&&!this.checkSpace(bc)){if(this.checkSpecialCharacter(bc)){Ext.Msg.show({title:templatesAlertLbl,msg:widgetDescSplCharacterAlertMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});return;}}a9=a9+","+"Description#"+bc;}else{Ext.Msg.show({title:templatesAlertLbl,msg:"plese select Graphical Type",buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});
return;}if(a9!=null&&a9.indexOf(",")==0){a9=a9.substring(1);}if(a9!=null&&a9.endsWith(",")){a9=a9.substring(0,a9.lastIndexOf(","));}bC=bC+"&widgetSettings="+encodeURIComponent(a9);if(C){if(ce){bC=bC+"&reConfigAssociatedComponents=yes";}else{bC=bC+"&reConfigAssociatedComponents=no";}}var b3=mec.getGridstackpanel();
var bB=b3.getTBPanelPositions();var x=N+":"+a6;if(bB!=null&&bB!=""){bC=bC+"&layoutConfig="+encodeURIComponent(bB)+"&blockPosMatch="+encodeURIComponent(x);}b3=null;delete b3;var R=cd.blockId;var a2=Ext.getCmp(R);a2.setLoading(true,true);var G=-1;if(aU!=null&&aU!=""&&!Ext.isEmpty(aU)){var bJ=new Array();
for(var by=0;by<aU.length;by++){var bm=aU[by];if(bm!=null&&bm.indexOf("$")>0){var aV=bm.substring(0,bm.indexOf("$"));var bQ=bm.substring(bm.indexOf("$")+1);if(aV!=null&&aV!=S){bJ.push(bQ);}}}if(bJ!=null&&!Ext.isEmpty(bJ)){G=bJ.indexOf(bL);}}if(G>-1){Ext.Msg.show({title:templatesAlertLbl,msg:widgetExistInGrpAlert,buttons:Ext.Msg.YESNO,icon:"iconConfirmation",fn:function(a){if(a=="yes"){Ext.Ajax.request({url:"/final/servlet/com.eg.EgTemplateBuilderController",method:"POST",params:bC,scope:this,success:function(c){var cu=c.responseText;
var ck=Ext.decode(cu);var cm=Ext.getCmp("userDefinedWindowaa");mec.showDataForBlock(a2,ck,R);Ext.getCmp("form_sumbit_button").addAnimation();var g=Ext.get("createWidgetMain");var cl=mec.getGridstackpanel()._serialization().length;var cy=N.substring(N.length-1);temparray=new Array();for(var cv=0;cv<bf.length;
cv++){var cp=bf[cv]["id"];var cs=cp;if(cp!=null&&cp.indexOf("_")>0){cs=cp.substring(0,cp.indexOf("_"));}var cn=Ext.getCmp(cs);var cq=cn.internalId;if(cq==null||cq==""){temparray.push(cs);}}var cw;for(var cv=0;cv<bf.length;cv++){var ct=bf[cv]["id"];var cz=ct;if(ct!=null&&ct.indexOf("_")>0){cz=ct.substring(0,ct.indexOf("_"));
}var j=Ext.getCmp(cz);var cx=j.internalId;var cr=cm;if(cx==null||cx==""){var co="";if(cz!=null){var cy=cz.substring(cz.indexOf("block")+5);co="Widget";}config={blockId:cz,internalId:cx,title:co,widgetAction:"addWidget",isFluidWindowConfigPopup:false};cw=cz;Ext.apply(cr,config);cm.setTitle(co+" Configuration");
cr.fireEvent("render",cr);break;}}}});}else{a2.setLoading(false);return;}}});}else{Ext.Ajax.request({url:"/final/servlet/com.eg.EgTemplateBuilderController",method:"POST",params:bC,scope:this,success:function(a){var ct=a.responseText;var j=Ext.decode(ct);var cl=Ext.getCmp("userDefinedWindowaa");mec.showDataForBlock(a2,j,R);
Ext.getCmp("form_sumbit_button").addAnimation();var c=Ext.get("createWidgetMain");var ck=mec.getGridstackpanel()._serialization().length;var cx=N.substring(N.length-1);temparray=new Array();for(var cu=0;cu<bf.length;cu++){var co=bf[cu]["id"];var cr=co;if(co!=null&&co.indexOf("_")>0){cr=co.substring(0,co.indexOf("_"));
}var cm=Ext.getCmp(cr);var cp=cm.internalId;if(cp==null||cp==""){temparray.push(cr);}}var cv;for(var cu=0;cu<bf.length;cu++){var cs=bf[cu]["id"];var cy=cs;if(cs!=null&&cs.indexOf("_")>0){cy=cs.substring(0,cs.indexOf("_"));}var g=Ext.getCmp(cy);var cw=g.internalId;var cq=cl;if(cw==null||cw==""){var cn="";
if(cy!=null){var cx=cy.substring(cy.indexOf("block")+5);cn="Widget";}config={blockId:cy,internalId:cw,title:cn,widgetAction:"addWidget",isFluidWindowConfigPopup:false};cv=cy;Ext.apply(cq,config);cl.setTitle(cn+" Configuration");cq.fireEvent("render",cq);break;}}}});}},saveFluidTemplateWindowResizeConfig:function(d,e){mec=this;
var a=[];a=mec.getGridstackpanel()._serialization();var b=a.length;var c=d;if(!Ext.isEmpty(c)){c=this.filterEncode(c);}Ext.Ajax.request({url:"/final/servlet/com.eg.EgTemplateBuilderController",method:"POST",params:"&action=saveLayoutConfig&profileName="+encodeURIComponent(c)+"&gridsterLength="+encodeURIComponent(b)+"&layoutConfig="+encodeURIComponent(e),scope:this,success:function(f){var g=f.responseText;
if(g!=null&&g!=""){}}});},showDataForBlock:function(g,d,c){g.setLoading(false);g.removeAll();g.suspendEvents(true);var f="";var e="loadWidget";var b=d["resultData"]["userName"];if(d["resultData"]["imgClassname"]!=null&&d["resultData"]["imgClassname"]!=""){imgClassname=d["resultData"]["imgClassname"];
if(g.isDefaultWidget){if(imgClassname.indexOf(":")>0&&imgClassname.startsWith("Default")){imgClassname=imgClassname.substring(imgClassname.indexOf(":")+1);}else{imgClassname="/final/images/icon-library/"+b+"/"+imgClassname;}var a=d["resultData"]["dispWidgetName"];if(a!=null&&a=="currentalarms"){a=alertsTitle;
}else{if(a!=null&&a=="tierhealth"){a=tierHealthTitle;}else{if(a!=null&&a=="servicehealth"){a=healthPieChartTitle;}else{if(a!=null&&a=="networkhealth"){a=networkhealthPieChartTitle;}else{if(a!=null&&a=="news"){a=newsTitle;}else{if(a!=null&&a=="weather"){a=weatherTitle;}}}}}}f='<div style="height:100%;width:100%;display:table;"><div style="display:table-cell;vertical-align:middle;text-align:center;" align="center" ><img src="/final/images/spacer.gif" width="42px" height="42px" border="0px" class="'+imgClassname+'" /><div style="text-align:center;margin-top:10px"><span class="textView  font_normal13">'+a+"</span></div></div>";
}else{if(imgClassname.indexOf(":")>0&&imgClassname.startsWith("Default")){imgClassname=imgClassname.substring(imgClassname.indexOf(":")+1);f='<div style="height:100%;width:100%;display:table;"><div style="display:table-cell;vertical-align:middle;text-align:center;" align="center" ><img src="/final/images/spacer.gif" width="42px" height="42px" border="0px" class="'+imgClassname+' mouse" onclick="javascript:configPopup(\''+c+"','"+e+"','"+b+'\');" /><div style="text-align:center;margin-top:10px"><span class="widgetName mouse newFont_normal13"><a onclick="javascript:configPopup(\''+c+"','"+e+"','"+b+"');\">"+d["resultData"]["widgetName"]+"</a></span></div></div>";
}else{if(b!=null&&b!=""){imgClassname="/final/images/icon-library/"+b+"/"+imgClassname;f='<div style="height:100%;width:100%;display:table;"><div style="display:table-cell;vertical-align:middle;text-align:center;" align="center" ><img src="'+imgClassname+'" width="42px" height="42px" border="0px" class="mouse" onclick="javascript:configPopup(\''+c+"','"+e+"','"+b+'\');" /><div style="text-align:center;margin-top:10px"><span class="widgetName mouse newFont_normal13"><a onclick="javascript:configPopup(\''+c+"','"+e+"','"+b+"');\">"+d["resultData"]["widgetName"]+"</a></span></div></div></div>";
}}}}else{if(g.isDefaultWidget){imgClassname="configureWidgetDefaultIcon";var a=d["resultData"]["dispWidgetName"];if(a!=null&&a=="currentalarms"){a=alertsTitle;}else{if(a!=null&&a=="tierhealth"){a=tierHealthTitle;}else{if(a!=null&&a=="servicehealth"){a=healthPieChartTitle;}else{if(a!=null&&a=="networkhealth"){a=networkhealthPieChartTitle;
}else{if(a!=null&&a=="news"){a=newsTitle;}else{if(a!=null&&a=="weather"){a=weatherTitle;}else{if(a!=null&&a=="proactivealerts"){a=proActiveAlertsChartTitle;}else{if(a!=null&&a=="incidentssummary"){a=incidentsSummaryChartTitle;}}}}}}}}f='<div style="height:100%;width:100%;display:table;"><div style="display:table-cell;vertical-align:middle;text-align:center;" align="center" ><img src="/final/images/spacer.gif" width="42px" height="42px" border="0px" class="'+imgClassname+'" /><div style="text-align:center;margin-top:10px"><span class="textView font_normal13">'+a+"</span></div></div>";
}else{imgClassname="/final/images/"+strSkin+"/userDefinedWidgetIstamName.png";f='<div style="height:100%;width:100%;display:table;"><div style="display:table-cell;vertical-align:middle;text-align:center;" align="center" ><img src="'+imgClassname+'" width="42px" height="42px" border="0px" class="mouse" onclick="javascript:configPopup(\''+c+"','"+e+"','"+b+'\');" /><div style="text-align:center;margin-top:10px"><span class="widgetName mouse newFont_normal13"><a onclick="javascript:configPopup(\''+c+"','"+e+"','"+b+"');\">"+d["resultData"]["dispWidgetName"]+"</a></span></div></div></div>";
}}g.add({xtype:"container",baseCls:"OneClickConfigButton",action:"configmeAction",flex:1,html:f});if(d["resultData"]["internalID"]!=null&&d["resultData"]["internalID"]!=""){g.internalId=d["resultData"]["internalID"];}g.action="loadWidget";g.resumeEvents();g.doComponentLayout();if(d["resultData"]["widgetsForUserArr"]!=null&&!Ext.isEmpty(d["resultData"]["widgetsForUserArr"])){currWidgetsForUser=d["resultData"]["widgetsForUserArr"];
}},cloneMyTemplate:function(){var a=Ext.getCmp("templateLayoutObj").profileName;this.callClone(a,false);},cloneSharedTemplate:function(f,c){var b=this;var d=f;var e=f+"_Clone";var a=Ext.create("Ext.window.Window",{height:strSkin=="Light"?185:175,width:strSkin=="Light"?345:325,header:{height:33,padding:"0 10",margin:0},ghost:false,ui:"newPopupWindow newplainHeader_border",frame:true,padding:0,border:true,modal:true,closable:true,draggable:true,resizable:false,id:"callCloneWindow",timeFilterConfig:"",title:cloneTemplateLbl,scroll:true,autoScroll:true,closeAction:"destroy",buttonAlign:"center",layout:"hbox",items:[{xtype:"image",imgCls:"clone_arrow",width:21,height:33,margin:"15 0 5 10",src:"/final/images/"+strSkin+"/clone_arrow.png",},{xtype:"container",layout:"vbox",defaults:{labelAlign:"top",},flex:1,items:[{xtype:"label",margin:"10 20 5 2",html:'<div class="font_bold13" data-qtip="'+f+'">'+Ext.String.ellipsis(f,43,true)+"</div>",},{xtype:"textfield",id:"clone_templatename",name:"clone_templatename",cls:"textbox",width:"100%",margin:"10 10 10 2",labelWidth:152,fieldLabel:templateNameLbl,labelSeparator:"",value:e}]}],dockedItems:[{xtype:"toolbar",dock:"bottom",cls:"egFooter",items:["->",{xtype:"button",buttonAlign:"center",text:screenLabelsObj["Clone"],margin:6,padding:"0 10 0 10",cls:"buttonNewBig",buttonAlign:"center",handler:function(g){var h=Ext.getCmp("clone_templatename").getValue();
b.cloneTemplate(h,c,g,false,true);}},"->"]}],listeners:{"close":function(g){Ext.getCmp("cloneTemplate").defaultState();}}});a.show();},callClone:function(b,f){var c=this;var d=b;var e=b+"_Clone";var a=Ext.create("Ext.window.Window",{height:strSkin=="Light"?185:175,width:strSkin=="Light"?345:325,header:{height:33,padding:"0 10",margin:0},ghost:false,ui:"newPopupWindow newplainHeader_border",frame:true,padding:0,border:true,modal:true,closable:true,draggable:true,resizable:false,id:"callCloneWindow",timeFilterConfig:"",title:cloneTemplateLbl,scroll:true,autoScroll:true,closeAction:"destroy",buttonAlign:"center",layout:"hbox",items:[{xtype:"image",imgCls:"clone_arrow",width:21,height:33,margin:"15 0 5 10",src:"/final/images/"+strSkin+"/clone_arrow.png",},{xtype:"container",layout:"vbox",defaults:{labelAlign:"top",},flex:1,items:[{xtype:"label",margin:"10 20 5 2",html:'<div class="font_bold13" data-qtip="'+b+'">'+Ext.String.ellipsis(b,43,true)+"</div>"},{xtype:"textfield",id:"clone_templatename",name:"clone_templatename",cls:"textbox",width:"100%",margin:"10 10 10 2",labelWidth:152,fieldLabel:templateNameLbl,labelSeparator:"",value:e}]}],dockedItems:[{xtype:"toolbar",dock:"bottom",cls:"egFooter",items:["->",{xtype:"button",buttonAlign:"center",text:screenLabelsObj["Clone"],margin:6,padding:"0 10 0 10",cls:"buttonNewBig",buttonAlign:"center",handler:function(g){var h=Ext.getCmp("clone_templatename").getValue();
c.cloneTemplate(h,d,g,f,false);}},"->"]}],listeners:{"close":function(g){Ext.getCmp("cloneTemplate").defaultState();}}});a.show();},cloneTemplate:function(a,p,c,o,r){a.trim();var f=this;c.setDisabled(true);if(this.checkBlankSpc(a)){Ext.Msg.show({title:templatesAlertLbl,msg:templateBlankNameAlertMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});
c.setDisabled(false);return;}if(this.checkSpace(a)){Ext.Msg.show({title:templatesAlertLbl,msg:templateBlankNameAlertMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});c.setDisabled(false);return;}if(a!=null&&a.indexOf(" ")==0){Ext.Msg.show({title:templatesAlertLbl,msg:templateNameStartsWithSpacMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});
c.setDisabled(false);return;}if(this.checkSpecialCharacter(a)){Ext.Msg.show({title:templatesAlertLbl,msg:templateSplCharacterAlertMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});c.setDisabled(false);return;}var m="-1";var g=publicJson["action"];if(g!=null&&g=="loadMyTemplateListPage"){var d=Ext.getCmp("dataViewId");
if(!Ext.isEmpty(d)){var j=d.getStore();var t=a;if(r){if(t!=null&&t.indexOf("|USRSEP|")>0){var e=t.split("|USRSEP|");t=e[0];}}var b=j.findRecord("templateName",t,0,false,false,true);m=j.indexOf(b);}}else{var s=Ext.getCmp("templateListCombo");if(!Ext.isEmpty(s)){var j=s.getStore();var h=j.data.length;var q=[];
for(var n=0;n<h;n++){var l=j.getAt(n).get("valueField");if(l!=null&&l.indexOf("|USRSEP|")>0){var e=l.split("|USRSEP|");l=e[0];}q.push(l);}m=q.indexOf(a);}}if(m>-1){Ext.Msg.show({title:templatesAlertLbl,msg:templateExistAlertMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});c.setDisabled(false);
return;}var k=a;if(!Ext.isEmpty(k)){k=this.filterEncode(k);}Ext.Ajax.request({url:"/final/servlet/com.eg.EgTemplateBuilderController",method:"POST",params:"action=cloneTemplate&prevTemplateName="+encodeURIComponent(p)+"&profileName="+encodeURIComponent(k)+"&screenWidth="+(Ext.getBody().getViewSize().width)+"&isDefaultTemplate="+o+"&screenHeight="+(Ext.getBody().getViewSize().height),scope:this,success:function(i){var v=i.responseText;
var u=Ext.decode(v);Ext.getCmp("callCloneWindow").close();if(u["update"]=="success"){f.goToTemplateListPage();}}});},checkBlankSpc:function(a){a.replace(/^[\s]+/,"").replace(/[\s]+$/,"").replace(/[\s]{2,}/," ");if(a.length==0||a==""){return true;}return false;},checkSpecialCharacter:function(a){var c='%&+="?#:$!^~,|[]';
for(var b=0;b<a.length;b++){check_char=c.indexOf(a.charAt(b));if(check_char>=0){return true;}}return false;},checkSpace:function(a){if(a.replace(/\s/g,"")==""){return true;}return false;},createTemplateView:function(){var a="comesFrom=templateBuilder&action=loadCreateTemplatePopup";this.loadCreateTemplateViewPopup("addTemplate",a);
},loadCreateTemplateViewPopup:function(e,a){var c=this;minwidgets=0;widgetsforTemplate=0;defaultSelectedLayout="";tempSelectedLayout="";var d=this.getCreateTemplate();if(Ext.isEmpty(d)){d=Ext.widget("createTemplate");}var b="";if(a!=null&&a!=""){b=a;}Ext.Ajax.request({url:"/final/servlet/com.eg.EgMonitorRequestDispatcher",method:"POST",params:b+"&screenWidth="+(Ext.getBody().getViewSize().width)+"&screenHeight="+(Ext.getBody().getViewSize().height),scope:this,success:function(f){var D=f.responseText;
if(D!=null&&D!=""){var k=Ext.decode(D);d.suspendEvents(true);var h=k["templateComponentAccessDetails"]["templateImg"];if(h!=null&&h!=""){if(h.indexOf(":")>0&&h.startsWith("Default")){h=h.substring(h.indexOf(":")+1);Ext.getCmp("imgcont").update('<div class="listViewImgDefault"><div style="width:64px;height:64px;overflow:hidden;position: absolute;top:0%;left: 0%;right: 0%;margin: auto;bottom: 0%;"><img id="templateImageIcon"  class= "'+h+'" src="/final/images/clear.png" border="0px"  style="position:absolute;top:0%;left: 0%;right: 0%;margin: auto;bottom: 0%;" border="0px" /><div id="settingOver" class="settingOver"></div></div></div>');
}else{Ext.getCmp("imgcont").update('<div class="listViewImgDefault"><div style="width:64px;height:64px;overflow:hidden;position: absolute;top:0%;left: 0%;right: 0%;margin: auto;bottom: 0%;"><img id="templateImageIcon"  src="'+h+'"  style="position:absolute;top:0%;left: 0%;right: 0%;margin: auto;bottom: 0%;" border="0px"/><div id="settingOver" class="settingOver"></div></div></div>');
}}defaultSelectedLayout=k["layoutOptions"]["selectedLayout"];tempSelectedLayout=defaultSelectedLayout;var g=Ext.getCmp("templateViewOpt");var i=k["templateComponentAccessDetails"]["TemplateType"];c.setValueWithOptionInList(g,k["templateTypeOptions"]["typeOptions"],"-1","");if(i!=null&&i!=""){g.setValue(i);
}var u=Ext.getCmp("infraTypeCombo");var s=k["templateComponentAccessDetails"]["selectedType"];c.setValueWithOptionInList(u,k["templateComponentAccessDetails"]["typeOptions"],"-1","");if(s!=null&&s!=""){u.setValue(s);}var B=Ext.getCmp("templateInfraElementsCombo");var F=k["templateComponentAccessDetails"]["availElements"];
var K=k["templateComponentAccessDetails"]["selectedElements"];if(F!=null&&!Ext.isEmpty(F)){B.getStore().loadRawData(F);}if(K!=null&&!Ext.isEmpty(K)){B.setValue(K);}var A=Ext.getCmp("templateForHomePage");A.suspendEvents(false);var t=k["templateComponentAccessDetails"]["UseThisTemplateForHomePage"];if(t!=null&&t=="yes"){A.setValue(true);
}A.resumeEvents();var o=Ext.getCmp("templateInfraElementsSingleCombo");if(!Ext.isEmpty(o)){var H=o.getStore();var w="";if(!Ext.isEmpty(H)){H.loadRawData(F);H.insert(0,{displayField:compTypAlertMsg,valueField:"-1"});var j=H.findRecord("valueField","All");if(!Ext.isEmpty(j)){H.suspendEvents(false);H.remove(j);
H.resumeEvents();}w="-1";}else{H.insert(0,{displayField:notApplicable,valueField:"-1"});w="-1";}if(!Ext.isEmpty(K)){w=K[0];if(Ext.isEmpty(w)){w=F[0].valueField;}o.setValue(w);}else{o.setValue(w);}}var q=Ext.getCmp("templateViewOpt");if(!Ext.isEmpty(q)){var C=q.getValue();if(i!=null&&(i=="consolidated-server"||i=="singleserver")){B.hide();
Ext.getCmp("multiSearchCompType").hide();Ext.getCmp("templateCompExpand").hide();u.setValue("components");u.setDisabled(true);o.show();}else{o.hide();B.show();Ext.getCmp("multiSearchCompType").show();Ext.getCmp("templateCompExpand").show();u.setDisabled(false);}}if(e!=null&&e=="addTemplate"){d.setTitle(createtemplateTitle);
d.templateAction="Add";var G=Ext.getCmp("customPrivateId");Ext.getCmp("customSharingLbl").update('<div class="formLabelDivFont">'+k["screenLabels"]["monitor.dashboard.Sharing"]+"</div>");G.setText('<div class="dashboardSharedButtonText">'+k["screenLabels"]["monitor.common.Private"]+"</div>");Ext.getCmp("customPublicId").setText('<div class="dashboardSharedButtonText">'+k["screenLabels"]["monitor.common.Public"]+"</div>");
Ext.getCmp("customShareId").setText('<div class="dashboardSharedButtonText">'+k["screenLabels"]["monitor.common.Share to"]+"</div>");Ext.getCmp("customSharingGridLbl").update('<div class="formLabelDivFont">'+k["screenLabels"]["monitor.common.Share to - Available Users"]+"</div>");G.pressed=true;var p=Ext.getCmp("customCheckComp");
p.getStore().loadRawData(k["validUsers"]);}if(e!=null&&e=="modifyTemplate"){d.setTitle(editTemplateTitle);var J=Ext.getCmp("templateName");var r=k["userSharingDetails"]["profileName"];J.setValue(r);var n=Ext.getCmp("templateDescription");n.setValue(k["templateDescription"]);var I=k["userSharingDetails"]["sharePref"];
var l=Ext.getCmp("customPrivateId");var z=Ext.getCmp("customPublicId");var m=Ext.getCmp("customShareId");Ext.getCmp("customSharingLbl").update('<div class="formLabelDivFont">'+k["screenLabels"]["monitor.dashboard.Sharing"]+"</div>");l.setText('<div class="dashboardSharedButtonText">'+k["screenLabels"]["monitor.common.Private"]+"</div>");
z.setText('<div class="dashboardSharedButtonText">'+k["screenLabels"]["monitor.common.Public"]+"</div>");m.setText('<div class="dashboardSharedButtonText">'+k["screenLabels"]["monitor.common.Share to"]+"</div>");Ext.getCmp("customSharingGridLbl").update('<div class="formLabelDivFont">'+k["screenLabels"]["monitor.common.Share to - Available Users"]+"</div>");
var E=Ext.getCmp("customSharedUsersObj");E.removeAll();var v=k["userSharingDetails"]["sharedUsers"];var y=[];y.push({xtype:"container",html:'<div class="formLabelDivFont padding4">'+k["screenLabels"]["monitor.common.Share to - Available Users"]+"</div>",},{xtype:"gridpanel",store:new Ext.data.Store({fields:["displayField","valueField","readWrite"],data:k["validUsers"]}),createGridButton:function(O,Q,M,L,P,N){new Ext.form.field.Checkbox({checked:O,margin:0,hidden:true,ui:"readWrite_checkbt",setToolTip:function(T){var S=this;
readOnlyText=readOnlyLbl;switch(T){case true:readOnlyText=readWriteLbl;break;case false:readOnlyText=readOnlyLbl;break;}if(!Ext.isEmpty(M)){M.suspendEvents();var R=M.getAt(P);R.set(N,this.checked);M.resumeEvents();}S.getEl().set({"data-qtip":readOnlyText});},listeners:{afterRender:function(R){this.setToolTip(this.checked);
},change:function(R,U,S,T,V){this.checked=U;R.setToolTip(this.checked);}},renderTo:Q,});return O;},ui:"multiSelectWithCheckbox",hideHeaders:true,columns:[{text:"",dataIndex:"displayField",width:152,},{dataIndex:"readWrite",width:20,padding:"0 0 0 0",margin:0,renderer:function(T,L,N,Q,V,U,R,O){var P=this,S=R.ownerCt.columns[V].dataIndex;
L["tdAttr"]='id="'+S+Q+'"';var M=""+S+Q+"";Ext.defer(function(){P.createGridButton(T,M,U,R,Q,S);},50);return Ext.String.format('<div id="{0}"></div>',M);}},],id:"customCheckComp",name:"customCheckComp",height:90,width:200,padding:0,margin:0,selModel:Ext.create("Ext.selection.CheckboxModel",{checkOnly:true,headerWidth:18}),border:true,listeners:{"viewready":function(M){if(!Ext.isEmpty(v)&&(v!=null&&v!="undefined")){for(var N in v){var L=M.getStore().findRecord("valueField",v[N]);
M.getSelectionModel().select(L,true);}}}}});E.add(y);if(I!=null&&I=="Private"){l.pressed=true;z.pressed=false;m.pressed=false;}else{if(I!=null&&I=="Public"){l.pressed=false;z.pressed=true;m.pressed=false;}else{if(I!=null&&I=="Share"){l.pressed=false;z.pressed=false;m.pressed=true;Ext.apply(E,{style:{"display":"block"}});
E.show();}}}var x=Ext.getCmp("CreateTemplateBtn");x.setText(k["screenLabels"]["monitor.common.Update"]);d.templateAction="Modify";d.profileName=r;}d.show();d.resumeEvents();d.doComponentLayout();k=null;delete k;}},failure:function(f,g){console.log("EXCEPTION IN LOADING");}});},onLayoutSelect:function(d){var b=d.value;
tempSelectedLayout=b;if(b!=null){if(b==defaultSelectedLayout){Ext.getCmp("templateNumField").setValue(widgetsforTemplate);Ext.getCmp("templateNumField").hiddenMinVal=minwidgets;}else{var c=Ext.getCmp("templateLayoutObj");var f="";if(c!=null&&!Ext.isEmpty(c)){var a=c.profileName;if(a!=null||a!="undefined"){f=a;
}}var e=f;if(!Ext.isEmpty(e)){e=this.filterEncode(e);}var g="action=getDefaultWidgetCount&selectedlayOut="+encodeURIComponent(b)+"&profileName="+encodeURIComponent(e);Ext.Ajax.request({url:"/final/servlet/com.eg.EgTemplateBuilderController",method:"POST",params:g+"&screenWidth="+(Ext.getBody().getViewSize().width)+"&screenHeight="+(Ext.getBody().getViewSize().height),scope:this,async:true,success:function(h){var l=h.responseText;
if(l!=null&&l!=""){var k=Ext.decode(l);var m=k["defaultWidgetsCount"]["defaultWidgetsForLayout"];var j=k["defaultWidgetsCount"]["minimumWidgetsForLayout"];var i=k["defaultWidgetsCount"]["restrictedWidgetsForLayout"];if(m!=null&&j!=null&&i!=null){Ext.getCmp("templateNumField").setValue(m);Ext.getCmp("templateNumField").hiddenMinVal=j;
Ext.getCmp("templateNumField").setMinValue(i);}isLayoutChanged=true;k=null;delete k;}l=null;delete l;},failure:function(h,i){console.log("EXCEPTION IN LOADING");}});}}},onGraphTypeSelect:function(E){var p=this;var c=false;var s=false;var x=E.value;var Y=E.btnGrp;tempSelectedGraph=x;if(tempSelectedGraph!=null&&tempSelectedGraph!=""){var d=Ext.getCmp("configTableGrid");
if(Y!=availBtnGrp){d.getStore().removeAll();}availBtnGrp=Y;var L=this.getUserDefinedWidgetWindow();L.chartType=tempSelectedGraph;var G=L.blockId;var K=L.internalId;var r=Ext.getCmp("templateLayoutObj").profileName;var i=L.getComponent("configForm").getForm();var T=i.findField("testCombo");T.suspendEvents(true);
T.getStore().removeAt(0);T.getStore().insert(0,{displayField:screenLabelsObj["Please Select a Test"],valueField:"-1"});if(tempSelectedGraph!="DDTable"){T.setValue("-1");}T.resumeEvents();var S=Ext.getCmp("measureLbl");if(tempSelectedGraph=="TopNGaugeChart"||tempSelectedGraph=="TopNDigitalChart"||tempSelectedGraph=="DDTable"||tempSelectedGraph=="TopN"){if(tempSelectedGraph=="DDTable"){var J=Ext.getCmp("summarizeDDColumnCombo");
if(!Ext.isEmpty(J)){J.hide();}var q=Ext.getCmp("graphicalTypeId");if(!Ext.isEmpty(q)){q.show();}Ext.getCmp("addtoGridBtn").hide();i.findField("testCombo").show();Ext.getCmp("selectionDetailsLbl").hide();Ext.getCmp("oneMetricTxt").hide();}else{var J=Ext.getCmp("summarizeDDColumnCombo");if(!Ext.isEmpty(J)){J.hide();
}var q=Ext.getCmp("graphicalTypeId");if(!Ext.isEmpty(q)){q.hide();}Ext.getCmp("graphicalTypeId").hide();if(!S.isVisible()){Ext.getCmp("addtoGridBtn").hide();}else{Ext.getCmp("addtoGridBtn").show();}i.findField("testCombo").show();Ext.getCmp("selectionDetailsLbl").show();Ext.getCmp("oneMetricTxt").show();
}var m=i.findField("categoryOpts");var R=i.findField("healthCenterTestScrollCombo");var t=i.findField("healthCenterCompContiner");t=Ext.getCmp("healthCenterCompContiner");var h=i.findField("healthCenterCompTypeCombo");if(!Ext.isEmpty(m)){m.hide();}if(!Ext.isEmpty(R)){R.hide();}if(!Ext.isEmpty(t)){t.hide();
}if(!Ext.isEmpty(h)){h.hide();}i.findField("measurelist").hide();i.findField("metricsSearchTextBox").hide();var ab=i.findField("measureListCombo");ab.suspendEvents(true);var N=ab.getStore();N.removeAll();N.insert(0,{displayField:screenLabelsObj["Please Choose Measure"],valueField:"-1"});ab.setValue("-1");
N.resumeEvents();if(S.isVisible()){ab.show();}}else{if(tempSelectedGraph!=null&&tempSelectedGraph=="servicehealth"){var J=Ext.getCmp("summarizeDDColumnCombo");if(!Ext.isEmpty(J)){J.hide();}var q=Ext.getCmp("graphicalTypeId");if(!Ext.isEmpty(q)){q.hide();}var l=Ext.getCmp("healthCenterComponentCombo");
if(!Ext.isEmpty(l)){l.suspendEvents(true);l.getStore().removeAll();l.getStore().insert(0,{displayField:notApplicable,valueField:"-1"});l.resumeEvents();l.setValue("-1");}var H=Ext.getCmp("healthCenterComponentComboLbl");Ext.getCmp("selectionDetailsLbl").hide();Ext.getCmp("oneMetricTxt").hide();i.findField("measurelist").hide();
i.findField("metricsSearchTextBox").hide();i.findField("measureListCombo").hide();i.findField("testCombo").hide();var y=i.findField("measureLbl");y=Ext.getCmp("measureLbl");H.setText("Zones");if(!Ext.isEmpty(y)){y.hide();}Ext.getCmp("addtoGridBtn").hide();var m=i.findField("categoryOpts");var R=i.findField("healthCenterTestScrollCombo");
var t=i.findField("healthCenterCompContiner");t=Ext.getCmp("healthCenterCompContiner");if(!Ext.isEmpty(m)){m.show();}if(!Ext.isEmpty(R)){R.show();}}else{var J=Ext.getCmp("summarizeDDColumnCombo");if(!Ext.isEmpty(J)){J.hide();}var q=Ext.getCmp("graphicalTypeId");if(!Ext.isEmpty(q)){q.hide();}var S=Ext.getCmp("measureLbl");
if(!S.isVisible()){Ext.getCmp("addtoGridBtn").hide();}else{Ext.getCmp("addtoGridBtn").show();}i.findField("testCombo").show();Ext.getCmp("selectionDetailsLbl").show();var m=i.findField("categoryOpts");var R=i.findField("healthCenterTestScrollCombo");var t=i.findField("healthCenterCompContiner");t=Ext.getCmp("healthCenterCompContiner");
var h=i.findField("healthCenterCompTypeCombo");if(!Ext.isEmpty(m)){m.hide();}if(!Ext.isEmpty(R)){R.hide();}if(!Ext.isEmpty(t)){t.hide();}if(!Ext.isEmpty(h)){h.hide();}Ext.getCmp("oneMetricTxt").hide();i.findField("measureListCombo").hide();var X=i.findField("measurelist");X.suspendEvents(true);var U=X.getStore();
U.removeAll();U.insert(0,{displayField:notApplicable,valueField:"-1"});X.setValue("-1");X.resumeEvents();if(S.isVisible()){X.show();i.findField("metricsSearchTextBox").show();}}}if(tempSelectedGraph!=null&&tempSelectedGraph=="DDTable"){var M="";var q=Ext.getCmp("graphicalTypeId");if(!Ext.isEmpty(q)){M=q.getValue();
}if(Ext.getCmp("measureListCombo").isVisible()){var J=Ext.getCmp("summarizeDDColumnCombo");if(!Ext.isEmpty(J)){if(M!=null&&M!="Table"){J.show();}}Ext.getCmp("ddcolumnsLbl").show();Ext.getCmp("ddcolumnsMultiSelect").show();}}else{var J=Ext.getCmp("summarizeDDColumnCombo");if(!Ext.isEmpty(J)){J.hide();
}Ext.getCmp("ddcolumnsLbl").hide();Ext.getCmp("ddcolumnsMultiSelect").hide();}var f=L.confguredWidgetName;var z=L.configuredDataValue;var C=z["gridData"];if((tempSelectedGraph==f)&&(C!=null&&!Ext.isEmpty(C))){var e=Ext.getCmp("configTableGrid");e.suspendEvents(true);var u=e.getStore();u.removeAll();for(var B=1;
B<e.columns.length;B++){if(e.columns[B].text=="DD Columns"||e.columns[B].text=="Chart Type"){e.headerCt.remove(B);e.getView().refresh();break;}}for(var B=1;B<e.columns.length;B++){if(e.columns[B].text=="Component Type"){e.headerCt.remove(B);e.getView().refresh();break;}}for(var B=1;B<e.columns.length;
B++){if(e.columns[B].text=="Descriptor"){e.headerCt.remove(B);e.getView().refresh();break;}}var n=false;for(var g=1;g<d.columns.length;g++){if(d.columns[g].text=="Measure"){n=true;}}if(!n){var W=Ext.create("Ext.grid.column.Column",{text:screenLabelsObj["Measure"],dataIndex:"measure",cls:"x-form-item-label",flex:0.6,editor:{allowBlank:false},renderer:function(ad,k){k.tdAttr='data-qclass=yellowTip data-qtip="'+ad+'"';
return ad;}});d.headerCt.insert(2,W);}var aa=C;var F=f;if(aa!=null&&!Ext.isEmpty(aa)){if(F!=null&&F=="CombinationChart"){e.hideChartType=false;var O=Ext.create("Ext.grid.column.Column",{text:screenLabelsObj["Chart Type"],dataIndex:"chartType",field:{xtype:"scrollcombo",editable:true,forceSelection:true,selectOnTab:true,displayField:"displayField",valueField:"valueField",store:Ext.create("Ext.data.Store",{fields:["displayField","valueField"],data:[{"displayField":screenLabelsObj["line"],"valueField":"line"},{"displayField":screenLabelsObj["column"],"valueField":"column"},{"displayField":screenLabelsObj["Area"],"valueField":"Area"}]}),lazyRender:true}});
e.headerCt.insert(e.columns.length-1,O);e.getView().refresh();}if(F!=null&&F=="DDTable"){var O=Ext.create("Ext.grid.column.Column",{text:screenLabelsObj["DD Columns"],dataIndex:"ddval",renderer:function(ad,k){k.tdAttr='data-qclass=yellowTip data-qtip="'+ad+'"';return ad;}});e.headerCt.insert(e.columns.length-1,O);
e.getView().refresh();}if(F!=null&&F=="servicehealth"){var R=i.findField("healthCenterTestScrollCombo");R.hide();c=true;var A=false;var v=false;for(var g=1;g<d.columns.length;g++){if(d.columns[g].text=="Component Type"){A=true;}if(d.columns[g].text=="Descriptor"){v=true;}}if(!A){var Z=Ext.create("Ext.grid.column.Column",{text:"Component Type",dataIndex:"componentType",flex:0.4,hidden:false,renderer:function(ad,k){k.tdAttr='data-qclass=yellowTip data-qtip="'+ad+'"';
return ad;}});d.headerCt.insert(1,Z);}for(var g=1;g<d.columns.length;g++){if(d.columns[g].text=="Measure"){d.headerCt.remove(g);d.getView().refresh();break;}}if(!v){var W=Ext.create("Ext.grid.column.Column",{text:"Descriptor",dataIndex:"Descriptor",flex:0.4,hidden:false,renderer:function(ad,k){k.tdAttr='data-qclass=yellowTip data-qtip="'+ad+'"';
return ad;}});d.headerCt.insert(3,W);}d.getView().refresh();}u.add(aa);e.show();e.resumeEvents();e.doComponentLayout();}else{for(var B=1;B<e.columns.length;B++){if(e.columns[B].text=="DD Columns"||e.columns[B].text=="Chart Type"){e.headerCt.remove(B);e.getView().refresh();break;}}for(var B=1;B<e.columns.length;
B++){if(e.columns[B].text=="Component Type"){e.headerCt.remove(B);e.getView().refresh();break;}}for(var B=1;B<e.columns.length;B++){if(e.columns[B].text=="Descriptor"){e.headerCt.remove(B);e.getView().refresh();break;}}Ext.getCmp("configTableGrid").show();}}else{if(tempSelectedGraph==f){if(tempSelectedGraph=="DDTable"){Ext.getCmp("configTableGrid").hide();
s=true;var a="";var q=Ext.getCmp("graphicalTypeId");if(!Ext.isEmpty(q)&&z.hasOwnProperty("chartDataCombo")&&z.hasOwnProperty("selectedChartType")){a=z["selectedChartType"];q.suspendEvents(true);q.getStore().removeAll();q.getStore().loadRawData(z["chartDataCombo"]);q.setValue(z["selectedChartType"]);q.resumeEvents();
q.show();}T.isModification=true;}else{var J=Ext.getCmp("summarizeDDColumnCombo");if(!Ext.isEmpty(J)){J.hide();}var q=Ext.getCmp("graphicalTypeId");if(!Ext.isEmpty(q)){q.hide();}Ext.getCmp("configTableGrid").hide();c=true;var m=i.findField("categoryOpts");var w="-1";if(z.hasOwnProperty("categoryCombo")&&z.hasOwnProperty("selectedCategory")){m.suspendEvents(true);
m.getStore().removeAll();m.getStore().loadRawData(z["categoryCombo"]);m.setValue(z["selectedCategory"]);m.resumeEvents();w=z["selectedCategory"];}else{if(z.hasOwnProperty("categoryCombo")){m.suspendEvents(true);m.getStore().removeAll();m.getStore().loadRawData(z["categoryCombo"]);m.setValue("-1");m.resumeEvents();
}}var R=i.findField("healthCenterTestScrollCombo");R.hide();var t=Ext.getCmp("healthCenterCompContiner");var l=Ext.getCmp("healthCenterComponentCombo");var h=Ext.getCmp("healthCenterCompTypeCombo");if(w!=null&&(w=="Zone"||w=="Segment"||w=="Service")){t.show();h.hide();if(!Ext.isEmpty(l)){if(z.hasOwnProperty("availableOptions")&&z.hasOwnProperty("selectedFields")){var V=z["availableOptions"];
if(V.hasOwnProperty("optionsForType")){l.suspendEvents(true);l.getStore().removeAll();l.getStore().loadRawData(V["optionsForType"]);l.setValue(z["selectedFields"]);l.resumeEvents();}}}}else{if(w!=null&&w=="Components"){t.hide();h.show();if(!Ext.isEmpty(h)){if(z.hasOwnProperty("availableOptions")&&z.hasOwnProperty("selectedFields")){var V=z["availableOptions"];
if(V.hasOwnProperty("availCompTypes")){h.suspendEvents(true);h.getStore().removeAll();h.getStore().loadRawData(V["availCompTypes"]);if(w!="Descriptors"){h.getStore().insert(1,{displayField:"All types",valueField:"allServers"});}h.setValue(z["selectedFields"]);h.resumeEvents();h.show();}}}}else{if(w!=null&&w=="vms|desktop|users"){Ext.getCmp("selectionDetailsLbl").hide();
if(!Ext.isEmpty(R)){R.hide();}if(!Ext.isEmpty(t)){t.show();}if(z.hasOwnProperty("availableOptions")&&z.hasOwnProperty("selectedFields")){var V=z["availableOptions"];if(V.hasOwnProperty("availCompTypes")){if(!Ext.isEmpty(h)){h.suspendEvents(true);h.getStore().removeAll();h.getStore().loadRawData(V["availCompTypes"]);
var I=false;for(var Q=0;Q<V["availCompTypes"].length;Q++){var o=V["availCompTypes"][Q];var D=o.valueField;if(D==z["selectedFields"]){I=true;break;}}if(z["selectedFields"]!=null&&z["selectedFields"]=="allServers"){I=true;}if(I){h.setValue(z["selectedFields"]);}else{h.setValue("-1");}h.resumeEvents();h.show();
}}}if(z.hasOwnProperty("availableOptions")&&z.hasOwnProperty("selectedFields")){if(!Ext.isEmpty(l)){if(z.hasOwnProperty("availableVmOptions")&&z.hasOwnProperty("selectedvms")){var V=z["availableVmOptions"];if(V.hasOwnProperty("descriptorsList")){l.suspendEvents(true);l.getStore().removeAll();l.getStore().loadRawData(V["descriptorsList"]);
l.getStore().insert(0,{displayField:allVms,valueField:"allVms"});l.setValue(z["selectedvms"]);l.resumeEvents();}}}}}}}}}else{var q=Ext.getCmp("graphicalTypeId");if(!Ext.isEmpty(q)){q.hide();}var u=Ext.getCmp("configTableGrid").getStore();u.removeAll();if(tempSelectedGraph!=null&&(tempSelectedGraph=="servicehealth"||tempSelectedGraph=="DDTable")){Ext.getCmp("configTableGrid").hide();
}else{Ext.getCmp("configTableGrid").show();}if(tempSelectedGraph=="CombinationChart"){var j=false;for(var B=1;B<d.columns.length;B++){if(d.columns[B].text=="Chart Type"){j=true;break;}}if(!j){for(var g=1;g<d.columns.length;g++){if(d.columns[g].text=="DD Columns"){d.headerCt.remove(g);d.getView().refresh();
break;}}var O=Ext.create("Ext.grid.column.Column",{text:screenLabelsObj["Chart Type"],dataIndex:"chartType",field:{xtype:"scrollcombo",editable:true,forceSelection:true,selectOnTab:true,displayField:"displayField",valueField:"valueField",store:Ext.create("Ext.data.Store",{fields:["displayField","valueField"],data:[{"displayField":screenLabelsObj["line"],"valueField":"line"},{"displayField":screenLabelsObj["column"],"valueField":"column"},{"displayField":screenLabelsObj["Area"],"valueField":"Area"}]}),lazyRender:true}});
d.headerCt.insert(3,O);d.getView().refresh();}}else{for(var B=1;B<d.columns.length;B++){if(d.columns[B].text=="Chart Type"){d.headerCt.remove(B);d.getView().refresh();break;}}}if(tempSelectedGraph=="DDTable"){var b=false;for(var g=1;g<d.columns.length;g++){if(d.columns[g].text=="DD Columns"){b=true;break;
}}if(!b){for(var B=1;B<d.columns.length;B++){if(d.columns[B].text=="Chart Type"){d.headerCt.remove(B);d.getView().refresh();break;}}var O=Ext.create("Ext.grid.column.Column",{text:screenLabelsObj["DD Columns"],dataIndex:"ddval",renderer:function(ad,k){k.tdAttr='data-qclass=yellowTip data-qtip="'+ad+'"';
return ad;}});d.headerCt.insert(3,O);d.getView().refresh();}}else{for(var g=1;g<d.columns.length;g++){if(d.columns[g].text=="DD Columns"){d.headerCt.remove(g);d.getView().refresh();break;}}}if(tempSelectedGraph=="servicehealth"){var A=false;var v=false;for(var g=1;g<d.columns.length;g++){if(d.columns[g].text=="Component Type"){A=true;
}if(d.columns[g].text=="Descriptor"){v=true;}}if(!A){var Z=Ext.create("Ext.grid.column.Column",{text:"Component Type",dataIndex:"componentType",flex:0.4,hidden:false,renderer:function(ad,k){k.tdAttr='data-qclass=yellowTip data-qtip="'+ad+'"';return ad;}});d.headerCt.insert(1,Z);}for(var g=1;g<d.columns.length;
g++){if(d.columns[g].text=="Measure"){d.headerCt.remove(g);d.getView().refresh();break;}}if(!v){var W=Ext.create("Ext.grid.column.Column",{text:"Descriptor",dataIndex:"Descriptor",flex:0.4,hidden:false,renderer:function(ad,k){k.tdAttr='data-qclass=yellowTip data-qtip="'+ad+'"';return ad;}});d.headerCt.insert(3,W);
}d.getView().refresh();}else{for(var g=1;g<d.columns.length;g++){if(d.columns[g].text=="Component Type"){d.headerCt.remove(g);d.getView().refresh();}}for(var g=1;g<d.columns.length;g++){if(d.columns[g].text=="Descriptor"){d.headerCt.remove(g);d.getView().refresh();}}var n=false;for(var g=1;g<d.columns.length;
g++){if(d.columns[g].text=="Measure"){n=true;}}if(!n){var W=Ext.create("Ext.grid.column.Column",{text:screenLabelsObj["Measure"],dataIndex:"measure",cls:"x-form-item-label",flex:0.6,editor:{allowBlank:false},renderer:function(ad,k){k.tdAttr='data-qclass=yellowTip data-qtip="'+ad+'"';return ad;}});d.headerCt.insert(2,W);
}d.getView().refresh();}}}var ac=r;if(!Ext.isEmpty(ac)){ac=p.filterEncode(ac);}var P="action=getAdvanceControls&comesFrom=templateBuilder&selectedGraph="+encodeURIComponent(x)+"&blockId="+encodeURIComponent(G)+"&profileName="+encodeURIComponent(ac)+"&from=graphSelect";if(K!=null&&K!=""){K=p.filterEncode(K);
P=P+"&internalId="+encodeURIComponent(K);}Ext.Ajax.request({url:"/final/servlet/com.eg.EgTemplateBuilderController",method:"POST",params:P+"&screenWidth="+(Ext.getBody().getViewSize().width)+"&screenHeight="+(Ext.getBody().getViewSize().height),scope:this,async:true,success:function(ad){var ag=ad.responseText;
if(ag!=null&&ag!=""){var aF=Ext.decode(ag);if(!Ext.isEmpty(aN)){var au=aN.isModification;aN.suspendEvents(true);aN.getStore().removeAll();aN.getStore().loadRawData(aF["tests"]);if(!au){aN.setValue("-1");}aN.isModification=false;aN.resumeEvents();}if(tempSelectedGraph!=null&&tempSelectedGraph=="servicehealth"&&!c){var ah=i.findField("categoryOpts");
ah.suspendEvents(true);ah.getStore().removeAll();ah.getStore().loadRawData(aF["categoryCombo"]);ah.setValue("-1");ah.resumeEvents();var aI=ah.getValue();var ao=Ext.getCmp("healthCenterCompContiner");R.hide();}if(tempSelectedGraph=="DDTable"){if(z.hasOwnProperty("selectedTest")&&z.hasOwnProperty("selectedMeasure")&&z.hasOwnProperty("selectedDDColumns")){var aN=i.findField("testCombo");
aN.isModification=true;aN.setValue(z["selectedTest"]);var aj=z["selectedTest"];var aq=z["selectedMeasure"];var az=z["selectedDDColumns"];var aJ=z["summarizedDDColumn"];tempBuilderApp.getController("Main").onManualTestComboChange(a,aN,aj,aq,az,aJ);}}if(tempSelectedGraph!=null&&tempSelectedGraph=="DDTable"&&!s){var am=Ext.getCmp("graphicalTypeId");
if(!Ext.isEmpty(am)){am.suspendEvents(true);am.getStore().removeAll();am.getStore().loadRawData(aF["chartDataCombo"]);am.setValue("Table");am.resumeEvents();am.show();}}if(!c&&tempSelectedGraph!="DDTable"){Ext.getCmp("configTableGrid").show();}Ext.getCmp("advancedOptionWidgetSlider").removeAll();if((tempSelectedGraph==f)){var at=z;
var aD=at["AggregateOptions"];var ap=aD["AggrConfiguration"];var ar=ap["ShowAggOptions"];var aH=at["advanceControlArr"];var an=at["excludeIncludeOptions"];var aA=false;if(F!=null&&aH!=null&&(F=="PieChart"||F=="activityChart")){for(var aK=0;aK<aH.length;aK++){var al=aH[aK];if(al.id!=null&&al.id=="ChartDistribution"){if(al.selectedValue!=null&&al.selectedValue=="Multiple"){aA=true;
}}}}if(ar!=null&&ar=="yes"){Ext.getCmp("advancedOptionWidgetSlider").add(defaultAggr);}var ay="no";var aC=aD["descactionComboOptions"];if(aC!=null&&!Ext.isEmpty(aC)){}if(ar!=null&&ar=="yes"){var aE=aD["AggrComboOptions"];if(aE!=null){Ext.getCmp("AggrfnCombo").getStore().loadRawData(aE);}}if(ap!=null&&!Ext.isEmpty(ap)){if(ar!=null&&ar=="yes"){ay=ap["isAaggregationEnabled"];
var ae="";if(ay!=null&&ay.indexOf("|")>0){ae=ay.substring(ay.indexOf("|")+1);ay=ay.substring(0,ay.indexOf("|"));}if(ay=="Yes"){var aO=Ext.getCmp("showAggOpt");aO.suspendEvents(false);aO.setValue({showAgg:"yes"});Ext.getCmp("AggrfnCombo").show();Ext.getCmp("AggrfnCombo").setValue(ae);}else{var aO=Ext.getCmp("showAggOpt");
aO.suspendEvents(false);aO.setValue({showAgg:"no"});}}var ax=ap["actiononDescriptor"];if(ax!=null&&ax.indexOf("|")>0){var aM=ax.substring(ax.indexOf("|")+1);var aw=ax.substring(0,ax.indexOf("|"));if(aM!=null){while(aM.indexOf("$!")>0){aM=aM.replace("$!",",");}}}else{}}else{if(ar!=null&&ar=="yes"){var aO=Ext.getCmp("showAggOpt");
aO.suspendEvents(false);aO.setValue({showAgg:"no"});Ext.getCmp("AggrfnCombo").setValue("avg");}}if(aA){Ext.getCmp("showAggOpt").hide();Ext.getCmp("AggrfnCombo").hide();}if(aH!=null&&!Ext.isEmpty(aH)){Ext.getCmp("advancedOptionWidgetSlider").add(this.createFilters(aH));if(aA){var ai=Ext.getCmp("Legend Display");
if(!Ext.isEmpty(ai)){ai.hide();}}Ext.getCmp("advancedOptionWidgetSlider").doLayout();}if(tempSelectedGraph!=null&&tempSelectedGraph!="servicehealth"){var af=tempBuilderApp.getController("Main").createExcludeIncludeSettingsLayout();Ext.getCmp("advancedOptionWidgetSlider").add(af);Ext.getCmp("advancedOptionWidgetSlider").add(tempBuilderApp.getController("Main").loadExcludeIncludeDefaultData(an,tempSelectedGraph,L.showDescriptorTextBox));
}if(tempSelectedGraph!=null&&tempSelectedGraph=="DDTable"){var ak=Ext.getCmp("Timeline");if(!Ext.isEmpty(ak)){ak.hide();}}Ext.getCmp("advancedOptionWidgetSlider").doLayout();}else{var ap=aF["AggregateOptions"]["AggrConfiguration"];var ar=ap["ShowAggOptions"];if(ar!=null&&ar=="yes"){if(tempSelectedGraph=="BarChart"||tempSelectedGraph=="TabularView"||tempSelectedGraph=="PieChart"||tempSelectedGraph=="activityChart"){Ext.getCmp("advancedOptionWidgetSlider").add(defaultAggr);
}}var ay="no";var aC=aF["AggregateOptions"]["descactionComboOptions"];if(aC!=null&&!Ext.isEmpty(aC)){}if(ar!=null&&ar=="yes"){if(tempSelectedGraph=="BarChart"||tempSelectedGraph=="TabularView"||tempSelectedGraph=="PieChart"||tempSelectedGraph=="activityChart"){var aE=aF["AggregateOptions"]["AggrComboOptions"];
if(aE!=null){Ext.getCmp("AggrfnCombo").getStore().loadRawData(aE);}}}if(ar!=null&&ar=="yes"){if(tempSelectedGraph=="BarChart"||tempSelectedGraph=="TabularView"||tempSelectedGraph=="PieChart"||tempSelectedGraph=="activityChart"){var aO=Ext.getCmp("showAggOpt");aO.suspendEvents(false);aO.setValue({showAgg:"no"});
Ext.getCmp("AggrfnCombo").setValue("avg");}}var av=aF["AdvancedControlsArr"]["advanceControls"];if(av!=null&&!Ext.isEmpty(av)){Ext.getCmp("advancedOptionWidgetSlider").add(this.createFilters(av));Ext.getCmp("advancedOptionWidgetSlider").doLayout();}if(tempSelectedGraph!=null&&tempSelectedGraph!="servicehealth"){var an=aF["ExcludeAndIncludeOptions"];
var af=tempBuilderApp.getController("Main").createExcludeIncludeSettingsLayout();Ext.getCmp("advancedOptionWidgetSlider").add(af);Ext.getCmp("advancedOptionWidgetSlider").add(tempBuilderApp.getController("Main").loadExcludeIncludeDefaultData(an,tempSelectedGraph,L.showDescriptorTextBox));}if(tempSelectedGraph!=null&&tempSelectedGraph=="DDTable"){var am=Ext.getCmp("graphicalTypeId");
if(!Ext.isEmpty(am)){var aG=am.getValue();if(aG!=null&&aG=="Bar Chart"){var aL=Ext.getCmp("ViewType");if(!Ext.isEmpty(aL)){aL.show();}}else{var aL=Ext.getCmp("ViewType");if(!Ext.isEmpty(aL)){aL.hide();}}if(aG!=null&&aG=="Bar Chart"){var ak=Ext.getCmp("Timeline");if(!Ext.isEmpty(ak)){ak.hide();}var aB=Ext.getCmp("showChartSummary");
if(!Ext.isEmpty(aB)){aB.hide();}}else{var ak=Ext.getCmp("Timeline");if(!Ext.isEmpty(ak)){ak.show();}var aB=Ext.getCmp("showChartSummary");if(!Ext.isEmpty(aB)){aB.show();}}}}Ext.getCmp("advancedOptionWidgetSlider").doLayout();}var ah=i.findField("categoryOpts");aF=null;delete aF;}ag=null;delete jsonTextForgrapht;
},failure:function(k,ad){console.log("EXCEPTION IN LOADING Advanced Controls");}});}},createFilters:function(d){var b=new Array();for(var a=0;a<d.length;a++){var c=d[a];var e=this.createFilterItem(c);if(!Ext.isEmpty(e)){b.push(e);}}return b;},createFilterItem:function(a){var b=null;switch(a.type){case"combo":b=this.createCombo(a);
break;case"Checkbox":b=this.createCheckBoxfield(a);break;case"Radio":b=this.createRadioButtonfield(a);break;case"ColorCombo":b=this.createColorCombo(a);break;case"Switch":b=this.createSwitchfield(a);break;case"ImageIcon":b=this.createImageIconfield(a);break;}return b;},createImageIconfield:function(e){var c="";
var d="";var b=false;if((e.showIconStatus!=null&&e.showIconStatus=="no")){b=true;}if(e.enableImg!=null&&e.enableImg=="false"){b=true;}if(e.selectedImg!=null){c=e.selectedImg;}if(c!=null&&c!=""){if(c.indexOf(":")>0&&c.startsWith("Default")){c=c.substring(c.indexOf(":")+1);if(c.indexOf("_")>-1){c=c.substring(0,c.lastIndexOf("_")+1)+"32";
}d='<div id="customUserDefinedImgDefault" class="userDefinedImgDefault" style="padding:4px"><div id="digitalChartImgIcon"  class= "'+c+'" width="32px" height="32px" border="0px"/><div class="settingOver"></div></div>';}else{c="/final/images/icon-library/"+loginUser+"/"+c;d='<div id="customUserDefinedImgDefault" class="userDefinedImgDefault" style="padding:4px"><img id="digitalChartImgIcon"  src="'+c+'" width="100%" height="100%" border="0px"/><div class="settingOver"></div></div>';
}}else{c="/final/images/"+strSkin+"/listViewWidgetDefaultSmall.png";d='<div id="customUserDefinedImgDefault" class="userDefinedImgDefault" style="padding:4px"><img id="digitalChartImgIcon"  src= "'+c+'" width="32px" height="32px" border="0px"/><div id="settingOver" class="settingOver"></div></div>';}var a={xtype:"container",id:e.id,name:e.id,margin:"0 10 5 10",width:42,height:42,disabled:b,html:d,listeners:{afterrender:function(f){this.setImageTriggerEvents(f);
}},setImageTriggerEvents:function(f){Ext.get(f.el).select(".userDefinedImgDefault").on("mouseenter",function(){Ext.get(f.el).select(".settingOver").update('<div class="userDefinedImgDefaultOver" style="display:block;padding:5px;"><table border="0px" cellpadding="0px" cellspacing="0px" width="100%" height="100%"><tr><td align="center" valign="middle"><a href="javascript:void(0)" id="customChangeImg"><span style="width:20px;height:20px;display:inline-block" class="iconOneClickImgDefaultChange"></span><br/></a></td></tr></table></div>');
Ext.get(f.el).select("#customChangeImg").on("click",function(){var g=Ext.create("TemplateBuilder.view.IconLibrary",{from:"digitialChartWidget",windowId:"windowId",custUploadPath:"manager/tomcat/webapps/final/images/icon-library/"+loginUser+"/",profileName:""}).show();g.on("close",function(){g.destroy();
g="closed";});},Ext.get("customChangeImg"));});Ext.get(f.el).select(".settingOver").on("mouseleave",function(){Ext.get(f.el).select(".settingOver").update("");});}};return a;},createSwitchfield:function(a){var b=false;var f="10 0 0 10";var j=400;var h=false;var k=false;if(a.label!=null&&a.label=="ChartSummaryEnabled"){a.label=screenLabelsObj["Enable History View"];
}if(a.label!=null&&a.label=="UseStateColorForFonts"){a.label=screenLabelsObj["Apply State Color For Font"];}if(a.label!=null&&a.label=="UseStateColorForBackground"){a.label=screenLabelsObj["Apply State Color For Background"];Ext.defer(function(){var m=Ext.getCmp("widgetType");if(!Ext.isEmpty(m)){var n=m.getValue();
if(!Ext.isEmpty(n)&&n=="tableview"){var l=Ext.getCmp("UseStateColorForBackground");if(!Ext.isEmpty(l)){l.hide();}}}},1000);}if(a.label!=null&&(a.label=="ShowGaugeCircle"||a.label=="Enable Full Dial")){a.label=screenLabelsObj["Enable Full Dial"];if(!isHighchartForGauge){b=true;}}if(a.label!=null&&(a.label=="UseStateColorForGauge"||a.label=="Apply State Color For Gauge")){a.label=screenLabelsObj["Apply State Color For Gauge"];
if(!isHighchartForGauge){b=true;}}if(a.label!=null&&a.label=="ShowIcon"){a.label=screenLabelsObj["Show Icon"];if(a.HistoricalSelValue!=null&&a.HistoricalSelValue=="false"){k=true;}}if(a.label!=null&&(a.label=="EnableMeasureStateColor"||a.label=="Apply State Color")){a.label=screenLabelsObj["Apply State Color"];
j=220;f="10 0 5 10";if(!Ext.isEmpty(Ext.getCmp("showAggOpt"))){var d=Ext.getCmp("showAggOpt").getChecked();if(d!=null&&!Ext.isEmpty(d)){var i=d[0].inputValue;if(i!=null&&i=="yes"){b=true;}}}}var e=152;var g=400;if(a.label!=null&&a.label=="SortByPriority"){a.label=screenLabelsObj["showTopNLbl"];e=70;g=140;
}if(a.selectedValue!=null&&a.selectedValue=="yes"){h=true;}var c={xtype:"switchfield",disabled:k,name:a.id,id:a.id,fieldLabel:a.label,inputValue:"Yes",uncheckedValue:"No",margin:"5 10 10 10",width:g,labelWidth:e,vertical:false,checked:h,hidden:b,listeners:{"change":function(m){if(m.id=="SortByPriority"){if(m.getValue()==true){var l=Ext.getCmp("Priority");
l.show();}else{var l=Ext.getCmp("Priority");l.hide();}}}}};return c;},createRadioButtonfield:function(c){var j=this;var k=c.filOptions;var a=k.split(",");var b=new Array();var e=false;if(!Ext.isEmpty(c.id)&&(c.id=="Stacked"&&c.selectedValue=="Yes")){if(!Ext.isEmpty(Ext.getCmp("showAggOpt"))){Ext.getCmp("showAggOpt").hide();
}if(!Ext.isEmpty(Ext.getCmp("AggrfnCombo"))){Ext.getCmp("AggrfnCombo").show();}}for(var f=0;f<a.length;f++){var d=false;if(!e&&c.selectedValue!=null&&c.selectedValue==a[f]){d=true;}if(!e&&c.selectedValue=="default"&&f==0){d=true;}var h={boxLabel:a[f],cls:"radiobt",name:c.id+"rb",inputValue:a[f],checked:d};
b.push(h);}if(c.label!=null&&c.label=="showDistprcnt"){c.label=screenLabelsObj["Show Distribution As Pct(%)"];}else{if(c.label!=null&&c.label=="ShowValues"){c.label=screenLabelsObj["Show Values"];}else{if(c.label!=null&&c.label=="WeightedAverage"){c.label=screenLabelsObj["Weighted Average"];}else{if(c.label!=null&&c.label=="ViewType"){c.label=screenLabelsObj["View Type"];
}}}}var g={xtype:"radiogroup",columns:3,vertical:true,name:c.id,id:c.id,fieldLabel:c.label,width:320,labelAlign:"top",labelSeparator:"",margin:"0 10 10 10",defaults:{margin:"0 5 0 0",columnWidth:100,},items:b,listeners:{change:function(i,l,m){j.onChangeViewType(i);}}};return g;},createColorCombo:function(c){if(c.selectedValue!=null&&c.selectedValue=="default"){c.selectedValue=c.filOptions[0].valueField;
}if(c.label!=null&&c.label=="ColorPalette"){c.label=screenLabelsObj["Color Picker"];}var a=Ext.create("Ext.data.Store",{fields:["displayColor","displayField","valueField"],proxy:{type:"memory",reader:{type:"json",root:"filOptions"}},data:c});var b={xtype:"combo",editable:false,width:210,store:a,cls:"dropdown colorPalette",displayField:"displayField",valueField:"valueField",displayColor:"displayColor",trigerAction:"all",labelAlign:"top",labelSeparator:"",margin:"0 10 10 10",typeAhead:false,fieldLabel:c.label,queryMode:"local",id:"colorPlt",name:"colorPlt",listeners:{afterrender:function(){this.setValue(c.selectedValue);
}},displayTpl:Ext.create("Ext.XTemplate",['<tpl for=".">',"<div>",'<tpl for="displayColor">','<tpl for="colorCode">','<span style="padding:4px 4px;background:{value};margin:3px 1px 0px 0px;border:1px solid #2c2c2c;"></span>',"</tpl>","</tpl>",'<span style="margin-left:10px;padding:0px">{displayField}</span>','<input type="text" id="palleteID" style="display:none" value={valueField} />',"</div>","</tpl>"]),listConfig:{itemTpl:new Ext.XTemplate('<tpl for=".">','<tpl for="displayColor">','<tpl for="colorCode">','<span style="padding:4px 4px;background:{value};margin:3px 1px 0px 0px;float:left;border:1px solid #2c2c2c"></span>',"</tpl>","</tpl>",'<span style="margin-left:10px;padding:0px">{displayField}</span>',"</tpl>")},fieldSubTpl:['<div class="{hiddenDataCls}" role="presentation"></div>','<ul><li id="{id}" type="{type}" ','<tpl if="size">size="{size}" </tpl>','<tpl if="tabIdx">tabIndex="{tabIdx}" </tpl>','<div class="{fieldCls} {typeCls}" autocomplete="off"></div>','<div class="{clearCls}" role="presentation"></div>',"</li></ul>",{compiled:true,disableFormats:true}],setRawValue:function(e){var d=this;
e=Ext.value(e,"");d.rawValue=e;if(d.inputEl){d.inputEl.dom.innerHTML=e;}return e;}};return b;},createCheckBoxfield:function(d){if(m=="default"){var e="left";}else{e="top";}var m=d.filOptions;var h=d.selectedValue;h=h.split("$");var b=m.split(",");var c=new Array();for(var j=0;j<b.length;j++){var g=false;
if(h.indexOf(b[j])>-1){g=true;}var f=b[j];var a=b[j]+"Opt";if(b[j]=="default"){f="";a=d.label+"Opt";}var k={boxLabel:f,name:a,id:a,inputValue:"yes",checked:g,margin:"0 5 0 0",columnWidth:100,};c.push(k);}if(d.label!=null&&d.label=="showChartSummary"){d.label=screenLabelsObj["Show Summary"];}var l={xtype:"checkboxgroup",columns:3,vertical:true,labelAlign:"top",labelSeparator:"",margin:"0 10 10 10",name:d.id,id:d.id,width:320,fieldLabel:d.label,defaults:{allowBlank:false,labelAlign:top,labelSeparator:"",margin:"0 5 0 0",columnWidth:100,cls:"checkbt"},items:c};
return l;},createCombo:function(b){var e="10 10 10 10";var c=false;var a=100;if(b.selectedValue!=null&&b.selectedValue=="default"){b.selectedValue=b.filOptions[0].value;}var f=Ext.create("Ext.data.Store",{fields:["value","name"],proxy:{type:"memory",reader:{type:"json",root:"filOptions"}},data:b});if(b.label!=null&&b.label=="GraphicalType"){isTopNWidget=true;
topNVal=b.selectedValue;}var h=false;if(b.label!=null&&b.label=="SummaryGraphType"){a=150;b.label=screenLabelsObj["Chart Type"]+":";if(b.selHistoricalView!=null&&b.selHistoricalView=="false"){h=true;}else{h=false;}}else{if(b.label!=null&&b.label=="Aggregation_Function"){b.label=screenLabelsObj["Aggregation Function"];
a=150;}else{if(b.label!=null&&b.label=="widgetType"){b.label=screenLabelsObj["widgetTypeLbl"];}else{if(b.label!=null&&(b.label=="SetStateColorOn"||b.label=="Select an option")){b.label=screenLabelsObj["Select an option"];a=165;e="-15 10 10 10";if(b.ShowSetColorASValue!=null&&b.ShowSetColorASValue=="false"){c=true;
h=true;}else{c=false;h=false;}if(!Ext.isEmpty(Ext.getCmp("showAggOpt"))){var d=Ext.getCmp("showAggOpt").getChecked();if(d!=null&&!Ext.isEmpty(d)){var g=d[0].inputValue;if(g!=null&&g=="yes"){c=true;h=true;}}}}else{if(b.label!=null&&b.label=="Priority"){if(b!=null&&b.hasOwnProperty("sortByPriorityEnabled")){if(b.sortByPriorityEnabled!=null&&b.sortByPriorityEnabled=="yes"){c=false;
}else{c=true;}}}}}}}var i={xtype:"scrollcombo",editable:false,store:f,cls:"dropdown",displayField:"name",valueField:"value",trigerAction:"all",fieldLabel:b.label,value:b.selectedValue,itemId:b.id,labelAlign:"top",width:a,labelSeparator:"",margin:"0 10 10 10",queryMode:"local",id:b.id,name:b.id,disabled:h,hidden:c,editable:true,forceSelection:true};
return i;},uploadwidgetImage:function(d){var a=Ext.getCmp("FILE_1").getValue();var b=Ext.getCmp("hiddenFile_dstFile");var c=this;var a=Ext.getCmp("FILE_1").getValue();if(a!=null&&a!="undefined"){a=a.toLowerCase();}if(a.lastIndexOf(".png")==-1&&a.lastIndexOf(".jpg")==-1&&a.lastIndexOf(".gif")==-1){Ext.Msg.show({title:templatesAlertLbl,msg:invalidImageTypeAlert,buttons:Ext.Msg.OK,icon:Ext.Msg.WARNING});
Ext.getCmp("FILE_1").reset();Ext.getCmp("FILE_1").focus();return;}Ext.Msg.show({title:templatesAlertLbl,msg:uploadWidgetImageMsgAlert+"?",buttons:Ext.Msg.YESNO,icon:"iconConfirmation",fn:function(h){if(h=="yes"){var i=Ext.getCmp("FILE_1").getValue();var f=Ext.getCmp("fileUploadFormId").getForm();if(f.isValid()){if(i!=null&&i.lastIndexOf("/")>0&&i.lastIndexOf("clear.png")==-1){i=i.substring(i.lastIndexOf("/")+1);
}else{if(i!=null&&i.lastIndexOf("\\")>0&&i.lastIndexOf("clear.png")==-1){i=i.substring(i.lastIndexOf("\\")+1);}}var e=Ext.getCmp("FILE_1_dstFile");if(e!=null){e.setValue("manager/tomcat/webapps/final/images/icon-library/"+loginUser+"/"+i);}var g="/final/servlet/com.eg.EgFileUpload?&requestFrom=EgTemplateList.jsp&uploadFor=widgetImg&uploadDir=manager/tomcat/webapps/final/images/icon-library/"+loginUser+"/"+i+"&fileExt=jpg&fileUpload=yes";
Ext.getCmp("fileUploadFormId").submit({url:g,method:"POST",success:function(l,n){var j=Ext.getCmp("widgetWindowId");if(!Ext.isEmpty(j)){j.destroy();j=null;delete j;}var p=Ext.getCmp("iconLibWindow");if(!Ext.isEmpty(p)){p.destroy();p=null;delete p;}var j=Ext.getCmp("windowId");if(!Ext.isEmpty(j)){j.destroy();
j=null;delete j;}var m=n.response.responseText;if(i.indexOf(" ")>0){for(var k=0;k<i.length;k++){i=i.replace(" ","");}}var m=n.response.responseText;if(i.indexOf(" ")>0){for(var k=0;k<i.length;k++){i=i.replace(" ","");}}i="/final/images/icon-library/"+loginUser+"/"+i;if(d!=null&&d=="widgetUpload"){Ext.getCmp("userDefinedWidgetIcon").update('<div id="userDefinedImgDefault" class="userDefinedImgDefault" style="padding:5px"><img id="widgetImageIcon"  src= "'+i+'" width="100%" height="100%" border="0px"/><div id="settingOver" class="settingOver"></div></div>');
Ext.get("userDefinedImgDefault").on("mouseenter",function(){Ext.get("settingOver").update('<a href="javascript:void(0)" id="changeImg"><div class="userDefinedImgDefaultOver" style="display:block"></div></a>');Ext.get("changeImg").on("click",function(){var q=Ext.create("TemplateBuilder.view.IconLibrary",{from:"widgetUpload",windowId:"widgetWindowId",custUploadPath:"manager/tomcat/webapps/final/images/icon-library/"+loginUser+"/",}).show();
q.on("close",function(){q.destroy();q="closed";});},Ext.get("changeImg"));});Ext.get("settingOver").on("mouseleave",function(){Ext.get("settingOver").update("");});}else{var o=Ext.getCmp("imgIcon");Ext.getCmp("imgIcon").update('<div id="customUserDefinedImgDefault" class="userDefinedImgDefault" style="padding:4px"><img id="digitalChartImgIcon"  src= "'+i+'" width="100%" height="100%" border="0px"/><div id="customSettingOver" class="settingOver"></div></div>');
Ext.get("customUserDefinedImgDefault").on("mouseenter",function(){Ext.get("customSettingOver").update('<a href="javascript:void(0)" id="customUserDefinedImgDefault1"><div class="userDefinedImgDefaultOver" style="display:block"></div></a>');Ext.get("customUserDefinedImgDefault1").on("click",function(){var q=Ext.create("TemplateBuilder.view.IconLibrary",{from:"digitialChartWidget",windowId:"windowId",custUploadPath:"manager/tomcat/webapps/final/images/icon-library/"+loginUser+"/",}).show();
q.on("close",function(){q.destroy();q="closed";});},Ext.get("customUserDefinedImgDefault1"));});Ext.get("customSettingOver").on("mouseleave",function(){Ext.get("customSettingOver").update("");});}},failure:function(j,k){}});}}}});},uploadDefaultImage:function(e,h,a){var f=this;if(h!=null&&h=="widgetUpload"){e=Ext.getCmp("templateLayoutObj").profileName;
if(a!=null&&(a.endsWith(".png")||a.endsWith(".jpg")||a.endsWith(".gif"))){Ext.getCmp("userDefinedWidgetIcon").update('<div id="userDefinedImgDefault" class="userDefinedImgDefault" style="padding:5px"><img id="widgetImageIcon"  src= "'+a+'" width="100%" height="100%" border="0px"/><div id="settingOver" class="settingOver"></div></div>');
}else{if(a.indexOf("_")>-1){a=a.substring(0,a.lastIndexOf("_")+1)+"32";}Ext.getCmp("userDefinedWidgetIcon").update('<div id="userDefinedImgDefault" class="userDefinedImgDefault" style="padding:5px"><div id="widgetImageIcon"  class= "'+a+'"  style="width:32px;height:32px"  border="0px"/><div id="settingOver" class="settingOver"></div></div>');
}Ext.get("userDefinedImgDefault").on("mouseenter",function(){Ext.get("settingOver").update('<a href="javascript:void(0)" id="changeImg"><div class="userDefinedImgDefaultOver" style="display:block"></div></a>');Ext.get("changeImg").on("click",function(){var i=Ext.create("TemplateBuilder.view.IconLibrary",{from:"widgetUpload",windowId:"widgetWindowId",custUploadPath:"manager/tomcat/webapps/final/images/icon-library/"+loginUser+"/",}).show();
i.on("close",function(){i.destroy();i="closed";});},Ext.get("changeImg"));});Ext.get("settingOver").on("mouseleave",function(){Ext.get("settingOver").update("");});var c=Ext.getCmp("iconLibWindow");if(!Ext.isEmpty(c)){c.destroy();c=null;delete c;}}else{if(h!=null&&h=="templateUpload"){if(a!=null&&(a.endsWith(".png")||a.endsWith(".jpg")||a.endsWith(".gif"))){Ext.getCmp("imgcont").update('<div id="listViewImgDefault" class="listViewImgDefault"><img id="templateImageIcon"  src="'+a+'"  style="position:absolute;top:0%;left:0%;right:0%;margin:auto;bottom:0%;width:64px;height:64px" border="0px"/><div id="settingOver" class="settingOver"></div></div>');
}else{Ext.getCmp("imgcont").update('<div id="listViewImgDefault" class="listViewImgDefault"><div id="templateImageIcon"  Class= "'+a+'"   style="position: absolute;top:0%;left: 0%;right: 0%;margin: auto;bottom: 0%;"/></div><div id="settingOver" class="settingOver"></div></div>');}var c=Ext.getCmp("iconLibWindow");
if(!Ext.isEmpty(c)){c.destroy();c=null;delete c;}Ext.get("listViewImgDefault").on("mouseenter",function(){Ext.get("settingOver").update('<div class="listViewImgDefaultOver" style="display:block"><table border="0px" cellpadding="0px" cellspacing="0px" width="100%" height="100%"><tr><td align="center" valign="middle"><a href="javascript:void(0)" id="changeImg"><span style="width:20px;height:20px;display:block" class="iconOneClickImgDefaultChange"></span><span class="changeImageIconText">Change Image</span></a></td></tr></table></div>');
Ext.get("changeImg").on("click",function(){var i=Ext.getCmp("templateName").getValue();var j=Ext.create("TemplateBuilder.view.IconLibrary",{from:"templateUpload",windowId:"windowId",custUploadPath:"manager/tomcat/webapps/final/images/icon-library/"+loginUser+"/",profileName:i}).show();j.on("close",function(){j.destroy();
j="closed";});},Ext.get("changeImg"));});Ext.get("settingOver").on("mouseleave",function(){Ext.get("settingOver").update("");});}else{if(h!=null&&h=="digitialChartWidget"){if(Ext.getCmp("imgIcon")!=null){if(a!=null&&(a.endsWith(".png")||a.endsWith(".jpg")||a.endsWith(".gif"))){Ext.getCmp("imgIcon").update('<div id="customUserDefinedImgDefault" class="userDefinedImgDefault" style="padding:4px"><img id="digitalChartImgIcon"  src="'+a+'" width="100%" height="100%" border="0px"/><div id="customSettingOver" class="settingOver"></div></div>');
}else{var b=Ext.getCmp("imgIcon");b.iconClass=a;if(a.indexOf("_")>-1){a=a.substring(0,a.lastIndexOf("_")+1)+"32";}b.update('<div id="customUserDefinedImgDefault" class="userDefinedImgDefault" style="padding:4px"><div id="digitalChartImgIcon"  class= "'+a+'"   style="width:32px; height:32px" /><div id="customSettingOver" class="settingOver"></div></div>');
}}var c=Ext.getCmp("iconLibWindow");if(!Ext.isEmpty(c)){c.destroy();c=null;delete c;}if(Ext.get("customUserDefinedImgDefault")!=null){Ext.get("customUserDefinedImgDefault").on("mouseenter",function(){Ext.get("customSettingOver").update('<div class="userDefinedImgDefaultOver" style="display:block;padding:5px;"><table border="0px" cellpadding="0px" cellspacing="0px" width="100%" height="100%"><tr><td align="center" valign="middle"><a href="javascript:void(0)" id="customChangeImg"><span style="width:20px;height:20px;display:inline-block" class="iconOneClickImgDefaultChange"></span></a></td></tr></table></div>');
Ext.get("customChangeImg").on("click",function(){var i=Ext.create("TemplateBuilder.view.IconLibrary",{from:"digitialChartWidget",windowId:"windowId",custUploadPath:"manager/tomcat/webapps/final/images/icon-library/"+loginUser+"/",profileName:""}).show();i.on("close",function(){i.destroy();i="closed";
});},Ext.get("customChangeImg"));});Ext.get("customSettingOver").on("mouseleave",function(){Ext.get("customSettingOver").update("");});}}else{if(h!=null&&h=="templateList"){if(a!=null&&(a.endsWith(".png")||a.endsWith(".jpg")||a.endsWith(".gif"))){if(a!=null&&a.lastIndexOf("/")>0){a=a.substring(a.lastIndexOf("/")+1);
}else{if(a!=null&&a.lastIndexOf("\\")>0){a=a.substring(a.lastIndexOf("\\")+1);}}}var d=e;if(!Ext.isEmpty(d)){d=f.filterEncode(d);}var g="action=uploadDefaultImage&from="+encodeURIComponent(h)+"&profileName="+encodeURIComponent(d)+"&defaultClass="+encodeURIComponent(a);Ext.Ajax.request({url:"/final/servlet/com.eg.EgTemplateBuilderController",method:"POST",params:g+"&screenWidth="+(Ext.getBody().getViewSize().width)+"&screenHeight="+(Ext.getBody().getViewSize().height),scope:this,async:true,success:function(i){var m=i.responseText;
if(m!=null&&m!=""){var l=Ext.decode(m);if(l!=null&&l["updated"]=="true"){var j=Ext.getCmp("iconLibWindow");if(!Ext.isEmpty(j)){j.destroy();j=null;delete j;}var k=Ext.getCmp("templateBuilderListPageView");if(k!=null&&!Ext.isEmpty(k)){k.removeAll();k.setLoading(false);k.doLayout();}f.goToTemplateListPage();
}l=null;delete l;}m=null;delete m;},failure:function(i,j){console.log("EXCEPTION IN LOADING");}});}}}}},expandMe:function(c){var g="";var b="";var h=c.getId();if(h=="templateCompExpand"){g="templateInfraElementsCombo";b=compTypAlertMsg;}var a=Ext.getCmp(g);var f=Ext.clone(a.getStore());c.setDisabled(true);
var d=this;var e=Ext.create("Ext.window.Window",{title:$("#"+g+"Lbl").text(),cls:"expandWindowPopupShadow",height:350,header:{height:34,style:{"padding-bottom":"4px !important"},},padding:"0 10 5 10",width:260,frame:true,border:true,ghost:false,id:h+"View",closeAction:"destroy",buttonAlign:"center",btnObjId:h,comboBxId:g,items:[{xtype:"container",width:240,layout:{type:"vbox",align:"stretch",},margin:0,items:[{xype:"container",cls:"multisearchlist",style:{"top":"0px"},items:[{xtype:"customtrigger",width:225,id:"compSearch",emptyText:screenLabelsObj["Search"],listeners:{"change":function(m,l,i,j){if(!Ext.isEmpty(f)){if(l=="*"){f.clearFilter();
}else{if(l.lastIndexOf("*")==(l.length-1)){l=l.substr(0,(l.length-1));}f.clearFilter();if(l){var k=new RegExp(Ext.String.escapeRegex(l),"i");f.filter({filterFn:function(n){return k.test(n.get("displayField"));}});}m.focus();}}}}}]},{xtype:"multiselect",width:240,height:240,border:0,layout:"fit",autoScroll:true,scroll:true,labelAlign:"left",baseCls:"egmultiselect",multiSelect:true,id:g+"_Clone",name:g+"_Clone",store:f,value:a.getValue(),displayField:"displayField",valueField:"valueField",queryMode:"local",listConfig:{simpleSelect:true,id:g+"_maximize",name:g+"_maximize"}}]}],buttons:[{text:screenLabelsObj["SELECT"],id:"expand",margin:"0 0 10 0",padding:"0 4 0 4",cls:"quickMenuWhiteButton",name:"expand",handler:function(){var k=Ext.getCmp(this.up("window").comboBxId+"_Clone");
if(k.getValue()!=""){var l=Ext.getCmp(this.up("window").btnObjId);if(l!=null){l.setDisabled(false);}a.setValue(k.getValue());if(h=="templateCompExpand"){var j=Ext.getCmp("compSearch");if(!Ext.isEmpty(j)){var i=Ext.clone(a.getStore());if(i!=null){i.clearFilter();}}}e.destroy();}else{Ext.MessageBox.show({title:templatesAlertLbl,msg:b,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});
return;}}}],listeners:{"destroy":function(){var j=Ext.getCmp(this.btnObjId);if(j!=null){j.setDisabled(false);}if(h=="templateCompExpand"){var k=Ext.getCmp(g);if(!Ext.isEmpty(k)){var i=Ext.clone(k.getStore());if(i!=null){i.clearFilter();}}}}}}).show();this.getMain().doLayout();},addMeasuresToGrid:function(I){var L=this;
var M=this.getUserDefinedWidgetWindow();var k=M.getComponent("configForm").getForm();if(tempSelectedGraph!=null&&tempSelectedGraph=="servicehealth"){var s=k.findField("healthCenterCompTypeCombo").getValue();if(s!=null&&s=="-1"){Ext.Msg.show({title:templatesAlertLbl,msg:compTypAlertMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});
return;}var T=k.findField("healthCenterTestScrollCombo").getValue();if(Ext.isEmpty(T)||T==""||T=="-1"){Ext.Msg.show({title:templatesAlertLbl,msg:testAlertMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});return;}var y=k.findField("healthCenterComponentCombo").getValue();if((y!=null&&y=="")||(y=="-1")){Ext.Msg.show({title:templatesAlertLbl,msg:descriptorAlertMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});
return;}var n=k.findField("healthCenterTestScrollCombo").getValue();var x=k.findField("healthCenterTestScrollCombo").getRawValue();var D=k.findField("healthCenterComponentCombo").getValue();var b=k.findField("healthCenterCompTypeCombo").getRawValue();var f=this.getComparisontable();var w=f.getStore();
var z=[];var P=false;for(var R in D){var Z=D[R];var d=false;if(Z!=null&&Z=="allDescriptors"){d=true;P=true;}if(Z=="-1"||Z==""){Z="+";}var E="+";var u="+";if(Z!=null&&Z!="+"&&Z.indexOf("+")==0&&Z.length>1){E=Z.substring(1);}if(d){E="AllInfos";u=allDescriptors;}else{u=E;}if(P&&!d){Ext.Msg.show({title:templatesAlertLbl,msg:allDescriptorsAlertMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});
return;}var j=s+"|@|"+b+"|@|"+n+"|@|"+x+"|@|"+E;var S=w.find("hidVal",j,0,false,true,true);if(S==-1){z.push({componentType:b,test:x,Descriptor:u,measure:"",hidVal:j,chartType:"line",ddHidVal:"",ddval:""});}else{Ext.Msg.show({title:templatesAlertLbl,msg:"selection already exists",buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});
return;}}w.add(z);f.doLayout();}else{var aa="";if(tempSelectedGraph=="TopNGaugeChart"||tempSelectedGraph=="TopNDigitalChart"||tempSelectedGraph=="DDTable"||tempSelectedGraph=="TopN"){aa=k.findField("measureListCombo");}else{aa=k.findField("measurelist");}var X=k.findField("testCombo");var n=X.getValue();
var x=X.getRawValue();var a=aa.getValue();if(n!=null&&(n==""||n=="-1")){Ext.Msg.show({title:templatesAlertLbl,msg:testAlertMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});return;}else{if(a!=null&&(a==""||a=="-1")){Ext.Msg.show({title:templatesAlertLbl,msg:measureAlertMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});
return;}}var A=k.findField("ddcolumnsMultiSelect");var J=null;if(tempSelectedGraph=="DDTable"){J=A.getValue();if(J!=null&&(J==""||J=="-1")){Ext.Msg.show({title:templatesAlertLbl,msg:noDDColSelectedAlertMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});return;}}var O=aa.getStore();var f=this.getComparisontable();
var w=f.getStore();var i=w.getCount();var z=new Array();if(tempSelectedGraph=="TopNGaugeChart"||tempSelectedGraph=="TopNDigitalChart"||tempSelectedGraph=="DDTable"||tempSelectedGraph=="TopN"){if(i!=null&&i>0){w.removeAll();}var N=O.findRecord(aa.valueField,a,0,false,true,true);var r=O.indexOf(N);var V=O.getAt(r).get("displayField");
var j=n+":"+a;j=j+"!!!"+V;var Y=a;var l="";var H="";if(tempSelectedGraph=="DDTable"){for(var W in J){var v=J[W];var p=A.getStore();var e=p.findRecord(A.valueField,v,0,false,true,true);var r=p.indexOf(e);var c=p.getAt(r).get("displayField");H=H+","+c;l=l+","+v+":"+c;}if(l!=null&&l.indexOf(",")==0){l=l.substr(1);
}if(H!=null&&H.indexOf(",")==0){H=H.substr(1);}}var S=w.find("hidVal",j,0,false,true,true);if(S==-1){z.push({test:x,measure:V,hidVal:j,chartType:"line",ddHidVal:l,ddval:H});}else{Ext.Msg.show({title:templatesAlertLbl,msg:"selection already exists",buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});
return;}}else{if(tempSelectedGraph=="liveMeasuresBox"){if(i!=null&&i>0){if(X.previousTestSelection!=n){w.removeAll();}}}var C="";var B="";var Y="";if(tempSelectedGraph!=null){if(tempSelectedGraph=="CombinationChart"){for(var g in a){var o=a[g];var N=O.findRecord(aa.valueField,o,0,false,true,true);var r=O.indexOf(N);
var V=O.getAt(r).get("displayField");var j=n+":"+o;j=j+"!!!"+V;var K=w.find("hidVal",j,0,false,true,true);if(K>-1){Ext.Msg.show({title:templatesAlertLbl,msg:"selection already exists",buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});return;}if(K==-1){z.push({test:x,measure:V,hidVal:j,chartType:"line",ddHidVal:"",ddval:""});
}else{Ext.Msg.show({title:templatesAlertLbl,msg:"selection already exists",buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});return;}}}else{var m=false;var U=w.getRange();var G=w.findRecord("test",x,0,false,true,true);var h=w.indexOf(G);for(var g in a){var o=a[g];var N=O.findRecord(aa.valueField,o,0,false,true,true);
var r=O.indexOf(N);var V=O.getAt(r).get("displayField");Ext.each(U,function(ab){var ae=ab.data.test;var ad=ab.data.measure;if(ae==x){ad=ad.split(",");for(var ac=0;ac<ad.length;ac++){if(ad[ac]==V){m=true;break;}}}});Y=Y+"$!"+o;C=C+","+V;}if(m){Ext.Msg.show({title:templatesAlertLbl,msg:"selection already exists",buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});
return;}if(C!=null&&C.indexOf(",")==0){C=C.substring(1);}if(Y!=null&&Y.indexOf("$!")==0){Y=Y.substring(2);}B=n+":"+Y;var t=C;while(t.indexOf(",")>0){t=t.replace(",","^^");}B=B+"!!!"+t;var q=w.find("hidVal",B,0,false,true,true);if(q>-1){Ext.Msg.show({title:templatesAlertLbl,msg:"selection already exists",buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});
return;}var S=w.find("hidVal",B,0,false,true,true);if(S==-1){if(h>-1){var F=w.getAt(h).get("measure");var Q=w.getAt(h).get("hidVal");t=Q.substring(Q.indexOf("!!!")+3)+"^^"+t;Q=Q.substring(0,Q.indexOf("!!!"));G.set("measure",F+","+C);G.set("hidVal",Q+"$!"+Y+"!!!"+t);G.commit();}else{z.push({test:x,measure:C,hidVal:B,chartType:"line",ddHidVal:"",ddval:""});
}}else{Ext.Msg.show({title:templatesAlertLbl,msg:"selection already exists",buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});return;}}}}w.add(z);f.doLayout();X.previousTestSelection=n;}},setValueWithOptionInList:function(g,e,d,f){var c=g.getStore();c.removeAll();g.suspendEvents(false);c.loadRawData(e);
if(f!=null&&f!=""){c.insert(0,{displayField:f,valueField:"-1"});g.setValue(d);}else{var a=false;for(var b=0;b<e.length;b++){if(e[b].valueField==d&&d!=""&&d!=null){g.setValue(d);a=true;}}if(!a){g.setValue(e[0].valueField);}}g.resumeEvents();},setValueWithMultiSelectOptionInList:function(f,d,c,e,a){var b=f.getStore();
b.removeAll();f.suspendLayout=true;f.suspendEvents(false);b.loadRawData(d);if(e!=null&&e!=""){if((c!=null&&c=="allDescriptors")||(a!=null&&a=="allDescriptors")){b.insert(0,{displayField:e,valueField:"allDescriptors"});}else{if(c!=null&&c=="allServers"){b.insert(0,{displayField:e,valueField:"allServers"});
}else{if((c!=null&&c=="allVms")||(a!=null&&a=="allVms")){b.insert(0,{displayField:e,valueField:"allVms"});}else{b.insert(0,{displayField:e,valueField:"-1"});}}}}f.setValue(c);f.resumeEvents();f.suspendLayout=false;f.doLayout();},getOptionsForType:function(){var d=this.getCreateTemplate();if(Ext.isEmpty(d)){d=Ext.widget("createTemplate");
}var b=Ext.getCmp("infraTypeCombo").getValue();var c=null;if(b!=null){if(b=="components"){c="C=true&&calljson=true&F=getServerTypesJSONForTemplate";}else{c="C=true&P0={"+b+"}&P1=None&calljson=true&F=getOptionsForTypeJSON";}}var a=this;Ext.Ajax.request({url:"/final/servlet/com.eg.EgMonRemoteScriptingServlet",method:"POST",params:c+"&screenWidth="+(Ext.getBody().getViewSize().width)+"&screenHeight="+(Ext.getBody().getViewSize().height),scope:this,async:true,success:function(e){var h=e.responseText;
if(h!=null&&h!=""){var g=Ext.decode(h);var f=Ext.getCmp("templateInfraElementsCombo");a.setValueWithMultiSelectOptionInList(f,g["optionsForType"],"","","");g=null;delete g;}h=null;delete h;},failure:function(e,f){console.log("EXCEPTION IN LOADING");}});},saveTemplate:function(o){var K=this;var C=this.getCreateTemplate();
if(Ext.isEmpty(C)){C=Ext.widget("createTemplate");}var k="";var e="";if(C.templateAction=="Modify"){e=C.profileName;}k=Ext.getCmp("templateName").getValue();var A=$("#templateImageIcon");var p=A[0].src;var U=null;if(p!=null&&p.lastIndexOf("/")>0&&p.lastIndexOf("clear.png")==-1){U=p.substring(0,p.lastIndexOf("/"));
p=p.substring(p.lastIndexOf("/")+1);}else{if(p!=null&&p.lastIndexOf("\\")>0&&p.lastIndexOf("clear.png")==-1){U=p.substring(0,p.lastIndexOf("\\"));p=p.substring(p.lastIndexOf("\\")+1);}else{p=A[0].className;}}o.setDisabled(true);k.trim();if(this.checkBlankSpc(k)){Ext.Msg.show({title:templatesAlertLbl,msg:templateBlankNameAlertMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});
o.setDisabled(false);return;}if(this.checkSpace(k)){Ext.Msg.show({title:templatesAlertLbl,msg:templateBlankNameAlertMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});o.setDisabled(false);return;}if(k!=null&&k.indexOf(" ")==0){Ext.Msg.show({title:templatesAlertLbl,msg:templateNameStartsWithSpacMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});
o.setDisabled(false);return;}if(this.checkSpecialCharacter(k)){Ext.Msg.show({title:templatesAlertLbl,msg:templateSplCharacterAlertMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});o.setDisabled(false);return;}var J=-1;var j=publicJson["action"];if(j!=null&&j=="loadMyTemplateListPage"){var B=Ext.getCmp("dataViewId");
if(!Ext.isEmpty(B)){var Q=B.getStore();var V=Q.findRecord("templateName",k,0,false,false,true);J=Q.indexOf(V);}}else{var c=Ext.getCmp("templateListCombo");if(!Ext.isEmpty(c)){var Q=c.getStore();var V=Q.findRecord("templateName",k,0,false,false,true);J=Q.indexOf(V);}}if(J>-1){if(C.templateAction=="Modify"){if(e!=k){Ext.Msg.show({title:templatesAlertLbl,msg:templateExistAlertMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});
o.setDisabled(false);return;}}else{Ext.Msg.show({title:templatesAlertLbl,msg:templateExistAlertMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});o.setDisabled(false);return;}}var y=Ext.getCmp("templateDescription").getValue();var M=Ext.getCmp("infraTypeCombo").getValue();var f=Ext.getCmp("templateInfraElementsCombo").getValue();
var r="addProfile";if(C.templateAction!=null&&C.templateAction=="Modify"){r="modifyProfile";}var i=Ext.getCmp("customPrivateId");var O=Ext.getCmp("customPublicId");var D=Ext.getCmp("customShareId");var E="Private";if(!Ext.isEmpty(i)&&i.pressed==true){E="Private";}else{if(!Ext.isEmpty(O)&&O.pressed==true){E="Public";
}else{if(!Ext.isEmpty(D)&&D.pressed==true){E="Share";}}}y=this.filterEncode(y);var W=k;if(!Ext.isEmpty(W)){W=this.filterEncode(W);}var G="action="+r+"&profileName="+encodeURIComponent(W)+"&templateDescription="+encodeURIComponent(y)+"&from=templateCreation&DBtype=multiple&access_type="+encodeURI(E);if(C.templateAction=="Modify"){G=G+"&prevTemplateName="+encodeURIComponent(e);
}var I=Ext.getCmp("templateViewOpt");var T=I.getValue();if(!Ext.isEmpty(T)){if(T!=null&&(T=="consolidated-server"||T=="singleserver")){var R=Ext.getCmp("templateInfraElementsSingleCombo");var L=R.getValue();if(L==null||L==""||L=="-1"){Ext.Msg.show({title:templatesAlertLbl,msg:compTypAlertMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});
o.setDisabled(false);return;}G=G+"&infraType="+M+"&TemplateType="+encodeURIComponent(T)+"&associatedElements="+encodeURIComponent(L);}else{if(f==null||f==""||f=="-1"){Ext.Msg.show({title:templatesAlertLbl,msg:compTypAlertMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});o.setDisabled(false);
return;}if(f!=null&&f!=""){var w=false;var H=false;var n=Ext.getCmp("templateInfraElementsCombo").boundList.getSelectionModel().getSelection();for(var a in n){var u=f[a];if(u!=null&&u=="ALL"){w=true;continue;}else{if(w){H=true;break;}}}if(H){Ext.Msg.show({title:templatesAlertLbl,msg:allindividualTypesAlertMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});
o.setDisabled(false);return;}var g=Ext.getCmp("templateInfraElementsCombo").boundList.getSelectionModel().getSelection();var S="";for(var a in f){var h=f[a];S=S+","+h;}if(S!=null&&S.indexOf(",")==0){S=S.substring(1);}if(M!=null&&S!=null){var m=S;G=G+"&infraType="+M+"&associatedElements="+encodeURIComponent(m);
}}G=G+"&TemplateType="+encodeURIComponent(T);}}var N="";var b="";if(E=="Share"){var t=Ext.getCmp("customCheckComp").getSelectionModel().getSelection();for(var v in t){var s=t[v];N=N+","+s.get("valueField");var F=s.get("readWrite");if(F!=null&&F==true){b=b+","+s.get("valueField");}}if(N==null||N==""){Ext.Msg.show({title:templatesAlertLbl,msg:dashboardSharingAlertMsg,buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING});
o.setDisabled(false);return;}if(N!=null&&N.indexOf(",")==0){N=N.substring(1);}if(b!=null&&b.indexOf(",")==0){b=b.substring(1);}G=G+"&s_user="+encodeURIComponent(N);if(b!=null&&b.length>0){G=G+"&allowed_user_to_edit_shared_ashboard="+encodeURIComponent(b);}}if(p!=null){if(U!=null&&!U.endsWith("/final/images/"+strSkin+"")){p="Custom:"+p;
G=G+"&imgIcon="+encodeURIComponent(p);}else{if(U==null){p="Default:"+p;G=G+"&imgIcon="+encodeURIComponent(p);}}}if(isMonitorHome){G=G+"&setMonitorHome=true";}var P=Ext.getCmp("templateForHomePage").getValue();var z="no";if(P!=null&&P==true){z="yes";}G=G+"&useThisTemplateForHomePage="+encodeURIComponent(z);
Ext.getCmp("custom_layouts").defaultState();var d=Ext.getCmp("createTempCompSearch");if(!Ext.isEmpty(d)){var q=d.componentStore;if(q!=null){q.clearFilter();}}var x=Ext.getCmp("compSearchTrigger");if(!Ext.isEmpty(x)){var l=x.componentStore;if(l!=null){l.clearFilter();}}Ext.Ajax.request({url:"/final/servlet/com.eg.EgTemplateBuilderController",method:"POST",params:G+"&screenWidth="+(Ext.getBody().getViewSize().width)+"&screenHeight="+(Ext.getBody().getViewSize().height),scope:this,success:function(X){var ab=X.responseText;
if(ab!=null&&ab!=""){var Z=Ext.decode(ab);if(Z["update"]=="success"){var Y=k;if(!Ext.isEmpty(Y)){Y=K.filterEncode(Y);}var aa="/final/servlet/com.eg.EgMonitorRequestDispatcher?comesFrom=templateBuilder&action=loadTemplateConfigView&profileName="+encodeURIComponent(Y);this.goToPage(aa,"loadTemplateConfigView");
}}},failure:function(X,Y){o.setDisabled(false);}});},showIconLibrary:function(){Ext.create("TemplateBuilder.view.IconLibrary").show();},loadCompsForSelection:function(h){var g=h.getValue();if(!Ext.isEmpty(g)){var e=Ext.getCmp("templateInfraElementsSingleCombo");var d=Ext.getCmp("templateInfraElementsCombo");
var c=Ext.getCmp("multiSearchCompType");var f=Ext.getCmp("infraTypeCombo");if(g=="cross-application"){Ext.getCmp("templateCompExpand").show();e.hide();f.setDisabled(false);d.show();c.show();var b=Ext.getCmp("compTypeFilterComboObj");if(!Ext.isEmpty(b)){b.show();}var a=Ext.getCmp("excludeCompLbl");if(!Ext.isEmpty(a)){a.hide();
}}else{var e=Ext.getCmp("templateInfraElementsSingleCombo");d.hide();Ext.getCmp("templateCompExpand").hide();c.hide();f.setValue("components");f.setDisabled(true);e.show();var b=Ext.getCmp("compTypeFilterComboObj");if(!Ext.isEmpty(b)){b.hide();}var a=Ext.getCmp("excludeCompLbl");if(!Ext.isEmpty(a)){a.show();
}}}},addWidgetFromWidgetGallery:function(c,d,b,a){return addWidgetFromWidgetGallery(c,d,b,a,false,"");},addWidgetFromWidgetGallery:function(e,d,m,p,o,v){var u="";maxBlockId=parseInt(maxBlockId);maxBlockId=maxBlockId+1;var n=m;var w=false;var x=true;if(e!=null&&e=="Alarms"){e="currentalarms";u="currentalarms";
m=e;n=alertsTitle;o=false;w=true;}else{if(e!=null&&e=="TIER_HEALTH"){e="tierhealth";u="tierhealth";n=tierHealthTitle;m=e;o=false;w=true;}else{if(e!=null&&e=="SERVICE_HEALTH"){e="servicehealth";u="servicehealth";n=healthPieChartTitle;m=e;o=false;w=true;}else{if(e!=null&&e=="NETWORK_HEALTH"){lastvisible="";
e="networkhealth";u="networkhealth";n=networkhealthPieChartTitle;m=e;o=false;w=true;}else{if(e!=null&&e=="news"){u="news";n=newsTitle;m=e;o=false;w=true;}else{if(e!=null&&e=="weather"){u="weather";n=weatherTitle;m=e;o=false;w=true;}else{if(e!=null&&e=="USEREXPERIENCE"){u="USEREXPERIENCE";n="User Experience - RUM";
m="mapwidget";o=false;w=true;}else{if(e!=null&&e=="Citrix-USERLATENCY"){u="Citrix-USERLATENCY";n="User Experience - Citrix";m="mapwidget";o=false;w=true;}else{if(e!=null&&e=="proactivealerts"){u="proactivealerts";n=proActiveAlertsChartTitle;m=proActiveAlertsChartTitle;o=false;w=true;}else{if(e!=null&&e=="incidentssummary"){u="incidentssummary";
n=incidentsSummaryChartTitle;m=incidentsSummaryChartTitle;o=false;w=true;}else{if(e!=null&&e=="VMAlerts"){x=true;}else{x=false;}u=e;n=e;}}}}}}}}}}var h=this;var r=4;var q=5;if(m!=null&&(m=="CombinedTimelineChart"||m=="TimelineChart"||m=="areaChart"||m=="combinationChart"||m=="TimelineChart"||m=="BarChart")){r=4;
}else{if(m!=null&&(m=="TabularView"||m=="DDTable")){r=4;}else{if(m!=null&&(m=="dialChart"||m=="digitalChart")){r=2;}else{if(m!=null&&(m=="pieChart"||m=="activityChart")){r=4;q=6;}else{if(m!=null&&m=="liveMeasuresBox"){r=4;}else{if(m!=null&&m=="VMAlerts"){r=4;q=5;}else{if(m!=null&&(m=="CombinedTimelineChart"||m=="TimelineChart"||m=="areaChart"||m=="combinationChart"||m=="BarChart")){q=6;
}else{if(m!=null&&m=="weather"||m=="networkhealth"){r=4;q=9;}else{if(m!=null&&m=="mapwidget"){r=5;q=7;}else{if(m!=null&&(m=="currentalarms"||m=="tierhealth"||m=="servicehealth"||m=="news")){r=4;q=6;}}}}}}}}}}var k={"x":0,"y":0,"width":r,"height":q,"id":"block"+maxBlockId,"widgetType":"","noResize":false,"internalId":"","widget_name":"block"+maxBlockId,"widgetNum":"Widget "+maxBlockId,"isDefaultWidget":x,"autoPosition":true};
Ext.getCmp("gridstackpanelObj")._addWidget(k,"addWidget",n,"","");var a=Ext.getCmp("templateLayoutObj");var i=a.profileName;e=h.filterEncode(e);var s=i;if(!Ext.isEmpty(s)){s=h.filterEncode(s);}var c="action=addWidgetFromWidgetGallery&profileName="+encodeURIComponent(s)+"&widgetName="+encodeURIComponent(e)+"&widgetId="+encodeURIComponent(u)+"&displayType="+encodeURIComponent(m)+"&srcTemplateName="+encodeURIComponent(d);
var g=this.getGridstackpanel();var t=g.getTBPanelPositions();var f="block"+maxBlockId+":"+u;if(t!=null&&t!=""){c=c+"&layoutConfig="+encodeURIComponent(t)+"&blockPosMatch="+encodeURIComponent(f);}var l=g._serialization();var b=l.length;c=c+"&gridsterLength="+encodeURIComponent(b);g=null;delete g;var j=Ext.get(p+"_addBtn");
if(!Ext.isEmpty(j)){if(w){j.removeCls("addToWidgetBtn");j.addCls("widgetRemoveButton");}else{j.removeCls("myWidgetTableBtn_add");j.addCls("myWidgetTableBtn_added");j.dom.innerHTML='<img class="stateIconWhiteHealthy" src="../images/Light/stateIconsWhite.png">';}}var h=this;Ext.Ajax.request({url:"/final/servlet/com.eg.EgTemplateBuilderController",method:"POST",params:c,scope:this,success:function(z){var C=Ext.getCmp("block"+maxBlockId);
var B=z.responseText;var A=Ext.decode(B);C.isDefaultWidget=x;if(o){var y=Ext.getCmp("addWidgetwindowNew");if(!Ext.isEmpty(y)){y.updateWidgetGalleryData(v,"");}}h.showDataForBlock(C,A,u);h.flashMsgBox(widgetAddedAlertMsg);}});},flashMsgBox:function(a){Ext.create("Ext.window.Window",{floating:true,plain:true,ui:"flash-msg",resizable:false,frame:false,header:false,border:false,closeAction:"destroy",bodyPadding:10,html:'<div style="margin-top:10px;">'+a+"</div>",height:53,listeners:{show:function(b){b.getEl().setOpacity(0);
b.getEl().fadeIn({duration:1000,callback:function(){Ext.defer(function(){b.hide();},5000);}});b.hide();},hide:function(b){b.getEl().fadeOut({duration:1000,callback:function(){b.close();}});}}}).show();},deleteTemplateWidget:function(a,c,b){return deleteWidget(a,c,b,false,"");},deleteTemplateWidget:function(a,c,b,d,f){var h=this;
var g=false;var e=Ext.getCmp(a);var g=false;if(a!=null&&a=="Alarms"){a="currentalarms";d=false;g=true;}else{if(a!=null&&a=="TIER_HEALTH"){a="tierhealth";d=false;g=true;}else{if(a!=null&&a=="SERVICE_HEALTH"){a="servicehealth";d=false;g=true;}else{if(a!=null&&a=="NETWORK_HEALTH"){a="networkhealth";d=false;
g=true;}else{if(a!=null&&a=="news"){a="news";d=false;g=true;}else{if(a!=null&&a=="weather"){a="weather";d=false;g=true;}}}}}}Ext.Msg.show({title:templatesAlertLbl,msg:deleteBlockMsg+"?",buttons:Ext.Msg.YESNO,width:300,icon:"iconConfirmation",fn:function(k){if(k=="yes"){var j=Ext.getCmp("templateLayoutObj").profileName;
if(!Ext.isEmpty(j)){j=h.filterEncode(j);}var i="action=removeWidgetFromWidgetGallery&profileName="+encodeURIComponent(j)+"&keyToDelete="+a;Ext.defer(function(){var p=Ext.getCmp("gridstackpanelObj");var n=p.getTBPanelPositions();var l=p._serialization();var o=l.length;var m=9;if(!Ext.isEmpty(o)){m=parseInt(o)-1;
}i=i+"&layoutConfig="+encodeURIComponent(n)+"&gridsterLength="+encodeURIComponent(m);var q=Ext.get(c+"_addBtn");if(!Ext.isEmpty(q)){if(g){q.removeCls("widgetRemoveButton");q.addCls("addToWidgetBtn");}else{q.removeCls("myWidgetTableBtn_added");q.addCls("myWidgetTableBtn_add");}}Ext.Ajax.request({url:"/final/servlet/com.eg.EgTemplateBuilderController",method:"POST",params:i,scope:this,success:function(v){var w=v.responseText;
if(w!=null&&w!=""){var r=Ext.decode(w);if(r!=null&&!Ext.isEmpty(r)){var t=r["configData"];if(t!=null&&!Ext.isEmpty(t)){widgetsforTemplateView=t["maxWidgetsForTemplate"];widgetsforTemplateView=parseInt(widgetsforTemplateView);maxBlockId=t["maxBlockId"];maxBlockId=parseInt(maxBlockId);}var x=r["deletedWidgetId"];
var s=h.getGridstackpanel();s._removeWidget(x);if(d){var u=Ext.getCmp("addWidgetwindowNew");if(!Ext.isEmpty(u)){u.updateWidgetGalleryData(f,"");}}}}}});},200);}else{e=null;delete e;}}});},filterEncode:function(i){var d=["[","]","(",")","=","%","'","&",";",'"'];var c=["|lsbr|","|rsbr|","|lbr|","|rbr|","|eq|","|per|","|squot|","|ampsnd|","|scol|","|dqt|"];
try{if(i!=null&&i!=undefined&&!Ext.isEmpty(i)){for(var b in d){var f=d[b];var g=c[b];do{i=i.replace(f,g);}while(i.indexOf(f)>-1);}}}catch(h){}return i;},createExcludeIncludeSettingsLayout:function(){var a=[{xtype:"fieldcontainer",layout:"hbox",id:"excludeIncludeOpt",width:380,name:"excludeIncludeOpt",defaultType:"textfield",margin:"0 0 0 10",labelAlign:"top",labelSeparator:"",flex:1,defaults:{margin:"0 0 0 0",},items:[{xtype:"scrollcombo",id:"serverdescripCombo",name:"serverdescripCombo",cls:"dropdown",fieldLabel:ExcluedIncludeLbl,width:150,labelSeparator:"",labelAlign:"top",margin:"0 10 10 0",store:Ext.create("Ext.data.Store",{fields:["displayField","valueField"],data:[]}),editable:true,forceSelection:true,displayField:"displayField",valueField:"valueField",queryMode:"local",value:notApplicable,listeners:{"select":function(b){tempBuilderApp.getController("Main").onTypeCombochange(b);
}}},{xtype:"scrollcombo",id:"compTypeCombo",name:"compTypeCombo",cls:"dropdown",labelAlign:"top",labelSeparator:"",fieldLabel:compType,width:210,margin:"0 0 10 10",padding:0,store:Ext.create("Ext.data.Store",{fields:["displayField","valueField"],data:[]}),editable:true,forceSelection:true,displayField:"displayField",valueField:"valueField",queryMode:"local",value:notApplicable,listeners:{"select":function(b){tempBuilderApp.getController("Main").loadComponentsForCompType(b);
}}}]},{xtype:"fieldcontainer",layout:"hbox",width:430,margin:"0 0 10 0",items:[{xtype:"scrollcombo",id:"testComboValue",name:"testComboValue",cls:"dropdown",labelAlign:"top",labelSeparator:"",hidden:true,fieldLabel:testLbl,width:200,margin:"0 10 10 10",store:Ext.create("Ext.data.Store",{fields:["displayField","valueField"],data:[]}),editable:true,forceSelection:true,displayField:"displayField",valueField:"valueField",queryMode:"local",value:notApplicable,listeners:{"select":function(b){tempBuilderApp.getController("Main").loadDescForSelectedTest(b);
}}}]},{xtype:"radiogroup",width:200,column:2,labelWidth:135,height:20,margin:"0 10 10 10",fieldLabel:"Action on descriptors",labelAlign:"top",id:"excIncludeRadioOpt",name:"descRadioOpt",hidden:true,items:[{boxLabel:"Exclude",name:"descOpt",inputValue:"Exclude",cls:"radiobt"},{boxLabel:"Include",name:"descOpt",inputValue:"Include",cls:"radiobt"}],listeners:{change:function(g,c,b){var i=c.descOpt;
var h=Ext.getCmp("descriptorItemSel");var k=Ext.getCmp("updateExcludeInclude");var j=Ext.getCmp("descMultiselect");if(i!=null&&i=="Exclude"){if(!Ext.isEmpty(j)&&h.isVisible()==true){Ext.getCmp("descriptorTextFieldObj").hide();if(j.getStore().getAt(0).data.valueField=="allDescriptors"){j.getStore().removeAt(0);
j.getStore().insert(0,{displayField:"None",valueField:"None"});j.resumeEvents();}else{if(j.getStore().getAt(0).data.valueField!="-1"){j.getStore().insert(0,{displayField:"None",valueField:"None"});j.resumeEvents();}}}else{var f=Ext.getCmp("descriptorTextFieldObj");if(!Ext.isEmpty(f)){var d=f.getValue();
if(d!=null&&(d=="*"||d.trim()=="")){f.setValue("None");}f.show();}}if(!Ext.isEmpty(k)){k.setText(screenLabelsObj["Exclude"]);}}else{if(i!=null&&i=="Include"){if(!Ext.isEmpty(j)&&h.isVisible()==true){Ext.getCmp("descriptorTextFieldObj").hide();if(j.getStore().getAt(0).data.valueField=="None"){j.getStore().removeAt(0);
if(j.getStore().getRange().length>1){j.getStore().insert(0,{displayField:"All Descriptors",valueField:"allDescriptors"});j.resumeEvents();}}else{if(j.getStore().getAt(0).data.valueField!="-1"&&j.getStore().getRange().length>1){j.getStore().insert(0,{displayField:"All Descriptors",valueField:"allDescriptors"});
j.resumeEvents();}}}else{var f=Ext.getCmp("descriptorTextFieldObj");if(!Ext.isEmpty(f)){var e=f.getValue();if(e!=null&&(e=="None"||e.trim()=="")){f.setValue("*");}f.show();}}if(!Ext.isEmpty(k)){k.setText(screenLabelsObj["Include"]);}}}}}},{xtype:"fieldcontainer",layout:"vbox",width:430,cls:"templateBuilderItemSelector addRemove",margin:"0 0 10 0",items:[{xtype:"itemselector",cls:"itemselector ",id:"compFilterItmSel",name:"compFilterItmSel",buttons:["add","remove"],buttonsText:{add:screenLabelsObj["Add"],remove:screenLabelsObj["Remove"]},imagePath:"/final/images/",multiSelect:true,margin:"0 0 10 10",height:180,width:420,scroll:true,toTitle:unManagedItem1,fromTitle:managedItem1,editable:false,displayField:"displayField",valueField:"valueField",store:Ext.create("Ext.data.Store",{fields:["displayField","valueField"],data:[]}),hidden:false},{xtype:"container",margin:"0 0 10 10",id:"descriptorItemSel",hidden:true,settedValues:"",items:[{xtype:"label",cls:"x-form-item",id:"multiselectLbl",name:"multiselectLbl",labelAlign:"top",text:"Descriptors",labelClsExtra:"icon-properties item-label-icon",},{xtype:"container",height:160,width:195,layout:{type:"vbox",align:"stretch"},cls:"darkbox",margin:"5 5 0 0",id:"MultiSelectOuterBox",items:[{xtype:"trigger",margin:"5",id:"SearchTextBox",name:"SearchTextBox",width:228,cls:"whitedropdown_search",emptyText:"search",controltStoreObj:null,listeners:{"change":function(h,g,c,d){var e=this;
var b=e.controltStoreObj;if(b==null){e.controltStoreObj=Ext.getCmp("descMultiselect").getStore();b=e.controltStoreObj;}if(g=="*"){b.clearFilter();}else{if(g.lastIndexOf("*")==(g.length-1)){g=g.substr(0,(g.length-1));}b.clearFilter();if(g){var f=new RegExp(Ext.String.escapeRegex(g),"i");b.filter({filterFn:function(i){return f.test(i.get("displayField"));
}});}h.focus();}}}},{xtype:"multiselect",id:"descMultiselect",baseCls:"egmultiselect",name:"descMultiselect",multiSelect:true,height:130,width:195,store:Ext.create("Ext.data.Store",{fields:["displayField","valueField"],data:[]}),listConfig:{id:"ListC1",simpleSelect:true},editable:false,displayField:"displayField",valueField:"valueField",queryMode:"local"}]}]},{xtype:"textfield",id:"descriptorTextFieldObj",name:"descriptorTextFieldObj",cls:"textbox",width:"100%",height:30,margin:"10 10 10 2",labelWidth:152,hidden:true,labelSeparator:""},{xtype:"button",buttonAlign:"center",text:screenLabelsObj["Exclude"]+"&#47;"+screenLabelsObj["Include"],margin:"0 0 0 10",id:"updateExcludeInclude",cls:"buttonNew small",buttonAlign:"center",listeners:{click:function(){tempBuilderApp.getController("Main").saveExcludeIncludeWidgetConfig();
}}}]}];return a;},filterEncode:function(i){var d=["[","]","(",")","=","%","'","&"];var c=["|lsbr|","|rsbr|","|lbr|","|rbr|","|eq|","|per|","|squot|","|ampsnd|"];try{if(i!=null&&i!=undefined&&!Ext.isEmpty(i)){for(var b in d){var f=d[b];var g=c[b];do{i=i.replace(f,g);}while(i.indexOf(f)>-1);}}}catch(h){}return i;
},changePreDefinedLayout:function(n){var q=[];if(publicJson!=null&&publicJson.hasOwnProperty("templateConfigDetails")){var f="";var g=false;if(!Ext.isEmpty(publicJson["templateConfigDetails"])&&publicJson["templateConfigDetails"].hasOwnProperty("preDefinedLayouts")){var d=publicJson["templateConfigDetails"]["preDefinedLayouts"];
if(!Ext.isEmpty(d)){for(var i in d){var c=d[i];if(!Ext.isEmpty(c)&&c["valueField"]==n){g=true;f=c["layoutSettings"];break;}}}if(g){var b=this;var l=this.getMain();Ext.getCmp("templateMainPanel").getHeader().show();var r=this.getCreateTemplate();if(Ext.isEmpty(r)){r=Ext.widget("createTemplate");}if(r!=null&&!Ext.isEmpty(r)){r.close();
}publicJson["action"]="loadTemplateConfigView";var h=publicJson["templateConfigDetails"]["isSharedTemplate"];if(h!=null&&h=="true"){h=true;}else{h=false;}var p=publicJson["templateConfigDetails"]["isDefaultTemplate"];if(p!=null&&p=="true"){p=true;}else{p=false;}var a=Ext.getCmp("gridstackpanelObj");if(!Ext.isEmpty(a)){a._removeAllWidget();
}Ext.getCmp("listPageHeaderMenu").hide();Ext.getCmp("searchTemplate").hide();l.remove("templateBuilderListPageView",true);l.remove("dataViewId",true);l.clearManagedListeners();l.removeAll("dataViewId",true);l.remove("templateLayout",true);l.remove("templateLayoutObj",true);Ext.EventManager.removeAll("templateLayoutObj");
Ext.EventManager.removeAll("templateBuilderListPageView");Ext.EventManager.removeAll("dataViewId");l.add({xtype:"templateLayout",profileName:publicJson["templateConfigDetails"]["profileName"],isSharedTemplate:h,isDefaultTemplate:p,layoutchoosen:publicJson["templateConfigDetails"]["layout"]});Ext.getCmp("templateListCombo").show();
Ext.getCmp("templateConfigTools").hide();var k=this.getTemplategeneralsettings();if(publicJson["templateConfigDetails"]["isSharedTemplate"]=="false"&&!isMonitorHome){if(!p){Ext.getCmp("templateConfigTools").show();}}else{Ext.getCmp("templateConfigTools").hide();}var j=this.getTemplatetools();j.show();
j.getComponent("listBtnContainer").show();j=null;delete j;this.loadTemplateListCombo(publicJson["templateComboList"],publicJson["templateConfigDetails"]["profileName"]);l.doLayout();this.loadTemplateConfigurationView("changePreDefinedLayout",n,f);var m=publicJson["templateConfigDetails"]["profileName"];
if(!Ext.isEmpty(m)){m=this.filterEncode(m);}var e="&action=savePredefinedTemplateLayout&profileName="+encodeURIComponent(m)+"&predef_layout="+encodeURIComponent(n);var a=Ext.getCmp("gridstackpanelObj");var o=a.getTBPanelPositions();if(o!=null&&o!=""){e=e+"&layoutConfig="+encodeURIComponent(o);}Ext.Ajax.request({url:"/final/servlet/com.eg.EgTemplateBuilderController",method:"POST",params:e,scope:this,success:function(s){var t=s.responseText;
if(!Ext.isEmpty(t)){}}});}}}},saveCustomColumn:function(f,b){var e=this;var a=this.getMain();var c=this.getGridstackpanel();b.setDisabled(true);var d=publicJson["templateConfigDetails"]["profileName"];if(!Ext.isEmpty(d)){d=this.filterEncode(d);}Ext.Ajax.request({url:"/final/servlet/com.eg.EgTemplateBuilderController",method:"POST",params:"&action=saveCustomLayoutColumn&profileName="+encodeURIComponent(d)+"&column="+encodeURIComponent(f),scope:this,success:function(i){var n=i.responseText;
if(n!=null&&n!=""){publicJson=Ext.decode(n);var m=this.getCreateTemplate();if(Ext.isEmpty(m)){m=Ext.widget("createTemplate");}if(m!=null&&!Ext.isEmpty(m)){m.close();}publicJson["action"]="loadTemplateConfigView";var k=publicJson["templateConfigDetails"]["isSharedTemplate"];if(k!=null&&k=="true"){k=true;
}else{k=false;}var l=publicJson["templateConfigDetails"]["isDefaultTemplate"];if(l!=null&&l=="true"){l=true;}else{l=false;}var h=Ext.getCmp("gridstackpanelObj");if(!Ext.isEmpty(h)){h._removeAllWidget();}Ext.getCmp("listPageHeaderMenu").hide();Ext.getCmp("searchTemplate").hide();a.remove("templateBuilderListPageView",true);
a.remove("dataViewId",true);a.clearManagedListeners();a.removeAll("dataViewId",true);a.remove("templateLayout",true);a.remove("templateLayoutObj",true);Ext.EventManager.removeAll("templateLayoutObj");Ext.EventManager.removeAll("templateBuilderListPageView");Ext.EventManager.removeAll("dataViewId");a.add({xtype:"templateLayout",profileName:publicJson["templateConfigDetails"]["profileName"],isSharedTemplate:k,isDefaultTemplate:l,layoutchoosen:publicJson["templateConfigDetails"]["layout"]});
Ext.getCmp("templateListCombo").show();Ext.getCmp("templateConfigTools").hide();var j=this.getTemplategeneralsettings();if(publicJson["templateConfigDetails"]["isSharedTemplate"]=="false"&&!isMonitorHome){if(!l){Ext.getCmp("templateConfigTools").show();}}else{Ext.getCmp("templateConfigTools").hide();
}var g=this.getTemplatetools();g.show();g.getComponent("listBtnContainer").show();g=null;delete g;this.loadTemplateListCombo(publicJson["templateComboList"],publicJson["templateConfigDetails"]["profileName"]);a.doLayout();this.loadTemplateConfigurationView();b.setDisabled(false);}}});},onChangeDDChartType:function(c){var f=c.getValue();
var a=Ext.getCmp("summarizeDDColumnCombo");var h=Ext.getCmp("ddcolumnsLbl");var g=Ext.getCmp("ViewType");var i=Ext.getCmp("Timeline");var j=Ext.getCmp("showChartSummary");var d=Ext.getCmp("measureLbl");if(f!=null&&f=="Bar Chart"){if(j!=null&&!Ext.isEmpty(j)){j.hide();}if(i!=null&&!Ext.isEmpty(i)){i.hide();
}if(!Ext.isEmpty(a)&&!Ext.isEmpty(g)){if(d.isVisible()){a.show();a.setValue("-1");}g.show();if(h!=null&&!Ext.isEmpty(h)){var e="";var b=g.getChecked();if(b!=null&&!Ext.isEmpty(b)){e=b[0].inputValue;}if(e!=null&&e=="Vertical"){a.setFieldLabel("Summarize DD Data By (X axis)");h.setText("DD Columns (Y axis)");
}else{if(e!=null&&e=="Horizontal"){a.setFieldLabel("Summarize DD Data By (Y axis)");h.setText("DD Columns (X axis)");}}}}}else{if(f!=null&&(f=="Time Line"||f=="Area")){if(j!=null&&!Ext.isEmpty(j)){j.show();}if(g!=null&&!Ext.isEmpty(g)){g.hide();}if(i!=null&&!Ext.isEmpty(i)){i.show();}if(!Ext.isEmpty(h)&&!Ext.isEmpty(a)){a.setFieldLabel("Summarize DD Data By");
h.setText("DD Columns");}if(d.isVisible()){if(!Ext.isEmpty(a)){a.show();a.setValue("-1");}}}else{if(j!=null&&!Ext.isEmpty(j)){j.hide();}if(i!=null&&!Ext.isEmpty(i)){i.hide();}if(!Ext.isEmpty(a)&&!Ext.isEmpty(g)){a.hide();g.hide();}if(h!=null&&!Ext.isEmpty(h)){h.setText("DD Columns");}}}},onChangeViewType:function(f){var e=Ext.getCmp("graphicalTypeId");
var c=e.getValue();var b=Ext.getCmp("ddcolumnsLbl");var d=Ext.getCmp("summarizeDDColumnCombo");if(c!=null&&c=="Bar Chart"){var g=f.getChecked();var a=g[0].inputValue;if(b!=null&&!Ext.isEmpty(b)){if(a!=null&&a=="Vertical"){d.setFieldLabel("Summarize DD Data By (X axis)");b.setText("DD Columns (Y axis)");
}else{if(a!=null&&a=="Horizontal"){d.setFieldLabel("Summarize DD Data By (Y axis)");b.setText("DD Columns (X axis)");}}}}},onManualTestComboChange:function(b,c,n,f,i,k){var j=this;var d=Ext.getCmp("measureListCombo");var h=Ext.getCmp("measurelist");var g=this.getUserDefinedWidgetWindow();var a=g.getComponent("configForm").getForm();
if(n!=null){tempSelectedGraph="DDTable";if(n!="-1"){Ext.Ajax.request({url:"/final/servlet/com.eg.EgTemplateBuilderController",method:"POST",params:"action=getMeasuresForTest&comesFrom=widgetConfiguration&selectedTest="+encodeURIComponent(n)+"&selectedGraph="+tempSelectedGraph,scope:this,success:function(o){var q=o.responseText;
if(q!=null&&q!=""){var u=Ext.decode(q);var t=null;t=u["Measures"]["ddMeasureOpts"];if(t!=null&&!Ext.isEmpty(t)){if(tempSelectedGraph!=null&&tempSelectedGraph!=""){Ext.getCmp("addtoGridBtn").hide();Ext.getCmp("measureLbl").show();if(tempSelectedGraph=="DDTable"){a.findField("measurelist").hide();a.findField("metricsSearchTextBox").hide();
var v=a.findField("measureListCombo");v.suspendEvents(true);var p=v.getStore();p.removeAll();p.loadRawData(t);p.insert(0,{displayField:"Please Choose Measure",valueField:"-1"});v.setValue(f);p.resumeEvents();v.show();}}}else{if(tempSelectedGraph!=null&&tempSelectedGraph=="DDTable"){var v=a.findField("measureListCombo");
v.suspendEvents(true);var p=v.getStore();p.removeAll();p.insert(0,{displayField:notApplicable,valueField:"-1"});v.setValue("-1");v.resumeEvents();v.show();var s=a.findField("ddcolumnsMultiSelect");s.suspendEvents(true);var r=s.getStore();r.removeAll();r.insert(0,{displayField:notApplicable,valueField:"-1"});
s.setValue("-1");s.resumeEvents();s.show();}}}}});}else{var l=a.findField("measurelist");l.suspendEvents(true);var e=l.getStore();e.removeAll();e.insert(0,{displayField:notApplicable,valueField:"-1"});l.setValue("-1");l.resumeEvents();}}var m=a.findField("measureListCombo");Ext.defer(function(){m.isManualLoading=true;
j.loadManualDDColumns(m,i,k);},200);g=null;delete g;}});