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