| Current Path : /snap/lxd/38768/share/lxd-ui/assets/ |
| Current File : //snap/lxd/38768/share/lxd-ui/assets/StoragePools-D6bh-iQT.js |
import{c as j,H as x,y as b,j as e,d as t,R as u,C as N,Q as S,aZ as y,s as c,L as f,b3 as v,p as C}from"./index-BsQN_SZU.js";import{D as P}from"./DeleteStoragePoolBtn-IU1yXGAf.js";import{S as L}from"./StoragePoolSize-BNbqTfwA.js";import{H as I}from"./HelpLink-BJF9zWZL.js";import{P as l}from"./PageHeader-BkhUaI4-.js";import{S as w}from"./StoragePoolClusterMember-BaBZgKZ2.js";import"./Meter-cq8smrSm.js";import"./ClusterMemberRichChip-Di9w-E3M.js";import"./ClusterMemberMemoryUsage-DYUQFY0n.js";const m=({project:i,className:a})=>{const o=j(),r=x(),{canCreateStoragePools:n}=b();return e.jsxs(t.Button,{appearance:"positive",className:a,hasIcon:!r,title:n()?"":"You do not have permission to create storage pools",onClick:async()=>o(`${u}/ui/project/${encodeURIComponent(i)}/storage/pools/create`),disabled:!n(),children:[!r&&e.jsx(t.Icon,{name:"plus",light:!0}),e.jsx("span",{children:"Create pool"})]})},$=()=>{const i=t.useNotify(),{project:a}=N(),o=S();if(!a)return e.jsx(e.Fragment,{children:"Missing project"});const{data:r=[],error:n,isLoading:d}=y();n&&i.failure("Loading storage pools failed",n);const g=[{content:"Name",sortKey:"name"},{content:"Driver",sortKey:"driver",className:"driver"},...o?[{content:"Cluster member",className:"cluster-member"}]:[],{content:"Size",className:c("size",{clustered:o})},{content:e.jsx(e.Fragment,{children:"Used by"}),sortKey:"usedBy",className:"u-align--right volumes-total"},{content:"Status",sortKey:"status",className:"status"},{"aria-label":"Actions",className:"u-align--right actions"}],p=r.map(s=>({key:s.name,columns:[{content:e.jsx(f,{to:`${u}/ui/project/${encodeURIComponent(a)}/storage/pool/${encodeURIComponent(s.name)}`,children:s.name}),role:"rowheader","aria-label":"Name"},{content:s.driver,role:"cell","aria-label":"Driver",className:"driver"},...o?[{content:e.jsx(w,{pool:s}),role:"cell","aria-label":"Cluster member",className:"cluster-member"}]:[],{content:e.jsx(L,{pool:s,hasMeterBar:!0}),role:"cell","aria-label":"Size",className:c("size",{clustered:o})},{content:s.used_by?.length??0,role:"cell",className:"u-align--right volumes-total","aria-label":"Volumes in all projects"},{content:s.status,role:"cell","aria-label":"Status",className:"status"},{content:e.jsx(P,{pool:s,project:a},s.name),role:"cell",className:"u-align--right actions","aria-label":"Actions"}],sortData:{name:s.name.toLowerCase(),driver:s.driver,status:s.status,usedBy:s.used_by?.length??0}}));if(d)return e.jsx(t.Spinner,{className:"u-loader",text:"Loading...",isMainComponent:!0});const h=r.length>0?e.jsx(t.Row,{children:e.jsx(t.ScrollableTable,{dependencies:[r],tableId:"storage-pool-table",belowIds:["status-bar"],children:e.jsx(t.MainTable,{id:"storage-pool-table",headers:g,rows:p,sortable:!0,className:"storage-pool-table"})})}):e.jsxs(t.EmptyState,{className:"empty-state",image:e.jsx(t.Icon,{name:"storage-pool",className:"empty-state-icon"}),title:"No pools found in this project",children:[e.jsx("p",{children:"Storage pools will appear here."}),e.jsx("p",{children:e.jsx(v,{docPath:"/explanation/storage/",hasExternalIcon:!0,children:"Learn more about storage pools, volumes and buckets"})}),e.jsx(m,{project:a,className:"empty-state-button"})]});return e.jsxs(t.CustomLayout,{contentClassName:"detail-page",header:e.jsxs(l,{children:[e.jsx(l.Left,{children:e.jsx(l.Title,{children:e.jsx(I,{docPath:"/explanation/storage/",title:"Learn more about storage pools, volumes and buckets",children:"Pools"})})}),e.jsx(l.BaseActions,{children:e.jsx(m,{project:a,className:"u-float-right u-no-margin--bottom"})})]}),children:[e.jsx(C,{}),e.jsx(t.Row,{children:h})]})};export{$ as default};