github.com/minio/console@v1.4.1/web-app/build/static/js/3035.d50f543e.chunk.js (about)

     1  "use strict";(self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[3035],{13035:(e,t,n)=>{n.r(t),n.d(t,{default:()=>p});var a=n(65043),l=n(22166),s=n(89923),c=n(20554),o=n(56483),i=n(32511),r=n(68603),d=n(64159),u=n(20649),x=n(48793),h=n(55968),m=n(70579);const p=()=>{const e=(0,c.jL)(),t=(0,l.d4)((e=>e.watch.messages)),[n,p]=(0,a.useState)(!1),[b,f]=(0,a.useState)("Select Bucket"),[g,j]=(0,a.useState)(""),[w,k]=(0,a.useState)(""),[S,v]=(0,a.useState)([]);(0,a.useEffect)((()=>{u.A.invoke("GET","/api/v1/buckets").then((e=>{let t=[];null!==e.buckets&&(t=e.buckets),v(t)})).catch((e=>{console.error(e)}))}),[]),(0,a.useEffect)((()=>{if(e((0,r.n4)()),n&&S.some((e=>e.name===b))){const t=new URL(window.location.toString()),n=!1?"9090":t.port,a=new URL(document.baseURI).pathname,l=(0,i.nw)(t.protocol),s=new WebSocket("".concat(l,"://").concat(t.hostname,":").concat(n).concat(a,"ws/watch/").concat(b,"?prefix=").concat(g,"&suffix=").concat(w));let c=null;if(null!==s)return s.onopen=()=>{console.log("WebSocket Client Connected"),s.send("ok"),c=setInterval((()=>{s.send("ok")}),1e4)},s.onmessage=t=>{let n=JSON.parse(t.data.toString());n.Time=new Date(n.Time.toString()),n.key=Math.random(),e((0,r.ID)(n))},s.onclose=()=>{clearInterval(c),console.log("connection closed by server"),p(!1)},()=>{s.close(1e3),clearInterval(c),console.log("closing websockets")}}else p(!1)}),[e,n,S,b,g,w]);const y=S.map((e=>({label:e.name,value:e.name})));(0,a.useEffect)((()=>{e((0,d.ph)("watch"))}),[]);const C=y.map((e=>({label:e.label,value:e.value})));return(0,m.jsxs)(a.Fragment,{children:[(0,m.jsx)(x.A,{label:"Watch",actions:(0,m.jsx)(h.A,{})}),(0,m.jsx)(s.Mxu,{children:(0,m.jsxs)(s.xA9,{container:!0,children:[(0,m.jsxs)(s.xA9,{item:!0,xs:12,sx:{display:"flex",gap:10,marginBottom:15,alignItems:"center"},children:[(0,m.jsxs)(s.azJ,{sx:{flexGrow:1},children:[(0,m.jsx)(s.l1Y,{children:"Bucket"}),(0,m.jsx)(s.l6P,{id:"bucket-name",name:"bucket-name",value:b,onChange:e=>{f(e)},disabled:n,options:C,placeholder:"Select Bucket"})]}),(0,m.jsxs)(s.azJ,{sx:{flexGrow:1},children:[(0,m.jsx)(s.l1Y,{children:"Prefix"}),(0,m.jsx)(s.cl_,{id:"prefix-resource",disabled:n,onChange:e=>{j(e.target.value)}})]}),(0,m.jsxs)(s.azJ,{sx:{flexGrow:1},children:[(0,m.jsx)(s.l1Y,{children:"Suffix"}),(0,m.jsx)(s.cl_,{id:"suffix-resource",disabled:n,onChange:e=>{k(e.target.value)}})]}),(0,m.jsx)(s.azJ,{sx:{alignSelf:"flex-end",paddingBottom:4},children:n?(0,m.jsx)(s.$nd,{id:"stop-watch",type:"submit",variant:"callAction",onClick:()=>p(!1),label:"Stop"}):(0,m.jsx)(s.$nd,{id:"start-watch",type:"submit",variant:"callAction",onClick:()=>p(!0),label:"Start"})})]}),(0,m.jsx)(s.xA9,{item:!0,xs:12,children:(0,m.jsx)(s.bQt,{columns:[{label:"Time",elementKey:"Time",renderFunction:o.cj},{label:"Size",elementKey:"Size",renderFunction:o.nO},{label:"Type",elementKey:"Type"},{label:"Path",elementKey:"Path"}],records:t,entityName:"Watch",customEmptyMessage:"No Changes at this time",idField:"watch_table",isLoading:!1,customPaperHeight:"calc(100vh - 270px)"})})]})})]})}}}]);
     2  //# sourceMappingURL=3035.d50f543e.chunk.js.map