import{P as g,Q as u,T as o,dq as d,bp as p,u as c,du as m,cm as h,j as i,L as R,cr as C,y as x,B as f,gP as j,q as y,s as L,d as A}from"./index-C1DmWO_C.js";import{R as T}from"./RoleChainingTable-ftBd5kM_.js";import{N as v}from"./NoData-Y_e6mfNf.js";import"./useProjectOptions-BhlzfZPS.js";const I=g.injectEndpoints({endpoints:t=>({getRoleChainingList:t.query({query:({id:e})=>({url:`/project/${e}/cloud/role-mappings?sort_by=ID`}),providesTags:u.providesList(o.IAMRoleChainingTags.RoleChainingList),transformResponse:e=>e.count>0?e.items:[]}),updateRoleChainingDefault:t.mutation({query:({projectId:e,id:a,defaultRole:n})=>{const s=d.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,useUpdateRoleChainingDefaultMutation:P}=I,E=()=>{const t=p(),{id:e}=c(),{data:a,isLoading:n}=m(),{data:s=[],isLoading:r}=b({id:+e}),{isAdmin:l}=h();return r||n?i.jsx(R,{}):a!=null&&a.enabled?i.jsxs(x,{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(C,{})};export{E as default};
