AlaK4X
Linux lhjmq-records 5.15.0-118-generic #128-Ubuntu SMP Fri Jul 5 09:28:59 UTC 2024 x86_64



Your IP : 18.116.52.29


Current Path : /snap/lxd/31333/share/lxd-ui/assets/
Upload File :
Current File : //snap/lxd/31333/share/lxd-ui/assets/NetworkList-45862bf6.js

import{l as y,e as j,d as t,m as x,j as e,f as N,c as b,B as f,H as w,b as L,L as k,q as K}from"./index-13b2882d.js";import{f as B}from"./networks-5caac489.js";const $=()=>{const r=y(),o=j(),p=t.useNotify(),{project:s}=x();if(!s)return e.jsx(e.Fragment,{children:"Missing project"});const{data:i=[],error:l,isLoading:c}=N({queryKey:[K.networks,s],queryFn:()=>B(s)});l&&p.failure("Loading networks failed",l);const n=i.length>0,g=[{content:"Name",sortKey:"name"},{content:"Type",sortKey:"type"},{content:"Managed",sortKey:"managed"},{content:"IPV4",className:"u-align--right"},{content:"IPV6"},{content:"Description",sortKey:"description"},{content:"Used by",sortKey:"usedBy",className:"u-align--right"},{content:"State",sortKey:"state"},{"aria-label":"Actions",className:"u-align--right"}],h=i.map(a=>{var d,m,u;return{columns:[{content:e.jsx(b,{to:`/ui/project/${s}/networks/detail/${a.name}`,children:a.name}),role:"rowheader","aria-label":"Name"},{content:a.type,role:"rowheader","aria-label":"Type"},{content:a.managed?"Yes":"No",role:"rowheader","aria-label":"Managed"},{content:a.config["ipv4.address"],className:"u-align--right",role:"rowheader","aria-label":"IPV4"},{content:a.config["ipv6.address"],role:"rowheader","aria-label":"IPV6"},{content:a.description,role:"rowheader","aria-label":"Description"},{content:((d=a.used_by)==null?void 0:d.length)??"0",role:"rowheader",className:"u-align--right","aria-label":"Used by"},{content:a.status,role:"rowheader","aria-label":"State"},{content:e.jsx(e.Fragment,{}),role:"rowheader",className:"u-align--right","aria-label":"Actions"}],sortData:{name:a.name.toLowerCase(),type:a.type,managed:a.managed,description:(m=a.description)==null?void 0:m.toLowerCase(),state:a.status,usedBy:((u=a.used_by)==null?void 0:u.length)??0}}});return e.jsx(e.Fragment,{children:e.jsxs(f,{title:e.jsx(w,{href:`${r}/explanation/networks/`,title:"Learn more about networking",children:"Networks"}),controls:e.jsxs(e.Fragment,{children:[n&&e.jsx(t.Button,{className:"u-no-margin--bottom",onClick:()=>o(`/ui/project/${s}/networks/map`),children:"See map"}),e.jsx(t.Button,{appearance:"positive",className:"u-no-margin--bottom",onClick:()=>o(`/ui/project/${s}/networks/create`),children:"Create network"})]}),children:[e.jsx(L,{}),e.jsxs(t.Row,{children:[n&&e.jsx(t.MainTable,{headers:g,rows:h,paginate:30,responsive:!0,sortable:!0,className:"u-table-layout--auto",emptyStateMsg:c?e.jsx(k,{text:"Loading networks..."}):"No data to display"}),!c&&!n&&e.jsxs(t.EmptyState,{className:"empty-state",image:e.jsx(t.Icon,{className:"empty-state-icon",name:"connected"}),title:"No networks found",children:[e.jsx("p",{children:"There are no networks in this project."}),e.jsx("p",{children:e.jsxs("a",{href:`${r}/explanation/networks/`,target:"_blank",rel:"noreferrer",children:["Learn more about networks",e.jsx(t.Icon,{className:"external-link-icon",name:"external-link"})]})})]})]})]})})};export{$ as default};