"use strict";(self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[8642],{8642:(e,s,r)=>{r.r(s),r.d(s,{default:()=>j});var t=r(65043),n=r(89923),a=r(73216),l=r(20649),i=r(77938),c=r(99161),o=r(21383),d=r(64159),x=r(64681),p=r(6681),u=r(48793),h=r(88617),K=r(70579);const j=()=>{const e=(0,o.jL)(),s=(0,a.Zp)(),[r,j]=(0,t.useState)(""),[S,f]=(0,t.useState)(!1),[_,m]=(0,t.useState)([]),y=(0,i._)(c.Ms,[c.OV.KMS_CREATE_KEY]),E=(0,i._)(c.Ms,[c.OV.KMS_LIST_KEYS]);(0,t.useEffect)((()=>{b()}),[]),(0,t.useEffect)((()=>{f(!0)}),[r]),(0,t.useEffect)((()=>{if(S)if(E){let s=""===r.trim()?"*":r.trim();l.A.invoke("GET",`/api/v1/kms/keys?pattern=${s}`).then((e=>{f(!1),m(e.results)})).catch((s=>{f(!1),e((0,d.C9)(s))}))}else f(!1)}),[S,f,m,e,E,r]);const b=()=>{f(!0)};return(0,t.useEffect)((()=>{e((0,d.ph)("list_keys"))}),[e]),(0,K.jsxs)(t.Fragment,{children:[(0,K.jsx)(u.A,{label:"Key Management Service Keys",actions:(0,K.jsx)(h.A,{})}),(0,K.jsx)(n.Mxu,{children:(0,K.jsxs)(n.xA9,{container:!0,children:[(0,K.jsxs)(n.xA9,{item:!0,xs:12,sx:{display:"flex",alignItems:"center",justifyContent:"flex-end","& button":{marginLeft:"8px"}},children:[(0,K.jsx)(i.R,{scopes:[c.OV.KMS_LIST_KEYS],resource:c.Ms,errorProps:{disabled:!0},children:(0,K.jsx)(x.A,{onChange:j,placeholder:"Search Keys with pattern",value:r})}),(0,K.jsx)(i.R,{scopes:[c.OV.KMS_LIST_KEYS],resource:c.Ms,errorProps:{disabled:!0},children:(0,K.jsx)(p.A,{tooltip:"Refresh",children:(0,K.jsx)(n.$nd,{id:"refresh-keys",variant:"regular",icon:(0,K.jsx)(n.fNY,{}),onClick:()=>f(!0)})})}),y?(0,K.jsx)(i.R,{scopes:[c.OV.KMS_CREATE_KEY],resource:c.Ms,errorProps:{disabled:!0},children:(0,K.jsx)(p.A,{tooltip:"Create Key",children:(0,K.jsx)(n.$nd,{id:"create-key",label:"Create Key",variant:"callAction",icon:(0,K.jsx)(n.REV,{}),onClick:()=>s(c.zZ.KMS_KEYS_ADD)})})}):null]}),(0,K.jsx)(n.xA9,{item:!0,xs:12,sx:{marginTop:"5px"},children:(0,K.jsx)(i.R,{scopes:[c.OV.KMS_LIST_KEYS],resource:c.Ms,errorProps:{disabled:!0},children:(0,K.jsx)(n.bQt,{columns:[{label:"Name",elementKey:"name"},{label:"Created By",elementKey:"createdBy"},{label:"Created At",elementKey:"createdAt"}],isLoading:S,records:_,entityName:"Keys",idField:"name"})})})]})})]})}}}]);
//# sourceMappingURL=8642.6ba87ff0.chunk.js.map