| 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/NetworkRichChip-D2iomVd3.js |
import{bp as T,j as t,y as j,L as b,d as k,bF as I,bh as L,v as w,R as d,a0 as f,cs as U,O as C,ct as $}from"./index-BFGypnt-.js";import{b as S,u as P,j as _}from"./useNetworks-B1lu5MbM.js";const F=({network:s,project:i})=>{const{data:o}=S(s.name,i);if(o&&o.length>0){const l=o.filter(T).filter(n=>n!==void 0&&n.config&&n.config.parent).map(n=>n.config.parent);if(l.length===0)return"-";const e=[...new Set(l)];return e.length===1?e[0]:`${e.length} different parents`}return s?.config.parent||"-"},A=({networkName:s,projectName:i,networkUrl:o,clusterMember:l})=>{const{data:e,isLoading:n,error:c}=P(s,i,l),{data:a}=_(s,i,l,!n||!c);if(!e&&!n)return t.jsxs(t.Fragment,{children:["Network ",t.jsx(j,{type:"network",value:s,bold:!0})," not found"]});const v=e?.description||"-",g=e?.config["security.acls"]?.split(","),R=e?.config["ipv4.address"]||"-",x=e?.config["ipv6.address"]||"-",m=e?.config.vlan||"-",h=e?.config.mtu||"-",{counters:p}=a??{},r=[{title:"Network",value:e?t.jsx(b,{to:o,title:s,children:s}):t.jsx(k.Spinner,{}),valueTitle:s},{title:"Description",value:v,valueTitle:v},{title:"State",value:a?.state||"-"},{title:"Type",value:e?.type||"-"}];e?.managed&&(e?.type==="bridge"||e?.type==="ovn")?r.push({title:"IPV4",value:R},{title:"IPV6",value:x}):r.push({title:"Parent",value:e&&t.jsx(F,{network:e,project:i})},{title:"VLAN ID",value:m}),I.includes(e?.type??"")?r.push({title:"ACLs",value:t.jsx(L,{items:g?g.map(u=>t.jsx(w,{type:"network-acl",value:u,to:`${d}/ui/project/${encodeURIComponent(i)}/network-acl/${encodeURIComponent(u)}`},u)):[t.jsx(t.Fragment,{children:"-"})]})}):r.push({title:"MTU",value:h});const y=()=>e?{bridge:{title:"MTU",value:h},ovn:{title:"Uplink",value:e.config.network||"-"},macvlan:{title:"GVRP registration",value:e.config.gvrp||"-"},physical:{title:"OVN ingress",value:e.config["ovn.ingress_mode"]||"-"}}[e.type]||{title:"-",value:"-"}:{title:"-",value:"-"};return r.push(y()),r.push({title:"Statistics",value:t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"general-field-label",children:["RX: ",f(p?.bytes_received??0)," (",p?.packets_received??0," packets)"]}),t.jsxs("div",{className:"general-field-label",children:["TX: ",f(p?.bytes_sent??0)," (",p?.packets_sent??0," packets)"]})]})}),r.push({title:"Used by",value:e?.used_by?.length||0}),t.jsx(U,{rows:r,className:"profile-rich-tooltip-table"})},E=({networkName:s,projectName:i,clusterMember:o,className:l,disabled:e})=>{const n=!C($,"height"),c=o?`${d}/ui/project/${encodeURIComponent(i)}/member/${encodeURIComponent(o)}/network/${encodeURIComponent(s)}`:`${d}/ui/project/${encodeURIComponent(i)}/network/${encodeURIComponent(s)}`,a=t.jsx(w,{type:"network",value:s,to:c,hasTitle:!n,className:l,disabled:e});return n?t.jsx(k.Tooltip,{zIndex:1e3,position:"right",message:t.jsx(A,{networkName:s,projectName:i,networkUrl:c,clusterMember:o}),children:a}):t.jsx(t.Fragment,{children:a})};export{E as N};