import{O as g,P as o,dU as u,Q as d,bo as p,u as c,dM as h,cl as m,j as i,D as R,cq as C,W as j,a as x,gS as y,s as f,t as L,L as T,bT as A}from"./index-_eM6l4Nf.js";import{R as v}from"./RoleChainingTable-VZbwbdYl.js";import"./useProjectOptions-Drz85yrF.js";const b=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:I}=b,E=()=>{const t=p(),{id:e}=c(),{data:a,isLoading:n}=h(),{data:s=[],isLoading:r}=I({id:+e}),{isAdmin:l}=m();return r||n?i.jsx(R,{}):a!=null&&a.enabled?i.jsxs(j,{title:"IAM Role Chaining",maxHeight:"calc(100vh - 215px)",contentProps:{pb:0,overflow:"auto"},children:[i.jsx(x,{flexDirection:"row",mb:"28px",children:l&&i.jsx(y,{onClick:()=>{t(f(L.settings.iamRoleChaining.list))},mode:"default",children:"edit cloud role ->"})}),s&&s.length>0?i.jsx(v,{roleChaining:s,isEditable:!1}):i.jsx(T,{my:"40px",children:i.jsx(A,{mainText:"No IAM Role Chaining found"})})]}):i.jsx(C,{})};export{E as default};
