1import{j as t}from"./vendor-motion-Cy762vrn.js";import{r as a}from"./vendor-sentry-D7POXGpw.js";import{h as p}from"./vendor-moment-DCotJ1WP.js";import{A as x}from"./index-HE4qZLTJ.js";import{q as m,H as u,L as j}from"./index-_s6YStUd.js";import{M as g,B as y,aG as f,e as c,A as w,aa as I,T as S,m as r,Q as A,b1 as b,b2 as L}from"./vendor-antd-CoJDjQn_.js";import"./vendor-react-6nTOL8jH.js";import"./vendor-auth0-r0USk3Bl.js";class v extends a.Component{viewEpcList=(n,e)=>{g.info({title:n,width:768,content:t.jsx("pre",{children:e.map((s,o)=>t.jsxs("span",{children:[s,t.jsx("br",{})]},o))})})};render(){var{epcList:n,title:e}=this.props;return Array.isArray(n)&&t.jsxs(t.Fragment,{children:[e&&t.jsxs("small",{children:[t.jsx("b",{children:e}),t.jsx("br",{})]}),n.slice(0,5).map((s,o)=>t.jsxs("span",{children:[s,t.jsx("br",{})]},o)),n.length>5&&t.jsxs(t.Fragment,{children:["...",t.jsx("br",{}),t.jsxs("a",{onClick:()=>this.viewEpcList(e,n),children:["View all ",n.length," EPCs...",t.jsx("br",{})]})]})]})}}const{Text:R}=S;class $ extends a.Component{static contextType=x;constructor(n){super(n),this.state={actions:[]}}componentDidMount(){var{token:n,tenant:e}=this.context,{params:s,setButtons:o}=this.props;const d={readPointId:s.readPointId,tenantId:e.tenantId};var h=m.stringify(d);o(t.jsx(t.Fragment,{children:t.jsx(y,{type:"primary",icon:t.jsx(f,{}),onClick:this.clear,children:"Clear"})})),this.connection=new u().withUrl(`/hub/read-point/v1/actions?${h}`,{accessTokenFactory:()=>n}).withAutomaticReconnect({nextRetryDelayInMilliseconds:i=>Math.random()*1e4}).configureLogging(j.Warning).build(),this.connection.on("action",i=>this.addAction(i)),this.connection.onreconnected(i=>{console.log("SignalR reconnected!"),this.setState({connection:!0})}),this.connection.onclose(()=>{console.log("SignalR close!"),this.setState({connection:!1})}),this.connection.onreconnecting(()=>{console.log("SignalR reconnectingâ¦"),this.setState({connection:!1})}),this.connection.start().then(()=>this.setState({connection:!0}),i=>(this.setState({connection:!1}),console.error(i.toString())))}async componentWillUnmount(){await this.connection.stop()}addAction=n=>{var e=this.state.actions;e.unshift(n),this.setState({actions:[...e]})};clear=()=>{this.setState({actions:[]})};render(){const n=[{title:"Id",key:"readPointActionId",width:"250px",render:(e,s)=>t.jsx(R,{code:!0,children:s.readPointActionId})},{title:"Type",key:"type",width:"100px",render:(e,s)=>{switch(s.type){case"Arrive":return t.jsxs(r,{color:"green",children:[t.jsx(L,{})," Arrive"]});case"Leave":return t.jsxs(r,{color:"red",children:[t.jsx(b,{})," Leave"]});case"Stay":return t.jsxs(r,{color:"geekblue",children:[t.jsx(A,{})," Stay"]})}}},{title:"Timestamp",key:"timestamp",width:"250px",render:(e,s)=>p(s.timestamp).format("LL LTS")},{title:"EPCs",dataIndex:"epcs",width:"350px",render:(e,s)=>t.jsx(v,{epcList:s.epcHexs})}];return t.jsxs(t.Fragment,{children:[this.state.connection===!1&&t.jsx(c,{style:{marginBottom:16},children:t.jsx(w,{title:"Currently not connected to backend.",type:"error",showIcon:!0})}),t.jsx(c,{style:{marginBottom:16},children:t.jsx(I,{dataSource:this.state.actions,columns:n,rowKey:e=>e.readPointActionId,pagination:!1,size:"middle"})})]})}}export{$ as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.