var proceed=true;var check="";Ext.define("Segments.controller.Main",{extend:"Ext.app.Controller",views:["ComponentSegments","ComponentSegment","maximizeWindow","RenameSegment","GroupDetails","RenameGroup","ManagedComponents"],requires:["Segments.view.RenameSegment"],refs:[{selector:"componentsegments",ref:"componentsegments"},{selector:"componentsegment",ref:"componentsegment"},{selector:"renamesegment",ref:"renamesegment"},{selector:"maximizewindow",ref:"maximizewindow"},{selector:"groupdetails",ref:"groupdetails"},{selector:"renamegroup",ref:"renamegroup"},{selector:"managedcomponents",ref:"managedcomponents"},],init:function(){appCnt=this;
this.buildFieldData();this.control({"componentsegments":{"afterrender":this.afterMainRender},'componentsegments [id="gridDisplay"]':{},'componentsegments trigger[name="gridSearch"]':{"change":this.mainGridSearch},'componentsegments button[id="addSegment"]':{"click":this.addSegment},'componentsegments button[id="autoTopPreview"]':{"click":this.autoTopologyPreview},'componentsegment textfield[id="segmentName"]':{"blur":this.validateName},'componentsegment combo[id="imagecombo"]':{"select":this.validation},'componentsegment combo[id="segmentNameCombo"]':{"select":this.comboLoad},'componentsegment multiselectSi[id="assocZoneCombo"]':{"change":this.zoneComboLoad},'componentsegment checkbox[id="association"]':{"change":this.checkBoxLoad},'componentsegment checkbox[id="discComp"]':{"change":this.showNewDiscoveredComp},'componentsegment combo[id="compTypeCombo"]':{"select":this.compTypeLoad},'componentsegment combo[id="componentsList"]':{"select":this.multiselectLoad},'componentsegment button[id="backbutton"]':{"click":this.backbutton},'componentsegment button[id="deleteBtn"]':{"click":this.deleteSegment},'renamesegment button[id="renameBTN"]':{"click":this.renameSegment},'componentsegment button[id="iconDefaultTopo"]':{"click":this.defaultPosition},'componentsegment button[id="iconAutoTopo"]':{"click":this.autoPosition},'componentsegment button[id="iconSave"]':{"click":this.savePosition},'componentsegment button[id="iconAutofit"]':{"click":this.autoFit},'componentsegment button[id="iconReset"]':{"click":this.resetPosition},'componentsegment button[id="iconMaximize"]':{"click":this.iconMaximize},'groupdetails button[id="addBtn"]':{"click":this.manageGrpComponent},'groupdetails button[id="removeBtn"]':{"click":this.removeGrpComponent},'renamegroup button[id="renameGrpbtn"]':{"click":this.renameBtnClick},'maximizewindow button[id="iconSavePopup"]':{"click":this.savePosition},'maximizewindow button[id="iconAutoFitPopup"]':{"click":this.autoFit},'maximizewindow button[id="iconResetPopup"]':{"click":this.resetPosition}});
},defaultPosition:function(){window.frames[0].defaultPosition();},autoPosition:function(){window.frames[0].autoPositions();},resetPosition:function(a){if(!Ext.isEmpty(a)){if(a.getId()=="iconReset"){window.frames[0].resetPositions(check);}else{if(a.getId()=="iconResetPopup"){window.frames[1].resetPositions(check);
}}}else{window.frames[0].resetPositions(check);}},iconMaximize:function(){var b=Ext.getBody().getViewSize().height;var a=Ext.getBody().getViewSize().width;var d=window.frames[0].document.body.scrollHeight;var c=window.frames[0].openBigDiv(check);Ext.widget("maximizewindow").show();Ext.getCmp("topologyMaxFrame").update('<iframe id="maxWindow" src="'+c+'" style="width:1308px;border:0px" height='+d+' scrolling="no"></iframe>');
},autoFit:function(a){if(a.getId()=="iconAutofit"){window.frames[0].autoFit();}else{if(a.getId()=="iconAutoFitPopup"){window.frames[1].autoFit();}}},savePosition:function(a){if(a.getId()=="iconSave"){window.frames[0].savePositions("save",check);}else{if(a.getId()=="iconSavePopup"){window.frames[1].savePositions("save",check);
}}},showNewDiscoveredComp:function(){check=Ext.getCmp("discComp").checked;window.frames[0].newDiscComp(check);},expandAllRows:function(){var d=Ext.getCmp("gridDisplay");var b=d.getStore();var e=d.getPlugin("rowexpanderDiv");for(var c=0;c<b.getCount();c++){var a=b.getAt(c);if(!e.recordsExpanded[a.internalId]){e.toggleRow(c);
}}},collapseAllRows:function(){var d=Ext.getCmp("gridDisplay");var b=d.getStore();var e=d.getPlugin("rowexpanderDiv");for(var c=0;c<b.getCount();c++){var a=b.getAt(c);if(e.recordsExpanded[a.internalId]){e.toggleRow(c);}}},backbutton:function(){if(returnToMain=="true"){if(!Ext.isEmpty(mainUrl)){if(mainUrl.indexOf(".jsp?")!=-1){mainUrl+="&fromWizard="+fromWizard;
}else{mainUrl+="?fromWizard="+fromWizard;}}window.location.href=mainUrl;return;}else{if(returnTo=="userpage"){window.location.href=backHref+"&username="+username+"&selectedTab=3"+"&fromWizard="+fromWizard;return;}else{if(returnTo=="comp_mng_umng"){window.location.href="EgConfigEnv.jsp?srvtype="+comptype+"&activeCompTypes="+activeCompTypes+"&fromWizard="+fromWizard;
return;}else{if(returnTo=="agg_mng_umng"){window.location.href="aggConfigEnv.jsp?srvtype="+comptype+"&activeCompTypes="+activeCompTypes+"&fromWizard="+fromWizard;return;}else{if(returnTo=="discovery_mng_umng"){window.location.href="EgDiscoveryPane.jsp?server="+comptype+"&activeCompTypes="+activeCompTypes+"&selectedNode=node11"+"&fromWizard="+fromWizard;
return;}else{if(returnTo=="comp_add_modify"){window.location.href="EgDispServer.jsp?comptype="+comptype+"&activeCompTypes="+activeCompTypes+"&fromWizard="+fromWizard;return;}else{if(returnTo=="comp_add_mod_new"){window.location.href="EgAdminOperations.jsp?server="+comptype+"&fromAction="+fromAction+"&classify="+classify;
return;}}}}}}}if(pageFrom=="topology"){window.location.href="EgAutoTopology.jsp";}else{window.location.href="EgComponentSegments.jsp?fromWizard="+fromWizard;}},showActions:function(b,c,f,i,g){var h=b.getStore().getAt(i);var a=h.get("isDisabled");var d=Ext.DomQuery.select(".x-action-col-icon",f);Ext.each(d,function(e){if(a=="true"){Ext.get(d[0]).removeCls("x-hidden");
Ext.get(d[1]).removeCls("x-hidden");}else{Ext.get(e).removeCls("x-hidden");}});},hideActions:function(a,b,d,g,f){var c=Ext.DomQuery.select(".x-action-col-icon",d);Ext.each(c,function(e){Ext.get(e).addCls("x-hidden");});},handleEditIconClick:function(d,h,b){btnText="Edit";var g=Ext.getCmp("gridDisplay").getStore().getAt(h);
var a=g.get("Segmentname");var f="all";var e=this.getController("Segments.controller.ConfigSegmentControl");Ext.getCmp("viewport").removeAll();Ext.getCmp("viewport").add({xtype:"componentsegment"});var c=g.get("ModifyUrl");e.afterMainRender("modify",a,f);},handleRenameIconClick:function(c,e,b){btnText="Rename";
var d=c.getStore().getAt(e);var a=d.get("Segmentname");this.showEditWindow(a);},discCompIconHide:function(a){var c=a;var b="Segments/data/EgAdminTopologyJson.jsp?&fromAction=newCompHideIcon"+"&segment="+c+"&mode=modify";Ext.Ajax.request({url:b,method:"POST",success:function(e){if(e.status==200&&!Ext.isEmpty(e.responseText)){var f=e.responseText;
publicJSON=Ext.decode(f);var d=publicJSON["IsNewCompIconHide"];if(d){Ext.getCmp("discComp").hide();}else{Ext.getCmp("discComp").show();}}}});},changeImage:function(a){var b=publicJSON["mode"];if(b=="modify"){Ext.MessageBox.confirm(mainPageTitle,alertMsg36,function(g){if(g=="yes"){var h=Ext.getCmp("segmentNameCombo").getValue();
var c="";if(Ext.getCmp("assocZoneCombo").getValue()!=undefined){c=Ext.getCmp("assocZoneCombo").getValue();}var f="false";var e="Segments/data/EgAdminTopologyJson.jsp?mode="+b+"&segment="+encodeURIComponent(h)+"&newsegment="+encodeURIComponent(f)+"&zone="+encodeURIComponent(c)+"&imageName="+a+"&validate=true&callFrom=fromItemSelector";
Ext.Ajax.request({url:e,method:"POST",async:false,success:function(i){if(i.status==200&&!Ext.isEmpty(i.responseText)){Ext.Msg.show({title:mainPageTitle,msg:alertMsg37,icon:"iconInformation",buttons:Ext.Msg.OK});}}});}else{var h=Ext.getCmp("segmentNameCombo").getValue();var c="";if(Ext.getCmp("assocZoneCombo").getValue()!=undefined){c=Ext.getCmp("assocZoneCombo").getValue();
}var d="Segments/data/EgAdminTopologyJson.jsp?mode="+b+"&segment="+encodeURIComponent(h)+"&zone="+encodeURIComponent(c)+"&returnToMain=false&mainUrl=false";Ext.Ajax.request({url:d,method:"POST",async:false,success:function(i){if(i.status==200&&!Ext.isEmpty(i.responseText)){var j=i.responseText;publicJSON=Ext.decode(j);
Ext.getCmp("imagecombo").setValue(publicJSON["selectedImage"]);$("#"+Ext.getCmp("imagecombo").inputEl.id).removeClass().addClass(publicJSON["selectedImage"]);}}});}});}},showEditWindow:function(a){Ext.widget("renamesegment").show();Ext.getCmp("currentname").setValue(a);Ext.Ajax.request({url:"Segments/data/renamehelpJson.jsp",method:"POST"});
},renameSegment:function(){var b="Segment";var c=Ext.getCmp("currentname").getValue();var e=Ext.getCmp("newname").getValue();var a=true;if(e==""||e.length==0){Ext.Msg.show({title:"Rename Segment",msg:publicJSON["screenLabels"]["admin.common.field value cannot be blank"]+".",icon:"iconExclamation",buttons:Ext.Msg.OK});
return;}else{if(c==e){Ext.Msg.show({title:"Rename Segment",msg:publicJSON["screenLabels"]["sameName"]+".",icon:"iconExclamation",buttons:Ext.Msg.OK});return;}else{if(e.indexOf(" ")==0||e.lastIndexOf(" ")==e.length-1){Ext.Msg.alert("Rename Segment",segmentnameSpaceValMsg1+".");return false;}else{if(e.indexOf("  ")>-1){Ext.Msg.alert("Rename Segment",segmentnameSpaceValMsg2+".");
return false;}}}}var g="`~!@#$%^&*()+={}[]|\\:;\"'<>,?/";var f=publicJSON["isDouble"];for(count=0;count<e.length;count++){var i=g.indexOf(e.charAt(count));if(!f){var d=e.charCodeAt(count);if(d>255){Ext.Msg.show({title:"Rename Segment",msg:publicJSON["screenLabels"]["admin.common.DBL not allowed"]+".",icon:"iconExclamation",buttons:Ext.Msg.OK});
return false;}}if(i>=0){Ext.Msg.show({title:"Rename Segment",msg:publicJSON["screenLabels"]["admin.common.special characters not allowed"]+".",icon:"iconExclamation",buttons:Ext.Msg.OK});return false;}}var h="Segments/data/renameJson.jsp?old_name="+encodeURIComponent(c)+"&new_name="+encodeURIComponent(e)+"&rename="+b;
Ext.Ajax.request({url:h,method:"POST",async:false,success:function(k){if(k.status==200&&!Ext.isEmpty(k.responseText)){var j=k.responseText;renameJSON=Ext.decode(k.responseText);if(renameJSON.renamed){window.location.href="EgComponentSegments.jsp?fromWizard="+fromWizard;}else{Ext.Msg.alert(renameJSON.rename,renameJSON.message);
}}}});},handleDeleteIconClick:function(b,e,a){var c=Ext.getCmp("gridDisplay").getStore().getAt(e);var d=c.get("Segmentname");Ext.Msg.show({title:mainPageTitle,msg:publicJSON["screenLabels"]["deleteiconMsg1"]+' "'+d+'" '+publicJSON["screenLabels"]["deleteiconMsg2"],icon:"iconConfirmation",buttons:Ext.Msg.YESNO,fn:function(f){if(f=="yes"){var g="Segments/data/EgdelsegmentpJson.jsp?segment="+encodeURIComponent(d)+"&destiny=segments&reqfrom=navlink";
Ext.Ajax.request({url:g,method:"POST",async:false,success:function(i){if(i.status==200&&!Ext.isEmpty(i.responseText)){var h=i.responseText;var k=Ext.decode(h);var j=k["deleteSegment"];if(j=="true"){window.location.href="EgComponentSegments.jsp?fromWizard="+fromWizard;}else{Ext.Msg.show({title:mainPageTitle,msg:k["screenLabels"]["admin.error.ErrorInDeletingSegment"]+".",icon:"iconExclamation",buttons:Ext.Msg.OK});
}}}});}}});},handleDeleteSelected:function(){var e=Ext.getCmp("gridDisplay").getSelectionModel().getSelection();var b="";var f=new Array();var a="";if(e==""){Ext.MessageBox.show({title:mainPageTitle,msg:publicJSON["screenLabels"]["no segment selected"]+".",icon:"iconExclamation",buttons:Ext.Msg.OK});
return false;}for(var d=0;d<e.length;d++){b=e[d];id=b.get("Segmentname");if(id!=null){f.push(id);}}for(var c=0;c<f.length;c++){a+=f[c]+",";}Ext.Msg.show({title:mainPageTitle,msg:publicJSON["screenLabels"]["deleteforSelectedMessage"],icon:"iconConfirmation",buttons:Ext.Msg.YESNO,fn:function(g){if(g=="yes"){var h="Segments/data/EgdelsegmentpJson.jsp?segment="+encodeURIComponent(a)+"&destiny=segments&reqfrom=navlink";
Ext.Ajax.request({url:h,method:"POST",async:false,success:function(j){if(j.status==200&&!Ext.isEmpty(j.responseText)){var i=j.responseText;var l=Ext.decode(i);var k=l["deleteSegment"];if(k=="true"){window.location.href="EgComponentSegments.jsp?fromWizard="+fromWizard;}else{Ext.Msg.alert(mainPageTitle,l["screenLabels"]["admin.error.ErrorInDeletingSegment"]+".");
}}}});}}});},buildFieldData:function(){Ext.Ajax.request({url:"Segments/data/EgDispSegmentsJson.jsp?reqfrom=navlink&fromWizard="+fromWizard,method:"POST",async:false,success:function(a){if(a.status==200&&!Ext.isEmpty(a.responseText)){var b=a.responseText;publicJSON=Ext.decode(b);}}});},loadTopologyFrame:function(a,c){btnText="Edit";
var b=this.getController("Segments.controller.ConfigSegmentControl");Ext.getCmp("viewport").removeAll();Ext.getCmp("viewport").add({xtype:"componentsegment"});b.afterMainRender("modify",a,c);},afterMainRender:function(){if(pageFrom=="topology"){this.loadTopologyFrame(segmentName,zoneName);}else{if((returnTo!=null&&returnTo!="null"&&returnTo=="segments")||returnToMain=="true"||returnTo=="userpage"||returnTo=="comp_mng_umng"||returnTo=="agg_mng_umng"||returnTo=="discovery_mng_umng"||returnTo=="comp_add_modify"||returnTo=="comp_add_mod_new"){var b=this.getController("Segments.controller.ConfigSegmentControl");
Ext.getCmp("viewport").removeAll();Ext.getCmp("viewport").add({xtype:"componentsegment"});b.afterMainRender("modify",segmentName,zoneName);return;}var a=publicJSON["gridValues"];Ext.getCmp("gridDisplay").show();Ext.getCmp("gridDisplay").getStore().suspendEvents(true);Ext.getCmp("gridDisplay").getStore().loadRawData(a);
Ext.getCmp("gridDisplay").getStore().resumeEvents();if(publicJSON["disableAddSeg"]==="true"){Ext.getCmp("NoExtPresent").show();Ext.getCmp("gridDisplay").hide();}else{Ext.getCmp("NoExtPresent").hide();Ext.getCmp("gridDisplay").show();}var c=publicJSON["NoExtFound"];if(c=="true"){Ext.getCmp("gridSearch").disable();
}else{Ext.getCmp("gridSearch").enable();}}},mainGridSearch:function(b){var a=Ext.getCmp("gridSearch").getValue();if(a==""||a.length==0){Ext.get("MyTrigger_0").setStyle("display","none");Ext.get("MyTrigger_1").setStyle("display","block");}else{Ext.get("MyTrigger_1").setStyle("display","none");Ext.get("MyTrigger_0").setStyle("display","block");
}Ext.Ajax.request({url:"Segments/data/EgDispSegmentsJson.jsp?egTitleSearchStr="+encodeURIComponent(parent.filterEncode(a))+"&fromWizard="+fromWizard,method:"POST",success:function(c){if(c.status==200&&!Ext.isEmpty(c.responseText)){var e=c.responseText;publicJSON=Ext.decode(e);}var d=publicJSON["gridValues"];
Ext.getCmp("gridDisplay").show();if(d!=null&&d.length>0){Ext.getCmp("gridDisplay").store.loadData(publicJSON["gridValues"]);}else{Ext.getCmp("gridDisplay").store.loadData("");Ext.getCmp("gridDisplay").getView().emptyText='<div class="egFlexCenterByColumnWise" style="height:98%"><div class="iconInformation"></div><div class="commonErrorMsgText">'+srchVal+".</div></div>";
Ext.getCmp("gridDisplay").getView().refresh();}}});},addSegment:function(){var b=publicJSON["screenLabels"]["isValid"];if(b=="false"){Ext.Msg.show({title:pageTitle,msg:publicJSON["screenLabels"]["admin.common.ErroInAddingSegment"]+".",icon:"iconExclamation",buttons:Ext.Msg.OK});}else{var a=this.getController("Segments.controller.ConfigSegmentControl");
Ext.getCmp("viewport").removeAll();Ext.getCmp("viewport").add({xtype:"componentsegment"});a.afterMainRender("add","aa","all");}},autoTopologyPreview:function(){window.location.href="EgDispAutoTopology.jsp?fromWizard="+fromWizard;},validateName:function(){Ext.EventManager.on("backbutton","mousedown",function(g,f,b){proceed=false;
},this);if(proceed){var a=Ext.getCmp("segmentName").getValue();if(a!=null&&a.trim().length>0){if(this.specialCharacterCheck(a)){Ext.Msg.show({title:pageTitle,msg:publicJSON["screenLabels"]["admin.common.special characters not allowed"]+".",icon:"iconExclamation",buttons:Ext.Msg.OK,fn:function(){Ext.getCmp("segmentName").focus();
}});return false;}Ext.Ajax.request({url:"Segments/data/EgAdminTopologyJson.jsp?mode="+publicJSON["mode"]+"&segment="+encodeURIComponent(a)+"&validate=firsttime"+"&returnToMain="+returnToMain+"&mainUrl="+mainUrl,method:"POST",async:false,success:function(b){if(b.status==200&&!Ext.isEmpty(b.responseText)){var d=b.responseText;
var e=Ext.decode(d);var c=e["screenLabels"]["isValid"];if(c=="false"){Ext.getCmp("compTypeCombo").disable();Ext.getCmp("assocZoneCombo").disable();Ext.getCmp("segmentName").focus();Ext.Msg.show({title:pageTitle,msg:e["screenLabels"]["admin.common.ErroInAddingSegment"]+".",icon:"iconExclamation",buttons:Ext.Msg.OK});
return false;}else{Ext.getCmp("assocZoneCombo").enable();Ext.getCmp("compTypeCombo").enable();}}}});}}else{this.backbutton();}},comboLoad:function(){var a=Ext.getCmp("segmentNameCombo").getValue();var c="all";var b=this.getController("Segments.controller.ConfigSegmentControl");b.afterMainRender("modify",a,c);
},multiselectLoad:function(c){var f=publicJSON["mode"];var a=Ext.getCmp("componentsList").getValue();var i="";var b="";if(f=="add"){i=Ext.getCmp("segmentName").getValue();b="true";}else{if(f=="modify"){i=Ext.getCmp("segmentNameCombo").getValue();b="false";}}var h="";if(Ext.getCmp("assocZoneCombo").getValue()!=undefined){h=Ext.getCmp("assocZoneCombo").getValue();
}var j=Ext.getCmp("association").getValue();var e=Ext.getCmp("compTypeCombo").getValue();var g=this.validation();if(g){var d=new Ext.LoadMask(Ext.getBody(),{msg:"Loading..."});d.show();Ext.Ajax.request({url:"Segments/data/EgAdminTopologyJson.jsp?mode="+f+"&segment="+encodeURIComponent(i)+"&newsegment="+encodeURIComponent(b)+"&zone="+encodeURIComponent(h)+"&showIndOnlyParam="+!j+"&comptype="+encodeURIComponent(e)+"&compname="+encodeURIComponent(a)+"&validate=true"+"&returnToMain="+returnToMain+"&mainUrl="+mainUrl,method:"POST",success:function(k){d.hide();
if(k.status==200&&!Ext.isEmpty(k.responseText)){var m=k.responseText;publicJSON=Ext.decode(m);}var l=publicJSON["screenLabels"]["isValid"];if(l=="false"){Ext.Msg.alert(pageTitle,publicJSON["screenLabels"]["admin.common.ErroInAddingSegment"]);Ext.getCmp("assocZoneCombo").setValue(Ext.getCmp("assocZoneCombo").getStore().getAt(0));
return false;}else{if(c==undefined||c=="undefined"){if(e!="-1"){Ext.getCmp("itemselectHostsForSegment").getStore().suspendEvents(true);Ext.getCmp("itemselectHostsForSegment").getStore().loadRawData(publicJSON["itemSelectorValue"]);Ext.getCmp("itemselectHostsForSegment").getStore().resumeEvents();Ext.getCmp("itemselectHostsForSegment").setValue(publicJSON["associatedComponentsArr"]);
}}else{Ext.getCmp("itemselectHostsForSegment").getStore().suspendEvents(true);Ext.getCmp("itemselectHostsForSegment").getStore().loadRawData(publicJSON["itemSelectorValue"]);Ext.getCmp("itemselectHostsForSegment").getStore().resumeEvents();Ext.getCmp("itemselectHostsForSegment").setValue(publicJSON["associatedComponentsArr"]);
}}if(publicJSON.isSearchNeededForFromField==true){Ext.getCmp("searchFieldContainer").show();if(publicJSON.isSearchNeededForFromField==true){Ext.getCmp("unAssociateCmpSeacrchBox").setDisabled(false);}else{Ext.getCmp("unAssociateCmpSeacrchBox").setDisabled(true);}}else{Ext.getCmp("searchFieldContainer").hide();
}if(publicJSON.isSearchNeededForToField==true){Ext.getCmp("searchFieldContainer").show();if(publicJSON.isSearchNeededForToField==true){Ext.getCmp("associateCmpSeacrchBox").setDisabled(false);}else{Ext.getCmp("associateCmpSeacrchBox").setDisabled(true);}}else{Ext.getCmp("searchFieldContainer").hide();
}}});}else{Ext.getCmp("assocZoneCombo").setValue(Ext.getCmp("assocZoneCombo").getStore().getAt(0));}},checkBoxLoad:function(){var d=publicJSON["mode"];var h="";var b="";if(d=="add"){h=Ext.getCmp("segmentName").getValue();b="true";}else{if(d=="modify"){h=Ext.getCmp("segmentNameCombo").getValue();b="false";
}}var f="";if(Ext.getCmp("assocZoneCombo").getValue()!=undefined){f=Ext.getCmp("assocZoneCombo").getValue();}var i=Ext.getCmp("association").getValue();var a=Ext.getCmp("compTypeCombo").getValue();var e=Ext.getCmp("componentsList").getValue();var g=this.validation();if(g){var c=new Ext.LoadMask(Ext.getBody(),{msg:"Loading..."});
c.show();Ext.Ajax.request({url:"Segments/data/EgAdminTopologyJson.jsp?mode="+d+"&segment="+encodeURIComponent(h)+"&newsegment="+encodeURIComponent(b)+"&zone="+encodeURIComponent(f)+"&showIndOnlyParam="+!i+"&validate=true"+"&returnToMain="+returnToMain+"&mainUrl="+mainUrl,method:"POST",success:function(k){c.hide();
if(k.status==200&&!Ext.isEmpty(k.responseText)){var m=k.responseText;publicJSON=Ext.decode(m);var l=publicJSON["screenLabels"]["isValid"];if(l=="false"){Ext.Msg.show({title:pageTitle,msg:publicJSON["screenLabels"]["admin.common.ErroInAddingSegment"]+".",icon:"iconExclamation",buttons:Ext.Msg.YESNO});
Ext.getCmp("assocZoneCombo").setValue(Ext.getCmp("assocZoneCombo").getStore().getAt(0));return false;}else{Ext.getCmp("compTypeCombo").getStore().suspendEvents(true);Ext.getCmp("compTypeCombo").getStore().clearFilter(true);Ext.getCmp("compTypeCombo").getStore().loadRawData(publicJSON["ComponentTypeList"]);
Ext.getCmp("compTypeCombo").getStore().resumeEvents();if(a=="-1"){a=publicJSON["SelectedComponentType"];}if(!Ext.isEmpty(a)){var j=Ext.getCmp("compTypeCombo").getStore().findRecord("valueField",a);if(!Ext.isEmpty(j)){Ext.getCmp("compTypeCombo").setValue(a);}else{Ext.getCmp("compTypeCombo").setValue("-1");
}}else{Ext.getCmp("compTypeCombo").setValue("-1");}if(d=="modify"){appCnt.compTypeLoad();}Ext.getCmp("componentsList").getStore().loadRawData(publicJSON["ComponentList"]);if(e=="-1"){e=publicJSON["SelectedComponent"];}if(!Ext.isEmpty(e)){var j=Ext.getCmp("componentsList").getStore().findRecord("valueField",e);
if(!Ext.isEmpty(j)){Ext.getCmp("componentsList").setValue(e);}else{Ext.getCmp("componentsList").setValue("-1");}}else{Ext.getCmp("componentsList").setValue("-1");}if(d=="modify"){appCnt.multiselectLoad();}if(a!="-1"){Ext.getCmp("itemselectHostsForSegment").getStore().suspendEvents(true);Ext.getCmp("itemselectHostsForSegment").getStore().loadRawData(publicJSON["itemSelectorValue"]);
Ext.getCmp("itemselectHostsForSegment").getStore().resumeEvents();Ext.getCmp("itemselectHostsForSegment").setValue(publicJSON["associatedComponentsArr"]);}}}}});}else{Ext.getCmp("assocZoneCombo").setValue(Ext.getCmp("assocZoneCombo").getStore().getAt(0));}this.compTypeLoad();},compTypeLoad:function(){var d=publicJSON["mode"];
var h="";var a="";if(d=="add"){h=Ext.getCmp("segmentName").getValue();a="true";}else{if(d=="modify"){h=Ext.getCmp("segmentNameCombo").getValue();a="false";}}var f="";if(Ext.getCmp("assocZoneCombo").getValue()!=undefined){f=Ext.getCmp("assocZoneCombo").getValue();}var i=Ext.getCmp("association").getValue();
var c=Ext.getCmp("compTypeCombo").getValue();var e=Ext.getCmp("componentsList").getValue();var g=this.validation();if(g){var b=new Ext.LoadMask(Ext.getBody(),{msg:"Loading..."});b.show();Ext.Ajax.request({url:"Segments/data/EgAdminTopologyJson.jsp?mode="+d+"&segment="+encodeURIComponent(h)+"&newsegment="+encodeURIComponent(a)+"&zone="+encodeURIComponent(f)+"&showIndOnlyParam="+!i+"&comptype="+encodeURIComponent(c)+"&validate=true"+"&returnToMain="+returnToMain+"&mainUrl="+mainUrl,method:"POST",success:function(k){b.hide();
if(k.status==200&&!Ext.isEmpty(k.responseText)){var m=k.responseText;publicJSON=Ext.decode(m);}var l=publicJSON["screenLabels"]["isValid"];if(l=="false"){Ext.Msg.show({title:pageTitle,msg:publicJSON["screenLabels"]["admin.common.ErroInAddingSegment"]+".",icon:"iconExclamation",buttons:Ext.Msg.OK});Ext.getCmp("compTypeCombo").setValue("-1");
return false;}else{Ext.getCmp("componentsList").getStore().suspendEvents(true);Ext.getCmp("componentsList").getStore().clearFilter(true);Ext.getCmp("componentsList").getStore().removeAll();Ext.getCmp("componentsList").getStore().loadRawData(publicJSON["ComponentList"]);Ext.getCmp("componentsList").getStore().resumeEvents();
Ext.getCmp("componentsList").setFieldLabel(startComp);if(e=="-1"){e=publicJSON["SelectedComponent"];}if(!Ext.isEmpty(e)){var j=Ext.getCmp("componentsList").getStore().findRecord("valueField",e);if(!Ext.isEmpty(j)){Ext.getCmp("componentsList").setValue(e);}else{Ext.getCmp("componentsList").setValue("-1");
}}else{Ext.getCmp("componentsList").setValue("-1");}if(e!="-1"){appCnt.multiselectLoad(Ext.getCmp("componentsList"));}Ext.getCmp("itemselectHostsForSegment").getStore().suspendEvents(true);Ext.getCmp("itemselectHostsForSegment").getStore().loadRawData(publicJSON["itemSelectorValue"]);Ext.getCmp("itemselectHostsForSegment").getStore().resumeEvents();
Ext.getCmp("itemselectHostsForSegment").setValue(publicJSON["associatedComponentsArr"]);}}});}else{Ext.getCmp("compTypeCombo").getStore().clearFilter(true);Ext.getCmp("compTypeCombo").setValue("-1");}},zoneComboLoad:function(c){var e=publicJSON["mode"];var h="";var b="";if(e=="add"){if(!Ext.isEmpty(Ext.getCmp("segmentName").getValue())){h=Ext.getCmp("segmentName").getValue();
}else{h="aa";}b="true";}else{if(e=="modify"){h=Ext.getCmp("segmentNameCombo").getValue();b="false";}}var g="";if(Ext.getCmp("assocZoneCombo").getValue()!=undefined){g=Ext.getCmp("assocZoneCombo").getValue();}var i=Ext.getCmp("association").getValue();var a=Ext.getCmp("compTypeCombo").getValue();var f=Ext.getCmp("componentsList").getValue();
var d=new Ext.LoadMask(Ext.getBody(),{msg:"Loading..."});d.show();Ext.Ajax.request({url:"Segments/data/EgAdminTopologyJson.jsp?mode="+e+"&segment="+encodeURIComponent(h)+"&newsegment="+encodeURIComponent(b)+"&zone="+encodeURIComponent(g)+"&showIndOnlyParam="+!i+"&validate=true"+"&returnToMain="+returnToMain+"&mainUrl="+mainUrl,method:"POST",success:function(k){d.hide();
if(k.status==200&&!Ext.isEmpty(k.responseText)){var m=k.responseText;publicJSON=Ext.decode(m);}var l=publicJSON["screenLabels"]["isValid"];if(l=="false"){Ext.Msg.show({title:pageTitle,msg:publicJSON["screenLabels"]["admin.common.ErroInAddingSegment"]+".",icon:"iconExclamation",buttons:Ext.Msg.OK});Ext.getCmp("assocZoneCombo").setValue(Ext.getCmp("assocZoneCombo").getStore().getAt(0));
return false;}else{Ext.getCmp("compTypeCombo").getStore().suspendEvents(true);Ext.getCmp("compTypeCombo").getStore().clearFilter(true);Ext.getCmp("compTypeCombo").getStore().loadRawData(publicJSON["ComponentTypeList"]);Ext.getCmp("compTypeCombo").getStore().resumeEvents();if(a=="-1"){a=publicJSON["SelectedComponentType"];
}if(!Ext.isEmpty(a)){var j=Ext.getCmp("compTypeCombo").getStore().findRecord("valueField",a);if(!Ext.isEmpty(j)){Ext.getCmp("compTypeCombo").setValue(a);}else{Ext.getCmp("compTypeCombo").setValue("-1");}}else{Ext.getCmp("compTypeCombo").setValue("-1");}if(e=="modify"){appCnt.compTypeLoad();}Ext.getCmp("componentsList").getStore().suspendEvents(true);
Ext.getCmp("componentsList").getStore().clearFilter(true);Ext.getCmp("componentsList").getStore().loadRawData(publicJSON["ComponentList"]);Ext.getCmp("componentsList").getStore().resumeEvents();if(f=="-1"){f=publicJSON["SelectedComponent"];}if(!Ext.isEmpty(f)){var j=Ext.getCmp("componentsList").getStore().findRecord("valueField",f);
if(!Ext.isEmpty(j)){Ext.getCmp("componentsList").setValue(f);}else{Ext.getCmp("componentsList").setValue("-1");}}else{Ext.getCmp("componentsList").setValue("-1");}if(e=="modify"){appCnt.multiselectLoad();}Ext.getCmp("itemselectHostsForSegment").getStore().suspendEvents(true);Ext.getCmp("itemselectHostsForSegment").getStore().loadRawData(publicJSON["itemSelectorValue"]);
Ext.getCmp("itemselectHostsForSegment").getStore().resumeEvents();Ext.getCmp("itemselectHostsForSegment").setValue(publicJSON["associatedComponentsArr"]);}}});return true;},deleteSegment:function(){var g=publicJSON["mode"];var c=Ext.getCmp("componentsList").getValue();var f="";var b="";if(g=="add"){f=Ext.getCmp("segmentName").getValue();
b="true";}else{if(g=="modify"){f=Ext.getCmp("segmentNameCombo").getValue();b="false";}}var e="";if(Ext.getCmp("assocZoneCombo").getValue()!=undefined){e=Ext.getCmp("assocZoneCombo").getValue();}var a=Ext.getCmp("association").getValue();var d=Ext.getCmp("compTypeCombo").getValue();Ext.Ajax.request({url:"Segments/data/EgAdminTopologyJson.jsp?mode="+g+"&segment="+encodeURIComponent(f)+"&newsegment="+encodeURIComponent(b)+"&zone="+encodeURIComponent(e)+"&showIndOnlyParam="+!a+"&comptype="+encodeURIComponent(d)+"&compname="+encodeURIComponent(c)+"&returnToMain="+returnToMain+"&mainUrl="+mainUrl,method:"POST",async:false,success:function(h){if(h.status==200&&!Ext.isEmpty(h.responseText)){var j=h.responseText;
publicJSON=Ext.decode(j);var i=publicJSON["site_associated"];var k=publicJSON["zone_associated"];if(i=="false"&&k=="false"){Ext.Msg.confirm("Segment",publicJSON["screenLabels"]["admin.common.Delete Segment"],function(l){if(l=="yes"){Ext.Ajax.request({url:"Segments/data/EgdelsegmentpJson.jsp?qctr="+publicJSON["qctr"]+"&segment="+encodeURIComponent(f)+"&destiny=segments"+"&comptype="+encodeURIComponent(d)+"&compname="+encodeURIComponent(c)+"&zone="+encodeURIComponent(e)+"&zoneAssociated="+k+"&reqfrom=navlink",method:"POST",async:false,success:function(m){if(m.status==200&&!Ext.isEmpty(m.responseText)){var n=m.responseText;
var p=Ext.decode(n);var o=p["deleteSegment"];if(o=="true"){if(returnToMain=="true"){if(!Ext.isEmpty(mainUrl)){if(mainUrl.indexOf(".jsp?")!=-1){mainUrl+="&fromWizard="+fromWizard;}else{mainUrl+="?fromWizard="+fromWizard;}}window.location.href=mainUrl;return;}else{if(returnTo=="userpage"){window.location.href=backHref+"&username="+username+"&selectedTab=3"+"&fromWizard="+fromWizard;
return;}else{if(returnTo=="comp_mng_umng"){window.location.href="EgConfigEnv.jsp?srvtype="+comptype+"&activeCompTypes="+activeCompTypes+"&fromWizard="+fromWizard;return;}else{if(returnTo=="agg_mng_umng"){window.location.href="aggConfigEnv.jsp?srvtype="+comptype+"&activeCompTypes="+activeCompTypes+"&fromWizard="+fromWizard;
return;}else{if(returnTo=="discovery_mng_umng"){window.location.href="EgDiscoveryPane.jsp?server="+comptype+"&activeCompTypes="+activeCompTypes+"&selectedNode=node11"+"&fromWizard="+fromWizard;return;}else{if(returnTo=="comp_add_modify"){window.location.href="EgDispServer.jsp?comptype="+comptype+"&activeCompTypes="+activeCompTypes+"&fromWizard="+fromWizard;
return;}else{if(returnTo=="comp_add_mod_new"){window.location.href="EgAdminOperations.jsp?server="+comptype+"&fromAction="+fromAction+"&classify="+classify;return;}}}}}}}if(pageFrom=="topology"){window.location.href="EgAutoTopology.jsp";}else{window.location.href="EgComponentSegments.jsp?fromWizard="+fromWizard;
}}else{Ext.Msg.show({title:pageTitle,msg:p["screenLabels"]["admin.error.ErrorInDeletingSegment"]+".",icon:"iconExclamation",buttons:Ext.Msg.OK});return false;}}}});}});}else{Ext.Ajax.request({url:"Segments/data/EgdelsegmentpJson.jsp?qctr="+publicJSON["qctr"]+"&segment="+encodeURIComponent(f)+"&destiny=topology"+"&comptype="+encodeURIComponent(d)+"&compname="+encodeURIComponent(c)+"&zone="+encodeURIComponent(publicJSON["HiddenValues"]["zone"])+"&zoneAssociated="+k+"&reqfrom=navlink",method:"POST",async:false,success:function(l){if(l.status==200&&!Ext.isEmpty(l.responseText)){var m=l.responseText;
var o=Ext.decode(m);var n=o["deleteSegment"];if(n=="false"){Ext.Msg.show({title:pageTitle,msg:o["screenLabels"]["admin.error.ErrorInDeletingSegment"]+".",icon:"iconExclamation",buttons:Ext.Msg.OK});return false;}else{if(n=="true"){if(returnToMain=="true"){if(!Ext.isEmpty(mainUrl)){if(mainUrl.indexOf(".jsp?")!=-1){mainUrl+="&fromWizard="+fromWizard;
}else{mainUrl+="?fromWizard="+fromWizard;}}window.location.href=mainUrl;return;}else{if(returnTo=="userpage"){window.location.href=backHref+"&username="+username+"&selectedTab=3"+"&fromWizard="+fromWizard;return;}else{if(returnTo=="comp_mng_umng"){window.location.href="EgConfigEnv.jsp?srvtype="+comptype+"&activeCompTypes="+activeCompTypes+"&fromWizard="+fromWizard;
return;}else{if(returnTo=="agg_mng_umng"){window.location.href="aggConfigEnv.jsp?srvtype="+comptype+"&activeCompTypes="+activeCompTypes+"&fromWizard="+fromWizard;return;}else{if(returnTo=="discovery_mng_umng"){window.location.href="EgDiscoveryPane.jsp?server="+comptype+"&activeCompTypes="+activeCompTypes+"&selectedNode=node11"+"&fromWizard="+fromWizard;
return;}else{if(returnTo=="comp_add_modify"){window.location.href="EgDispServer.jsp?comptype="+comptype+"&activeCompTypes="+activeCompTypes+"&fromWizard="+fromWizard;return;}else{if(returnTo=="comp_add_mod_new"){window.location.href="EgAdminOperations.jsp?server="+comptype+"&fromAction="+fromAction+"&classify="+classify;
return;}}}}}}}if(pageFrom=="topology"){window.location.href="EgAutoTopology.jsp";}else{window.location.href="EgComponentSegments.jsp?fromWizard="+fromWizard;}}}}}});}}}});},manageGrpComponent:function(){var l;try{l=window.frames;}catch(j){l=document.frames;}var d=Ext.getCmp("topologyMaxFrame");var n="";
var b="";var g="";if(d==undefined){n=l[0].document.getElementById("segment").value;b=l[0].document.getElementById("h_cmpName").value;g=l[0].document.getElementById("h_status").value;}else{n=l[1].document.getElementById("segment").value;b=l[1].document.getElementById("h_cmpName").value;g=l[1].document.getElementById("h_status").value;
}var c=window.frames[0].document.body.scrollHeight;var p=[];var m=Ext.getCmp("GrpDetailsDisplay").getStore();var i=Ext.getCmp("GrpDetailsDisplay").getSelectionModel();var k=b;if(b.endsWith(":NULL")){k=k.replace(":NULL","");}m.each(function(r){var q=r.get("CompVal");var e=i.isSelected(r);if(e){p.push(q);
}});var a="AutoTopology/data/EgAutoManageComponentsJson.jsp?segment="+encodeURIComponent(n)+"&grpname="+b+"&compStatus="+encodeURIComponent(g)+"&groupNameVal="+encodeURIComponent(b);var h="AutoTopology/data/EgTopologyGroupDetailsJson.jsp?index=details&grptitle="+encodeURIComponent(k)+"&segment="+encodeURIComponent(n)+"&compName="+encodeURIComponent(b);
var o=p.toString();if(o!=null&&o.length>0){var f="manageGrpComp";a=a+"&test="+o+"&action="+f+"&fromPage=configSegment";Ext.Ajax.request({url:a,method:"POST",async:false,success:function(t){if(t.status==200&&!Ext.isEmpty(t.responseText)){var r=t.responseText;var z=Ext.decode(r);var q=z["isManagedComp"];
var e=z["msgString"];var y=z["isNewCompExceedLicense"];if(q==true){Ext.MessageBox.show({title:grpDetails,msg:managedCompAlert,buttons:Ext.Msg.OK,icon:"iconInformation",width:300,fn:function(A){var B=Ext.WindowManager.getActive();if(B){B.close();}this.showGroupDetails(k);}});}else{if(y==true){var x=Ext.WindowManager.getActive();
if(x){x.close();}Ext.widget("managedcomponents").show();if(z["callBasicErrorPage"]==true){var s=z["ErrorMessage"];var w=z["licenseMsg"];var v=s+""+w;var u='<div class="error_panel" style="text-align:center"><div style="margin:0px auto;align:center;width:50px" class="iconExclamation"></div>'+v+"</div>";
Ext.getCmp("errorMsg").setText(u,false);Ext.getCmp("ErrorMessage").show();}}else{Ext.MessageBox.show({title:grpDetails,msg:"Group has been added successfully.",buttons:Ext.Msg.OK,icon:"iconInformation",width:300,fn:function(B){var D=Ext.WindowManager.getActive();if(D){D.close();}var C=Ext.getCmp("discComp").checked;
if(d==undefined){window.frames[0].newDiscComp(C);}else{var A=window.frames[0].openBigDiv(C);Ext.getCmp("topologyMaxFrame").update('<iframe src="'+A+'" style="width:1308px;border:0px" height='+c+' scrolling="no"></iframe>');window.frames[0].newDiscComp(C);}}});}}Ext.widget("groupdetails").hide();}}});
}else{Ext.Msg.alert(grpDetails,selectComptoManage);}},removeGrpComponent:function(){var j;try{j=window.frames;}catch(r){j=document.frames;}var c="";var h="";var f="";var n=Ext.getCmp("topologyMaxFrame");if(n==undefined){c=j[0].document.getElementById("segment").value;f=j[0].document.getElementById("h_cmpName").value;
h=j[0].document.getElementById("h_status").value;}else{c=j[1].document.getElementById("segment").value;f=j[1].document.getElementById("h_cmpName").value;h=j[1].document.getElementById("h_status").value;}var l=window.frames[0].document.body.scrollHeight;var a=f;if(f.endsWith(":NULL")){a=a.replace(":NULL","");
}var s=[];var g=Ext.getCmp("GrpDetailsDisplay").getStore();var m=Ext.getCmp("GrpDetailsDisplay").getSelectionModel();var k=Ext.getCmp("GrpDetailsDisplay").getStore().getCount();var o=Ext.getCmp("GrpDetailsDisplay").getSelectionModel().getSelection().length;g.each(function(u){var t=u.get("CompVal");var e=m.isSelected(u);
if(e){s.push(t);}});var p="removeGrpComp";var d="AutoTopology/data/EgAutoManageComponentsJson.jsp?segment="+encodeURIComponent(c)+"&action="+encodeURIComponent(p)+"&compname="+encodeURIComponent(f)+"&compStatus="+h;var b="AutoTopology/data/EgTopologyGroupDetailsJson.jsp?index=details&grptitle="+encodeURIComponent(a)+"&segment="+encodeURIComponent(c)+"&compName="+encodeURIComponent(f)+"&compStatus="+h;
var q="/final/admin/AutoTopology/data/EgAutoTopologyMainPageD3JS.jsp?index=main&segment="+encodeURI(c);var i=s.toString();if((k-o)==0){Ext.Msg.alert(pageTitle,associateAtleastOneComp);}else{if(i!=null&&i.length>0){d=d+"&removeComp="+i;Ext.Ajax.request({url:d,method:"POST",async:false,success:function(t){if(t.status==200&&!Ext.isEmpty(t.responseText)){var e=t.responseText;
var u=Ext.decode(e);Ext.MessageBox.show({title:grpDetails,msg:dissociateMsg,buttons:Ext.Msg.OK,icon:"iconInformation",width:300,fn:function(v){Ext.Ajax.request({url:b,method:"POST",async:false,success:function(y){if(y.status==200&&!Ext.isEmpty(y.responseText)){var B=y.responseText;var D=Ext.decode(B);
var x=D["GroupDetails"];var z=Ext.getCmp("GrpDetailsDisplay").getStore();z.suspendEvents(true);z.clearFilter(true);z.loadRawData(D["GroupDetails"]);z.resumeEvents();var C=Ext.WindowManager.getActive();if(C){C.close();}var A=Ext.getCmp("discComp").checked;if(n==undefined){window.frames[0].newDiscComp(A);
}else{var w=window.frames[0].openBigDiv(A);Ext.getCmp("topologyMaxFrame").update('<iframe src="'+w+'" style="width:1308px;border:0px" height='+l+' scrolling="no"></iframe>');window.frames[0].newDiscComp(A);}}}});}});}Ext.widget("groupdetails").hide();}});}else{if(i.length<=0){Ext.Msg.alert(grpDetails,selectComptoDissociate);
}}}},renameBtnClick:function(){var c=Ext.getCmp("currentname").getValue();var f=Ext.getCmp("newname").getValue();var g="renameGrpName";var e=Ext.getCmp("topologyMaxFrame");var b=window.frames[0].document.body.scrollHeight;var h="";if(e==undefined){h=frames[0].document.getElementById("h_status").value;
}else{h=frames[1].document.getElementById("h_status").value;}if(f==""||f.length==0){Ext.Msg.show({title:renameTitle,msg:lblNoBlank,icon:"iconExclamation",buttons:Ext.Msg.OK});return;}else{if(c==f){Ext.Msg.show({title:renameTitle,msg:lblSameName,icon:"iconExclamation",buttons:Ext.Msg.OK});return;}else{if(f.indexOf(" ")==0||f.lastIndexOf(" ")==f.length-1){Ext.Msg.alert(renameTitle,segmentnameSpaceValMsg1+".");
return false;}else{if(f.indexOf("  ")>-1){Ext.Msg.alert(renameTitle,segmentnameSpaceValMsg2+".");return false;}}}}var j="`~!@#$%^&*()+={}[]|\\:;\"'<>,?/";var i=publicJSON["isDouble"];for(count=0;count<f.length;count++){var k=j.indexOf(f.charAt(count));if(!i){var d=f.charCodeAt(count);if(d>255){Ext.Msg.show({title:renameTitle,msg:lblNoDBL,icon:"iconExclamation",buttons:Ext.Msg.OK});
return false;}}if(k>=0){Ext.Msg.show({title:renameTitle,msg:lblNoSplChar,icon:"iconExclamation",buttons:Ext.Msg.OK});return false;}}var a="AutoTopology/data/EgAutoManageComponentsJson.jsp?action="+encodeURIComponent(g)+"&old_name="+encodeURIComponent(c)+"&new_name="+encodeURIComponent(f)+"&compStatus="+h;
Ext.Ajax.request({url:a,method:"POST",async:false,success:function(m){if(m.status==200&&!Ext.isEmpty(m.responseText)){var l=m.responseText;renameJSON=Ext.decode(m.responseText);if(renameJSON.renamed){Ext.MessageBox.show({title:renameGrpTitle,msg:renameJSON.message,buttons:Ext.Msg.OK,icon:"iconInformation",width:300,fn:function(o){var q=Ext.WindowManager.getActive();
if(q){q.close();}var p=Ext.getCmp("discComp").checked;if(e==undefined){window.frames[0].newDiscComp(p);}else{var n=window.frames[0].openBigDiv(p);Ext.getCmp("topologyMaxFrame").update('<iframe src="'+n+'" style="width:1308px;border:0px" height='+b+' scrolling="no"></iframe>');window.frames[0].newDiscComp(p);
}}});}else{Ext.Msg.show({title:renameGrpTitle,msg:renameJSON.message,icon:"iconInformation",buttons:Ext.Msg.OK});}}Ext.widget("renamegroup").hide();}});},specialCharacterCheck:function(d){var b="`~!@#$%^&*()+={}[]|\\:;\"'<>,?/";try{for(count=0;count<d.length;count++){var a=b.indexOf(d.charAt(count));
if(a>=0){return true;}}}catch(c){}return false;},validation:function(){var f=publicJSON["mode"];var e="";if(f=="add"){e=Ext.getCmp("segmentName").getValue();}else{if(f=="modify"){e=Ext.getCmp("segmentNameCombo").getValue();}}var d="`~!@#$%^&*()+={}[]|\\:;\"'<>,?/";var b=publicJSON["isDouble"];if(e==null||e.length==0){Ext.Msg.show({title:pageTitle,msg:publicJSON["screenLabels"]["admin.common.Please enter a name"]+".",icon:"iconExclamation",buttons:Ext.Msg.OK,fn:function(){Ext.getCmp("segmentName").focus();
}});return false;}else{if(e.indexOf(" ")==0||e.lastIndexOf(" ")==e.length-1){Ext.Msg.show({title:pageTitle,msg:segmentnameSpaceValMsg1+".",buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(g){Ext.getCmp("segmentName").focus();}});return false;}if(e.indexOf("  ")>-1){Ext.Msg.show({title:pageTitle,msg:segmentnameSpaceValMsg2+".",buttons:Ext.Msg.OK,icon:"iconExclamation",fn:function(g){Ext.getCmp("segmentName").focus();
}});return false;}for(count=0;count<e.length;count++){var c=d.indexOf(e.charAt(count));if(!b){var a=e.charCodeAt(count);if(a>255){Ext.Msg.show({title:pageTitle,msg:publicJSON["screenLabels"]["admin.common.DBL not allowed"]+".",icon:"iconExclamation",buttons:Ext.Msg.OK,fn:function(){Ext.getCmp("segmentName").focus();
}});return false;}}if(c>=0){Ext.Msg.show({title:pageTitle,msg:publicJSON["screenLabels"]["admin.common.special characters not allowed"]+".",icon:"iconExclamation",buttons:Ext.Msg.OK,fn:function(){Ext.getCmp("segmentName").focus();}});return false;}else{if(e=="independent_servers"){Ext.Msg.show({title:pageTitle,msg:publicJSON["screenLabels"]["admin.common.Cannot add segment by name"]+".",icon:"iconExclamation",buttons:Ext.Msg.OK,fn:function(){Ext.getCmp("segmentName").focus();
}});return false;}}}}return true;},searchComponent:function(a,i,k,n){var j=this,b=n;var g=publicJSON["mode"];var d=Ext.getCmp("componentsList").getValue();var l="";var c="";if(g=="add"){l=Ext.getCmp("segmentName").getValue();c="true";}else{if(g=="modify"){l=Ext.getCmp("segmentNameCombo").getValue();c="false";
}}var h="";if(Ext.getCmp("assocZoneCombo").getValue()!=undefined){h=Ext.getCmp("assocZoneCombo").getValue();}var m=Ext.getCmp("association").getValue();var e=Ext.getCmp("compTypeCombo").getValue();if(i==""||i.length==0){Ext.get("MyTrigger_"+b+"_0").setStyle("display","none");Ext.get("MyTrigger_"+b+"_1").setStyle("display","block");
}else{Ext.get("MyTrigger_"+b+"_1").setStyle("display","none");Ext.get("MyTrigger_"+b+"_0").setStyle("display","block");}var f="";if(i.length==0||i=="Search"){f="Segments/data/EgAdminTopologyJson.jsp?mode="+g+"&segment="+encodeURIComponent(l)+"&newsegment="+encodeURIComponent(c)+"&zone="+encodeURIComponent(h)+"&showIndOnlyParam="+!m+"&comptype="+encodeURIComponent(e)+"&compname="+encodeURIComponent(d)+"&validate=true"+"&returnToMain="+returnToMain+"&mainUrl="+mainUrl;
}else{f="Segments/data/EgAdminTopologyJson.jsp?mode="+g+"&segment="+encodeURIComponent(l)+"&newsegment="+encodeURIComponent(c)+"&zone="+encodeURIComponent(h)+"&showIndOnlyParam="+!m+"&comptype="+encodeURIComponent(e)+"&compname="+encodeURIComponent(d)+"&validate=true"+"&strSearch="+encodeURIComponent(i)+"&searchType="+k+"&strComponent="+a+"&returnToMain="+returnToMain+"&mainUrl="+mainUrl;
}Ext.Ajax.request({url:f,method:"POST",success:function(o){if(o.status==200&&!Ext.isEmpty(o.responseText)){var p=o.responseText;publicJSON=Ext.decode(p);}Ext.getCmp("itemselectHostsForSegment").getStore().suspendEvents(true);Ext.getCmp("itemselectHostsForSegment").getStore().loadRawData(publicJSON["itemSelectorValue"]);
Ext.getCmp("itemselectHostsForSegment").getStore().resumeEvents();Ext.getCmp("itemselectHostsForSegment").setValue(publicJSON["associatedComponentsArr"]);}});}});function OpenManageDiv(b,f){var d=Ext.getCmp("segmentNameCombo").getValue();var c="NEW";var e="EgNewServer.jsp?server=new&from=inventory&compstatus="+encodeURIComponent(c)+"&serverType="+encodeURIComponent(b)+"&allExternalTests=true&from=addnew&isAggregateLink=false&frmTopology=yes&frmPage=configSeg&comptitle="+encodeURIComponent(f)+"&topoSegName="+encodeURIComponent(d);
var a;if(!a){a=new Ext.Window({layout:"fit",title:"Manage components",id:"manageWindow",listeners:{"beforedestroy":function(){assignNewComp(b,f);}},closeAction:"destroy",width:850,padding:"5 10 10 10",height:550,border:false,html:'<iframe id="newCompId" width="100%" src='+e+' style="height:100%;border:0" scrolling="no"></iframe>',});
}a.show();}function assignNewComp(a,f){var e=Ext.getCmp("topologyMaxFrame");var d=window.frames[0].document.body.scrollHeight;var c=Ext.getCmp("segmentNameCombo").getValue();var b="Segments/data/EgAdminTopologyJson.jsp?&comptype="+encodeURIComponent(a)+"&compname="+encodeURIComponent(f)+"&fromAction=newComp"+"&segment="+c;
Ext.Ajax.request({url:b,method:"POST",success:function(i){if(i.status==200&&!Ext.isEmpty(i.responseText)){var k=i.responseText;publicJSON=Ext.decode(k);var h=publicJSON["isNewCompManged"];if(h){var j=Ext.getCmp("discComp").checked;if(e==undefined){window.frames[0].newDiscComp(j);}else{var g=window.frames[0].openBigDiv(j);
Ext.getCmp("topologyMaxFrame").update('<iframe src="'+g+'" style="width:1308px;border:0px" height='+d+' scrolling="no"></iframe>');window.frames[0].newDiscComp(j);}}}}});}function closedManagedWindow(){var a=Ext.getCmp("manageWindow");if(a!=null&&a!=undefined){a.destroy();}}function showGroupDetails(e){var g=Ext.getCmp("topologyMaxFrame");
var d="";var c="";if(g==undefined){d=frames[0].document.getElementById("h_cmpName").value;c=frames[0].document.getElementById("h_status").value;}else{d=frames[1].document.getElementById("h_cmpName").value;c=frames[1].document.getElementById("h_status").value;}var b=[];var f=[];Ext.widget("groupdetails").show();
Ext.getCmp("GrpDetailsHeader").update('<center><img src="/final/images/spacer.gif" class="iconAdminInfo" valign="middle" style="margin-right:2px"/>&nbsp;'+grpDetailsMsg+" "+"<b>"+e+"</b>"+" "+"</center>");var a="AutoTopology/data/EgTopologyGroupDetailsJson.jsp?index=details&grptitle="+encodeURIComponent(e)+"&compName="+encodeURIComponent(d)+"&compStatus="+c;
Ext.Ajax.request({url:a,method:"POST",async:false,success:function(h){if(h.status==200&&!Ext.isEmpty(h.responseText)){var k=h.responseText;var j=Ext.decode(k);var l=j["manageBtnDis"];var i=Ext.getCmp("GrpDetailsDisplay").getStore();i.suspendEvents(true);i.loadRawData(j["GroupDetails"]);i.resumeEvents();
i.each(function(n){var m=n.get("compstatus");if(m.startsWith("#")){b.push(m);}else{if(m.startsWith("*")){f.push(m);}}});if(b.length<=0){Ext.getCmp("unmanagemsg").hide();}if(f.length<=0){Ext.getCmp("discmsg").hide();}if(f.length<=0&&b.length<=0){Ext.getCmp("msgbox").hide();}if(l=="disablebtn"){Ext.getCmp("addBtn").setDisabled(true);
}}}});}function showRename(){var d;try{d=window.frames;}catch(b){d=document.frames;}var c=Ext.getCmp("topologyMaxFrame");var a="";if(c==undefined){a=d[0].document.getElementById("h_cmpName").value;}else{a=d[1].document.getElementById("h_cmpName").value;}Ext.widget("renamegroup").show();if(a.endsWith(":NULL")){a=a.replace(":NULL","");
}Ext.getCmp("currentname").setValue(a);}function manageGrpFunction(b){var d=Ext.getCmp("topologyMaxFrame");var c=window.frames[0].document.body.scrollHeight;var a="false";b=b+"&enableDrag="+encodeURIComponent(a)+"&index=main&com.eg.CSRF_NONCE="+csrfToken;Ext.Ajax.request({url:b,method:"POST",async:false,success:function(h){if(h.status==200&&!Ext.isEmpty(h.responseText)){var f=h.responseText;
var m=Ext.decode(f);var j=m["status"];var k=m["grpStatus"];var l=m["grpStatusMsg"];if(l.startsWith("Result:")){l=l.replace("Result:","");}var g=m["filePath"];if(j!="eG_CLI_0030"){Ext.Msg.show({title:pageTitle,msg:compErrMsg1+"<br>"+compErrMsg2+"<br>"+g,buttons:Ext.Msg.OK,icon:"iconExclamation"});}else{if(k!="eG_CLI_Res_0323"){Ext.Msg.show({title:pageTitle,msg:l,buttons:Ext.Msg.OK,icon:"iconExclamation"});
}else{if(k=="eG_CLI_Res_0323"){Ext.Msg.show({title:pageTitle,msg:l,buttons:Ext.Msg.OK,icon:"iconInformation"});}}}var e=Ext.getCmp("discComp").checked;if(d==undefined){window.frames[0].newDiscComp(e);}else{var i=window.frames[0].openBigDiv(e);Ext.getCmp("topologyMaxFrame").update('<iframe src="'+i+'" style="width:1308px;border:0px" height='+c+' scrolling="no"></iframe>');
window.frames[0].newDiscComp(e);}}}});}function openAssign(a,f){var d=Ext.getCmp("segmentNameCombo").getValue();var e=Ext.getCmp("topologyMaxFrame");var c=window.frames[0].document.body.scrollHeight;var b="Segments/data/EgAdminTopologyJson.jsp?&comptype="+encodeURIComponent(a)+"&compname="+encodeURIComponent(f)+"&fromAction=newComp"+"&segment="+d;
Ext.Ajax.request({url:b,method:"POST",success:function(h){if(h.status==200&&!Ext.isEmpty(h.responseText)){var i=h.responseText;publicJSON=Ext.decode(i);var g=publicJSON["isNewCompManged"];if(g){Ext.Msg.show({title:pageTitle,msg:assignComp,buttons:Ext.Msg.OK,icon:"iconInformation",fn:function(k){var l=Ext.getCmp("discComp").checked;
if(e==undefined){window.frames[0].newDiscComp(l);}else{var j=window.frames[0].openBigDiv(l);Ext.getCmp("topologyMaxFrame").update('<iframe src="'+j+'" style="width:1308px;border:0px" height='+c+' scrolling="no"></iframe>');window.frames[0].newDiscComp(l);}}});}}}});}