import{r as j,p as N,g as R,b4 as _,d as L,k as z,e as O,j as e,$ as o,ap as m,C as h,c as x,f as c,cB as w,gO as P,gP as U,gQ as $,gR as F,gS as W,gT as B,L as d,b_ as I,U as v,b8 as M,eA as A,bO as y,bP as S,ao as b,gH as V,fE as H,gU as J,u as q,i as G,bl as Q,gV as X,ef as g}from"./index-46ma1THH.js";const Y=({activity:s})=>{const{titleData:i,listData:n}=j.useMemo(()=>N(R(_(":"),t=>{const[r,l]=t.split(":");return{titleData:`${r}:`,listData:l.split(",")}},L({titleData:O,listData:z([])})))(s.metadata),[s.metadata]);return e.jsxs(o,{justifyContent:"space-between",bg:"white",alignItems:"start",children:[e.jsxs(o,{alignItems:"start",ml:"20px",children:[e.jsxs(o,{mt:"20px",children:[e.jsx(m,{icon:h.creation,color:"gray",size:"sm"}),e.jsx(x,{width:"120px",bold:!0,ml:"8px",gray:!0,children:"Creation"})]}),e.jsx(c,{pt:"20px",ml:"140px",children:i}),n.length===1&&e.jsx(c,{ml:"5px",pt:"20px",children:n[0]}),n.length>1&&e.jsx(Z,{listData:n})]}),e.jsx(o,{my:"12px",pr:"20px",children:e.jsx(w,{firstName:s.user.firstname,lastName:s.user.lastname})})]})},Z=({listData:s})=>{const[i,n]=j.useState(!1),t=()=>{n(a=>!a)},[r,...l]=s;return e.jsxs(o,{ml:"5px",children:[e.jsxs(c,{pt:"20px",children:[r,", ..."]}),e.jsxs(P,{isOpen:i,onClose:t,children:[e.jsx(U,{children:e.jsx("div",{style:{marginTop:"15px"},children:e.jsxs($,{onClick:()=>n(!0),children:["view all ",s.length," new features"]})})}),e.jsxs(F,{children:[e.jsx(W,{}),e.jsx(B,{p:"0",children:e.jsx(d,{maxHeight:"300px",overflow:"auto",children:e.jsx(I,{standalone:!0,padded:!1,children:l.map(a=>e.jsx(I.Row,{fontSize:"12px",p:"4px",sx:{p:"4px !important"},children:e.jsx(I.Cell,{children:e.jsx(c,{children:a})})},a))})})})]})]})]})},K=({activity:s})=>{var n,t,r,l;const i=v((t=(n=s.job)==null?void 0:n.executions)==null?void 0:t.finalStatus,{SUCCEEDED:{value:"success",variant:"success"},UNDEFINED:{value:"running",variant:"default",loading:!0}})??{value:"error",variant:"fail"};return e.jsxs(o,{bg:"white",height:"56px",alignItems:"center",justifyContent:"space-between",children:[e.jsxs(o,{alignItems:"center",ml:"20px",children:[e.jsx(d,{children:e.jsx(m,{icon:h.job,color:"gray",size:"sm"})}),e.jsx(x,{width:"110px",bold:!0,ml:"8px",gray:!0,children:"Job execution"}),e.jsx(d,{ml:"20px",width:"110px",children:e.jsx(M,{width:"fit-content",...i})}),e.jsxs(c,{ml:"20px",children:["#",(r=s.job)==null?void 0:r.executions.id]}),e.jsx(c,{ml:"20px",children:(l=s.job)==null?void 0:l.name})]}),e.jsx(o,{pr:"20px",children:e.jsx(w,{firstName:s.user.firstname,lastName:s.user.lastname})})]})},ee=({rowsDeleted:s,rowsInserted:i,rowsUpdated:n,allRowsCount:t,...r})=>{const l=A(),a=j.useMemo(()=>Math.ceil(s/t*100),[t,s]),u=j.useMemo(()=>a+Math.ceil(n/t*100),[t,n,a]);return e.jsx(d,{...r,children:e.jsxs("svg",{width:"22px",height:"22px",viewBox:"-5 -5 45 45",children:[e.jsx("path",{d:`M18 2.0845
      a 15.9155 15.9155 0 0 1 0 31.831
      a 15.9155 15.9155 0 0 1 0 -31.831`,fill:"none",stroke:l.colors.primary,strokeWidth:"7",strokeDasharray:"100, 100"}),e.jsx("path",{d:`M18 2.0845
      a 15.9155 15.9155 0 0 1 0 31.831
      a 15.9155 15.9155 0 0 1 0 -31.831`,fill:"none",stroke:l.colors.labels.orange,strokeWidth:"7",strokeDasharray:`${u}, 100`}),e.jsx("path",{d:`M18 2.0845
      a 15.9155 15.9155 0 0 1 0 31.831
      a 15.9155 15.9155 0 0 1 0 -31.831`,fill:"none",stroke:l.colors.labels.red,strokeWidth:"7",strokeDasharray:`${a}, 100`})]})})},k=1,D=.1,C=1,T=30,se=1e3*60*60*24,f=s=>s>1e3?`${Math.round(s/1e3)}k`:s,me=(s,i)=>{const t=(s-i)/se;return t>=T?D:t<=C?k:D+(T-t)*((k-D)/(T-C))},te=({activity:s})=>{const{commit:i}=s,{rowsUpdated:n=0,rowsInserted:t=0,rowsDeleted:r=0,archived:l=!1,commitID:a}=i,u=j.useMemo(()=>y(+a,S.DATE_TIME.DATE_TIME_FULL),[a]),p=r+n+t;return e.jsxs(o,{bg:l?"grayScale3":"white",height:"56px",alignItems:"center",justifyContent:"space-between",children:[e.jsxs(o,{ml:"20px",sx:{alignItems:"center"},children:[e.jsx(d,{children:e.jsx(m,{icon:h.ingest,color:"gray",size:"sm"})}),e.jsx(x,{width:"110px",bold:!0,ml:"8px",gray:!0,children:"Offline ingestion"}),e.jsx(o,{alignItems:"center",width:"110px",ml:"20px",children:e.jsx(ee,{rowsUpdated:n,rowsDeleted:r,rowsInserted:t,allRowsCount:p})}),e.jsx(x,{ml:"20px",children:"commit"}),e.jsx(c,{ml:"5px",children:u}),e.jsx(c,{ml:"20px",children:f(t)}),e.jsx(x,{ml:"5px",children:"new rows,"}),e.jsx(c,{ml:"5px",children:f(n)}),e.jsx(x,{ml:"5px",children:"updated rows,"}),e.jsx(c,{ml:"5px",children:f(r)}),e.jsx(x,{ml:"5px",children:"deleted rows"})]}),l&&e.jsx(o,{children:e.jsx(b,{mt:"5px",mr:"35px",mainText:"This commit has been archived and cannot be referenced in incremental queries",children:e.jsx(d,{children:e.jsx(m,{icon:h.history,size:"sm"})})})})]})},ne=({rowsProcessed:s,rowsSuccessful:i,rowsFailed:n,...t})=>{const r=A(),l=j.useMemo(()=>Math.ceil(i/s*100),[s,i]),a=j.useMemo(()=>l+Math.ceil(n/s*100),[s,n,l]);return e.jsx(d,{...t,children:e.jsxs("svg",{width:"22px",height:"22px",viewBox:"-5 -5 45 45",children:[e.jsx("path",{d:`M18 2.0845
      a 15.9155 15.9155 0 0 1 0 31.831
      a 15.9155 15.9155 0 0 1 0 -31.831`,fill:"none",stroke:r.colors.labels.red,strokeWidth:"7",strokeDasharray:`${a}, 100`}),e.jsx("path",{d:`M18 2.0845
      a 15.9155 15.9155 0 0 1 0 31.831
      a 15.9155 15.9155 0 0 1 0 -31.831`,fill:"none",stroke:r.colors.labels.green,strokeWidth:"7",strokeDasharray:`${l}, 100`}),e.jsx("path",{d:`M18 2.0845
      a 15.9155 15.9155 0 0 1 0 31.831
      a 15.9155 15.9155 0 0 1 0 -31.831`,fill:"none",stroke:r.colors.gray,strokeWidth:"7",strokeDasharray:"0, 100"})]})})},re=({activity:s})=>{const{onlineIngestion:i}=s,{numEntries:n,results:t,id:r}=i,l=t.filter(p=>p.status==="UPSERTED").reduce((p,E)=>p+E.rows,0),a=t.filter(p=>p.status!=="UPSERTED").reduce((p,E)=>p+E.rows,0),u=l+a;return e.jsx(o,{bg:"white",height:"56px",alignItems:"center",justifyContent:"space-between",children:e.jsxs(o,{ml:"20px",sx:{alignItems:"center"},children:[e.jsx(d,{children:e.jsx(m,{icon:h.ingest,color:"gray",size:"sm"})}),e.jsx(x,{width:"110px",bold:!0,ml:"8px",gray:!0,children:"Online ingestion"}),e.jsx(o,{alignItems:"center",width:"110px",ml:"20px",children:e.jsx(ne,{rowsProcessed:u,rowsSuccessful:l,rowsFailed:a})}),e.jsx(x,{ml:"20px",children:"id"}),e.jsx(c,{ml:"5px",children:r}),e.jsx(c,{ml:"20px",children:f(l+a)}),e.jsx(x,{ml:"5px",children:"rows processed,"}),e.jsx(c,{ml:"5px",children:f(a)}),e.jsx(x,{ml:"5px",children:"failures,"}),n&&e.jsx(c,{ml:"5px",children:f(n)}),n&&e.jsx(x,{ml:"5px",children:"dataset size"})]})})},ie=({activity:s,onButtonClick:i})=>{const n=j.useMemo(()=>y(+(s.statistics.computationTime||s.statistics.commitTime),S.DATE_TIME.DATE_TIME_FULL),[s]);return e.jsxs(o,{bg:"white",height:"56px",alignItems:"center",justifyContent:"space-between",children:[e.jsxs(o,{ml:"20px",sx:{alignItems:"center"},children:[e.jsx(d,{children:e.jsx(m,{icon:h.new_stats,color:"gray",size:"sm"})}),e.jsx(x,{width:"110px",bold:!0,ml:"8px",gray:!0,children:"New statistics"}),e.jsx(x,{ml:"150px",children:"commit"}),e.jsx(c,{ml:"5px",children:n})]}),e.jsxs(o,{pr:"20px",alignItems:"center",children:[i&&e.jsx(d,{mr:"22px",ml:"13px",p:"5px",sx:{cursor:"pointer",backgroundColor:"white",transition:"all .4s ease",":hover":{backgroundColor:"grayShade3"},svg:{width:"16px",height:"16px"}},onClick:()=>i(+s.statistics.computationTime),children:e.jsx(b,{mainText:"open statistics",children:e.jsx(m,{icon:h.stats,size:"lg"})})}),e.jsx(d,{children:e.jsx(w,{firstName:s.user.firstname,lastName:s.user.lastname})})]})]})},ae=s=>{const i=/An Expectation Suite was attached to the Feature Group. /,n=/The Expectation Suite was updated. */,t=/The Expectation Suite was deleted. /;let r;return i.test(s)?r="Attached Expectation Suite":n.test(s)?r="Updated Expectation Suite":t.test(s)?r="Deleted Expectation Suite":r="Something went wrong.",r},le=({activity:s})=>(ae(s.metadata),e.jsxs(o,{bg:"white",height:"56px",alignItems:"center",justifyContent:"space-between",children:[e.jsxs(o,{alignItems:"center",ml:"20px",children:[e.jsx(d,{children:e.jsx(m,{icon:h.glass,color:"gray",size:"sm"})}),e.jsx(x,{width:"110px",bold:!0,ml:"8px",gray:!0,children:"Expectations"}),e.jsx(c,{ml:"20px",children:s.metadata})]}),e.jsx(o,{pr:"20px",children:e.jsx(w,{firstName:s.user.firstname,lastName:s.user.lastname})})]})),oe=async(s,i)=>{var n,t,r,l;try{await V.download(s,i,H.DATASET)}catch(a){const u=((t=(n=a==null?void 0:a.response)==null?void 0:n.data)==null?void 0:t.usrMsg)||((l=(r=a==null?void 0:a.response)==null?void 0:r.data)==null?void 0:l.errorMsg);J.error({title:"Error",content:u})}},ce=({activity:s})=>{const{id:i}=q();return s.validationReport.success,e.jsxs(o,{bg:"white",height:"56px",alignItems:"center",children:[e.jsxs(o,{flex:"1",alignItems:"center",ml:"20px",children:[e.jsx(d,{children:e.jsx(m,{icon:h.data_validation,size:"sm"})}),e.jsx(x,{width:"110px",bold:!0,ml:"8px",gray:!0,children:"Validation Report"}),e.jsx(c,{ml:"20px",children:"Data Validation Result :"}),e.jsx(c,{ml:"20px",children:e.jsx(xe,{success:s.validationReport.success})})]}),e.jsx(d,{width:"50px",children:e.jsx(b,{mainText:"Download",children:e.jsx(G,{icon:h.download,onClick:()=>oe(+i,s.validationReport.fullReportPath)})})}),e.jsx(o,{pr:"20px",children:e.jsx(w,{firstName:s.user.firstname,lastName:s.user.lastname})})]})},xe=({success:s})=>s?e.jsx(M,{width:"fit-content",mode:"bordered",value:"success",variant:"success"}):e.jsx(M,{width:"fit-content",mode:"bordered",value:"fail",variant:"fail"}),{DATE_TIME_FULL:de}=S.DATE_TIME,he=s=>{const n=new Map([[g.commit,te],[g.job,K],[g.metadata,Y],[g.onlineIngestion,re],[g.statistics,ie],[g.expectations,le],[g.validations,ce]]).get(s);return n||null},je=({activities:s,actions:i,loading:n})=>e.jsx(d,{children:s.map((t,r)=>{const l=r!==s.length-1,a=he(t.type);return e.jsx(b,{position:Q.left,mainText:t.timestamp?y(t.timestamp,de):"",children:e.jsxs(d,{sx:{border:"1px solid",borderColor:"grayShade2",borderBottom:l?"none":""},children:[n&&e.jsx(X,{children:e.jsx(o,{height:"56px"})}),!!a&&e.jsx(a,{activity:t,onButtonClick:i==null?void 0:i.get(t.type)})]})},`${t==null?void 0:t.timestamp}-${r}`)})});export{je as A,oe as d,me as g};
