var configOpnWinCnt=0;var disablerefresh=false;var alarmsortbaleby;var coloumns=new Ext.util.HashMap();var sortbyalarm="";var orderbyalarm="";var longestAlarms="";var searchAck=false;Ext.Loader.setConfig({enabled:true,disableCaching:false,preserveScripts:true,garbageCollect:true});function parseWrdfrHtml(b){if(b.indexOf("<span class='linkText'>")>-1){var a=b.replace(/(<([^>]+)>)/ig,"");
return a;}return b;}function get_browser_info(){var b=navigator.userAgent,a,c=b.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i)||[];if(/trident/i.test(c[1])){a=/\brv[ :]+(\d+)/g.exec(b)||[];return{name:"IE ",version:(a[1]||"")};}if(c[1]==="Chrome"){a=b.match(/\bOPR\/(\d+)/);if(a!=null){return{name:"Opera",version:a[1]};
}}c=c[2]?[c[1],c[2]]:[navigator.appName,navigator.appVersion,"-?"];if((a=b.match(/version\/(\d+)/i))!=null){c.splice(1,1,a[1]);}return{name:c[0],version:c[1]};}function urlParamReplace(c){var d=null;var f=c.substring(c.indexOf("?")+1);d=c.substring(0,c.indexOf("?"))+"?";var e=f.split("&");if(e!=null&&e.length>0){for(var b=0;
b<e.length;b++){if(e[b].indexOf("screenWidth")>-1||e[b].indexOf("screenHeight")>-1||e[b].indexOf("isBro")>-1||e[b].indexOf("maxDurationAlarmIds")>-1||e[b].indexOf("isFromQuickLink")>-1){}else{if(b<e.length-1){d=d+e[b]+"&";}else{d=d+e[b];}}}}return d;}Ext.Ajax.timeout=58000;Ext.Loader.setPath("Ext.ux","/final/scripts/ux");
Ext.Loader.setPath("utilities","/final/scripts/utilities");Ext.require("Ext.ux.form.ItemSelector");Ext.require("Ext.ux.form.MultiSelectSI");Ext.application({name:"currentAlarms",requires:["currentAlarms.view.Main","Ext.data.NodeStore","utilities.Multiselector","Ext.ux.form.MultiSelectSI"],appFolder:"../monitor/eg_scripts/currentAlarmsApp",controllers:["currentAlarms.controller.Main"],launch:function(){currentAlmsApp=this;
var a=get_browser_info();Ext.Ajax.request({url:"/final/servlet/com.eg.EgCurrentAlarmsC",method:"POST",params:defaultParams+"&screenWidth="+(Ext.getBody().getViewSize().width)+"&screenHeight="+(Ext.getBody().getViewSize().height)+"&isBro="+a.name+"&maxDurationAlarmIds="+maxDurationAlarmIds+"&isFromQuickLink="+isFromQuickLink,scope:this,success:function(e){var j=JSON.parse(e.responseText);
publicJson=j;if(!Ext.isEmpty(publicJson["History_Alarms"])||!Ext.isEmpty(publicJson["Current_Alarms"])){if(!Ext.isEmpty(publicJson["History_Alarms"])){if(publicJson["History_Alarms"]=="NO_DATA"){publicJson["History_Alarms"]=[];}var g=Ext.create("Ext.data.Store",{fields:["STATE","COMPONENT","DESCRIPTION","START_TIME","DURATION","LINK"],data:publicJson["History_Alarms"],});
var b=Ext.create("Ext.grid.Panel",{id:"HistoryAlarmsGrid",cls:"gridSkin",autoScroll:true,scroll:true,defaults:{flex:1},layout:"fit",frame:false,padding:0,store:g,margin:"10 5 0 5",stateful:true,collapsible:false,multiSelect:true,stripeRows:false,viewConfig:{emptyText:'<div style="display:table;height:98%;width:100%" ><div style="display:table-cell;vertical-align:middle;text-align:center;"><div style="margin:auto;" class="iconNoalarms"></div><div> No Alarms found </div></div></div>',deferEmptyText:false,},columns:{defaults:{sortable:false,draggable:true,hideable:false,style:{"border-bottom":"0px !important"}},items:[{dataIndex:"STATE",width:30,renderer:function(p){var o="<div style='margin-right:6px;margin-top:1px' class='state_"+p+"'></div>";
return o;}},{text:"Component",dataIndex:"COMPONENT",flex:0.7,sortable:false,},{text:"Description",dataIndex:"DESCRIPTION",flex:1.3,sortable:false,},{text:"StartTime",dataIndex:"START_TIME",width:170,sortable:false,},{text:"Duration",dataIndex:"DURATION",width:100,sortable:false,},{dataIndex:"LINK",xtype:"actioncolumn",flex:0.2,items:[{icon:"",tooltip:"graph",getClass:function(q,p,o){var r=o.raw.LINK.graph;
if(Ext.isEmpty(r)||r==null||r=="-"){return"iconSpacer mouseOverRemove";}else{return"iconLineChart actionIcon";}},handler:function(t,s,u,v,r,q,w){var p=q.raw.LINK.graph;var o=q.raw.LINK.dd;this.fireEvent("itemClick",loadPopup(p));},},{icon:"",tooltip:"dd",getClass:function(q,p,o){var r=o.raw.LINK.dd;if(Ext.isEmpty(r)||r==null||r=="-"){return"iconSpacer actionIcon mouseOverRemove";
}else{return"iconDiagnosis actionIcon";}},handler:function(p,v,q,r,s,o,u){var t=o.raw.LINK.dd;this.fireEvent("itemClick",loadPopup(t));},}]}]},listeners:{resize:function(){var o=Ext.getCmp("HistoryAlarmsGrid");var q=$("#currentalarmsmain").height();var p=$("#currentalarmsmain").width();o.setHeight(q-20);
o.setWidth(p-20);},render:function(){var o=Ext.getCmp("HistoryAlarmsGrid");}},});if(!Ext.isEmpty(Ext.get("alarmloadmask"))){Ext.get("alarmloadmask").remove();}var h=this;var c=true;var f="0 0 5 0";if(isPopupWindow!=null&&isPopupWindow=="true"){AlarmsMainTitle="";c=false;f="0 0 -5 0";}if(hideBackButton==false){f="0 0 0 0";
}var n=[{xtype:"main",header:false,margin:f,items:[b],}];if(Ext.isEmpty(publicJson["History_Alarms"])){n=[{xtype:"fieldset",margin:"10 5 0 5",html:'<div style="height:100%;width:100%;display:table"><div class="msgFont" style="display:table-cell;vertical-align:middle"> <div class="iconNoalarms" style="margin:0px auto"></div><div style="text-align:center"> No Alarms found</div></div></div>',}];
}Ext.create("Ext.container.Viewport",{layout:"fit",items:n,});}else{if(!Ext.isEmpty(publicJson["Current_Alarms"])){if(publicJson["Current_Alarms"]=="NO_DATA"){publicJson["Current_Alarms"]=[];}var g=Ext.create("Ext.data.Store",{fields:["STATE","COMPONENT","DESCRIPTION","TEST","LAYER","START_TIME","LINK"],data:publicJson["Current_Alarms"],});
var b=Ext.create("Ext.grid.Panel",{id:"CurrentAlarmsGrid",cls:"gridSkin",autoScroll:true,scroll:true,defaults:{flex:1},layout:"fit",frame:false,padding:0,store:g,margin:"10 5 0 5",stateful:true,collapsible:false,multiSelect:true,stripeRows:false,viewConfig:{emptyText:'<div style="display:table;height:98%;width:100%" ><div style="display:table-cell;vertical-align:middle;text-align:center;"><div style="margin:auto;" class="iconNoalarms"></div><div>  No Alarms found </div></div></div>',deferEmptyText:false,},columns:{defaults:{sortable:false,draggable:true,hideable:false,style:{"border-bottom":"0px !important"}},items:[{dataIndex:"STATE",width:30,renderer:function(p){var o="<div style='margin-right:6px;margin-top:1px' class='state_"+p+"'></div>";
return o;}},{text:"Component",dataIndex:"COMPONENT",flex:0.7,sortable:true,renderer:function(s,p,o,u,r,q,t){if(!Ext.isEmpty(o)&&o.hasOwnProperty("raw")&&o.raw.hasOwnProperty("LAYERMODELLINK")&&!Ext.isEmpty(o.raw.LAYERMODELLINK)){p.tdCls="egShowTip";s="<a href=\"javascript:wayToLayerModel('"+o.raw.LAYERMODELLINK+"')\">"+s+"</a>";
}return s;}},{text:"Description",dataIndex:"DESCRIPTION",flex:1.1,sortable:true,renderer:function(s,p,o,u,r,q,t){if(!Ext.isEmpty(o)&&o.hasOwnProperty("raw")&&o.raw.hasOwnProperty("LAYERMODELLINK")&&!Ext.isEmpty(o.raw.LAYERMODELLINK)){p.tdCls="egShowTip";s="<a href=\"javascript:wayToLayerModel('"+o.raw.LAYERMODELLINK+"')\">"+s+"</a>";
}return s;}},{text:"Test",dataIndex:"TEST",width:150,sortable:true,renderer:function(s,p,o,u,r,q,t){if(!Ext.isEmpty(o)&&o.hasOwnProperty("raw")&&o.raw.hasOwnProperty("LAYERMODELLINK")&&!Ext.isEmpty(o.raw.LAYERMODELLINK)){p.tdCls="egShowTip";s="<a href=\"javascript:wayToLayerModel('"+o.raw.LAYERMODELLINK+"')\">"+s+"</a>";
}return s;}},{text:"Layer",dataIndex:"LAYER",width:170,sortable:true,renderer:function(s,p,o,u,r,q,t){if(!Ext.isEmpty(o)&&o.hasOwnProperty("raw")&&o.raw.hasOwnProperty("LAYERMODELLINK")&&!Ext.isEmpty(o.raw.LAYERMODELLINK)){p.tdCls="egShowTip";s="<a href=\"javascript:wayToLayerModel('"+o.raw.LAYERMODELLINK+"')\">"+s+"</a>";
}return s;}},{text:"StartTime",dataIndex:"START_TIME",width:150,sortable:true,renderer:function(s,p,o,u,r,q,t){if(!Ext.isEmpty(o)&&o.hasOwnProperty("raw")&&o.raw.hasOwnProperty("LAYERMODELLINK")&&!Ext.isEmpty(o.raw.LAYERMODELLINK)){p.tdCls="egShowTip";s="<a href=\"javascript:wayToLayerModel('"+o.raw.LAYERMODELLINK+"')\">"+s+"</a>";
}return s;}},{dataIndex:"LINK",xtype:"actioncolumn",flex:0.2,items:[{icon:"",tooltip:"graph",getClass:function(q,p,o){var r=o.raw.LINK.graph;if(Ext.isEmpty(r)||r==null||r=="-"){return"iconSpacer mouseOverRemove";}else{return"iconLineChart actionIcon";}},handler:function(t,s,u,v,r,q,w){var p=q.raw.LINK.graph;
var o=q.raw.LINK.dd;this.fireEvent("itemClick",loadPopup(p));},},{icon:"",tooltip:"dd",getClass:function(q,p,o){var r=o.raw.LINK.dd;if(Ext.isEmpty(r)||r==null||r=="-"){return"iconSpacer actionIcon mouseOverRemove";}else{return"iconDiagnosis actionIcon";}},handler:function(p,v,q,r,s,o,u){var t=o.raw.LINK.dd;
this.fireEvent("itemClick",loadPopup(t));},}]}]},listeners:{resize:function(){var o=Ext.getCmp("CurrentAlarmsGrid");var q=$("#currentalarmsmain").height();var p=$("#currentalarmsmain").width();o.setHeight(q-20);o.setWidth(p-20);},render:function(){var o=Ext.getCmp("CurrentAlarmsGrid");}},});if(!Ext.isEmpty(Ext.get("alarmloadmask"))){Ext.get("alarmloadmask").remove();
}var h=this;var c=true;var f="0 0 5 0";if(isPopupWindow!=null&&isPopupWindow=="true"){AlarmsMainTitle="";c=false;f="0 0 -5 0";}if(hideBackButton==false){f="0 0 0 0";}var n=[{xtype:"main",header:false,margin:f,items:[b],}];if(Ext.isEmpty(publicJson["Current_Alarms"])){n=[{xtype:"fieldset",margin:"10 5 0 5",html:'<div style="height:100%;width:100%;display:table"><div class="msgFont" style="display:table-cell;vertical-align:middle"> <div class="iconNoalarms" style="margin:0px auto"></div><div style="text-align:center"> No Alarms found</div></div></div>',}];
}Ext.create("Ext.container.Viewport",{layout:"fit",items:n,});}else{if(!Ext.isEmpty(Ext.get("alarmloadmask"))){Ext.get("alarmloadmask").remove();}var l=Ext.create("Ext.container.Viewport",{layout:"fit",cls:"uxFieldsetNew",renderTo:Ext.getBody(),margin:"10 5 0 5",items:[{xtype:"fieldset",id:"errFieldset",defaults:{anchor:"100%"},layout:"anchor",collapsible:false,title:"",html:'<div style="height:100%;width:100%;display:table"><div class="msgFont" style="display:table-cell;vertical-align:middle"> <div class="iconNoalarms" style="margin:0px auto"></div><div style="text-align:center"> No Alarms found</div></div></div>'}]});
}}}else{if(publicJson["pageParams"]["alarmType"]=="longestAlarms"){longestAlarms=publicJson["pageParams"]["selectedShowOption"];disablerefresh=true;}if(!Ext.isEmpty(Ext.get("alarmloadmask"))){Ext.get("alarmloadmask").remove();}var i=a.name;if(!Ext.isEmpty(i)&&i!=null&&i!=undefined&&i.indexOf("IE")!=-1){var k=window.parent.Ext.getCmp("btnCloseId");
var m=window.parent.Ext.getCmp("btnMaxId");var d=window.parent.Ext.getCmp("btnHelpId");if(!Ext.isEmpty(k)&&k!=null&&k!=undefined){k.enable();}if(!Ext.isEmpty(m)&&m!=null&&m!=undefined){m.enable();}if(!Ext.isEmpty(d)&&d!=null&&d!=undefined){d.enable();}}var h=this;var c=true;var f="0 0 5 0";if(isPopupWindow!=null&&isPopupWindow=="true"){AlarmsMainTitle="";
c=false;f="0 0 0 0";}if(hideBackButton==false){f="0 0 0 0";}Ext.create("Ext.container.Viewport",{layout:"fit",items:[{xtype:"main",header:false,margin:f}]});setTimeout(function(){currentAlmsApp.getController("Main").refreshAlarms(metaRefreshUrl);},refreshFreq);if(!newWindowAlarm){setInterval(function(){this.parent.window.location.href="/final/egm?entry=monitor&displayTab=all&uname=&integritycheckviolated=false";
},dashboardRefreshFreq);}}}});}});