import{r as o,bx as x,by as y,u as _,al as v,bo as j,ee as b,j as s,D as I,cq as k,s as F,t as u,a as $,dx as q,dv as E,dw as P}from"./index-_eM6l4Nf.js";import{P as D}from"./Panel-BNKhRIJO.js";import{u as G}from"./useUserPermissions-Dd9YjnbM.js";import"./Deprecated-Cn0z8EIY.js";const L=()=>{x(y.fgMetrics);const{id:t,fsId:r,fgId:a}=_(),{colorMode:l}=v(),d=j(),[i,n]=o.useState(void 0),{currentData:e,isFetching:c,refetch:m}=b({pId:+t,fsId:+r,fgId:+a}),{canEdit:p,isLoading:f,isDataScientist:g}=G();return o.useEffect(()=>{i===void 0&&(async()=>{const h=await new E().request({url:`/elastic/jwt/${+t}`,type:P.get});n(h.data.kibanaUrl)})()},[t,r,a,n,i]),c?s.jsx(I,{}):e?s.jsxs(s.Fragment,{children:[s.jsx(D,{isEditDisabled:!p||g||f,data:e,title:e==null?void 0:e.name,version:e==null?void 0:e.version,pathnamePostFix:"/logs",idColor:"labels.orange",onClickEdit:()=>{d(F(u.project.featureGroup.edit,u.project.value,{id:t,fsId:r,fgId:a}))},onClickRefresh:m}),s.jsx($,{sx:{my:"20px",height:"100%",...l==="dark"?{filter:"invert(92%)"}:{}},children:s.jsx("iframe",{title:"Online feature group logs",src:`${q}${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_${+t}-*',key:log_arguments.feature_group_id,negate:!f,params:(query:'${a}'),type:phrase),query:(match_phrase:(log_arguments.feature_group_id:'${a}')))),index:'onlinefs_${+t}-*',interval:auto,query:(language:kuery,query:''),sort:!('@timestamp',desc))`,width:"100%",height:"100%",frameBorder:"0"})})]}):s.jsx(k,{})},B=o.memo(L);export{B as default};
