github.com/minio/console@v1.4.1/web-app/build/static/js/6164.c2cd952a.chunk.js (about) 1 "use strict";(self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[6164],{96164:(e,s,n)=>{n.r(s),n.d(s,{default:()=>v});var t=n(65043),l=n(89923),i=n(22166),o=n(20554),r=n(32511),a=n(3883),d=n(64159),c=n(64681),x=n(20649),g=n(24241),h=n(33097),p=n.n(h),j=n(70579);const m="HH:mm:ss ZZZZ MM/dd/yyyy",u=e=>{const{log:s}=e,[n,i]=(0,t.useState)(!1),o=e=>p()(s,e,"");let r="",a=o("ConsoleMsg"),d=o("error.message");""!==a?r=a:""!==d&&(r=d);let c=(r||"").replace(/\u2501|\u250f|\u2513|\u2503|\u2517|\u251b/g,"");c=c.replace(/([^\x20-\x7F])/g,"");let x=(0,j.jsx)(t.Fragment,{});""!==a?x=(e=>{let s=e.ConsoleMsg;return s=s.replace(/\x1B/g," "),s=s.replace(/((\[[0-9;]+m))/g,""),(0,j.jsx)("div",{style:{display:"table",tableLayout:"fixed",width:"100%",paddingLeft:10,paddingRight:10},children:(0,j.jsx)("div",{style:{display:"table-cell",whiteSpace:"nowrap",textOverflow:"ellipsis",overflowX:"auto"},children:(0,j.jsx)("pre",{children:s})})})})(s):""!==d&&(x=(e=>{const s={color:"#C83B51",fontWeight:400,fontFamily:"monospace",fontSize:"12px"},n={fontFamily:"monospace",fontSize:"12px"},l=s=>p()(e,s,""),i=g.c9.fromFormat(e.time.toString(),"HH:mm:ss z MM/dd/yyyy",{zone:"UTC"});return(0,j.jsxs)(t.Fragment,{children:[(0,j.jsxs)("div",{children:[(0,j.jsx)("b",{style:n,children:"API:\xa0"}),(0,j.jsx)("span",{style:s,children:l("api.name")})]}),(0,j.jsxs)("div",{children:[(0,j.jsx)("b",{style:n,children:"Time:\xa0"}),(0,j.jsx)("span",{style:s,children:i.toFormat(m)})]}),(0,j.jsxs)("div",{children:[(0,j.jsx)("b",{style:n,children:"DeploymentID:\xa0"}),(0,j.jsx)("span",{style:s,children:l("deploymentid")})]}),(0,j.jsxs)("div",{children:[(0,j.jsx)("b",{style:n,children:"RequestID:\xa0"}),(0,j.jsx)("span",{style:s,children:l("requestID")})]}),(0,j.jsxs)("div",{children:[(0,j.jsx)("b",{style:n,children:"RemoteHost:\xa0"}),(0,j.jsx)("span",{style:s,children:l("remotehost")})]}),(0,j.jsxs)("div",{children:[(0,j.jsx)("b",{style:n,children:"UserAgent:\xa0"}),(0,j.jsx)("span",{style:s,children:l("userAgent")})]}),(0,j.jsxs)("div",{children:[(0,j.jsx)("b",{style:n,children:"Error:\xa0"}),(0,j.jsx)("span",{style:s,children:l("error.message")})]}),(0,j.jsx)("br",{}),(0,j.jsx)("div",{children:(0,j.jsx)("b",{style:n,children:"Backtrace:\xa0"})}),(e.error.source||[]).map(((e,t)=>(0,j.jsxs)("div",{children:[(0,j.jsxs)("b",{style:n,children:[t,":\xa0"]}),(0,j.jsx)("span",{style:s,children:e})]})))]})})(s)),c=(c||"").replace(/((\[[0-9;]+m))/g,"");const h=g.c9.fromFormat(s.time.toString(),"HH:mm:ss z MM/dd/yyyy",{zone:"UTC"}),u=h.toJSDate();let y=(0,j.jsx)(t.Fragment,{children:h.toFormat(m)});return 1===u.getFullYear()&&(y=(0,j.jsx)(t.Fragment,{children:"n/a"})),(0,j.jsxs)(t.Fragment,{children:[(0,j.jsxs)(l.Hjg,{sx:{cursor:"pointer",borderLeft:"0",borderRight:"0"},children:[(0,j.jsx)(l.nA6,{onClick:()=>i(!n),sx:{width:280,color:"#989898",fontSize:12},children:(0,j.jsxs)(l.azJ,{sx:{display:"flex",gap:1,alignItems:"center","& .min-icon":{width:12,marginRight:1},fontWeight:"bold",lineHeight:1},children:[(0,j.jsx)(l.uwE,{}),(0,j.jsx)("div",{children:y})]})}),(0,j.jsx)(l.nA6,{onClick:()=>i(!n),sx:{width:200,color:"#989898",fontSize:12},children:(0,j.jsx)(l.azJ,{sx:{"& .min-icon":{width:12,marginRight:1},fontWeight:"bold",lineHeight:1},children:s.errKind})}),(0,j.jsx)(l.nA6,{onClick:()=>i(!n),children:(0,j.jsx)(l.azJ,{sx:{display:"table",tableLayout:"fixed",width:"100%",paddingLeft:10,paddingRight:10},children:(0,j.jsx)(l.azJ,{sx:{display:"table-cell",whiteSpace:"nowrap",textOverflow:"ellipsis",overflow:"hidden"},children:c})})}),(0,j.jsx)(l.nA6,{onClick:()=>i(!n),sx:{width:40},children:(0,j.jsx)(l.azJ,{sx:{"& .min-icon":{display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"2px"},"&:hover .min-icon":{fill:"#eaeaea"}},children:n?(0,j.jsx)(l.Clq,{}):(0,j.jsx)(l.FZk,{})})})]}),n?(0,j.jsxs)(l.Hjg,{children:[(0,j.jsx)(l.nA6,{sx:{paddingBottom:0,paddingTop:0,width:200,textTransform:"uppercase",verticalAlign:"top",textAlign:"right",color:"#8399AB",fontWeight:"bold"},children:(0,j.jsx)(l.azJ,{sx:{marginTop:10},children:"Log Details"})}),(0,j.jsx)(l.nA6,{sx:{paddingBottom:0,paddingTop:0},colSpan:2,children:(0,j.jsx)(l.azJ,{sx:{margin:1,padding:4,fontSize:14},withBorders:!0,useBackground:!0,children:x})}),(0,j.jsx)(l.nA6,{sx:{paddingBottom:0,paddingTop:0,width:40}})]}):null]},h.toString())};var y=n(48793),b=n(55968),f=null;const v=()=>{const e=(0,o.jL)(),s=(0,i.d4)((e=>e.logs.logMessages)),n=(0,i.d4)((e=>e.logs.logsStarted)),[g,h]=(0,t.useState)(""),[p,m]=(0,t.useState)([""]),[v,w]=(0,t.useState)("all"),[A,S]=(0,t.useState)("Select user agent"),[C,k]=(0,t.useState)(["All User Agents"]),[z,L]=(0,t.useState)("all"),[F,B]=(0,t.useState)(!1),I=g.toLowerCase();let M=s.filter((e=>(e.userAgent===A||"All User Agents"===A||"Select user agent"===A)&&(""===g||(e.ConsoleMsg.toLowerCase().indexOf(I)>=0||(!!(e.error&&e.error.source&&e.error.source.filter((e=>e.toLowerCase().indexOf(I)>=0)).length>0)||(!!(e.error&&e.error.message.toLowerCase().indexOf(I)>=0)||!!(e.api&&e.api.name.toLowerCase().indexOf(I)>=0)))))));return(0,t.useEffect)((()=>{B(!0),x.A.invoke("GET","/api/v1/nodes").then((e=>{m(e),B(!1)})).catch((e=>{B(!1)}))}),[]),(0,t.useEffect)((()=>{e((0,d.ph)("error_logs"))}),[]),(0,j.jsxs)(t.Fragment,{children:[(0,j.jsx)(y.A,{label:"Logs",actions:(0,j.jsx)(b.A,{})}),(0,j.jsx)(l.Mxu,{children:(0,j.jsxs)(l.xA9,{container:!0,sx:{gap:15},children:[(0,j.jsx)(l.xA9,{item:!0,xs:3,children:F?(0,j.jsx)("h3",{children:" Loading nodes"}):(0,j.jsx)(l.l6P,{id:"node-selector",name:"node","data-test-id":"node-selector",value:v,onChange:e=>{w(e)},disabled:F||n,options:[{label:"All Nodes",value:"all"},...p.map((e=>({label:e,value:e})))]})}),(0,j.jsx)(l.xA9,{item:!0,xs:3,children:(0,j.jsx)(l.l6P,{id:"logType",name:"logType","data-test-id":"log-type",value:z,onChange:e=>{L(e)},disabled:F||n,options:[{value:"all",label:"All Log Types"},{value:"minio",label:"MinIO"},{value:"application",label:"Application"}]})}),(0,j.jsx)(l.xA9,{item:!0,xs:3,children:C.length>1&&(0,j.jsx)(l.l6P,{id:"userAgent",name:"userAgent","data-test-id":"user-agent",value:A,onChange:e=>{S(e)},disabled:C.length<1||n,options:C.map((e=>({label:e,value:e})))})}),(0,j.jsxs)(l.xA9,{item:!0,xs:2,sx:{display:"flex",justifyContent:"flex-end"},children:[!n&&(0,j.jsx)(l.$nd,{id:"start-logs",type:"submit",variant:"callAction",disabled:!1,onClick:()=>{e((0,a.Ib)());const s=new URL(window.location.toString()),n=s.port,t=(0,r.nw)(s.protocol),l=new URL(document.baseURI).pathname;f=new WebSocket("".concat(t,"://").concat(s.hostname,":").concat(n).concat(l,"ws/console/?logType=").concat(z,"&node=").concat("Select node"===v?"":v));let i=null;if(null!==f)return f.onopen=()=>{console.log("WebSocket Client Connected"),e((0,a.xW)(!0)),f.send("ok"),i=setInterval((()=>{f.send("ok")}),1e4)},f.onmessage=s=>{let n=JSON.parse(s.data.toString()),t=!0;""===n.level&&""===n.errKind&&"00:00:00 UTC 01/01/0001"===n.time&&""===n.ConsoleMsg&&""===n.node&&(t=!1),n.key=Math.random(),C.indexOf(n.userAgent)<0&&void 0!==n.userAgent&&(C.push(n.userAgent),k(C)),t&&e((0,a.Jb)(n))},f.onclose=()=>{clearInterval(i),console.log("connection closed by server"),e((0,a.xW)(!1))},()=>{f.close(1e3),clearInterval(i),console.log("closing websockets"),e((0,a.xW)(!1))}},label:"Start Logs"}),n&&(0,j.jsx)(l.$nd,{id:"stop-logs",type:"button",variant:"callAction",onClick:()=>{null!==f&&void 0!==f&&(f.close(1e3),e((0,a.xW)(!1)))},label:"Stop Logs"})]}),(0,j.jsx)(l.xA9,{item:!0,xs:12,sx:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"1rem","& button":{flexGrow:0,marginLeft:8,marginBottom:0}},children:(0,j.jsx)(c.A,{placeholder:"Filter",onChange:e=>{h(e)},value:g})}),(0,j.jsx)(l.xA9,{item:!0,xs:12,children:(0,j.jsx)(l.azJ,{id:"logs-container","data-test-id":"logs-list-container",sx:{minHeight:400,height:"calc(100vh - 200px)",overflow:"auto",fontSize:13,borderRadius:4},children:(0,j.jsxs)(l.azJ,{withBorders:!0,customBorderPadding:"0px",useBackground:!0,children:[(0,j.jsx)(l.XIK,{"aria-label":"collapsible table",children:(0,j.jsx)(l.BFY,{children:M.map((e=>(0,j.jsx)(u,{log:e})))})}),0===M.length&&(0,j.jsx)(l.azJ,{sx:{padding:20,textAlign:"center"},children:"No logs to display"})]})})})]})})]})}}}]); 2 //# sourceMappingURL=6164.c2cd952a.chunk.js.map