| Current Path : /proc/thread-self/root/snap/lxd/current/share/lxd-ui/assets/ |
| Current File : //proc/thread-self/root/snap/lxd/current/share/lxd-ui/assets/NetworkAclList-CuTrznZ-.js |
import{c as j,d as s,I as x,T as w,j as e,r as N,L as y,R as u,p as L,M as f}from"./index-BFGypnt-.js";import{H as k}from"./HelpLink-l4aaXUp-.js";import{P as o}from"./PageHeader-DZVSTM6q.js";import{u as C}from"./projects-DAlFlfjH.js";import{a as b}from"./useNetworkAcls-DNeSgtR0.js";import"./network-acls-DPo6Eh5Y.js";const v=()=>{const d=j(),p=s.useNotify(),{project:n}=x(),{project:i}=w(),{canCreateNetworkAcls:c}=C();if(!n)return e.jsx(e.Fragment,{children:"Missing project"});const{data:r=[],error:a,isLoading:l}=b(n);N.useEffect(()=>{a&&p.failure("Loading ACLs failed",a)},[a]);const g=[{content:"Name",sortKey:"name"},{content:"Description",sortKey:"description"},{content:"Ingress Rules",sortKey:"ingress",className:"u-align--right"},{content:"Egress Rules",sortKey:"egress",className:"u-align--right"},{content:"Used by",sortKey:"usedBy",className:"u-align--right"}],h=r.map(t=>({columns:[{content:e.jsx(y,{to:`${u}/ui/project/${encodeURIComponent(n)}/network-acl/${encodeURIComponent(t.name)}`,children:t.name}),role:"rowheader","aria-label":"Name"},{content:t.description,role:"cell","aria-label":"Description"},{content:t.ingress.length,role:"cell","aria-label":"Ingress rules",className:"u-align--right"},{content:t.egress.length,role:"cell","aria-label":"Egress rules",className:"u-align--right"},{content:(t.used_by??[]).length,role:"cell","aria-label":"Used by",className:"u-align--right"}],sortData:{name:t.name.toLowerCase(),description:t.description?.toLowerCase(),ingress:t.ingress.length,egress:t.egress.length,usedBy:t.used_by?.length??0}}));if(l)return e.jsx(s.Spinner,{className:"u-loader",text:"Loading...",isMainComponent:!0});const m=e.jsxs(s.Button,{appearance:"positive",className:"u-no-margin--bottom",hasIcon:!0,onClick:async()=>d(`${u}/ui/project/${encodeURIComponent(n)}/network-acls/create`),disabled:!c(i),title:c(i)?"":"You do not have permission to create ACLs in this project",children:[e.jsx(s.Icon,{name:"plus",light:!0}),e.jsx("span",{children:"Create ACL"})]});return e.jsxs(s.CustomLayout,{header:e.jsxs(o,{children:[e.jsx(o.Left,{children:e.jsx(o.Title,{children:e.jsx(k,{docPath:"/howto/network_acls/",title:"Learn more about network access control lists",children:"Network Access Control Lists"})})}),e.jsx(o.BaseActions,{children:r.length>0&&m})]}),children:[e.jsx(L,{}),e.jsxs(s.Row,{children:[r.length>0&&e.jsx(s.MainTable,{headers:g,rows:h,responsive:!0,sortable:!0,emptyStateMsg:"No data to display"}),!l&&r.length===0&&e.jsxs(s.EmptyState,{className:"empty-state",image:e.jsx(s.Icon,{className:"empty-state-icon",name:"exposed"}),title:"No network access control lists found",children:[e.jsx("p",{children:"There are no network ACLs in this project."}),e.jsx("p",{children:e.jsx(f,{docPath:"/howto/network_acls/",hasExternalIcon:!0,children:"Learn more about network ACLs"})}),m]})]})]})};export{v as default};