import{aY as j,aS as f,r as n,fE as C,fF as R,j as e,a$ as b,cf as L,E as v,Q as r,b4 as h,aU as E,c as w,b as N,aH as y,z as A,o as F,aZ as Q}from"./index-ea7817a2.js";import{N as S}from"./NoData-8733f606.js";import{R as H}from"./RoleChainingTable-e3cbb20d.js";import{u as O}from"./useProjectOptions-6652bb75.js";import"./iamRoleUtils-7a0b61f9.js";const I=()=>{j(Q.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}=O();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(b,{}):o!=null&&o.enabled?e.jsxs(v,{title:"IAM Role Chaining",maxHeight:"calc(100vh - 215px)",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(E,{onClick:()=>{d(w(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(y,{width:"294px",value:i,icon:A.glass,placeholder:"Find a chaining by project name, cloud role...",onChange:p})}),e.jsx(H,{roleChaining:u,isEditable:!0,projectOptions:m,projectLoading:x})]}):e.jsx(F,{my:"40px",children:e.jsx(S,{mainText:"No IAM Role Chaining found"})})]}):e.jsx(L,{})};export{I as default};
