import{j as t,cs as f,cB as v,o as c,R as u,aD as P,a4 as x,em as m,t as L,db as R,aI as h,d as p,en as T,U as C,eo as I}from"./index-C6X1YceK.js";import{P as b,D as k,a as w,b as D}from"./ProfileResourceLimits-Dix7I59c.js";const $=({profile:s,project:o})=>t.jsx(t.Fragment,{children:Object.values(s.devices).some(f)?t.jsx(v,{items:Object.values(s.devices).filter(f).map(e=>t.jsx(c,{type:"network",value:e.network,to:`${u}/ui/project/${encodeURIComponent(o)}/network/${encodeURIComponent(e.network)}`},e.network))}):"-"}),U=({profileName:s,projectName:o})=>{const{data:e,isLoading:a}=P(s,o),{project:i,isLoading:r}=x(),n=m(i);if(!e&&!(a||r))return t.jsxs(t.Fragment,{children:["Profile ",t.jsx(L,{type:"profile",value:s,bold:!0})," not found"]});const d=e?.description||"-",j=R(o,o==="default",e?e.used_by:[]).length,l=e?h(e):"",g=[{title:"Profile",value:e?t.jsx(b,{profile:e}):t.jsx(p.Spinner,{}),valueTitle:s},{title:"Description",value:d,valueTitle:d},{title:"Defined in",value:`${n?"Current":"Default"} project`},{title:"Root storage",value:l?t.jsx(c,{type:"pool",value:l,to:`${u}/ui/project/${encodeURIComponent(o)}/storage/pool/${encodeURIComponent(l)}`}):"-",truncate:!1,className:"storage-list"},{title:"Networks",value:e?t.jsx($,{profile:e,project:o}):"-",truncate:!1,className:"networks-list"},{title:"Devices",value:e?t.jsx(k,{devices:Object.values(e.devices),className:"truncated"}):"-",truncate:!1},{title:"Limits",value:e?t.jsx(w,{profile:e}):"-",truncate:!1},{title:"Configuration",value:t.jsx(D,{profile:e,className:"truncated"}),truncate:!1},{title:"Used by",value:j}];return t.jsx(T,{rows:g,className:"profile-rich-tooltip-table"})},_=({profileName:s,projectName:o,className:e,disabled:a})=>{const i=!C(I,"height"),r=`${u}/ui/project/${encodeURIComponent(o)}/profile/${encodeURIComponent(s)}`,n=t.jsx(c,{type:"profile",value:s,to:r,hasTitle:!i,className:e,disabled:a});return i?t.jsx(p.Tooltip,{zIndex:1e3,position:"right",message:t.jsx(U,{profileName:s,projectName:o}),children:n}):t.jsx(t.Fragment,{children:n})};export{_ as P};
