var normal=0;var refresh=0;Ext.define("citrixDashboard.view.CommonGrid",{extend:"Ext.panel.Panel",alias:"widget.commongrid",autoDestroy:true,header:false,bodyPadding:"0 0 0 0",layout:"fit",margin:"0 5 5 5",alignR:"",overriderRenderer:function(d,e,c,a){var b=this;return function(f){return f;};b.callParent();
},config:{data:{},storeData:[],storefileds:[],gridColumns:[]},constructor:function(a){var b=this;b.initConfig(a);b.callParent(arguments);},loadData:function(g){var e=this;e.storefileds=[];e.storeData=[];e.gridColumns=[];if(!Ext.isEmpty(g)){if(g.title){Ext.getCmp(e.id).setTitle(g.title);}if(e.data.columns){var a=e.data.title;
for(var d=0;d<g.columns.length;d++){if(g.dataSet&&g.dataSet.items!=null){g.columns[d].renderer=e.overriderRenderer(g.columns[d],g.dataSet.items[d],g.fields,d);g.columns[d].renderer=function(p,h,l,o,r){var i,k,m;var q;try{i=e.data.dataSet.items[o].subjectVariable;k=e.data.dataSet.items[o].test+"~!~"+e.data.dataSet.items[o].measure;
m=e.data.dataSet.items[o].DESCRIPTION;if(m.indexOf("'")>0){m=m.replace("'","$quote$");}q=e.data.columns[r].dataIndex;}catch(n){}if(!Ext.isEmpty(i)&&p!="-"){var s;if(q=="HIGH"){s=q;}if(q=="INTERMEDIATE"){s=q;}if(q=="LOW"){s=q;}if(p=="HIGH"){p='<img alt="" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" style="margin-top: -1px;" class="x-action-col-icon x-action-col-0   state_HIGH">';
}else{if(p=="INTERMEDIATE"){p='<img alt="" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" style="margin-top: -1px;" class="x-action-col-icon x-action-col-0   state_INTERMEDIATE"';}else{if(p=="LOW"){p='<img alt="" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="style="margin-top: -1px;" class="x-action-col-icon x-action-col-0   state_LOW"';
}}}if(r!=0&&(e.alignR!=undefined&&e.alignR!=null&&e.alignR)){p='<div style="text-align:center">'+p+"</div>";}var j="javascript:openAlarmPopup('"+a+"','"+i+"','$"+s+"','"+k+"','"+m+"')";p='<a href="'+j+'">'+p+"</a>";}else{if(p=="HIGH"){p='<img alt="" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" style="margin-top: -1px;" class="x-action-col-icon x-action-col-0   state_HIGH">';
}else{if(p=="INTERMEDIATE"){p='<img alt="" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" style="margin-top: -1px;" class="x-action-col-icon x-action-col-0   state_INTERMEDIATE"';}else{if(p=="LOW"){p='<img alt="" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="style="margin-top: -1px;" class="x-action-col-icon x-action-col-0   state_LOW"';
}}}if(r!=0&&(e.alignR!=undefined&&e.alignR!=null&&e.alignR)){p='<div style="text-align:center">'+p+"</div>";}if(requestParams.activeView=="Applications_View"&&!Ext.isEmpty(e.data)&&!Ext.isEmpty(e.data.dataSet)&&!Ext.isEmpty(e.data.dataSet.items[o])&&!Ext.isEmpty(e.data.dataSet.items[o].layerURL)&&e.data.dataSet.items[o].layerURL!=undefined&&e.data.dataSet.items[o].layerURL!=null){p="<a href='"+e.data.dataSet.items[o].layerURL+"'>"+p+"</a>";
}}return p;};g.columns[d].menuDisabled=true;g.columns[d].draggable=false;}else{if((!Ext.isEmpty(this.iSBrro)&&this.iSBrro)||(!Ext.isEmpty(this.iSLogon)&&this.iSLogon)||requestParams.activeView=="Sessions_View"||requestParams.activeView=="sessions"){var f=g.columns[d].text;if(g.DataSet&&g.DataSet[0].data!=undefined&&g.DataSet[0].data!=null){g.columns[d].renderer=e.overriderRenderer(g.columns[d],g.DataSet[0].data,g.fields,d);
g.columns[d].renderer=function(m,i,h,o,l){if(this.columns[l].dataIndex=="Users"||this.columns[l].dataIndex=="User Name"){try{if(!Ext.isEmpty(g.DataSet[0].data[o].showSlowLogonIcon)&&g.DataSet[0].data[o].showSlowLogonIcon){m="<span><img src='../images/clear.png' class='showSlowLogonIcon' style='vertical-align: middle'/>&nbsp;"+m+"</span>";
}else{m="<span><img width='16' height='16' src='../images/clear.png' class='' style='vertical-align: middle'/>&nbsp;"+m+"</span>";}}catch(n){m="<span>"+m+"</span>";}try{if(!Ext.isEmpty(e.data.DataSet[0].data[o].linkUrl)&&e.data.DataSet[0].data[o].linkUrl!=undefined&&e.data.DataSet[0].data[o].linkUrl!=null){m="<a href='"+e.data.DataSet[0].data[o].linkUrl+"'>"+m+"</a>";
}}catch(k){}}else{if(this.columns[l].dataIndex=="Server"){try{if(!Ext.isEmpty(e.data.DataSet[0].data[o].layerLink)&&e.data.DataSet[0].data[o].layerLink!=undefined&&e.data.DataSet[0].data[o].layerLink!=null){m="<a href='"+e.data.DataSet[0].data[o].layerLink+"'>"+m+"</a>";}}catch(k){}}else{if(this.columns[l].dataIndex=="Established Sessions"){var j=h.get("Server");
if(j.indexOf(":")==-1){j+=":NULL";}try{m="<a class=ctxMouse onclick=loadView('UED','null','-','-','-','-','-','"+h.get("componentType")+":"+j+"')>"+m+"</a>";}catch(k){}}}}return m;};}}}if(e.alignR!=undefined&&e.alignR!=null&&e.alignR){var f=g.columns[d].text;if(f!=undefined&&f!=null){if(f=="alarmCritical"){g.columns[d].text='<img alt="" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" style="margin-top: -1px;" class="x-action-col-icon x-action-col-0   state_HIGH">';
}else{if(f=="alarmMajor"){g.columns[d].text='<img alt="" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" style="margin-top: -1px;" class="x-action-col-icon x-action-col-0   state_INTERMEDIATE">';}else{if(f=="alarmMinor"){g.columns[d].text='<img alt="" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" style="margin-top: -1px;" class="x-action-col-icon x-action-col-0   state_LOW">';
}}}}}}var b=e.data.columns;for(var c=0;c<b.length;c++){if(b[c].dataIndex=="USER"||b[c].dataIndex=="APPLICATION"||b[c].dataIndex=="SERVER"||b[c].dataIndex=="PROBLEM"){b[c]["align"]="center";}if(b[c].dataIndex!="USER"||b[c].dataIndex!="APPLICATION"||b[c].dataIndex!="SERVER"||b[c].dataIndex!="PROBLEM"){b[c].doSort=function(i){var h=this.up("grid").store;
var j=this.getSortParam();h.sort({property:j,direction:i,sorterFn:function(l,k){l=l.get(j);k=k.get(j);if(isNaN(l)&&isNaN(k)){return l>k?1:(l<k?-1:0);}else{l=isNaN(l)?isHyphen(l):l;l=Ext.isNumber(l)?l:parseFloat(String(l),10);k=isNaN(k)?isHyphen(k):k;k=Ext.isNumber(k)?k:parseFloat(String(k),10);return(l>k)?1:((l<k)?-1:0);
}}});};}}e.gridColumns=b;}if(g.fields){e.storefileds=g.fields;}if((!Ext.isEmpty(this.iSBrro)&&this.iSBrro)||(!Ext.isEmpty(this.ifSessions)&&this.ifSessions)||(!Ext.isEmpty(this.iSLogon)&&this.iSLogon)){if(g.DataSet&&g.DataSet[0].data!=undefined&&g.DataSet[0].data!=null&&Ext.isEmpty(g.DataSet[0].data[0].Error)){e.storeData=g.DataSet[0].data;
}}else{if(g.dataSet&&g.dataSet.items!=undefined&&g.dataSet.items!=null){e.storeData=g.dataSet.items;}}}Ext.getCmp(e.id+"_grid").suspendLayouts();Ext.getCmp(e.id+"_grid").reconfigure(Ext.getCmp(e.id+"_grid").getStore(),e.gridColumns);Ext.getCmp(e.id+"_grid").getStore().loadData(e.storeData);Ext.getCmp(e.id+"_grid").resumeLayouts(true);
Ext.getCmp(e.id+"_grid").getView().refresh();},initComponent:function(){var e=this;if(!Ext.isEmpty(e.data)){if(e.data.columns){var a=e.data.title;for(var d=0;d<e.data.columns.length;d++){if(e.data.dataSet&&e.data.dataSet.items!=undefined&&e.data.dataSet.items!=null){e.data.columns[d].renderer=e.overriderRenderer(e.data.columns[d],e.data.dataSet.items[d],e.data.fields,d);
e.data.columns[d].renderer=function(o,g,k,n,q){var h,j,l;var p;try{h=e.data.dataSet.items[n].subjectVariable;j=e.data.dataSet.items[n].test+"~!~"+e.data.dataSet.items[n].measure;l=e.data.dataSet.items[n].DESCRIPTION;if(l.indexOf("'")>0){l=l.replace("'","$quote$");}p=e.data.columns[q].dataIndex;}catch(m){}if(!Ext.isEmpty(h)&&o!="-"){var r;
if(p=="HIGH"){r=p;}if(p=="INTERMEDIATE"){r=p;}if(p=="LOW"){r=p;}if(o=="HIGH"){o='<img alt="" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" style="margin-top: -1px;" class="x-action-col-icon x-action-col-0   state_HIGH">';}else{if(o=="INTERMEDIATE"){o='<img alt="" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" style="margin-top: -1px;" class="x-action-col-icon x-action-col-0   state_INTERMEDIATE"';
}else{if(o=="LOW"){o='<img alt="" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="style="margin-top: -1px;" class="x-action-col-icon x-action-col-0   state_LOW"';}}}if(q!=0&&(e.alignR!=undefined&&e.alignR!=null&&e.alignR)){o='<div style="text-align:center">'+o+"</div>";
}var i="javascript:openAlarmPopup('"+a+"','"+h+"','$"+r+"','"+j+"','"+l+"')";o='<a href="'+i+'">'+o+"</a>";}else{if(o=="HIGH"){o='<img alt="" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" style="margin-top: -1px;" class="x-action-col-icon x-action-col-0   state_HIGH">';
}else{if(o=="INTERMEDIATE"){o='<img alt="" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" style="margin-top: -1px;" class="x-action-col-icon x-action-col-0   state_INTERMEDIATE"';}else{if(o=="LOW"){o='<img alt="" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="style="margin-top: -1px;" class="x-action-col-icon x-action-col-0   state_LOW"';
}}}if(q!=0&&(e.alignR!=undefined&&e.alignR!=null&&e.alignR)){o='<div style="text-align:center">'+o+"</div>";}if(requestParams.activeView=="Applications_View"&&!Ext.isEmpty(e.data)&&!Ext.isEmpty(e.data.dataSet)&&!Ext.isEmpty(e.data.dataSet.items[n])&&!Ext.isEmpty(e.data.dataSet.items[n].layerURL)&&e.data.dataSet.items[n].layerURL!=undefined&&e.data.dataSet.items[n].layerURL!=null){o="<a href='"+e.data.dataSet.items[n].layerURL+"'>"+o+"</a>";
}}return o;};e.data.columns[d].menuDisabled=true;e.data.columns[d].draggable=false;}else{if((!Ext.isEmpty(this.iSBrro)&&this.iSBrro)||(!Ext.isEmpty(this.iSLogon)&&this.iSLogon)||requestParams.activeView=="Sessions_View"||requestParams.activeView=="sessions"||requestParams.activeView=="Alerts_View"){var f=e.data.columns[d].text;
if(e.data.DataSet&&e.data.DataSet[0].data!=undefined&&e.data.DataSet[0].data!=null){e.data.columns[d].renderer=e.overriderRenderer(e.data.columns[d],e.data.DataSet[0].data,e.data.fields,d);e.data.columns[d].renderer=function(l,h,g,n,k){if(this.columns[k].dataIndex=="Users"||this.columns[k].dataIndex=="User Name"){try{if(!Ext.isEmpty(e.data.DataSet[0].data[n].showSlowLogonIcon)&&e.data.DataSet[0].data[n].showSlowLogonIcon){l="<span><img src='../images/clear.png' class='showSlowLogonIcon' style='vertical-align: middle'/>&nbsp;"+l+"</span>";
}else{l="<span><img width='16' height='16' src='../images/clear.png' class='' style='vertical-align: middle'/>&nbsp;"+l+"</span>";}}catch(m){l="<span>"+l+"</span>";}try{if(!Ext.isEmpty(e.data.DataSet[0].data[n].linkUrl)&&e.data.DataSet[0].data[n].linkUrl!=undefined&&e.data.DataSet[0].data[n].linkUrl!=null){l="<a href='"+e.data.DataSet[0].data[n].linkUrl+"'>"+l+"</a>";
}}catch(j){}}else{if(this.columns[k].dataIndex=="Server"){try{if(!Ext.isEmpty(e.data.DataSet[0].data[n].layerLink)&&e.data.DataSet[0].data[n].layerLink!=undefined&&e.data.DataSet[0].data[n].layerLink!=null){l="<a href='"+e.data.DataSet[0].data[n].layerLink+"'>"+l+"</a>";}}catch(j){}}else{if(this.columns[k].dataIndex=="Established Sessions"){var i=g.get("Server");
if(i.indexOf(":")==-1){i+=":NULL";}try{l="<a class=ctxMouse onclick=loadView('UED','null','-','-','-','-','-','"+g.get("componentType")+":"+i+"')>"+l+"</a>";}catch(j){}}}}return l;};}}}if(e.alignR!=undefined&&e.alignR!=null&&e.alignR){var f=e.data.columns[d].text;if(f!=undefined&&f!=null){if(f=="alarmCritical"){e.data.columns[d].text='<img alt="" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" style="height:17px !important;position:relative" class="x-action-col-icon x-action-col-0   state_HIGH">';
}else{if(f=="alarmMajor"){e.data.columns[d].text='<img alt="" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" style="height:17px !important;position:relative" class="x-action-col-icon x-action-col-0   state_INTERMEDIATE">';}else{if(f=="alarmMinor"){e.data.columns[d].text='<img alt="" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" style="height:17px !important;position:relative" class="x-action-col-icon x-action-col-0   state_LOW">';
}}}}}}var b=e.data.columns;for(var c=0;c<b.length;c++){if(b[c].dataIndex=="USER"||b[c].dataIndex=="APPLICATION"||b[c].dataIndex=="SERVER"||b[c].dataIndex=="PROBLEM"){b[c]["align"]="center";}if(b[c].dataIndex!="USER"||b[c].dataIndex!="APPLICATION"||b[c].dataIndex!="SERVER"||b[c].dataIndex!="PROBLEM"){b[c].doSort=function(h){var g=this.up("grid").store;
var i=this.getSortParam();g.sort({property:i,direction:h,sorterFn:function(k,j){k=k.get(i);j=j.get(i);if(isNaN(k)&&isNaN(j)){return k>j?1:(k<j?-1:0);}else{k=isNaN(k)?isHyphen(k):k;k=Ext.isNumber(k)?k:parseFloat(String(k),10);j=isNaN(j)?isHyphen(j):j;j=Ext.isNumber(j)?j:parseFloat(String(j),10);return(k>j)?1:((k<j)?-1:0);
}}});};}}e.gridColumns=b;}if(e.data.fields){e.storefileds=e.data.fields;}if((!Ext.isEmpty(this.iSBrro)&&this.iSBrro)||(!Ext.isEmpty(this.ifSessions)&&this.ifSessions)||(!Ext.isEmpty(this.iSLogon)&&this.iSLogon)){if(e.data.DataSet&&e.data.DataSet[0].data!=undefined&&e.data.DataSet[0].data!=null&&Ext.isEmpty(e.data.DataSet[0].data[0].Error)){e.storeData=e.data.DataSet[0].data;
}}else{if(e.data.dataSet&&e.data.dataSet.items!=undefined&&e.data.dataSet.items!=null){e.storeData=e.data.dataSet.items;}}}e.items=e.loadGrid();e.callParent();},loadGrid:function(){var c=this;var e=true;var d="auto";if(this.iSBrro){e=false;d="scroll";}var a='<div style="display:table;height:98%;width:100%" ><div style="display:table-cell;vertical-align:middle;text-align:center;"><div style="margin:auto;" class="iconInformation"></div><div>No Data Found!</div></div></div>';
if(c.iSAlerts!=undefined&&c.iSAlerts!=null&&c.iSAlerts){a='<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 Alerts Found!</div></div></div>';}if(c.data.hasOwnProperty("DataSet")&&c.data.DataSet[0].hasOwnProperty("data")&&c.data.DataSet[0].data[0].hasOwnProperty("Error")){a='<div style="display:table;height:98%;width:100%" ><div style="display:table-cell;vertical-align:middle;text-align:center;"><div style="margin:auto;" class="iconInformation"></div><div>'+c.data.DataSet[0].data[0].Error+"</div></div></div>";
}if(c.data.hasOwnProperty("errorMsg")&&!Ext.isEmpty(c.data.errorMsg)){a='<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>'+c.data.errorMsg+"</div></div></div>";}var b=Ext.create("Ext.grid.Panel",{flex:1,ui:"newGridPanel",border:true,frame:false,id:c.id+"_grid",height:170,header:false,scroll:true,autoScroll:true,overflowX:d,dockedItems:[{xtype:"label",hidden:e,html:'<span class="font_normal11 fontStyleRobotRegular" style="float:right">Last '+c.data.timeline+"</span>",height:"15px"}],style:{},columnLines:true,store:new Ext.create("Ext.data.Store",{fields:c.storefileds,data:c.storeData}),viewConfig:{emptyText:a,deferEmptyText:false,},columns:c.gridColumns});
return b;}});