PageSourceSearch

https://app.hightouch.com/assets/sync-health-table-0qYamAIF.js

js hightouch.com collected 2026-09-24 07:25:43 UTC 8,690 bytes, 2 lines download raw bytes

1import{af as e,r as p,ar as _,ao as N,bD as P,bE as F,bF as O,bG as Q,aw as z}from"./vendor-B2oIjyY4.js";import{R as W,sH as K,aq as q,M as U,a$ as I,e as G,h as B,fr as J,C as V,B as j,g as w,f as b,al as t,I as M,T as X,am as D,a as Y,J as v,gW as Z,dH as ee,aI as L,k as ne,an as te}from"./main-CJK8sxkW.js";import{s as se}from"./sync-ChxifjL-.js";import{u as re}from"./use-alerts-for-syncs-p4kreA7r.js";import{g as oe}from"./utils-BcWOQ0Uw.js";import"./bounded-range-fetch-CggGfMWc.js";import"./vendor-charts-BqgCVUWx.js";const ae=3,H="minmax(300px, 1fr) minmax(140px, 180px) minmax(140px, 180px) minmax(140px, 180px) minmax(140px, 180px)",Ce=()=>{const n=K(),[a]=p.useState(_(new Date,ae).toISOString()),r=p.useMemo(()=>n.data?n.data.destinations.flatMap(i=>i.syncs.map(c=>c.id)).map(String):[],[n.data]),s=q({syncIds:r,resourceType:U.Sync,since:a},{enabled:!!r.length}),d=re(r,U.Sync,0),h=p.useMemo(()=>d.data?Object.entries(d.data).reduce((i,[c,{alerts:f}])=>(i[c]=f,i),{}):{},[d.data]),u=p.useMemo(()=>{var c;if(!n.data||!h)return{};const i=((c=s.data)==null?void 0:c.resource_monitor_statuses)||[];return he(n.data,h,i)},[n.data,h,s.data]);return n.isLoading||s.isLoading||d.isLoading?e.jsxs(I,{children:[e.jsx(E,{}),e.jsx(G,{isLoading:!0,children:N.times(10,i=>e.jsx(le,{},i))})]}):n.data?e.jsxs(I,{overflow:"hidden",children:[e.jsx(E,{}),e.jsx(V,{overflow:"auto",children:Object.entries(u).map(([,i],c)=>e.jsx(ie,{destinations:i},c))})]}):e.jsxs(I,{children:[e.jsx(B,{children:"Sync status by destination"}),e.jsx(J,{variant:"minimal",title:"No active syncs",message:"A sync defines how and when your data will be sent to a destination. This table only shows syncs that are enabled.",imageUrl:se,mb:6})]})},E=()=>e.jsxs(e.Fragment,{children:[e.jsx(B,{mb:4,children:"Sync status by destination"}),e.jsxs(j,{display:"grid",gridTemplateColumns:H,children:[e.jsx(y,{height:"48px",children:e.jsx(w,{children:"Destination"})}),e.jsx(y,{justifyContent:"center",height:"48px",children:e.jsx(w,{children:"No alerts"})}),e.jsx(y,{justifyContent:"center",height:"48px",children:e.jsx(w,{children:"Warning"})}),e.jsx(y,{justifyContent:"center",height:"48px",children:e.jsx(w,{children:"Critical"})}),e.jsx(y,{justifyContent:"center",height:"48px",children:e.jsx(w,{children:"Inactive"})})]})]}),ie=({destinations:n})=>{const[a,r]=p.useState(!1),[s,d]=p.useState(!1);if(n.length===1){const o=n[0];return o?e.jsx(k,{destination:o}):null}const h=n.map(o=>o.id),u=n[0],x=n.reduce((o,l)=>o+l[t.Healthy],0),i=n.reduce((o,l)=>o+l[t.Pending],0),c=n.reduce((o,l)=>o+l[t.Warning],0),f=n.reduce((o,l)=>o+l[t.Unhealthy],0),S=n.reduce((o,l)=>o+l[t.Disabled],0),g={[t.Healthy]:{count:0,syncIds:[]},[t.Warning]:{count:0,syncIds:[]},[t.Unhealthy]:{count:0,syncIds:[]}};return n.forEach(o=>{[t.Healthy,t.Warning,t.Unhealthy].forEach(l=>{o.transitions[l].syncIds.forEach(C=>{g[l].syncIds.includes(C)||(g[l].syncIds.push(C),g[l].count++)})})}),e.jsx(P,{allowToggle:!0,index:s?[0]:[],onChange:o=>d(o===0),children:e.jsxs(F,{border:"none",children:[e.jsxs(j,{display:"grid",gridTemplateColumns:H,className:"group",children:[e.jsx(y,{cursor:"pointer",alignItems:"center",gap:2,_groupHover:{bg:"base.background"},onClick:()=>d(!s),onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),children:u&&e.jsxs(e.Fragment,{children:[e.jsx(M,{name:u.name,src:u.icon}),e.jsx(X,{fontWeight:"medium",isTruncated:!0,children:u.friendlyType}),e.jsx(D,{children:n.length}),e.jsx(O,{"aria-label":`${s?"Collapse":"Expand"} syncs`,outline:"none !important",p:1,borderRadius:"sm",width:"fit-content",onClick:o=>o.stopPropagation(),children:e.jsx(j,{as:Y,opacity:s||a?1:0,fontSize:"18px",transform:s?"rotate(90deg)":"",transitionProperty:"transform, opacity",transitionDuration:"fast",transitionTimingFunction:"easeOutQuad"})})]})}),e.jsx(m,{count:x,transitions:g[t.Healthy],status:t.Healthy,destinationIds:h}),e.jsx(m,{count:c,transitions:g[t.Warning],status:t.Warning,destinationIds:h}),e.jsx(m,{count:f,transitions:g[t.Unhealthy],status:t.Unhealthy,destinationIds:h}),e.jsx(m,{count:S+i,status:t.Disabled,destinationIds:h})]}),e.jsx(Q,{p:0,children:n.map(o=>e.jsx(k,{nested:!0,destination:o},o.id))})]})})},k=({destination:n,nested:a=!1})=>e.jsxs(j,{position:"relative",display:"grid",gridTemplateColumns:H,className:"group",children:[e.jsxs(y,{pl:a?12:void 0,gap:2,alignItems:"center",_groupHover:{bg:"base.background"},children:[e.jsx(M,{src:n.icon,name:n.friendlyType}),e.jsx(Z,{href:`/syncs?destination=${n.id}`,fontWeight:"medium",color:"inherit",children:a?n.name:n.friendlyType})]}),e.jsx(m,{count:n[t.Healthy],transitions:n.transitions[t.Healthy],status:t.Healthy,destinationIds:[n.id]}),e.jsx(m,{count:n[t.Warning],transitions:n.transitions[t.Warning],status:t.Warning,de
1stinationIds:[n.id]}),e.jsx(m,{count:n[t.Unhealthy],transitions:n.transitions[t.Unhealthy],status:t.Unhealthy,destinationIds:[n.id]}),e.jsx(m,{count:n[t.Disabled]+n[t.Pending],status:t.Disabled,destinationIds:[n.id]})]}),m=({count:n,transitions:a,status:r,destinationIds:s})=>{const[d,h]=p.useState(!1),[u,x]=p.useState(!1),{bgColor:i,hoverBgColor:c,textColor:f}=ge(r,!n),S=ee(n),g=s!=null&&s.length?ue(s,r):void 0,o=g&&n>0;return e.jsxs(y,{as:o?L:"div",to:g,bg:i,pos:"relative",alignItems:"center",fontWeight:"medium",color:f,cursor:o?"pointer":"default",justifyContent:"space-between",gap:2,_groupHover:{bg:c},onMouseEnter:()=>h(!0),onMouseLeave:()=>h(!1),children:[e.jsxs(W,{align:"center",gap:1,children:[S,d&&!u&&o&&e.jsx(j,{as:ne,fontSize:"lg"})]}),r!==t.Healthy&&e.jsx(j,{onMouseEnter:()=>x(!0),onMouseLeave:()=>x(!1),children:e.jsx(ce,{transition:a,status:r})})]})},ce=({transition:n,status:a})=>{if(!n||!n.count)return null;const r=`Click to view ${z("sync",n.count)} with recent ${a===t.Unhealthy?"critical":"warning"} alerts (last 72 hours).`,s=a===t.Warning?"warning":a===t.Unhealthy?"error":"success";return e.jsx(te,{message:r,children:e.jsx(j,{as:L,to:ye(n.syncIds),_hover:{span:{color:"white",bg:s==="warning"?"yellow.600":s==="error"?"red.600":"green.600"}},children:e.jsxs(D,{size:"sm",variant:s,children:[n.count," new"]})})})},y=({children:n,...a})=>e.jsx(W,{px:6,height:"56px",alignItems:"center",borderBottomWidth:"hairline",borderBottomStyle:"solid",borderColor:"base.border",flexShrink:0,...a,children:n}),le=()=>e.jsxs(j,{display:"grid",gridTemplateColumns:H,children:[e.jsx(y,{children:e.jsxs(W,{alignItems:"center",gap:2,children:[e.jsx(b,{borderRadius:"full",width:"24px",height:"24px"}),e.jsx(b,{width:"200px",height:"16px",borderRadius:"sm"})]})}),e.jsx(y,{justifyContent:"center",alignItems:"center",children:e.jsx(b,{width:"50px",height:"16px",borderRadius:"sm"})}),e.jsx(y,{justifyContent:"center",alignItems:"center",children:e.jsx(b,{width:"50px",height:"16px",borderRadius:"sm"})}),e.jsx(y,{justifyContent:"center",alignItems:"center",children:e.jsx(b,{width:"50px",height:"16px",borderRadius:"sm"})}),e.jsx(y,{justifyContent:"center",alignItems:"center",children:e.jsx(b,{width:"50px",height:"16px",borderRadius:"sm"})})]}),de=(n,a)=>{const r={[t.Healthy]:{count:0,syncIds:[]},[t.Warning]:{count:0,syncIds:[]},[t.Unhealthy]:{count:0,syncIds:[]}};return n.forEach(s=>{const d=a.find(u=>u.resource_id===String(s));if(!d)return;switch(d.new_status){case v.Unhealthy:r[t.Unhealthy].syncIds.includes(s)||(r[t.Unhealthy].count++,r[t.Unhealthy].syncIds.push(s));break;case v.Warning:r[t.Warning].syncIds.includes(s)||(r[t.Warning].count++,r[t.Warning].syncIds.push(s));break;case v.Healthy:r[t.Healthy].syncIds.includes(s)||(r[t.Healthy].count++,r[t.Healthy].syncIds.push(s));break}}),r},he=(n,a,r=[])=>{var d,h,u,x;if(!((d=n==null?void 0:n.destinations)!=null&&d.length))return{};const s={};for(const i of n.destinations){const c=i.type,f=i.id,S=i.name||"Unknown",g=((h=i.definition)==null?void 0:h.icon)||"",o=((u=i.definition)==null?void 0:u.name)||c;if(!((x=i.syncs)!=null&&x.length))continue;s[c]||(s[c]=[]);const l={[t.Healthy]:0,[t.Warning]:0,[t.Unhealthy]:0,[t.Disabled]:0,[t.Pending]:0};for(const T of i.syncs){const R=a[T.id];if(!R)continue;const A=oe(T,R);l[A]++}const C=i.syncs.map(T=>T.id),$=de(C,r);s[c].push({id:f,name:S,type:c,friendlyType:o,icon:g,syncIds:C,...l,transitions:$})}return s},ue=(n,a)=>a===t.Disabled?`/syncs?destination=${n.join(",")}&syncStatus=disabled`:`/syncs?destination=${n.join(",")}&alerts=${a}`,ye=n=>`/syncs?id=${n.join(",")}`,ge=(n,a)=>{if(a)return{bgColor:"white",hoverBgColor:"gray.200",textColor:"text.tertiary"};const r={[t.Healthy]:"green",[t.Warning]:"yellow",[t.Unhealthy]:"red",[t.Disabled]:"gray"};return{bgColor:`${r[n]}.100`,hoverBgColor:`${r[n]}.200`,textColor:"text.primary"}};export{y as Cell,Ce as SyncHealthTable};
2//# sourceMappingURL=sync-health-table-0qYamAIF.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.