Your IP : 216.73.216.52


Current Path : /snap/lxd/current/share/lxd-ui/assets/
Upload File :
Current File : //snap/lxd/current/share/lxd-ui/assets/NetworkAclList-CqEuZGyh.js

import{c as j,d as s,C as x,S as w,j as e,r as N,L as y,R as u,p as L,b3 as f}from"./index-BsQN_SZU.js";import{H as C}from"./HelpLink-BJF9zWZL.js";import{P as o}from"./PageHeader-BkhUaI4-.js";import{u as k}from"./projects-CczQ3aFg.js";import{a as b}from"./useNetworkAcls-Bl3lzJua.js";import"./network-acls-bpCzo6oH.js";const B=()=>{const d=j(),p=s.useNotify(),{project:n}=x(),{project:i}=w(),{canCreateNetworkAcls:c}=k();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(C,{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{B as default};