1import{r as n,j as e,R as z,M as ee,C as ke,b as ue,v as be,U as Ee,a5 as ds,ap as us,ag as Ye,a as ms,J as ps,P as Le,O as ge,S as hs,F as gs,z as Te,K as vs,w as fs,L as ys,u as xs,A as Ce}from"./CZzrexQa.production.bundle.min.js";import{u as X,s as te}from"./9eHdvLN4.production.bundle.min.js";import{bb as Oe,b3 as Qe,kd as bs,ke as js,f7 as _s,f9 as ks,iF as Ns,fb as Ts,u as Cs,cu as As,cs as ws,gt as ze,gw as Je,gC as Ss,s as Z,cc as qe,cd as Me,p as de,T as ve,cf as le,v as We,br as Is,kf as Es,kg as Ls,e1 as fe,f4 as ye,e0 as Ae,w as we,kh as Rs,ki as Ds,kj as Os,kk as je,kl as Ze,hW as qs,km as Ms,kn as Xe,ko as es,kp as Fs,kq as Bs,kr as Ps,ks as Vs,t as Gs,bf as Ws,f6 as Us,kt as Se,bZ as Ks,bx as $s,ku as Hs,kv as Ys,kw as Qs,kx as zs,ky as Js,dW as Zs}from"./DeceMiF-.production.bundle.min.js";import{T as ss,r as oe,L as Xs,y as et}from"./DQegFpUo.production.bundle.min.js";import{B as Ue}from"./YCM_kEyP.production.bundle.min.js";import{c as Fe,b as Q,S as _e,L as st,i as tt,ah as at}from"./C_cH1u9D.production.bundle.min.js";import{A as ts}from"./CXT9N8xZ.production.bundle.min.js";import{c as rt,g as it}from"./DGPiEcaj.production.bundle.min.js";import{g as Ne,b as nt,r as ot,c as lt,e as ct,f as as,t as dt}from"./B87FJoLq.production.bundle.min.js";import{G as ut}from"./7LcJfZNO.production.bundle.min.js";import{C as mt,D as pt}from"./oN3AJijl.production.bundle.min.js";import{G as ne,a as K,b as rs,W as Re}from"./XIUDksrr.production.bundle.min.js";import{d as ht,r as gt,S as vt}from"./CNsPFEJO.production.bundle.min.js";import{u as is}from"./D1TNtnEv.production.bundle.min.js";import{u as V}from"./DvLd3evF.production.bundle.min.js";import{aa as ce,a6 as ft,o as me}from"./b2Mkg01q.production.bundle.min.js";import{A as yt}from"./BkFsgW6T.production.bundle.min.js";import{A as pe}from"./D4lvmK5r.production.bundle.min.js";import{P as xt,D as bt}from"./CHClG9UV.production.bundle.min.js";import{g as jt}from"./D6diP7ct.production.bundle.min.js";import{U as xe}from"./DMW9XKyf.production.bundle.min.js";import{h as _t,D as kt}from"./3wIbuO__.production.bundle.min.js";import{G as ns}from"./CJIgguc4.production.bundle.min.js";import{A as Nt}from"./BJ0nZLiJ.production.bundle.min.js";import{c as Be}from"./DGYQp8fe.production.bundle.min.js";import{L as Tt}from"./Ch78CD0x.production.bundle.min.js";import{T as Ct}from"./kkIr59yR.production.bundle.min.js";import{I as At}from"./B0uEge7d.production.bundle.min.js";import{b as Ke}from"./Bylw-B_Y.production.bundle.min.js";import{G as wt}from"./CUZmxn9S.production.bundle.min.js";import"./CiD4UJCU.production.bundle.min.js";import"./D-90pMQ7.production.bundle.min.js";import"./BmBjCq8D.production.bundle.min.js";import"./Dsqj8S3w.production.bundle.min.js";import"./Y4Ob0Is8.production.bundle.min.js";import"./DGAisTA8.production.bundle.min.js";import"./C_Ln3svq.production.bundle.min.js";import"./DWUNlcjA.production.bundle.min.js";import"./D8sKcCdJ.production.bundle.min.js";import"./tkddr5kZ.production.bundle.min.js";import"./Bm1LOIPR.production.bundle.min.js";import"./DFn2u8qh.production.bundle.min.js";import"./DtpVAsok.production.bundle.min.js";import"./2mZBARql.production.bundle.min.js";import"./vhNSgALD.production.bundle.min.js";import"./DwmhJbxl.production.bundle.min.js";import"./E6csxmgU.production.bundle.min.js";import"./CpVN2k6O.production.bundle.min.js";import"./B7Fri_dM.production.bundle.min.js";import"./Ci_hGDFV.production.bundle.min.js";import"./CLBsRoPD.production.bundle.min.js";import"./D0x1Z4HE.production.bundle.min.js";import"./DnQqxH0F.production.bundle.min.js";import"./6CErwzJG.production.bundle.min.js";import"./zzLyrqbE.production.bundle.min.js";import"./ClxpELDE.production.bundle.min.js";import"./oDpBuzcf.production.bundle.min.js";import"./CGH77sOA.production.bundle.min.js";import"./B8RfvBQ5.production.bundle.min.js";import"./0848Mj-N.production.bundle.min.js";import"./sGP2xcvT.production.bundle.min.js";import"./drslPOw-.production.bundle.min.js";import"./DzP7rVs8.production.bundle.min.js";import"./DS1fZd27.production.bundle.min.js";import"./IGpOy5ve.production.bundle.min.js";import"./DPhSHDOL.production.bundle.min.js";import"./lhKoKxe1.production.bundle.min.js";import"./DgyXvJj2.production.bundle.min.js";import"./BeGorq6H.production.bundle.min.js";import"./QZU1LdqS.production.bundle.min.js";import"./DY2Z-YLP.production.bundle.min.js";import"./DbuQJihJ.production.bundle.min.js";import"./Gi6I4Gst.production.bundle.min.js";import"./C4B-KCzX.production.bundle.min.js";import"./RPH7bue7.production.bundle.min.js";import"./BnY2Z5Cw.production.bundle.min.js";import"./DwSJhZHa.production.bundle.min.js";import"./Cg7lcwdl.production.bundle.min.js";import"./CzpQ7VYw.production.bundle.min.js";import"./BqsD4Qxx.production.bundle.min.js";import"./fGcVTXcf.production.bundle.min.js";import"./BMcbifYh.production.bundle.min.js";import"./Bt81uVuP.production.bundle.min.js";import"./DegiHwa8.production.bundle.min.js";const St=a=>{const{dashboardCards:s}=a,t=h=>h==null?void 0:h.map(b=>({label:b.title,value:b.key,defaultSelected:b.visible})),d=n.useMemo(()=>t(s??[]),[s]),r=n.useCallback(h=>{const b=[],o=[],_=[];
1s==null||s.forEach(y=>{const R=h.includes(y.key);b.push({key:y.key,visible:R,title:y.title,layout:y.layout}),y.visible!==R&&(R?o.push(y.title):_.push(y.title))}),b.length>0&&a.onItemClick(b,{added:o,removed:_})},[s,a]),p=()=>{const h=s;h==null||h.forEach(b=>{b.visible===!1&&a.onItemClick(b.key,b.visible,b.title)})};return e.jsx("div",{className:"update-block-action",children:e.jsx(mt,{filterOptions:d,handleApplyFilter:h=>r(h),onDefaultLabelClick:p})})},$e=(a,s,t)=>({label:"",builderId:0,scopeId:0,widgetAppId:ss,builderConfig:{with:[{key:"SELECT_DATA_BY",value:["host.name"],is_arg:!0}],columns:[a],source:{name:"host",alias:"",dataset_id:0}},builderViewOptions:{displayScope:""},params:[{key:"from_ts",value:s},{key:"to_ts",value:t}]}),De=()=>{const a=z.useContext(ee),{dateRange:s}=a.params,t=s.fromTs,d=s.toTs,r=a.params.isLive,[p,h]=n.useState(!1),[b,o]=n.useState({up:0,down:0}),_=X(),y=V(Ne),R=n.useMemo(()=>[$e("avg(up_resource_count,value(avg))",t,d),$e("avg(down_resource_count,value(avg))",t,d)],[t,d]),k=l=>_(oe(R,(c,T,D)=>{var w,x,C,i,u,m;if(l!=null&&l()&&(h(T),c&&Array.isArray(D)&&(D==null?void 0:D.length)>=2)){const g=((C=(x=(w=D[0])==null?void 0:w.chart_data)==null?void 0:x[0])==null?void 0:C.value)??0,j=((m=(u=(i=D[1])==null?void 0:i.chart_data)==null?void 0:u[0])==null?void 0:m.value)??0;o({up:g,down:j})}})),N=Oe(k);return Qe(()=>{r?N.start():N.stop()},[r]),n.useEffect(()=>{let l=!0;return k(()=>l),()=>{N.stop(),l=!1}},[t,d,y,_,R]),e.jsx(e.Fragment,{children:e.jsx("div",{className:"card-body",children:p?e.jsx(ke,{}):e.jsx(e.Fragment,{children:e.jsxs("div",{className:"card-summary hexagon-count-container",children:[e.jsx("span",{className:"card-br",children:e.jsxs("div",{className:"d-flex flex-column",children:[e.jsxs("div",{className:"hexagon-count",children:[e.jsx(bs,{}),e.jsx("div",{className:"hext-count",children:b.up})]}),e.jsx("div",{children:e.jsx("div",{className:"count-text",children:e.jsx("span",{children:"UP"})})})]})}),e.jsx("span",{className:"card-br",children:e.jsxs("div",{className:"d-flex flex-column",children:[e.jsxs("div",{className:"hexagon-count",children:[e.jsx(js,{}),e.jsx("div",{className:"hext-count",children:b.down})]}),e.jsx("div",{children:e.jsx("div",{className:"count-text",children:e.jsx("span",{children:"DOWN"})})})]})})]})})})})},It=()=>{const a=[{title:"Status",columnKey:"severityText",render:s=>{const t=s;return e.jsx("span",{className:"severity-column-patterns",style:{color:ks(t)},children:t})},fixed:!0,width:75},{title:"Log",columnKey:"body512",renderTooltipContent:" ",render:(s,t)=>{const d=t,r=s;return e.jsx("div",{onClick:p=>{p.stopPropagation()},children:e.jsx(ce,{title:Ts(r),showBorder:!1,shouldtitleStyleBold:!1,children:e.jsx(Ns,{data:d.attributes,enableClipboard:!0,fingerprint:d.bodyFingerprint})})})},fixed:!0,width:1200}];return e.jsx(_s,{tableUniqueID:"dashboard-logs-table",columns:a,hideOuterInfo:!0,isLogPanelRequired:!0,fullBody:!1,limit:50,pagination:!1})},Et=[{title:"Source",columnKey:"label",render:(a,s)=>{var r;const t=s,d=jt((r=t==null?void 0:t.meta_data)==null?void 0:r.data_source);return e.jsx("div",{className:"column-data-with-icon",children:d||e.jsx(yt,{size:20,seed:t.label})})},width:50,align:pe.Center},{title:"Label",columnKey:"label"},{title:"",columnKey:"favorite",width:50,render:a=>e.jsx(_t,{filled:a}),align:pe.Center}],Lt=()=>{const a=X(),s=ue(),t=Cs();n.useEffect(()=>{a(As({filterBy:null}))},[a]);const d=V(ws),r=n.useMemo(()=>{var p;return((p=d.reports)==null?void 0:p.map(h=>({...h})))??[]},[d.reports]);return e.jsx(e.Fragment,{children:e.jsx("div",{className:"card-body",children:e.jsx("div",{className:"dashboard-list",children:e.jsx(Fe,{columns:Et,uniqId:"onboard-dashboards-list",dataProvider:r,rowOnClick:p=>{p.key==xe&&!t(xt.UnifiedView)?a(te("error",bt)):s(`/dashboards/${p.key}`)},loading:!1})})})})},Rt={metric:Q.Options,billing:Q.Options,kubernetes:Q.Options,trace:Q.Trace,apm:Q.Trace,logs:Q.Trace},Dt=()=>{const a=z.useContext(ee),{dateRange:s}=a.params,t=s.fromTs,d=s.toTs,r=X(),p=V(Ne),[h,b]=z.useState(!1),[o,_]=n.useState(),[y,R]=n.useState(!1),k=V(ze),N=V(rt),[l,c]=n.useState({WARNING:0,CRITICAL:0,OK:0,NODATA:0,NOALERT:0});n.useEffect(()=>{let w=!0;const C=[{key:"triggered_at",values:[be(s.fromTs).format("YYYY-MM-DD HH:mm:ss"),be(s.toTs).format("YYYY-MM-DD HH:mm:ss")]}];C.push({key:"timeZone",values:[Intl.DateTimeFormat().resolvedOptions().timeZone]});const i={filters:C,page:0};return w&&R(!0),r(Je(i)),R(!1),()=>{w=!1}},[t,d,p]);const T=n.useMemo(()=>[{title:"Rule Name",columnKey:"name"},{title:"Rule Status",columnKey:"status",align:pe.Right,render:w=>{const x=w,C=x==100?Q.Warning:x==200?Q.Error:x==10?Q.Success:Q.Default;return e.jsx(_e,{labelText:Ss(x),type:C})}},{title:"Count",columnKey:"count",align:pe.Right,render:w=>{const x=w;return e.jsx("span",{children:Ee(x,!1,!0)})}}],[]);n.useEffect(()=>{let w=0,x=0,C=0,i=0;const u=0;
1N.forEach(m=>{m.status==Z.critical&&(C=m.value),m.status==Z.warning&&(w=m.value),m.status==Z.ok&&(x=m.value),m.status==Z.noalert&&(x=m.value),m.status==Z.nodata&&(i=m.value)}),c({WARNING:w,OK:x,CRITICAL:C,NODATA:i,NOALERT:u})},[N]);const D=n.useMemo(()=>k!=null&&k.rules&&k.rules.length>0?k.rules.sort((x,C)=>new Date(C.triggered_at).getTime()-new Date(x.triggered_at).getTime()):[],[k]);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"card-body",children:y?e.jsx(ke,{}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"card-summary",children:[{key:"CRITICAL",label:"Critical",className:"failed"},{key:"WARNING",label:"Warning",className:"warning"},{key:"OK",label:"Ok",className:"alert"},{key:"NODATA",label:"No data",className:"info"},{key:"NOALERT",label:"No alert",className:"info"}].map(({key:w,label:x,className:C})=>e.jsx("span",{className:"card-br",children:e.jsxs("div",{className:"alert",children:[e.jsx("div",{className:"count-text",children:Ee(l[w],!1,!0)}),e.jsxs("div",{className:"d-flex",children:[e.jsx("span",{className:`square-icon ${C}`}),e.jsx("span",{children:x})]})]})},w))}),e.jsx("div",{className:"card-list",children:e.jsx(Fe,{columns:T,uniqId:"onboard-users-list",dataProvider:D,rowOnClick:w=>{b(!0),_(w)},noDataLabel:"Try changing the timeframe to view more data.",loading:y})})]})}),e.jsx(ns,{title:us((o==null?void 0:o.name)??"",150),isOpen:h,onClose:()=>b(!1),onBackBtnClick:()=>b(!1),bodyPadding:!1,datePicker:!1,dialogContentClassName:"alert-list-panel",headerElements:e.jsx(_e,{labelText:ds((o==null?void 0:o.type.toString())??""),type:Rt[(o==null?void 0:o.type.toString())??""]}),children:(o==null?void 0:o.id)&&e.jsx(Nt,{ruleID:o==null?void 0:o.id,ruleType:o==null?void 0:o.type})})]})},Pe=a=>{const s=Be("onboarding-dashboard-card",a.className);return e.jsxs("div",{className:s,children:[e.jsx("div",{className:"shadow-box"}),e.jsx("div",{className:"common-card-children",children:a.children})]})},Ie=a=>{const s=Be("card-heading",a.className,{dark:a.dark,red:a.red});return e.jsx("div",{className:s,onClick:a.onClick,children:a.children})},Ve=a=>{const s=Be("card-header",a.className),t=is();return e.jsxs("div",{className:s,children:[e.jsx(Ie,{dark:!0,children:a.title}),e.jsxs("div",{className:"card-actions",children:[e.jsxs("span",{className:"card-br",onClick:()=>{t(`click - ${a.viewAllText} on welcome dashboard`)},children:[a.link?e.jsx(Tt,{to:a.link,children:e.jsx(Ie,{red:!0,onClick:a.onLinkClick,children:a.viewAllText})}):e.jsx(Ie,{red:!0,onClick:a.onLinkClick,children:a.viewAllText}),e.jsx("span",{className:"link-icon",children:e.jsx(st,{})})]}),e.jsx("span",{className:"card-br delete-icon",onClick:a.onDeleteClick,children:e.jsx(kt,{color:"#888A8D",size:18})})]})]})},Ot=a=>{const{chartKey:s,onDelete:t}=a,d=V(qe),r=V(Me);return e.jsx("div",{className:"avg-latency-chart-container",children:e.jsx(de,{uniqName:"service-dashboard-avg_response_time_ms",resource:"trace",columns:["avg_response_time_ms"],chartType:Ye,builderProps:{boxTitle:"Avg Latency(ms)",bordered:!0,nestedProps:{showLegend:!1,columnConfig:{avg_response_time_ms:{title:"Avg Latency(ms)"}},actionsMenuProps:{showDeleteExtrenally:!0}},filters:d?r.filters:[]},onDeleteWidget:()=>t==null?void 0:t(s,!0,"Avg Latency (ms)")},"Avg Latency(ms)")})},os=z.memo(Ot),ls=a=>{var j,L,q;const s=ms(),[t,d]=n.useState({isLoading:!1,data:{}}),[r,p]=n.useState({is_loading:!1,data:[],total_records:0}),[h,b]=n.useState(Number(s.get("page"))||1),[o,_]=n.useState({}),[y,R]=n.useState(null),[k,N]=n.useState(!1),l=X(),c=n.useContext(ee),T=V(qe),D=V(Me),w={fromTs:(c==null?void 0:c.params.dateRange.fromTs)||0,toTs:(c==null?void 0:c.params.dateRange.toTs)||0},x=f=>{const S=Le(c.params.dateRange.range),O=c.params.isLive?S:w,E=[];let F=c.params.appliedFilters;F={...F};let G=c.params.queryBarFilter;G={...G};const P=[{key:ge.FromTs,value:O.fromTs},{key:ge.ToTs,value:O.toTs},fe.QUICKWIT];c.params.debug&&P.push(fe.DEBUG);const $=ye({},F,G,0,0,T?D.filters:[]),H={label:"overview-cards",builderId:0,scopeId:0,widgetAppId:5,builderViewOptions:{},params:P,builderConfig:{columns:[le.ERROR_RATE,Ae.SERVICE_NAME,le.SUCCESS_RATE],with:[...$],source:{name:we,alias:"",dataset_id:0}}};E.push(H),l(oe(E,(Y,J,v)=>
1{if(f()&&(d({isLoading:J,data:{}}),!J&&Array.isArray(v)&&v.length>0)){const A=v[0].chart_data,I=M=>{var U;if(Array.isArray(A)){const B=A.find(re=>re.name===M);return(B==null?void 0:B.value)??0}const W=(U=A==null?void 0:A.data)==null?void 0:U[0];return(W==null?void 0:W[M])??0};d({isLoading:!1,data:{avg_error_rate:I(le.ERROR_RATE),active_services:I(Ae.SERVICE_NAME),success_rate:I(le.SUCCESS_RATE)}})}}))},C=JSON.stringify(c.params.appliedFilters),i=JSON.stringify(c.params.queryBarFilter);n.useEffect(()=>{let f=!0;const S=()=>f;return f&&!a.hideStats&&x(S),()=>{f=!1}},[T,c.params.dateRange,C,i]),n.useEffect(()=>()=>{c.params.query.delete("page"),c.params.query.redirect()},[]);const u=(f,S,O,E,F)=>{const G=Le(c.params.dateRange.range),P=c.params.isLive?G:w,$=[],H=[{key:ge.FromTs,value:P.fromTs},{key:ge.ToTs,value:P.toTs},fe.QUICKWIT];c.params.debug&&H.push(fe.DEBUG);const Y=ye(T?{filter_column:D.sortBy.key,filter_value:D.sortBy.order}:f,S,O,E,T?D.pagination.limit:0,T?D.filters:[]),J={label:"",builderId:0,scopeId:0,widgetAppId:Xs,builderViewOptions:{},params:H,builderConfig:{columns:Rs,with:[...Y,{key:hs,value:T?D.groupBy:[ve.SERVICE_NAME],is_arg:!0}],source:{name:we,alias:"",dataset_id:0}}};$.push(J);const v=ye({},S,O,0,T?D.pagination.limit:0,T?D.filters:[]),A={label:"",builderId:0,scopeId:0,widgetAppId:ss,builderViewOptions:{},params:H,builderConfig:{columns:[Ae.SERVICE_NAME],with:[...v],source:{name:we,alias:"",dataset_id:0}}};$.push(A),l(oe($,(I,M,W)=>{var U;if(F()&&(p(B=>({...B,is_loading:B.data.length>0&&c.params.isLive?!1:M})),!M)){if(!F())return;if(p(B=>({...B,is_loading:M})),W&&Array.isArray(W)&&W.length>0){const B=W[0].chart_data.data,re=(U=W[1].chart_data)!=null&&U[0].value?W[1].chart_data[0].value:0;if(!F())return;p(ie=>({...ie,data:B,total_records:re}))}}}))},m=Oe(u);n.useEffect(()=>{let f=!0;if(f)if(c.params.isLive){const S=c.params.appliedFilters||{},O=c.params.queryBarFilter||{};m.start(o,S,O,h,()=>f)}else m.stop();return()=>{m.stop(),f=!1}},[c.params.isLive,JSON.stringify(c.params.appliedFilters),JSON.stringify(c.params.queryBarFilter)]),n.useEffect(()=>{let f=!0;const S=()=>f,O=c.params.appliedFilters||{},E=c.params.queryBarFilter||{};return u(o,O,E,h,S),()=>{f=!1}},[T,c.params.dateRange,o,JSON.stringify(c.params.appliedFilters),JSON.stringify(c.params.queryBarFilter),h]);const g=n.useMemo(()=>[{title:"Service",columnKey:ve.SERVICE_NAME,width:210,render:(f,S)=>{if(!f)return"-";const O=S,E=S,F=(E==null?void 0:E[ve.SERVICE_NAME])||"",G=O[We.TELEMETRY_SDK_LANGUAGE]||O[We.LIBRARY_LANGUAGE]||"unknown";return e.jsxs("div",{style:{display:"flex",alignItems:"center",columnGap:"4px"},children:[e.jsx(Is,{lang:G}),e.jsx("span",{children:F})]})}},{title:"Error Rate",columnKey:le.ERROR_RATE,width:110,align:pe.Center,defaultSortOrder:o.filter_column===le.ERROR_RATE?o.filter_value:ps.Desc,render:f=>e.jsx(ft,{progress:Number((f??0).toFixed(2))})}],[o]);return e.jsxs("div",{className:"apm-block-container",children:[!a.hideStats&&e.jsxs("div",{className:"apm-stat-container",children:[e.jsxs("div",{className:"stat-detail",children:[e.jsx("div",{className:"stat-count warning",children:`${parseFloat(((j=t==null?void 0:t.data)==null?void 0:j.avg_error_rate)??0).toFixed(2)}%`}),e.jsx("div",{className:"stat-text",children:"Avg Error Rate"})]}),e.jsxs("div",{className:"stat-detail",children:[e.jsx("div",{className:"stat-count",children:Ee(parseFloat(((L=t==null?void 0:t.data)==null?void 0:L.active_services)??"0"))}),e.jsx("div",{className:"stat-text",children:"Active Services"})]}),e.jsxs("div",{className:"stat-detail",children:[e.jsx("div",{className:"stat-count success",children:`${parseFloat(((q=t==null?void 0:t.data)==null?void 0:q.success_rate)??0).toFixed(2)}%`}),e.jsx("div",{className:"stat-text",children:"Success Rate"})]})]}),e.jsx("div",{className:"service-table",children:e.jsx(Fe,{columns:g,dataProvider:r.data,loading:r.is_loading,uniqId:"service-list-table",rowOnClick:f=>{R(f),N(!0)},onSortingChange:(f,S)=>{_({filter_column:f,filter_value:S})},pagination:{totalRecords:r.total_records,page:h,onChange:f=>{b(f)}}})}),y&&e.jsx(ns,{shouldCloseOnOverlayClick:!1,title:y[ve.SERVICE_NAME],isOpen:k,dataTestIdBackAction:"panel-back-apm-service",dataTestIdCloseAction:"panel-close-apm-service",dataTestIdDatePicker:"panel-datepicker-apm-service",onClose:()=>{N(!1),R(null)},onBackBtnClick:()=>{N(!1),R(null)},bodyPadding:!1,children:e.jsx(Es,{service:y,tabs:Ls()})})]})},qt=(a,s)=>{let t;switch(a){case ne.Host:t=e.jsx(De,{});break;case ne.Logs:t=e.jsx(It,{});break;case ne.Reports:t=e.jsx(Lt,{});break;case ne.Alerts:t=e.jsx(Dt,{});break;case ne.AvgLatency:t=e.jsx(os,{chartKey:a,onDelete:s});break;case ne.APM:t=e.jsx(ls,{});break;default:t=e.jsx(De,{})}return t},Mt=30,Ft=12,Bt=Ds.WidthProvider(Os),Pt=a=>{const{handleMenuClick:s,onLayoutChange:t,dashboardCards:d}=a;return e.jsx("div",{className:"welcome-dashboard-grid-layout-container",children:e.jsx(Bt,{className:"grid-layout",rowHeight:Mt,cols:Ft,isDraggable:!0,isResizable:!0,draggableHandle:".card-header",containerPadding:[15,15],margin:[15,15],isBounded:!0,onLayoutChange:t,children:d.map(r=>{if(r.visible)return e.jsx("div",{"data-grid":{...r.layout,minW:1,minH:1},className:`card-onboard-dashboard ${r.class}`,children:e.jsxs(Pe,{className:"dashboard-draggable-cards",children:[r.key!==ne.AvgLatency&&e.jsx(Ve,{title:r.title,viewAllText:r==null?void 0:r.viewAllText,link:r==null?void 0:r.link,onDeleteClick:()=>{s(r.key,!0,r.title)}}),qt(r.key,s)]})},`layout-${r.key}`)})})})},Vt=z.memo(Pt),Gt=a=>{const{onDelete:s,dashboardCards:t}=a;return e.jsxs("div",{className:"metrics-widget-container",children:[ae(K.Hosts,t)&&e.jsx("div",{className:"hosts-container",children:e.jsxs(Pe,{children:[e.jsx(Ve,{title:"Hosts",viewAllText:"View All",link:"/infrastru
1cture/host/list",onDeleteClick:()=>{s(K.Hosts,!0,"Hosts")}}),e.jsx(De,{})]})}),ae(K.CPUUsage,t)&&e.jsx("div",{className:"avg-cpu-usage",children:e.jsx(de,{uniqName:"avg-cpu-usage",resource:"host",columns:["avg(system.cpu.utilization,value(avg))"],chartType:"time_series_chart",builderProps:{groupBy:["host.name"],nestedProps:{showLegend:!1,titleInfo:"Avg CPU Usage",yAxisTitle:"Usage Percentage",actionsMenuProps:{showDeleteExtrenally:!0}},boxTitle:"Avg Cpu Usage"},onDeleteWidget:()=>s(K.CPUUsage,!0,"Avg Cpu Usage")})}),ae(K.MemoryBreakdown,t)&&e.jsx("div",{className:"avg-memory-breakdown",children:e.jsx(de,{uniqName:"avg-memory-breakdown",resource:"host",columns:["avg(system.memory.utilization)"],chartType:"time_series_chart",builderProps:{groupBy:["host.name"],nestedProps:{showLegend:!1,titleInfo:"Avg Memory Breakdown",yAxisTitle:"Percentage",actionsMenuProps:{showDeleteExtrenally:!0}},boxTitle:"Avg Memory Breakdown"},onDeleteWidget:()=>s(K.MemoryBreakdown,!0,"Avg Memory Breakdown")})})]})},Wt=a=>{const{onDelete:s,dashboardCards:t}=a;return e.jsxs("div",{className:"logs-widget-container",children:[ae(K.LogsOverTime,t)&&e.jsx("div",{className:"logs-over-time",children:e.jsx(de,{uniqName:"logs-over-time",resource:"log",columns:["total_logs"],chartType:Ye,builderProps:{nestedProps:{showLegend:!1,titleInfo:"Logs over time",columnConfig:{total_logs:{title:"Total Logs"},"INFO-total_logs":{title:"Total Logs",color:"#1570ef"},"WARN-total_logs":{title:"Total Logs",color:"#f79009"},"ERROR-total_logs":{title:"Total Logs",color:"#d92d20"}},actionsMenuProps:{showDeleteExtrenally:!0}},groupBy:["severityText"],boxTitle:"Logs over time"},onDeleteWidget:()=>s(K.LogsOverTime,!0,"Logs over time")})}),ae(K.LogLevelDistribution,t)&&e.jsx("div",{className:"log-level-distribution",children:e.jsx(de,{uniqName:"log-level-distribution",resource:"log",columns:["total_logs"],chartType:"pie_chart",builderProps:{nestedProps:{showLegend:!1,titleInfo:"Log level distribution",columnConfig:{total_logs:{title:"Total Logs"}},actionsMenuProps:{showDeleteExtrenally:!0}},groupBy:["severityText"],boxTitle:"Log level distribution"},onDeleteWidget:()=>s(K.LogLevelDistribution,!0,"Log level distribution")})}),ae(K.PathDistribution,t)&&e.jsx("div",{className:"path-distribution",children:e.jsx(de,{uniqName:"path-distribution",resource:"log",columns:["total_logs"],chartType:"pie_chart",builderProps:{nestedProps:{showLegend:!1,titleInfo:"Path Distribution",columnConfig:{total_logs:{title:"Total Logs"}},actionsMenuProps:{showDeleteExtrenally:!0}},groupBy:["log.file.name"],boxTitle:"Path Distribution"},onDeleteWidget:()=>s(K.PathDistribution,!0,"Path Distribution")})})]})},Ut=z.memo(Wt),Ge=a=>{const{item:s,isLoading:t}=a,d=ue();return e.jsxs("div",{className:"count-card-container",children:[e.jsxs("div",{className:"count-card-title",children:[e.jsx("span",{children:s.title}),s.info&&e.jsx(Ct,{content:s.info||"",children:e.jsx("div",{children:e.jsx(At,{})})})]}),e.jsx("div",{className:"count-card-content",children:e.jsxs("div",{className:"count-content-container",children:[e.jsx("div",{className:"count-card-icon",children:s.icon}),e.jsx("div",{className:`count-text ${s.status??""} ${!t&&(s.onclick||s.link)?"clickable":""}`,onClick:()=>{t||(s.onclick?s.onclick():s.link&&d(s.link))},children:t?e.jsx("div",{className:"loader-container",children:e.jsx(ke,{})}):s.count})]})})]},s.title)},Kt=()=>{var C;const a=X(),s=n.useContext(ee),{dateRange:t}=s.params,d=t.fromTs,r=t.toTs,p=window.location.search,h=new URLSearchParams(p),b=h.get("from_ts"),o=h.get("to_ts"),_=V(Ne),y=V(nt),R=ue(),[k,N]=n.useState({totalContainers:0,totalServices:0,maxLatency:0,uniqTraces:0,errorTraces:0,isBuilderDataLoading:!1}),[l,c]=n.useState(!1),[T,D]=n.useState({spanID:"",traceID:"",spanName:""}),w=i=>{const u=[],m={label:"",builderId:0,scopeId:0,widgetAppId:12,builderConfig:{with:[{key:"SELECT_DATA_BY",value:["container.id"],is_arg:!0}],columns:["uniq(container.id)"],source:{name:"container",alias:"",dataset_id:0}},builderViewOptions:{displayScope:"infrastructure_container_list"},params:[{key:"from_ts",value:d},{key:"to_ts",value:r}]};u.push(m);const g={label:"",builderId:0,scopeId:0,widgetAppId:12,builderConfig:{with:[{key:"SELECT_DATA_BY",value:["k8s.container.name"],is_arg:!0}],columns:["uniq(container.id)"],source:{name:"k8s.container",alias:"",dataset_id:0}}
1,builderViewOptions:{displayScope:"infrastructure_container_list"},params:[{key:"from_ts",value:d},{key:"to_ts",value:r}]};u.push(g);const j={label:"",builderId:0,scopeId:0,widgetAppId:5,builderConfig:{columns:["uniq(service.name)"],source:{name:"trace",alias:"",dataset_id:0}},builderViewOptions:{resource:{columns:["uniq(service.name)"],name:"service-list",resourceType:"trace",widgetAppId:5}},params:[{key:"from_ts",value:d},{key:"to_ts",value:r}]};u.push(j);const L={label:"",builderId:0,scopeId:0,widgetAppId:5,builderConfig:{columns:["max(max_response_time_ns,value(avg))","traceID","spanID","spanName"],source:{name:"trace",alias:"",dataset_id:0}},builderViewOptions:{},params:[{key:"from_ts",value:d},{key:"to_ts",value:r}]};u.push(L);const q={label:"",builderId:0,scopeId:0,widgetAppId:12,builderConfig:{with:[{key:"ATTRIBUTE_FILTER",value:{parentSpanID:{"=":"''"}},is_arg:!0}],columns:["any(total_requests)"],source:{name:"trace",alias:"",dataset_id:0}},builderViewOptions:{},params:[{key:"from_ts",value:d},{key:"to_ts",value:r}]};u.push(q);const f={label:"",builderId:0,scopeId:0,widgetAppId:12,builderConfig:{with:[{key:"ATTRIBUTE_FILTER",value:{statusCode:{"=":"2"}},is_arg:!0}],columns:["count(total_requests)"],source:{name:"trace",alias:"",dataset_id:0}},builderViewOptions:{},params:[{key:"from_ts",value:d},{key:"to_ts",value:r}]};u.push(f),a(oe(u,(S,O,E)=>{let F=0,G=0,P=0,$=0,H=0;if(O&&i&&N({...k,isBuilderDataLoading:!0}),S&&E){const Y=E;u.forEach((J,v)=>{var A;if(v<2)Y[v].chart_data.forEach(M=>{F+=M.value});else{const I=Y[v].chart_data;if(v===2&&(G=(I==null?void 0:I.data[0]["uniq(service.name)"])||0),v===3&&((A=I==null?void 0:I.data)==null?void 0:A.length)>0&&i){P=I==null?void 0:I.data[0]["max(max_response_time_ns,value(avg))"];const U=[{label:"max-latency",builderId:0,scopeId:0,widgetAppId:5,builderConfig:{with:[{key:"ATTRIBUTE_FILTER",value:{durationNano:{"=":P.toString()}},is_arg:!0}],columns:["durationNano","traceID","spanID","spanName"],source:{name:"trace",alias:"",dataset_id:0}},builderViewOptions:{},params:[{key:"from_ts",value:d},{key:"to_ts",value:r}]}];P>0&&a(oe(U,(B,re,ie)=>{if(B&&ie){const he=ie;
1U.forEach((sa,cs)=>{const se=he[cs].chart_data;D({spanID:se==null?void 0:se.data[0].spanID,traceID:se==null?void 0:se.data[0].traceID,spanName:se==null?void 0:se.data[0].spanName})})}}))}const M=Y[v].chart_data;v==4&&($=M[0].value),v==5&&(H=M[0].value)}}),!O&&i&&N({totalContainers:F,totalServices:G,uniqTraces:$,errorTraces:H,maxLatency:P,isBuilderDataLoading:!1})}else!O&&i&&N({...k,isBuilderDataLoading:!1})}))};n.useEffect(()=>{let i=!0;return w(i),i&&c(!0),a(ot({sts:d,ets:r},u=>{u!=null&&u.status&&i&&c(!1)})),()=>{i=!1}},[d,r,_]);const x=n.useMemo(()=>[{title:"Total Errors",count:me(k.errorTraces,!1,!0)||0,icon:e.jsx(je,{}),onclick:()=>{s.actions.handleApplyFilters({hasError:{operator:gs.Equal,values:["true"]}}),R("/apm/traces")}},{title:"Max Latency",count:qs(k.maxLatency)||0,icon:e.jsx(Ze,{}),onclick:()=>{var i;((i=T.traceID)==null?void 0:i.length)<1&&R(`/apm/traces?from_ts=${b}&to_ts=${o}`)}},{title:"Unique Traces",count:me(k.uniqTraces,!1,!0)||0,icon:e.jsx(Ms,{}),link:`/apm/traces?limit=20&from_ts=${b}&to_ts=${o}`},{title:"Synthetic Tests",count:me((y==null?void 0:y.synthetics)??0,!1,!0),icon:e.jsx(Xe,{}),link:"/synthetics"},{title:"Total Services",count:me(k.totalServices,!1,!0)||0,icon:e.jsx(es,{}),link:"/apm/services"},{title:"Total Containers",count:me(k.totalContainers,!1,!0)||0,icon:e.jsx(Fs,{}),link:`/infrastructure/container/list?live=true&from_ts=${b}&to_ts=${o}`}],[k,o,R,y==null?void 0:y.synthetics,s.actions,(C=T.traceID)==null?void 0:C.length,b]);return e.jsx("div",{className:"top-count-section",children:x.map(i=>e.jsx(Ge,{item:i,isLoading:l||k.isBuilderDataLoading},i.title))})},$t=a=>[{title:"Max Latency",count:a.max_latency??0,icon:e.jsx(Ze,{}),info:"Max latency"},{title:"Active Services",count:a.active_services??0,icon:e.jsx(es,{}),status:"success",link:"/apm/services",info:"Number of running services"},{title:"Avg Error Rate",count:a.avg_error_rate,icon:e.jsx(je,{}),status:"warning",link:"/apm/services",info:"Avg error rate"}],Ht=a=>{const[s,t]=n.useState({isLoading:!1,data:{}}),{onDelete:d,dashboardCards:r}=a,p=X(),h=n.useContext(ee),b=V(qe),o=V(Me),_={fromTs:(h==null?void 0:h.params.dateRange.fromTs)||0,toTs:(h==null?void 0:h.params.dateRange.toTs)||0},y=JSON.stringify(h.params.appliedFilters),R=JSON.stringify(h.params.queryBarFilter),k=N=>{const l=Le(h.params.dateRange.range),c=h.params.isLive?l:_,T=[];let D=h.params.appliedFilters;D={...D};let w=h.params.queryBarFilter;w={...w};const x=[{key:"from_ts",value:c.fromTs},{key:"to_ts",value:c.toTs},{key:"quickwit",value:"true"}];h.params.debug&&x.push({key:"debug",value:"true"});const C=ye({},D,w,0,0,b?o.filters:[]),i={label:"overview-cards",builderId:0,scopeId:0,widgetAppId:5,builderViewOptions:{},params:x,builderConfig:{columns:["avg(error_rate,value(avg))","uniq(service.name)","max(max_response_time_ns,value(avg))"],with:[...C],source:{name:"trace",alias:"",dataset_id:0}}};T.push(i),p(oe(T,(u,m,g)=>{if(N()&&(t({isLoading:m,data:{}}),!m&&Array.isArray(g)&&g.length>0)){const j=g[0].chart_data,L=q=>{var O,E;const f=Array.isArray(j==null?void 0:j.columns)?j.columns.find(F=>F.accessor===q):void 0,S=(E=(O=j==null?void 0:j.data)==null?void 0:O[0])==null?void 0:E[q];return tt(S??0,(f==null?void 0:f.tpl)??{})};t({isLoading:!1,data:{avg_error_rate:L("avg(error_rate,value(avg))"),active_services:L("uniq(service.name)"),max_latency:L("max(max_response_time_ns,value(avg))")}})}}))};return n.useEffect(()=>{let N=!0;return N&&k(()=>N),()=>{N=!1}},[b,h.params.dateRange,y,R]),e.jsxs("div",{className:"apm-widgets-container",children:[e.jsx("div",{className:"overview-stat-container",children:$t(s.data).map((N,l)=>e.jsx(Ge,{item:N,isLoading:s.isLoading},l))}),ae(K.Services,r)&&e.jsx("div",{className:"service-table-container",children:e.jsxs(Pe,{children:[e.jsx(Ve,{title:"Services",viewAllText:"View All Services",link:"/apm/services",onDeleteClick:()=>{d(K.Services,!0,"Services")}}),e.jsx("div",{className:"service-list-container",children:e.jsx(ls,{hideStats:!0})})]})}),ae(K.Latency,r)&&e.jsx("div",{className:"latency-graph-container",children:e.jsx(os,{chartKey:K.Latency,onDelete:d})})]})},Yt=()=>{const a=z.useContext(ee),{dateRange:s}=a.params,t=s.fromTs,d=s.toTs,r=X(),p=ue(),h=V(Ne),[b,o]=n.useState(!1),_=V(Bs),y=V(ze);n.useEffect(()=>{const N=[{key:"triggered_at",values:[be(t).format("YYYY-MM-DD HH:mm:ss"),be(d).format("YYYY-MM-DD HH:mm:ss")]}];N.push({key:"timeZone",values:[Intl.DateTimeFormat().resolvedOptions().timeZone]});const l={filters:N,page:0};o(!0),r(Je(l)),r(Ps()),o(!1)},[t,d,h,r]);const R=n.useMemo(()=>{let k=0,N=0,l=0;return _.forEach(c=>
1{c.status===Z.critical&&(N=c.value),c.status===Z.warning&&(k=c.value),c.status===Z.nodata&&(l=c.value)}),[{title:"Triggered Alerts",count:y.total_count??0,icon:e.jsx(Xe,{}),link:"/alerts/rules"},{title:"Warning",count:k,icon:e.jsx(Vs,{}),status:"warning",onclick:()=>{a.params.query.set("status",Z.warning.toString()),p("/alerts/rules")}},{title:"Critical Alerts",count:N,icon:e.jsx(je,{}),status:"error",onclick:()=>{a.params.query.set("status",Z.critical.toString()),p("/alerts/rules")}},{title:"No Data",count:l,icon:e.jsx(je,{}),onclick:()=>{a.params.query.set("status",Z.nodata.toString()),p("/alerts/rules")}}]},[_,y.total_count,p,a.params.query]);return e.jsx("div",{className:"alerts-widget-container",children:R.map((k,N)=>e.jsx(Ge,{item:k,isLoading:b},N))})},He=(a=0,s=0,t=0)=>Math.max(0,a-s-t),Qt=()=>{var l;const a=X(),s=n.useContext(ee),{dateRange:t}=s.params,[d,r]=n.useState({}),[p,h]=n.useState({total:0,ok:0,failed:0,error:0}),b=Gs(),[o,_]=n.useState([]),y=n.useMemo(()=>b.selectors.getMetrics,[b.selectors.getMetrics]),R={resource:"check-engine",kpiType:vs.KpiTypeMetric,widgetType:ys,search:"check.isMultiStep",filterTypes:[Te.TagMapKey,Te.ResourceAttributeKey,Te.AttributeKey],dataType:pt.Filters},k=n.useCallback(()=>{const c=[{key:"from_ts",value:t.fromTs},{key:"to_ts",value:t.toTs}],T=(x,C,i,u=["uniq(check.check_id)"],m)=>{const g={};C&&(g["check.status"]=Array.isArray(C)?{IN:C}:{"=":C}),i&&(g["check.isMultiStep"]={"=":String(i)}),m&&(g["check.protocol"]={"=":m.toString()});let j=g;Object.keys(g).length>1&&(j={and:Object.entries(g).map(([f,S])=>({[f]:S}))});const L=`widget-${x}-id`,q=x;return{label:x,builderId:0,scopeId:0,widgetAppId:12,params:c,builderViewOptions:{},builderConfig:[{with:Object.keys(g).length?[{is_arg:!0,key:fs,value:j}]:[],columns:u,source:{name:"check-engine",alias:"",dataset_id:0},id:L,key:q}]}},D=[T("total-cards"),T("failed-tests","FAIL"),T("error-test","ERROR"),T("ok-tests","OK"),T("alert-tests",["E
1RROR","FAIL"]),T("browser-alert-tests",["ERROR","FAIL"],!1,["uniq(check.check_id)"],Ke),T("browser-ok-tests","OK",!1,["uniq(check.check_id)"],Ke),...o.length>0?[T("alert-multistep-count",["ERROR","FAIL"],!0)]:[],...o.length>0?[T("good-multistep-count",["OK"],!0)]:[]],w={start_ts:t.fromTs,end_ts:t.toTs,session_id:window.mw_user_session};a(Ws(w,x=>{x.error&&a(te("error",x.error)),r(()=>({inflight:x.inflight,result:x.result}))})),a(oe(D,(x,C,i)=>{var u,m,g,j,L,q,f,S,O,E,F,G,P,$,H,Y,J,v,A,I,M,W,U,B,re,ie,he;!C&&Array.isArray(i)&&i.length>0&&h({total:((g=(m=(u=i[0])==null?void 0:u.chart_data)==null?void 0:m[0])==null?void 0:g.value)??0,failed:((q=(L=(j=i[1])==null?void 0:j.chart_data)==null?void 0:L[0])==null?void 0:q.value)??0,error:((O=(S=(f=i[2])==null?void 0:f.chart_data)==null?void 0:S[0])==null?void 0:O.value)??0,ok:((G=(F=(E=i[3])==null?void 0:E.chart_data)==null?void 0:F[0])==null?void 0:G.value)??0,alert:((H=($=(P=i[4])==null?void 0:P.chart_data)==null?void 0:$[0])==null?void 0:H.value)??0,browserAlert:((v=(J=(Y=i[5])==null?void 0:Y.chart_data)==null?void 0:J[0])==null?void 0:v.value)??0,browserOk:((M=(I=(A=i[6])==null?void 0:A.chart_data)==null?void 0:I[0])==null?void 0:M.value)??0,alertMultiStepCount:o.length>0?((B=(U=(W=i[7])==null?void 0:W.chart_data)==null?void 0:U[0])==null?void 0:B.value)??0:0,goodMultiStepCount:o.length>0?((he=(ie=(re=i[8])==null?void 0:re.chart_data)==null?void 0:ie[0])==null?void 0:he.value)??0:0})}))},[a,t,s.params.isLive,o]);n.useEffect(()=>{k(),(async()=>{_(await y(R))})()},[]),n.useEffect(()=>{o.length>0&&k()},[o]);const N=Oe(k);return n.useEffect(()=>(s.params.isLive?N.start():N.stop(),()=>N.stop()),[s.params.isLive]),e.jsxs("div",{className:"synthetic-widget-container",children:[e.jsxs("div",{className:"synthetic-alert-inner-wrapper",children:[e.jsx("div",{className:"synthetic-card",children:e.jsxs("div",{className:"synthetic-detail",children:[e.jsx("div",{className:"alert_title_bold",children:`${p.alert??0} tests`}),e.jsx(_e,{labelText:"Alert",type:Q.Error})]})}),e.jsx("div",{className:"synthetic-card",children:e.jsxs("div",{className:"synthetic-detail",children:[e.jsx("div",{className:"text",children:"API"}),e.jsx("div",{className:"value",children:He(p.alert,p.browserAlert,p.alertMultiStepCount)})]})}),e.jsx("div",{className:"synthetic-card",children:e.jsxs("div",{className:"synthetic-detail",children:[e.jsx("div",{className:"text",children:"Browser"}),e.jsx("div",{className:"value",children:p.browserAlert??0})]})}),e.jsx("div",{className:"synthetic-card",children:e.jsxs("div",{className:"synthetic-detail",children:[e.jsx("div",{className:"text",children:"MultistepAPI"}),e.jsx("div",{className:"value",children:p.alertMultiStepCount??0})]})})]}),e.jsxs("div",{className:"synthetic-alert-inner-wrapper",children:[e.jsx("div",{className:"synthetic-card",children:e.jsxs("div",{className:"synthetic-detail",children:[e.jsx("div",{className:"alert_title_bold",children:`${p.ok??0} tests`}),e.jsx(_e,{labelText:"Good",type:Q.Success})]})}),e.jsx("div",{className:"synthetic-card",children:e.jsxs("div",{className:"synthetic-detail",children:[e.jsx("div",{className:"text",children:"API"}),e.jsx("div",{className:"value",children:He(p.ok,p.browserOk,p.goodMultiStepCount)})]})}),e.jsx("div",{className:"synthetic-card",children:e.jsxs("div",{className:"synthetic-detail",children:[e.jsx("div",{className:"text",children:"Browser"}),e.jsx("div",{className:"value",children:p.browserOk??0})]})}),e.jsx("div",{className:"synthetic-card",children:e.jsxs("div",{className:"synthetic-detail",children:[e.jsx("div",{className:"text",children:"Multistep API"}),e.jsx("div",{className:"value",children:p.goodMultiStepCount??0})]})})]}),e.jsxs("div",{className:"stats-container",children:[e.jsxs("div",{className:"stat-count",children:[e.jsx("span",{className:"label",children:"Total"}),e.jsxs("span",{children:[" ",p.total??0]})]}),e.jsxs("div",{className:"stat-count ok",children:[e.jsx("span",{className:"label",children:"Ok"}),e.jsxs("span",{children:[" ",p.ok??0]})]}),e.jsxs("div",{className:"stat-count paused",children:[e.jsx("span",{className:"label",children:"Paused"}),e.jsxs("span",{children:[" ",((l=d==null?void 0:d.result)==null?void 0:l.pauseCount)??0]})]}),e.jsxs("div",{className:"stat-count fail",children:[e.jsx("span",{className:"label",children:"Fail"}),e.jsxs("span",{children:[" ",p.failed??0]})]}),e.jsxs("div",{className:"stat-count error",children:[e.jsx("span",{className:"label",children:"Error"}),e.jsxs("span",{children:[" ",p.error??0]})]})]})]})};function ae(a,s){const t=s.find(d=>d.key===a);return t==null?void 0:t.visible}const zt=a=>{const{onDelete:s,dashboardCards:t}=a;return e.jsxs("div",{className:"grouped-widgets-container",children:[e.jsx("div",{className:"metrics-group-container",children:e.jsx(ce,{title:"Metrics",defaultExpanded:!0,children:e.jsx(Gt,{onDelete:s,dashboardCards:t})})}),e.jsx("div",{className:"logs-group-container",children:e.jsx(ce,{title:"Logs",defaultExpanded:!0,children:e.jsx(Ut,{onDelete:s,dashboardCards:t})})}),e.jsx("div",{className:"apm-group-container",children:e.jsx(ce,{title:"APM",defaultExpanded:!0,children:e.jsx(Ht,{onDelete:s,dashboardCards:t})})}),e.jsxs("div",{className:"alerts-synthetic-wrapper",children:[e.jsx("div",{className:"alerts-group-container",children:e.jsx(ce,{title:"Alerts",defaultExpanded:!0,children:e.jsx(Yt,{})})}),e.jsx("div",{className:"synthetic-group-container",children:e.jsx(ce,{title:"Synthetic & Browser Test",defaultExpanded:!0,children:e.jsx(Qt,{})})})]})]})},Jt=z.memo(zt),Zt=a=>{var w,x,C;const s=n.useContext(ts),t=X(),d=is(),{isInfraOrApmInstalled:r}=a,p=(x=(w=s==null?void 0:s.user)==null?void 0:w.settings)==null?void 0:x.welcome_screen,h=!p||p.value==-1,b=V(lt),o=V(ct),_=r?rs:Re,y=n.useMemo(()=>{var i,u,m,g;return((g=(m=(u=(i=s.user)==null?void 0:i.settings)==null?void 0:u.onboard_dashboard_cards_new)==null?void 0:m.value)==null?void 0:g.cards)||[]},[(C=s.user)==null?void 0:C.settings]),R=z.useContext(ee),k=n.useCallback(()=>{t(ht("welcome_screen",i=>{var u;if(i){const m={...(u=s.user)==null?void 0:u.settings};
1delete m.welcome_screen,s.changeContext({key:"user",value:{...s.user,settings:m}}),t(as(!1)),t(te("success","Restored the middleware home dashboard successfully ",{title:"Successfully restored the home page"}))}else t(te("error","Failed to restore middleware home screen",{title:"Failed to restore the home page"}))}))},[s,t]);n.useEffect(()=>{b&&k()},[b]);const N=n.useCallback(()=>{var m,g,j;const i=y??[];let u=[];return(((j=(g=(m=s==null?void 0:s.user)==null?void 0:m.settings)==null?void 0:g.onboard_dashboard_cards_new)==null?void 0:j.id)??0)>0?i==null||i.forEach(L=>{_==null||_.forEach(q=>{L.key===q.key&&u.push({title:q.title,viewAllText:q.viewAllText,link:q.link,class:q.class,layout:L.layout,key:L.key,visible:L.visible,filters:q.filters})})}):u=_??[],u},[y,_,s]),l=n.useCallback(()=>N(),[h,r,y]),c=(i,u)=>{t(gt({key:"onboard_dashboard_cards_new",value:{cards:i}},m=>{u&&m&&u(m)}))},T=n.useCallback((i,u,m)=>{var L,q,f;let g=[];const j=(((f=(q=(L=s==null?void 0:s.user)==null?void 0:L.settings)==null?void 0:q.onboard_dashboard_cards_new)==null?void 0:f.id)??0)>0?y:_;if(Array.isArray(i))g=i;else{const S=j.filter(E=>E.visible);if(!(S.length===1&&S[0].key===i))g=j.map(E=>({...E,layout:E.layout,visible:E.key===i?!E.visible:E.visible}));else{g=j,t(te("error","Can't delete this widget. Atleast one widget should be visible"));return}}c(g,()=>{var S,O,E;if(Array.isArray(i)&&typeof u=="object"&&u!==null){const F=u.added||[],G=u.removed||[];F.forEach(P=>{t(te("success",`Card for ${P} added successfully`,{title:"Successfully added."}))}),G.forEach(P=>{t(te("success",`Card for ${P} removed successfully`,{title:"Successfully removed."}))})}else t(te("success",u?`Card for ${m} removed successfully`:`Card for ${m} added successfully`,{title:u?"Successfully removed.":"Successfully added."}));N(),s.changeContext({key:"user",value:{...s.user,settings:{...(S=s==null?void 0:s.user)==null?void 0:S.settings,onboard_dashboard_cards_new:{...(E=(O=s==null?void 0:s.user)==null?void 0:O.settings)==null?void 0:E.onboard_dashboard_cards_new,value:{cards:g}}}}})})},[s,t,y,_]),D=i=>{var m,g,j;let u=Re.map(L=>({key:L.key,layout:L.layout,visible:L.visible}));(((j=(g=(m=s==null?void 0:s.user)==null?void 0:m.settings)==null?void 0:g.onboard_dashboard_cards_new)==null?void 0:j.id)??0)>0&&(u=y),i==null||i.forEach(L=>{u==null||u.forEach(q=>{var f;(f=q.layout)!=null&&f.i&&L.i===q.layout.i&&(q.layout=L)})}),c(u)};return n.useEffect(()=>{const i=R.params.query.get("login_status");i&&i==="success"&&d("login successful"),d("open welcome dashboard")},[]),Qe(()=>{o&&(Array.isArray(o)?T(o.key,o.visible):T(o.key,o.visible,o.title))},[o]),n.useEffect(()=>{var i,u,m;if(_.length!==y.length){const g=[];_==null||_.forEach(j=>{g==null||g.push({key:j.key,layout:j.layout,visible:j.visible})}),c(g),s.changeContext({key:"user",value:{...s.user,settings:{...(i=s==null?void 0:s.user)==null?void 0:i.settings,onboard_dashboard_cards_new:{...(m=(u=s==null?void 0:s.user)==null?void 0:u.settings)==null?void 0:m.onboard_dashboard_cards_new,value:{cards:g}}}}})}},[r]),n.useEffect(()=>{var u,m,g;const i=[];_==null||_.forEach(j=>{i==null||i.push({key:j.key,layout:j.layout,visible:j.visible})}),((g=(m=(u=s==null?void 0:s.user)==null?void 0:u.settings)==null?void 0:m.onboard_dashboard_cards_new)==null?void 0:g.id)===void 0&&r&&c(i)},[s,r,N]),e.jsx("div",{className:"widgets-section-container",children:h?e.jsx(e.Fragment,{children:r?e.jsx(Jt,{onDelete:T,dashboardCards:l(),updateCards:c}):e.jsxs(e.Fragment,{children:[e.jsx(Kt,{}),e.jsx(Vt,{dashboardCards:l(),onLayoutChange:D,handleMenuClick:T,updateCards:c})]})}):e.jsx("div",{className:"builder-view-welcome-dashboard",children:e.jsx(Us,{builderViewOptions:{report:{reportId:p.value,reportName:"Welcome Screen"},disableUserEdit:!0,removeGlobalHeader:!0}})})})},Xt=z.memo(Zt),ea=({showBackStrip:a})=>{var S,O,E,F,G,P,$,H,Y,J;const s=n.useContext(ts),t=ue(),d=X(),r=z.useContext(ee),p=r.params.query.get("aws_token"),h=r.params.query.get("gcp_token"),b=V(it),{infra_enabled:o,traces_enabled:_,synthetics_enabled:y}=((S=s==null?void 0:s.user)==null?void 0:S.project_meta_data)||{},{user_created_alert_rule:R,user_created_dashboard:k}=((O=s.user)==null?void 0:O.project_meta_data)||{};z.useEffect(()=>{if(p){r.params.query.set("aws_token",p),t("/settings/billing");return}h&&(r.params.query.set("gcp_token",h),t("/settings/billing"))},[]);const N=()=>{const v=Se(),I=[{flag:!o,index:0},{flag:!_,index:1},{flag:!k,index:2},{flag:!R,index:3},{flag:!y,index:4}
1].find(({flag:M})=>M);return v[(I==null?void 0:I.index)??5]},[l,c]=n.useState(N()),[T,D]=n.useState({}),w=v=>({"configure-host":!!o,"configure-app":!!_,"create-synthetic-test":!!y,"create-dashboard":!!k,"create-alert":!!R,"install-integrations":Object.values(T).some(Boolean)})[v]??!1,x=n.useMemo(()=>o&&_&&y&&k&&R,[o,_,y,k,R]),C=n.useMemo(()=>o||_,[o,_]),i=(F=(E=s==null?void 0:s.user)==null?void 0:E.settings)==null?void 0:F.welcome_screen,u=!i||i.value==-1,m=n.useMemo(()=>C?rs:Re,[C]),g=n.useMemo(()=>{var v,A,I,M;return(M=(I=(A=(v=s.user)==null?void 0:v.settings)==null?void 0:A.onboard_dashboard_cards_new)==null?void 0:I.value)==null?void 0:M.cards},[(H=($=(P=(G=s.user)==null?void 0:G.settings)==null?void 0:P.onboard_dashboard_cards_new)==null?void 0:$.value)==null?void 0:H.cards]),j=n.useCallback(()=>{const v=Array.isArray(b)?b.some(A=>A.integration==="Slack"):!1;return e.jsx("div",{className:`config-list ${x?"all-config-done":""}`,children:Se(T,v).map(A=>{const I=A.key!=="install-integrations"&&w(A.key);return e.jsxs("div",{onClick:()=>!I&&c(A),className:`config-title ${I?"installed":""} ${A.key===(l==null?void 0:l.key)?"active":""}`,children:[A.title,I&&e.jsx(vt,{size:12})]},A.key)})})},[x,T,l==null?void 0:l.key,b]),L=n.useCallback(()=>{var I,M,W;const v=g;let A=[];return((W=(M=(I=s==null?void 0:s.user)==null?void 0:I.settings)==null?void 0:M.onboard_dashboard_cards_new)==null?void 0:W.id)>0?v==null||v.forEach(U=>{m==null||m.forEach(B=>{U.key===B.key&&A.push({title:B.title,viewAllText:B.viewAllText,link:B.link,class:B.class,layout:U.layout,key:U.key,visible:U.visible,filters:B.filters})})}):A=m,A},[g,C,m]),q=n.useCallback(()=>L(),[g,u,C,L]),f=n.useCallback(()=>{d(Ks(v=>{D((v==null?void 0:v.result)||{})}))},[d]);return n.useEffect(()=>{f(),d($s())},[f,d]),n.useEffect(()=>{l.key==="install-integrations"&&c(Se(T)[5])},[l.key,T]),e.jsxs(e.Fragment,{children:[a&&e.jsxs("div",{className:"welcome-dashboard-back-strip",role:"navigation","aria-label":"Breadcrumb",children:[e.jsx("div",{onClick:()=>t("/dashboards"),children:"Dashboards"}),e.jsxs("span",{children:[">"," System Health Overview"]})]}),e.jsxs("div",{className:`welcome-dashboard-container ${a?"contains-back-strip":""}`,children:[e.jsxs("div",{className:"dashboard-top-section-container",children:[e.jsxs("div",{className:"top-section-title",children:[e.jsxs("div",{children:[e.jsxs("span",{className:"welcome-user",children:["Hey ",(Y=s.user)==null?void 0:Y.full_name,","," "]}),e.jsx("span",{className:"getting-started-text",children:x?"explore and keep an eye on your metrics":"letâs optimize a few things before getting started"})]}),e.jsxs("div",{className:"top-section-actions",children:[u?e.jsx(St,{dashboardCards:q(),onItemClick:(v,A,I)=>{d(dt(typeof v!="string"?{key:v,visible:A}:{key:v,visible:A,title:I})),L()}}):e.jsx(Ue,{primary:!0,prefixicon:e.jsx(at,{color:"var(--color-white)"}),onClick:()=>{d(as(!0))},children:"Reset to Default"}),e.jsx(ut,{})]})]}),x?e.jsx("div",{children:j()}):e.jsxs("div",{className:"configuration-section-container",children:[e.jsxs("div",{className:"config-section-container",children:[j(),e.jsx("div",{className:"divider"}),e.jsxs("div",{className:"config-details-container",children:[e.jsxs("div",{className:"details-title",children:[e.jsx(Hs,{}),e.jsx("span",{className:"details-title-text",children:l==null?void 0:l.title})]}),e.jsx("div",{className:"details-description",children:l==null?void 0:l.description}),e.jsx("div",{children:e.jsx(Ue,{primary:!0,onClick:()=>{l.key==="create-dashboard"&&r.params.query.set("build-dashboard","true"),t(l==null?void 0:l.installationLink)},children:l.key==="create-dashboard"?"Build Dashboard":l.key==="create-alert"?"Create an Alert":l.key==="create-synthetic-test"?"Create a Synthetic Test":"Install Integration"})})]})]}),e.jsx("div",{className:"welcome-dashboard-video",children:e.jsx("img",{src:l==null?void 0:l.img})})]})]}),e.jsxs("div",{className:"popular-application-container",children:[e.jsx("span",{className:"popular-integration-text",children:l.popularEntityTitle}),e.jsx("span",{className:"connector-line"}),e.jsx("div",{className:"integrations-list-container",children:(J=l==null?void 0:l.integrations)==null?void 0:J.map((v,A)=>e.jsxs("div",{className:"integration-item-container",onClick:()=>{(l==null?void 0:l.key)==="create-dashboard"?(r.params.query.set("build-dashboard","true"),r.params.query.set("dashboard-for",v.link),t("/dashboards")):((l==null?void 0:l.key)==="create-synthetic-test"&&r.params.query.set("request-type",v.name.toLowerCase()),t(v.link))},children:[v.icon&&e.jsx("div",{className:"integration-icon",children:v.icon}),e.jsx("div",{className:"integration-name",children:v.name}),v.installed?e.jsx(Ys,{}):e.jsx("div",{className:"install-link-icon",children:e.jsx(wt,{size:20})})]},A))})]}),e.jsx(Xt,{isInfraOrApmInstalled:C??!1})]})]})};function Lr(){var p,h;const a=X(),s=ue(),{dashboardKey:t}=xs(),d=n.useContext(ee);n.useEffect(()=>{!t||t===xe||a(Qs(t))},[t,a]);const r=V(zs);return n.useEffect(()=>{t!==xe&&(!t||[Ce.SUCCESS,Ce.ERROR].includes(r.apiStatus)&&!r.dashboard)&&s("/dashboards")},[t,r,s]),n.useEffect(()=>()=>
1{a(Js()),a(et()),d.actions.removeParamsIfPathMismatch("/dashboards",["filterBy"])},[a]),t===xe?e.jsx(ea,{showBackStrip:!0}):e.jsxs(e.Fragment,{children:[r.apiStatus===Ce.LOADING&&e.jsx(ke,{}),((p=r.dashboard)==null?void 0:p.key)&&e.jsx(Zs,{builderViewOptions:{report:{reportName:r.dashboard.label,reportId:r.dashboard.id,reportSource:(h=r.dashboard.meta_data)==null?void 0:h.data_source,reportKey:r.dashboard.key,metadata:r.dashboard.meta_data,reportDescription:r.dashboard.description},disableUserEdit:r.dashboard.display_scope!==""&&d.params.query.get("cwedit")!=="true"}})]})}export{Lr as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.