PageSourceSearch

https://sureops.ai/assets/ProblemRecords-gAZ_7lWt.js

js sureops.ai collected 2026-10-05 12:48:58 UTC 14,612 bytes, 1 lines download raw bytes

1import{j as e,r as u,e as w}from"./framer-motion-CbFncxLX.js";import{S as p,ap as ce,f as h,b as C,b2 as de,q as me,b1 as ue,u as xe,h as G,l as Q,a2 as ge,a3 as he,a4 as E,aB as pe,a6 as fe,H as ve,N as je,X as Ne,$ as be}from"./index-6z_mnp2h.js";import{e as ye,d as we,b as H}from"./tanstack-B0SOp_i7.js";import{C as Ce,A as Se,P as ke}from"./AgingBadge-CM0PR0_F.js";import{f as Pe,p as Re,d as Le}from"./date-fns-Ds4Q3IhH.js";import{C as W}from"./CollapsibleSection-BNkY2Rif.js";import{v as Te,s as Ae,u as _e,I as Me}from"./useScrollParent-erp124C0.js";import{l as I}from"./problemService-CkTCmXlu.js";import{C as F}from"./circle-alert-t2-3RtPq.js";import{C as O}from"./circle-check-big-DGVJ7kKn.js";import{R as Ee}from"./repeat-DbX3y7LJ.js";import"./radix-C_BAld3k.js";import"./recharts-C2xaRzo_.js";import"./supabase-CLaGB8z6.js";import"./loader-circle-Dd-CApw4.js";function Ie(){return e.jsxs("div",{className:"p-4 md:p-6 space-y-4 md:space-y-6 w-full max-w-full overflow-x-hidden",role:"status","aria-live":"polite","aria-busy":"true","aria-label":"Loading problems",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(p,{className:"h-7 w-56"}),e.jsx(p,{className:"h-4 w-32"})]}),e.jsx(p,{className:"h-10 w-full max-w-md"}),e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-3",children:[e.jsx(p,{className:"h-10 flex-1 max-w-sm"}),e.jsx("div",{className:"flex items-center gap-2",children:[0,1,2].map(s=>e.jsx(p,{className:"h-6 w-20 rounded-full"},s))})]}),e.jsx("div",{className:"space-y-3",children:Array.from({length:5}).map((s,a)=>e.jsxs("div",{className:"glass-card rounded-lg p-4 border border-border/50 space-y-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"space-y-2 flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(p,{className:"h-5 w-16 rounded-full"}),e.jsx(p,{className:"h-4 w-24"})]}),e.jsx(p,{className:"h-5 w-3/4"}),e.jsx(p,{className:"h-4 w-1/2"})]}),e.jsx(p,{className:"h-8 w-8 rounded-md shrink-0"})]}),e.jsx(p,{className:"h-2 w-full rounded-full"})]},a))}),e.jsx("span",{className:"sr-only",children:"Loading problems…"})]})}const X=s=>s.startsWith("sureops-internal:")||s==="manual-promote";function Fe(s){switch(s){case"investigating":return"investigating";case"identified":return"root_cause_identified";case"in_progress":return"remediation";case"resolved":return"resolved";default:return"new"}}function Oe({problem:s}){var g,o,c;const a=s.stage||Fe(s.status),i=ke[a],f=s.actions.filter(x=>x.status==="completed").length,d=s.actions.length>0?f/s.actions.length*100:0,N=!!s.rca,n=((o=(g=s.rca)==null?void 0:g.gitHubPR)==null?void 0:o.status)==="merged";return e.jsx(ce,{to:`/problems/${s.id}
1`,className:"flex flex-col h-full min-h-[200px] p-3 md:p-4 rounded-lg border bg-card hover:bg-muted/50 transition-all group",children:e.jsxs("div",{className:"flex items-start justify-between gap-2 flex-1",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1 flex-wrap",children:[e.jsx("span",{className:"text-xs font-mono text-muted-foreground",children:s.id}),e.jsx(h,{className:C("text-xs border",i.bgColor,i.color),children:i.label}),e.jsx(Ce,{category:s.category,subtle:!0}),e.jsx(Se,{dueDate:s.dueDate,status:s.status,compact:!0}),((c=s.recurrence)==null?void 0:c.chainDepth)&&s.recurrence.chainDepth>1&&e.jsxs(h,{variant:"outline",className:"text-[10px] px-1.5 py-0 text-severity-p2 border-severity-p2/30",title:`${s.recurrence.chainDepth}th occurrence in a recurrence chain`,children:["×",s.recurrence.chainDepth]}),N&&e.jsx(h,{variant:"outline",className:C("text-[10px] px-1.5 py-0",n?"text-severity-resolved border-severity-resolved/30":"text-primary border-primary/30"),children:n?"RCA Approved":"RCA Generated"})]}),e.jsx("p",{className:"font-medium text-sm line-clamp-2 min-h-[2lh]",children:s.title}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 md:gap-4 mt-2 text-xs text-muted-foreground",children:[e.jsx("span",{className:"font-mono",children:s.incidentId}),e.jsx("span",{className:"hidden sm:inline",children:s.owner.name}),e.jsx("span",{children:Pe(new Date(s.createdAt),{addSuffix:!0})})]}),s.tags.filter(x=>!X(x)).length>0&&e.jsx("div",{className:"flex flex-wrap gap-1 mt-2",children:s.tags.filter(x=>!X(x)).slice(0,3).map(x=>e.jsx(h,{variant:"outline",className:"text-xs px-1.5 py-0",children:x},x))}),s.actions.length>0&&e.jsxs("div",{className:"mt-3",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs mb-1",children:[e.jsx("span",{className:"text-muted-foreground",children:"Actions"}),e.jsxs("span",{children:[f,"/",s.actions.length]})]}),e.jsx(de,{value:d,className:"h-1"})]})]}),e.jsx(me,{className:"h-5 w-5 text-muted-foreground group-hover:text-foreground transition-colors flex-shrink-0"})]})})}const Y=u.memo(Oe);function J({items:s,scrollParent:a,getKey:i,renderItem:f,estimateSize:d=220,gapClassName:N="pb-3"}){const n=u.useRef(null),[g,o]=u.useState(0);u.useEffect(()=>{if(!n.current||!a)return;const l=n.current.getBoundingClientRect(),v=a.getBoundingClientRect();o(l.top-v.top+a.scrollTop)},[a,s.length]);const c=ye({count:s.length,getScrollElement:()=>a,estimateSize:()=>d,overscan:6,scrollMargin:g,initialRect:Te()}),x=c.getVirtualItems();return Ae(s.length,x.length)?e.jsx("div",{ref:n,className:"w-full",children:s.map((l,v)=>e.jsx("div",{className:N,children:f(l,v)},i(l,v)))}):e.jsx("div",{ref:n,style:{height:c.getTotalSize(),position:"relative"},className:"w-full",children:x.map(l=>{const v=s[l.index];return v===void 0?null:e.jsx("div",{"data-index":l.index,ref:c.measureElement,style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${l.start-c.options.scrollMargin}px)`},className:N,children:f(v,l.index)},i(v,l.index))})})}const De={hidden:{opacity:0},visible:{opacity:1,transition:{staggerChildren:.1}}},S={hidden:{opacity:0,y:20},visible:{opacity:1,y:0}};function U(s){if(!s)return null;let a=null;try{a=Re(String(s))}catch{a=null}if(!a||Number.isNaN(a.getTime()))return null;const i=new Date;i.setHours(0,0,0,0);const f=Le(a,i);return f<0?"overdue":f<=2?"due_soon":"on_track"}const $e=s=>s.startsWith("sureops-internal:")||s==="manual-promote",qe=50;function ts(){var V;const[s,a]=ue(),[i,f]=u.useState(""),d=be(),{state:N}=xe(),n=s.get("status")||"all",g=s.get("tag"),o=s.get("aging"),c=s.get("recurrence"),x=n==="open"||n==="resolved"?n:void 0,{data:l,isLoading:v,isError:Z,fetchNextPage:D,hasNextPage:k,isFetchingNextPage:P}=we({queryKey:["problems","list",{status:x??"all"}],queryFn:({pageParam:t=1})=>I({status:x,page:t,perPage:qe}),initialPageParam:1,getNextPageParam:(t,r)=>r.reduce((M,oe)=>M+oe.problems.length,0)<(t.total||0)?r.length+1:void 0,enabled:!d,staleTime:3e4,refetchInterval:6e4}),ee=((V=l==null?void 0:l.pages[0])==null?void 0:V.total)??0,{data:R}=H({queryKey:["problems","count",{status:"all"}],queryFn:()=>I({page:1,perPage:1}),enabled:!d,staleTime:3e4,refetchInterval:6e4}),{data:L}=H({queryKey:["problems","count",{status:"open"}],queryFn:()=>I({status:"open",page:1,perPage:1}),enabled:!d,staleTime:3e4,refetchInterval:6e4}),j=u.useMemo(()=>d?N.problems:(l==null?void 0:l.pages.flatMap(t=>t.problems))??[],[d,N.problems,l]),y=u.useMemo(()=>j.filter(t=>t.status!=="resolved"),[j]),se=u.useMemo(()=>{const t=new Set;
1return j.forEach(r=>r.tags.filter(m=>!$e(m)).forEach(m=>t.add(m))),Array.from(t).sort()},[j]),T=u.useMemo(()=>{const t={overdue:0,due_soon:0,on_track:0};return y.forEach(r=>{const m=U(r.dueDate);m&&(t[m]+=1)}),t},[y]),te=u.useMemo(()=>y.filter(t=>{var r;return(((r=t.recurrence)==null?void 0:r.chainDepth)??0)>1}).length,[y]),b=u.useMemo(()=>{let t=j;if(n==="open"?t=t.filter(r=>r.status!=="resolved"):n==="resolved"&&(t=t.filter(r=>r.status==="resolved")),g&&(t=t.filter(r=>r.tags.includes(g))),o&&(t=t.filter(r=>r.status!=="resolved"&&U(r.dueDate)===o)),c==="recurring"&&(t=t.filter(r=>{var m;return(((m=r.recurrence)==null?void 0:m.chainDepth)??0)>1})),i){const r=i.toLowerCase();t=t.filter(m=>m.id.toLowerCase().includes(r)||m.title.toLowerCase().includes(r)||m.owner.name.toLowerCase().includes(r)||m.tags.some(M=>M.toLowerCase().includes(r)))}return t},[j,n,g,o,c,i]),$=u.useMemo(()=>b.filter(t=>t.status!=="resolved"),[b]),q=u.useMemo(()=>b.filter(t=>t.status==="resolved"),[b]),B=d?j.length:(R==null?void 0:R.total)??0,z=d?y.length:(L==null?void 0:L.total)??0,re=t=>{t==="all"?s.delete("status"):s.set("status",t),a(s)},ae=t=>{g===t?s.delete("tag"):s.set("tag",t),a(s)},A=t=>{o===t?s.delete("aging"):s.set("aging",t),a(s)},ne=()=>{c==="recurring"?s.delete("recurrence"):s.set("recurrence","recurring"),a(s)},le=u.useCallback(()=>{k&&!P&&D()},[k,P,D]),K=u.useRef(null),_=_e(K);if(!d&&v)return e.jsx(Ie,{});if(!d&&Z)return e.jsx("div",{className:"p-4 md:p-6",children:e.jsx(G,{className:"glass-card",children:e.jsxs(Q,{className:"flex flex-col items-center justify-center py-12",children:[e.jsx(F,{className:"h-12 w-12 text-destructive/50 mb-4"}),e.jsx("p",{className:"text-lg font-medium",children:"Failed to load problems"}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"Please try again later"})]})})});const ie=d||i||g||o||c?`${b.length} ${b.length===1?"problem":"problems"}`:`Showing ${j.length.toLocaleString()} of ${ee.toLocaleString()}`;return e.jsxs(w.div,{ref:K,variants:De,initial:"hidden",animate:"visible",className:"p-4 md:p-6 space-y-4 md:space-y-6 w-full max-w-full overflow-x-hidden",children:[e.jsxs(w.div,{variants:S,children:[e.jsx("h1",{className:"text-xl md:text-2xl font-bold",children:"Problem Management"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:ie})]}),e.jsx(w.div,{variants:S,children:e.jsx(ge,{value:n,onValueChange:re,children:e.jsxs(he,{className:"grid w-full max-w-md grid-cols-3",children:[e.jsxs(E,{value:"all",className:"gap-2",children:["All",B>0&&e.jsx(h,{variant:"secondary",className:"ml-1 h-5 px-1.5 text-xs",children:B.toLocaleString()})]}),e.jsxs(E,{value:"open",className:"gap-2",children:[e.jsx(F,{className:"h-3.5 w-3.5"}),"Open",z>0&&e.jsx(h,{variant:"secondary",className:"ml-1 h-5 px-1.5 text-xs",children:z.toLocaleString()})]}),e.jsxs(E,{value:"resolved",className:"gap-2",children:[e.jsx(O,{className:"h-3.5 w-3.5"}),"Resolved"]})]})})}),e.jsxs(w.div,{variants:S,className:"flex flex-col sm:flex-row gap-3",children:[e.jsxs("div",{className:"relative flex-1 max-w-sm",children:[e.jsx(pe,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(fe,{placeholder:"Search problems...",value:i,onChange:t=>f(t.target.value),className:"pl-9"})]}),e.jsxs("div",{className:"flex gap-2 overflow-x-auto pb-1",children:[se.slice(0,6).map(t=>e.jsx(h,{variant:g===t?"default":"outline",className:"cursor-pointer hover:bg-muted transition-colors shrink-0",onClick:()=>ae(t),children:t},t)),g&&e.jsx(h,{variant:"outline",className:"cursor-pointer hover:bg-destructive/10 transition-colors shrink-0 text-muted-foreground",onClick:()=>{s.delete("tag"),a(s)},children:"Clear"})]})]}),n!=="resolved"&&(y.length>0||o||c)&&e.jsxs(w.div,{variants:S,className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:"text-xs text-muted-foreground font-medium mr-1",children:"Priority:"}),e.jsxs(h,{variant:"outline",onClick:()=>A("overdue"),className:C("cursor-pointer shrink-0 inline-flex items-center gap-1 transition-colors",o==="overdue"?"bg-severity-p1/15 text-severity-p1 border-severity-p1/50":"hover:bg-severity-p1/5 text-muted-foreground border-border"),children:[e.jsx(ve,{className:"h-3 w-3"}),"Overdue",e.jsx("span",{className:"ml-0.5 font-mono text-[10px] opacity-80",children:T.overdue})]}),e.jsxs(h,{variant:"outline",onClick:()=>A("due_soon"),className:C("cursor-pointer shrink-0 inline-flex items-center gap-1 transition-colors",o==="due_soon"?"bg-severity-p2/15 text-severity-p2 border-severity-p2/50":"hover:bg-severity-p2/5 text-muted-foreground border-border"),children:[e.jsx(je,{className:"h-3 w-3"}),"Due soon",e.jsx("span",{className:"ml-0.5 font-mono text-[10px] opacity-80",children:T.due_soon})]}),e.jsxs(h,{variant:"outline",onClick:()=>
1A("on_track"),className:C("cursor-pointer shrink-0 inline-flex items-center gap-1 transition-colors",o==="on_track"?"bg-muted text-foreground border-border":"hover:bg-muted/50 text-muted-foreground border-border"),children:[e.jsx(Ne,{className:"h-3 w-3"}),"On track",e.jsx("span",{className:"ml-0.5 font-mono text-[10px] opacity-80",children:T.on_track})]}),e.jsx("span",{className:"mx-1 h-4 w-px bg-border"}),e.jsxs(h,{variant:"outline",onClick:ne,className:C("cursor-pointer shrink-0 inline-flex items-center gap-1 transition-colors",c==="recurring"?"bg-stage-diagnosis/15 text-stage-diagnosis border-stage-diagnosis/50":"hover:bg-stage-diagnosis/5 text-muted-foreground border-border"),children:[e.jsx(Ee,{className:"h-3 w-3"}),"Recurring",e.jsx("span",{className:"ml-0.5 font-mono text-[10px] opacity-80",children:te})]}),(o||c)&&e.jsx(h,{variant:"outline",className:"cursor-pointer shrink-0 text-muted-foreground hover:bg-destructive/10",onClick:()=>{s.delete("aging"),s.delete("recurrence"),a(s)},children:"Clear"})]}),b.length===0?e.jsx(G,{className:"glass-card",children:e.jsxs(Q,{className:"flex flex-col items-center justify-center py-12",children:[e.jsx(O,{className:"h-12 w-12 text-muted-foreground/50 mb-4"}),e.jsx("p",{className:"text-lg font-medium",children:"No problems found"}),e.jsx("p",{className:"text-muted-foreground text-sm",children:g||i||o||c?"Try adjusting your filters":"All clear!"})]})}):e.jsx("div",{children:e.jsxs(w.div,{variants:S,className:"flex flex-col gap-4 md:gap-6",children:[n!=="resolved"&&e.jsx(W,{title:"Open Problems",icon:e.jsx(F,{className:"h-4 w-4 text-severity-p2"}),storageKey:"problems-open",className:"glass-card",unclipped:!0,children:$.length===0?e.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"No open problems"}):e.jsx(J,{items:$,scrollParent:_,getKey:t=>t.id,estimateSize:220,renderItem:t=>e.jsx(Y,{problem:t})})}),n!=="open"&&e.jsx(W,{title:"Recently Resolved",icon:e.jsx(O,{className:"h-4 w-4 text-severity-resolved"}),storageKey:"problems-resolved",className:"glass-card",unclipped:!0,children:q.length===0?e.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"No recently resolved problems"}):e.jsx(J,{items:q,scrollParent:_,getKey:t=>t.id,estimateSize:220,renderItem:t=>e.jsx(Y,{problem:t})})})]})}),!d&&e.jsx(Me,{hasNextPage:!!k,isFetchingNextPage:P,onLoadMore:le,label:"Load more problems",root:_})]})}export{ts as default};

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.