import{r as o,aX as x,u as y,ac as _,aR as v,gr as j,j as t,a_ as k,ce as $,g as b,e as u,a as F,aY as E,di as I,dj as q}from"./index-d6499a22.js";import{P as L}from"./Panel-b19e8cc0.js";import{u as P}from"./useUserPermissions-3851a25d.js";import"./Deprecated-ec8916ed.js";import"./CardActionButton-ccf1bc35.js";import"./index-da50fbe6.js";import"./file-utils-b5704e1c.js";import"./useCurrentProject-b23444be.js";import"./useProject-0d0fdeb3.js";const G=()=>{x(E.fgMetrics);const{id:s,fsId:r,fgId:a}=y(),{colorMode:l}=_(),d=v(),[i,n]=o.useState(void 0),{currentData:e,isFetching:m,refetch:p}=j({pId:+s,fsId:+r,fgId:+a}),{canEdit:c,isLoading:g,isDataScientist:f}=P();return o.useEffect(()=>{i===void 0&&(async()=>{const h=await new I().request({url:`/elastic/jwt/${+s}`,type:q.get});n(h.data.kibanaUrl)})()},[s,r,a,n,i]),m?t.jsx(k,{}):e?t.jsxs(t.Fragment,{children:[t.jsx(L,{isEditDisabled:!c||f||g,data:e,title:e==null?void 0:e.name,version:e==null?void 0:e.version,pathnamePostFix:"/logs",idColor:"labels.orange",onClickEdit:()=>{d(b(u.featureGroup.edit,u.project.value,{id:s,fsId:r,fgId:a}))},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:'${a}'),type:phrase),query:(match_phrase:(log_arguments.feature_group_id:'${a}')))),index:'onlinefs_${+s}-*',interval:auto,query:(language:kuery,query:''),sort:!('@timestamp',desc))`,width:"100%",height:"100%",frameBorder:"0"})})]}):t.jsx($,{})},A=o.memo(G);export{A as default};
