import{T as u,U as g,W as o,di as d,bw as p,u as c,dm as m,cf as h,j as i,L as R,ck as C,m as f,B as x,aX as j,q as y,s as v,e as L}from"./index-dP1W1_bd.js";import{R as A}from"./RoleChainingTable-BAflRnbR.js";import{N as T}from"./NoData-DLZ_8GEo.js";import"./useProjectOptions-FXFkYH64.js";const b=u.injectEndpoints({endpoints:t=>({getRoleChainingList:t.query({query:({id:e})=>({url:`/project/${e}/cloud/role-mappings?sort_by=ID`}),providesTags:g.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:I,useUpdateRoleChainingDefaultMutation:k}=b,w=()=>{const t=p(),{id:e}=c(),{data:a,isLoading:n}=m(),{data:s=[],isLoading:r}=I({id:+e}),{isAdmin:l}=h();return r||n?i.jsx(R,{}):a!=null&&a.enabled?i.jsxs(f,{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(j,{onClick:()=>{t(y(v.settings.iamRoleChaining.list))},mode:"default",children:"edit cloud role ->"})}),s&&s.length>0?i.jsx(A,{roleChaining:s,isEditable:!1}):i.jsx(L,{my:"40px",children:i.jsx(T,{mainText:"No IAM Role Chaining found"})})]}):i.jsx(C,{})};export{w as default};
