@odigos/ui-kit 0.0.295 → 0.0.296
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/lib/chunks/{helpers-CVRjhvw4.js → helpers-BV_MHw06.js} +1 -1
- package/lib/chunks/index-vZsC8Ggg.js +353 -0
- package/lib/chunks/{source-instrument-form-context-CgGshOFa.js → source-instrument-form-context-CWv4NCRf.js} +1 -1
- package/lib/chunks/{ui-components-DwtaxXwl.js → ui-components-BlmdA--F.js} +14 -19
- package/lib/components/field-title/index.d.ts +1 -1
- package/lib/components/input/index.d.ts +3 -1
- package/lib/components/table/types.d.ts +1 -0
- package/lib/components/trace-view/types.d.ts +2 -1
- package/lib/components.js +1 -1
- package/lib/constants.js +1 -1
- package/lib/containers/insights/findings/drawer/anomaly/anomaly-trace-compare/helpers.d.ts +2 -2
- package/lib/containers.js +200 -200
- package/lib/contexts/odigos-api/types.d.ts +1 -0
- package/lib/contexts.js +1 -1
- package/lib/functions/parse-raw-otlp/index.d.ts +2 -1
- package/lib/functions.js +1 -1
- package/lib/hooks.js +1 -1
- package/lib/icons.js +1 -1
- package/lib/snippets/blast-radius/helpers.d.ts +5 -5
- package/lib/snippets/blast-radius/types.d.ts +0 -4
- package/lib/snippets.js +1 -1
- package/lib/store.js +1 -1
- package/lib/theme.js +1 -1
- package/lib/types.js +1 -1
- package/lib/visuals.js +1 -1
- package/package.json +1 -1
- package/lib/chunks/index-B13xWqwt.js +0 -342
package/lib/containers.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMemo as a,useEffect as o,useState as l,Fragment as r,forwardRef as s,useImperativeHandle as c,useCallback as d,useRef as p,Children as u,createContext as h,useContext as g,useLayoutEffect as m,memo as b}from"react";import f,{useTheme as v,css as y,keyframes as S}from"styled-components";import{
|
|
1
|
+
import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMemo as a,useEffect as o,useState as l,Fragment as r,forwardRef as s,useImperativeHandle as c,useCallback as d,useRef as p,Children as u,createContext as h,useContext as g,useLayoutEffect as m,memo as b}from"react";import f,{useTheme as v,css as y,keyframes as S}from"styled-components";import{u as x,e as w,g as C,f as k,h as T,b_ as I,F as $,b$ as N,c0 as A,c1 as O,c2 as E,bv as D,d as z,k as R,I as P,c3 as X,p as L,q as _,y as M,$ as F,c4 as B,c5 as V,av as U,c6 as G,c7 as j,B as H,i as W,j as K,z as Y,a7 as J,bw as q,N as Z,c8 as Q,w as ee,H as te,S as ie,c9 as ne,bB as ae,bC as oe,bA as le,ca as re,aj as se,T as ce,ah as de,ai as pe,af as ue,ae as he,ag as ge,ad as me,b9 as be,ac as fe,cb as ve,cc as ye,cd as Se,ce as xe,cf as we,W as Ce,n as ke,bd as Te,cg as Ie,ch as $e,ci as Ne,cj as Ae,ck as Oe,cl as Ee,cm as De,cn as ze,Z as Re,co as Pe,a2 as Xe,cp as Le,cq as _e,v as Me,cr as Fe,cs as Be,b3 as Ve,bJ as Ue,ct as Ge,cu as je,cv as He,cw as We,cx as Ke,cy as Ye,cz as Je,cA as qe,cB as Ze,cC as Qe,cD as et,cE as tt,cF as it,cG as nt,cH as at,cI as ot,cJ as lt,cK as rt,cL as st,cM as ct,cN as dt,cO as pt,cP as ut,cQ as ht,cR as gt,cS as mt,cT as bt,cU as ft,cV as vt,cW as yt,A as St,cX as xt,cY as wt,cZ as Ct,c_ as kt,c$ as Tt,d0 as It,d1 as $t,d2 as Nt,bV as At,d3 as Ot,d4 as Et,d5 as Dt,d6 as zt,d7 as Rt,d8 as Pt,aB as Xt,d9 as Lt,bU as _t,da as Mt,E as Ft,db as Bt,dc as Vt,dd as Ut,de as Gt,df as jt,dg as Ht,dh as Wt,di as Kt,dj as Yt,dk as Jt,bP as qt,a9 as Zt,dl as Qt,dm as ei,dn as ti,dp as ii,dq as ni,bT as ai,C as oi,dr as li,ds as ri,dt as si,du as ci,dv as di,dw as pi,dx as ui,dy as hi,dz as gi,dA as mi,dB as bi,dC as fi,dD as vi,dE as yi,dF as Si,dG as xi,dH as wi,dI as Ci,dJ as ki,dK as Ti,dL as Ii,dM as $i,dN as Ni,dO as Ai,dP as Oi,dQ as Ei,dR as Di,dS as zi,dT as Ri,dU as Pi,L as Xi,dV as Li,bD as _i,dW as Mi,dX as Fi,dY as Bi,r as Vi,bX as Ui,dZ as Gi,d_ as ji,d$ as Hi,e0 as Wi,e1 as Ki,e2 as Yi,e3 as Ji,e4 as qi,e5 as Zi,bQ as Qi,e6 as en,e7 as tn,e8 as nn,e9 as an,ea as on,D as ln,bI as rn,eb as sn,ec as cn,ed as dn,ee as pn,ef as un,eg as hn,eh as gn,bz as mn,ei as bn,ej as fn,ek as vn,el as yn,b0 as Sn,x as xn,bY as wn,em as Cn,bc as kn,en as Tn,be as In,eo as $n,bi as Nn,bg as An,ep as On,b5 as En,eq as Dn,m as zn,er as Rn,ak as Pn,es as Xn,et as Ln,o as _n,G as Mn,bl as Fn,bu as Bn,eu as Vn,ev as Un,bt as Gn,ew as jn,a6 as Hn,ex as Wn,ey as Kn,b8 as Yn,ez as Jn,eA as qn,eB as Zn,eC as Qn,eD as ea,eE as ta,eF as ia,eG as na,eH as aa,eI as oa,Y as la,eJ as ra,b4 as sa,b2 as ca,eK as da,eL as pa,eM as ua,eN as ha,eO as ga,eP as ma,bZ as ba,eQ as fa,eR as va,eS as ya,eT as Sa,eU as xa,b as wa,eV as Ca,eW as ka,X as Ta,eX as Ia,eY as $a,eZ as Na,e_ as Aa,e$ as Oa,f0 as Ea,f1 as Da,f2 as za,f3 as Ra,f4 as Pa,f5 as Xa,f6 as La,f7 as _a,f8 as Ma,f9 as Fa,fa as Ba,fb as Va,fc as Ua,fd as Ga,fe as ja,ff as Ha,fg as Wa,fh as Ka,fi as Ya,fj as Ja,fk as qa,fl as Za,fm as Qa,fn as eo,fo as to,fp as io,fq as no,fr as ao,fs as oo,ft as lo,fu as ro,fv as so,fw as co,fx as po,fy as uo,fz as ho,fA as go,fB as mo,fC as bo,aS as fo,fD as vo,fE as yo,fF as So,fG as xo,fH as wo,fI as Co,fJ as ko,fK as To,fL as Io,fM as $o,fN as No,fO as Ao,fP as Oo,fQ as Eo,fR as Do,fS as zo,fT as Ro,fU as Po,fV as Xo,fW as Lo,fX as _o,fY as Mo,fZ as Fo,f_ as Bo,f$ as Vo,g0 as Uo,g1 as Go,g2 as jo,g3 as Ho,g4 as Wo,g5 as Ko,g6 as Yo,g7 as Jo,g8 as qo,g9 as Zo,ga as Qo,gb as el,gc as tl,gd as il,ge as nl,gf as al,gg as ol,gh as ll,gi as rl,gj as sl,gk as cl,J as dl,K as pl,U as ul,M as hl,O as gl,gl as ml,gm as bl,gn as fl,go as vl,gp as yl,a3 as Sl,gq as xl,gr as wl,gs as Cl,gt as kl,gu as Tl,gv as Il,gw as $l,gx as Nl,gy as Al,gz as Ol,gA as El,gB as Dl,gC as zl,gD as Rl,gE as Pl,gF as Xl,gG as Ll,gH as _l,gI as Ml,gJ as Fl,gK as Bl,gL as Vl,gM as Ul,gN as Gl,gO as jl,gP as Hl,gQ as Wl,gR as Kl,gS as Yl,gT as Jl,gU as ql,gV as Zl,gW as Ql,gX as er,gY as tr,gZ as ir,g_ as nr,g$ as ar,h0 as or,h1 as lr,h2 as rr,h3 as sr,h4 as cr,h5 as dr,h6 as pr,h7 as ur,h8 as hr,h9 as gr,ha as mr,hb as br,hc as fr,hd as vr,he as yr,hf as Sr,hg as xr,hh as wr,hi as Cr,hj as kr,hk as Tr,hl as Ir,hm as $r,hn as Nr,ho as Ar,b6 as Or,hp as Er,hq as Dr,hr as zr,hs as Rr,ht as Pr,hu as Xr,hv as Lr,hw as _r,hx as Mr,hy as Fr,hz as Br,hA as Vr,hB as Ur,hC as Gr,hD as jr,hE as Hr,hF as Wr,hG as Kr,hH as Yr,hI as Jr,hJ as qr,hK as Zr,hL as Qr,hM as es,hN as ts,hO as is,hP as ns,hQ as as,hR as os,hS as ls,hT as rs,hU as ss,hV as cs,hW as ds,hX as ps,hY as us,hZ as hs,h_ as gs,h$ as ms,i0 as bs,i1 as fs,i2 as vs,i3 as ys,i4 as Ss,i5 as xs,i6 as ws,i7 as Cs,i8 as ks,i9 as Ts,ia as Is,ib as $s,ic as Ns,id as As,ie as Os,ig as Es,ih as Ds,ii as zs,ij as Rs,ik as Ps,il as Xs,im as Ls,io as _s,ip as Ms,iq as Fs,ir as Bs,is as Vs,it as Us,iu as Gs,iv as js,iw as Hs,ix as Ws,iy as Ks,iz as Ys,iA as Js,iB as qs,iC as Zs,iD as Qs,P as ec,iE as tc,iF as ic,R as nc,a as ac,iG as oc,iH as lc,iI as rc,iJ as sc,iK as cc,iL as dc,iM as pc,iN as uc,iO as hc,iP as gc,iQ as mc,iR as bc,iS as fc,iT as vc,iU as yc,iV as Sc,iW as xc,iX as wc,l as Cc,b7 as kc,iY as Tc,iZ as Ic,i_ as $c,i$ as Nc,j0 as Ac,j1 as Oc,j2 as Ec,j3 as Dc,j4 as zc,j5 as Rc,j6 as Pc,j7 as Xc,j8 as Lc,bH as _c,bG as Mc,bF as Fc,bE as Bc,j9 as Vc,ja as Uc,jb as Gc,jc,jd as Hc,je as Wc,jf as Kc,jg as Yc,jh as Jc,ji as qc,jj as Zc,jk as Qc,jl as ed,jm as td,jn as id,jo as nd,jp as ad,jq as od,jr as ld,js as rd,b1 as sd,jt as cd,ju as dd,jv as pd,jw as ud,jx as hd,jy as gd,jz as md,jA as bd,jB as fd,jC as vd,jD as yd,jE as Sd,jF as xd,bf as wd,jG as Cd,jH as kd,jI as Td,jJ as Id,jK as $d,jL as Nd,jM as Ad,jN as Od,jO as Ed,jP as Dd,jQ as zd,jR as Rd,jS as Pd,jT as Xd,jU as Ld,jV as _d,jW as Md,jX as Fd,jY as Bd,jZ as Vd,j_ as Ud,j$ as Gd,k0 as jd,k1 as Hd,k2 as Wd,k3 as Kd,k4 as Yd,k5 as Jd,k6 as qd,k7 as Zd,k8 as Qd,k9 as ep,ka as tp,kb as ip,kc as np,kd as ap,ke as op,kf as lp,kg as rp,kh as sp,ki as cp,kj as dp,kk as pp,kl as up,km as hp,kn as gp,ko as mp,kp as bp,kq as fp,kr as vp,ks as yp,kt as Sp,ku as xp,kv as wp,kw as Cp,kx as kp,ky as Tp,kz as Ip,kA as $p,kB as Np,kC as Ap,kD as Op,kE as Ep,kF as Dp,kG as zp,kH as Rp,kI as Pp,kJ as Xp,kK as Lp,kL as _p}from"./chunks/ui-components-BlmdA--F.js";import{u as Mp,n as Fp,C as Bp,g as Vp,f as Up,e as Gp,q as jp,h as Hp,j as Wp,k as Kp,i as Yp,m as Jp,p as qp,l as Zp,c as Qp,r as eu,S as tu,s as iu,R as nu,t as au,w as ou,o as lu,x as ru,y as su,z as cu,A as du,B as pu,D as uu,E as hu,F as gu,G as mu,H as bu,I as fu,J as vu}from"./chunks/helpers-BV_MHw06.js";import{ChevronRightIcon as yu,ActionIcon as Su,TrashIcon as xu,PlusIcon as wu,ArrowRightIcon as Cu,BookIcon as ku,DeleteIcon as Tu,EditIcon as Iu,GoLogo as $u,JavaLogo as Nu,PhpLogo as Au,VSquareIcon as Ou,XSquareIcon as Eu,InboundIcon as Du,OutboundIcon as zu,DestinationIcon as Ru,InsightsTransactionsIcon as Pu,XIcon as Xu,VIcon as Lu,ISquareIcon as _u,ThreatDetectionIcon as Mu,ChevronUpIcon as Fu,ChevronDownIcon as Bu,InstrumentationRuleIcon as Vu,SourceIcon as Uu,NamespacesIcon as Gu,AzureIcon as ju,GoogleCloudPlatformLogo as Hu,AwsLogo as Wu,CloudConnectorIcon as Ku,EyeOpenIcon as Yu,OdigosLogo as Ju,ArrowLeftIcon as qu,RefreshIcon as Zu,SettingsIcon as Qu,PodIcon as eh,K8sLogo as th,ExclamationCircleIcon as ih,QuestionCircleIcon as nh,UserIcon as ah,TerminalIcon as oh,RefreshLeftArrowIcon as lh,SearchIcon as rh,MinusIcon as sh,ExpandIcon as ch,CopyIcon as dh,DotIcon as ph,ArrowDownIcon as uh,DownloadIcon as hh,MetricsIcon as gh,EnrichmentIcon as mh,NormalizationIcon as bh,SamplingIcon as fh,RecommendationsIcon as vh,UrlTemplatizationIcon as yh,ListIcon as Sh,StarIcon as xh,ReplicaIcon as wh,ExclamationTriangleIcon as Ch,KeyIcon as kh,DiagnoseIcon as Th,ArrowIcon as Ih,ConnectionsIcon as $h,InsightsFindingsIcon as Nh,LockIcon as Ah,DbIcon as Oh,FolderIcon as Eh,CodeIcon as Dh,TracesIcon as zh,PrivacyIcon as Rh,NotificationIcon as Ph,FilterIcon as Xh,DataStreamIcon as Lh,PipelineCollectorIcon as _h,ArrowDownSquareIcon as Mh,ArrowUpSquareIcon as Fh,GatewayIcon as Bh,YamlIcon as Vh,ImageErrorIcon as Uh,SelfLoopIcon as Gh}from"./icons.js";import{l as jh,B as Hh,t as Wh,E as Kh,s as Yh,H as Jh,F as qh,S as Zh,G as Qh,x as eg,K as tg,M as ig,e as ng,L as ag,z as og,y as lg,N as rg,j as sg,J as cg,d as dg,c as pg,w as ug,P as hg,Q as gg,v as mg,T as bg,U as fg,V as vg,W as yg,X as Sg,Y as xg,I as wg,q as Cg,g as kg,C as Tg,O as Ig,i as $g,Z as Ng,_ as Ag,$ as Og,a0 as Eg,a1 as Dg,a2 as zg,a3 as Rg,a4 as Pg,a5 as Xg,a6 as Lg,a7 as _g,a8 as Mg,b as Fg,R as Bg,A as Vg,h as Ug,D as Gg}from"./chunks/source-instrument-form-context-CWv4NCRf.js";import{u as jg,i as Hg,E as Wg,p as Kg,I as Yg,q as Jg,v as qg,n as Zg,P as Qg,S as em,R as tm,l as im,o as nm,f as am,m as om,r as lm,W as rm,C as sm,e as cm,Y as dm,A as pm,O as um,c as hm,B as gm,j as mm,s as bm,U as fm,t as vm,a as ym,b as Sm,h as xm}from"./chunks/index-vZsC8Ggg.js";import{Handle as wm,Position as Cm,MarkerType as km,useNodesState as Tm,useEdgesState as Im,BaseEdge as $m,ReactFlowProvider as Nm,ReactFlow as Am,Background as Om,Controls as Em,ControlButton as Dm}from"@xyflow/react";import{createPortal as zm}from"react-dom";import"@xyflow/react/dist/style.css";import"zustand";import"javascript-time-ago";import"javascript-time-ago/locale/en";import"prism-react-renderer";import"react-error-boundary";import"virtua";import"@apollo/client/react";import"@apollo/client/link/error";import"@apollo/client/link/context";import"@apollo/client/utilities";import"@apollo/client/errors";import"@apollo/client";import"elkjs/lib/elk.bundled.js";const Rm=f.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
align-items: center;
|
|
4
4
|
justify-content: space-between;
|
|
@@ -1966,7 +1966,7 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
1966
1966
|
white-space: pre-line;
|
|
1967
1967
|
`,E$=f.div`
|
|
1968
1968
|
width: fit-content;
|
|
1969
|
-
`,D$=["50","25","10","1","0.1"],z$=({value:i,onChange:n,label:o})=>{const l=v(),r=a(()=>D$.map(e=>({value:e,label:`${e}%`,selectedBgColor:l.v2.colors.purple[900],selectedBorderColor:l.v2.colors.purple[400]})),[l]);return e($,{$gap:8,children:[t(w,{size:C.XS,color:l.v2.colors.white[500],children:o}),t(E$,{children:t(F,{"data-id":"sampling-onboarding-ambient",options:r,selected:i,setSelected:n})})]})},R$=({errorPresetEnabled:n,onErrorPresetChange:o,ambientPercentage:l,onAmbientPercentageChange:r,onBack:s,onNext:c,submitting:d})=>{const p=v(),u=a(()=>Zp(n?{disabled:!1}:null),[n]);return e(i,{children:[t(ZI,{title:Gs,onBack:s}),e(KI,{$width:854,children:[t(c$,{children:js}),e($,{$gap:8,$width:"100%",children:[e(e$,{children:[t(O$,{children:t(w,{size:C.XXS,color:p.v2.colors.silver[200],children:Hs})}),t(n$,{items:[Ws,Ks,Ys,Js,qs]}),t(o$,{message:Ls})]}),e(l$,{children:[e(r$,{children:[t(w,{size:C.S,weight:500,color:p.v2.colors.white[500],children:Zs}),t(nh,{size:16,fill:p.v2.colors.silver[200]})]}),t(s$,{children:t(GI,{name:Us,recommended:!0,toggleLabel:Vs,enabled:n,onEnabledChange:o,summary:u,toggleName:"sampling-onboarding-error-preset-toggle"})}),t(s$,{children:t(z$,{value:l,onChange:r,label:Qs})})]})]})]}),t(JI,{onNext:c,nextLoading:d})]})},P$=({isOpen:e,onClose:i,k8sHealthProbesConfig:n,samplingId:a,docsUrl:r})=>{const{samplingApi:s}=Hh(),[c,p]=l("welcome"),[u,h]=l(!0),[g,m]=l("keep-list"),[b,f]=l(!0),[v,y]=l("25"),[S,x]=l(!1);o(()=>{e&&(p("welcome"),h(n?.enabled??!0),m("keep-list"),f(!0),y("25"),x(!1))},[e,n?.enabled]);const w=d(async()=>{const e=a??"default",t=[];if(u!==(n?.enabled??!1)){const e=s.updateK8sHealthProbesConfig;e&&t.push(e({enabled:u,keepPercentage:n?.keepPercentage??0}))}if("advanced"!==g&&b){const i=s.createHighlyRelevant;i&&t.push(i({samplingId:e,rule:{name:"Auto - Keep All Error Traces",disabled:!1,error:!0,sourceScopes:null,operation:null,percentageAtLeast:null}}))}if("keep-list"===g){const i=s.createCostReduction;i&&t.push(i({samplingId:e,rule:{name:"Onboarding - Ambient sampling",disabled:!1,sourceScopes:null,operation:null,percentageAtMost:parseFloat(v)}}))}x(!0);try{await Promise.all(t),p("success")}catch{}finally{x(!1)}},[a,s,u,n?.enabled,n?.keepPercentage,g,b,v]);let C=null;switch(c){case"welcome":C=t(b$,{onSkip:i,onNext:()=>p("noisy")});break;case"noisy":C=t(p$,{enabled:u,onEnabledChange:h,onBack:()=>p("welcome"),onNext:()=>p("strategy")});break;case"strategy":C=t(I$,{strategy:g,onStrategyChange:m,onBack:()=>p("noisy"),onNext:()=>{p("keep-list"===g?"keep-list":"drop-list"===g?"drop-list":"advanced")},docsUrl:r});break;case"keep-list":C=t(R$,{errorPresetEnabled:b,onErrorPresetChange:f,ambientPercentage:v,onAmbientPercentageChange:y,onBack:()=>p("strategy"),onNext:w,submitting:S});break;case"drop-list":C=t(A$,{errorPresetEnabled:b,onErrorPresetChange:f,onBack:()=>p("strategy"),onNext:w,submitting:S});break;case"advanced":C=t($$,{onBack:()=>p("strategy"),onNext:w,submitting:S});break;case"success":C=t(h$,{onClose:i})}return t(Er,{isOpen:e,onClose:i,children:C})};var X$,L$;(e=>{e.BulkConfig="bulk-config",e.BulkSource="bulk-source",e.Delete="delete"})(X$||(X$={})),(e=>{e.K8s="k8s",e.VmAgent="vm-agent",e.CloudConnector="cloud-connector",e.AwsEcsAgent="aws-ecs-agent"})(L$||(L$={}));const _$=[{id:L$.CloudConnector,label:ke.CLOUD_CONNECTOR}];var M$;(e=>{e.Id="id",e.Name="name",e.Type="type",e.Status="status",e.OdigosVersion="odigosVersion",e.ConnectedSince="connectedSince",e.LastActivity="lastActivity"})(M$||(M$={}));const F$=[{key:M$.Name,label:ke.NAME},{key:M$.Type,label:ke.TYPE},{key:M$.Status,label:ke.STATUS},{key:M$.OdigosVersion,label:ke.ODIGOS_VERSION},{key:M$.ConnectedSince,label:ke.CONNECTED_SINCE},{key:M$.LastActivity,label:ke.LAST_ACTIVITY}],B$=(e,t)=>{const i=e.find(e=>e.key===M$.Id)?.rawValue;return t(i?.toString()||"")},V$={[ie.Success]:"Connected",[ie.Warning]:"Degraded",[ie.Error]:"Error",[ie.Disabled]:"Disabled",[ie.Info]:"Pending"},U$={[ec.K8s]:_i.Purple,[ec.Vm]:_i.Blue,[ec.Connector]:_i.Green,[ec.AwsEcs]:_i.Yellow},G$=({connections:i,getConnections:n,onClickConnection:r,deleteConnection:s,onCreateNew:c,cloudConnectorProviders:p,onCreateCloudConnector:u,configMinSupportedVersion:h=0,snapshotMinSupportedVersion:g=0})=>{const m=v(),{formatTimeAgo:b}=qn(),{capabilities:f}=Hh(),[y,S]=l(!i?.length),[x,w]=l(i||[]),C=d(async()=>{try{S(!0),w(await n()??[])}catch(e){}finally{S(!1)}},[]);o(()=>{x.length||C()},[]);const[k,T]=l(""),[I,$]=l(null),[N,A]=l([]),[O,D]=l(!1),[z,R]=l(!1),P=d(()=>{D(!1),R(!0),C()},[C]),X=d(e=>{e===L$.CloudConnector?D(!0):c?.(e)},[c]),L=a(()=>I===X$.BulkConfig?h:I===X$.BulkSource?g:0,[I,h,g]),{supportedConnections:_,supportedConnectionIds:M}=a(()=>{const e=((e,t)=>e.filter(e=>{const i=e.status===ie.Success,n=Qp(e.odigosVersion,t,e.type);return i&&n}))(x,L);return{supportedConnections:e,supportedConnectionIds:e.map(e=>e.id)}},[x,L]),F=a(()=>N.map(e=>x.find(t=>t.id===e)).filter(e=>!!e),[x,N]);o(()=>{if(!I||I===X$.Delete)return;const e=N.filter(e=>!M.includes(e));e.length&&A(t=>t.filter(t=>!e.includes(t)))},[I,N.length,M.length]);const B=a(()=>x.filter(e=>!k||e.name.toLowerCase().includes(k.toLowerCase())).map(e=>{const i=Qp(e.odigosVersion,h,e.type),n=Qp(e.odigosVersion,g,e.type),a=I===X$.BulkConfig?!i:!(I!==X$.BulkSource&&i||n);return{cells:[{key:M$.Id,rawValue:e.id},{key:M$.Name,rawValue:e.name},{key:M$.Type,rawValue:e.type,component:()=>t(Xi,{variant:U$[e.type]??_i.Default,label:tc(e.type),leftIcon:La(e.type)})},{key:M$.Status,rawValue:e.status,component:()=>(e=>{if(e.type===ec.Connector){const i=V$[e.status]??"Pending",n=e.status===ie.Success?Lu:e.status===ie.Error?Xu:void 0;return t(E,{status:e.status,label:i,leftIcon:n})}const i=e.status===ie.Success?ke.CONNECTION_LIVE:ke.CONNECTION_LOST,n=e.status===ie.Success?Lu:Xu;return t(E,{status:e.status,label:i,leftIcon:n})})(e)},{key:M$.OdigosVersion,rawValue:e.odigosVersion},{key:M$.ConnectedSince,rawValue:e.connectedAt?b(e.connectedAt):"-"},{key:M$.LastActivity,rawValue:e.lastSeenAt?b(e.lastSeenAt):"-"}],onClick:e.status!==ie.Success||I?void 0:()=>r(e),isSelected:N.includes(e.id),onSelect:()=>A(t=>Array.from(new Set([...t,e.id]))),onDeselect:()=>A(t=>t.filter(t=>t!==e.id)),hideCheckbox:e.type!==ec.K8s||e.status!==ie.Success||a}}),[x,N,k,I,h,g,b,r]),V=a(()=>B.some(e=>!e.hideCheckbox),[B]),U=a(()=>{const e=(e,t)=>{A([e]),$(t)};return(e=>{const{connections:t,configMinSupportedVersion:i,snapshotMinSupportedVersion:n,onDelete:a,onAddSource:o,onEditConfiguration:l}=e;return({cells:e})=>{const r=B$(e,e=>t.find(t=>t.id===e)),s={id:Or(),label:ke.DELETE_CONNECTION,rightIcon:Tu,onClick:()=>B$(e,a)};if(!(e=>e.find(e=>e.key===M$.Status)?.rawValue===ie.Success)(e)||r?.type===ec.Connector)return[s];if(r?.type!==ec.K8s)return[];const c=!!r&&Qp(r.odigosVersion,i,r.type),d=!!r&&Qp(r.odigosVersion,n,r.type),p=eu(i,r?.type),u=eu(n,r?.type),h=[];return o&&h.push({id:Or(),tooltip:d?ke.ADD_SOURCE:ke.UPGRADE_TO_USE_FEATURE(u),rightIcon:Uu,disabled:!d,onClick:()=>B$(e,o)}),l&&h.push({id:Or(),tooltip:c?ke.EDIT_CONFIGURATION:ke.UPGRADE_TO_USE_FEATURE(p),rightIcon:Qu,disabled:!c,onClick:()=>B$(e,l)}),h}})({connections:x,configMinSupportedVersion:h,snapshotMinSupportedVersion:g,onDelete:t=>e(t,X$.Delete),onAddSource:f.canFetchSnapshots&&f.canBulkPersistSources?t=>e(t,X$.BulkSource):void 0,onEditConfiguration:t=>e(t,X$.BulkConfig)})},[x,h,g,f]),G=a(()=>F.some(e=>e.type===ec.K8s&&e.status===ie.Success&&Qp(e.odigosVersion,g,e.type)),[F,g]),j=a(()=>F.some(e=>e.type===ec.K8s&&e.status===ie.Success&&Qp(e.odigosVersion,h,e.type)),[F,h]),H=a(()=>{const e=f.canFetchSnapshots&&f.canBulkPersistSources,t=eu(g,ec.K8s),i=eu(h,ec.K8s);return(e=>{const{onCancel:t,onAddSource:i,addSourceDisabled:n,addSourceTooltip:a,onManageConfigurations:o,manageConfigDisabled:l,manageConfigTooltip:r}=e,s=[];return i&&s.push({id:X$.BulkSource,type:St.Button,buttonProps:{variant:K.Primary,size:W.S,label:ke.ADD_SOURCES,rightIcon:Uu,disabled:n,tooltip:a,onClick:i}}),o&&s.push({id:X$.BulkConfig,type:St.Button,buttonProps:{variant:K.Secondary,size:W.S,leftIcon:Qu,label:ke.MANAGE_CONFIGURATIONS,disabled:l,tooltip:r,onClick:o}}),s.push({id:Or(),type:St.Button,buttonProps:{variant:K.Text,size:W.S,label:zn.CANCEL,onClick:t}}),s})({onCancel:()=>A([]),onAddSource:e?()=>$(X$.BulkSource):void 0,addSourceDisabled:e&&!G,addSourceTooltip:e&&!G?ke.UPGRADE_TO_USE_FEATURE(t):void 0,onManageConfigurations:()=>$(X$.BulkConfig),manageConfigDisabled:!j,manageConfigTooltip:j?void 0:ke.UPGRADE_TO_USE_FEATURE(i)})},[f,G,j,g,h]),Y=a(()=>t(Xt,{items:_$,withMultiSelect:!1,selectedIds:[],setSelectedIds:e=>X(e[0]),buttonProps:{variant:K.Primary,size:W.S,label:zn.CREATE_NEW}}),[X]),J=a(()=>k.trim()&&x.length>0?{hideIcon:!0,title:ke.NO_RESULTS,subTitle:ke.NO_RESULTS_FOR_FILTER(k)}:{icon:$h,title:ke.NO_CONNECTIONS,action:Y},[k,x.length,Y]);return t(ic,{children:e(Re,{fullHeight:!0,richTitle:{icon:$h,title:ke.CONNECTIONS,badge:{label:x.length.toString(),status:ie.Unknown}},search:{placeholder:ke.SEARCH_BY_CLUSTER_NAME,value:k,onChange:e=>T(e),width:"300px"},actions:[{id:"connections-refresh",type:St.Button,buttonProps:{variant:K.Secondary,size:W.S,leftIcon:Zu,onClick:C,disabled:y}},{id:"connections-create-new",type:St.DropDataButton,buttonProps:{variant:K.Primary,size:W.S,label:zn.CREATE_NEW,onClick:e=>X(e)},dropDataProps:{alignX:Lt.Right,items:_$}}],children:[t(za,{variant:Ra.Pretty,headerBackgroundColor:m.v2.colors.silver[1e3],isLoading:y,withCheckboxes:V,columns:F$,rows:B,noDataProps:J,rowActionsPushRightPosition:I?`calc(${rm} - 24px)`:void 0,getRowActions:U}),O&&t(Tg,{providers:p,children:t(Ex,{onClose:()=>D(!1),withOverlay:!0,onCreateCloudConnector:u,onCreated:P})}),t(hm,{isOpen:z,onClose:()=>R(!1)}),t(vt,{isOpen:!!N.length&&!I,richTitle:{icon:Ou,title:ke.SELECTED_CLUSTERS,badge:{label:N.length}},actions:H}),I===X$.BulkConfig&&t(Ig,{connections:F,children:t(Xx,{onClose:()=>$(null),connections:_,selectedConnectionIds:N,setSelectedConnectionIds:A})}),I===X$.BulkSource&&f.canFetchSnapshots&&f.canBulkPersistSources&&t(Ig,{connections:F,children:t($g,{selectedConnectionIds:N,children:t(Xy,{onClose:()=>$(null),selectedConnectionIds:N,setSelectedConnectionIds:A})})}),t(cm,{target:"connection",isOpen:I===X$.Delete,onClose:()=>{A([]),$(null)},onApprove:async()=>{const e=N[0];e&&(await s(e),await C())}})]})})};var j$,H$;(e=>{e.Overview="overview",e.Findings="findings",e.Transactions="transactions",e.SettingsAndConfigurations="settings-and-configurations"})(j$||(j$={})),(e=>{e.Anomaly="anomaly",e.Violation="violation",e.Transaction="transaction"})(H$||(H$={}));const W$={drawerIsOpenFor:{type:null,id:null},openDrawer:()=>{},closeDrawer:()=>{}},K$=h(W$),Y$=({children:e})=>{const[i,n]=l(W$.drawerIsOpenFor),o=d((e,t)=>n({type:e,id:t}),[]),r=d(()=>n(W$.drawerIsOpenFor),[]),s=a(()=>({drawerIsOpenFor:i,openDrawer:o,closeDrawer:r}),[i,o,r]);return t(K$.Provider,{value:s,children:e})},J$=()=>g(K$),q$=f.div`
|
|
1969
|
+
`,D$=["50","25","10","1","0.1"],z$=({value:i,onChange:n,label:o})=>{const l=v(),r=a(()=>D$.map(e=>({value:e,label:`${e}%`,selectedBgColor:l.v2.colors.purple[900],selectedBorderColor:l.v2.colors.purple[400]})),[l]);return e($,{$gap:8,children:[t(w,{size:C.XS,color:l.v2.colors.white[500],children:o}),t(E$,{children:t(F,{"data-id":"sampling-onboarding-ambient",options:r,selected:i,setSelected:n})})]})},R$=({errorPresetEnabled:n,onErrorPresetChange:o,ambientPercentage:l,onAmbientPercentageChange:r,onBack:s,onNext:c,submitting:d})=>{const p=v(),u=a(()=>Zp(n?{disabled:!1}:null),[n]);return e(i,{children:[t(ZI,{title:Gs,onBack:s}),e(KI,{$width:854,children:[t(c$,{children:js}),e($,{$gap:8,$width:"100%",children:[e(e$,{children:[t(O$,{children:t(w,{size:C.XXS,color:p.v2.colors.silver[200],children:Hs})}),t(n$,{items:[Ws,Ks,Ys,Js,qs]}),t(o$,{message:Ls})]}),e(l$,{children:[e(r$,{children:[t(w,{size:C.S,weight:500,color:p.v2.colors.white[500],children:Zs}),t(nh,{size:16,fill:p.v2.colors.silver[200]})]}),t(s$,{children:t(GI,{name:Us,recommended:!0,toggleLabel:Vs,enabled:n,onEnabledChange:o,summary:u,toggleName:"sampling-onboarding-error-preset-toggle"})}),t(s$,{children:t(z$,{value:l,onChange:r,label:Qs})})]})]})]}),t(JI,{onNext:c,nextLoading:d})]})},P$=({isOpen:e,onClose:i,k8sHealthProbesConfig:n,samplingId:a,docsUrl:r})=>{const{samplingApi:s}=Hh(),[c,p]=l("welcome"),[u,h]=l(!0),[g,m]=l("keep-list"),[b,f]=l(!0),[v,y]=l("25"),[S,x]=l(!1);o(()=>{e&&(p("welcome"),h(n?.enabled??!0),m("keep-list"),f(!0),y("25"),x(!1))},[e,n?.enabled]);const w=d(async()=>{const e=a??"default",t=[];if(u!==(n?.enabled??!1)){const e=s.updateK8sHealthProbesConfig;e&&t.push(e({enabled:u,keepPercentage:n?.keepPercentage??0}))}if("advanced"!==g&&b){const i=s.createHighlyRelevant;i&&t.push(i({samplingId:e,rule:{name:"Auto - Keep All Error Traces",disabled:!1,error:!0,sourceScopes:null,operation:null,percentageAtLeast:null}}))}if("keep-list"===g){const i=s.createCostReduction;i&&t.push(i({samplingId:e,rule:{name:"Onboarding - Ambient sampling",disabled:!1,sourceScopes:null,operation:null,percentageAtMost:parseFloat(v)}}))}x(!0);try{await Promise.all(t),p("success")}catch{}finally{x(!1)}},[a,s,u,n?.enabled,n?.keepPercentage,g,b,v]);let C=null;switch(c){case"welcome":C=t(b$,{onSkip:i,onNext:()=>p("noisy")});break;case"noisy":C=t(p$,{enabled:u,onEnabledChange:h,onBack:()=>p("welcome"),onNext:()=>p("strategy")});break;case"strategy":C=t(I$,{strategy:g,onStrategyChange:m,onBack:()=>p("noisy"),onNext:()=>{p("keep-list"===g?"keep-list":"drop-list"===g?"drop-list":"advanced")},docsUrl:r});break;case"keep-list":C=t(R$,{errorPresetEnabled:b,onErrorPresetChange:f,ambientPercentage:v,onAmbientPercentageChange:y,onBack:()=>p("strategy"),onNext:w,submitting:S});break;case"drop-list":C=t(A$,{errorPresetEnabled:b,onErrorPresetChange:f,onBack:()=>p("strategy"),onNext:w,submitting:S});break;case"advanced":C=t($$,{onBack:()=>p("strategy"),onNext:w,submitting:S});break;case"success":C=t(h$,{onClose:i})}return t(Er,{isOpen:e,onClose:i,children:C})};var X$,L$;(e=>{e.BulkConfig="bulk-config",e.BulkSource="bulk-source",e.Delete="delete"})(X$||(X$={})),(e=>{e.K8s="k8s",e.VmAgent="vm-agent",e.CloudConnector="cloud-connector",e.AwsEcsAgent="aws-ecs-agent"})(L$||(L$={}));const _$=[{id:L$.CloudConnector,label:ke.CLOUD_CONNECTOR}];var M$;(e=>{e.Id="id",e.Name="name",e.Type="type",e.Status="status",e.OdigosVersion="odigosVersion",e.ConnectedSince="connectedSince",e.LastActivity="lastActivity"})(M$||(M$={}));const F$=[{key:M$.Name,label:ke.NAME},{key:M$.Type,label:ke.TYPE},{key:M$.Status,label:ke.STATUS},{key:M$.OdigosVersion,label:ke.ODIGOS_VERSION},{key:M$.ConnectedSince,label:ke.CONNECTED_SINCE},{key:M$.LastActivity,label:ke.LAST_ACTIVITY}],B$=(e,t)=>{const i=e.find(e=>e.key===M$.Id)?.rawValue;return t(i?.toString()||"")},V$={[ie.Success]:"Connected",[ie.Warning]:"Degraded",[ie.Error]:"Error",[ie.Disabled]:"Disabled",[ie.Info]:"Pending"},U$={[ec.K8s]:_i.Purple,[ec.Vm]:_i.Blue,[ec.Connector]:_i.Green,[ec.AwsEcs]:_i.Yellow},G$=({connections:i,getConnections:n,onClickConnection:r,deleteConnection:s,onCreateNew:c,cloudConnectorProviders:p,onCreateCloudConnector:u,configMinSupportedVersion:h=0,snapshotMinSupportedVersion:g=0})=>{const m=v(),{formatTimeAgo:b}=qn(),{capabilities:f}=Hh(),[y,S]=l(!i?.length),[x,w]=l(i||[]),C=d(async()=>{try{S(!0),w(await n()??[])}catch(e){}finally{S(!1)}},[]);o(()=>{x.length||C()},[]);const[k,T]=l(""),[I,$]=l(null),[N,A]=l([]),[O,D]=l(!1),[z,R]=l(!1),P=d(()=>{D(!1),R(!0),C()},[C]),X=d(e=>{e===L$.CloudConnector?D(!0):c?.(e)},[c]),L=a(()=>I===X$.BulkConfig?h:I===X$.BulkSource?g:0,[I,h,g]),{supportedConnections:_,supportedConnectionIds:M}=a(()=>{const e=((e,t)=>e.filter(e=>{const i=e.status===ie.Success,n=Qp(e.odigosVersion,t,e.type);return i&&n}))(x,L);return{supportedConnections:e,supportedConnectionIds:e.map(e=>e.id)}},[x,L]),F=a(()=>N.map(e=>x.find(t=>t.id===e)).filter(e=>!!e),[x,N]);o(()=>{if(!I||I===X$.Delete)return;const e=N.filter(e=>!M.includes(e));e.length&&A(t=>t.filter(t=>!e.includes(t)))},[I,N.length,M.length]);const B=a(()=>x.filter(e=>!k||e.name.toLowerCase().includes(k.toLowerCase())).map(e=>{const i=Qp(e.odigosVersion,h,e.type),n=Qp(e.odigosVersion,g,e.type),a=I===X$.BulkConfig?!i:!(I!==X$.BulkSource&&i||n);return{cells:[{key:M$.Id,rawValue:e.id},{key:M$.Name,rawValue:e.name},{key:M$.Type,rawValue:e.type,component:()=>t(Xi,{variant:U$[e.type]??_i.Default,label:tc(e.type),leftIcon:La(e.type)})},{key:M$.Status,rawValue:e.status,component:()=>(e=>{if(e.type===ec.Connector){const i=V$[e.status]??"Pending",n=e.status===ie.Success?Lu:e.status===ie.Error?Xu:void 0;return t(E,{status:e.status,label:i,leftIcon:n})}const i=e.status===ie.Success?ke.CONNECTION_LIVE:ke.CONNECTION_LOST,n=e.status===ie.Success?Lu:Xu;return t(E,{status:e.status,label:i,leftIcon:n})})(e)},{key:M$.OdigosVersion,rawValue:e.odigosVersion},{key:M$.ConnectedSince,rawValue:e.connectedAt?b(e.connectedAt):"-"},{key:M$.LastActivity,rawValue:e.lastSeenAt?b(e.lastSeenAt):"-"}],onClick:e.status!==ie.Success||I?void 0:()=>r(e),isSelected:N.includes(e.id),onSelect:()=>A(t=>Array.from(new Set([...t,e.id]))),onDeselect:()=>A(t=>t.filter(t=>t!==e.id)),hideCheckbox:e.type!==ec.K8s||e.status!==ie.Success||a}}),[x,N,k,I,h,g,b,r]),V=a(()=>{const e=(e,t)=>{A([e]),$(t)};return(e=>{const{connections:t,configMinSupportedVersion:i,snapshotMinSupportedVersion:n,onDelete:a,onAddSource:o,onEditConfiguration:l}=e;return({cells:e})=>{const r=B$(e,e=>t.find(t=>t.id===e)),s={id:Or(),label:ke.DELETE_CONNECTION,rightIcon:Tu,onClick:()=>B$(e,a)};if(!(e=>e.find(e=>e.key===M$.Status)?.rawValue===ie.Success)(e)||r?.type===ec.Connector)return[s];if(r?.type!==ec.K8s)return[];const c=!!r&&Qp(r.odigosVersion,i,r.type),d=!!r&&Qp(r.odigosVersion,n,r.type),p=eu(i,r?.type),u=eu(n,r?.type),h=[];return o&&h.push({id:Or(),tooltip:d?ke.ADD_SOURCE:ke.UPGRADE_TO_USE_FEATURE(u),rightIcon:Uu,disabled:!d,onClick:()=>B$(e,o)}),l&&h.push({id:Or(),tooltip:c?ke.EDIT_CONFIGURATION:ke.UPGRADE_TO_USE_FEATURE(p),rightIcon:Qu,disabled:!c,onClick:()=>B$(e,l)}),h}})({connections:x,configMinSupportedVersion:h,snapshotMinSupportedVersion:g,onDelete:t=>e(t,X$.Delete),onAddSource:f.canFetchSnapshots&&f.canBulkPersistSources?t=>e(t,X$.BulkSource):void 0,onEditConfiguration:t=>e(t,X$.BulkConfig)})},[x,h,g,f]),U=a(()=>F.some(e=>e.type===ec.K8s&&e.status===ie.Success&&Qp(e.odigosVersion,g,e.type)),[F,g]),G=a(()=>F.some(e=>e.type===ec.K8s&&e.status===ie.Success&&Qp(e.odigosVersion,h,e.type)),[F,h]),j=a(()=>{const e=f.canFetchSnapshots&&f.canBulkPersistSources,t=eu(g,ec.K8s),i=eu(h,ec.K8s);return(e=>{const{onCancel:t,onAddSource:i,addSourceDisabled:n,addSourceTooltip:a,onManageConfigurations:o,manageConfigDisabled:l,manageConfigTooltip:r}=e,s=[];return i&&s.push({id:X$.BulkSource,type:St.Button,buttonProps:{variant:K.Primary,size:W.S,label:ke.ADD_SOURCES,rightIcon:Uu,disabled:n,tooltip:a,onClick:i}}),o&&s.push({id:X$.BulkConfig,type:St.Button,buttonProps:{variant:K.Secondary,size:W.S,leftIcon:Qu,label:ke.MANAGE_CONFIGURATIONS,disabled:l,tooltip:r,onClick:o}}),s.push({id:Or(),type:St.Button,buttonProps:{variant:K.Text,size:W.S,label:zn.CANCEL,onClick:t}}),s})({onCancel:()=>A([]),onAddSource:e?()=>$(X$.BulkSource):void 0,addSourceDisabled:e&&!U,addSourceTooltip:e&&!U?ke.UPGRADE_TO_USE_FEATURE(t):void 0,onManageConfigurations:()=>$(X$.BulkConfig),manageConfigDisabled:!G,manageConfigTooltip:G?void 0:ke.UPGRADE_TO_USE_FEATURE(i)})},[f,U,G,g,h]),H=a(()=>t(Xt,{items:_$,withMultiSelect:!1,selectedIds:[],setSelectedIds:e=>X(e[0]),buttonProps:{variant:K.Primary,size:W.S,label:zn.CREATE_NEW}}),[X]),Y=a(()=>k.trim()&&x.length>0?{hideIcon:!0,title:ke.NO_RESULTS,subTitle:ke.NO_RESULTS_FOR_FILTER(k)}:{icon:$h,title:ke.NO_CONNECTIONS,action:H},[k,x.length,H]);return t(ic,{children:e(Re,{fullHeight:!0,richTitle:{icon:$h,title:ke.CONNECTIONS,badge:{label:x.length.toString(),status:ie.Unknown}},search:{placeholder:ke.SEARCH_BY_CLUSTER_NAME,value:k,onChange:e=>T(e),width:"300px"},actions:[{id:"connections-refresh",type:St.Button,buttonProps:{variant:K.Secondary,size:W.S,leftIcon:Zu,onClick:C,disabled:y}},{id:"connections-create-new",type:St.DropDataButton,buttonProps:{variant:K.Primary,size:W.S,label:zn.CREATE_NEW,onClick:e=>X(e)},dropDataProps:{alignX:Lt.Right,items:_$}}],children:[t(za,{variant:Ra.Pretty,headerBackgroundColor:m.v2.colors.silver[1e3],isLoading:y,withCheckboxes:!0,columns:F$,rows:B,noDataProps:Y,rowActionsPushRightPosition:I?`calc(${rm} - 24px)`:void 0,getRowActions:V}),O&&t(Tg,{providers:p,children:t(Ex,{onClose:()=>D(!1),withOverlay:!0,onCreateCloudConnector:u,onCreated:P})}),t(hm,{isOpen:z,onClose:()=>R(!1)}),t(vt,{isOpen:!!N.length&&!I,richTitle:{icon:Ou,title:ke.SELECTED_CLUSTERS,badge:{label:N.length}},actions:j}),I===X$.BulkConfig&&t(Ig,{connections:F,children:t(Xx,{onClose:()=>$(null),connections:_,selectedConnectionIds:N,setSelectedConnectionIds:A})}),I===X$.BulkSource&&f.canFetchSnapshots&&f.canBulkPersistSources&&t(Ig,{connections:F,children:t($g,{selectedConnectionIds:N,children:t(Xy,{onClose:()=>$(null),selectedConnectionIds:N,setSelectedConnectionIds:A})})}),t(cm,{target:"connection",isOpen:I===X$.Delete,onClose:()=>{A([]),$(null)},onApprove:async()=>{const e=N[0];e&&(await s(e),await C())}})]})})};var j$,H$;(e=>{e.Overview="overview",e.Findings="findings",e.Transactions="transactions",e.SettingsAndConfigurations="settings-and-configurations"})(j$||(j$={})),(e=>{e.Anomaly="anomaly",e.Violation="violation",e.Transaction="transaction"})(H$||(H$={}));const W$={drawerIsOpenFor:{type:null,id:null},openDrawer:()=>{},closeDrawer:()=>{}},K$=h(W$),Y$=({children:e})=>{const[i,n]=l(W$.drawerIsOpenFor),o=d((e,t)=>n({type:e,id:t}),[]),r=d(()=>n(W$.drawerIsOpenFor),[]),s=a(()=>({drawerIsOpenFor:i,openDrawer:o,closeDrawer:r}),[i,o,r]);return t(K$.Provider,{value:s,children:e})},J$=()=>g(K$),q$=f.div`
|
|
1970
1970
|
display: flex;
|
|
1971
1971
|
flex-direction: column;
|
|
1972
1972
|
align-self: stretch;
|
|
@@ -1992,7 +1992,7 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
1992
1992
|
padding: 8px;
|
|
1993
1993
|
border-radius: 12px;
|
|
1994
1994
|
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
1995
|
-
`,eN=({richTitle:i,textCards:n,tableColumns:a,tableRows:o,getRowActions:l,tableKey:r,tableMaxHeight:s,tableWithCheckboxes:c,tableNoDataProps:d,isLoading:p,actions:u,children:h})=>{const g=v();return t(q$,{children:e(Z$,{children:[e(T,{$justifyContent:"space-between",children:[t(nc,{...i}),u&&t(ac,{actions:u})]}),t(T,{$gap:22,children:n.map(e=>t(oc,{...e},e.title))}),h,!!a.length&&t(Q$,{children:t(za,{maxHeight:s,headerBackgroundColor:g.v2.colors.silver[800],variant:Ra.Data,columns:a,rows:o,isLoading:p,getRowActions:l,withCheckboxes:c,noDataProps:d},r)})]})})},tN=(e,t)=>{const{items:i}=Hh().sourcesApi.useSources();return a(()=>{const n=lc(i,e,t);if(!n)return[nh];const a=ha(n);return a.length?a:[nh]},[i,e,t])},iN=({service:i,namespace:n,size:a=24,typographySize:o=C.XXS})=>{const l=tN(i,n);return e(T,{$gap:8,children:[t(ga,{icons:l,size:a}),t(w,{size:o,nowrap:!0,children:i})]})};var nN;(e=>{e.Title="title",e.TransactionId="transactionId",e.LastSeen="lastSeen",e.StartTime="startTime",e.EndTime="endTime",e.Namespace="namespace",e.Service="service",e.Kind="kind",e.Status="status",e.Score="score",e.Severity="severity",e.Occurrences="occurrences",e.Offending="offending",e.Signature="signature",e.RuleKey="ruleKey",e.ScopeKey="scopeKey"})(nN||(nN={}));const aN=e=>e.firstSeen||e.lastSeen,oN=e=>e.kind===cc.Anomaly?["anomaly",e.transactionId??"",e.signature??""].join("\0"):["violation",e.scopeKey??"",e.ruleKey??"",e.offending??""].join("\0"),lN=(e,t)=>oN(e)===oN(t);var rN;(e=>{e.Dismiss="dismiss",e.Accept="accept"})(rN||(rN={}));const sN={[rN.Dismiss]:[rc.Dismissed,sc.Dismissed],[rN.Accept]:[rc.Accepted,sc.Accepted]},cN=(e,t)=>[{id:`${e.id}-investigate`,label:"Investigate",tooltip:"Open the investigation view for this finding",rightIcon:Cu,variant:K.Primary,onClick:()=>{if(!e.id)return;const i=e.cells.find(e=>e.key===nN.Kind)?.rawValue;t(i===cc.Anomaly?H$.Anomaly:H$.Violation,e.id)}}],dN=[{label:"Severity",key:nN.Severity},{label:"Namespace",key:nN.Namespace},{label:"Service",key:nN.Service,noFilter:!0},{label:"Finding",key:nN.Title,noFilter:!0},{label:"Type",key:nN.Kind},{label:"Matched traces",key:nN.Occurrences,noFilter:!0},{label:"Status",key:nN.Status},{label:"Last seen",key:nN.LastSeen,noFilter:!0}],pN=[{label:"Namespace",key:nN.Namespace},{label:"Service",key:nN.Service,noFilter:!0},{label:"Events",key:nN.Occurrences,noFilter:!0},{label:"Last seen",key:nN.LastSeen,noFilter:!0}],uN=[{label:"",key:nN.Title,noSort:!0,noFilter:!0}],hN=e=>e.status===rc.Open||e.status===sc.Open,gN=e=>{const t={open:0,violations:0,anomalies:0,critical:0,high:0,medium:0,low:0};return e?.forEach(e=>{switch(hN(e)&&(t.open+=1),e.kind===cc.Violation?t.violations+=1:e.kind===cc.Anomaly&&(t.anomalies+=1),e.severity){case en.Critical:t.critical+=1;break;case en.High:t.high+=1;break;case en.Medium:t.medium+=1;break;case en.Low:t.low+=1}}),t},mN=(e,t)=>({label:t,backgroundColor:(()=>{switch(t){case en.Low:return e.v2.colors.purple[900];case en.Medium:return e.v2.colors.yellow[550];case en.High:return e.v2.colors.orange[500];case en.Critical:return e.v2.colors.red[800];default:return}})(),textColor:(()=>{switch(t){case en.Low:case en.Critical:return e.v2.colors.white[500];case en.Medium:case en.High:return e.v2.colors.black[500];default:return}})()}),bN=(e,t)=>({label:t,backgroundColor:(()=>{switch(t){case rc.Open:case sc.Open:return e.v2.colors.beige[600];case rc.Accepted:case sc.Accepted:return e.v2.colors.green[500];case rc.Dismissed:case sc.Dismissed:default:return e.v2.colors.silver[500]}})(),textColor:(()=>{switch(t){case rc.Open:case sc.Open:case rc.Accepted:case sc.Accepted:return e.v2.colors.black[500];case rc.Dismissed:case sc.Dismissed:default:return e.v2.colors.white[500]}})()}),fN=(e,i,n,a,o,l)=>n
|
|
1995
|
+
`,eN=({richTitle:i,textCards:n,tableColumns:a,tableRows:o,getRowActions:l,tableKey:r,tableMaxHeight:s,tableWithCheckboxes:c,tableNoDataProps:d,isLoading:p,actions:u,children:h})=>{const g=v();return t(q$,{children:e(Z$,{children:[e(T,{$justifyContent:"space-between",children:[t(nc,{...i}),u&&t(ac,{actions:u})]}),t(T,{$gap:22,children:n.map(e=>t(oc,{...e},e.title))}),h,!!a.length&&t(Q$,{children:t(za,{maxHeight:s,headerBackgroundColor:g.v2.colors.silver[800],variant:Ra.Data,columns:a,rows:o,isLoading:p,getRowActions:l,withCheckboxes:c,noDataProps:d},r)})]})})},tN=(e,t)=>{const{items:i}=Hh().sourcesApi.useSources();return a(()=>{const n=lc(i,e,t);if(!n)return[nh];const a=ha(n);return a.length?a:[nh]},[i,e,t])},iN=({service:i,namespace:n,size:a=24,typographySize:o=C.XXS})=>{const l=tN(i,n);return e(T,{$gap:8,children:[t(ga,{icons:l,size:a}),t(w,{size:o,nowrap:!0,children:i})]})};var nN;(e=>{e.Title="title",e.TransactionId="transactionId",e.LastSeen="lastSeen",e.StartTime="startTime",e.EndTime="endTime",e.Namespace="namespace",e.Service="service",e.Kind="kind",e.Status="status",e.Score="score",e.Severity="severity",e.Occurrences="occurrences",e.Offending="offending",e.Signature="signature",e.RuleKey="ruleKey",e.ScopeKey="scopeKey"})(nN||(nN={}));const aN=e=>e.firstSeen||e.lastSeen,oN=e=>e.kind===cc.Anomaly?["anomaly",e.transactionId??"",e.signature??""].join("\0"):["violation",e.scopeKey??"",e.ruleKey??"",e.offending??""].join("\0"),lN=(e,t)=>oN(e)===oN(t);var rN;(e=>{e.Dismiss="dismiss",e.Accept="accept"})(rN||(rN={}));const sN={[rN.Dismiss]:[rc.Dismissed,sc.Dismissed],[rN.Accept]:[rc.Accepted,sc.Accepted]},cN=(e,t)=>[{id:`${e.id}-investigate`,label:"Investigate",tooltip:"Open the investigation view for this finding",rightIcon:Cu,variant:K.Primary,onClick:()=>{if(!e.id)return;const i=e.cells.find(e=>e.key===nN.Kind)?.rawValue;t(i===cc.Anomaly?H$.Anomaly:H$.Violation,e.id)}}],dN=[{label:"Severity",key:nN.Severity},{label:"Namespace",key:nN.Namespace},{label:"Service",key:nN.Service,noFilter:!0},{label:"Finding",key:nN.Title,noFilter:!0},{label:"Type",key:nN.Kind},{label:"Matched traces",key:nN.Occurrences,noFilter:!0},{label:"Status",key:nN.Status},{label:"Last seen",key:nN.LastSeen,noFilter:!0}],pN=[{label:"Namespace",key:nN.Namespace},{label:"Service",key:nN.Service,noFilter:!0},{label:"Events",key:nN.Occurrences,noFilter:!0},{label:"Last seen",key:nN.LastSeen,noFilter:!0}],uN=[{label:"",key:nN.Title,noSort:!0,noFilter:!0}],hN=e=>e.status===rc.Open||e.status===sc.Open,gN=e=>{const t={open:0,violations:0,anomalies:0,critical:0,high:0,medium:0,low:0};return e?.forEach(e=>{switch(hN(e)&&(t.open+=1),e.kind===cc.Violation?t.violations+=1:e.kind===cc.Anomaly&&(t.anomalies+=1),e.severity){case en.Critical:t.critical+=1;break;case en.High:t.high+=1;break;case en.Medium:t.medium+=1;break;case en.Low:t.low+=1}}),t},mN=(e,t)=>({label:t,backgroundColor:(()=>{switch(t){case en.Low:return e.v2.colors.purple[900];case en.Medium:return e.v2.colors.yellow[550];case en.High:return e.v2.colors.orange[500];case en.Critical:return e.v2.colors.red[800];default:return}})(),textColor:(()=>{switch(t){case en.Low:case en.Critical:return e.v2.colors.white[500];case en.Medium:case en.High:return e.v2.colors.black[500];default:return}})()}),bN=(e,t)=>({label:t,backgroundColor:(()=>{switch(t){case rc.Open:case sc.Open:return e.v2.colors.beige[600];case rc.Accepted:case sc.Accepted:return e.v2.colors.green[500];case rc.Dismissed:case sc.Dismissed:default:return e.v2.colors.silver[500]}})(),textColor:(()=>{switch(t){case rc.Open:case sc.Open:case rc.Accepted:case sc.Accepted:return e.v2.colors.black[500];case rc.Dismissed:case sc.Dismissed:default:return e.v2.colors.white[500]}})()}),fN={[en.Info]:0,[en.Low]:1,[en.Medium]:2,[en.High]:3,[en.Critical]:4},vN=e=>{let t=en.Info;for(const i of e)fN[i.severity]>fN[t]&&(t=i.severity);return t},yN=(e,i,n,a,o,l)=>{const r=[...n??[]].sort((e,t)=>fN[t.severity]-fN[e.severity]);return r.slice(0,a||r.length).map(n=>({id:oN(n),isSelected:!!o?.find(e=>lN(e,n)),onSelect:()=>l?.(n,!0),onDeselect:()=>l?.(n,!1),cells:[{key:nN.Title,rawValue:n.kind===cc.Anomaly&&Ag(n)||n.title,component:()=>n.kind===cc.Anomaly?t(Ng,{operationName:n.operationName||n.title,identityDimensions:n.identityDimensions}):t(Xi,{label:n.title,variant:_i.Blue})},{key:nN.TransactionId,rawValue:n.transactionId??"-"},{key:nN.LastSeen,rawValue:i(n.lastSeen,{style:"short"})},{key:nN.Namespace,rawValue:n.namespace},{key:nN.Service,rawValue:n.service,component:()=>t(iN,{service:n.service,namespace:n.namespace})},{key:nN.Kind,rawValue:n.kind,component:()=>t(E,{label:n.kind,backgroundColor:e.v2.colors.pink[1e3],textColor:e.v2.colors.pink[500]})},{key:nN.Status,rawValue:n.status,component:()=>t(E,{...bN(e,n.status)})},{key:nN.Score,rawValue:Number(n.score).toLocaleString()},{key:nN.Severity,rawValue:n.severity,component:()=>t(E,{...mN(e,n.severity)})},{key:nN.Occurrences,rawValue:Number(n.occurrences).toLocaleString()},{key:nN.Offending,rawValue:n.offending??"-"},{key:nN.Signature,rawValue:n.signature??"-"},{key:nN.RuleKey,rawValue:n.ruleKey??"-",component:n.ruleKey?()=>t(Xi,{label:n.ruleKey,variant:_i.Blue}):void 0},{key:nN.ScopeKey,rawValue:n.scopeKey??"-",component:n.scopeKey?()=>t(Xi,{label:n.scopeKey,variant:_i.Default}):void 0}]}))},SN=(e,t)=>`(${t(e.startTime,{style:"short",units:1})} ago)`,xN=e=>{const t=new Date(e.startTime).getTime(),i=new Date(e.endTime).getTime(),n=Math.max(0,Math.round((i-t)/1e3)),a=new Date(e.startTime).toLocaleString();return n<=0?`at ${a}`:`starting at ${a} for ${n} ${1===n?"second":"seconds"}`},wN=(e,t)=>{const i=e.findings.length,n=vN(e.findings),a=[...new Set(e.findings.map(e=>e.service))],o=1===i?"finding":"findings",l=i>1?"possibly related ":"",r=1===i?n:`up to ${n}`,s=1===a.length?`service ${a[0]}`:`services ${a.join(", ")}`;return`${SN(e,t)} ${i} ${l}suspicious ${o} ${r} found in ${s} ${xN(e)}`};var CN;(e=>{e.TransactionId="transactionId",e.Class="class",e.Status="status",e.Learning="learning",e.Data="data",e.ObservationCount="observationCount",e.ObservationCountAtLastChange="observationCountAtLastChange",e.LearningStartedAt="learningStartedAt",e.LastChangedAt="lastChangedAt"})(CN||(CN={}));const kN=(e,i)=>i?.map((e,i)=>({id:`${e.transactionId}-${i}`,cells:[{key:CN.TransactionId,rawValue:e.transactionId},{key:CN.Class,rawValue:e.class,component:()=>t(ce,{text:e.classDescription,children:t(w,{size:C.XXS,children:e.classLabel})})},{key:CN.Status,rawValue:e.learning?.phase||"",component:e.learning?.phase?()=>t(AN,{phase:e.learning.phase,readyToPromote:e.learning.readyToPromote}):void 0},{key:CN.Learning,rawValue:e.learning?.phase||"",component:e.learning?()=>t(ON,{learning:e.learning}):void 0},{key:CN.LearningStartedAt,rawValue:e.learningStartedAt?new Date(e.learningStartedAt).toLocaleString():""},{key:CN.ObservationCount,rawValue:Number(e.observationCount).toLocaleString()},{key:CN.ObservationCountAtLastChange,rawValue:Number(e.observationCountAtLastChange??0).toLocaleString()},{key:CN.LastChangedAt,rawValue:e.lastChangedAt?new Date(e.lastChangedAt).toLocaleString():""},{key:CN.Data,rawValue:e.data??""}]}))??[],TN=f.div`
|
|
1996
1996
|
position: relative;
|
|
1997
1997
|
width: 100%;
|
|
1998
1998
|
height: 6px;
|
|
@@ -2007,7 +2007,7 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2007
2007
|
width: ${({$pct:e})=>`${Math.max(0,Math.min(100,e))}%`};
|
|
2008
2008
|
border-radius: 3px;
|
|
2009
2009
|
background-color: ${({$color:e})=>e};
|
|
2010
|
-
`,$N="Locked: this class is promoted - its baseline is frozen and no longer changes.",NN="Learning: progress toward the resolved stability targets. A full bar is not promotion - Locked is only when phase is promoted.",AN=({phase:e,readyToPromote:i})=>{const n=v();if(i)return t(E,{label:"Ready to promote",backgroundColor:n.v2.colors.green[800],textColor:n.v2.colors.green[300],textSize:C.XXXS});switch(e){case uc.Empty:case uc.Learning:return t(E,{label:"Learning",backgroundColor:n.v2.colors.beige[600],textColor:n.v2.colors.black[500],textSize:C.XXXS});case uc.Promoted:return t(E,{label:"Promoted",leftIcon:Lu,status:ie.Success,textSize:C.XXXS});default:return null}},ON=({learning:i})=>{const n=v();if(!i)return null;switch(i.phase){case uc.Empty:return t(ce,{text:"No data yet: this class has not grown a baseline structure. Stability does not apply until it learns something.",children:t(w,{size:C.XXXS,color:k.Secondary,children:"No baseline data yet"})});case uc.Promoted:return t(ce,{text:$N,children:t(w,{size:C.XXXS,color:k.Secondary,children:"Baseline locked"})});case uc.Learning:{const{observations:l,duration:r}=i.stability;return t(ce,{text:i.readyToPromote?"Ready to promote: the learning policy gate is already satisfied, but the engine has not graduated the class yet.":NN,children:e($,{$gap:4,children:[e(w,{size:C.XXXS,color:k.Primary,children:[l.current.toLocaleString()," / ",l.target.toLocaleString()," observations"]}),t(TN,{children:t(IN,{$pct:(a=l.current,o=l.target,o<=0?0:a/o*100),$color:n.v2.colors.blue[400]})}),t(w,{size:C.XXXS,color:k.Secondary,children:r.current<=0?"grew just now":`grew ${hc(r.current,{units:2,style:"long",suffix:!0})}`})]})})}default:return null}var a,o};var EN;(e=>{e.TransactionId="transactionId",e.LastSeen="lastSeen",e.Namespace="namespace",e.Service="service",e.Kind="kind",e.Operation="operation",e.Baseline="baseline",e.Guardrail="guardrail",e.Volume="volume",e.TransactionCount="transactionCount"})(EN||(EN={}));const DN=(e,t,i,n)=>{const a=e.cells.find(e=>e.key===EN.TransactionId)?.rawValue,o="Promoted"===e.cells.find(e=>e.key===EN.Baseline)?.rawValue,l=[{id:`${e.id}-open-baseline`,label:"View more",tooltip:"Open this transaction's details and baselines",rightIcon:Cu,variant:K.Primary,onClick:()=>t(H$.Transaction,a)}];return i&&l.push({id:`${e.id}-promote-baselines`,label:"Promote baselines",leftIcon:Ou,variant:K.Secondary,disabled:o||!i.canPromote,onClick:()=>i.onPromote(a)}),n&&l.push({id:`${e.id}-delete`,label:"Delete",leftIcon:xu,variant:K.Secondary,disabled:!n.canDelete,onClick:()=>n.onDelete(a)}),l},zN=[{label:"Namespace",key:EN.Namespace},{label:"Service",key:EN.Service,noFilter:!0},{label:"Operation",key:EN.Operation,noFilter:!0},{label:"Kind",key:EN.Kind},{label:"Volume",key:EN.Volume,noFilter:!0},{label:"Baseline",key:EN.Baseline},{label:"Last seen",key:EN.LastSeen,noFilter:!0}],RN=[{label:"Namespace",key:EN.Namespace},{label:"Service",key:EN.Service,noFilter:!0},{label:"Baseline",key:EN.Baseline},{label:"Auto guardrail",key:EN.Guardrail,tooltip:"Once every transaction on a service is promoted, Odigos enforces only the transaction identities already learned - new ones are flagged."},{label:"Transactions",key:EN.TransactionCount,noFilter:!0},{label:"Volume",key:EN.Volume,noFilter:!0}],PN=e=>({total:e?.length||0,services:Array.from(new Set(e?.map(e=>e.service))).length,volume:e?.reduce((e,t)=>e+Number(t.volume),0)||0,promoted:e?.filter(e=>e.promoted).length||0,learning:e?.filter(e=>!e.promoted).length||0}),XN=(e,i,n,a,o)=>n?.slice(0,a||n.length).map(n=>({id:n.id,isSelected:o?o.selectedIds.includes(n.id):void 0,onSelect:o?()=>o.toggleSelection(n.id,!0):void 0,onDeselect:o?()=>o.toggleSelection(n.id,!1):void 0,cells:[{key:EN.TransactionId,rawValue:n.id},{key:EN.LastSeen,rawValue:i(n.lastSeen,{style:"short"})},{key:EN.Namespace,rawValue:n.namespace},{key:EN.Service,rawValue:n.service,component:()=>t(iN,{service:n.service,namespace:n.namespace})},{key:EN.Kind,rawValue:n.kind,component:()=>t(E,{label:n.kind,backgroundColor:e.v2.colors.blue[900]})},{key:EN.Operation,rawValue:Ag(n),component:()=>t(Ng,{operationName:n.operationName,identityDimensions:n.identityDimensions})},{key:EN.Baseline,rawValue:n.promoted?"Promoted":"Learning",component:()=>n.promoted?t(E,{label:"Promoted",leftIcon:Lu,status:ie.Success,textSize:C.XXXS,tooltip:$N}):t(E,{label:"Learning",backgroundColor:e.v2.colors.beige[600],textColor:e.v2.colors.black[500],textSize:C.XXXS,tooltip:NN})},{key:EN.Volume,rawValue:Number(n.volume).toLocaleString()}]}))||[],LN=({setSelectedTab:i})=>{const n=v(),{openDrawer:o}=J$(),{formatDurationAgo:r}=qn(),{insightsApi:s}=Hh(),[c,d]=l(gc),{data:p,loading:u,refetch:h}=s.useFindings({windowHours:c}),{data:g,loading:m,refetch:b}=s.useTransactions(),f=a(()=>(e=>e?.filter(hN)??[])(p),[p]),y=a(()=>gN(p),[p]),S=a(()=>fN(n,r,f,5),[f,n,r]),x=a(()=>PN(g),[g]),k=a(()=>XN(n,r,g,5),[g,n,r]);return e($,{children:[e(T,{$padding:"12px 0",$justifyContent:"space-between",children:[t(w,{size:C.M,children:"Runtime Trace Security (Insights)"}),t(H,{variant:K.Text,size:W.S,leftIcon:Zu,label:"Refresh",onClick:()=>{h(),b()},disabled:u||m})]}),e($,{$gap:24,children:[t(eN,{tableMaxHeight:"380px",richTitle:{title:"Top 5 Open Findings",titleSize:C.M,icon:Nh,badge:{label:f.length}},textCards:[{bgTint:"900",title:"Open findings",cells:[{value:y.open.toLocaleString()}]},{bgTint:"900",title:"Critical / High",cells:[{value:(y.critical+y.high).toLocaleString()}]},{bgTint:"900",title:"Policy violations",cells:[{value:y.violations.toLocaleString()}]},{bgTint:"900",title:"Anomalies",cells:[{value:y.anomalies.toLocaleString()}]}],tableColumns:dN,tableRows:S,tableNoDataProps:{icon:Nh,title:"No findings found",subTitle:""},isLoading:u,actions:[{id:"search-by-time",type:St.PopupButton,buttonProps:bc(c),popupProps:{children:({close:e})=>t(mc,{defaultValue:c,onApply:d,onClose:e})}},{id:"view-all",type:St.Button,buttonProps:{label:"View all",rightIcon:Cu,variant:K.Secondary,size:W.S,onClick:()=>i(j$.Findings)}}],getRowActions:e=>cN(e,o)}),t(eN,{tableMaxHeight:"380px",richTitle:{title:"Top 5 Transactions",titleSize:C.M,icon:Pu,badge:{label:g?.length||0}},textCards:[{bgTint:"900",title:"Transactions",cells:[{value:x.total.toLocaleString()}]},{bgTint:"900",title:"Services",cells:[{value:x.services.toLocaleString()}]},{bgTint:"900",title:"Volume",cells:[{value:x.volume.toLocaleString()}]},{bgTint:"900",title:"Baselines promoted",tooltip:'Share of learned baseline classes that have finished the learning phase (graduated), and are now enforced for anomaly detection. The rest are still learning what "normal" looks like.',cells:[{value:((x.promoted||0)/(x.total||1)*100).toFixed(1)+"%"}]}],tableColumns:zN,tableRows:k,tableNoDataProps:{icon:Pu,title:"No transactions found",subTitle:""},isLoading:m,actions:[{id:"view-all",type:St.Button,buttonProps:{label:"View all",rightIcon:Cu,variant:K.Secondary,size:W.S,onClick:()=>i(j$.Transactions)}}],getRowActions:e=>DN(e,o)})]})]})},_N={[rN.Dismiss]:{label:"Dismiss",title:e=>`Dismiss selected findings (${e})`,description:"Are you sure you want to dismiss the selected findings?"},[rN.Accept]:{label:"Accept",title:e=>`Accept selected findings (${e})`,description:"Are you sure you want to accept the selected findings?"}},MN=({actionType:i,selectedFindings:n,onDone:o,buttonProps:s})=>{const[c,d]=l(!1),[p,u]=l(!1),h=()=>u(!1),{insightsApi:g}=Hh(),m=_N[i],b=a(()=>{return!n.length||(t=i,(e=n).length>0&&e.every(e=>((e,t)=>sN[t].includes(e.status))(e,t)));var e,t},[n,i]);return e(r,{children:[t(H,{label:m.label,variant:K.Secondary,onClick:()=>u(!0),disabled:b,loading:c,...s}),t(Ce,{isOpen:p,onClose:h,title:m.title(n.length),description:m.description,denyButton:{label:"Cancel",variant:K.Secondary,onClick:h,loading:c},approveButton:{label:m.label,variant:K.Primary,disabled:!n.length,onClick:async()=>{d(!0),await(async(e,t,i)=>{const n=t.filter(e=>e.kind===cc.Anomaly&&e.transactionId&&e.signature),a=t.filter(e=>e.kind===cc.Violation),o=[],l=i===rN.Accept;if(n.length){const t=n.map(e=>({transactionId:e.transactionId,signature:e.signature}));if(e.bulkResolveAnomalies)o.push(e.bulkResolveAnomalies(l?dc.Accept:dc.Dismiss,t));else{const i=l?pc.Accept:pc.Dismiss;o.push(...t.map(t=>e.resolveAnomaly?.({...t,resolution:i})))}}if(a.length){const t=l?e.acceptViolation:e.dismissViolation;o.push(...a.map(e=>t?.({scopeKey:e.scopeKey||"",ruleKey:e.ruleKey||"",offending:e.offending||""})))}await Promise.all(o.filter(Boolean))})(g,n,i),d(!1),u(!1),o?.()},loading:c}})]})};var FN;(e=>{e.All="all",e.GroupByService="groupByService",e.GroupByTime="groupByTime"})(FN||(FN={}));const BN=[{label:"All findings",value:FN.All},{label:"Group by service",value:FN.GroupByService},{label:"Related findings",value:FN.GroupByTime}];var VN;(e=>{e.Open="open",e.Dismissed="dismissed",e.Accepted="accepted"})(VN||(VN={}));const UN=[{label:"Open",value:VN.Open},{label:"Dismissed",value:VN.Dismissed},{label:"Accepted",value:VN.Accepted}],GN=()=>{const i=v(),{openDrawer:n}=J$(),{formatDurationAgo:o}=qn(),{insightsApi:r}=Hh(),[s,c]=l(gc),{data:p,loading:u,refetch:h}=r.useFindings({windowHours:s}),[g,m]=l([]),b=d((e,t)=>{m(i=>t?-1===i.findIndex(t=>lN(t,e))?[...i,e]:i:i.filter(t=>!lN(t,e)))},[]),[f,y]=l(""),[S,x]=l(FN.All),[I,$]=l(VN.Open),{openFindings:A,dismissedFindings:O,acceptedFindings:D}=a(()=>{const e=[],t=[],i=[];return p?.forEach(n=>{hN(n)&&e.push(n),[rc.Dismissed,sc.Dismissed].includes(n.status)&&t.push(n),[rc.Accepted,sc.Accepted].includes(n.status)&&i.push(n)}),{openFindings:e,dismissedFindings:t,acceptedFindings:i}},[p]),z=a(()=>I===VN.Open?A:I===VN.Dismissed?O:I===VN.Accepted?D:[],[I,A,O,D]),R=a(()=>f?z?.filter(e=>{const t=f.toLowerCase();return e.namespace?.toLowerCase().includes(t)||e.service?.toLowerCase().includes(t)||e.kind?.toLowerCase().includes(t)||e.title.toLowerCase().includes(t)||e.operationName?.toLowerCase().includes(t)||e.identityDimensions?.some(e=>e.key.toLowerCase().includes(t)||e.value.toLowerCase().includes(t))}):z,[z,f]),P=a(()=>gN(z),[z]),X=a(()=>{if(S===FN.GroupByService){const e=[];return R?.forEach(t=>{const i=e.find(e=>e.service===t.service);i?(i.findings.push(t),i.occurrences+=t.occurrences,new Date(i.lastSeen)<new Date(t.lastSeen)&&(i.lastSeen=t.lastSeen)):e.push({service:t.service,namespace:t.namespace,occurrences:t.occurrences,lastSeen:t.lastSeen,findings:[t]})}),((e,i,n,a,o,l)=>a.map(a=>({id:`${a.namespace}/${a.service}`,cells:[{key:nN.Namespace,rawValue:a.namespace},{key:nN.Service,rawValue:a.service,component:()=>t(iN,{service:a.service,namespace:a.namespace})},{key:nN.Occurrences,rawValue:Number(a.occurrences).toLocaleString()},{key:nN.LastSeen,rawValue:new Date(a.lastSeen).toLocaleString()}],expandedContent:({maxHeight:r})=>t(za,{fitContent:!0,variant:Ra.DataSecondary,maxHeight:r,columns:dN,rows:fN(e,i,a.findings,void 0,o,l),getRowActions:e=>cN(e,n),withCheckboxes:!0})})))(i,o,n,e,g,b)}if(S===FN.GroupByTime){const a=(e=>{const t=[...e].sort((e,t)=>new Date(aN(e)).getTime()-new Date(aN(t)).getTime()),i=[];return t.forEach(e=>{const t=aN(e),n=new Date(t).getTime(),a=i[i.length-1];!a||n-new Date(a.endTime).getTime()>3e4?i.push({startTime:t,endTime:t,occurrences:e.occurrences,findings:[e]}):(a.findings.push(e),a.occurrences+=e.occurrences,a.endTime=t)}),i.reverse()})(R??[]);return((i,n,a,o,l,r)=>o.map((o,s)=>({id:`time-${s}-${o.startTime}-${o.endTime}`,cells:[{key:nN.Title,rawValue:wN(o,n),component:()=>{const a=o.findings.length,l=yN(o.findings),r=[...new Set(o.findings.map(e=>e.service))],s=1===r.length?"service":"services",c=SN(o,n),d=xN(o);return e(T,{$gap:6,$alignItems:"center",$wrap:"nowrap",children:[t(w,{size:C.XS,color:k.Secondary,nowrap:!0,children:c}),t(w,{size:C.XS,color:k.Primary,weight:600,nowrap:!0,children:a}),e(w,{size:C.XS,color:k.Secondary,nowrap:!0,children:[a>1?"possibly related ":"","suspicious ",1===a?"finding":"findings",a>1?" up to":""]}),t(E,{...mN(i,l)}),e(w,{size:C.XS,color:k.Secondary,nowrap:!0,children:["found in ",s]}),t(w,{size:C.XS,color:k.Primary,weight:600,nowrap:!0,children:r.join(", ")}),t(w,{size:C.XS,color:k.Secondary,nowrap:!0,children:d})]})}}],expandedContent:({maxHeight:e})=>t(za,{fitContent:!0,variant:Ra.DataSecondary,maxHeight:e,columns:dN,rows:fN(i,n,o.findings,void 0,l,r),getRowActions:e=>cN(e,a),withCheckboxes:!0})})))(i,o,n,a,g,b)}return fN(i,o,R,void 0,g,b)},[i,R,S,o,n,g,b]);return t(eN,{richTitle:{title:"Findings",titleSize:C.M,icon:Nh,badge:{label:z?.length||0},children:t(N,{$padding:"0 0 0 32px",children:t(F,{options:UN,selected:I,setSelected:$,size:Zt.L})})},textCards:[{bgTint:"900",title:(I===VN.Open?"Open":I===VN.Dismissed?"Dismissed":"Accepted")+" findings",cells:[{value:P.open.toLocaleString()}]},{bgTint:"900",title:"Critical / High",cells:[{value:(P.critical+P.high).toLocaleString()}]},{bgTint:"900",title:"Policy violations",cells:[{value:P.violations.toLocaleString()}]},{bgTint:"900",title:"Anomalies",cells:[{value:P.anomalies.toLocaleString()}]}],tableKey:S,tableColumns:S===FN.GroupByService?pN:S===FN.GroupByTime?uN:dN,tableRows:X,tableWithCheckboxes:S===FN.All,tableNoDataProps:{icon:Nh,title:f?"No matched findings":"No findings found",subTitle:f?`No findings matched your search criteria: ${f}`:""},isLoading:u,actions:[{id:"search-by-time",type:St.PopupButton,buttonProps:bc(s),popupProps:{children:({close:e})=>t(mc,{defaultValue:s,onApply:c,onClose:e})}},{id:"refresh",type:St.Button,buttonProps:{label:"Refresh",leftIcon:Zu,variant:K.Secondary,size:W.S,disabled:u,onClick:()=>h()}}],getRowActions:S===FN.All?e=>cN(e,n):void 0,children:e(T,{$width:"100%",$gap:24,$justifyContent:"space-between",children:[e(T,{$gap:12,children:[t(nc,{title:"Findings list",titleSize:C.S,badge:{label:R?.length||0}}),t(sa,{width:"400px",value:f,onChange:y}),t(F,{options:BN,selected:S,setSelected:x,size:Zt.L})]}),e(T,{$gap:12,children:[t(MN,{actionType:rN.Dismiss,selectedFindings:g,onDone:()=>{m([]),h()},buttonProps:{label:"Dismiss selection"}}),t(MN,{actionType:rN.Accept,selectedFindings:g,onDone:()=>{m([]),h()},buttonProps:{label:"Accept selection",variant:K.Primary}})]})]})})};var jN;(e=>{e.All="all",e.GroupByService="groupByService"})(jN||(jN={}));const HN=[{label:"Group by service",value:jN.GroupByService},{label:"All transactions",value:jN.All}],WN=()=>{const i=v(),{openDrawer:n}=J$(),{formatDurationAgo:o}=qn(),{insightsApi:r}=Hh(),{data:s,loading:c,refetch:p}=r.useTransactions(),{data:u}=r.useGuardrails(),[h,g]=l(""),[m,b]=l(jN.GroupByService),[f,y]=l([]),[S,x]=l(null),[w,k]=l(null),[I,$]=l(!1),[N,A]=l(!1),[O,D]=l(null),[z,R]=l(null),[P,X]=l(null),L=d((e,t)=>{y(i=>t?i.includes(e)?i:[...i,e]:i.filter(t=>t!==e))},[]),_=a(()=>({selectedIds:f,toggleSelection:L}),[f,L]),M=a(()=>({onPromote:x,canPromote:!!r.promoteTransactionBaselines}),[r.promoteTransactionBaselines]),B=a(()=>({onDelete:k,canDelete:!!r.deleteTransaction}),[r.deleteTransaction]),V=a(()=>{const e=new Set;return u?.forEach(t=>{t.rules.some(e=>"allowed_transactions"===e.key&&e.mode===Ue.Enforce)&&e.add(t.scopeKey)}),e},[u]),U=a(()=>h?s?.filter(e=>{const t=h.toLowerCase();return e.id?.toLowerCase().includes(t)||e.namespace?.toLowerCase().includes(t)||e.service?.toLowerCase().includes(t)||e.kind?.toLowerCase().includes(t)||e.operationName?.toLowerCase().includes(t)||e.identityDimensions?.some(e=>e.key.toLowerCase().includes(t)||e.value.toLowerCase().includes(t))}):s,[s,h]),G=a(()=>PN(s),[s]),j=a(()=>{if(!f.length||!s?.length)return[];const e=new Set(f);return s.filter(t=>e.has(t.id)&&!t.promoted).map(e=>e.id)},[s,f]),Y=a(()=>{if(m===jN.GroupByService){const e=[];return U?.forEach(t=>{const i=e.find(e=>e.service===t.service);i?(i.transactions.push(t),i.volume+=t.volume):e.push({namespace:t.namespace,service:t.service,volume:t.volume,transactions:[t]})}),((e,i,n,a,o,l,r,s)=>a.map(a=>{const c=a.transactions.length,d=a.transactions.filter(e=>e.promoted).length,p=d===c,u=`${a.namespace}/${a.service}`,h=o?.has(u)??!1;return{id:u,cells:[{key:EN.Namespace,rawValue:a.namespace},{key:EN.Service,rawValue:a.service,component:()=>t(iN,{service:a.service,namespace:a.namespace})},{key:EN.Baseline,rawValue:p?"Promoted":"Learning",component:()=>t(E,p?{label:`${d}/${c} Promoted`,rightIcon:Lu,status:ie.Success,textSize:C.XXXS,tooltip:$N}:{label:`${d}/${c} Learning`,backgroundColor:e.v2.colors.beige[600],textColor:e.v2.colors.black[500],textSize:C.XXXS,tooltip:NN})},{key:EN.Guardrail,rawValue:h?"Enabled":"Disabled",component:()=>t(E,h?{label:"Enabled",leftIcon:Lu,status:ie.Success,invertColors:!0,textSize:C.XXXS}:{label:"Disabled",leftIcon:Xu,status:ie.Disabled,invertColors:!0,textSize:C.XXXS})},{key:EN.TransactionCount,rawValue:a.transactions.length.toLocaleString()},{key:EN.Volume,rawValue:a.volume.toLocaleString()}],expandedContent:({maxHeight:o})=>t(za,{fitContent:!0,variant:Ra.DataSecondary,maxHeight:o,columns:zN,rows:XN(e,i,a.transactions,void 0,l),getRowActions:e=>DN(e,n,r,s),withCheckboxes:!!l})}}))(i,o,n,e,V,_,M,B)}return XN(i,o,U,void 0,_)},[i,U,m,o,n,V,_,M,B]);return e(eN,{richTitle:{title:"Transactions",titleSize:C.M,icon:Pu,badge:{label:s?.length||0}},textCards:[{bgTint:"900",title:"Transactions",cells:[{value:G.total.toLocaleString()}]},{bgTint:"900",title:"Services",cells:[{value:G.services.toLocaleString()}]},{bgTint:"900",title:"Volume",cells:[{value:G.volume.toLocaleString()}]},{bgTint:"900",title:"Baseline Promoted",cells:[{value:((G.promoted||0)/(G.total||1)*100).toFixed(1)+"%"}]}],tableKey:m,tableColumns:m===jN.GroupByService?RN:zN,tableRows:Y,tableWithCheckboxes:m===jN.All,tableNoDataProps:{icon:Pu,title:h?"No matched transactions":"No transactions found",subTitle:h?`No transactions matched your search criteria: ${h}`:""},isLoading:c,actions:[{id:"refresh",type:St.Button,buttonProps:{label:"Refresh",leftIcon:Zu,variant:K.Secondary,size:W.S,disabled:c,onClick:()=>p()}}],getRowActions:e=>{if(m===jN.All)return DN(e,n,M,B);const t=e.cells.find(e=>e.key===EN.Namespace)?.rawValue,i=e.cells.find(e=>e.key===EN.Service)?.rawValue,a="Promoted"===e.cells.find(e=>e.key===EN.Baseline)?.rawValue,o=V.has(((e,t)=>`${e}/${t}`)(t,i)),l={namespace:t,service:i},s=[];return o?s.push({id:`${e.id}-disable-txn-guardrail`,label:"Disable transaction guardrail",leftIcon:Ah,variant:K.Secondary,disabled:!r.disableTransactionGuardrail,onClick:()=>X(l)}):s.push({id:`${e.id}-enable-txn-guardrail`,label:"Enable transaction guardrail",leftIcon:Ah,variant:K.Primary,disabled:!r.enableTransactionGuardrail,onClick:()=>R(l)}),s.push({id:`${e.id}-promote-service`,label:"Promote service",leftIcon:Ou,variant:K.Primary,disabled:a||!r.forcePromoteService,onClick:()=>D(l)}),s},children:[e(T,{$width:"100%",$gap:24,$justifyContent:"space-between",children:[e(T,{$gap:12,children:[t(nc,{title:"Transactions list",titleSize:C.S,badge:{label:U?.length||0}}),t(sa,{width:"400px",value:h,onChange:g}),t(F,{options:HN,selected:m,setSelected:b,size:Zt.L})]}),e(T,{$gap:12,children:[t(H,{label:"Delete selection",leftIcon:xu,variant:K.Secondary,disabled:!f.length||!r.bulkDeleteTransactions,onClick:()=>A(!0)}),t(H,{label:"Promote selection",leftIcon:Ou,variant:K.Primary,disabled:!j.length||!r.bulkPromoteTransactions,onClick:()=>$(!0)})]})]}),t(Ce,{isOpen:null!==S,onClose:()=>x(null),title:"Promote transaction",description:"Promote every scored baseline class on this transaction? Learning gates will be skipped and baselines will freeze.",approveButton:{label:"Promote now",onClick:()=>(async()=>{if(!S)return;const e=S;x(null),await(r.promoteTransactionBaselines?.(e))})()},denyButton:{label:"Cancel",onClick:()=>x(null),variant:K.Secondary}}),t(Ce,{isOpen:null!==w,onClose:()=>k(null),title:"Delete transaction",description:"Permanently delete this transaction and its related baselines, samples, issues, and transaction-scoped policies?",approveButton:{label:"Delete",onClick:()=>(async()=>{if(!w)return;const e=w;k(null),y(t=>t.filter(t=>t!==e)),await(r.deleteTransaction?.(e))})()},denyButton:{label:"Cancel",onClick:()=>k(null),variant:K.Secondary}}),t(Ce,{isOpen:I,onClose:()=>$(!1),title:`Promote selected transactions (${j.length})`,description:"Promote every scored baseline class on each selected transaction that is not already promoted? Learning gates will be skipped and baselines will freeze.",approveButton:{label:"Promote selection",onClick:()=>(async()=>{$(!1);const e=j;y([]),e.length&&await(r.bulkPromoteTransactions?.(e))})()},denyButton:{label:"Cancel",onClick:()=>$(!1),variant:K.Secondary}}),t(Ce,{isOpen:N,onClose:()=>A(!1),title:`Delete selected transactions (${f.length})`,description:"Permanently delete each selected transaction and its related baselines, samples, issues, and transaction-scoped policies?",approveButton:{label:"Delete selection",onClick:()=>(async()=>{A(!1);const e=f;y([]),await(r.bulkDeleteTransactions?.(e))})()},denyButton:{label:"Cancel",onClick:()=>A(!1),variant:K.Secondary}}),t(Ce,{isOpen:null!==O,onClose:()=>D(null),title:"Force promote service",description:`Promote every scored baseline class on every transaction of ${O?.service??"this service"}? This skips learning gates and may auto-enable the transaction guardrail.`,approveButton:{label:"Force promote",onClick:()=>(async()=>{if(!O)return;const e=O;D(null),await(r.forcePromoteService?.(e))})()},denyButton:{label:"Cancel",onClick:()=>D(null),variant:K.Secondary}}),t(Ce,{isOpen:null!==z,onClose:()=>R(null),title:"Enable transaction guardrail",description:`Create an allowed_transactions guardrail for ${z?.service??"this service"} from its current operations? New operations will become findings.`,approveButton:{label:"Enable",onClick:()=>(async()=>{if(!z)return;const e=z;R(null),await(r.enableTransactionGuardrail?.(e))})()},denyButton:{label:"Cancel",onClick:()=>R(null),variant:K.Secondary}}),t(Ce,{isOpen:null!==P,onClose:()=>X(null),title:"Disable transaction guardrail",description:`Disable the allowed_transactions guardrail for ${P?.service??"this service"}? New operations will no longer create findings until the guardrail is enabled again.`,approveButton:{label:"Disable",onClick:()=>(async()=>{if(!P)return;const e=P;X(null),await(r.disableTransactionGuardrail?.(e))})()},denyButton:{label:"Cancel",onClick:()=>X(null),variant:K.Secondary}})]})},KN=(e,t,i)=>({title:e,titleSize:C.S,subTitle:t,subTitleWrap:!0,subTitleSize:C.XXXS,textGap:4,icon:i}),YN=f.div`
|
|
2010
|
+
`,$N="Locked: this class is promoted - its baseline is frozen and no longer changes.",NN="Learning: progress toward the resolved stability targets. A full bar is not promotion - Locked is only when phase is promoted.",AN=({phase:e,readyToPromote:i})=>{const n=v();if(i)return t(E,{label:"Ready to promote",backgroundColor:n.v2.colors.green[800],textColor:n.v2.colors.green[300],textSize:C.XXXS});switch(e){case uc.Empty:case uc.Learning:return t(E,{label:"Learning",backgroundColor:n.v2.colors.beige[600],textColor:n.v2.colors.black[500],textSize:C.XXXS});case uc.Promoted:return t(E,{label:"Promoted",leftIcon:Lu,status:ie.Success,textSize:C.XXXS});default:return null}},ON=({learning:i})=>{const n=v();if(!i)return null;switch(i.phase){case uc.Empty:return t(ce,{text:"No data yet: this class has not grown a baseline structure. Stability does not apply until it learns something.",children:t(w,{size:C.XXXS,color:k.Secondary,children:"No baseline data yet"})});case uc.Promoted:return t(ce,{text:$N,children:t(w,{size:C.XXXS,color:k.Secondary,children:"Baseline locked"})});case uc.Learning:{const{observations:l,duration:r}=i.stability;return t(ce,{text:i.readyToPromote?"Ready to promote: the learning policy gate is already satisfied, but the engine has not graduated the class yet.":NN,children:e($,{$gap:4,children:[e(w,{size:C.XXXS,color:k.Primary,children:[l.current.toLocaleString()," / ",l.target.toLocaleString()," observations"]}),t(TN,{children:t(IN,{$pct:(a=l.current,o=l.target,o<=0?0:a/o*100),$color:n.v2.colors.blue[400]})}),t(w,{size:C.XXXS,color:k.Secondary,children:r.current<=0?"grew just now":`grew ${hc(r.current,{units:2,style:"long",suffix:!0})}`})]})})}default:return null}var a,o};var EN;(e=>{e.TransactionId="transactionId",e.LastSeen="lastSeen",e.Namespace="namespace",e.Service="service",e.Kind="kind",e.Operation="operation",e.Baseline="baseline",e.Guardrail="guardrail",e.Volume="volume",e.TransactionCount="transactionCount"})(EN||(EN={}));const DN=(e,t,i,n)=>{const a=e.cells.find(e=>e.key===EN.TransactionId)?.rawValue,o="Promoted"===e.cells.find(e=>e.key===EN.Baseline)?.rawValue,l=[{id:`${e.id}-open-baseline`,label:"View more",tooltip:"Open this transaction's details and baselines",rightIcon:Cu,variant:K.Primary,onClick:()=>t(H$.Transaction,a)}];return i&&l.push({id:`${e.id}-promote-baselines`,label:"Promote baselines",leftIcon:Ou,variant:K.Secondary,disabled:o||!i.canPromote,onClick:()=>i.onPromote(a)}),n&&l.push({id:`${e.id}-delete`,label:"Delete",leftIcon:xu,variant:K.Secondary,disabled:!n.canDelete,onClick:()=>n.onDelete(a)}),l},zN=[{label:"Namespace",key:EN.Namespace},{label:"Service",key:EN.Service,noFilter:!0},{label:"Operation",key:EN.Operation,noFilter:!0},{label:"Kind",key:EN.Kind},{label:"Volume",key:EN.Volume,noFilter:!0},{label:"Baseline",key:EN.Baseline},{label:"Last seen",key:EN.LastSeen,noFilter:!0}],RN=[{label:"Namespace",key:EN.Namespace},{label:"Service",key:EN.Service,noFilter:!0},{label:"Baseline",key:EN.Baseline},{label:"Auto guardrail",key:EN.Guardrail,tooltip:"Once every transaction on a service is promoted, Odigos enforces only the transaction identities already learned - new ones are flagged."},{label:"Transactions",key:EN.TransactionCount,noFilter:!0},{label:"Volume",key:EN.Volume,noFilter:!0}],PN=e=>({total:e?.length||0,services:Array.from(new Set(e?.map(e=>e.service))).length,volume:e?.reduce((e,t)=>e+Number(t.volume),0)||0,promoted:e?.filter(e=>e.promoted).length||0,learning:e?.filter(e=>!e.promoted).length||0}),XN=(e,i,n,a,o)=>n?.slice(0,a||n.length).map(n=>({id:n.id,isSelected:o?o.selectedIds.includes(n.id):void 0,onSelect:o?()=>o.toggleSelection(n.id,!0):void 0,onDeselect:o?()=>o.toggleSelection(n.id,!1):void 0,cells:[{key:EN.TransactionId,rawValue:n.id},{key:EN.LastSeen,rawValue:i(n.lastSeen,{style:"short"})},{key:EN.Namespace,rawValue:n.namespace},{key:EN.Service,rawValue:n.service,component:()=>t(iN,{service:n.service,namespace:n.namespace})},{key:EN.Kind,rawValue:n.kind,component:()=>t(E,{label:n.kind,backgroundColor:e.v2.colors.blue[900]})},{key:EN.Operation,rawValue:Ag(n),component:()=>t(Ng,{operationName:n.operationName,identityDimensions:n.identityDimensions})},{key:EN.Baseline,rawValue:n.promoted?"Promoted":"Learning",component:()=>n.promoted?t(E,{label:"Promoted",leftIcon:Lu,status:ie.Success,textSize:C.XXXS,tooltip:$N}):t(E,{label:"Learning",backgroundColor:e.v2.colors.beige[600],textColor:e.v2.colors.black[500],textSize:C.XXXS,tooltip:NN})},{key:EN.Volume,rawValue:Number(n.volume).toLocaleString()}]}))||[],LN=({setSelectedTab:i})=>{const n=v(),{openDrawer:o}=J$(),{formatDurationAgo:r}=qn(),{insightsApi:s}=Hh(),[c,d]=l(gc),[p,u]=l(gc),{data:h,loading:g,refetch:m}=s.useFindings({windowHours:c}),{data:b,loading:f,refetch:y}=s.useTransactions({windowHours:p}),S=a(()=>(e=>e?.filter(hN)??[])(h),[h]),x=a(()=>gN(h),[h]),k=a(()=>yN(n,r,S,5),[S,n,r]),I=a(()=>PN(b),[b]),N=a(()=>XN(n,r,b,5),[b,n,r]);return e($,{children:[e(T,{$padding:"12px 0",$justifyContent:"space-between",children:[t(w,{size:C.M,children:"Runtime Trace Security (Insights)"}),t(H,{variant:K.Text,size:W.S,leftIcon:Zu,label:"Refresh",onClick:()=>{m(),y()},disabled:g||f})]}),e($,{$gap:24,children:[t(eN,{tableMaxHeight:"380px",richTitle:{title:"Top 5 Open Findings",titleSize:C.M,icon:Nh,badge:{label:S.length}},textCards:[{bgTint:"900",title:"Open findings",cells:[{value:x.open.toLocaleString()}]},{bgTint:"900",title:"Critical / High",cells:[{value:(x.critical+x.high).toLocaleString()}]},{bgTint:"900",title:"Policy violations",cells:[{value:x.violations.toLocaleString()}]},{bgTint:"900",title:"Anomalies",cells:[{value:x.anomalies.toLocaleString()}]}],tableColumns:dN,tableRows:k,tableNoDataProps:{icon:Nh,title:"No findings found",subTitle:""},isLoading:g,actions:[{id:"search-by-time",type:St.PopupButton,buttonProps:bc(c),popupProps:{children:({close:e})=>t(mc,{defaultValue:c,onApply:d,onClose:e})}},{id:"view-all",type:St.Button,buttonProps:{label:"View all",rightIcon:Cu,variant:K.Secondary,size:W.S,onClick:()=>i(j$.Findings)}}],getRowActions:e=>cN(e,o)}),t(eN,{tableMaxHeight:"380px",richTitle:{title:"Top 5 Transactions",titleSize:C.M,icon:Pu,badge:{label:b?.length||0}},textCards:[{bgTint:"900",title:"Transactions",cells:[{value:I.total.toLocaleString()}]},{bgTint:"900",title:"Services",cells:[{value:I.services.toLocaleString()}]},{bgTint:"900",title:"Volume",cells:[{value:I.volume.toLocaleString()}]},{bgTint:"900",title:"Baselines promoted",tooltip:'Share of learned baseline classes that have finished the learning phase (graduated), and are now enforced for anomaly detection. The rest are still learning what "normal" looks like.',cells:[{value:((I.promoted||0)/(I.total||1)*100).toFixed(1)+"%"}]}],tableColumns:zN,tableRows:N,tableNoDataProps:{icon:Pu,title:"No transactions found",subTitle:""},isLoading:f,actions:[{id:"search-by-time",type:St.PopupButton,buttonProps:bc(p),popupProps:{children:({close:e})=>t(mc,{defaultValue:p,onApply:u,onClose:e})}},{id:"view-all",type:St.Button,buttonProps:{label:"View all",rightIcon:Cu,variant:K.Secondary,size:W.S,onClick:()=>i(j$.Transactions)}}],getRowActions:e=>DN(e,o)})]})]})},_N={[rN.Dismiss]:{label:"Dismiss",title:e=>`Dismiss selected findings (${e})`,description:"Are you sure you want to dismiss the selected findings?"},[rN.Accept]:{label:"Accept",title:e=>`Accept selected findings (${e})`,description:"Are you sure you want to accept the selected findings?"}},MN=({actionType:i,selectedFindings:n,onDone:o,buttonProps:s})=>{const[c,d]=l(!1),[p,u]=l(!1),h=()=>u(!1),{insightsApi:g}=Hh(),m=_N[i],b=a(()=>{return!n.length||(t=i,(e=n).length>0&&e.every(e=>((e,t)=>sN[t].includes(e.status))(e,t)));var e,t},[n,i]);return e(r,{children:[t(H,{label:m.label,variant:K.Secondary,onClick:()=>u(!0),disabled:b,loading:c,...s}),t(Ce,{isOpen:p,onClose:h,title:m.title(n.length),description:m.description,denyButton:{label:"Cancel",variant:K.Secondary,onClick:h,loading:c},approveButton:{label:m.label,variant:K.Primary,disabled:!n.length,onClick:async()=>{d(!0),await(async(e,t,i)=>{const n=t.filter(e=>e.kind===cc.Anomaly&&e.transactionId&&e.signature),a=t.filter(e=>e.kind===cc.Violation),o=[],l=i===rN.Accept;if(n.length){const t=n.map(e=>({transactionId:e.transactionId,signature:e.signature}));if(e.bulkResolveAnomalies)o.push(e.bulkResolveAnomalies(l?dc.Accept:dc.Dismiss,t));else{const i=l?pc.Accept:pc.Dismiss;o.push(...t.map(t=>e.resolveAnomaly?.({...t,resolution:i})))}}if(a.length){const t=l?e.acceptViolation:e.dismissViolation;o.push(...a.map(e=>t?.({scopeKey:e.scopeKey||"",ruleKey:e.ruleKey||"",offending:e.offending||""})))}await Promise.all(o.filter(Boolean))})(g,n,i),d(!1),u(!1),o?.()},loading:c}})]})};var FN;(e=>{e.All="all",e.GroupByService="groupByService",e.GroupByTime="groupByTime"})(FN||(FN={}));const BN=[{label:"All findings",value:FN.All},{label:"Group by service",value:FN.GroupByService},{label:"Related findings",value:FN.GroupByTime}];var VN;(e=>{e.Open="open",e.Dismissed="dismissed",e.Accepted="accepted"})(VN||(VN={}));const UN=[{label:"Open",value:VN.Open},{label:"Dismissed",value:VN.Dismissed},{label:"Accepted",value:VN.Accepted}],GN=()=>{const i=v(),{openDrawer:n}=J$(),{formatDurationAgo:o}=qn(),{insightsApi:r}=Hh(),[s,c]=l(gc),{data:p,loading:u,refetch:h}=r.useFindings({windowHours:s}),[g,m]=l([]),b=d((e,t)=>{m(i=>t?-1===i.findIndex(t=>lN(t,e))?[...i,e]:i:i.filter(t=>!lN(t,e)))},[]),[f,y]=l(""),[S,x]=l(FN.All),[I,$]=l(VN.Open),{openFindings:A,dismissedFindings:O,acceptedFindings:D}=a(()=>{const e=[],t=[],i=[];return p?.forEach(n=>{hN(n)&&e.push(n),[rc.Dismissed,sc.Dismissed].includes(n.status)&&t.push(n),[rc.Accepted,sc.Accepted].includes(n.status)&&i.push(n)}),{openFindings:e,dismissedFindings:t,acceptedFindings:i}},[p]),z=a(()=>I===VN.Open?A:I===VN.Dismissed?O:I===VN.Accepted?D:[],[I,A,O,D]),R=a(()=>f?z?.filter(e=>{const t=f.toLowerCase();return e.namespace?.toLowerCase().includes(t)||e.service?.toLowerCase().includes(t)||e.kind?.toLowerCase().includes(t)||e.title.toLowerCase().includes(t)||e.operationName?.toLowerCase().includes(t)||e.identityDimensions?.some(e=>e.key.toLowerCase().includes(t)||e.value.toLowerCase().includes(t))}):z,[z,f]),P=a(()=>gN(z),[z]),X=a(()=>{if(S===FN.GroupByService){const e=[];return R?.forEach(t=>{const i=e.find(e=>e.service===t.service);i?(i.findings.push(t),i.occurrences+=t.occurrences,new Date(i.lastSeen)<new Date(t.lastSeen)&&(i.lastSeen=t.lastSeen)):e.push({service:t.service,namespace:t.namespace,occurrences:t.occurrences,lastSeen:t.lastSeen,findings:[t]})}),((e,i,n,a,o,l)=>a.map(a=>({id:`${a.namespace}/${a.service}`,cells:[{key:nN.Namespace,rawValue:a.namespace},{key:nN.Service,rawValue:a.service,component:()=>t(iN,{service:a.service,namespace:a.namespace})},{key:nN.Occurrences,rawValue:Number(a.occurrences).toLocaleString()},{key:nN.LastSeen,rawValue:new Date(a.lastSeen).toLocaleString()}],expandedContent:({maxHeight:r})=>t(za,{fitContent:!0,variant:Ra.DataSecondary,maxHeight:r,columns:dN,rows:yN(e,i,a.findings,void 0,o,l),getRowActions:e=>cN(e,n),withCheckboxes:!0})})))(i,o,n,e,g,b)}if(S===FN.GroupByTime){const a=(e=>{const t=[...e].sort((e,t)=>new Date(aN(e)).getTime()-new Date(aN(t)).getTime()),i=[];return t.forEach(e=>{const t=aN(e),n=new Date(t).getTime(),a=i[i.length-1];!a||n-new Date(a.endTime).getTime()>3e4?i.push({startTime:t,endTime:t,occurrences:e.occurrences,findings:[e]}):(a.findings.push(e),a.occurrences+=e.occurrences,a.endTime=t)}),i.reverse()})(R??[]);return((i,n,a,o,l,r)=>[...o].sort((e,t)=>fN[vN(t.findings)]-fN[vN(e.findings)]).map((o,s)=>({id:`time-${s}-${o.startTime}-${o.endTime}`,cells:[{key:nN.Title,rawValue:wN(o,n),component:()=>{const a=o.findings.length,l=vN(o.findings),r=[...new Set(o.findings.map(e=>e.service))],s=1===r.length?"service":"services",c=SN(o,n),d=xN(o);return e(T,{$gap:6,$alignItems:"center",$wrap:"nowrap",children:[t(w,{size:C.XS,color:k.Secondary,nowrap:!0,children:c}),t(w,{size:C.XS,color:k.Primary,weight:600,nowrap:!0,children:a}),e(w,{size:C.XS,color:k.Secondary,nowrap:!0,children:[a>1?"possibly related ":"","suspicious ",1===a?"finding":"findings",a>1?" up to":""]}),t(E,{...mN(i,l)}),e(w,{size:C.XS,color:k.Secondary,nowrap:!0,children:["found in ",s]}),t(w,{size:C.XS,color:k.Primary,weight:600,nowrap:!0,children:r.join(", ")}),t(w,{size:C.XS,color:k.Secondary,nowrap:!0,children:d})]})}}],expandedContent:({maxHeight:e})=>t(za,{fitContent:!0,variant:Ra.DataSecondary,maxHeight:e,columns:dN,rows:yN(i,n,o.findings,void 0,l,r),getRowActions:e=>cN(e,a),withCheckboxes:!0})})))(i,o,n,a,g,b)}return yN(i,o,R,void 0,g,b)},[i,R,S,o,n,g,b]);return t(eN,{richTitle:{title:"Findings",titleSize:C.M,icon:Nh,badge:{label:z?.length||0},children:t(N,{$padding:"0 0 0 32px",children:t(F,{options:UN,selected:I,setSelected:$,size:Zt.L})})},textCards:[{bgTint:"900",title:(I===VN.Open?"Open":I===VN.Dismissed?"Dismissed":"Accepted")+" findings",cells:[{value:P.open.toLocaleString()}]},{bgTint:"900",title:"Critical / High",cells:[{value:(P.critical+P.high).toLocaleString()}]},{bgTint:"900",title:"Policy violations",cells:[{value:P.violations.toLocaleString()}]},{bgTint:"900",title:"Anomalies",cells:[{value:P.anomalies.toLocaleString()}]}],tableKey:S,tableColumns:S===FN.GroupByService?pN:S===FN.GroupByTime?uN:dN,tableRows:X,tableWithCheckboxes:S===FN.All,tableNoDataProps:{icon:Nh,title:f?"No matched findings":"No findings found",subTitle:f?`No findings matched your search criteria: ${f}`:""},isLoading:u,actions:[{id:"search-by-time",type:St.PopupButton,buttonProps:bc(s),popupProps:{children:({close:e})=>t(mc,{defaultValue:s,onApply:c,onClose:e})}},{id:"refresh",type:St.Button,buttonProps:{label:"Refresh",leftIcon:Zu,variant:K.Secondary,size:W.S,disabled:u,onClick:()=>h()}}],getRowActions:S===FN.All?e=>cN(e,n):void 0,children:e(T,{$width:"100%",$gap:24,$justifyContent:"space-between",children:[e(T,{$gap:12,children:[t(nc,{title:"Findings list",titleSize:C.S,badge:{label:R?.length||0}}),t(sa,{width:"400px",value:f,onChange:y}),t(F,{options:BN,selected:S,setSelected:x,size:Zt.L})]}),e(T,{$gap:12,children:[t(MN,{actionType:rN.Dismiss,selectedFindings:g,onDone:()=>{m([]),h()},buttonProps:{label:"Dismiss selection"}}),t(MN,{actionType:rN.Accept,selectedFindings:g,onDone:()=>{m([]),h()},buttonProps:{label:"Accept selection",variant:K.Primary}})]})]})})};var jN;(e=>{e.All="all",e.GroupByService="groupByService"})(jN||(jN={}));const HN=[{label:"Group by service",value:jN.GroupByService},{label:"All transactions",value:jN.All}],WN=()=>{const i=v(),{openDrawer:n}=J$(),{formatDurationAgo:o}=qn(),{insightsApi:r}=Hh(),[s,c]=l(""),[p,u]=l(gc),{data:h,loading:g,refetch:m}=r.useTransactions({windowHours:p}),{data:b}=r.useGuardrails(),[f,y]=l(jN.GroupByService),[S,x]=l([]),[w,k]=l(null),[I,$]=l(null),[N,A]=l(!1),[O,D]=l(!1),[z,R]=l(null),[P,X]=l(null),[L,_]=l(null),M=d((e,t)=>{x(i=>t?i.includes(e)?i:[...i,e]:i.filter(t=>t!==e))},[]),B=a(()=>({selectedIds:S,toggleSelection:M}),[S,M]),V=a(()=>({onPromote:k,canPromote:!!r.promoteTransactionBaselines}),[r.promoteTransactionBaselines]),U=a(()=>({onDelete:$,canDelete:!!r.deleteTransaction}),[r.deleteTransaction]),G=a(()=>{const e=new Set;return b?.forEach(t=>{t.rules.some(e=>"allowed_transactions"===e.key&&e.mode===Ue.Enforce)&&e.add(t.scopeKey)}),e},[b]),j=a(()=>s?h?.filter(e=>{const t=s.toLowerCase();return e.id?.toLowerCase().includes(t)||e.namespace?.toLowerCase().includes(t)||e.service?.toLowerCase().includes(t)||e.kind?.toLowerCase().includes(t)||e.operationName?.toLowerCase().includes(t)||e.identityDimensions?.some(e=>e.key.toLowerCase().includes(t)||e.value.toLowerCase().includes(t))}):h,[h,s]),Y=a(()=>PN(h),[h]),J=a(()=>{if(!S.length||!h?.length)return[];const e=new Set(S);return h.filter(t=>e.has(t.id)&&!t.promoted).map(e=>e.id)},[h,S]),q=a(()=>{if(f===jN.GroupByService){const e=[];return j?.forEach(t=>{const i=e.find(e=>e.service===t.service);i?(i.transactions.push(t),i.volume+=t.volume):e.push({namespace:t.namespace,service:t.service,volume:t.volume,transactions:[t]})}),((e,i,n,a,o,l,r,s)=>a.map(a=>{const c=a.transactions.length,d=a.transactions.filter(e=>e.promoted).length,p=d===c,u=`${a.namespace}/${a.service}`,h=o?.has(u)??!1;return{id:u,cells:[{key:EN.Namespace,rawValue:a.namespace},{key:EN.Service,rawValue:a.service,component:()=>t(iN,{service:a.service,namespace:a.namespace})},{key:EN.Baseline,rawValue:p?"Promoted":"Learning",component:()=>t(E,p?{label:`${d}/${c} Promoted`,rightIcon:Lu,status:ie.Success,textSize:C.XXXS,tooltip:$N}:{label:`${d}/${c} Learning`,backgroundColor:e.v2.colors.beige[600],textColor:e.v2.colors.black[500],textSize:C.XXXS,tooltip:NN})},{key:EN.Guardrail,rawValue:h?"Enabled":"Disabled",component:()=>t(E,h?{label:"Enabled",leftIcon:Lu,status:ie.Success,invertColors:!0,textSize:C.XXXS}:{label:"Disabled",leftIcon:Xu,status:ie.Disabled,invertColors:!0,textSize:C.XXXS})},{key:EN.TransactionCount,rawValue:a.transactions.length.toLocaleString()},{key:EN.Volume,rawValue:a.volume.toLocaleString()}],expandedContent:({maxHeight:o})=>t(za,{fitContent:!0,variant:Ra.DataSecondary,maxHeight:o,columns:zN,rows:XN(e,i,a.transactions,void 0,l),getRowActions:e=>DN(e,n,r,s),withCheckboxes:!!l})}}))(i,o,n,e,G,B,V,U)}return XN(i,o,j,void 0,B)},[i,j,f,o,n,G,B,V,U]);return e(eN,{richTitle:{title:"Transactions",titleSize:C.M,icon:Pu,badge:{label:h?.length||0}},textCards:[{bgTint:"900",title:"Transactions",cells:[{value:Y.total.toLocaleString()}]},{bgTint:"900",title:"Services",cells:[{value:Y.services.toLocaleString()}]},{bgTint:"900",title:"Volume",cells:[{value:Y.volume.toLocaleString()}]},{bgTint:"900",title:"Baseline Promoted",cells:[{value:((Y.promoted||0)/(Y.total||1)*100).toFixed(1)+"%"}]}],tableKey:f,tableColumns:f===jN.GroupByService?RN:zN,tableRows:q,tableWithCheckboxes:f===jN.All,tableNoDataProps:{icon:Pu,title:s?"No matched transactions":"No transactions found",subTitle:s?`No transactions matched your search criteria: ${s}`:""},isLoading:g,actions:[{id:"search-by-time",type:St.PopupButton,buttonProps:bc(p),popupProps:{children:({close:e})=>t(mc,{defaultValue:p,onApply:u,onClose:e})}},{id:"refresh",type:St.Button,buttonProps:{label:"Refresh",leftIcon:Zu,variant:K.Secondary,size:W.S,disabled:g,onClick:()=>m()}}],getRowActions:e=>{if(f===jN.All)return DN(e,n,V,U);const t=e.cells.find(e=>e.key===EN.Namespace)?.rawValue,i=e.cells.find(e=>e.key===EN.Service)?.rawValue,a="Promoted"===e.cells.find(e=>e.key===EN.Baseline)?.rawValue,o=G.has(((e,t)=>`${e}/${t}`)(t,i)),l={namespace:t,service:i},s=[];return o?s.push({id:`${e.id}-disable-txn-guardrail`,label:"Disable transaction guardrail",leftIcon:Ah,variant:K.Secondary,disabled:!r.disableTransactionGuardrail,onClick:()=>_(l)}):s.push({id:`${e.id}-enable-txn-guardrail`,label:"Enable transaction guardrail",leftIcon:Ah,variant:K.Primary,disabled:!r.enableTransactionGuardrail,onClick:()=>X(l)}),s.push({id:`${e.id}-promote-service`,label:"Promote service",leftIcon:Ou,variant:K.Primary,disabled:a||!r.forcePromoteService,onClick:()=>R(l)}),s},children:[e(T,{$width:"100%",$gap:24,$justifyContent:"space-between",children:[e(T,{$gap:12,children:[t(nc,{title:"Transactions list",titleSize:C.S,badge:{label:j?.length||0}}),t(sa,{width:"400px",value:s,onChange:c}),t(F,{options:HN,selected:f,setSelected:y,size:Zt.L})]}),e(T,{$gap:12,children:[t(H,{label:"Delete selection",leftIcon:xu,variant:K.Secondary,disabled:!S.length||!r.bulkDeleteTransactions,onClick:()=>D(!0)}),t(H,{label:"Promote selection",leftIcon:Ou,variant:K.Primary,disabled:!J.length||!r.bulkPromoteTransactions,onClick:()=>A(!0)})]})]}),t(Ce,{isOpen:null!==w,onClose:()=>k(null),title:"Promote transaction",description:"Promote every scored baseline class on this transaction? Learning gates will be skipped and baselines will freeze.",approveButton:{label:"Promote now",onClick:()=>(async()=>{if(!w)return;const e=w;k(null),await(r.promoteTransactionBaselines?.(e))})()},denyButton:{label:"Cancel",onClick:()=>k(null),variant:K.Secondary}}),t(Ce,{isOpen:null!==I,onClose:()=>$(null),title:"Delete transaction",description:"Permanently delete this transaction and its related baselines, samples, issues, and transaction-scoped policies?",approveButton:{label:"Delete",onClick:()=>(async()=>{if(!I)return;const e=I;$(null),x(t=>t.filter(t=>t!==e)),await(r.deleteTransaction?.(e))})()},denyButton:{label:"Cancel",onClick:()=>$(null),variant:K.Secondary}}),t(Ce,{isOpen:N,onClose:()=>A(!1),title:`Promote selected transactions (${J.length})`,description:"Promote every scored baseline class on each selected transaction that is not already promoted? Learning gates will be skipped and baselines will freeze.",approveButton:{label:"Promote selection",onClick:()=>(async()=>{A(!1);const e=J;x([]),e.length&&await(r.bulkPromoteTransactions?.(e))})()},denyButton:{label:"Cancel",onClick:()=>A(!1),variant:K.Secondary}}),t(Ce,{isOpen:O,onClose:()=>D(!1),title:`Delete selected transactions (${S.length})`,description:"Permanently delete each selected transaction and its related baselines, samples, issues, and transaction-scoped policies?",approveButton:{label:"Delete selection",onClick:()=>(async()=>{D(!1);const e=S;x([]),await(r.bulkDeleteTransactions?.(e))})()},denyButton:{label:"Cancel",onClick:()=>D(!1),variant:K.Secondary}}),t(Ce,{isOpen:null!==z,onClose:()=>R(null),title:"Force promote service",description:`Promote every scored baseline class on every transaction of ${z?.service??"this service"}? This skips learning gates and may auto-enable the transaction guardrail.`,approveButton:{label:"Force promote",onClick:()=>(async()=>{if(!z)return;const e=z;R(null),await(r.forcePromoteService?.(e))})()},denyButton:{label:"Cancel",onClick:()=>R(null),variant:K.Secondary}}),t(Ce,{isOpen:null!==P,onClose:()=>X(null),title:"Enable transaction guardrail",description:`Create an allowed_transactions guardrail for ${P?.service??"this service"} from its current operations? New operations will become findings.`,approveButton:{label:"Enable",onClick:()=>(async()=>{if(!P)return;const e=P;X(null),await(r.enableTransactionGuardrail?.(e))})()},denyButton:{label:"Cancel",onClick:()=>X(null),variant:K.Secondary}}),t(Ce,{isOpen:null!==L,onClose:()=>_(null),title:"Disable transaction guardrail",description:`Disable the allowed_transactions guardrail for ${L?.service??"this service"}? New operations will no longer create findings until the guardrail is enabled again.`,approveButton:{label:"Disable",onClick:()=>(async()=>{if(!L)return;const e=L;_(null),await(r.disableTransactionGuardrail?.(e))})()},denyButton:{label:"Cancel",onClick:()=>_(null),variant:K.Secondary}})]})},KN=(e,t,i)=>({title:e,titleSize:C.S,subTitle:t,subTitleWrap:!0,subTitleSize:C.XXXS,textGap:4,icon:i}),YN=f.div`
|
|
2011
2011
|
display: flex;
|
|
2012
2012
|
flex-direction: column;
|
|
2013
2013
|
gap: 8px;
|
|
@@ -2015,32 +2015,32 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2015
2015
|
border-radius: 12px;
|
|
2016
2016
|
border-left: 2px solid ${({theme:e})=>e.v2.colors.red[500]};
|
|
2017
2017
|
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
2018
|
-
`,JN=({classFindings:i})=>{const n=v();return i?.length?t(r,{children:i?.map((i,a)=>e(YN,{children:[e(T,{$gap:8,children:[t(w,{size:C.XS,color:k.Primary,children:i.title}),t(E,{label:i.class,status:ie.Info,invertColors:!0}),t(E,{label:i.kind,status:ie.Info,invertColors:!0})]}),t(w,{size:C.XXS,color:n.v2.colors.red[400],children:i.summary||"-"}),i.spanHighlights?t($,{children:i.spanHighlights?.map((t,i)=>e(w,{size:C.XXXS,color:k.Secondary,children:["• ",t.reason," - ",t.spanId]},`span-highlight--${i}`))}):null,i.attrHighlights?t($,{children:i.attrHighlights?.map((t,i)=>e(w,{size:C.XXXS,color:k.Secondary,children:["• ",t.value," - ",t.key," - ",t.spanId]},`attribute-highlight--${i}`))}):null]},`${i.class}-${a}`))}):null},qN=["server.address","net.peer.name","net.host.name","http.host","url.full","http.url","db.system","db.name"],ZN=(e,t)=>e.attrs?.find(e=>e?.key===t)?.value??"",QN=e=>{for(const t of qN){const i=ZN(e,t);if(i)return i}return""},eA=e=>`${e.depth??0}::${e.name??""}::${QN(e)}`,tA=(e,t)=>{const i=QN(e),n=QN(t);return!(!i||!n||i===n)||(e.name??"")!==(t.name??"")},iA=e=>null==e||Number.isNaN(e)?null:fc(1e6*Math.max(0,e)),nA=e=>(e.attrs??[]).filter(e=>!!e?.key).map(e=>({key:e.key??null,value:e.value??null})),aA=()=>({placeholder:!0}),oA=(e,t,i,n)=>({id:t,index:i,service:e.service??null,name:e.name??null,durationLabel:iA(e.durationMs),depth:e.depth??0,scope:e.scope??null,attributes:nA(e),variant:"default",...n}),lA=(e,t)=>{const i=e?.spans??[],n=t?.spans??[],a=e?.error||t?.error||null;if(!i.length&&!n.length)return{baselineRows:[],observedRows:[],newSpanCount:0,timingChangeCount:0,observedDurationLabel:null,error:a};const o=((e,t)=>{const i=e.length,n=t.length,a=Array.from({length:i+1},()=>Array(n+1).fill(0));for(let o=i-1;o>=0;o--)for(let i=n-1;i>=0;i--)eA(e[o])===eA(t[i])?a[o][i]=1+(a[o+1][i+1]??0):a[o][i]=Math.max(a[o+1][i]??0,a[o][i+1]??0);const o=[];let l=0,r=0;for(;l<i&&r<n;)eA(e[l])===eA(t[r])?(o.push({baselineIdx:l,observedIdx:r}),l+=1,r+=1):(a[l+1][r]??0)>=(a[l][r+1]??0)?(o.push({baselineIdx:l,observedIdx:null}),l+=1):(o.push({baselineIdx:null,observedIdx:r}),r+=1);for(;l<i;)o.push({baselineIdx:l,observedIdx:null}),l+=1;for(;r<n;)o.push({baselineIdx:null,observedIdx:r}),r+=1;return o})(i,n),l=[],r=[];let s=0,c=0,d=0,p=0,u=0;const h=(e,t)=>{const[i,n]=((e,t)=>{const[i,n]=((e,t)=>{const i=e.filter(e=>!!e.key),n=t.filter(e=>!!e.key),a=i.length,o=n.length,l=Array.from({length:a+1},()=>Array(o+1).fill(0));for(let e=a-1;e>=0;e--)for(let t=o-1;t>=0;t--)i[e].key===n[t].key?l[e][t]=1+(l[e+1][t+1]??0):l[e][t]=Math.max(l[e+1][t]??0,l[e][t+1]??0);const r=[],s=[];let c=0,d=0;for(;c<a&&d<o;)i[c].key===n[d].key?(r.push(i[c]),s.push(n[d]),c+=1,d+=1):(l[c+1][d]??0)>=(l[c][d+1]??0)?(r.push(i[c]),s.push(aA()),c+=1):(r.push(aA()),s.push(n[d]),d+=1);for(;c<a;)r.push(i[c]),s.push(aA()),c+=1;for(;d<o;)r.push(aA()),s.push(n[d]),d+=1;return[r,s]})(e.attributes??[],t.attributes??[]),a=e.scope??null,o=t.scope??null,l=!!a,r=!!o;return[{...e,scope:l?a:null,scopePlaceholder:!l&&r,attributes:i},{...t,scope:r?o:null,scopePlaceholder:!r&&l,attributes:n}]})(e,t);l.push(i),r.push(n)};for(const e of o){const t=null!=e.baselineIdx?i[e.baselineIdx]:void 0,a=null!=e.observedIdx?n[e.observedIdx]:void 0;if(t&&a){if(tA(t,a)){s+=1,
|
|
2018
|
+
`,JN=({classFindings:i})=>{const n=v();return i?.length?t(r,{children:i?.map((i,a)=>e(YN,{children:[e(T,{$gap:8,children:[t(w,{size:C.XS,color:k.Primary,children:i.title}),t(E,{label:i.class,status:ie.Info,invertColors:!0}),t(E,{label:i.kind,status:ie.Info,invertColors:!0})]}),t(w,{size:C.XXS,color:n.v2.colors.red[400],children:i.summary||"-"}),i.spanHighlights?t($,{children:i.spanHighlights?.map((t,i)=>e(w,{size:C.XXXS,color:k.Secondary,children:["• ",t.reason," - ",t.spanId]},`span-highlight--${i}`))}):null,i.attrHighlights?t($,{children:i.attrHighlights?.map((t,i)=>e(w,{size:C.XXXS,color:k.Secondary,children:["• ",t.value," - ",t.key," - ",t.spanId]},`attribute-highlight--${i}`))}):null]},`${i.class}-${a}`))}):null},qN=["server.address","net.peer.name","net.host.name","http.host","url.full","http.url","db.system","db.name"],ZN=(e,t)=>e.attrs?.find(e=>e?.key===t)?.value??"",QN=e=>{for(const t of qN){const i=ZN(e,t);if(i)return i}return""},eA=e=>`${e.depth??0}::${e.name??""}::${QN(e)}`,tA=(e,t)=>{const i=QN(e),n=QN(t);return!(!i||!n||i===n)||(e.name??"")!==(t.name??"")},iA=e=>null==e||Number.isNaN(e)?null:fc(1e6*Math.max(0,e)),nA=e=>(e.attrs??[]).filter(e=>!!e?.key).map(e=>({key:e.key??null,value:e.value??null})),aA=()=>({placeholder:!0}),oA=(e,t,i,n)=>({id:t,index:i,service:e.service??null,name:e.name??null,durationLabel:iA(e.durationMs),depth:e.depth??0,scope:e.scope??null,attributes:nA(e),variant:"default",...n}),lA=(e,t)=>{const i=e?.spans??[],n=t?.spans??[],a=e?.error||t?.error||null;if(!i.length&&!n.length)return{baselineRows:[],observedRows:[],newSpanCount:0,timingChangeCount:0,observedDurationLabel:null,error:a};const o=((e,t)=>{const i=e.length,n=t.length,a=Array.from({length:i+1},()=>Array(n+1).fill(0));for(let o=i-1;o>=0;o--)for(let i=n-1;i>=0;i--)eA(e[o])===eA(t[i])?a[o][i]=1+(a[o+1][i+1]??0):a[o][i]=Math.max(a[o+1][i]??0,a[o][i+1]??0);const o=[];let l=0,r=0;for(;l<i&&r<n;)eA(e[l])===eA(t[r])?(o.push({baselineIdx:l,observedIdx:r}),l+=1,r+=1):(a[l+1][r]??0)>=(a[l][r+1]??0)?(o.push({baselineIdx:l,observedIdx:null}),l+=1):(o.push({baselineIdx:null,observedIdx:r}),r+=1);for(;l<i;)o.push({baselineIdx:l,observedIdx:null}),l+=1;for(;r<n;)o.push({baselineIdx:null,observedIdx:r}),r+=1;return o})(i,n),l=[],r=[];let s=0,c=0,d=0,p=0,u=0;const h=(e,t)=>{const[i,n]=((e,t)=>{const[i,n]=((e,t)=>{const i=e.filter(e=>!!e.key),n=t.filter(e=>!!e.key),a=i.length,o=n.length,l=Array.from({length:a+1},()=>Array(o+1).fill(0));for(let e=a-1;e>=0;e--)for(let t=o-1;t>=0;t--)i[e].key===n[t].key?l[e][t]=1+(l[e+1][t+1]??0):l[e][t]=Math.max(l[e+1][t]??0,l[e][t+1]??0);const r=[],s=[];let c=0,d=0;for(;c<a&&d<o;)i[c].key===n[d].key?(r.push(i[c]),s.push(n[d]),c+=1,d+=1):(l[c+1][d]??0)>=(l[c][d+1]??0)?(r.push(i[c]),s.push(aA()),c+=1):(r.push(aA()),s.push(n[d]),d+=1);for(;c<a;)r.push(i[c]),s.push(aA()),c+=1;for(;d<o;)r.push(aA()),s.push(n[d]),d+=1;return[r,s]})(e.attributes??[],t.attributes??[]),a=e.scope??null,o=t.scope??null,l=!!a,r=!!o;return[{...e,scope:l?a:null,scopePlaceholder:!l&&r,attributes:i},{...t,scope:r?o:null,scopePlaceholder:!r&&l,attributes:n}]})(e,t);l.push(i),r.push(n)};for(const e of o){const t=null!=e.baselineIdx?i[e.baselineIdx]:void 0,a=null!=e.observedIdx?n[e.observedIdx]:void 0;if(t&&a){if(tA(t,a)){s+=1,u+=1;const i=`baseline-only-${e.baselineIdx}`;l.push(oA(t,i,s)),r.push({id:`removed-${u}`,variant:"removed",depth:t.depth??0,badge:{icon:sh}}),d+=1,c+=1,u+=1;const n=`new-${e.observedIdx}`;l.push({id:`placeholder-${u}`,variant:"placeholder",depth:a.depth??0,badge:{icon:wu}}),r.push(oA(a,n,c,{variant:"new",badge:{label:"New",tone:"danger",icon:wu}}));continue}const i=`pair-${e.baselineIdx}-${e.observedIdx}`;s+=1,c+=1;const n=t.durationMs??0,o=a.durationMs??0;if(n>0&&o/n>=2){p+=1;const e=Math.max(1,Math.round(o/n));h(oA(t,i,s,{variant:"timing"}),oA(a,i,c,{variant:"timing",badge:{label:`${e}x Slower`,tone:"warning",icon:Ch}}))}else h(oA(t,i,s),oA(a,i,c));continue}if(a&&!t){d+=1,c+=1,u+=1;const t=`new-${e.observedIdx}`;l.push({id:`placeholder-${u}`,variant:"placeholder",depth:a.depth??0,badge:{icon:wu}}),r.push(oA(a,t,c,{variant:"new",badge:{label:"New",tone:"danger",icon:wu}}));continue}if(t&&!a){s+=1,u+=1;const i=`baseline-only-${e.baselineIdx}`;l.push(oA(t,i,s)),r.push({id:`removed-${u}`,variant:"removed",depth:t.depth??0,badge:{icon:sh}})}}const g=n.find(e=>0===(e.depth??0))??n[0],m=iA(g?.durationMs??null);return{baselineRows:l,observedRows:r,newSpanCount:d,timingChangeCount:p,observedDurationLabel:m,error:a}},rA=f(T)`
|
|
2019
2019
|
width: 100%;
|
|
2020
2020
|
min-width: 0;
|
|
2021
2021
|
align-items: flex-start;
|
|
2022
2022
|
`,sA=f.div`
|
|
2023
2023
|
flex: 1;
|
|
2024
2024
|
min-width: 0;
|
|
2025
|
-
`,cA=e=>{let t=0;return(e.scope||e.scopePlaceholder)&&(t+=1),t+=e.attributes?.filter(e=>!!e?.key||!!e?.placeholder).length??0,t},dA=(e,t)=>({id:e,variant:"placeholder",depth:t,badge:{icon:wu}}),pA=({baselineTrace:i,anomalyTrace:n})=>{const o=a(()=>lA(i,n),[i,n]),[r,s]=l([]),c=a(()=>new Set(r),[r]),p=a(()=>((e,t,i)=>{const n=[],a=[],o=Math.max(e.length,t.length);for(let l=0;l<o;l++){const o=e[l],r=t[l];o&&n.push(o),r&&a.push(r);const s=!!o
|
|
2025
|
+
`,cA=e=>{let t=0;return(e.scope||e.scopePlaceholder)&&(t+=1),t+=e.attributes?.filter(e=>!!e?.key||!!e?.placeholder).length??0,t},dA=(e,t)=>({id:e,variant:"placeholder",depth:t,badge:{icon:wu}}),pA=e=>"placeholder"===e?.variant||"removed"===e?.variant,uA=({baselineTrace:i,anomalyTrace:n})=>{const o=a(()=>lA(i,n),[i,n]),[r,s]=l([]),c=a(()=>new Set(r),[r]),p=a(()=>((e,t,i)=>{const n=[],a=[],o=Math.max(e.length,t.length);for(let l=0;l<o;l++){const o=e[l],r=t[l];o&&n.push(o),r&&a.push(r);const s=!!o&&!pA(o)&&i.has(o.id),c=!!r&&!pA(r)&&i.has(r.id),d=s?cA(o):0,p=c?cA(r):0,u=Math.max(d,p),h=r?.depth??o?.depth??0;for(let e=0;e<u-d;e++)n.push(dA(`expand-filler-baseline-${r?.id??o?.id}-${l}-${e}`,h));for(let e=0;e<u-p;e++)a.push(dA(`expand-filler-observed-${o?.id??r?.id}-${l}-${e}`,h))}return{baseline:n,observed:a}})(o.baselineRows,o.observedRows,c),[o.baselineRows,o.observedRows,c]),u=d(e=>{s(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[]),h=a(()=>[],[]),g=a(()=>{const e=[];return o.observedDurationLabel&&e.push({label:o.observedDurationLabel}),o.newSpanCount>0&&e.push({label:`${o.newSpanCount} new span${1===o.newSpanCount?"":"s"}`}),o.timingChangeCount>0&&e.push({label:`${o.timingChangeCount} timing change${1===o.timingChangeCount?"":"s"}`}),e},[o.newSpanCount,o.observedDurationLabel,o.timingChangeCount]);return e(rA,{children:[t(sA,{children:o.baselineRows.length?t(vc,{traceId:i?.traceId,title:"Baseline trace",titleIcon:Ou,headerBadge:{label:"Baseline",tone:"success"},meta:h,rows:p.baseline,expandedRowIds:r,onToggleRow:u,corner:"left"}):t(oi,{children:t(Z,{title:"No trace available",subTitle:o.error?`Unable to compare traces: ${o.error}`:"No baseline spans available"})})}),t(sA,{children:o.observedRows.length?t(vc,{traceId:n?.traceId,title:"Observed trace",titleIcon:Ch,headerBadge:{label:"Flagged",tone:"danger"},meta:g,rows:p.observed,expandedRowIds:r,onToggleRow:u,corner:"right"}):t(oi,{children:t(Z,{title:"No trace available",subTitle:o.error?`Unable to compare traces: ${o.error}`:"No observed spans available"})})})]})},hA=e=>e.split("_").filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "),gA=(e,t)=>{const i=t?.deviationClasses.find(t=>t.id===e.source);if(i)return{name:i.label||e.source,isEnricher:!1};const n=t?.enrichers.find(t=>t.source===e.source);return n?{name:n.label||e.source,isEnricher:!0}:{name:e.source,isEnricher:!1}},mA=(e,t,i=[])=>{const n=t?.categories.find(t=>t.id===e);if(n)return{label:n.label||hA(e),mitre:n.mitre,owasp:n.owasp};const a=t?.deviationClasses.find(t=>t.category===e);if(a)return{label:a.categoryLabel||hA(e),mitre:a.mitre??i.find(e=>e.mitre)?.mitre,owasp:a.owasp??i.find(e=>e.owasp)?.owasp};const o=i[0];return{label:hA(e),mitre:o?.mitre,owasp:o?.owasp}};var bA;(e=>{e.Signal="signal",e.Category="category",e.Weight="weight",e.Confidence="confidence",e.Contribution="contribution"})(bA||(bA={}));const fA=[{key:bA.Signal,label:"Signal",flex:2.2},{key:bA.Category,label:"Category (MITRE/OWASP)",flex:1.4},{key:bA.Weight,label:"Weight",flex:.7},{key:bA.Confidence,label:"Confidence",flex:.8},{key:bA.Contribution,label:"Contribution",flex:.9}],vA=f.div`
|
|
2026
2026
|
display: flex;
|
|
2027
2027
|
flex-direction: column;
|
|
2028
2028
|
width: 100%;
|
|
2029
2029
|
border-radius: 12px;
|
|
2030
2030
|
overflow: hidden;
|
|
2031
2031
|
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
2032
|
-
`,
|
|
2032
|
+
`,yA=f.div`
|
|
2033
2033
|
display: grid;
|
|
2034
2034
|
grid-template-columns: 2.2fr 1.4fr 0.7fr 0.8fr 0.9fr;
|
|
2035
2035
|
width: 100%;
|
|
2036
2036
|
align-items: stretch;
|
|
2037
|
-
`,
|
|
2037
|
+
`,SA=f.div`
|
|
2038
2038
|
display: flex;
|
|
2039
2039
|
align-items: center;
|
|
2040
2040
|
min-height: 44px;
|
|
2041
2041
|
padding: 0 12px;
|
|
2042
2042
|
border-bottom: 1px solid ${({theme:e})=>e.v2.colors.silver[500]};
|
|
2043
|
-
`,
|
|
2043
|
+
`,xA=f.div`
|
|
2044
2044
|
display: flex;
|
|
2045
2045
|
align-items: center;
|
|
2046
2046
|
gap: 8px;
|
|
@@ -2049,7 +2049,7 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2049
2049
|
padding: 0 24px;
|
|
2050
2050
|
border-left: 2px solid ${({theme:e})=>e.v2.colors.orange[500]};
|
|
2051
2051
|
background-color: ${({theme:e})=>e.v2.colors.orange[1e3]};
|
|
2052
|
-
`,
|
|
2052
|
+
`,wA=f.div`
|
|
2053
2053
|
display: flex;
|
|
2054
2054
|
flex-direction: column;
|
|
2055
2055
|
justify-content: center;
|
|
@@ -2058,7 +2058,7 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2058
2058
|
min-height: 54px;
|
|
2059
2059
|
padding: 8px 12px;
|
|
2060
2060
|
border-bottom: 1px solid ${({theme:e})=>e.v2.colors.silver[500]};
|
|
2061
|
-
`,
|
|
2061
|
+
`,CA=f.div`
|
|
2062
2062
|
display: flex;
|
|
2063
2063
|
align-items: center;
|
|
2064
2064
|
justify-content: space-between;
|
|
@@ -2066,13 +2066,13 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2066
2066
|
min-height: 56px;
|
|
2067
2067
|
padding: 12px;
|
|
2068
2068
|
border-top: 1px solid ${({theme:e})=>e.v2.colors.silver[500]};
|
|
2069
|
-
`,
|
|
2069
|
+
`,kA=f.div`
|
|
2070
2070
|
display: flex;
|
|
2071
2071
|
align-items: center;
|
|
2072
2072
|
gap: 16px;
|
|
2073
2073
|
flex: 1;
|
|
2074
2074
|
min-width: 0;
|
|
2075
|
-
`,
|
|
2075
|
+
`,TA=f.div`
|
|
2076
2076
|
position: relative;
|
|
2077
2077
|
flex: 1;
|
|
2078
2078
|
height: 8px;
|
|
@@ -2080,25 +2080,25 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2080
2080
|
border-radius: 100px;
|
|
2081
2081
|
overflow: hidden;
|
|
2082
2082
|
background-color: ${({theme:e})=>e.v2.colors.grey[700]};
|
|
2083
|
-
`,
|
|
2083
|
+
`,IA=f.div`
|
|
2084
2084
|
height: 100%;
|
|
2085
2085
|
width: ${({$widthPct:e})=>`${Math.max(0,Math.min(100,e))}%`};
|
|
2086
2086
|
background-color: ${({$color:e})=>e};
|
|
2087
|
-
|
|
2087
|
+
`,$A=(e,t)=>e>=50?t.v2.colors.red[500]:e>=35?t.v2.colors.orange[500]:t.v2.colors.blue[500],NA=({risk:i,catalog:n})=>{const o=v(),l=n?.deviationClasses?.length?n:Bv,r=a(()=>i?((e,t)=>{const i=new Map,n=[];(e.categories?.filter(Boolean)??[]).forEach(e=>{i.has(e)||(i.set(e,[]),n.push(e))}),e.signals.forEach(e=>{const t=e.category||"unknown";i.has(t)||(i.set(t,[]),n.push(t)),i.get(t).push(e)});const a=[];for(const e of n){const n=i.get(e)??[];if(!n.length)continue;const o=mA(e,t,n);a.push({categoryId:e,label:o.label,mitre:o.mitre,owasp:o.owasp,signals:n.map(e=>{const{name:i,isEnricher:n}=gA(e,t);return{source:e.source,name:i,rationale:e.rationale,category:e.category,weight:e.weight,confidence:e.confidence,contribution:e.contribution,isEnricher:n}})})}return a})(i,l):[],[i,l]);return i&&r.length?e(vA,{children:[t(yA,{children:fA.map(e=>t(SA,{children:t(w,{size:C.XS,color:k.Primary,children:e.label})},e.key))}),r.map(i=>e($,{$gap:0,$width:"100%",children:[e(xA,{children:[e(w,{size:C.XS,color:k.Primary,children:[i.label,i.mitre?` ${i.mitre}`:""]}),i.owasp?t(E,{label:i.owasp,backgroundColor:o.v2.colors.grey[500],textColor:o.v2.colors.white[500],textSize:C.XXXS}):null]}),i.signals.map(n=>{return e(yA,{children:[e(wA,{children:[e(T,{$gap:4,$alignItems:"center",children:[t(w,{size:C.XS,color:k.Primary,children:n.name}),n.isEnricher?t(Xi,{label:"Enricher",variant:_i.Purple}):null,t(E,{label:n.source,backgroundColor:o.v2.colors.grey[500],textColor:o.v2.colors.white[500],textSize:C.XXXS})]}),n.rationale?t(w,{size:C.XXS,color:k.Secondary,children:n.rationale}):null]}),t(wA,{children:t(w,{size:C.XS,color:k.Primary,children:n.category})}),t(wA,{children:t(w,{size:C.XXS,color:k.Primary,children:n.weight})}),t(wA,{children:t(w,{size:C.XXS,color:k.Primary,children:(a=n.confidence,Number.isInteger(a)?a.toFixed(1):String(Number(a.toFixed(2))))})}),t(wA,{children:t(w,{size:C.XXS,color:k.Primary,children:n.contribution})})]},`${i.categoryId}-${n.source}`);var a})]},i.categoryId)),i.correlated&&i.correlationBonus>0?e(yA,{children:[t(wA,{children:e(T,{$gap:4,$alignItems:"center",children:[t(w,{size:C.XS,color:k.Primary,children:"Correlation bonus"}),t(E,{label:"multi-category",backgroundColor:o.v2.colors.grey[500],textColor:o.v2.colors.white[500],textSize:C.XXXS})]})}),t(wA,{}),t(wA,{}),t(wA,{}),t(wA,{children:e(w,{size:C.XXS,color:k.Primary,children:["+",i.correlationBonus]})})]}):null,e(CA,{children:[e(kA,{children:[e(w,{size:C.S,color:k.Primary,children:["Total risk score ",i.score]}),t(TA,{children:t(IA,{$widthPct:i.score,$color:$A(i.score,o)})})]}),e(w,{size:C.XXS,color:k.Secondary,children:["fires at ≥ ",i.fireAtScore," (policy threshold)"]})]})]}):t(w,{size:C.XXS,color:k.Secondary,children:"No risk signals for this anomaly."})},AA=(e,t,i)=>t?[{id:"severity",title:"Severity",badge:mN(e,t.severity)},{id:"status",title:"Status",badge:bN(e,t.status)},{id:"operation",title:"Operation",tag:{label:t.operationName||"-"}},...t.identityDimensions.map((e,t)=>({id:`identity-dim-${t}`,title:e.key,badge:{label:Og(e.key,e.value),tooltip:e.key}})),{id:"transaction-id",title:"Transaction ID",label:t.transactionId,withCopy:!0},{id:"signature",title:"Signature",label:t.signature,withCopy:!0},{id:"matched-traces",title:"Matched traces",label:t.occurrences.toString()},{id:"last-seen",title:"Last seen",label:t.lastSeen?i(t.lastSeen,{style:"short"}):"-"}]:[],OA=[{id:"alert-only",title:"Alert only",description:"Notify when this behavior appears again. No runtime action is taken. Safe."},{id:"kill-thread",title:"Kill thread",description:"Stop the matching execution thread when this behavior appears again."},{id:"kill-process",title:"Kill process",description:"Terminate the affected process on the next match. This may interrupt service availability."}],EA=({finding:i,onClose:n})=>{const o=v(),{formatDurationAgo:l}=qn(),{insightsApi:s}=Hh(),c=i.transactionId||"",d=i.signature||"",p=!!c&&!!d,{data:u,loading:h}=s.useAnomaly({transactionId:c,signature:d},{skip:!p}),{data:g}=s.useCatalog(),m=a(()=>yc(u?.anomalyTrace?.traceId,u?.anomalyTrace?.rawOtlp),[u?.anomalyTrace?.traceId,u?.anomalyTrace?.rawOtlp]),b=a(()=>yc(u?.baselineTrace?.traceId,u?.baselineTrace?.rawOtlp),[u?.baselineTrace?.traceId,u?.baselineTrace?.rawOtlp]),{data:f,loading:y}=s.useBlastRadius({namespace:i.namespace,service:i.service},{skip:!i.namespace||!i.service}),{formData:S,handleFormChange:x}=Gn({responseOnNextMatch:""});return e(Mn,{bgTint:"1000",moreSpacing:!0,children:[t(Mn,{bgTint:"900",moreSpacing:!0,richTitle:{icon:Nh,title:i?.title},renderOnRightSide:e(r,{children:[t(MN,{actionType:rN.Dismiss,selectedFindings:[i],onDone:n,buttonProps:{size:W.S}}),t(MN,{actionType:rN.Accept,selectedFindings:[i],onDone:n,buttonProps:{label:"Accept (Add to baseline)",variant:K.Primary,size:W.S}})]}),items:AA(o,u||null,l)}),t(Mn,{bgTint:"900",richTitle:{title:"Why this fired",icon:ih},withCollapse:!0,children:t(JN,{classFindings:u?.classFindings})}),t(Mn,{bgTint:"900",richTitle:{title:"Risk breakdown",titleSize:C.S,tooltip:"How this anomaly score was computed from weighted signals, confidence, and optional multi-category correlation."},withCollapse:!0,children:h&&!u?t(oi,{children:t(Ve,{withSpinner:!0})}):t(NA,{risk:u?.risk,catalog:g})}),t(Mn,{bgTint:"900",richTitle:KN("Baseline vs observed trace","Compare the learned normal trace with the observed trace that triggered this anomaly."),withCollapse:!0,collapseIsDefaultOpen:!0,children:h&&!u?t(oi,{children:t(Ve,{withSpinner:!0})}):t(uA,{baselineTrace:b,anomalyTrace:m})}),t(Mn,{bgTint:"900",richTitle:KN("Blast Radius","Services and resources touched by traces matching this anomaly."),withCollapse:!0,collapseIsDefaultOpen:!0,children:y&&!f?t(oi,{children:t(Ve,{withSpinner:!0})}):t(gm,{blastRadius:f})}),t(Mn,{bgTint:"900",richTitle:{...KN("Response on next match","This action will be applied only when a future trace matches this anomaly pattern again."),badge:{label:xc,tooltip:Sc,backgroundColor:o.v2.colors.pink[500],textColor:o.v2.colors.black[500]}},actions:[{id:"apply",type:St.Button,buttonProps:{label:"Apply on next match",rightIcon:Cu,variant:K.Primary,size:W.S,disabled:!0,onClick:()=>{}}}],withCollapse:!0,children:t(T,{$gap:16,children:t(DA,{options:OA,selectedId:S.responseOnNextMatch,setSelectedId:e=>x("responseOnNextMatch",e)})})})]})},DA=({options:i,selectedId:n,setSelectedId:a})=>i.map(i=>{const o=n===i.id,l=()=>a(i.id);return t(Mn,{bgTint:"800",moreSpacing:!0,onClick:l,clickStylesRemainActive:o,children:e(T,{$gap:16,children:[t(U,{value:o,onChange:l}),e($,{$gap:4,children:[t(w,{size:C.S,color:k.Primary,children:i.title}),t(w,{size:C.XXS,color:k.Secondary,children:i.description})]})]})},i.id)}),zA=f(T)`
|
|
2088
2088
|
width: 100%;
|
|
2089
2089
|
min-width: 0;
|
|
2090
2090
|
align-items: flex-start;
|
|
2091
|
-
`,
|
|
2091
|
+
`,RA=f.div`
|
|
2092
2092
|
flex: 1;
|
|
2093
2093
|
min-width: 0;
|
|
2094
|
-
`,
|
|
2094
|
+
`,PA=e=>(e.attrs??[]).filter(e=>!!e?.key).map(e=>({key:e.key??null,value:e.value??null})),XA=({evidenceTrace:e,spanHighlights:i})=>{const n=a(()=>((e,t)=>{const i=e?.spans??[],n=new Map((t??[]).map(e=>[e.spanId,e]));return i.map((e,t)=>{const i=e.spanId?n.get(e.spanId):void 0;return{id:e.spanId||`span-${t}`,index:t+1,service:e.service??null,name:e.name??null,durationLabel:(a=e.durationMs,null==a||Number.isNaN(a)?null:fc(1e6*Math.max(0,a))),depth:e.depth??0,scope:e.scope??null,attributes:PA(e),variant:i?"new":"default",badge:i?{icon:Ch,tone:"danger",label:i.reason}:null};var a})})(e,i),[e,i]),[o,r]=l([]);return e&&e.spans?.length?t(zA,{children:t(RA,{children:e&&e.spans?.length?t(vc,{traceId:e.traceId,title:"Evidence trace",rows:n,expandedRowIds:o,onToggleRow:e=>{r(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])}}):t(oi,{children:t(Z,{title:"No evidence retained",subTitle:e?.error?`Unable to parse traces: ${e.error}`:"No sample trace was captured for this violation."})})})}):t(oi,{children:t(Z,{title:"No evidence retained",subTitle:e?.error?`Unable to parse traces: ${e.error}`:"No sample trace was captured for this violation."})})},LA=(e,t,i)=>[{id:"severity",title:"Severity",badge:mN(e,t.severity)},{id:"status",title:"Status",badge:bN(e,t.status)},{id:"rule-key",title:"Rule key",tag:{label:t.ruleKey||"-"}},{id:"offending",title:"Offending",label:t.offending||"-",withCopy:!0},{id:"matched-traces",title:"Matched traces",label:t.occurrences.toString()},{id:"last-seen",title:"Last seen",label:t.lastSeen?i(t.lastSeen,{style:"short"}):"-"}],_A=({finding:i,onClose:n})=>{const o=v(),{formatDurationAgo:l}=qn(),{insightsApi:s}=Hh(),c=i.scopeKey||"",d=i.ruleKey||"",p=i.offending||"",u=!!c&&!!d&&!!p,{data:h,loading:g}=s.useGuardrailViolation({scopeKey:c,ruleKey:d,offending:p},{skip:!u}),m=a(()=>yc(h?.evidenceTrace?.traceId,h?.evidenceTrace?.rawOtlp),[h?.evidenceTrace?.traceId,h?.evidenceTrace?.rawOtlp]),{data:b,loading:f}=s.useBlastRadius({namespace:i.namespace,service:i.service},{skip:!i.namespace||!i.service});return e(Mn,{bgTint:"1000",moreSpacing:!0,children:[t(Mn,{bgTint:"900",moreSpacing:!0,richTitle:{icon:Nh,title:i?.title},renderOnRightSide:e(r,{children:[t(MN,{actionType:rN.Dismiss,selectedFindings:[i],onDone:n,buttonProps:{size:W.S}}),t(MN,{actionType:rN.Accept,selectedFindings:[i],onDone:n,buttonProps:{label:"Accept (Add to guardrails)",variant:K.Primary,size:W.S}})]}),items:LA(o,i,l),children:t(Mn,{bgTint:"800",items:[{id:"summary",title:"Summary",label:h?.summary||"-"}]})}),t(Mn,{bgTint:"900",richTitle:KN("Evidence trace","The trace that triggered this violation."),withCollapse:!0,collapseIsDefaultOpen:!0,children:g&&!h?t(oi,{children:t(Ve,{withSpinner:!0})}):t(XA,{evidenceTrace:m,spanHighlights:h?.spanHighlights})}),t(Mn,{bgTint:"900",richTitle:KN("Blast Radius","Services and resources touched by traces matching this violation."),withCollapse:!0,collapseIsDefaultOpen:!0,children:f&&!b?t(oi,{children:t(Ve,{withSpinner:!0})}):t(gm,{blastRadius:b})})]})},MA=({type:i})=>{const n=v(),{drawerIsOpenFor:o,closeDrawer:l}=J$(),{insightsApi:s}=Hh(),{data:c,loading:d}=s.useFindings(void 0,{fetchPolicy:"cache-first"}),p=a(()=>{if(o.id)return((e,t)=>e?.find(e=>oN(e)===t))(c,o.id)},[c,o.id]);return t(ln,{width:o.type===H$.Anomaly?"90vw":"60vw",isOpen:!0,header:{onClose:l,icon:Uu,title:p?.service||"-",titleBadges:[{label:p?.namespace||"-",tooltip:"Namespace"},{label:p?.kind||"-",tooltip:"Finding kind",backgroundColor:n.v2.colors.blue[900]}],subTitleTags:[{label:`Captured ${p?.lastSeen?new Date(p.lastSeen).toLocaleString():"-"}`,disabled:!0}]},children:p?e(r,{children:[i===H$.Anomaly&&t(EA,{finding:p,onClose:l}),i===H$.Violation&&t(_A,{finding:p,onClose:l})]}):t(ln,{width:"95vw",isOpen:!0,header:{onClose:l},children:t(oi,{children:d?t(Ve,{withSpinner:!0}):t(Z,{title:"No finding found",subTitle:`No finding found for this ID ${o.id}`})})})})},FA=({histogram:e,classDescription:i})=>e.series.map(e=>t(Mn,{bgTint:"900",richTitle:KN(e.label,i),withCollapse:!0,collapseIsDefaultOpen:!0,children:t(wc,{bars:e.bars.map(e=>({label:e.label,value:e.count}))})},e.name));var BA;(e=>{e.Namespace="namespace",e.Version="version"})(BA||(BA={}));const VA=[{key:BA.Namespace,label:"Namespace"},{key:BA.Version,label:"Version"}],UA=({libraries:e})=>{const i=a(()=>(e=>e.map((e,t)=>({id:`${e.ns}-${t}`,cells:[{key:BA.Namespace,rawValue:e.ns||"-"},{key:BA.Version,rawValue:e.ver||"-"}]})))(e),[e]);return t(Mn,{bgTint:"900",richTitle:KN("Libraries","Learned libraries used in this transaction"),withCollapse:!0,collapseIsDefaultOpen:!0,children:t(za,{maxHeight:"420px",variant:Ra.Data,columns:VA,rows:i})})};var GA,jA,HA;(e=>{e.System="system",e.Namespace="namespace",e.TableAccess="tableAccess"})(GA||(GA={})),(e=>{e.Access="db-access"})(jA||(jA={})),(e=>{e.Animated="db-access-animated"})(HA||(HA={}));const WA=f.div`
|
|
2095
2095
|
min-width: ${({$isScope:e})=>e?"unset":"200px"};
|
|
2096
2096
|
padding: 12px;
|
|
2097
2097
|
border-radius: 8px;
|
|
2098
2098
|
background-color: ${({theme:e})=>e.v2.colors.silver[900]};
|
|
2099
2099
|
border: 1px
|
|
2100
2100
|
${({theme:e,$isScope:t})=>t?`dashed ${e.v2.colors.silver[400]}`:`solid ${e.v2.colors.silver[400]}`};
|
|
2101
|
-
`,
|
|
2101
|
+
`,KA=f.div`
|
|
2102
2102
|
display: flex;
|
|
2103
2103
|
align-items: center;
|
|
2104
2104
|
justify-content: center;
|
|
@@ -2106,13 +2106,13 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2106
2106
|
padding: 4px;
|
|
2107
2107
|
border-radius: 4px;
|
|
2108
2108
|
background-color: ${({theme:e})=>e.v2.colors.blue[900]};
|
|
2109
|
-
`,
|
|
2109
|
+
`,YA={visibility:"hidden"},JA=b(({data:n})=>{const a=v(),{kind:o,system:l,ns:r,table:s,op:c}=n,d=o===GA.System||o===GA.Namespace,p=o===GA.System?l:o===GA.Namespace?r:s,u=a.v2.colors.blue[200];return e(i,{children:[t(wm,{type:"source",position:Cm.Right,style:YA}),t(wm,{type:"target",position:Cm.Left,style:YA}),t(WA,{$isScope:d,children:e(T,{$gap:24,$justifyContent:"space-between",children:[e($,{$gap:4,children:[d&&e($,{$gap:8,children:[t(KA,{children:o===GA.System?t(Oh,{size:16,fill:u}):o===GA.Namespace?t(Eh,{size:16,fill:u}):null}),t(w,{transform:"uppercase",fontFamily:"code",size:C.XXXS,color:k.Secondary,nowrap:!0,children:o})]}),t(w,{size:C.XXS,color:k.Primary,nowrap:!0,children:p})]}),!!c&&t(Xi,{label:c,variant:_i.Green})]})})]})});JA.displayName=JA.name;const qA=140,ZA=e=>`system:${e}`,QA=(e,t)=>`ns:${e}:${t}`,eO=(e,t,i,n)=>`table:${e}:${t}:${i}:${n}`,tO={[jA.Access]:JA},iO=({accesses:e})=>{const i=v(),[n,r]=l([]),[s,c]=l([]),[d,p]=l(0),u=a(()=>e.map(e=>`${e.system}|${e.ns}|${e.table}|${e.op}`).join("::"),[e]);return o(()=>{let t=!1;return(async()=>{const{nodes:n,edges:a,rootIds:o}=((e,t)=>{const i=new Map,n=new Set,a=[],o=[],l=t.v2.colors.silver[400],r=e=>{i.has(e.id)||i.set(e.id,e)},s=(e,t)=>{const i=`${e}->${t}`;n.has(i)||(n.add(i),a.push({id:i,type:"smoothstep",source:e,target:t,markerEnd:{type:km.ArrowClosed,color:l,width:16,height:16},style:{stroke:l,strokeWidth:1}}))};for(const t of e){const e=t.system?.trim();if(!e)continue;const i=ZA(e);r({id:i,type:jA.Access,position:{x:0,y:0},data:{kind:GA.System,system:e,ns:"",table:"",op:""},measured:{width:qA,height:58}}),o.includes(i)||o.push(i);const n=t.ns?.trim();if(!n)continue;const a=QA(e,n);r({id:a,type:jA.Access,position:{x:0,y:0},data:{kind:GA.Namespace,system:e,ns:n,table:"",op:""},measured:{width:qA,height:58}}),s(i,a);const l=t.table?.trim()??"",c=t.op?.trim()??"";if(!l&&!c)continue;const d=eO(e,n,l,c);r({id:d,type:jA.Access,position:{x:0,y:0},data:{kind:GA.TableAccess,system:e,ns:n,table:l,op:c},measured:{width:qA,height:58}}),s(a,d)}return{nodes:Array.from(i.values()),edges:a,rootIds:o}})(e,i);if(!n.length)return void(t||(r([]),c([])));const l=await bm(n,a,{direction:"RIGHT",nodeWidth:qA,nodeHeight:58,rootIds:o,rootLayerConstraint:"FIRST",spacing:{betweenLayers:120,nodeNode:12,edgeEdge:24,edgeNode:32}});t||(r(l.nodes),c(l.edges),p(e=>e+1))})(),()=>{t=!0}},[u,e,i]),t(mm,{height:420,interactive:!1,nodeTypes:tO,nodes:n,edges:s,fitViewTrigger:d,minZoom:.4,maxZoom:1.5})},nO=({accesses:e})=>e.length?t(iO,{accesses:e}):t(oi,{children:t(Z,{subTitle:"No access footprint to visualize."})});var aO;(e=>{e.Table="table",e.Map="map"})(aO||(aO={}));const oO=[{label:"Table",value:aO.Table},{label:"Map",value:aO.Map}];var lO;(e=>{e.Type="type",e.Operation="operation",e.Table="table",e.Namespace="namespace"})(lO||(lO={}));const rO=[{key:lO.Type,label:"Type"},{key:lO.Operation,label:"Operation"},{key:lO.Table,label:"Table"},{key:lO.Namespace,label:"Namespace"}],sO=(i,n)=>i.map(i=>{const a=!i.table&&!i.op,o=a?"Namespace level":"Table access";return{id:i.system+i.ns+i.table+i.op,cells:[{key:lO.Type,rawValue:o,component:()=>e(T,{$gap:4,children:[t(Cc,{color:a?n.v2.colors.orange[500]:n.v2.colors.blue[500]}),t(w,{size:C.XXS,children:o})]})},{key:lO.Operation,rawValue:i.op||"-",component:()=>t(Xi,{label:i.op||"-",variant:i.op?_i.Green:void 0})},{key:lO.Table,rawValue:i.table||"-",component:()=>t(Xi,{label:i.table||"-"})},{key:lO.Namespace,rawValue:i.ns||"-",component:()=>t(Xi,{label:i.ns||"-"})}]}}),cO=({parsedJson:e})=>{const i=v(),[n,a]=l(aO.Map),o=d(()=>n===aO.Table?t(za,{maxHeight:"420px",variant:Ra.Data,columns:rO,rows:sO(e.accesses||[],i)}):t(nO,{accesses:e.accesses||[]}),[n,e,i]);return t(Mn,{bgTint:"900",richTitle:KN("Observed access footprint",""),withCollapse:!0,collapseIsDefaultOpen:!0,renderOnRightSide:t(F,{options:oO,selected:n,setSelected:a,size:Zt.L}),children:o()})};var dO,pO;(e=>{e.Owner="owner",e.Peer="peer"})(dO||(dO={})),(e=>{e.Peer="outbound-peer"})(pO||(pO={}));const uO=f.div`
|
|
2110
2110
|
padding: 12px;
|
|
2111
2111
|
border-radius: 8px;
|
|
2112
2112
|
background-color: ${({theme:e,$isOwner:t})=>t?e.v2.colors.purple[900]:e.v2.colors.silver[900]};
|
|
2113
2113
|
border: 1px solid
|
|
2114
2114
|
${({theme:e,$isOwner:t})=>t?e.v2.colors.purple[400]:e.v2.colors.silver[400]};
|
|
2115
|
-
`,
|
|
2115
|
+
`,hO=f.div`
|
|
2116
2116
|
display: flex;
|
|
2117
2117
|
align-items: center;
|
|
2118
2118
|
justify-content: center;
|
|
@@ -2120,12 +2120,12 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2120
2120
|
padding: 4px;
|
|
2121
2121
|
border-radius: 4px;
|
|
2122
2122
|
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
2123
|
-
`,
|
|
2123
|
+
`,gO={visibility:"hidden"},mO=b(({data:n})=>{const a=v(),{kind:o,label:l,port:r,external:s}=n,c=o===dO.Owner,d=!c&&!!s,p=tN(c?l:"");return e(i,{children:[t(wm,{type:"source",position:Cm.Bottom,style:gO}),t(wm,{type:"target",position:Cm.Top,style:gO}),t(uO,{$isOwner:c,children:e($,{$gap:8,children:[e(T,{$gap:8,children:[c?t(ga,{icons:p,size:20}):t(hO,{children:t(zu,{size:14,fill:a.v2.colors.silver[200]})}),t(w,{size:C.XXXS,color:k.Secondary,nowrap:!0,children:l})]}),!c&&e(T,{$gap:8,children:[null!=r&&t(Xi,{label:String(r),variant:_i.Blue}),d&&t(Xi,{label:"External",variant:_i.Yellow})]})]})})]})});mO.displayName=mO.name;const bO=e=>`owner:${e}`,fO=(e,t)=>`peer:${e}:${t}`,vO={[pO.Peer]:mO},yO=({peers:e})=>{const i=v(),[n,r]=l([]),[s,c]=l([]),[d,p]=l(0),u=a(()=>e.map(e=>`${e.owner??""}|${e.host}:${e.port}|${e.external?1:0}`).join("::"),[e]);return o(()=>{let t=!1;return(async()=>{const{nodes:n,edges:a,rootIds:o}=((e,t)=>{const i=new Map,n=new Set,a=[],o=[],l=t.v2.colors.silver[400],r=e=>{const t=bO(e);return i.has(t)||(i.set(t,{id:t,type:pO.Peer,position:{x:0,y:0},data:{kind:dO.Owner,label:e},measured:{width:200,height:64}}),o.push(t)),t},s=(e,t,n)=>{const a=fO(e,t),o=i.get(a);return o?(n&&(o.data={...o.data,external:!0}),a):(i.set(a,{id:a,type:pO.Peer,position:{x:0,y:0},data:{kind:dO.Peer,label:e,port:t,external:!!n},measured:{width:200,height:64}}),a)},c=(e,t)=>{const i=`${e}->${t}`;n.has(i)||(n.add(i),a.push({id:i,type:"smoothstep",source:e,target:t,markerEnd:{type:km.ArrowClosed,color:l,width:16,height:16},style:{stroke:l,strokeWidth:1}}))};for(const t of e){const e=t.host?.trim()??"",i=t.port;if(!e||null==i||Number.isNaN(Number(i)))continue;const n=s(e,Number(i),t.external),a=t.owner?.trim()??"";a?c(r(a),n):o.includes(n)||o.push(n)}return{nodes:Array.from(i.values()),edges:a,rootIds:o}})(e,i);if(!n.length)return void(t||(r([]),c([])));const l=await bm(n,a,{direction:"DOWN",nodeWidth:200,nodeHeight:64,rootIds:o,rootLayerConstraint:"FIRST_SEPARATE",rootAlignCenter:!1,spacing:{betweenLayers:80,nodeNode:32,edgeEdge:24,edgeNode:32},extraOptions:{"elk.separateConnectedComponents":"false"}});t||(r(l.nodes),c(l.edges),p(e=>e+1))})(),()=>{t=!0}},[u,e,i]),t(mm,{height:420,interactive:!1,nodeTypes:vO,nodes:n,edges:s,fitViewTrigger:d,minZoom:.2,maxZoom:1.5})},SO=({peers:e})=>(a(()=>{const t=new Set;for(const i of e)i.owner?.trim()&&t.add(bO(i.owner.trim())),i.host?.trim()&&null!=i.port&&t.add(fO(i.host.trim(),Number(i.port)));return t.size},[e]),e.length?t(yO,{peers:e}):t(oi,{children:t(Z,{subTitle:"No outbound peers to visualize."})}));var xO;(e=>{e.Table="table",e.Map="map"})(xO||(xO={}));const wO=[{label:"Table",value:xO.Table},{label:"Map",value:xO.Map}];var CO;(e=>{e.Owner="owner",e.Host="host",e.Port="port",e.External="external"})(CO||(CO={}));const kO=[{key:CO.Owner,label:"Owner"},{key:CO.Host,label:"Host"},{key:CO.Port,label:"Port"},{key:CO.External,label:"External"}],TO=({peers:e})=>{const[i,n]=l(xO.Map),o=a(()=>(e=>e.map((e,i)=>({id:`${e.owner??""}-${e.host}:${e.port}-${i}`,cells:[{key:CO.Owner,rawValue:e.owner||"-",component:e.owner?()=>t(iN,{service:e.owner}):void 0},{key:CO.Host,rawValue:e.host||"-"},{key:CO.Port,rawValue:e.port??"-",component:()=>t(Xi,{label:null!=e.port?String(e.port):"-",variant:null!=e.port?_i.Blue:void 0})},{key:CO.External,rawValue:e.external?"yes":"no",component:()=>e.external?t(Xi,{label:"External",variant:_i.Yellow}):t("span",{children:"-"})}]})))(e),[e]),r=d(()=>i===xO.Table?t(za,{maxHeight:"420px",variant:Ra.Data,columns:kO,rows:o}):t(SO,{peers:e}),[i,e,o]);return t(Mn,{bgTint:"900",richTitle:KN("Outbound peers","Learned egress destinations (host:port) reached by this transaction"),withCollapse:!0,collapseIsDefaultOpen:!0,renderOnRightSide:t(F,{options:wO,selected:i,setSelected:n,size:Zt.L}),children:r()})},IO=f.div`
|
|
2124
2124
|
padding: 12px;
|
|
2125
2125
|
border-radius: 8px;
|
|
2126
2126
|
background-color: ${({theme:e,$withService:t})=>t?e.v2.colors.purple[900]:e.v2.colors.silver[900]};
|
|
2127
2127
|
border: 1px solid ${({theme:e,$withService:t})=>t?e.v2.colors.purple[400]:e.v2.colors.silver[400]};
|
|
2128
|
-
`,IO={visibility:"hidden"},$O=b(({data:n})=>{const{svc:a,op:o,sameServiceAsSource:l}=n,r=!l,s=tN(a);return e(i,{children:[t(wm,{type:"source",position:Cm.Right,style:IO}),t(wm,{type:"target",position:Cm.Left,style:IO}),t(TO,{$withService:r,children:e($,{$gap:8,children:[r&&e(T,{$gap:8,children:[t(ga,{icons:s,size:20}),t(w,{size:C.XXXS,color:k.Secondary,nowrap:!0,children:a})]}),t(Xi,{label:o,variant:_i.Green})]})})]})});var NO;$O.displayName=$O.name,(e=>{e.Call="service-call"})(NO||(NO={}));const AO={[NO.Call]:$O},OO=({callEdges:e})=>{const i=v(),[n,r]=l([]),[s,c]=l([]),[d,p]=l(0),u=a(()=>e.map(e=>`${e.from.svc}|${e.from.op}->${e.to.svc}|${e.to.op}`).join("::"),[e]);return o(()=>{let t=!1;return(async()=>{const{nodes:n,edges:a,rootIds:o}=((e,t)=>{const i=new Map,n=new Set,a=[],o=new Map,l=new Map,r=t.v2.colors.silver[400],s=(e,t)=>{const n=((e,t)=>`${e}::${t}`)(e,t);return i.has(n)||(i.set(n,{id:n,type:NO.Call,position:{x:0,y:0},data:{svc:e,op:t,isRoot:!1,sameServiceAsSource:!1},measured:{width:220,height:64}}),o.set(n,0),l.set(n,new Set)),n};for(const t of e){const e=t.from?.svc?.trim()??"",i=t.from?.op?.trim()??"",c=t.to?.svc?.trim()??"",d=t.to?.op?.trim()??"";if(!(e&&i&&c&&d))continue;const p=s(e,i),u=s(c,d);if(p===u)continue;const h=`${p}->${u}`;n.has(h)||(n.add(h),o.set(u,(o.get(u)??0)+1),l.get(u)?.add(e),a.push({id:h,type:"smoothstep",source:p,target:u,markerEnd:{type:km.ArrowClosed,color:r,width:16,height:16},style:{stroke:r,strokeWidth:1}}))}const c=[];for(const[e,t]of i){const i=0===(o.get(e)??0),n=l.get(e)??new Set,a=!i&&n.size>0&&[...n].every(e=>e===t.data.svc);t.data={...t.data,isRoot:i,sameServiceAsSource:a},i&&c.push(e)}return{nodes:Array.from(i.values()),edges:a,rootIds:c}})(e,i);if(!n.length)return void(t||(r([]),c([])));const l=await bm(n,a,{direction:"RIGHT",nodeWidth:220,nodeHeight:64,rootIds:o,rootLayerConstraint:"FIRST",spacing:{betweenLayers:120,nodeNode:24,edgeEdge:24,edgeNode:32}});t||(r(l.nodes),c(l.edges),p(e=>e+1))})(),()=>{t=!0}},[u,e,i]),t(mm,{height:420,interactive:!1,nodeTypes:AO,nodes:n,edges:s,fitViewTrigger:d,minZoom:.2,maxZoom:1.5})},EO=({edges:e})=>(a(()=>{const t=new Set;for(const i of e)t.add(`${i.from.svc}::${i.from.op}`),t.add(`${i.to.svc}::${i.to.op}`);return t.size},[e]),e.length?t(OO,{callEdges:e}):t(oi,{children:t(Z,{subTitle:"No service call edges to visualize."})}));var DO;(e=>{e.Table="table",e.Map="map"})(DO||(DO={}));const zO=[{label:"Table",value:DO.Table},{label:"Map",value:DO.Map}];var RO;(e=>{e.FromService="fromService",e.FromOperation="fromOperation",e.ToService="toService",e.ToOperation="toOperation"})(RO||(RO={}));const PO=[{key:RO.FromService,label:"From service"},{key:RO.FromOperation,label:"From operation"},{key:RO.ToService,label:"To service"},{key:RO.ToOperation,label:"To operation"}],XO=({edges:e})=>{const[i,n]=l(DO.Map),o=a(()=>(e=>e.map((e,i)=>({id:`${e.from.svc}-${e.from.op}->${e.to.svc}-${e.to.op}-${i}`,cells:[{key:RO.FromService,rawValue:e.from.svc||"-",component:e.from.svc?()=>t(iN,{service:e.from.svc}):void 0},{key:RO.FromOperation,rawValue:e.from.op||"-",component:()=>t(Xi,{label:e.from.op||"-",variant:e.from.op?_i.Green:void 0})},{key:RO.ToService,rawValue:e.to.svc||"-",component:e.to.svc?()=>t(iN,{service:e.to.svc}):void 0},{key:RO.ToOperation,rawValue:e.to.op||"-",component:()=>t(Xi,{label:e.to.op||"-",variant:e.to.op?_i.Green:void 0})}]})))(e),[e]),r=d(()=>i===DO.Table?t(za,{maxHeight:"420px",variant:Ra.Data,columns:PO,rows:o}):t(EO,{edges:e}),[i,e,o]);return t(Mn,{bgTint:"900",richTitle:KN("Service call edges","Observed call graph between operations"),withCollapse:!0,collapseIsDefaultOpen:!0,renderOnRightSide:t(F,{options:zO,selected:i,setSelected:n,size:Zt.L}),children:r()})},LO=({isOpen:i,onClose:n,baseline:o})=>{const{CopyButton:l}=En(),{histogram:r,data:s}=o||{},c=!!r?.series?.length,d=!!s,p=c||d,{parsedJson:u,jsonIsDbAccess:h,jsonIsServiceCalls:g,jsonIsOutboundPeers:m,jsonIsLibraries:b}=a(()=>{const e=xn(s,{});return{parsedJson:e,jsonIsDbAccess:!!e?.accesses?.length&&!!e?.query_shapes?.length,jsonIsServiceCalls:!!e?.edges?.length,jsonIsOutboundPeers:!!e?.peers?.length,jsonIsLibraries:!!e?.libs?.length}},[o]),f=!(c||h||g||m||b);return t(ln,{isOpen:i,width:c||h||g||m?"90vw":"40vw",header:{icon:Dh,title:"Baseline data",subTitle:`Deviation class: ${o?.class}`,onClose:n},children:o&&p?e($,{$gap:12,children:[g&&t(XO,{edges:u.edges||[]}),m&&t(kO,{peers:u.peers||[]}),b&&t(VA,{libraries:u.libs||[]}),h&&t(sO,{parsedJson:u}),c&&t(MA,{histogram:r,classDescription:o.classDescription}),d&&t(Mn,{bgTint:"900",richTitle:KN("JSON data","Raw baseline payload"),withCollapse:!0,collapseIsDefaultOpen:f,children:t(Mn,{bgTint:"800",overflow:"auto",children:e(T,{$width:"100%",$alignItems:"flex-start",$justifyContent:"space-between",children:[t(kc,{language:"json",code:s}),t(l,{value:s})]})})})]}):t(Z,{})})},_O=({transactionId:i})=>{const n=v(),{insightsApi:o}=Hh(),{data:r,loading:s,refetch:c}=o.useBaseline({transactionId:i},{pollInterval:3e4}),{baselinesColumns:d,baselinesRows:p}=a(()=>({baselinesColumns:[{key:CN.Class,label:"Class"},{key:CN.Status,label:"Status"},{key:CN.Learning,label:"Learning stability",noFilter:!0,noSort:!0},{key:CN.ObservationCount,label:"Observations",noFilter:!0},{key:CN.LearningStartedAt,label:"First observed",noFilter:!0}],baselinesRows:kN(0,r)}),[n,r]),u=a(()=>!!r?.length&&r.every(e=>e.promoted),[r]),[h,g]=l(!1),[m,b]=l(!1),[f,y]=l(null),[S,x]=l(null),[w,C]=l(null);return t(Mn,{bgTint:"900",richTitle:KN("Baseline (One row per deviation class)",'"Learning stability" shows how converged each class\'s baseline is. Locked means the class is promoted and frozen. While learning, progress shows observations and quiet time toward the resolved policy — a full bar is not promotion until the engine graduates the class.'),actions:[{id:"promote-all-baselines",type:St.Button,buttonProps:{label:"Promote all baselines",leftIcon:Ou,variant:K.Primary,disabled:u||!o.promoteTransactionBaselines,onClick:()=>b(!0)}},{id:"reset-all-baselines",type:St.Button,buttonProps:{label:"Reset all baselines",leftIcon:lh,variant:K.Secondary,onClick:()=>g(!0)}},{id:"refetch-baselines",type:St.Button,buttonProps:{tooltip:"Refetch",hideTooltipIcon:!0,leftIcon:Zu,variant:K.Secondary,onClick:c,loading:s}}],children:e(Mn,{bgTint:"800",children:[t(za,{maxHeight:"35vh",variant:Ra.Data,isLoading:s,columns:d,rows:p,getRowActions:e=>{const t=e.cells.find(e=>e.key===CN.Class)?.rawValue,i=r?.find(e=>e.class===t),n=i?.learning?.phase,a=n===uc.Promoted;return[{id:`${e.id}-view-data`,label:"View data",leftIcon:Yu,variant:K.Primary,onClick:()=>C(i??null)},{id:`${e.id}-promote-now`,label:"Promote now",leftIcon:Ou,disabled:a||!o.promoteBaselineClass,onClick:()=>x(t)},{id:`${e.id}-re-learn`,label:"Re-learn (reset)",leftIcon:lh,onClick:()=>y(t)}]}}),t(LO,{isOpen:!!w,onClose:()=>C(null),baseline:w}),t(Ce,{isOpen:m,onClose:()=>b(!1),title:"Promote all baseline classes",description:"Promote every scored baseline class on this transaction? Learning gates will be skipped and baselines will freeze.",approveButton:{label:"Promote all",onClick:()=>(async()=>{b(!1),await(o?.promoteTransactionBaselines?.(i)),c()})()},denyButton:{label:"Cancel",onClick:()=>b(!1),variant:K.Secondary}}),t(Ce,{isOpen:h,onClose:()=>g(!1),title:"Reset transaction baselines",description:"Are you sure you want to reset all baselines for this transaction?",approveButton:{label:"Reset all baselines",onClick:()=>(async()=>{g(!1),await(o?.resetTransactionBaselines?.(i)),c()})()},denyButton:{label:"Cancel",onClick:()=>g(!1),variant:K.Secondary}}),t(Ce,{isOpen:null!==f,onClose:()=>y(null),title:"Reset baseline class",description:"Are you sure you want to reset the baseline class?",approveButton:{label:"Reset baseline class",onClick:()=>(async e=>{y(null),await(o?.resetBaselineClass?.(i,e)),c()})(f)},denyButton:{label:"Cancel",onClick:()=>y(null),variant:K.Secondary}}),t(Ce,{isOpen:null!==S,onClose:()=>x(null),title:"Promote baseline class",description:"Promote this class now? Learning gates will be skipped and the baseline will freeze.",approveButton:{label:"Promote now",onClick:()=>(async e=>{x(null),await(o?.promoteBaselineClass?.({transactionId:i,class:e})),c()})(S)},denyButton:{label:"Cancel",onClick:()=>x(null),variant:K.Secondary}})]})})},MO=e=>(e.attrs??[]).filter(e=>!!e?.key).map(e=>({key:e.key??null,value:e.value??null})),FO=({isOpen:e,onClose:i,observation:n})=>{const o=n?.transactionId,r=n?.traceId,{insightsApi:s}=Hh(),{data:c,loading:d}=s.useObservation({transactionId:o,traceId:r},{skip:!e||!o||!r}),p=a(()=>(e=>e?.spans?.map((e,t)=>{return{id:e.spanId||`span-${t}`,index:t+1,service:e.service??null,name:e.name,duration:(i=e.durationMs,null==i||Number.isNaN(i)?null:fc(1e6*Math.max(0,i))),depth:e.depth??0,scope:e.scope??null,attributes:MO(e),variant:"default",badge:null};var i})??[])(yc(c?.rawOtlp)),[c?.rawOtlp]),[u,h]=l([]);return t(ln,{isOpen:e,width:"40vw",header:{icon:Pu,title:"Observation data",subTitle:`Trace ID: ${n?.traceId}`,onClose:i},children:n&&c?t($,{$gap:12,children:t(Mn,{bgTint:"900",richTitle:KN("Trace view","Spans for this observation",zh),withCollapse:!0,collapseIsDefaultOpen:!0,children:t(Mn,{bgTint:"800",overflow:"auto",children:t(vc,{rows:p,expandedRowIds:u,onToggleRow:e=>h(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])})})})}):t(oi,{children:d?t(Ve,{withSpinner:!0}):t(Z,{})})})};var BO;(e=>{e.TraceId="traceId",e.TransactionId="transactionId",e.ObservedAt="observedAt",e.DurationMs="durationMs",e.SampleReason="sampleReason"})(BO||(BO={}));const VO=e=>e?.map((e,i)=>({id:`${e.transactionId}-${e.traceId}-${i}`,cells:[{key:BO.TraceId,rawValue:e.traceId},{key:BO.TransactionId,rawValue:e.transactionId},{key:BO.ObservedAt,rawValue:e.observedAt?new Date(e.observedAt).toLocaleString():""},{key:BO.DurationMs,rawValue:`${e.durationMs}ms`},{key:BO.SampleReason,rawValue:e.sampleReason,component:()=>t(E,{label:e.sampleReason})}]}))??[];var UO;(e=>{e.Examples="examples",e.Anomalies="anomalies"})(UO||(UO={}));const GO=({transactionId:i})=>{const{insightsApi:n}=Hh(),{data:o,loading:r,refetch:s}=n.useObservations({transactionId:i},{pollInterval:3e4}),{observationsColumns:c,observationsRows:d}=a(()=>({observationsColumns:[{key:BO.TraceId,label:"Trace ID",noFilter:!0},{key:BO.ObservedAt,label:"Observed at",noFilter:!0},{key:BO.DurationMs,label:"Duration",noFilter:!0},{key:BO.SampleReason,label:"Sample reason"}],observationsRows:VO(o)}),[o]),[p,u]=l(UO.Examples),[h,g]=l(null),{examplesRows:m,anomaliesRows:b}=a(()=>{const e=[],t=[];return d.forEach(i=>{const n=i.cells.find(e=>e.key===BO.SampleReason)?.rawValue;[Tc.Example].includes(n)&&e.push(i),[Tc.AnomalyEvidence,Tc.GuardrailEvidence].includes(n)&&t.push(i)}),{examplesRows:e,anomaliesRows:t}},[d]);return e(Mn,{bgTint:"900",richTitle:KN("Trace observations","Representative sample of normal traffic - up to 10 collected while learning, then collection stops."),actions:[{id:"refetch-observations",type:St.Button,buttonProps:{tooltip:"Refetch",hideTooltipIcon:!0,leftIcon:Zu,variant:K.Secondary,onClick:s,loading:r}}],renderOnRightSide:t(F,{options:(f=m.length,v=b.length,[{label:"Examples",value:UO.Examples,badge:{label:f.toString()}},{label:"Anomaly issues",value:UO.Anomalies,badge:{label:v.toString()}}]),selected:p,setSelected:u,size:Zt.L}),children:[t(Mn,{bgTint:"800",children:t(za,{maxHeight:"35vh",variant:Ra.Data,isLoading:r,columns:c,rows:p===UO.Examples?m:b,getRowActions:e=>[{id:`${e.id}-view-trace`,label:"View trace",rightIcon:Yu,variant:K.Primary,onClick:()=>{const t=e.cells.find(e=>e.key===BO.TransactionId)?.rawValue,i=e.cells.find(e=>e.key===BO.TraceId)?.rawValue,n=o?.find(e=>e.transactionId===t&&e.traceId===i)??null;g(n)}}]})}),t(FO,{isOpen:!!h,onClose:()=>g(null),observation:h})]});var f,v},jO=()=>{const{drawerIsOpenFor:e,closeDrawer:i}=J$(),{insightsApi:n}=Hh(),{data:o,loading:l}=n.useTransactions(void 0,{fetchPolicy:"cache-first"}),r=a(()=>{if(e.id)return o?.find(t=>t.id===e.id)},[o,e.id]);return t(ln,{width:"60vw",isOpen:!0,header:{onClose:i,icon:Pu,title:"Transaction data",subTitle:`Transaction ID: ${r?.id}`},children:r?t(HO,{transaction:r}):t(oi,{children:l?t(Ve,{withSpinner:!0}):t(Z,{title:"No transaction found",subTitle:`No transaction found for this ID ${e.id}`})})})},HO=({transaction:i})=>{const n=v();return e(Mn,{bgTint:"1000",moreSpacing:!0,children:[e(T,{$gap:8,children:[t(iN,{service:i.service,namespace:i.namespace,typographySize:C.M,size:28}),t(Ng,{operationName:i.operationName,identityDimensions:i.identityDimensions}),t(E,{backgroundColor:n.v2.colors.blue[900],label:i.kind}),t(Xi,{disabled:!0,label:`Transaction ID: ${i.id}`})]}),t(_O,{transactionId:i.id}),t(GO,{transactionId:i.id})]})},WO=f($)`
|
|
2128
|
+
`,$O={visibility:"hidden"},NO=b(({data:n})=>{const{svc:a,op:o,sameServiceAsSource:l}=n,r=!l,s=tN(a);return e(i,{children:[t(wm,{type:"source",position:Cm.Right,style:$O}),t(wm,{type:"target",position:Cm.Left,style:$O}),t(IO,{$withService:r,children:e($,{$gap:8,children:[r&&e(T,{$gap:8,children:[t(ga,{icons:s,size:20}),t(w,{size:C.XXXS,color:k.Secondary,nowrap:!0,children:a})]}),t(Xi,{label:o,variant:_i.Green})]})})]})});var AO;NO.displayName=NO.name,(e=>{e.Call="service-call"})(AO||(AO={}));const OO={[AO.Call]:NO},EO=({callEdges:e})=>{const i=v(),[n,r]=l([]),[s,c]=l([]),[d,p]=l(0),u=a(()=>e.map(e=>`${e.from.svc}|${e.from.op}->${e.to.svc}|${e.to.op}`).join("::"),[e]);return o(()=>{let t=!1;return(async()=>{const{nodes:n,edges:a,rootIds:o}=((e,t)=>{const i=new Map,n=new Set,a=[],o=new Map,l=new Map,r=t.v2.colors.silver[400],s=(e,t)=>{const n=((e,t)=>`${e}::${t}`)(e,t);return i.has(n)||(i.set(n,{id:n,type:AO.Call,position:{x:0,y:0},data:{svc:e,op:t,isRoot:!1,sameServiceAsSource:!1},measured:{width:220,height:64}}),o.set(n,0),l.set(n,new Set)),n};for(const t of e){const e=t.from?.svc?.trim()??"",i=t.from?.op?.trim()??"",c=t.to?.svc?.trim()??"",d=t.to?.op?.trim()??"";if(!(e&&i&&c&&d))continue;const p=s(e,i),u=s(c,d);if(p===u)continue;const h=`${p}->${u}`;n.has(h)||(n.add(h),o.set(u,(o.get(u)??0)+1),l.get(u)?.add(e),a.push({id:h,type:"smoothstep",source:p,target:u,markerEnd:{type:km.ArrowClosed,color:r,width:16,height:16},style:{stroke:r,strokeWidth:1}}))}const c=[];for(const[e,t]of i){const i=0===(o.get(e)??0),n=l.get(e)??new Set,a=!i&&n.size>0&&[...n].every(e=>e===t.data.svc);t.data={...t.data,isRoot:i,sameServiceAsSource:a},i&&c.push(e)}return{nodes:Array.from(i.values()),edges:a,rootIds:c}})(e,i);if(!n.length)return void(t||(r([]),c([])));const l=await bm(n,a,{direction:"RIGHT",nodeWidth:220,nodeHeight:64,rootIds:o,rootLayerConstraint:"FIRST",spacing:{betweenLayers:120,nodeNode:24,edgeEdge:24,edgeNode:32}});t||(r(l.nodes),c(l.edges),p(e=>e+1))})(),()=>{t=!0}},[u,e,i]),t(mm,{height:420,interactive:!1,nodeTypes:OO,nodes:n,edges:s,fitViewTrigger:d,minZoom:.2,maxZoom:1.5})},DO=({edges:e})=>(a(()=>{const t=new Set;for(const i of e)t.add(`${i.from.svc}::${i.from.op}`),t.add(`${i.to.svc}::${i.to.op}`);return t.size},[e]),e.length?t(EO,{callEdges:e}):t(oi,{children:t(Z,{subTitle:"No service call edges to visualize."})}));var zO;(e=>{e.Table="table",e.Map="map"})(zO||(zO={}));const RO=[{label:"Table",value:zO.Table},{label:"Map",value:zO.Map}];var PO;(e=>{e.FromService="fromService",e.FromOperation="fromOperation",e.ToService="toService",e.ToOperation="toOperation"})(PO||(PO={}));const XO=[{key:PO.FromService,label:"From service"},{key:PO.FromOperation,label:"From operation"},{key:PO.ToService,label:"To service"},{key:PO.ToOperation,label:"To operation"}],LO=({edges:e})=>{const[i,n]=l(zO.Map),o=a(()=>(e=>e.map((e,i)=>({id:`${e.from.svc}-${e.from.op}->${e.to.svc}-${e.to.op}-${i}`,cells:[{key:PO.FromService,rawValue:e.from.svc||"-",component:e.from.svc?()=>t(iN,{service:e.from.svc}):void 0},{key:PO.FromOperation,rawValue:e.from.op||"-",component:()=>t(Xi,{label:e.from.op||"-",variant:e.from.op?_i.Green:void 0})},{key:PO.ToService,rawValue:e.to.svc||"-",component:e.to.svc?()=>t(iN,{service:e.to.svc}):void 0},{key:PO.ToOperation,rawValue:e.to.op||"-",component:()=>t(Xi,{label:e.to.op||"-",variant:e.to.op?_i.Green:void 0})}]})))(e),[e]),r=d(()=>i===zO.Table?t(za,{maxHeight:"420px",variant:Ra.Data,columns:XO,rows:o}):t(DO,{edges:e}),[i,e,o]);return t(Mn,{bgTint:"900",richTitle:KN("Service call edges","Observed call graph between operations"),withCollapse:!0,collapseIsDefaultOpen:!0,renderOnRightSide:t(F,{options:RO,selected:i,setSelected:n,size:Zt.L}),children:r()})},_O=({isOpen:i,onClose:n,baseline:o})=>{const{CopyButton:l}=En(),{histogram:r,data:s}=o||{},c=!!r?.series?.length,d=!!s,p=c||d,{parsedJson:u,jsonIsDbAccess:h,jsonIsServiceCalls:g,jsonIsOutboundPeers:m,jsonIsLibraries:b}=a(()=>{const e=xn(s,{});return{parsedJson:e,jsonIsDbAccess:!!e?.accesses?.length&&!!e?.query_shapes?.length,jsonIsServiceCalls:!!e?.edges?.length,jsonIsOutboundPeers:!!e?.peers?.length,jsonIsLibraries:!!e?.libs?.length}},[o]),f=!(c||h||g||m||b);return t(ln,{isOpen:i,width:c||h||g||m?"90vw":"40vw",header:{icon:Dh,title:"Baseline data",subTitle:`Deviation class: ${o?.class}`,onClose:n},children:o&&p?e($,{$gap:12,children:[g&&t(LO,{edges:u.edges||[]}),m&&t(TO,{peers:u.peers||[]}),b&&t(UA,{libraries:u.libs||[]}),h&&t(cO,{parsedJson:u}),c&&t(FA,{histogram:r,classDescription:o.classDescription}),d&&t(Mn,{bgTint:"900",richTitle:KN("JSON data","Raw baseline payload"),withCollapse:!0,collapseIsDefaultOpen:f,children:t(Mn,{bgTint:"800",overflow:"auto",children:e(T,{$width:"100%",$alignItems:"flex-start",$justifyContent:"space-between",children:[t(kc,{language:"json",code:s}),t(l,{value:s})]})})})]}):t(Z,{})})},MO=({transactionId:i})=>{const n=v(),{insightsApi:o}=Hh(),{data:r,loading:s,refetch:c}=o.useBaseline({transactionId:i},{pollInterval:3e4}),{baselinesColumns:d,baselinesRows:p}=a(()=>({baselinesColumns:[{key:CN.Class,label:"Class"},{key:CN.Status,label:"Status"},{key:CN.Learning,label:"Learning stability",noFilter:!0,noSort:!0},{key:CN.ObservationCount,label:"Observations",noFilter:!0},{key:CN.LearningStartedAt,label:"First observed",noFilter:!0}],baselinesRows:kN(0,r)}),[n,r]),u=a(()=>!!r?.length&&r.every(e=>e.promoted),[r]),[h,g]=l(!1),[m,b]=l(!1),[f,y]=l(null),[S,x]=l(null),[w,C]=l(null);return t(Mn,{bgTint:"900",richTitle:KN("Baseline (One row per deviation class)",'"Learning stability" shows how converged each class\'s baseline is. Locked means the class is promoted and frozen. While learning, progress shows observations and quiet time toward the resolved policy — a full bar is not promotion until the engine graduates the class.'),actions:[{id:"promote-all-baselines",type:St.Button,buttonProps:{label:"Promote all baselines",leftIcon:Ou,variant:K.Primary,disabled:u||!o.promoteTransactionBaselines,onClick:()=>b(!0)}},{id:"reset-all-baselines",type:St.Button,buttonProps:{label:"Reset all baselines",leftIcon:lh,variant:K.Secondary,onClick:()=>g(!0)}},{id:"refetch-baselines",type:St.Button,buttonProps:{tooltip:"Refetch",hideTooltipIcon:!0,leftIcon:Zu,variant:K.Secondary,onClick:c,loading:s}}],children:e(Mn,{bgTint:"800",children:[t(za,{maxHeight:"35vh",variant:Ra.Data,isLoading:s,columns:d,rows:p,getRowActions:e=>{const t=e.cells.find(e=>e.key===CN.Class)?.rawValue,i=r?.find(e=>e.class===t),n=i?.learning?.phase,a=n===uc.Promoted;return[{id:`${e.id}-view-data`,label:"View data",leftIcon:Yu,variant:K.Primary,onClick:()=>C(i??null)},{id:`${e.id}-promote-now`,label:"Promote now",leftIcon:Ou,disabled:a||!o.promoteBaselineClass,onClick:()=>x(t)},{id:`${e.id}-re-learn`,label:"Re-learn (reset)",leftIcon:lh,onClick:()=>y(t)}]}}),t(_O,{isOpen:!!w,onClose:()=>C(null),baseline:w}),t(Ce,{isOpen:m,onClose:()=>b(!1),title:"Promote all baseline classes",description:"Promote every scored baseline class on this transaction? Learning gates will be skipped and baselines will freeze.",approveButton:{label:"Promote all",onClick:()=>(async()=>{b(!1),await(o?.promoteTransactionBaselines?.(i)),c()})()},denyButton:{label:"Cancel",onClick:()=>b(!1),variant:K.Secondary}}),t(Ce,{isOpen:h,onClose:()=>g(!1),title:"Reset transaction baselines",description:"Are you sure you want to reset all baselines for this transaction?",approveButton:{label:"Reset all baselines",onClick:()=>(async()=>{g(!1),await(o?.resetTransactionBaselines?.(i)),c()})()},denyButton:{label:"Cancel",onClick:()=>g(!1),variant:K.Secondary}}),t(Ce,{isOpen:null!==f,onClose:()=>y(null),title:"Reset baseline class",description:"Are you sure you want to reset the baseline class?",approveButton:{label:"Reset baseline class",onClick:()=>(async e=>{y(null),await(o?.resetBaselineClass?.(i,e)),c()})(f)},denyButton:{label:"Cancel",onClick:()=>y(null),variant:K.Secondary}}),t(Ce,{isOpen:null!==S,onClose:()=>x(null),title:"Promote baseline class",description:"Promote this class now? Learning gates will be skipped and the baseline will freeze.",approveButton:{label:"Promote now",onClick:()=>(async e=>{x(null),await(o?.promoteBaselineClass?.({transactionId:i,class:e})),c()})(S)},denyButton:{label:"Cancel",onClick:()=>x(null),variant:K.Secondary}})]})})},FO=e=>(e.attrs??[]).filter(e=>!!e?.key).map(e=>({key:e.key??null,value:e.value??null})),BO=({isOpen:e,onClose:i,observation:n})=>{const o=n?.transactionId,r=n?.traceId,{insightsApi:s}=Hh(),{data:c,loading:d}=s.useObservation({transactionId:o,traceId:r},{skip:!e||!o||!r}),p=a(()=>(e=>e?.spans?.map((e,t)=>{return{id:e.spanId||`span-${t}`,index:t+1,service:e.service??null,name:e.name,duration:(i=e.durationMs,null==i||Number.isNaN(i)?null:fc(1e6*Math.max(0,i))),depth:e.depth??0,scope:e.scope??null,attributes:FO(e),variant:"default",badge:null};var i})??[])(yc(r,c?.rawOtlp)),[r,c?.rawOtlp]),[u,h]=l([]);return t(ln,{isOpen:e,width:"40vw",header:{icon:Pu,title:"Observation data",subTitle:`Trace ID: ${n?.traceId}`,onClose:i},children:n&&c?t($,{$gap:12,children:t(Mn,{bgTint:"900",richTitle:KN("Trace view","Spans for this observation",zh),withCollapse:!0,collapseIsDefaultOpen:!0,children:t(Mn,{bgTint:"800",overflow:"auto",children:t(vc,{traceId:r,rows:p,expandedRowIds:u,onToggleRow:e=>h(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])})})})}):t(oi,{children:d?t(Ve,{withSpinner:!0}):t(Z,{})})})};var VO;(e=>{e.TraceId="traceId",e.TransactionId="transactionId",e.ObservedAt="observedAt",e.DurationMs="durationMs",e.SampleReason="sampleReason"})(VO||(VO={}));const UO=e=>e?.map((e,i)=>({id:`${e.transactionId}-${e.traceId}-${i}`,cells:[{key:VO.TraceId,rawValue:e.traceId},{key:VO.TransactionId,rawValue:e.transactionId},{key:VO.ObservedAt,rawValue:e.observedAt?new Date(e.observedAt).toLocaleString():""},{key:VO.DurationMs,rawValue:`${e.durationMs}ms`},{key:VO.SampleReason,rawValue:e.sampleReason,component:()=>t(E,{label:e.sampleReason})}]}))??[];var GO;(e=>{e.Examples="examples",e.Anomalies="anomalies"})(GO||(GO={}));const jO=({transactionId:i})=>{const{insightsApi:n}=Hh(),{data:o,loading:r,refetch:s}=n.useObservations({transactionId:i},{pollInterval:3e4}),{observationsColumns:c,observationsRows:d}=a(()=>({observationsColumns:[{key:VO.TraceId,label:"Trace ID",noFilter:!0},{key:VO.ObservedAt,label:"Observed at",noFilter:!0},{key:VO.DurationMs,label:"Duration",noFilter:!0},{key:VO.SampleReason,label:"Sample reason"}],observationsRows:UO(o)}),[o]),[p,u]=l(GO.Examples),[h,g]=l(null),{examplesRows:m,anomaliesRows:b}=a(()=>{const e=[],t=[];return d.forEach(i=>{const n=i.cells.find(e=>e.key===VO.SampleReason)?.rawValue;[Tc.Example].includes(n)&&e.push(i),[Tc.AnomalyEvidence,Tc.GuardrailEvidence].includes(n)&&t.push(i)}),{examplesRows:e,anomaliesRows:t}},[d]);return e(Mn,{bgTint:"900",richTitle:KN("Trace observations","Representative sample of normal traffic - up to 10 collected while learning, then collection stops."),actions:[{id:"refetch-observations",type:St.Button,buttonProps:{tooltip:"Refetch",hideTooltipIcon:!0,leftIcon:Zu,variant:K.Secondary,onClick:s,loading:r}}],renderOnRightSide:t(F,{options:(f=m.length,v=b.length,[{label:"Examples",value:GO.Examples,badge:{label:f.toString()}},{label:"Anomaly issues",value:GO.Anomalies,badge:{label:v.toString()}}]),selected:p,setSelected:u,size:Zt.L}),children:[t(Mn,{bgTint:"800",children:t(za,{maxHeight:"35vh",variant:Ra.Data,isLoading:r,columns:c,rows:p===GO.Examples?m:b,getRowActions:e=>[{id:`${e.id}-view-trace`,label:"View trace",rightIcon:Yu,variant:K.Primary,onClick:()=>{const t=e.cells.find(e=>e.key===VO.TransactionId)?.rawValue,i=e.cells.find(e=>e.key===VO.TraceId)?.rawValue,n=o?.find(e=>e.transactionId===t&&e.traceId===i)??null;g(n)}}]})}),t(BO,{isOpen:!!h,onClose:()=>g(null),observation:h})]});var f,v},HO=()=>{const{drawerIsOpenFor:e,closeDrawer:i}=J$(),{insightsApi:n}=Hh(),a=e.id??"",{data:o,loading:l}=n.useTransaction({id:a},{skip:!a});return t(ln,{width:"60vw",isOpen:!0,header:{onClose:i,icon:Pu,title:"Transaction data",subTitle:`Transaction ID: ${o?.id}`},children:o?t(WO,{transaction:o}):t(oi,{children:l?t(Ve,{withSpinner:!0}):t(Z,{title:"No transaction found",subTitle:`No transaction found for this ID ${e.id}`})})})},WO=({transaction:i})=>{const n=v();return e(Mn,{bgTint:"1000",moreSpacing:!0,children:[e(T,{$gap:8,children:[t(iN,{service:i.service,namespace:i.namespace,typographySize:C.M,size:28}),t(Ng,{operationName:i.operationName,identityDimensions:i.identityDimensions}),t(E,{backgroundColor:n.v2.colors.blue[900],label:i.kind}),t(Xi,{disabled:!0,label:`Transaction ID: ${i.id}`})]}),t(MO,{transactionId:i.id}),t(jO,{transactionId:i.id})]})},KO=f($)`
|
|
2129
2129
|
flex: 1;
|
|
2130
2130
|
min-width: 0;
|
|
2131
2131
|
min-height: 0;
|
|
@@ -2133,46 +2133,46 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2133
2133
|
overflow: hidden;
|
|
2134
2134
|
border-radius: 16px;
|
|
2135
2135
|
background-color: ${({theme:e})=>e.v2.colors.silver[1e3]};
|
|
2136
|
-
`,
|
|
2136
|
+
`,YO=f(T)`
|
|
2137
2137
|
width: 100%;
|
|
2138
2138
|
flex-shrink: 0;
|
|
2139
2139
|
align-items: center;
|
|
2140
2140
|
gap: 24px;
|
|
2141
2141
|
padding: 12px 12px 16px 12px;
|
|
2142
|
-
`,
|
|
2142
|
+
`,JO=f(T)`
|
|
2143
2143
|
flex-shrink: 0;
|
|
2144
2144
|
align-items: center;
|
|
2145
2145
|
gap: 8px;
|
|
2146
|
-
`,
|
|
2146
|
+
`,qO=f(w)`
|
|
2147
2147
|
flex: 1;
|
|
2148
2148
|
min-width: 0;
|
|
2149
2149
|
white-space: pre-line;
|
|
2150
|
-
`,
|
|
2150
|
+
`,ZO=f($)`
|
|
2151
2151
|
flex: 1;
|
|
2152
2152
|
min-height: 0;
|
|
2153
2153
|
width: 100%;
|
|
2154
2154
|
overflow: hidden;
|
|
2155
|
-
`,
|
|
2155
|
+
`,QO=f(T)`
|
|
2156
2156
|
flex: 1;
|
|
2157
2157
|
min-height: 0;
|
|
2158
2158
|
width: 100%;
|
|
2159
2159
|
align-items: stretch;
|
|
2160
|
-
`,
|
|
2160
|
+
`,eE=f($)`
|
|
2161
2161
|
min-width: 350px;
|
|
2162
2162
|
max-width: 500px;
|
|
2163
2163
|
gap: 16px;
|
|
2164
2164
|
padding: 12px;
|
|
2165
2165
|
height: 100%;
|
|
2166
2166
|
overflow-y: auto;
|
|
2167
|
-
`,
|
|
2167
|
+
`,tE=f($)`
|
|
2168
2168
|
width: 100%;
|
|
2169
2169
|
gap: 8px;
|
|
2170
|
-
`,
|
|
2170
|
+
`,iE=f(T)`
|
|
2171
2171
|
width: 100%;
|
|
2172
2172
|
align-items: center;
|
|
2173
2173
|
gap: 4px;
|
|
2174
2174
|
padding: 8px 12px;
|
|
2175
|
-
`,
|
|
2175
|
+
`,nE=f(H)`
|
|
2176
2176
|
&&:enabled {
|
|
2177
2177
|
background-color: ${({theme:e})=>e.v2.colors.purple[900]};
|
|
2178
2178
|
&:hover {
|
|
@@ -2182,7 +2182,7 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2182
2182
|
background-color: ${({theme:e})=>e.v2.colors.purple[700]};
|
|
2183
2183
|
}
|
|
2184
2184
|
}
|
|
2185
|
-
`,
|
|
2185
|
+
`,aE=f.button`
|
|
2186
2186
|
display: flex;
|
|
2187
2187
|
align-items: center;
|
|
2188
2188
|
justify-content: space-between;
|
|
@@ -2198,7 +2198,7 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2198
2198
|
&:hover {
|
|
2199
2199
|
background-color: ${({theme:e,$isSelected:t})=>t?e.v2.colors.silver[800]:e.v2.colors.silver[900]};
|
|
2200
2200
|
}
|
|
2201
|
-
`,
|
|
2201
|
+
`,oE=f.div`
|
|
2202
2202
|
flex: 1;
|
|
2203
2203
|
min-width: 0;
|
|
2204
2204
|
min-height: 0;
|
|
@@ -2206,40 +2206,40 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2206
2206
|
flex-direction: column;
|
|
2207
2207
|
border-radius: 16px 0 16px 0;
|
|
2208
2208
|
background-color: ${({theme:e})=>e.v2.colors.silver[900]};
|
|
2209
|
-
`,
|
|
2209
|
+
`,lE=({id:i,selectedId:n,onSelect:a,header:o,subDivisions:l})=>e(aE,{type:"button","data-id":`menu-item-${i}`,$isSelected:n===i,onClick:()=>a(i),children:[e($,{$gap:8,children:[e(T,{$gap:4,children:[t(w,{size:C.XXS,nowrap:!0,children:o.label}),o.badges?.map(e=>e&&t(E,{...e,textSize:C.XXS},`${i}-${e.label}`))]}),t(T,{$gap:6,$wrap:"wrap",children:l?.length?l.map(n=>e(T,{$gap:4,children:[t(w,{size:C.XXXS,color:k.Secondary,nowrap:!0,children:n.label}),n.badges?.map(e=>e&&t(E,{...e,textSize:C.XXXS},`${i}-${e.label}`))]},n.label)):t(w,{size:C.XXXS,color:k.Secondary,nowrap:!0,children:"No rules"})})]}),t(yu,{size:18})]}),rE=({loading:i,sections:n})=>{const a=v();return t(eE,{"data-id":"menu-root",children:n.map((o,l)=>e(r,{children:[e(tE,{"data-id":`menu-${o.id}-section`,children:[o.addButton&&t(nE,{"data-id":`menu-${o.id}-add-button`,fullWidth:!0,leftIcon:wu,size:W.M,variant:K.Primary,textColor:a.v2.colors.purple[300],...o.addButton}),e(iE,{children:[t(w,{size:C.XXS,color:a.v2.colors.purple[300],children:o.title}),t(E,{label:o.titleCount})]}),o.list.length?o.list.map(e=>t(lE,{...e},e.id)):i?t(A,{size:3}):t(Z,{hideIcon:!0,...o.noData})]}),l<n.length-1&&t(J,{})]},`menu-${o.id}-section`))})},sE=({loading:e,showDetail:n=!0,emptyTitle:a,emptySubTitle:o,children:l})=>n?t(i,{children:l}):e?t(oi,{$height:"100%",children:t(Ve,{withSpinner:!0})}):a?t(oi,{$height:"100%",children:t(Z,{hideIcon:!0,title:a,subTitle:o})}):null,cE=({icon:i,title:n,count:a,description:o,loading:l,sections:r,showDetail:s=!0,emptyTitle:c,emptySubTitle:d,children:p})=>{const u=v();return e(KO,{"data-id":`settings-content-panel-${n}`,children:[e(YO,{children:[(i||n||"number"==typeof a)&&e(JO,{children:[i&&t(i,{size:18}),n&&t(w,{size:C.S,children:n}),"number"==typeof a&&t(E,{label:a})]}),o&&t(qO,{size:C.XXS,color:u.v2.colors.silver[300],children:o})]}),t(ZO,{children:e(QO,{children:[r&&t(rE,{loading:l,sections:r}),t(oE,{children:t(sE,{loading:l,showDetail:s,emptyTitle:c,emptySubTitle:d,children:p})})]})})]})},dE="System",pE="Storage";var uE;(e=>{e.Detection="detection",e.Guardrails="guardrails",e.Learning="learning",e.System="system",e.Storage="storage"})(uE||(uE={}));const hE=uE.Guardrails,gE=[{id:"threat-detection",title:"Threat detection",icon:Mu,items:[{id:uE.Detection,title:"Detection",description:"When a finding fires",panelIcon:Mu,panelDescription:Ic},{id:uE.Guardrails,title:"Guardrails",description:"L7 allowlist rules (Enforce / Suggest)",panelIcon:Rh,panelDescription:$c}]},{id:"learning",title:"Learning",icon:ku,items:[{id:uE.Learning,title:"Learning",description:"Control baseline learning",panelIcon:ku,panelDescription:Nc}]},{id:"advanced",title:"Advanced",icon:Ph,items:[{id:uE.System,title:dE,description:"Sampling, retention, capacity",panelIcon:Ph,panelDescription:"Engine-wide operational configuration. Detection thresholds and learning rules live on their own tabs."},{id:uE.Storage,title:pE,description:"ClickHouse health",panelIcon:Eh}]}],mE=e=>gE.flatMap(e=>e.items).find(t=>t.id===e),bE=()=>{const e=mE(uE.System),{insightsApi:i}=Hh(),{data:n,loading:a,unsupported:o,error:l}=i.useSystemSettings();return t(cE,{icon:e?.panelIcon,title:e?.title||dE,description:e?.panelDescription,loading:a&&!n&&!o,showDetail:!!n||o||!a,children:t(Qf,{settings:n??null,unsupported:o,error:l,onSave:async e=>{i.updateSystemSettings&&await i.updateSystemSettings(e)}})})},fE=f(T)`
|
|
2210
2210
|
padding: 8px 12px 4px 12px;
|
|
2211
|
-
`,
|
|
2211
|
+
`,vE=({icon:i,title:n,count:a})=>{const o=v().v2.colors.purple[200];return e(fE,{$gap:8,children:[t(i,{size:14,fill:o}),t(w,{size:C.XXS,color:o,children:n}),t(E,{label:a})]})},yE=f($)`
|
|
2212
2212
|
width: 280px;
|
|
2213
2213
|
flex-shrink: 0;
|
|
2214
2214
|
height: 100%;
|
|
2215
2215
|
gap: 16px;
|
|
2216
2216
|
overflow-y: auto;
|
|
2217
|
-
`,
|
|
2217
|
+
`,SE=f(T)`
|
|
2218
2218
|
padding: 4px 12px;
|
|
2219
|
-
`,
|
|
2219
|
+
`,xE=f($)`
|
|
2220
2220
|
gap: 0;
|
|
2221
|
-
`,xE=({selected:i,onSelect:n})=>{const a=v();return e(vE,{"data-id":"insights-settings-menu",children:[e(yE,{$gap:8,children:[t(Qu,{size:16,fill:a.v2.colors.silver[200]}),t(w,{size:C.XS,children:"Settings Menu"})]}),hE.map(a=>e(SE,{"data-id":`settings-menu-category-${a.id}`,children:[t(fE,{icon:a.icon,title:a.title,count:a.items.length}),a.items.map(e=>t(Mm,{dataId:`settings-menu-item-${e.id}`,title:e.title,description:e.description,withCarret:!0,isSelected:i===e.id,onClick:()=>n(e.id)},e.id))]},a.id))]})},wE=e=>{const t={invertColors:!0};switch(e){case qt.Global:return{...t,label:Dt,status:ie.Warning};case qt.Service:return{...t,label:Ot,status:ie.Info};case qt.Transaction:return{...t,label:Et,status:ie.Info};default:return t}},CE=()=>{const e=v(),i=gE(pE.Learning),{insightsApi:n}=Hh(),{data:r,loading:s,refetch:c}=n.useLearningPolicies(),d=n.useServices(),p=n.useTransactions(),u=Array.isArray(r)?r:[],[h,g]=l(!1),[m,b]=l(null),[f,y]=l(null),S=a(()=>Array.isArray(d.data)?d.data:[],[d.data]),x=a(()=>Array.isArray(p.data)?p.data:[],[p.data]),w=a(()=>Rg(u.map(Pg),x),[u,x]),{defaultPolicies:C,overridePolicies:k,allPolicies:T}=a(()=>(e=>{const t=(e=>{const t=new Map(rg.map((e,t)=>[e,t]));return[...e].sort((e,i)=>(t.get(e.class)??99)-(t.get(i.class)??99))})(e.filter(Eg)),i=e.filter(e=>!Eg(e));return{defaultPolicies:t,overridePolicies:i,allPolicies:[...t,...i]}})(w),[w]);o(()=>{b(e=>((e,t,i)=>e||!t.length?null:i&&t.some(e=>e.id===i)?i:t[0].id)(h,T,e))},[h,T]);const I=a(()=>T.find(e=>e.id===m)??null,[T,m]),$=a(()=>((e,t,i,n,a)=>e?i.find(e=>e.id===t)??a[0]??null:n??a[0]??null)(h,f,T,I,C),[h,f,T,I,C]),N=a(()=>(e=>e.map(e=>({class:e.class,scopeKey:e.scopeKey})))(k),[k]),A=()=>{y(m??C[0]?.id??null),g(!0),b(null)},O=e=>{g(!1),y(null),b(e)},E=a(()=>(({defaultPolicies:e,overridePolicies:t,selectedId:i,onSelect:n,onAddOverride:a,modeBadgeColors:o})=>{const l=e.map(e=>({id:e.id,selectedId:i,onSelect:n,header:{label:e.name,badges:[Eg(e)?wE(e.scope):null,{label:zt[e.mode],invertColors:!0,backgroundColor:o.backgroundColor,textColor:o.textColor}]},subDivisions:[{label:e.summary}]})),r=t.map(e=>({id:e.id,selectedId:i,onSelect:n,header:{label:e.name},subDivisions:[{label:e.summary}]}));return[{id:"default-policies",title:Ec,titleCount:l.length,noData:{title:Oc,subTitle:Ac},list:l},{id:"override-policies",title:Pc,titleCount:r.length,addButton:{label:Rc,onClick:a},noData:{title:zc,subTitle:Dc},list:r}]})({defaultPolicies:C,overridePolicies:k,selectedId:h?null:m,onSelect:O,onAddOverride:A,modeBadgeColors:{backgroundColor:e.v2.colors.blue[900],textColor:e.v2.colors.blue[300]}}),[C,k,h,m,e]);return t(sE,{icon:i?.panelIcon,title:Lc,count:T.length,description:i?.panelDescription||Nc,loading:s,sections:E,showDetail:h||!!I,emptyTitle:Xc,children:h?t(Xf,{services:S,transactions:x,existingOverrides:N,initialClass:$?.class,onSubmit:async e=>{if(!n.upsertLearningPolicy)return;const t=((e,t,i)=>t.find(t=>t.class===e.class)??i.find(t=>t.class===e.class&&Eg(t))??Dg(e.class))(e,C,T),i=((e,t)=>e.find(e=>e.class===t.class&&e.scope===t.scope&&e.scopeKey===t.scopeKey)??null)(k,e);if(i)return g(!1),void b(i.id);const a=(e=>zg({scope:e.scope,scopeKey:e.scopeKey,source:{...e.source,class:e.class},displayName:e.name}))({...e,source:t}),o=await n.upsertLearningPolicy(Xg(a));o&&!o.error&&(await c(),g(!1),y(null),b(o.data?Pg(o.data).id:a.id))}}):I?t(Xf,{policy:I,onSave:async e=>{if(!n.upsertLearningPolicy)return;const t=await n.upsertLearningPolicy(Xg(e));t&&!t.error&&await c()},onDelete:Eg(I)?void 0:()=>(async e=>{if(!n.deleteLearningPolicy)return;const t=await n.deleteLearningPolicy(e.class,e.scope,e.scopeKey);t?.error||(await c(),b(null))})(I)},I.id):null})},kE={[fg.Low]:Bc,[fg.Medium]:Fc,[fg.High]:Mc,[fg.Critical]:_c},TE=e=>{let t=fg.Medium,i=Number.POSITIVE_INFINITY;for(const[n,a]of Object.entries(Lg)){const o=Math.abs(a-e);o<i&&(t=n,i=o)}return t},IE=e=>`Triggers at ${kE[e]} risk or higher`,$E=e=>{const t=(e=>{switch(e){case bg.Global:return bg.Global;case bg.Transaction:return bg.Transaction;case bg.Service:default:return bg.Service}})(e.scope),i=TE(e.fireAtScore),n=(e=>{if(!e)return 0;try{const t=JSON.parse(e);if(t&&"object"==typeof t&&!Array.isArray(t))return Object.keys(t).length}catch{}return 0})(e.signalWeights);return{id:e.id,name:e.name,scope:t,scopeKey:e.scopeKey,enabled:e.enabled,summary:t===bg.Global?IE(i):rn(e.fireAtScore,n),fireAtScore:e.fireAtScore,riskLevel:i,signalWeightOverrideCount:n,signalWeights:e.signalWeights??null,enricherLists:e.enricherLists??null}},NE=e=>({id:e.id,name:e.name,enabled:e.enabled,fireAtScore:e.fireAtScore,signalWeights:e.signalWeights,enricherLists:e.enricherLists,scope:e.scope,scopeKey:e.scopeKey}),AE=e=>{const t={invertColors:!0};switch(e){case bg.Global:return{...t,label:Dt,status:ie.Warning};case bg.Service:return{...t,label:Ot,status:ie.Info};case bg.Transaction:return{...t,label:Et,status:ie.Info};default:return t}},OE=(e,t,i)=>{return{id:e.id,selectedId:t,onSelect:i,header:{label:e.name,badges:[AE(e.scope),(n=e.enabled,{label:n?De:ze,status:n?ie.Success:ie.Error,invertColors:!0})]},subDivisions:[{label:e.summary}]};var n},EE=()=>{const e=gE(pE.Detection),{insightsApi:i}=Hh(),{data:n,loading:r,refetch:s}=i.usePolicies(),c=i.useServices(),d=i.useTransactions(),p=Array.isArray(n)?n:[],[u,h]=l(!1),[g,m]=l(null),b=a(()=>p.map($E),[p]),{defaultPolicies:f,overridePolicies:v,allPolicies:y}=a(()=>(e=>{const t=e.filter(gg),i=e.filter(e=>!gg(e));return{defaultPolicies:t,overridePolicies:i,allPolicies:[...t,...i]}})(b),[b]),S=a(()=>Array.isArray(c.data)?c.data:[],[c.data]),x=a(()=>Array.isArray(d.data)?d.data:[],[d.data]),w=a(()=>v.map(e=>e.scopeKey),[v]);o(()=>{m(e=>((e,t,i)=>e||!t.length?null:i&&t.some(e=>e.id===i)?i:t[0].id)(u,y,e))},[u,y]);const C=a(()=>y.find(e=>e.id===g)??null,[y,g]),k=f[0]??null,T=()=>{h(!0),m(null)},I=e=>{h(!1),m(e)},$=a(()=>(({defaultPolicies:e,overridePolicies:t,selectedId:i,onSelect:n,onAddOverride:a})=>{const o=e.map(e=>OE(e,i,n)),l=t.map(e=>OE(e,i,n));return[{id:"default-policies",title:Ec,titleCount:o.length,noData:{title:Oc,subTitle:Vc},list:o},{id:"override-policies",title:Pc,titleCount:l.length,addButton:{label:un,onClick:a},noData:{title:zc,subTitle:Uc},list:l}]})({defaultPolicies:f,overridePolicies:v,selectedId:u?null:g,onSelect:I,onAddOverride:T}),[f,v,u,g]);return t(sE,{icon:e?.panelIcon,title:Gc,count:y.length,description:e?.panelDescription,loading:r,sections:$,showDetail:u||!!C,emptyTitle:Xc,children:u?t(sy,{services:S,transactions:x,existingScopeKeys:w,onSubmit:async e=>{if(!i.upsertPolicy)return;const t=((e,t,i)=>e.find(e=>e.scope===t&&e.scopeKey===i)??null)(v,e.scope,e.scopeKey);if(t)return h(!1),void m(t.id);const n=((e,t)=>(({scope:e,scopeKey:t,name:i,defaults:n})=>{const a=n?.fireAtScore??Lg[fg.Medium],o=TE(a),l=n?.signalWeightOverrideCount??0;return{id:`${e}:${t}`,name:i,scope:e,scopeKey:t,enabled:!0,summary:rn(a,l),fireAtScore:a,riskLevel:o,signalWeightOverrideCount:l,signalWeights:n?.signalWeights??null,enricherLists:n?.enricherLists??null}})({scope:e.scope,scopeKey:e.scopeKey,name:e.name,defaults:t}))(e,k),a=await i.upsertPolicy({...NE(n),id:null});a?.error||(await s(),h(!1),m(a?.data?$E(a.data).id:n.id))}}):C?t(sy,{policy:C,onSave:async e=>{if(!i.upsertPolicy)return;const t=await i.upsertPolicy(NE(e));t?.error||await s()},onDelete:gg(C)?void 0:()=>(async e=>{if(!i.deletePolicy)return;const t=await i.deletePolicy(e.scope,e.scopeKey);t?.error||(await s(),m(null))})(C)},`${C.id}-${C.name}-${C.enabled}-${C.fireAtScore}-${C.summary}`):null})},DE=()=>{const e=gE(pE.Guardrails),{insightsApi:i}=Hh(),{data:n,loading:r,unsupported:s,refetch:c}=i.useGuardrails(),d=i.useServices(),p=i.useServiceNames(),u=Array.isArray(n)?n:[],[h,g]=l([]),[m,b]=l(!1),[f,v]=l(null),[y,S]=l(""),[x,w]=l(""),C=a(()=>s?h:u,[s,h,u]),k=a(()=>(e=>e.map(_g))(C),[C]),T=a(()=>C.find(e=>e.scopeKey===f)??null,[C,f]),I=a(()=>Array.isArray(d.data)?d.data:[],[d.data]),$=a(()=>Array.isArray(p.data)?p.data:[],[p.data]),{namespace:N,service:A}=((e,t,i,n)=>{const a=n?Mg(n.scopeKey):null;return{namespace:e?t:a?.namespace||"",service:e?i:a?.service||""}})(m,y,x,T),O=i.useServiceProfile({namespace:N||null,service:A||""},{skip:!(m||T)||!A}),E=A?O.data??null:null;o(()=>{v(e=>((e,t,i)=>e||!t.length?null:i&&t.some(e=>e.id===i)?i:t[0].id)(m,k,e))},[m,k]),o(()=>{if(!m||!I.length)return;const e=((e,t,i)=>{if(!e.length)return{namespace:t,service:i};if(!t){const t=e[0]?.namespace||"";return{namespace:t,service:e.find(e=>e.namespace===t)?.service||""}}return i&&e.some(e=>e.namespace===t&&e.service===i)?{namespace:t,service:i}:{namespace:t,service:e.find(e=>e.namespace===t)?.service||""}})(I,y,x);e.namespace!==y&&S(e.namespace),e.service!==x&&w(e.service)},[m,I,y,x]);const D=()=>{b(!0),v(null)},z=e=>{b(!1),v(e)},R=async e=>{if(s)return g(t=>((e,t)=>[...e.filter(e=>e.scopeKey!==t.scopeKey),t])(t,e)),b(!1),void v(e.scopeKey);const t=await(i.upsertGuardrail?.(e));t?.error||(await c(),b(!1),v(e.scopeKey))},P=a(()=>(({guardrails:e,selectedId:t,onSelect:i,onCreate:n})=>{const a=e.map(e=>{const n=e.mode===Ue.Enforce;return{id:e.id,selectedId:t,onSelect:i,header:{label:e.scopeKey,badges:[{label:n?jc:Hc,status:n?ie.Error:ie.Default,useSecondaryTone:n,invertColors:!0}]},subDivisions:e.rules.map(e=>({label:e.label,badges:[{label:e.allowlistCount,status:ie.Unknown},e.isAuto?{label:Wc,tooltip:"Created automatically when this service finished learning. You can edit the allowlist or turn the rule off anytime.",status:ie.Info,invertColors:!0}:null]}))}});return[{id:"guardrails",title:Jc,titleCount:e.length,addButton:{label:Ct,onClick:n},noData:{title:Yc,subTitle:Kc},list:a}]})({guardrails:k,selectedId:m?null:f,onSelect:z,onCreate:D}),[k,m,f]);return t(sE,{icon:e?.panelIcon,title:Zc,count:k.length,description:$c,loading:r,sections:P,showDetail:m||!!T,emptyTitle:qc,children:m?t(of,{services:I,serviceNames:$,profile:E,profileLoading:!!x&&O.loading,namespace:y,service:x,onNamespaceChange:e=>{S(e),w(((e,t)=>e.find(e=>e.namespace===t)?.service||"")(I,e))},onServiceChange:w,onSubmit:R}):T?t(of,{guardrail:T,profile:E,profileLoading:!!A&&O.loading,services:I,serviceNames:$,onSubmit:R,onDelete:async e=>{if(s)return g(t=>((e,t)=>e.filter(e=>e.scopeKey!==t))(t,e)),void v(null);const t=await(i.deleteGuardrail?.(e));t?.error||(await c(),v(null))}},T.scopeKey):null})},zE=f($)`
|
|
2221
|
+
`,wE=({selected:i,onSelect:n})=>{const a=v();return e(yE,{"data-id":"insights-settings-menu",children:[e(SE,{$gap:8,children:[t(Qu,{size:16,fill:a.v2.colors.silver[200]}),t(w,{size:C.XS,children:"Settings Menu"})]}),gE.map(a=>e(xE,{"data-id":`settings-menu-category-${a.id}`,children:[t(vE,{icon:a.icon,title:a.title,count:a.items.length}),a.items.map(e=>t(Mm,{dataId:`settings-menu-item-${e.id}`,title:e.title,description:e.description,withCarret:!0,isSelected:i===e.id,onClick:()=>n(e.id)},e.id))]},a.id))]})},CE=e=>{const t={invertColors:!0};switch(e){case qt.Global:return{...t,label:Dt,status:ie.Warning};case qt.Service:return{...t,label:Ot,status:ie.Info};case qt.Transaction:return{...t,label:Et,status:ie.Info};default:return t}},kE=()=>{const e=v(),i=mE(uE.Learning),{insightsApi:n}=Hh(),{data:r,loading:s,refetch:c}=n.useLearningPolicies(),d=n.useServices(),p=n.useTransactions(),u=Array.isArray(r)?r:[],[h,g]=l(!1),[m,b]=l(null),[f,y]=l(null),S=a(()=>Array.isArray(d.data)?d.data:[],[d.data]),x=a(()=>Array.isArray(p.data)?p.data:[],[p.data]),w=a(()=>Rg(u.map(Pg),x),[u,x]),{defaultPolicies:C,overridePolicies:k,allPolicies:T}=a(()=>(e=>{const t=(e=>{const t=new Map(rg.map((e,t)=>[e,t]));return[...e].sort((e,i)=>(t.get(e.class)??99)-(t.get(i.class)??99))})(e.filter(Eg)),i=e.filter(e=>!Eg(e));return{defaultPolicies:t,overridePolicies:i,allPolicies:[...t,...i]}})(w),[w]);o(()=>{b(e=>((e,t,i)=>e||!t.length?null:i&&t.some(e=>e.id===i)?i:t[0].id)(h,T,e))},[h,T]);const I=a(()=>T.find(e=>e.id===m)??null,[T,m]),$=a(()=>((e,t,i,n,a)=>e?i.find(e=>e.id===t)??a[0]??null:n??a[0]??null)(h,f,T,I,C),[h,f,T,I,C]),N=a(()=>(e=>e.map(e=>({class:e.class,scopeKey:e.scopeKey})))(k),[k]),A=()=>{y(m??C[0]?.id??null),g(!0),b(null)},O=e=>{g(!1),y(null),b(e)},E=a(()=>(({defaultPolicies:e,overridePolicies:t,selectedId:i,onSelect:n,onAddOverride:a,modeBadgeColors:o})=>{const l=e.map(e=>({id:e.id,selectedId:i,onSelect:n,header:{label:e.name,badges:[Eg(e)?CE(e.scope):null,{label:zt[e.mode],invertColors:!0,backgroundColor:o.backgroundColor,textColor:o.textColor}]},subDivisions:[{label:e.summary}]})),r=t.map(e=>({id:e.id,selectedId:i,onSelect:n,header:{label:e.name},subDivisions:[{label:e.summary}]}));return[{id:"default-policies",title:Ec,titleCount:l.length,noData:{title:Oc,subTitle:Ac},list:l},{id:"override-policies",title:Pc,titleCount:r.length,addButton:{label:Rc,onClick:a},noData:{title:zc,subTitle:Dc},list:r}]})({defaultPolicies:C,overridePolicies:k,selectedId:h?null:m,onSelect:O,onAddOverride:A,modeBadgeColors:{backgroundColor:e.v2.colors.blue[900],textColor:e.v2.colors.blue[300]}}),[C,k,h,m,e]);return t(cE,{icon:i?.panelIcon,title:Lc,count:T.length,description:i?.panelDescription||Nc,loading:s,sections:E,showDetail:h||!!I,emptyTitle:Xc,children:h?t(Xf,{services:S,transactions:x,existingOverrides:N,initialClass:$?.class,onSubmit:async e=>{if(!n.upsertLearningPolicy)return;const t=((e,t,i)=>t.find(t=>t.class===e.class)??i.find(t=>t.class===e.class&&Eg(t))??Dg(e.class))(e,C,T),i=((e,t)=>e.find(e=>e.class===t.class&&e.scope===t.scope&&e.scopeKey===t.scopeKey)??null)(k,e);if(i)return g(!1),void b(i.id);const a=(e=>zg({scope:e.scope,scopeKey:e.scopeKey,source:{...e.source,class:e.class},displayName:e.name}))({...e,source:t}),o=await n.upsertLearningPolicy(Xg(a));o&&!o.error&&(await c(),g(!1),y(null),b(o.data?Pg(o.data).id:a.id))}}):I?t(Xf,{policy:I,onSave:async e=>{if(!n.upsertLearningPolicy)return;const t=await n.upsertLearningPolicy(Xg(e));t&&!t.error&&await c()},onDelete:Eg(I)?void 0:()=>(async e=>{if(!n.deleteLearningPolicy)return;const t=await n.deleteLearningPolicy(e.class,e.scope,e.scopeKey);t?.error||(await c(),b(null))})(I)},I.id):null})},TE={[fg.Low]:Bc,[fg.Medium]:Fc,[fg.High]:Mc,[fg.Critical]:_c},IE=e=>{let t=fg.Medium,i=Number.POSITIVE_INFINITY;for(const[n,a]of Object.entries(Lg)){const o=Math.abs(a-e);o<i&&(t=n,i=o)}return t},$E=e=>`Triggers at ${TE[e]} risk or higher`,NE=e=>{const t=(e=>{switch(e){case bg.Global:return bg.Global;case bg.Transaction:return bg.Transaction;case bg.Service:default:return bg.Service}})(e.scope),i=IE(e.fireAtScore),n=(e=>{if(!e)return 0;try{const t=JSON.parse(e);if(t&&"object"==typeof t&&!Array.isArray(t))return Object.keys(t).length}catch{}return 0})(e.signalWeights);return{id:e.id,name:e.name,scope:t,scopeKey:e.scopeKey,enabled:e.enabled,summary:t===bg.Global?$E(i):rn(e.fireAtScore,n),fireAtScore:e.fireAtScore,riskLevel:i,signalWeightOverrideCount:n,signalWeights:e.signalWeights??null,enricherLists:e.enricherLists??null}},AE=e=>({id:e.id,name:e.name,enabled:e.enabled,fireAtScore:e.fireAtScore,signalWeights:e.signalWeights,enricherLists:e.enricherLists,scope:e.scope,scopeKey:e.scopeKey}),OE=e=>{const t={invertColors:!0};switch(e){case bg.Global:return{...t,label:Dt,status:ie.Warning};case bg.Service:return{...t,label:Ot,status:ie.Info};case bg.Transaction:return{...t,label:Et,status:ie.Info};default:return t}},EE=(e,t,i)=>{return{id:e.id,selectedId:t,onSelect:i,header:{label:e.name,badges:[OE(e.scope),(n=e.enabled,{label:n?De:ze,status:n?ie.Success:ie.Error,invertColors:!0})]},subDivisions:[{label:e.summary}]};var n},DE=()=>{const e=mE(uE.Detection),{insightsApi:i}=Hh(),{data:n,loading:r,refetch:s}=i.usePolicies(),c=i.useServices(),d=i.useTransactions(),p=Array.isArray(n)?n:[],[u,h]=l(!1),[g,m]=l(null),b=a(()=>p.map(NE),[p]),{defaultPolicies:f,overridePolicies:v,allPolicies:y}=a(()=>(e=>{const t=e.filter(gg),i=e.filter(e=>!gg(e));return{defaultPolicies:t,overridePolicies:i,allPolicies:[...t,...i]}})(b),[b]),S=a(()=>Array.isArray(c.data)?c.data:[],[c.data]),x=a(()=>Array.isArray(d.data)?d.data:[],[d.data]),w=a(()=>v.map(e=>e.scopeKey),[v]);o(()=>{m(e=>((e,t,i)=>e||!t.length?null:i&&t.some(e=>e.id===i)?i:t[0].id)(u,y,e))},[u,y]);const C=a(()=>y.find(e=>e.id===g)??null,[y,g]),k=f[0]??null,T=()=>{h(!0),m(null)},I=e=>{h(!1),m(e)},$=a(()=>(({defaultPolicies:e,overridePolicies:t,selectedId:i,onSelect:n,onAddOverride:a})=>{const o=e.map(e=>EE(e,i,n)),l=t.map(e=>EE(e,i,n));return[{id:"default-policies",title:Ec,titleCount:o.length,noData:{title:Oc,subTitle:Vc},list:o},{id:"override-policies",title:Pc,titleCount:l.length,addButton:{label:un,onClick:a},noData:{title:zc,subTitle:Uc},list:l}]})({defaultPolicies:f,overridePolicies:v,selectedId:u?null:g,onSelect:I,onAddOverride:T}),[f,v,u,g]);return t(cE,{icon:e?.panelIcon,title:Gc,count:y.length,description:e?.panelDescription,loading:r,sections:$,showDetail:u||!!C,emptyTitle:Xc,children:u?t(sy,{services:S,transactions:x,existingScopeKeys:w,onSubmit:async e=>{if(!i.upsertPolicy)return;const t=((e,t,i)=>e.find(e=>e.scope===t&&e.scopeKey===i)??null)(v,e.scope,e.scopeKey);if(t)return h(!1),void m(t.id);const n=((e,t)=>(({scope:e,scopeKey:t,name:i,defaults:n})=>{const a=n?.fireAtScore??Lg[fg.Medium],o=IE(a),l=n?.signalWeightOverrideCount??0;return{id:`${e}:${t}`,name:i,scope:e,scopeKey:t,enabled:!0,summary:rn(a,l),fireAtScore:a,riskLevel:o,signalWeightOverrideCount:l,signalWeights:n?.signalWeights??null,enricherLists:n?.enricherLists??null}})({scope:e.scope,scopeKey:e.scopeKey,name:e.name,defaults:t}))(e,k),a=await i.upsertPolicy({...AE(n),id:null});a?.error||(await s(),h(!1),m(a?.data?NE(a.data).id:n.id))}}):C?t(sy,{policy:C,onSave:async e=>{if(!i.upsertPolicy)return;const t=await i.upsertPolicy(AE(e));t?.error||await s()},onDelete:gg(C)?void 0:()=>(async e=>{if(!i.deletePolicy)return;const t=await i.deletePolicy(e.scope,e.scopeKey);t?.error||(await s(),m(null))})(C)},`${C.id}-${C.name}-${C.enabled}-${C.fireAtScore}-${C.summary}`):null})},zE=()=>{const e=mE(uE.Guardrails),{insightsApi:i}=Hh(),{data:n,loading:r,unsupported:s,refetch:c}=i.useGuardrails(),d=i.useServices(),p=i.useServiceNames(),u=Array.isArray(n)?n:[],[h,g]=l([]),[m,b]=l(!1),[f,v]=l(null),[y,S]=l(""),[x,w]=l(""),C=a(()=>s?h:u,[s,h,u]),k=a(()=>(e=>e.map(_g))(C),[C]),T=a(()=>C.find(e=>e.scopeKey===f)??null,[C,f]),I=a(()=>Array.isArray(d.data)?d.data:[],[d.data]),$=a(()=>Array.isArray(p.data)?p.data:[],[p.data]),{namespace:N,service:A}=((e,t,i,n)=>{const a=n?Mg(n.scopeKey):null;return{namespace:e?t:a?.namespace||"",service:e?i:a?.service||""}})(m,y,x,T),O=i.useServiceProfile({namespace:N||null,service:A||""},{skip:!(m||T)||!A}),E=A?O.data??null:null;o(()=>{v(e=>((e,t,i)=>e||!t.length?null:i&&t.some(e=>e.id===i)?i:t[0].id)(m,k,e))},[m,k]),o(()=>{if(!m||!I.length)return;const e=((e,t,i)=>{if(!e.length)return{namespace:t,service:i};if(!t){const t=e[0]?.namespace||"";return{namespace:t,service:e.find(e=>e.namespace===t)?.service||""}}return i&&e.some(e=>e.namespace===t&&e.service===i)?{namespace:t,service:i}:{namespace:t,service:e.find(e=>e.namespace===t)?.service||""}})(I,y,x);e.namespace!==y&&S(e.namespace),e.service!==x&&w(e.service)},[m,I,y,x]);const D=()=>{b(!0),v(null)},z=e=>{b(!1),v(e)},R=async e=>{if(s)return g(t=>((e,t)=>[...e.filter(e=>e.scopeKey!==t.scopeKey),t])(t,e)),b(!1),void v(e.scopeKey);const t=await(i.upsertGuardrail?.(e));t?.error||(await c(),b(!1),v(e.scopeKey))},P=a(()=>(({guardrails:e,selectedId:t,onSelect:i,onCreate:n})=>{const a=e.map(e=>{const n=e.mode===Ue.Enforce;return{id:e.id,selectedId:t,onSelect:i,header:{label:e.scopeKey,badges:[{label:n?jc:Hc,status:n?ie.Error:ie.Default,useSecondaryTone:n,invertColors:!0}]},subDivisions:e.rules.map(e=>({label:e.label,badges:[{label:e.allowlistCount,status:ie.Unknown},e.isAuto?{label:Wc,tooltip:"Created automatically when this service finished learning. You can edit the allowlist or turn the rule off anytime.",status:ie.Info,invertColors:!0}:null]}))}});return[{id:"guardrails",title:Jc,titleCount:e.length,addButton:{label:Ct,onClick:n},noData:{title:Yc,subTitle:Kc},list:a}]})({guardrails:k,selectedId:m?null:f,onSelect:z,onCreate:D}),[k,m,f]);return t(cE,{icon:e?.panelIcon,title:Zc,count:k.length,description:$c,loading:r,sections:P,showDetail:m||!!T,emptyTitle:qc,children:m?t(of,{services:I,serviceNames:$,profile:E,profileLoading:!!x&&O.loading,namespace:y,service:x,onNamespaceChange:e=>{S(e),w(((e,t)=>e.find(e=>e.namespace===t)?.service||"")(I,e))},onServiceChange:w,onSubmit:R}):T?t(of,{guardrail:T,profile:E,profileLoading:!!A&&O.loading,services:I,serviceNames:$,onSubmit:R,onDelete:async e=>{if(s)return g(t=>((e,t)=>e.filter(e=>e.scopeKey!==t))(t,e)),void v(null);const t=await(i.deleteGuardrail?.(e));t?.error||(await c(),v(null))}},T.scopeKey):null})},RE=f($)`
|
|
2222
2222
|
width: 100%;
|
|
2223
2223
|
min-width: 0;
|
|
2224
2224
|
gap: 12px;
|
|
2225
|
-
`,
|
|
2225
|
+
`,PE=f(T)`
|
|
2226
2226
|
width: 100%;
|
|
2227
2227
|
min-width: 0;
|
|
2228
2228
|
align-items: flex-start;
|
|
2229
2229
|
justify-content: space-between;
|
|
2230
2230
|
gap: 12px;
|
|
2231
2231
|
flex-wrap: wrap;
|
|
2232
|
-
`,
|
|
2232
|
+
`,XE=f($)`
|
|
2233
2233
|
min-width: 0;
|
|
2234
2234
|
flex: 1;
|
|
2235
2235
|
gap: 4px;
|
|
2236
|
-
`,
|
|
2236
|
+
`,LE=({title:i,description:n,extra:a,children:o})=>e(RE,{"data-id":`insights-storage-section-${i}`,children:[e(PE,{children:[e(XE,{children:[t(w,{size:C.XS,children:i}),n&&t(w,{size:C.XXXS,color:k.Secondary,children:n})]}),a]}),o]}),_E=f.div`
|
|
2237
2237
|
display: flex;
|
|
2238
2238
|
flex-wrap: wrap;
|
|
2239
2239
|
gap: 12px;
|
|
2240
2240
|
width: 100%;
|
|
2241
2241
|
min-width: 0;
|
|
2242
|
-
`,
|
|
2242
|
+
`,ME=f($)`
|
|
2243
2243
|
flex: 1 1 160px;
|
|
2244
2244
|
min-width: min(100%, 160px);
|
|
2245
2245
|
max-width: 280px;
|
|
@@ -2247,36 +2247,36 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2247
2247
|
padding: 12px 16px;
|
|
2248
2248
|
border-radius: 12px;
|
|
2249
2249
|
background-color: ${({theme:e})=>e.v2.colors.silver[900]};
|
|
2250
|
-
`,
|
|
2250
|
+
`,FE=({label:i,value:n})=>{const a=v();return e(ME,{children:[t(w,{size:C.XXXS,color:a.v2.colors.grey[150],children:i}),t(w,{size:C.XS,children:n})]})},BE=f.div`
|
|
2251
2251
|
width: 100%;
|
|
2252
2252
|
padding: 12px 16px;
|
|
2253
2253
|
border-radius: 8px;
|
|
2254
2254
|
background-color: ${({theme:e})=>e.v2.colors.silver[900]};
|
|
2255
|
-
`,
|
|
2255
|
+
`,VE=f.div`
|
|
2256
2256
|
width: 100%;
|
|
2257
2257
|
min-width: 0;
|
|
2258
2258
|
overflow-x: auto;
|
|
2259
|
-
`,
|
|
2259
|
+
`,UE=f.div`
|
|
2260
2260
|
width: 100%;
|
|
2261
2261
|
min-width: 0;
|
|
2262
2262
|
overflow-x: auto;
|
|
2263
|
-
`,
|
|
2263
|
+
`,GE=["B","KB","MB","GB","TB","PB"],jE=e=>{if(null==e||e<=0)return"0 B";const t=Math.min(Math.floor(Math.log(e)/Math.log(1024)),GE.length-1);return`${(e/Math.pow(1024,t)).toFixed(0===t?0:1)} ${GE[t]}`},HE=e=>null==e||!Number.isFinite(e)||e<=0?"0 ms":fc(1e9*e),WE=e=>null!=e&&Number.isFinite(e)?Math.round(e).toLocaleString():"0",KE=e=>`${Math.round(e??0)}%`,YE="—",JE="Storage health is not available.",qE="Memory",ZE="User",QE="Query";var eD,tD,iD;(e=>{e.When="when",e.Duration="duration",e.Memory="memory",e.User="user",e.Query="query"})(eD||(eD={})),(e=>{e.Elapsed="elapsed",e.User="user",e.Memory="memory",e.Query="query"})(tD||(tD={})),(e=>{e.Table="table",e.Rows="rows",e.OnDisk="onDisk",e.ActiveParts="activeParts"})(iD||(iD={}));const nD=[{key:eD.When,label:"When"},{key:eD.Duration,label:"Duration"},{key:eD.Memory,label:qE},{key:eD.User,label:ZE},{key:eD.Query,label:QE,noSort:!0,noFilter:!0}],aD=[{key:tD.Elapsed,label:"Elapsed"},{key:tD.User,label:ZE},{key:tD.Memory,label:qE},{key:tD.Query,label:QE,noSort:!0,noFilter:!0}],oD=[{key:iD.Table,label:"Table"},{key:iD.Rows,label:"Rows (approx)"},{key:iD.OnDisk,label:"On disk"},{key:iD.ActiveParts,label:"Active parts"}],lD=f($)`
|
|
2264
2264
|
flex: 1;
|
|
2265
2265
|
min-height: 0;
|
|
2266
2266
|
width: 100%;
|
|
2267
2267
|
overflow-y: auto;
|
|
2268
2268
|
gap: 24px;
|
|
2269
2269
|
padding: 4px 12px 24px;
|
|
2270
|
-
`,
|
|
2270
|
+
`,rD=f(lD)`
|
|
2271
2271
|
padding-top: 16px;
|
|
2272
|
-
`,
|
|
2272
|
+
`,sD=e=>{switch(e){case td.Critical:return ie.Error;case td.Warning:return ie.Warning;default:return ie.Success}},cD=({title:e})=>t(BE,{children:t(w,{size:C.XXS,color:k.Secondary,children:e})}),dD=()=>{const i=v(),n=mE(uE.Storage),{formatDurationAgo:o}=qn(),{insightsApi:r}=Hh(),{data:s,loading:c,unsupported:p,error:u}=r.useStorageHealth({pollInterval:15e3}),[h,g]=l("heaviest"),m=d(e=>e?o(e,{style:"short"}):YE,[o]),b=("heaviest"===h?s?.queries.recentHeaviest??[]:s?.queries.recentLatest??[]).slice(0,5),f=a(()=>((e,t)=>e.map((e,i)=>({id:`recent-${i}`,cells:[{key:eD.When,rawValue:t(e.finishedAt)},{key:eD.Duration,rawValue:HE(e.elapsedSeconds)},{key:eD.Memory,rawValue:jE(e.memoryBytes)},{key:eD.User,rawValue:e.user},{key:eD.Query,rawValue:e.query}]})))(b,m),[b,m]),y=a(()=>(s?.queries.items??[]).map((e,t)=>({id:`running-${t}`,cells:[{key:tD.Elapsed,rawValue:HE(e.elapsedSeconds)},{key:tD.User,rawValue:e.user},{key:tD.Memory,rawValue:jE(e.memoryBytes)},{key:tD.Query,rawValue:e.query}]})),[s?.queries.items]),S=a(()=>(s?.tables??[]).map(e=>({id:e.name,cells:[{key:iD.Table,rawValue:e.name},{key:iD.Rows,rawValue:WE(e.rows)},{key:iD.OnDisk,rawValue:jE(e.bytesOnDisk)},{key:iD.ActiveParts,rawValue:WE(e.activeParts)}]})),[s?.tables]),x=s?.disk.usedPercent??0,T=Math.max(0,100-x);return t(cE,{icon:n?.panelIcon,title:n?.title||pE,description:n?.panelDescription,children:(()=>{if(p)return t(oi,{$height:"100%",children:t(w,{size:C.XS,color:k.Secondary,children:JE})});if(c&&!s)return t(rD,{"data-id":"insights-storage-panel-loading",children:t(A,{size:8})});if(!s)return t(oi,{$height:"100%",children:t(Z,{hideIcon:!0,title:JE,subTitle:u?.message})});const n=s.connection.reachable,a=s.disk.totalBytes>0;return e(lD,{"data-id":"insights-storage-panel",children:[e(LE,{title:"Connection",children:[e(_E,{children:[t(FE,{label:"Reachable",value:n?"OK":"No"}),t(FE,{label:"Ping latency",value:n?(b=s.connection.pingLatencyMs,null!=b&&Number.isFinite(b)?`${Math.round(b)} ms`:"—"):YE}),t(FE,{label:"ClickHouse version",value:s.connection.version||YE}),t(FE,{label:"Database",value:s.connection.database||YE})]}),s.connection.error?t(w,{size:C.XXS,color:i.v2.colors.orange[500],children:s.connection.error}):null]}),t(J,{margin:"0",opacity:.45}),e(LE,{title:"Disk",children:[t(_E,{children:t(FE,{label:"Insights data",value:n?jE(s.disk.insightsBytes):YE})}),a?t(UE,{children:e(Mn,{bgTint:"900",richTitle:{title:"Filesystem (ClickHouse volume)",titleSize:C.XS},badges:[{key:"disk-used",label:`${KE(s.disk.usedPercent)} used`,status:sD(s.disk.status)}],children:[t(w,{size:C.XXXS,color:k.Secondary,children:"On shared volumes this includes unrelated host data — use Insights data above for stored size."}),t(Qc,{variant:ed.CurrentOfMax,gaugeWidth:150,min:0,max:"100%",current:`${Math.round(x)}%`,title:`Total ${jE(s.disk.totalBytes)}`,primaryLabel:`Used ${jE(s.disk.usedBytes)} (${KE(x)})`,secondaryLabel:`Available ${jE(s.disk.availableBytes)} (${KE(T)})`})]})}):t(cD,{title:"Filesystem usage is not available."})]}),t(J,{margin:"0",opacity:.45}),t(LE,{title:"Memory",children:e(_E,{children:[t(FE,{label:"Process RSS",value:n?jE(s.memory.processRssBytes):YE}),t(FE,{label:"Pod (cgroup)",value:n?(r=s.memory.cgroupUsedBytes,d=s.memory.cgroupTotalBytes,d>0?`${jE(r)} / ${jE(d)}`:jE(r)):YE}),t(FE,{label:"Uptime",value:n?HE(s.memory.uptimeSeconds):YE})]})}),t(J,{margin:"0",opacity:.45}),e(LE,{title:"Running queries",children:[e(_E,{children:[t(FE,{label:"Active now",value:n?String(s.queries.active):YE}),t(FE,{label:"Longest running",value:n?HE(s.queries.longestSeconds):YE}),t(FE,{label:"Peak memory (active)",value:n?jE(s.queries.peakMemoryBytes):YE})]}),y.length?t(VE,{children:t(za,{variant:Ra.DataSecondary,fitContent:!0,columns:aD,rows:y})}):t(cD,{title:"No active queries (idle is normal)."})]}),t(J,{margin:"0",opacity:.45}),t(LE,{title:"Recent queries",description:"Last 5 min · max 5",extra:t(F,{"data-id":"insights-storage-recent-sort",size:Zt.S,selected:h,setSelected:g,options:[{value:"heaviest",label:"Heaviest"},{value:"latest",label:"Latest"}]}),children:f.length?t(VE,{children:t(za,{variant:Ra.DataSecondary,fitContent:!0,maxHeight:320,columns:nD,rows:f})}):t(cD,{title:"No finished queries in the last 5 minutes."})}),t(J,{margin:"0",opacity:.45}),t(LE,{title:"Database Tables",children:S.length?t(VE,{children:t(za,{variant:Ra.DataSecondary,fitContent:!0,maxHeight:400,columns:oD,rows:S})}):t(cD,{title:"No table stats."})}),t(J,{margin:"0",opacity:.45}),t(LE,{title:"Write pressure",children:e(_E,{children:[t(FE,{label:"Unfinished mutations",value:n?String(s.writePressure.unfinishedMutations):YE}),t(FE,{label:"Active parts",value:n?String(s.writePressure.activeParts):YE}),t(FE,{label:"Flush interval",value:s.writeback.flushIntervalSeconds?`${s.writeback.flushIntervalSeconds} s`:YE})]})}),t(J,{margin:"0",opacity:.45}),t(LE,{title:"Insights <> DB",children:e(_E,{children:[t(FE,{label:"Last flush",value:(o=s.writeback.everFlushed,l=s.writeback.lastFlushOk,o?l?"OK":"Error":YE)}),t(FE,{label:"Last flush at",value:s.writeback.everFlushed?m(s.writeback.lastFlushAt):YE}),t(FE,{label:"Last flush error",value:s.writeback.lastFlushError||YE})]})})]});var o,l,r,d,b})()})},pD=f(T)`
|
|
2273
2273
|
flex: 1;
|
|
2274
2274
|
min-height: 0;
|
|
2275
2275
|
width: 100%;
|
|
2276
2276
|
align-items: stretch;
|
|
2277
2277
|
gap: 24px;
|
|
2278
2278
|
padding-top: 16px;
|
|
2279
|
-
`,
|
|
2279
|
+
`,uD=()=>{const[i,n]=l(hE),a=d(()=>{switch(i){case uE.Detection:return t(DE,{});case uE.Guardrails:return t(zE,{});case uE.Learning:return t(kE,{});case uE.System:return t(bE,{});case uE.Storage:return t(dD,{});default:return null}},[i]);return e(pD,{"data-id":"insights-settings-and-configurations",children:[t(wE,{selected:i,onSelect:n}),a()]})},hD=[{label:"Overview",value:j$.Overview},{label:"Findings",value:j$.Findings},{label:"Transactions",value:j$.Transactions},{label:"Settings & Configurations",value:j$.SettingsAndConfigurations}],gD=({minSupportedVersion:i})=>{const{isVersionSupported:n,version:a,minSupportedVersion:o}=Mp(i),[r,s]=l(j$.Overview),c=d(()=>{switch(r){case j$.Overview:return t(LN,{setSelectedTab:s});case j$.Findings:return t(GN,{});case j$.Transactions:return t(WN,{});case j$.SettingsAndConfigurations:return t(uD,{});default:return null}},[r]);return t(Y$,{children:t(K$.Consumer,{children:({drawerIsOpenFor:i})=>t(ic,{children:e(id,{children:[!n&&t(fm,{minSupportedVersion:o,currentVersion:a||""}),e($,{$fullHeight:!0,$gap:12,children:[e($,{$gap:0,children:[t(F,{variant:Da.Underline,size:Zt.L,options:hD,selected:r,setSelected:s}),t(J,{margin:"0"})]}),c(),i.type===H$.Anomaly&&!!i.id&&t(MA,{type:H$.Anomaly}),i.type===H$.Violation&&!!i.id&&t(MA,{type:H$.Violation}),i.type===H$.Transaction&&!!i.id&&t(HO,{})]})]})})})})},mD=f.div`
|
|
2280
2280
|
display: flex;
|
|
2281
2281
|
align-items: center;
|
|
2282
2282
|
justify-content: space-between;
|
|
@@ -2285,26 +2285,26 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2285
2285
|
width: 100%;
|
|
2286
2286
|
border-radius: 16px;
|
|
2287
2287
|
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
2288
|
-
`,
|
|
2288
|
+
`,bD=f.div`
|
|
2289
2289
|
display: flex;
|
|
2290
2290
|
align-items: center;
|
|
2291
2291
|
justify-content: center;
|
|
2292
2292
|
padding: 8px;
|
|
2293
2293
|
border-radius: 8px;
|
|
2294
2294
|
background-color: ${({theme:e})=>e.v2.colors.white[500]+I["004"]};
|
|
2295
|
-
`,
|
|
2295
|
+
`,fD=({setStep:i,onSave:n,sourcesPayload:o,destinationsPayload:l,disableAnimation:r})=>{const s=v(),c=()=>i(2),d=()=>i(3),p=a(()=>Object.values(o||{}).flatMap((i,n)=>i.map((i,a)=>{if(!i.selected)return null;const o=i.kind||kn.Namespace,l=o===kn.Namespace?i.namespace:`${i.namespace} → ${i.name}`;return e(mD,{children:[t(w,{nowrap:!0,children:l}),t(E,{label:o,status:ie.Info,backgroundColor:s.v2.colors.blue[900]})]},`source-${n}-${a}`)})).filter(Boolean),[o]),u=a(()=>l?.map((i,n)=>{const a=yn(i.option.type).icon;return e(mD,{children:[e(T,{$gap:8,children:[a&&t(bD,{children:t(a,{size:24})}),t(w,{nowrap:!0,children:i.formData.name||i.option.displayName})]}),void 0!==i.testResult&&t(E,{status:i.testResult.succeeded?ie.Success:ie.Error,leftIcon:i.testResult.succeeded?Lu:Xu})]},`destination-${n}`)})||[],[l]);return t(lm,{isOpen:!0,disableAnimation:r,onBack:()=>i(3),onSave:n,header:{icon:Ju,title:ke.SUMMARY,subTitle:ke.REVIEW_SETUP},leftColumn:{width:"50%",header:e(T,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(T,{$gap:8,children:[t(Uu,{size:24}),t(w,{nowrap:!0,children:ke.SELECTED_SOURCES}),t(E,{label:p.length})]}),t(H,{"data-id":"summary-edit-sources",leftIcon:Iu,variant:K.Secondary,size:W.S,onClick:c})]}),list:p.length?p:[t(oi,{$height:"100%",children:t(Z,{icon:Uu,title:ke.NO_SOURCES_SELECTED,subTitle:ke.ADD_SOURCE_PROMPT,button:{leftIcon:wu,label:ke.ADD_SOURCE,onClick:c}})},"no-sources-data")]},rightColumn:{width:"50%",header:e(T,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(T,{$gap:8,children:[t(Ru,{size:24}),t(w,{nowrap:!0,children:ke.SELECTED_DESTINATIONS}),t(E,{label:u.length})]}),t(H,{"data-id":"summary-edit-destinations",leftIcon:Iu,variant:K.Secondary,size:W.S,onClick:d})]}),list:u.length?u:[t(oi,{"data-id":"summary-no-destinations",$height:"100%",children:t(Z,{icon:Ru,title:ke.NO_DESTINATIONS_SELECTED,subTitle:ke.ADD_DESTINATION_PROMPT,button:{leftIcon:wu,label:ke.ADD_DESTINATIONS,onClick:d}})},"no-destinations-data")]}})},vD=f.div`
|
|
2296
2296
|
position: relative;
|
|
2297
2297
|
overflow: hidden;
|
|
2298
2298
|
width: 100vw;
|
|
2299
2299
|
height: 100vh;
|
|
2300
2300
|
box-sizing: border-box;
|
|
2301
|
-
`,
|
|
2301
|
+
`,yD=f.svg`
|
|
2302
2302
|
position: absolute;
|
|
2303
2303
|
top: 50%;
|
|
2304
2304
|
left: 50%;
|
|
2305
2305
|
transform: translate(-50%, -50%);
|
|
2306
2306
|
z-index: -1;
|
|
2307
|
-
`,
|
|
2307
|
+
`,SD=[{opacity:"0.1"},{offset:"0.31",opacity:"0.11"},{offset:"0.45",opacity:"0.14"},{offset:"0.56",opacity:"0.19"},{offset:"0.65",opacity:"0.26"},{offset:"0.73",opacity:"0.35"},{offset:"0.8",opacity:"0.46"},{offset:"0.86",opacity:"0.6"},{offset:"0.92",opacity:"0.76"},{offset:"0.98",opacity:"0.93"},{offset:"1"}],xD=[{width:1440,height:900,pathOpacity:.1,path:"M719.992 1169.99C322.351 1169.99 0 847.64 0 450C0 52.3591 322.351 -269.992 719.992 -269.992C1117.63 -269.992 1439.98 52.3591 1439.98 450C1439.98 847.64 1117.63 1169.99 719.992 1169.99Z",gradientTransform:"translate(814.309 444.011) rotate(180) scale(718.904)",stops:[{opacity:"0.1"},{offset:"0.41",opacity:"0.11"},{offset:"0.56",opacity:"0.13"},{offset:"0.67",opacity:"0.18"},{offset:"0.75",opacity:"0.25"},{offset:"0.83",opacity:"0.33"},{offset:"0.89",opacity:"0.44"},{offset:"0.95",opacity:"0.56"},{offset:"1",opacity:"0.7"}]},{width:1343,height:900,pathOpacity:.3,path:"M671.344 1121.34C300.571 1121.34 0 820.773 0 450C0 79.2264 300.571 -221.345 671.344 -221.345C1042.12 -221.345 1342.69 79.2264 1342.69 450C1342.69 820.773 1042.12 1121.34 671.344 1121.34Z",gradientTransform:"translate(644.026 441.551) rotate(180) scale(581.31)",stops:SD},{width:1163,height:900,pathOpacity:.5,path:"M581.31 1031.31C260.261 1031.31 0 771.048 0 449.999C0 128.951 260.261 -131.311 581.31 -131.311C902.358 -131.311 1162.62 128.951 1162.62 449.999C1162.62 771.048 902.358 1031.31 581.31 1031.31Z",gradientTransform:"translate(644.026 441.551) rotate(180) scale(581.31)",stops:SD},{width:798,height:798,pathOpacity:.7,path:"M398.581 797.162C178.451 797.162 0 618.711 0 398.581C0 178.451 178.451 0 398.581 0C618.711 0 797.162 178.451 797.162 398.581C797.162 618.711 618.711 797.162 398.581 797.162Z",gradientTransform:"translate(445.003 392.441) rotate(180) scale(398.23)",stops:SD}],wD=({paddingXAxis:i="0px",paddingYAxis:n="0px",children:r})=>{const[s,c]=l(window.innerWidth),d=a(()=>s/xD[0].width,[s]);return o(()=>{const e=()=>c(window.innerWidth);return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),e(vD,{$paddingXAxis:i,$paddingYAxis:n,children:[xD.map(({width:i,height:n,pathOpacity:a,path:o,gradientTransform:l,stops:r},s)=>{const c=`purple-ring-${s}`;return e(yD,{width:i*d,height:"100%",viewBox:`0 0 ${i} ${n}`,fill:"none",children:[t("path",{opacity:a,d:o,fill:`url(#${c})`}),t("defs",{children:t("radialGradient",{id:c,cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:l,children:r.map(({offset:e,opacity:i},n)=>t("stop",{offset:e,stopColor:"#7C3BFF",stopOpacity:i},n))})})]},c)}),r]})},CD=f.div`
|
|
2308
2308
|
display: flex;
|
|
2309
2309
|
flex-direction: column;
|
|
2310
2310
|
align-items: center;
|
|
@@ -2315,7 +2315,7 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2315
2315
|
width: 50vw;
|
|
2316
2316
|
border-radius: 16px;
|
|
2317
2317
|
background: ${({theme:e})=>e.v2.colors.silver[900]};
|
|
2318
|
-
`,
|
|
2318
|
+
`,kD=f.div`
|
|
2319
2319
|
display: flex;
|
|
2320
2320
|
flex-direction: column;
|
|
2321
2321
|
align-items: center;
|
|
@@ -2325,15 +2325,15 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2325
2325
|
& * {
|
|
2326
2326
|
text-align: center;
|
|
2327
2327
|
}
|
|
2328
|
-
`,
|
|
2328
|
+
`,TD=({onStart:i})=>t(ln,{width:"75vw",isOpen:!0,hideOverlay:!0,disableAnimation:!0,children:t(oi,{$height:"100%",children:e(CD,{children:[e(kD,{children:[t(w,{size:C.L,weight:500,children:ke.GET_STARTED_WITH}),t(um,{size:260}),t(w,{size:C.S,weight:400,children:ke.GET_STARTED_DESCRIPTION})]}),t(H,{"data-id":"onboarding-get-started",label:zn.GET_STARTED,rightIcon:Cu,size:W.L,onClick:i})]})})}),ID=[{step:1,label:ke.INSTALLATION,forceDoneBadge:!0},{step:2,label:ke.SOURCES_SETUP},{step:3,label:ke.DESTINATIONS_SETUP},{step:4,label:ke.SUMMARY}],$D=f.div`
|
|
2329
2329
|
display: flex;
|
|
2330
2330
|
flex-direction: column;
|
|
2331
2331
|
gap: 32px;
|
|
2332
2332
|
padding: 64px;
|
|
2333
|
-
|
|
2333
|
+
`,ND=({pagePaddingXAxis:i,pagePaddingYAxis:n,onDone:a})=>{const{setDrawerType:o}=da(),{sourcesApi:r,destinationsApi:s}=Hh(),[c,d]=l(1),[p,u]=l(!1),[h,g]=l(null),[m,b]=l(null),f=()=>d(e=>e+1),v=()=>d(e=>e-1);return e(wD,{paddingXAxis:i,paddingYAxis:n,children:[e($D,{children:[t(um,{useInline:!0}),t(nd,{currentStep:c,data:ID,gap:32})]}),t($g,{initialInputs:h,children:e(Fg,{children:[1===c&&t(TD,{onStart:f}),2===c&&t(Xy,{disableAnimation:!0,onBack:e=>{g(e),v()},onNext:e=>{g(e),f()}}),3===c&&t(yy,{disableAnimation:!0,onBack:e=>{b(e),v()},onNext:e=>{b(e),f()},initialInputs:m}),4===c&&t(fD,{disableAnimation:!0,setStep:d,onSave:async()=>{if(!p){u(!0);try{const e=[];h&&e.push(r.persistV2(h)),m&&e.push(...m.map(e=>s.create(e.formData)));const t=await Promise.allSettled(e),i=[];for(const e of t)"rejected"===e.status?i.push(e.reason?.message||String(e.reason)):e.value&&"object"==typeof e.value&&"error"in e.value&&e.value.error&&i.push(e.value.error);if(i.length)return{error:i.join("\n")};o(Dr.OnboardingDone),a()}catch(e){return u(!1),{error:e instanceof Error?e.message:String(e)}}}},sourcesPayload:h,destinationsPayload:m})]})})]})},AD=e=>(e||[]).filter(e=>!!e.id).map(e=>String(e.id)),OD=e=>e.replace(/[_-]+/g," ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/\b\w/g,e=>e.toUpperCase()),ED=e=>{let t=0;return Object.values(e).forEach(e=>{Array.isArray(e)&&(t+=e.length)}),e.onlyErrors&&t++,t},DD=f.div`
|
|
2334
2334
|
position: relative;
|
|
2335
2335
|
display: inline-flex;
|
|
2336
|
-
`,
|
|
2336
|
+
`,zD=f.button`
|
|
2337
2337
|
display: inline-flex;
|
|
2338
2338
|
align-items: center;
|
|
2339
2339
|
gap: 8px;
|
|
@@ -2346,7 +2346,7 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2346
2346
|
&:hover {
|
|
2347
2347
|
background-color: ${({theme:e})=>e.v2.colors.silver[700]};
|
|
2348
2348
|
}
|
|
2349
|
-
`,
|
|
2349
|
+
`,RD=f.div`
|
|
2350
2350
|
position: absolute;
|
|
2351
2351
|
top: calc(100% + 8px);
|
|
2352
2352
|
right: 0;
|
|
@@ -2359,25 +2359,25 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2359
2359
|
border-radius: 12px;
|
|
2360
2360
|
background-color: ${({theme:e})=>e.v2.colors.silver[900]};
|
|
2361
2361
|
box-shadow: 0 0 24px 0 rgba(0, 0, 0, 0.3);
|
|
2362
|
-
`,
|
|
2362
|
+
`,PD=f.div`
|
|
2363
2363
|
display: flex;
|
|
2364
2364
|
flex-direction: column;
|
|
2365
2365
|
gap: 12px;
|
|
2366
2366
|
padding: 16px;
|
|
2367
2367
|
max-height: 60vh;
|
|
2368
2368
|
overflow-y: auto;
|
|
2369
|
-
`,
|
|
2369
|
+
`,XD=f.div`
|
|
2370
2370
|
display: flex;
|
|
2371
2371
|
align-items: center;
|
|
2372
2372
|
gap: 8px;
|
|
2373
2373
|
padding: 12px 16px;
|
|
2374
2374
|
border-top: 1px solid ${({theme:e})=>e.v2.colors.silver[700]};
|
|
2375
|
-
`,
|
|
2375
|
+
`,LD=f.div`
|
|
2376
2376
|
display: flex;
|
|
2377
2377
|
align-items: center;
|
|
2378
2378
|
gap: 8px;
|
|
2379
2379
|
margin-left: auto;
|
|
2380
|
-
`,
|
|
2380
|
+
`,_D=()=>{const i=v(),{platformType:n,isK8s:r,isConnector:s}=Mp(),{sourcesApi:c,namespacesApi:d}=Hh(),u=c.useSources().items,h=d.useNamespaces().items,{selectedStreamName:g}=Te(),{getItemSS:m,setItemSS:b,removeItemSS:f}=cd(),{statuses:y,namespaces:S,regions:x,kinds:k,monitors:T,languages:I,onlyErrors:$,podsAgentInjectionStatus:N,enabledStatuses:A,setAll:O,clearFilters:D,getEmptyState:z}=ad(),R=a(()=>od(u,g),[u,g]);o(()=>{const e=m(ld.OVERVIEW_FILTERS,z());O(e)},[]);const[P,X]=l({statuses:y,namespaces:S,regions:x,kinds:k,monitors:T,languages:I,onlyErrors:$,podsAgentInjectionStatus:N,enabledStatuses:A}),[_,M]=l(ED(P)),[F,B]=l(!1),V=p(n);o(()=>{if(!F){const e={statuses:y,namespaces:S,regions:x,kinds:k,monitors:T,languages:I,onlyErrors:$,podsAgentInjectionStatus:N,enabledStatuses:A};X(e),M(ED(e))}},[F,y,S,x,k,T,I,$,N,A]),o(()=>{V.current!==n&&(V.current=n,f(ld.OVERVIEW_FILTERS),D(),X(z()),M(0),B(!1))},[n]);const U=p(null);Sa(U,()=>B(!1)),$r({key:"Escape",active:F},()=>B(!1));const G=a(()=>{const e=new Set,t=[];return h.forEach(({name:i})=>{e.has(i)||(e.add(i),t.push({id:i,label:i,withCheckbox:!0}))}),t},[h]),j=a(()=>{const e=new Set,t=[];return R.forEach(({id:i})=>{const{kind:n}=i;e.has(n)||(e.add(n),t.push({id:n,label:fa(n),withCheckbox:!0}))}),t},[R]),Y=a(()=>{const e=new Set,t=[];return R.forEach(({id:i})=>{const n=i.region?.trim();n&&!e.has(n)&&(e.add(n),t.push({id:n,label:n,withCheckbox:!0}))}),t.sort((e,t)=>e.id.localeCompare(t.id))},[R]),J=a(()=>{const e=new Set,t=[];return R.forEach(({runtimeInfo:i})=>{i?.detectedLanguages?.forEach(i=>{e.has(i)||(e.add(i),t.push({id:i,label:rd[i]||i,withCheckbox:!0}))})}),t.sort((e,t)=>e.id.localeCompare(t.id))},[R]),q=a(()=>sd.map(({id:e,value:t})=>({id:e,label:t,withCheckbox:!0})),[]),Z=a(()=>{const e=new Set,t=[];return R.forEach(({instrumentationReport:i})=>{const n=i?.state||i?.progressStage;n&&!e.has(n)&&(e.add(n),t.push({id:n,label:OD(n),withCheckbox:!0}))}),t.sort((e,t)=>e.label.localeCompare(t.label))},[R]),Q=a(()=>{const e=new Set,t=[];return R.forEach(({podsAgentInjectionStatus:i})=>{const{reasonEnum:n,message:a}=i||{};if(n){if(e.has(n))return;e.add(n),t.push({id:n,label:Pn(n),withCheckbox:!0})}else if(a){if(e.has(a))return;e.add(a),t.push({id:a,label:a,withCheckbox:!0})}}),t},[R]),ee=a(()=>[{id:"enabled",label:ke.ENABLED,withCheckbox:!0},{id:"disabled",label:ke.DISABLED,withCheckbox:!0}],[]),te=(e,t,i)=>{const n=t.filter(e=>i.includes(e.id));X(t=>{return{...t,[e]:(i=n,i.map(({id:e,label:t})=>({id:e,label:t})))};var i})},ne=F?Fu:Bu,ae=a(()=>AD(P.languages),[P.languages]);return e(DD,{ref:U,children:[e(zD,{"data-id":"filters-trigger",$isOpen:F,type:"button",onClick:()=>B(e=>!e),children:[t(Xh,{size:16,fill:i.v2.colors.white[500]}),t(w,{size:C.XS,weight:500,nowrap:!0,children:"Filters"}),_>0&&t(E,{label:_,status:ie.Unknown,textSize:C.XXXS}),t(ne,{size:16,fill:i.v2.colors.silver[200]})]}),F&&e(RD,{children:[e(PD,{children:[r&&t(Me,{label:"Namespace",placeholder:"All",withSearch:!0,withMultiSelect:!0,disabled:!G.length,options:G,values:AD(P.namespaces),setValues:e=>te("namespaces",G,e)}),s&&t(Me,{label:"Region",placeholder:"All",withSearch:!0,withMultiSelect:!0,disabled:!Y.length,options:Y,values:AD(P.regions),setValues:e=>te("regions",Y,e)}),t(Me,{label:"Kind",placeholder:"All",withSearch:!0,withMultiSelect:!0,disabled:!j.length,options:j,values:AD(P.kinds),setValues:e=>te("kinds",j,e)}),t(Me,{label:"Programming Language",placeholder:"All",withSearch:!0,withMultiSelect:!0,disabled:!J.length,options:J,values:ae,setValues:e=>te("languages",J,e)}),t(Me,{label:"Monitors",placeholder:"All",withSearch:!0,withMultiSelect:!0,disabled:!q.length,options:q,values:AD(P.monitors),setValues:e=>te("monitors",q,e)}),t(Me,r?{label:"Agent Injection Status",placeholder:"All",withSearch:!0,withMultiSelect:!0,disabled:!Q.length,options:Q,values:AD(P.podsAgentInjectionStatus),setValues:e=>te("podsAgentInjectionStatus",Q,e)}:{label:"Instrumentation Status",placeholder:"All",withSearch:!0,withMultiSelect:!0,disabled:!Z.length,options:Z,values:AD(P.statuses),setValues:e=>te("statuses",Z,e)}),t(Me,{label:"Enabled Status",placeholder:"All",withMultiSelect:!0,options:ee,values:AD(P.enabledStatuses),setValues:e=>te("enabledStatuses",ee,e)}),t(L,{label:"Show only sources with errors",size:Vi.L,value:!!P.onlyErrors,onChange:e=>X(t=>({...t,onlyErrors:e}))})]}),e(XD,{children:[t(H,{"data-id":"filters-reset",size:W.S,variant:K.Text,label:"Reset",onClick:()=>{f(ld.OVERVIEW_FILTERS),D(),X(z()),M(0),B(!1)},textColor:i.v2.colors.red[500]}),e(LD,{children:[t(H,{"data-id":"filters-cancel",size:W.S,variant:K.Secondary,label:"Cancel",onClick:()=>B(!1)}),t(H,{"data-id":"filters-apply",size:W.S,variant:K.Primary,label:"Apply",onClick:()=>{b(ld.OVERVIEW_FILTERS,P),O(P),M(ED(P)),B(!1)}})]})]})]})]})},MD=f.div`
|
|
2381
2381
|
position: relative;
|
|
2382
2382
|
display: flex;
|
|
2383
2383
|
align-items: center;
|
|
@@ -2388,7 +2388,7 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2388
2388
|
box-sizing: border-box;
|
|
2389
2389
|
border-radius: 16px 16px 0 0;
|
|
2390
2390
|
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
2391
|
-
`,
|
|
2391
|
+
`,FD=f.div`
|
|
2392
2392
|
position: absolute;
|
|
2393
2393
|
bottom: 0;
|
|
2394
2394
|
left: 0;
|
|
@@ -2397,7 +2397,7 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2397
2397
|
background-color: ${({theme:e})=>e.v2.colors.purple[500]};
|
|
2398
2398
|
border-radius: 32px;
|
|
2399
2399
|
transition: width 0.3s;
|
|
2400
|
-
`,
|
|
2400
|
+
`,BD=({entityType:i,badge:n,badgeTooltip:a,isLoading:o,refetch:l,partiallySelected:r,allSelected:s,onSelectAll:c,progressPercent:d})=>{const{setDrawerType:p}=da();return e(MD,{children:[e(T,{$gap:8,style:{flex:1,minWidth:0},children:[c&&t(x,{size:Xe.S,partiallyChecked:r,value:!!s,onChange:c}),t(w,{size:C.S,nowrap:!0,children:`${Pn(i)}s`}),t(E,{label:n,tooltip:a,status:ie.Unknown,textSize:C.XXXS})]}),e(T,{children:[t(bn,{"data-id":`add-${i}`,icon:wu,onClick:()=>p(dd(i))}),t(bn,{"data-id":`refresh-${i}`,icon:Zu,onClick:l,disabled:o})]}),"number"==typeof d&&t(FD,{$percent:d})]})},VD=f($)`
|
|
2401
2401
|
align-items: center !important;
|
|
2402
2402
|
justify-content: center !important;
|
|
2403
2403
|
align-self: stretch;
|
|
@@ -2412,7 +2412,7 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2412
2412
|
&:hover {
|
|
2413
2413
|
background-color: ${({theme:e})=>e.v2.colors.silver[1e3]};
|
|
2414
2414
|
}
|
|
2415
|
-
`,
|
|
2415
|
+
`,UD=({entityType:i,description:n})=>{const{setDrawerType:a}=da();return e(VD,{onClick:()=>a(dd(i)),children:[e(T,{$gap:4,children:[t(wu,{size:16}),t(w,{size:C.S,children:`Add ${Pn(i)}`})]}),t(w,{size:C.XXS,align:"center",children:n})]})},GD=f.div`
|
|
2416
2416
|
display: flex;
|
|
2417
2417
|
align-items: center;
|
|
2418
2418
|
gap: 12px;
|
|
@@ -2427,10 +2427,10 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2427
2427
|
&:hover {
|
|
2428
2428
|
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
2429
2429
|
}
|
|
2430
|
-
`,
|
|
2430
|
+
`,jD=f(T)`
|
|
2431
2431
|
flex: 1;
|
|
2432
2432
|
min-width: 0;
|
|
2433
|
-
`,
|
|
2433
|
+
`,HD=({entityId:i,entityType:n,title:o,status:l,faded:r,tooltip:s,throughput:c,icon:d,icons:p,iconSrc:u,isActive:h,raw:g})=>{const m=v(),b=n===kn.Source,f="boolean"==typeof h,y=r||f&&!h,{setDrawerType:S,setDrawerEntityId:w}=da(),{selectedSources:k,setSelectedSources:I}=pd(),$=g,N=b?$.id.namespace:"",A=a(()=>{if(!b)return-1;const e=k[N];return e?.length?e.findIndex(e=>e.id.name===$.id.name&&e.id.kind===$.id.kind&&(e.id.region??"")===($.id.region??"")):-1},[b,k,N,$.id]),O=f&&!h?$a(ie.Info,m):l?$a(l,m):void 0,D=b&&"object"==typeof i?`${i.namespace}-${i.name}-${i.kind}${i.region?`-${i.region}`:""}`:i;return e(GD,{"data-id":D,$faded:y,onClick:()=>{S(ma(n)),w(i)},children:[b&&t(x,{size:Xe.S,value:-1!==A,onChange:()=>{const e={...k};e[N]||(e[N]=[]),-1===A?e[N].push($):e[N].splice(A,1),I(e)}}),t(ga,{icons:p,icon:d,iconSrc:u}),e(jD,{$gap:4,children:[t(Q,{size:C.XS,nowrap:!0,children:o}),t(T,{$gap:6,$justifyContent:"flex-end",style:{marginLeft:"auto",flexShrink:0},children:(c||f&&!h)&&t(ce,{text:s||(f&&!h?ke.DISABLED:"Heads up! The data-flow metrics you see are calculated over 10-second intervals."),children:t(E,{label:c||ke.DISABLED,status:l&&[ie.Error,ie.Warning].includes(l)?l:ie.Unknown,leftIcon:O,textSize:C.XXXS})})})]})]})};function WD(e){return Object.values(e.conditions??{}).filter(Boolean).some(({status:e})=>e===ie.Loading)?e:{...e,workloadOdigosHealthStatus:{status:ta.Pending,name:"WorkloadOdigosHealthStatus",reasonEnum:"Pending",message:""}}}function KD(e){const t=Object.values(e.conditions??{}).filter(Boolean),i=t.filter(({status:e})=>e!==ie.Loading);return i?.length===t?.length?e:{...e,conditions:i?.length?i.reduce((e,t)=>(e[t.name]=t,e),{}):{}}}const YD=f.div`
|
|
2434
2434
|
position: absolute;
|
|
2435
2435
|
top: 0;
|
|
2436
2436
|
left: 0;
|
|
@@ -2441,21 +2441,21 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2441
2441
|
background-color: ${({theme:e})=>e.v2.colors.silver[900]};
|
|
2442
2442
|
border-bottom: 1px solid ${({theme:e})=>e.v2.colors.silver[700]};
|
|
2443
2443
|
pointer-events: none;
|
|
2444
|
-
`,
|
|
2444
|
+
`,JD=f.div`
|
|
2445
2445
|
display: flex;
|
|
2446
2446
|
align-items: center;
|
|
2447
2447
|
gap: 8px;
|
|
2448
2448
|
padding: 4px 8px 0;
|
|
2449
|
-
`,
|
|
2449
|
+
`,qD=f.div`
|
|
2450
2450
|
flex: 1;
|
|
2451
2451
|
height: 1px;
|
|
2452
2452
|
background: ${({theme:e})=>e.v2.colors.silver[700]};
|
|
2453
|
-
`,
|
|
2453
|
+
`,ZD=({namespace:e})=>{const i=v();return t(YD,{children:t(w,{size:C.XXS,nowrap:!0,color:i.v2.colors.grey[300],children:e})})},QD=({namespace:i})=>{const n=v();return e(JD,{children:[t(qD,{}),t(w,{size:C.XXS,nowrap:!0,color:n.v2.colors.grey[300],children:i}),t(qD,{})]})},ez={[kn.InstrumentationRule]:ke.NO_DATA_INSTRUMENTATION_RULES,[kn.Source]:ke.NO_DATA_SOURCES,[kn.Action]:ke.NO_DATA_ACTIONS,[kn.Destination]:ke.NO_DATA_DESTINATIONS},tz=f.div`
|
|
2454
2454
|
display: flex;
|
|
2455
2455
|
flex-direction: column;
|
|
2456
2456
|
flex: 1 0 0;
|
|
2457
2457
|
min-width: 0;
|
|
2458
|
-
`,
|
|
2458
|
+
`,iz=f.div`
|
|
2459
2459
|
display: flex;
|
|
2460
2460
|
flex-direction: column;
|
|
2461
2461
|
align-items: stretch;
|
|
@@ -2465,7 +2465,7 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2465
2465
|
border-radius: 0 0 16px 16px;
|
|
2466
2466
|
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
2467
2467
|
overflow: hidden;
|
|
2468
|
-
`,
|
|
2468
|
+
`,nz=f.div`
|
|
2469
2469
|
position: relative;
|
|
2470
2470
|
display: flex;
|
|
2471
2471
|
flex-direction: column;
|
|
@@ -2477,7 +2477,7 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2477
2477
|
background-color: ${({theme:e})=>e.v2.colors.silver[900]};
|
|
2478
2478
|
height: ${({$height:e})=>e}px;
|
|
2479
2479
|
overflow: hidden;
|
|
2480
|
-
`,
|
|
2480
|
+
`,az=({entityType:i,entities:n,unfilteredCount:r,metrics:s,loading:c,maxHeight:p,refetch:u})=>{const h=i===kn.Source,g=n.length!==r,m=In(e=>h?e.progress[An.Instrumenting]?.percentage:void 0),b=In(e=>h?e.progress[An.Uninstrumenting]?.percentage:void 0),f=!h||void 0===m&&void 0===b?void 0:m||b||0,{selectedSources:v,setSelectedSources:y}=pd(),S=a(()=>h?Object.values(v).reduce((e,t)=>e+t.length,0):0,[h,v]),x=a(()=>{if(!s)return;const e=new Map,t=i===kn.Source?s.sources:i===kn.Destination?s.destinations:void 0;if(t)for(const i of t)e.set(ud(i),i.throughput);return e},[s,i]),w=a(()=>n.map(e=>((e,t,i)=>{const n=Fn(e);if(!n)return null;const a=t===kn.Source;let o,l,r=!1,s=e;if(a){const t=(e=>{const t=e.workloadOdigosHealthStatus?.status,i=!1===e.markedForInstrumentation?.markedForInstrumentation;switch(t){case ta.Failure:return{status:ie.Error,faded:!1,tooltip:e.workloadOdigosHealthStatus?.message,displaySource:e};case ta.Notice:return{status:ie.Warning,faded:!1,tooltip:e.workloadOdigosHealthStatus?.message,displaySource:e};case ta.Pending:case ta.Waiting:return{status:void 0,faded:!1,displaySource:WD(e)};case ta.Unsupported:case ta.Disabled:return{status:void 0,faded:!0,tooltip:e.workloadOdigosHealthStatus?.message,displaySource:e};default:return i?{status:void 0,faded:!0,tooltip:e.workloadOdigosHealthStatus?.message,displaySource:e}:{status:void 0,faded:!1,displaySource:KD(e)}}})(e);o=t.status,r=t.faded,l=t.tooltip,s=t.displaySource}else{const i=t===kn.Action?hd(e):e.conditions,{priorotizedStatus:n,hasDisableds:a}=gd(i);o=n,r=a}const c=md(e,t,{extended:a,prioritizeDisplayName:!a});let d,p,u,h,g;switch(t){case kn.Source:{d=ha(e),p=fd(kn.Source);const t=i?.get(bd(n));h=va(t);const a=e.markedForInstrumentation?.markedForInstrumentation;"boolean"==typeof a&&(g=a);break}case kn.Destination:{const t=yn(e.destinationType.type);p=t.icon,u=t.iconSrc;const a=i?.get(bd(n));h=va(a),g=!e.disabled;break}case kn.Action:p=Un(e.type),g=!e.disabled;break;case kn.InstrumentationRule:p=Jn(e.type),g=!e.disabled}return{key:bd(n),entityId:n,namespace:a?e.id.namespace:void 0,raw:s,itemProps:{entityId:n,entityType:t,title:c,status:o,faded:r,tooltip:l,throughput:h,icon:p,icons:d,iconSrc:u,isActive:g,raw:s}}})(e,i,x)).filter(Boolean),[n,i,x]),[C,k]=l(""),{elements:T,indexToNamespace:I,multipleNs:$,dividerCount:N}=a(()=>{const e=[],i=[],n=new Set(w.map(e=>e.namespace).filter(Boolean)).size>1;n&&(i.push(""),e.push(t("div",{style:{height:24}},"ns-spacer")));let a=0,o="";for(const n of w)h&&n.namespace&&n.namespace!==o&&(""!==o&&(i.push(n.namespace),e.push(t(QD,{namespace:n.namespace},`ns-divider-${n.namespace}`)),a+=1),o=n.namespace),i.push(n.namespace||""),e.push(t(HD,{...n.itemProps},n.key));return{elements:e,indexToNamespace:i,multipleNs:n,dividerCount:a}},[w,h]);o(()=>{if(h&&I.length&&!C){const e=I.find(Boolean);e&&k(e)}},[h,I]);const O=d(e=>{if(!I.length)return;const t=I[Math.min(e,I.length-1)];t&&t!==C&&k(t)},[I,C]),E=58*w.length+($?28:0)+32*N,D=Math.max(0,p-52-16),z=Math.min(D,E)+8,R="number"==typeof f?`${f}%`:g?`${n.length}/${r}`:r;return e(tz,{children:[t(BD,{entityType:i,badge:R,badgeTooltip:g?ke.FILTERED_COUNT_TOOLTIP:void 0,isLoading:c,refetch:u,partiallySelected:S>0&&n?.length!==S,allSelected:S>0&&n?.length===S,onSelectAll:h?e=>{if(h)if(e){const e={};n?.forEach(t=>{const{namespace:i}=t.id;e[i]?e[i].push(t):e[i]=[t]}),y(e)}else y({})}:void 0,progressPercent:f}),t(iz,{children:n.length?e(nz,{$height:z,children:[$&&C&&t(ZD,{namespace:C}),t(ca,{gap:4,elements:T,onTopIndexChange:$?O:void 0})]}):c?t(A,{size:3}):t(UD,{entityType:i,description:ez[i]??ke.TO_COLLECT_OTEL_DATA})})]})},oz=f.div`
|
|
2481
2481
|
width: 100%;
|
|
2482
2482
|
flex: 1;
|
|
2483
2483
|
min-height: 0;
|
|
@@ -2485,10 +2485,10 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2485
2485
|
display: flex;
|
|
2486
2486
|
align-items: stretch;
|
|
2487
2487
|
gap: 16px;
|
|
2488
|
-
`,
|
|
2488
|
+
`,lz={sources:[],destinations:[]},rz=()=>{const i=ad(),{selectedStreamName:n}=Te(),{containerRef:o,containerHeight:l}=vd(),{sourcesApi:r,destinationsApi:s,actionsApi:c,instrumentationRulesApi:d,metricsApi:p,capabilities:u}=Hh(),{items:h,loading:g}=r.useSources(),{items:m,loading:b}=s.useDestinations(),{items:f,loading:v}=c.useActions(),{items:y,loading:S}=d.useRules(),x=da(e=>e.drawerType),{data:w}=p.useMetrics({skip:!h.length||!m.length||!!x,pollInterval:1e4,fetchPolicy:"network-only"}),C=w?.getOverviewMetrics??lz,k=a(()=>od(h,n),[h,n]),T=a(()=>Wn(m,n),[m,n]),I=a(()=>yd(k,i),[k,i]),$=a(()=>Sd(T,i),[T,i]),N=a(()=>xd(f,i),[f,i]);return e(oz,{ref:o,children:[u.canManageInstrumentationRules&&t(az,{entityType:kn.InstrumentationRule,entities:y,unfilteredCount:y.length,loading:S,maxHeight:l,refetch:d.fetchAll}),t(az,{entityType:kn.Source,entities:I,unfilteredCount:k.length,metrics:C,loading:g,maxHeight:l,refetch:r.fetchAll}),u.canManageActions&&t(az,{entityType:kn.Action,entities:N,unfilteredCount:f.length,loading:v,maxHeight:l,refetch:c.fetchAll}),t(az,{entityType:kn.Destination,entities:$,unfilteredCount:T.length,metrics:C,loading:b,maxHeight:l,refetch:s.fetchAll})]})},sz="40vw",cz=f.div`
|
|
2489
2489
|
position: relative;
|
|
2490
|
-
width: ${
|
|
2491
|
-
`,
|
|
2490
|
+
width: ${sz};
|
|
2491
|
+
`,dz=f.div`
|
|
2492
2492
|
position: absolute;
|
|
2493
2493
|
top: calc(100% + 8px);
|
|
2494
2494
|
left: 0;
|
|
@@ -2497,23 +2497,23 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2497
2497
|
flex-direction: column;
|
|
2498
2498
|
gap: 8px;
|
|
2499
2499
|
padding: 8px;
|
|
2500
|
-
width: calc(${
|
|
2500
|
+
width: calc(${sz} - 16px);
|
|
2501
2501
|
border-radius: 12px;
|
|
2502
2502
|
background-color: ${({theme:e})=>e.v2.colors.silver[900]};
|
|
2503
2503
|
box-shadow: 0 12px 24px 24px rgba(0, 0, 0, 0.5);
|
|
2504
|
-
`,
|
|
2504
|
+
`,pz=f.div`
|
|
2505
2505
|
display: flex;
|
|
2506
2506
|
align-items: center;
|
|
2507
2507
|
overflow-x: auto;
|
|
2508
|
-
`,
|
|
2508
|
+
`,uz=f.div`
|
|
2509
2509
|
display: flex;
|
|
2510
2510
|
flex-direction: column;
|
|
2511
2511
|
gap: 0;
|
|
2512
2512
|
max-height: 60vh;
|
|
2513
2513
|
overflow-y: auto;
|
|
2514
|
-
`,uz=f.div`
|
|
2515
|
-
padding: 8px 12px 4px 12px;
|
|
2516
2514
|
`,hz=f.div`
|
|
2515
|
+
padding: 8px 12px 4px 12px;
|
|
2516
|
+
`,gz=f.div`
|
|
2517
2517
|
display: flex;
|
|
2518
2518
|
align-items: center;
|
|
2519
2519
|
gap: 8px;
|
|
@@ -2523,12 +2523,12 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2523
2523
|
&:hover {
|
|
2524
2524
|
background-color: ${({theme:e})=>e.v2.colors.silver[700]};
|
|
2525
2525
|
}
|
|
2526
|
-
`,
|
|
2526
|
+
`,mz=f.div`
|
|
2527
2527
|
padding: 16px 8px;
|
|
2528
|
-
`,
|
|
2528
|
+
`,bz=({preventPopup:i=!1})=>{const n=v(),{selectedStreamName:o}=Te(),{searchText:s,setSearchText:c}=ad(),{setDrawerType:d,setDrawerEntityId:u}=da(),{sourcesApi:h,destinationsApi:g,actionsApi:m,instrumentationRulesApi:b,capabilities:f}=Hh(),y=h.useSources().items,S=g.useDestinations().items,x=m.useActions().items,T=b.useRules().items,I=p(null),[$,N]=l(!1),[A,O]=l("all"),E=!i&&(!!s||$),D=()=>{c(""),N(!1),O("all")};Sa(I,()=>D()),$r({key:"Escape",active:E},D);const{categories:z,searchResults:R}=a(()=>(({instrumentationRules:e,sources:t,actions:i,destinations:n,searchText:a,selectedCategory:o,includeActions:l=!0,includeInstrumentationRules:r=!0})=>{const s=r?a?e.filter(e=>e.type?.toLowerCase().includes(a)||e.ruleName?.toLowerCase().includes(a)):e:[],c=a?t.filter(e=>e.id.name?.toLowerCase().includes(a)||e.serviceName?.toLowerCase().includes(a)||e.id.namespace?.toLowerCase().includes(a)):t,d=l?a?i.filter(e=>e.type?.toLowerCase().includes(a)||e.name?.toLowerCase().includes(a)):i:[],p=a?n.filter(e=>e.destinationType.displayName?.toLowerCase().includes(a)||e.name?.toLowerCase().includes(a)):n,u=[{category:kn.Source,label:"Sources",count:c.length,entities:[]},...l?[{category:kn.Action,label:"Actions",count:d.length,entities:[]}]:[],{category:kn.Destination,label:"Destinations",count:p.length,entities:[]},...r?[{category:kn.InstrumentationRule,label:"Instrumentation Rules",count:s.length,entities:[]}]:[]];u.unshift({category:"all",label:"All",count:s.length+c.length+d.length+p.length,entities:[]});const h=u.filter(({count:e,category:t})=>!!e&&"all"!==t&&["all",t].includes(o)).map(e=>({...e,entities:e.category===kn.InstrumentationRule?s:e.category===kn.Source?c:e.category===kn.Action?d:e.category===kn.Destination?p:[]}));return{categories:u,searchResults:h}})({instrumentationRules:T,sources:od(y,o),actions:x,destinations:Wn(S,o),searchText:s,selectedCategory:A,includeActions:f.canManageActions,includeInstrumentationRules:f.canManageInstrumentationRules}),[T,y,x,S,o,s,A,f.canManageActions,f.canManageInstrumentationRules]),P=a(()=>z.filter(({count:e,category:t})=>!!e||"all"===t).map(({category:e,label:t,count:i})=>({value:e,label:i?`${t} (${i})`:t})),[z]),X=R.some(({entities:e})=>e.length>0);return e(cz,{ref:I,children:[t(sa,{value:s,onChange:e=>c(e.toLowerCase()),onFocus:()=>N(!0),width:sz}),E&&e(dz,{children:[P.length>1&&t(pz,{children:t(F,{options:P,selected:A,setSelected:O})}),X?t(uz,{children:R.map(({category:i,label:a,entities:o},l)=>{if(!o.length)return null;const s=fd(i);return e(r,{children:[t(hz,{children:t(w,{size:C.XXS,color:k.Secondary,children:a})}),o.map((a,o)=>e(gz,{onClick:()=>{const e=Fn(a);e&&(d(ma(i)),u(e),D())},children:[s&&t(s,{size:16,fill:n.v2.colors.white[500]}),t(w,{size:C.XS,nowrap:!0,children:md(a,i,{extended:!0})})]},`entity-${l}-${o}`))]},`category-list-${i}`)})}):t(mz,{children:t(Z,{hideIcon:!0,title:"No results",subTitle:s?`No matches for "${s}"`:"Start typing to search"})})]})]})},fz=({onRedirectToSampling:n})=>{const{sourcesApi:o}=Hh(),{items:l}=o.useSources(),{drawerType:r,drawerEntityId:s,setDrawerType:c,setDrawerEntityId:d}=da(),p=()=>{c(null),d(null)},u=a(()=>l.map(({id:e})=>({id:`${e.namespace}/${e.kind}/${e.name}`,label:e.name,badge:e.kind,secondaryLabel:e.namespace})),[l]),h=a(()=>Array.from(new Set(l.map(({id:e})=>e.namespace))).sort().map(e=>({id:e,label:e})),[l]);return e(i,{children:[t(BI,{}),r===Dr.AddSource&&t($g,{children:t(Xy,{onClose:p,withOverlay:!0})}),r===Dr.AddDestination&&t(Fg,{children:t(yy,{onClose:p,withOverlay:!0})}),r===Dr.AddInstrumentationRule&&t(Bg,{sourceOptions:u,namespaceOptions:h,children:t(Sy,{onClose:p,withOverlay:!0})}),r===Dr.AddAction&&t(Vg,{sourceOptions:u,namespaceOptions:h,children:t(cy,{onClose:p,withOverlay:!0})}),r===Dr.EditSource&&t(Ug,{children:t(kk,{onClose:p,sourceId:s,onRedirectToSampling:n})}),r===Dr.EditDestination&&t(Fg,{children:t(_x,{onClose:p,destinationId:s})}),r===Dr.EditInstrumentationRule&&t(Bg,{sourceOptions:u,namespaceOptions:h,children:t(Fx,{onClose:p,ruleId:s})}),r===Dr.EditAction&&t(Vg,{sourceOptions:u,namespaceOptions:h,children:t(Px,{onClose:p,actionId:s})})]})},vz=f.div`
|
|
2529
2529
|
position: relative;
|
|
2530
2530
|
display: inline-flex;
|
|
2531
|
-
`,
|
|
2531
|
+
`,yz=f.div`
|
|
2532
2532
|
display: inline-flex;
|
|
2533
2533
|
align-items: center;
|
|
2534
2534
|
gap: 6px;
|
|
@@ -2539,7 +2539,7 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2539
2539
|
&:hover {
|
|
2540
2540
|
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
2541
2541
|
}
|
|
2542
|
-
`,
|
|
2542
|
+
`,Sz=f.div`
|
|
2543
2543
|
position: absolute;
|
|
2544
2544
|
top: calc(100% + 8px);
|
|
2545
2545
|
left: 0;
|
|
@@ -2554,18 +2554,18 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2554
2554
|
border: 1px solid ${({theme:e})=>e.v2.colors.silver[700]};
|
|
2555
2555
|
background-color: ${({theme:e})=>e.v2.colors.silver[900]};
|
|
2556
2556
|
box-shadow: 0 0 24px 0 rgba(0, 0, 0, 0.3);
|
|
2557
|
-
`,
|
|
2557
|
+
`,xz=f.div`
|
|
2558
2558
|
display: flex;
|
|
2559
2559
|
align-items: center;
|
|
2560
2560
|
gap: 8px;
|
|
2561
2561
|
width: 100%;
|
|
2562
|
-
`,
|
|
2562
|
+
`,wz=f.div`
|
|
2563
2563
|
display: flex;
|
|
2564
2564
|
flex-direction: column;
|
|
2565
2565
|
gap: 0;
|
|
2566
2566
|
max-height: 240px;
|
|
2567
2567
|
overflow-y: auto;
|
|
2568
|
-
`,
|
|
2568
|
+
`,Cz=f.div`
|
|
2569
2569
|
display: flex;
|
|
2570
2570
|
align-items: center;
|
|
2571
2571
|
gap: 8px;
|
|
@@ -2576,41 +2576,41 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2576
2576
|
&:hover {
|
|
2577
2577
|
background-color: ${({$selected:e,theme:t})=>e?t.v2.colors.silver[600]:t.v2.colors.silver[700]};
|
|
2578
2578
|
}
|
|
2579
|
-
`,
|
|
2579
|
+
`,kz=f.div`
|
|
2580
2580
|
flex: 1;
|
|
2581
2581
|
min-width: 0;
|
|
2582
2582
|
overflow: hidden;
|
|
2583
2583
|
text-overflow: ellipsis;
|
|
2584
2584
|
white-space: nowrap;
|
|
2585
|
-
`,
|
|
2585
|
+
`,Tz=f.div`
|
|
2586
2586
|
display: flex;
|
|
2587
2587
|
align-items: center;
|
|
2588
2588
|
gap: 2px;
|
|
2589
2589
|
flex-shrink: 0;
|
|
2590
|
-
`,
|
|
2590
|
+
`,Iz=f.div`
|
|
2591
2591
|
display: flex;
|
|
2592
2592
|
padding-top: 4px;
|
|
2593
2593
|
border-top: 1px solid ${({theme:e})=>e.v2.colors.silver[700]};
|
|
2594
|
-
|
|
2594
|
+
`,$z=()=>{const n=v(),{isK8s:r}=Mp(),{clearStore:s}=wd(),{dataStreamsApi:c}=Hh();c.useDataStreams();const{dataStreams:d,selectedStreamName:u,setSelectedStreamName:h}=Te(),g=p(null),[m,b]=l(!1),[f,y]=l(""),[S,x]=l(""),[T,I]=l(!1),[$,N]=l(!1),[A,O]=l(!1),[D,z]=l(""),[R,P]=l(!1);Sa(g,()=>b(!1)),o(()=>{m||y("")},[m]);const X=a(()=>{if(!f)return d;const e=f.toLowerCase();return d.filter(({name:t})=>t.toLowerCase().includes(e))},[d,f]),L=m?Fu:Bu;return r?e(i,{children:[e(vz,{ref:g,children:[e(yz,{"data-id":"data-stream-select",$isOpen:m,onClick:()=>b(e=>!e),children:[t(Lh,{size:24}),t(w,{size:C.S,weight:500,nowrap:!0,children:(_=u,`Data Stream: ${_}`)}),t(E,{label:d.length,status:ie.Unknown,textSize:C.XXXS}),t(L,{size:20,fill:n.v2.colors.silver[200]})]}),m&&e(Sz,{children:[t(xz,{children:t(sa,{value:f,onChange:y,placeholder:"Search streams...",width:"100%"})}),t(wz,{children:0===X.length?t(Cz,{children:t(w,{size:C.XS,color:k.Secondary,children:"No streams match"})}):X.map(({name:i})=>{const n=i===Cd;return e(Cz,{"data-id":`stream-row-${i}`,$selected:i===u,onClick:()=>(e=>{e!==u&&(s(),h(e)),b(!1)})(i),children:[t(kz,{children:t(w,{size:C.XS,nowrap:!0,children:i})}),e(Tz,{children:[t(bn,{"data-id":`stream-edit-${i}`,icon:Iu,size:fn.XS,onClick:e=>{e.stopPropagation(),b(!1),x(i),I(!0)}}),!n&&t(bn,{"data-id":`stream-delete-${i}`,icon:xu,size:fn.XS,onClick:e=>{e.stopPropagation(),b(!1),z(i),P(!0)}})]})]},`stream-${i}`)})}),t(Iz,{children:t(H,{"data-id":"add-stream-trigger",variant:K.Secondary,size:W.S,leftIcon:wu,label:`${zn.NEW} ${ke.STREAM_NAME}`,fullWidth:!0,onClick:()=>{b(!1),s(),O(!0),N(!0)}})})]})]}),A&&t(Gg,{defaultExcludeName:u,children:t(LI,{isOpen:$,onClose:()=>N(!1),onCloseEnd:()=>O(!1)})}),S&&t(Gg,{children:t(_I,{isOpen:T,dataStreamName:S,onClose:()=>I(!1),onCloseEnd:()=>x("")})}),t(cm,{target:`${ke.STREAM_NAME.toLowerCase()} "${D}"`,isOpen:R,onClose:()=>P(!1),onApprove:async()=>{D&&await c.remove(D)}})]}):null;var _},Nz=f($)`
|
|
2595
2595
|
width: 100%;
|
|
2596
2596
|
max-height: 320px;
|
|
2597
2597
|
overflow-y: auto;
|
|
2598
2598
|
gap: 8px;
|
|
2599
|
-
`,
|
|
2599
|
+
`,Az=f(T)`
|
|
2600
2600
|
width: 100%;
|
|
2601
2601
|
align-items: center;
|
|
2602
2602
|
gap: 8px;
|
|
2603
2603
|
padding: 8px 12px;
|
|
2604
2604
|
border-radius: 8px;
|
|
2605
2605
|
background: ${({theme:e})=>e.v2.colors.silver[900]};
|
|
2606
|
-
`,
|
|
2606
|
+
`,Oz=()=>{const n=v(),{selectedStreamName:r}=Te(),{selectedSources:s,setSelectedSources:c}=pd(),{sourcesApi:p}=Hh(),[u,h]=l(!1),[g,m]=l(!1),[b,f]=l(!1),[y,S]=l(!1),{toInstrument:x,toUninstrument:T,totalSelected:I}=a(()=>{const e=[],t=[];return Object.values(s).forEach(i=>{i.forEach(i=>{(e=>!1===e.markedForInstrumentation?.markedForInstrumentation)(i)?e.push(i):t.push(i)})}),{toInstrument:e,toUninstrument:t,totalSelected:e.length+t.length}},[s]),$=d(()=>{c({})},[c]),N=d(()=>h(!1),[]),A=d(()=>m(!1),[]),O=d(()=>f(!1),[]),D=d(()=>S(!1),[]);o(()=>{$()},[r,$]);const z=d((e,t)=>{if(!e.length)return;const i=new Map;e.forEach(e=>{const t=e.id.namespace,n=i.get(t)??[];n.push(e),i.set(t,n)}),p.persistV2(Object.fromEntries([...i.entries()].map(([e,i])=>[e,i.map(({id:e})=>({namespace:e.namespace,name:e.name,kind:e.kind||void 0,...e.region?{region:e.region}:{},selected:t,currentStreamName:r}))])))},[p,r]),R=d(()=>{p.restartWorkloads(Object.values(s).flat().filter(e=>e.id.kind!==ba.StaticPod).map(pa)),$()},[p,s,$]),P=d(()=>{z(x,!0),$()},[z,x,$]),X=d(()=>{z(T,!1),$()},[z,T,$]),L=d(()=>{z(x,!0),z(T,!1),$()},[z,x,T,$]),_=x.length>0,M=T.length>0,F=_&&M,B=a(()=>{const e=[{id:"multi-source-deselect",type:St.Button,buttonProps:{variant:K.Text,size:W.S,label:"Deselect",onClick:$}},{id:"multi-source-restart",type:St.Button,buttonProps:{variant:K.Secondary,size:W.S,label:"Restart",leftIcon:lh,onClick:()=>h(!0)}}];return F?e.push({id:"multi-source-apply",type:St.Button,buttonProps:{variant:K.Primary,size:W.S,label:"Apply Changes",leftIcon:wu,onClick:()=>S(!0)}}):_?e.push({id:"multi-source-instrument",type:St.Button,buttonProps:{variant:K.Primary,size:W.S,label:"Instrument",leftIcon:wu,onClick:()=>f(!0)}}):M&&e.push({id:"multi-source-uninstrument",type:St.Button,buttonProps:{variant:K.Primary,size:W.S,label:"Uninstrument",leftIcon:xu,onClick:()=>m(!0)}}),e},[$,F,_,M]),V=e=>md(e,kn.Source,{extended:!0})||e.id.name;return e(i,{children:[t(vt,{isOpen:I>0,richTitle:{icon:Uu,title:"Selected sources",badge:{label:I}},actions:B}),t(Ce,{isOpen:u,title:"Rollout Restart Workloads",description:"Are you sure you want to rollout restart these workloads?",onClose:N,denyButton:{label:"Go Back",variant:K.Secondary,onClick:N},approveButton:{label:"Confirm",variant:K.Primary,onClick:()=>{R(),N()}}}),t(cm,{isOpen:b,action:"instrument",target:`${x.length} source${1===x.length?"":"s"}`,onClose:O,onDeny:O,onApprove:P}),t(cm,{isOpen:g,action:"uninstrument",target:`${T.length} source${1===T.length?"":"s"}`,onClose:A,onDeny:A,onApprove:X}),t(Ce,{isOpen:y,title:"Modify selected sources",description:"These changes are applied immediately. Disabled sources are re-instrumented; enabled sources are uninstrumented.",onClose:D,denyButton:{variant:K.Secondary,label:"Cancel",onClick:D},approveButton:{variant:K.Primary,label:"Confirm",onClick:()=>{L(),D()}},children:e(Nz,{children:[x.map(i=>e(Az,{children:[t(E,{leftIcon:wu,status:ie.Success,useSecondaryTone:!0,textColor:n.v2.colors.white[500],textSize:C.XXS}),t(w,{size:C.XS,color:k.Primary,children:V(i)})]},`instrument-${i.id.namespace}-${i.id.kind}-${i.id.name}-${i.id.region??""}`)),T.map(i=>e(Az,{children:[t(E,{leftIcon:sh,status:ie.Error,useSecondaryTone:!0,textColor:n.v2.colors.white[500],textSize:C.XXS}),t(w,{size:C.XS,color:k.Primary,children:V(i)})]},`uninstrument-${i.id.namespace}-${i.id.kind}-${i.id.name}-${i.id.region??""}`))]})})]})},Ez=S`
|
|
2607
2607
|
0% {
|
|
2608
2608
|
background-position: 200% 50%;
|
|
2609
2609
|
}
|
|
2610
2610
|
100% {
|
|
2611
2611
|
background-position: 0% 50%;
|
|
2612
2612
|
}
|
|
2613
|
-
`,
|
|
2613
|
+
`,Dz=f.div`
|
|
2614
2614
|
display: flex;
|
|
2615
2615
|
align-items: center;
|
|
2616
2616
|
justify-content: space-evenly;
|
|
@@ -2621,24 +2621,24 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2621
2621
|
|
|
2622
2622
|
background: ${({theme:e})=>`linear-gradient(90deg, ${e.v2.colors.pink[500]} 0%, ${e.v2.colors.purple[400]} 25%, ${e.v2.colors.green[500]} 50%, ${e.v2.colors.purple[400]} 75%, ${e.v2.colors.pink[500]} 100%)`};
|
|
2623
2623
|
background-size: 200% 100%;
|
|
2624
|
-
animation: ${
|
|
2625
|
-
`,
|
|
2624
|
+
animation: ${Ez} 15s linear infinite;
|
|
2625
|
+
`,zz=({onRedirectToSampling:i})=>{const n=v(),{capabilities:o}=Hh(),l=a(()=>{const e=[];return o.canManageInstrumentationRules&&e.push(Vu),e.push(Uu),o.canManageActions&&e.push(Su),e.push(Ru),e},[o.canManageActions,o.canManageInstrumentationRules]);return e(ic,{children:[e(Re,{fullHeight:!0,customTitle:t($z,{}),customSearch:t(bz,{}),filters:t(_D,{}),children:[t(Dz,{children:l.map((i,a)=>e(r,{children:[t(i,{size:24}),a<l.length-1&&t(yu,{fill:n.v2.colors.white[500]+I["020"],size:24})]},i.name))}),t(rz,{})]}),t(fz,{onRedirectToSampling:i}),t(Oz,{})]})};var Rz;(e=>{e.Gateway="gateway",e.Node="node"})(Rz||(Rz={}));const Pz=({onClickDownloadDiagnose:i,onClickRefresh:n,loading:o,disabled:l})=>{const r=a(()=>{const e=[];return i&&e.push({id:Or(),type:St.Button,buttonProps:{label:"Download Diagnose",leftIcon:hh,size:W.S,variant:K.Text,onClick:i,disabled:l}}),n&&e.push({id:Or(),type:St.Button,buttonProps:{label:"Refresh",leftIcon:Zu,size:W.S,variant:K.Text,onClick:n,disabled:l,loading:o}}),e},[i,n,l,o]);return e(T,{$alignItems:"center",$justifyContent:"space-between",children:[t(nc,{icon:_h,title:"Collectors Pipeline"}),t(ac,{actions:r})]})},Xz=({pod:i,onClose:n})=>{const{formatTimeAgo:o}=qn(),{collectorsApi:l}=Hh(),{data:r}=l.usePodInfo(i?{namespace:i.namespace,name:i.name}:void 0,{skip:!i}),s=a(()=>[{id:Or(),title:"Node",label:r?.node??"-",withCopy:!0},{id:Or(),title:"Status",badge:{status:kd(r?.status),label:r?.status??"-"}}],[r]),c=a(()=>r?.containers?.map(e=>({id:Or(),items:[{id:Or(),title:"Container",label:e.name??"-"},{id:Or(),title:"Status",label:e.startedAt?`${e.status} (since ${o(e.startedAt)})`:e.status},{id:Or(),title:"Ready",badge:{status:e.ready?ie.Success:ie.Error,leftIcon:e.ready?Ou:Eu,label:e.ready?"True":"False",invertColors:!0}},{id:Or(),title:"Started",badge:{status:e.started?ie.Success:ie.Error,leftIcon:e.started?Ou:Eu,label:e.started?"True":"False",invertColors:!0}},{id:Or(),title:"Image Version",label:e.image?.split(":")?.[1]??"-"},{id:Or(),title:"Image Repository",label:e.image?.split(":")?.[0]??"-"},{id:Or(),title:ke.RESTARTS,label:e.restarts.toString()},{id:Or(),title:"State Reason",label:e.stateReason??"-"},{id:Or(),title:"Resource Requests",label:`CPU ${e.resources.requests.cpu} • Memory ${e.resources.requests.memory}`},{id:Or(),title:"Resource Limits",label:`CPU ${e.resources.limits.cpu} • Memory ${e.resources.limits.memory}`}]}))||[],[r]);return t(ln,{isOpen:!!i,header:{icon:eh,title:"Pod Information",onClose:n},children:r?e(Mn,{bgTint:"1000",richTitle:{icon:eh,title:r.name,withCopy:!0},children:[t(Mn,{bgTint:"900",cellsPerRow:2,items:s}),e(Mn,{bgTint:"900",richTitle:{icon:oh,title:ke.DEBUG_COMMANDS},withCollapse:!0,collapseIsDefaultOpen:!0,children:[t(ra,{value:`kubectl get pod ${r.name} -n ${r.namespace} -o yaml`}),t(ra,{value:`kubectl describe pod ${r.name} -n ${r.namespace}`}),t(ra,{value:`kubectl logs ${r.name} -n ${r.namespace}`})]}),t(Mn,{bgTint:"900",richTitle:{title:"Containers Overview"},withCollapse:!0,collapseIsDefaultOpen:!0,children:c.length?c.map(({id:e,items:i})=>t(Mn,{bgTint:"800",cellsPerRow:2,items:i},e)):t(Z,{title:"No containers",subTitle:"Pod has no containers"})}),t(dm,{bgTint:"900",yaml:r.manifestYAML,defaultOpen:!0})]}):t(oi,{$height:"50vh",children:t(Ve,{withSpinner:!0})})})};var Lz;(e=>{e.PodName="podName",e.Status="status",e.Restarts="restarts",e.NodeName="nodeName",e.SpanDropRate="spanDropRate",e.Age="age",e.DockerImage="dockerImage"})(Lz||(Lz={}));const _z=e=>{const t=[{key:Lz.PodName,label:"Pod Name"},{key:Lz.Status,label:"Status"},{key:Lz.Restarts,label:ke.RESTARTS},{key:Lz.NodeName,label:"Node Name"},{key:Lz.Age,label:"Age"},{key:Lz.DockerImage,label:"Collector Version"}];return e&&t.splice(4,0,{key:Lz.SpanDropRate,label:"Span Drop Rate",noSort:!0,noFilter:!0}),t},Mz=({isLoading:i,pods:n,withSpanDropRate:o})=>{const r=v(),{formatTimeAgo:s}=qn(),[c,d]=l(null),p=a(()=>n.map(i=>({onClick:()=>d(i),cells:[{key:Lz.PodName,rawValue:i.name},{key:Lz.Status,rawValue:i.status,component:()=>{return e=i.status,t(E,{status:kd(e),label:e});var e}},{key:Lz.Restarts,rawValue:i.restartsCount.toString()},{key:Lz.NodeName,rawValue:i.nodeName},{key:Lz.SpanDropRate,rawValue:0,component:()=>{const{collectorMetrics:n}=i;if(!n)return t(w,{children:"-"});const a=(n?.metricsAcceptedRps??0)+(n?.metricsDroppedRps??0),o=a>0?Math.round((n?.metricsDroppedRps??0)/a*100):0,l=o>0?ie.Error:ie.Success,r=(n?.exporterSuccessRps??0)+(n?.exporterFailedRps??0),s=r>0?Math.round((n?.exporterFailedRps??0)/r*100):0,c=s>0?ie.Error:ie.Success;return e(T,{$gap:4,children:[t(ce,{text:`Accepted: ${n.metricsAcceptedRps.toLocaleString()} spans/s\nDropped: ${n.metricsDroppedRps.toLocaleString()} spans/s`,children:t(E,{status:l,label:`Receiver ${o}%`,leftIcon:l===ie.Error?Mh:Fh,useSecondaryTone:!0,invertColors:!0})}),t(ce,{text:`Success: ${n.exporterSuccessRps.toLocaleString()} spans/s\nFailed: ${n.exporterFailedRps.toLocaleString()} spans/s`,children:t(E,{status:c,label:`Exporter ${s}%`,leftIcon:c===ie.Error?Mh:Fh,useSecondaryTone:!0,invertColors:!0})})]})}},{key:Lz.Age,rawValue:s(i.creationTimestamp)},{key:Lz.DockerImage,rawValue:i.image}]})),[n,r]);return e(Mn,{fullHeight:!0,bgTint:"1000",moreSpacing:!0,richTitle:{icon:eh,title:"Pods"},children:[t(za,{variant:Ra.Data,isLoading:i,columns:_z(o),rows:p}),t(Xz,{pod:c,onClose:()=>d(null)})]})},Fz=({isOpen:e,onClose:i,title:n,yaml:a})=>t(ln,{isOpen:e,header:{icon:Bh,title:n,onClose:i},children:t(dm,{yaml:a,defaultOpen:!0})}),Bz=e=>{switch(e){case Td.Healthy:return"All desired replicas are updated, available, and ready";case Td.Updating:return"Workload is progressing towards desired state (e.g., updating pods)";case Td.Degraded:return"Progressing but with availability issues (e.g., not enough available replicas)";case Td.Failed:return"Progress deadline exceeded or an unrecoverable error occurred";case Td.Down:return"No available replicas";case Td.Unknown:return"Status cannot be determined from current signals";default:return"Status unknown"}};var Vz;(e=>{e.ManifestYaml="manifest-yaml",e.ConfigMapYaml="configmap-yaml"})(Vz||(Vz={}));const Uz=f.div`
|
|
2626
2626
|
flex: 1;
|
|
2627
2627
|
min-width: 0;
|
|
2628
2628
|
padding: 12px;
|
|
2629
2629
|
border-radius: 12px;
|
|
2630
2630
|
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
2631
|
-
`,
|
|
2631
|
+
`,Gz=f(T)`
|
|
2632
2632
|
width: 100%;
|
|
2633
2633
|
min-width: 0;
|
|
2634
2634
|
justify-content: space-between;
|
|
2635
2635
|
flex-wrap: wrap;
|
|
2636
2636
|
align-items: flex-start;
|
|
2637
2637
|
gap: 12px;
|
|
2638
|
-
`,
|
|
2638
|
+
`,jz=f.div`
|
|
2639
2639
|
flex: 1;
|
|
2640
2640
|
min-width: 0;
|
|
2641
|
-
`,
|
|
2641
|
+
`,Hz=f.div`
|
|
2642
2642
|
flex-shrink: 0;
|
|
2643
2643
|
|
|
2644
2644
|
@media (max-width: 1099px) {
|
|
@@ -2646,11 +2646,11 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2646
2646
|
display: flex;
|
|
2647
2647
|
justify-content: flex-end;
|
|
2648
2648
|
}
|
|
2649
|
-
`,
|
|
2649
|
+
`,Wz=f(T)`
|
|
2650
2650
|
width: 100%;
|
|
2651
2651
|
align-items: stretch;
|
|
2652
2652
|
flex-wrap: wrap;
|
|
2653
|
-
`,
|
|
2653
|
+
`,Kz=f.div`
|
|
2654
2654
|
flex: 2 1 440px;
|
|
2655
2655
|
min-width: 320px;
|
|
2656
2656
|
|
|
@@ -2658,7 +2658,7 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2658
2658
|
flex-basis: 100%;
|
|
2659
2659
|
min-width: 0;
|
|
2660
2660
|
}
|
|
2661
|
-
`,
|
|
2661
|
+
`,Yz=f.div`
|
|
2662
2662
|
flex: 1 1 300px;
|
|
2663
2663
|
min-width: 280px;
|
|
2664
2664
|
|
|
@@ -2671,7 +2671,7 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2671
2671
|
flex-basis: 100%;
|
|
2672
2672
|
min-width: 0;
|
|
2673
2673
|
}
|
|
2674
|
-
`,
|
|
2674
|
+
`,Jz=f.div`
|
|
2675
2675
|
flex: 1 1 260px;
|
|
2676
2676
|
min-width: 240px;
|
|
2677
2677
|
|
|
@@ -2684,37 +2684,37 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2684
2684
|
flex-basis: 100%;
|
|
2685
2685
|
min-width: 0;
|
|
2686
2686
|
}
|
|
2687
|
-
`,
|
|
2687
|
+
`,qz=({selectedTab:i,gatewayInfo:n,nodeCollectorInfo:o,isLoading:r,withDataThroughput:s})=>{const{formatTimeAgo:c}=qn(),[p,u]=l(null),h=a(()=>(e=>{switch(e){case Rz.Gateway:return"Deployment";case Rz.Node:return"DaemonSet";default:return"Pipeline Collectors"}})(i),[i]),g=a(()=>((e,t,i,n)=>{const a={status:ie.Disabled,label:"No rollouts yet"};let o=!1,l=null;switch(e){case Rz.Gateway:o=t?.rolloutInProgress??!1,l=t?.lastRolloutAt??null;break;case Rz.Node:o=i?.rolloutInProgress??!1,l=i?.lastRolloutAt??null;break;default:return a}return o?{status:ie.Info,label:"Rollout in progress",rightIcon:Zu,useSecondaryTone:!0}:l?{status:ie.Disabled,label:`Last Rollout: ${n(l)}`}:a})(i,n,o,c),[n,o,i,c]),m=a(()=>((e,t,i,n)=>{let a=n?ie.Info:ie.Unknown,o=n?"Loading":Td.Unknown,l=n?"Fetching data...":Bz(Td.Unknown);switch(e){case Rz.Gateway:a=t?.status?kd(t?.status):a,o=t?.status??o,l=t?.status?Bz(t.status):l;break;case Rz.Node:a=i?.status?kd(i?.status):a,o=i?.status??o,l=i?.status?Bz(i.status):l}return{status:a,title:o,description:l}})(i,n,o,r),[n,o,i,r]),b=a(()=>((e,t,i)=>{switch(e){case Rz.Gateway:return[{gaugeWidth:128,min:0,max:t?.hpa?.max??0,current:t?.hpa?.current??0,title:"HPA Spec",primaryLabel:"Current replicas",secondaryLabel:"Max replicas"}];case Rz.Node:return[{gaugeWidth:128,min:0,max:i?.nodes?.desired??0,current:i?.nodes?.ready??0,title:"Nodes",primaryLabel:"Ready nodes",secondaryLabel:"Desired nodes"}];default:return[]}})(i,n,o),[n,o,i]),f=a(()=>((e,t,i,n,a)=>{switch(e){case Rz.Gateway:{const e=[];return a&&e.push({title:"Data throughput",cells:[{label:"Traces data",value:va(t?.throughputTracesBytesPerSec??0),isLoading:n},{label:"Metrics data",value:va(t?.throughputMetricsBytesPerSec??0),isLoading:n},{label:"Logs data",value:va(t?.throughputLogsBytesPerSec??0),isLoading:n}]}),e.push({title:"Resources (request/limit)",cells:[{label:"CPU",value:`${t?.resources?.requests.cpu}/${t?.resources?.limits.cpu}`,isLoading:n},{label:"Memory",value:`${t?.resources?.requests.memory}/${t?.resources?.limits.memory}`,isLoading:n}]}),e}case Rz.Node:{const e=[];return a&&e.push({title:"Data Throughput",cells:[{label:"Traces data",value:va(i?.throughputTracesBytesPerSec??0),isLoading:n},{label:"Metrics data",value:va(i?.throughputMetricsBytesPerSec??0),isLoading:n},{label:"Logs data",value:va(i?.throughputLogsBytesPerSec??0),isLoading:n}]}),e.push({title:"Resources (request/limit)",cells:[{label:"CPU",value:`${i?.resources?.requests.cpu}/${i?.resources?.limits.cpu}`,isLoading:n},{label:"Memory",value:`${i?.resources?.requests.memory}/${i?.resources?.limits.memory}`,isLoading:n}]}),e}default:return[]}})(i,n,o,r,s),[n,o,i,r,s]),v=a(()=>(i===Rz.Gateway?n?.manifestYAML:o?.manifestYAML)??"",[n,o,i]),y=a(()=>(i===Rz.Gateway?n?.configMapYAML:o?.configMapYAML)??"",[n,o,i]),S=d(e=>u(e),[]),x=a(()=>[{id:"view-yaml",type:St.DropDataButton,buttonProps:{variant:K.Secondary,size:W.S,label:"View YAML",onClick:S},dropDataProps:{items:[{id:Vz.ManifestYaml,label:h,icon:Vh},{id:Vz.ConfigMapYaml,label:"ConfigMap",icon:Vh}]}}],[h,S]);return e(Mn,{bgTint:"1000",moreSpacing:!0,children:[e(Gz,{children:[t(jz,{children:t(nc,{icon:Bh,title:h,badge:g})}),t(Hz,{children:t(ac,{actions:x})})]}),e(Wz,{$gap:16,children:[t(Kz,{children:t(Id,{...m})}),b.map(e=>t(Yz,{children:t(Uz,{children:t(Qc,{...e})})},e.title)),f.map(e=>t(Jz,{children:t(oc,{...e})},e.title))]}),t(Fz,{isOpen:p===Vz.ManifestYaml,onClose:()=>u(null),title:h,yaml:v}),t(Fz,{isOpen:p===Vz.ConfigMapYaml,onClose:()=>u(null),title:"ConfigMap",yaml:y})]})},Zz=[{value:Rz.Gateway,label:"Gateway"},{value:Rz.Node,label:"Node Collector"}],Qz=({minSupportedVersion:i})=>{const{isVersionSupported:n,version:o,minSupportedVersion:r}=Mp(i),[s,c]=l(Rz.Gateway),p=s===Rz.Gateway,u=s===Rz.Node,{collectorsApi:h,configApi:g}=Hh(),{data:m}=g.useEffectiveConfig(),{data:b,loading:f,refetch:v}=h.useGatewayInfo({skip:!p}),{data:y=[],loading:S,refetch:x}=h.useGatewayPods({skip:!p}),{data:w,loading:C,refetch:k}=h.useNodeCollectorInfo({skip:!u}),{data:T=[],loading:I,refetch:N}=h.useNodeCollectorPods({skip:!u}),A=p&&(f||S)||u&&(C||I),O=d(()=>{p?(v(),x()):u&&(k(),N())},[p,u,v,x,k,N]),E=a(()=>p?y:T,[y,T,p]),D=!m?.odigosOwnTelemetryStore?.metricsStoreDisabled;return e(ic,{children:[t(Pz,{disabled:!n,loading:A,onClickDownloadDiagnose:void 0,onClickRefresh:O}),e(id,{children:[e($,{children:[t(F,{variant:Da.Underline,size:Zt.L,options:Zz,selected:s,setSelected:c}),t(qz,{selectedTab:s,gatewayInfo:b??null,nodeCollectorInfo:w??null,isLoading:A,withDataThroughput:D})]}),t(Mz,{isLoading:A,pods:E,withSpanDropRate:D}),!n&&t(fm,{minSupportedVersion:r,currentVersion:o||""})]})]})},eR=f.div`
|
|
2688
2688
|
display: inline-flex;
|
|
2689
2689
|
align-items: center;
|
|
2690
2690
|
min-width: 0;
|
|
2691
2691
|
overflow: hidden;
|
|
2692
2692
|
white-space: pre;
|
|
2693
2693
|
text-overflow: ellipsis;
|
|
2694
|
-
`,
|
|
2694
|
+
`,tR=f.div`
|
|
2695
2695
|
display: flex;
|
|
2696
2696
|
flex-direction: column;
|
|
2697
2697
|
gap: 4px;
|
|
2698
2698
|
min-width: 0;
|
|
2699
2699
|
flex: 1;
|
|
2700
2700
|
opacity: ${({$disabled:e})=>e?.4:1};
|
|
2701
|
-
`,
|
|
2701
|
+
`,iR=f(T)`
|
|
2702
2702
|
flex-shrink: 0;
|
|
2703
2703
|
gap: 6px;
|
|
2704
2704
|
align-items: center;
|
|
2705
2705
|
min-height: 22px;
|
|
2706
|
-
`,
|
|
2706
|
+
`,nR=[{key:"content",label:"Content",noSort:!0,noFilter:!0},{key:"badges",label:"Type",noSort:!0,noFilter:!0}],aR=[{value:"all",label:Ed},{value:"Relevance",label:"Relevance"},{value:"Duration",label:"Duration"},{value:"Error",label:"Error"}],oR=({title:i,items:n,isLoading:o,showTypeFilter:r,onRuleClick:s,onCreateRule:c,onEditRule:p,onDeleteRule:u})=>{const h=v(),[g,m]=l(""),[b,f]=l("all"),y=a(()=>{let e=((e,t,i)=>i&&"all"!==t?e.filter(e=>e.typeBadge===t):e)(n,b,r);return e=((e,t)=>{if(!t.trim())return e;const i=t.toLowerCase();return e.filter(e=>{const t=e.name?.toLowerCase().includes(i),n=e.summary.map(e=>e.text).join("").toLowerCase();return t||n.includes(i)})})(e,g),e},[n,b,r,g]),S=a(()=>y.map(i=>{const n=i.typeBadge?((e,t)=>{const i=e.v2.colors;switch(t){case"Relevance":return{bg:i.blue[700],text:i.white[500]};case"Duration":return{bg:i.purple[700],text:i.white[500]};case"Error":return{bg:i.red[500],text:i.black[500]}}})(h,i.typeBadge):void 0;return{cells:[{key:"content",rawValue:i.summary.map(e=>e.text).join(""),component:()=>e(tR,{$disabled:i.disabled,children:[t(eR,{children:t(Bp,{parts:i.summary})}),i.name&&t(w,{size:C.XXS,color:k.Secondary,nowrap:!0,children:i.name})]})},{key:"badges",rawValue:i.typeBadge||"",component:()=>e(iR,{children:[i.disabled&&t(E,{label:Pa,textSize:C.XXXS,backgroundColor:h.v2.colors.grey[700],textColor:h.v2.colors.grey[300]}),i.typeBadge&&n&&t(E,{label:i.typeBadge,textSize:C.XXXS,backgroundColor:n.bg,textColor:n.text})]})}],onClick:()=>s(i)}}),[y,h,s]),x=a(()=>{const e=e=>t(Tu,{...e,fill:h.v2.colors.red[500]});return e.displayName="RedDeleteIcon",e},[h]),T=d(e=>{const t=S.indexOf(e);if(t<0)return[];const i=y[t];return i?[{id:"edit","data-id":"sampling-rule-action-edit",label:ho,leftIcon:Iu,onClick:()=>p(i.ruleId,i.samplingId)},{id:"delete","data-id":"sampling-rule-action-delete",label:"",leftIcon:x,onClick:()=>u(i.ruleId,i.samplingId)}]:[]},[S,y,p,u,x]);return t(Re,{fullHeight:!0,richTitle:{icon:fh,title:i,badge:{label:n.length,backgroundColor:h.v2.colors.silver[600],textColor:h.v2.colors.white[500]}},search:{"data-id":"sampling-search-rules",value:g,onChange:m,placeholder:"Search..",width:"500px"},filters:r?t(F,{"data-id":"sampling-segment-type-filter",options:aR,selected:b,setSelected:f}):void 0,children:t(za,{variant:Ra.Pretty,hideHeader:!0,isLoading:o,noDataProps:g.trim()?{hideIcon:!0,title:$d,subTitle:Od(g)}:{hideIcon:!0,title:Ad,button:{label:Nd,onClick:c}},columns:nR,rows:S,getRowActions:T})})},lR=({docsUrl:i})=>{const{samplingApi:n,sourcesApi:r}=Hh(),{items:s}=r.useSources(),c=a(()=>s.map(e=>({id:e.id})),[s]),{items:u,loading:h,k8sHealthProbesConfig:g,refetch:m}=n.useSamplingRules(),b=d((e,t)=>n.createNoisy?.({samplingId:e,rule:t}),[n]),f=d((e,t,i)=>n.updateNoisy?.(t,{samplingId:e,rule:i}),[n]),v=d((e,t)=>n.createHighlyRelevant?.({samplingId:e,rule:t}),[n]),y=d((e,t,i)=>n.updateHighlyRelevant?.(t,{samplingId:e,rule:i}),[n]),S=d((e,t)=>n.createCostReduction?.({samplingId:e,rule:t}),[n]),x=d((e,t,i)=>n.updateCostReduction?.(t,{samplingId:e,rule:i}),[n]),w=d((e,t,i)=>"noisy"===i?n.deleteNoisy?.(t,e):"highlyRelevant"===i?n.deleteHighlyRelevant?.(t,e):"costReduction"===i?n.deleteCostReduction?.(t,e):void 0,[n]),C=d((e,t)=>n.updateK8sHealthProbesConfig?.({enabled:e,keepPercentage:t}),[n]),k=a(()=>c.map(({id:e})=>({id:`${e.namespace}/${e.kind}/${e.name}`,label:e.name,badge:e.kind,secondaryLabel:e.namespace})),[c]),I=a(()=>Array.from(new Set(c.map(({id:e})=>e.namespace))).sort().map(e=>({id:e,label:e})),[c]),[N,A]=l(tu.Noisy),[O,E]=l(null),[D,z]=l(!1),[R,P]=l(!1),[X,L]=l(null),[_,M]=l(!1),[B,V]=l(!1),[U,G]=l(!1),[j,Y]=l(!1);p(!1),o(()=>{},[h,u]);const{pendingViewSamplingRule:J,setPendingViewSamplingRule:q}=da();o(()=>{if(!J)return;if(h||0===u.length)return;q(null);const e=iu(u,J.ruleId,J.category);e&&(A(nu[J.category]),z(!1),E(e))},[h,u,J,q]);const Z=a(()=>qp(g),[g]),Q=a(()=>au(u),[u]),ee=a(()=>Zp(Q?.rule??null),[Q]),ne=a(()=>ou(u),[u]),ae=a(()=>lu(ne?.rule??null),[ne]),oe=p(O);oe.current=O,o(()=>{const e=oe.current;if(!e)return;const t=ru(u,e);t?E(t):(E(null),z(!1))},[u]);const le=a(()=>{const e=new Set;return Q&&e.add(Q.rule.ruleId),ne&&e.add(ne.rule.ruleId),e},[Q,ne]),re=a(()=>su(u,N,le),[u,N,le]),se=d(()=>P(!0),[]),ce=d(()=>P(!1),[]);d(()=>Y(!1),[]);const de=d(async e=>{const t=u[0]?.id??"default";switch(gu[N]){case"noisy":await b(t,pu(e));break;case"highlyRelevant":await v(t,du(e));break;case"costReduction":await S(t,cu(e))}P(!1)},[u,N,b,v,S]),pe=d(e=>{const t=uu(u,e);t&&(z(!1),E(t))},[u]),ue=d(()=>{E(null),z(!1)},[]),he=d((e,t)=>{const i=O;if(i&&i.rule.ruleId===e&&i.samplingId===t)z(!0),E({...i});else for(const i of u){if(i.id!==t)continue;const n=[...i.noisyOperations.map(e=>({category:"noisy",rule:e})),...i.highlyRelevantOperations.map(e=>({category:"highlyRelevant",rule:e})),...i.costReductionRules.map(e=>({category:"costReduction",rule:e}))].find(t=>t.rule.ruleId===e);if(n)return z(!0),void E({category:n.category,rule:n.rule,samplingId:t,summary:hu(n.category,n.rule)})}},[O,u]),ge=d(async(e,t,i)=>{const n=O?.category;if(n){switch(n){case"noisy":await f(i,t,pu(e));break;case"highlyRelevant":await y(i,t,du(e));break;case"costReduction":await x(i,t,cu(e))}z(!1)}},[O,f,y,x]),me=d((e,t)=>{L({ruleId:e,samplingId:t})},[]),be=d(async()=>{if(!X)return;const{ruleId:e,samplingId:t}=X,i=O?.category||gu[N];await w(t,e,i),E(null),z(!1),L(null)},[X,O,N,w]),fe=d(()=>L(null),[]),ve=d(async(e,t)=>{await C(e,t),M(!1)},[C]),ye=d(async e=>{const t=u[0]?.id??"default",i=Q;i?await y(i.samplingId,i.rule.ruleId,{name:i.rule.name,disabled:!e,error:!0,sourceScopes:null,operation:null,percentageAtLeast:null,notes:i.rule.notes}):e&&await v(t,{name:"Auto - Keep All Error Traces",disabled:!1,error:!0,sourceScopes:null,operation:null,percentageAtLeast:null}),V(!1)},[u,Q,v,y]),Se=d(async(e,t)=>{const i=u[0]?.id??"default",n=ne;n?await x(n.samplingId,n.rule.ruleId,{name:n.rule.name,disabled:!e,sourceScopes:null,operation:null,percentageAtMost:t,notes:n.rule.notes}):e&&await S(i,{name:"Auto - Drop Traces Cluster-Wide",disabled:!1,sourceScopes:null,operation:null,percentageAtMost:t}),G(!1)},[u,ne,S,x]),xe=d(e=>{const t=gu[N];let i=null;switch(t){case"noisy":{const n=pu(e);i=mu(u,t,{sourceScopes:n.sourceScopes,operation:n.operation});break}case"highlyRelevant":{const n=du(e);i=mu(u,t,{sourceScopes:n.sourceScopes,operation:n.operation,error:n.error??!1,durationAtLeastMs:n.durationAtLeastMs});break}case"costReduction":{const n=cu(e);i=mu(u,t,{sourceScopes:n.sourceScopes,operation:n.operation});break}}return i?{message:Dd,ruleId:i}:null},[u,N]),we=d(e=>{const t=O?.category,i=O?.rule.ruleId;if(!t)return null;let n=null;switch(t){case"noisy":{const a=pu(e);n=mu(u,t,{sourceScopes:a.sourceScopes,operation:a.operation},i);break}case"highlyRelevant":{const a=du(e);n=mu(u,t,{sourceScopes:a.sourceScopes,operation:a.operation,error:a.error??!1,durationAtLeastMs:a.durationAtLeastMs},i);break}case"costReduction":{const a=cu(e);n=mu(u,t,{sourceScopes:a.sourceScopes,operation:a.operation},i);break}}return n?{message:Dd,ruleId:n}:null},[u,O]),ke=d(e=>{P(!1);for(const t of u){const i=[...t.noisyOperations.map(e=>({category:"noisy",rule:e})),...t.highlyRelevantOperations.map(e=>({category:"highlyRelevant",rule:e})),...t.costReductionRules.map(e=>({category:"costReduction",rule:e}))].find(t=>t.rule.ruleId===e);if(i)return z(!0),void E({category:i.category,rule:i.rule,samplingId:t.id,summary:hu(i.category,i.rule)})}},[u]),Te=a(()=>{const e=[];return i&&e.push({id:Or(),type:St.Button,buttonProps:{"data-id":"sampling-btn-docs",label:zd,leftIcon:ku,size:W.S,variant:K.Text,onClick:()=>window.open(i,"_blank")}}),e.push({id:Or(),type:St.Button,buttonProps:{"data-id":"sampling-btn-refresh",label:Rd,leftIcon:Zu,size:W.S,variant:K.Text,onClick:m,loading:h}}),e.push({id:Or(),type:St.Button,buttonProps:{"data-id":"sampling-btn-create-rule",label:Pd,rightIcon:wu,size:W.S,variant:K.Primary,onClick:se}}),e},[i,m,h,se]);return e(ic,{children:[e(T,{$gap:12,$justifyContent:"space-between",children:[t(nc,{icon:fh,title:Ld,subTitle:Xd}),t(ac,{actions:Te})]}),e($,{$gap:12,$fullHeight:!0,children:[t(F,{variant:Da.Underline,size:Zt.L,options:bu,selected:N,setSelected:A}),e(T,{$justifyContent:"space-between",children:[t(te,{status:ie.Default,message:fu[N]}),i&&t(H,{"data-id":"sampling-btn-docs-banner",label:"Docs",leftIcon:ku,size:W.S,variant:K.Text,onClick:()=>window.open(i,"_blank")})]}),N===tu.Noisy?t(qg,{title:Ee,summary:Z,onEdit:()=>M(!0)}):N===tu.HighlyRelevant?t(qg,{title:Ie,summary:ee,onEdit:()=>V(!0)}):N===tu.CostReduction?t(qg,{title:Ae,summary:ae,onEdit:()=>G(!0)}):null,t(oR,{title:vu[N],items:re,isLoading:h,showTypeFilter:N===tu.HighlyRelevant,onRuleClick:pe,onCreateRule:se,onEditRule:he,onDeleteRule:me})]}),t(dT,{formType:Zh.View,data:O,defaultEditMode:D,onClose:ue,onDelete:me,onSaveEdit:ge,sourceOptions:k,namespaceOptions:I,validateForm:we,onNavigateToDuplicate:ke}),t(dT,{formType:Zh.Create,isOpen:R,category:gu[N],onClose:ce,onSubmit:de,sourceOptions:k,namespaceOptions:I,validateForm:xe,onNavigateToDuplicate:ke}),t(dT,{formType:Zh.EditAutoNoisy,isOpen:_,enabled:g?.enabled??!1,keepPercentage:g?.keepPercentage??0,onClose:()=>M(!1),onSave:ve}),t(dT,{formType:Zh.EditAutoHighlyRelevant,isOpen:B,enabled:!!Q&&!Q.rule.disabled,onClose:()=>V(!1),onSave:ye}),t(dT,{formType:Zh.EditAutoCostReduction,isOpen:U,enabled:!!ne&&!ne.rule.disabled,dropPercentage:ne?.rule.percentageAtMost??25,onClose:()=>G(!1),onSave:Se}),t(Ce,{title:Bd,description:Fd,isOpen:!!X,onClose:fe,denyButton:{label:Md,variant:K.Secondary,onClick:fe},approveButton:{label:_d,variant:K.Primary,onClick:()=>{be(),fe()}}}),!1]})},rR=f.div`
|
|
2707
2707
|
padding: 12px;
|
|
2708
2708
|
border-radius: 12px;
|
|
2709
2709
|
background-color: ${({theme:e})=>e.v2.colors.silver[750]};
|
|
2710
|
-
`,
|
|
2710
|
+
`,sR=b(({id:e,data:i})=>t(rR,{"data-id":e,children:t(Z,{...i})}));var cR,dR;sR.displayName=sR.name,(e=>{e.MapItem="map-item",e.NoData="no-data"})(cR||(cR={})),(e=>{e.AnimatedTraffic="animated-traffic",e.SelfLoop="self-loop"})(dR||(dR={}));const pR=(e,t,i)=>{if(i)return{icons:[ah],aggService:e,selected:!0};const n=e.isVirtual,a=n?[ua(e)]:t?ha(t):[Uh],{priorotizedStatus:o}=n?{priorotizedStatus:void 0}:gd(t?.conditions||[]);return{icons:a,status:o,isVirtual:n,aggService:e,selected:!0}},uR=e=>!(!e||e.serviceName!==nw||e.id.namespace||e.id.name||e.id.kind),hR=e=>{const t=e.lastIndexOf("|");return-1===t?{graphKey:e,detail:""}:{graphKey:e.substring(0,t),detail:e.substring(t+1)}},gR={id:{namespace:"",name:"",kind:""},serviceName:nw,markedForInstrumentation:{markedForInstrumentation:!0}},mR=h(null),bR=()=>{const e=g(mR);if(!e)throw new Error("useServiceMapContext must be used within a ServiceMapProvider");return e},fR=({serviceMap:e,children:i})=>{const n=v(),{sourcesApi:r}=Hh(),{items:s}=r.useSources(),[c,p,u]=Tm([]),[h,g,m]=Im([]),[b,f]=l(0),y=d(()=>f(e=>e+1),[]),[S,x]=l(""),[w,C]=l(null),[k,T]=l(null),I=d(e=>T(t=>t===e?null:e),[]),$=d(()=>T(null),[]),[N,A]=l(!1),O=d(()=>A(e=>!e),[]),E=a(()=>h.some(e=>e.source===e.target||Boolean(e.data?.isSelfLoop)),[h]),D=d((e,t)=>{const i=new Set(e);p(e=>e.map(e=>e.type===cR.MapItem&&i.has(e.id)?{...e,data:{...e.data,selected:t}}:e))},[p]);o(()=>{let t=!1;const i=(e=>{const t=new Map,i=new Set,n=(e,i,n=!1)=>{let a=t.get(e);return a||(a={serviceName:i,isVirtual:n,attributes:{},connectionMap:new Map},t.set(e,a)),a},a=(e,t)=>{if(t)for(const{key:i,value:n}of t)i in e||(e[i]=n)};for(const t of e){const{graphKey:e}=hR(t.nodeId),o=n(e,t.serviceName);o.isVirtual=!1;for(const e of t.services){const{graphKey:t,detail:l}=hR(e?.nodeId??"");e.isVirtual&&(i.add(t),a(n(t,e.serviceName,!0).attributes,e.nodeAttributes));let r=o.connectionMap.get(t);if(r||(r={targetGraphKey:t,targetServiceName:e.serviceName,totalRequests:0,lastDateTime:e.dateTime,details:[]},o.connectionMap.set(t,r)),r.totalRequests+=e.requests,e.dateTime>r.lastDateTime&&(r.lastDateTime=e.dateTime),l){const t=r.details.find(e=>e.value===l);t?(t.requests+=e.requests,e.dateTime>t.dateTime&&(t.dateTime=e.dateTime)):r.details.push({value:l,requests:e.requests,dateTime:e.dateTime})}}}const o=[...t.entries()];for(const[,{connectionMap:e}]of o)for(const[a,o]of e)t.has(a)||n(a,o.targetServiceName,i.has(a));const l=[];for(const[e,{serviceName:i,isVirtual:n,attributes:a,connectionMap:o}]of t){const t=[...o.values()];t.sort((e,t)=>e.targetGraphKey.localeCompare(t.targetGraphKey)),l.push({graphKey:e,serviceName:i,isVirtual:n,connections:t,attributes:a})}return l.sort((e,t)=>e.graphKey.localeCompare(t.graphKey)),l})(e),a=(({sources:e,aggregatedServiceMap:t})=>{const i=[],n={x:0,y:0};if(t.length&&e.length)for(const a of t){const t=e.find(e=>a.serviceName===e.serviceName||a.serviceName===e.id.name),o=uR(t);i.push({id:a.graphKey,type:cR.MapItem,position:n,data:pR(a,t,o),measured:{width:80,height:80}})}else i.push({id:cR.NoData,type:cR.NoData,position:n,data:{subTitle:ke.ARE_SERVICES_INSTRUMENTED_AND_PRODUCING_TRAFFIC}});return i})({aggregatedServiceMap:i,sources:[gR].concat(s)});if(1===a.length&&a[0].id===cR.NoData)return p(a),g([]),x(""),void y();const o=(({theme:e,nodes:t,aggregatedServiceMap:i})=>{const n=[],a=new Map(t.map(e=>[e.id,e]));for(const t of i){const i=t.graphKey,o=a.get(i);if(!o)continue;const l=o.data?.status===ie.Error;for(const o of t.connections){const r=o.targetGraphKey;if(!a.has(r))continue;const s=i===r;n.push({id:`${i}-to-${r}`,type:s?dR.SelfLoop:"smoothstep",source:i,target:r,data:{sourceGraphKey:t.graphKey,targetGraphKey:o.targetGraphKey,isSelfLoop:s},markerEnd:{type:km.ArrowClosed},style:{stroke:l?e?.colors.dark_red:e?.colors.border}})}}return n})({theme:n,nodes:a,aggregatedServiceMap:i});g(o);const l=a.map(e=>e.id).sort().join("|");if(l!==S)return(async(e,t,i={})=>bm(e,t,{direction:"RIGHT",nodeWidth:80,nodeHeight:80,rootIds:e.some(e=>e.id===nw)?[nw]:[],rootLayerConstraint:"FIRST",spacing:{betweenLayers:150,nodeNode:120,edgeEdge:30,edgeNode:40},extraOptions:i}))(a,o).then(({nodes:e})=>{t||(p(e),x(l),y())}),()=>{t=!0};p(e=>{const t=new Map(e.map(e=>[e.id,e]));return a.map(e=>{const i=t.get(e.id);return i?e.type===cR.MapItem&&i.type===cR.MapItem?{...e,position:i.position,data:{...e.data,selected:i.data.selected}}:{...e,position:i.position}:e})})},[n,e,s,S]);const z=a(()=>{const e=N?h:h.filter(e=>e.source!==e.target&&!e.data?.isSelfLoop);return w||k?e.map(e=>{if(e.source===w||e.target===w||e.source===k||e.target===k)return{...e,type:dR.AnimatedTraffic};const t={opacity:.3};return{...e,style:{...e.style,...t},labelStyle:{...e.labelStyle,...t},labelBgStyle:{...e.labelBgStyle,...t}}}):e},[h,N,w,k]),R=a(()=>({nodes:c,edges:z,onNodesChange:u,onEdgesChange:m,setNodesSelected:D,fitViewTrigger:b,hoveredNodeId:w,setHoveredNodeId:C,activeNodeId:k,toggleActiveNode:I,resetActiveNode:$,showSelfLoops:N,hasSelfLoops:E,toggleShowSelfLoops:O}),[c,z,u,m,D,b,w,k,I,$,N,E,O]);return t(mR.Provider,{value:R,children:i})},vR=f.div`
|
|
2711
2711
|
border: 1px ${({theme:e,$isSelected:t,$isVirtual:i})=>t?`solid ${e.v2.colors.blue[300]}`:i?`dashed ${e.v2.colors.silver[300]}`:"solid transparent"};
|
|
2712
2712
|
border-radius: 8px;
|
|
2713
2713
|
cursor: pointer;
|
|
2714
2714
|
opacity: ${({$isVirtual:e})=>e?.8:1};
|
|
2715
|
-
`,vR=f.div`
|
|
2716
|
-
position: relative;
|
|
2717
2715
|
`,yR=f.div`
|
|
2716
|
+
position: relative;
|
|
2717
|
+
`,SR=f.div`
|
|
2718
2718
|
position: absolute;
|
|
2719
2719
|
top: 100%;
|
|
2720
2720
|
left: 50%;
|
|
@@ -2723,7 +2723,7 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2723
2723
|
align-items: center;
|
|
2724
2724
|
gap: 4px;
|
|
2725
2725
|
margin-top: 4px;
|
|
2726
|
-
`,
|
|
2726
|
+
`,xR=b(({id:n,data:o})=>{const{icons:l,status:r,isVirtual:s}=o,c=v(),{activeNodeId:d,hoveredNodeId:p}=bR(),{isUserSource:u,isNodeSelected:h,isHovered:g}=a(()=>({isUserSource:n===nw,isNodeSelected:d===n,isHovered:p===n}),[n,d,p,n]),{isSelected:m,isHighlighted:b}=a(()=>({isSelected:h||u,isHighlighted:h||g||u}),[h,g,u]),f=r?$a(r,c):null;return e(i,{children:[t(wm,{type:"source",position:Cm.Right,style:{visibility:"hidden"}}),t(wm,{type:"target",position:Cm.Left,style:{visibility:"hidden"}}),e(yR,{"data-id":n,children:[t(vR,{$isSelected:m,$isVirtual:s,children:t(ga,{padding:12,icons:l,status:b?ie.Info:r})}),e(SR,{children:[f&&t(f,{}),t(w,{size:C.XXS,nowrap:!0,children:n})]})]})]})});xR.displayName=xR.name;const wR=b(({id:e,sourceX:i,sourceY:n,targetX:a,targetY:o,markerEnd:l,style:r})=>{const[s]=vm({sourceX:i,sourceY:n,targetX:a,targetY:o,isSelfLoop:!0,selfLoopNodeHeight:80});return t($m,{id:e,path:s,markerEnd:l,style:r})});wR.displayName=wR.name;const CR=f.div`
|
|
2727
2727
|
display: flex;
|
|
2728
2728
|
flex-direction: column;
|
|
2729
2729
|
gap: 12px;
|
|
@@ -2736,10 +2736,10 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2736
2736
|
top: 16px;
|
|
2737
2737
|
left: 8px;
|
|
2738
2738
|
z-index: ${({theme:e})=>e.v2.zIndex.island};
|
|
2739
|
-
`,
|
|
2739
|
+
`,kR=({children:e})=>t(CR,{children:e});var TR,IR;(e=>{e.All="All",e.Inbound="Inbound",e.Outbound="Outbound"})(TR||(TR={})),(e=>{e.Inbound="Inbound",e.Outbound="Outbound"})(IR||(IR={}));const $R=f.div`
|
|
2740
2740
|
flex: 1 1 auto;
|
|
2741
2741
|
min-height: 0;
|
|
2742
|
-
|
|
2742
|
+
`,NR=()=>{const{nodes:i,activeNodeId:n,resetActiveNode:o}=bR(),[r,s]=l(TR.All),c=a(()=>{const e=new Map;for(const t of i)t.type===cR.MapItem&&e.set(t.id,t);return e},[i]),d=a(()=>c.get(n??""),[c,n]),{inbound:p,outbound:u}=a(()=>{const e=[],t=[];if(!d)return{inbound:e,outbound:t};for(const e of d.data.aggService?.connections??[])t.push({peerId:e.targetGraphKey,direction:IR.Outbound});for(const t of c.values())if(t.id!==d.id)for(const i of t.data.aggService?.connections??[])i.targetGraphKey===d.id&&e.push({peerId:t.id,direction:IR.Inbound});return e.sort((e,t)=>e.peerId.localeCompare(t.peerId)),t.sort((e,t)=>e.peerId.localeCompare(t.peerId)),{inbound:e,outbound:t}},[d,c]);if(!d)return null;const h=[TR.All,TR.Inbound].includes(r)&&p.length>0,g=[TR.All,TR.Outbound].includes(r)&&u.length>0;return e(kR,{children:[e(T,{$width:"100%",$gap:8,children:[t(H,{variant:K.Text,size:W.S,leftIcon:qu,onClick:o}),t(ga,{icons:d.data.icons}),t(w,{size:C.XS,children:d.id})]}),t(F,{fullWidth:!0,options:[{label:`${TR.All}`,value:TR.All,badge:{label:`${p.length+u.length}`}},{label:`${TR.Inbound}`,value:TR.Inbound,badge:{label:`${p.length}`}},{label:`${TR.Outbound}`,value:TR.Outbound,badge:{label:`${u.length}`}}],selected:r,setSelected:s}),h&&t(OR,{halfHeight:g,title:"Inbound",icon:Du,connections:p,mapNodesById:c}),g&&t(OR,{halfHeight:h,title:"Outbound",icon:zu,connections:u,mapNodesById:c})]})},AR=f.div`
|
|
2743
2743
|
display: flex;
|
|
2744
2744
|
flex-direction: column;
|
|
2745
2745
|
gap: 8px;
|
|
@@ -2747,17 +2747,17 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2747
2747
|
border-radius: 12px;
|
|
2748
2748
|
background-color: ${({theme:e})=>e.v2.colors.silver[900]};
|
|
2749
2749
|
height: ${({$halfHeight:e})=>e?"48%":"100%"};
|
|
2750
|
-
`,
|
|
2750
|
+
`,OR=({halfHeight:i,title:n,icon:a,connections:o,mapNodesById:l})=>{const r=v();return e(AR,{$halfHeight:i,children:[e(T,{children:[t(a,{size:16,fill:r.v2.colors.grey[300]}),t(w,{size:C.XXS,color:k.Secondary,children:n})]}),t($R,{children:t(ca,{gap:4,elements:o.map(e=>t(DR,{connection:e,peerNode:l.get(e.peerId)},`${e.direction}-${e.peerId}`))})})]})},ER=f.div`
|
|
2751
2751
|
display: flex;
|
|
2752
2752
|
align-items: center;
|
|
2753
2753
|
gap: 8px;
|
|
2754
2754
|
padding: 8px;
|
|
2755
2755
|
border-radius: 8px;
|
|
2756
2756
|
background-color: ${({theme:e})=>e.v2.colors.silver[900]};
|
|
2757
|
-
`,
|
|
2757
|
+
`,DR=({connection:i,peerNode:n})=>e(ER,{children:[n&&t(ga,{icons:n.data.icons}),t(w,{size:C.XXS,children:i.peerId})]}),zR=b(e=>{const i=v(),n={mode:"fixed",selfLoopNodeHeight:80,isSelfLoop:e.source===e.target||Boolean(e.data?.isSelfLoop),trackColor:i.v2.colors.blue[700],ballColorSmall:i.v2.colors.blue[900],ballColorLarge:i.v2.colors.blue[500]};return t(ym,{...e,data:n})});zR.displayName=zR.name;const RR=f.div`
|
|
2758
2758
|
flex: 1 1 auto;
|
|
2759
2759
|
min-height: 0;
|
|
2760
|
-
`,
|
|
2760
|
+
`,PR=({})=>{const{nodes:i,setNodesSelected:n,resetActiveNode:o}=bR(),[r,s]=l(""),c=a(()=>i.filter(e=>e.type===cR.MapItem).sort((e,t)=>e.id.localeCompare(t.id)),[i]),p=a(()=>c.filter(e=>e.data.selected),[c]),u=a(()=>c.filter(e=>e.id.toLowerCase().includes(r.toLowerCase())),[c,r]),h=a(()=>u.every(e=>e.data.selected),[u]),g=d(()=>{const e=!h;n(u.map(e=>e.id),e),e||o()},[u,h,n,o]);return c.length?e(kR,{children:[e(T,{$width:"100%",$gap:8,children:[t(w,{size:C.XS,children:"Services"}),t(E,{label:c.length})]}),t(sa,{width:"100%",value:r,onChange:s}),e(T,{$width:"100%",$justifyContent:"space-between",children:[t(w,{size:C.XXXS,children:`Showing ${p.length} out of ${c.length}`}),t(w,{"data-id":"namespaces-select-all",onClick:g,disabled:!u.length,size:C.XS,children:h?ke.UNSELECT_ALL:ke.SELECT_ALL})]}),t(RR,{children:t(ca,{gap:4,elements:u.map(e=>t(LR,{node:e},e.id))})})]}):null},XR=f.div`
|
|
2761
2761
|
display: flex;
|
|
2762
2762
|
align-items: center;
|
|
2763
2763
|
gap: 8px;
|
|
@@ -2765,7 +2765,7 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2765
2765
|
border-radius: 8px;
|
|
2766
2766
|
background-color: ${({theme:e})=>e.v2.colors.silver[900]};
|
|
2767
2767
|
cursor: pointer;
|
|
2768
|
-
`,
|
|
2768
|
+
`,LR=({node:i})=>{const{setNodesSelected:n,activeNodeId:a,resetActiveNode:o}=bR(),l=d(()=>{const e=!i.data.selected,t=a===i.id;n([i.id],e),!e&&t&&o()},[i,a,n,o]);return e(XR,{onClick:l,children:[t(x,{value:i.data.selected||!1,onChange:l}),t(ga,{icons:i.data.icons}),t(w,{size:C.XXS,children:i.id})]},i.id)},_R=f.div`
|
|
2769
2769
|
position: relative;
|
|
2770
2770
|
height: 100%;
|
|
2771
2771
|
.react-flow__attribution {
|
|
@@ -2774,7 +2774,7 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2774
2774
|
* {
|
|
2775
2775
|
transition: none;
|
|
2776
2776
|
}
|
|
2777
|
-
`,
|
|
2777
|
+
`,MR=f.div`
|
|
2778
2778
|
.react-flow__controls {
|
|
2779
2779
|
display: flex;
|
|
2780
2780
|
align-items: center;
|
|
@@ -2817,33 +2817,33 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2817
2817
|
}
|
|
2818
2818
|
}
|
|
2819
2819
|
}
|
|
2820
|
-
`,
|
|
2820
|
+
`,FR={[cR.MapItem]:xR,[cR.NoData]:sR},BR={[dR.AnimatedTraffic]:zR,[dR.SelfLoop]:wR},VR={duration:300,padding:.1,includeHiddenNodes:!0,maxZoom:1},UR=({onRefresh:i})=>{const{nodes:n,edges:o,fitViewTrigger:l,onNodesChange:r,onEdgesChange:s,setHoveredNodeId:c,toggleActiveNode:d,showSelfLoops:p,hasSelfLoops:u,toggleShowSelfLoops:h}=bR(),g=a(()=>{const e=new Set(n.filter(e=>e.type===cR.MapItem&&e.data.selected).map(e=>e.id)),t=new Set;for(const i of o)e.has(i.source)&&t.add(i.target),e.has(i.target)&&t.add(i.source);return n.filter(e=>e.type!==cR.MapItem||e.data.selected||t.has(e.id))},[n,o]);return e(Am,{zoomOnScroll:!0,nodes:g,nodeTypes:FR,edges:o,edgeTypes:BR,onNodeClick:(e,t)=>d(t.id),onNodeMouseEnter:(e,t)=>c(t.id),onNodeMouseLeave:()=>c(null),onNodesChange:r,onEdgesChange:s,children:[t(Om,{}),t(Sm,{trigger:l,options:VR}),t(MR,{children:e(Em,{position:"top-right",orientation:"horizontal",showInteractive:!1,showZoom:!0,showFitView:!0,fitViewOptions:VR,children:[u&&t(Dm,{title:p?"Hide self-loops":"Show self-loops","aria-label":p?"Hide self-loops":"Show self-loops","aria-pressed":p,onClick:h,children:t(Gh,{})}),t(Dm,{title:"Refresh","aria-label":"Refresh",onClick:i,children:t(Zu,{})})]})})]})},GR=i=>t(Nm,{children:e(_R,{children:[t(UR,{...i}),t(PR,{}),t(NR,{})]})}),jR=f.div`
|
|
2821
2821
|
width: 100%;
|
|
2822
2822
|
flex: 1;
|
|
2823
2823
|
align-self: stretch;
|
|
2824
2824
|
min-height: 0;
|
|
2825
2825
|
height: 100%;
|
|
2826
2826
|
position: relative;
|
|
2827
|
-
`,
|
|
2827
|
+
`,HR=()=>{const{serviceMapApi:e}=Hh(),{data:i,refetch:n}=e.useServiceMap({pollInterval:5e3,fetchPolicy:"cache-and-network"});return t(fR,{serviceMap:i?.serviceMap??[],children:t(jR,{children:t(GR,{onRefresh:n})})})},WR=f.div`
|
|
2828
2828
|
display: flex;
|
|
2829
2829
|
align-items: center;
|
|
2830
2830
|
justify-content: space-between;
|
|
2831
2831
|
padding: 0 12px;
|
|
2832
|
-
`,
|
|
2832
|
+
`,KR=f.div`
|
|
2833
2833
|
display: flex;
|
|
2834
2834
|
align-items: center;
|
|
2835
2835
|
gap: 8px;
|
|
2836
|
-
`,
|
|
2836
|
+
`,YR=f.div`
|
|
2837
2837
|
width: 1px;
|
|
2838
2838
|
height: 20px;
|
|
2839
2839
|
background-color: ${({theme:e})=>e.v2.colors.silver[500]};
|
|
2840
|
-
`,
|
|
2840
|
+
`,JR=({disabled:i,loading:n,onClickShowYaml:o,onClickReset:r,onClickRefresh:s})=>{const c=v(),[d,p]=l(!1),u=a(()=>o?[{id:Or(),type:St.Button,buttonProps:{label:"Show Config YAML",leftIcon:Vh,size:W.S,variant:K.Secondary,onClick:o,disabled:i}}]:[],[o,i]),h=a(()=>{const e=[];return s&&e.push({id:Or(),type:St.Button,buttonProps:{leftIcon:Zu,tooltip:"Refresh",hideTooltipIcon:!0,size:W.S,variant:K.Text,onClick:s,disabled:i,loading:n}}),r&&e.push({id:Or(),type:St.Button,buttonProps:{leftIcon:xu,tooltip:"Reset to defaults",hideTooltipIcon:!0,size:W.S,variant:K.Text,textColor:c.v2.colors.red[500],onClick:()=>p(!0),disabled:i}}),e},[i,n,r,s,c]),g=u.length>0,m=h.length>0;return e(WR,{children:[t(nc,{icon:Qu,title:"Odigos Settings"}),e(KR,{children:[g&&t(ac,{actions:u}),g&&m&&t(YR,{}),m&&t(ac,{actions:h})]}),t(Ce,{isOpen:d,onClose:()=>p(!1),title:"Reset Settings",description:"Are you sure you want to reset the settings? This will clear the odigos-local-ui-config and reset the settings to the default values.",denyButton:{label:"Deny",variant:K.Secondary,onClick:()=>p(!1)},approveButton:{label:"Approve",variant:K.Primary,onClick:()=>{r?.(),p(!1)}}})]})},qR=f($)`
|
|
2841
2841
|
width: 220px;
|
|
2842
2842
|
flex-shrink: 0;
|
|
2843
2843
|
height: 100%;
|
|
2844
2844
|
gap: 4px;
|
|
2845
2845
|
overflow-y: auto;
|
|
2846
|
-
`,
|
|
2846
|
+
`,ZR=({options:e,selected:i,setSelected:n,disabled:a})=>t(qR,{children:e.map(e=>t(Mm,{dataId:`settings-nav-${e.id}`,title:e.label,isSelected:i===e.id,disabled:a,onClick:()=>n(e.id)},e.id))}),QR=f($)`
|
|
2847
2847
|
width: 100%;
|
|
2848
2848
|
/* side menu (220) + gap (24) + form (600) = 844, so content fills exactly with no dead space */
|
|
2849
2849
|
max-width: 844px;
|
|
@@ -2853,25 +2853,25 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2853
2853
|
gap: 24px;
|
|
2854
2854
|
flex: 1;
|
|
2855
2855
|
min-height: 0;
|
|
2856
|
-
`,
|
|
2856
|
+
`,eP=f(T)`
|
|
2857
2857
|
flex: 1;
|
|
2858
2858
|
min-height: 0;
|
|
2859
2859
|
width: 100%;
|
|
2860
2860
|
align-self: stretch;
|
|
2861
|
-
`,
|
|
2861
|
+
`,tP=f($)`
|
|
2862
2862
|
flex: 1;
|
|
2863
2863
|
min-height: 0;
|
|
2864
2864
|
height: 100%;
|
|
2865
2865
|
max-width: 600px;
|
|
2866
2866
|
overflow-y: auto;
|
|
2867
|
-
`,
|
|
2867
|
+
`,iP=f(T)`
|
|
2868
2868
|
gap: 8px;
|
|
2869
2869
|
width: 100%;
|
|
2870
2870
|
align-items: center;
|
|
2871
|
-
`,
|
|
2871
|
+
`,nP=f.div`
|
|
2872
2872
|
flex: 1;
|
|
2873
2873
|
min-width: 0;
|
|
2874
|
-
`,
|
|
2874
|
+
`,aP=e=>"general"===e.name?0:"advanced"===e.name?2:1,oP=({minSupportedVersion:n})=>{const{isVersionSupported:r,version:s,isEnterprise:c,minSupportedVersion:d}=Mp(n),{configApi:p}=Hh(),{data:u,loading:h}=p.useConfigYamls(),{data:g,loading:m,refetch:b}=p.useEffectiveConfig(),f=u?.configYamls??[],[v,y]=l(!1),S=a(()=>{if(!g)return{};const{manifestYAML:e,provenance:t,...i}=g;return i},[g]),{formData:x,handleFormChange:I,getNestedValue:N,getFormDiff:A,isFormDirty:O}=Gn(S);o(()=>{"{}"!==JSON.stringify(S)&&"{}"===JSON.stringify(x)&&I(void 0,void 0,S)},[S,x]);const D=a(()=>[...f].sort((e,t)=>aP(e)-aP(t)),[f]),z=a(()=>(e=>{if(!e)return{};const t={};for(const i of e)t[i.helmPath]=i.reconciledFrom;return t})(g?.provenance),[g?.provenance]),R=a(()=>{const e=new Set;for(const t of f)for(const i of t.fields)i.componentType===_n.Dropdown&&e.add(i.helmValuePath);return e},[f]),P=a(()=>f.flatMap(e=>e.fields.map(e=>({name:e.helmValuePath,value:N("formData",e.helmValuePath)}))),[f,x,N]),[X,L]=l(!1),[_,M]=l(!1),F=a(()=>[{id:Or(),type:St.Button,buttonProps:{"data-id":"settings-save",variant:K.Primary,size:W.S,label:"Save Changes",leftIcon:Lu,loading:v,onClick:()=>L(!0)}},{id:Or(),type:St.Button,buttonProps:{"data-id":"settings-cancel",variant:K.Secondary,size:W.S,label:"Cancel",leftIcon:Xu,onClick:()=>I(void 0,void 0,S)}}],[v,A,S,x,I]),B=a(()=>D.map(e=>({id:e.name,label:e.displayName})),[D]),V=a(()=>D.map(e=>e.name),[D]),{selectedSection:U,setSelectedSection:G,setSectionRef:j,setScrollContainerRef:H}=Vd({sectionNames:V});return t(ic,{$gap:24,children:e(QR,{children:[t(JR,{disabled:!r,loading:h||m,onClickShowYaml:()=>M(!0),onClickReset:async()=>{await(async()=>{p.resetLocalUiConfigToDefaults&&await p.resetLocalUiConfigToDefaults()})(),await(b?.()),I(void 0,void 0,{})},onClickRefresh:b?()=>b():void 0}),e(id,{children:[!r&&t(fm,{minSupportedVersion:d,currentVersion:s||""}),t(vt,{isOpen:O,richTitle:{icon:Qu,title:"Config Settings"},actions:F}),t(Ce,{isOpen:X,title:"Save Changes via UI?",description:"We recommend updating via your Helm values.yaml to ensure changes are version-controlled and go through a proper review process.",onClose:()=>L(!1),denyButton:{label:"Keep editing",variant:K.Secondary,onClick:()=>L(!1)},approveButton:{label:"Save changes",variant:K.Primary,onClick:()=>{(async()=>{const e=((e,t)=>{const i=(e,t,i)=>{for(let i=0;i<t.length-1;i++){const n=t[i];n in e&&"object"==typeof e[n]&&null!==e[n]||(e[n]={}),e=e[n]}e[t[t.length-1]]=i},n=JSON.parse(JSON.stringify(e));for(const e of t){const t=e.split(".");let a=n;for(const e of t){if(null==a||"object"!=typeof a){a=void 0;break}a=a[e]}"string"==typeof a&&i(n,t,a.replaceAll("-","_"))}return n})(A(S,x),R);await(async e=>{p.updateLocalUiConfig&&(y(!0),await p.updateLocalUiConfig(e),y(!1),await b())})(e),I(void 0,void 0,{})})(),L(!1)}}}),e(eP,{$gap:24,$alignItems:"stretch",children:[!!f.length&&t(ZR,{options:B,selected:U,setSelected:G,disabled:!r}),t(tP,{ref:H,$gap:24,$width:"100%",children:f.length?D.map(n=>t(Re,{id:n.name,bordered:!0,ref:e=>j(n.name,e),customTitle:t(w,{size:C.M,weight:500,color:k.Primary,children:n.displayName}),children:t($,{$gap:24,children:n.fields.map(n=>{if(n.isEnterpriseOnly&&!c)return null;if(n.renderCondition&&!Hn(n.renderCondition,[],P))return null;const a=xn(n.componentProps||"{}",{}),o=z[n.helmValuePath],l=n.componentType===_n.Toggle,r=t(w,{size:C.XS,weight:500,color:k.Primary,children:n.displayName}),s=(e=>{if(e)return"odigos-local-ui-config"===e?{status:ie.Warning,label:"Edited in UI",tooltip:`Reconciled from ${e}`}:"odigos-configuration"===e?{status:ie.Unknown,useSecondaryTone:!0,label:"Cluster config",tooltip:`Reconciled from ${e}`}:{status:ie.Unknown,useSecondaryTone:!0,label:e,tooltip:`Reconciled from ${e}`}})(o),d=s?t(E,{...s}):null,p=n.description?t(w,{size:C.XXS,color:k.Secondary,children:n.description}):null,u=e($,{$gap:4,children:[e(T,{$gap:8,$alignItems:"center",children:[r,d]}),p]}),h=t(xm,{componentType:n.componentType,inputType:a.type,name:n.helmValuePath,disabled:n.isHelmOnly||v,value:N("formData",n.helmValuePath),setValue:e=>I(n.helmValuePath,e),dropdownOptions:a.options?.map(e=>({id:e,label:e})),dropdownNoSearch:!0,dropdownNoCheckbox:!0,toggleSize:Vi.S},n.helmValuePath),g=n.isHelmOnly?t(ce,{text:"This field can only be updated via the Helm values.yaml file",children:t(Ah,{})}):null;return t($,{$gap:8,children:l?e(T,{$gap:12,$justifyContent:"space-between",$alignItems:"flex-start",children:[u,e(T,{$gap:8,$alignItems:"center",children:[g,h]})]}):e(i,{children:[u,e(iP,{children:[t(nP,{children:h}),g]})]})},n.helmValuePath)})})},n.name)):h?t(oi,{$height:"30vh",children:t(Ve,{withSpinner:!0})}):t(Re,{richTitle:{icon:Qu,title:"Config Settings"},children:t(Z,{title:"YAML not found",subTitle:"The YAML for this resource is not available"})})})]}),t(ln,{isOpen:_,width:"40vw",minWidth:"480px",header:{icon:Vh,title:"Effective Config YAML",onClose:()=>M(!1)},children:m&&!g?.manifestYAML?t(oi,{$height:"30vh",children:t(Ve,{withSpinner:!0})}):t(dm,{yaml:g?.manifestYAML?.replaceAll(" |",""),defaultOpen:!0,fullHeight:!0})})]})]})})},lP=f.div`
|
|
2875
2875
|
position: fixed;
|
|
2876
2876
|
bottom: 12px;
|
|
2877
2877
|
left: 12px;
|
|
@@ -2880,19 +2880,19 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2880
2880
|
flex-direction: column-reverse;
|
|
2881
2881
|
gap: 6px;
|
|
2882
2882
|
max-width: 600px;
|
|
2883
|
-
`,
|
|
2883
|
+
`,rP=()=>{const{notifications:e,markAsDismissed:i,markAsSeen:n}=Yn(),a=e.filter(({dismissed:e})=>!e);return t(lP,{children:a.map(({id:e,type:o,title:l,message:r},s)=>{const c=r||l;if(!c)return null;const d=a.length-s;return t(te,{status:o,message:c,onClose:({asSeen:t})=>(({id:e,asSeen:t})=>{i(e),t&&n(e)})({id:e,asSeen:t}),zIndex:d},`toast-${e}`)})})},sP=f.div`
|
|
2884
2884
|
display: flex;
|
|
2885
2885
|
align-items: center;
|
|
2886
2886
|
flex-wrap: wrap;
|
|
2887
2887
|
gap: 8px;
|
|
2888
2888
|
min-width: 0;
|
|
2889
2889
|
max-width: 100%;
|
|
2890
|
-
`,
|
|
2890
|
+
`,cP=f.div`
|
|
2891
2891
|
display: flex;
|
|
2892
2892
|
align-items: center;
|
|
2893
2893
|
gap: 8px;
|
|
2894
2894
|
min-width: 0;
|
|
2895
|
-
`,
|
|
2895
|
+
`,dP=f.div`
|
|
2896
2896
|
display: flex;
|
|
2897
2897
|
align-items: center;
|
|
2898
2898
|
width: fit-content;
|
|
@@ -2901,18 +2901,18 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2901
2901
|
padding: 4px 8px;
|
|
2902
2902
|
border-radius: 6px;
|
|
2903
2903
|
background-color: ${({theme:e})=>e.v2.colors.grey[500]};
|
|
2904
|
-
`;function
|
|
2904
|
+
`;function pP(e){return[e.namespace,e.name].filter(Boolean).join("/")||e.kind||"unknown"}function uP(e){const t=pP(e);return e.kind&&t!==e.kind?`${e.kind} ${t}`:t}function hP({label:e,wide:i}){return t(dP,{$wide:i,children:t(Q,{size:C.XXS,color:k.Primary,nowrap:!0,fullText:e,children:e})})}function gP({count:e,items:i}){return e<=0?null:t(ce,{text:i,maxWidth:360,children:t(Xi,{variant:_i.Default,label:`+${e}`})})}function mP({label:i,items:n}){if(!n.length)return null;const a=n.slice(0,2),o=n.slice(2),l=1===n.length;return e(cP,{children:[t(w,{size:C.XXXS,color:k.Secondary,nowrap:!0,children:i}),a.map(e=>t(hP,{label:e,wide:l},e)),t(gP,{count:o.length,items:o})]})}function bP({sources:i}){if(!i.length)return null;const n=i.slice(0,2),a=i.slice(2),o=1===i.length,l=new Map;for(const e of n){const t=e.kind||Wd,i=l.get(t)??[];i.push(e),l.set(t,i)}return e(cP,{children:[[...l.entries()].map(([i,n])=>e(cP,{children:[t(w,{size:C.XXXS,color:k.Secondary,nowrap:!0,children:i}),n.map(e=>t(hP,{label:pP(e),wide:o},`${e.kind}-${e.namespace}-${e.name}`))]},i)),t(gP,{count:a.length,items:a.map(uP)})]})}const fP=({scopes:i})=>{if(Yp(i))return t(Xi,{variant:_i.Default,label:Ud});const a=i.languages??[],o=i.namespaces??[],l=i.sources??[],r=[a.length?t(mP,{label:Gd,items:a},"languages"):null,o.length?t(mP,{label:jd,items:o},"namespaces"):null,l.length?t(bP,{sources:l},"sources"):null].filter(Boolean);return t(sP,{children:r.map((i,a)=>e(n.Fragment,{children:[a>0&&t(w,{size:C.XXXS,color:k.Secondary,nowrap:!0,children:Hd}),i]},a))})},vP=f($)`
|
|
2905
2905
|
gap: 12px;
|
|
2906
2906
|
width: 100%;
|
|
2907
|
-
`,
|
|
2907
|
+
`,yP=f($)`
|
|
2908
2908
|
gap: 4px;
|
|
2909
2909
|
min-width: 0;
|
|
2910
|
-
`,
|
|
2910
|
+
`,SP=f.div`
|
|
2911
2911
|
width: 100%;
|
|
2912
2912
|
border: 1px solid ${({theme:e})=>e.v2.colors.silver[800]};
|
|
2913
2913
|
border-radius: 12px;
|
|
2914
2914
|
overflow: hidden;
|
|
2915
|
-
`,
|
|
2915
|
+
`,xP=f.div`
|
|
2916
2916
|
display: flex;
|
|
2917
2917
|
align-items: center;
|
|
2918
2918
|
gap: 8px;
|
|
@@ -2928,35 +2928,35 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2928
2928
|
opacity: 1;
|
|
2929
2929
|
pointer-events: auto;
|
|
2930
2930
|
}
|
|
2931
|
-
`,
|
|
2931
|
+
`,wP=f.div`
|
|
2932
2932
|
display: flex;
|
|
2933
2933
|
min-width: 0;
|
|
2934
2934
|
align-items: center;
|
|
2935
2935
|
flex-wrap: wrap;
|
|
2936
2936
|
gap: 8px;
|
|
2937
|
-
`,
|
|
2937
|
+
`,CP=f.div`
|
|
2938
2938
|
display: flex;
|
|
2939
2939
|
flex-shrink: 0;
|
|
2940
2940
|
opacity: 0;
|
|
2941
2941
|
pointer-events: none;
|
|
2942
2942
|
transition: opacity 0.15s ease;
|
|
2943
|
-
`,
|
|
2943
|
+
`,kP=f.div`
|
|
2944
2944
|
display: flex;
|
|
2945
2945
|
justify-content: center;
|
|
2946
2946
|
width: 100%;
|
|
2947
2947
|
padding: 4px 16px;
|
|
2948
|
-
`,
|
|
2948
|
+
`,TP=({rules:n,onDelete:a,onAdd:o})=>{const[r,s]=l(null),c=o?t(H,{"data-id":"url-templatization-disabled-scopes-add",label:Kd,leftIcon:wu,variant:K.Text,size:W.S,onClick:o}):null;return e(i,{children:[e(vP,{"data-id":"url-templatization-disabled-scopes-table",children:[e(yP,{children:[t(w,{size:C.S,color:k.Primary,children:Yd}),t(w,{size:C.XXS,color:k.Secondary,children:Jd(n.length)})]}),e(SP,{children:[n.map(i=>{const n=i.group.scopes??Jp(),o=`${i.actionId}-${i.groupIndex}`;return e(xP,{children:[e(wP,{children:[t(fP,{scopes:n}),t(E,{label:Ql,status:ie.Warning,textSize:C.XXXS})]}),!!a&&t(CP,{className:"url-templatization-disabled-scope-delete",children:t(bn,{"data-id":`url-templatization-disabled-scope-delete-${o}`,icon:xu,size:fn.S,onClick:()=>s(i)})})]},o)}),!!c&&t(kP,{children:c})]})]}),t(cm,{isOpen:!!r,onClose:()=>s(null),onApprove:()=>{r&&a?.(r)},target:Qd,description:Zd,overrideApproveButtonLabel:qd})]})},IP=f($)`
|
|
2949
2949
|
gap: 12px;
|
|
2950
2950
|
width: 100%;
|
|
2951
|
-
|
|
2951
|
+
`,$P=f($)`
|
|
2952
2952
|
gap: 4px;
|
|
2953
2953
|
min-width: 0;
|
|
2954
|
-
|
|
2954
|
+
`,NP=f.div`
|
|
2955
2955
|
width: 100%;
|
|
2956
2956
|
border: 1px solid ${({theme:e})=>e.v2.colors.silver[800]};
|
|
2957
2957
|
border-radius: 12px;
|
|
2958
2958
|
overflow: hidden;
|
|
2959
|
-
`,
|
|
2959
|
+
`,AP=f.div`
|
|
2960
2960
|
display: flex;
|
|
2961
2961
|
align-items: center;
|
|
2962
2962
|
gap: 8px;
|
|
@@ -2972,37 +2972,37 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2972
2972
|
opacity: 1;
|
|
2973
2973
|
pointer-events: auto;
|
|
2974
2974
|
}
|
|
2975
|
-
`,
|
|
2975
|
+
`,OP=f.div`
|
|
2976
2976
|
display: flex;
|
|
2977
2977
|
min-width: 0;
|
|
2978
2978
|
align-items: center;
|
|
2979
2979
|
flex-wrap: wrap;
|
|
2980
2980
|
gap: 8px;
|
|
2981
|
-
`,
|
|
2981
|
+
`,EP=f.div`
|
|
2982
2982
|
display: flex;
|
|
2983
2983
|
flex-shrink: 0;
|
|
2984
2984
|
opacity: 0;
|
|
2985
2985
|
pointer-events: none;
|
|
2986
2986
|
transition: opacity 0.15s ease;
|
|
2987
|
-
`,
|
|
2987
|
+
`,DP=f.div`
|
|
2988
2988
|
display: flex;
|
|
2989
2989
|
justify-content: center;
|
|
2990
2990
|
width: 100%;
|
|
2991
2991
|
padding: 4px 16px;
|
|
2992
|
-
`,
|
|
2992
|
+
`,zP=({rules:n,onDelete:a,onAdd:o})=>{const[r,s]=l(null),c=o?t(H,{"data-id":"url-templatization-skip-policies-add",label:ep,leftIcon:wu,variant:K.Text,size:W.S,onClick:o}):null;return e(i,{children:[e(IP,{"data-id":"url-templatization-skip-policies-table",children:[e($P,{children:[t(w,{size:C.S,color:k.Primary,children:tp}),t(w,{size:C.XXS,color:k.Secondary,children:ip(n.length)})]}),e(NP,{children:[n.map(i=>{const n=i.group.scopes??Jp(),o=`${i.actionId}-${i.groupIndex}`,l=(e=>{const t=e.skipPolicy;if(!t)return"";const i=!!t.skipForNonSuccessCodes,n=(t.skipHttpStatusCodes??[]).filter(e=>Number.isInteger(e));return i?"Skip non-2xx":1===n.length?`Skip HTTP ${n[0]}`:n.length>1?`Skip HTTP ${n.join(", ")}`:""})(i.group);return e(AP,{children:[e(OP,{children:[t(fP,{scopes:n}),!!l&&t(E,{label:l,status:ie.Info,textSize:C.XXXS})]}),!!a&&t(EP,{className:"url-templatization-skip-policy-delete",children:t(bn,{"data-id":`url-templatization-skip-policy-delete-${o}`,icon:xu,size:fn.S,onClick:()=>s(i)})})]},o)}),!!c&&t(DP,{children:c})]})]}),t(cm,{isOpen:!!r,onClose:()=>s(null),onApprove:()=>{r&&a?.(r)},target:op,description:ap,overrideApproveButtonLabel:np})]})},RP=f($)`
|
|
2993
2993
|
width: 100%;
|
|
2994
2994
|
gap: 24px;
|
|
2995
|
-
`,
|
|
2995
|
+
`,PP=f($)`
|
|
2996
2996
|
gap: 8px;
|
|
2997
|
-
`,
|
|
2997
|
+
`,XP=f(T)`
|
|
2998
2998
|
flex-wrap: wrap;
|
|
2999
2999
|
gap: 8px;
|
|
3000
3000
|
align-items: center;
|
|
3001
3001
|
min-width: 0;
|
|
3002
|
-
`,
|
|
3002
|
+
`,LP=f($)`
|
|
3003
3003
|
width: 100%;
|
|
3004
3004
|
gap: 24px;
|
|
3005
|
-
`,
|
|
3005
|
+
`,_P=({disabledRules:i=[],skipPolicyRules:n=[],onDisableForScope:a,onAddSkipPolicy:o,onDeleteDisabledRule:l,onDeleteSkipPolicyRule:r})=>t("div",{"data-id":"url-templatization-default-normalization-card",children:t(Re,{padding:32,children:e(RP,{children:[e(PP,{children:[e(XP,{children:[t(w,{size:C.M,color:k.Primary,children:lp}),t(E,{label:rp,status:ie.Success,textSize:C.XXXS})]}),t(w,{size:C.XS,color:k.Secondary,children:sp})]}),t(zT,{"data-id":"url-templatization-advanced",label:cp,summary:dp(i.length,n.length),children:e(LP,{children:[t(TP,{rules:i,onDelete:l,onAdd:a}),t(zP,{rules:n,onDelete:r,onAdd:o})]})})]})})}),MP=f.div`
|
|
3006
3006
|
position: relative;
|
|
3007
3007
|
display: flex;
|
|
3008
3008
|
flex-wrap: wrap;
|
|
@@ -3014,16 +3014,16 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
3014
3014
|
border-radius: 12px;
|
|
3015
3015
|
border: 1.5px solid ${({theme:e})=>e.v2.colors.purple[500]};
|
|
3016
3016
|
background-color: ${({theme:e})=>e.v2.colors.silver[900]};
|
|
3017
|
-
`,
|
|
3017
|
+
`,FP=f.div`
|
|
3018
3018
|
position: absolute;
|
|
3019
3019
|
top: 8px;
|
|
3020
3020
|
right: 8px;
|
|
3021
|
-
`,
|
|
3021
|
+
`,BP=f(T)`
|
|
3022
3022
|
flex: 1;
|
|
3023
3023
|
min-width: 220px;
|
|
3024
3024
|
gap: 12px;
|
|
3025
3025
|
align-items: center;
|
|
3026
|
-
`,
|
|
3026
|
+
`,VP=f.div`
|
|
3027
3027
|
display: flex;
|
|
3028
3028
|
align-items: center;
|
|
3029
3029
|
justify-content: center;
|
|
@@ -3033,52 +3033,52 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
3033
3033
|
border-radius: 50%;
|
|
3034
3034
|
background-color: ${({theme:e})=>e.v2.colors.purple[900]};
|
|
3035
3035
|
border: 1px solid ${({theme:e})=>e.v2.colors.purple[700]};
|
|
3036
|
-
`,
|
|
3036
|
+
`,UP=f($)`
|
|
3037
3037
|
flex: 1;
|
|
3038
3038
|
min-width: 0;
|
|
3039
3039
|
gap: 8px;
|
|
3040
|
-
`,
|
|
3040
|
+
`,GP=f($)`
|
|
3041
3041
|
gap: 4px;
|
|
3042
|
-
`,
|
|
3042
|
+
`,jP=f(T)`
|
|
3043
3043
|
flex-wrap: wrap;
|
|
3044
3044
|
gap: 8px;
|
|
3045
3045
|
align-items: center;
|
|
3046
|
-
`,
|
|
3046
|
+
`,HP=f(T)`
|
|
3047
3047
|
flex-wrap: wrap;
|
|
3048
3048
|
gap: 16px;
|
|
3049
3049
|
min-width: 0;
|
|
3050
3050
|
align-items: center;
|
|
3051
|
-
`,
|
|
3051
|
+
`,WP=f(T)`
|
|
3052
3052
|
gap: 6px;
|
|
3053
3053
|
align-items: center;
|
|
3054
|
-
`,
|
|
3054
|
+
`,KP=f.div`
|
|
3055
3055
|
width: 1px;
|
|
3056
3056
|
height: 12px;
|
|
3057
3057
|
flex-shrink: 0;
|
|
3058
3058
|
background-color: ${({theme:e})=>e.v2.colors.silver[500]};
|
|
3059
|
-
`,
|
|
3059
|
+
`,YP=f.div`
|
|
3060
3060
|
flex-shrink: 0;
|
|
3061
3061
|
width: ${"140px"};
|
|
3062
3062
|
|
|
3063
3063
|
& > button {
|
|
3064
3064
|
width: 100%;
|
|
3065
3065
|
}
|
|
3066
|
-
`,
|
|
3066
|
+
`,JP=({onEnableDefault:i,onDismiss:n})=>{const a=v();return e(MP,{"data-id":"url-templatization-default-empty","aria-label":`${pp}, ${Ko}`,children:[!!n&&t(FP,{children:t(bn,{"data-id":"url-templatization-enable-default-dismiss",icon:Xu,size:fn.S,onClick:n})}),e(BP,{children:[t(VP,{"aria-hidden":!0,children:t(bh,{size:18,fill:a.v2.colors.purple[300]})}),e(UP,{children:[e(GP,{children:[e(jP,{children:[t(w,{size:C.S,color:k.Primary,children:pp}),t(E,{label:Ko,leftIcon:xh,backgroundColor:a.v2.colors.purple[700],textColor:a.v2.colors.white[500],textSize:C.XXXS})]}),t(w,{size:C.XXS,color:k.Secondary,children:up})]}),e(HP,{children:[e(WP,{children:[t(eh,{size:14,fill:a.v2.colors.grey[300]}),t(w,{size:C.XXXS,color:k.Secondary,children:hp})]}),t(KP,{"aria-hidden":!0}),e(WP,{children:[t(lh,{size:14,fill:a.v2.colors.grey[300]}),t(w,{size:C.XXXS,color:k.Secondary,children:gp})]})]})]})]}),t(YP,{children:t(H,{"data-id":"url-templatization-enable-default",label:mp,rightIcon:Cu,variant:K.Secondary,size:W.S,onClick:i})})]})},qP=f($)`
|
|
3067
3067
|
width: 100%;
|
|
3068
3068
|
flex: 1;
|
|
3069
3069
|
min-height: 0;
|
|
3070
3070
|
overflow: hidden;
|
|
3071
|
-
`,
|
|
3071
|
+
`,ZP=f.div`
|
|
3072
3072
|
display: flex;
|
|
3073
3073
|
align-items: center;
|
|
3074
3074
|
justify-content: space-between;
|
|
3075
3075
|
gap: 8px;
|
|
3076
3076
|
padding: 0 0 12px;
|
|
3077
|
-
`,
|
|
3077
|
+
`,QP=f(T)`
|
|
3078
3078
|
align-items: center;
|
|
3079
3079
|
gap: 8px;
|
|
3080
3080
|
min-width: 0;
|
|
3081
|
-
`,
|
|
3081
|
+
`,eX=f($)`
|
|
3082
3082
|
width: 100%;
|
|
3083
3083
|
flex: 0 1 auto;
|
|
3084
3084
|
min-height: 0;
|
|
@@ -3086,61 +3086,61 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
3086
3086
|
overflow-y: auto;
|
|
3087
3087
|
border: 1px solid ${({theme:e})=>e.v2.colors.silver[700]};
|
|
3088
3088
|
border-radius: 12px;
|
|
3089
|
-
`,
|
|
3089
|
+
`,tX=f($)`
|
|
3090
3090
|
width: 100%;
|
|
3091
3091
|
flex: 0 0 auto;
|
|
3092
3092
|
|
|
3093
3093
|
&:not(:last-child) {
|
|
3094
3094
|
border-bottom: 1px solid ${({theme:e})=>e.v2.colors.silver[700]};
|
|
3095
3095
|
}
|
|
3096
|
-
`,
|
|
3096
|
+
`,iX=f.div`
|
|
3097
3097
|
display: flex;
|
|
3098
3098
|
align-items: center;
|
|
3099
3099
|
gap: 8px;
|
|
3100
3100
|
width: 100%;
|
|
3101
3101
|
padding: 12px;
|
|
3102
3102
|
cursor: pointer;
|
|
3103
|
-
`,
|
|
3103
|
+
`,nX=f.div`
|
|
3104
3104
|
display: flex;
|
|
3105
3105
|
align-items: center;
|
|
3106
3106
|
gap: 8px;
|
|
3107
3107
|
flex: 1;
|
|
3108
3108
|
min-width: 0;
|
|
3109
|
-
`,
|
|
3109
|
+
`,aX=f($)`
|
|
3110
3110
|
gap: 2px;
|
|
3111
3111
|
min-width: 0;
|
|
3112
|
-
`,
|
|
3112
|
+
`,oX=f(T)`
|
|
3113
3113
|
align-items: center;
|
|
3114
3114
|
gap: 8px;
|
|
3115
3115
|
min-width: 0;
|
|
3116
3116
|
flex: 1;
|
|
3117
3117
|
flex-wrap: nowrap;
|
|
3118
3118
|
justify-content: flex-start;
|
|
3119
|
-
`,
|
|
3119
|
+
`,lX=f.div`
|
|
3120
3120
|
flex: 0 1 auto;
|
|
3121
3121
|
min-width: 0;
|
|
3122
3122
|
max-width: 100%;
|
|
3123
|
-
`,
|
|
3123
|
+
`,rX=f(T)`
|
|
3124
3124
|
align-items: center;
|
|
3125
3125
|
gap: 8px;
|
|
3126
3126
|
flex-shrink: 0;
|
|
3127
|
-
`,
|
|
3127
|
+
`,sX=f($)`
|
|
3128
3128
|
gap: 8px;
|
|
3129
3129
|
/* Align under action title (panel pad 12 + chevron 18 + gap 8) */
|
|
3130
3130
|
padding: 0 12px 12px 38px;
|
|
3131
3131
|
width: 100%;
|
|
3132
|
-
`,
|
|
3132
|
+
`,cX=f(T)`
|
|
3133
3133
|
align-items: center;
|
|
3134
3134
|
gap: 8px;
|
|
3135
3135
|
padding: 4px 0;
|
|
3136
|
-
`,
|
|
3136
|
+
`,dX=f($)`
|
|
3137
3137
|
width: 100%;
|
|
3138
3138
|
gap: 8px;
|
|
3139
|
-
`,
|
|
3139
|
+
`,pX=f($)`
|
|
3140
3140
|
width: 100%;
|
|
3141
3141
|
border-bottom: 1px solid ${({theme:e})=>e.v2.colors.silver[700]};
|
|
3142
3142
|
border-radius: 8px;
|
|
3143
|
-
`,
|
|
3143
|
+
`,uX=f.div`
|
|
3144
3144
|
display: flex;
|
|
3145
3145
|
align-items: center;
|
|
3146
3146
|
gap: 8px;
|
|
@@ -3152,17 +3152,17 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
3152
3152
|
opacity: 1;
|
|
3153
3153
|
pointer-events: auto;
|
|
3154
3154
|
}
|
|
3155
|
-
`,
|
|
3155
|
+
`,hX=f.span`
|
|
3156
3156
|
display: inline-flex;
|
|
3157
3157
|
flex-shrink: 0;
|
|
3158
3158
|
opacity: 0;
|
|
3159
3159
|
pointer-events: none;
|
|
3160
3160
|
transition: opacity 0.15s ease;
|
|
3161
|
-
`,
|
|
3161
|
+
`,gX=f($)`
|
|
3162
3162
|
gap: 0;
|
|
3163
3163
|
width: 100%;
|
|
3164
3164
|
padding: 0 12px 8px 38px;
|
|
3165
|
-
`,
|
|
3165
|
+
`,mX=f.div`
|
|
3166
3166
|
display: flex;
|
|
3167
3167
|
align-items: center;
|
|
3168
3168
|
gap: 8px;
|
|
@@ -3179,14 +3179,14 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
3179
3179
|
opacity: 1;
|
|
3180
3180
|
pointer-events: auto;
|
|
3181
3181
|
}
|
|
3182
|
-
`,
|
|
3182
|
+
`,bX=f.span`
|
|
3183
3183
|
display: inline-flex;
|
|
3184
3184
|
align-items: center;
|
|
3185
3185
|
justify-content: center;
|
|
3186
3186
|
width: 18px;
|
|
3187
3187
|
height: 18px;
|
|
3188
3188
|
flex-shrink: 0;
|
|
3189
|
-
`;function
|
|
3189
|
+
`;function fX(e){return(e.group.templatizationRules??[]).map(e=>e.template).filter(e=>!!e?.trim())}function vX(e,t){"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),t())}const yX=({actions:i,onCreateGroup:n,onEditGroup:o,onViewTemplate:r})=>{const[s,c]=l("groups"),[d,p]=l({}),[u,h]=l({}),g=e=>!0===d[e],m=e=>!1!==u[e],b=a(()=>i.reduce((e,t)=>e+t.groups.reduce((e,t)=>e+fX(t).length,0),0),[i]);return e(qP,{"data-id":"url-templatization-custom-templates-list",children:[e(ZP,{children:[e(QP,{children:[t(w,{size:C.S,children:bp}),t(E,{label:b,textSize:C.XXXS})]}),e(T,{$gap:8,$alignItems:"center",children:[t(w,{size:C.XS,color:k.Secondary,children:fp}),t(F,{"data-id":"url-templatization-custom-view",size:Zt.L,selected:s,setSelected:c,options:[{value:"groups",label:vp},{value:"tree",label:yp,disabled:!0},{value:"list",label:Sp,disabled:!0}]})]})]}),t(eX,{children:i.map(i=>{const a=g(i.id),l=i.groups.reduce((e,t)=>e+fX(t).length,0),s=()=>p(e=>({...e,[i.id]:!g(i.id)}));return e(tX,{children:[e(iX,{role:"button",tabIndex:0,"aria-expanded":a,"aria-label":a?"Collapse action":"Expand action",onClick:s,onKeyDown:e=>vX(e,s),children:[t(bX,{children:t(a?Bu:yu,{size:18})}),t(nX,{children:e(aX,{children:[t(w,{size:C.XXXS,color:k.Secondary,nowrap:!0,children:ol}),e(oX,{children:[t(w,{size:C.XS,color:k.Primary,nowrap:!0,lineHeight:"1",children:i.name||Eo}),t(jT,{actionName:i.name}),t(w,{size:C.XXXS,color:k.Secondary,nowrap:!0,children:xp(i.groups.length,l)})]})]})}),t(H,{"data-id":`url-templatization-create-group-${i.id}`,label:wp,rightIcon:wu,variant:K.Text,size:W.S,onClick:e=>{e.stopPropagation(),n?.(i.id)}})]}),a&&e(sX,{children:[e(cX,{children:[t(w,{size:C.XXS,color:k.Secondary,children:Cp}),t(E,{label:i.groups.length,textSize:C.XXXS})]}),t(dX,{children:i.groups.map(i=>{const n=`${i.actionId}-${i.groupIndex}`,a=m(n),l=fX(i),s=mT(i.group),c=()=>h(e=>({...e,[n]:!m(n)}));return e(pX,{children:[e(uX,{role:"button",tabIndex:0,"aria-expanded":a,"aria-label":a?"Collapse templating scope":"Expand templating scope",onClick:c,onKeyDown:e=>vX(e,c),children:[t(bX,{children:t(a?Bu:yu,{size:18})}),t(nX,{children:e(oX,{children:[t(lX,{children:t(fP,{scopes:s})}),e(rX,{children:[t(w,{size:C.XXXS,color:k.Secondary,nowrap:!0,children:Wo(l.length)}),o&&t(hX,{className:"url-templatization-edit-group",children:t(bn,{"data-id":`url-templatization-edit-group-${n}`,icon:Iu,size:fn.XS,onClick:e=>{e.stopPropagation(),o(i)}})})]})]})})]}),a&&t(gX,{children:l.map((e,a)=>t(mX,{$clickable:!!r,onClick:()=>r?.(i,e),children:t(wT,{copyable:!0,template:e,"data-id":`url-templatization-template-${n}-${a}`})},`${n}-${a}`))})]},n)})})]})]},i.id)})})]})},SX=f.div`
|
|
3190
3190
|
display: flex;
|
|
3191
3191
|
flex-wrap: wrap;
|
|
3192
3192
|
align-items: center;
|
|
@@ -3197,12 +3197,12 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
3197
3197
|
border-radius: 16px;
|
|
3198
3198
|
border: 1.5px solid ${({theme:e})=>e.v2.colors.silver[500]};
|
|
3199
3199
|
background-color: ${({theme:e})=>e.v2.colors.silver[900]};
|
|
3200
|
-
`,
|
|
3200
|
+
`,xX=f(T)`
|
|
3201
3201
|
flex: 1;
|
|
3202
3202
|
min-width: 220px;
|
|
3203
3203
|
gap: 16px;
|
|
3204
3204
|
align-items: flex-start;
|
|
3205
|
-
`,
|
|
3205
|
+
`,wX=f.div`
|
|
3206
3206
|
display: flex;
|
|
3207
3207
|
align-items: center;
|
|
3208
3208
|
justify-content: center;
|
|
@@ -3211,44 +3211,44 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
3211
3211
|
height: 36px;
|
|
3212
3212
|
border-radius: 50%;
|
|
3213
3213
|
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
3214
|
-
`,
|
|
3214
|
+
`,CX=f($)`
|
|
3215
3215
|
flex: 1;
|
|
3216
3216
|
min-width: 0;
|
|
3217
3217
|
gap: 4px;
|
|
3218
|
-
`,
|
|
3218
|
+
`,kX=f(H)`
|
|
3219
3219
|
border: 1px solid ${({theme:e})=>e.v2.colors.purple[500]};
|
|
3220
3220
|
|
|
3221
3221
|
&:enabled:hover {
|
|
3222
3222
|
background-color: ${({theme:e})=>e.v2.colors.purple[900]};
|
|
3223
3223
|
}
|
|
3224
|
-
`,
|
|
3224
|
+
`,TX=({onCreateCustomRule:i})=>{const n=v();return e(SX,{"data-id":"url-templatization-custom-empty",children:[e(xX,{children:[t(wX,{"aria-hidden":!0,children:t(Qu,{size:18,fill:n.v2.colors.grey[300]})}),e(CX,{children:[t(w,{size:C.S,color:k.Primary,children:kp}),t(w,{size:C.XXS,color:k.Secondary,children:Tp})]})]}),t(kX,{"data-id":"url-templatization-create-template",label:Ip,variant:K.Text,size:W.M,onClick:i})]})},IX=f.div`
|
|
3225
3225
|
display: flex;
|
|
3226
3226
|
flex-direction: column;
|
|
3227
3227
|
flex: 1;
|
|
3228
3228
|
min-height: 0;
|
|
3229
3229
|
width: 100%;
|
|
3230
|
-
|
|
3230
|
+
`,$X=f.div`
|
|
3231
3231
|
display: flex;
|
|
3232
3232
|
flex: 1;
|
|
3233
3233
|
min-height: 0;
|
|
3234
3234
|
width: 100%;
|
|
3235
3235
|
align-items: center;
|
|
3236
3236
|
justify-content: center;
|
|
3237
|
-
|
|
3237
|
+
`,NX=f($)`
|
|
3238
3238
|
width: 100%;
|
|
3239
3239
|
min-width: 750px;
|
|
3240
3240
|
max-width: 70vw;
|
|
3241
3241
|
gap: 32px;
|
|
3242
|
-
`,
|
|
3242
|
+
`,AX=f($)`
|
|
3243
3243
|
gap: 12px;
|
|
3244
3244
|
width: 100%;
|
|
3245
3245
|
max-width: 100%;
|
|
3246
3246
|
overflow-x: auto;
|
|
3247
|
-
`,
|
|
3247
|
+
`,OX=f(T)`
|
|
3248
3248
|
gap: 16px;
|
|
3249
3249
|
align-items: center;
|
|
3250
3250
|
min-width: 0;
|
|
3251
|
-
`,
|
|
3251
|
+
`,EX=f.div`
|
|
3252
3252
|
display: flex;
|
|
3253
3253
|
align-items: center;
|
|
3254
3254
|
justify-content: center;
|
|
@@ -3258,7 +3258,7 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
3258
3258
|
padding: 6px 12px;
|
|
3259
3259
|
border-radius: 6px;
|
|
3260
3260
|
border: 1px solid ${({theme:e})=>e.v2.colors.silver[500]};
|
|
3261
|
-
`,
|
|
3261
|
+
`,DX=f.span`
|
|
3262
3262
|
display: inline-flex;
|
|
3263
3263
|
min-width: 0;
|
|
3264
3264
|
font-family: ${({theme:e})=>e.font_family.code};
|
|
@@ -3266,12 +3266,12 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
3266
3266
|
line-height: 20px;
|
|
3267
3267
|
color: ${({theme:e})=>e.v2.colors.white[500]};
|
|
3268
3268
|
white-space: nowrap;
|
|
3269
|
-
`,
|
|
3269
|
+
`,zX=f.span`
|
|
3270
3270
|
color: ${({theme:e,$accent:t})=>t?e.v2.colors.purple[300]:"inherit"};
|
|
3271
|
-
`,
|
|
3271
|
+
`,RX=f($)`
|
|
3272
3272
|
gap: 16px;
|
|
3273
3273
|
width: 100%;
|
|
3274
|
-
`,
|
|
3274
|
+
`,PX=f.button`
|
|
3275
3275
|
display: inline-flex;
|
|
3276
3276
|
align-items: center;
|
|
3277
3277
|
gap: 6px;
|
|
@@ -3287,12 +3287,12 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
3287
3287
|
outline-offset: 2px;
|
|
3288
3288
|
border-radius: 4px;
|
|
3289
3289
|
}
|
|
3290
|
-
`,
|
|
3290
|
+
`,XX=e=>e.split(/(\{[^}]+\}|\d+)/g).filter(Boolean).map((e,i)=>{const n=e.startsWith("{")&&e.endsWith("}")||/^\d+$/.test(e);return t(zX,{$accent:n,children:e},`${e}-${i}`)}),LX=({docsUrl:i,onEnableDefault:n,onCreateCustomRule:a})=>{const o=v();return t(IX,{"data-id":"url-templatization-onboarding",children:t(Re,{padding:32,fullHeight:!0,children:t($X,{children:e(NX,{children:[e($,{$gap:8,children:[t(w,{variant:Tn.H2,size:C.M,color:k.Primary,children:$p}),t(w,{size:C.XS,color:k.Secondary,children:Np})]}),e(AX,{"aria-label":"URL templatization example",children:[e(OX,{children:[t(EX,{children:t(w,{size:C.XXXS,color:k.Secondary,align:"center",children:Ap})}),t(DX,{children:XX(Dp)})]}),e(OX,{children:[t(EX,{children:t(w,{size:C.XXXS,color:k.Secondary,align:"center",children:Op})}),t(DX,{children:XX(zp)})]})]}),e(RX,{children:[t(JP,{onEnableDefault:n}),t(TX,{onCreateCustomRule:a})]}),i?e(PX,{type:"button","data-id":"url-templatization-onboarding-docs",onClick:()=>window.open(i,"_blank","noopener,noreferrer"),"aria-label":`${Ep} (opens in a new tab)`,children:[t(ku,{size:14,fill:o.v2.colors.purple[400]}),t(w,{size:C.XXS,color:k.Link,weight:500,children:Ep}),t(ch,{size:12,fill:o.v2.colors.purple[400]})]}):null]})})})})},_X=f(ic)`
|
|
3291
3291
|
padding-right: 24px;
|
|
3292
|
-
`,
|
|
3292
|
+
`,MX=f($)`
|
|
3293
3293
|
flex: 1;
|
|
3294
3294
|
min-height: 0;
|
|
3295
3295
|
width: 100%;
|
|
3296
3296
|
gap: 24px;
|
|
3297
3297
|
overflow-y: auto;
|
|
3298
|
-
`,
|
|
3298
|
+
`,FX=({docsUrl:n=Rp})=>{const{actionsApi:o,sourcesApi:r}=Hh(),{items:s,loading:c,refetch:p}=o.useActions(),{items:u}=r.useSources(),[h,g]=l(!1),[m,b]=l(null),[f,v]=l(null),[y,S]=l(!1),[x,w]=l(!1),[C,k]=l(!1),[I,$]=l(!1),[N,A]=l(!1),[O,E]=l(),[z,R]=l(!1),[P,X]=l(null),L=a(()=>CT(s),[s]),_=L[0]??null,M=a(()=>L.flatMap(e=>(e.fields.urlTemplatizationRulesGroups??[]).map((t,i)=>({actionId:e.id,actionName:e.name||Eo,groupIndex:i,group:t}))),[L]),F=a(()=>{const e=[],t=new Map;for(const i of M){const n=t.get(i.actionId);void 0!==n?e[n].groups.push(i):(t.set(i.actionId,e.length),e.push({id:i.actionId,name:i.actionName,groups:[i]}))}return e},[M]),B=(e=>!!e&&(e.fields.urlTemplatizationDefaultGroups??[]).length>0)(_),V=a(()=>(e=>CT(e).filter(e=>!e.disabled).flatMap(e=>(e.fields.urlTemplatizationDefaultGroups??[]).map((t,i)=>({action:e,group:t,groupIndex:i})).filter(({group:e})=>!0===e.disabled).map(({action:e,group:t,groupIndex:i})=>({actionId:e.id,actionName:e.name||Eo,groupIndex:i,group:t}))))(L),[L]),U=a(()=>function(e){return CT(e).filter(e=>!e.disabled).flatMap(e=>(e.fields.urlTemplatizationDefaultGroups??[]).map((t,i)=>({action:e,group:t,groupIndex:i})).filter(({group:e})=>(e=>{const t=e.skipPolicy;return!!t&&(!!t.skipForNonSuccessCodes||(t.skipHttpStatusCodes??[]).some(e=>Number.isInteger(e)))})(e)).map(({action:e,group:t,groupIndex:i})=>({actionId:e.id,actionName:e.name||Eo,groupIndex:i,group:t})))}(L),[L]),G=(e=>CT(e).some(e=>(e=>!!e&&(e.fields.urlTemplatizationRulesGroups??[]).some(e=>e.templatizationRules?.some(e=>!!e.template?.trim())))(e)))(s),j=a(()=>u.map(e=>({id:`${e.id.namespace}/${e.id.kind}/${e.id.name}`,label:e.id.name,badge:e.id.kind,secondaryLabel:e.id.namespace})),[u]),H=a(()=>Array.from(new Set(u.map(e=>e.id.namespace))).sort().map(e=>({id:e,label:e})),[u]),Y=d(()=>{b(null),v(null),S(!0),w(!1),g(!0)},[]),J=d(()=>{b(null),v(null),S(!1),w(!0),g(!0)},[]),Z=d(async()=>{const e=hT(pT());_?await o.update(_.id,{type:_.type,name:_.name,notes:_.notes,disabled:_.disabled,signals:_.signals,fields:{..._.fields,[D.UrlTemplatizationDefaultGroups]:[..._.fields.urlTemplatizationDefaultGroups??[],e]}}):await o.create({type:q.URLTemplatization,name:Eo,disabled:!1,signals:[ae.Traces],fields:{[D.UrlTemplatizationDefaultGroups]:[e]}})},[_,o]),Q=d(async e=>{const t=L.find(t=>t.id===e.actionId);if(t){$(!0);try{const i=(t.fields.urlTemplatizationDefaultGroups??[]).filter((t,i)=>i!==e.groupIndex);await o.update(t.id,{type:t.type,name:t.name,notes:t.notes,disabled:t.disabled,signals:t.signals,fields:{...t.fields,[D.UrlTemplatizationDefaultGroups]:i}})}finally{$(!1)}}},[o,L]),ee=d(async e=>{const t=L.find(t=>t.id===e.actionId);if(t){$(!0);try{const i=(t.fields.urlTemplatizationDefaultGroups??[]).map((t,i)=>i===e.groupIndex?{...t,skipPolicy:null}:t);await o.update(t.id,{type:t.type,name:t.name,notes:t.notes,disabled:t.disabled,signals:t.signals,fields:{...t.fields,[D.UrlTemplatizationDefaultGroups]:i}})}finally{$(!1)}}},[o,L]),te=d(()=>{I||(g(!1),b(null),v(null),S(!1),w(!1))},[I]),ie=d(()=>{E(void 0),A(!0)},[]),ne=d(e=>{E({step:2,destination:"template-group",groupMode:"new",existingGroupIndex:null,targetActionId:e,createNewAction:!1}),A(!0)},[]),oe=d((e,t)=>{const i=M.findIndex(t=>t.actionId===e.actionId&&t.groupIndex===e.groupIndex);i<0||(E({step:2,destination:"template-group",groupMode:"existing",existingGroupIndex:i,targetActionId:e.actionId,createNewAction:!1,loadExistingGroupTemplates:!0,replaceExistingGroupTemplates:!0,focusTemplate:t}),A(!0))},[M]),le=d(()=>{z||(A(!1),E(void 0))},[z]),re=d((e,t)=>{X({template:t,actionName:e.actionName,actionId:e.actionId,groupIndex:e.groupIndex,scopes:mT(e.group),groupTemplates:(e.group.templatizationRules??[]).map(e=>e.template?.trim()||"").filter(Boolean)})},[]),se=d(()=>{X(null)},[]),ce=d(e=>{if(!P)return;const t=M.find(e=>e.actionId===P.actionId&&e.groupIndex===P.groupIndex);t&&(X(null),oe(t,e))},[M,oe,P]),de=d(()=>{if(!P)return;const e=M.find(e=>e.actionId===P.actionId&&e.groupIndex===P.groupIndex);e&&(X(null),oe(e))},[M,oe,P]),pe=a(()=>{if(y)return{...pT(),enabled:!1};if(x)return{...pT(),enabled:!0,skipForNonSuccessCodes:!0};if(!f)return;const e=L.find(e=>e.id===f.actionId),t=e?.fields.urlTemplatizationDefaultGroups?.[f.groupIndex];return t?(e=>{const t=e.skipPolicy,i=(t?.skipHttpStatusCodes??[]).filter(e=>Number.isInteger(e)),n=!!t?.skipForNonSuccessCodes,a=!n&&i.length>0;return{scopes:Fp(e.scopes),enabled:!e.disabled,skipForNonSuccessCodes:n,skipSelectedHttpStatusCodes:a,skipHttpStatusCodesInput:a?i.join(", "):""}})(t):void 0},[y,x,f,L]),ue=d(async e=>{$(!0);try{const t=hT(e),i=f?L.find(e=>e.id===f.actionId)??null:_;if(i){const e=i.fields.urlTemplatizationDefaultGroups??[],n=f?.groupIndex??m,a=null==n?[...e,t]:e.map((e,i)=>i===n?t:e);await o.update(i.id,{type:i.type,name:i.name,notes:i.notes,disabled:i.disabled,signals:i.signals,fields:{...i.fields,[D.UrlTemplatizationDefaultGroups]:a}})}else{const e=await o.create({type:q.URLTemplatization,name:Eo,disabled:!1,signals:[ae.Traces],fields:{[D.UrlTemplatizationDefaultGroups]:[t]}});if(e?.error)return}g(!1),b(null),v(null),S(!1),w(!1)}finally{$(!1)}},[_,o,m,f,L]),he=d(async e=>{R(!0);try{const i={scopes:Yp((t=e).scopes)?null:t.scopes,templatizationRules:t.templates.map(e=>e.trim()).filter(Boolean).map(e=>({template:e}))};if(null!==e.existingGroupIndex){const t=M[e.existingGroupIndex],n=L.find(e=>e.id===t?.actionId);if(!t||!n)return;const a=n.fields.urlTemplatizationRulesGroups??[],l=!!e.replaceExistingGroupTemplates;return await o.update(n.id,{type:n.type,name:n.name,notes:n.notes,disabled:n.disabled,signals:n.signals,fields:{...n.fields,[D.UrlTemplatizationRulesGroups]:a.map((n,a)=>a===t.groupIndex?l?i:((e,t)=>{const i=t.map(e=>e.trim()).filter(Boolean).map(e=>({template:e}));return{...e,templatizationRules:[...e.templatizationRules??[],...i]}})(n,e.templates):n)}}),A(!1),void E(void 0)}const n=e.createNewAction?null:"entire-cluster"===e.destination?L.find(e=>e.name===Eo)??null:e.targetActionId?L.find(t=>t.id===e.targetActionId)??null:L.find(e=>e.name===Eo)??null;if(n)await o.update(n.id,{type:n.type,name:n.name,notes:n.notes,disabled:n.disabled,signals:n.signals,fields:{...n.fields,[D.UrlTemplatizationRulesGroups]:[...n.fields.urlTemplatizationRulesGroups??[],i]}});else{const t="entire-cluster"===e.destination?Eo:e.createNewAction&&e.newActionName.trim()||Eo,n=await o.create({type:q.URLTemplatization,name:t,disabled:!1,signals:[ae.Traces],fields:{[D.UrlTemplatizationRulesGroups]:[i]}});if(n?.error)return}A(!1),E(void 0)}finally{R(!1)}var t},[o,M,L]),ge=d(async e=>{if(null!==e.existingGroupIndex){R(!0);try{const t=M[e.existingGroupIndex],i=L.find(e=>e.id===t?.actionId);if(!t||!i)return;const n=i.fields.urlTemplatizationRulesGroups??[];await o.update(i.id,{type:i.type,name:i.name,notes:i.notes,disabled:i.disabled,signals:i.signals,fields:{...i.fields,[D.UrlTemplatizationRulesGroups]:n.filter((e,i)=>i!==t.groupIndex)}}),A(!1),E(void 0)}finally{R(!1)}}},[o,M,L]),me=a(()=>{const e=[];return n&&e.push({id:Or(),type:St.Button,buttonProps:{"data-id":"url-templatization-btn-docs",label:Pp,leftIcon:ku,size:W.S,variant:K.Text,onClick:()=>window.open(n,"_blank")}}),e.push({id:Or(),type:St.Button,buttonProps:{"data-id":"url-templatization-btn-refresh",label:"Refresh",size:W.S,variant:K.Text,onClick:p,loading:c}}),G&&e.push({id:Or(),type:St.Button,buttonProps:{"data-id":"url-templatization-btn-create",label:Xp,rightIcon:wu,size:W.S,variant:K.Primary,onClick:ie}}),e},[n,ie,G,c,p]);return e(_X,{"data-id":"url-templatization-page",children:[e(T,{$gap:12,$justifyContent:"space-between",children:[t(nc,{icon:yh,title:_p,subTitle:Lp}),t(ac,{actions:me})]}),c&&!s.length?t(oi,{$height:"320px",children:t(Ve,{})}):t(MX,{children:B||G?e(i,{children:[B?t(i,{children:t(_P,{disabledRules:V,skipPolicyRules:U,onDisableForScope:Y,onAddSkipPolicy:J,onDeleteDisabledRule:Q,onDeleteSkipPolicyRule:ee})}):!C&&t(JP,{onEnableDefault:Z,onDismiss:()=>k(!0)}),G?t(yX,{actions:F,onCreateGroup:ne,onEditGroup:oe,onViewTemplate:re}):t(TX,{onCreateCustomRule:ie})]}):t(LX,{docsUrl:n,onEnableDefault:Z,onCreateCustomRule:ie})}),t(yI,{isOpen:h,mode:null===f?"create":"edit",disableForScope:y,skipPolicyForScope:x,initialFormState:pe,submitting:I,onClose:te,onSubmit:ue,sourceOptions:j,namespaceOptions:H}),t(uI,{isOpen:N,submitting:z,prefill:O,templatizationActions:L.map(e=>({id:e.id,name:e.name||Eo})),existingGroups:M,onClose:le,onSubmit:he,onDelete:ge,sourceOptions:j,namespaceOptions:H}),t($I,{isOpen:!!P,template:P?.template??"",actionName:P?.actionName,actionId:P?.actionId,scopes:P?.scopes,groupTemplates:P?.groupTemplates,onClose:se,onEdit:ce,onEditGroup:de})]})};export{cy as AddActionDrawer,cb as AddActionForm,LI as AddDataStreamModal,yy as AddDestinationDrawer,pb as AddDestinationForm,Sy as AddRuleDrawer,yb as AddRuleForm,Xy as AddSourceDrawer,G$ as CentralConnections,Nx as CloudConnectorStep,Ex as CreateCloudConnectorDrawer,L$ as CreateNewType,xb as DataStreamForm,Sb as DataStreamMergeWarning,sy as DetectionPolicyForm,Px as EditActionDrawer,Xx as EditConfigDrawer,_I as EditDataStreamModal,_x as EditDestinationDrawer,Fx as EditRuleDrawer,kk as EditSourceDrawer,wb as EditSourceForm,of as GuardrailForm,gD as Insights,Xf as LearningPolicyForm,ND as Onboarding,BI as OnboardingDone,zz as Overview,Qz as PipelineCollectors,Zk as RecommendationsDrawer,jg as RegexTesterDrawer,Fv as RiskModelDrawer,Pk as SECTION_ORDER,P$ as SamplingOnboardingModal,dT as SamplingRuleDrawer,Nb as SamplingRuleForm,lR as SamplingRules,HR as ServiceMap,oP as Settings,XI as SystemDrawer,Qf as SystemSettingsForm,Zz as TABS,rP as ToastList,FX as UrlTemplatization,uI as UrlTemplatizationCustomTemplateDrawer,yI as UrlTemplatizationDefaultRuleDrawer,$I as UrlTemplatizationTemplateViewDrawer,Rk as countRecommended,Dk as getRecommendationState,zk as groupRecommendations};
|