import{g as u,q as d,ak as g,z as b,j as s,d as c}from"./index-DRe7Uehz.js";import{S}from"./ScrollableTable-tzQTcMDf.js";import{S as x}from"./StoragePoolSize-LK8V_koD.js";const h=({onSelect:l,disablePool:a})=>{const{data:n=[],isLoading:i}=u({queryKey:[d.storage],queryFn:()=>g()}),o=[{content:"Name",sortKey:"name"},{content:"Driver",sortKey:"driver"},{content:"Status",sortKey:"status"},{content:"Size",className:"size"},{"aria-label":"Actions",className:"actions"}],m=n.map(e=>{const r=(a==null?void 0:a.name)===e.name&&(a==null?void 0:a.reason),t=()=>{r||l(e.name)};return{className:b("u-row",{"u-text--muted":r,"u-row--disabled":r}),columns:[{content:s.jsx("div",{className:"u-truncate migrate-instance-name",title:e.name,children:e.name}),role:"cell","aria-label":"Name",onClick:t},{content:e.driver,role:"cell","aria-label":"Driver",onClick:t},{content:e.status,role:"cell","aria-label":"Status",onClick:t},{content:s.jsx(x,{pool:e,hasMeterBar:!0}),role:"cell","aria-label":"Size",onClick:t,className:"size"},{content:s.jsx(c.Button,{onClick:t,dense:!0,title:r,disabled:!!r,children:"Select"}),role:"cell","aria-label":"Actions",className:"u-align--right actions",onClick:t}],sortData:{name:e.name.toLowerCase(),driver:e.driver,status:e.status}}});return s.jsx("div",{className:"migrate-instance-table u-selectable-table-rows",children:s.jsx(S,{dependencies:[n],tableId:"migrate-instance-table",belowIds:["status-bar","migrate-instance-actions"],children:s.jsx(c.MainTable,{id:"migrate-instance-table",headers:o,rows:m,sortable:!0,className:"u-table-layout--auto storage-pools",emptyStateMsg:i?"Loading storage pools...":"No storage pools available"})})})};export{h as S};
