import{M as g,O as o,ea as u,P as d,bx as c,u as p,e2 as h,cy as m,j as i,L as R,cE as x,f as C,q as f,gS as j,t as y,x as L,F as A,c5 as v}from"./index-C6OVXshM.js";import{R as T}from"./RoleChainingTable-Lx3VOUjl.js";import"./useProjectOptions-fOgrzMyU.js";const M=g.injectEndpoints({endpoints:t=>({getRoleChainingList:t.query({query:({id:e})=>({url:`/project/${e}/cloud/role-mappings?sort_by=ID`}),providesTags:d.providesList(o.IAMRoleChainingTags.RoleChainingList),transformResponse:e=>e.count>0?e.items:[]}),updateRoleChainingDefault:t.mutation({query:({projectId:e,id:a,defaultRole:n})=>{const s=u.stringify({defaultRole:n});return{url:`/project/${e}/cloud/role-mappings/${a}?${s}`,method:"put"}},invalidatesTags:(e,a)=>[{type:o.IAMRoleChainingTags.RoleChainingAdminList},{type:o.IAMRoleChainingTags.RoleChainingList}]})})}),{useGetRoleChainingListQuery:b}=M,D=()=>{const t=c(),{id:e}=p(),{data:a,isLoading:n}=h(),{data:s=[],isLoading:r}=b({id:+e}),{isAdmin:l}=m();return r||n?i.jsx(R,{}):a!=null&&a.enabled?i.jsxs(C,{title:"IAM Role Chaining",maxHeight:"calc(100vh - 215px)",contentProps:{pb:0,overflow:"auto"},children:[i.jsx(f,{flexDirection:"row",mb:"28px",children:l&&i.jsx(j,{onClick:()=>{t(y(L.settings.iamRoleChaining.list))},mode:"default",children:"edit cloud role ->"})}),s&&s.length>0?i.jsx(T,{roleChaining:s,isEditable:!1}):i.jsx(A,{my:"40px",children:i.jsx(v,{mainText:"No IAM Role Chaining found"})})]}):i.jsx(x,{})};export{D as default};
