import{H as j,j as e,aP as p,d as s,af as g,q as c,fb as h}from"./index-C88DWJny.js";import{P as o}from"./PageHeader-6_Og6mu3.js";const y=()=>{const{project:n}=j();if(!n)return e.jsx(e.Fragment,{children:"Missing project"});const{data:i,isLoading:l}=p({queryKey:[c.projects,n,c.projectUsage],queryFn:async()=>h(n)});if(l)return e.jsx(s.Spinner,{className:"u-loader",text:"Loading...",isMainComponent:!0});const u=(r,t)=>["disk","memory"].includes(r)?g(t):t.toString(),a=Object.entries(i.resources),d=[{content:"Resource"},{content:"Limit"},{content:"Usage"}],m=a.map(([r,t])=>({key:r,className:"u-row",columns:[{content:r,role:"rowheader","aria-label":"Resource"},{content:t.Limit>=0?t.Limit:"UNLIMITED",role:"cell","aria-label":"Limit"},{content:u(r,t.Usage),role:"cell","aria-label":"Usage"}]}));return e.jsx(e.Fragment,{children:e.jsx(s.CustomLayout,{header:e.jsx(o,{children:e.jsx(o.Left,{children:e.jsx(o.Title,{children:"Project usage"})})}),children:e.jsx(s.Row,{className:"no-grid-gap",children:e.jsxs(s.Col,{size:12,children:[a.length===0&&e.jsx(s.EmptyState,{className:"empty-state",image:e.jsx(s.Icon,{name:"repository",className:"empty-state-icon"}),title:"No resources found",children:e.jsx("p",{children:"There are no resources in this project."})}),a.length>0&&e.jsx(s.ScrollableTable,{dependencies:a,tableId:"proect-usage-table",belowIds:["status-bar"],children:e.jsx(s.MainTable,{id:"project-usage-table",headers:d,rows:m,sortable:!0})})]})})})})};export{y as default};
