1import{r as d,af as e,az as g}from"./vendor-B2oIjyY4.js";import{rq as f,BF as b,BG as A,e1 as S,f5 as w,C as i,G as C,j as E,cr as u,T as h,de as y,aj as T,R as F,H as R,h as D,A as B,b3 as O,y as W,s1 as M,s2 as N,N as _}from"./main-CJK8sxkW.js";import{D as H}from"./drawer-uoKBN2zN.js";import{C as I}from"./content-header-Bu9-RFzG.js";import"./bounded-range-fetch-CggGfMWc.js";import"./vendor-charts-BqgCVUWx.js";const L=336*60*60*1e3,P=()=>{const{sync:r}=f(),{toast:s}=W(),[m,n]=d.useState(),o=d.useMemo(()=>new Date(Date.now()-L).toISOString(),[]),{data:a,isLoading:p,error:x}=b({input:{syncId:r.id,fromDate:o}},{select:t=>t.getArchivedFailures.events}),c=A(),v=async()=>{try{const{retryArchivedFailures:{numRetried:t}}=await c.mutateAsync({input:{syncId:r.id,fromDate:o}});s({id:"retry",title:`${t} events will be retried on the next run`,variant:"success"})}catch(t){T(t),s({id:"retry",title:"There was an error retrying the failures.",variant:"error"})}};if(p)return e.jsx(S,{});if(x)return e.jsx(w,{title:"Failed to load archived errors",subtitle:"Please try again"});const j=a==null?void 0:a.flatMap(t=>t.errors.map(l=>({eventType:t.eventType,receivedAt:t.receivedAt,payload:t.payload,table:l.table,error:l.message})));return e.jsxs(i,{children:[e.jsx(I,{variant:"table",title:"Archived failures",description:"Events are archived if they fail for more than 48 hours.",actions:e.jsx(C,{permission:{v2:{resource:"event_warehouse_sync",grant:"can_run",id:r.id}},isLoading:c.isLoading,onClick:v,children:"Retry failures"})}),e.jsx(E,{data:j,columns:[{name:"Event type",cell:({eventType:t})=>e.jsx(u,{fontWeight:"medium",children:t})},{name:"Table",cell:({table:t})=>e.jsx(u,{fontWeight:"medium",children:t})},{name:"Received at",cell:({receivedAt:t})=>e.jsx(h,{fontWeight:"medium",children:y(t)})}],onRowClick:t=>{n(t)},placeholder:{title:"No archived failures",body:"Events are archived if they fail for more than 48 hours."}}),e.jsx(k,{failure:m,onClose:()=>{n(void 0)}})]})},k=({failure:r,onClose:s})=>e.jsxs(H,{isOpen:!!r,onClose:s,size:"lg",children:[e.jsx(F,{p:6,borderBottomWidth:"hairline",borderBottomStyle:"solid",borderColor:"base.border",width:"100%",children:e.jsx(R,{children:"Failure"})}),e.jsx(g,{children:e.jsxs(i,{gap:4,children:[r&&e.jsxs(i,{children:[e.jsx(D,{children:r.eventType}),e.jsxs(h,{color:"text.secondary",children:["Received at: ",y(r.receivedAt)]})]}),e.jsx(B,{variant:"inline",type:"error",title:"Error",message:r==null?void 0:r.error}),e.jsx(O,{label:"Event payload",code:r?JSON.stringify(r.payload,null,4):""})]})})]}),U=()=>{const r=M();return N(r)?e.jsx(_,{to:`/events/syncs/${r.sync.id}`,replace:!0}):e.jsx(P,{})};export{U as Archive}; 2//# sourceMappingURL=archive-B72ZbJ5E.js.map
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.