import{r as o,bC as x,u as y,ao as v,bw as _,dZ as b,j as t,L as j,ck as k,q as $,s as u,B as F,bD as q,d4 as E,d5 as I}from"./index-dP1W1_bd.js";import{P as L}from"./Panel-M9AVvYdm.js";import{u as P}from"./useUserPermissions-Olw8jjZn.js";import"./Deprecated-ClfPkp7s.js";import"./CardActionButton-BtCnEqTK.js";import"./uniqBy-6mvKp2Ip.js";import"./FileUploaderButton-frSujVRY.js";import"./useDownload-C3yCvYJa.js";import"./useProject-CXVt1xnE.js";import"./length-BzpOfCdE.js";import"./uniq-98MdbBvs.js";import"./dumbPluralize-CcxDsNiu.js";const B=()=>{x(q.fgMetrics);const{id:s,fsId:a,fgId:r}=y(),{colorMode:l}=v(),m=_(),[i,n]=o.useState(void 0),{currentData:e,isFetching:d,refetch:p}=b({pId:+s,fsId:+a,fgId:+r}),{canEdit:c,isLoading:f,isDataScientist:g}=P();return o.useEffect(()=>{i===void 0&&(async()=>{const h=await new E().request({url:`/elastic/jwt/${+s}`,type:I.get});n(h.data.kibanaUrl)})()},[s,a,r,n,i]),d?t.jsx(j,{}):e?t.jsxs(t.Fragment,{children:[t.jsx(L,{isEditDisabled:!c||g||f,data:e,title:e==null?void 0:e.name,version:e==null?void 0:e.version,pathnamePostFix:"/logs",idColor:"labels.orange",onClickEdit:()=>{m($(u.featureGroup.edit,u.project.value,{id:s,fsId:a,fgId:r}))},onClickRefresh:p}),t.jsx(F,{sx:{my:"20px",height:"100%",...l==="dark"?{filter:"invert(92%)"}:{}},children:t.jsx("iframe",{title:"Online feature group logs",src:`${i}#/?embed=true&hide-filter-bar=true&_g=(filters:!(),refreshInterval:(pause:!t,value:0),time:(from:now-24h,to:now))&_a=(columns:!('@timestamp',priority,log_message),filters:!(('$state':(store:appState),meta:(alias:!n,disabled:!f,index:'onlinefs_${+s}-*',key:log_arguments.feature_group_id,negate:!f,params:(query:'${r}'),type:phrase),query:(match_phrase:(log_arguments.feature_group_id:'${r}')))),index:'onlinefs_${+s}-*',interval:auto,query:(language:kuery,query:''),sort:!('@timestamp',desc))`,width:"100%",height:"100%",frameBorder:"0"})})]}):t.jsx(k,{})},O=o.memo(B);export{O as default};
