/
proc
/
3430793
/
root
/
snap
/
lxd
/
current
/
share
/
lxd-ui
/
assets
/
File Upload :
llllll
Current File: //proc/3430793/root/snap/lxd/current/share/lxd-ui/assets/StoragePools-DxyTqJSw.js
import{c as x,x as v,E as y,j as e,d as a,n as I,o as P,D as k,aE as L,t as j,L as V,e as w}from"./index-dL2n30-Z.js";import{D as B}from"./DeleteStoragePoolBtn-BRw8z49I.js";import{S as R}from"./StoragePoolSize-BwIynhzl.js";import{S as D}from"./ScrollableTable-CQDmfMtz.js";import{H as $}from"./HelpLink-C3KAssP1.js";import{P as m}from"./PageHeader-5dI4zJHr.js";import{S as E}from"./StoragePoolClusterMember-CcrqLmFp.js";import"./Meter-BBGrNnHA.js";const h=({project:n,className:l})=>{const s=x(),o=v(),{canCreateStoragePools:r}=y();return e.jsxs(a.Button,{appearance:"positive",className:l,hasIcon:!o,title:r()?"":"You do not have permission to create storage pools",onClick:async()=>s(`/ui/project/${encodeURIComponent(n)}/storage/pools/create`),disabled:!r(),children:[!o&&e.jsx(a.Icon,{name:"plus",light:!0}),e.jsx("span",{children:"Create pool"})]})},z=({project:n,pool:l,children:s,...o})=>{const r=x(),c=()=>{r(`/ui/project/${encodeURIComponent(n)}/storage/volumes?pool=${encodeURIComponent(l)}`)};return e.jsx(a.Button,{onClick:c,...o,children:s})},W=()=>{const n=I(),l=a.useNotify(),{project:s}=P(),o=k();if(!s)return e.jsx(e.Fragment,{children:"Missing project"});const{data:r=[],error:c,isLoading:b}=L();c&&l.failure("Loading storage pools failed",c);const N=s==="default",f=[{content:"Name",sortKey:"name"},{content:"Driver",sortKey:"driver",className:"driver"},...o?[{content:"Cluster member",className:"cluster-member"}]:[],{content:"Size",className:j("size",{clustered:o})},{content:e.jsxs(e.Fragment,{children:["Volumes",e.jsx("br",{}),"(this project)"]}),sortKey:"projectVolumes",className:"u-align--right volumes-this-project"},{content:e.jsxs(e.Fragment,{children:["Volumes",e.jsx("br",{}),"(all projects)"]}),sortKey:"allVolumes",className:"u-align--right volumes-total"},{content:"Status",sortKey:"status",className:"status"},{"aria-label":"Actions",className:"u-align--right actions"}],S=r.map(t=>{var g;const u=((g=t.used_by)==null?void 0:g.filter(i=>!i.startsWith("/1.0/profiles")))??[],d=u.filter(i=>N?!i.includes("project="):i.includes("project="+s)).length,p=u.length;return{key:t.name,columns:[{content:e.jsx(V,{to:`/ui/project/${encodeURIComponent(s)}/storage/pool/${encodeURIComponent(t.name)}`,children:t.name}),role:"rowheader","aria-label":"Name"},{content:t.driver,role:"cell","aria-label":"Driver",className:"driver"},...o?[{content:e.jsx(E,{pool:t}),role:"cell","aria-label":"Cluster member",className:"cluster-member"}]:[],{content:e.jsx(R,{pool:t,hasMeterBar:!0}),role:"cell","aria-label":"Size",className:j("size",{clustered:o})},{content:e.jsx(z,{project:s,pool:t.name,appearance:"link",className:"u-no-margin--bottom",children:d}),role:"cell",className:"u-align--right volumes-this-project","aria-label":"Volumes in this projects"},{content:p,role:"cell",className:"u-align--right volumes-total","aria-label":"Volumes in all projects"},{content:t.status,role:"cell","aria-label":"Status",className:"status"},{content:e.jsx(B,{pool:t,project:s},t.name),role:"cell",className:"u-align--right actions","aria-label":"Actions"}],sortData:{name:t.name.toLowerCase(),driver:t.driver,status:t.status,projectVolumes:d,allVolumes:p}}});if(b)return e.jsx(a.Spinner,{className:"u-loader",text:"Loading...",isMainComponent:!0});const C=r.length>0?e.jsx(a.Row,{children:e.jsx(D,{dependencies:[r],tableId:"storage-pool-table",belowIds:["status-bar"],children:e.jsx(a.MainTable,{id:"storage-pool-table",headers:f,rows:S,sortable:!0,className:"storage-pool-table"})})}):e.jsxs(a.EmptyState,{className:"empty-state",image:e.jsx(a.Icon,{name:"switcher-dashboard",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.jsxs("a",{href:`${n}/explanation/storage/`,target:"_blank",rel:"noopener noreferrer",children:["Learn more about storage",e.jsx(a.Icon,{className:"external-link-icon",name:"external-link"})]})}),e.jsx(h,{project:s,className:"empty-state-button"})]});return e.jsxs(a.CustomLayout,{contentClassName:"detail-page",header:e.jsxs(m,{children:[e.jsx(m.Left,{children:e.jsx(m.Title,{children:e.jsx($,{href:`${n}/explanation/storage/`,title:"Learn more about storage pools, volumes and buckets",children:"Pools"})})}),e.jsx(m.BaseActions,{children:e.jsx(h,{project:s,className:"u-float-right u-no-margin--bottom"})})]}),children:[e.jsx(w,{}),e.jsx(a.Row,{children:C})]})};export{W as default};
Copyright ©2k19 -
Hexid
|
Tex7ure