| Current Path : /proc/thread-self/root/snap/lxd/current/share/lxd-ui/assets/ |
| Current File : //proc/thread-self/root/snap/lxd/current/share/lxd-ui/assets/ProjectRichChip-CtiU36yR.js |
import{al as I,K as S,j as e,y as C,ad as D,ac as N,cr as b,L as y,R as f,aM as U,d as l,v as d,cs as O,O as B,ct as E}from"./index-BFGypnt-.js";import{a as F}from"./useProfiles-CErbukD2.js";const M=({projectName:s})=>{const{data:t,isLoading:g}=I(s),{data:r,isLoading:c}=F("default",s),{hasProjectsNetworksZones:u,hasStorageBuckets:j}=S();if(!t&&!(g||c))return e.jsxs(e.Fragment,{children:["Project ",e.jsx(C,{type:"project",value:s,bold:!0})," not found"]});const h=t?.description||"-",m=r?D(r):"",p=r?N(r):"none",k=t?.config?.restricted==="true",v=t?.config?.["features.images"]==="true",P=b(t),x=t?.config?.["features.networks"]==="true",L=t?.config?.["features.networks.zones"]==="true",w=t?.config?.["features.storage.buckets"]==="true",$=t?.config?.["features.storage.volumes"]==="true",i=[];v&&i.push("Images"),P&&i.push("Profiles"),x&&i.push("Networks"),u&&L&&i.push("Network zones"),j&&w&&i.push("Storage buckets"),$&&i.push("Storage volumes");const o=[],n=[],a=[];t?.config?.["limits.instances"]&&o.push(`Instances: ${t.config["limits.instances"]}`),t?.config?.["limits.containers"]&&o.push(`Containers: ${t.config["limits.containers"]}`),t?.config?.["limits.virtual-machines"]&&o.push(`VMs: ${t.config["limits.virtual-machines"]}`),t?.config?.["limits.cpu"]&&n.push(`CPU: ${t.config["limits.cpu"]}`),t?.config?.["limits.memory"]&&n.push(`Memory: ${t.config["limits.memory"]}`),t?.config?.["limits.processes"]&&n.push(`Processes: ${t.config["limits.processes"]}`),t?.config?.["limits.disk"]&&a.push(`Disk: ${t.config["limits.disk"]}`),t?.config?.["limits.networks"]&&a.push(`Networks: ${t.config["limits.networks"]}`);const R=[{title:"Project",value:t?e.jsx(y,{to:`${f}/ui/project/${encodeURIComponent(s)}`,onClick:T=>{T.stopPropagation()},children:e.jsx(U,{item:t})}):e.jsx(l.Spinner,{}),valueTitle:s},{title:"Description",value:h,valueTitle:h},{title:"Default root storage",value:m?e.jsx(d,{type:"pool",value:m,to:`${f}/ui/project/${encodeURIComponent(s)}/storage/pool/${encodeURIComponent(m)}`}):"-",truncate:!1},{title:"Default instance network",value:p!=="none"?e.jsx(d,{type:"network",value:p,to:`${f}/ui/project/${encodeURIComponent(s)}/network/${encodeURIComponent(p)}`}):"-",truncate:!1},{title:"Isolation",value:i.length>0?e.jsx(l.List,{items:i,middot:!0,className:"u-no-margin truncated",title:i.join(", ")}):"-",valueTitle:i.length>0?i.join(", "):"-"},{title:"Restrictions",value:k?"Enabled":"Disabled"},{title:"Instance limits",value:o.length>0?e.jsx(l.List,{items:o,middot:!0,className:"u-no-margin truncated",title:o.join(", ")}):"-",valueTitle:o.length>0?o.join(", "):"-"},{title:"Compute limits",value:n.length>0?e.jsx(l.List,{items:n,middot:!0,className:"u-no-margin truncated",title:n.join(", ")}):"-",valueTitle:n.length>0?n.join(", "):"-"},{title:"Storage & Network",value:a.length>0?e.jsx(l.List,{items:a,middot:!0,className:"u-no-margin truncated",title:a.join(", ")}):"-",valueTitle:a.length>0?a.join(", "):"-"}];return e.jsx(O,{rows:R,className:"project-rich-tooltip-table"})},K=({projectName:s,urlSuffix:t="",className:g,disabled:r})=>{const c=!B(E,"height"),u=e.jsx(d,{type:"project",value:s,to:`${f}/ui/project/${encodeURIComponent(s)}${t}`,hasTitle:!c,className:g,disabled:r});return c?e.jsx(l.Tooltip,{zIndex:1e3,position:"right",message:e.jsx(M,{projectName:s}),children:u}):e.jsx(e.Fragment,{children:u})};export{K as P};