import{aX as j,aR as f,r as n,fy as C,fz as R,j as e,a_ as L,ce as b,K as v,a as r,b3 as h,aT as w,g as y,e as N,aG as E,Z as O,O as A,aY as T}from"./index-d6499a22.js";import{N as F}from"./NoData-789df290.js";import{R as G}from"./RoleChainingTable-8c8bc952.js";import{u as S}from"./useProjectOptions-37a90d51.js";import"./iamRoleUtils-0d5d3309.js";const M=()=>{j(T.iamRole);const d=f(),[i,l]=n.useState(""),{data:a=[],isLoading:t}=C(),{data:o,isLoading:g}=R(),[u,c]=n.useState([]),{data:m=[],isLoading:x}=S();n.useEffect(()=>{!t&&a.length>0&&c(i?a.filter(s=>s.projectName.toLowerCase().includes(i)||s.cloudRole.toLowerCase().includes(i)):a)},[t,a,i]);const p=n.useCallback(({target:s})=>{l(s.value)},[l]);return t||g?e.jsx(L,{}):o!=null&&o.enabled?e.jsxs(v,{title:"IAM Role Chaining",maxHeight:"calc(100vh - 230px)",contentProps:{pb:0,overflow:"auto"},children:[e.jsxs(r,{mb:"28px",children:[e.jsxs(r,{width:4/5,children:[e.jsx(h,{color:"primary",mr:"5px",children:a.length}),e.jsx(h,{children:"role chaining"})]}),e.jsx(w,{onClick:()=>{d(y(N.settings.iamRoleChaining.create))},intent:"primary",ml:"auto",mt:-10,children:"New role chaining"})]}),a&&a.length>0?e.jsxs(e.Fragment,{children:[e.jsx(r,{mt:"10px",children:e.jsx(E,{width:"294px",value:i,icon:O.glass,placeholder:"Find a chaining by project name, cloud role...",onChange:p})}),e.jsx(G,{roleChaining:u,isEditable:!0,projectOptions:m,projectLoading:x})]}):e.jsx(A,{my:"40px",children:e.jsx(F,{mainText:"No IAM Role Chaining found"})})]}):e.jsx(b,{})};export{M as default};
