import{v as y,l as d,d as r,f as h,W as l,j as t,B as p,H as m,b as f,L,q as b}from"./index-3c1b2661.js";const j=()=>new Promise((s,a)=>{fetch("/1.0/warnings?recursion=1").then(y).then(o=>s(o.metadata)).catch(a)}),x=()=>{const s=d(),a=r.useNotify(),{data:o=[],error:n,isLoading:i}=h({queryKey:[b.warnings],queryFn:j});n&&a.failure("Loading warnings failed",n);const c=[{content:"Type",sortKey:"type"},{content:"Last message",sortKey:"lastMessage"},{content:"Status",sortKey:"status"},{content:"Severity",sortKey:"severity"},{content:"Count",sortKey:"count",className:"u-align--right"},{content:"Project",sortKey:"project"},{content:"First seen",sortKey:"firstSeen"},{content:"Last seen",sortKey:"lastSeen"}],u=o.map(e=>({columns:[{content:e.type,role:"rowheader","aria-label":"Type"},{content:e.last_message,role:"rowheader","aria-label":"Last message"},{content:e.status,role:"rowheader","aria-label":"Status"},{content:e.severity,role:"rowheader","aria-label":"Severity"},{content:e.count,role:"rowheader",className:"u-align--right","aria-label":"Count"},{content:e.project,role:"rowheader",className:"u-align--center","aria-label":"Project"},{content:l(e.first_seen_at),role:"rowheader","aria-label":"First seen"},{content:l(e.last_seen_at),role:"rowheader","aria-label":"Last seen"}],sortData:{type:e.type,lastMessage:e.last_message.toLowerCase(),status:e.status,severity:e.severity,count:e.count,project:e.project.toLowerCase(),firstSeen:e.first_seen_at,lastSeen:e.last_seen_at}}));return t.jsx(t.Fragment,{children:t.jsxs(p,{title:t.jsx(m,{href:`${s}/howto/troubleshoot/`,title:"Learn more about troubleshooting",children:"Warnings"}),children:[t.jsx(f,{}),t.jsx(r.Row,{children:t.jsx(r.MainTable,{headers:c,rows:u,paginate:30,responsive:!0,sortable:!0,className:"u-table-layout--auto",emptyStateMsg:i?t.jsx(L,{text:"Loading warnings..."}):"No data to display"})})]})})};export{x as default};
