import{n as g,f,d as t,o as w,j as e,g as k,e as L,L as N,q as u}from"./index-BTX30BGB.js";import{l as b}from"./networks-CpaxpXQg.js";import{B as A}from"./BaseLayout-C9qzVjMS.js";import{N as C}from"./NotificationRow-BrFpgHY8.js";import{H as B}from"./HelpLink-kd-C01he.js";import{u as S}from"./useSmallScreen-CeyBGfRX.js";const I=()=>{const n=g(),h=f(),x=t.useNotify(),{project:r}=w(),a=S();if(!r)return e.jsx(e.Fragment,{children:"Missing project"});const{data:o=[],error:i,isLoading:c}=k({queryKey:[u.projects,r,u.networkAcls],queryFn:()=>b(r)});i&&x.failure("Loading network ACLs failed",i);const l=o.length>0,j=[{content:"Name",sortKey:"name"},{content:"Description",sortKey:"description"},{content:"Used by",sortKey:"usedBy",className:"u-align--right"}],y=o.map(s=>{var m,p,d;return{columns:[{content:e.jsx(L,{to:`/ui/project/${r}/network-acls/${s.name}`,children:s.name}),role:"rowheader","aria-label":"Name"},{content:s.description,role:"rowheader","aria-label":"Description"},{content:((m=s.used_by)==null?void 0:m.length)??"0",role:"rowheader",className:"u-align--right","aria-label":"Used by"}],sortData:{name:s.name.toLowerCase(),description:(p=s.description)==null?void 0:p.toLowerCase(),usedBy:((d=s.used_by)==null?void 0:d.length)??0}}});return c?e.jsx(N,{}):e.jsx(e.Fragment,{children:e.jsxs(A,{title:e.jsx(B,{href:`${n}/explanation/networks/`,title:"Learn more about networking",children:"ACLs"}),controls:e.jsx(e.Fragment,{children:e.jsxs(t.Button,{appearance:"positive",className:"u-no-margin--bottom",onClick:()=>h(`/ui/project/${r}/network-acls/create`),hasIcon:!a,children:[!a&&e.jsx(t.Icon,{name:"plus",light:!0}),e.jsx("span",{children:"Create ACL"})]})}),children:[e.jsx(C,{}),e.jsxs(t.Row,{children:[l&&e.jsx(t.MainTable,{headers:j,rows:y,paginate:30,responsive:!0,sortable:!0,className:"u-table-layout--auto",emptyStateMsg:"No data to display"}),!c&&!l&&e.jsxs(t.EmptyState,{className:"empty-state",image:e.jsx(t.Icon,{className:"empty-state-icon",name:"exposed"}),title:"No network ACLs found",children:[e.jsx("p",{children:"There are no network ACLs in this project."}),e.jsx("p",{children:e.jsxs("a",{href:`${n}/explanation/network-acls/`,target:"_blank",rel:"noopener noreferrer",children:["Learn more about network ACLs",e.jsx(t.Icon,{className:"external-link-icon",name:"external-link"})]})})]})]})]})})};export{I as default};
