import{v as y,n as d,d as r,g as h,a4 as l,j as t,L as m,q as p}from"./index-Cziemgsu.js";import{B as f}from"./BaseLayout-7LTMOawH.js";import{N as L}from"./NotificationRow-BJRTvUVl.js";import{H as j}from"./HelpLink-C4E8LWq2.js";const b=()=>new Promise((s,a)=>{fetch("/1.0/warnings?recursion=1").then(y).then(o=>s(o.metadata)).catch(a)}),_=()=>{const s=d(),a=r.useNotify(),{data:o=[],error:n,isLoading:i}=h({queryKey:[p.warnings],queryFn:b});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(f,{title:t.jsx(j,{href:`${s}/howto/troubleshoot/`,title:"Learn more about troubleshooting",children:"Warnings"}),children:[t.jsx(L,{}),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(m,{text:"Loading warnings..."}):"No data to display"})})]})})};export{_ as default};
