Your IP : 216.73.216.52


Current Path : /snap/lxd/38768/share/lxd-ui/assets/
Upload File :
Current File : //snap/lxd/38768/share/lxd-ui/assets/NetworkIPAM-BiXyunhq.js

import{d as s,C as N,J as f,r as x,j as t,bU as I,bM as b,p as g,b3 as C,R as p,x as l}from"./index-BsQN_SZU.js";import{H as U}from"./HelpLink-BJF9zWZL.js";import{P as i}from"./PageHeader-BkhUaI4-.js";import{h as R,k as A}from"./useNetworks-1j5RF-bH.js";import{U as L}from"./UsedByItem-DYTdOZkC.js";import{I as P}from"./InstanceIpEdit-Dh7Kdppb.js";import{N as T}from"./NetworkRichChip-Cp8QBNS_.js";import"./SshKeyForm-BNz7yPwa.js";import"./limits-yeXZOxhv.js";import"./AutoExpandingTextArea-Bd-45rZK.js";import"./formFields-DzJouV_d.js";import"./scroll-Dc7Cgzms.js";import"./ProjectRichChip-DZzjTfq6.js";import"./ConfigFieldDescription-CjXKAIpa.js";import"./snapshots-LtzKNDw1.js";const W=()=>{const y=s.useNotify(),{project:o}=N(),{data:a=[],error:c,isLoading:m}=f({queryKey:[l.projects,o,l.networkAllocations],queryFn:async()=>A(o??"default")}),{data:u}=R(o??""),w=e=>u?.find(d=>d.name===e.network)?.type;if(x.useEffect(()=>{c&&y.failure("Loading network allocations failed",c)},[c]),!o)return t.jsx(t.Fragment,{children:"Missing project"});const h=[{content:"Type",sortKey:"type",className:"type"},{content:"Used by",sortKey:"usedBy",className:"usedBy"},{content:"Network",sortKey:"network",className:"network"},{content:"NAT",sortKey:"nat",className:"nat"},{content:"MAC address",sortKey:"hwaddress",className:"hwaddr"},{content:"Address",sortKey:"address",className:"address"}],j=a.map(e=>{const d=I(e.type,[e.used_by]),n=d.length===1?d[0]:null,k=r=>e.type==="instance"?`${p}/ui/project/${encodeURIComponent(r.project)}/instance/${encodeURIComponent(r.name)}`:e.type==="network"?`${p}/ui/project/${encodeURIComponent(r.project)}/network/${encodeURIComponent(r.name)}`:e.type==="network-forward"&&r.network?`${p}/ui/project/${encodeURIComponent(r.project)}/network/${encodeURIComponent(r.network)}/forwards`:"";return{columns:[{content:e.type,role:"cell",className:"type"},{content:n&&t.jsx(L,{item:n,activeProject:o,type:e.type,to:k(n)}),role:"rowheader",className:"usedBy"},{content:t.jsx(T,{networkName:e.network,projectName:o}),role:"cell",className:"network"},{content:e.nat?"Yes":"No",role:"cell",className:"nat"},{content:e.hwaddr,role:"cell",className:"hwaddr"},{content:e.type==="instance"&&n&&b.includes(w(e)??"")?t.jsx(P,{address:e.addresses,instanceName:n.name,projectName:n.project}):t.jsx(t.Fragment,{children:e.addresses}),role:"cell",className:"address"}],sortData:{usedBy:e.used_by.toLowerCase(),type:e.type,nat:e.nat,hwaddress:e.hwaddr,network:e.network?.toLowerCase(),address:e.addresses}}});return m?t.jsx(s.Spinner,{className:"u-loader",text:"Loading...",isMainComponent:!0}):t.jsxs(s.CustomLayout,{header:t.jsx(i,{children:t.jsx(i.Left,{children:t.jsx(i.Title,{children:t.jsx(U,{docPath:"/howto/network_ipam/",title:"Learn more about IPAM",children:"IP Address Management"})})})}),children:[t.jsx(g,{}),t.jsxs(s.Row,{children:[a.length>0&&t.jsx(s.ScrollableTable,{dependencies:a,tableId:"network-ipam-table",belowIds:["status-bar"],children:t.jsx(s.MainTable,{className:"network-ipam-table",id:"network-ipam-table",headers:h,rows:j,defaultSort:"address",defaultSortDirection:"ascending",responsive:!0,sortable:!0,emptyStateMsg:"No data to display"})}),!m&&a.length===0&&t.jsxs(s.EmptyState,{className:"empty-state",image:t.jsx(s.Icon,{className:"empty-state-icon",name:"exposed"}),title:"No network allocations found",children:[t.jsx("p",{children:"There are no network allocations in this project."}),t.jsx("p",{children:t.jsx(C,{docPath:"/howto/network_ipam/",hasExternalIcon:!0,children:"Learn more about network allocations"})})]})]})]})};export{W as default};