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