import{r as o,bw as x,bx as y,u as b,al as _,bo as j,eb as v,j as s,D as $,cp as I,o as k,q as u,$ as F,du as q,ds as E,dt as P}from"./index-46ma1THH.js";import{P as D}from"./Panel-CnxQ3Lqy.js";import{u as G}from"./useUserPermissions-DiAMkzC6.js";import"./Deprecated-CcWZugSq.js";const L=()=>{x(y.fgMetrics);const{id:t,fsId:r,fgId:a}=b(),{colorMode:l}=_(),d=j(),[i,n]=o.useState(void 0),{currentData:e,isFetching:c,refetch:m}=v({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($,{}):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(k(u.project.featureGroup.edit,u.project.value,{id:t,fsId:r,fgId:a}))},onClickRefresh:m}),s.jsx(F,{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(I,{})},B=o.memo(L);export{B as default};
