import{M as g,O as o,eb as u,P as d,bx as c,u as p,e3 as h,cy as m,j as i,L as R,cE as x,f as C,q as f,gR as j,t as y,x as L,F as A,c5 as v}from"./index-DHiyXWqE.js";import{R as T}from"./RoleChainingTable-BT5MQM-P.js";import"./useProjectOptions-BfTYzbpl.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:s,defaultRole:n})=>{const a=u.stringify({defaultRole:n});return{url:`/project/${e}/cloud/role-mappings/${s}?${a}`,method:"put"}},invalidatesTags:(e,s)=>[{type:o.IAMRoleChainingTags.RoleChainingAdminList},{type:o.IAMRoleChainingTags.RoleChainingList}]})})}),{useGetRoleChainingListQuery:M}=b,D=()=>{const t=c(),{id:e}=p(),{data:s,isLoading:n}=h(),{data:a=[],isLoading:r}=M({id:+e}),{isAdmin:l}=m();return r||n?i.jsx(R,{}):s!=null&&s.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 ->"})}),a&&a.length>0?i.jsx(T,{roleChaining:a,isEditable:!1}):i.jsx(A,{my:"40px",children:i.jsx(v,{mainText:"No IAM Role Chaining found"})})]}):i.jsx(x,{})};export{D as default};
