import{K as u,M as g,O as o,cT as d,b4 as p,u as c,cX as h,bR as m,j as i,L as R,bW as C,Q as f,d as x,f_ as j,o as y,q as b,c as L}from"./index-CK33qGU_.js";import{R as A}from"./RoleChainingTable-Bhm4Y5YG.js";import{N as T}from"./NoData-CuLyR2Bg.js";import"./useProjectOptions-CUI0IhzU.js";const v=u.injectEndpoints({endpoints:s=>({getRoleChainingList:s.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:s.mutation({query:({projectId:e,id:a,defaultRole:n})=>{const t=d.stringify({defaultRole:n});return{url:`/project/${e}/cloud/role-mappings/${a}?${t}`,method:"put"}},invalidatesTags:(e,a)=>[{type:o.IAMRoleChainingTags.RoleChainingAdminList},{type:o.IAMRoleChainingTags.RoleChainingList}]})})}),{useGetRoleChainingListQuery:M,useUpdateRoleChainingDefaultMutation:Q}=v,E=()=>{const s=p(),{id:e}=c(),{data:a,isLoading:n}=h(),{data:t=[],isLoading:r}=M({id:+e}),{isAdmin:l}=m();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:()=>{s(y(b.settings.iamRoleChaining.list))},mode:"default",children:"edit cloud role ->"})}),t&&t.length>0?i.jsx(A,{roleChaining:t,isEditable:!1}):i.jsx(L,{my:"40px",children:i.jsx(T,{mainText:"No IAM Role Chaining found"})})]}):i.jsx(C,{})};export{E as default};
