/*! For license information please see module-3.bundle.js.LICENSE.txt */
"use strict";(self.webpackChunkapplication=self.webpackChunkapplication||[]).push([[555],{779:(e,t,s)=>{s.r(t),s.d(t,{default:()=>o});var i=s(178),r=s(669);class o extends i.BaseModule{constructor(){super("bBoxMonitor"),this.REQ_GET_DATA="getData",this.RESP_DATA="data"}initialize(e,t){super.initialize(e,t),r("#bbm-refreshBt").on("click",r.proxy(this._onUpdateIntervalChange,this)),this._zonesFilterDD=r("#bbm-zonesDD").kendoDropDownList({autoWidth:!0,change:r.proxy(this._onFilterChange,this)}).data("kendoDropDownList"),r("#bbm-usernameIn").on("input",r.proxy(this._onFilterChange,this)),r("#bbm-clearBt").on("click",r.proxy(this._onClearFilterClick,this)),this._intervalDropDown=r("#bbm-intervalDD").kendoDropDownList({size:"small",valueTemplate:'<span class="text-secondary">Refresh every</span> <span>#:data.value#s</span>',change:r.proxy(this._onUpdateIntervalChange,this)}).data("kendoDropDownList"),r(this).kendoTooltip({filter:".show-tooltip[title]",position:"bottom",content:function(e){return`<div class='help-tooltip'>${e.target.data("title")}</div>`}}),this._grid=r("#bbm-grid").kendoGrid({scrollable:!0,sortable:!0,selectable:!1,columns:[{field:"zone",width:150,title:"Zone"},{field:"userId",width:100,title:"User Id"},{field:"userName",width:250,title:"Username"},{field:"sessionId",width:150,title:"BlueBox Session Id"},{field:"lastReq",width:100,title:"Last Request"},{field:"lastPoll",width:100,title:"Last Polling"},{field:"queueSize",width:100,title:"Queued Messages"}],noRecords:{template:"No BlueBox sessions."},dataSource:[]}).data("kendoGrid"),this._requestData()}destroy(){super.destroy(),r("#bbm-refreshBt").off("click"),r("#bbm-usernameIn").off("input"),r("#bbm-clearBt").off("click"),clearTimeout(this._requestTimer)}onExtensionCommand(e,t){if(e==this.RESP_DATA){let e=t.getSFSArray("clients"),s=[],i=[];for(let t=0;t<e.size();t++){let r=e.getSFSArray(t),o={zone:r.getString(0),userId:r.getNumber(1),userName:r.getString(2),sessionId:r.getString(3),lastReq:r.getNumber(4)+"s ago",lastPoll:r.getNumber(5)+"s ago",queueSize:r.getNumber(6)};s.push(o),i.indexOf(o.zone)<0&&i.push(o.zone)}i.sort((function(e,t){return e.localeCompare(t)})),i.unshift("[any]");let o=this._zonesFilterDD.value(),a=i.indexOf(o);a<0&&(a=0),this._zonesFilterDD.setDataSource(i),this._zonesFilterDD.select(a);const n=r(".k-grid-content",this._grid.wrapper).scrollLeft();let l=this._grid.dataSource.sort(),d=new kendo.data.DataSource({sort:l,data:s});this._setFilters(d),this._grid.setDataSource(d),r(".k-grid-content",this._grid.wrapper).scrollLeft(n),r("#bbm-totalSessions").text(s.length)}}_onUpdateIntervalChange(){this._requestData()}_onFilterChange(){this._setFilters(this._grid.dataSource)}_onClearFilterClick(){this._zonesFilterDD.select(0),r("#bbm-usernameIn").val("")}_requestData(){clearTimeout(this._requestTimer),this.smartFox.isConnected&&(this.sendExtensionRequest(this.REQ_GET_DATA),this._requestTimer=setTimeout(r.proxy(this._requestData,this),1e3*Number(this._intervalDropDown.value())))}_setFilters(e){let t=[];this._zonesFilterDD.select()>0&&t.push({field:"zone",operator:"eq",value:this._zonesFilterDD.value()}),""!=r("#bbm-usernameIn").val()&&t.push({field:"userName",operator:"contains",value:r("#bbm-usernameIn").val()}),e.filter(t),r("#bbm-displayedSessions").text(e.total())}}}}]);