import{j as t,cv as f,cE as g,o as c,R as u,aD as P,a4 as x,ep as m,t as L,de as R,aI as h,d as p,eq as T,U as C,er as I}from"./index-Dz5JRQhj.js";import{P as k,D as w,a as b,b as D}from"./ProfileResourceLimits-Bjfzp666.js";const $=({profile:s,project:o})=>t.jsx(t.Fragment,{children:Object.values(s.devices).some(f)?t.jsx(g,{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:r}=P(s,o),{project:i,isLoading:a}=x(),n=m(i);if(!e&&!(r||a))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):"",v=[{title:"Profile",value:e?t.jsx(k,{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(w,{devices:Object.values(e.devices),className:"truncated"}):"-",truncate:!1},{title:"Limits",value:e?t.jsx(b,{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:v,className:"profile-rich-tooltip-table"})},E=({profileName:s,projectName:o,className:e,disabled:r})=>{const i=!C(I,"height"),a=`${u}/ui/project/${encodeURIComponent(o)}/profile/${encodeURIComponent(s)}`,n=t.jsx(c,{type:"profile",value:s,to:a,hasTitle:!i,className:e,disabled:r});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{E as P};
