| Current Path : /snap/lxd/38768/share/lxd-ui/assets/ |
| Current File : //snap/lxd/38768/share/lxd-ui/assets/ProfileInstances-DsX_pANP.js |
import{j as e,L as m,R as f,c6 as u,aY as h}from"./index-BsQN_SZU.js";const o=({profile:t,project:n})=>{const a=`${f}/ui/project/${encodeURIComponent(n)}/instances?profile=${encodeURIComponent(t)}`;return e.jsx(m,{className:"u-no-margin u-no-padding",to:a,children:"Go to instances"})},x=({profile:t,affectedProjects:n,headingClassName:a})=>e.jsx(e.Fragment,{children:n?.map(s=>e.jsxs("tr",{className:"instances-by-project list-wrapper",children:[e.jsx("th",{className:a,children:e.jsxs("div",{className:"flexible-container",children:[e.jsx("div",{className:"u-truncate",title:`Project ${s.name}`,children:s.name}),e.jsxs("div",{className:"u-float-right",children:["(",s.instances.length,")"]})]})}),e.jsxs("td",{children:[s.instances.length===0&&e.jsx("i",{className:"u-text--muted no-instances",children:"No instances"}),s.instances.length>0&&e.jsx(o,{profile:t,project:s.name})]})]},s.name))}),j=({profile:t,project:n,usedByInstances:a})=>e.jsx(e.Fragment,{children:a.length>0&&e.jsx("tr",{children:e.jsx("td",{children:e.jsx(o,{profile:t,project:n})})})}),g=({profile:t,project:n,headingClassName:a})=>{const s=n==="default",c=u(n,s,t.used_by),l=s?[{name:n,instances:c.filter(r=>r.project===n)}]:void 0;if(s){const{data:r=[]}=h();r.filter(i=>i.config["features.profiles"]==="false").map(i=>i.name).forEach(i=>l?.push({name:i,instances:c.filter(d=>d.project===i)}))}return s?e.jsx(x,{profile:t.name,affectedProjects:l,headingClassName:a}):e.jsx(j,{profile:t.name,project:n,usedByInstances:c})};export{g as P};