@odigos/ui-kit 0.0.288 → 0.0.289
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 +15 -0
- package/lib/chunks/{helpers-BCSEuuKh.js → helpers-Ds7r-EIJ.js} +1 -1
- package/lib/chunks/{index-Cy84opXf.js → index-DiYN36pr.js} +1 -1
- package/lib/chunks/source-instrument-form-context-CBP9xXNN.js +5 -0
- package/lib/chunks/{ui-components-D8rTJS7r.js → ui-components-Dvmqmy3G.js} +15 -6
- package/lib/components/table/types.d.ts +2 -2
- package/lib/components/trace-view/styled.d.ts +51 -34
- package/lib/components/trace-view/types.d.ts +4 -0
- package/lib/components.js +1 -1
- package/lib/constants.js +1 -1
- package/lib/containers/_modals/sampling-onboarding-modal/common/chrome.d.ts +14 -10
- package/lib/containers/_modals/sampling-onboarding-modal/common/section.d.ts +9 -3
- package/lib/containers/insights/findings/drawer/anomaly/risk-breakdown/helpers.d.ts +23 -0
- package/lib/containers/insights/findings/drawer/anomaly/risk-breakdown/index.d.ts +9 -0
- package/lib/containers/insights/operation-identity.d.ts +22 -0
- package/lib/containers/insights/overview/contained-table-and-heading/index.d.ts +2 -1
- package/lib/containers/insights/settings-and-configurations/panels/detection/create-override-panel.d.ts +1 -1
- package/lib/containers/insights/settings-and-configurations/panels/learning/mappers.d.ts +2 -1
- package/lib/containers/insights/settings-and-configurations/panels/storage/layout.d.ts +12 -4
- package/lib/containers/insights/settings-and-configurations/panels/system/constants.d.ts +16 -0
- package/lib/containers/insights/transactions/helpers.d.ts +15 -3
- package/lib/containers.js +463 -382
- package/lib/contexts/odigos-api/hooks/use-insights-api.d.ts +12 -1
- package/lib/contexts/odigos-api/index.d.ts +1 -1
- package/lib/contexts/odigos-api/types.d.ts +25 -1
- package/lib/contexts.js +1 -1
- package/lib/functions.js +1 -1
- package/lib/hooks.js +1 -1
- package/lib/snippets/sampling-rule-form-sections/styled.d.ts +6 -2
- package/lib/snippets.js +1 -1
- package/lib/store.js +1 -1
- package/lib/theme/palettes/index.d.ts +1 -0
- package/lib/theme.js +1 -1
- package/lib/types/insights/index.d.ts +57 -2
- package/lib/types.js +1 -1
- package/lib/visuals.js +1 -1
- package/package.json +27 -24
- package/lib/chunks/source-instrument-form-context-D6pVu22G.js +0 -5
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{x,e as w,g as C,f as k,h as T,bH as I,F as $,bI as
|
|
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{x,e as w,g as C,f as k,h as T,bH as I,F as $,bI as N,bJ as A,bK as O,bL as E,bx as D,d as R,k as z,E as X,bM as P,r as L,s as M,H as _,a3 as F,bN as B,bO as U,az as V,bP as G,bQ as H,B as j,i as W,j as K,J as Y,ab as q,by as J,N as Z,bR as Q,z as ee,L as te,S as ie,bS as ne,bD as ae,bE as oe,bC as le,bT as re,an as se,T as ce,al as de,am as pe,aj as ue,ai as he,ak as ge,ah as me,bb as be,ag as fe,bU as ve,bV as ye,bW as Se,bX as xe,bY as we,W as Ce,p as ke,bf as Te,bZ as Ie,b_ as $e,b$ as Ne,c0 as Ae,c1 as Oe,c2 as Ee,c3 as De,c4 as Re,a1 as ze,c5 as Xe,c6 as Pe,c7 as Le,C as Me,bB as _e,y as Fe,I as Be,l as Ue,b7 as Ve,c8 as Ge,c9 as He,b4 as je,G as We,bF as Ke,ca as Ye,be as qe,v as Je,cb as Ze,bg as Qe,cc as et,bk as tt,bi as it,cd as nt,u as at,ce as ot,o as lt,ad as rt,K as st,D as ct,cf as dt,ao as pt,cg as ut,ch as ht,q as gt,m as mt,bn as bt,bw as ft,ci as vt,cj as yt,bv as St,ck as xt,aa as wt,cl as Ct,cm as kt,ba as Tt,U as It,cn as $t,co as Nt,cp as At,cq as Ot,cr as Et,cs as Dt,ct as Rt,cu as zt,cv as Xt,cw as Pt,a0 as Lt,cx as Mt,cy as _t,A as Ft,b8 as Bt,b6 as Ut,cz as Vt,cA as Gt,cB as Ht,cC as jt,cD as Wt,cE as Kt,bG as Yt,cF as qt,cG as Jt,cH as Zt,cI as Qt,cJ as ei,b as ti,cK as ii,cL as ni,$ as ai,cM as oi,cN as li,cO as ri,cP as si,cQ as ci,cR as di,cS as pi,cT as ui,cU as hi,cV as gi,cW as mi,cX as bi,cY as fi,cZ as vi,c_ as yi,c$ as Si,d0 as xi,d1 as wi,d2 as Ci,d3 as ki,d4 as Ti,d5 as Ii,d6 as $i,d7 as Ni,d8 as Ai,d9 as Oi,da as Ei,db as Di,dc as Ri,dd as zi,de as Xi,df as Pi,dg as Li,dh as Mi,di as _i,dj as Fi,dk as Bi,dl as Ui,dm as Vi,dn as Gi,dp as Hi,dq as ji,dr as Wi,ds as Ki,dt as Yi,aW as qi,du as Ji,dv as Zi,dw as Qi,dx as en,dy as tn,dz as nn,dA as an,dB as on,dC as ln,dD as rn,dE as sn,dF as cn,dG as dn,dH as pn,dI as un,dJ as hn,dK as gn,dL as mn,dM as bn,dN as fn,dO as vn,dP as yn,dQ as Sn,dR as xn,dS as wn,dT as Cn,dU as kn,dV as Tn,dW as In,dX as $n,dY as Nn,dZ as An,d_ as On,d$ as En,e0 as Dn,e1 as Rn,e2 as zn,e3 as Xn,e4 as Pn,e5 as Ln,e6 as Mn,e7 as _n,e8 as Fn,e9 as Bn,ea as Un,eb as Vn,ec as Gn,ed as Hn,ee as jn,ef as Wn,eg as Kn,eh as Yn,ei as qn,ej as Jn,ek as Zn,el as Qn,em as ea,en as ta,eo as ia,ep as na,eq as aa,er as oa,es as la,et as ra,eu as sa,ev as ca,ew as da,ex as pa,ey as ua,ez as ha,eA as ga,eB as ma,eC as ba,eD as fa,eE as va,eF as ya,eG as Sa,eH as xa,eI as wa,eJ as Ca,aF as ka,eK as Ta,eL as Ia,b9 as $a,M as Na,eM as Aa,eN as Oa,eO as Ea,eP as Da,eQ as Ra,eR as za,eS as Xa,eT as Pa,eU as La,eV as Ma,eW as _a,eX as Fa,eY as Ba,eZ as Ua,e_ as Va,e$ as Ga,f0 as Ha,f1 as ja,f2 as Wa,f3 as Ka,f4 as Ya,f5 as qa,f6 as Ja,f7 as Za,f8 as Qa,f9 as eo,fa as to,fb as io,fc as no,fd as ao,fe as oo,ff as lo,fg as ro,fh as so,fi as co,fj as po,fk as uo,fl as ho,fm as go,fn as mo,fo as bo,fp as fo,fq as vo,fr as yo,fs as So,ft as xo,fu as wo,fv as Co,fw as ko,fx as To,fy as Io,fz as $o,fA as No,fB as Ao,fC as Oo,fD as Eo,fE as Do,fF as Ro,fG as zo,fH as Xo,fI as Po,fJ as Lo,fK as Mo,fL as _o,fM as Fo,fN as Bo,fO as Uo,fP as Vo,fQ as Go,fR as Ho,fS as jo,fT as Wo,fU as Ko,fV as Yo,fW as qo,fX as Jo,P as Zo,fY as Qo,fZ as el,R as tl,a as il,f_ as nl,f$ as al,g0 as ol,g1 as ll,g2 as rl,g3 as sl,g4 as cl,g5 as dl,g6 as pl,g7 as ul,g8 as hl,g9 as gl,ga as ml,gb as bl,gc as fl,gd as vl,ge as yl,gf as Sl,gg as xl,gh as wl,gi as Cl,a6 as kl,gj as Tl,gk as Il,gl as $l,gm as Nl,gn as Al,go as Ol,gp as El,gq as Dl,gr as Rl,b5 as zl,gs as Xl,gt as Pl,gu as Ll,gv as Ml,gw as _l,gx as Fl,gy as Bl,gz as Ul,gA as Vl,gB as Gl,gC as Hl,gD as jl,gE as Wl,bh as Kl,gF as Yl,gG as ql,gH as Jl,gI as Zl,gJ as Ql,gK as er,gL as tr,gM as ir,gN as nr,gO as ar,gP as or,gQ as lr,gR as rr,gS as sr,gT as cr,gU as dr,gV as pr,gW as ur,gX as hr,gY as gr,gZ as mr,g_ as br,g$ as fr,h0 as vr,h1 as yr,h2 as Sr,h3 as xr,h4 as wr,h5 as Cr,h6 as kr,h7 as Tr,h8 as Ir,h9 as $r,ha as Nr,hb as Ar,hc as Or,hd as Er,he as Dr,hf as Rr,hg as zr,hh as Xr}from"./chunks/ui-components-Dvmqmy3G.js";import{u as Pr,n as Lr,C as Mr,g as _r,f as Fr,e as Br,q as Ur,h as Vr,j as Gr,k as Hr,i as jr,m as Wr,p as Kr,l as Yr,c as qr,r as Jr,S as Zr,s as Qr,R as es,t as ts,w as is,o as ns,x as as,y as os,z as ls,A as rs,B as ss,D as cs,E as ds,F as ps,G as us,H as hs,I as gs,J as ms}from"./chunks/helpers-Ds7r-EIJ.js";import{ChevronRightIcon as bs,ActionIcon as fs,TrashIcon as vs,PlusIcon as ys,ArrowRightIcon as Ss,BookIcon as xs,DeleteIcon as ws,EditIcon as Cs,GoLogo as ks,JavaLogo as Ts,PhpLogo as Is,VSquareIcon as $s,XSquareIcon as Ns,DestinationIcon as As,ChevronUpIcon as Os,ChevronDownIcon as Es,VIcon as Ds,XIcon as Rs,InstrumentationRuleIcon as zs,SourceIcon as Xs,NamespacesIcon as Ps,AzureIcon as Ls,GoogleCloudPlatformLogo as Ms,AwsLogo as _s,CloudConnectorIcon as Fs,EyeOpenIcon as Bs,OdigosLogo as Us,ArrowLeftIcon as Vs,ISquareIcon as Gs,RefreshIcon as Hs,SettingsIcon as js,PodIcon as Ws,K8sLogo as Ks,ExclamationCircleIcon as Ys,QuestionCircleIcon as qs,InboundIcon as Js,OutboundIcon as Zs,UserIcon as Qs,TerminalIcon as ec,RefreshLeftArrowIcon as tc,MinusIcon as ic,SearchIcon as nc,ExpandIcon as ac,CopyIcon as oc,DotIcon as lc,ArrowDownIcon as rc,DownloadIcon as sc,MetricsIcon as cc,EnrichmentIcon as dc,NormalizationIcon as pc,SamplingIcon as uc,RecommendationsIcon as hc,UrlTemplatizationIcon as gc,ExclamationTriangleIcon as mc,KeyIcon as bc,DiagnoseIcon as fc,StarIcon as vc,ArrowIcon as yc,ConnectionsIcon as Sc,InsightsFindingsIcon as xc,InsightsTransactionsIcon as wc,LockIcon as Cc,ThreatDetectionIcon as kc,PrivacyIcon as Tc,NotificationIcon as Ic,FolderIcon as $c,FilterIcon as Nc,DataStreamIcon as Ac,PipelineCollectorIcon as Oc,ArrowDownSquareIcon as Ec,ArrowUpSquareIcon as Dc,GatewayIcon as Rc,YamlIcon as zc,ImageErrorIcon as Xc}from"./icons.js";import{h as Pc,o as Lc,n as Mc,q as _c,m as Fc,t as Bc,s as Uc,S as Vc,w as Gc,E as Hc,x as jc,y as Wc,v as Kc,l as Yc,d as qc,C as Jc,O as Zc,f as Qc,b as ed,R as td,A as id,e as nd,D as ad}from"./chunks/source-instrument-form-context-CBP9xXNN.js";import{o as od,g as ld,E as rd,l as sd,I as cd,m as dd,p as pd,j as ud,P as hd,S as gd,R as md,h as bd,k as fd,d as vd,i as yd,n as Sd,W as xd,C as wd,c as Cd,Y as kd,A as Td,O as Id,b as $d,B as Nd,U as Ad,a as Od,f as Ed}from"./chunks/index-DiYN36pr.js";import{createPortal as Dd}from"react-dom";import{MarkerType as Rd,useNodesState as zd,useEdgesState as Xd,Handle as Pd,Position as Ld,getSmoothStepPath as Md,BaseEdge as _d,EdgeLabelRenderer as Fd,ReactFlowProvider as Bd,ReactFlow as Ud,Background as Vd,Controls as Gd,ControlButton as Hd,useReactFlow as jd}from"@xyflow/react";import Wd from"elkjs/lib/elk.bundled.js";import"@xyflow/react/dist/style.css";import"zustand";import"javascript-time-ago";import"javascript-time-ago/locale/en";import"prism-react-renderer";import"zustand/middleware";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";const Kd=f.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
align-items: center;
|
|
4
4
|
justify-content: space-between;
|
|
@@ -18,17 +18,17 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
18
18
|
padding: 8px;
|
|
19
19
|
border-radius: 8px;
|
|
20
20
|
background-color: ${({theme:e})=>e.v2.colors.white[500]+I["004"]};
|
|
21
|
-
`,
|
|
21
|
+
`,qd=f(T)`
|
|
22
22
|
flex: 1;
|
|
23
23
|
min-width: 0;
|
|
24
|
-
`,
|
|
24
|
+
`,Jd=f($)`
|
|
25
25
|
flex: 1;
|
|
26
26
|
min-width: 0;
|
|
27
27
|
`,Zd=f(T)`
|
|
28
28
|
flex-shrink: 0;
|
|
29
|
-
`,Qd=({dataId:i,icon:n,title:a,description:o,withCarret:l,purpleColors:r,disabled:s,children:c,isSelected:d,onClick:p,isChecked:u,isPartiallyChecked:h,onCheckboxChange:g})=>e(
|
|
29
|
+
`,Qd=({dataId:i,icon:n,title:a,description:o,withCarret:l,purpleColors:r,disabled:s,children:c,isSelected:d,onClick:p,isChecked:u,isPartiallyChecked:h,onCheckboxChange:g})=>e(Kd,{"data-id":i||`list-item-${a}`,$isSelected:d,$purpleColors:r,$disabled:s,onClick:()=>!d&&!s&&p(),children:[e(qd,{$gap:12,children:[g&&t(x,{partiallyChecked:h||!1,value:u||!1,onChange:e=>g(e)}),n&&t(Yd,{children:t(n,{size:20})}),e(Jd,{$gap:4,children:[t(w,{size:C.XS,nowrap:!0,children:a}),o&&t(w,{size:C.XXXS,color:k.Secondary,nowrap:!0,children:o})]})]}),(l||c)&&e(Zd,{$gap:8,children:[c,l&&t(bs,{size:18})]})]}),ep="other",tp={...O,[ep]:{TITLE:"Other",ICON:fs}},ip=f(T)`
|
|
30
30
|
padding: 8px 12px 4px 12px;
|
|
31
|
-
`,np=({bucket:i,options:n,selectedType:a,onSelectOption:o})=>{const l=v(),{TITLE:r,ICON:s}=tp[i],c=l.v2.colors.purple[200];return e("div",{"data-id":`action-category-${i}`,children:[e(ip,{$gap:8,children:[t(s,{fill:c}),t(w,{size:C.XXS,color:c,children:r}),t(E,{label:n.length})]}),n.map(e=>t(Qd,{dataId:e.type?`option-${e.type}`:void 0,icon:e.icon,title:e.label,description:e.subtitle||e.description,withCarret:!0,isSelected:a===e.type,onClick:()=>o(e)},e.type))]})},ap=[{id:"CREDIT_CARD",label:"Credit card"}],op=[{id:D.CollectContainerAttributes,label:"Collect container attributes"},{id:D.CollectReplicaSetAttributes,label:"Collect ReplicaSet attributes"},{id:D.CollectWorkloadId,label:"Collect workload ID"},{id:D.CollectClusterId,label:"Collect cluster ID"}],lp=[{id:
|
|
31
|
+
`,np=({bucket:i,options:n,selectedType:a,onSelectOption:o})=>{const l=v(),{TITLE:r,ICON:s}=tp[i],c=l.v2.colors.purple[200];return e("div",{"data-id":`action-category-${i}`,children:[e(ip,{$gap:8,children:[t(s,{fill:c}),t(w,{size:C.XXS,color:c,children:r}),t(E,{label:n.length})]}),n.map(e=>t(Qd,{dataId:e.type?`option-${e.type}`:void 0,icon:e.icon,title:e.label,description:e.subtitle||e.description,withCarret:!0,isSelected:a===e.type,onClick:()=>o(e)},e.type))]})},ap=[{id:"CREDIT_CARD",label:"Credit card"}],op=[{id:D.CollectContainerAttributes,label:"Collect container attributes"},{id:D.CollectReplicaSetAttributes,label:"Collect ReplicaSet attributes"},{id:D.CollectWorkloadId,label:"Collect workload ID"},{id:D.CollectClusterId,label:"Collect cluster ID"}],lp=[{id:P.Pod,label:P.Pod},{id:P.Namespace,label:P.Namespace},{id:P.Node,label:P.Node}],rp=[{label:"Label key",keyName:"labelKey",placeholder:"app.kubernetes.io/name"},{label:"Attribute key",keyName:"attributeKey",placeholder:"app.kubernetes.name"},{label:"From sources",keyName:"fromSources",placeholder:"pod, namespace",tooltip:"Select multiple sources. Higher precedence sources (pod > namespace > node) will override lower ones.",componentType:"multi-dropdown",options:lp}],sp=[{label:"Annotation key",keyName:"annotationKey",placeholder:"kubectl.kubernetes.io/restartedAt"},{label:"Attribute key",keyName:"attributeKey",placeholder:"kubectl.kubernetes.restartedAt"},{label:"From sources",keyName:"fromSources",placeholder:"pod, namespace",tooltip:"Select multiple sources. Higher precedence sources (pod > namespace > node) will override lower ones.",componentType:"multi-dropdown",options:lp}],cp=D.ExtractAttribute;var dp;(e=>{e.Preset="preset",e.Regex="regex"})(dp||(dp={}));const pp=[U.JSON,U.SQL,U.ResourcePath],up=(e=U.JSON)=>({targetAttributeName:"",lookupKey:"",dataFormat:e,regex:""}),hp=e=>!!e.regex&&!e.lookupKey&&!e.dataFormat,gp=f.div`
|
|
32
32
|
width: 100%;
|
|
33
33
|
background: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
34
34
|
border-radius: 8px;
|
|
@@ -42,7 +42,7 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
42
42
|
`,bp=f.div`
|
|
43
43
|
/* Pushes the arrow down to sit next to the inputs rather than the field titles. */
|
|
44
44
|
padding-top: 24px;
|
|
45
|
-
`,fp=e=>Object.entries(e||{}).map(([e,t])=>({oldKey:e,newKey:t})),vp=e=>{const t={};return e.forEach(({oldKey:e,newKey:i})=>{t[e]=i}),t},yp=D.UrlTemplatizationRulesGroups,Sp=[{keyName:"kind",label:"Kind",placeholder:"Any kind",componentType:"dropdown",options:[{id:"Deployment",label:"Deployment"},{id:"StatefulSet",label:"StatefulSet"},{id:"DaemonSet",label:"DaemonSet"}]},{keyName:"name",label:"Name",placeholder:"Any name"}],xp={[
|
|
45
|
+
`,fp=e=>Object.entries(e||{}).map(([e,t])=>({oldKey:e,newKey:t})),vp=e=>{const t={};return e.forEach(({oldKey:e,newKey:i})=>{t[e]=i}),t},yp=D.UrlTemplatizationRulesGroups,Sp=[{keyName:"kind",label:"Kind",placeholder:"Any kind",componentType:"dropdown",options:[{id:"Deployment",label:"Deployment"},{id:"StatefulSet",label:"StatefulSet"},{id:"DaemonSet",label:"DaemonSet"}]},{keyName:"name",label:"Name",placeholder:"Any name"}],xp={[J.K8sAttributes]:({value:n,setValue:a,formErrors:l})=>(o(()=>{n[D.CollectContainerAttributes]||n[D.CollectReplicaSetAttributes]||n[D.CollectWorkloadId]||n[D.CollectClusterId]||n[D.LabelsAttributes]?.length||n[D.AnnotationsAttributes]?.length||(a(D.CollectContainerAttributes,!0),a(D.CollectReplicaSetAttributes,!0),a(D.CollectWorkloadId,!0),a(D.CollectClusterId,!0),a(D.LabelsAttributes,[]),a(D.AnnotationsAttributes,[]))},[]),e(i,{children:[t($,{$gap:6,children:op.map(({id:i,label:o})=>e($,{children:[t(x,{label:o,value:n[i]||!1,onChange:e=>a(i,e)}),t(z,{errorMessage:l[i]})]},i))}),t(X,{name:"labelsAttributes",label:"Label attributes",limitFieldsPerRow:2,columns:rp,values:n[D.LabelsAttributes]||[],setValues:e=>a(D.LabelsAttributes,e),errorMessage:l[D.LabelsAttributes]}),t(X,{name:"annotationsAttributes",label:"Annotation attributes",limitFieldsPerRow:2,columns:sp,values:n[D.AnnotationsAttributes]||[],setValues:e=>a(D.AnnotationsAttributes,e),errorMessage:l[D.AnnotationsAttributes]})]})),[J.AddClusterInfo]:({value:n,setValue:a,formErrors:o})=>{const l=v();return e(i,{children:[t(L,{label:"Overwrite existing values",labelAlign:M.Left,labelColor:l.v2.colors.silver[200],tooltip:"If enabled, the resource attributes will overwrite any existing attributes with the same name.",value:n[D.OverwriteExistingValues]||!1,onChange:e=>a(D.OverwriteExistingValues,e)}),t(X,{name:"clusterAttributes",label:"Resource attributes",limitFieldsPerRow:2,columns:[{keyName:"attributeName",label:"Attribute name",placeholder:"Attribute name"},{keyName:"attributeStringValue",label:"Attribute value",placeholder:"Attribute value"}],values:n[D.ClusterAttributes]||[],setValues:e=>a(D.ClusterAttributes,e),errorMessage:o[D.ClusterAttributes]})]})},[J.DeleteAttributes]:({value:e,setValue:i,formErrors:n})=>t(_,{name:"attributeNamesToDelete",label:"Attributes to delete",values:e[D.AttributeNamesToDelete]||[],setValues:e=>i(D.AttributeNamesToDelete,e),errorMessage:n[D.AttributeNamesToDelete]}),[J.RenameAttributes]:({value:e,setValue:i,formErrors:n})=>{const a=e[D.Renames],[r,s]=l(()=>fp(a));return o(()=>{((e,t)=>{const i=Object.keys(e),n=Object.keys(t);return i.length===n.length&&i.every(i=>Object.prototype.hasOwnProperty.call(t,i)&&t[i]===e[i])})(vp(r),a||{})||s(fp(a))},[a]),t(X,{name:"renames",label:"Attributes to rename",limitFieldsPerRow:2,columns:[{keyName:"oldKey",label:"Old key",placeholder:"Old key"},{keyName:"newKey",label:"New key",placeholder:"New key"}],values:r,setValues:e=>{const t=e.map(e=>({oldKey:String(e.oldKey??""),newKey:String(e.newKey??"")}));s(t),i(D.Renames,vp(t))},errorMessage:n[D.Renames]})},[J.PiiMasking]:({value:i,setValue:n,formErrors:a})=>(o(()=>{i[D.PiiCategories]?.length||n(D.PiiCategories,ap.map(({id:e})=>e))},[]),e($,{$gap:12,children:[t(R,{label:"Attributes to mask"}),t($,{$gap:6,children:ap.map(({id:e,label:a})=>t(x,{label:a,value:i[D.PiiCategories]?.includes(e)||!1,onChange:t=>{const a=i[D.PiiCategories]||[],o=t?[...a,e]:a.filter(t=>t!==e);n(D.PiiCategories,o)}},e))}),t(z,{errorMessage:a[D.PiiCategories]})]})),[J.URLTemplatization]:({value:n,setValue:a,formErrors:o})=>{const l=v(),s=n[yp]||[{filterK8sNamespace:"",workloadFilters:[],templatizationRules:[{template:""}],notes:""}],c=e=>a(yp,e),d=(e,t)=>c(s.map((i,n)=>n===e?{...i,...t}:i));return e(i,{children:[s.map((i,n)=>e(r,{children:[t(q,{}),e($,{$gap:12,children:[e(T,{$justifyContent:"space-between",$alignItems:"center",children:[t(R,{label:`Rule Group ${n+1}`}),t(j,{leftIcon:()=>t(vs,{fill:l.v2.colors.red[500]}),variant:K.Secondary,size:W.S,onClick:()=>{return e=n,c(s.filter((t,i)=>i!==e));var e},disabled:1===s.length})]}),t(Y,{name:`urlGroup-${n}-namespace`,label:"Namespace",placeholder:"All namespaces",tooltip:"Filter rules to a specific Kubernetes namespace.",value:i.filterK8sNamespace||"",onChange:e=>d(n,{filterK8sNamespace:e.target.value})}),t(X,{name:`urlGroup-${n}-workloadFilters`,label:"Workload filters",tooltip:"Optionally scope templates to specific workloads.",columns:Sp,values:i.workloadFilters||[],setValues:e=>d(n,{workloadFilters:e})}),t(_,{name:`urlGroup-${n}-templates`,label:"Templates",required:!0,placeholder:"e.g. /user/{id}",values:i.templatizationRules.map(e=>e.template),setValues:e=>d(n,{templatizationRules:e.map(e=>({template:e}))})})]}),t(z,{errorMessage:o[yp]})]},`url-templatization-group-${n}`)),t(j,{variant:K.Secondary,label:"Add rule group",leftIcon:ys,onClick:()=>c([...s,{filterK8sNamespace:"",workloadFilters:[],templatizationRules:[{template:""}],notes:""}])}),t(q,{})]})},[J.ExtractAttribute]:({value:i,setValue:n,formErrors:a})=>{const r=v(),s=a[cp],c=i[cp]?.extractions||[],[d,p]=l(()=>(e=>e.length&&e.some(hp)?dp.Regex:dp.Preset)(c)),[u,h]=l(null),g=e=>n(cp,{extractions:e});o(()=>{0===c.length&&g([d===dp.Preset?up():{targetAttributeName:"",lookupKey:"",dataFormat:"",regex:""}])},[]);const m=(e,t)=>{g(c.map((i,n)=>n===e?{...i,...t}:i))},b=()=>{g([...c,d===dp.Preset?up():{targetAttributeName:"",lookupKey:"",dataFormat:"",regex:""}])},f=d===dp.Preset,y=c.length?c:[f?up():{targetAttributeName:"",lookupKey:"",dataFormat:"",regex:""}],S=null!=u&&y[u]?.regex||"";return e($,{$gap:16,$width:"100%",children:[t(F,{options:[{value:dp.Preset,label:B.SEGMENT_PRESET_LABEL,tooltip:B.SEGMENT_PRESET_TOOLTIP,selectedBgColor:r.v2.colors.purple[500]},{value:dp.Regex,label:B.SEGMENT_REGEX_LABEL,tooltip:B.SEGMENT_REGEX_TOOLTIP,selectedBgColor:r.v2.colors.purple[500]}],selected:d,setSelected:e=>{p(e),g([e===dp.Preset?up():{targetAttributeName:"",lookupKey:"",dataFormat:"",regex:""}])}}),e($,{$gap:8,$width:"100%",children:[y.map((i,n)=>{const a=n===y.length-1,o=i.dataFormat||U.JSON,l=G[o];return e(gp,{"data-id":`extract-row-${n}`,children:[e(T,{$gap:10,$alignItems:"flex-start",$width:"100%",$justifyContent:"space-between",children:[e($,{$gap:10,children:[t(R,{label:f?B.PRESET_ROW_TITLE(n):B.REGEX_ROW_TITLE(n)}),f&&t(T,{$gap:24,children:pp.map(e=>t(V,{"data-id":`extract-row-${n}-fmt-${e}`,size:H.L,label:G[e].label,value:o===e,onChange:t=>t&&m(n,{dataFormat:e})},`extract-row-${n}-fmt-${e}`))})]}),e(T,{$gap:4,$alignItems:"center",children:[!f&&t(j,{"data-id":`extract-row-${n}-test-regex`,label:B.TEST_REGEX_LABEL,variant:K.Secondary,size:W.S,onClick:()=>h(n),disabled:!i.regex?.trim()}),t(j,{"data-id":`extract-row-${n}-delete`,leftIcon:()=>t(vs,{fill:r.v2.colors.red[500]}),variant:K.Secondary,size:W.S,onClick:()=>(e=>{const t=c.filter((t,i)=>i!==e);g(t.length?t:[d===dp.Preset?up():{targetAttributeName:"",lookupKey:"",dataFormat:"",regex:""}])})(n)}),a&&t(j,{"data-id":`extract-row-${n}-add`,leftIcon:ys,variant:K.Secondary,size:W.S,onClick:b})]})]}),f?e(T,{$gap:8,$alignItems:"flex-start",$width:"100%",children:[t(mp,{children:t(Y,{name:`extract-row-${n}-lookupKey`,label:l.keyLabel,placeholder:l.placeholder,helpMessage:l.helpMessage,width:"100%",value:i.lookupKey||"",onChange:e=>m(n,{lookupKey:e.target.value})})}),t(bp,{children:t(Ss,{size:24,fill:r.v2.colors.silver[200]})}),t(mp,{children:t(Y,{name:`extract-row-${n}-targetAttributeName`,label:B.TARGET_LABEL,placeholder:B.TARGET_PLACEHOLDER,helpMessage:B.TARGET_HELP,width:"100%",value:i.targetAttributeName||"",onChange:e=>m(n,{targetAttributeName:e.target.value})})})]}):e($,{$gap:12,$width:"100%",children:[t(Y,{name:`extract-row-${n}-regex`,label:B.REGEX_LABEL,placeholder:B.REGEX_PLACEHOLDER,helpMessage:B.REGEX_HELP,width:"100%",value:i.regex||"",onChange:e=>m(n,{regex:e.target.value})}),t(Y,{name:`extract-row-${n}-targetAttributeName`,label:B.TARGET_LABEL,placeholder:B.TARGET_PLACEHOLDER,helpMessage:B.TARGET_HELP,width:"100%",value:i.targetAttributeName||"",onChange:e=>m(n,{targetAttributeName:e.target.value})})]})]},`extract-row-${n}`)}),t(z,{errorMessage:s})]}),t(od,{isOpen:null!=u,regex:S,onClose:()=>h(null)})]})},[J.DbQueryTemplatization]:null,[J.InferDbAttributes]:null},wp=({actionType:e,value:i,setValue:n,formErrors:a,dynamicFields:o,signals:l,sourceOptions:r,namespaceOptions:s})=>{if(!e)return null;if(o?.length)return t(ld,{fields:o,value:i||{},setValue:n,formErrors:a||{},signals:l||[],seedInitialValues:!0,keyValuePersistAs:"map",sourceOptions:r,namespaceOptions:s},e);const c=xp[e];return c?t(c,{value:i,setValue:n,formErrors:a}):null},Cp=()=>{const{selectedOption:i,genericForm:n,sourceOptions:a,namespaceOptions:o}=Pc();if(!n||!i)return t(Z,{title:"No active form"});const{formData:l,handleFormChange:r,formErrors:s}=n;return e($,{$gap:24,children:[e(T,{$gap:12,$justifyContent:"space-between",children:[t(Q,{size:C.XXXS,maxLines:2,children:i.description}),e(T,{$gap:12,children:[t(rd,{isEnabled:!l.disabled,setIsEnabled:e=>r("disabled",!e)}),t(j,{leftIcon:xs,variant:K.Secondary,size:W.S,onClick:()=>i.docsUrl&&window.open(i.docsUrl,"_blank","noopener noreferrer")})]})]}),t(sd,{title:"Signals for processing",allowedSignals:i.allowedSignals,selectedSignals:l.signals||[],setSelectedSignals:e=>r("signals",e),errorMessage:s.signals}),t(Y,{name:"actionName",label:"Action name",placeholder:"Use a name that describes the action...",value:l.name||"",onChange:({target:{value:e}})=>r("name",e),errorMessage:s.name}),t(wp,{actionType:i.type,dynamicFields:i.fields,signals:l.signals||[],value:l.fields,setValue:(e,t)=>r(`fields.${e}`,t),formErrors:s,sourceOptions:a,namespaceOptions:o}),t(ee,{name:"notes",label:"Notes",placeholder:"Your personal notes...",value:l.notes||"",onChange:({target:{value:e}})=>r("notes",e),errorMessage:s.notes})]})},kp=f(T)`
|
|
46
46
|
position: sticky;
|
|
47
47
|
bottom: 4px;
|
|
48
48
|
align-self: center;
|
|
@@ -53,7 +53,7 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
53
53
|
background-color: ${({theme:e})=>e.v2.colors.black[500]};
|
|
54
54
|
box-shadow: 0 4px 16.7px 0 rgba(0, 0, 0, 0.83);
|
|
55
55
|
z-index: 1;
|
|
56
|
-
`,Tp=s(({isEdit:i},n)=>{const a=v(),{isK8s:r}=Xr(),{destinationsApi:s}=Pc(),{activeForm:d,genericForm:p,validateFormData:u,thisUnsavedDestination:h,addUnsavedDestination:g,updateUnsavedDestination:m,deleteUnsavedDestination:b}=Mc(),[f,y]=l(h?.testResult),[S,x]=l(!!h);o(()=>{h?(y(h.testResult),x(!0)):(y(void 0),x(!1))},[h]);const w=async()=>{if(!d?.option.testConnectionSupported||!p||!r)return;const e=await s.testConnection(re(p.formData));return y(e),e};return c(n,()=>({testConnection:w,testConnectionSupported:!!d?.option.testConnectionSupported}),[d?.option.testConnectionSupported,p,s]),p&&d?e($,{$gap:24,style:{minHeight:"100%"},children:[e(T,{$gap:12,$justifyContent:"space-between",children:[f?f.succeeded?t(te,{status:ie.Success,message:f.message||"Connection OK",fullWidth:!0,smallIcon:!0}):t(te,{status:ie.Error,message:f.message||"Connection Failed",fullWidth:!0,smallIcon:!0}):t("div",{}),e(T,{$gap:12,children:[r&&t(rd,{isEnabled:!p.formData.disabled,setIsEnabled:e=>p.handleFormChange("disabled",!e),fieldDisabled:S}),t(j,{"data-id":"dest-form-docs",leftIcon:xs,variant:W.Secondary,size:K.S,onClick:()=>window.open(`${ne}/backends/${d.option.type}`,"_blank","noopener noreferrer")})]})]}),t(sd,{title:"This connection will monitor:",allowedSignals:le(d.option.supportedSignals),selectedSignals:oe(p.formData.exportedSignals),setSelectedSignals:e=>p.handleFormChange("exportedSignals",{logs:e.includes(ae.Logs),metrics:e.includes(ae.Metrics),traces:e.includes(ae.Traces),profiles:e.includes(ae.Profiles)}),disabled:S,errorMessage:p.formErrors.exportedSignals}),t(Y,{name:"destinationName",label:"Destination name",placeholder:"Use a name that describes the destination...",value:p.formData.name,onChange:({target:{value:e}})=>p.handleFormChange("name",e),disabled:S,errorMessage:p.formErrors.name}),t(ld,{signals:oe(p.formData.exportedSignals),fields:d.option.fields,disabled:S,value:Object.fromEntries(p.formData.fields.map(e=>[e.key,e.value])),setValue:(e,t)=>{const i=p.formData.fields.some(t=>t.key===e);p.handleFormChange("fields",i?p.formData.fields.map(i=>i.key===e?{...i,value:t}:i):[...p.formData.fields,{key:e,value:t}]),e&&p.formErrors[e]&&p.handleErrorChange(e,void 0)},formErrors:p.formErrors,keyValuePersistAs:"array"}),!i&&e(kp,{$gap:8,$justifyContent:"center",children:[h&&t("div",{style:{width:"150px"},children:t(j,{"data-id":"dest-form-delete",fullWidth:!0,label:"Delete",rightIcon:ws,variant:W.Secondary,textColor:a.v2.colors.red[500],onClick:()=>b(d.unsavedIdx)})}),r&&(!h||h.option.testConnectionSupported&&!S)&&t("div",{style:{width:"150px"},children:t(j,{"data-id":"dest-form-test-connection",fullWidth:!0,label:"Test Connection",variant:W.Secondary,onClick:w})}),h&&t("div",S?{style:{width:"150px"},children:t(j,{"data-id":"dest-form-edit",fullWidth:!0,label:"Edit",rightIcon:Cs,variant:W.Secondary,onClick:()=>x(!1)})}:{style:{width:"150px"},children:t(j,{"data-id":"dest-form-save",fullWidth:!0,label:"Save Changes",variant:W.Primary,onClick:async()=>{const{errorMessage:e,preparedFormData:t}=u();if(!e){const e=await w(),i=!!e&&!e.succeeded;m(d.unsavedIdx,{formData:t,testResult:e},i)}}})}),!h&&t("div",{style:{width:"150px"},children:t(j,{"data-id":"dest-form-add",fullWidth:!0,label:"Add Destination",variant:W.Primary,onClick:async()=>{const{errorMessage:e,preparedFormData:t}=u();if(!e){const e=await w(),i=!!e&&!e.succeeded;g({formData:t,testResult:e},i)}}})})]})]}):t(Z,{title:"No active form"})});Tp.displayName="AddDestinationForm";const Ip=[{id:se.FilePath,label:"Collect file path",tooltip:"Indicates whether to record the `code.filepath` attribute."},{id:se.Function,label:"Collect function",tooltip:"Indicates whether to record the `code.function` attribute."},{id:se.LineNumber,label:"Collect line number",tooltip:"Indicates whether to record the `code.lineno` attribute."}],$p=[{id:se.Column,label:"Collect column",tooltip:"Indicates whether to record the `code.column` attribute."},{id:se.Namespace,label:"Collect namespace",tooltip:"Indicates whether to record the `code.namespace` attribute."},{id:se.StackTrace,label:"Collect stacktrace",tooltip:"Indicates whether to record the `code.stacktrace` attribute."}],Ap=["*"],Np=[{id:pe.HttpRequest,label:"Collect HTTP request",tooltip:""},{id:pe.HttpResponse,label:"Collect HTTP response",tooltip:""},{id:pe.DbQuery,label:"Collect DB query",tooltip:""},{id:pe.Messaging,label:"Collect messaging",tooltip:""}],Op={[me.Java]:[new he("","")],[me.Golang]:[new ue("")],[me.Php]:[new ge("","")]},Ep={[fe.CodeAttributes]:({value:n,setValue:l,formErrors:r,disabled:s})=>{const c=r.codeAttributes,d=a(()=>Object.entries(n.codeAttributes||{}).filter(([e,t])=>!!t).map(([e])=>e),[n]);o(()=>{if(!d.length&&!c){const e={[se.FilePath]:!0,[se.Function]:!0,[se.LineNumber]:!0,[se.Column]:null,[se.Namespace]:null,[se.StackTrace]:null};l("codeAttributes",e)}},[]);const p=(e,t)=>{const i=t?[...d,e]:d.filter(t=>t!==e),n=Object.values(se).reduce((e,t)=>(e[t]=!!i.includes(t)||null,e),{});l("codeAttributes",n)};return e(i,{children:[e($,{$gap:12,children:[t(w,{size:C.XS,color:k.Secondary,nowrap:!0,children:"Recommended data to collect"}),t($,{$gap:6,children:Ip.map(({id:e,label:i,tooltip:n})=>t(ce,{text:n,withIcon:!0,children:t(x,{label:i,value:d.includes(e),onChange:t=>p(e,t),disabled:s})},e))}),t(z,{errorMessage:c})]}),e($,{$gap:12,children:[t(w,{size:C.XS,color:k.Secondary,nowrap:!0,children:"Verbose data to collect"}),t($,{$gap:6,children:$p.map(({id:e,label:i,tooltip:n})=>t(ce,{text:n,withIcon:!0,children:t(x,{label:i,value:d.includes(e),onChange:t=>p(e,t),disabled:s})},e))}),t(z,{errorMessage:c})]})]})},[fe.CustomInstrumentation]:({value:n,setValue:l,formErrors:r,disabled:s})=>{const c=r.customInstrumentations,d=a(()=>(n?.customInstrumentations?.[me.Golang]||[]).map(e=>new ue(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)),[n]),p=a(()=>(n?.customInstrumentations?.[me.Java]||[]).map(e=>new he(e.className,e.methodName)),[n]),u=a(()=>(n?.customInstrumentations?.[me.Php]||[]).map(e=>new ge(e.className,e.functionName)),[n]);return o(()=>{n?.customInstrumentations||c||l("customInstrumentations",{[me.Golang]:Op[me.Golang],[me.Java]:Op[me.Java],[me.Php]:Op[me.Php]})},[]),e(i,{children:[e($,{children:[e(T,{$gap:8,children:[t(ks,{}),t(R,{label:"Golang custom probes"})]}),t(L,{name:"golangProbes",columns:[{keyName:"packageName",label:"Package name",placeholder:"e.g. github.com/my-org/my-package",tooltip:"The full import path of the package containing the function or method to be instrumented."},{keyName:"functionName",label:"Function name",placeholder:"e.g. myFunction",tooltip:"The name of the function to be instrumented. Leave empty if instrumenting a receiver method."},{keyName:"receiverName",label:"Receiver name",placeholder:"e.g. myReceiver",tooltip:"The name of the receiver type if instrumenting a method. Leave empty if instrumenting a standalone function."},{keyName:"receiverMethodName",label:"Receiver method name",placeholder:"e.g. myMethod",tooltip:"The name of the method to be instrumented. Leave empty if instrumenting a standalone function."}],values:d,setValues:e=>{const t={};t[me.Golang]=e.map(e=>new ue(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)),t[me.Java]=p,t[me.Php]=u,l("customInstrumentations",t)},errorMessage:c,limitFieldsPerRow:2,disabled:s})]}),e($,{children:[e(T,{$gap:8,children:[t(Ts,{}),t(R,{label:"Java custom probes"})]}),t(L,{name:"javaProbes",columns:[{keyName:"className",label:"Class name",placeholder:"e.g. com.example.MyClass",tooltip:"The name of the class to be instrumented."},{keyName:"methodName",label:"Method name",placeholder:"e.g. myMethod",tooltip:"The name of the method to be instrumented."}],values:p,setValues:e=>{const t={};t[me.Golang]=d,t[me.Java]=e.map(e=>new he(e.className,e.methodName)),t[me.Php]=u,l("customInstrumentations",t)},errorMessage:c,limitFieldsPerRow:2,disabled:s})]}),e($,{children:[e(T,{$gap:8,children:[t(Is,{}),t(R,{label:"PHP custom probes"})]}),t(te,{status:ie.Warning,message:be.PHP_CUSTOM_INSTRUMENTATION_RESTART,fullWidth:!0}),t(L,{name:"phpProbes",columns:[{keyName:"className",label:"Class name",placeholder:"e.g. App\\Service\\OrderService",tooltip:"The fully qualified class name to instrument. Leave empty for a global function."},{keyName:"functionName",label:"Function name",placeholder:"e.g. processOrder",tooltip:"The name of the function or method to instrument."}],values:u,setValues:e=>{const t={};t[me.Golang]=d,t[me.Java]=p,t[me.Php]=e.map(e=>new ge(e.className,e.functionName)),l("customInstrumentations",t)},errorMessage:c,limitFieldsPerRow:2})]})]})},[fe.HeadersCollection]:({value:e,setValue:i,formErrors:n,disabled:l})=>{const r=n.headersCollection,s=a(()=>e?.headersCollection?.[de.HeaderKeys]||[],[e]),c=e=>{const t={[de.HeaderKeys]:e};i("headersCollection",t)};return o(()=>{s.length||r||c(Ap)},[]),t(_,{name:"headerKeys",label:"Header keys",tooltip:"Specify which headers you want to collect",helpMessage:"Asterisk (*) will collect all headers",values:s,setValues:c,errorMessage:r,disabled:l})},[fe.PayloadCollection]:({value:i,setValue:n,formErrors:l,disabled:r})=>{const s=l.payloadCollection,c=a(()=>Object.entries(i.payloadCollection||{}).filter(([e,t])=>!!t).map(([e])=>e),[i]);return o(()=>{if(!c.length&&!s){const e={[pe.HttpRequest]:{},[pe.HttpResponse]:{},[pe.DbQuery]:{},[pe.Messaging]:{}};n("payloadCollection",e)}},[]),e($,{$gap:12,children:[t(w,{size:C.XS,color:k.Secondary,nowrap:!0,children:"Type of data to collect"}),t($,{$gap:6,children:Np.map(({id:e,label:i,tooltip:a})=>t(ce,{text:a,withIcon:!0,children:t(x,{label:i,value:c.includes(e),onChange:t=>((e,t)=>{const i=t?[...c,e]:c.filter(t=>t!==e),a={[pe.HttpRequest]:i.includes(pe.HttpRequest)?{}:null,[pe.HttpResponse]:i.includes(pe.HttpResponse)?{}:null,[pe.DbQuery]:i.includes(pe.DbQuery)?{}:null,[pe.Messaging]:i.includes(pe.Messaging)?{}:null};n("payloadCollection",a)})(e,t),disabled:r})},e))}),t(z,{errorMessage:s})]})},[fe.NetworkMetrics]:null,[fe.UnknownType]:null},Dp=({ruleType:e,value:i,setValue:n,formErrors:a,dynamicFields:o,disabled:l})=>{if(!e)return null;if(o?.length)return t(ld,{fields:o,value:i||{},setValue:n,formErrors:a||{},signals:[],seedInitialValues:!0,keyValuePersistAs:"map",disabled:l},e);const r=Ep[e];return r?t(r,{value:i,setValue:n,formErrors:a,disabled:l}):null},Rp=()=>{const i=v(),{isEnterprise:n,platformType:o,version:l}=Xr(),r=ve(o,l),{selectedOption:s,genericForm:c,sourceOptions:d,namespaceOptions:p}=_c(),u=a(()=>ye(s?.supportedLanguages),[s?.supportedLanguages]),h=a(()=>{if(s)return s.type===fe.CustomInstrumentation?[]:Se(s.supportedLanguages)},[s]);if(!c||!s)return t(Z,{title:"No active form"});const{formData:g,handleFormChange:m,formErrors:b}=c;return e($,{$gap:24,children:[e(T,{$gap:12,$justifyContent:"space-between",children:[t(Q,{size:C.XXXS,maxLines:2,children:s.description}),e(T,{$gap:12,children:[t(rd,{isEnabled:!g.disabled,setIsEnabled:e=>m("disabled",!e),fieldDisabled:!n}),t(j,{leftIcon:xs,variant:W.Secondary,size:K.S,onClick:()=>s.docsUrl&&window.open(s.docsUrl,"_blank","noopener noreferrer")})]})]}),t(cd,{option:s,formState:g}),!!u.length&&e(T,{$gap:12,children:[t(w,{size:C.XS,color:k.Secondary,nowrap:!0,children:"Supported Languages:"}),u.map(e=>t(E,{label:we(e),leftIcon:xe(e),backgroundColor:i.v2.colors.purple[900]},e))]}),r&&t(dd,{scopes:g.sourceScopes,onChange:e=>m("sourceScopes",e),sourceOptions:d,namespaceOptions:p,supportedLanguages:h,dataIdPrefix:"instrumentation-rule",slim:!0,disabled:!n}),t(Y,{name:"ruleName",label:"Rule name",placeholder:"Use a name that describes the rule...",value:g.ruleName,onChange:({target:{value:e}})=>m("ruleName",e),errorMessage:b.ruleName,disabled:!n}),t(Dp,{ruleType:s.type,dynamicFields:s.fields,value:g,setValue:(e,t)=>m(e,t),formErrors:b,disabled:!n}),t(ee,{name:"notes",label:"Notes",placeholder:"Your personal notes...",value:g.notes,onChange:({target:{value:e}})=>m("notes",e),errorMessage:b.notes,disabled:!n})]})},zp=()=>{const{pendingMerge:e,confirmMerge:i,cancelMerge:n}=Fc();if(!e)return null;const{existingName:a,editingName:o}=e;return t(Ce,{isOpen:!0,onClose:n,title:"Merge with existing Data Stream?",description:ke.DATA_STREAM_MERGE_WARNING(o,a),approveButton:{"data-id":"data-stream-merge-confirm",label:"Merge",variant:W.Primary,onClick:i},denyButton:{"data-id":"data-stream-merge-cancel",label:"Cancel",variant:W.Secondary,onClick:n}})},Lp=({autoFocus:i})=>{const{dataStreams:n}=Te(),{genericForm:o,excludeName:l,editingName:r}=Fc(),{formData:s,formErrors:c,handleFormChange:d}=o,p=s.name,u=a(()=>n.find(e=>e.name===p&&e.name!==l),[n,p,l]);return e($,{$width:"100%",$gap:12,children:[t(Y,{name:"data-stream-name",label:ke.STREAM_NAME,placeholder:ke.NAME_YOUR_STREAM_PLACEHOLDER,tooltip:ke.STREAM_DESCRIPTION,required:!0,autoFocus:i,value:p,onChange:e=>d("name",e.target.value),errorMessage:c.name}),u&&t(te,{status:ie.Warning,message:ke.DATA_STREAM_MERGE_WARNING(r,u.name),fullWidth:!0})]})},Xp=()=>{const{selectedStreamName:e}=Te(),{genericForm:i}=Bc();if(!i)return t(Z,{title:"No active form"});const{formData:n,handleFormChange:a,formErrors:o}=i;return t(Y,{name:"sourceName",label:ke.NAME,tooltip:"This overrides the default service name (service.name) reported in your telemetry.",placeholder:"Use a name that overrides the source name",value:n.otelServiceName,onChange:({target:{value:t}})=>{a("otelServiceName",t),a("currentStreamName",e)},errorMessage:o.otelServiceName})},Pp=[{value:"all",label:"Drop All"},{value:"sample",label:"Sample"}],Mp=f.div`
|
|
56
|
+
`,Tp=s(({isEdit:i},n)=>{const a=v(),{isK8s:r}=Pr(),{destinationsApi:s}=Lc(),{activeForm:d,genericForm:p,validateFormData:u,thisUnsavedDestination:h,addUnsavedDestination:g,updateUnsavedDestination:m,deleteUnsavedDestination:b}=Mc(),[f,y]=l(h?.testResult),[S,x]=l(!!h);o(()=>{h?(y(h.testResult),x(!0)):(y(void 0),x(!1))},[h]);const w=async()=>{if(!d?.option.testConnectionSupported||!p||!r)return;const e=await s.testConnection(re(p.formData));return y(e),e};return c(n,()=>({testConnection:w,testConnectionSupported:!!d?.option.testConnectionSupported}),[d?.option.testConnectionSupported,p,s]),p&&d?e($,{$gap:24,style:{minHeight:"100%"},children:[e(T,{$gap:12,$justifyContent:"space-between",children:[f?f.succeeded?t(te,{status:ie.Success,message:f.message||"Connection OK",fullWidth:!0,smallIcon:!0}):t(te,{status:ie.Error,message:f.message||"Connection Failed",fullWidth:!0,smallIcon:!0}):t("div",{}),e(T,{$gap:12,children:[r&&t(rd,{isEnabled:!p.formData.disabled,setIsEnabled:e=>p.handleFormChange("disabled",!e),fieldDisabled:S}),t(j,{"data-id":"dest-form-docs",leftIcon:xs,variant:K.Secondary,size:W.S,onClick:()=>window.open(`${ne}/backends/${d.option.type}`,"_blank","noopener noreferrer")})]})]}),t(sd,{title:"This connection will monitor:",allowedSignals:le(d.option.supportedSignals),selectedSignals:oe(p.formData.exportedSignals),setSelectedSignals:e=>p.handleFormChange("exportedSignals",{logs:e.includes(ae.Logs),metrics:e.includes(ae.Metrics),traces:e.includes(ae.Traces),profiles:e.includes(ae.Profiles)}),disabled:S,errorMessage:p.formErrors.exportedSignals}),t(Y,{name:"destinationName",label:"Destination name",placeholder:"Use a name that describes the destination...",value:p.formData.name,onChange:({target:{value:e}})=>p.handleFormChange("name",e),disabled:S,errorMessage:p.formErrors.name}),t(ld,{signals:oe(p.formData.exportedSignals),fields:d.option.fields,disabled:S,value:Object.fromEntries(p.formData.fields.map(e=>[e.key,e.value])),setValue:(e,t)=>{const i=p.formData.fields.some(t=>t.key===e);p.handleFormChange("fields",i?p.formData.fields.map(i=>i.key===e?{...i,value:t}:i):[...p.formData.fields,{key:e,value:t}]),e&&p.formErrors[e]&&p.handleErrorChange(e,void 0)},formErrors:p.formErrors,keyValuePersistAs:"array"}),!i&&e(kp,{$gap:8,$justifyContent:"center",children:[h&&t("div",{style:{width:"150px"},children:t(j,{"data-id":"dest-form-delete",fullWidth:!0,label:"Delete",rightIcon:ws,variant:K.Secondary,textColor:a.v2.colors.red[500],onClick:()=>b(d.unsavedIdx)})}),r&&(!h||h.option.testConnectionSupported&&!S)&&t("div",{style:{width:"150px"},children:t(j,{"data-id":"dest-form-test-connection",fullWidth:!0,label:"Test Connection",variant:K.Secondary,onClick:w})}),h&&t("div",S?{style:{width:"150px"},children:t(j,{"data-id":"dest-form-edit",fullWidth:!0,label:"Edit",rightIcon:Cs,variant:K.Secondary,onClick:()=>x(!1)})}:{style:{width:"150px"},children:t(j,{"data-id":"dest-form-save",fullWidth:!0,label:"Save Changes",variant:K.Primary,onClick:async()=>{const{errorMessage:e,preparedFormData:t}=u();if(!e){const e=await w(),i=!!e&&!e.succeeded;m(d.unsavedIdx,{formData:t,testResult:e},i)}}})}),!h&&t("div",{style:{width:"150px"},children:t(j,{"data-id":"dest-form-add",fullWidth:!0,label:"Add Destination",variant:K.Primary,onClick:async()=>{const{errorMessage:e,preparedFormData:t}=u();if(!e){const e=await w(),i=!!e&&!e.succeeded;g({formData:t,testResult:e},i)}}})})]})]}):t(Z,{title:"No active form"})});Tp.displayName="AddDestinationForm";const Ip=[{id:se.FilePath,label:"Collect file path",tooltip:"Indicates whether to record the `code.filepath` attribute."},{id:se.Function,label:"Collect function",tooltip:"Indicates whether to record the `code.function` attribute."},{id:se.LineNumber,label:"Collect line number",tooltip:"Indicates whether to record the `code.lineno` attribute."}],$p=[{id:se.Column,label:"Collect column",tooltip:"Indicates whether to record the `code.column` attribute."},{id:se.Namespace,label:"Collect namespace",tooltip:"Indicates whether to record the `code.namespace` attribute."},{id:se.StackTrace,label:"Collect stacktrace",tooltip:"Indicates whether to record the `code.stacktrace` attribute."}],Np=["*"],Ap=[{id:pe.HttpRequest,label:"Collect HTTP request",tooltip:""},{id:pe.HttpResponse,label:"Collect HTTP response",tooltip:""},{id:pe.DbQuery,label:"Collect DB query",tooltip:""},{id:pe.Messaging,label:"Collect messaging",tooltip:""}],Op={[me.Java]:[new he("","")],[me.Golang]:[new ue("")],[me.Php]:[new ge("","")]},Ep={[fe.CodeAttributes]:({value:n,setValue:l,formErrors:r,disabled:s})=>{const c=r.codeAttributes,d=a(()=>Object.entries(n.codeAttributes||{}).filter(([e,t])=>!!t).map(([e])=>e),[n]);o(()=>{if(!d.length&&!c){const e={[se.FilePath]:!0,[se.Function]:!0,[se.LineNumber]:!0,[se.Column]:null,[se.Namespace]:null,[se.StackTrace]:null};l("codeAttributes",e)}},[]);const p=(e,t)=>{const i=t?[...d,e]:d.filter(t=>t!==e),n=Object.values(se).reduce((e,t)=>(e[t]=!!i.includes(t)||null,e),{});l("codeAttributes",n)};return e(i,{children:[e($,{$gap:12,children:[t(w,{size:C.XS,color:k.Secondary,nowrap:!0,children:"Recommended data to collect"}),t($,{$gap:6,children:Ip.map(({id:e,label:i,tooltip:n})=>t(ce,{text:n,withIcon:!0,children:t(x,{label:i,value:d.includes(e),onChange:t=>p(e,t),disabled:s})},e))}),t(z,{errorMessage:c})]}),e($,{$gap:12,children:[t(w,{size:C.XS,color:k.Secondary,nowrap:!0,children:"Verbose data to collect"}),t($,{$gap:6,children:$p.map(({id:e,label:i,tooltip:n})=>t(ce,{text:n,withIcon:!0,children:t(x,{label:i,value:d.includes(e),onChange:t=>p(e,t),disabled:s})},e))}),t(z,{errorMessage:c})]})]})},[fe.CustomInstrumentation]:({value:n,setValue:l,formErrors:r,disabled:s})=>{const c=r.customInstrumentations,d=a(()=>(n?.customInstrumentations?.[me.Golang]||[]).map(e=>new ue(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)),[n]),p=a(()=>(n?.customInstrumentations?.[me.Java]||[]).map(e=>new he(e.className,e.methodName)),[n]),u=a(()=>(n?.customInstrumentations?.[me.Php]||[]).map(e=>new ge(e.className,e.functionName)),[n]);return o(()=>{n?.customInstrumentations||c||l("customInstrumentations",{[me.Golang]:Op[me.Golang],[me.Java]:Op[me.Java],[me.Php]:Op[me.Php]})},[]),e(i,{children:[e($,{children:[e(T,{$gap:8,children:[t(ks,{}),t(R,{label:"Golang custom probes"})]}),t(X,{name:"golangProbes",columns:[{keyName:"packageName",label:"Package name",placeholder:"e.g. github.com/my-org/my-package",tooltip:"The full import path of the package containing the function or method to be instrumented."},{keyName:"functionName",label:"Function name",placeholder:"e.g. myFunction",tooltip:"The name of the function to be instrumented. Leave empty if instrumenting a receiver method."},{keyName:"receiverName",label:"Receiver name",placeholder:"e.g. myReceiver",tooltip:"The name of the receiver type if instrumenting a method. Leave empty if instrumenting a standalone function."},{keyName:"receiverMethodName",label:"Receiver method name",placeholder:"e.g. myMethod",tooltip:"The name of the method to be instrumented. Leave empty if instrumenting a standalone function."}],values:d,setValues:e=>{const t={};t[me.Golang]=e.map(e=>new ue(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)),t[me.Java]=p,t[me.Php]=u,l("customInstrumentations",t)},errorMessage:c,limitFieldsPerRow:2,disabled:s})]}),e($,{children:[e(T,{$gap:8,children:[t(Ts,{}),t(R,{label:"Java custom probes"})]}),t(X,{name:"javaProbes",columns:[{keyName:"className",label:"Class name",placeholder:"e.g. com.example.MyClass",tooltip:"The name of the class to be instrumented."},{keyName:"methodName",label:"Method name",placeholder:"e.g. myMethod",tooltip:"The name of the method to be instrumented."}],values:p,setValues:e=>{const t={};t[me.Golang]=d,t[me.Java]=e.map(e=>new he(e.className,e.methodName)),t[me.Php]=u,l("customInstrumentations",t)},errorMessage:c,limitFieldsPerRow:2,disabled:s})]}),e($,{children:[e(T,{$gap:8,children:[t(Is,{}),t(R,{label:"PHP custom probes"})]}),t(te,{status:ie.Warning,message:be.PHP_CUSTOM_INSTRUMENTATION_RESTART,fullWidth:!0}),t(X,{name:"phpProbes",columns:[{keyName:"className",label:"Class name",placeholder:"e.g. App\\Service\\OrderService",tooltip:"The fully qualified class name to instrument. Leave empty for a global function."},{keyName:"functionName",label:"Function name",placeholder:"e.g. processOrder",tooltip:"The name of the function or method to instrument."}],values:u,setValues:e=>{const t={};t[me.Golang]=d,t[me.Java]=p,t[me.Php]=e.map(e=>new ge(e.className,e.functionName)),l("customInstrumentations",t)},errorMessage:c,limitFieldsPerRow:2})]})]})},[fe.HeadersCollection]:({value:e,setValue:i,formErrors:n,disabled:l})=>{const r=n.headersCollection,s=a(()=>e?.headersCollection?.[de.HeaderKeys]||[],[e]),c=e=>{const t={[de.HeaderKeys]:e};i("headersCollection",t)};return o(()=>{s.length||r||c(Np)},[]),t(_,{name:"headerKeys",label:"Header keys",tooltip:"Specify which headers you want to collect",helpMessage:"Asterisk (*) will collect all headers",values:s,setValues:c,errorMessage:r,disabled:l})},[fe.PayloadCollection]:({value:i,setValue:n,formErrors:l,disabled:r})=>{const s=l.payloadCollection,c=a(()=>Object.entries(i.payloadCollection||{}).filter(([e,t])=>!!t).map(([e])=>e),[i]);return o(()=>{if(!c.length&&!s){const e={[pe.HttpRequest]:{},[pe.HttpResponse]:{},[pe.DbQuery]:{},[pe.Messaging]:{}};n("payloadCollection",e)}},[]),e($,{$gap:12,children:[t(w,{size:C.XS,color:k.Secondary,nowrap:!0,children:"Type of data to collect"}),t($,{$gap:6,children:Ap.map(({id:e,label:i,tooltip:a})=>t(ce,{text:a,withIcon:!0,children:t(x,{label:i,value:c.includes(e),onChange:t=>((e,t)=>{const i=t?[...c,e]:c.filter(t=>t!==e),a={[pe.HttpRequest]:i.includes(pe.HttpRequest)?{}:null,[pe.HttpResponse]:i.includes(pe.HttpResponse)?{}:null,[pe.DbQuery]:i.includes(pe.DbQuery)?{}:null,[pe.Messaging]:i.includes(pe.Messaging)?{}:null};n("payloadCollection",a)})(e,t),disabled:r})},e))}),t(z,{errorMessage:s})]})},[fe.NetworkMetrics]:null,[fe.UnknownType]:null},Dp=({ruleType:e,value:i,setValue:n,formErrors:a,dynamicFields:o,disabled:l})=>{if(!e)return null;if(o?.length)return t(ld,{fields:o,value:i||{},setValue:n,formErrors:a||{},signals:[],seedInitialValues:!0,keyValuePersistAs:"map",disabled:l},e);const r=Ep[e];return r?t(r,{value:i,setValue:n,formErrors:a,disabled:l}):null},Rp=()=>{const i=v(),{isEnterprise:n,platformType:o,version:l}=Pr(),r=ve(o,l),{selectedOption:s,genericForm:c,sourceOptions:d,namespaceOptions:p}=_c(),u=a(()=>ye(s?.supportedLanguages),[s?.supportedLanguages]),h=a(()=>{if(s)return s.type===fe.CustomInstrumentation?[]:Se(s.supportedLanguages)},[s]);if(!c||!s)return t(Z,{title:"No active form"});const{formData:g,handleFormChange:m,formErrors:b}=c;return e($,{$gap:24,children:[e(T,{$gap:12,$justifyContent:"space-between",children:[t(Q,{size:C.XXXS,maxLines:2,children:s.description}),e(T,{$gap:12,children:[t(rd,{isEnabled:!g.disabled,setIsEnabled:e=>m("disabled",!e),fieldDisabled:!n}),t(j,{leftIcon:xs,variant:K.Secondary,size:W.S,onClick:()=>s.docsUrl&&window.open(s.docsUrl,"_blank","noopener noreferrer")})]})]}),t(cd,{option:s,formState:g}),!!u.length&&e(T,{$gap:12,children:[t(w,{size:C.XS,color:k.Secondary,nowrap:!0,children:"Supported Languages:"}),u.map(e=>t(E,{label:we(e),leftIcon:xe(e),backgroundColor:i.v2.colors.purple[900]},e))]}),r&&t(dd,{scopes:g.sourceScopes,onChange:e=>m("sourceScopes",e),sourceOptions:d,namespaceOptions:p,supportedLanguages:h,dataIdPrefix:"instrumentation-rule",slim:!0,disabled:!n}),t(Y,{name:"ruleName",label:"Rule name",placeholder:"Use a name that describes the rule...",value:g.ruleName,onChange:({target:{value:e}})=>m("ruleName",e),errorMessage:b.ruleName,disabled:!n}),t(Dp,{ruleType:s.type,dynamicFields:s.fields,value:g,setValue:(e,t)=>m(e,t),formErrors:b,disabled:!n}),t(ee,{name:"notes",label:"Notes",placeholder:"Your personal notes...",value:g.notes,onChange:({target:{value:e}})=>m("notes",e),errorMessage:b.notes,disabled:!n})]})},zp=()=>{const{pendingMerge:e,confirmMerge:i,cancelMerge:n}=Fc();if(!e)return null;const{existingName:a,editingName:o}=e;return t(Ce,{isOpen:!0,onClose:n,title:"Merge with existing Data Stream?",description:ke.DATA_STREAM_MERGE_WARNING(o,a),approveButton:{"data-id":"data-stream-merge-confirm",label:"Merge",variant:K.Primary,onClick:i},denyButton:{"data-id":"data-stream-merge-cancel",label:"Cancel",variant:K.Secondary,onClick:n}})},Xp=({autoFocus:i})=>{const{dataStreams:n}=Te(),{genericForm:o,excludeName:l,editingName:r}=Fc(),{formData:s,formErrors:c,handleFormChange:d}=o,p=s.name,u=a(()=>n.find(e=>e.name===p&&e.name!==l),[n,p,l]);return e($,{$width:"100%",$gap:12,children:[t(Y,{name:"data-stream-name",label:ke.STREAM_NAME,placeholder:ke.NAME_YOUR_STREAM_PLACEHOLDER,tooltip:ke.STREAM_DESCRIPTION,required:!0,autoFocus:i,value:p,onChange:e=>d("name",e.target.value),errorMessage:c.name}),u&&t(te,{status:ie.Warning,message:ke.DATA_STREAM_MERGE_WARNING(r,u.name),fullWidth:!0})]})},Pp=()=>{const{selectedStreamName:e}=Te(),{genericForm:i}=Bc();if(!i)return t(Z,{title:"No active form"});const{formData:n,handleFormChange:a,formErrors:o}=i;return t(Y,{name:"sourceName",label:ke.NAME,tooltip:"This overrides the default service name (service.name) reported in your telemetry.",placeholder:"Use a name that overrides the source name",value:n.otelServiceName,onChange:({target:{value:t}})=>{a("otelServiceName",t),a("currentStreamName",e)},errorMessage:o.otelServiceName})},Lp=[{value:"all",label:"Drop All"},{value:"sample",label:"Sample"}],Mp=f.div`
|
|
57
57
|
display: flex;
|
|
58
58
|
flex-direction: column;
|
|
59
59
|
gap: 24px;
|
|
@@ -63,7 +63,7 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
63
63
|
opacity: ${({$faded:e})=>e?.4:1};
|
|
64
64
|
transition: opacity 0.2s ease;
|
|
65
65
|
}
|
|
66
|
-
`,Fp=({value:e})=>{const i=v();return t(E,e?{status:ie.Success,label:De,leftIcon:$s}:{label:Re,leftIcon:
|
|
66
|
+
`,Fp=({value:e})=>{const i=v();return t(E,e?{status:ie.Success,label:De,leftIcon:$s}:{label:Re,leftIcon:Ns,backgroundColor:i.v2.colors.silver[500],textColor:i.v2.colors.white[500]})},Bp=({value:e,onChange:i})=>{const n=v(),o=a(()=>[{icon:$s,label:De,value:!0,selectedBgColor:n.v2.colors.green[800]},{icon:Ns,label:Re,value:!1,selectedBgColor:n.v2.colors.silver[500]}],[n]);return t(F,{options:o,selected:e,setSelected:i??(()=>{}),disabled:!i})},Up=()=>{const e=Uc();switch(e.formType){case Vc.Create:return t(Vp,{category:e.category,formData:e.formData,onChange:e.handleChange,sourceOptions:e.sourceOptions,namespaceOptions:e.namespaceOptions,renderAction:()=>t(Bp,{value:!e.formData.disabled,onChange:t=>e.handleChange({disabled:!t})})});case Vc.View:return e.data?e.isEditing?t(Vp,{category:e.data.category,formData:e.formData,onChange:e.handleChange,sourceOptions:e.sourceOptions,namespaceOptions:e.namespaceOptions,renderAction:()=>t(Bp,{value:!e.formData.disabled,onChange:t=>e.handleChange({disabled:!t})})}):t(Gp,{data:e.data,renderAction:()=>t(Fp,{value:!e.data?.rule.disabled})}):null;case Vc.EditAutoNoisy:return t(Hp,{enabled:e.localEnabled,summary:e.summary,inactiveTitle:Ee,sectionTitle:Ne,sectionSubTitle:Oe,presetLabel:$e,customInputName:"sampling-auto-input-custom-percentage",percentageMode:e.percentageMode,setPercentageMode:e.setPercentageMode,percentagePreset:e.percentagePreset,setPercentagePreset:e.setPercentagePreset,customPercentage:e.customPercentage,setCustomPercentage:e.setCustomPercentage,renderAction:()=>t(Bp,{value:e.localEnabled,onChange:e.setLocalEnabled})});case Vc.EditAutoCostReduction:return t(Hp,{enabled:e.localEnabled,summary:e.summary,inactiveTitle:Ae,sectionTitle:Ne,presetLabel:$e,customInputName:"sampling-cr-auto-input-custom-percentage",showModeToggle:!1,percentageMode:e.percentageMode,setPercentageMode:e.setPercentageMode,percentagePreset:e.percentagePreset,setPercentagePreset:e.setPercentagePreset,customPercentage:e.customPercentage,setCustomPercentage:e.setCustomPercentage,renderAction:()=>t(Bp,{value:e.localEnabled,onChange:e.setLocalEnabled})});case Vc.EditAutoHighlyRelevant:return t(Mp,{children:t(pd,{title:e.localEnabled?void 0:Ie,summary:e.summary,renderAction:()=>t(Bp,{value:e.localEnabled,onChange:e.setLocalEnabled})})})}},Vp=({category:i,formData:n,onChange:a,sourceOptions:o,namespaceOptions:l,renderAction:r})=>e(Mp,{children:[t(gd,{category:i,formState:n,renderAction:r}),e(_p,{$faded:!!n.disabled,children:[t(md,{category:i,formState:n,onChange:a}),t(dd,{scopes:n.sourceScopes,onChange:e=>a({sourceScopes:e}),sourceOptions:o,namespaceOptions:l,titleNumber:1,dataIdPrefix:"sampling"}),t(bd,{category:i,formState:n,onChange:a}),"highlyRelevant"===i&&t(fd,{formState:n,onChange:a}),"highlyRelevant"===i&&t(vd,{ruleType:n.ruleType,formState:n,onChange:a}),t(yd,{category:i,formState:n,onChange:a})]})]}),Gp=({data:i,renderAction:n})=>e(Mp,{children:[t(gd,{readOnly:!0,summary:i.summary,renderAction:n}),t(md,{readOnly:!0,data:i}),t(dd,{readOnly:!0,scopes:Lr(i.rule.sourceScopes)}),t(bd,{readOnly:!0,data:i}),t(yd,{readOnly:!0,data:i}),"highlyRelevant"===i.category&&t(vd,{readOnly:!0,rule:i.rule})]}),Hp=({enabled:i,summary:n,inactiveTitle:a,sectionTitle:o,sectionSubTitle:l,presetLabel:r,customInputName:s,showModeToggle:c=!0,percentageMode:p,setPercentageMode:u,percentagePreset:h,setPercentagePreset:g,customPercentage:m,setCustomPercentage:b,renderAction:f})=>{const v=d(e=>u(e),[u]),y=d(e=>g(e),[g]),S=d(e=>b(e.target.value),[b]),x=!c||"sample"===p;return e(Mp,{children:[t(pd,{title:i?void 0:a,summary:n,renderAction:f}),t(_p,{$faded:!i,children:e(ze,{richTitle:{title:o,subTitle:l},children:[c&&t($,{$alignItems:"flex-start",children:t(F,{options:Lp,selected:p,setSelected:v})}),x&&t(ud,{description:r,options:hd,selected:h,onSelect:y,customName:s,customLabel:Xe,customPlaceholder:"5%",customValue:m,onCustomChange:S})]})})]})},jp=({onClose:i,selectedConnectionIds:n,setSelectedConnectionIds:o,withOverlay:r})=>{const{actionsApi:s}=Lc(),{platformType:c,version:u}=Pr(),[h,g]=l(""),[m,b]=l(null),f=p(null),{selectedOption:v,onSelectOption:y,genericForm:S,validateFormData:x}=Pc(),{options:I,loading:$}=s.useActionTypes(),E=a(()=>I.length?I:Pe(c,u),[I,c,u]),D=a(()=>(h?E.filter(e=>e?.label?.toLowerCase().includes(h.toLowerCase())):E).filter(e=>!!e),[E,h]),R=d(e=>{f.current?.clearErrors(),y(e)},[y]),z=(({isLoading:e,options:i,selectedCategory:n,selectedType:o,onSelectOption:l})=>({width:"40%",list:a(()=>{if(e)return[t(N,{$padding:"8px 12px",children:t(A,{size:6})},"loading")];const a=i.reduce((e,t)=>{const i=t.category&&t.category in tp?t.category:ep;return(e[i]||=[]).push(t),e},{});return Object.keys(tp).filter(e=>a[e]?.length&&(!n||n===e)).map(e=>t(np,{bucket:e,options:a[e],selectedType:o,onSelectOption:l},e))},[e,i,n,o,l])}))({isLoading:$,options:D,selectedCategory:m,selectedType:v?.type,onSelectOption:R}),X=a(()=>{const e=new Set(E.map(e=>e.category));return[{value:null,label:"All Actions"},...Object.values(Le).filter(t=>e.has(t)).map(e=>({value:e,label:O[e].TITLE}))]},[E]),P=a(()=>$?[t(N,{$padding:"8px 12px",children:t(A,{size:4})},"loading")]:v?[t(Cp,{},v.type)]:[t(Me,{$height:"100%",children:t(Z,{icon:fs,title:"Action not selected",subTitle:"Please select an action to add"})},"no-data")],[$,v]);return t(Sd,{ref:f,isOpen:!0,withOverlay:r,onClose:i,onSave:async()=>{const{errorMessage:e,preparedFormData:t}=x();if(e)return!1;await s.create(t)},disableSave:!v||!S?.isFormDirty,isFormDirty:S?.isFormDirty,hideDirtyNote:!0,progress:{title:ke.CREATING_ACTION,subTitle:ke.CREATING_ACTION_SUBTITLE},header:{icon:fs,title:ke.ADD_ACTION,subTitle:ke.ADD_ACTION_DESCRIPTION},connectionIds:n&&o?{value:n,setValue:o}:void 0,search:{value:h,onChange:g,placeholder:"Search by action name",width:"370px"},filters:e(T,{$gap:8,children:[t(w,{size:C.XXS,color:k.Secondary,nowrap:!0,children:"Show"}),t(F,{options:X,selected:m,setSelected:b})]}),leftColumn:z,rightColumn:{width:"60%",list:P}})},Wp=({destinationsByCategory:n,filters:o,setFilters:l})=>{const r=a(()=>Object.values(_e).map(e=>({id:e,label:e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()})).filter(e=>n[e.id]?.length),[n]),s=a(()=>{const e=Object.values(ae).map(e=>({value:e,label:e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}));return e.unshift({value:null,label:"All"}),e},[]);return e(i,{children:[t(Fe,{placeholder:"Select category",options:r,values:o.categoryType?[o.categoryType]:[],setValues:e=>l({...o,categoryType:o.categoryType===e[0]?null:e[0]})}),t(F,{options:s,selected:o.signalType,setSelected:e=>l({...o,signalType:e})})]})},Kp=f.div`
|
|
67
67
|
display: flex;
|
|
68
68
|
flex-direction: column;
|
|
69
69
|
padding: 8px;
|
|
@@ -76,7 +76,7 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
76
76
|
justify-content: space-between;
|
|
77
77
|
gap: 12px;
|
|
78
78
|
padding: ${({$isOpen:e})=>e?"2px 12px 8px 12px":"2px 12px"};
|
|
79
|
-
`,
|
|
79
|
+
`,qp=({title:i,tooltip:n,list:a,noBgColor:o,purpleColors:r})=>{const[s,c]=l(!0);return e(Kp,{"data-id":`collapse-${i}`,$noBgColor:o,$purpleColors:r,children:[e(Yp,{$isOpen:s,children:[e(T,{$gap:10,children:[t(w,{size:C.XS,children:i}),n&&t(ce,{text:n,withIcon:!0}),t(E,{label:a.length,status:r?ie.Default:void 0})]}),t(Be,{icon:s?Os:Es,size:Ue.M,onClick:()=>c(e=>!e)})]}),s?t($,{children:a.length?u.toArray(a):t(Me,{$padding:"12px 0",children:t(Z,{})})}):null]})},Jp=(e,t,i)=>t||i.signalType?e.filter(e=>e.displayName.toLowerCase().includes(t.toLowerCase())&&(!i.signalType||le(e.supportedSignals).includes(i.signalType))):e,Zp=({option:e,formData:i,testResult:n,isSelected:a,onSelect:o})=>t(Qd,{icon:He(e.type).icon,title:i?.name||e.displayName,withCarret:!0,purpleColors:!!i,isSelected:a,onClick:()=>o(),children:n&&t(E,{status:n.succeeded?ie.Success:ie.Error,leftIcon:n.succeeded?Ds:Rs})}),Qp=({listType:e,destinationOptions:i,unsavedDestinations:n})=>{const{activeForm:a,onChangeActiveForm:o}=Mc();return i?.length?t(qp,{title:Ge[e].TITLE,tooltip:Ge[e].DESCRIPTION,list:i.map((i,n)=>t(Zp,{option:i,isSelected:a?.listType===e&&"number"!=typeof a?.unsavedIdx&&(null!=i.id&&""!==i.id?a?.option.id===i.id:a?.option.type===i.type),onSelect:()=>o({listType:e,option:i})},`${e}-${i.id??i.type}-${n}`))}):n?.length?t(qp,{purpleColors:!0,title:Ge[e].TITLE,tooltip:Ge[e].DESCRIPTION,list:n.map(({option:i,formData:n,testResult:l},r)=>t(Zp,{option:i,formData:n,testResult:l,isSelected:a?.unsavedIdx===r&&a?.listType===e,onSelect:()=>o({listType:e,option:i,unsavedIdx:r})},`${e}-${r}`))},e):void 0};var eu;(e=>{e.SELF_HOSTED="self hosted",e.MANAGED="managed"})(eu||(eu={}));const tu=(e,t)=>{const i=[],n=[],a=[];return e&&e.destinationCategories.categories.forEach(e=>{e.name===eu.SELF_HOSTED?n.push(...e.items):e.name===eu.MANAGED&&a.push(...e.items)}),t&&t?.potentialDestinations.forEach(t=>{for(const n of e?.destinationCategories?.categories||[]){const e=je(n),a=e.items.findIndex(e=>e.type===t.type);if(-1!==a){const n=We(t.fields,{});Object.keys(n).length&&(e.items[a].fields=e.items[a].fields.map(e=>({...e,initialValue:n[e.name]})),i.push(e.items[a]))}}}),{[_e.DETECTED]:i,[_e.SELF_HOSTED]:n,[_e.MANAGED]:a}},iu=({onClose:e,onBack:i,onNext:n,selectedConnectionIds:r,setSelectedConnectionIds:s,initialInputs:c,withOverlay:p,disableAnimation:u})=>{const{destinationsApi:h}=Lc(),[g,m]=l(""),[b,f]=l({categoryType:null,signalType:null}),{items:v}=h.useDestinations(),{data:y,loading:S}=h.useDestinationCategories(),{data:x,loading:w}=h.usePotentialDestinations(),{activeForm:C,genericForm:k,unsavedDestinations:T,setUnsavedDestinations:I}=Mc();o(()=>{c&&I(c)},[c]);const $=S||w,N=a(()=>y?.destinationCategories?.categories??[],[y]),[A,O]=l({[_e.ALL]:[],[_e.UNSAVED]:[],[_e.EXISTS]:[],[_e.DETECTED]:[],[_e.SELF_HOSTED]:[],[_e.MANAGED]:[]});o(()=>{const e=v.map(e=>{let t;for(const i of N){const n=i.items.find(t=>t.type===e.destinationType.type);if(n){t=n;break}}const i=We(e.fields,{});return{id:e.id,type:e.destinationType.type,displayName:e.name||e.destinationType.displayName,selected:!0,testConnectionSupported:t?.testConnectionSupported??!1,supportedSignals:e.destinationType.supportedSignals,fields:t?t.fields.map(e=>({...e,initialValue:i[e.name]??e.initialValue})):[]}});O(t=>({...t,[_e.EXISTS]:e}))},[v,N]),o(()=>{(y||x)&&O(e=>({...e,...tu(y,x)}))},[y,x]);const E=d(async()=>{for(const{option:e,formData:t}of T){const i=re(t);if(e.id){const t=Object.fromEntries(e.fields.map(e=>[e.name,e.initialValue??""])),n=Object.fromEntries(i.fields.map(e=>[e.key,e.value??""]));if(!Object.keys(t).some(e=>t[e]!==n[e])){await h.update(e.id,i);continue}}await h.create(i)}},[T,h]),D=(({isFetching:e,destinationsByCategory:i,searchText:n,filters:o})=>{const{unsavedDestinations:l}=Mc();return{width:"40%",list:a(()=>{const a=[];l.length&&a.push(t(Qp,{listType:_e.UNSAVED,unsavedDestinations:l},"unsaved"));for(const e of Object.values(_e)){if(o.categoryType&&o.categoryType!==e)continue;const l=Jp(i[e],n,o);l.length&&a.push(t(Qp,{listType:e,destinationOptions:l},e))}return e&&a.push(t(Me,{$height:"100%",children:t(Ve,{title:"Fetching destinations",withSpinner:!0})},"loading-more")),a},[l,i,n,o,e])}})({isFetching:$,destinationsByCategory:A,searchText:g,filters:b}),R=(()=>{const{activeForm:e}=Mc();return{width:"60%",list:e?[t(Tp,{},e.option.type)]:[t(Me,{$height:"100%",children:t(Z,{icon:As,title:"Select destination from the list",subTitle:"Add destination so your data has somewhere to go."})},"no-data")]}})();return t(Sd,{isOpen:!0,withOverlay:p,disableAnimation:u,onClose:e,onBack:i?()=>i(T):void 0,onNext:n?()=>n(T):void 0,nextIsSkip:!T.length,onSave:E,disableSave:!C&&!T.length,isFetching:$,isFormDirty:T.length>0||k?.isFormDirty,hideDirtyNote:!0,progress:{title:ke.CREATING_DESTINATION,subTitle:ke.CREATING_DESTINATION_SUBTITLE},header:{icon:As,title:ke.ADD_DESTINATIONS,subTitle:ke.ADD_DESTINATION_DRAWER_DESCRIPTION},connectionIds:r&&s?{value:r,setValue:s}:void 0,search:{value:g,onChange:m},filters:t(Wp,{destinationsByCategory:A,filters:b,setFilters:f}),leftColumn:D,rightColumn:R})},nu=({onClose:e,selectedConnectionIds:i,setSelectedConnectionIds:n,withOverlay:o})=>{const{isEnterprise:r}=Pr(),{instrumentationRulesApi:s}=Lc(),[c,d]=l(""),u=p(null),{selectedOption:h,onSelectOption:g,genericForm:m,validateFormData:b}=_c(),{options:f,loading:v}=s.useRuleTypes(),y=a(()=>f.length?f:Ke,[f]),S=a(()=>c?y.filter(e=>e.label.toLowerCase().includes(c.toLowerCase())):y,[y,c]),x=a(()=>v?[t(N,{$padding:"8px 12px",children:t(A,{size:4})},"loading")]:S.map(e=>{const i=h?.type===e.type;return t(Qd,{dataId:`option-${e.type}`,title:e.label,description:e.description,withCarret:!0,isSelected:i,onClick:()=>{u.current?.clearErrors(),g(e)}},e.type)}),[v,h?.type,S,g]),w=a(()=>v?[t(N,{$padding:"8px 12px",children:t(A,{size:4})},"loading")]:h?[t(Rp,{},h.type)]:[t(Me,{$height:"100%",children:t(Z,{icon:zs,title:"Instrumentation rule not selected",subTitle:"Please select an instrumentation rule to add"})},"no-data")],[v,h]);return t(Sd,{ref:u,isOpen:!0,withOverlay:o,onClose:e,onSave:async()=>{const{errorMessage:e,preparedFormData:t}=b();if(e)return!1;await s.create(t,h?.type)},disableSave:!h||!r||Ye(h.type)&&!m?.isFormDirty,isFormDirty:m?.isFormDirty,allowSaveWhenPristine:!!h&&!Ye(h.type),hideDirtyNote:!0,forcedNote:r?void 0:{fullWidth:!0,status:ie.Warning,message:"This feature is only supported for OnPrem (Enterprise) installations"},progress:{title:ke.CREATING_INSTRUMENTATION_RULE,subTitle:ke.CREATING_INSTRUMENTATION_RULE_SUBTITLE},header:{icon:zs,title:ke.ADD_INSTRUMENTATION_RULE,subTitle:ke.ADD_INSTRUMENTATION_RULE_DESCRIPTION},connectionIds:i&&n?{value:i,setValue:n}:void 0,search:{value:c,onChange:d},leftColumn:{width:"40%",list:x},rightColumn:{width:"60%",list:w}})},au={groupSegmentLabel:"Namespace",itemSegmentLabel:"Source",searchPlaceholder:()=>{},groupColumnHeader:"Namespaces",fetchingGroups:{title:ke.FETCHING_NAMESPACES,subTitle:ke.FETCHING_NAMESPACES_SUBTITLE},noGroups:{title:"No namespaces",subTitle:"No namespaces found in this cluster"},noGroupMatchedFilter:e=>`No namespace matched the filter '${e}'`,itemColumnHeader:"Workloads",selectGroupPrompt:{title:ke.SELECT_NAMESPACE,subTitle:ke.SELECT_NAMESPACE_SUBTITLE},noItemsInGroupSubTitle:"No sources found in this namespace"},ou={groupSegmentLabel:"Kind",itemSegmentLabel:"Source",searchPlaceholder:e=>"Search by "+(e===qe.Namespace?"kind":"source"),groupColumnHeader:"Kinds",fetchingGroups:{title:"Fetching kinds",subTitle:"Please wait while we fetch the kinds"},noGroups:{title:"No kinds",subTitle:"No kinds found on this host"},noGroupMatchedFilter:e=>`No kind matched the filter '${e}'`,itemColumnHeader:"Sources",selectGroupPrompt:{title:"Select kind from the list",subTitle:"Pick a kind so you can select sources from it."},noItemsInGroupSubTitle:"No sources found in this kind"},lu=e=>e?ou:au,ru="No matches",su=e=>(e?"Unselect":"Select")+" all",cu="Selected",du=f.div``,pu=f.div`
|
|
80
80
|
visibility: hidden;
|
|
81
81
|
|
|
82
82
|
transition: visibility 0s;
|
|
@@ -119,7 +119,7 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
119
119
|
justify-content: flex-end;
|
|
120
120
|
align-items: center;
|
|
121
121
|
min-width: 0;
|
|
122
|
-
`,fu=({clusterId:i,namespaceName:n,checkbox:a,isFutureApps:o,selectedCounts:l,isActive:r,onActive:s,handleSourceChange:c})=>{const{capabilities:d}=
|
|
122
|
+
`,fu=({clusterId:i,namespaceName:n,checkbox:a,isFutureApps:o,selectedCounts:l,isActive:r,onActive:s,handleSourceChange:c})=>{const{capabilities:d}=Lc(),p=d.canInstrumentNamespaces,u=e=>{s(),c({clusterId:i,workloadId:{namespace:n},auto:e.auto,selected:e.all})};return t(hu,{children:t(Qd,{dataId:`namespace-${n}`,withCarret:!0,title:n,isSelected:r,onClick:s,isPartiallyChecked:a.partial,isChecked:a.all,onCheckboxChange:e=>u({auto:e,all:e}),children:e(gu,{$withAuto:p,children:[p&&t(mu,{$visible:r||o,children:t(ce,{text:"Automatically instrument all workloads currently in the namespace, and all workloads that will be deployed to this namespace in the future",children:t(L,{label:"Auto",labelAlign:M.Left,size:Je.S,value:o,onChange:e=>u({auto:e,all:e||void 0})})})}),e(bu,{children:[t(w,{variant:Ze.Span,size:C.XXXS,color:k.Secondary,align:"right",nowrap:!0,children:cu}),t(E,{label:`${l.sourced}/${l.total}`,status:r?ie.Default:ie.Unknown,minWidth:"42px"})]})]})})})},vu=({withCollapse:e,clusterId:i,clusterName:n,namespaces:o,selectedArea:l,setSelectedArea:r,handleSourceChange:s})=>{const c=a(()=>o.map(({name:e,totalWorkloads:a,selectedCount:o,isAllSourced:c,isSomeSourced:d,isFutureApps:p})=>t(fu,{clusterId:i,namespaceName:e,isFutureApps:p,checkbox:{all:c||p,partial:d},selectedCounts:{sourced:o,total:a},isActive:l.clusterId===i&&l.namespaceName===e,onActive:()=>r({clusterId:i,clusterName:n,namespaceName:e}),handleSourceChange:s},`${i}#${e}`)),[i,n,o,l]);return e?t(qp,{title:n,list:c,noBgColor:!0}):c},yu=({onClose:i,onBack:n,onNext:r,selectedConnectionIds:s,setSelectedConnectionIds:c,withOverlay:d,disableAnimation:p})=>{const{isK8s:u}=Pr(),{sourcesApi:h,snapshotsApi:g,namespacesApi:m}=Lc(),{data:b,loading:f,pending:v,refetch:y}=g.useSnapshots(),{items:S,loading:x}=m.useNamespaces({skip:v||!!b}),I=lu(!u),{selectedStreamName:$}=Te(),{progress:N,resetProgress:A}=Qe(),{isFetching:O,setIsFetching:D,setSnapshots:R,formData:z,handleSourceChange:X,handleSelectAll:P,formDiff:M,isFormDirty:_}=Kc();o(()=>{y()},[]);const F=a(()=>{if(b)return b;const e=S;return e.length?{clusters:[{clusterId:tt,clusterName:et,namespaces:e.map(e=>({name:e.name,selected:e.markedForInstrumentation&&e.dataStreamNames.includes($),workloads:e.workloads?.map(e=>({namespace:e.id.namespace,name:e.id.name,kind:e.id.kind,region:e.id.region,selected:(e.markedForInstrumentation?.markedForInstrumentation??!1)&&(e.dataStreamNames?.includes($)??!1)}))||[]}))}]}:null},[b,S,$]);o(()=>{D(f||x),F&&R(F)},[F,f,x,D,R]);const[B,U]=l(""),[V,G]=l(qe.Namespace),[H,j]=l({showOnlySelected:!1}),[W,K]=l({clusterId:"",clusterName:"",namespaceName:""}),Y=(({isFetching:i,formData:n,handleSourceChange:o,handleSelectAll:l,selectedArea:r,setSelectedArea:s,searchText:c,searchBy:d,filters:p})=>{const{isK8s:u}=Pr(),h=lu(!u),g=a(()=>n.map(e=>{const t=[...e.namespaces].sort((e,t)=>e.name.localeCompare(t.name)).filter(e=>jc(e,c,p)).map(e=>({name:e.name,totalWorkloads:e.workloads.length,...Wc(e)}));return{clusterId:e.clusterId,clusterName:e.clusterName,visibleNamespaces:t}}),[n,c,p]),m=a(()=>{let e=!1;for(const{visibleNamespaces:t}of g)for(const{totalWorkloads:i,selectedCount:n}of t)if(e=!0,n!==i)return!1;return e},[g]),{list:b,withFilterCount:f,filteredCount:v,totalCount:y}=a(()=>{const e=g.map(({clusterId:e,clusterName:i,visibleNamespaces:n})=>n.length?t(vu,{withCollapse:g.length>1,clusterId:e,clusterName:i,namespaces:n,selectedArea:r,setSelectedArea:s,handleSourceChange:o},e):null).filter(e=>null!==e),i=g.reduce((e,{visibleNamespaces:t})=>e+t.length,0),a=n.reduce((e,{namespaces:t})=>e+t.length,0);return{list:e,withFilterCount:i!==a,filteredCount:i,totalCount:a}},[g,n,r]);return{width:"60%",header:e(T,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(T,{$gap:8,children:[t(w,{size:C.XS,nowrap:!0,children:h.groupColumnHeader}),t(ce,{text:f?ke.FILTERED_COUNT_TOOLTIP:void 0,children:t(E,{label:`${f?`${v} / ${y}`:y}`,status:ie.Unknown})})]}),t(w,{"data-id":"namespaces-select-all",onClick:()=>l({boolean:!m,searchText:c,searchBy:d,filters:p}),disabled:!b.length,size:C.XS,children:su(m)})]}),list:b.length?b:i?[t(Me,{$height:"100%",children:t(Ve,{title:h.fetchingGroups.title,subTitle:h.fetchingGroups.subTitle,withSpinner:!0})},"loading")]:[t(Me,{$height:"100%",children:t(Z,c?{icon:Ps,title:ru,subTitle:h.noGroupMatchedFilter(c)}:{icon:Ps,title:h.noGroups.title,subTitle:h.noGroups.subTitle})},"no-data")]}})({isFetching:O,formData:z,handleSourceChange:X,handleSelectAll:P,selectedArea:W,setSelectedArea:K,searchText:V===qe.Namespace?B:"",searchBy:V,filters:H}),q=(({formData:i,handleSourceChange:n,handleSelectAll:o,selectedArea:l,searchText:r,searchBy:s,filters:c})=>{const{isK8s:d,isEnterprise:p}=Pr(),u=lu(!d),h=a(()=>l.value.namespaceName?i.find(({clusterId:e})=>e===l.value.clusterId)?.namespaces.find(({name:e})=>e===l.value.namespaceName):void 0,[i,l.value.clusterId,l.value.namespaceName]),g=a(()=>h?[...h.workloads].sort((e,t)=>e.name.localeCompare(t.name)).filter(e=>Gc(e,r,c)):[],[h,r,c]),m=a(()=>!!g.length&&g.every(({selected:e})=>e),[g]),b=a(()=>{if(!h)return[];const{clusterId:e}=l.value,{name:i}=h;return g.map(({name:a,selected:o,kind:l,region:r})=>{const s=d&&!p&&Hc.has(l);return t(uu,{workloadName:a,workloadKind:l,isChecked:!s&&(o||!1),onToggle:()=>n({clusterId:e,workloadId:{namespace:i,name:a,kind:l,region:r}}),disabled:s},`${e}#${i}#${a}#${l}#${r??""}`)})},[g,h,l.value.clusterId,n,d,p]),{withFilterCount:f,filteredCount:v,totalCount:y}=a(()=>{const e=h?.workloads.length??0;return{withFilterCount:g.length!==e,filteredCount:g.length,totalCount:e}},[g,h]);return{width:"40%",header:e(T,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(T,{$gap:8,children:[t(w,{size:C.XS,nowrap:!0,children:l.value.namespaceName?`${l.value.namespaceName} > ${u.itemColumnHeader}`:u.itemColumnHeader}),t(ce,{text:f?ke.FILTERED_COUNT_TOOLTIP:void 0,children:t(E,{label:`${f?`${v} / ${y}`:y}`,status:ie.Unknown})})]}),t(w,{"data-id":"workloads-select-all",onClick:()=>o({clusterId:l.value.clusterId,namespaceName:l.value.namespaceName,boolean:!m,searchText:r,searchBy:s,filters:c}),disabled:!b.length,size:C.XS,children:su(m)})]}),list:b.length?b:[t(Me,{$height:"100%",children:t(Z,h?r?{icon:Xs,title:ru,subTitle:(S=r,`No sources matched the filter '${S}'`)}:{icon:Xs,title:"No sources",subTitle:u.noItemsInGroupSubTitle}:{icon:Xs,title:u.selectGroupPrompt.title,subTitle:u.selectGroupPrompt.subTitle})},"no-data")]};var S})({formData:z,handleSourceChange:X,handleSelectAll:P,selectedArea:{value:W},searchText:V===qe.Source?B:"",searchBy:V,filters:H});return t(Sd,{isOpen:!0,withOverlay:d,disableAnimation:p,onClose:i?()=>{A(it.BulkInstrumenting),i()}:void 0,onBack:n?()=>n(M):void 0,onNext:r?()=>r(M):void 0,nextIsSkip:!_,onSave:()=>h.persistV2(M),header:{icon:Xs,title:ke.ADD_SOURCE,subTitle:ke.ADD_SOURCES_DESCRIPTION},connectionIds:s&&c?{value:s,setValue:c}:void 0,search:{value:B,onChange:e=>{U(e),V===qe.Namespace&&K({clusterId:"",clusterName:"",namespaceName:""})},placeholder:I.searchPlaceholder(V),segment:{options:[{label:I.groupSegmentLabel,value:qe.Namespace},{label:I.itemSegmentLabel,value:qe.Source}],selected:V,setSelected:G}},filters:e(T,{$gap:8,children:[t(w,{size:C.XXXS,color:k.Secondary,nowrap:!0,children:"Show only:"}),t(L,{name:"filter-selected",size:Je.S,label:cu,value:H.showOnlySelected,onChange:e=>j(t=>({...t,showOnlySelected:e}))})]}),isFormDirty:_,isFetching:O,progress:{title:ke.CREATING_SOURCES,subTitle:ke.CREATING_SOURCES_SUBTITLE,percentage:N[it.BulkInstrumenting]?.percentage||0},leftColumn:Y,rightColumn:q})},Su={aws:_s,gcp:Ms,azure:Ls},xu={lambda:"Lambda","fargate-task":"ECS","fargate-cluster":"ECS","ecs-cluster":"ECS",eks:"EKS",ec2:"EC2"},wu=e=>e.split(/[-_]/).map(e=>e?e[0].toUpperCase()+e.slice(1):e).join(" "),Cu=e=>e.provider.toUpperCase(),ku=f.div`
|
|
123
123
|
display: flex;
|
|
124
124
|
flex-direction: column;
|
|
125
125
|
gap: 8px;
|
|
@@ -158,7 +158,7 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
158
158
|
gap: 2px;
|
|
159
159
|
flex: 1;
|
|
160
160
|
min-width: 0;
|
|
161
|
-
`,
|
|
161
|
+
`,Nu=({providers:i,selectedProvider:n,onSelect:a})=>{const o=v();return i.length?t(ku,{children:i.map(i=>{const l=(e=>Su[e.provider]??Fs)(i),r=i.provider===n,s=(e=>{const t=e.features.find(e=>e.key===nt.Discovery);if(!t)return"";const i=[],n=new Set;for(const e of t.types){const t=e.name.includes(".")?e.name.slice(e.name.indexOf(".")+1):e.name,a=xu[t]??wu(t);n.has(a)||(n.add(a),i.push(a))}return i.join(", ")})(i);return e(Tu,{type:"button",$selected:r,onClick:()=>a(i.provider),"data-id":`cloud-connector-provider-${i.provider}`,children:[t(Iu,{children:t(l,{size:24})}),e($u,{children:[t(w,{size:C.S,weight:400,lineHeight:"24px",color:k.Primary,children:Cu(i)}),s&&t(w,{size:C.XXXS,weight:400,lineHeight:"normal",color:k.Secondary,children:s})]}),t(bs,{size:18,fill:o.v2.colors.silver[300]})]},i.provider)})}):t(w,{size:C.XS,color:k.Secondary,children:"No providers available."})},Au=f.div`
|
|
162
162
|
display: flex;
|
|
163
163
|
flex-direction: column;
|
|
164
164
|
gap: 8px;
|
|
@@ -198,11 +198,11 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
198
198
|
transition: background-color 0.2s ease;
|
|
199
199
|
}
|
|
200
200
|
|
|
201
|
-
${
|
|
201
|
+
${Au}:hover & {
|
|
202
202
|
scrollbar-color: ${({theme:e})=>e.v2.colors.silver[300]} transparent;
|
|
203
203
|
}
|
|
204
204
|
|
|
205
|
-
${
|
|
205
|
+
${Au}:hover &::-webkit-scrollbar-thumb {
|
|
206
206
|
background-color: ${({theme:e})=>e.v2.colors.silver[300]};
|
|
207
207
|
}
|
|
208
208
|
`,Ru=f.pre`
|
|
@@ -212,7 +212,7 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
212
212
|
line-height: 20px;
|
|
213
213
|
color: ${({theme:e})=>e.v2.colors.green[400]};
|
|
214
214
|
white-space: pre;
|
|
215
|
-
`,zu=({policy:i})=>{const n=v(),{CopyButton:a}=at();return e(
|
|
215
|
+
`,zu=({policy:i})=>{const n=v(),{CopyButton:a}=at();return e(Au,{children:[e(Ou,{children:[t(Bs,{size:16,fill:n.v2.colors.silver[200]}),t(Eu,{children:t(w,{size:C.XXS,color:k.Primary,children:ke.CLOUD_CONNECTOR_POLICY_PREVIEW})}),t(a,{value:i})]}),t(Du,{children:t(Ru,{children:i})})]})},Xu="{{permissions}}",Pu=/\{\{(\w+)\}\}/g,Lu="create-role",Mu=(e,t,i)=>(e?.setup?.artifacts??[]).find(e=>e.section===t&&(!i||e.id===i)),_u=(e,t)=>(e?.setup?.artifacts??[]).filter(e=>e.section===t),Fu=(e,t)=>{const i=new Set,n=[];return _u(e,t).forEach(e=>{e.variant&&!i.has(e.variant)&&(i.add(e.variant),n.push({id:e.variant,label:e.variantLabel||e.variant}))}),n},Bu=(e,t,i)=>_u(e,t).find(e=>e.variant===i),Uu=(e,t={})=>{const i=((e,t,i)=>{const n=e.split("\n"),a=n.findIndex(e=>e.includes(Xu));if(-1===a)return e;const o=n[a],l=o.slice(0,o.indexOf(Xu)),r=t.itemTemplate||"{{permission}}",s=t.itemSeparator??"\n";return 0===i.length?n.splice(a,1):n[a]=i.map(e=>{return l+(t=e,r.split("{{permission}}").join(t));var t}).join(s),n.join("\n")})(e.template??"",e,t.permissions??[]);return((e,t)=>e.replace(Pu,(e,i)=>Object.prototype.hasOwnProperty.call(t,i)?t[i]:e))(i,t.vars??{})};var Vu;(e=>{e.DiscoveryOnly="discovery-only",e.DiscoveryInstrumentation="discovery-instrumentation",e.Custom="custom"})(Vu||(Vu={}));const Gu=[{id:Vu.DiscoveryOnly,title:ke.CLOUD_CONNECTOR_PERMISSION_DISCOVERY_ONLY_TITLE,description:ke.CLOUD_CONNECTOR_PERMISSION_DISCOVERY_ONLY_DESC,featureKeys:[nt.Discovery]},{id:Vu.DiscoveryInstrumentation,title:ke.CLOUD_CONNECTOR_PERMISSION_DISCOVERY_INSTRUMENTATION_TITLE,description:ke.CLOUD_CONNECTOR_PERMISSION_DISCOVERY_INSTRUMENTATION_DESC,featureKeys:[nt.Discovery,nt.Instrumentation]},{id:Vu.Custom,title:ke.CLOUD_CONNECTOR_PERMISSION_CUSTOM_TITLE,description:ke.CLOUD_CONNECTOR_PERMISSION_CUSTOM_DESC,featureKeys:[]}],Hu=(e,t)=>e.features?.find(e=>e.key===t),ju=e=>{if(!e)return[];const t=Hu(e,nt.Discovery),i=Hu(e,nt.Instrumentation);return t?t.types.map(e=>{const t=i?.types.find(t=>t.name===e.name);return{typeName:e.name,displayName:e.displayName||e.name,discoveryPermissions:e.permissions??[],instrumentationPermissions:t?t.permissions??[]:void 0}}):[]},Wu=()=>{const e=new Set,t=[];return{out:t,add:i=>i?.forEach(i=>{i&&!e.has(i)&&(e.add(i),t.push(i))})}},Ku=(e,t)=>{if(!e)return[];const i=Gu.find(e=>e.id===t)?.featureKeys??[],{out:n,add:a}=Wu();return a(e.auth?.permissions),e.features?.forEach(e=>{e.enabled&&i.includes(e.key)&&(a(e.permissions),e.types?.forEach(e=>{!1!==e.implemented&&a(e.permissions)}))}),n},Yu=(e,t)=>{if(!e)return[];const i=ju(e),n=Hu(e,nt.Discovery),a=i.some(e=>t[e.typeName]?.discovery),{out:o,add:l}=Wu();return l(e.auth?.permissions),a&&l(n?.permissions),i.forEach(e=>{const i=t[e.typeName];i?.discovery&&l(e.discoveryPermissions),i?.instrumentation&&l(e.instrumentationPermissions)}),o},qu=(e,t,i)=>{const n=t===Vu.Custom?Yu(e,i??{}):Ku(e,t),a=Mu(e,"permissions","policy-preview");return a?Uu(a,{permissions:n}):""},Ju=f.div`
|
|
216
216
|
width: 100%;
|
|
217
217
|
padding: 12px 16px;
|
|
218
218
|
border-radius: 12px;
|
|
@@ -234,7 +234,7 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
234
234
|
justify-content: flex-start;
|
|
235
235
|
`,ih=f(Qu)`
|
|
236
236
|
gap: 4px;
|
|
237
|
-
`,nh={discovery:!1,instrumentation:!1},ah=({provider:i,capabilities:a,onCapabilitiesChange:o})=>{const l=v(),r=ju(i),s=(e,t)=>{o({...a,[e]:t})};return r.length?t(
|
|
237
|
+
`,nh={discovery:!1,instrumentation:!1},ah=({provider:i,capabilities:a,onCapabilitiesChange:o})=>{const l=v(),r=ju(i),s=(e,t)=>{o({...a,[e]:t})};return r.length?t(Ju,{children:e(Zu,{children:[t(Qu,{children:t(w,{size:C.XXS,color:k.Secondary,children:ke.CLOUD_CONNECTOR_CUSTOM_COL_TYPE})}),t(eh,{children:t(w,{size:C.XXS,color:k.Secondary,children:ke.CLOUD_CONNECTOR_CUSTOM_COL_DISCOVERY})}),e(ih,{children:[t(w,{size:C.XXS,color:k.Secondary,children:ke.CLOUD_CONNECTOR_CUSTOM_COL_INSTRUMENTATION}),t(ce,{text:ke.CLOUD_CONNECTOR_CUSTOM_COL_INSTRUMENTATION_TOOLTIP,withIcon:!0})]}),r.map(i=>{const o=a[i.typeName]??nh,r=void 0!==i.instrumentationPermissions,c=o.instrumentation||o.discovery;return e(n.Fragment,{children:[t(Qu,{children:t(w,{size:C.XXS,weight:400,lineHeight:"normal",color:k.Primary,children:i.displayName})}),t(eh,{children:t(L,{name:`cloud-connector-custom-${i.typeName}-discovery`,size:Je.S,value:c,disabled:o.instrumentation,onChange:e=>s(i.typeName,{discovery:e,instrumentation:o.instrumentation})})}),t(th,{children:t(L,{name:`cloud-connector-custom-${i.typeName}-instrumentation`,size:Je.S,value:o.instrumentation,disabled:!r,label:o.instrumentation?ke.CLOUD_CONNECTOR_INSTRUMENTATION_MANAGED_BY_ODIGOS:ke.CLOUD_CONNECTOR_INSTRUMENTATION_SELF_MANAGED,labelColor:o.instrumentation?l.v2.colors.purple[400]:l.v2.colors.silver[200],onChange:e=>s(i.typeName,{discovery:!!e||o.discovery,instrumentation:e})})})]},i.typeName)})]})}):null},oh=f.div`
|
|
238
238
|
display: flex;
|
|
239
239
|
flex-direction: column;
|
|
240
240
|
gap: 8px;
|
|
@@ -265,7 +265,7 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
265
265
|
border-radius: 6px;
|
|
266
266
|
flex-shrink: 0;
|
|
267
267
|
background-color: ${({theme:e})=>e.v2.colors.purple[800]};
|
|
268
|
-
`,ch=({message:i})=>{const n=v();return e(rh,{children:[t(sh,{children:t(Us,{fill:"#B08BFD",size:24})}),t(w,{size:C.XXS,color:n.v2.colors.purple[300],children:i})]})},dh=({provider:i,selectedPermission:n,onSelect:a,capabilities:o,onCapabilitiesChange:l})=>t(oh,{children:Gu.map(r=>{const s=r.id===n,c=r.id===Vu.Custom,d=s?e(lh,{children:[c&&t(ah,{provider:i,capabilities:o,onCapabilitiesChange:l}),t(zu,{policy:
|
|
268
|
+
`,ch=({message:i})=>{const n=v();return e(rh,{children:[t(sh,{children:t(Us,{fill:"#B08BFD",size:24})}),t(w,{size:C.XXS,color:n.v2.colors.purple[300],children:i})]})},dh=({provider:i,selectedPermission:n,onSelect:a,capabilities:o,onCapabilitiesChange:l})=>t(oh,{children:Gu.map(r=>{const s=r.id===n,c=r.id===Vu.Custom,d=s?e(lh,{children:[c&&t(ah,{provider:i,capabilities:o,onCapabilitiesChange:l}),t(zu,{policy:qu(i,r.id,o)})]}):void 0,p=s?t(ch,{message:c?ke.CLOUD_CONNECTOR_POLICY_NOTE_CUSTOM:ke.CLOUD_CONNECTOR_POLICY_NOTE}):void 0;return t(ot,{"data-id":`cloud-connector-permission-${r.id}`,title:r.title,description:r.description,checked:s,onChange:()=>a(r.id),body:d,footerNote:p},r.id)})}),ph=f.div`
|
|
269
269
|
display: flex;
|
|
270
270
|
flex-direction: column;
|
|
271
271
|
padding: 16px;
|
|
@@ -288,7 +288,7 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
288
288
|
display: flex;
|
|
289
289
|
flex: 0 0 40%;
|
|
290
290
|
min-width: 0;
|
|
291
|
-
`,bh=()=>{const{providers:i,genericForm:n}=Yc(),[r,s]=l(!0),c=a(()=>i.find(e=>e.provider===n.formData.provider),[i,n.formData.provider]),p=d(e=>{e!==n.formData.provider&&n.handleFormChange(void 0,void 0,{...n.formData,provider:e,authMethod:"",setupMethod:"",accountId:"",credentials:{},customCapabilities:{}})},[n]);return o(()=>{!n.formData.provider&&i.length>0&&p(i[0].provider)},[i,n.formData.provider,p]),o(()=>{n.formData.permission||n.handleFormChange("permission",Vu.DiscoveryInstrumentation)},[n.formData.permission,n]),t(ph,{children:e(uh,{children:[e(hh,{children:[t(w,{size:C.S,weight:500,lineHeight:"24px",color:k.Primary,children:ke.CLOUD_CONNECTOR_SELECT_PROVIDER_TITLE}),t(w,{size:C.XXS,weight:400,lineHeight:"normal",color:k.Secondary,children:ke.CLOUD_CONNECTOR_SELECT_PROVIDER_SUBTITLE})]}),r&&t(te,{fullWidth:!0,maxWidth:"800px",smallIcon:!0,status:ie.Info,message:ke.CLOUD_CONNECTOR_PERMISSIONS_NOTE,action:{"data-id":"cloud-connector-permissions-note-close",label:lt.CLOSE,onClick:()=>s(!1)}}),e(gh,{children:[t(mh,{children:t(
|
|
291
|
+
`,bh=()=>{const{providers:i,genericForm:n}=Yc(),[r,s]=l(!0),c=a(()=>i.find(e=>e.provider===n.formData.provider),[i,n.formData.provider]),p=d(e=>{e!==n.formData.provider&&n.handleFormChange(void 0,void 0,{...n.formData,provider:e,authMethod:"",setupMethod:"",accountId:"",credentials:{},customCapabilities:{}})},[n]);return o(()=>{!n.formData.provider&&i.length>0&&p(i[0].provider)},[i,n.formData.provider,p]),o(()=>{n.formData.permission||n.handleFormChange("permission",Vu.DiscoveryInstrumentation)},[n.formData.permission,n]),t(ph,{children:e(uh,{children:[e(hh,{children:[t(w,{size:C.S,weight:500,lineHeight:"24px",color:k.Primary,children:ke.CLOUD_CONNECTOR_SELECT_PROVIDER_TITLE}),t(w,{size:C.XXS,weight:400,lineHeight:"normal",color:k.Secondary,children:ke.CLOUD_CONNECTOR_SELECT_PROVIDER_SUBTITLE})]}),r&&t(te,{fullWidth:!0,maxWidth:"800px",smallIcon:!0,status:ie.Info,message:ke.CLOUD_CONNECTOR_PERMISSIONS_NOTE,action:{"data-id":"cloud-connector-permissions-note-close",label:lt.CLOSE,onClick:()=>s(!1)}}),e(gh,{children:[t(mh,{children:t(Nu,{providers:i,selectedProvider:n.formData.provider,onSelect:p})}),t(dh,{provider:c,selectedPermission:n.formData.permission,onSelect:e=>n.handleFormChange("permission",e),capabilities:n.formData.customCapabilities,onCapabilitiesChange:e=>n.handleFormChange("customCapabilities",e)})]})]})})},fh=f.div`
|
|
292
292
|
display: flex;
|
|
293
293
|
flex-direction: column;
|
|
294
294
|
gap: 16px;
|
|
@@ -353,7 +353,7 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
353
353
|
height: 24px;
|
|
354
354
|
border-radius: 16px;
|
|
355
355
|
background-color: ${({theme:e})=>e.v2.colors.purple[700]};
|
|
356
|
-
`,
|
|
356
|
+
`,Nh=f.div`
|
|
357
357
|
display: flex;
|
|
358
358
|
flex: 3 1 0;
|
|
359
359
|
flex-direction: column;
|
|
@@ -362,7 +362,7 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
362
362
|
border-radius: 12px;
|
|
363
363
|
background-color: ${({theme:e})=>e.v2.colors.silver[1e3]};
|
|
364
364
|
border: 1px solid ${({theme:e})=>e.v2.colors.silver[700]};
|
|
365
|
-
`,
|
|
365
|
+
`,Ah=f.div`
|
|
366
366
|
display: flex;
|
|
367
367
|
align-items: center;
|
|
368
368
|
justify-content: flex-end;
|
|
@@ -381,7 +381,7 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
381
381
|
line-height: 20px;
|
|
382
382
|
color: ${({theme:e})=>e.v2.colors.green[400]};
|
|
383
383
|
white-space: pre;
|
|
384
|
-
`,Dh=({step:i,artifact:n,code:a})=>{const o=v(),{CopyButton:l}=at(),r=n.steps??[];return t(wh,{"data-id":"cloud-connector-create-role",step:i,title:n.title||ke.CLOUD_CONNECTOR_CREATE_ROLE_TITLE,description:n.description,children:e(Ch,{children:[r.length>0&&e(kh,{children:[t(w,{size:C.XXS,weight:400,lineHeight:"20px",color:k.Primary,children:ke.CLOUD_CONNECTOR_CREATE_ROLE_STEPS_HEADING}),t(Th,{children:r.map((i,a)=>e(Ih,{children:[t($h,{children:t(w,{size:C.XXS,weight:400,lineHeight:"20px",color:o.v2.colors.purple[200],children:a+1})}),t(w,{size:C.XXS,weight:400,lineHeight:"20px",color:k.Primary,children:i})]},`${n.id}-step-${a}`))})]}),a&&e(
|
|
384
|
+
`,Dh=({step:i,artifact:n,code:a})=>{const o=v(),{CopyButton:l}=at(),r=n.steps??[];return t(wh,{"data-id":"cloud-connector-create-role",step:i,title:n.title||ke.CLOUD_CONNECTOR_CREATE_ROLE_TITLE,description:n.description,children:e(Ch,{children:[r.length>0&&e(kh,{children:[t(w,{size:C.XXS,weight:400,lineHeight:"20px",color:k.Primary,children:ke.CLOUD_CONNECTOR_CREATE_ROLE_STEPS_HEADING}),t(Th,{children:r.map((i,a)=>e(Ih,{children:[t($h,{children:t(w,{size:C.XXS,weight:400,lineHeight:"20px",color:o.v2.colors.purple[200],children:a+1})}),t(w,{size:C.XXS,weight:400,lineHeight:"20px",color:k.Primary,children:i})]},`${n.id}-step-${a}`))})]}),a&&e(Nh,{children:[t(Ah,{children:t(l,{value:a})}),t(Oh,{children:t(Eh,{children:a})})]})]})})},Rh=f.div`
|
|
385
385
|
display: flex;
|
|
386
386
|
flex-direction: column;
|
|
387
387
|
padding: 16px;
|
|
@@ -392,12 +392,12 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
392
392
|
padding: 16px 16px 12px;
|
|
393
393
|
border-radius: 16px;
|
|
394
394
|
background-color: ${({theme:e})=>e.v2.colors.silver[1e3]};
|
|
395
|
-
`,
|
|
395
|
+
`,Xh=f.div`
|
|
396
396
|
display: flex;
|
|
397
397
|
align-items: center;
|
|
398
398
|
gap: 8px;
|
|
399
399
|
width: 100%;
|
|
400
|
-
`,
|
|
400
|
+
`,Ph=f.button`
|
|
401
401
|
display: flex;
|
|
402
402
|
align-items: center;
|
|
403
403
|
justify-content: center;
|
|
@@ -414,7 +414,7 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
414
414
|
&:hover {
|
|
415
415
|
background-color: ${({theme:e})=>e.v2.colors.silver[900]};
|
|
416
416
|
}
|
|
417
|
-
`,
|
|
417
|
+
`,Lh=f.div`
|
|
418
418
|
display: flex;
|
|
419
419
|
flex: 1;
|
|
420
420
|
flex-direction: column;
|
|
@@ -439,7 +439,7 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
439
439
|
display: flex;
|
|
440
440
|
flex: 1 1 calc(50% - 12px);
|
|
441
441
|
min-width: 0;
|
|
442
|
-
`,Uh=({field:e,value:i,onChange:n})=>{const a=`cloud-connector-credential-${e.name}`,o=e.displayName||e.name,l={name:a,label:o,required:e.required,tooltip:e.tooltip||void 0,helpMessage:e.tooltip||void 0,placeholder:o,value:i};return"textarea"===e.componentType||"credentialsJson"===e.name?t(ee,{...l,minHeight:"120px",onChange:e=>n(e.target.value)}):t(Y,{...l,width:"100%",type:e.secret?st.Password:st.Text,onChange:e=>n(e.target.value)})},Vh=({onBack:i})=>{const n=v(),{providers:l,genericForm:r}=Yc(),{provider:s,authMethod:c,setupMethod:d,accountId:p,credentials:u,permission:h,customCapabilities:g}=r.formData,m=a(()=>l.find(e=>e.provider===s),[l,s]),b=m?.connectorFields?.[0],f=a(()=>(e=>{const t=e?.auth?.defaultMethod?.trim();return t&&e?.auth?.methods?.some(e=>e.id===t)?t:e?.auth?.methods?.find(e=>e.fields?.some(e=>e.required))?.id??e?.auth?.methods?.[0]?.id??""})(m),[m]),y=a(()=>m?.auth?.methods?.find(e=>e.id===c),[m,c]),S=a(()=>((e,t)=>{const i=e?.auth?.methods?.find(e=>e.id===t);if(!i)return[];const n=new Map(e?.auth?.methods?.map(e=>[e.id,e])),a=new Set,o=[],l=e=>e?.forEach(e=>{e.name&&!a.has(e.name)&&(a.add(e.name),o.push(e))});return i.baseMethods?.forEach(e=>l(n.get(e)?.fields)),l(i.fields),o})(m,c),[m,c]),x=a(()=>Fu(m,
|
|
442
|
+
`,Uh=({field:e,value:i,onChange:n})=>{const a=`cloud-connector-credential-${e.name}`,o=e.displayName||e.name,l={name:a,label:o,required:e.required,tooltip:e.tooltip||void 0,helpMessage:e.tooltip||void 0,placeholder:o,value:i};return"textarea"===e.componentType||"credentialsJson"===e.name?t(ee,{...l,minHeight:"120px",onChange:e=>n(e.target.value)}):t(Y,{...l,width:"100%",type:e.secret?st.Password:st.Text,onChange:e=>n(e.target.value)})},Vh=({onBack:i})=>{const n=v(),{providers:l,genericForm:r}=Yc(),{provider:s,authMethod:c,setupMethod:d,accountId:p,credentials:u,permission:h,customCapabilities:g}=r.formData,m=a(()=>l.find(e=>e.provider===s),[l,s]),b=m?.connectorFields?.[0],f=a(()=>(e=>{const t=e?.auth?.defaultMethod?.trim();return t&&e?.auth?.methods?.some(e=>e.id===t)?t:e?.auth?.methods?.find(e=>e.fields?.some(e=>e.required))?.id??e?.auth?.methods?.[0]?.id??""})(m),[m]),y=a(()=>m?.auth?.methods?.find(e=>e.id===c),[m,c]),S=a(()=>((e,t)=>{const i=e?.auth?.methods?.find(e=>e.id===t);if(!i)return[];const n=new Map(e?.auth?.methods?.map(e=>[e.id,e])),a=new Set,o=[],l=e=>e?.forEach(e=>{e.name&&!a.has(e.name)&&(a.add(e.name),o.push(e))});return i.baseMethods?.forEach(e=>l(n.get(e)?.fields)),l(i.fields),o})(m,c),[m,c]),x=a(()=>Fu(m,Lu),[m]),T=x.length>0,I=a(()=>{if(T)return Bu(m,Lu,d)??(e=>{const t=Fu(e,Lu);return t[0]?Bu(e,Lu,t[0].id):void 0})(m)},[m,d,T]),$=a(()=>Mu(m,"credentials"),[m]),N=a(()=>{const e=h;return e===Vu.Custom?Yu(m,g??{}):Ku(m,e)},[m,h,g]),A=a(()=>I?Uu(I,{permissions:N,vars:{accountId:p??"",externalId:u.externalId?.trim()||"odigos-connector",projectId:p??"",subscriptionId:p??"",...u}}):"",[I,N,p,u]);o(()=>{if(!m)return;const e=m.auth?.methods?.some(e=>e.id===c);e||r.handleFormChange("authMethod",f)},[m,c,f,r]),o(()=>{T&&(x.some(e=>e.id===d)||r.handleFormChange("setupMethod",x[0].id))},[T,x,d,r]);let O=1;const E=b?O++:0,D=O++,R=T?O++:0,z=T?O++:0,X=O,P=m?.setup?.subtitle||(m?.displayName?`Configure the ${m.displayName} account and authentication details.`:"Configure the account and authentication details."),L=b?`Enter ${b.displayName||b.name}`:"Enter account details",M=b?.tooltip||"Enter the provider account identifier that contains the resources Odigos should discover.",_=$?.title||"Enter credentials",B=$?.description||y?.description||"Enter the credentials required by the selected authentication method.";return t(Rh,{children:e(zh,{children:[e(Xh,{children:[t(Ph,{"data-id":"cloud-connector-setup-back",type:"button",onClick:i,"aria-label":ke.CLOUD_CONNECTOR_SETUP_CREDENTIALS_TITLE,children:t(Vs,{size:24})}),e(Lh,{children:[t(w,{size:C.S,weight:500,lineHeight:"24px",color:k.Primary,children:ke.CLOUD_CONNECTOR_SETUP_CREDENTIALS_TITLE}),t(w,{size:C.XXS,weight:400,lineHeight:"normal",color:k.Secondary,children:P})]})]}),b&&t(wh,{"data-id":"cloud-connector-account",step:E,title:L,description:M,children:t(Y,{name:`cloud-connector-account-${b.name}`,width:"100%",label:b.displayName||b.name,required:b.required,tooltip:b.tooltip||void 0,helpMessage:b.tooltip||void 0,placeholder:b.displayName||b.name,value:p,onChange:e=>r.handleFormChange("accountId",e.target.value)})}),e(wh,{"data-id":"cloud-connector-auth-method",step:D,title:ke.CLOUD_CONNECTOR_AUTH_TITLE,description:"Choose how the connector authenticates with this provider.",children:[t(F,{"data-id":"cloud-connector-auth-method-segment",size:rt.S,selected:c,setSelected:e=>{r.handleFormChange(void 0,void 0,{...r.formData,authMethod:e,credentials:{}})},options:(m?.auth?.methods??[]).map(e=>({value:e.id,label:e.displayName}))}),y?.description&&e(Mh,{children:[t(Gs,{size:16,fill:n.v2.colors.silver[200]}),t(w,{size:C.XXXS,weight:400,lineHeight:"normal",color:k.Secondary,children:y.description})]})]}),T&&t(wh,{"data-id":"cloud-connector-setup-method",step:R,title:ke.CLOUD_CONNECTOR_SETUP_METHOD_TITLE,description:ke.CLOUD_CONNECTOR_SETUP_METHOD_SUBTITLE,children:t(F,{"data-id":"cloud-connector-setup-method-segment",size:rt.S,selected:d,setSelected:e=>r.handleFormChange("setupMethod",e),options:x.map(e=>({value:e.id,label:e.label}))})}),T&&I&&t(Dh,{step:z,artifact:I,code:A}),t(wh,{"data-id":"cloud-connector-credentials",step:X,title:_,description:B,children:S.length>0?t(_h,{children:t(Fh,{children:S.map(e=>{const i="textarea"===e.componentType||"credentialsJson"===e.name;return t(Bh,{style:i?{flex:"1 1 100%"}:void 0,children:t(Uh,{field:e,value:u[e.name]??"",onChange:t=>((e,t)=>{r.handleFormChange("credentials",{...u,[e]:t})})(e.name,t)})},e.name)})})}):t(w,{size:C.XXXS,weight:400,lineHeight:"normal",color:k.Secondary,children:"No stored credentials are required for this authentication method."})})]})})},Gh=f.div`
|
|
443
443
|
display: flex;
|
|
444
444
|
flex-direction: column;
|
|
445
445
|
flex: 1;
|
|
@@ -459,7 +459,7 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
459
459
|
align-items: center;
|
|
460
460
|
justify-content: center;
|
|
461
461
|
width: 100%;
|
|
462
|
-
`,
|
|
462
|
+
`,Wh=f.div`
|
|
463
463
|
display: flex;
|
|
464
464
|
flex-direction: column;
|
|
465
465
|
align-items: center;
|
|
@@ -469,7 +469,7 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
469
469
|
padding: 24px 8px;
|
|
470
470
|
border-radius: 8px;
|
|
471
471
|
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
472
|
-
`,
|
|
472
|
+
`,Kh=f.div`
|
|
473
473
|
display: flex;
|
|
474
474
|
flex-direction: column;
|
|
475
475
|
align-items: center;
|
|
@@ -487,7 +487,7 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
487
487
|
height: 39px;
|
|
488
488
|
border-radius: 20px;
|
|
489
489
|
background-color: ${({theme:e})=>e.v2.colors.red[500]};
|
|
490
|
-
`,
|
|
490
|
+
`,qh=f.div`
|
|
491
491
|
display: flex;
|
|
492
492
|
align-items: flex-start;
|
|
493
493
|
gap: 8px;
|
|
@@ -497,7 +497,7 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
497
497
|
padding: 12px;
|
|
498
498
|
border-radius: 8px;
|
|
499
499
|
background-color: ${({theme:e})=>e.v2.colors.silver[1e3]};
|
|
500
|
-
`,
|
|
500
|
+
`,Jh=f.pre`
|
|
501
501
|
flex: 1;
|
|
502
502
|
min-width: 0;
|
|
503
503
|
margin: 0;
|
|
@@ -533,7 +533,7 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
533
533
|
border-radius: 12px;
|
|
534
534
|
border: 1px solid ${({theme:e,$passed:t})=>t?e.v2.colors.silver[700]:e.v2.colors.red[800]};
|
|
535
535
|
background-color: ${({theme:e})=>e.v2.colors.silver[900]};
|
|
536
|
-
`,ng=({isTesting:i,error:n,result:o})=>{const l=v(),{CopyButton:r}=at(),s=a(()=>o?.checks.filter(e=>!e.passed)??[],[o]),c=!(i||!n&&(!o||o.success)),d=n?ke.CLOUD_CONNECTOR_CONNECTION_FAILED_DEFAULT:s[0]?.remediation||s[0]?.message||ke.CLOUD_CONNECTOR_CONNECTION_FAILED_DEFAULT,p=n||s.map(e=>e.message).filter(Boolean).join("\n");return t(Gh,{children:t(Hh,{children:i?t(jh,{children:t(Kh,{children:t(Ve,{withVisual:!0,withGradient:!0,title:ke.CLOUD_CONNECTOR_TESTING_TITLE,titleSize:C.XS})})}):c?t(jh,{children:e(Wh,{children:[t(Yh,{children:t(Rs,{size:20,fill:l.v2.colors.black[500]})}),t(w,{size:C.XS,weight:400,lineHeight:"20px",color:k.Primary,children:ke.CLOUD_CONNECTOR_CONNECTION_FAILED_TITLE}),t(w,{align:"center",size:C.XXXS,weight:400,lineHeight:"normal",color:k.Secondary,children:d}),p&&e(Jh,{children:[t(qh,{children:p}),t(r,{value:p})]})]})}):o?e(Zh,{children:[t(E,{status:ie.Success,label:ke.CLOUD_CONNECTOR_VALIDATE_SUCCESS,leftIcon:Ds,fullWidth:!0}),(o.accountId||o.identity)&&e(Qh,{children:[o.accountId&&e(eg,{children:[e(w,{size:C.XXS,weight:500,color:k.Secondary,children:[ke.CLOUD_CONNECTOR_VALIDATE_ACCOUNT,":"]}),t(w,{size:C.XXS,weight:400,color:k.Primary,children:o.accountId})]}),o.identity&&e(eg,{children:[e(w,{size:C.XXS,weight:500,color:k.Secondary,children:[ke.CLOUD_CONNECTOR_VALIDATE_IDENTITY,":"]}),t(w,{size:C.XXS,weight:400,color:k.Primary,children:o.identity})]})]}),o.checks.length>0&&t(tg,{children:o.checks.map(i=>e(ig,{$passed:i.passed,children:[t(E,{status:i.passed?ie.Success:ie.Error,label:i.displayName,leftIcon:i.passed?Ds:Rs}),i.message&&t(w,{size:C.XXS,weight:400,lineHeight:"normal",color:k.Secondary,children:i.message}),!i.passed&&i.remediation&&t(w,{size:C.XXS,weight:400,lineHeight:"normal",color:k.Primary,children:i.remediation})]},i.name))})]}):t(jh,{children:t(w,{size:C.XXS,weight:400,color:k.Secondary,children:ke.CLOUD_CONNECTOR_VALIDATE_EMPTY})})})})};var ag;(e=>{e[e.SelectProvider=1]="SelectProvider",e[e.Config=2]="Config",e[e.Validate=3]="Validate"})(ag||(ag={}));const og=ag.SelectProvider,lg=ag.Validate,rg=({onClose:i,withOverlay:n,onCreateCloudConnector:o,onCreated:r})=>{const{providers:s,genericForm:c}=Yc(),[p,u]=l(og),[h,g]=l(!1),[m,b]=l(!1),[f,v]=l(void 0),[y,S]=l(void 0),[x,w]=l(void 0),C=c.isFormDirty,k=p===og,T=p===lg,I=d(()=>{C&&!h?g(!0):(g(!1),i?.())},[C,h,i]),$=d(()=>{w(void 0),S(void 0),v(void 0),u(e=>e>og?e-1:e)},[]),A=d(()=>{if(w(void 0),p===ag.SelectProvider){if(!c.formData.provider)return void w("Please select a cloud provider");if(!c.formData.permission)return void w("Please select a permission level")}u(e=>e<lg?e+1:e)},[p,c.formData.provider,c.formData.permission]),N=d(async()=>{if(w(void 0),S(void 0),v(void 0),!o)return;const{provider:e,permission:t,customCapabilities:i,accountId:n,authMethod:a,credentials:l,name:d}=c.formData,p=s.find(t=>t.provider===e),h=p?.connectorFields?.[0];if(h?.required&&!n.trim())return void w(`Please enter ${h.displayName||h.name}`);if(!a)return void w("Please select an authentication method");const g=((e,t,i)=>{const n=e?.auth?.methods?.find(e=>e.id===t);if(!n)return;const a=e=>!!i[e]?.trim(),o=e=>e?.find(e=>e.required&&!a(e.name)),l=o(n.fields);if(l)return l;if(!n.baseMethods?.length)return;const r=new Map(e?.auth?.methods?.map(e=>[e.id,e])),s=n.baseMethods.some(e=>{const t=r.get(e);return!(!t||t.fields&&0!==t.fields.length)});for(const e of n.baseMethods){const t=r.get(e);if(t?.fields?.length&&(t.fields.some(e=>a(e.name))||!s)){const e=o(t.fields);if(e)return e}}})(p,a,l);if(g)return void w(`Please enter ${g.displayName||g.name}`);const m=((e,t,i)=>{const n=ju(e),a=[];return n.forEach(e=>{const n=void 0!==e.instrumentationPermissions;let o=!1,l=!1;switch(t){case Vu.DiscoveryOnly:o=!0;break;case Vu.DiscoveryInstrumentation:o=!0,l=n;break;case Vu.Custom:{const t=i[e.typeName];o=!!t?.discovery,l=!!t?.instrumentation;break}}(o||l)&&a.push({type:e.typeName,discovery:o,instrumentation:l,computePlatforms:!1})}),a})(p,t,i);u(ag.Validate),b(!0);try{const t=await o({provider:e,displayName:d,credentials:l,expectedAccountId:n.trim(),capabilities:m});if(t.created)return void r?.(t.connectorId);v(t.test)}catch(e){S(e instanceof Error?e.message:"Failed to create connector")}finally{b(!1)}},[o,r,c.formData,s]),O=m,E=T&&!m&&(!!y||!!f&&!f.success),D=a(()=>x?{status:ie.Error,message:x}:void 0,[x]),R=a(()=>k?{"data-id":"cloud-connector-cancel",label:lt.CANCEL,variant:W.Secondary,onClick:I,disabled:O}:{"data-id":"cloud-connector-back",label:lt.BACK,variant:W.Text,leftIcon:Vs,onClick:$,disabled:O},[k,I,$,O]),z=a(()=>{if(T){if(m)return;return E?{"data-id":"cloud-connector-retry",label:lt.RETRY,variant:W.Primary,rightIcon:Hs,onClick:N}:void 0}return p===ag.Config?{"data-id":"cloud-connector-verify",label:lt.VERIFY_AND_CREATE_CONNECTOR,variant:W.Primary,onClick:N,disabled:O}:{"data-id":"cloud-connector-next",label:lt.NEXT,variant:W.Primary,onClick:A,disabled:O}},[T,m,E,p,N,A,O]),L=a(()=>[R,z].filter(Boolean),[R,z]);return e(ct,{width:xd,isOpen:!0,hideOverlay:!O&&!n,header:{icon:Fs,title:ke.CREATE_CLOUD_CONNECTOR,onClose:i?I:void 0,onCloseDisabled:O},footer:{note:D,actions:L},children:[p===ag.SelectProvider&&t(bh,{}),p===ag.Config&&t(Vh,{onBack:$}),p===ag.Validate&&t(ng,{isTesting:m,error:y,result:f}),t(wd,{isOpen:h,onClose:()=>g(!1),onApprove:()=>i?.()})]})},sg=({statuses:e})=>{const i=a(()=>dt(e).map(({status:e,type:t,reason:i,message:n})=>({status:e,title:pt(i||t),subTitle:n??void 0})),[e]);return i.length?t($,{$gap:12,children:i.map(e=>t(ut,{invertColors:!0,slim:!0,width:"100%",...e},e.title))}):null},cg=(e,t)=>{const i=[{id:"type",title:ke.TYPE,label:t.label},{id:"status",title:ke.STATUS,badge:{status:e.disabled?ie.Unknown:ie.Success,label:e.disabled?ke.DISABLED:ke.ENABLED}}],n=e.signals?.map(e=>{let t=e.toLowerCase();return t=`${t.charAt(0).toUpperCase()}${t.slice(1)}`,t}).join(", ");return n&&i.push({id:"signals",title:ke.SIGNALS_FOR_PROCESSING,label:n}),e.name&&i.push({id:"name",title:ke.NAME,label:e.name}),e.notes&&i.push({id:"notes",title:ke.NOTES,label:e.notes}),i},dg=e=>e.map(e=>"cells"===e.kind?t(mt,{bgTint:"800",cellsPerRow:2,items:e.items},e.id):"list"===e.kind||"pairs"===e.kind?t(mt,{bgTint:"800",richTitle:{title:e.title},cellsPerRow:2,items:e.items},e.id):t(mt,{bgTint:"800",richTitle:{title:e.title},cellsPerRow:e.items?.length?2:void 0,items:e.items,children:e.segments?.length?dg(e.segments):null},e.id)),pg=({onClose:n,actionId:r})=>{const s=v(),{isK8s:c,platformType:u,version:h}=Xr(),{actionsApi:g}=Pc(),{items:m,refetch:b}=g.useActions(),{options:f}=g.useActionTypes(),{selectedOption:y,loadAction:S,validateFormData:x,genericForm:w}=Xc(),C=p(b);C.current=b,o(()=>{C.current()},[]);const[k,T]=l(!1),[I,N]=l(!1),[O,E]=l(null),R=k&&!!w?.isFormDirty;o(()=>{if(k)return;const e=setInterval(()=>C.current(),3e3);return()=>clearInterval(e)},[k]);const z=a(()=>m?.find(e=>bt(e)===r),[r,m]),L=a(()=>f.find(({type:e})=>e===z?.type)??Xe(u,h).find(({type:e})=>e===z?.type)??ft.find(({type:e})=>e===z?.type)??null,[f,z?.type,u,h]),X=z?.statuses&&Array.isArray(z.statuses)?z.statuses:null;o(()=>{z&&S(z,L)},[z,L]);const P=d(()=>{z&&T(!0)},[z]),M=d(()=>{z&&(S(z,L),T(!1))},[z,L,S]),_=d(()=>{R?E("close"):n()},[R,n]),F=d(()=>{R?E("cancel"):M()},[R,M]),B=d(()=>{const e=O;E(null),"close"===e?(M(),n()):M()},[O,M,n]),U=d(async()=>{if(z){const{errorMessage:e,preparedFormData:t}=x();e||(await g.update(z.id,t),T(!1))}},[z,x,g]),V=d(()=>{z&&N(!0)},[z]),G=d(async()=>{z&&(await g.remove(z.id,z.type),n())},[z,g,n]);if(!z||!L)return null;const H=(j=z,K=L,K?.fields?.length?ht(j.fields||{},K.fields,{signals:j.signals||[],skipComponentTypes:[gt.SourceScopes]}):[]);var j,K;const Y=L.fields?.find(e=>e.componentType===gt.SourceScopes),J=Y?.name||D.Scopes,q=z.fields?.[J]??null,Z=c&&(!!Y||void 0!==z.fields?.scopes);return e(i,{children:[t(ct,{isOpen:!0,header:{icon:yt(z.type),title:L.label,onClose:_,actions:[{id:"edit-action-btn-edit",label:lt.EDIT,icon:Cs,active:k,onClick:P},{id:"edit-action-btn-delete",label:lt.DELETE,icon:vs,color:s.v2.colors.red[500],active:I,onClick:V}]},footer:{actions:k?[{"data-id":"edit-action-btn-cancel",label:lt.CANCEL,variant:W.Secondary,onClick:F},{"data-id":"edit-action-btn-save",label:lt.SAVE,variant:W.Primary,onClick:U}]:[]},children:t(A,{$padding:"4px 12px 12px",children:k&&y?t(Cp,{}):t($,{$gap:16,children:e(mt,{bgTint:"1000",children:[c&&(X?t(sg,{statuses:X}):t(vt,{conditions:z.conditions||[]})),t(mt,{bgTint:"800",cellsPerRow:2,items:cg(z,L)}),Z&&t(dd,{readOnly:!0,scopes:q}),!!H.length&&t(mt,{bgTint:"900",richTitle:{title:"Configuration"},withCollapse:!0,collapseIsDefaultOpen:!0,children:dg(H)})]})})})}),t(Cd,{target:"action",isOpen:I,onClose:()=>N(!1),onApprove:G}),t(wd,{isOpen:null!==O,onClose:()=>E(null),onApprove:B})]})},ug=({onClose:i,connections:n,selectedConnectionIds:r,setSelectedConnectionIds:s})=>{const{configApi:c}=Pc(),[d,p]=l(""),[u,h]=l({showOnlySelected:!1}),g=a(()=>n.filter(e=>{const t=!d||e.name.toLowerCase().includes(d.toLowerCase()),i=!u.showOnlySelected||u.showOnlySelected&&r.includes(e.id);return t&&i}),[n.length,r.length,d,u]),m=e=>{s(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},b=1===r.length?r[0]:void 0,{data:f,loading:v}=c.useEffectiveConfig({id:b},{skip:!b}),y=a(()=>({rollout:{automaticRolloutDisabled:f?.rollout?.automaticRolloutDisabled??!1}}),[f]),{formData:S,areFormValuesEqual:x,handleFormChange:I,resetFormData:$}=St(y);o(()=>{y&&$(y)},[y]);const A=a(()=>r.length>1||!x(y,S),[r.length,y,S]);return t(Sd,{isOpen:!0,onClose:i,onSave:async()=>await(c.applyConfigurations?.(S,r))??void 0,header:{icon:js,title:"Cluster Configuration"},connectionIds:{value:r,setValue:s},search:{placeholder:"Search by cluster name",value:d,onChange:p},filters:e(T,{$gap:8,children:[t(w,{size:C.XXXS,color:k.Secondary,nowrap:!0,children:"Show only:"}),t(P,{size:qe.S,label:"Selected",value:u.showOnlySelected,onChange:e=>h(t=>({...t,showOnlySelected:e}))})]}),isFormDirty:A,isFetching:v,leftColumn:{width:"35%",header:e(T,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(T,{$gap:8,children:[t(w,{size:C.XS,children:"Clusters"}),t(E,{label:g.length,status:ie.Unknown})]}),e(T,{$gap:8,children:[t(w,{size:C.XXXS,color:k.Secondary,align:"right",children:"Selected clusters"}),t(E,{label:`${r.length}/${g.length}`,status:ie.Unknown})]})]}),list:g.map(e=>t(Qd,{title:e.name,isChecked:r.includes(e.id),onClick:()=>m(e.id),onCheckboxChange:()=>m(e.id)},e.id))},rightColumn:{width:"65%",header:t(w,{size:C.XS,children:"Configurations"}),list:[t(P,{label:"Automatic rollout disabled",tooltip:"Odigos automatically triggers a one-time rollout for workloads when instrumenting or uninstrumenting, ensuring that changes are applied without requiring manual intervention. When automatic rollout is disabled, Odigos will not restart workloads, and users will need to manually trigger rollouts after adding or removing sources.",value:S.rollout?.automaticRolloutDisabled||!1,onChange:e=>I("rollout.automaticRolloutDisabled",e),size:qe.S},"automatic-rollout-disabled")]}})},hg=e=>{const t=[{id:"type",title:ke.TYPE,label:e.destinationType.displayName},{id:"status",title:ke.STATUS,badge:{status:e.disabled?ie.Unknown:ie.Success,label:e.disabled?ke.DISABLED:ke.ENABLED}}],i=oe(e.exportedSignals).map(e=>{let t=e.toLowerCase();return t=`${t.charAt(0).toUpperCase()}${t.slice(1)}`,t}).join(", ");return i&&t.push({id:"monitors",title:ke.MONITORS,label:i}),e.name&&t.push({id:"name",title:ke.NAME,label:e.name}),t},gg=({onClose:n,destinationId:r})=>{const s=v(),{isK8s:c}=Xr(),{destinationsApi:u}=Pc(),{selectedStreamName:h}=Te(),{items:g,refetch:m}=u.useDestinations(),{data:b,loading:f}=u.useDestinationCategories(),{activeForm:y,loadDestination:S,validateFormData:x,genericForm:w}=Mc();o(()=>{m()},[]);const C=p(null),[k,T]=l(!1),[I,N]=l(!1),[O,E]=l(null),D=k&&!!w?.isFormDirty,R=a(()=>Ct(g,h),[g,h]),z=a(()=>R?.find(e=>bt(e)===r),[r,R]),L=b?.destinationCategories?.categories??null;o(()=>{z&&L&&S(z,L)},[z,L]);const X=a(()=>z&&L?kt(L,z):[],[z,L]),P=d(()=>{z&&T(!0)},[z]),M=d(()=>{z&&L&&(S(z,L),T(!1))},[z,L,S]),_=d(()=>{D?E("close"):n()},[D,n]),F=d(()=>{D?E("cancel"):M()},[D,M]),B=d(()=>{const e=O;E(null),"close"===e?(M(),n()):M()},[O,M,n]),U=d(async()=>{if(z){const{errorMessage:e,preparedFormData:t}=x();e||(await u.update(z.id,re(t)),T(!1))}},[z,x,u]),V=d(()=>{z&&N(!0)},[z]),G=d(async()=>{z&&(await u.remove(z.id),n())},[z,u,n]);if(!z)return null;const{icon:H,iconSrc:j}=He(z.destinationType.type),K=((e,t)=>{const i=[],n=xt(e,t),a=n.map(e=>({name:e.key,value:e.value})),o=oe(e.exportedSignals);let l=[];const r=()=>{l.length&&(i.push({kind:"cells",id:`cells-${i.length}`,items:l}),l=[])};return n.forEach(({key:e,name:n,value:s})=>{const c=t.find(t=>t.name===e),{secret:d,componentType:p,componentProperties:u,hideFromReadData:h,customReadDataLabels:g}=c||{};if(h?.length&&wt(h,o,a))return;const{type:m}=Ke(u,{type:""}),b=d||"password"===m;if(g?.length)g.forEach(({condition:t,...i},n)=>{t==s&&l.push({id:`${e}-custom-${n}`,title:i.title,label:i.value})});else if(s)if(b)l.push({id:e,title:n,label:new Array(10).fill("•").join("")});else{if(p===gt.MultiInput){const t=Ke(s,null);if(Array.isArray(t)&&t.length)return r(),void i.push({kind:"list",id:e,title:n,items:t.map((t,i)=>({id:`${e}-${i}`,label:String(t)}))})}if(p===gt.KeyValuePair){const t=Ke(s,null);if(Array.isArray(t)&&t.length)return r(),void i.push({kind:"pairs",id:e,title:n,items:t.map((t,i)=>{const n=t&&"object"==typeof t?t:{};return{id:`${e}-${i}`,title:null!=n.key?String(n.key):"",label:null!=n.value?String(n.value):""}})})}l.push({id:e,title:n,label:s})}else l.push({id:e,title:n,label:"-"})}),r(),i})(z,X);return e(i,{children:[t(ct,{isOpen:!0,header:{icon:H,iconSrc:j,title:z.name||z.destinationType.displayName,onClose:_,actions:[{id:"edit-destination-btn-edit",label:lt.EDIT,icon:Cs,active:k,onClick:P},{id:"edit-destination-btn-delete",label:lt.DELETE,icon:vs,color:s.v2.colors.red[500],active:I,onClick:V}]},footer:{actions:k?[{"data-id":"edit-destination-btn-cancel",label:lt.CANCEL,variant:W.Secondary,onClick:F},...y?.option.testConnectionSupported&&c?[{"data-id":"edit-destination-btn-test-connection",label:lt.TEST_CONNECTION,variant:W.Secondary,onClick:()=>C.current?.testConnection()}]:[],{"data-id":"edit-destination-btn-save",label:lt.SAVE,variant:W.Primary,onClick:U}]:[]},children:t(A,{$padding:"4px 12px 12px",children:f?t(Me,{$height:"50vh",children:t(Ve,{withSpinner:!0})}):k&&y?t(Tp,{ref:C,isEdit:!0}):e($,{$gap:16,children:[c&&t(vt,{conditions:z.conditions||[]}),t(mt,{bgTint:"900",cellsPerRow:2,items:hg(z)}),!!K.length&&t(mt,{bgTint:"900",richTitle:{title:"Configuration"},withCollapse:!0,collapseIsDefaultOpen:!0,children:K.map(e=>"cells"===e.kind?t(mt,{bgTint:"800",cellsPerRow:2,items:e.items},e.id):(e.kind,t(mt,{bgTint:"800",richTitle:{title:e.title},cellsPerRow:2,items:e.items},e.id)))})]})})}),t(Cd,{target:"destination",isOpen:I,onClose:()=>N(!1),onApprove:G}),t(wd,{isOpen:null!==O,onClose:()=>E(null),onApprove:B})]})},mg=(e,t)=>{const i=[{id:"type",title:ke.TYPE,label:t.label},{id:"status",title:ke.STATUS,badge:{status:e.disabled?ie.Unknown:ie.Success,label:e.disabled?ke.DISABLED:ke.ENABLED}}];return e.ruleName&&i.push({id:"name",title:ke.NAME,label:e.ruleName}),e.profileName&&i.push({id:"profile",title:ke.MANAGED_BY_PROFILE,label:e.profileName}),e.notes&&i.push({id:"notes",title:ke.NOTES,label:e.notes}),i},bg=({onClose:n,ruleId:r})=>{const s=v(),{addNotification:c}=Tt(),{isK8s:p,platformType:u,version:h}=Xr(),g=ve(u,h),{instrumentationRulesApi:m}=Pc(),{items:b,refetch:f}=m.useRules(),{selectedOption:y,loadRule:S,validateFormData:x,genericForm:w}=_c();o(()=>{f()},[]);const[C,k]=l(!1),[I,N]=l(!1),[O,E]=l(null),D=C&&!!w?.isFormDirty,{options:R}=m.useRuleTypes(),z=a(()=>R.length?R:We,[R]),L=a(()=>b?.find(e=>bt(e)===r),[r,b]),X=a(()=>z.find(({type:e})=>e===L?.type)??null,[z,L?.type]),P=a(()=>ye(X?.supportedLanguages),[X?.supportedLanguages]);o(()=>{L&&X&&S(L,X)},[L,X]);const M=d(()=>{if(L){if(!L.mutable)return void c({type:ie.Warning,title:be.FORBIDDEN,message:be.CANNOT_EDIT_RULE,crdType:Je.InstrumentationRule,target:L.ruleId,hideFromHistory:!0});k(!0)}},[L,c]),_=d(()=>{L&&X&&(S(L,X),k(!1))},[L,X,S]),F=d(()=>{D?E("close"):n()},[D,n]),B=d(()=>{D?E("cancel"):_()},[D,_]),U=d(()=>{const e=O;E(null),"close"===e?(_(),n()):_()},[O,_,n]),V=d(async()=>{if(L){const{errorMessage:e,preparedFormData:t}=x();e||(await m.update(L.ruleId,t,L.type),k(!1))}},[L,x,m]),G=d(()=>{if(L){if(!L.mutable)return void c({type:ie.Warning,title:be.FORBIDDEN,message:be.CANNOT_DELETE_RULE,crdType:Je.InstrumentationRule,target:L.ruleId,hideFromHistory:!0});N(!0)}},[L,c]),H=d(async()=>{L&&(await m.remove(L.ruleId,L.type),n())},[L,m,n]);if(!L||!X)return null;const j=(K=L,Y=X,Y?.fields?.length?ht(K,Y.fields,{skipComponentTypes:[gt.SourceScopes]}):[]);var K,Y;return e(i,{children:[t(ct,{isOpen:!0,header:{icon:$t(L.type),title:X.label,onClose:F,actions:[{id:"edit-rule-btn-edit",label:lt.EDIT,icon:Cs,active:C,onClick:M},{id:"edit-rule-btn-delete",label:lt.DELETE,icon:vs,color:s.v2.colors.red[500],active:I,onClick:G}]},footer:{actions:C?[{"data-id":"edit-rule-btn-cancel",label:lt.CANCEL,variant:W.Secondary,onClick:B},{"data-id":"edit-rule-btn-save",label:lt.SAVE,variant:W.Primary,onClick:V}]:[]},children:t(A,{$padding:"4px 12px 12px",children:C&&y?t(Rp,{}):t($,{$gap:16,children:e(mt,{bgTint:"1000",children:[p&&!!L.conditions?.length&&t(vt,{conditions:L.conditions}),t(mt,{bgTint:"800",cellsPerRow:2,items:mg(L,X)}),g&&t(dd,{readOnly:!0,scopes:L.sourceScopes??null}),X.type===fe.CustomInstrumentation&&!!L.customInstrumentations?.[me.Php]?.length&&t(te,{status:ie.Warning,message:be.PHP_CUSTOM_INSTRUMENTATION_RESTART,fullWidth:!0}),!!j.length&&t(mt,{bgTint:"900",richTitle:{title:"Collect"},withCollapse:!0,collapseIsDefaultOpen:!0,children:dg(j)}),!!P.length&&t(mt,{bgTint:"900",richTitle:{title:"Supported languages"},withCollapse:!0,collapseIsDefaultOpen:!0,children:t(mt,{bgTint:"800",children:t(T,{$gap:12,$wrap:"wrap",children:P.map(e=>t(It,{label:we(e),leftIcon:xe(e),flex:P.length>1?"0.5":"1"},e))})})})]})})})}),t(Cd,{target:"instrumentation rule",isOpen:I,onClose:()=>N(!1),onApprove:H}),t(wd,{isOpen:null!==O,onClose:()=>E(null),onApprove:U})]})};var fg;(e=>{e.Overview="overview",e.Pods="pods",e.Libraries="libraries",e.PeerSources="peer-sources",e.Profiling="profiling",e.Sampling="sampling",e.Debug="debug"})(fg||(fg={}));const vg=({collapseIsDefaultOpen:e,isJumpToTarget:i,onClickRestartPod:n,namespace:o,podName:l,nodeName:r,startTime:s,agentInjectedStatus:c,odigosHealthStatus:d,k8sHealthStatus:p,children:u})=>{const{formatDurationAgo:h}=At(),{platformType:g,version:m}=Xr(),b=Nt(g,m),f=Ot(!!i),v=a(()=>({title:l,icon:Ks,withCopy:!0}),[l]),y=a(()=>{const e=[],t=Et(c);t&&e.push(t);const i=Et(d,Us,"health");i&&e.push(i);const n=Et(p,Ws,"health");return n&&e.push(n),e},[c,d,p]),S=a(()=>n?[{id:`restart-pod-${l}`,icon:Hs,label:lt.RESTART_POD,onClick:()=>n(o,l)}]:void 0,[n,o,l]),x=a(()=>[{id:"nodeName",title:ke.NODE,label:r,withCopy:!0},{id:"age",title:ke.AGE,label:s?h(s,{style:"short"}):b?ke.NOT_RUNNING:ke.UNKNOWN_VALUE,labelTooltip:s||(b?void 0:ke.START_TIME_UNAVAILABLE)}],[r,s,h,b]);return t("div",{ref:f,children:t(mt,{bgTint:"900",richTitle:v,badges:y,dropDataActions:S,items:x,withCollapse:!0,collapseIsDefaultOpen:e,children:u})})},yg=f.div`
|
|
536
|
+
`,ng=({isTesting:i,error:n,result:o})=>{const l=v(),{CopyButton:r}=at(),s=a(()=>o?.checks.filter(e=>!e.passed)??[],[o]),c=!(i||!n&&(!o||o.success)),d=n?ke.CLOUD_CONNECTOR_CONNECTION_FAILED_DEFAULT:s[0]?.remediation||s[0]?.message||ke.CLOUD_CONNECTOR_CONNECTION_FAILED_DEFAULT,p=n||s.map(e=>e.message).filter(Boolean).join("\n");return t(Gh,{children:t(Hh,{children:i?t(jh,{children:t(Wh,{children:t(Ve,{withVisual:!0,withGradient:!0,title:ke.CLOUD_CONNECTOR_TESTING_TITLE,titleSize:C.XS})})}):c?t(jh,{children:e(Kh,{children:[t(Yh,{children:t(Rs,{size:20,fill:l.v2.colors.black[500]})}),t(w,{size:C.XS,weight:400,lineHeight:"20px",color:k.Primary,children:ke.CLOUD_CONNECTOR_CONNECTION_FAILED_TITLE}),t(w,{align:"center",size:C.XXXS,weight:400,lineHeight:"normal",color:k.Secondary,children:d}),p&&e(qh,{children:[t(Jh,{children:p}),t(r,{value:p})]})]})}):o?e(Zh,{children:[t(E,{status:ie.Success,label:ke.CLOUD_CONNECTOR_VALIDATE_SUCCESS,leftIcon:Ds,fullWidth:!0}),(o.accountId||o.identity)&&e(Qh,{children:[o.accountId&&e(eg,{children:[e(w,{size:C.XXS,weight:500,color:k.Secondary,children:[ke.CLOUD_CONNECTOR_VALIDATE_ACCOUNT,":"]}),t(w,{size:C.XXS,weight:400,color:k.Primary,children:o.accountId})]}),o.identity&&e(eg,{children:[e(w,{size:C.XXS,weight:500,color:k.Secondary,children:[ke.CLOUD_CONNECTOR_VALIDATE_IDENTITY,":"]}),t(w,{size:C.XXS,weight:400,color:k.Primary,children:o.identity})]})]}),o.checks.length>0&&t(tg,{children:o.checks.map(i=>e(ig,{$passed:i.passed,children:[t(E,{status:i.passed?ie.Success:ie.Error,label:i.displayName,leftIcon:i.passed?Ds:Rs}),i.message&&t(w,{size:C.XXS,weight:400,lineHeight:"normal",color:k.Secondary,children:i.message}),!i.passed&&i.remediation&&t(w,{size:C.XXS,weight:400,lineHeight:"normal",color:k.Primary,children:i.remediation})]},i.name))})]}):t(jh,{children:t(w,{size:C.XXS,weight:400,color:k.Secondary,children:ke.CLOUD_CONNECTOR_VALIDATE_EMPTY})})})})};var ag;(e=>{e[e.SelectProvider=1]="SelectProvider",e[e.Config=2]="Config",e[e.Validate=3]="Validate"})(ag||(ag={}));const og=ag.SelectProvider,lg=ag.Validate,rg=({onClose:i,withOverlay:n,onCreateCloudConnector:o,onCreated:r})=>{const{providers:s,genericForm:c}=Yc(),[p,u]=l(og),[h,g]=l(!1),[m,b]=l(!1),[f,v]=l(void 0),[y,S]=l(void 0),[x,w]=l(void 0),C=c.isFormDirty,k=p===og,T=p===lg,I=d(()=>{C&&!h?g(!0):(g(!1),i?.())},[C,h,i]),$=d(()=>{w(void 0),S(void 0),v(void 0),u(e=>e>og?e-1:e)},[]),N=d(()=>{if(w(void 0),p===ag.SelectProvider){if(!c.formData.provider)return void w("Please select a cloud provider");if(!c.formData.permission)return void w("Please select a permission level")}u(e=>e<lg?e+1:e)},[p,c.formData.provider,c.formData.permission]),A=d(async()=>{if(w(void 0),S(void 0),v(void 0),!o)return;const{provider:e,permission:t,customCapabilities:i,accountId:n,authMethod:a,credentials:l,name:d}=c.formData,p=s.find(t=>t.provider===e),h=p?.connectorFields?.[0];if(h?.required&&!n.trim())return void w(`Please enter ${h.displayName||h.name}`);if(!a)return void w("Please select an authentication method");const g=((e,t,i)=>{const n=e?.auth?.methods?.find(e=>e.id===t);if(!n)return;const a=e=>!!i[e]?.trim(),o=e=>e?.find(e=>e.required&&!a(e.name)),l=o(n.fields);if(l)return l;if(!n.baseMethods?.length)return;const r=new Map(e?.auth?.methods?.map(e=>[e.id,e])),s=n.baseMethods.some(e=>{const t=r.get(e);return!(!t||t.fields&&0!==t.fields.length)});for(const e of n.baseMethods){const t=r.get(e);if(t?.fields?.length&&(t.fields.some(e=>a(e.name))||!s)){const e=o(t.fields);if(e)return e}}})(p,a,l);if(g)return void w(`Please enter ${g.displayName||g.name}`);const m=((e,t,i)=>{const n=ju(e),a=[];return n.forEach(e=>{const n=void 0!==e.instrumentationPermissions;let o=!1,l=!1;switch(t){case Vu.DiscoveryOnly:o=!0;break;case Vu.DiscoveryInstrumentation:o=!0,l=n;break;case Vu.Custom:{const t=i[e.typeName];o=!!t?.discovery,l=!!t?.instrumentation;break}}(o||l)&&a.push({type:e.typeName,discovery:o,instrumentation:l,computePlatforms:!1})}),a})(p,t,i);u(ag.Validate),b(!0);try{const t=await o({provider:e,displayName:d,credentials:l,expectedAccountId:n.trim(),capabilities:m});if(t.created)return void r?.(t.connectorId);v(t.test)}catch(e){S(e instanceof Error?e.message:"Failed to create connector")}finally{b(!1)}},[o,r,c.formData,s]),O=m,E=T&&!m&&(!!y||!!f&&!f.success),D=a(()=>x?{status:ie.Error,message:x}:void 0,[x]),R=a(()=>k?{"data-id":"cloud-connector-cancel",label:lt.CANCEL,variant:K.Secondary,onClick:I,disabled:O}:{"data-id":"cloud-connector-back",label:lt.BACK,variant:K.Text,leftIcon:Vs,onClick:$,disabled:O},[k,I,$,O]),z=a(()=>{if(T){if(m)return;return E?{"data-id":"cloud-connector-retry",label:lt.RETRY,variant:K.Primary,rightIcon:Hs,onClick:A}:void 0}return p===ag.Config?{"data-id":"cloud-connector-verify",label:lt.VERIFY_AND_CREATE_CONNECTOR,variant:K.Primary,onClick:A,disabled:O}:{"data-id":"cloud-connector-next",label:lt.NEXT,variant:K.Primary,onClick:N,disabled:O}},[T,m,E,p,A,N,O]),X=a(()=>[R,z].filter(Boolean),[R,z]);return e(ct,{width:xd,isOpen:!0,hideOverlay:!O&&!n,header:{icon:Fs,title:ke.CREATE_CLOUD_CONNECTOR,onClose:i?I:void 0,onCloseDisabled:O},footer:{note:D,actions:X},children:[p===ag.SelectProvider&&t(bh,{}),p===ag.Config&&t(Vh,{onBack:$}),p===ag.Validate&&t(ng,{isTesting:m,error:y,result:f}),t(wd,{isOpen:h,onClose:()=>g(!1),onApprove:()=>i?.()})]})},sg=({statuses:e})=>{const i=a(()=>dt(e).map(({status:e,type:t,reason:i,message:n})=>({status:e,title:pt(i||t),subTitle:n??void 0})),[e]);return i.length?t($,{$gap:12,children:i.map(e=>t(ut,{invertColors:!0,slim:!0,width:"100%",...e},e.title))}):null},cg=(e,t)=>{const i=[{id:"type",title:ke.TYPE,label:t.label},{id:"status",title:ke.STATUS,badge:{status:e.disabled?ie.Unknown:ie.Success,label:e.disabled?ke.DISABLED:ke.ENABLED}}],n=e.signals?.map(e=>{let t=e.toLowerCase();return t=`${t.charAt(0).toUpperCase()}${t.slice(1)}`,t}).join(", ");return n&&i.push({id:"signals",title:ke.SIGNALS_FOR_PROCESSING,label:n}),e.name&&i.push({id:"name",title:ke.NAME,label:e.name}),e.notes&&i.push({id:"notes",title:ke.NOTES,label:e.notes}),i},dg=e=>e.map(e=>"cells"===e.kind?t(mt,{bgTint:"800",cellsPerRow:2,items:e.items},e.id):"list"===e.kind||"pairs"===e.kind?t(mt,{bgTint:"800",richTitle:{title:e.title},cellsPerRow:2,items:e.items},e.id):t(mt,{bgTint:"800",richTitle:{title:e.title},cellsPerRow:e.items?.length?2:void 0,items:e.items,children:e.segments?.length?dg(e.segments):null},e.id)),pg=({onClose:n,actionId:r})=>{const s=v(),{isK8s:c,platformType:u,version:h}=Pr(),{actionsApi:g}=Lc(),{items:m,refetch:b}=g.useActions(),{options:f}=g.useActionTypes(),{selectedOption:y,loadAction:S,validateFormData:x,genericForm:w}=Pc(),C=p(b);C.current=b,o(()=>{C.current()},[]);const[k,T]=l(!1),[I,A]=l(!1),[O,E]=l(null),R=k&&!!w?.isFormDirty;o(()=>{if(k)return;const e=setInterval(()=>C.current(),3e3);return()=>clearInterval(e)},[k]);const z=a(()=>m?.find(e=>bt(e)===r),[r,m]),X=a(()=>f.find(({type:e})=>e===z?.type)??Pe(u,h).find(({type:e})=>e===z?.type)??ft.find(({type:e})=>e===z?.type)??null,[f,z?.type,u,h]),P=z?.statuses&&Array.isArray(z.statuses)?z.statuses:null;o(()=>{z&&S(z,X)},[z,X]);const L=d(()=>{z&&T(!0)},[z]),M=d(()=>{z&&(S(z,X),T(!1))},[z,X,S]),_=d(()=>{R?E("close"):n()},[R,n]),F=d(()=>{R?E("cancel"):M()},[R,M]),B=d(()=>{const e=O;E(null),"close"===e?(M(),n()):M()},[O,M,n]),U=d(async()=>{if(z){const{errorMessage:e,preparedFormData:t}=x();e||(await g.update(z.id,t),T(!1))}},[z,x,g]),V=d(()=>{z&&A(!0)},[z]),G=d(async()=>{z&&(await g.remove(z.id,z.type),n())},[z,g,n]);if(!z||!X)return null;const H=(j=z,W=X,W?.fields?.length?ht(j.fields||{},W.fields,{signals:j.signals||[],skipComponentTypes:[gt.SourceScopes]}):[]);var j,W;const Y=X.fields?.find(e=>e.componentType===gt.SourceScopes),q=Y?.name||D.Scopes,J=z.fields?.[q]??null,Z=c&&(!!Y||void 0!==z.fields?.scopes);return e(i,{children:[t(ct,{isOpen:!0,header:{icon:yt(z.type),title:X.label,onClose:_,actions:[{id:"edit-action-btn-edit",label:lt.EDIT,icon:Cs,active:k,onClick:L},{id:"edit-action-btn-delete",label:lt.DELETE,icon:vs,color:s.v2.colors.red[500],active:I,onClick:V}]},footer:{actions:k?[{"data-id":"edit-action-btn-cancel",label:lt.CANCEL,variant:K.Secondary,onClick:F},{"data-id":"edit-action-btn-save",label:lt.SAVE,variant:K.Primary,onClick:U}]:[]},children:t(N,{$padding:"4px 12px 12px",children:k&&y?t(Cp,{}):t($,{$gap:16,children:e(mt,{bgTint:"1000",children:[c&&(P?t(sg,{statuses:P}):t(vt,{conditions:z.conditions||[]})),t(mt,{bgTint:"800",cellsPerRow:2,items:cg(z,X)}),Z&&t(dd,{readOnly:!0,scopes:J}),!!H.length&&t(mt,{bgTint:"900",richTitle:{title:"Configuration"},withCollapse:!0,collapseIsDefaultOpen:!0,children:dg(H)})]})})})}),t(Cd,{target:"action",isOpen:I,onClose:()=>A(!1),onApprove:G}),t(wd,{isOpen:null!==O,onClose:()=>E(null),onApprove:B})]})},ug=({onClose:i,connections:n,selectedConnectionIds:r,setSelectedConnectionIds:s})=>{const{configApi:c}=Lc(),[d,p]=l(""),[u,h]=l({showOnlySelected:!1}),g=a(()=>n.filter(e=>{const t=!d||e.name.toLowerCase().includes(d.toLowerCase()),i=!u.showOnlySelected||u.showOnlySelected&&r.includes(e.id);return t&&i}),[n.length,r.length,d,u]),m=e=>{s(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},b=1===r.length?r[0]:void 0,{data:f,loading:v}=c.useEffectiveConfig({id:b},{skip:!b}),y=a(()=>({rollout:{automaticRolloutDisabled:f?.rollout?.automaticRolloutDisabled??!1}}),[f]),{formData:S,areFormValuesEqual:x,handleFormChange:I,resetFormData:$}=St(y);o(()=>{y&&$(y)},[y]);const N=a(()=>r.length>1||!x(y,S),[r.length,y,S]);return t(Sd,{isOpen:!0,onClose:i,onSave:async()=>await(c.applyConfigurations?.(S,r))??void 0,header:{icon:js,title:"Cluster Configuration"},connectionIds:{value:r,setValue:s},search:{placeholder:"Search by cluster name",value:d,onChange:p},filters:e(T,{$gap:8,children:[t(w,{size:C.XXXS,color:k.Secondary,nowrap:!0,children:"Show only:"}),t(L,{size:Je.S,label:"Selected",value:u.showOnlySelected,onChange:e=>h(t=>({...t,showOnlySelected:e}))})]}),isFormDirty:N,isFetching:v,leftColumn:{width:"35%",header:e(T,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(T,{$gap:8,children:[t(w,{size:C.XS,children:"Clusters"}),t(E,{label:g.length,status:ie.Unknown})]}),e(T,{$gap:8,children:[t(w,{size:C.XXXS,color:k.Secondary,align:"right",children:"Selected clusters"}),t(E,{label:`${r.length}/${g.length}`,status:ie.Unknown})]})]}),list:g.map(e=>t(Qd,{title:e.name,isChecked:r.includes(e.id),onClick:()=>m(e.id),onCheckboxChange:()=>m(e.id)},e.id))},rightColumn:{width:"65%",header:t(w,{size:C.XS,children:"Configurations"}),list:[t(L,{label:"Automatic rollout disabled",tooltip:"Odigos automatically triggers a one-time rollout for workloads when instrumenting or uninstrumenting, ensuring that changes are applied without requiring manual intervention. When automatic rollout is disabled, Odigos will not restart workloads, and users will need to manually trigger rollouts after adding or removing sources.",value:S.rollout?.automaticRolloutDisabled||!1,onChange:e=>I("rollout.automaticRolloutDisabled",e),size:Je.S},"automatic-rollout-disabled")]}})},hg=e=>{const t=[{id:"type",title:ke.TYPE,label:e.destinationType.displayName},{id:"status",title:ke.STATUS,badge:{status:e.disabled?ie.Unknown:ie.Success,label:e.disabled?ke.DISABLED:ke.ENABLED}}],i=oe(e.exportedSignals).map(e=>{let t=e.toLowerCase();return t=`${t.charAt(0).toUpperCase()}${t.slice(1)}`,t}).join(", ");return i&&t.push({id:"monitors",title:ke.MONITORS,label:i}),e.name&&t.push({id:"name",title:ke.NAME,label:e.name}),t},gg=({onClose:n,destinationId:r})=>{const s=v(),{isK8s:c}=Pr(),{destinationsApi:u}=Lc(),{selectedStreamName:h}=Te(),{items:g,refetch:m}=u.useDestinations(),{data:b,loading:f}=u.useDestinationCategories(),{activeForm:y,loadDestination:S,validateFormData:x,genericForm:w}=Mc();o(()=>{m()},[]);const C=p(null),[k,T]=l(!1),[I,A]=l(!1),[O,E]=l(null),D=k&&!!w?.isFormDirty,R=a(()=>Ct(g,h),[g,h]),z=a(()=>R?.find(e=>bt(e)===r),[r,R]),X=b?.destinationCategories?.categories??null;o(()=>{z&&X&&S(z,X)},[z,X]);const P=a(()=>z&&X?kt(X,z):[],[z,X]),L=d(()=>{z&&T(!0)},[z]),M=d(()=>{z&&X&&(S(z,X),T(!1))},[z,X,S]),_=d(()=>{D?E("close"):n()},[D,n]),F=d(()=>{D?E("cancel"):M()},[D,M]),B=d(()=>{const e=O;E(null),"close"===e?(M(),n()):M()},[O,M,n]),U=d(async()=>{if(z){const{errorMessage:e,preparedFormData:t}=x();e||(await u.update(z.id,re(t)),T(!1))}},[z,x,u]),V=d(()=>{z&&A(!0)},[z]),G=d(async()=>{z&&(await u.remove(z.id),n())},[z,u,n]);if(!z)return null;const{icon:H,iconSrc:j}=He(z.destinationType.type),W=((e,t)=>{const i=[],n=xt(e,t),a=n.map(e=>({name:e.key,value:e.value})),o=oe(e.exportedSignals);let l=[];const r=()=>{l.length&&(i.push({kind:"cells",id:`cells-${i.length}`,items:l}),l=[])};return n.forEach(({key:e,name:n,value:s})=>{const c=t.find(t=>t.name===e),{secret:d,componentType:p,componentProperties:u,hideFromReadData:h,customReadDataLabels:g}=c||{};if(h?.length&&wt(h,o,a))return;const{type:m}=We(u,{type:""}),b=d||"password"===m;if(g?.length)g.forEach(({condition:t,...i},n)=>{t==s&&l.push({id:`${e}-custom-${n}`,title:i.title,label:i.value})});else if(s)if(b)l.push({id:e,title:n,label:new Array(10).fill("•").join("")});else{if(p===gt.MultiInput){const t=We(s,null);if(Array.isArray(t)&&t.length)return r(),void i.push({kind:"list",id:e,title:n,items:t.map((t,i)=>({id:`${e}-${i}`,label:String(t)}))})}if(p===gt.KeyValuePair){const t=We(s,null);if(Array.isArray(t)&&t.length)return r(),void i.push({kind:"pairs",id:e,title:n,items:t.map((t,i)=>{const n=t&&"object"==typeof t?t:{};return{id:`${e}-${i}`,title:null!=n.key?String(n.key):"",label:null!=n.value?String(n.value):""}})})}l.push({id:e,title:n,label:s})}else l.push({id:e,title:n,label:"-"})}),r(),i})(z,P);return e(i,{children:[t(ct,{isOpen:!0,header:{icon:H,iconSrc:j,title:z.name||z.destinationType.displayName,onClose:_,actions:[{id:"edit-destination-btn-edit",label:lt.EDIT,icon:Cs,active:k,onClick:L},{id:"edit-destination-btn-delete",label:lt.DELETE,icon:vs,color:s.v2.colors.red[500],active:I,onClick:V}]},footer:{actions:k?[{"data-id":"edit-destination-btn-cancel",label:lt.CANCEL,variant:K.Secondary,onClick:F},...y?.option.testConnectionSupported&&c?[{"data-id":"edit-destination-btn-test-connection",label:lt.TEST_CONNECTION,variant:K.Secondary,onClick:()=>C.current?.testConnection()}]:[],{"data-id":"edit-destination-btn-save",label:lt.SAVE,variant:K.Primary,onClick:U}]:[]},children:t(N,{$padding:"4px 12px 12px",children:f?t(Me,{$height:"50vh",children:t(Ve,{withSpinner:!0})}):k&&y?t(Tp,{ref:C,isEdit:!0}):e($,{$gap:16,children:[c&&t(vt,{conditions:z.conditions||[]}),t(mt,{bgTint:"900",cellsPerRow:2,items:hg(z)}),!!W.length&&t(mt,{bgTint:"900",richTitle:{title:"Configuration"},withCollapse:!0,collapseIsDefaultOpen:!0,children:W.map(e=>"cells"===e.kind?t(mt,{bgTint:"800",cellsPerRow:2,items:e.items},e.id):(e.kind,t(mt,{bgTint:"800",richTitle:{title:e.title},cellsPerRow:2,items:e.items},e.id)))})]})})}),t(Cd,{target:"destination",isOpen:I,onClose:()=>A(!1),onApprove:G}),t(wd,{isOpen:null!==O,onClose:()=>E(null),onApprove:B})]})},mg=(e,t)=>{const i=[{id:"type",title:ke.TYPE,label:t.label},{id:"status",title:ke.STATUS,badge:{status:e.disabled?ie.Unknown:ie.Success,label:e.disabled?ke.DISABLED:ke.ENABLED}}];return e.ruleName&&i.push({id:"name",title:ke.NAME,label:e.ruleName}),e.profileName&&i.push({id:"profile",title:ke.MANAGED_BY_PROFILE,label:e.profileName}),e.notes&&i.push({id:"notes",title:ke.NOTES,label:e.notes}),i},bg=({onClose:n,ruleId:r})=>{const s=v(),{addNotification:c}=Tt(),{isK8s:p,platformType:u,version:h}=Pr(),g=ve(u,h),{instrumentationRulesApi:m}=Lc(),{items:b,refetch:f}=m.useRules(),{selectedOption:y,loadRule:S,validateFormData:x,genericForm:w}=_c();o(()=>{f()},[]);const[C,k]=l(!1),[I,A]=l(!1),[O,E]=l(null),D=C&&!!w?.isFormDirty,{options:R}=m.useRuleTypes(),z=a(()=>R.length?R:Ke,[R]),X=a(()=>b?.find(e=>bt(e)===r),[r,b]),P=a(()=>z.find(({type:e})=>e===X?.type)??null,[z,X?.type]),L=a(()=>ye(P?.supportedLanguages),[P?.supportedLanguages]);o(()=>{X&&P&&S(X,P)},[X,P]);const M=d(()=>{if(X){if(!X.mutable)return void c({type:ie.Warning,title:be.FORBIDDEN,message:be.CANNOT_EDIT_RULE,crdType:qe.InstrumentationRule,target:X.ruleId,hideFromHistory:!0});k(!0)}},[X,c]),_=d(()=>{X&&P&&(S(X,P),k(!1))},[X,P,S]),F=d(()=>{D?E("close"):n()},[D,n]),B=d(()=>{D?E("cancel"):_()},[D,_]),U=d(()=>{const e=O;E(null),"close"===e?(_(),n()):_()},[O,_,n]),V=d(async()=>{if(X){const{errorMessage:e,preparedFormData:t}=x();e||(await m.update(X.ruleId,t,X.type),k(!1))}},[X,x,m]),G=d(()=>{if(X){if(!X.mutable)return void c({type:ie.Warning,title:be.FORBIDDEN,message:be.CANNOT_DELETE_RULE,crdType:qe.InstrumentationRule,target:X.ruleId,hideFromHistory:!0});A(!0)}},[X,c]),H=d(async()=>{X&&(await m.remove(X.ruleId,X.type),n())},[X,m,n]);if(!X||!P)return null;const j=(W=X,Y=P,Y?.fields?.length?ht(W,Y.fields,{skipComponentTypes:[gt.SourceScopes]}):[]);var W,Y;return e(i,{children:[t(ct,{isOpen:!0,header:{icon:$t(X.type),title:P.label,onClose:F,actions:[{id:"edit-rule-btn-edit",label:lt.EDIT,icon:Cs,active:C,onClick:M},{id:"edit-rule-btn-delete",label:lt.DELETE,icon:vs,color:s.v2.colors.red[500],active:I,onClick:G}]},footer:{actions:C?[{"data-id":"edit-rule-btn-cancel",label:lt.CANCEL,variant:K.Secondary,onClick:B},{"data-id":"edit-rule-btn-save",label:lt.SAVE,variant:K.Primary,onClick:V}]:[]},children:t(N,{$padding:"4px 12px 12px",children:C&&y?t(Rp,{}):t($,{$gap:16,children:e(mt,{bgTint:"1000",children:[p&&!!X.conditions?.length&&t(vt,{conditions:X.conditions}),t(mt,{bgTint:"800",cellsPerRow:2,items:mg(X,P)}),g&&t(dd,{readOnly:!0,scopes:X.sourceScopes??null}),P.type===fe.CustomInstrumentation&&!!X.customInstrumentations?.[me.Php]?.length&&t(te,{status:ie.Warning,message:be.PHP_CUSTOM_INSTRUMENTATION_RESTART,fullWidth:!0}),!!j.length&&t(mt,{bgTint:"900",richTitle:{title:"Collect"},withCollapse:!0,collapseIsDefaultOpen:!0,children:dg(j)}),!!L.length&&t(mt,{bgTint:"900",richTitle:{title:"Supported languages"},withCollapse:!0,collapseIsDefaultOpen:!0,children:t(mt,{bgTint:"800",children:t(T,{$gap:12,$wrap:"wrap",children:L.map(e=>t(It,{label:we(e),leftIcon:xe(e),flex:L.length>1?"0.5":"1"},e))})})})]})})})}),t(Cd,{target:"instrumentation rule",isOpen:I,onClose:()=>A(!1),onApprove:H}),t(wd,{isOpen:null!==O,onClose:()=>E(null),onApprove:U})]})};var fg;(e=>{e.Overview="overview",e.Pods="pods",e.Libraries="libraries",e.PeerSources="peer-sources",e.Profiling="profiling",e.Sampling="sampling",e.Debug="debug"})(fg||(fg={}));const vg=({collapseIsDefaultOpen:e,isJumpToTarget:i,onClickRestartPod:n,namespace:o,podName:l,nodeName:r,startTime:s,agentInjectedStatus:c,odigosHealthStatus:d,k8sHealthStatus:p,children:u})=>{const{formatDurationAgo:h}=Nt(),{platformType:g,version:m}=Pr(),b=At(g,m),f=Ot(!!i),v=a(()=>({title:l,icon:Ws,withCopy:!0}),[l]),y=a(()=>{const e=[],t=Et(c);t&&e.push(t);const i=Et(d,Us,"health");i&&e.push(i);const n=Et(p,Ks,"health");return n&&e.push(n),e},[c,d,p]),S=a(()=>n?[{id:`restart-pod-${l}`,icon:Hs,label:lt.RESTART_POD,onClick:()=>n(o,l)}]:void 0,[n,o,l]),x=a(()=>[{id:"nodeName",title:ke.NODE,label:r,withCopy:!0},{id:"age",title:ke.AGE,label:s?h(s,{style:"short"}):b?ke.NOT_RUNNING:ke.UNKNOWN_VALUE,labelTooltip:s||(b?void 0:ke.START_TIME_UNAVAILABLE)}],[r,s,h,b]);return t("div",{ref:f,children:t(mt,{bgTint:"900",richTitle:v,badges:y,dropDataActions:S,items:x,withCollapse:!0,collapseIsDefaultOpen:e,children:u})})},yg=f.div`
|
|
537
537
|
display: flex;
|
|
538
538
|
align-items: center;
|
|
539
539
|
justify-content: space-between;
|
|
@@ -541,7 +541,7 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
541
541
|
padding: ${({$noPadding:e})=>e?"0":"12px"};
|
|
542
542
|
border-radius: 12px;
|
|
543
543
|
background-color: ${({theme:e})=>e.v2.colors.silver[900]};
|
|
544
|
-
`,Sg=({podsOdigosHealthStatus:i,pods:n,noPadding:o})=>{const l=Rt(i?.status),r=pt(i?.name),s=i?.message,{totalPodsCount:c,odigosHealthyPodsCount:d,k8sHealthyPodsCount:p}=a(()=>({totalPodsCount:n?.length||0,odigosHealthyPodsCount:n?.reduce((e,t)=>e+(t.odigosHealthStatus?.status===Dt.Success?1:0),0)||0,k8sHealthyPodsCount:n?.reduce((e,t)=>e+(t.k8sHealthStatus?.status===Dt.Success?1:0),0)||0}),[n]);return n?.length&&i&&l?e(yg,{$noPadding:o,children:[t(ut,{invertColors:!0,hideBackground:!0,status:l,title:r,subTitle:s}),e(T,{$gap:8,children:[t(wg,{label:ke.PODS,count:c}),t(wg,{label:ke.ODIGOS_HEALTHY,icon:Us,count:d,total:c}),t(wg,{label:ke.KUBERNETES_HEALTHY,icon:
|
|
544
|
+
`,Sg=({podsOdigosHealthStatus:i,pods:n,noPadding:o})=>{const l=Rt(i?.status),r=pt(i?.name),s=i?.message,{totalPodsCount:c,odigosHealthyPodsCount:d,k8sHealthyPodsCount:p}=a(()=>({totalPodsCount:n?.length||0,odigosHealthyPodsCount:n?.reduce((e,t)=>e+(t.odigosHealthStatus?.status===Dt.Success?1:0),0)||0,k8sHealthyPodsCount:n?.reduce((e,t)=>e+(t.k8sHealthStatus?.status===Dt.Success?1:0),0)||0}),[n]);return n?.length&&i&&l?e(yg,{$noPadding:o,children:[t(ut,{invertColors:!0,hideBackground:!0,status:l,title:r,subTitle:s}),e(T,{$gap:8,children:[t(wg,{label:ke.PODS,count:c}),t(wg,{label:ke.ODIGOS_HEALTHY,icon:Us,count:d,total:c}),t(wg,{label:ke.KUBERNETES_HEALTHY,icon:Ks,count:p,total:c})]})]}):null},xg=f.div`
|
|
545
545
|
display: flex;
|
|
546
546
|
flex-direction: column;
|
|
547
547
|
justify-content: center;
|
|
@@ -552,14 +552,14 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
552
552
|
width: fit-content;
|
|
553
553
|
border-radius: 8px;
|
|
554
554
|
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
555
|
-
`,wg=({count:i,total:n,label:a,icon:o})=>{const l=v(),r=void 0===n?void 0:i===n?l.v2.colors.green[500]:l.v2.colors.red[500];return e(xg,{children:[e(T,{$gap:0,$alignItems:"flex-end",children:[t(w,{size:C.L,color:r,weight:500,nowrap:!0,children:i}),void 0!==n&&t(w,{size:C.S,color:r,weight:500,nowrap:!0,children:`/${n}`})]}),e(T,{$alignItems:"center",$gap:4,children:[o&&t(o,{size:16}),t(w,{size:C.XXXS,nowrap:!0,children:a})]})]})},Cg=e=>{if(e.overrideProcessNum)return e.overrideProcessNum.toString();const t=e.identifyingAttributes?.find(({name:e})=>e===zt.PID)??e.identifyingAttributes?.find(({name:e})=>e===zt.VPID);return t?.value??null};var kg;(e=>{e.IdentifyingAttributes="identifying-attributes",e.InstrumentationLibraries="instrumentation-libraries"})(kg||(kg={}));const Tg=({overrideProcessNum:i,healthy:n,healthStatus:r,identifyingAttributes:s,instrumentations:c,isJumpToTarget:d})=>{const p=v(),[u,h]=l(kg.IdentifyingAttributes),g=Ot(!!d),{tabOptions:m,firstTabValue:b,bothTabsDisabled:f}=a(()=>{const e=c?.some(e=>!1===e.healthy),i=[{value:kg.IdentifyingAttributes,label:ke.IDENTIFYING_ATTRIBUTES,disabled:!s?.length,selectedBgColor:p.v2.colors.purple[500]},{value:kg.InstrumentationLibraries,label:ke.INSTRUMENTATION_LIBRARIES,icon:e?e=>t(Ys,{...e,fill:p.v2.colors.red[500]}):void 0,disabled:!c?.length,selectedBgColor:p.v2.colors.purple[500]}];return{tabOptions:i,firstTabValue:i.find(e=>!e.disabled)?.value||i[0].value,bothTabsDisabled:i.every(e=>e.disabled)}},[s,c]);o(()=>{b&&h(b)},[b]);const y=a(()=>{switch(u){case kg.IdentifyingAttributes:return t($,{children:s?.map((e,i)=>t(
|
|
555
|
+
`,wg=({count:i,total:n,label:a,icon:o})=>{const l=v(),r=void 0===n?void 0:i===n?l.v2.colors.green[500]:l.v2.colors.red[500];return e(xg,{children:[e(T,{$gap:0,$alignItems:"flex-end",children:[t(w,{size:C.L,color:r,weight:500,nowrap:!0,children:i}),void 0!==n&&t(w,{size:C.S,color:r,weight:500,nowrap:!0,children:`/${n}`})]}),e(T,{$alignItems:"center",$gap:4,children:[o&&t(o,{size:16}),t(w,{size:C.XXXS,nowrap:!0,children:a})]})]})},Cg=e=>{if(e.overrideProcessNum)return e.overrideProcessNum.toString();const t=e.identifyingAttributes?.find(({name:e})=>e===zt.PID)??e.identifyingAttributes?.find(({name:e})=>e===zt.VPID);return t?.value??null};var kg;(e=>{e.IdentifyingAttributes="identifying-attributes",e.InstrumentationLibraries="instrumentation-libraries"})(kg||(kg={}));const Tg=({overrideProcessNum:i,healthy:n,healthStatus:r,identifyingAttributes:s,instrumentations:c,isJumpToTarget:d})=>{const p=v(),[u,h]=l(kg.IdentifyingAttributes),g=Ot(!!d),{tabOptions:m,firstTabValue:b,bothTabsDisabled:f}=a(()=>{const e=c?.some(e=>!1===e.healthy),i=[{value:kg.IdentifyingAttributes,label:ke.IDENTIFYING_ATTRIBUTES,disabled:!s?.length,selectedBgColor:p.v2.colors.purple[500]},{value:kg.InstrumentationLibraries,label:ke.INSTRUMENTATION_LIBRARIES,icon:e?e=>t(Ys,{...e,fill:p.v2.colors.red[500]}):void 0,disabled:!c?.length,selectedBgColor:p.v2.colors.purple[500]}];return{tabOptions:i,firstTabValue:i.find(e=>!e.disabled)?.value||i[0].value,bothTabsDisabled:i.every(e=>e.disabled)}},[s,c]);o(()=>{b&&h(b)},[b]);const y=a(()=>{switch(u){case kg.IdentifyingAttributes:return t($,{children:s?.map((e,i)=>t(Xt,{label:e.name,value:e.value},`attr-${i}-${e.name}`))});case kg.InstrumentationLibraries:return t($,{children:c?.map((e,i)=>t(Xt,{label:e.name,isStandardLibrary:e.isStandardLibrary,healthy:e.healthy,message:e.message},`instr-${i}-${e.name}`))});default:return null}},[u,s,c]),S=a(()=>Cg({overrideProcessNum:i,identifyingAttributes:s}),[i,s]);return t("div",{ref:g,children:e(mt,{bgTint:"800",richTitle:{title:S?`${ke.PROCESS} ${ke.PID(S)}`:ke.PROCESS_FALLBACK_NAME},renderOnRightSide:t(w,{color:n?k.Success:k.Error,size:C.XXXS,children:r?.message}),badges:[{key:"odigos-healthy",status:n?ie.Success:ie.Error,leftIcon:Us,label:n?ke.HEALTHY:ke.NOT_HEALTHY,textSize:C.XXXS,invertColors:!0,useSecondaryTone:!0}],withCollapse:!f,collapseIsDefaultOpen:d,children:[!f&&t(F,{options:m,selected:u,setSelected:h}),!f&&y]})})},Ig=h(null),$g=({value:e,children:i})=>t(Ig.Provider,{value:e,children:i}),Ng=({podContainers:e,sourceContainers:i,jumpToTarget:n})=>{const o=e??[],l=a(()=>({title:ke.CONTAINERS,titleSize:C.XS,badge:{label:o.length}}),[o.length]),r=a(()=>{const e=new Map;return i?.forEach(t=>e.set(t.containerName,t)),e},[i]);return t(mt,{bgTint:"800",richTitle:l,withCollapse:!0,collapseIsDefaultOpen:!0,children:t($,{$gap:8,children:o.map(e=>{const i=n?.containerName===e.containerName;return t(Og,{...e,language:Pt(r.get(e.containerName)),jumpToTarget:i?n:null},`pod-container-${e.containerName}`)})})})},Ag=f.div`
|
|
556
556
|
display: flex;
|
|
557
557
|
flex-direction: column;
|
|
558
558
|
gap: 12px;
|
|
559
559
|
padding: 8px 12px;
|
|
560
560
|
border-radius: 8px;
|
|
561
561
|
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
562
|
-
`,Og=({language:i,containerName:n,otelDistroName:o,runningStartedTime:l,started:r,ready:s,restartCount:c,isCrashLoop:d,waitingReasonEnum:p,waitingMessage:u,odigosHealthStatus:h,k8sHealthStatus:g,processes:m,jumpToTarget:b})=>{const f=!!b,v=f&&!b?.processPid,{formatDurationAgo:y}=
|
|
562
|
+
`,Og=({language:i,containerName:n,otelDistroName:o,runningStartedTime:l,started:r,ready:s,restartCount:c,isCrashLoop:d,waitingReasonEnum:p,waitingMessage:u,odigosHealthStatus:h,k8sHealthStatus:g,processes:m,jumpToTarget:b})=>{const f=!!b,v=f&&!b?.processPid,{formatDurationAgo:y}=Nt(),{platformType:S,version:x}=Pr(),I=At(S,x),$=Ot(v),N=a(()=>({title:n,icon:i?Lt(i):qs,iconWithWrapper:!0}),[n,i]),A=a(()=>{const e=[],t=Et({status:o?Dt.Success:Dt.Disabled,reasonEnum:o?ke.INSTRUMENTED_WITH_DISTRO(o):ke.UNINSTRUMENTED,message:""});t&&e.push(t);const i=Et(h,Us,"health");i&&e.push(i);const n=Et(g,Ks,"health");return n&&e.push(n),e},[g,h,o]),O=a(()=>{const e=[{id:"runningTime",title:ke.RUNNING_TIME,label:l?y(l,{style:"short"}):I?ke.NOT_RUNNING:ke.UNKNOWN_VALUE,labelTooltip:l?`${ke.RUNNING_TIME_TOOLTIP}. (${l})`:I?ke.RUNNING_TIME_TOOLTIP:ke.START_TIME_UNAVAILABLE},{id:"blank",spacer:!0},{id:"started",badge:{status:r?ie.Success:ie.Disabled,leftIcon:r?$s:Ns,label:r?ke.STARTED:ke.NOT_STARTED,textSize:C.XXXS,invertColors:!0,useSecondaryTone:!0}},{id:"ready",badge:{status:s?ie.Success:ie.Disabled,leftIcon:s?$s:Ns,label:s?ke.READY:ke.NOT_READY,textSize:C.XXXS,invertColors:!0,useSecondaryTone:!0}}];return d&&e.push({id:"isCrashLoop",badge:{status:ie.Error,leftIcon:Ns,label:ke.CRASHLOOP,textSize:C.XXXS,invertColors:!0,useSecondaryTone:!0}}),e.push({id:"restartCount",title:ke.RESTARTS,badge:{status:c?ie.Error:void 0,label:c||0,textSize:C.XXXS}}),e},[l,y,r,s,d,c,I]),E=a(()=>u?pt(p):"",[u,p]);return t("div",{ref:$,children:e(mt,{bgTint:"750",richTitle:N,badges:A,items:O,withCollapse:!0,collapseIsDefaultOpen:f,children:[u&&t(Ag,{children:e(T,{$gap:10,$alignItems:"center",children:[t(It,{variant:Mt.Pink,leftIcon:Ks,label:E}),t(w,{size:C.XXXS,color:k.Error,children:u})]})}),(m??[]).map((e,i)=>{const a=i+1,o=f&&(l=b,r=e,!!l?.processPid&&Cg({identifyingAttributes:r.identifyingAttributes})===l.processPid);var l,r;return t(Tg,{...e,overrideProcessNum:a,isJumpToTarget:o},`pod-container-${n}-process-${a}`)})]})})},Eg=({podName:e,namespace:i,hasRestarted:n})=>{const o=a(()=>({title:ke.DEBUG_COMMANDS,titleSize:C.XS}),[]),l=a(()=>[{label:ke.GET_POD_YAML,value:`kubectl get pod ${e} -n ${i} -o yaml`},{label:ke.DESCRIBE_POD,value:`kubectl describe pod ${e} -n ${i}`},{label:ke.GET_POD_LOGS,value:`kubectl logs ${e} -n ${i}${n?" -p":""}`}],[e,i,n]);return t(mt,{bgTint:"800",richTitle:o,withCollapse:!0,children:l.map(({label:e,value:i})=>t(_t,{bgTint:"700",label:e,value:i},e))})},Dg=({source:n,onClickRestartPod:o})=>{const{jumpToTarget:l}=(()=>{const e=g(Ig);if(!e)throw new Error("useJumpToTargetContext must be used within a JumpToTargetContextProvider");return e})(),r=l?.tab===fg.Pods?l:null,s=n?.pods??[],c=s.length>0,d=a(()=>s.some(e=>e.containers?.some(e=>e.restartCount&&e.restartCount>0)),[s]),p=a(()=>({title:ke.PODS,badge:{label:s.length}}),[s.length]);return t($,{$gap:12,children:c?e(i,{children:[t(Sg,{podsOdigosHealthStatus:n.podsOdigosHealthStatus,pods:s}),t(mt,{bgTint:"1000",richTitle:p,children:s.map(i=>{const a=r?.podName===i.podName,l=a&&!r?.containerName;return e(vg,{...i,namespace:n.id.namespace,onClickRestartPod:o,collapseIsDefaultOpen:a,isJumpToTarget:l,children:[t(Eg,{podName:i.podName,namespace:n.id.namespace,hasRestarted:d}),t(Ng,{podContainers:i.containers,sourceContainers:n.containers,jumpToTarget:a?r:null})]},`pod-${i.podName}`)})})]}):t(Me,{$height:"70vh",children:t(Z,{title:ke.NO_RUNNING_PODS,subTitle:ke.NO_RUNNING_PODS_SUBTITLE})})})},Rg="user",zg=({source:i})=>{const n=a(()=>i.serviceName||i.id.name,[i]),{sourcesApi:o}=Lc(),{data:l,loading:r,refetch:s}=o.usePeerSources({serviceName:n},{fetchPolicy:"network-only"}),c=l?.peerSources??null;return!c||r?t(Me,r?{$height:"70vh",children:t(Ve,{withSpinner:!0})}:{$height:"70vh",children:t(Z,{subTitle:ke.COULD_NOT_FETCH_PEER_SOURCES})}):e(T,{$gap:16,$alignItems:"flex-start",children:[t(Xg,{icon:Js,title:ke.INBOUND,subTitle:ke.INBOUND_DESCRIPTION(n),onRefresh:s,items:c?.inbound??[]}),t(Xg,{icon:Zs,title:ke.OUTBOUND,subTitle:ke.OUTBOUND_DESCRIPTION(n),onRefresh:s,items:c?.outbound??[]})]})},Xg=({icon:i,title:n,subTitle:o,onRefresh:r,items:s})=>{const[c,d]=l(""),p=a(()=>s.filter(e=>e.serviceName.toLowerCase().includes(c.toLowerCase())),[s,c]);return e(mt,{bgTint:"1000",richTitle:{icon:i,title:n,titleSize:C.XS,subTitle:o,subTitleSize:C.XXXS,badge:{label:s.length}},actions:[{id:"refresh",type:Ft.Button,buttonProps:{variant:K.Secondary,size:W.S,leftIcon:Hs,onClick:r}}],children:[t(Bt,{value:c,onChange:d,width:"100%"}),t(Ut,{height:"calc(100vh - 284px)",gap:4,elements:p.length||c?!p.length&&c?[t(Me,{$height:"50vh",children:t(Z,{icon:i,title:ke.NO_RESULTS,subTitle:ke.NO_RESULTS_FOR_FILTER(c)})},"no-results")]:p.map(e=>t(Lg,{...e},`${n}-${e.serviceName}`)):[t(Me,{$height:"50vh",children:t(Z,{icon:i,title:`No ${n} connections yet`,subTitle:n===ke.INBOUND?ke.NO_INBOUND_CONNECTIONS_DESCRIPTION:ke.NO_OUTBOUND_CONNECTIONS_DESCRIPTION})},"no-data")]})]})},Pg=f.div`
|
|
563
563
|
display: flex;
|
|
564
564
|
align-items: center;
|
|
565
565
|
justify-content: space-between;
|
|
@@ -573,9 +573,9 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
573
573
|
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
574
574
|
}
|
|
575
575
|
`}
|
|
576
|
-
`,
|
|
576
|
+
`,Lg=({serviceName:i,isVirtual:n,nodeAttributes:o})=>{const l=Vt(e=>e.drawerEntityId),{items:r}=Lc().sourcesApi.useSources(),s=a(()=>r.find(e=>e.id.name===i||e.serviceName===i),[r,i]),c=a(()=>s&&JSON.stringify(Gt(s))!==JSON.stringify(Gt(l)),[s,l]),d=a(()=>{if(n){const e=Object.fromEntries((o??[]).map(({key:e,value:t})=>[e,t]));return[Ht({serviceName:i,attributes:e})]}if(i?.toLowerCase()===Rg)return[Qs];const e=s?jt(s):void 0;return e?.length?e:[qs]},[n,o,i,s]),p=c?()=>{const{setDrawerType:e,setDrawerEntityId:t}=Vt.getState();e(Kt(qe.Source)),t({namespace:s?.id.namespace??"",name:s?.id.name??"",kind:s?.id.kind??"",region:s?.id.region??""})}:void 0;return e(Pg,{onClick:p,$withClick:!!p,children:[e(T,{$gap:8,children:[t(Wt,{icons:d}),t(w,{size:C.XXS,children:i})]}),n&&t(E,{status:ie.Info,label:ke.VIRTUAL,textSize:C.XXXS,invertColors:!0,tooltip:ke.VIRTUAL_TOOLTIP})]})},Mg=e=>{if("string"==typeof e)return e;if(e&&"object"==typeof e){const t=e;if("string"==typeof t.k8sActualManifest)return t.k8sActualManifest;if("string"==typeof t.manifest)return t.manifest}},_g=({source:i})=>{const n=v(),{k8sManifestApi:r}=Lc(),[s,c]=l(!0),[d,u]=l(void 0),[h,g]=l(!0),[m,b]=l(void 0),[f,y]=l(!0),[S,x]=l({}),w=p(r);w.current=r,o(()=>{w.current.fetch({namespace:i.id.namespace,kind:i.id.kind,name:i.id.name}).then(({data:e})=>u(Mg(e))).finally(()=>c(!1)),w.current.fetch({namespace:i.id.namespace,kind:Yt.InstrumentationConfig,name:`${i.id.kind}-${i.id.name}`.toLowerCase()}).then(({data:e})=>b(Mg(e))).finally(()=>g(!1))},[i.id.namespace,i.id.kind,i.id.name]);const C=a(()=>(i.pods??[]).map(e=>e.podName).join(","),[i.pods]);o(()=>{if(Object.keys(S).length>0)return;const e=C?C.split(","):[];if(0===e.length)return x({}),void y(!1);let t=!1;return y(!0),Promise.all(e.map(async e=>{const{data:t}=await w.current.fetch({namespace:i.id.namespace,kind:Yt.Pod,name:e});return[e,Mg(t)]})).then(e=>{t||x(Object.fromEntries(e))}).finally(()=>{t||y(!1)}),()=>{t=!0}},[S,C,i.id.namespace]);const k=a(()=>[{label:ke.DESCRIBE_POD,value:`kubectl describe ${i.id.kind} ${i.id.name} -n ${i.id.namespace}`},{label:ke.GET_POD_YAML,value:`kubectl get ${i.id.kind} ${i.id.name} -n ${i.id.namespace} -o yaml`},{label:ke.GET_POD_YAML,value:`kubectl get ${Yt.InstrumentationConfig} ${i.id.kind}-${i.id.name} -n ${i.id.namespace} -o yaml`}],[i.id.kind,i.id.name,i.id.namespace]);return e(mt,{bgTint:"1000",children:[t(mt,{bgTint:"900",richTitle:{icon:ec,title:ke.DEBUG_COMMANDS},withCollapse:!0,collapseIsDefaultOpen:!0,children:k.map(({label:e,value:i},n)=>t(_t,{label:e,value:i},`debug-cmd-${n}-${e}`))}),s?t(A,{size:1}):t(kd,{bgTint:"800",codeBgColor:n.v2.colors.silver[900],title:`${i.id.kind} YAML`,yaml:d}),h?t(A,{size:1}):t(kd,{bgTint:"800",codeBgColor:n.v2.colors.silver[900],title:"Instrumentation Config YAML",yaml:m}),i.pods?.map(e=>f?t(A,{size:1},e.podName):t(kd,{bgTint:"800",codeBgColor:n.v2.colors.silver[900],title:`Pod ${e.podName} YAML`,yaml:S[e.podName]},e.podName))]})},Fg=({title:i,children:n})=>e($,{$gap:8,children:[t(w,{size:C.XXXS,color:k.Secondary,children:i}),n]}),Bg=({source:i})=>{const n=a(()=>{const[e,t]=Jt(i.telemetryMetrics?.[0]?.throughputBytes||0).split(" ");return{value:e,units:t}},[i]);return t(Fg,{title:ke.THROUGHPUT_LAST_10_SECONDS,children:e(T,{$alignItems:"flex-end",$gap:4,children:[t(w,{size:C.L,children:n.value}),t(w,{size:C.XS,variant:Ze.Span,children:n.units})]})})},Ug=({source:i})=>{const{CopyButton:n}=at();return t(Fg,{title:ke.NAMESPACE,children:e(T,{children:[t(It,{variant:Mt.Blue,label:i.id.namespace}),t(n,{value:i.id.namespace})]})})},Vg=({source:i})=>{const{CopyButton:n}=at(),a=i.id.region;return a?t(Fg,{title:ke.REGION,children:e(T,{children:[t(It,{variant:Mt.Blue,label:a}),t(n,{value:a})]})}):null},Gg=({source:e})=>{const i=e.markedForInstrumentation?.markedForInstrumentation??!1;return t(Fg,{title:ke.ENABLED,children:t(T,{children:t(It,{variant:i?Mt.Green:Mt.Default,label:i?ke.ENABLED:ke.DISABLED})})})},Hg=({source:e,label:i})=>t(Fg,{title:ke.KIND,children:t(T,{children:t(It,{variant:Mt.Blue,label:i||e.id.kind})})}),jg=({source:i})=>{const{CopyButton:n}=at();return t(Fg,{title:ke.NAME,children:e(T,{children:[t(It,{variant:Mt.Blue,label:i.id.name}),t(n,{value:i.id.name})]})})},Wg=({source:i})=>{const{CopyButton:n}=at(),a=i.serviceName||i.id.name;return t(Fg,{title:ke.SERVICE_NAME,children:e(T,{children:[t(It,{variant:Mt.Blue,label:a}),t(n,{value:a})]})})},Kg=({source:i})=>{const{isK8s:n,isConnector:o}=Pr(),l=a(()=>qt(i.id.kind),[i.id.kind]);return t(mt,{children:e(T,{$gap:24,$alignItems:"flex-start",$justifyContent:"flex-start",$wrap:"wrap",children:[n&&t(Bg,{source:i}),t(Gg,{source:i}),o&&t(Vg,{source:i}),n&&t(Ug,{source:i}),t(Hg,{source:i,label:l}),t(jg,{source:i}),!n&&t(Wg,{source:i})]})})},Yg=({source:e})=>e.pods?.length&&e.podsOdigosHealthStatus?t(mt,{bgTint:"900",children:t(Sg,{podsOdigosHealthStatus:e.podsOdigosHealthStatus,pods:e.pods,noPadding:!0})}):null,qg=({source:e})=>{const i=a(()=>e.workloadOdigosHealthStatus?{status:e.workloadOdigosHealthStatus.status?Zt(e.workloadOdigosHealthStatus.status):ie.Unknown,title:pt(e.workloadOdigosHealthStatus.reasonEnum),subTitle:e.workloadOdigosHealthStatus.message}:null,[e]);return i?t(ut,{...i,width:"100%"}):null},Jg=h(null),Zg=f.div`
|
|
577
577
|
position: relative;
|
|
578
|
-
`,Qg=({children:e})=>{const i=p(null);return t(Zg,{ref:i,children:t(
|
|
578
|
+
`,Qg=({children:e})=>{const i=p(null);return t(Zg,{ref:i,children:t(Jg.Provider,{value:i,children:e})})},em=f.div`
|
|
579
579
|
position: fixed;
|
|
580
580
|
top: ${({$coords:e})=>e.top}px;
|
|
581
581
|
right: ${({$coords:e})=>e.right}px;
|
|
@@ -596,7 +596,7 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
596
596
|
gap: 8px;
|
|
597
597
|
`,im=f.div`
|
|
598
598
|
flex: 1;
|
|
599
|
-
`,nm=({width:i,onClose:n,onSave:a,saveTooltip:o,onDelete:r,deleteTooltip:s,title:c,subTitle:d,warning:p,children:u,pushButtonsWith:h})=>{const b=v(),f=g(
|
|
599
|
+
`,nm=({width:i,onClose:n,onSave:a,saveTooltip:o,onDelete:r,deleteTooltip:s,title:c,subTitle:d,warning:p,children:u,pushButtonsWith:h})=>{const b=v(),f=g(Jg),[y,S]=l(null);return Qt(f??{current:null},n),m(()=>{const e=f?.current?.getBoundingClientRect();e&&S({top:e.bottom+4,right:window.innerWidth-e.left-24})},[f]),y?Dd(e(em,{$coords:y,$width:i,"data-ignore-outside-click":"true",children:[e($,{$gap:4,children:[t(w,{size:C.XXS,children:c}),t(w,{size:C.XXXS,color:k.Secondary,children:d})]}),e(tm,{children:[t(im,{children:u}),e(T,{$gap:8,$width:"fit-content",$margin:`0 0 ${h||0} 0`,children:[t(j,{variant:K.Secondary,onClick:r,leftIcon:vs,tooltip:s,hideTooltipIcon:!0,iconSize:16,size:W.S,textColor:b.v2.colors.red[500]}),t(j,{variant:K.Primary,onClick:a,leftIcon:Ds,tooltip:o,hideTooltipIcon:!0,iconSize:16,size:W.S})]})]}),t("div",{children:t(te,{status:ie.Warning,message:p})})]}),document.body):null},am=({language:i,overridden:n,onOverride:o,defaultValues:r})=>{const{tier:s}=Pr(),{formData:c,handleFormChange:d,resetFormData:p}=St(r),u=a(()=>{if(!i)return[];const e=ei[i].community,t=s===ti.Onprem?ei[i].enterprise:[];return e.concat(t).map(e=>({id:e.id,label:e.label,icon:e.icon||void 0})).sort((e,t)=>e.label.localeCompare(t.label))},[i,s]),[h,g]=l(!1),[m,b]=l(!1),f=()=>{h||(m&&p(),b(e=>!e))};return e(T,{$gap:4,$alignItems:"center",children:[n?t(E,{status:ie.Info,invertColors:!0,label:ke.OVERIDDEN}):null,e(Qg,{children:[t(ce,{text:ke.OVERRIDE_OTEL_DISTRO_NAME,children:t(Be,{icon:Cs,onClick:f})}),m&&t(nm,{width:"500px",onClose:f,onSave:async()=>{g(!0),await o(c),g(!1),f()},saveTooltip:ke.OVERRIDE_OTEL_DISTRO_NAME_SAVE_TOOLTIP,onDelete:async()=>{g(!0),await o({otelDistroName:null}),g(!1),f()},deleteTooltip:ke.OVERRIDE_OTEL_DISTRO_NAME_DELETE_TOOLTIP,title:ke.OVERRIDE_OTEL_DISTRO_NAME,subTitle:ke.OVERRIDE_OTEL_DISTRO_NAME_SUBTITLE,warning:ke.OVERRIDE_OTEL_DISTRO_NAME_WARNING,children:t(Fe,{label:ke.OTEL_DISTRO_NAME,options:u,values:c.otelDistroName?[c.otelDistroName]:[],setValues:e=>d("otelDistroName",e[0])})})]})]})},om=({overridden:i,onOverride:n,defaultValues:o,originalValues:r})=>{const{addNotification:s}=Tt(),{formData:c,handleFormChange:d,resetFormData:p}=St(o),u=a(()=>ii.map(e=>({id:e.id,label:e.label,icon:e.icon||void 0})),[]),[h,g]=l(!1),[m,b]=l(!1),f=()=>{h||(m&&p(),b(e=>!e))};return e(T,{children:[i?t(E,{status:ie.Info,invertColors:!0,label:ke.OVERIDDEN}):null,e(Qg,{children:[t(ce,{text:ke.OVERRIDE_RUNTIME_DETAILS,children:t(Be,{icon:Cs,onClick:f})}),m&&t(nm,{width:"500px",onClose:f,onSave:async()=>{!c.version||ni(c.version)?(g(!0),await n(c),g(!1),f()):s({type:ie.Warning,message:be.INVALID_VERSION,hideFromHistory:!0})},saveTooltip:ke.OVERRIDE_RUNTIME_DETAILS_SAVE_TOOLTIP,onDelete:async()=>{g(!0),await n({language:null,version:""}),g(!1),f()},deleteTooltip:ke.OVERRIDE_RUNTIME_DETAILS_DELETE_TOOLTIP,title:ke.OVERRIDE_RUNTIME_DETAILS,subTitle:ke.OVERRIDE_RUNTIME_DETAILS_SUBTITLE,warning:ke.OVERRIDE_RUNTIME_WARNING,pushButtonsWith:"20px",children:e(T,{$gap:8,children:[t(Fe,{label:ke.LANGUAGE,options:u,values:c.language?[c.language]:[],setValues:e=>d("language",e[0]),helpMessage:`Auto-detected: ${r.language||"none"}`}),t(Y,{label:ke.RUNTIME_VERSION,placeholder:ke.VERSION_PLACEHOLDER,value:c.version??"",onChange:e=>d("version",e.target.value),helpMessage:`Auto-detected: ${r.version||"none"}`})]})})]})]})},lm=f.div`
|
|
600
600
|
display: flex;
|
|
601
601
|
flex-direction: column;
|
|
602
602
|
gap: 10px;
|
|
@@ -622,7 +622,7 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
622
622
|
padding: 8px;
|
|
623
623
|
border-radius: 10px;
|
|
624
624
|
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
625
|
-
`,um=e=>{if(!e)return ai.Unknown;const t=e.trim().toLowerCase();return{go:ai.Go,golang:ai.Go,javascript:ai.JavaScript,js:ai.JavaScript,node:ai.JavaScript,nodejs:ai.JavaScript,typescript:ai.JavaScript,python:ai.Python,java:ai.Java,dotnet:ai.DotNet,csharp:ai.CSharp,php:ai.Php,ruby:ai.Ruby,rust:ai.Rust,swift:ai.Swift,elixir:ai.Elixir}[t]??ai.Unknown},hm=({source:i})=>{const n=v(),{isK8s:o,isVm:l}=
|
|
625
|
+
`,um=e=>{if(!e)return ai.Unknown;const t=e.trim().toLowerCase();return{go:ai.Go,golang:ai.Go,javascript:ai.JavaScript,js:ai.JavaScript,node:ai.JavaScript,nodejs:ai.JavaScript,typescript:ai.JavaScript,python:ai.Python,java:ai.Java,dotnet:ai.DotNet,csharp:ai.CSharp,php:ai.Php,ruby:ai.Ruby,rust:ai.Rust,swift:ai.Swift,elixir:ai.Elixir}[t]??ai.Unknown},hm=({source:i})=>{const n=v(),{isK8s:o,isVm:l}=Pr(),{sourcesApi:r}=Lc(),s=i.instrumentationReport,c=i.sourceConfig,d=l?s?.processes:null,p=a(()=>!(!c?.runtimeOverride?.language&&!c?.runtimeOverride?.version),[c]),u=a(()=>{const e=um(s?.runtimeLanguage);return e!==ai.Unknown?e:i.runtimeInfo?.detectedLanguages?.[0]??ai.Unknown},[s?.runtimeLanguage,i.runtimeInfo?.detectedLanguages]),h=s?.runtimeVersion?.trim()||"",g=a(()=>{const e=um(c?.runtimeOverride?.language);return{language:e!==ai.Unknown?e:u,version:c?.runtimeOverride?.version?.trim()||h||void 0}},[c,u,h]),m=a(()=>!!c?.distroOverride?.otelDistroName,[c]),b=a(()=>({otelDistroName:c?.distroOverride?.otelDistroName||void 0}),[c]),f=a(()=>{const{language:e,version:t}=g;return e!==ai.Unknown||t?e!==ai.Unknown&&t?`${e} • ${t}`:e!==ai.Unknown?e:t||null:null},[g]),y=!f&&!p&&"Instrumenting"===s?.state,S=a(()=>y||g.language===ai.Unknown?qs:Lt(g.language),[y,g.language]),x=a(()=>{const e=s?.state??"",t=s?.instrumented||"Instrumented"===e,i=c?.distroOverride?.otelDistroName?.trim()||s?.sdkType?.trim();return"Instrumenting"===e?{status:ie.Loading,label:pt(s?.progressStage||e)||e}:"NotImplemented"===e||"Unsupported"===e?{status:ie.Disabled,leftIcon:Ns,label:pt(e)||e}:"Error"===e?{status:ie.Error,leftIcon:Ns,label:"Error"}:t?{status:ie.Success,leftIcon:$s,label:i?`Instrumented | ${i}`:"Instrumented"}:{status:ie.Disabled,leftIcon:Ns,label:ke.UNINSTRUMENTED}},[s,c]),k=e=>r.update(i.id,{...m?b:{},...p?{language:g.language!==ai.Unknown?g.language:void 0,version:g.version}:{},...e});return o?null:s?t(mt,{bgTint:"1000",richTitle:{title:ke.INSTRUMENTATION,tooltip:ke.INSTRUMENTATION_DESCRIPTION,badge:{label:1}},withCollapse:!0,collapseIsDefaultOpen:!0,children:t($,{$gap:8,children:e(dm,{children:[e(T,{$gap:16,$alignItems:"center",$justifyContent:"space-between",$wrap:"wrap",children:[e(T,{$gap:8,$alignItems:"center",children:[t(pm,{children:t(S,{size:24,fill:y||g.language===ai.Unknown?n.v2.colors.grey[400]:void 0})}),t(w,{children:i.id.name}),y?t(It,{variant:Mt.Loader,label:ke.DETECTING_RUNTIME_INFO}):f?t(It,{variant:Mt.Blue,label:f}):null,t(om,{overridden:p,onOverride:k,defaultValues:{language:g.language!==ai.Unknown?g.language:void 0,version:g.version||""},originalValues:{language:u!==ai.Unknown?u:void 0,version:h}})]}),e(T,{$gap:8,$alignItems:"center",children:[t(E,{...x,textSize:C.XXXS}),t(am,{language:g.language!==ai.Unknown?g.language:null,overridden:m,onOverride:k,defaultValues:b})]})]}),d?.length?t(cm,{processes:d}):null]})})}):null},gm="100%",mm=f(T)`
|
|
626
626
|
@media (max-width: 1099px) {
|
|
627
627
|
flex-direction: column;
|
|
628
628
|
|
|
@@ -635,7 +635,7 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
635
635
|
padding: 2px 6px;
|
|
636
636
|
border-radius: 8px;
|
|
637
637
|
background-color: ${({theme:e})=>e.v2.colors.silver[750]};
|
|
638
|
-
`,vm=({overview:i,status:n})=>{const a=v(),o=i?[{id:"applied",count:i.totalAgentAppliedPods,ok:i.agentAppliedOk,label:"Agent applied"},{id:"out-of-date",count:i.totalAgentOutOfDatePods,ok:i.agentOutOfDateOk,label:"Agent out of date"},{id:"not-applied",count:i.totalAgentNotAppliedPods,ok:i.agentNotAppliedOk,label:"No agent applied"}].filter(({count:e})=>e>0):[];return o.length?t(fm,{$gap:12,$wrap:"wrap",children:o.map(({id:o,count:l,ok:r,label:s})=>{const c=r?ie.Success:n,d=li(c,a);return e(T,{$gap:2,children:[t(d,{size:16,fill:oi(a,c,"300")}),t(w,{size:C.XXXS,color:k.Secondary,children:`${l}/${i?.totalPods??0} ${s}`})]},o)})}):null},ym=({changedTime:e})=>{const{formatTimeAgo:i}=
|
|
638
|
+
`,vm=({overview:i,status:n})=>{const a=v(),o=i?[{id:"applied",count:i.totalAgentAppliedPods,ok:i.agentAppliedOk,label:"Agent applied"},{id:"out-of-date",count:i.totalAgentOutOfDatePods,ok:i.agentOutOfDateOk,label:"Agent out of date"},{id:"not-applied",count:i.totalAgentNotAppliedPods,ok:i.agentNotAppliedOk,label:"No agent applied"}].filter(({count:e})=>e>0):[];return o.length?t(fm,{$gap:12,$wrap:"wrap",children:o.map(({id:o,count:l,ok:r,label:s})=>{const c=r?ie.Success:n,d=li(c,a);return e(T,{$gap:2,children:[t(d,{size:16,fill:oi(a,c,"300")}),t(w,{size:C.XXXS,color:k.Secondary,children:`${l}/${i?.totalPods??0} ${s}`})]},o)})}):null},ym=({changedTime:e})=>{const{formatTimeAgo:i}=Nt();return t(w,{size:C.XXXS,color:k.Disable,nowrap:!0,children:`Agent Assignment Updated · ${i(e)}`})},Sm=({source:i,onClickRollout:n,onClickRollback:o})=>{const l=i.rollout?.podsManifestInjectionStatus??i.conditions?.rollout,r=a(()=>{const{status:e,reasonEnum:a,message:o,actionItems:r}=l||{},s=Rt(e);if(!s)return null;const c=bm(a,ke.ROLLOUT),d=o,p=(r??[]).flatMap(e=>[{"data-id":`rollout-action-${e.type}`,label:e.buttonText,hideTooltipIcon:!0,leftIcon:tc,onClick:n}]);return{status:s,title:c,subTitle:d,details:t(vm,{overview:i.rollout?.podsManifestInjectionOverview,status:s}),actionDetails:i.rollout?.agentsMetaHashChangedTime?t(ym,{changedTime:i.rollout.agentsMetaHashChangedTime}):void 0,actionButtons:p}},[i.rollout,l,n]),s=a(()=>{const{status:e,reasonEnum:t,message:n,actionItems:a}=i.autoRollback?.autoRollbackStatus||{},l=Rt(e);if(!l)return null;const r=bm(t,ke.ROLLBACK),s=n,c=(a??[]).flatMap(e=>[{"data-id":`rollback-action-${e.type}`,label:e.buttonText,hideTooltipIcon:!0,leftIcon:Hs,onClick:o}]);return c.length||l===ie.Success||c.push({"data-id":"rollback-action",label:ke.ROLLBACK,tooltip:"Recover the workload from the last rollback",hideTooltipIcon:!0,leftIcon:Hs,onClick:o}),{status:l,title:r,subTitle:s,actionButtons:c}},[i,o]);return r||s?e(mm,{$gap:12,$alignItems:"stretch",children:[r&&t(ut,{invertColors:!0,slim:!0,width:s?"calc(60% - 6px)":gm,...r}),s&&t(ut,{invertColors:!0,slim:!0,width:r?"calc(40% - 6px)":gm,...s})]}):null},xm="Instrumented",wm=({source:e})=>{const{isK8s:i}=Pr(),{containers:n,containersRichTitle:o}=a(()=>{const t=e?.conditions?.runtimeDetection,n=i?`${e.id.kind} ${ke.CONTAINERS}`:ke.CONTAINERS;return{containers:e?.containers??[],containersRichTitle:{title:n,tooltip:t?.message||ke.DETECTED_CONTAINERS_DESCRIPTION,badge:Rt(t?.status)===ie.Loading?{status:ie.Loading,backgroundColor:"transparent"}:{label:e?.containers?.length}}}},[e,i]);return n.length?t(mt,{bgTint:"1000",richTitle:o,withCollapse:!0,collapseIsDefaultOpen:!0,children:t($,{$gap:8,children:n.map(i=>i&&t(Im,{...i,sourceId:e.id},`source-container-${i.containerName}`))})}):null},Cm=f.div`
|
|
639
639
|
display: flex;
|
|
640
640
|
flex-direction: column;
|
|
641
641
|
align-self: stretch;
|
|
@@ -657,17 +657,17 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
657
657
|
padding: 8px 12px;
|
|
658
658
|
border-radius: 8px;
|
|
659
659
|
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
660
|
-
`,Im=({sourceId:i,...n})=>{const{containerName:o,runtimeInfo:r,agentEnabled:s,overrides:c}=n,d=v(),{isK8s:p}=
|
|
660
|
+
`,Im=({sourceId:i,...n})=>{const{containerName:o,runtimeInfo:r,agentEnabled:s,overrides:c}=n,d=v(),{isK8s:p}=Pr(),{sourcesApi:u}=Lc(),[h,g]=l(!1),m=a(()=>!!c?.runtimeInfo?.language||!!c?.runtimeInfo?.runtimeVersion,[c]),b=a(()=>({language:Pt(n),version:ri(n)||""}),[n]),f=a(()=>!!c?.otelDistroName,[c]),y=a(()=>({otelDistroName:c?.otelDistroName||n.agentEnabled?.otelDistroName}),[c,n]),S=a(()=>!r&&!m,[r,m]),x=a(()=>S?qs:Lt(b.language),[S,b]),I=a(()=>{if(S)return"";const{language:e,version:t}=b;return`${e}${t?` • ${t}`:""}`},[S,b]),$=a(()=>{if(S)return{status:ie.Loading,label:ke.WAITING_FOR_RUNTIME_DETECTION};const e=s?.otelDistroName?.trim(),t=p?!!e:!!s?.agentEnabled;return{status:t?ie.Success:ie.Disabled,leftIcon:t?$s:Ns,label:t?e?`${xm} | ${e}`:xm:"Uninstrumented",tooltip:s?.agentEnabledStatus?.message}},[S,s,p]),N=e=>u.update(i,{containerName:o,...f?y:{},...m?b:{},...null!=c?.allowConcurrentAgents?{allowConcurrentAgents:c.allowConcurrentAgents}:{},...e}),A=(s?.agentEnabledStatus?.actionItems??[]).flatMap(e=>{let t;if(e.type===si.AllowConcurrentAgentsForContainer)t=!0;else{if(e.type!==si.DisallowConcurrentAgentsForContainer)return[];t=!1}return[{type:e.type,label:e.buttonText,onClick:t?()=>g(!0):()=>N({allowConcurrentAgents:!1})}]}),O=a(()=>{const e=[];return n.agentConfig?.traces?.headSampling?.noisyOperations?.length&&e.push(ke.HEAD_SAMPLING),(n.collectorConfig?.tailSampling?.noisyOperations?.length||n.collectorConfig?.tailSampling?.highlyRelevantOperations?.length||n.collectorConfig?.tailSampling?.costReductionRules?.length)&&e.push(ke.TAIL_SAMPLING),e},[n]);return e(Cm,{children:[e(T,{$gap:16,$alignItems:"center",$justifyContent:"space-between",$wrap:"wrap",children:[e(T,{$gap:8,$alignItems:"center",children:[t(km,{children:t(x,{size:24,fill:r?void 0:d.v2.colors.grey[400]})}),t(w,{children:o}),t(It,I?{variant:Mt.Blue,label:I}:{variant:Mt.Loader,label:ke.DETECTING_RUNTIME_INFO}),t(om,{overridden:m,onOverride:N,defaultValues:b,originalValues:{language:n.runtimeInfo?.language,version:n.runtimeInfo?.runtimeVersion||""}})]}),e(T,{$gap:8,$alignItems:"center",children:[t(E,{...$,textSize:C.XXXS}),t(am,{language:b.language,overridden:f,onOverride:N,defaultValues:y})]})]}),s&&(!s.agentEnabled||A.length>0)&&!S?t(Tm,{children:e(T,{$gap:10,$alignItems:"center",$justifyContent:"space-between",$wrap:"wrap",children:[e(T,{$gap:10,$alignItems:"center",children:[t(It,{variant:Mt.Pink,label:pt(s.agentEnabledStatus?.reasonEnum)||ke.NO_AVAILABLE_AGENT}),t(w,{size:C.XXXS,color:k.Secondary,children:s?.agentEnabledStatus?.message})]}),A.map(e=>t(j,{"data-id":`container-action-${e.type}`,label:e.label,variant:K.Secondary,size:W.S,onClick:e.onClick},e.type))]})}):null,O.length>0&&t(Tm,{children:t(T,{$gap:16,$wrap:"wrap",children:O.map((e,i)=>t(E,{label:e,leftIcon:$s,status:ie.Success,invertColors:!0,useSecondaryTone:!0},`${o}-rule-${i}`))})}),t(Ce,{isOpen:h,title:"Run Odigos with other agents?",description:"Running multiple instrumentation agents in the same container is not recommended and may affect performance or reliability.",onClose:()=>g(!1),denyButton:{label:"Cancel",variant:K.Secondary,onClick:()=>g(!1)},approveButton:{label:"Run Odigos With Other Agents",variant:K.Primary,onClick:async()=>{await N({allowConcurrentAgents:!0}),g(!1)}}})]})},$m=f($)`
|
|
661
661
|
gap: 12px;
|
|
662
662
|
width: 100%;
|
|
663
663
|
min-width: 0;
|
|
664
|
-
`,
|
|
664
|
+
`,Nm=f.div`
|
|
665
665
|
display: flex;
|
|
666
666
|
align-items: stretch;
|
|
667
667
|
gap: 10px;
|
|
668
668
|
width: 100%;
|
|
669
669
|
min-width: 0;
|
|
670
|
-
`,
|
|
670
|
+
`,Am=f.div`
|
|
671
671
|
display: flex;
|
|
672
672
|
flex: 2 1 0;
|
|
673
673
|
flex-direction: column;
|
|
@@ -707,21 +707,21 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
707
707
|
align-items: center;
|
|
708
708
|
justify-content: flex-end;
|
|
709
709
|
width: 100%;
|
|
710
|
-
`,
|
|
710
|
+
`,Xm=f.div`
|
|
711
711
|
flex: 1;
|
|
712
712
|
width: 100%;
|
|
713
713
|
min-height: 160px;
|
|
714
714
|
max-height: 320px;
|
|
715
715
|
overflow: auto;
|
|
716
716
|
padding: 0 12px 12px;
|
|
717
|
-
`,
|
|
717
|
+
`,Pm=f.pre`
|
|
718
718
|
margin: 0;
|
|
719
719
|
font-family: ${({theme:e})=>e.font_family.code};
|
|
720
720
|
font-size: 12px;
|
|
721
721
|
line-height: 20px;
|
|
722
722
|
color: ${({theme:e})=>e.v2.colors.green[400]};
|
|
723
723
|
white-space: pre;
|
|
724
|
-
`,
|
|
724
|
+
`,Lm=f.div`
|
|
725
725
|
display: flex;
|
|
726
726
|
flex-direction: column;
|
|
727
727
|
gap: 8px;
|
|
@@ -744,12 +744,12 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
744
744
|
&:hover {
|
|
745
745
|
color: ${({theme:e})=>e.v2.colors.purple[300]};
|
|
746
746
|
}
|
|
747
|
-
`,Bm=/(https?:\/\/[^\s)]+)/g,Um=e=>{const i=e.split(Bm);return 1===i.length?e:i.map((e,i)=>/^https?:\/\//.test(e)?t(Fm,{href:e,target:"_blank",rel:"noopener noreferrer",children:e},`note-link-${i}`):e)},Vm=({source:i})=>{const n=v(),{CopyButton:o}=at(),{sourcesApi:r}=
|
|
747
|
+
`,Bm=/(https?:\/\/[^\s)]+)/g,Um=e=>{const i=e.split(Bm);return 1===i.length?e:i.map((e,i)=>/^https?:\/\//.test(e)?t(Fm,{href:e,target:"_blank",rel:"noopener noreferrer",children:e},`note-link-${i}`):e)},Vm=({source:i})=>{const n=v(),{CopyButton:o}=at(),{sourcesApi:r}=Lc(),[s,c]=l(null),{data:d,unsupported:p}=r.useInstrumentationInstructions(i.id),u=d?.instrumentationInstructions??null,h=a(()=>u?.documents??[],[u]),g=a(()=>h.find(e=>e.variant===s)??h[0],[h,s]);if(p||!u||!g)return null;const m="manual"===u.mode?.trim().toLowerCase(),b=g.unresolved??[];return t(mt,{bgTint:"1000",withCollapse:!0,collapseIsDefaultOpen:m,richTitle:{title:ke.INSTRUMENTATION_INSTRUCTIONS_TITLE,subTitle:m?ke.INSTRUMENTATION_INSTRUCTIONS_MANUAL_SUBTITLE:ke.INSTRUMENTATION_INSTRUCTIONS_AUTOMATIC_SUBTITLE,subTitleWrap:!0},children:e($m,{children:[h.length>1&&t(F,{"data-id":"instrumentation-instructions-variant",size:rt.S,options:h.map(e=>({value:e.variant,label:e.variantLabel})),selected:g.variant,setSelected:c}),!!g.description&&t(w,{size:C.XXS,weight:400,lineHeight:"20px",color:k.Secondary,children:g.description}),e(Nm,{children:[g.steps.length>0&&e(Am,{children:[t(w,{size:C.XXS,weight:400,lineHeight:"20px",color:k.Primary,children:ke.INSTRUMENTATION_INSTRUCTIONS_STEPS_HEADING}),t(Om,{children:g.steps.map((i,a)=>e(Em,{children:[t(Dm,{children:t(w,{size:C.XXS,weight:400,lineHeight:"20px",color:n.v2.colors.purple[200],children:a+1})}),t(w,{size:C.XXS,weight:400,lineHeight:"20px",color:k.Primary,children:i})]},`${g.id}-step-${a}`))})]}),!!g.content&&e(Rm,{children:[t(zm,{children:t(o,{value:g.content,size:W.S})}),t(Xm,{children:t(Pm,{children:g.content})})]})]}),b.length>0&&e(Lm,{children:[t(w,{size:C.XXS,weight:600,lineHeight:"20px",color:k.Primary,children:ke.INSTRUMENTATION_INSTRUCTIONS_INPUTS_HEADING}),b.map(i=>e(Mm,{children:[t(w,{size:C.XXS,weight:600,lineHeight:"20px",color:k.Primary,children:t(_m,{children:i.placeholder})}),t(w,{size:C.XXS,weight:400,lineHeight:"20px",color:k.Secondary,children:i.description})]},`${g.id}-input-${i.placeholder}`))]}),u.notes.length>0&&e(Lm,{children:[t(w,{size:C.XXS,weight:600,lineHeight:"20px",color:k.Primary,children:ke.INSTRUMENTATION_INSTRUCTIONS_NOTES_HEADING}),u.notes.map((e,i)=>t(w,{size:C.XXS,weight:400,lineHeight:"20px",color:k.Secondary,children:Um(e)},`instrumentation-note-${i}`))]})]})})},Gm=({source:i,onClickRollout:n,onClickRollback:o})=>{const{isK8s:l,platformType:r,version:s}=Pr(),c=a(()=>ci(r,s)?dt(di(i.conditions)):[],[r,s,i.conditions]);return e($,{$gap:12,children:[t(Kg,{source:i}),t(qg,{source:i}),l&&t(Sm,{source:i,onClickRollout:n,onClickRollback:o}),!!c.length&&t(vt,{conditions:c,title:ke.INSTRUMENTATION_LIFECYCLE}),t(wm,{source:i}),!l&&!i.containers?.length&&t(hm,{source:i}),!l&&t(Vm,{source:i}),l&&t(Yg,{source:i})]})},Hm=({source:e})=>{const i=e.containers||[];return t(mt,{bgTint:"1000",richTitle:{title:ke.INSTRUMENTED_LIBRARIES},children:i.length?i.map(e=>{const i=e.instrumentations||[];return t(mt,{bgTint:"800",richTitle:{title:e.containerName,badge:{label:i.length}},withCollapse:!0,collapseIsDefaultOpen:!!i?.length,children:i?.length?t($,{children:i.map((e,i)=>t(Xt,{label:e.name,isStandardLibrary:e.isStandardLibrary,healthy:e.healthy,message:e.message},`instr-${i}-${e.name}`))}):t(Z,{title:"No libraries found"})},e.containerName)}):t(Z,{title:"No containers found"})})},jm=f($)`
|
|
748
748
|
width: 100%;
|
|
749
749
|
max-height: 320px;
|
|
750
750
|
overflow-y: auto;
|
|
751
751
|
gap: 8px;
|
|
752
|
-
`,
|
|
752
|
+
`,Wm=f(T)`
|
|
753
753
|
width: 100%;
|
|
754
754
|
align-items: center;
|
|
755
755
|
gap: 8px;
|
|
@@ -759,14 +759,14 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
759
759
|
& > * {
|
|
760
760
|
font-family: monospace !important;
|
|
761
761
|
}
|
|
762
|
-
`,Wm=({pendingModify:i,onClose:n,onConfirm:a})=>{const o=v();return t(Ce,{isOpen:!!i,title:'Modify the "Profiling Symbols" rule',description:'These changes are applied immediately to a single custom instrumentation rule named "Profiling Symbols".\nSelected symbols are added to it; unchecked symbols are removed from it (the rule is deleted once empty). Symbols managed by other rules are never touched.',onClose:n,denyButton:{variant:W.Secondary,label:"Cancel",onClick:n},approveButton:{variant:W.Primary,label:"Confirm",onClick:a},children:i&&e(jm,{children:[i.add.map(i=>e(Km,{children:[t(E,{leftIcon:ys,status:ie.Success,useSecondaryTone:!0,textColor:o.v2.colors.white[500],textSize:C.XXS}),t(w,{size:C.XS,color:k.Primary,children:i})]},`add-${i}`)),i.remove.map(i=>e(Km,{children:[t(E,{leftIcon:ic,status:ie.Error,useSecondaryTone:!0,textColor:o.v2.colors.white[500],textSize:C.XXS}),t(w,{size:C.XS,color:k.Primary,children:i})]},`remove-${i}`))]})})};function Ym(e,t){const i=e.names[t];if(null==i)return"";if("string"==typeof i)return i;if("object"==typeof i&&"name"in i){const e=i.name;if("string"==typeof e)return e}return"number"==typeof i||"boolean"==typeof i?String(i):""}function Jm(e){const t=Math.abs(e);return t>=1e9?`${qm(e/1e9)}s`:t>=1e6?`${qm(e/1e6)}ms`:t>=1e3?`${qm(e/1e3)}μs`:String(Math.round(e))}function qm(e){return e.toFixed(2).replace(/\.?0+$/,"")}function Zm(e){const t=[];for(let i=0;i<e.levels.length;i++){const n=e.levels[i];let a=0;for(let e=0;e+3<n.length;e+=4){const o=n[e],l=n[e+1],r=n[e+2],s=n[e+3],c=a+o;t.push({level:i,offset:c,size:l,self:r,nameIndex:s}),a=c+l}}return t}function Qm(e){return`${e.level}:${e.offset}:${e.size}:${e.nameIndex}`}function eb(e,t){return e.level===t.level&&e.offset===t.offset&&e.size===t.size&&e.nameIndex===t.nameIndex}function tb(e,t,i){return((e,t)=>{const i=[];for(let n=0;n<=t.level;n++){let a;for(const i of e)if(i.level===n&&t.offset>=i.offset&&t.offset+t.size<=i.offset+i.size){a=i;break}if(!a)return i;i.push(a)}return i})(t,i).map(t=>Ym(e,t.nameIndex))}function ib(e,t,i){if(0===i.length)return null;let n=null,a=null;for(let o=0;o<i.length;o++){const l=i[o];let r=null;for(const i of t)i.level===o&&Ym(e,i.nameIndex)===l&&(n&&(i.offset<n.offset||i.offset+i.size>n.offset+n.size)||(!r||i.size>r.size)&&(r=i));if(!r)return null;n=r,a=r}return a}function nb(e,t){const i=e.reduce((e,t)=>Math.max(e,t.level),t.level),n=new Map;for(const t of e){const e=n.get(t.level);e?e.push(t):n.set(t.level,[t])}const a=[t];for(let e=t.level+1;e<=i;e++){const t=a.filter(t=>t.level===e-1);if(0===t.length)break;const i=n.get(e);if(i?.length)for(const e of i)for(const i of t)if(e.offset>=i.offset&&e.offset+e.size<=i.offset+i.size){a.push(e);break}}return a}function ab(e,t){const i=t.trim().toLowerCase();return!i||e.toLowerCase().includes(i)}function ob(e,t){let i=0;for(let t=0;t<e.length;t++)i=31*i+e.charCodeAt(t)>>>0;const n=t.v2.colors.black[500],a=[{fill:t.v2.colors.purple[300],text:n},{fill:t.v2.colors.green[300],text:n},{fill:t.v2.colors.red[300],text:n},{fill:t.v2.colors.blue[300],text:n},{fill:t.v2.colors.yellow[300],text:n}];return a[i%a.length]}var lb,rb;function sb(e,t){return t<=0?"0":(100*e/t).toFixed(e/t<.001?2:1)}function cb(e,t,i){for(const n of i)if(e>=n.x&&e<n.x+n.w&&t>=n.y&&t<n.y+n.h)return n;return null}function db(e){return e>=1073741824?`${(e/1073741824).toFixed(1)} GiB`:e>=1048576?`${(e/1048576).toFixed(1)} MiB`:e>=1024?`${(e/1024).toFixed(1)} KiB`:`${e} B`}(e=>{e[e.Fit=1]="Fit",e[e.X10=10]="X10"})(lb||(lb={})),(e=>{e[e.Fit=1]="Fit",e[e.X10=10]="X10"})(rb||(rb={}));const pb=({flamebearer:i,maxRowPx:n,searchQuery:r="",shouldKeepName:s,minHostHeight:c=200,onFullscreenChange:u,profilingSlots:h,onFrameClick:g,onZoomedSymbolsChange:b,onResetZoom:f})=>{const y=v(),S=p(null),x=p(null),I=p({x:0,y:0}),[$,A]=l({w:0,h:0}),[N,O]=l(""),[E,D]=l(null),[R,z]=l([]),[L,X]=l(!1),[_,B]=l(lb.Fit),[U,V]=l(rb.Fit),[G,H]=l(!1),Y=Math.max(1,Math.min(Math.floor($.w*_),8192)),J=Math.max(1,Math.min(Math.floor($.h*U),8192)),q=R.length>0?R[R.length-1]:null,Z=q?.size??i.numTicks,Q=a(()=>Zm(i),[i]),ee=p({fb:i,rects:Q});o(()=>{const e=ee.current;e.fb!==i&&(ee.current={fb:i,rects:Q},z(t=>{if(0===t.length)return t;const n=((e,t,i,n,a)=>{const o=[];for(const l of a){const a=tb(e,t,l);if(0===a.length)break;const r=ib(i,n,a);if(!r)break;o.push(r)}return o})(e.fb,e.rects,i,Q,t);return n.length===t.length&&n.every((e,i)=>eb(e,t[i]))?t:n}))},[i,Q]),o(()=>{if(!b)return;if(!q)return void b(null);const e=nb(Q,q),t=new Set;for(const n of e){const e=Ym(i,n.nameIndex);e&&t.add(e)}b([...t])},[q,i,Q,b]),m(()=>{const e=S.current;if(!e)return;const t=new ResizeObserver(()=>{const t=e.getBoundingClientRect();A({w:Math.floor(t.width),h:Math.floor(t.height)})});return t.observe(e),()=>t.disconnect()},[]),o(()=>{if(!L)return;const e=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=e}},[L]),o(()=>(u?.(L),()=>{L&&u?.(!1)}),[L,u]);const te=a(()=>function(e,t,i,n,a,o={}){if(0===e.levels.length||t<2||i<2)return null;const{zoomRoot:l=null,shouldKeepName:r,collapseRecursive:s=!1,allRects:c}=o,d=c??Zm(e);let p=l?nb(d,l):d;if(0===p.length)return null;if(r&&(p=p.filter(t=>r(Ym(e,t.nameIndex))),0===p.length))return null;if(s&&(p=((e,t)=>{if(0===t.length)return t;const i=[...t].sort((e,t)=>e.level-t.level||e.offset-t.offset),n=new Map;for(const e of i){const t=n.get(e.level);t?t.push(e):n.set(e.level,[e])}const a=new Set;for(const t of i){const i=n.get(t.level+1);if(!i)continue;const o=i.filter(e=>e.offset>=t.offset&&e.offset+e.size<=t.offset+t.size);if(1!==o.length)continue;const l=o[0];l.size===t.size&&Ym(e,l.nameIndex)===Ym(e,t.nameIndex)&&a.add(Qm(l))}if(0===a.size)return i;const o=[];for(const e of i){if(a.has(Qm(e)))continue;let t=0;for(let i=0;i<e.level;i++){const o=n.get(i);if(!o)continue;const l=o.find(t=>e.offset>=t.offset&&e.offset+e.size<=t.offset+t.size);l&&a.has(Qm(l))&&t++}o.push({...e,level:e.level-t})}return o})(e,p),0===p.length))return null;const u=l?.level??0,h=l?.offset??0,g=l?.size??e.numTicks;if(g<=0)return null;const m=p.reduce((e,t)=>Math.max(e,t.level-u),0)+1,b=n??Number.POSITIVE_INFINITY,f=Math.max(1,Math.min(i/m,b)),v=a.trim(),y=f>8?1:0;return p.map(i=>{const n=i.level-u,a=(i.offset-h)/g*t,o=Math.max(i.size/g*t,1),l=n*f,r=Math.max(f-y,1),s=Ym(e,i.nameIndex);return{...i,x:a,y:l,w:o,h:r,name:s,matchesSearch:ab(s,v)}})}(i,Y,J,n,r,{zoomRoot:q,shouldKeepName:s,collapseRecursive:G,allRects:Q}),[i,n,r,J,Y,q,s,G,Q]),ie=a(()=>(e=>[...e].sort((e,t)=>t.level-e.level))(te?.length?r.trim()?te.filter(e=>e.matchesSearch):te:[]),[te,r]),ne=d(e=>{if(Y<2||J<2)return;const t=e.currentTarget.getBoundingClientRect();if(t.width<1||t.height<1)return;const n=cb((e.clientX-t.left)/t.width*Y,(e.clientY-t.top)/t.height*J,ie);if(n){const e=Qm(n);D(e);const t=Z>0?(100*n.size/Z).toFixed(1):"0",a=i.numTicks>0?(100*n.size/i.numTicks).toFixed(1):"0";O(`${n.name}\ntotal ${Jm(n.size)} (${t}% of view, ${a}% of profile) · self ${Jm(n.self)}`)}else D(null),O("")},[ie,i.numTicks,J,Y,Z]),ae=d(e=>{ne(e)},[ne]),oe=d(()=>{D(null),O("")},[]),le=d(e=>{I.current={x:e.clientX,y:e.clientY}},[]),re=d(e=>{const{x:t,y:i}=I.current;if(Math.abs(e.clientX-t)>3||Math.abs(e.clientY-i)>3)return;if(Y<2||J<2)return;const n=e.currentTarget.getBoundingClientRect();if(n.width<1||n.height<1)return;const a=cb((e.clientX-n.left)/n.width*Y,(e.clientY-n.top)/n.height*J,ie);if(!a)return;g?.(a.name);const o=(e=>({level:e.level,offset:e.offset,size:e.size,self:e.self,nameIndex:e.nameIndex}))(a);z(e=>{const t=e.length>0?e[e.length-1]:null;return t&&eb(o,t)?e.slice(0,-1):[...e,o]})},[ie,J,Y,g]);m(()=>{const e=x.current;if(!e||Y<2||J<2)return;const t="undefined"!=typeof window&&window.devicePixelRatio||1,n=Math.max(Y,J),a=Math.min(t,16384/n);e.width=Math.floor(Y*a),e.height=Math.floor(J*a),e.style.width=`${Y}px`,e.style.height=`${J}px`;const o=e.getContext("2d");o&&(o.setTransform(a,0,0,a,0,0),o.clearRect(0,0,Y,J),te?.length?((e,t,i,n,a,o,l,r)=>{const s=o.v2.colors.silver[900];e.fillStyle=s,e.fillRect(0,0,t,i);const c=a.trim().length>0;e.textRendering="optimizeLegibility";for(const t of n){const{x:i,y:n,w:a,h:l,name:s,size:d,matchesSearch:p}=t;if(c&&!p)continue;const{fill:u,text:h}=ob(s,o);e.fillStyle=u,e.fillRect(i,n,a,l),e.strokeStyle="rgba(255,255,255,0.14)",e.lineWidth=1,e.beginPath(),e.moveTo(i+.5,n+.5),e.lineTo(i+a-.5,n+.5),e.stroke(),e.strokeStyle="rgba(0,0,0,0.45)",e.lineWidth=1,e.strokeRect(i+.5,n+.5,Math.max(a-1,0),Math.max(l-1,0));const g=sb(d,r),m=`${s} (${Jm(d)}, ${g}%)`,b=o.v2.text.size.xs,f=8,v=5,y=26,S=Math.min(b,Math.floor(l-2));if(a>=y&&S>=f){e.font=`${S}px ${o.font_family.primary}, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif`,e.textBaseline="middle",e.textAlign="left";let t=m;for(;t.length>2&&e.measureText(t).width>a-2*v;)t=`${t.slice(0,-2)}…`;e.measureText(t).width<=a-2*v&&(e.lineWidth=1,e.strokeStyle="rgba(0, 0, 0, 0.5)",e.lineJoin="round",e.miterLimit=1,e.strokeText(t,i+v,n+l/2),e.fillStyle=h,e.fillText(t,i+v,n+l/2))}}if(l)for(const t of n){if(Qm(t)!==l)continue;if(c&&!t.matchesSearch)continue;const{x:i,y:n,w:a,h:o}=t;e.strokeStyle="rgba(255,255,255,0.88)",e.lineWidth=2,e.strokeRect(i+1,n+1,Math.max(a-2,0),Math.max(o-2,0));break}})(o,Y,J,te,r,y,E,i.numTicks):(o.fillStyle=y.v2.colors.silver[900],o.fillRect(0,0,Y,J)))},[te,i.numTicks,E,r,J,Y,y]);const se=d(()=>X(e=>!e),[]),de=i.numTicks>0?Math.max(0,Math.min(100,Math.round(Z/i.numTicks*100))):100,pe=a(()=>((e,t,i)=>{const n=i??Zm(e),a=t?.offset??0,o=a+(t?.size??e.numTicks),l=(t?.level??-1)+1,r=t?.size??e.numTicks;let s=null;for(const e of n)e.level<l||e.offset<a||e.offset+e.size>o||e.size>=r||(!s||e.size>s.size||e.size===s.size&&e.level<s.level)&&(s=e);return s})(i,q,Q),[i,q,Q]),ue=null!==pe,he=R.length>0,ge=q?Ym(i,q.nameIndex):"",me=d(()=>{z([]),f?.()},[f]),be=d(()=>z(e=>e.slice(0,-1)),[]),fe=d(()=>{pe&&z(e=>[...e,pe])},[pe]);return e("div",{style:L?{position:"fixed",inset:0,zIndex:9999,display:"flex",flexDirection:"column",gap:8,padding:16,background:y.v2.colors.silver[900]}:{flex:1,minHeight:c,minWidth:0,width:"100%",display:"flex",flexDirection:"column",gap:8,position:"relative"},children:[e(T,{$gap:8,$wrap:"nowrap",$justifyContent:"space-between",children:[t(P,{label:"Collapse recursive",tooltip:"Collapse straight-line recursion (parent → single same-name child of equal width) into a single bar. Helps deep recursive call chains fit on screen.",labelAlign:M.Left,size:qe.S,value:G,onChange:H}),e(T,{$gap:8,children:[e(T,{children:[t(j,{variant:W.Secondary,size:K.S,label:"Reset zoom",leftIcon:nc,onClick:me,disabled:!R.length}),t(j,{variant:W.Secondary,size:K.S,iconSize:20,leftIcon:ic,tooltip:"Zoom out",hideTooltipIcon:!0,disabled:!he,onClick:be}),t("div",{style:{minWidth:36,textAlign:"center",fontVariantNumeric:"tabular-nums"},children:t(w,{size:C.XXS,color:k.Secondary,nowrap:!0,align:"center",children:`${de}%`})}),t(j,{variant:W.Secondary,size:K.S,iconSize:20,leftIcon:ys,tooltip:"Zoom in",hideTooltipIcon:!0,disabled:!ue,onClick:fe})]}),e(T,{children:[t(ce,{text:"Horizontal width: stretch the canvas wider than the viewport so narrow stacks become hoverable / readable.",children:t(F,{variant:pi.Filled,options:[{value:lb.Fit,label:"W: Fit"},{value:lb.X10,label:"10x"}],selected:_,setSelected:B})}),t(ce,{text:"Vertical height: scale rows taller than the viewport for deep call stacks. Scroll vertically to navigate.",children:t(F,{variant:pi.Filled,options:[{value:rb.Fit,label:"H: Fit"},{value:rb.X10,label:"10x"}],selected:U,setSelected:V})})]}),t(j,{variant:W.Secondary,size:K.S,iconSize:24,leftIcon:L?Rs:ac,tooltip:L?"Exit fullscreen (Esc)":"Fullscreen",hideTooltipIcon:!0,onClick:se})]})]}),t(ce,{fullWidth:!0,keepAlive:!0,text:N,children:t("div",{ref:S,style:{flex:1,minWidth:0,width:"100%",height:L?"calc(100vh - 80px)":"calc(100vh - 364px)",position:"relative",overflow:"hidden"},children:t("div",{style:{position:"absolute",inset:0,overflowX:_>1?"auto":"hidden",overflowY:U>1?"auto":"hidden"},children:t("div",{style:{width:Y||"100%",height:J||"100%",position:"relative"},children:t("canvas",{ref:x,style:{display:"block",position:"absolute",left:0,top:0,width:"100%",height:"100%",borderRadius:8,cursor:E?"pointer":"default"},onPointerDown:le,onPointerMove:ae,onPointerLeave:oe,onClick:re})})})})}),e(T,{$justifyContent:"space-between",children:[t(w,q?{size:C.XXXS,color:y.v2.colors.silver[300],children:`Zoomed: ${ge} • ${Jm(Z)} samples in view`}:{size:C.XXXS,color:y.v2.colors.silver[300],children:g?"Click a frame to zoom in and jump to its row in the symbol table.":"Click a frame to zoom into its subtree (pprof-style)."}),h&&t(w,{size:C.XXXS,color:y.v2.colors.silver[300],children:`${h.activeKeys.length} / ${h.maxSlots} profiling slots · ${db(h.totalBytesUsed)} / ${db(h.maxTotalBytesBudget)} budget · TTL ${h.slotTtlSeconds}s`})]})]})},ub=[ai.Go,ai.Java],hb="Profiling Symbols";function gb(e,t){if(0===t.length)return null;const i=1===t.length?t[0]:(e=>e.includes("/")||/\.\(\*?[^)]+\)\./.test(e)?ai.Go:e.includes(" ")||e.includes("(")?ai.Java:ai.Go)(e);if(i===ai.Go){const t=(e=>{let t=e.trim();if(!t)return null;t=t.replace(/\[[^\]]*\]/g,"");const i=t.lastIndexOf("/"),n=t.indexOf(".",i+1);if(-1===n)return null;const a=t.slice(0,n),o=t.slice(n+1);if(!a||!o)return null;const l=o.match(/^\(\*?([^)]+)\)\.(.+)$/);if(l){const e=new ue(a,"",l[1],l[2]);return e.Verify()?e:null}const r=new ue(a,o);return r.Verify()?r:null})(e);return t?{language:i,golang:t}:null}if(i===ai.Java){const t=(e=>{let t=e.trim();if(!t)return null;const i=t.indexOf("(");-1!==i&&(t=t.slice(0,i).trim());const n=t.split(/\s+/);t=n[n.length-1]??"";const a=t.lastIndexOf(".");if(-1===a)return null;const o=t.slice(0,a),l=t.slice(a+1),r=new he(o,l);return r.Verify()?r:null})(e);return t?{language:i,java:t}:null}return null}function mb(e,t){return e.namespace===t.namespace&&e.name===t.name&&e.kind===t.kind}function bb(e,t,i){if(!e)return!0;const{sources:n=[],namespaces:a=[],languages:o=[]}=e,l=!n.length||n.some(e=>mb(e,t.id)),r=!a.length||a.includes(t.id.namespace),s=!o.length||null==i||o.includes(i);return l&&r&&s}function fb(e,t){return e.packageName===t.packageName&&(e.functionName||"")===(t.functionName||"")&&(e.receiverName||"")===(t.receiverName||"")&&(e.receiverMethodName||"")===(t.receiverMethodName||"")}function vb(e,t){return e.className===t.className&&e.methodName===t.methodName}function yb(e,t,i,n){const a=gb(e,i);if(!a)return[];const o=[];for(const e of n){const i=e.customInstrumentations;if(!i)continue;if(!bb(e.sourceScopes,t,a.language))continue;const n=!!a.golang&&!!i[me.Golang]?.some(e=>fb(e,a.golang)),l=!!a.java&&!!i[me.Java]?.some(e=>vb(e,a.java));(n||l)&&o.push({rule:e,resolved:a})}return o}var Sb,xb,wb;(e=>{e.Symbol="symbol",e.Self="self",e.Total="total"})(Sb||(Sb={})),(e=>{e.OnlyInstrumentable="only-instrumentable"})(xb||(xb={})),(e=>{e.FilterOutVoid="filter-out-void",e.OnlyWithReturnValues="only-with-return-values"})(wb||(wb={}));const Cb=/^[A-Za-z_$][A-Za-z0-9_$]*(\[\])*$/;function kb(e,t){const i=(e=>e.split(" ")[0]??"")(e);return(!t.includes(wb.FilterOutVoid)||"void"!==i)&&!!(!t.includes(wb.OnlyWithReturnValues)||e.includes(" ")&&"void"!==i&&Cb.test(i))}const Tb=({rows:e,languages:i,instrumentation:n,searchQuery:o,filters:l,onFiltersChange:r,zoomedSymbols:s,highlightSymbol:c,scrollSignal:p})=>{const u=!!i?.includes(ai.Java),h=a(()=>{const t=s?new Set(s):null,i=o?.trim().toLowerCase();return e.filter(e=>(!t||t.has(e.name))&&(!i||e.name.toLowerCase().includes(i)))},[e,o,s]),g=a(()=>{const e=[];if(n.selectionEnabled&&e.push({id:xb.OnlyInstrumentable,label:"Only show instrumentable symbols"}),u&&(e.push({id:wb.FilterOutVoid,label:"Filter out void symbols"}),e.push({id:wb.OnlyWithReturnValues,label:"Only show functions with return values"})),0!==e.length)return{options:e,filterRow:(e,t)=>{const i=e.cells.find(e=>e.key===Sb.Symbol)?.rawValue?.toString()??"";return!(t.includes(xb.OnlyInstrumentable)&&!n.getSymbolState(i).showCheckbox)&&kb(i,t)}}},[n,u]),m=a(()=>[{key:Sb.Symbol,label:"Symbol",flex:"0 0 160px",filterOverride:g,noFilter:!g},{key:Sb.Self,label:"Self",tooltip:"Time spent in this function itself, excluding time in functions it calls.",textAlign:"right",noFilter:!0},{key:Sb.Total,label:"Total",tooltip:"Time spent in this function and all functions it calls (inclusive).",textAlign:"right",noFilter:!0}],[g]),b=a(()=>h.map(e=>{const t=n.getSymbolState(e.name),i=t.showCheckbox;return{id:e.name,cells:[{key:Sb.Symbol,rawValue:e.name},{key:Sb.Self,rawValue:Jm(e.self)},{key:Sb.Total,rawValue:Jm(e.total)}],isSelected:i?n.isSelected(e.name):void 0,onSelect:i?()=>n.onToggleSymbol(e.name,!0):void 0,onDeselect:i?()=>n.onToggleSymbol(e.name,!1):void 0,hideCheckbox:!i,checkboxDisabled:i?t.checkboxDisabled:void 0,checkboxTooltip:i?t.checkboxTooltip:void 0}}),[h,n]),f=d(e=>{const t=e.cells[0].rawValue,i=n.getSymbolState(t),a=[];return i.inManagedRule?a.push({id:`remove-instrumentation-${t}`,label:"",leftIcon:vs,tooltip:"Remove from the “Profiling Symbols” rule",onClick:()=>n.onRemove(t)}):a.push({id:`add-instrumentation-${t}`,label:"",leftIcon:ys,tooltip:i.addTooltip,disabled:!i.addEnabled,onClick:()=>n.onAdd(t)}),a.push({id:`copy-${t}`,label:"",leftIcon:oc,tooltip:"Copy symbol name",onClick:()=>{navigator.clipboard.writeText(t)}}),a},[n]);return t(ui,{variant:hi.Data,maxHeight:"calc(100vh - 306px)",columns:m,rows:b,withCheckboxes:n.selectionEnabled,filters:l,onFiltersChange:r,activeRowId:c,scrollSignal:p,getRowActions:f})};var Ib;(e=>{e.Table="table",e.Flame="flame",e.Both="both"})(Ib||(Ib={}));const $b=f($)`
|
|
762
|
+
`,Km=({pendingModify:i,onClose:n,onConfirm:a})=>{const o=v();return t(Ce,{isOpen:!!i,title:'Modify the "Profiling Symbols" rule',description:'These changes are applied immediately to a single custom instrumentation rule named "Profiling Symbols".\nSelected symbols are added to it; unchecked symbols are removed from it (the rule is deleted once empty). Symbols managed by other rules are never touched.',onClose:n,denyButton:{variant:K.Secondary,label:"Cancel",onClick:n},approveButton:{variant:K.Primary,label:"Confirm",onClick:a},children:i&&e(jm,{children:[i.add.map(i=>e(Wm,{children:[t(E,{leftIcon:ys,status:ie.Success,useSecondaryTone:!0,textColor:o.v2.colors.white[500],textSize:C.XXS}),t(w,{size:C.XS,color:k.Primary,children:i})]},`add-${i}`)),i.remove.map(i=>e(Wm,{children:[t(E,{leftIcon:ic,status:ie.Error,useSecondaryTone:!0,textColor:o.v2.colors.white[500],textSize:C.XXS}),t(w,{size:C.XS,color:k.Primary,children:i})]},`remove-${i}`))]})})};function Ym(e,t){const i=e.names[t];if(null==i)return"";if("string"==typeof i)return i;if("object"==typeof i&&"name"in i){const e=i.name;if("string"==typeof e)return e}return"number"==typeof i||"boolean"==typeof i?String(i):""}function qm(e){const t=Math.abs(e);return t>=1e9?`${Jm(e/1e9)}s`:t>=1e6?`${Jm(e/1e6)}ms`:t>=1e3?`${Jm(e/1e3)}μs`:String(Math.round(e))}function Jm(e){return e.toFixed(2).replace(/\.?0+$/,"")}function Zm(e){const t=[];for(let i=0;i<e.levels.length;i++){const n=e.levels[i];let a=0;for(let e=0;e+3<n.length;e+=4){const o=n[e],l=n[e+1],r=n[e+2],s=n[e+3],c=a+o;t.push({level:i,offset:c,size:l,self:r,nameIndex:s}),a=c+l}}return t}function Qm(e){return`${e.level}:${e.offset}:${e.size}:${e.nameIndex}`}function eb(e,t){return e.level===t.level&&e.offset===t.offset&&e.size===t.size&&e.nameIndex===t.nameIndex}function tb(e,t,i){return((e,t)=>{const i=[];for(let n=0;n<=t.level;n++){let a;for(const i of e)if(i.level===n&&t.offset>=i.offset&&t.offset+t.size<=i.offset+i.size){a=i;break}if(!a)return i;i.push(a)}return i})(t,i).map(t=>Ym(e,t.nameIndex))}function ib(e,t,i){if(0===i.length)return null;let n=null,a=null;for(let o=0;o<i.length;o++){const l=i[o];let r=null;for(const i of t)i.level===o&&Ym(e,i.nameIndex)===l&&(n&&(i.offset<n.offset||i.offset+i.size>n.offset+n.size)||(!r||i.size>r.size)&&(r=i));if(!r)return null;n=r,a=r}return a}function nb(e,t){const i=e.reduce((e,t)=>Math.max(e,t.level),t.level),n=new Map;for(const t of e){const e=n.get(t.level);e?e.push(t):n.set(t.level,[t])}const a=[t];for(let e=t.level+1;e<=i;e++){const t=a.filter(t=>t.level===e-1);if(0===t.length)break;const i=n.get(e);if(i?.length)for(const e of i)for(const i of t)if(e.offset>=i.offset&&e.offset+e.size<=i.offset+i.size){a.push(e);break}}return a}function ab(e,t){const i=t.trim().toLowerCase();return!i||e.toLowerCase().includes(i)}function ob(e,t){let i=0;for(let t=0;t<e.length;t++)i=31*i+e.charCodeAt(t)>>>0;const n=t.v2.colors.black[500],a=[{fill:t.v2.colors.purple[300],text:n},{fill:t.v2.colors.green[300],text:n},{fill:t.v2.colors.red[300],text:n},{fill:t.v2.colors.blue[300],text:n},{fill:t.v2.colors.yellow[300],text:n}];return a[i%a.length]}var lb,rb;function sb(e,t){return t<=0?"0":(100*e/t).toFixed(e/t<.001?2:1)}function cb(e,t,i){for(const n of i)if(e>=n.x&&e<n.x+n.w&&t>=n.y&&t<n.y+n.h)return n;return null}function db(e){return e>=1073741824?`${(e/1073741824).toFixed(1)} GiB`:e>=1048576?`${(e/1048576).toFixed(1)} MiB`:e>=1024?`${(e/1024).toFixed(1)} KiB`:`${e} B`}(e=>{e[e.Fit=1]="Fit",e[e.X10=10]="X10"})(lb||(lb={})),(e=>{e[e.Fit=1]="Fit",e[e.X10=10]="X10"})(rb||(rb={}));const pb=({flamebearer:i,maxRowPx:n,searchQuery:r="",shouldKeepName:s,minHostHeight:c=200,onFullscreenChange:u,profilingSlots:h,onFrameClick:g,onZoomedSymbolsChange:b,onResetZoom:f})=>{const y=v(),S=p(null),x=p(null),I=p({x:0,y:0}),[$,N]=l({w:0,h:0}),[A,O]=l(""),[E,D]=l(null),[R,z]=l([]),[X,P]=l(!1),[_,B]=l(lb.Fit),[U,V]=l(rb.Fit),[G,H]=l(!1),Y=Math.max(1,Math.min(Math.floor($.w*_),8192)),q=Math.max(1,Math.min(Math.floor($.h*U),8192)),J=R.length>0?R[R.length-1]:null,Z=J?.size??i.numTicks,Q=a(()=>Zm(i),[i]),ee=p({fb:i,rects:Q});o(()=>{const e=ee.current;e.fb!==i&&(ee.current={fb:i,rects:Q},z(t=>{if(0===t.length)return t;const n=((e,t,i,n,a)=>{const o=[];for(const l of a){const a=tb(e,t,l);if(0===a.length)break;const r=ib(i,n,a);if(!r)break;o.push(r)}return o})(e.fb,e.rects,i,Q,t);return n.length===t.length&&n.every((e,i)=>eb(e,t[i]))?t:n}))},[i,Q]),o(()=>{if(!b)return;if(!J)return void b(null);const e=nb(Q,J),t=new Set;for(const n of e){const e=Ym(i,n.nameIndex);e&&t.add(e)}b([...t])},[J,i,Q,b]),m(()=>{const e=S.current;if(!e)return;const t=new ResizeObserver(()=>{const t=e.getBoundingClientRect();N({w:Math.floor(t.width),h:Math.floor(t.height)})});return t.observe(e),()=>t.disconnect()},[]),o(()=>{if(!X)return;const e=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=e}},[X]),o(()=>(u?.(X),()=>{X&&u?.(!1)}),[X,u]);const te=a(()=>function(e,t,i,n,a,o={}){if(0===e.levels.length||t<2||i<2)return null;const{zoomRoot:l=null,shouldKeepName:r,collapseRecursive:s=!1,allRects:c}=o,d=c??Zm(e);let p=l?nb(d,l):d;if(0===p.length)return null;if(r&&(p=p.filter(t=>r(Ym(e,t.nameIndex))),0===p.length))return null;if(s&&(p=((e,t)=>{if(0===t.length)return t;const i=[...t].sort((e,t)=>e.level-t.level||e.offset-t.offset),n=new Map;for(const e of i){const t=n.get(e.level);t?t.push(e):n.set(e.level,[e])}const a=new Set;for(const t of i){const i=n.get(t.level+1);if(!i)continue;const o=i.filter(e=>e.offset>=t.offset&&e.offset+e.size<=t.offset+t.size);if(1!==o.length)continue;const l=o[0];l.size===t.size&&Ym(e,l.nameIndex)===Ym(e,t.nameIndex)&&a.add(Qm(l))}if(0===a.size)return i;const o=[];for(const e of i){if(a.has(Qm(e)))continue;let t=0;for(let i=0;i<e.level;i++){const o=n.get(i);if(!o)continue;const l=o.find(t=>e.offset>=t.offset&&e.offset+e.size<=t.offset+t.size);l&&a.has(Qm(l))&&t++}o.push({...e,level:e.level-t})}return o})(e,p),0===p.length))return null;const u=l?.level??0,h=l?.offset??0,g=l?.size??e.numTicks;if(g<=0)return null;const m=p.reduce((e,t)=>Math.max(e,t.level-u),0)+1,b=n??Number.POSITIVE_INFINITY,f=Math.max(1,Math.min(i/m,b)),v=a.trim(),y=f>8?1:0;return p.map(i=>{const n=i.level-u,a=(i.offset-h)/g*t,o=Math.max(i.size/g*t,1),l=n*f,r=Math.max(f-y,1),s=Ym(e,i.nameIndex);return{...i,x:a,y:l,w:o,h:r,name:s,matchesSearch:ab(s,v)}})}(i,Y,q,n,r,{zoomRoot:J,shouldKeepName:s,collapseRecursive:G,allRects:Q}),[i,n,r,q,Y,J,s,G,Q]),ie=a(()=>(e=>[...e].sort((e,t)=>t.level-e.level))(te?.length?r.trim()?te.filter(e=>e.matchesSearch):te:[]),[te,r]),ne=d(e=>{if(Y<2||q<2)return;const t=e.currentTarget.getBoundingClientRect();if(t.width<1||t.height<1)return;const n=cb((e.clientX-t.left)/t.width*Y,(e.clientY-t.top)/t.height*q,ie);if(n){const e=Qm(n);D(e);const t=Z>0?(100*n.size/Z).toFixed(1):"0",a=i.numTicks>0?(100*n.size/i.numTicks).toFixed(1):"0";O(`${n.name}\ntotal ${qm(n.size)} (${t}% of view, ${a}% of profile) · self ${qm(n.self)}`)}else D(null),O("")},[ie,i.numTicks,q,Y,Z]),ae=d(e=>{ne(e)},[ne]),oe=d(()=>{D(null),O("")},[]),le=d(e=>{I.current={x:e.clientX,y:e.clientY}},[]),re=d(e=>{const{x:t,y:i}=I.current;if(Math.abs(e.clientX-t)>3||Math.abs(e.clientY-i)>3)return;if(Y<2||q<2)return;const n=e.currentTarget.getBoundingClientRect();if(n.width<1||n.height<1)return;const a=cb((e.clientX-n.left)/n.width*Y,(e.clientY-n.top)/n.height*q,ie);if(!a)return;g?.(a.name);const o=(e=>({level:e.level,offset:e.offset,size:e.size,self:e.self,nameIndex:e.nameIndex}))(a);z(e=>{const t=e.length>0?e[e.length-1]:null;return t&&eb(o,t)?e.slice(0,-1):[...e,o]})},[ie,q,Y,g]);m(()=>{const e=x.current;if(!e||Y<2||q<2)return;const t="undefined"!=typeof window&&window.devicePixelRatio||1,n=Math.max(Y,q),a=Math.min(t,16384/n);e.width=Math.floor(Y*a),e.height=Math.floor(q*a),e.style.width=`${Y}px`,e.style.height=`${q}px`;const o=e.getContext("2d");o&&(o.setTransform(a,0,0,a,0,0),o.clearRect(0,0,Y,q),te?.length?((e,t,i,n,a,o,l,r)=>{const s=o.v2.colors.silver[900];e.fillStyle=s,e.fillRect(0,0,t,i);const c=a.trim().length>0;e.textRendering="optimizeLegibility";for(const t of n){const{x:i,y:n,w:a,h:l,name:s,size:d,matchesSearch:p}=t;if(c&&!p)continue;const{fill:u,text:h}=ob(s,o);e.fillStyle=u,e.fillRect(i,n,a,l),e.strokeStyle="rgba(255,255,255,0.14)",e.lineWidth=1,e.beginPath(),e.moveTo(i+.5,n+.5),e.lineTo(i+a-.5,n+.5),e.stroke(),e.strokeStyle="rgba(0,0,0,0.45)",e.lineWidth=1,e.strokeRect(i+.5,n+.5,Math.max(a-1,0),Math.max(l-1,0));const g=sb(d,r),m=`${s} (${qm(d)}, ${g}%)`,b=o.v2.text.size.xs,f=8,v=5,y=26,S=Math.min(b,Math.floor(l-2));if(a>=y&&S>=f){e.font=`${S}px ${o.font_family.primary}, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif`,e.textBaseline="middle",e.textAlign="left";let t=m;for(;t.length>2&&e.measureText(t).width>a-2*v;)t=`${t.slice(0,-2)}…`;e.measureText(t).width<=a-2*v&&(e.lineWidth=1,e.strokeStyle="rgba(0, 0, 0, 0.5)",e.lineJoin="round",e.miterLimit=1,e.strokeText(t,i+v,n+l/2),e.fillStyle=h,e.fillText(t,i+v,n+l/2))}}if(l)for(const t of n){if(Qm(t)!==l)continue;if(c&&!t.matchesSearch)continue;const{x:i,y:n,w:a,h:o}=t;e.strokeStyle="rgba(255,255,255,0.88)",e.lineWidth=2,e.strokeRect(i+1,n+1,Math.max(a-2,0),Math.max(o-2,0));break}})(o,Y,q,te,r,y,E,i.numTicks):(o.fillStyle=y.v2.colors.silver[900],o.fillRect(0,0,Y,q)))},[te,i.numTicks,E,r,q,Y,y]);const se=d(()=>P(e=>!e),[]),de=i.numTicks>0?Math.max(0,Math.min(100,Math.round(Z/i.numTicks*100))):100,pe=a(()=>((e,t,i)=>{const n=i??Zm(e),a=t?.offset??0,o=a+(t?.size??e.numTicks),l=(t?.level??-1)+1,r=t?.size??e.numTicks;let s=null;for(const e of n)e.level<l||e.offset<a||e.offset+e.size>o||e.size>=r||(!s||e.size>s.size||e.size===s.size&&e.level<s.level)&&(s=e);return s})(i,J,Q),[i,J,Q]),ue=null!==pe,he=R.length>0,ge=J?Ym(i,J.nameIndex):"",me=d(()=>{z([]),f?.()},[f]),be=d(()=>z(e=>e.slice(0,-1)),[]),fe=d(()=>{pe&&z(e=>[...e,pe])},[pe]);return e("div",{style:X?{position:"fixed",inset:0,zIndex:9999,display:"flex",flexDirection:"column",gap:8,padding:16,background:y.v2.colors.silver[900]}:{flex:1,minHeight:c,minWidth:0,width:"100%",display:"flex",flexDirection:"column",gap:8,position:"relative"},children:[e(T,{$gap:8,$wrap:"nowrap",$justifyContent:"space-between",children:[t(L,{label:"Collapse recursive",tooltip:"Collapse straight-line recursion (parent → single same-name child of equal width) into a single bar. Helps deep recursive call chains fit on screen.",labelAlign:M.Left,size:Je.S,value:G,onChange:H}),e(T,{$gap:8,children:[e(T,{children:[t(j,{variant:K.Secondary,size:W.S,label:"Reset zoom",leftIcon:nc,onClick:me,disabled:!R.length}),t(j,{variant:K.Secondary,size:W.S,iconSize:20,leftIcon:ic,tooltip:"Zoom out",hideTooltipIcon:!0,disabled:!he,onClick:be}),t("div",{style:{minWidth:36,textAlign:"center",fontVariantNumeric:"tabular-nums"},children:t(w,{size:C.XXS,color:k.Secondary,nowrap:!0,align:"center",children:`${de}%`})}),t(j,{variant:K.Secondary,size:W.S,iconSize:20,leftIcon:ys,tooltip:"Zoom in",hideTooltipIcon:!0,disabled:!ue,onClick:fe})]}),e(T,{children:[t(ce,{text:"Horizontal width: stretch the canvas wider than the viewport so narrow stacks become hoverable / readable.",children:t(F,{variant:pi.Filled,options:[{value:lb.Fit,label:"W: Fit"},{value:lb.X10,label:"10x"}],selected:_,setSelected:B})}),t(ce,{text:"Vertical height: scale rows taller than the viewport for deep call stacks. Scroll vertically to navigate.",children:t(F,{variant:pi.Filled,options:[{value:rb.Fit,label:"H: Fit"},{value:rb.X10,label:"10x"}],selected:U,setSelected:V})})]}),t(j,{variant:K.Secondary,size:W.S,iconSize:24,leftIcon:X?Rs:ac,tooltip:X?"Exit fullscreen (Esc)":"Fullscreen",hideTooltipIcon:!0,onClick:se})]})]}),t(ce,{fullWidth:!0,keepAlive:!0,text:A,children:t("div",{ref:S,style:{flex:1,minWidth:0,width:"100%",height:X?"calc(100vh - 80px)":"calc(100vh - 364px)",position:"relative",overflow:"hidden"},children:t("div",{style:{position:"absolute",inset:0,overflowX:_>1?"auto":"hidden",overflowY:U>1?"auto":"hidden"},children:t("div",{style:{width:Y||"100%",height:q||"100%",position:"relative"},children:t("canvas",{ref:x,style:{display:"block",position:"absolute",left:0,top:0,width:"100%",height:"100%",borderRadius:8,cursor:E?"pointer":"default"},onPointerDown:le,onPointerMove:ae,onPointerLeave:oe,onClick:re})})})})}),e(T,{$justifyContent:"space-between",children:[t(w,J?{size:C.XXXS,color:y.v2.colors.silver[300],children:`Zoomed: ${ge} • ${qm(Z)} samples in view`}:{size:C.XXXS,color:y.v2.colors.silver[300],children:g?"Click a frame to zoom in and jump to its row in the symbol table.":"Click a frame to zoom into its subtree (pprof-style)."}),h&&t(w,{size:C.XXXS,color:y.v2.colors.silver[300],children:`${h.activeKeys.length} / ${h.maxSlots} profiling slots · ${db(h.totalBytesUsed)} / ${db(h.maxTotalBytesBudget)} budget · TTL ${h.slotTtlSeconds}s`})]})]})},ub=[ai.Go,ai.Java],hb="Profiling Symbols";function gb(e,t){if(0===t.length)return null;const i=1===t.length?t[0]:(e=>e.includes("/")||/\.\(\*?[^)]+\)\./.test(e)?ai.Go:e.includes(" ")||e.includes("(")?ai.Java:ai.Go)(e);if(i===ai.Go){const t=(e=>{let t=e.trim();if(!t)return null;t=t.replace(/\[[^\]]*\]/g,"");const i=t.lastIndexOf("/"),n=t.indexOf(".",i+1);if(-1===n)return null;const a=t.slice(0,n),o=t.slice(n+1);if(!a||!o)return null;const l=o.match(/^\(\*?([^)]+)\)\.(.+)$/);if(l){const e=new ue(a,"",l[1],l[2]);return e.Verify()?e:null}const r=new ue(a,o);return r.Verify()?r:null})(e);return t?{language:i,golang:t}:null}if(i===ai.Java){const t=(e=>{let t=e.trim();if(!t)return null;const i=t.indexOf("(");-1!==i&&(t=t.slice(0,i).trim());const n=t.split(/\s+/);t=n[n.length-1]??"";const a=t.lastIndexOf(".");if(-1===a)return null;const o=t.slice(0,a),l=t.slice(a+1),r=new he(o,l);return r.Verify()?r:null})(e);return t?{language:i,java:t}:null}return null}function mb(e,t){return e.namespace===t.namespace&&e.name===t.name&&e.kind===t.kind}function bb(e,t,i){if(!e)return!0;const{sources:n=[],namespaces:a=[],languages:o=[]}=e,l=!n.length||n.some(e=>mb(e,t.id)),r=!a.length||a.includes(t.id.namespace),s=!o.length||null==i||o.includes(i);return l&&r&&s}function fb(e,t){return e.packageName===t.packageName&&(e.functionName||"")===(t.functionName||"")&&(e.receiverName||"")===(t.receiverName||"")&&(e.receiverMethodName||"")===(t.receiverMethodName||"")}function vb(e,t){return e.className===t.className&&e.methodName===t.methodName}function yb(e,t,i,n){const a=gb(e,i);if(!a)return[];const o=[];for(const e of n){const i=e.customInstrumentations;if(!i)continue;if(!bb(e.sourceScopes,t,a.language))continue;const n=!!a.golang&&!!i[me.Golang]?.some(e=>fb(e,a.golang)),l=!!a.java&&!!i[me.Java]?.some(e=>vb(e,a.java));(n||l)&&o.push({rule:e,resolved:a})}return o}var Sb,xb,wb;(e=>{e.Symbol="symbol",e.Self="self",e.Total="total"})(Sb||(Sb={})),(e=>{e.OnlyInstrumentable="only-instrumentable"})(xb||(xb={})),(e=>{e.FilterOutVoid="filter-out-void",e.OnlyWithReturnValues="only-with-return-values"})(wb||(wb={}));const Cb=/^[A-Za-z_$][A-Za-z0-9_$]*(\[\])*$/;function kb(e,t){const i=(e=>e.split(" ")[0]??"")(e);return(!t.includes(wb.FilterOutVoid)||"void"!==i)&&!!(!t.includes(wb.OnlyWithReturnValues)||e.includes(" ")&&"void"!==i&&Cb.test(i))}const Tb=({rows:e,languages:i,instrumentation:n,searchQuery:o,filters:l,onFiltersChange:r,zoomedSymbols:s,highlightSymbol:c,scrollSignal:p})=>{const u=!!i?.includes(ai.Java),h=a(()=>{const t=s?new Set(s):null,i=o?.trim().toLowerCase();return e.filter(e=>(!t||t.has(e.name))&&(!i||e.name.toLowerCase().includes(i)))},[e,o,s]),g=a(()=>{const e=[];if(n.selectionEnabled&&e.push({id:xb.OnlyInstrumentable,label:"Only show instrumentable symbols"}),u&&(e.push({id:wb.FilterOutVoid,label:"Filter out void symbols"}),e.push({id:wb.OnlyWithReturnValues,label:"Only show functions with return values"})),0!==e.length)return{options:e,filterRow:(e,t)=>{const i=e.cells.find(e=>e.key===Sb.Symbol)?.rawValue?.toString()??"";return!(t.includes(xb.OnlyInstrumentable)&&!n.getSymbolState(i).showCheckbox)&&kb(i,t)}}},[n,u]),m=a(()=>[{key:Sb.Symbol,label:"Symbol",flex:"0 0 160px",filterOverride:g,noFilter:!g},{key:Sb.Self,label:"Self",tooltip:"Time spent in this function itself, excluding time in functions it calls.",textAlign:"right",noFilter:!0},{key:Sb.Total,label:"Total",tooltip:"Time spent in this function and all functions it calls (inclusive).",textAlign:"right",noFilter:!0}],[g]),b=a(()=>h.map(e=>{const t=n.getSymbolState(e.name),i=t.showCheckbox;return{id:e.name,cells:[{key:Sb.Symbol,rawValue:e.name},{key:Sb.Self,rawValue:qm(e.self)},{key:Sb.Total,rawValue:qm(e.total)}],isSelected:i?n.isSelected(e.name):void 0,onSelect:i?()=>n.onToggleSymbol(e.name,!0):void 0,onDeselect:i?()=>n.onToggleSymbol(e.name,!1):void 0,hideCheckbox:!i,checkboxDisabled:i?t.checkboxDisabled:void 0,checkboxTooltip:i?t.checkboxTooltip:void 0}}),[h,n]),f=d(e=>{const t=e.cells[0].rawValue,i=n.getSymbolState(t),a=[];return i.inManagedRule?a.push({id:`remove-instrumentation-${t}`,label:"",leftIcon:vs,tooltip:"Remove from the “Profiling Symbols” rule",onClick:()=>n.onRemove(t)}):a.push({id:`add-instrumentation-${t}`,label:"",leftIcon:ys,tooltip:i.addTooltip,disabled:!i.addEnabled,onClick:()=>n.onAdd(t)}),a.push({id:`copy-${t}`,label:"",leftIcon:oc,tooltip:"Copy symbol name",onClick:()=>{navigator.clipboard.writeText(t)}}),a},[n]);return t(ui,{variant:hi.Data,maxHeight:"calc(100vh - 306px)",columns:m,rows:b,withCheckboxes:n.selectionEnabled,filters:l,onFiltersChange:r,activeRowId:c,scrollSignal:p,getRowActions:f})};var Ib;(e=>{e.Table="table",e.Flame="flame",e.Both="both"})(Ib||(Ib={}));const $b=f($)`
|
|
763
763
|
width: 100%;
|
|
764
764
|
flex: 1;
|
|
765
765
|
border-radius: 16px;
|
|
766
766
|
overflow: hidden;
|
|
767
767
|
background: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
768
768
|
box-shadow: 0 2px 14.1px 0 rgba(0, 0, 0, 0.25);
|
|
769
|
-
`,
|
|
769
|
+
`,Nb=f.div`
|
|
770
770
|
display: flex;
|
|
771
771
|
align-items: center;
|
|
772
772
|
gap: 10px;
|
|
@@ -774,7 +774,7 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
774
774
|
padding: 12px 12px 8px;
|
|
775
775
|
background: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
776
776
|
border-radius: 16px 16px 0 0;
|
|
777
|
-
`,
|
|
777
|
+
`,Ab=f(T)`
|
|
778
778
|
flex-shrink: 0;
|
|
779
779
|
align-items: center;
|
|
780
780
|
gap: 4px;
|
|
@@ -799,7 +799,7 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
799
799
|
width: 100%;
|
|
800
800
|
min-height: 32px;
|
|
801
801
|
flex-shrink: 0;
|
|
802
|
-
`,zb=({source:i,onFlameFullscreenChange:n})=>{const s=v(),{profilingApi:c}=Pc(),u=a(()=>({namespace:i.id.namespace,name:i.id.name,kind:i.id.kind,region:i.id.region,serviceName:i.serviceName}),[i.id.namespace,i.id.name,i.id.kind,i.id.region,i.serviceName]),[h,g]=l(!0),[m,b]=l(Ib.Both),[f,y]=l(""),[S,x]=l({}),[I,A]=l(!1),N=p(!1);o(()=>{N.current||(N.current=!0,c.enableProfiling?.(u),A(!0))},[c,u]);const{data:O}=c.useSlots({skip:!I,pollInterval:h?3e3:0,fetchPolicy:"network-only"}),{data:D,loading:R,refetch:z}=c.useSourceProfiling(u,{skip:!I,pollInterval:h?3e3:0,fetchPolicy:"network-only"}),L=D?.profileJson??null,X=a(()=>(e=>{if(!e?.trim())return null;try{const t=JSON.parse(e),i=t.flamebearer;return!i?.names?.length||!Array.isArray(i.levels)||"number"!=typeof i.numTicks||i.numTicks<=0?null:{flamebearer:i,units:t.metadata?.units}}catch{return null}})(L),[L]),_=a(()=>X?(e=>{const t=new Map;for(let i=0;i<e.levels.length;i++){const n=e.levels[i];for(let i=0;i+3<n.length;i+=4){const a=n[i+1],o=n[i+2],l=Ym(e,n[i+3]);if(!l)continue;const r=t.get(l);(!r||a>r.total)&&t.set(l,{self:o,total:a})}}return[...t.entries()].map(([e,t])=>({name:e,self:t.self,total:t.total})).sort((e,t)=>t.self-e.self)})(X.flamebearer):[],[X]),B=m===Ib.Table||m===Ib.Both,U=m===Ib.Flame||m===Ib.Both,V=B&&U,G=i.runtimeInfo?.detectedLanguages?.join("\0")??"",H=i.containers?.map(e=>e.overrides?.runtimeInfo?.language??e.runtimeInfo?.language??"").join("\0")??"",Y=a(()=>G?G.split("\0"):H?H.split("\0"):void 0,[G,H]),J=a(()=>((e,t)=>{if(!t?.includes(ai.Java))return;const i=(e?.[Sb.Symbol]?.filter(Boolean)??[]).filter(e=>e===wb.FilterOutVoid||e===wb.OnlyWithReturnValues);return 0!==i.length?e=>kb(e,i):void 0})(S,Y),[S,Y]),{instrumentation:q,pendingCount:Q,pendingModify:ee,closeModify:te,openBulkModify:ie,resetSelection:ae,confirmModify:oe}=function({source:e,languages:t,rows:i}){const{instrumentationRulesApi:n,capabilities:o}=Pc(),{items:r}=n.useRules(),[s,c]=l(new Set),[p,u]=l(new Set),[h,g]=l(null),m=a(()=>(e=>{const t=new Set(e??[]);return ub.filter(e=>t.has(e))})(t),[t]),b=o.canCreateInstrumentationRule,f=`${e.id.namespace}\0${e.id.kind}\0${e.id.name}`,v=a(()=>((e,t)=>{const i=e.filter(e=>e.type===fe.CustomInstrumentation&&e.ruleName===hb&&bb(e.sourceScopes,t));return i.find(e=>e.sourceScopes?.sources?.some(e=>mb(e,t.id)))??i[0]??null})(r,e),[r,f]),y=b&&m.length>0,S=a(()=>{const t=new Map;for(const n of i){const i=!!gb(n.name,m),a=yb(n.name,e,m,r),o=!!v&&a.some(e=>e.rule.ruleId===v.ruleId),l=a.filter(e=>e.rule.ruleId!==v?.ruleId),s=!o&&l.length>0,c=y&&i,d=s;let p;if(s){const e=[...new Set(l.map(e=>e.rule.ruleName))];p=`Managed by ${e.length>1?"rules":"rule"} ${e.map(e=>`“${e}”`).join(", ")}. Edit ${e.length>1?"those rules":"that rule"} to change this symbol.`}let u=!1,h="Add this symbol to the “Profiling Symbols” rule";s?h=p??"Managed by another rule":0===a.length&&(0===m.length?h="Custom instrumentation is only available for Go and Java sources":b?i?u=!0:h="This symbol could not be parsed into a probe automatically":h="You don’t have permission to add custom instrumentation"),t.set(n.name,{parsable:i,inManagedRule:o,otherRules:l,showCheckbox:c,checkboxDisabled:d,checkboxTooltip:p,addEnabled:u,addTooltip:h})}return t},[i,r,f,m,b,y,v]),x=a(()=>{const e=new Set;return S.forEach((t,i)=>{t.inManagedRule&&e.add(i)}),e},[S]),w=a(()=>[...s].filter(e=>S.get(e)?.addEnabled&&!x.has(e)),[s,S,x]),C=a(()=>[...p].filter(e=>x.has(e)),[p,x]),k=w.length+C.length,T=d(e=>{const t=S.get(e);return t?.inManagedRule?!p.has(e):!!(t&&t.otherRules.length>0)||s.has(e)},[S,p,s]),I=d((e,t)=>{const i=S.get(e);i&&!i.checkboxDisabled&&(i.inManagedRule?u(i=>{const n=new Set(i);return t?n.delete(e):n.add(e),n}):c(i=>{const n=new Set(i);return t?n.add(e):n.delete(e),n}))},[S]),$=d(()=>{c(new Set),u(new Set)},[]),A=d(t=>{(async()=>{const i=t.add.map(e=>gb(e,m)).filter(e=>!!e),a=t.remove.map(e=>gb(e,m)).filter(e=>!!e);if(v){const{customInstrumentations:e,isEmpty:t}=((e,t,i)=>{const n=e.customInstrumentations??{};let a=[...n[me.Golang]??[]],o=[...n[me.Java]??[]];for(const e of i)e.golang&&(a=a.filter(t=>!fb(t,e.golang))),e.java&&(o=o.filter(t=>!vb(t,e.java)));for(const e of t)e.golang&&!a.some(t=>fb(t,e.golang))&&a.push(e.golang),e.java&&!o.some(t=>vb(t,e.java))&&o.push(e.java);return{customInstrumentations:{[me.Golang]:a,[me.Java]:o},isEmpty:0===a.length&&0===o.length}})(v,i,a);t?await n.remove(v.ruleId,fe.CustomInstrumentation):await n.update(v.ruleId,((e,t)=>({ruleName:e.ruleName,notes:e.notes,disabled:e.disabled,sourceScopes:e.sourceScopes??null,workloads:null,instrumentationLibraries:e.instrumentationLibraries??null,payloadCollection:null,codeAttributes:null,headersCollection:null,customInstrumentations:t}))(v,e),fe.CustomInstrumentation)}else i.length>0&&await n.create(((e,t)=>{const i=e.map(e=>e.golang).filter(e=>!!e),n=e.map(e=>e.java).filter(e=>!!e),a={sources:[{namespace:t.id.namespace,name:t.id.name,kind:t.id.kind}],namespaces:[],languages:[]};return{ruleName:hb,notes:"Symbols selected from the profiling tab.",disabled:!1,sourceScopes:a,workloads:null,instrumentationLibraries:null,payloadCollection:null,codeAttributes:null,headersCollection:null,customInstrumentations:{[me.Golang]:i,[me.Java]:n}}})(i,e),fe.CustomInstrumentation)})()},[v,m,e,n]),N=d(()=>{k&&g({add:w,remove:C})},[k,w,C]),O=d(e=>g({add:[e],remove:[]}),[]),E=d(e=>g({add:[],remove:[e]}),[]),D=d(()=>g(null),[]),R=d(()=>{h&&(A(h),g(null),$())},[h,A,$]),z=d(e=>S.get(e)??{parsable:!1,inManagedRule:!1,otherRules:[],showCheckbox:!1,checkboxDisabled:!1,addEnabled:!1,addTooltip:"Custom instrumentation is only available for Go and Java sources"},[S]);return{instrumentation:a(()=>({getSymbolState:z,onAdd:O,onRemove:E,selectionEnabled:y,isSelected:T,onToggleSymbol:I}),[z,O,E,y,T,I]),pendingCount:k,pendingModify:h,closeModify:D,openBulkModify:N,resetSelection:$,confirmModify:R}}({source:i,languages:Y,rows:_}),[le,re]=l(null),[se,de]=l(0),[pe,ue]=l(null),he=d(e=>{re(e),de(e=>e+1),b(e=>e===Ib.Flame?Ib.Both:e)},[]),ge=d(e=>{ue(t=>{if(null===e)return null===t?t:null;if(t&&t.length===e.length){const i=new Set(t);if(e.every(e=>i.has(e)))return t}return e})},[]),be=d(()=>re(null),[]);return!L&&R?t(Me,{$height:"70vh",children:t(Ve,{withSpinner:!0})}):e($b,{$gap:0,$width:"100%",children:[e(Ab,{children:[t(ce,{text:"Live CPU profile collected from the workload agent. Search symbols, switch between the table and flame graph, or download a JSON snapshot.",withIcon:!0,children:t(Nb,{children:t(w,{size:C.S,weight:500,color:k.Primary,nowrap:!0,children:"CPU Profiling"})})}),e(T,{style:{flex:1,minWidth:200,gap:10,alignItems:"center",flexWrap:"wrap"},children:[t("div",{style:{flex:"1 1 220px",minWidth:180},children:t(Bt,{value:f,onChange:y,placeholder:"Search by symbol name",width:"100%",idleBackgroundColor:s.v2.colors.silver[900],emphasizeBackgroundColor:s.v2.colors.silver[800]})}),t(F,{variant:pi.Filled,options:[{value:Ib.Table,label:"Top table"},{value:Ib.Flame,label:"Flame graph"},{value:Ib.Both,label:"Both"}],selected:m,setSelected:b}),t(j,h?{variant:W.Secondary,size:K.S,label:"Live",tooltip:"Odigos profiler works in-memory and doesn't store any data on disk, to keep minimum memory footprint we store only last 10 minutes of data on demand",leftIcon:e=>t(lc,{...e,size:8,fill:s.v2.colors.green[500]})}:{variant:W.Secondary,size:K.S,label:"Paused",tooltip:"Odigos profiler is still collecting data, but the UI is not updating in real time",leftIcon:e=>t(lc,{...e,size:8,fill:s.v2.colors.red[500]})})]})]}),t(Ob,{$gap:B&&U?16:0,children:X?e(r,{children:[B&&e(Eb,{$splitWithFlame:V,children:[e(Rb,{$justifyContent:"space-between",children:[e($,{$margin:"0 0 0 20px",children:[t(w,{size:C.XXXS,nowrap:!0,children:"Please select symbols to"}),e(T,{$gap:8,children:[e(T,{children:[t(rc,{size:24}),t(w,{size:C.S,color:k.Success,nowrap:!0,children:"Custom Instrument"})]}),t(j,{leftIcon:xs,variant:W.Secondary,size:K.S,onClick:()=>window.open(`${ne}/enterprise/pipeline/rules/custominstrumentation`,"_blank","noopener noreferrer")})]})]}),e(T,{$gap:8,children:[pe&&t(ce,{text:"The table is scoped to the symbols inside the flame graph’s current zoom. Use “Reset zoom” on the flame graph to show all symbols again.",children:t(E,{label:`Zoomed: ${pe.length} symbols`,backgroundColor:s.v2.colors.silver[750],textColor:s.v2.colors.silver[200],textSize:C.XXS})}),t(j,{variant:W.Secondary,size:K.S,label:"Download snapshot",rightIcon:sc,onClick:()=>{if(!L)return;const e=new Blob([L],{type:"application/json"}),t=URL.createObjectURL(e),n=document.createElement("a");n.href=t,n.download=`cpu-profile-${i.id.namespace}-${i.id.kind}-${i.id.name}.json`,n.click(),URL.revokeObjectURL(t)},disabled:!L})]})]}),t(Tb,{rows:_,languages:Y,instrumentation:q,searchQuery:f,filters:S,onFiltersChange:x,zoomedSymbols:pe,highlightSymbol:le,scrollSignal:se})]}),U&&e(Db,{$splitWithTable:V,children:[e(Rb,{$justifyContent:"space-between",children:[t(E,{label:X?`Total in view ${Jm(X.flamebearer.numTicks)}`:"No profile sample yet",backgroundColor:s.v2.colors.silver[750],textColor:s.v2.colors.silver[200],textSize:C.XXS}),e(T,{$gap:12,children:[!h&&t(j,{variant:W.Secondary,size:K.S,label:"Refresh",leftIcon:Hs,onClick:z}),t(P,{label:"Auto refresh",labelAlign:M.Left,size:qe.S,value:h,onChange:g})]})]}),t(pb,{flamebearer:X.flamebearer,maxRowPx:24,searchQuery:f,shouldKeepName:J,minHostHeight:280,onFullscreenChange:n,profilingSlots:O??null,onFrameClick:he,onZoomedSymbolsChange:ge,onResetZoom:be})]})]}):t(Me,{children:t(Z,{title:"No profile samples yet",subTitle:"Dynamically collecting profiling samples — keep this tab open while the agent sends OTLP profiles."})})}),t(Wm,{pendingModify:ee,onClose:te,onConfirm:oe}),t(gi,{isOpen:Q>0,richTitle:{icon:zs,title:"Profiling Symbols",badge:{label:Q}},actions:[{id:"profiling-bulk-cancel",type:Ft.Button,buttonProps:{variant:W.Secondary,size:K.S,label:"Cancel",onClick:ae}},{id:"profiling-bulk-apply",type:Ft.Button,buttonProps:{variant:W.Primary,size:K.S,label:"Modify Rule",leftIcon:Cs,onClick:ie}}]})]})},Lb=f.div`
|
|
802
|
+
`,zb=({source:i,onFlameFullscreenChange:n})=>{const s=v(),{profilingApi:c}=Lc(),u=a(()=>({namespace:i.id.namespace,name:i.id.name,kind:i.id.kind,region:i.id.region,serviceName:i.serviceName}),[i.id.namespace,i.id.name,i.id.kind,i.id.region,i.serviceName]),[h,g]=l(!0),[m,b]=l(Ib.Both),[f,y]=l(""),[S,x]=l({}),[I,N]=l(!1),A=p(!1);o(()=>{A.current||(A.current=!0,c.enableProfiling?.(u),N(!0))},[c,u]);const{data:O}=c.useSlots({skip:!I,pollInterval:h?3e3:0,fetchPolicy:"network-only"}),{data:D,loading:R,refetch:z}=c.useSourceProfiling(u,{skip:!I,pollInterval:h?3e3:0,fetchPolicy:"network-only"}),X=D?.profileJson??null,P=a(()=>(e=>{if(!e?.trim())return null;try{const t=JSON.parse(e),i=t.flamebearer;return!i?.names?.length||!Array.isArray(i.levels)||"number"!=typeof i.numTicks||i.numTicks<=0?null:{flamebearer:i,units:t.metadata?.units}}catch{return null}})(X),[X]),_=a(()=>P?(e=>{const t=new Map;for(let i=0;i<e.levels.length;i++){const n=e.levels[i];for(let i=0;i+3<n.length;i+=4){const a=n[i+1],o=n[i+2],l=Ym(e,n[i+3]);if(!l)continue;const r=t.get(l);(!r||a>r.total)&&t.set(l,{self:o,total:a})}}return[...t.entries()].map(([e,t])=>({name:e,self:t.self,total:t.total})).sort((e,t)=>t.self-e.self)})(P.flamebearer):[],[P]),B=m===Ib.Table||m===Ib.Both,U=m===Ib.Flame||m===Ib.Both,V=B&&U,G=i.runtimeInfo?.detectedLanguages?.join("\0")??"",H=i.containers?.map(e=>e.overrides?.runtimeInfo?.language??e.runtimeInfo?.language??"").join("\0")??"",Y=a(()=>G?G.split("\0"):H?H.split("\0"):void 0,[G,H]),q=a(()=>((e,t)=>{if(!t?.includes(ai.Java))return;const i=(e?.[Sb.Symbol]?.filter(Boolean)??[]).filter(e=>e===wb.FilterOutVoid||e===wb.OnlyWithReturnValues);return 0!==i.length?e=>kb(e,i):void 0})(S,Y),[S,Y]),{instrumentation:J,pendingCount:Q,pendingModify:ee,closeModify:te,openBulkModify:ie,resetSelection:ae,confirmModify:oe}=function({source:e,languages:t,rows:i}){const{instrumentationRulesApi:n,capabilities:o}=Lc(),{items:r}=n.useRules(),[s,c]=l(new Set),[p,u]=l(new Set),[h,g]=l(null),m=a(()=>(e=>{const t=new Set(e??[]);return ub.filter(e=>t.has(e))})(t),[t]),b=o.canCreateInstrumentationRule,f=`${e.id.namespace}\0${e.id.kind}\0${e.id.name}`,v=a(()=>((e,t)=>{const i=e.filter(e=>e.type===fe.CustomInstrumentation&&e.ruleName===hb&&bb(e.sourceScopes,t));return i.find(e=>e.sourceScopes?.sources?.some(e=>mb(e,t.id)))??i[0]??null})(r,e),[r,f]),y=b&&m.length>0,S=a(()=>{const t=new Map;for(const n of i){const i=!!gb(n.name,m),a=yb(n.name,e,m,r),o=!!v&&a.some(e=>e.rule.ruleId===v.ruleId),l=a.filter(e=>e.rule.ruleId!==v?.ruleId),s=!o&&l.length>0,c=y&&i,d=s;let p;if(s){const e=[...new Set(l.map(e=>e.rule.ruleName))];p=`Managed by ${e.length>1?"rules":"rule"} ${e.map(e=>`“${e}”`).join(", ")}. Edit ${e.length>1?"those rules":"that rule"} to change this symbol.`}let u=!1,h="Add this symbol to the “Profiling Symbols” rule";s?h=p??"Managed by another rule":0===a.length&&(0===m.length?h="Custom instrumentation is only available for Go and Java sources":b?i?u=!0:h="This symbol could not be parsed into a probe automatically":h="You don’t have permission to add custom instrumentation"),t.set(n.name,{parsable:i,inManagedRule:o,otherRules:l,showCheckbox:c,checkboxDisabled:d,checkboxTooltip:p,addEnabled:u,addTooltip:h})}return t},[i,r,f,m,b,y,v]),x=a(()=>{const e=new Set;return S.forEach((t,i)=>{t.inManagedRule&&e.add(i)}),e},[S]),w=a(()=>[...s].filter(e=>S.get(e)?.addEnabled&&!x.has(e)),[s,S,x]),C=a(()=>[...p].filter(e=>x.has(e)),[p,x]),k=w.length+C.length,T=d(e=>{const t=S.get(e);return t?.inManagedRule?!p.has(e):!!(t&&t.otherRules.length>0)||s.has(e)},[S,p,s]),I=d((e,t)=>{const i=S.get(e);i&&!i.checkboxDisabled&&(i.inManagedRule?u(i=>{const n=new Set(i);return t?n.delete(e):n.add(e),n}):c(i=>{const n=new Set(i);return t?n.add(e):n.delete(e),n}))},[S]),$=d(()=>{c(new Set),u(new Set)},[]),N=d(t=>{(async()=>{const i=t.add.map(e=>gb(e,m)).filter(e=>!!e),a=t.remove.map(e=>gb(e,m)).filter(e=>!!e);if(v){const{customInstrumentations:e,isEmpty:t}=((e,t,i)=>{const n=e.customInstrumentations??{};let a=[...n[me.Golang]??[]],o=[...n[me.Java]??[]];for(const e of i)e.golang&&(a=a.filter(t=>!fb(t,e.golang))),e.java&&(o=o.filter(t=>!vb(t,e.java)));for(const e of t)e.golang&&!a.some(t=>fb(t,e.golang))&&a.push(e.golang),e.java&&!o.some(t=>vb(t,e.java))&&o.push(e.java);return{customInstrumentations:{[me.Golang]:a,[me.Java]:o},isEmpty:0===a.length&&0===o.length}})(v,i,a);t?await n.remove(v.ruleId,fe.CustomInstrumentation):await n.update(v.ruleId,((e,t)=>({ruleName:e.ruleName,notes:e.notes,disabled:e.disabled,sourceScopes:e.sourceScopes??null,workloads:null,instrumentationLibraries:e.instrumentationLibraries??null,payloadCollection:null,codeAttributes:null,headersCollection:null,customInstrumentations:t}))(v,e),fe.CustomInstrumentation)}else i.length>0&&await n.create(((e,t)=>{const i=e.map(e=>e.golang).filter(e=>!!e),n=e.map(e=>e.java).filter(e=>!!e),a={sources:[{namespace:t.id.namespace,name:t.id.name,kind:t.id.kind}],namespaces:[],languages:[]};return{ruleName:hb,notes:"Symbols selected from the profiling tab.",disabled:!1,sourceScopes:a,workloads:null,instrumentationLibraries:null,payloadCollection:null,codeAttributes:null,headersCollection:null,customInstrumentations:{[me.Golang]:i,[me.Java]:n}}})(i,e),fe.CustomInstrumentation)})()},[v,m,e,n]),A=d(()=>{k&&g({add:w,remove:C})},[k,w,C]),O=d(e=>g({add:[e],remove:[]}),[]),E=d(e=>g({add:[],remove:[e]}),[]),D=d(()=>g(null),[]),R=d(()=>{h&&(N(h),g(null),$())},[h,N,$]),z=d(e=>S.get(e)??{parsable:!1,inManagedRule:!1,otherRules:[],showCheckbox:!1,checkboxDisabled:!1,addEnabled:!1,addTooltip:"Custom instrumentation is only available for Go and Java sources"},[S]);return{instrumentation:a(()=>({getSymbolState:z,onAdd:O,onRemove:E,selectionEnabled:y,isSelected:T,onToggleSymbol:I}),[z,O,E,y,T,I]),pendingCount:k,pendingModify:h,closeModify:D,openBulkModify:A,resetSelection:$,confirmModify:R}}({source:i,languages:Y,rows:_}),[le,re]=l(null),[se,de]=l(0),[pe,ue]=l(null),he=d(e=>{re(e),de(e=>e+1),b(e=>e===Ib.Flame?Ib.Both:e)},[]),ge=d(e=>{ue(t=>{if(null===e)return null===t?t:null;if(t&&t.length===e.length){const i=new Set(t);if(e.every(e=>i.has(e)))return t}return e})},[]),be=d(()=>re(null),[]);return!X&&R?t(Me,{$height:"70vh",children:t(Ve,{withSpinner:!0})}):e($b,{$gap:0,$width:"100%",children:[e(Nb,{children:[t(ce,{text:"Live CPU profile collected from the workload agent. Search symbols, switch between the table and flame graph, or download a JSON snapshot.",withIcon:!0,children:t(Ab,{children:t(w,{size:C.S,weight:500,color:k.Primary,nowrap:!0,children:"CPU Profiling"})})}),e(T,{style:{flex:1,minWidth:200,gap:10,alignItems:"center",flexWrap:"wrap"},children:[t("div",{style:{flex:"1 1 220px",minWidth:180},children:t(Bt,{value:f,onChange:y,placeholder:"Search by symbol name",width:"100%",idleBackgroundColor:s.v2.colors.silver[900],emphasizeBackgroundColor:s.v2.colors.silver[800]})}),t(F,{variant:pi.Filled,options:[{value:Ib.Table,label:"Top table"},{value:Ib.Flame,label:"Flame graph"},{value:Ib.Both,label:"Both"}],selected:m,setSelected:b}),t(j,h?{variant:K.Secondary,size:W.S,label:"Live",tooltip:"Odigos profiler works in-memory and doesn't store any data on disk, to keep minimum memory footprint we store only last 10 minutes of data on demand",leftIcon:e=>t(lc,{...e,size:8,fill:s.v2.colors.green[500]})}:{variant:K.Secondary,size:W.S,label:"Paused",tooltip:"Odigos profiler is still collecting data, but the UI is not updating in real time",leftIcon:e=>t(lc,{...e,size:8,fill:s.v2.colors.red[500]})})]})]}),t(Ob,{$gap:B&&U?16:0,children:P?e(r,{children:[B&&e(Eb,{$splitWithFlame:V,children:[e(Rb,{$justifyContent:"space-between",children:[e($,{$margin:"0 0 0 20px",children:[t(w,{size:C.XXXS,nowrap:!0,children:"Please select symbols to"}),e(T,{$gap:8,children:[e(T,{children:[t(rc,{size:24}),t(w,{size:C.S,color:k.Success,nowrap:!0,children:"Custom Instrument"})]}),t(j,{leftIcon:xs,variant:K.Secondary,size:W.S,onClick:()=>window.open(`${ne}/enterprise/pipeline/rules/custominstrumentation`,"_blank","noopener noreferrer")})]})]}),e(T,{$gap:8,children:[pe&&t(ce,{text:"The table is scoped to the symbols inside the flame graph’s current zoom. Use “Reset zoom” on the flame graph to show all symbols again.",children:t(E,{label:`Zoomed: ${pe.length} symbols`,backgroundColor:s.v2.colors.silver[750],textColor:s.v2.colors.silver[200],textSize:C.XXS})}),t(j,{variant:K.Secondary,size:W.S,label:"Download snapshot",rightIcon:sc,onClick:()=>{if(!X)return;const e=new Blob([X],{type:"application/json"}),t=URL.createObjectURL(e),n=document.createElement("a");n.href=t,n.download=`cpu-profile-${i.id.namespace}-${i.id.kind}-${i.id.name}.json`,n.click(),URL.revokeObjectURL(t)},disabled:!X})]})]}),t(Tb,{rows:_,languages:Y,instrumentation:J,searchQuery:f,filters:S,onFiltersChange:x,zoomedSymbols:pe,highlightSymbol:le,scrollSignal:se})]}),U&&e(Db,{$splitWithTable:V,children:[e(Rb,{$justifyContent:"space-between",children:[t(E,{label:P?`Total in view ${qm(P.flamebearer.numTicks)}`:"No profile sample yet",backgroundColor:s.v2.colors.silver[750],textColor:s.v2.colors.silver[200],textSize:C.XXS}),e(T,{$gap:12,children:[!h&&t(j,{variant:K.Secondary,size:W.S,label:"Refresh",leftIcon:Hs,onClick:z}),t(L,{label:"Auto refresh",labelAlign:M.Left,size:Je.S,value:h,onChange:g})]})]}),t(pb,{flamebearer:P.flamebearer,maxRowPx:24,searchQuery:f,shouldKeepName:q,minHostHeight:280,onFullscreenChange:n,profilingSlots:O??null,onFrameClick:he,onZoomedSymbolsChange:ge,onResetZoom:be})]})]}):t(Me,{children:t(Z,{title:"No profile samples yet",subTitle:"Dynamically collecting profiling samples — keep this tab open while the agent sends OTLP profiles."})})}),t(Km,{pendingModify:ee,onClose:te,onConfirm:oe}),t(gi,{isOpen:Q>0,richTitle:{icon:zs,title:"Profiling Symbols",badge:{label:Q}},actions:[{id:"profiling-bulk-cancel",type:Ft.Button,buttonProps:{variant:K.Secondary,size:W.S,label:"Cancel",onClick:ae}},{id:"profiling-bulk-apply",type:Ft.Button,buttonProps:{variant:K.Primary,size:W.S,label:"Modify Rule",leftIcon:Cs,onClick:ie}}]})]})},Xb=f.div`
|
|
803
803
|
position: relative;
|
|
804
804
|
display: flex;
|
|
805
805
|
align-items: center;
|
|
@@ -807,14 +807,14 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
807
807
|
padding: 8px 16px;
|
|
808
808
|
border-radius: 12px;
|
|
809
809
|
background-color: ${({theme:e})=>e.v2.colors.silver[700]};
|
|
810
|
-
`,
|
|
810
|
+
`,Pb=f.div`
|
|
811
811
|
display: flex;
|
|
812
812
|
flex-direction: column;
|
|
813
813
|
gap: 4px;
|
|
814
814
|
flex: 1;
|
|
815
815
|
min-width: 0;
|
|
816
816
|
opacity: ${({$disabled:e})=>e?.4:1};
|
|
817
|
-
`,
|
|
817
|
+
`,Lb=f.div`
|
|
818
818
|
flex-shrink: 0;
|
|
819
819
|
display: flex;
|
|
820
820
|
align-items: center;
|
|
@@ -832,11 +832,11 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
832
832
|
pointer-events: none;
|
|
833
833
|
transition: opacity 0.15s ease;
|
|
834
834
|
|
|
835
|
-
${
|
|
835
|
+
${Xb}:hover & {
|
|
836
836
|
opacity: 1;
|
|
837
837
|
pointer-events: auto;
|
|
838
838
|
}
|
|
839
|
-
`,Fb=({name:i,summary:n,disabled:a=!1,onJumpToRule:o})=>{const l=v();return e(
|
|
839
|
+
`,Fb=({name:i,summary:n,disabled:a=!1,onJumpToRule:o})=>{const l=v();return e(Xb,{children:[e(Pb,{$disabled:a,children:[i&&t(w,{size:C.XXXS,color:k.Secondary,nowrap:!0,children:i}),t(Mb,{children:t(Mr,{parts:n})})]}),a&&t(Lb,{$reserveJumpSpace:!!o,children:t(E,{label:mi,textSize:C.XXXS,backgroundColor:l.v2.colors.grey[700],textColor:l.v2.colors.grey[300]})}),o&&t(_b,{children:t(ce,{text:ke.OPEN_IN_SAMPLING_PAGE,children:t(j,{"data-id":"sampling-rule-jump",variant:K.Primary,size:W.S,leftIcon:ac,onClick:o})})})]})},Bb=f.div`
|
|
840
840
|
opacity: 0;
|
|
841
841
|
pointer-events: none;
|
|
842
842
|
transition: opacity 0.15s ease;
|
|
@@ -849,7 +849,7 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
849
849
|
display: flex;
|
|
850
850
|
align-items: center;
|
|
851
851
|
padding: 4px 12px;
|
|
852
|
-
`,Gb=({source:e,onRedirectToSampling:i})=>t(mt,{bgTint:"1000",richTitle:{title:ke.CONTAINERS,badge:{label:e.containers?.length??0}},children:e.containers?.map(e=>t(Kb,{container:e,onRedirectToSampling:i},e.containerName))});var Hb;(e=>{e.All="all",e.Noisy="noisy",e.HighlyRelevant="highly-relevant",e.CostReduction="cost-reduction"})(Hb||(Hb={}));const jb=e=>"noisy"===e.type?_r(e.rule,"source"):"highlyRelevant"===e.type?Fr(e.rule,"source"):"costReduction"===e.type?Br(e.rule,"source"):[],Kb=({container:i,onRedirectToSampling:n})=>{const[o,r]=l(Hb.All),s=Vt(e=>e.setPendingViewSamplingRule),c=i.agentConfig?.traces?.headSampling?.noisyOperations??[],d=a(()=>(i.collectorConfig?.tailSampling?.noisyOperations??[]).map(e=>({type:"noisy",rule:e})),[i.agentConfig?.traces?.headSampling?.noisyOperations]),p=a(()=>(i.collectorConfig?.tailSampling?.highlyRelevantOperations??[]).map(e=>({type:"highlyRelevant",rule:e})),[i.collectorConfig?.tailSampling?.highlyRelevantOperations]),u=a(()=>(i.collectorConfig?.tailSampling?.costReductionRules??[]).map(e=>({type:"costReduction",rule:e})),[i.collectorConfig?.tailSampling?.costReductionRules]),h=a(()=>o===Hb.Noisy?d:o===Hb.HighlyRelevant?p:o===Hb.CostReduction?u:[...d,...p,...u],[o,p,u]),g=d.length+p.length+u.length,m=a(()=>(e,t)=>{s({ruleId:e,category:t}),n()},[n,s]),b=t(Bb,{children:t(j,{"data-id":"sampling-container-create-rule",variant:W.Secondary,size:K.S,label:bi,rightIcon:ys,onClick:e=>{e.stopPropagation(),n()}})});return t(Ub,{children:e(mt,{bgTint:"900",richTitle:{title:i.containerName},renderOnRightSide:b,withCollapse:!0,collapseIsDefaultOpen:!0,children:[c.length?e(mt,{bgTint:"800",richTitle:{title:ke.HEAD_SAMPLING,badge:{label:c.length}},children:[t(w,{size:C.XXS,children:ke.NOISY_OPERATIONS}),t($,{$gap:4,children:c.map(e=>t(Fb,{name:e.name,summary:_r(e),disabled:e.disabled,onJumpToRule:()=>m(e.ruleId,"noisy")},e.ruleId))})]}):t(Vb,{children:t(w,{size:C.XS,color:k.Secondary,children:ke.HEAD_SAMPLING})}),g?e(mt,{bgTint:"800",richTitle:{title:ke.TAIL_SAMPLING,badge:{label:g}},children:[t(F,{options:(f=d.length,v=p.length,y=u.length,[{value:Hb.All,label:"All",badge:{label:f+v+y,textSize:C.XXXS}},{value:Hb.Noisy,label:ke.NOISY_OPERATIONS,badge:{label:f,textSize:C.XXXS}},{value:Hb.HighlyRelevant,label:ke.HIGHLY_RELEVANT_OPERATIONS,badge:{label:v,textSize:C.XXXS}},{value:Hb.CostReduction,label:ke.COST_REDUCTION_OPERATIONS,badge:{label:y,textSize:C.XXXS}}]),selected:o,setSelected:r}),t($,{$gap:4,children:h.length?h.map(e=>t(Fb,{name:e.rule.name,summary:jb(e),disabled:e.rule.disabled,onJumpToRule:()=>m(e.rule.ruleId,e.type)},e.rule.ruleId)):t(Z,{title:`No ${o===Hb.All?`${Hb.Noisy}, ${Hb.HighlyRelevant} and ${Hb.CostReduction}`:o} operations`})})]}):t(Vb,{children:t(w,{size:C.XS,color:k.Secondary,children:ke.TAIL_SAMPLING})})]})});var f,v,y},Wb=[Yt.Deployment,Yt.StatefulSet,Yt.DaemonSet,Yt.DeploymentConfig,Yt.Rollout,Yt.Pod];var Yb;(e=>{e.Workload="Workload",e.Pod="Pod"})(Yb||(Yb={}));const Jb=e=>!!e&&Rt(e.status)===ie.Error,qb=e=>Jb(e.healthStatus),Zb=e=>Jb(e.odigosHealthStatus)||(e.processes??[]).some(qb),Qb=e=>Jb(e.agentInjectedStatus)||Jb(e.odigosHealthStatus)||(e.containers??[]).some(Zb),ef=({onClose:i,sourceId:n,onRedirectToSampling:r})=>{const s=v(),{isK8s:c,isVm:u,platformType:h}=Xr(),{selectedStreamName:g}=Te(),{sourcesApi:m,configApi:b,capabilities:f}=Pc(),{genericForm:y,loadSource:S,validateFormData:x}=Bc(),{data:w}=b.useEffectiveConfig(),[k,T]=l(!1),[I,N]=l(!1),[O,E]=l(!1),[D,R]=l(fg.Overview),[z,L]=l(null),[X,P]=l({openFor:null}),M=(()=>{const[e,t]=l(null),i=d(e=>{t({tab:fg.Pods,podName:e.podName})},[]),n=d((e,i)=>{t({tab:fg.Pods,podName:e.podName,containerName:i.containerName})},[]),o=d((e,i,n)=>{const a=Cg({identifyingAttributes:n.identifyingAttributes});t({tab:fg.Pods,podName:e.podName,containerName:i.containerName,processPid:a})},[]),r=d(()=>t(null),[]);return a(()=>({jumpToTarget:e,jumpToPod:i,jumpToContainer:n,jumpToProcess:o,clearJumpToTarget:r}),[e,i,n,o,r])})();o(()=>{M.jumpToTarget&&R(M.jumpToTarget.tab)},[M.jumpToTarget]),o(()=>{z&&JSON.stringify(Gt(n))!==JSON.stringify(Gt(z))&&L(null)},[n,z]);const _=p(!1),B=d(async()=>L(await m.fetchById(n)||null),[n,m]);o(()=>{if(_.current||(B(),_.current=!0),!k){const e=setInterval(()=>B(),3e3);return()=>clearInterval(e)}},[B,k]),o(()=>{z&&S(z)},[z]);const U=z&&Wb.includes(z.id.kind),V=a(()=>{const e=[],i=(z?.pods??[]).some(Qb),n=(a=z,(a?.containers??[]).some(e=>(e.instrumentations??[]).some(e=>!1===e.healthy)));var a;const o=e=>t(Ys,{...e,fill:s.v2.colors.red[500]});return e.push({value:fg.Overview,label:ke.OVERVIEW}),c?(e.push({value:fg.Pods,label:ke.PODS,icon:i?o:void 0}),e.push({value:fg.Libraries,label:ke.LIBRARIES,icon:n?o:void 0}),e.push({value:fg.PeerSources,label:ke.PEER_SOURCES}),w?.profiling?.enabled&&e.push({value:fg.Profiling,label:ke.PROFILING}),e.push({value:fg.Sampling,label:ke.SAMPLING}),e.push({value:fg.Debug,label:ke.DEBUG}),e):(u&&f.canFetchProfiling&&e.push({value:fg.Profiling,label:ke.PROFILING}),e)},[c,u,f.canFetchProfiling,w,z?.pods,s]),G=d(()=>T(!0),[]),H=a(()=>()=>{i(),r()},[i,r]),j=d(()=>{z&&S(z),T(!1)},[z]),K=d(async()=>{if(!z||!y)return;const{errorMessage:e,preparedFormData:t}=x();if(e)return;const i=t.otelServiceName!==z.id.name?t.otelServiceName:"";await m.update(n,{...t,otelServiceName:i}),T(!1)},[z,y,x,n,m]),Y=!1===z?.markedForInstrumentation?.markedForInstrumentation,J=d(()=>N(!0),[]),q=d(async()=>{if(!z)return;const e=!1===z.markedForInstrumentation?.markedForInstrumentation;await m.persistV2({[tt]:[{namespace:z.id.namespace,name:z.id.name,kind:z.id.kind,...z.id.region?{region:z.id.region}:{},selected:e,currentStreamName:g}]}),N(!1),e||i()},[z,m,g,i]),Z=d(()=>{P({openFor:Yb.Workload})},[]),Q=d(e=>{R(e),M.clearJumpToTarget()},[M]),ee=d(async()=>{await m.recoverFromRollback(n)},[m,n]),te=d(()=>P({openFor:null}),[]),ie=d(async()=>{X.openFor===Yb.Workload?await m.restartWorkloads([n]):X.openFor===Yb.Pod&&X.podNamespace&&X.podName&&await m.restartPod(X.podNamespace,X.podName),te()},[X,m,n,te]),ne=a(()=>{const{kind:e,name:t}=n;return{title:`Rollout ${e}`,description:`Are you sure you want to rollout the ${e.toLowerCase()} "${t}"?`}},[n]),ae=a(()=>{const e=[];return k||D===fg.Overview&&(e.push({id:"edit-source-btn-edit",label:lt.EDIT,icon:Cs,active:k,onClick:G}),c&&U&&e.push({id:"edit-source-btn-restart",label:ke.ROLLOUT_RESTART,icon:tc,onClick:Z}),e.push(Y?{id:"edit-source-btn-instrument",label:lt.INSTRUMENT,icon:ys,color:s.v2.colors.green[500],active:I,onClick:J}:{id:"edit-source-btn-delete",label:lt.UNINSTRUMENT,icon:vs,color:s.v2.colors.red[500],active:I,onClick:J})),e},[D,k,I,Y,c,U,G,Z,J,s]),oe=a(()=>{if(!z)return[];const e=[],t={backgroundColor:"transparent",textSize:C.S};return e.push({...t,label:z.id.name,leftIcon:c?Ws:void 0}),z.serviceName&&z.serviceName!==z.id.name&&e.push({...t,label:z.serviceName,leftIcon:Us,textColor:s.v2.colors.silver[200]}),e},[z,s,c]);if(!z)return t(ct,{isOpen:!0,children:t(Me,{$height:"80vh",children:t(Ve,{withSpinner:!0})})});const le=D===fg.Profiling?O?"95vw":"fit-content":k?void 0:"60vw",re=c?vi(z.containers)[0]:fi(h);return e($g,{value:M,children:[t(ct,{isOpen:!0,width:le,minWidth:"min(1100px, 100vw)",header:{icon:re,titleBadges:oe,onClose:()=>{Q(fg.Overview),L(null),E(!1),i()},actions:ae},footer:{actions:k?[{"data-id":"edit-source-btn-cancel",label:lt.CANCEL,variant:W.Secondary,onClick:j},{"data-id":"edit-source-btn-save",label:lt.SAVE,variant:W.Primary,onClick:K}]:[]},children:t(A,{$padding:"4px 12px 12px",children:e($,{$gap:16,children:[!k&&V.length>1&&t(F,{options:V,selected:D,setSelected:Q}),(()=>{switch(D){case fg.Overview:return k?t(Xp,{}):t(Gm,{source:z,onClickRollout:Z,onClickRollback:ee});case fg.Pods:return t(Dg,{source:z,onClickRestartPod:U?(e,t)=>P({openFor:Yb.Pod,podNamespace:e,podName:t}):void 0});case fg.Libraries:return t(Hm,{source:z});case fg.PeerSources:return t(zg,{source:z});case fg.Profiling:return t(zb,{source:z,onFlameFullscreenChange:E});case fg.Sampling:return t(Gb,{source:z,onRedirectToSampling:H});case fg.Debug:return t(_g,{source:z});default:return null}})()]})})}),t(Cd,{target:"source",action:Y?"instrument":"uninstrument",isOpen:I,onClose:()=>N(!1),onApprove:q}),t(Ce,{isOpen:X.openFor===Yb.Workload,title:ne.title,description:ne.description,onClose:te,denyButton:{label:"Go back",variant:W.Secondary,onClick:te},approveButton:{label:lt.CONFIRM,variant:W.Primary,onClick:ie}}),t(Cd,{target:"pod",action:"restart",description:ke.ROLLOUT_RESTART_WORKLOADS_DESCRIPTION,isOpen:X.openFor===Yb.Pod,onClose:te,onApprove:ie,overrideApproveButtonLabel:ke.DELETE_POD_TO_RESTART})]})},tf={"Cost Optimization":{icon:uc,status:ie.Warning},Normalization:{icon:pc,status:ie.Default},Enrichment:{icon:dc,status:ie.Info},Maintenance:{icon:Hs,status:ie.Warning},Reliability:{icon:zs,status:ie.Success},Usability:{icon:cc,status:ie.Info}},nf={icon:hc,status:ie.Unknown},af={[yi.Recommended]:ie.Info,[yi.Applied]:ie.Success,[yi.Dismissed]:ie.Disabled,[yi.NotApplicable]:ie.Unknown},of="Created from recommendation",lf={[xi.EnableUrlTemplatization]:()=>({type:q.URLTemplatization,name:"URL Templatization",notes:of,disabled:!1,signals:[ae.Traces],fields:{}}),[xi.EnableInferDbAttributes]:()=>({type:q.InferDbAttributes,name:"Infer DB Attributes",notes:of,disabled:!1,signals:[ae.Traces],fields:{}})},rf=e=>e.applyExamples.some(({type:e})=>e===Si.OdigosAction),sf=e=>rf(e)?lf[e.type]?.():void 0,cf=e=>e.applied?yi.Applied:e.conditionsMet?e.dismissed?yi.Dismissed:yi.Recommended:yi.NotApplicable,df=e=>{const t={[yi.Recommended]:[],[yi.Applied]:[],[yi.Dismissed]:[],[yi.NotApplicable]:[]};for(const i of e)t[cf(i)].push(i);return t},pf=e=>{let t=0;for(const i of e)cf(i)===yi.Recommended&&(t+=1);return t},uf=[yi.Recommended,yi.Applied,yi.Dismissed,yi.NotApplicable],hf={[Si.HelmValues]:"Helm values",[Si.OdigosAction]:"Odigos Action"},gf=({remediations:i})=>{const n=i.flatMap(e=>e.applyExamples.map((t,n)=>({key:`${e.type}-${t.type}-${n}`,title:i.length>1?`${hf[t.type]||t.type} — ${e.buttonText}`:hf[t.type]||t.type,content:t.content})));return n.length?e($,{$gap:8,children:[e($,{$gap:2,children:[t(w,{size:C.XS,color:k.Primary,weight:500,children:wi}),t(w,{size:C.XXS,color:k.Secondary,children:Ci})]}),n.map(e=>t(kd,{title:e.title,yaml:e.content,compact:!0},e.key))]}):null},mf=({recommendation:i,onApplyServerRemediation:n,onCreateAction:a,onApplied:o})=>{const[r,s]=l(),c=i.remediations.filter(e=>rf(e)?!!sf(e)&&!!a:!!n);return c.length?e($,{$gap:8,children:[e($,{$gap:2,children:[t(w,{size:C.XS,color:k.Primary,weight:500,children:ki}),t(w,{size:C.XXS,color:k.Secondary,children:Ti})]}),t(te,{status:ie.Default,message:Ii,fullWidth:!0,smallIcon:!0}),t(T,{$gap:8,$wrap:"wrap",children:c.map(e=>t(j,{"data-id":`apply-recommendation-${e.type}`,label:e.buttonText,tooltip:e.tooltip,size:K.S,variant:W.Primary,loading:r===e.type,disabled:!!r,onClick:()=>(async e=>{if(!r){s(e.type);try{(rf(e)?await(a?.(e)):await(n?.(e.type)))&&o?.()}finally{s(void 0)}}})(e)},e.type))})]}):null};var bf;(e=>{e.Ui="ui",e.GitOps="gitops"})(bf||(bf={}));const ff=({recommendation:i,onDismiss:n,onAcceptedChange:a,onApplyServerRemediation:r,onCreateAction:s,onApplied:c})=>{const p=!i.requireOdigosDeployment&&i.remediations.some(e=>rf(e)?!!sf(e)&&!!s:!!r),u=i.remediations.some(({applyExamples:e})=>e.length>0),[h,g]=l(!1),[m,b]=l(!1),[f,v]=l(()=>p?bf.Ui:bf.GitOps),y=[...p?[{value:bf.Ui,label:Di}]:[],...u?[{value:bf.GitOps,label:Ri}]:[]],S=y.length>1;o(()=>()=>a?.(!1),[a]);const x=d(()=>{g(!0),a?.(!0)},[a]),I=d(async()=>{if(n&&!m){b(!0);try{await n(i.name,!0)}finally{b(!1)}}},[m,n,i.name]);return p||u?e($,{$gap:0,children:[t(Td,{open:!h,gapCancelPx:0,children:e($,{$gap:12,children:[e($,{$gap:4,children:[t(w,{size:C.XS,color:k.Primary,weight:500,children:$i}),t(w,{size:C.XXS,color:k.Secondary,children:Ai})]}),e(T,{$gap:8,children:[t(j,{"data-id":"recommendation-accept",label:Ni,size:K.S,variant:W.Primary,onClick:x}),n&&t(j,{"data-id":"recommendation-dismiss",label:Oi,size:K.S,variant:W.Secondary,disabled:m,onClick:I})]})]})}),t(Td,{open:h,delayInMs:40,children:e($,{$gap:20,children:[S&&e($,{$gap:4,children:[t(w,{size:C.XS,color:k.Primary,weight:500,children:$i}),t(w,{size:C.XXS,color:k.Secondary,children:Ei}),t(F,{"data-id":"recommendation-installation-method",size:rt.S,fullWidth:!0,selected:f,setSelected:v,options:y})]}),f===bf.Ui&&p?t(mf,{recommendation:i,onApplyServerRemediation:r,onCreateAction:s,onApplied:c}):t(gf,{remediations:i.remediations})]})})]}):null},vf=f.ul`
|
|
852
|
+
`,Gb=({source:e,onRedirectToSampling:i})=>t(mt,{bgTint:"1000",richTitle:{title:ke.CONTAINERS,badge:{label:e.containers?.length??0}},children:e.containers?.map(e=>t(Wb,{container:e,onRedirectToSampling:i},e.containerName))});var Hb;(e=>{e.All="all",e.Noisy="noisy",e.HighlyRelevant="highly-relevant",e.CostReduction="cost-reduction"})(Hb||(Hb={}));const jb=e=>"noisy"===e.type?_r(e.rule,"source"):"highlyRelevant"===e.type?Fr(e.rule,"source"):"costReduction"===e.type?Br(e.rule,"source"):[],Wb=({container:i,onRedirectToSampling:n})=>{const[o,r]=l(Hb.All),s=Vt(e=>e.setPendingViewSamplingRule),c=i.agentConfig?.traces?.headSampling?.noisyOperations??[],d=a(()=>(i.collectorConfig?.tailSampling?.noisyOperations??[]).map(e=>({type:"noisy",rule:e})),[i.agentConfig?.traces?.headSampling?.noisyOperations]),p=a(()=>(i.collectorConfig?.tailSampling?.highlyRelevantOperations??[]).map(e=>({type:"highlyRelevant",rule:e})),[i.collectorConfig?.tailSampling?.highlyRelevantOperations]),u=a(()=>(i.collectorConfig?.tailSampling?.costReductionRules??[]).map(e=>({type:"costReduction",rule:e})),[i.collectorConfig?.tailSampling?.costReductionRules]),h=a(()=>o===Hb.Noisy?d:o===Hb.HighlyRelevant?p:o===Hb.CostReduction?u:[...d,...p,...u],[o,p,u]),g=d.length+p.length+u.length,m=a(()=>(e,t)=>{s({ruleId:e,category:t}),n()},[n,s]),b=t(Bb,{children:t(j,{"data-id":"sampling-container-create-rule",variant:K.Secondary,size:W.S,label:bi,rightIcon:ys,onClick:e=>{e.stopPropagation(),n()}})});return t(Ub,{children:e(mt,{bgTint:"900",richTitle:{title:i.containerName},renderOnRightSide:b,withCollapse:!0,collapseIsDefaultOpen:!0,children:[c.length?e(mt,{bgTint:"800",richTitle:{title:ke.HEAD_SAMPLING,badge:{label:c.length}},children:[t(w,{size:C.XXS,children:ke.NOISY_OPERATIONS}),t($,{$gap:4,children:c.map(e=>t(Fb,{name:e.name,summary:_r(e),disabled:e.disabled,onJumpToRule:()=>m(e.ruleId,"noisy")},e.ruleId))})]}):t(Vb,{children:t(w,{size:C.XS,color:k.Secondary,children:ke.HEAD_SAMPLING})}),g?e(mt,{bgTint:"800",richTitle:{title:ke.TAIL_SAMPLING,badge:{label:g}},children:[t(F,{options:(f=d.length,v=p.length,y=u.length,[{value:Hb.All,label:"All",badge:{label:f+v+y,textSize:C.XXXS}},{value:Hb.Noisy,label:ke.NOISY_OPERATIONS,badge:{label:f,textSize:C.XXXS}},{value:Hb.HighlyRelevant,label:ke.HIGHLY_RELEVANT_OPERATIONS,badge:{label:v,textSize:C.XXXS}},{value:Hb.CostReduction,label:ke.COST_REDUCTION_OPERATIONS,badge:{label:y,textSize:C.XXXS}}]),selected:o,setSelected:r}),t($,{$gap:4,children:h.length?h.map(e=>t(Fb,{name:e.rule.name,summary:jb(e),disabled:e.rule.disabled,onJumpToRule:()=>m(e.rule.ruleId,e.type)},e.rule.ruleId)):t(Z,{title:`No ${o===Hb.All?`${Hb.Noisy}, ${Hb.HighlyRelevant} and ${Hb.CostReduction}`:o} operations`})})]}):t(Vb,{children:t(w,{size:C.XS,color:k.Secondary,children:ke.TAIL_SAMPLING})})]})});var f,v,y},Kb=[Yt.Deployment,Yt.StatefulSet,Yt.DaemonSet,Yt.DeploymentConfig,Yt.Rollout,Yt.Pod];var Yb;(e=>{e.Workload="Workload",e.Pod="Pod"})(Yb||(Yb={}));const qb=e=>!!e&&Rt(e.status)===ie.Error,Jb=e=>qb(e.healthStatus),Zb=e=>qb(e.odigosHealthStatus)||(e.processes??[]).some(Jb),Qb=e=>qb(e.agentInjectedStatus)||qb(e.odigosHealthStatus)||(e.containers??[]).some(Zb),ef=({onClose:i,sourceId:n,onRedirectToSampling:r})=>{const s=v(),{isK8s:c,isVm:u,platformType:h}=Pr(),{selectedStreamName:g}=Te(),{sourcesApi:m,configApi:b,capabilities:f}=Lc(),{genericForm:y,loadSource:S,validateFormData:x}=Bc(),{data:w}=b.useEffectiveConfig(),[k,T]=l(!1),[I,A]=l(!1),[O,E]=l(!1),[D,R]=l(fg.Overview),[z,X]=l(null),[P,L]=l({openFor:null}),M=(()=>{const[e,t]=l(null),i=d(e=>{t({tab:fg.Pods,podName:e.podName})},[]),n=d((e,i)=>{t({tab:fg.Pods,podName:e.podName,containerName:i.containerName})},[]),o=d((e,i,n)=>{const a=Cg({identifyingAttributes:n.identifyingAttributes});t({tab:fg.Pods,podName:e.podName,containerName:i.containerName,processPid:a})},[]),r=d(()=>t(null),[]);return a(()=>({jumpToTarget:e,jumpToPod:i,jumpToContainer:n,jumpToProcess:o,clearJumpToTarget:r}),[e,i,n,o,r])})();o(()=>{M.jumpToTarget&&R(M.jumpToTarget.tab)},[M.jumpToTarget]),o(()=>{z&&JSON.stringify(Gt(n))!==JSON.stringify(Gt(z))&&X(null)},[n,z]);const _=p(!1),B=d(async()=>X(await m.fetchById(n)||null),[n,m]);o(()=>{if(_.current||(B(),_.current=!0),!k){const e=setInterval(()=>B(),3e3);return()=>clearInterval(e)}},[B,k]),o(()=>{z&&S(z)},[z]);const U=z&&Kb.includes(z.id.kind),V=a(()=>{const e=[],i=(z?.pods??[]).some(Qb),n=(a=z,(a?.containers??[]).some(e=>(e.instrumentations??[]).some(e=>!1===e.healthy)));var a;const o=e=>t(Ys,{...e,fill:s.v2.colors.red[500]});return e.push({value:fg.Overview,label:ke.OVERVIEW}),c?(e.push({value:fg.Pods,label:ke.PODS,icon:i?o:void 0}),e.push({value:fg.Libraries,label:ke.LIBRARIES,icon:n?o:void 0}),e.push({value:fg.PeerSources,label:ke.PEER_SOURCES}),w?.profiling?.enabled&&e.push({value:fg.Profiling,label:ke.PROFILING}),e.push({value:fg.Sampling,label:ke.SAMPLING}),e.push({value:fg.Debug,label:ke.DEBUG}),e):(u&&f.canFetchProfiling&&e.push({value:fg.Profiling,label:ke.PROFILING}),e)},[c,u,f.canFetchProfiling,w,z?.pods,s]),G=d(()=>T(!0),[]),H=a(()=>()=>{i(),r()},[i,r]),j=d(()=>{z&&S(z),T(!1)},[z]),W=d(async()=>{if(!z||!y)return;const{errorMessage:e,preparedFormData:t}=x();if(e)return;const i=t.otelServiceName!==z.id.name?t.otelServiceName:"";await m.update(n,{...t,otelServiceName:i}),T(!1)},[z,y,x,n,m]),Y=!1===z?.markedForInstrumentation?.markedForInstrumentation,q=d(()=>A(!0),[]),J=d(async()=>{if(!z)return;const e=!1===z.markedForInstrumentation?.markedForInstrumentation;await m.persistV2({[tt]:[{namespace:z.id.namespace,name:z.id.name,kind:z.id.kind,...z.id.region?{region:z.id.region}:{},selected:e,currentStreamName:g}]}),A(!1),e||i()},[z,m,g,i]),Z=d(()=>{L({openFor:Yb.Workload})},[]),Q=d(e=>{R(e),M.clearJumpToTarget()},[M]),ee=d(async()=>{await m.recoverFromRollback(n)},[m,n]),te=d(()=>L({openFor:null}),[]),ie=d(async()=>{P.openFor===Yb.Workload?await m.restartWorkloads([n]):P.openFor===Yb.Pod&&P.podNamespace&&P.podName&&await m.restartPod(P.podNamespace,P.podName),te()},[P,m,n,te]),ne=a(()=>{const{kind:e,name:t}=n;return{title:`Rollout ${e}`,description:`Are you sure you want to rollout the ${e.toLowerCase()} "${t}"?`}},[n]),ae=a(()=>{const e=[];return k||D===fg.Overview&&(e.push({id:"edit-source-btn-edit",label:lt.EDIT,icon:Cs,active:k,onClick:G}),c&&U&&e.push({id:"edit-source-btn-restart",label:ke.ROLLOUT_RESTART,icon:tc,onClick:Z}),e.push(Y?{id:"edit-source-btn-instrument",label:lt.INSTRUMENT,icon:ys,color:s.v2.colors.green[500],active:I,onClick:q}:{id:"edit-source-btn-delete",label:lt.UNINSTRUMENT,icon:vs,color:s.v2.colors.red[500],active:I,onClick:q})),e},[D,k,I,Y,c,U,G,Z,q,s]),oe=a(()=>{if(!z)return[];const e=[],t={backgroundColor:"transparent",textSize:C.S};return e.push({...t,label:z.id.name,leftIcon:c?Ks:void 0}),z.serviceName&&z.serviceName!==z.id.name&&e.push({...t,label:z.serviceName,leftIcon:Us,textColor:s.v2.colors.silver[200]}),e},[z,s,c]);if(!z)return t(ct,{isOpen:!0,children:t(Me,{$height:"80vh",children:t(Ve,{withSpinner:!0})})});const le=D===fg.Profiling?O?"95vw":"fit-content":k?void 0:"60vw",re=c?vi(z.containers)[0]:fi(h);return e($g,{value:M,children:[t(ct,{isOpen:!0,width:le,minWidth:"min(1100px, 100vw)",header:{icon:re,titleBadges:oe,onClose:()=>{Q(fg.Overview),X(null),E(!1),i()},actions:ae},footer:{actions:k?[{"data-id":"edit-source-btn-cancel",label:lt.CANCEL,variant:K.Secondary,onClick:j},{"data-id":"edit-source-btn-save",label:lt.SAVE,variant:K.Primary,onClick:W}]:[]},children:t(N,{$padding:"4px 12px 12px",children:e($,{$gap:16,children:[!k&&V.length>1&&t(F,{options:V,selected:D,setSelected:Q}),(()=>{switch(D){case fg.Overview:return k?t(Pp,{}):t(Gm,{source:z,onClickRollout:Z,onClickRollback:ee});case fg.Pods:return t(Dg,{source:z,onClickRestartPod:U?(e,t)=>L({openFor:Yb.Pod,podNamespace:e,podName:t}):void 0});case fg.Libraries:return t(Hm,{source:z});case fg.PeerSources:return t(zg,{source:z});case fg.Profiling:return t(zb,{source:z,onFlameFullscreenChange:E});case fg.Sampling:return t(Gb,{source:z,onRedirectToSampling:H});case fg.Debug:return t(_g,{source:z});default:return null}})()]})})}),t(Cd,{target:"source",action:Y?"instrument":"uninstrument",isOpen:I,onClose:()=>A(!1),onApprove:J}),t(Ce,{isOpen:P.openFor===Yb.Workload,title:ne.title,description:ne.description,onClose:te,denyButton:{label:"Go back",variant:K.Secondary,onClick:te},approveButton:{label:lt.CONFIRM,variant:K.Primary,onClick:ie}}),t(Cd,{target:"pod",action:"restart",description:ke.ROLLOUT_RESTART_WORKLOADS_DESCRIPTION,isOpen:P.openFor===Yb.Pod,onClose:te,onApprove:ie,overrideApproveButtonLabel:ke.DELETE_POD_TO_RESTART})]})},tf={"Cost Optimization":{icon:uc,status:ie.Warning},Normalization:{icon:pc,status:ie.Default},Enrichment:{icon:dc,status:ie.Info},Maintenance:{icon:Hs,status:ie.Warning},Reliability:{icon:zs,status:ie.Success},Usability:{icon:cc,status:ie.Info}},nf={icon:hc,status:ie.Unknown},af={[yi.Recommended]:ie.Info,[yi.Applied]:ie.Success,[yi.Dismissed]:ie.Disabled,[yi.NotApplicable]:ie.Unknown},of="Created from recommendation",lf={[xi.EnableUrlTemplatization]:()=>({type:J.URLTemplatization,name:"URL Templatization",notes:of,disabled:!1,signals:[ae.Traces],fields:{}}),[xi.EnableInferDbAttributes]:()=>({type:J.InferDbAttributes,name:"Infer DB Attributes",notes:of,disabled:!1,signals:[ae.Traces],fields:{}})},rf=e=>e.applyExamples.some(({type:e})=>e===Si.OdigosAction),sf=e=>rf(e)?lf[e.type]?.():void 0,cf=e=>e.applied?yi.Applied:e.conditionsMet?e.dismissed?yi.Dismissed:yi.Recommended:yi.NotApplicable,df=e=>{const t={[yi.Recommended]:[],[yi.Applied]:[],[yi.Dismissed]:[],[yi.NotApplicable]:[]};for(const i of e)t[cf(i)].push(i);return t},pf=e=>{let t=0;for(const i of e)cf(i)===yi.Recommended&&(t+=1);return t},uf=[yi.Recommended,yi.Applied,yi.Dismissed,yi.NotApplicable],hf={[Si.HelmValues]:"Helm values",[Si.OdigosAction]:"Odigos Action"},gf=({remediations:i})=>{const n=i.flatMap(e=>e.applyExamples.map((t,n)=>({key:`${e.type}-${t.type}-${n}`,title:i.length>1?`${hf[t.type]||t.type} — ${e.buttonText}`:hf[t.type]||t.type,content:t.content})));return n.length?e($,{$gap:8,children:[e($,{$gap:2,children:[t(w,{size:C.XS,color:k.Primary,weight:500,children:wi}),t(w,{size:C.XXS,color:k.Secondary,children:Ci})]}),n.map(e=>t(kd,{title:e.title,yaml:e.content,compact:!0},e.key))]}):null},mf=({recommendation:i,onApplyServerRemediation:n,onCreateAction:a,onApplied:o})=>{const[r,s]=l(),c=i.remediations.filter(e=>rf(e)?!!sf(e)&&!!a:!!n);return c.length?e($,{$gap:8,children:[e($,{$gap:2,children:[t(w,{size:C.XS,color:k.Primary,weight:500,children:ki}),t(w,{size:C.XXS,color:k.Secondary,children:Ti})]}),t(te,{status:ie.Default,message:Ii,fullWidth:!0,smallIcon:!0}),t(T,{$gap:8,$wrap:"wrap",children:c.map(e=>t(j,{"data-id":`apply-recommendation-${e.type}`,label:e.buttonText,tooltip:e.tooltip,size:W.S,variant:K.Primary,loading:r===e.type,disabled:!!r,onClick:()=>(async e=>{if(!r){s(e.type);try{(rf(e)?await(a?.(e)):await(n?.(e.type)))&&o?.()}finally{s(void 0)}}})(e)},e.type))})]}):null};var bf;(e=>{e.Ui="ui",e.GitOps="gitops"})(bf||(bf={}));const ff=({recommendation:i,onDismiss:n,onAcceptedChange:a,onApplyServerRemediation:r,onCreateAction:s,onApplied:c})=>{const p=!i.requireOdigosDeployment&&i.remediations.some(e=>rf(e)?!!sf(e)&&!!s:!!r),u=i.remediations.some(({applyExamples:e})=>e.length>0),[h,g]=l(!1),[m,b]=l(!1),[f,v]=l(()=>p?bf.Ui:bf.GitOps),y=[...p?[{value:bf.Ui,label:Di}]:[],...u?[{value:bf.GitOps,label:Ri}]:[]],S=y.length>1;o(()=>()=>a?.(!1),[a]);const x=d(()=>{g(!0),a?.(!0)},[a]),I=d(async()=>{if(n&&!m){b(!0);try{await n(i.name,!0)}finally{b(!1)}}},[m,n,i.name]);return p||u?e($,{$gap:0,children:[t(Td,{open:!h,gapCancelPx:0,children:e($,{$gap:12,children:[e($,{$gap:4,children:[t(w,{size:C.XS,color:k.Primary,weight:500,children:$i}),t(w,{size:C.XXS,color:k.Secondary,children:Ni})]}),e(T,{$gap:8,children:[t(j,{"data-id":"recommendation-accept",label:Ai,size:W.S,variant:K.Primary,onClick:x}),n&&t(j,{"data-id":"recommendation-dismiss",label:Oi,size:W.S,variant:K.Secondary,disabled:m,onClick:I})]})]})}),t(Td,{open:h,delayInMs:40,children:e($,{$gap:20,children:[S&&e($,{$gap:4,children:[t(w,{size:C.XS,color:k.Primary,weight:500,children:$i}),t(w,{size:C.XXS,color:k.Secondary,children:Ei}),t(F,{"data-id":"recommendation-installation-method",size:rt.S,fullWidth:!0,selected:f,setSelected:v,options:y})]}),f===bf.Ui&&p?t(mf,{recommendation:i,onApplyServerRemediation:r,onCreateAction:s,onApplied:c}):t(gf,{remediations:i.remediations})]})})]}):null},vf=f.ul`
|
|
853
853
|
margin: 0;
|
|
854
854
|
padding-left: 18px;
|
|
855
855
|
display: flex;
|
|
@@ -895,7 +895,7 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
895
895
|
`,kf=f(T)`
|
|
896
896
|
width: 100%;
|
|
897
897
|
padding-top: 4px;
|
|
898
|
-
`,Tf=({recommendation:i,state:n,onDismiss:a,onApplyServerRemediation:o,onCreateAction:r,onRemediationApplied:s})=>{const c=v(),[p,u]=l(!1),[h,g]=l(!1),m=n===yi.NotApplicable?zi:i.summary,b=i.description.trim().split(/\n\s*\n/).map(e=>e.replace(/\s+/g," ").trim()).filter(Boolean),f=(y=i.categories[0])&&tf[y]||nf;var y;const S=n===yi.Recommended&&i.conditionsMet,x=S&&!h,I=n===yi.Recommended&&!!a&&!x,
|
|
898
|
+
`,Tf=({recommendation:i,state:n,onDismiss:a,onApplyServerRemediation:o,onCreateAction:r,onRemediationApplied:s})=>{const c=v(),[p,u]=l(!1),[h,g]=l(!1),m=n===yi.NotApplicable?zi:i.summary,b=i.description.trim().split(/\n\s*\n/).map(e=>e.replace(/\s+/g," ").trim()).filter(Boolean),f=(y=i.categories[0])&&tf[y]||nf;var y;const S=n===yi.Recommended&&i.conditionsMet,x=S&&!h,I=n===yi.Recommended&&!!a&&!x,N=n===yi.Dismissed&&!!a,A=n===yi.Recommended?void 0:{key:n,label:Xi[n],status:af[n],useSecondaryTone:!0,textSize:C.XXXS},O=d(async()=>{if(a&&!p){u(!0);try{await a(i.name,n!==yi.Dismissed)}finally{u(!1)}}},[a,p,i.name,n]);return t(Cf,{children:t(mt,{bgTint:"900",moreSpacing:!0,withCollapse:!0,badges:A?[A]:[],richTitle:{icon:f.icon,title:i.title,titleSize:C.S,titleWrap:!0,titleMeta:i.categories.join(" · "),subTitle:m,subTitleSize:C.XXS,subTitleWrap:!0,textGap:6,alignItems:"flex-start"},children:e($,{$gap:16,children:[t(Td,{open:!h,gapCancelPx:16,children:e($,{$gap:16,children:[b.length>0&&t($,{$gap:8,children:b.map(e=>t(w,{size:C.XS,color:k.Secondary,lineHeight:"20px",children:e},e))}),(i.pros.length>0||i.cons.length>0)&&e(Sf,{children:[i.pros.length>0&&e(xf,{$gap:8,children:[e(T,{$gap:8,children:[t(wf,{children:t(Ds,{size:10,fill:c.v2.colors.green[600]})}),t(w,{size:C.XS,weight:400,color:k.Primary,children:Pi})]}),t(vf,{children:i.pros.slice(0,3).map(e=>t(yf,{children:t(w,{size:C.XXS,color:k.Secondary,variant:Ze.Span,children:e})},e))})]}),i.cons.length>0&&e(xf,{$gap:8,children:[e(T,{$gap:8,children:[t(Ys,{size:18,fill:c.v2.colors.orange[500]}),t(w,{size:C.XS,weight:400,color:k.Primary,children:Li})]}),t(vf,{children:i.cons.slice(0,3).map(e=>t(yf,{children:t(w,{size:C.XXS,color:k.Secondary,variant:Ze.Span,children:e})},e))})]})]})]})}),S&&t(ff,{recommendation:i,onDismiss:a,onAcceptedChange:g,onApplyServerRemediation:o,onCreateAction:r,onApplied:s}),e(kf,{$gap:8,$justifyContent:"flex-end",children:[i.docsUrl&&t(j,{label:Mi,leftIcon:xs,size:W.S,variant:K.Text,onClick:()=>window.open(i.docsUrl,"_blank","noopener noreferrer")}),I&&t(j,{label:Oi,size:W.S,variant:K.Secondary,disabled:p,onClick:O}),N&&t(j,{label:_i,size:W.S,variant:K.Secondary,disabled:p,onClick:O})]})]})})})},If=f.div`
|
|
899
899
|
width: 100%;
|
|
900
900
|
min-width: 0;
|
|
901
901
|
max-width: 100%;
|
|
@@ -907,13 +907,13 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
907
907
|
&:hover {
|
|
908
908
|
opacity: 1;
|
|
909
909
|
}
|
|
910
|
-
`,
|
|
910
|
+
`,Nf=f(T)`
|
|
911
911
|
width: 100%;
|
|
912
912
|
min-height: 28px;
|
|
913
913
|
padding-left: 10px;
|
|
914
914
|
border-left: 2px solid
|
|
915
915
|
${({theme:e,$state:t})=>t===yi.Recommended?e.v2.colors.purple[500]:t===yi.Applied?e.v2.colors.green[500]:e.v2.colors.grey[500]};
|
|
916
|
-
`,
|
|
916
|
+
`,Af=({isOpen:i,onClose:n})=>{const{actionsApi:l,capabilities:r,recommendationsApi:s}=Lc(),{items:c,loading:u,refetch:h}=s.useRecommendations(),g=p([]),m=p(h);m.current=h,o(()=>{i&&m.current()},[i]),o(()=>()=>{g.current.forEach(clearTimeout)},[]);const b=d(()=>{g.current.forEach(clearTimeout),g.current=[2e3,5e3,1e4].map(e=>setTimeout(()=>{m.current()},e))},[]),f=d(async(e,t)=>{if(!s.applyRemediation)return!1;const i=await s.applyRemediation(e,t);return!i?.error},[s]),v=d(async e=>{const t=sf(e);if(!t)return!1;const i=await l.create(t);return!i?.error},[l]),y=a(()=>df(c),[c]),S=c.length>0;return t(ct,{isOpen:i,width:"min(700px, 100vw)",header:{icon:hc,title:Bi,subTitle:Fi,onClose:n},children:t(If,{children:u&&!S?t(A,{size:3}):S?t($,{$gap:28,$width:"100%",children:uf.map(i=>{const n=y[i];return 0===n.length?null:e($f,{$state:i,$gap:12,$width:"100%",children:[e(Nf,{$state:i,$gap:8,$justifyContent:"space-between",children:[t(w,{size:C.XS,weight:600,color:i===yi.Recommended?k.Primary:k.Secondary,children:Xi[i]}),t(E,{label:n.length,status:af[i],useSecondaryTone:!0,textSize:C.XXXS})]}),t($,{$gap:12,$width:"100%",children:n.map(e=>t(Tf,{recommendation:e,state:i,onDismiss:s.setDismissed,onApplyServerRemediation:s.applyRemediation?t=>f(e.type,t):void 0,onCreateAction:r.canCreateAction?v:void 0,onRemediationApplied:b},e.name))})]},i)})}):t(Z,{icon:hc,title:Vi,subTitle:Ui})})})},Of=f.div`
|
|
917
917
|
display: flex;
|
|
918
918
|
align-items: center;
|
|
919
919
|
gap: 8px;
|
|
@@ -925,18 +925,18 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
925
925
|
}
|
|
926
926
|
`,Ef=f.div`
|
|
927
927
|
flex: 1;
|
|
928
|
-
`,Df=({onClick:i})=>{const n=v().v2.colors.red[500];return e(Of,{"data-id":"sampling-view-btn-delete",onClick:i,children:[t(w,{size:C.XS,weight:500,color:n,children:
|
|
928
|
+
`,Df=({onClick:i})=>{const n=v().v2.colors.red[500];return e(Of,{"data-id":"sampling-view-btn-delete",onClick:i,children:[t(w,{size:C.XS,weight:500,color:n,children:Wi}),t(vs,{size:16,fill:n})]})};const Rf={[Vc.EditAutoNoisy]:{title:sn,subTitle:rn,cancelId:"sampling-edit-auto-rule-btn-cancel",saveId:"sampling-edit-auto-rule-btn-save"},[Vc.EditAutoCostReduction]:{title:ln,subTitle:on,cancelId:"sampling-edit-cost-reduction-auto-rule-btn-cancel",saveId:"sampling-edit-cost-reduction-auto-rule-btn-save"},[Vc.EditAutoHighlyRelevant]:{title:an,subTitle:nn,cancelId:"sampling-edit-highly-relevant-auto-rule-btn-cancel",saveId:"sampling-edit-highly-relevant-auto-rule-btn-save"}},zf=({isOpen:e,title:i,subTitle:n,onClose:a,footer:o,renderBody:l})=>t(ct,{isOpen:e,width:dn,header:{icon:uc,title:i,subTitle:n,onClose:a},footer:o,children:l?l():t(N,{$padding:"12px",children:t(Up,{})})}),Xf=({isOpen:n,onClose:r,onSubmit:s,validateForm:c,onNavigateToDuplicate:p})=>{const{category:u,formData:h,resetForm:g,duplicateWarning:m,setDuplicateWarning:b}=Uc(Vc.Create),[f,v]=l(!1);o(()=>{n&&(g(),v(!1))},[n]);const y=d(()=>{v(!1),s(h)},[h,s]),S=d(()=>{if(c){const e=c(h);if(e)return void b(e)}((e,t)=>JSON.stringify(e)===JSON.stringify(Ur(t)))(h,u)?v(!0):y()},[h,u,c,b,y]),x=a(()=>f?((e,t)=>{switch(e){case"noisy":return _r(Hr(t));case"highlyRelevant":return Fr(Gr(t));case"costReduction":return Br(Vr(t))}})(u,h):[],[f,u,h]),T={note:m?{status:ie.Warning,message:m.message,action:p?{"data-id":"sampling-create-btn-view-duplicate",label:"View rule",onClick:()=>p(m.ruleId)}:void 0}:void 0,actions:[{"data-id":"sampling-create-btn-cancel",label:Gi,variant:K.Secondary,size:W.S,onClick:r},{"data-id":"sampling-create-btn-submit",label:bi,variant:K.Primary,size:W.S,onClick:S,disabled:!!m}]};return e(i,{children:[t(zf,{isOpen:n,title:Ji[u],subTitle:Ki[u],onClose:r,footer:T}),t(Ce,{isOpen:f,title:en,description:Qi,onClose:()=>v(!1),denyButton:{"data-id":"sampling-create-default-continue-editing",label:Zi,variant:K.Secondary,onClick:()=>v(!1)},approveButton:{"data-id":"sampling-create-default-confirm",label:bi,variant:K.Primary,onClick:y},children:e($,{$gap:8,$alignItems:"flex-start",style:{width:"100%"},children:[t(w,{size:C.XS,weight:500,color:k.Secondary,children:tn}),t("div",{style:{width:"100%"},children:t(pd,{summary:x})})]})})]})},Pf=({onClose:n,onDelete:o,onSaveEdit:l,validateForm:r,onNavigateToDuplicate:s})=>{const{data:c,isEditing:p,formData:u,handleEdit:h,handleCancelEdit:g,duplicateWarning:m,setDuplicateWarning:b}=Uc(Vc.View),f=c?.rule.name||qi,v=p&&c?Yi[c.category]:`${f} preview`,y=d(()=>{if(c&&p){if(r){const e=r(u);if(e)return void b(e)}l(u,c.rule.ruleId,c.samplingId),g()}},[c,p,u,l,r,b,g]),S=d(()=>{c&&o(c.rule.ruleId,c.samplingId)},[c,o]),x=a(()=>{if(!c)return;const a=m?{message:m.message,onViewRule:s?()=>s(m.ruleId):void 0}:null;return function(n){if(n.isEditing){const{onCancelEdit:a,onSave:o,onDelete:l,duplicateWarning:r}=n;return{children:e(i,{children:[t(Df,{onClick:l}),r&&t(te,{status:ie.Warning,message:r.message,action:r.onViewRule?{"data-id":"sampling-view-edit-btn-view-duplicate",label:"View rule",onClick:r.onViewRule}:void 0}),t(Ef,{}),t(j,{"data-id":"sampling-view-edit-btn-cancel",label:Gi,variant:K.Secondary,size:W.S,onClick:a}),t(j,{"data-id":"sampling-view-edit-btn-save",label:Hi,variant:K.Primary,size:W.S,onClick:o,disabled:!!r})]})}}const{onDelete:a,onCancel:o,onEdit:l}=n;return{children:e(i,{children:[t(Df,{onClick:a}),t(Ef,{}),t(j,{"data-id":"sampling-view-btn-cancel",label:Gi,variant:K.Secondary,size:W.S,onClick:o}),t(j,{"data-id":"sampling-view-btn-edit",label:ji,variant:K.Primary,size:W.S,onClick:l})]})}}(p?{isEditing:!0,onCancelEdit:g,onSave:y,onDelete:S,duplicateWarning:a}:{isEditing:!1,onDelete:S,onCancel:n,onEdit:h})},[c,p,m,g,y,S,h,n,s]);return t(zf,{isOpen:!!c,title:v,subTitle:c?Ki[c.category]:"",onClose:n,footer:x})},Lf=({isOpen:e,onClose:i,onSave:n})=>{const{localEnabled:a,resolvedPercentage:o}=Uc(Vc.EditAutoNoisy),l=d(()=>n(a,o),[n,a,o]);return t(Ff,{formType:Vc.EditAutoNoisy,isOpen:e,onClose:i,onSave:l})},Mf=({isOpen:e,onClose:i,onSave:n})=>{const{localEnabled:a,resolvedPercentage:o}=Uc(Vc.EditAutoCostReduction),l=d(()=>n(a,o),[n,a,o]);return t(Ff,{formType:Vc.EditAutoCostReduction,isOpen:e,onClose:i,onSave:l})},_f=({isOpen:e,onClose:i,onSave:n})=>{const{localEnabled:a}=Uc(Vc.EditAutoHighlyRelevant),o=d(()=>n(a),[n,a]);return t(Ff,{formType:Vc.EditAutoHighlyRelevant,isOpen:e,onClose:i,onSave:o})},Ff=({formType:e,isOpen:i,onClose:n,onSave:a})=>{const o=Rf[e];return t(zf,{isOpen:i,title:o.title,subTitle:o.subTitle,onClose:n,footer:{actions:[{"data-id":o.cancelId,label:Gi,variant:K.Secondary,size:W.S,onClick:n},{"data-id":o.saveId,label:cn,variant:K.Primary,size:W.S,onClick:a}]}})},Bf=e=>{switch(e.formType){case Vc.Create:return t(qc,{formType:Vc.Create,category:e.category,sourceOptions:e.sourceOptions,namespaceOptions:e.namespaceOptions,children:t(Xf,{...e})});case Vc.View:return t(qc,{formType:Vc.View,data:e.data,defaultEditMode:e.defaultEditMode,sourceOptions:e.sourceOptions,namespaceOptions:e.namespaceOptions,children:t(Pf,{...e})});case Vc.EditAutoNoisy:return t(qc,{formType:Vc.EditAutoNoisy,enabled:e.enabled,keepPercentage:e.keepPercentage,children:t(Lf,{...e})});case Vc.EditAutoCostReduction:return t(qc,{formType:Vc.EditAutoCostReduction,enabled:e.enabled,dropPercentage:e.dropPercentage,children:t(Mf,{...e})});case Vc.EditAutoHighlyRelevant:return t(qc,{formType:Vc.EditAutoHighlyRelevant,enabled:e.enabled,children:t(_f,{...e})})}};function Uf(){return{scopes:Wr(),enabled:!0,skipForNonSuccessCodes:!0,skipSelectedHttpStatusCodes:!1,skipHttpStatusCodesInput:""}}function Vf(e){const t=e.trim();if(!t)return[];const i=[];for(const e of t.split(",")){const t=e.trim();if(!t)continue;if(!/^\d+$/.test(t))return null;const n=Number(t);if(n<100||n>599)return null;i.push(n)}return i}function Gf(e){return{destination:"template-group",groupMode:e?.hasExistingGroups?"existing":"new",existingGroupIndex:null,targetActionId:e?.defaultActionId??null,createNewAction:!1,newActionName:"",scopes:Wr(),templates:[""]}}function Hf(e){if(e.scopes&&!jr(e.scopes))return Lr(e.scopes);const t=Wr();return e.filterK8sNamespace&&(t.namespaces=[e.filterK8sNamespace]),e.filterProgrammingLanguage&&(t.languages=[e.filterProgrammingLanguage]),e.workloadFilters?.length?t.sources=e.workloadFilters.filter(e=>!!e.name).map(t=>({namespace:e.filterK8sNamespace||"",kind:t.kind||"Deployment",name:t.name||""})):e.filterK8sWorkloadName&&(t.sources=[{namespace:e.filterK8sNamespace||"",kind:e.filterK8sWorkloadKind||"Deployment",name:e.filterK8sWorkloadName}]),t}const jf=f.div`
|
|
929
929
|
display: flex;
|
|
930
930
|
align-items: center;
|
|
931
931
|
flex-wrap: wrap;
|
|
932
932
|
gap: 8px;
|
|
933
933
|
min-width: 0;
|
|
934
|
-
`,
|
|
934
|
+
`,Wf=f.div`
|
|
935
935
|
display: flex;
|
|
936
936
|
align-items: center;
|
|
937
937
|
gap: 4px;
|
|
938
938
|
min-width: 0;
|
|
939
|
-
`;function
|
|
939
|
+
`;function Kf({label:i,items:n,variant:a}){if(!n.length)return null;const o=n.length<=2?n.join(", "):n[0],l=n.length<=2?0:n.length-1;return e(Wf,{children:[t(w,{size:C.XXXS,color:k.Secondary,nowrap:!0,children:i}),t(It,{variant:a,label:o}),l>0&&t(It,{variant:a,label:`+${l}`})]})}const Yf=({scopes:i})=>{if(jr(i))return t(w,{size:C.XXS,color:k.Secondary,children:pn});const a=i.languages??[],o=i.namespaces??[],l=(i.sources??[]).map(e=>[e.namespace,e.name].filter(Boolean).join(" / ")),r=[a.length?t(Kf,{label:un,items:a,variant:Mt.Yellow},"languages"):null,o.length?t(Kf,{label:hn,items:o,variant:Mt.Purple},"namespaces"):null,l.length?t(Kf,{label:gn,items:l,variant:Mt.Blue},"sources"):null].filter(Boolean);return t(jf,{children:r.map((i,a)=>e(n.Fragment,{children:[a>0&&t(w,{size:C.XXXS,color:k.Secondary,nowrap:!0,children:mn}),i]},a))})},qf=f.div`
|
|
940
940
|
display: flex;
|
|
941
941
|
flex-direction: column;
|
|
942
942
|
gap: 12px;
|
|
@@ -944,7 +944,7 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
944
944
|
padding: 12px;
|
|
945
945
|
border-radius: 12px;
|
|
946
946
|
background: ${({theme:e})=>e.v2.colors.silver[900]};
|
|
947
|
-
`,
|
|
947
|
+
`,Jf=f.div`
|
|
948
948
|
display: flex;
|
|
949
949
|
align-items: flex-start;
|
|
950
950
|
gap: 12px;
|
|
@@ -1020,10 +1020,10 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
1020
1020
|
flex: 1;
|
|
1021
1021
|
min-width: 0;
|
|
1022
1022
|
}
|
|
1023
|
-
`,sv=({formState:n,existingGroups:a,templatizationActions:o,defaultActionId:l=null,defaultActionName:r=bn,groupSearch:s,advancedOpen:c,onGroupSearchChange:d,onAdvancedOpenChange:p,onChange:u})=>{const h="template-group"===n.destination,g=null===n.existingGroupIndex?void 0:a[n.existingGroupIndex],m=a.filter(e=>((e,t,i)=>{const n=t.trim().toLowerCase();if(!n)return!0;const a=Hf(e);return[i,jr(a)?"entire cluster":"",...a.languages??[],...a.namespaces??[],...(a.sources??[]).flatMap(e=>[e.namespace,e.kind,e.name])].filter(Boolean).join(" ").toLowerCase().includes(n)})(e.group,s,e.actionName)),b=o.map(e=>({id:e.id,label:e.name||r})),f=n.createNewAction?[]:n.targetActionId?[n.targetActionId]:l?[l]:[],v=e=>{u({groupMode:e,existingGroupIndex:null,createNewAction:!1,targetActionId:l,scopes:"new"===e?Gf().scopes:n.scopes}),d(""),p(!1)};return t(ze,{richTitle:{title:fn},children:e(nv,{children:[t(F,{"data-id":"url-templatization-custom-destination",size:rt.S,selected:n.destination,setSelected:e=>{u({destination:e,groupMode:"entire-cluster"===e?"new":a.length?"existing":"new",existingGroupIndex:null,createNewAction:!1,targetActionId:l}),d(""),p(!1)},options:[{value:"template-group",label:vn},{value:"entire-cluster",label:yn}]}),t(te,{status:ie.Info,message:h?Sn:xn,fullWidth:!0,smallIcon:!0}),h&&e(i,{children:[t(
|
|
1023
|
+
`,sv=({formState:n,existingGroups:a,templatizationActions:o,defaultActionId:l=null,defaultActionName:r=bn,groupSearch:s,advancedOpen:c,onGroupSearchChange:d,onAdvancedOpenChange:p,onChange:u})=>{const h="template-group"===n.destination,g=null===n.existingGroupIndex?void 0:a[n.existingGroupIndex],m=a.filter(e=>((e,t,i)=>{const n=t.trim().toLowerCase();if(!n)return!0;const a=Hf(e);return[i,jr(a)?"entire cluster":"",...a.languages??[],...a.namespaces??[],...(a.sources??[]).flatMap(e=>[e.namespace,e.kind,e.name])].filter(Boolean).join(" ").toLowerCase().includes(n)})(e.group,s,e.actionName)),b=o.map(e=>({id:e.id,label:e.name||r})),f=n.createNewAction?[]:n.targetActionId?[n.targetActionId]:l?[l]:[],v=e=>{u({groupMode:e,existingGroupIndex:null,createNewAction:!1,targetActionId:l,scopes:"new"===e?Gf().scopes:n.scopes}),d(""),p(!1)};return t(ze,{richTitle:{title:fn},children:e(nv,{children:[t(F,{"data-id":"url-templatization-custom-destination",size:rt.S,selected:n.destination,setSelected:e=>{u({destination:e,groupMode:"entire-cluster"===e?"new":a.length?"existing":"new",existingGroupIndex:null,createNewAction:!1,targetActionId:l}),d(""),p(!1)},options:[{value:"template-group",label:vn},{value:"entire-cluster",label:yn}]}),t(te,{status:ie.Info,message:h?Sn:xn,fullWidth:!0,smallIcon:!0}),h&&e(i,{children:[t(qf,{children:e(Jf,{children:[t(V,{"data-id":"url-templatization-custom-existing-group",size:H.S,value:"existing"===n.groupMode,onChange:e=>{e&&v("existing")}}),e(Zf,{children:[t(w,{size:C.XS,children:wn}),"existing"===n.groupMode&&e(i,{children:[t(Bt,{"data-id":"url-templatization-custom-group-search",width:"100%",value:g?g.actionName:s,onChange:e=>{g||d(e)},placeholder:Cn}),g?e($,{$gap:8,children:[t(w,{size:C.XXXS,color:k.Secondary,children:kn}),e(tv,{children:[t(Yf,{scopes:Hf(g.group)}),t(Be,{"data-id":"url-templatization-custom-clear-group",icon:vs,size:Ue.S,onClick:()=>u({existingGroupIndex:null})})]})]}):!!m.length&&t(Qf,{children:m.map(e=>{const i=a.indexOf(e);return t(ev,{type:"button",$selected:n.existingGroupIndex===i,onClick:()=>u({existingGroupIndex:i,targetActionId:e.actionId,createNewAction:!1,scopes:Hf(e.group)}),children:t(Yf,{scopes:Hf(e.group)})},`${e.actionId}-${e.groupIndex}`)})})]})]})]})}),e(qf,{children:[e(Jf,{children:[t(V,{"data-id":"url-templatization-custom-new-group",size:H.S,value:"new"===n.groupMode,onChange:e=>{e&&v("new")}}),e(Zf,{children:[t(w,{size:C.XS,children:Tn}),"new"===n.groupMode&&!c&&t(te,{status:ie.Info,message:In,smallIcon:!0})]})]}),"new"===n.groupMode&&e(av,{children:[e(ov,{type:"button","data-id":"url-templatization-custom-advanced",onClick:()=>{if(c)return u({createNewAction:!1,targetActionId:l}),void p(!1);p(!0)},children:[t(c?Es:bs,{size:18}),t(w,{size:C.XXS,children:$n})]}),c&&e(lv,{children:[e(Jf,{children:[t(V,{"data-id":"url-templatization-custom-existing-action",size:H.S,value:!n.createNewAction,onChange:e=>{e&&u({createNewAction:!1,targetActionId:n.targetActionId??l})}}),e(iv,{children:[t(w,{size:C.XS,color:n.createNewAction?k.Secondary:void 0,children:Nn}),t(Fe,{"data-id":"url-templatization-custom-action",width:"100%",disabled:n.createNewAction,placeholder:r,options:b,values:f,setValues:e=>u({targetActionId:e[0]??l,createNewAction:!1})})]})]}),e(Jf,{children:[t(V,{"data-id":"url-templatization-custom-new-action",size:H.S,value:n.createNewAction,onChange:e=>{e&&u({createNewAction:!0,targetActionId:null})}}),e(iv,{children:[t(w,{size:C.XS,color:n.createNewAction?void 0:k.Secondary,children:An}),t(Y,{"data-id":"url-templatization-custom-new-action-name",width:"100%",disabled:!n.createNewAction,placeholder:On,value:n.createNewAction?n.newActionName:"",onChange:e=>u({newActionName:e.target.value,createNewAction:!0,targetActionId:null})}),n.createNewAction&&e(rv,{children:[t(Gs,{size:12}),t(w,{size:C.XXXS,color:k.Secondary,children:En})]})]})]})]})]})]})]})]})})},cv=f($)`
|
|
1024
1024
|
gap: 16px;
|
|
1025
1025
|
width: 100%;
|
|
1026
|
-
`,dv=({isOpen:n,submitting:r,prefill:s,templatizationActions:c=[],existingGroups:p=[],onClose:u,onSubmit:h,sourceOptions:g=[],namespaceOptions:m=[]})=>{const b=c.find(e=>e.name===bn)??c[0],[f,v]=l(1),[y,S]=l(""),[x,I]=l(!1),[A
|
|
1026
|
+
`,dv=({isOpen:n,submitting:r,prefill:s,templatizationActions:c=[],existingGroups:p=[],onClose:u,onSubmit:h,sourceOptions:g=[],namespaceOptions:m=[]})=>{const b=c.find(e=>e.name===bn)??c[0],[f,v]=l(1),[y,S]=l(""),[x,I]=l(!1),[N,A]=l(()=>Gf({hasExistingGroups:p.length>0,defaultActionId:b?.id??null}));o(()=>{if(!n)return;const e=Gf({hasExistingGroups:p.length>0,defaultActionId:b?.id??null});if(s&&(e.destination=s.destination??e.destination,e.groupMode=s.groupMode??e.groupMode,e.existingGroupIndex=void 0!==s.existingGroupIndex?s.existingGroupIndex:e.existingGroupIndex,e.targetActionId=void 0!==s.targetActionId?s.targetActionId:e.targetActionId,e.createNewAction=s.createNewAction??e.createNewAction),null!==e.existingGroupIndex){const t=p[e.existingGroupIndex];t&&(e.scopes=Hf(t.group),e.targetActionId=t.actionId,e.createNewAction=!1)}v(s?.step??1),S(""),I(!1),A(e)},[n,p.length,b?.id,s]);const O=d(e=>{A(t=>({...t,...e}))},[]),D=a(()=>{if(N.createNewAction)return N.newActionName.trim()||Dn;const e=c.find(e=>e.id===N.targetActionId);return e?.name||b?.name||bn},[b?.name,N.createNewAction,N.newActionName,N.targetActionId,c]),R="template-group"===N.destination&&"existing"===N.groupMode&&null!==N.existingGroupIndex,z=a(()=>"entire-cluster"===N.destination||"new"===N.groupMode||null!==N.existingGroupIndex,[N.destination,N.groupMode,N.existingGroupIndex]),X=N.templates.some(e=>!!e.trim()),P=d(()=>{if("entire-cluster"===N.destination)O({existingGroupIndex:null,groupMode:"new",createNewAction:!1,targetActionId:b?.id??null,scopes:Gf().scopes});else if("existing"===N.groupMode&&null!==N.existingGroupIndex){const e=p[N.existingGroupIndex];e&&O({scopes:Hf(e.group),targetActionId:e.actionId,createNewAction:!1})}else N.createNewAction||O({targetActionId:N.targetActionId??b?.id??null,createNewAction:!1});v(2)},[b?.id,p,N.createNewAction,N.destination,N.existingGroupIndex,N.groupMode,N.targetActionId,O]),L=d(()=>{X&&h(N)},[X,N,h]),M=1===f?{actions:[{"data-id":"url-templatization-custom-btn-cancel",label:Rn,variant:K.Secondary,size:W.S,onClick:u,disabled:r},{"data-id":"url-templatization-custom-btn-next",label:zn,variant:K.Primary,size:W.S,onClick:P,disabled:!z||r}]}:{note:{status:ie.Warning,message:Ln,fullWidth:!1,smallIcon:!0},actions:[{"data-id":"url-templatization-custom-btn-back",label:Xn,leftIcon:Vs,variant:K.Secondary,size:W.S,onClick:()=>v(1),disabled:r},{"data-id":"url-templatization-custom-btn-save",label:Pn,variant:K.Primary,size:W.S,onClick:L,loading:r,disabled:!X||r}]};return t(ct,{isOpen:n,width:_n,header:{icon:gc,title:Mn,subTitle:Dn,onClose:u},footer:M,children:t(cv,{"data-id":"url-templatization-custom-template-drawer",children:1===f?t(sv,{formState:N,existingGroups:p,templatizationActions:c,defaultActionName:b?.name||bn,defaultActionId:b?.id??null,groupSearch:y,advancedOpen:x,onGroupSearchChange:S,onAdvancedOpenChange:I,onChange:O}):e(i,{children:[t(ze,{children:e($,{$gap:4,children:[t(w,{size:C.XXXS,color:k.Secondary,children:Fn}),e(T,{$gap:8,$alignItems:"center",children:[t(w,{size:C.S,children:D}),t(E,{label:Bn,backgroundColor:"#062A31",textColor:"#4CD1F2"})]})]})}),t(dd,R?{readOnly:!0,scopes:N.scopes}:{scopes:N.scopes,onChange:e=>O({scopes:e}),sourceOptions:g,namespaceOptions:m,dataIdPrefix:"url-templatization-custom-scope"}),t(_,{name:"url-templatization-custom-templates",label:Vn,required:!0,placeholder:Un,values:N.templates,setValues:e=>O({templates:e})})]})})})},pv=f($)`
|
|
1027
1027
|
gap: 16px;
|
|
1028
1028
|
width: 100%;
|
|
1029
1029
|
`,uv=f.div`
|
|
@@ -1048,9 +1048,9 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
1048
1048
|
flex-direction: column;
|
|
1049
1049
|
gap: 4px;
|
|
1050
1050
|
min-width: 0;
|
|
1051
|
-
`,bv=({isOpen:i,submitting:n,mode:r="create",initialFormState:s,onClose:c,onSubmit:p,sourceOptions:u=[],namespaceOptions:h=[]})=>{const g="edit"===r,[m,b]=l(Uf),[f,v]=l();o(()=>{i&&(b(s??Uf()),v(void 0))},[i,s]);const y=d(e=>{b(t=>({...t,...e}))},[]),S=a(()=>{if(m.skipSelectedHttpStatusCodes){const e=Vf(m.skipHttpStatusCodesInput);if(null===e||0===e.length)return!1}return!0},[m.skipSelectedHttpStatusCodes,m.skipHttpStatusCodesInput]),x=d(()=>{if(m.skipSelectedHttpStatusCodes){const e=Vf(m.skipHttpStatusCodesInput);if(null===e||0===e.length)return void v(Gn)}v(void 0),p(m)},[m,p]),T={note:{status:ie.Warning,message:g?jn:
|
|
1051
|
+
`,bv=({isOpen:i,submitting:n,mode:r="create",initialFormState:s,onClose:c,onSubmit:p,sourceOptions:u=[],namespaceOptions:h=[]})=>{const g="edit"===r,[m,b]=l(Uf),[f,v]=l();o(()=>{i&&(b(s??Uf()),v(void 0))},[i,s]);const y=d(e=>{b(t=>({...t,...e}))},[]),S=a(()=>{if(m.skipSelectedHttpStatusCodes){const e=Vf(m.skipHttpStatusCodesInput);if(null===e||0===e.length)return!1}return!0},[m.skipSelectedHttpStatusCodes,m.skipHttpStatusCodesInput]),x=d(()=>{if(m.skipSelectedHttpStatusCodes){const e=Vf(m.skipHttpStatusCodesInput);if(null===e||0===e.length)return void v(Gn)}v(void 0),p(m)},[m,p]),T={note:{status:ie.Warning,message:g?jn:Ln,fullWidth:!1,smallIcon:!0},actions:[{"data-id":"url-templatization-default-rule-btn-cancel",label:Rn,variant:K.Secondary,size:W.S,onClick:c,disabled:n},{"data-id":g?"url-templatization-default-rule-btn-save":"url-templatization-default-rule-btn-add",label:g?Pn:Hn,variant:K.Primary,size:W.S,onClick:x,loading:n,disabled:!S||n}]};return t(ct,{isOpen:i,width:_n,header:{icon:gc,title:g?Kn:Yn,subTitle:Wn,onClose:c},footer:T,children:e(pv,{"data-id":"url-templatization-default-rule-drawer",children:[t(dd,{scopes:m.scopes,onChange:e=>y({scopes:e}),sourceOptions:u,namespaceOptions:h,dataIdPrefix:"url-templatization-default-rule-scope"}),t(ze,{richTitle:{title:Jn,subTitle:qn,subTitleWrap:!0},children:e(hv,{children:[t(L,{name:"url-templatization-default-rule-enabled",value:m.enabled,onChange:e=>y({enabled:e}),size:Je.S,variant:Zn.SuccessError,withIcon:!0}),t(w,{size:C.XS,children:Qn})]})}),t(mt,{bgTint:"1000",withCollapse:!0,collapseIsDefaultOpen:!0,richTitle:{title:ia,subTitle:ta,subTitleWrap:!0},badges:[{key:"advanced",label:ea,status:ie.Info}],children:e(uv,{children:[e(hv,{children:[t(L,{name:"url-templatization-default-rule-skip-non-2xx",value:m.skipForNonSuccessCodes,onChange:e=>y({skipForNonSuccessCodes:e}),size:Je.S}),t(w,{size:C.XS,children:na})]}),e(gv,{children:[t(L,{name:"url-templatization-default-rule-skip-status-codes",value:m.skipSelectedHttpStatusCodes,onChange:e=>{y({skipSelectedHttpStatusCodes:e}),e||v(void 0)},size:Je.S}),e(mv,{children:[t(w,{size:C.XS,color:m.skipSelectedHttpStatusCodes?k.Primary:k.Secondary,children:aa}),t(Y,{"data-id":"url-templatization-default-rule-status-codes",placeholder:la,value:m.skipHttpStatusCodesInput,onChange:e=>{y({skipHttpStatusCodesInput:e.target.value}),f&&v(void 0)},disabled:!m.skipSelectedHttpStatusCodes,hasError:!!f,errorMessage:f,helpMessage:oa})]})]})]})})]})})},fv=f.span`
|
|
1052
1052
|
color: ${({$color:e})=>e};
|
|
1053
|
-
`,vv=({template:e,size:i=C.XXS})=>{const n=v(),a=e.split(/(\{[^}]+\}|\*)/g).filter(Boolean);return t(w,{size:i,nowrap:!0,children:a.map((e,i)=>e.startsWith("{")&&e.endsWith("}")?t(fv,{$color:n.v2.colors.purple[300],children:e},`${e}-${i}`):"*"===e?t(fv,{$color:n.v2.colors.orange[500],children:e},`${e}-${i}`):t("span",{children:e},`${e}-${i}`))})},yv=e=>e.filter(e=>e.type===
|
|
1053
|
+
`,vv=({template:e,size:i=C.XXS})=>{const n=v(),a=e.split(/(\{[^}]+\}|\*)/g).filter(Boolean);return t(w,{size:i,nowrap:!0,children:a.map((e,i)=>e.startsWith("{")&&e.endsWith("}")?t(fv,{$color:n.v2.colors.purple[300],children:e},`${e}-${i}`):"*"===e?t(fv,{$color:n.v2.colors.orange[500],children:e},`${e}-${i}`):t("span",{children:e},`${e}-${i}`))})},yv=e=>e.filter(e=>e.type===J.URLTemplatization);const Sv=f($)`
|
|
1054
1054
|
gap: 16px;
|
|
1055
1055
|
width: 100%;
|
|
1056
1056
|
`,xv=f($)`
|
|
@@ -1091,11 +1091,11 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
1091
1091
|
font-family: ${({theme:e})=>e.font_family.code};
|
|
1092
1092
|
font-size: 12px;
|
|
1093
1093
|
line-height: 20px;
|
|
1094
|
-
`,
|
|
1094
|
+
`,Nv=f.div`
|
|
1095
1095
|
color: ${({theme:e})=>e.v2.colors.white[500]};
|
|
1096
|
-
`,
|
|
1096
|
+
`,Av=f.span`
|
|
1097
1097
|
color: ${({theme:e})=>e.v2.colors.purple[300]};
|
|
1098
|
-
`,Ov=({isOpen:i,template:n,actionName:a,actionId:r,onClose:s})=>{const c=v(),[p,u]=l(""),[h,g]=l(null);o(()=>{i&&(u(""),g(null))},[i,n,r]);const m=d(()=>{g(function(e,t){const i=(e=>{const t=e.trim();if(!t)return"";if(/^[a-zA-Z][a-zA-Z0-9+.-]*:\/\//.test(t))try{return new URL(t).pathname}catch{return t.split("?")[0].split("#")[0]}return t.split("?")[0].split("#")[0]})(t);if(!e.trim()||!i)return{matched:!1,captures:[]};const n=(e=>{const t=e.trim(),i=t.startsWith("/")?t.slice(1):t;return(""===i?[""]:i.split("/")).map(e=>"*"===e?{kind:"wildcard"}:e.startsWith("{")&&e.endsWith("}")?{kind:"param",name:e.slice(1,-1).trim()||"id"}:{kind:"static",value:e})})(e),a=i.startsWith("/")?i.slice(1):i,o=""===a?[""]:a.split("/");if(n.length!==o.length)return{matched:!1,captures:[]};const l=[];for(let e=0;e<n.length;e++){const t=n[e],i=o[e];if("static"===t.kind&&t.value!==i)return{matched:!1,captures:[]};"param"===t.kind&&l.push({name:t.name,value:i})}return{matched:!0,captures:l}}(n,p))},[n,p]),b=d(e=>{"Enter"===e.key&&(e.preventDefault(),m())},[m]),f={actions:[{"data-id":"url-templatization-view-btn-close",label:ra,variant:
|
|
1098
|
+
`,Ov=({isOpen:i,template:n,actionName:a,actionId:r,onClose:s})=>{const c=v(),[p,u]=l(""),[h,g]=l(null);o(()=>{i&&(u(""),g(null))},[i,n,r]);const m=d(()=>{g(function(e,t){const i=(e=>{const t=e.trim();if(!t)return"";if(/^[a-zA-Z][a-zA-Z0-9+.-]*:\/\//.test(t))try{return new URL(t).pathname}catch{return t.split("?")[0].split("#")[0]}return t.split("?")[0].split("#")[0]})(t);if(!e.trim()||!i)return{matched:!1,captures:[]};const n=(e=>{const t=e.trim(),i=t.startsWith("/")?t.slice(1):t;return(""===i?[""]:i.split("/")).map(e=>"*"===e?{kind:"wildcard"}:e.startsWith("{")&&e.endsWith("}")?{kind:"param",name:e.slice(1,-1).trim()||"id"}:{kind:"static",value:e})})(e),a=i.startsWith("/")?i.slice(1):i,o=""===a?[""]:a.split("/");if(n.length!==o.length)return{matched:!1,captures:[]};const l=[];for(let e=0;e<n.length;e++){const t=n[e],i=o[e];if("static"===t.kind&&t.value!==i)return{matched:!1,captures:[]};"param"===t.kind&&l.push({name:t.name,value:i})}return{matched:!0,captures:l}}(n,p))},[n,p]),b=d(e=>{"Enter"===e.key&&(e.preventDefault(),m())},[m]),f={actions:[{"data-id":"url-templatization-view-btn-close",label:ra,variant:K.Secondary,size:W.S,onClick:s}]},y=a||bn;return t(ct,{isOpen:i,width:_n,header:{icon:gc,title:sa,onClose:s},footer:f,children:e(Sv,{"data-id":"url-templatization-template-view-drawer",children:[t(ze,{children:e($,{$gap:16,children:[e(xv,{children:[t(w,{size:C.XXXS,color:k.Secondary,children:ca}),t(vv,{template:n,size:C.XS})]}),e(T,{$gap:24,$alignItems:"flex-start",children:[e(xv,{children:[t(w,{size:C.XXXS,color:k.Secondary,children:da}),t(E,{label:Bn,backgroundColor:"#062A31",textColor:"#4CD1F2"})]}),e(xv,{children:[t(w,{size:C.XXXS,color:k.Secondary,children:pa}),t(w,{size:C.XS,children:y})]}),e(xv,{children:[t(w,{size:C.XXXS,color:k.Secondary,children:ua}),t(w,{size:C.XS,children:r||"—"})]})]})]})}),t(ze,{children:e($,{$gap:12,children:[t(R,{label:ha}),e(wv,{children:[t(Cv,{children:t(Y,{name:"url-templatization-try-url","data-id":"url-templatization-try-url",placeholder:ga,value:p,onChange:e=>{u(e.target.value),g(null)},onKeyDown:b,width:"100%"})}),t(j,{"data-id":"url-templatization-btn-test-url",label:ma,variant:K.Primary,size:W.S,onClick:m})]}),h&&e($,{$gap:8,children:[t(w,{size:C.XXXS,color:k.Secondary,children:ba}),e(kv,{"data-id":"url-templatization-test-result",children:[e(Tv,{children:[h.matched?t($s,{size:32,fill:c.v2.colors.green[500]}):t(Ns,{size:32,fill:c.v2.colors.orange[500]}),e($,{$gap:2,children:[t(w,{size:C.XS,weight:500,children:h.matched?fa:va}),t(w,{size:C.XXS,color:k.Secondary,children:h.matched?ya:Sa})]})]}),h.matched?!!h.captures.length&&t($v,{"data-id":"url-templatization-test-captures",children:h.captures.map((i,n)=>e(Nv,{children:[t(Av,{children:`{${i.name}}`}),` = ${i.value}`]},`${i.name}-${n}`))}):t(Iv,{$centered:!0,"data-id":"url-templatization-test-no-match-help",children:t(w,{size:C.XXS,color:k.Secondary,align:"center",children:xa})})]})]})]})})]})})},Ev=({token:n,isLoading:a,isEditing:o,onEdit:l,onCancel:r,onSave:s,formData:c,handleFormChange:d,handleErrorChange:p,formErrors:u})=>{const{CopyButton:h}=at(),g=!o||a||!c.newToken;return wa({key:"Enter",active:!g},s),e(T,o?{$justifyContent:"space-between",$alignItems:"flex-start",$gap:12,children:[t(Y,{type:"password",value:c.newToken,onChange:e=>{d("newToken",e.target.value),p("newToken",void 0)},width:"430px",autoFocus:!0,errorMessage:u.newToken}),t(T,{$margin:a?"8px 0 0 0":"2px 0 0 0",$alignItems:"center",children:a?t(Ve,{title:"Saving...",withGradient:!0}):e(i,{children:[t(j,{variant:K.Secondary,size:W.S,leftIcon:Rs,onClick:r,disabled:a}),t(j,{variant:K.Primary,size:W.S,leftIcon:Ds,onClick:s,disabled:g})]})})]}:{$justifyContent:"space-between",$gap:12,children:[t(w,{size:C.XS,children:new Array(55).fill("•").join("")}),e(T,{$alignItems:"center",$justifyContent:"space-between",children:[t(h,{value:n}),t(Be,{icon:Cs,onClick:l})]})]})},Dv=({expiresAt:e,callbackValid:i,callbackExpired:n})=>{const{formatTimeAgo:l}=Nt(),r=a(()=>l(e),[e,l]),s=a(()=>new Date(e).toDateString().split(" ").slice(1).join(" "),[e]),c=a(()=>Ca(e,0)?ie.Error:Ca(e,2592e6)?ie.Warning:ie.Success,[e]),d=a(()=>c===ie.Success?Ds:c===ie.Warning?mc:Ys,[c]);return o(()=>{c===ie.Success?i():c===ie.Error&&n()},[c]),t(ce,{text:s,children:t(E,{leftIcon:d,label:r,status:c,invertColors:!0,useSecondaryTone:!0})})},Rv=f.div`
|
|
1099
1099
|
display: flex;
|
|
1100
1100
|
flex-direction: column;
|
|
1101
1101
|
gap: 12px;
|
|
@@ -1103,7 +1103,7 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
1103
1103
|
border-radius: 12px;
|
|
1104
1104
|
border: 1px solid ${({theme:e,$isExpired:t})=>t?e.v2.colors.red[500]:e.v2.colors.silver[600]};
|
|
1105
1105
|
background-color: ${({theme:e,$isExpired:t})=>t?e.v2.colors.red[1e3]:e.v2.colors.silver[800]};
|
|
1106
|
-
`,zv=({children:e})=>{const i=v();return t(w,{size:C.XXXS,color:i.v2.colors.grey[150],children:e})},
|
|
1106
|
+
`,zv=({children:e})=>{const i=v();return t(w,{size:C.XXXS,color:i.v2.colors.grey[150],children:e})},Xv=({token:i})=>{const{tokensApi:n}=Lc(),[a,o]=l(!1),[r,s]=l(!1),[c,d]=l(!1),{formData:p,handleFormChange:u,formErrors:h,handleErrorChange:g,resetFormData:m}=St({newToken:""});return t(ze,{richTitle:{icon:bc,title:"Odigos Pro Token"},children:e(Rv,{$isExpired:c,children:[e(T,{$justifyContent:"space-between",children:[e($,{$gap:4,children:[t(zv,{children:"Issued for"}),t(w,{size:C.XS,children:i.name||"N/A"})]}),e($,{$gap:4,children:[t(zv,{children:"Expiration"}),t(Dv,{expiresAt:i.expiresAt,callbackValid:()=>d(!1),callbackExpired:()=>d(!0)})]}),t($,{})]}),t(T,{children:e($,{children:[t(zv,{children:"Token"}),t(Ev,{token:i.token,newToken:p.newToken,isLoading:a,isEditing:r,onEdit:()=>s(!0),onCancel:()=>(s(!1),void u("newToken","")),onSave:()=>(async()=>{if(!n.updateToken)return;o(!0);const e=await n.updateToken(p.newToken.trim());o(!1),e?.error?g("newToken",e.error):(s(!1),m())})(),formData:p,handleFormChange:u,handleErrorChange:g,formErrors:h})]})})]})})},Pv=f.div`
|
|
1107
1107
|
display: flex;
|
|
1108
1108
|
flex-direction: column;
|
|
1109
1109
|
align-items: center;
|
|
@@ -1112,13 +1112,13 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
1112
1112
|
padding: 12px 24px;
|
|
1113
1113
|
border-radius: 8px;
|
|
1114
1114
|
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
1115
|
-
`,Pv=()=>{const{progress:i}=Qe(),{describeApi:n,namespacesApi:a}=Pc(),{items:o}=a.useNamespaces(),[r,s]=l(null),{formData:c,handleFormChange:d,resetFormData:p}=St({includeProfiles:!0,includeMetrics:!0,includeSourceWorkloads:!1,sourceWorkloadNamespaces:[]});return t(ze,{richTitle:{icon:fc,title:"Diagnose"},children:r?e(Xv,{children:[t(Ve,{title:"Creating file...",subTitle:"This may take a few moments. Do not refresh the page.",withGradient:!0,withSpinner:"number"==typeof i[it.DownloadingDiagnose]?.percentage,percentage:i[it.DownloadingDiagnose]?.percentage,withVisual:"number"!=typeof i[it.DownloadingDiagnose]?.percentage,visualIcon:sc,startedAt:r}),i[it.DownloadingDiagnose]?.list?.length&&t($,{$width:"100%",children:i[it.DownloadingDiagnose].list.map((i,n)=>e(T,{$gap:4,$alignItems:"center",children:[i.status===ie.Success?t(Ds,{size:16}):i.status===ie.Error?t(Rs,{size:16}):t(Ve,{withSpinnerOld:!0,scaleSpinnerOld:.7}),t(w,{size:C.XXXS,color:k.Secondary,children:i.label})]},`diagnose-item-${n}-${i.label}`))})]}):e($,{$gap:24,children:[t(w,{size:C.XXS,color:k.Secondary,children:"Download a tar.gz file with diagnostics from this cluster. Select which data to include before downloading, and share the file with the Odigos support team for troubleshooting."}),e($,{$gap:16,children:[e(T,{$gap:8,children:[t(x,{label:"Profiles",value:c.includeProfiles,onChange:e=>d("includeProfiles",e),tooltip:"Note: Adds 30s to diagnose download time to collect Profiles"}),t(w,{size:C.XXXS,color:k.Secondary,children:"Include pprof profiles"})]}),e(T,{$gap:8,children:[t(x,{label:"Metrics",value:c.includeMetrics,onChange:e=>d("includeMetrics",e)}),t(w,{size:C.XXXS,color:k.Secondary,children:"Include Prometheus metrics"})]}),e(T,{$gap:8,children:[t(x,{label:"Source Workloads",value:c.includeSourceWorkloads,onChange:e=>d("includeSourceWorkloads",e)}),t(w,{size:C.XXXS,color:k.Secondary,children:"Include workload and pod manifests for instrumented sources"})]})]}),t(ka,{alignX:Ia.Left,alignY:Ta.Bottom,items:o.map(e=>({id:e.name,label:e.name,withCheckbox:!0})),selectedIds:c.sourceWorkloadNamespaces,setSelectedIds:e=>d("sourceWorkloadNamespaces",e),withMultiSelect:!0,withSearch:!0,fullWidth:!0,buttonProps:{label:(c.sourceWorkloadNamespaces.length?"Selected":"Select")+" Namespaces",variant:W.Secondary,leftIcon:c.sourceWorkloadNamespaces.length?()=>t(E,{label:c.sourceWorkloadNamespaces.length,status:ie.Default}):void 0}}),t(T,{$justifyContent:"flex-end",children:t(j,{label:"Download Diagnose",rightIcon:sc,variant:W.Primary,onClick:async()=>{n.downloadDiagnose&&(s(Date.now()),await n.downloadDiagnose(c),s(null),p())},disabled:null!==r})})]})})},Mv=()=>{const{platformType:e,version:i,tier:n}=Xr(),{describeApi:a}=Pc(),[r,s]=l(null);return o(()=>{a.fetchDescribeOdigos&&a.fetchDescribeOdigos().then(({data:e})=>s(e?.describeOdigos??null))},[]),t(ze,{richTitle:{icon:ec,title:"General Information"},children:t(mt,{cellsPerRow:2,items:[{id:$a(),title:"Odigos Version",label:i},{id:$a(),title:`${e.toUpperCase()} Version`,label:r?.kubernetesVersion?.value||"-"},{id:$a(),title:"Installation Method",label:r?.installationMethod?.value||"-"},{id:$a(),title:"Tier",label:n}]})})},_v=({isOpen:i,onClose:n})=>{const{describeApi:a,tokensApi:o}=Pc(),l=o.useTokens().items[0];return e(ct,{isOpen:i,header:{icon:ec,title:"System Overview",onClose:n},children:[a.fetchDescribeOdigos&&t(Mv,{}),o.updateToken&&l&&t(Lv,{token:l}),a.downloadDiagnose&&t(Pv,{})]})},Fv=({isOpen:n,onClose:a,onCloseEnd:o})=>{const{addDataStreams:l,setSelectedStreamName:r}=Te(),{dataStreamsApi:s}=Pc(),{requestSubmit:c}=Fc(),p=d(async e=>{s.create?await s.create(e):(l([e]),r(e.name)),a()},[s,l,r,a]),u=d(()=>c(p),[c,p]);return wa({key:"Enter",active:n},u),e(i,{children:[t(Ce,{isOpen:n,onClose:a,onCloseEnd:o,title:ke.NAME_YOUR_STREAM,description:ke.STREAM_DESCRIPTION,approveButton:{"data-id":"add-stream-btn-done",label:lt.DONE,variant:W.Primary,onClick:u},denyButton:{"data-id":"add-stream-btn-cancel",label:lt.CANCEL,variant:W.Secondary,onClick:a},children:t(Lp,{autoFocus:!0})}),t(zp,{})]})},Bv=({isOpen:n,onClose:a,onCloseEnd:l,dataStreamName:r})=>{const{dataStreamsApi:s}=Pc(),{genericForm:c,loadDataStream:p,requestSubmit:u}=Fc();o(()=>{n&&r&&p(r)},[n,r]);const h=!!c?.isFormDirty,g=d(async e=>{await s.update(r,e),a()},[s,r,a]),m=d(()=>u(g),[u,g]);return wa({key:"Enter",active:n},m),e(i,{children:[t(Ce,{isOpen:n,onClose:a,onCloseEnd:l,title:ke.RENAME_STREAM(r),description:ke.STREAM_DESCRIPTION,approveButton:{"data-id":"edit-stream-btn-save",label:lt.SAVE,variant:W.Primary,onClick:m,disabled:!h},denyButton:{"data-id":"edit-stream-btn-cancel",label:lt.CANCEL,variant:W.Secondary,onClick:a},children:t(Lp,{autoFocus:!0})}),t(zp,{})]})},Uv=({scale:i=1})=>e("svg",{width:742*i,height:533*i,viewBox:"0 0 742 533",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[t("path",{d:"M0 0H722C733.046 0 742 8.95431 742 20V513C742 524.046 733.046 533 722 533H0V0Z",fill:"url(#paint0_linear_1585_55266)"}),e("g",{clipPath:"url(#clip0_1585_55266)",children:[t("path",{opacity:"0.1",d:"M817.963 1364.02C1052.53 1129.46 1052.53 749.151 817.96 514.585C583.394 280.019 203.089 280.018 -31.4751 514.583C-266.039 749.147 -266.038 1129.45 -31.4725 1364.02C203.093 1598.58 583.398 1598.58 817.963 1364.02Z",fill:"url(#paint1_radial_1585_55266)"}),t("path",{opacity:"0.3",d:"M789.266 1335.32C1007.98 1116.61 1007.98 761.998 789.264 543.281C570.547 324.565 215.938 324.563 -2.7781 543.279C-221.494 761.995 -221.493 1116.6 -2.77577 1335.32C215.941 1554.04 570.55 1554.04 789.266 1335.32Z",fill:"url(#paint2_radial_1585_55266)"}),t("path",{opacity:"0.5",d:"M736.156 1282.21C925.539 1092.83 925.538 785.776 736.153 596.392C546.769 407.007 239.717 407.006 50.333 596.39C-139.05 785.773 -139.05 1092.83 50.3351 1282.21C239.72 1471.59 546.772 1471.6 736.156 1282.21Z",fill:"url(#paint3_radial_1585_55266)"}),t("path",{opacity:"0.7",d:"M628.365 1174.42C758.218 1044.57 758.217 834.036 628.364 704.182C498.51 574.329 287.977 574.328 158.124 704.181C28.2713 834.033 28.272 1044.57 158.125 1174.42C287.979 1304.27 498.512 1304.27 628.365 1174.42Z",fill:"url(#paint4_radial_1585_55266)"}),t("path",{opacity:"0.1",d:"M795.717 29.8993C1030.28 -204.665 1030.28 -584.97 795.714 -819.536C561.148 -1054.1 180.843 -1054.1 -53.7211 -819.539C-288.285 -584.974 -288.284 -204.669 -53.7185 29.8967C180.847 264.462 561.152 264.464 795.717 29.8993Z",fill:"url(#paint5_radial_1585_55266)"}),t("path",{opacity:"0.3",d:"M767.02 1.20219C985.736 -217.513 985.734 -572.123 767.017 -790.84C548.301 -1009.56 193.691 -1009.56 -25.0242 -790.842C-243.74 -572.126 -243.739 -217.517 -25.0219 1.19982C193.695 219.917 548.304 219.918 767.02 1.20219Z",fill:"url(#paint6_radial_1585_55266)"}),t("path",{opacity:"0.5",d:"M713.909 -51.908C903.293 -241.292 903.292 -548.344 713.907 -737.728C524.523 -927.113 217.47 -927.114 28.0869 -737.731C-161.297 -548.347 -161.296 -241.295 28.089 -51.91C217.474 137.475 524.526 137.476 713.909 -51.908Z",fill:"url(#paint7_radial_1585_55266)"}),t("path",{opacity:"0.7",d:"M606.119 -159.699C735.972 -289.552 735.971 -500.085 606.118 -629.939C476.264 -759.792 265.731 -759.793 135.878 -629.94C6.0252 -500.088 6.02586 -289.554 135.879 -159.701C265.733 -29.8472 476.266 -29.8465 606.119 -159.699Z",fill:"url(#paint8_radial_1585_55266)"})]}),e("defs",{children:[e("linearGradient",{id:"paint0_linear_1585_55266",x1:"371",y1:"0",x2:"371",y2:"533",gradientUnits:"userSpaceOnUse",children:[t("stop",{offset:"0.028197",stopColor:"#0B0517"}),t("stop",{offset:"1",stopColor:"#190D31"})]}),e("radialGradient",{id:"paint1_radial_1585_55266",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(334.074 991.405) rotate(-45) scale(599.732 599.736)",children:[t("stop",{stopColor:"#7C3BFF",stopOpacity:"0.1"}),t("stop",{offset:"0.41",stopColor:"#7C3BFF",stopOpacity:"0.11"}),t("stop",{offset:"0.56",stopColor:"#7C3BFF",stopOpacity:"0.13"}),t("stop",{offset:"0.67",stopColor:"#7C3BFF",stopOpacity:"0.18"}),t("stop",{offset:"0.75",stopColor:"#7C3BFF",stopOpacity:"0.25"}),t("stop",{offset:"0.83",stopColor:"#7C3BFF",stopOpacity:"0.33"}),t("stop",{offset:"0.89",stopColor:"#7C3BFF",stopOpacity:"0.44"}),t("stop",{offset:"0.95",stopColor:"#7C3BFF",stopOpacity:"0.56"}),t("stop",{offset:"1",stopColor:"#7C3BFF",stopOpacity:"0.7"})]}),e("radialGradient",{id:"paint2_radial_1585_55266",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(368.968 957.913) rotate(-45) scale(560.978 560.981)",children:[t("stop",{stopColor:"#7C3BFF",stopOpacity:"0.1"}),t("stop",{offset:"0.38",stopColor:"#7C3BFF",stopOpacity:"0.11"}),t("stop",{offset:"0.52",stopColor:"#7C3BFF",stopOpacity:"0.13"}),t("stop",{offset:"0.62",stopColor:"#7C3BFF",stopOpacity:"0.18"}),t("stop",{offset:"0.69",stopColor:"#7C3BFF",stopOpacity:"0.25"}),t("stop",{offset:"0.76",stopColor:"#7C3BFF",stopOpacity:"0.33"}),t("stop",{offset:"0.82",stopColor:"#7C3BFF",stopOpacity:"0.44"}),t("stop",{offset:"0.88",stopColor:"#7C3BFF",stopOpacity:"0.57"}),t("stop",{offset:"0.93",stopColor:"#7C3BFF",stopOpacity:"0.72"}),t("stop",{offset:"0.97",stopColor:"#7C3BFF",stopOpacity:"0.88"}),t("stop",{offset:"1",stopColor:"#7C3BFF"})]}),e("radialGradient",{id:"paint3_radial_1585_55266",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(351.265 971.313) rotate(-45) scale(484.947 484.95)",children:[t("stop",{stopColor:"#7C3BFF",stopOpacity:"0.1"}),t("stop",{offset:"0.31",stopColor:"#7C3BFF",stopOpacity:"0.11"}),t("stop",{offset:"0.45",stopColor:"#7C3BFF",stopOpacity:"0.14"}),t("stop",{offset:"0.56",stopColor:"#7C3BFF",stopOpacity:"0.19"}),t("stop",{offset:"0.65",stopColor:"#7C3BFF",stopOpacity:"0.26"}),t("stop",{offset:"0.73",stopColor:"#7C3BFF",stopOpacity:"0.35"}),t("stop",{offset:"0.8",stopColor:"#7C3BFF",stopOpacity:"0.46"}),t("stop",{offset:"0.86",stopColor:"#7C3BFF",stopOpacity:"0.6"}),t("stop",{offset:"0.92",stopColor:"#7C3BFF",stopOpacity:"0.76"}),t("stop",{offset:"0.98",stopColor:"#7C3BFF",stopOpacity:"0.93"}),t("stop",{offset:"1",stopColor:"#7C3BFF"})]}),e("radialGradient",{id:"paint4_radial_1585_55266",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(362.239 963.064) rotate(-45) scale(332.216 332.218)",children:[t("stop",{stopColor:"#7C3BFF",stopOpacity:"0.1"}),t("stop",{offset:"0.31",stopColor:"#7C3BFF",stopOpacity:"0.11"}),t("stop",{offset:"0.45",stopColor:"#7C3BFF",stopOpacity:"0.14"}),t("stop",{offset:"0.56",stopColor:"#7C3BFF",stopOpacity:"0.19"}),t("stop",{offset:"0.65",stopColor:"#7C3BFF",stopOpacity:"0.26"}),t("stop",{offset:"0.73",stopColor:"#7C3BFF",stopOpacity:"0.35"}),t("stop",{offset:"0.8",stopColor:"#7C3BFF",stopOpacity:"0.46"}),t("stop",{offset:"0.86",stopColor:"#7C3BFF",stopOpacity:"0.6"}),t("stop",{offset:"0.92",stopColor:"#7C3BFF",stopOpacity:"0.76"}),t("stop",{offset:"0.98",stopColor:"#7C3BFF",stopOpacity:"0.93"}),t("stop",{offset:"1",stopColor:"#7C3BFF"})]}),e("radialGradient",{id:"paint5_radial_1585_55266",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(311.828 -342.716) rotate(-45) scale(599.733 599.736)",children:[t("stop",{stopColor:"#7C3BFF",stopOpacity:"0.1"}),t("stop",{offset:"0.41",stopColor:"#7C3BFF",stopOpacity:"0.11"}),t("stop",{offset:"0.56",stopColor:"#7C3BFF",stopOpacity:"0.13"}),t("stop",{offset:"0.67",stopColor:"#7C3BFF",stopOpacity:"0.18"}),t("stop",{offset:"0.75",stopColor:"#7C3BFF",stopOpacity:"0.25"}),t("stop",{offset:"0.83",stopColor:"#7C3BFF",stopOpacity:"0.33"}),t("stop",{offset:"0.89",stopColor:"#7C3BFF",stopOpacity:"0.44"}),t("stop",{offset:"0.95",stopColor:"#7C3BFF",stopOpacity:"0.56"}),t("stop",{offset:"1",stopColor:"#7C3BFF",stopOpacity:"0.7"})]}),e("radialGradient",{id:"paint6_radial_1585_55266",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(346.722 -376.208) rotate(-45) scale(560.977 560.981)",children:[t("stop",{stopColor:"#7C3BFF",stopOpacity:"0.1"}),t("stop",{offset:"0.38",stopColor:"#7C3BFF",stopOpacity:"0.11"}),t("stop",{offset:"0.52",stopColor:"#7C3BFF",stopOpacity:"0.13"}),t("stop",{offset:"0.62",stopColor:"#7C3BFF",stopOpacity:"0.18"}),t("stop",{offset:"0.69",stopColor:"#7C3BFF",stopOpacity:"0.25"}),t("stop",{offset:"0.76",stopColor:"#7C3BFF",stopOpacity:"0.33"}),t("stop",{offset:"0.82",stopColor:"#7C3BFF",stopOpacity:"0.44"}),t("stop",{offset:"0.88",stopColor:"#7C3BFF",stopOpacity:"0.57"}),t("stop",{offset:"0.93",stopColor:"#7C3BFF",stopOpacity:"0.72"}),t("stop",{offset:"0.97",stopColor:"#7C3BFF",stopOpacity:"0.88"}),t("stop",{offset:"1",stopColor:"#7C3BFF"})]}),e("radialGradient",{id:"paint7_radial_1585_55266",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(329.019 -362.807) rotate(-45) scale(484.947 484.95)",children:[t("stop",{stopColor:"#7C3BFF",stopOpacity:"0.1"}),t("stop",{offset:"0.31",stopColor:"#7C3BFF",stopOpacity:"0.11"}),t("stop",{offset:"0.45",stopColor:"#7C3BFF",stopOpacity:"0.14"}),t("stop",{offset:"0.56",stopColor:"#7C3BFF",stopOpacity:"0.19"}),t("stop",{offset:"0.65",stopColor:"#7C3BFF",stopOpacity:"0.26"}),t("stop",{offset:"0.73",stopColor:"#7C3BFF",stopOpacity:"0.35"}),t("stop",{offset:"0.8",stopColor:"#7C3BFF",stopOpacity:"0.46"}),t("stop",{offset:"0.86",stopColor:"#7C3BFF",stopOpacity:"0.6"}),t("stop",{offset:"0.92",stopColor:"#7C3BFF",stopOpacity:"0.76"}),t("stop",{offset:"0.98",stopColor:"#7C3BFF",stopOpacity:"0.93"}),t("stop",{offset:"1",stopColor:"#7C3BFF"})]}),e("radialGradient",{id:"paint8_radial_1585_55266",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(339.993 -371.057) rotate(-45) scale(332.216 332.218)",children:[t("stop",{stopColor:"#7C3BFF",stopOpacity:"0.1"}),t("stop",{offset:"0.31",stopColor:"#7C3BFF",stopOpacity:"0.11"}),t("stop",{offset:"0.45",stopColor:"#7C3BFF",stopOpacity:"0.14"}),t("stop",{offset:"0.56",stopColor:"#7C3BFF",stopOpacity:"0.19"}),t("stop",{offset:"0.65",stopColor:"#7C3BFF",stopOpacity:"0.26"}),t("stop",{offset:"0.73",stopColor:"#7C3BFF",stopOpacity:"0.35"}),t("stop",{offset:"0.8",stopColor:"#7C3BFF",stopOpacity:"0.46"}),t("stop",{offset:"0.86",stopColor:"#7C3BFF",stopOpacity:"0.6"}),t("stop",{offset:"0.92",stopColor:"#7C3BFF",stopOpacity:"0.76"}),t("stop",{offset:"0.98",stopColor:"#7C3BFF",stopOpacity:"0.93"}),t("stop",{offset:"1",stopColor:"#7C3BFF"})]}),t("clipPath",{id:"clip0_1585_55266",children:t("rect",{width:"929.477",height:"667",fill:"white",transform:"translate(-93.7383 -134)"})})]})]}),Vv=f.div`
|
|
1115
|
+
`,Lv=()=>{const{progress:i}=Qe(),{describeApi:n,namespacesApi:a}=Lc(),{items:o}=a.useNamespaces(),[r,s]=l(null),{formData:c,handleFormChange:d,resetFormData:p}=St({includeProfiles:!0,includeMetrics:!0,includeSourceWorkloads:!1,sourceWorkloadNamespaces:[]});return t(ze,{richTitle:{icon:fc,title:"Diagnose"},children:r?e(Pv,{children:[t(Ve,{title:"Creating file...",subTitle:"This may take a few moments. Do not refresh the page.",withGradient:!0,withSpinner:"number"==typeof i[it.DownloadingDiagnose]?.percentage,percentage:i[it.DownloadingDiagnose]?.percentage,withVisual:"number"!=typeof i[it.DownloadingDiagnose]?.percentage,visualIcon:sc,startedAt:r}),i[it.DownloadingDiagnose]?.list?.length&&t($,{$width:"100%",children:i[it.DownloadingDiagnose].list.map((i,n)=>e(T,{$gap:4,$alignItems:"center",children:[i.status===ie.Success?t(Ds,{size:16}):i.status===ie.Error?t(Rs,{size:16}):t(Ve,{withSpinnerOld:!0,scaleSpinnerOld:.7}),t(w,{size:C.XXXS,color:k.Secondary,children:i.label})]},`diagnose-item-${n}-${i.label}`))})]}):e($,{$gap:24,children:[t(w,{size:C.XXS,color:k.Secondary,children:"Download a tar.gz file with diagnostics from this cluster. Select which data to include before downloading, and share the file with the Odigos support team for troubleshooting."}),e($,{$gap:16,children:[e(T,{$gap:8,children:[t(x,{label:"Profiles",value:c.includeProfiles,onChange:e=>d("includeProfiles",e),tooltip:"Note: Adds 30s to diagnose download time to collect Profiles"}),t(w,{size:C.XXXS,color:k.Secondary,children:"Include pprof profiles"})]}),e(T,{$gap:8,children:[t(x,{label:"Metrics",value:c.includeMetrics,onChange:e=>d("includeMetrics",e)}),t(w,{size:C.XXXS,color:k.Secondary,children:"Include Prometheus metrics"})]}),e(T,{$gap:8,children:[t(x,{label:"Source Workloads",value:c.includeSourceWorkloads,onChange:e=>d("includeSourceWorkloads",e)}),t(w,{size:C.XXXS,color:k.Secondary,children:"Include workload and pod manifests for instrumented sources"})]})]}),t(ka,{alignX:Ia.Left,alignY:Ta.Bottom,items:o.map(e=>({id:e.name,label:e.name,withCheckbox:!0})),selectedIds:c.sourceWorkloadNamespaces,setSelectedIds:e=>d("sourceWorkloadNamespaces",e),withMultiSelect:!0,withSearch:!0,fullWidth:!0,buttonProps:{label:(c.sourceWorkloadNamespaces.length?"Selected":"Select")+" Namespaces",variant:K.Secondary,leftIcon:c.sourceWorkloadNamespaces.length?()=>t(E,{label:c.sourceWorkloadNamespaces.length,status:ie.Default}):void 0}}),t(T,{$justifyContent:"flex-end",children:t(j,{label:"Download Diagnose",rightIcon:sc,variant:K.Primary,onClick:async()=>{n.downloadDiagnose&&(s(Date.now()),await n.downloadDiagnose(c),s(null),p())},disabled:null!==r})})]})})},Mv=()=>{const{platformType:e,version:i,tier:n}=Pr(),{describeApi:a}=Lc(),[r,s]=l(null);return o(()=>{a.fetchDescribeOdigos&&a.fetchDescribeOdigos().then(({data:e})=>s(e?.describeOdigos??null))},[]),t(ze,{richTitle:{icon:ec,title:"General Information"},children:t(mt,{cellsPerRow:2,items:[{id:$a(),title:"Odigos Version",label:i},{id:$a(),title:`${e.toUpperCase()} Version`,label:r?.kubernetesVersion?.value||"-"},{id:$a(),title:"Installation Method",label:r?.installationMethod?.value||"-"},{id:$a(),title:"Tier",label:n}]})})},_v=({isOpen:i,onClose:n})=>{const{describeApi:a,tokensApi:o}=Lc(),l=o.useTokens().items[0];return e(ct,{isOpen:i,header:{icon:ec,title:"System Overview",onClose:n},children:[a.fetchDescribeOdigos&&t(Mv,{}),o.updateToken&&l&&t(Xv,{token:l}),a.downloadDiagnose&&t(Lv,{})]})},Fv=({isOpen:n,onClose:a,onCloseEnd:o})=>{const{addDataStreams:l,setSelectedStreamName:r}=Te(),{dataStreamsApi:s}=Lc(),{requestSubmit:c}=Fc(),p=d(async e=>{s.create?await s.create(e):(l([e]),r(e.name)),a()},[s,l,r,a]),u=d(()=>c(p),[c,p]);return wa({key:"Enter",active:n},u),e(i,{children:[t(Ce,{isOpen:n,onClose:a,onCloseEnd:o,title:ke.NAME_YOUR_STREAM,description:ke.STREAM_DESCRIPTION,approveButton:{"data-id":"add-stream-btn-done",label:lt.DONE,variant:K.Primary,onClick:u},denyButton:{"data-id":"add-stream-btn-cancel",label:lt.CANCEL,variant:K.Secondary,onClick:a},children:t(Xp,{autoFocus:!0})}),t(zp,{})]})},Bv=({isOpen:n,onClose:a,onCloseEnd:l,dataStreamName:r})=>{const{dataStreamsApi:s}=Lc(),{genericForm:c,loadDataStream:p,requestSubmit:u}=Fc();o(()=>{n&&r&&p(r)},[n,r]);const h=!!c?.isFormDirty,g=d(async e=>{await s.update(r,e),a()},[s,r,a]),m=d(()=>u(g),[u,g]);return wa({key:"Enter",active:n},m),e(i,{children:[t(Ce,{isOpen:n,onClose:a,onCloseEnd:l,title:ke.RENAME_STREAM(r),description:ke.STREAM_DESCRIPTION,approveButton:{"data-id":"edit-stream-btn-save",label:lt.SAVE,variant:K.Primary,onClick:m,disabled:!h},denyButton:{"data-id":"edit-stream-btn-cancel",label:lt.CANCEL,variant:K.Secondary,onClick:a},children:t(Xp,{autoFocus:!0})}),t(zp,{})]})},Uv=({scale:i=1})=>e("svg",{width:742*i,height:533*i,viewBox:"0 0 742 533",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[t("path",{d:"M0 0H722C733.046 0 742 8.95431 742 20V513C742 524.046 733.046 533 722 533H0V0Z",fill:"url(#paint0_linear_1585_55266)"}),e("g",{clipPath:"url(#clip0_1585_55266)",children:[t("path",{opacity:"0.1",d:"M817.963 1364.02C1052.53 1129.46 1052.53 749.151 817.96 514.585C583.394 280.019 203.089 280.018 -31.4751 514.583C-266.039 749.147 -266.038 1129.45 -31.4725 1364.02C203.093 1598.58 583.398 1598.58 817.963 1364.02Z",fill:"url(#paint1_radial_1585_55266)"}),t("path",{opacity:"0.3",d:"M789.266 1335.32C1007.98 1116.61 1007.98 761.998 789.264 543.281C570.547 324.565 215.938 324.563 -2.7781 543.279C-221.494 761.995 -221.493 1116.6 -2.77577 1335.32C215.941 1554.04 570.55 1554.04 789.266 1335.32Z",fill:"url(#paint2_radial_1585_55266)"}),t("path",{opacity:"0.5",d:"M736.156 1282.21C925.539 1092.83 925.538 785.776 736.153 596.392C546.769 407.007 239.717 407.006 50.333 596.39C-139.05 785.773 -139.05 1092.83 50.3351 1282.21C239.72 1471.59 546.772 1471.6 736.156 1282.21Z",fill:"url(#paint3_radial_1585_55266)"}),t("path",{opacity:"0.7",d:"M628.365 1174.42C758.218 1044.57 758.217 834.036 628.364 704.182C498.51 574.329 287.977 574.328 158.124 704.181C28.2713 834.033 28.272 1044.57 158.125 1174.42C287.979 1304.27 498.512 1304.27 628.365 1174.42Z",fill:"url(#paint4_radial_1585_55266)"}),t("path",{opacity:"0.1",d:"M795.717 29.8993C1030.28 -204.665 1030.28 -584.97 795.714 -819.536C561.148 -1054.1 180.843 -1054.1 -53.7211 -819.539C-288.285 -584.974 -288.284 -204.669 -53.7185 29.8967C180.847 264.462 561.152 264.464 795.717 29.8993Z",fill:"url(#paint5_radial_1585_55266)"}),t("path",{opacity:"0.3",d:"M767.02 1.20219C985.736 -217.513 985.734 -572.123 767.017 -790.84C548.301 -1009.56 193.691 -1009.56 -25.0242 -790.842C-243.74 -572.126 -243.739 -217.517 -25.0219 1.19982C193.695 219.917 548.304 219.918 767.02 1.20219Z",fill:"url(#paint6_radial_1585_55266)"}),t("path",{opacity:"0.5",d:"M713.909 -51.908C903.293 -241.292 903.292 -548.344 713.907 -737.728C524.523 -927.113 217.47 -927.114 28.0869 -737.731C-161.297 -548.347 -161.296 -241.295 28.089 -51.91C217.474 137.475 524.526 137.476 713.909 -51.908Z",fill:"url(#paint7_radial_1585_55266)"}),t("path",{opacity:"0.7",d:"M606.119 -159.699C735.972 -289.552 735.971 -500.085 606.118 -629.939C476.264 -759.792 265.731 -759.793 135.878 -629.94C6.0252 -500.088 6.02586 -289.554 135.879 -159.701C265.733 -29.8472 476.266 -29.8465 606.119 -159.699Z",fill:"url(#paint8_radial_1585_55266)"})]}),e("defs",{children:[e("linearGradient",{id:"paint0_linear_1585_55266",x1:"371",y1:"0",x2:"371",y2:"533",gradientUnits:"userSpaceOnUse",children:[t("stop",{offset:"0.028197",stopColor:"#0B0517"}),t("stop",{offset:"1",stopColor:"#190D31"})]}),e("radialGradient",{id:"paint1_radial_1585_55266",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(334.074 991.405) rotate(-45) scale(599.732 599.736)",children:[t("stop",{stopColor:"#7C3BFF",stopOpacity:"0.1"}),t("stop",{offset:"0.41",stopColor:"#7C3BFF",stopOpacity:"0.11"}),t("stop",{offset:"0.56",stopColor:"#7C3BFF",stopOpacity:"0.13"}),t("stop",{offset:"0.67",stopColor:"#7C3BFF",stopOpacity:"0.18"}),t("stop",{offset:"0.75",stopColor:"#7C3BFF",stopOpacity:"0.25"}),t("stop",{offset:"0.83",stopColor:"#7C3BFF",stopOpacity:"0.33"}),t("stop",{offset:"0.89",stopColor:"#7C3BFF",stopOpacity:"0.44"}),t("stop",{offset:"0.95",stopColor:"#7C3BFF",stopOpacity:"0.56"}),t("stop",{offset:"1",stopColor:"#7C3BFF",stopOpacity:"0.7"})]}),e("radialGradient",{id:"paint2_radial_1585_55266",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(368.968 957.913) rotate(-45) scale(560.978 560.981)",children:[t("stop",{stopColor:"#7C3BFF",stopOpacity:"0.1"}),t("stop",{offset:"0.38",stopColor:"#7C3BFF",stopOpacity:"0.11"}),t("stop",{offset:"0.52",stopColor:"#7C3BFF",stopOpacity:"0.13"}),t("stop",{offset:"0.62",stopColor:"#7C3BFF",stopOpacity:"0.18"}),t("stop",{offset:"0.69",stopColor:"#7C3BFF",stopOpacity:"0.25"}),t("stop",{offset:"0.76",stopColor:"#7C3BFF",stopOpacity:"0.33"}),t("stop",{offset:"0.82",stopColor:"#7C3BFF",stopOpacity:"0.44"}),t("stop",{offset:"0.88",stopColor:"#7C3BFF",stopOpacity:"0.57"}),t("stop",{offset:"0.93",stopColor:"#7C3BFF",stopOpacity:"0.72"}),t("stop",{offset:"0.97",stopColor:"#7C3BFF",stopOpacity:"0.88"}),t("stop",{offset:"1",stopColor:"#7C3BFF"})]}),e("radialGradient",{id:"paint3_radial_1585_55266",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(351.265 971.313) rotate(-45) scale(484.947 484.95)",children:[t("stop",{stopColor:"#7C3BFF",stopOpacity:"0.1"}),t("stop",{offset:"0.31",stopColor:"#7C3BFF",stopOpacity:"0.11"}),t("stop",{offset:"0.45",stopColor:"#7C3BFF",stopOpacity:"0.14"}),t("stop",{offset:"0.56",stopColor:"#7C3BFF",stopOpacity:"0.19"}),t("stop",{offset:"0.65",stopColor:"#7C3BFF",stopOpacity:"0.26"}),t("stop",{offset:"0.73",stopColor:"#7C3BFF",stopOpacity:"0.35"}),t("stop",{offset:"0.8",stopColor:"#7C3BFF",stopOpacity:"0.46"}),t("stop",{offset:"0.86",stopColor:"#7C3BFF",stopOpacity:"0.6"}),t("stop",{offset:"0.92",stopColor:"#7C3BFF",stopOpacity:"0.76"}),t("stop",{offset:"0.98",stopColor:"#7C3BFF",stopOpacity:"0.93"}),t("stop",{offset:"1",stopColor:"#7C3BFF"})]}),e("radialGradient",{id:"paint4_radial_1585_55266",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(362.239 963.064) rotate(-45) scale(332.216 332.218)",children:[t("stop",{stopColor:"#7C3BFF",stopOpacity:"0.1"}),t("stop",{offset:"0.31",stopColor:"#7C3BFF",stopOpacity:"0.11"}),t("stop",{offset:"0.45",stopColor:"#7C3BFF",stopOpacity:"0.14"}),t("stop",{offset:"0.56",stopColor:"#7C3BFF",stopOpacity:"0.19"}),t("stop",{offset:"0.65",stopColor:"#7C3BFF",stopOpacity:"0.26"}),t("stop",{offset:"0.73",stopColor:"#7C3BFF",stopOpacity:"0.35"}),t("stop",{offset:"0.8",stopColor:"#7C3BFF",stopOpacity:"0.46"}),t("stop",{offset:"0.86",stopColor:"#7C3BFF",stopOpacity:"0.6"}),t("stop",{offset:"0.92",stopColor:"#7C3BFF",stopOpacity:"0.76"}),t("stop",{offset:"0.98",stopColor:"#7C3BFF",stopOpacity:"0.93"}),t("stop",{offset:"1",stopColor:"#7C3BFF"})]}),e("radialGradient",{id:"paint5_radial_1585_55266",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(311.828 -342.716) rotate(-45) scale(599.733 599.736)",children:[t("stop",{stopColor:"#7C3BFF",stopOpacity:"0.1"}),t("stop",{offset:"0.41",stopColor:"#7C3BFF",stopOpacity:"0.11"}),t("stop",{offset:"0.56",stopColor:"#7C3BFF",stopOpacity:"0.13"}),t("stop",{offset:"0.67",stopColor:"#7C3BFF",stopOpacity:"0.18"}),t("stop",{offset:"0.75",stopColor:"#7C3BFF",stopOpacity:"0.25"}),t("stop",{offset:"0.83",stopColor:"#7C3BFF",stopOpacity:"0.33"}),t("stop",{offset:"0.89",stopColor:"#7C3BFF",stopOpacity:"0.44"}),t("stop",{offset:"0.95",stopColor:"#7C3BFF",stopOpacity:"0.56"}),t("stop",{offset:"1",stopColor:"#7C3BFF",stopOpacity:"0.7"})]}),e("radialGradient",{id:"paint6_radial_1585_55266",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(346.722 -376.208) rotate(-45) scale(560.977 560.981)",children:[t("stop",{stopColor:"#7C3BFF",stopOpacity:"0.1"}),t("stop",{offset:"0.38",stopColor:"#7C3BFF",stopOpacity:"0.11"}),t("stop",{offset:"0.52",stopColor:"#7C3BFF",stopOpacity:"0.13"}),t("stop",{offset:"0.62",stopColor:"#7C3BFF",stopOpacity:"0.18"}),t("stop",{offset:"0.69",stopColor:"#7C3BFF",stopOpacity:"0.25"}),t("stop",{offset:"0.76",stopColor:"#7C3BFF",stopOpacity:"0.33"}),t("stop",{offset:"0.82",stopColor:"#7C3BFF",stopOpacity:"0.44"}),t("stop",{offset:"0.88",stopColor:"#7C3BFF",stopOpacity:"0.57"}),t("stop",{offset:"0.93",stopColor:"#7C3BFF",stopOpacity:"0.72"}),t("stop",{offset:"0.97",stopColor:"#7C3BFF",stopOpacity:"0.88"}),t("stop",{offset:"1",stopColor:"#7C3BFF"})]}),e("radialGradient",{id:"paint7_radial_1585_55266",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(329.019 -362.807) rotate(-45) scale(484.947 484.95)",children:[t("stop",{stopColor:"#7C3BFF",stopOpacity:"0.1"}),t("stop",{offset:"0.31",stopColor:"#7C3BFF",stopOpacity:"0.11"}),t("stop",{offset:"0.45",stopColor:"#7C3BFF",stopOpacity:"0.14"}),t("stop",{offset:"0.56",stopColor:"#7C3BFF",stopOpacity:"0.19"}),t("stop",{offset:"0.65",stopColor:"#7C3BFF",stopOpacity:"0.26"}),t("stop",{offset:"0.73",stopColor:"#7C3BFF",stopOpacity:"0.35"}),t("stop",{offset:"0.8",stopColor:"#7C3BFF",stopOpacity:"0.46"}),t("stop",{offset:"0.86",stopColor:"#7C3BFF",stopOpacity:"0.6"}),t("stop",{offset:"0.92",stopColor:"#7C3BFF",stopOpacity:"0.76"}),t("stop",{offset:"0.98",stopColor:"#7C3BFF",stopOpacity:"0.93"}),t("stop",{offset:"1",stopColor:"#7C3BFF"})]}),e("radialGradient",{id:"paint8_radial_1585_55266",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(339.993 -371.057) rotate(-45) scale(332.216 332.218)",children:[t("stop",{stopColor:"#7C3BFF",stopOpacity:"0.1"}),t("stop",{offset:"0.31",stopColor:"#7C3BFF",stopOpacity:"0.11"}),t("stop",{offset:"0.45",stopColor:"#7C3BFF",stopOpacity:"0.14"}),t("stop",{offset:"0.56",stopColor:"#7C3BFF",stopOpacity:"0.19"}),t("stop",{offset:"0.65",stopColor:"#7C3BFF",stopOpacity:"0.26"}),t("stop",{offset:"0.73",stopColor:"#7C3BFF",stopOpacity:"0.35"}),t("stop",{offset:"0.8",stopColor:"#7C3BFF",stopOpacity:"0.46"}),t("stop",{offset:"0.86",stopColor:"#7C3BFF",stopOpacity:"0.6"}),t("stop",{offset:"0.92",stopColor:"#7C3BFF",stopOpacity:"0.76"}),t("stop",{offset:"0.98",stopColor:"#7C3BFF",stopOpacity:"0.93"}),t("stop",{offset:"1",stopColor:"#7C3BFF"})]}),t("clipPath",{id:"clip0_1585_55266",children:t("rect",{width:"929.477",height:"667",fill:"white",transform:"translate(-93.7383 -134)"})})]})]}),Vv=f.div`
|
|
1116
1116
|
position: absolute;
|
|
1117
1117
|
top: 50%;
|
|
1118
1118
|
left: 50%;
|
|
1119
1119
|
transform: translate(-50%, -50%);
|
|
1120
1120
|
z-index: ${({theme:e})=>e.v2.zIndex.modal};
|
|
1121
|
-
`,Gv=()=>{const{drawerType:i,setDrawerType:n}=Vt(),a=i===
|
|
1121
|
+
`,Gv=()=>{const{drawerType:i,setDrawerType:n}=Vt(),a=i===Aa.OnboardingDone,o=()=>n(null);return e(Na,{isOpen:a,onClose:o,children:[t(Uv,{}),t(Vv,{children:e($,{$gap:32,$alignItems:"center",children:[e($,{$gap:24,$alignItems:"center",children:[t(w,{size:C.L,weight:500,children:"Welcome to"}),t(Id,{size:260}),t(w,{size:C.S,weight:400,children:"Your observability control plane is ready."})]}),t(j,{label:"Get Started",rightIcon:Ss,onClick:o})]})})]})},Hv=f.div`
|
|
1122
1122
|
display: flex;
|
|
1123
1123
|
flex-direction: column;
|
|
1124
1124
|
gap: 8px;
|
|
@@ -1128,7 +1128,7 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
1128
1128
|
`,jv=f.div`
|
|
1129
1129
|
white-space: pre;
|
|
1130
1130
|
overflow-x: auto;
|
|
1131
|
-
`,
|
|
1131
|
+
`,Wv=({name:i,recommended:n,toggleLabel:a,enabled:o,onEnabledChange:l,summary:r,toggleName:s})=>{const c=v();return e(Hv,{children:[e(T,{$gap:8,$justifyContent:"space-between",children:[e(T,{$gap:4,children:[t(w,{size:C.XS,color:c.v2.colors.white[500],nowrap:!0,children:i}),n&&t(E,{label:Oa,leftIcon:vc,backgroundColor:c.v2.colors.purple[700],textColor:c.v2.colors.white[500],textSize:C.XXXS})]}),t(L,{name:s??`sampling-onboarding-toggle-${i}`,label:a,labelAlign:M.Left,value:o,onChange:l,size:Je.S})]}),t(jv,{children:t(Mr,{parts:r})})]})},Kv=f.div`
|
|
1132
1132
|
position: relative;
|
|
1133
1133
|
display: flex;
|
|
1134
1134
|
align-items: center;
|
|
@@ -1143,13 +1143,13 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
1143
1143
|
left: 16px;
|
|
1144
1144
|
top: 50%;
|
|
1145
1145
|
transform: translateY(-50%);
|
|
1146
|
-
`,
|
|
1146
|
+
`,qv=f.div`
|
|
1147
1147
|
height: 16px;
|
|
1148
1148
|
width: 100%;
|
|
1149
1149
|
background-color: ${({theme:e})=>e.v2.colors.black[500]};
|
|
1150
1150
|
border-top-left-radius: 18px;
|
|
1151
1151
|
border-top-right-radius: 18px;
|
|
1152
|
-
`,
|
|
1152
|
+
`,Jv=f.div`
|
|
1153
1153
|
width: ${({$width:e})=>e}px;
|
|
1154
1154
|
display: flex;
|
|
1155
1155
|
flex-direction: column;
|
|
@@ -1157,7 +1157,7 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
1157
1157
|
gap: 22px;
|
|
1158
1158
|
padding: 8px 32px 32px 32px;
|
|
1159
1159
|
background-color: ${({theme:e})=>e.v2.colors.black[500]};
|
|
1160
|
-
`,Zv=e=>t(yc,{rotate:90,...e}),Qv=({children:i,center:n,onNext:a,nextLabel:o=Ea,nextLoading:l})=>e(T,{$gap:8,$justifyContent:n?"center":"flex-end",$padding:"0 16px 16px 16px",children:[i,a&&t(j,{"data-id":"sampling-onboarding-btn-next",label:o,rightIcon:Zv,variant:
|
|
1160
|
+
`,Zv=e=>t(yc,{rotate:90,...e}),Qv=({children:i,center:n,onNext:a,nextLabel:o=Ea,nextLoading:l})=>e(T,{$gap:8,$justifyContent:n?"center":"flex-end",$padding:"0 16px 16px 16px",children:[i,a&&t(j,{"data-id":"sampling-onboarding-btn-next",label:o,rightIcon:Zv,variant:K.Primary,size:W.M,onClick:a,loading:l})]}),ey=e=>t(yc,{rotate:-90,...e}),ty=({title:i,onBack:n})=>{const a=v();return e(Kv,{$hasBack:!!n,children:[n&&t(Yv,{children:t(Be,{"data-id":"sampling-onboarding-back",icon:ey,size:Ue.M,onClick:n})}),t(w,{size:C.M,weight:500,color:a.v2.colors.white[500],align:"center",children:i})]})},iy=f.div`
|
|
1161
1161
|
box-sizing: border-box;
|
|
1162
1162
|
width: ${({$width:e})=>e??"100%"};
|
|
1163
1163
|
${({$fillHeight:e})=>e&&y`
|
|
@@ -1202,13 +1202,13 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
1202
1202
|
background-color: ${({theme:e})=>e.v2.colors.silver[900]};
|
|
1203
1203
|
`,uy=({children:e})=>{const i=v();return t(w,{size:C.S,weight:500,color:i.v2.colors.white[500],align:"center",children:e})},hy=f.div`
|
|
1204
1204
|
white-space: pre-line;
|
|
1205
|
-
`,gy=({enabled:n,onEnabledChange:o,onBack:l,onNext:r})=>{const s=v(),c=a(()=>
|
|
1205
|
+
`,gy=({enabled:n,onEnabledChange:o,onBack:l,onNext:r})=>{const s=v(),c=a(()=>Kr({enabled:n,keepPercentage:0}),[n]);return e(i,{children:[t(ty,{title:Da,onBack:l}),e(Jv,{$width:854,children:[t(uy,{children:Ra}),e($,{$gap:8,$width:"100%",children:[t(ny,{children:t(hy,{children:t(w,{size:C.XXS,color:s.v2.colors.silver[200],children:za})})}),e($,{$gap:8,$width:"100%",children:[e(cy,{children:[t(dy,{children:t(w,{size:C.S,weight:500,color:s.v2.colors.white[500],children:Xa})}),t(py,{children:t(Wv,{name:La,recommended:!0,toggleLabel:Pa,enabled:n,onEnabledChange:o,summary:c,toggleName:"sampling-onboarding-noisy-toggle"})})]}),t(sy,{message:Ma})]})]})]}),t(Qv,{onNext:r})]})},my=e=>t(yc,{rotate:90,...e}),by=({onClose:n})=>{const a=v();return e(i,{children:[t(qv,{}),e(Jv,{$width:732,children:[t(_a,{icon:uc}),e($,{$gap:16,$alignItems:"center",$width:"100%",children:[t(w,{size:C.M,weight:500,color:a.v2.colors.white[500],children:Fa}),Ba.split("\n").map((e,i)=>t(uy,{children:e},`subtitle-${i}-${e}`)),e(ny,{children:[t(w,{size:C.XS,color:a.v2.colors.silver[200],children:Ua}),t(ly,{color:a.v2.colors.white[500],items:[Va,Ga,Ha]})]})]})]}),t(Qv,{center:!0,children:t(j,{"data-id":"sampling-onboarding-btn-go-to",label:ja,rightIcon:my,variant:K.Primary,size:W.M,onClick:n})})]})},fy=e=>t(yc,{rotate:90,...e}),vy=f.div`
|
|
1206
1206
|
display: flex;
|
|
1207
1207
|
flex-direction: column;
|
|
1208
1208
|
align-items: center;
|
|
1209
1209
|
gap: 8px;
|
|
1210
1210
|
width: 100%;
|
|
1211
|
-
`,yy=({onSkip:n,onNext:a})=>{const o=v();return e(i,{children:[t(
|
|
1211
|
+
`,yy=({onSkip:n,onNext:a})=>{const o=v();return e(i,{children:[t(qv,{}),e(Jv,{$width:732,children:[t(_a,{icon:uc}),e($,{$gap:16,$alignItems:"center",$width:"100%",children:[e(vy,{children:[t(w,{size:C.M,weight:500,color:o.v2.colors.white[500],children:Wa}),t(uy,{children:Ka})]}),e(ny,{children:[t(w,{size:C.XS,color:o.v2.colors.silver[200],children:Ya}),t(ry,{items:[{title:Ja,description:qa},{title:Qa,description:Za},{title:to,description:eo}]}),t(sy,{message:io})]})]})]}),e(Qv,{center:!0,children:[t(j,{"data-id":"sampling-onboarding-btn-skip",label:no,variant:K.Secondary,onClick:n}),t(j,{"data-id":"sampling-onboarding-btn-start",label:ao,rightIcon:fy,variant:K.Primary,onClick:a})]})]})},Sy=f.div`
|
|
1212
1212
|
display: flex;
|
|
1213
1213
|
align-items: stretch;
|
|
1214
1214
|
gap: 16px;
|
|
@@ -1270,13 +1270,13 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
1270
1270
|
height: 24px;
|
|
1271
1271
|
border-radius: 6px;
|
|
1272
1272
|
background-color: ${({theme:e})=>e.v2.colors.yellow[900]};
|
|
1273
|
-
`,
|
|
1273
|
+
`,Ny=({selected:i,onSelect:n,name:a,description:o,badgeProps:l,bullets:r,warning:s,onReadMore:c})=>{const d=v(),p=i?d.v2.colors.white[500]:d.v2.colors.silver[200];return e(xy,{$selected:i,onClick:n,children:[e(wy,{children:[t(V,{"data-id":`sampling-onboarding-radio-${a}`,value:i,onChange:n,size:H.L}),t(uc,{size:24,fill:d.v2.colors.white[500]}),t(w,{size:C.S,weight:500,color:d.v2.colors.white[500],children:a})]}),e(Cy,{children:[e(ky,{$selected:i,children:[e($,{$gap:8,children:[t(E,{...l,textSize:C.XXXS}),t(w,{size:C.XXS,color:p,children:o})]}),r&&r.length>0&&t(ly,{color:p,items:r}),s&&e(Iy,{children:[t($y,{children:t(mc,{size:18,fill:d.v2.colors.yellow[500]})}),t(w,{size:C.XXXS,color:d.v2.colors.yellow[500],children:s})]})]}),c&&t(Ty,{children:t(j,{"data-id":`sampling-onboarding-btn-read-more-${a}`,label:wo,rightIcon:xs,variant:K.Text,size:W.S,onClick:e=>{e.stopPropagation(),c()}})})]})]})},Ay=({strategy:n,onStrategyChange:a,onBack:o,onNext:l,docsUrl:r})=>{const s=v(),c=r?()=>window.open(r,"_blank"):void 0;return e(i,{children:[t(ty,{title:oo,onBack:o}),e(Jv,{$width:854,children:[t(uy,{children:lo}),e(Sy,{children:[t(Ny,{selected:"keep-list"===n,onSelect:()=>a("keep-list"),name:ho,description:uo,badgeProps:{label:po,backgroundColor:s.v2.colors.purple[500],textColor:s.v2.colors.white[500]},bullets:[so,co],warning:ro,onReadMore:c}),t(Ny,{selected:"drop-list"===n,onSelect:()=>a("drop-list"),name:vo,description:fo,badgeProps:{label:bo,backgroundColor:s.v2.colors.green[500],textColor:s.v2.colors.black[500]},bullets:[go,mo],onReadMore:c}),t(Ny,{selected:"advanced"===n,onSelect:()=>a("advanced"),name:xo,description:So,badgeProps:{label:yo,backgroundColor:s.v2.colors.blue[700],textColor:s.v2.colors.white[500]},onReadMore:c})]})]}),t(Qv,{onNext:l})]})},Oy=({onBack:n,onNext:o,submitting:l})=>{const r=v(),s=a(()=>[{title:Io,bullets:[Co,ko,To]},{title:Do,bullets:[$o,No,Ao,Oo,Eo]}],[]);return e(i,{children:[t(ty,{title:Ro,onBack:n}),e(Jv,{$width:854,children:[t(uy,{children:zo}),t(T,{$gap:16,$width:"100%",$alignItems:"stretch",children:s.map((i,n)=>e(ny,{fillHeight:!0,width:"50%",children:[t(w,{size:C.XS,color:r.v2.colors.white[500],children:i.title}),t(ly,{items:i.bullets})]},n))}),t(sy,{message:Xo})]}),t(Qv,{onNext:o,nextLoading:l})]})},Ey=f.div`
|
|
1274
1274
|
white-space: pre-line;
|
|
1275
|
-
`,Dy=({errorPresetEnabled:n,onErrorPresetChange:o,onBack:l,onNext:r,submitting:s})=>{const c=v(),d=a(()=>Yr(n?{disabled:!1}:null),[n]);return e(i,{children:[t(ty,{title:
|
|
1275
|
+
`,Dy=({errorPresetEnabled:n,onErrorPresetChange:o,onBack:l,onNext:r,submitting:s})=>{const c=v(),d=a(()=>Yr(n?{disabled:!1}:null),[n]);return e(i,{children:[t(ty,{title:Po,onBack:l}),e(Jv,{$width:854,children:[t(uy,{children:Lo}),e($,{$gap:8,$width:"100%",children:[e(ny,{children:[t(Ey,{children:t(w,{size:C.XXS,color:c.v2.colors.silver[200],children:Mo})}),t(sy,{message:Xo})]}),e(cy,{children:[e(dy,{children:[t(w,{size:C.S,weight:500,color:c.v2.colors.white[500],children:_o}),t(qs,{size:16,fill:c.v2.colors.silver[200]})]}),t(py,{children:t(Wv,{name:Bo,recommended:!0,toggleLabel:Fo,enabled:n,onEnabledChange:o,summary:d,toggleName:"sampling-onboarding-drop-error-preset-toggle"})})]})]})]}),t(Qv,{onNext:r,nextLoading:s})]})},Ry=f.div`
|
|
1276
1276
|
white-space: pre-line;
|
|
1277
1277
|
`,zy=f.div`
|
|
1278
1278
|
width: fit-content;
|
|
1279
|
-
`,Ly=["50","25","10","1","0.1"],Xy=({value:i,onChange:n,label:o})=>{const l=v(),r=a(()=>Ly.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(zy,{children:t(F,{"data-id":"sampling-onboarding-ambient",options:r,selected:i,setSelected:n})})]})},Py=({errorPresetEnabled:n,onErrorPresetChange:o,ambientPercentage:l,onAmbientPercentageChange:r,onBack:s,onNext:c,submitting:d})=>{const p=v(),u=a(()=>Yr(n?{disabled:!1}:null),[n]);return e(i,{children:[t(ty,{title:Uo,onBack:s}),e(qv,{$width:854,children:[t(uy,{children:Vo}),e($,{$gap:8,$width:"100%",children:[e(ny,{children:[t(Ry,{children:t(w,{size:C.XXS,color:p.v2.colors.silver[200],children:Go})}),t(ly,{items:[Ho,jo,Ko,Wo,Yo]}),t(sy,{message:Lo})]}),e(cy,{children:[e(dy,{children:[t(w,{size:C.S,weight:500,color:p.v2.colors.white[500],children:Jo}),t(Js,{size:16,fill:p.v2.colors.silver[200]})]}),t(py,{children:t(Kv,{name:Bo,recommended:!0,toggleLabel:Fo,enabled:n,onEnabledChange:o,summary:u,toggleName:"sampling-onboarding-error-preset-toggle"})}),t(py,{children:t(Xy,{value:l,onChange:r,label:qo})})]})]})]}),t(Qv,{onNext:c,nextLoading:d})]})},My=({isOpen:e,onClose:i,k8sHealthProbesConfig:n,samplingId:a,docsUrl:r})=>{const{samplingApi:s}=Pc(),[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(yy,{onSkip:i,onNext:()=>p("noisy")});break;case"noisy":C=t(gy,{enabled:u,onEnabledChange:h,onBack:()=>p("welcome"),onNext:()=>p("strategy")});break;case"strategy":C=t(Ny,{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(Py,{errorPresetEnabled:b,onErrorPresetChange:f,ambientPercentage:v,onAmbientPercentageChange:y,onBack:()=>p("strategy"),onNext:w,submitting:S});break;case"drop-list":C=t(Dy,{errorPresetEnabled:b,onErrorPresetChange:f,onBack:()=>p("strategy"),onNext:w,submitting:S});break;case"advanced":C=t(Oy,{onBack:()=>p("strategy"),onNext:w,submitting:S});break;case"success":C=t(by,{onClose:i})}return t(Aa,{isOpen:e,onClose:i,children:C})};var _y,Fy;(e=>{e.BulkConfig="bulk-config",e.BulkSource="bulk-source",e.Delete="delete"})(_y||(_y={})),(e=>{e.K8s="k8s",e.VmAgent="vm-agent",e.CloudConnector="cloud-connector",e.AwsEcsAgent="aws-ecs-agent"})(Fy||(Fy={}));const By=[{id:Fy.CloudConnector,label:ke.CLOUD_CONNECTOR}];var Uy;(e=>{e.Id="id",e.Name="name",e.Type="type",e.Status="status",e.OdigosVersion="odigosVersion",e.ConnectedSince="connectedSince",e.LastActivity="lastActivity"})(Uy||(Uy={}));const Vy=[{key:Uy.Name,label:ke.NAME},{key:Uy.Type,label:ke.TYPE},{key:Uy.Status,label:ke.STATUS},{key:Uy.OdigosVersion,label:ke.ODIGOS_VERSION},{key:Uy.ConnectedSince,label:ke.CONNECTED_SINCE},{key:Uy.LastActivity,label:ke.LAST_ACTIVITY}],Gy=(e,t)=>{const i=e.find(e=>e.key===Uy.Id)?.rawValue;return t(i?.toString()||"")},Hy={[ie.Success]:"Connected",[ie.Warning]:"Degraded",[ie.Error]:"Error",[ie.Disabled]:"Disabled",[ie.Info]:"Pending"},jy={[Zo.K8s]:Mt.Purple,[Zo.Vm]:Mt.Blue,[Zo.Connector]:Mt.Green,[Zo.AwsEcs]:Mt.Yellow},Ky=({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}=At(),{capabilities:f}=Pc(),[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),[A,N]=l([]),[O,D]=l(!1),[R,z]=l(!1),L=d(()=>{D(!1),z(!0),C()},[C]),X=d(e=>{e===Fy.CloudConnector?D(!0):c?.(e)},[c]),P=a(()=>I===_y.BulkConfig?h:I===_y.BulkSource?g:0,[I,h,g]),{supportedConnections:M,supportedConnectionIds:_}=a(()=>{const e=((e,t)=>e.filter(e=>{const i=e.status===ie.Success,n=Jr(e.odigosVersion,t,e.type);return i&&n}))(x,P);return{supportedConnections:e,supportedConnectionIds:e.map(e=>e.id)}},[x,P]),F=a(()=>A.map(e=>x.find(t=>t.id===e)).filter(e=>!!e),[x,A]);o(()=>{if(!I||I===_y.Delete)return;const e=A.filter(e=>!_.includes(e));e.length&&N(t=>t.filter(t=>!e.includes(t)))},[I,A.length,_.length]);const B=a(()=>x.filter(e=>!k||e.name.toLowerCase().includes(k.toLowerCase())).map(e=>{const i=Jr(e.odigosVersion,h,e.type),n=Jr(e.odigosVersion,g,e.type),a=I===_y.BulkConfig?!i:!(I!==_y.BulkSource&&i||n);return{cells:[{key:Uy.Id,rawValue:e.id},{key:Uy.Name,rawValue:e.name},{key:Uy.Type,rawValue:e.type,component:()=>t(It,{variant:jy[e.type]??Mt.Default,label:Qo(e.type),leftIcon:fi(e.type)})},{key:Uy.Status,rawValue:e.status,component:()=>(e=>{if(e.type===Zo.Connector){const i=Hy[e.status]??"Pending",n=e.status===ie.Success?Ds:e.status===ie.Error?Rs: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?Ds:Rs;return t(E,{status:e.status,label:i,leftIcon:n})})(e)},{key:Uy.OdigosVersion,rawValue:e.odigosVersion},{key:Uy.ConnectedSince,rawValue:e.connectedAt?b(e.connectedAt):"-"},{key:Uy.LastActivity,rawValue:e.lastSeenAt?b(e.lastSeenAt):"-"}],onClick:e.status!==ie.Success||I?void 0:()=>r(e),isSelected:A.includes(e.id),onSelect:()=>N(t=>Array.from(new Set([...t,e.id]))),onDeselect:()=>N(t=>t.filter(t=>t!==e.id)),hideCheckbox:e.type!==Zo.K8s||e.status!==ie.Success||a}}),[x,A,k,I,h,g,b,r]),U=a(()=>B.some(e=>!e.hideCheckbox),[B]),V=a(()=>{const e=(e,t)=>{N([e]),$(t)};return(e=>{const{connections:t,configMinSupportedVersion:i,snapshotMinSupportedVersion:n,onDelete:a,onAddSource:o,onEditConfiguration:l}=e;return({cells:e})=>{const r=Gy(e,e=>t.find(t=>t.id===e)),s={id:$a(),label:ke.DELETE_CONNECTION,rightIcon:ws,onClick:()=>Gy(e,a)};if(!(e=>e.find(e=>e.key===Uy.Status)?.rawValue===ie.Success)(e)||r?.type===Zo.Connector)return[s];if(r?.type!==Zo.K8s)return[];const c=!!r&&Jr(r.odigosVersion,i,r.type),d=!!r&&Jr(r.odigosVersion,n,r.type),p=qr(i,r?.type),u=qr(n,r?.type),h=[];return o&&h.push({id:$a(),tooltip:d?ke.ADD_SOURCE:ke.UPGRADE_TO_USE_FEATURE(u),rightIcon:Ls,disabled:!d,onClick:()=>Gy(e,o)}),l&&h.push({id:$a(),tooltip:c?ke.EDIT_CONFIGURATION:ke.UPGRADE_TO_USE_FEATURE(p),rightIcon:js,disabled:!c,onClick:()=>Gy(e,l)}),h}})({connections:x,configMinSupportedVersion:h,snapshotMinSupportedVersion:g,onDelete:t=>e(t,_y.Delete),onAddSource:f.canFetchSnapshots&&f.canBulkPersistSources?t=>e(t,_y.BulkSource):void 0,onEditConfiguration:t=>e(t,_y.BulkConfig)})},[x,h,g,f]),G=a(()=>F.some(e=>e.type===Zo.K8s&&e.status===ie.Success&&Jr(e.odigosVersion,g,e.type)),[F,g]),H=a(()=>F.some(e=>e.type===Zo.K8s&&e.status===ie.Success&&Jr(e.odigosVersion,h,e.type)),[F,h]),j=a(()=>{const e=f.canFetchSnapshots&&f.canBulkPersistSources,t=qr(g,Zo.K8s),i=qr(h,Zo.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:_y.BulkSource,type:Ft.Button,buttonProps:{variant:W.Primary,size:K.S,label:ke.ADD_SOURCES,rightIcon:Ls,disabled:n,tooltip:a,onClick:i}}),o&&s.push({id:_y.BulkConfig,type:Ft.Button,buttonProps:{variant:W.Secondary,size:K.S,leftIcon:js,label:ke.MANAGE_CONFIGURATIONS,disabled:l,tooltip:r,onClick:o}}),s.push({id:$a(),type:Ft.Button,buttonProps:{variant:W.Text,size:K.S,label:lt.CANCEL,onClick:t}}),s})({onCancel:()=>N([]),onAddSource:e?()=>$(_y.BulkSource):void 0,addSourceDisabled:e&&!G,addSourceTooltip:e&&!G?ke.UPGRADE_TO_USE_FEATURE(t):void 0,onManageConfigurations:()=>$(_y.BulkConfig),manageConfigDisabled:!H,manageConfigTooltip:H?void 0:ke.UPGRADE_TO_USE_FEATURE(i)})},[f,G,H,g,h]),Y=a(()=>t(ka,{items:By,withMultiSelect:!1,selectedIds:[],setSelectedIds:e=>X(e[0]),buttonProps:{variant:W.Primary,size:K.S,label:lt.CREATE_NEW}}),[X]),J=a(()=>k.trim()&&x.length>0?{hideIcon:!0,title:ke.NO_RESULTS,subTitle:ke.NO_RESULTS_FOR_FILTER(k)}:{icon:Sc,title:ke.NO_CONNECTIONS,action:Y},[k,x.length,Y]);return t(el,{children:e(ze,{fullHeight:!0,richTitle:{icon:Sc,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:Ft.Button,buttonProps:{variant:W.Secondary,size:K.S,leftIcon:Hs,onClick:C,disabled:y}},{id:"connections-create-new",type:Ft.DropDataButton,buttonProps:{variant:W.Primary,size:K.S,label:lt.CREATE_NEW,onClick:e=>X(e)},dropDataProps:{alignX:Ia.Right,items:By}}],children:[t(ui,{variant:hi.Pretty,headerBackgroundColor:m.v2.colors.silver[1e3],isLoading:y,withCheckboxes:U,columns:Vy,rows:B,noDataProps:J,rowActionsPushRightPosition:I?`calc(${xd} - 24px)`:void 0,getRowActions:V}),O&&t(qc,{providers:p,children:t(rg,{onClose:()=>D(!1),withOverlay:!0,onCreateCloudConnector:u,onCreated:L})}),t($d,{isOpen:R,onClose:()=>z(!1)}),t(gi,{isOpen:!!A.length&&!I,richTitle:{icon:$s,title:ke.SELECTED_CLUSTERS,badge:{label:A.length}},actions:j}),I===_y.BulkConfig&&t(Zc,{connections:F,children:t(ug,{onClose:()=>$(null),connections:M,selectedConnectionIds:A,setSelectedConnectionIds:N})}),I===_y.BulkSource&&f.canFetchSnapshots&&f.canBulkPersistSources&&t(Zc,{connections:F,children:t(Qc,{selectedConnectionIds:A,children:t(yu,{onClose:()=>$(null),selectedConnectionIds:A,setSelectedConnectionIds:N})})}),t(Cd,{target:"connection",isOpen:I===_y.Delete,onClose:()=>{N([]),$(null)},onApprove:async()=>{const e=A[0];e&&(await s(e),await C())}})]})})};var Wy,Yy,Jy;(e=>{e.Overview="overview",e.Findings="findings",e.Transactions="transactions",e.SettingsAndConfigurations="settings-and-configurations"})(Wy||(Wy={})),(e=>{e.Anomaly="anomaly",e.Violation="violation",e.Transaction="transaction"})(Yy||(Yy={})),(e=>{e.JsonCode="jsonCode",e.TraceView="traceView"})(Jy||(Jy={}));const qy={drawerIsOpenFor:{type:null,id:null},openDrawer:()=>{},closeDrawer:()=>{},modalIsOpenFor:{type:null,payload:null},openModal:()=>{},closeModal:()=>{}},Zy=h(qy),Qy=({children:e})=>{const[i,n]=l(qy.drawerIsOpenFor),o=d((e,t)=>n({type:e,id:t}),[]),r=d(()=>n(qy.drawerIsOpenFor),[]),[s,c]=l(qy.modalIsOpenFor),p=d((e,t)=>c({type:e,payload:t}),[]),u=d(()=>c(qy.modalIsOpenFor),[]),h=a(()=>({drawerIsOpenFor:i,openDrawer:o,closeDrawer:r,modalIsOpenFor:s,openModal:p,closeModal:u}),[i,o,r,s,p,u]);return t(Zy.Provider,{value:h,children:e})},eS=()=>g(Zy),tS=f.div`
|
|
1279
|
+
`,Xy=["50","25","10","1","0.1"],Py=({value:i,onChange:n,label:o})=>{const l=v(),r=a(()=>Xy.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(zy,{children:t(F,{"data-id":"sampling-onboarding-ambient",options:r,selected:i,setSelected:n})})]})},Ly=({errorPresetEnabled:n,onErrorPresetChange:o,ambientPercentage:l,onAmbientPercentageChange:r,onBack:s,onNext:c,submitting:d})=>{const p=v(),u=a(()=>Yr(n?{disabled:!1}:null),[n]);return e(i,{children:[t(ty,{title:Uo,onBack:s}),e(Jv,{$width:854,children:[t(uy,{children:Vo}),e($,{$gap:8,$width:"100%",children:[e(ny,{children:[t(Ry,{children:t(w,{size:C.XXS,color:p.v2.colors.silver[200],children:Go})}),t(ly,{items:[Ho,jo,Wo,Ko,Yo]}),t(sy,{message:Xo})]}),e(cy,{children:[e(dy,{children:[t(w,{size:C.S,weight:500,color:p.v2.colors.white[500],children:qo}),t(qs,{size:16,fill:p.v2.colors.silver[200]})]}),t(py,{children:t(Wv,{name:Bo,recommended:!0,toggleLabel:Fo,enabled:n,onEnabledChange:o,summary:u,toggleName:"sampling-onboarding-error-preset-toggle"})}),t(py,{children:t(Py,{value:l,onChange:r,label:Jo})})]})]})]}),t(Qv,{onNext:c,nextLoading:d})]})},My=({isOpen:e,onClose:i,k8sHealthProbesConfig:n,samplingId:a,docsUrl:r})=>{const{samplingApi:s}=Lc(),[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(yy,{onSkip:i,onNext:()=>p("noisy")});break;case"noisy":C=t(gy,{enabled:u,onEnabledChange:h,onBack:()=>p("welcome"),onNext:()=>p("strategy")});break;case"strategy":C=t(Ay,{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(Ly,{errorPresetEnabled:b,onErrorPresetChange:f,ambientPercentage:v,onAmbientPercentageChange:y,onBack:()=>p("strategy"),onNext:w,submitting:S});break;case"drop-list":C=t(Dy,{errorPresetEnabled:b,onErrorPresetChange:f,onBack:()=>p("strategy"),onNext:w,submitting:S});break;case"advanced":C=t(Oy,{onBack:()=>p("strategy"),onNext:w,submitting:S});break;case"success":C=t(by,{onClose:i})}return t(Na,{isOpen:e,onClose:i,children:C})};var _y,Fy;(e=>{e.BulkConfig="bulk-config",e.BulkSource="bulk-source",e.Delete="delete"})(_y||(_y={})),(e=>{e.K8s="k8s",e.VmAgent="vm-agent",e.CloudConnector="cloud-connector",e.AwsEcsAgent="aws-ecs-agent"})(Fy||(Fy={}));const By=[{id:Fy.CloudConnector,label:ke.CLOUD_CONNECTOR}];var Uy;(e=>{e.Id="id",e.Name="name",e.Type="type",e.Status="status",e.OdigosVersion="odigosVersion",e.ConnectedSince="connectedSince",e.LastActivity="lastActivity"})(Uy||(Uy={}));const Vy=[{key:Uy.Name,label:ke.NAME},{key:Uy.Type,label:ke.TYPE},{key:Uy.Status,label:ke.STATUS},{key:Uy.OdigosVersion,label:ke.ODIGOS_VERSION},{key:Uy.ConnectedSince,label:ke.CONNECTED_SINCE},{key:Uy.LastActivity,label:ke.LAST_ACTIVITY}],Gy=(e,t)=>{const i=e.find(e=>e.key===Uy.Id)?.rawValue;return t(i?.toString()||"")},Hy={[ie.Success]:"Connected",[ie.Warning]:"Degraded",[ie.Error]:"Error",[ie.Disabled]:"Disabled",[ie.Info]:"Pending"},jy={[Zo.K8s]:Mt.Purple,[Zo.Vm]:Mt.Blue,[Zo.Connector]:Mt.Green,[Zo.AwsEcs]:Mt.Yellow},Wy=({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}=Nt(),{capabilities:f}=Lc(),[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),[R,z]=l(!1),X=d(()=>{D(!1),z(!0),C()},[C]),P=d(e=>{e===Fy.CloudConnector?D(!0):c?.(e)},[c]),L=a(()=>I===_y.BulkConfig?h:I===_y.BulkSource?g:0,[I,h,g]),{supportedConnections:M,supportedConnectionIds:_}=a(()=>{const e=((e,t)=>e.filter(e=>{const i=e.status===ie.Success,n=qr(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===_y.Delete)return;const e=N.filter(e=>!_.includes(e));e.length&&A(t=>t.filter(t=>!e.includes(t)))},[I,N.length,_.length]);const B=a(()=>x.filter(e=>!k||e.name.toLowerCase().includes(k.toLowerCase())).map(e=>{const i=qr(e.odigosVersion,h,e.type),n=qr(e.odigosVersion,g,e.type),a=I===_y.BulkConfig?!i:!(I!==_y.BulkSource&&i||n);return{cells:[{key:Uy.Id,rawValue:e.id},{key:Uy.Name,rawValue:e.name},{key:Uy.Type,rawValue:e.type,component:()=>t(It,{variant:jy[e.type]??Mt.Default,label:Qo(e.type),leftIcon:fi(e.type)})},{key:Uy.Status,rawValue:e.status,component:()=>(e=>{if(e.type===Zo.Connector){const i=Hy[e.status]??"Pending",n=e.status===ie.Success?Ds:e.status===ie.Error?Rs: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?Ds:Rs;return t(E,{status:e.status,label:i,leftIcon:n})})(e)},{key:Uy.OdigosVersion,rawValue:e.odigosVersion},{key:Uy.ConnectedSince,rawValue:e.connectedAt?b(e.connectedAt):"-"},{key:Uy.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!==Zo.K8s||e.status!==ie.Success||a}}),[x,N,k,I,h,g,b,r]),U=a(()=>B.some(e=>!e.hideCheckbox),[B]),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=Gy(e,e=>t.find(t=>t.id===e)),s={id:$a(),label:ke.DELETE_CONNECTION,rightIcon:ws,onClick:()=>Gy(e,a)};if(!(e=>e.find(e=>e.key===Uy.Status)?.rawValue===ie.Success)(e)||r?.type===Zo.Connector)return[s];if(r?.type!==Zo.K8s)return[];const c=!!r&&qr(r.odigosVersion,i,r.type),d=!!r&&qr(r.odigosVersion,n,r.type),p=Jr(i,r?.type),u=Jr(n,r?.type),h=[];return o&&h.push({id:$a(),tooltip:d?ke.ADD_SOURCE:ke.UPGRADE_TO_USE_FEATURE(u),rightIcon:Xs,disabled:!d,onClick:()=>Gy(e,o)}),l&&h.push({id:$a(),tooltip:c?ke.EDIT_CONFIGURATION:ke.UPGRADE_TO_USE_FEATURE(p),rightIcon:js,disabled:!c,onClick:()=>Gy(e,l)}),h}})({connections:x,configMinSupportedVersion:h,snapshotMinSupportedVersion:g,onDelete:t=>e(t,_y.Delete),onAddSource:f.canFetchSnapshots&&f.canBulkPersistSources?t=>e(t,_y.BulkSource):void 0,onEditConfiguration:t=>e(t,_y.BulkConfig)})},[x,h,g,f]),G=a(()=>F.some(e=>e.type===Zo.K8s&&e.status===ie.Success&&qr(e.odigosVersion,g,e.type)),[F,g]),H=a(()=>F.some(e=>e.type===Zo.K8s&&e.status===ie.Success&&qr(e.odigosVersion,h,e.type)),[F,h]),j=a(()=>{const e=f.canFetchSnapshots&&f.canBulkPersistSources,t=Jr(g,Zo.K8s),i=Jr(h,Zo.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:_y.BulkSource,type:Ft.Button,buttonProps:{variant:K.Primary,size:W.S,label:ke.ADD_SOURCES,rightIcon:Xs,disabled:n,tooltip:a,onClick:i}}),o&&s.push({id:_y.BulkConfig,type:Ft.Button,buttonProps:{variant:K.Secondary,size:W.S,leftIcon:js,label:ke.MANAGE_CONFIGURATIONS,disabled:l,tooltip:r,onClick:o}}),s.push({id:$a(),type:Ft.Button,buttonProps:{variant:K.Text,size:W.S,label:lt.CANCEL,onClick:t}}),s})({onCancel:()=>A([]),onAddSource:e?()=>$(_y.BulkSource):void 0,addSourceDisabled:e&&!G,addSourceTooltip:e&&!G?ke.UPGRADE_TO_USE_FEATURE(t):void 0,onManageConfigurations:()=>$(_y.BulkConfig),manageConfigDisabled:!H,manageConfigTooltip:H?void 0:ke.UPGRADE_TO_USE_FEATURE(i)})},[f,G,H,g,h]),Y=a(()=>t(ka,{items:By,withMultiSelect:!1,selectedIds:[],setSelectedIds:e=>P(e[0]),buttonProps:{variant:K.Primary,size:W.S,label:lt.CREATE_NEW}}),[P]),q=a(()=>k.trim()&&x.length>0?{hideIcon:!0,title:ke.NO_RESULTS,subTitle:ke.NO_RESULTS_FOR_FILTER(k)}:{icon:Sc,title:ke.NO_CONNECTIONS,action:Y},[k,x.length,Y]);return t(el,{children:e(ze,{fullHeight:!0,richTitle:{icon:Sc,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:Ft.Button,buttonProps:{variant:K.Secondary,size:W.S,leftIcon:Hs,onClick:C,disabled:y}},{id:"connections-create-new",type:Ft.DropDataButton,buttonProps:{variant:K.Primary,size:W.S,label:lt.CREATE_NEW,onClick:e=>P(e)},dropDataProps:{alignX:Ia.Right,items:By}}],children:[t(ui,{variant:hi.Pretty,headerBackgroundColor:m.v2.colors.silver[1e3],isLoading:y,withCheckboxes:U,columns:Vy,rows:B,noDataProps:q,rowActionsPushRightPosition:I?`calc(${xd} - 24px)`:void 0,getRowActions:V}),O&&t(Jc,{providers:p,children:t(rg,{onClose:()=>D(!1),withOverlay:!0,onCreateCloudConnector:u,onCreated:X})}),t($d,{isOpen:R,onClose:()=>z(!1)}),t(gi,{isOpen:!!N.length&&!I,richTitle:{icon:$s,title:ke.SELECTED_CLUSTERS,badge:{label:N.length}},actions:j}),I===_y.BulkConfig&&t(Zc,{connections:F,children:t(ug,{onClose:()=>$(null),connections:M,selectedConnectionIds:N,setSelectedConnectionIds:A})}),I===_y.BulkSource&&f.canFetchSnapshots&&f.canBulkPersistSources&&t(Zc,{connections:F,children:t(Qc,{selectedConnectionIds:N,children:t(yu,{onClose:()=>$(null),selectedConnectionIds:N,setSelectedConnectionIds:A})})}),t(Cd,{target:"connection",isOpen:I===_y.Delete,onClose:()=>{A([]),$(null)},onApprove:async()=>{const e=N[0];e&&(await s(e),await C())}})]})})};var Ky,Yy,qy;(e=>{e.Overview="overview",e.Findings="findings",e.Transactions="transactions",e.SettingsAndConfigurations="settings-and-configurations"})(Ky||(Ky={})),(e=>{e.Anomaly="anomaly",e.Violation="violation",e.Transaction="transaction"})(Yy||(Yy={})),(e=>{e.JsonCode="jsonCode",e.TraceView="traceView"})(qy||(qy={}));const Jy={drawerIsOpenFor:{type:null,id:null},openDrawer:()=>{},closeDrawer:()=>{},modalIsOpenFor:{type:null,payload:null},openModal:()=>{},closeModal:()=>{}},Zy=h(Jy),Qy=({children:e})=>{const[i,n]=l(Jy.drawerIsOpenFor),o=d((e,t)=>n({type:e,id:t}),[]),r=d(()=>n(Jy.drawerIsOpenFor),[]),[s,c]=l(Jy.modalIsOpenFor),p=d((e,t)=>c({type:e,payload:t}),[]),u=d(()=>c(Jy.modalIsOpenFor),[]),h=a(()=>({drawerIsOpenFor:i,openDrawer:o,closeDrawer:r,modalIsOpenFor:s,openModal:p,closeModal:u}),[i,o,r,s,p,u]);return t(Zy.Provider,{value:h,children:e})},eS=()=>g(Zy),tS=f.div`
|
|
1280
1280
|
display: flex;
|
|
1281
1281
|
flex-direction: column;
|
|
1282
1282
|
align-self: stretch;
|
|
@@ -1302,7 +1302,7 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
1302
1302
|
padding: 8px;
|
|
1303
1303
|
border-radius: 12px;
|
|
1304
1304
|
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
1305
|
-
`,aS=({richTitle:i,textCards:n,tableColumns:a,tableRows:o,getRowActions:l,tableKey:r,tableMaxHeight:s,tableWithCheckboxes:c,isLoading:d,actions:p,children:u})=>{const h=v();return t(tS,{children:e(iS,{children:[e(T,{$justifyContent:"space-between",children:[t(tl,{...i}),p&&t(il,{actions:p})]}),t(T,{$gap:22,children:n.map(e=>t(nl,{...e},e.title))}),u,!!a.length&&t(nS,{children:t(ui,{maxHeight:s,headerBackgroundColor:h.v2.colors.silver[800],variant:hi.Data,columns:a,rows:o,isLoading:d,getRowActions:l,withCheckboxes:c},r)})]})})};var oS;(e=>{e.Title="title",e.TransactionId="transactionId",e.LastSeen="lastSeen",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"})(oS||(oS={}));const lS=e=>e.kind===ll.Anomaly?["anomaly",e.transactionId??"",e.signature??""].join("\0"):["violation",e.scopeKey??"",e.ruleKey??"",e.offending??""].join("\0"),rS=(e,t)=>lS(e)===lS(t);var sS;(e=>{e.Dismiss="dismiss",e.Allow="allow"})(sS||(sS={}));const cS={[sS.Dismiss]:[al.Dismissed,ol.Dismissed],[sS.Allow]:[al.Allowed,ol.Baselined]},dS=(e,t)=>[{id:`${e.id}-investigate`,label:"Investigate",rightIcon:Ss,variant:W.Primary,onClick:()=>{if(!e.id)return;const i=e.cells.find(e=>e.key===oS.Kind)?.rawValue;t(i===ll.Anomaly?Yy.Anomaly:Yy.Violation,e.id)}}],pS=[{label:"Severity",key:oS.Severity},{label:"Namespace",key:oS.Namespace},{label:"Service",key:oS.Service,noFilter:!0},{label:"Finding",key:oS.Title,noFilter:!0},{label:"Type",key:oS.Kind},{label:"Matched traces",key:oS.Occurrences,noFilter:!0},{label:"Status",key:oS.Status},{label:"Last seen",key:oS.LastSeen,noFilter:!0}],uS=[{label:"Namespace",key:oS.Namespace},{label:"Service",key:oS.Service,noFilter:!0},{label:"Events",key:oS.Occurrences,noFilter:!0},{label:"Last seen",key:oS.LastSeen,noFilter:!0}],hS=e=>{const t={open:0,violations:0,anomalies:0,critical:0,high:0,medium:0,low:0};return e?.forEach(e=>{switch(e.status!==al.Open&&e.status!==ol.Open||(t.open+=1),e.kind===ll.Violation?t.violations+=1:e.kind===ll.Anomaly&&(t.anomalies+=1),e.severity){case rl.Critical:t.critical+=1;break;case rl.High:t.high+=1;break;case rl.Medium:t.medium+=1;break;case rl.Low:t.low+=1}}),t},gS=(e,t)=>({label:t,backgroundColor:(()=>{switch(t){case rl.Low:return e.v2.colors.purple[900];case rl.Medium:return e.v2.colors.yellow[550];case rl.High:return e.v2.colors.orange[500];case rl.Critical:return e.v2.colors.red[800];default:return}})(),textColor:(()=>{switch(t){case rl.Low:case rl.Critical:return e.v2.colors.white[500];case rl.Medium:case rl.High:return e.v2.colors.black[500];default:return}})()}),mS=(e,t)=>({label:t,backgroundColor:(()=>{switch(t){case al.Open:case ol.Open:return e.v2.colors.beige[600];case al.Allowed:case ol.Baselined:return e.v2.colors.green[500];case al.Dismissed:case ol.Dismissed:default:return e.v2.colors.silver[500]}})(),textColor:(()=>{switch(t){case al.Open:case ol.Open:case al.Allowed:case ol.Baselined:return e.v2.colors.black[500];case al.Dismissed:case ol.Dismissed:default:return e.v2.colors.white[500]}})()}),bS=(e,i,n,a,o,l)=>n?.slice(0,a||n.length).map(n=>({id:lS(n),isSelected:!!o?.find(e=>rS(e,n)),onSelect:()=>l?.(n,!0),onDeselect:()=>l?.(n,!1),cells:[{key:oS.Title,rawValue:n.title,component:()=>t(It,{label:n.title,variant:Mt.Blue})},{key:oS.TransactionId,rawValue:n.transactionId??"-"},{key:oS.LastSeen,rawValue:i(n.lastSeen,{style:"short"})},{key:oS.Namespace,rawValue:n.namespace},{key:oS.Service,rawValue:n.service},{key:oS.Kind,rawValue:n.kind,component:()=>t(E,{label:n.kind,backgroundColor:e.v2.colors.pink[1e3],textColor:e.v2.colors.pink[500]})},{key:oS.Status,rawValue:n.status,component:()=>t(E,{...mS(e,n.status)})},{key:oS.Score,rawValue:Number(n.score).toLocaleString()},{key:oS.Severity,rawValue:n.severity,component:()=>t(E,{...gS(e,n.severity)})},{key:oS.Occurrences,rawValue:Number(n.occurrences).toLocaleString()},{key:oS.Offending,rawValue:n.offending??"-"},{key:oS.Signature,rawValue:n.signature??"-"},{key:oS.RuleKey,rawValue:n.ruleKey??"-",component:n.ruleKey?()=>t(It,{label:n.ruleKey,variant:Mt.Blue}):void 0},{key:oS.ScopeKey,rawValue:n.scopeKey??"-",component:n.scopeKey?()=>t(It,{label:n.scopeKey,variant:Mt.Default}):void 0}]}))||[];var fS;(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"})(fS||(fS={}));const vS=(e,t)=>[{id:`${e.id}-open-baseline`,label:"Open baseline",rightIcon:Ss,variant:W.Primary,onClick:()=>{const i=e.cells.find(e=>e.key===fS.TransactionId)?.rawValue;t(Yy.Transaction,i)}}],yS=[{label:"Namespace",key:fS.Namespace},{label:"Service",key:fS.Service,noFilter:!0},{label:"Operation",key:fS.Operation,noFilter:!0},{label:"Kind",key:fS.Kind},{label:"Volume",key:fS.Volume,noFilter:!0},{label:"Baseline",key:fS.Baseline},{label:"Last seen",key:fS.LastSeen,noFilter:!0}],SS=[{label:"Namespace",key:fS.Namespace},{label:"Service",key:fS.Service,noFilter:!0},{label:"Baseline",key:fS.Baseline},{label:"Auto guardrail",key:fS.Guardrail},{label:"Transactions",key:fS.TransactionCount,noFilter:!0},{label:"Volume",key:fS.Volume,noFilter:!0}],xS=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}),wS=(e,i,n,a)=>n?.slice(0,a||n.length).map(n=>({id:n.id,cells:[{key:fS.TransactionId,rawValue:n.id},{key:fS.LastSeen,rawValue:i(n.lastSeen,{style:"short"})},{key:fS.Namespace,rawValue:n.namespace},{key:fS.Service,rawValue:n.service},{key:fS.Kind,rawValue:n.kind,component:()=>t(E,{label:n.kind,backgroundColor:e.v2.colors.blue[900]})},{key:fS.Operation,rawValue:n.operation,component:()=>t(It,{label:n.operation,variant:Mt.Blue})},{key:fS.Baseline,rawValue:n.promoted?"Promoted":"Learning",component:()=>n.promoted?t(E,{label:"Promoted",leftIcon:Ds,status:ie.Success,textSize:C.XXXS}):t(E,{label:"Learning",backgroundColor:e.v2.colors.beige[600],textColor:e.v2.colors.black[500],textSize:C.XXXS})},{key:fS.Volume,rawValue:Number(n.volume).toLocaleString()}]}))||[],CS=({setSelectedTab:i})=>{const n=v(),{openDrawer:o}=eS(),{formatDurationAgo:r}=At(),{insightsApi:s}=Pc(),[c,d]=l(dl),{data:p,loading:u,refetch:h}=s.useFindings({windowHours:c}),{data:g,loading:m,refetch:b}=s.useTransactions(),f=a(()=>hS(p),[p]),y=a(()=>bS(n,r,p,5),[p,n,r]),S=a(()=>xS(g),[g]),x=a(()=>wS(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(j,{variant:W.Text,size:K.S,leftIcon:Hs,label:"Refresh",onClick:()=>{h(),b()},disabled:u||m})]}),e($,{$gap:24,children:[t(aS,{tableMaxHeight:"380px",richTitle:{title:"Top 5 Findings",titleSize:C.M,icon:xc,badge:{label:p?.length||0}},textCards:[{bgTint:"900",title:"Open findings",cells:[{value:f.open.toLocaleString()}]},{bgTint:"900",title:"Critical / High",cells:[{value:(f.critical+f.high).toLocaleString()}]},{bgTint:"900",title:"Policy violations",cells:[{value:f.violations.toLocaleString()}]},{bgTint:"900",title:"Anomalies",cells:[{value:f.anomalies.toLocaleString()}]}],tableColumns:pS,tableRows:y,isLoading:u,actions:[{id:"search-by-time",type:Ft.PopupButton,buttonProps:ul(c),popupProps:{children:({close:e})=>t(pl,{defaultValue:c,onApply:d,onClose:e})}},{id:"view-all",type:Ft.Button,buttonProps:{label:"View all",rightIcon:Ss,variant:W.Secondary,size:K.S,onClick:()=>i(Wy.Findings)}}],getRowActions:e=>dS(e,o)}),t(aS,{tableMaxHeight:"380px",richTitle:{title:"Top 5 Transactions",titleSize:C.M,icon:wc,badge:{label:g?.length||0}},textCards:[{bgTint:"900",title:"Transactions",cells:[{value:S.total.toLocaleString()}]},{bgTint:"900",title:"Services",cells:[{value:S.services.toLocaleString()}]},{bgTint:"900",title:"Volume",cells:[{value:S.volume.toLocaleString()}]},{bgTint:"900",title:"Baseline Promoted",cells:[{value:((S.promoted||0)/(S.total||1)*100).toFixed(1)+"%"}]}],tableColumns:yS,tableRows:x,isLoading:m,actions:[{id:"view-all",type:Ft.Button,buttonProps:{label:"View all",rightIcon:Ss,variant:W.Secondary,size:K.S,onClick:()=>i(Wy.Transactions)}}],getRowActions:e=>vS(e,o)})]})]})},kS={[sS.Dismiss]:{label:"Dismiss",title:e=>`Dismiss selected findings (${e})`,description:"Are you sure you want to dismiss the selected findings?"},[sS.Allow]:{label:"Allow",title:e=>`Allow selected findings (${e})`,description:"Are you sure you want to allow the selected findings?"}},TS=({actionType:i,selectedFindings:n,onDone:o,buttonProps:s})=>{const[c,d]=l(!1),[p,u]=l(!1),h=()=>u(!1),{insightsApi:g}=Pc(),m=kS[i],b=a(()=>{return!n.length||(t=i,(e=n).length>0&&e.every(e=>((e,t)=>cS[t].includes(e.status))(e,t)));var e,t},[n,i]);return e(r,{children:[t(j,{label:m.label,variant:W.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:W.Secondary,onClick:h,loading:c},approveButton:{label:m.label,variant:W.Primary,disabled:!n.length,onClick:async()=>{d(!0),await(async(e,t,i)=>{const n=t.filter(e=>e.kind===ll.Anomaly&&e.transactionId&&e.signature),a=t.filter(e=>e.kind===ll.Violation),o=[],l=i===sS.Allow;if(n.length){const t=n.map(e=>({transactionId:e.transactionId,signature:e.signature}));if(e.bulkResolveAnomalies)o.push(e.bulkResolveAnomalies(l?sl.Accept:sl.Dismiss,t));else{const i=l?cl.Accept:cl.Dismiss;o.push(...t.map(t=>e.resolveAnomaly?.({...t,resolution:i})))}}if(a.length){const t=l?e.allowViolation: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 IS;(e=>{e.All="all",e.GroupByService="groupByService"})(IS||(IS={}));const $S=[{label:"All findings",value:IS.All},{label:"Group by service",value:IS.GroupByService}];var AS;(e=>{e.Open="open",e.Dismissed="dismissed",e.Allowed="allowed"})(AS||(AS={}));const NS=[{label:"Open",value:AS.Open},{label:"Dismissed",value:AS.Dismissed},{label:"Allowed",value:AS.Allowed}],OS=()=>{const i=v(),{openDrawer:n}=eS(),{formatDurationAgo:o}=At(),{insightsApi:r}=Pc(),[s,c]=l(dl),{data:p,loading:u,refetch:h}=r.useFindings({windowHours:s}),[g,m]=l([]),b=d((e,t)=>{m(i=>t?-1===i.findIndex(t=>rS(t,e))?[...i,e]:i:i.filter(t=>!rS(t,e)))},[]),[f,y]=l(""),[S,x]=l(IS.All),[w,k]=l(AS.Open),{openFindings:I,dismissedFindings:$,allowedFindings:N}=a(()=>{const e=[],t=[],i=[];return p?.forEach(n=>{[al.Open,ol.Open].includes(n.status)&&e.push(n),[al.Dismissed,ol.Dismissed].includes(n.status)&&t.push(n),[al.Allowed,ol.Baselined].includes(n.status)&&i.push(n)}),{openFindings:e,dismissedFindings:t,allowedFindings:i}},[p]),O=a(()=>w===AS.Open?I:w===AS.Dismissed?$:w===AS.Allowed?N:[],[w,I,$,N]),E=a(()=>f?O?.filter(e=>e.namespace?.toLowerCase().includes(f.toLowerCase())||e.service?.toLowerCase().includes(f.toLowerCase())||e.kind?.toLowerCase().includes(f.toLowerCase())||e.title.toLowerCase().includes(f.toLowerCase())):O,[O,f]),D=a(()=>hS(O),[O]),R=a(()=>{if(S===IS.GroupByService){const e=[];return E?.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:oS.Namespace,rawValue:a.namespace},{key:oS.Service,rawValue:a.service},{key:oS.Occurrences,rawValue:Number(a.occurrences).toLocaleString()},{key:oS.LastSeen,rawValue:new Date(a.lastSeen).toLocaleString()}],expandedContent:({maxHeight:r})=>t(ui,{fitContent:!0,variant:hi.DataSecondary,maxHeight:r,columns:pS,rows:bS(e,i,a.findings,void 0,o,l),getRowActions:e=>dS(e,n),withCheckboxes:!0})})))(i,o,n,e,g,b)}return bS(i,o,E,void 0,g,b)},[i,E,S,o,n,g,b]);return t(aS,{richTitle:{title:"Findings",titleSize:C.M,icon:xc,badge:{label:O?.length||0},children:t(A,{$padding:"0 0 0 32px",children:t(F,{options:NS,selected:w,setSelected:k,size:rt.L})})},textCards:[{bgTint:"900",title:(w===AS.Open?"Open":w===AS.Dismissed?"Dismissed":"Allowed")+" findings",cells:[{value:D.open.toLocaleString()}]},{bgTint:"900",title:"Critical / High",cells:[{value:(D.critical+D.high).toLocaleString()}]},{bgTint:"900",title:"Policy violations",cells:[{value:D.violations.toLocaleString()}]},{bgTint:"900",title:"Anomalies",cells:[{value:D.anomalies.toLocaleString()}]}],tableKey:S,tableColumns:S===IS.GroupByService?uS:pS,tableRows:R,tableWithCheckboxes:S===IS.All,isLoading:u,actions:[{id:"search-by-time",type:Ft.PopupButton,buttonProps:ul(s),popupProps:{children:({close:e})=>t(pl,{defaultValue:s,onApply:c,onClose:e})}},{id:"refresh",type:Ft.Button,buttonProps:{label:"Refresh",leftIcon:Hs,variant:W.Secondary,size:K.S,disabled:u,onClick:()=>h()}}],getRowActions:S===IS.All?e=>dS(e,n):void 0,children:e(T,{$width:"100%",$gap:24,$justifyContent:"space-between",children:[e(T,{$gap:12,children:[t(tl,{title:"Findings list",titleSize:C.S,badge:{label:E?.length||0}}),t(Bt,{width:"400px",value:f,onChange:y}),t(F,{options:$S,selected:S,setSelected:x,size:rt.L})]}),e(T,{$gap:12,children:[t(TS,{actionType:sS.Dismiss,selectedFindings:g,onDone:()=>{m([]),h()},buttonProps:{label:"Dismiss selection"}}),t(TS,{actionType:sS.Allow,selectedFindings:g,onDone:()=>{m([]),h()},buttonProps:{label:"Allow selection",variant:W.Primary}})]})]})})};var ES;(e=>{e.All="all",e.GroupByService="groupByService"})(ES||(ES={}));const DS=[{label:"All transactions",value:ES.All},{label:"Group by service",value:ES.GroupByService}],RS=()=>{const i=v(),{openDrawer:n}=eS(),{formatDurationAgo:o}=At(),{insightsApi:r}=Pc(),{data:s,loading:c,refetch:d}=r.useTransactions(),{data:p}=r.useGuardrails(),[u,h]=l(""),[g,m]=l(ES.GroupByService),[b,f]=l(null),[y,S]=l(null),[x,w]=l(null),k=a(()=>{const e=new Set;return p?.forEach(t=>{t.rules.some(e=>"allowed_transactions"===e.key&&e.mode===hl.Enforce)&&e.add(t.scopeKey)}),e},[p]),I=a(()=>u?s?.filter(e=>e.id?.toLowerCase().includes(u.toLowerCase())||e.namespace?.toLowerCase().includes(u.toLowerCase())||e.service?.toLowerCase().includes(u.toLowerCase())||e.kind?.toLowerCase().includes(u.toLowerCase())||e.operation?.toLowerCase().includes(u.toLowerCase())):s,[s,u]),$=a(()=>xS(s),[s]),A=a(()=>{if(g===ES.GroupByService){const e=[];return I?.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)=>a.map(a=>{const l=a.transactions.length,r=a.transactions.filter(e=>e.promoted).length,s=r===l,c=`${a.namespace}/${a.service}`,d=o?.has(c)??!1;return{id:c,cells:[{key:fS.Namespace,rawValue:a.namespace},{key:fS.Service,rawValue:a.service},{key:fS.Baseline,rawValue:s?"Promoted":"Learning",component:()=>t(E,s?{label:`${r}/${l} Promoted`,rightIcon:Ds,status:ie.Success,textSize:C.XXXS}:{label:`${r}/${l} Learning`,backgroundColor:e.v2.colors.beige[600],textColor:e.v2.colors.black[500],textSize:C.XXXS})},{key:fS.Guardrail,rawValue:d?"Enabled":"Disabled",component:()=>t(E,d?{label:"Enabled",leftIcon:Ds,status:ie.Success,invertColors:!0,textSize:C.XXXS}:{label:"Disabled",leftIcon:Rs,status:ie.Disabled,invertColors:!0,textSize:C.XXXS})},{key:fS.TransactionCount,rawValue:a.transactions.length.toLocaleString()},{key:fS.Volume,rawValue:a.volume.toLocaleString()}],expandedContent:({maxHeight:o})=>t(ui,{fitContent:!0,variant:hi.DataSecondary,maxHeight:o,columns:yS,rows:wS(e,i,a.transactions),getRowActions:e=>vS(e,n)})}}))(i,o,n,e,k)}return wS(i,o,I)},[i,I,g,o,n,k]);return e(aS,{richTitle:{title:"Transactions",titleSize:C.M,icon:wc,badge:{label:s?.length||0}},textCards:[{bgTint:"900",title:"Transactions",cells:[{value:$.total.toLocaleString()}]},{bgTint:"900",title:"Services",cells:[{value:$.services.toLocaleString()}]},{bgTint:"900",title:"Volume",cells:[{value:$.volume.toLocaleString()}]},{bgTint:"900",title:"Baseline Promoted",cells:[{value:(($.promoted||0)/($.total||1)*100).toFixed(1)+"%"}]}],tableKey:g,tableColumns:g===ES.GroupByService?SS:yS,tableRows:A,isLoading:c,actions:[{id:"refresh",type:Ft.Button,buttonProps:{label:"Refresh",leftIcon:Hs,variant:W.Secondary,size:K.S,disabled:c,onClick:()=>d()}}],getRowActions:e=>{if(g===ES.All)return vS(e,n);const t=e.cells.find(e=>e.key===fS.Namespace)?.rawValue,i=e.cells.find(e=>e.key===fS.Service)?.rawValue,a="Promoted"===e.cells.find(e=>e.key===fS.Baseline)?.rawValue,o=k.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:Cc,variant:W.Secondary,disabled:!r.disableTransactionGuardrail,onClick:()=>w(l)}):s.push({id:`${e.id}-enable-txn-guardrail`,label:"Enable transaction guardrail",leftIcon:Cc,variant:W.Primary,disabled:!r.enableTransactionGuardrail,onClick:()=>S(l)}),s.push({id:`${e.id}-force-promote`,label:"Force promote",leftIcon:$s,variant:W.Primary,disabled:a||!r.forcePromoteService,onClick:()=>f(l)}),s},children:[t(T,{$width:"100%",$justifyContent:"space-between",children:e(T,{$gap:12,children:[t(tl,{title:"Transactions list",titleSize:C.S,badge:{label:I?.length||0}}),t(Bt,{width:"400px",value:u,onChange:h}),t(F,{options:DS,selected:g,setSelected:m,size:rt.L})]})}),t(Ce,{isOpen:null!==b,onClose:()=>f(null),title:"Force promote service",description:`Promote every scored baseline class on every transaction of ${b?.service??"this service"}? This skips learning gates and may auto-enable the transaction guardrail.`,approveButton:{label:"Force promote",onClick:()=>(async()=>{if(!b)return;const e=b;f(null),await(r.forcePromoteService?.(e))})()},denyButton:{label:"Cancel",onClick:()=>f(null),variant:W.Secondary}}),t(Ce,{isOpen:null!==y,onClose:()=>S(null),title:"Enable transaction guardrail",description:`Create an allowed_transactions guardrail for ${y?.service??"this service"} from its current operations? New operations will become findings.`,approveButton:{label:"Enable",onClick:()=>(async()=>{if(!y)return;const e=y;S(null),await(r.enableTransactionGuardrail?.(e))})()},denyButton:{label:"Cancel",onClick:()=>S(null),variant:W.Secondary}}),t(Ce,{isOpen:null!==x,onClose:()=>w(null),title:"Disable transaction guardrail",description:`Disable the allowed_transactions guardrail for ${x?.service??"this service"}? New operations will no longer create findings until the guardrail is enabled again.`,approveButton:{label:"Disable",onClick:()=>(async()=>{if(!x)return;const e=x;w(null),await(r.disableTransactionGuardrail?.(e))})()},denyButton:{label:"Cancel",onClick:()=>w(null),variant:W.Secondary}})]})},zS=(e,t)=>({title:e,titleSize:C.S,subTitle:t,subTitleWrap:!0,subTitleSize:C.XXXS,textGap:4}),LS=f.div`
|
|
1305
|
+
`,aS=({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(tS,{children:e(iS,{children:[e(T,{$justifyContent:"space-between",children:[t(tl,{...i}),u&&t(il,{actions:u})]}),t(T,{$gap:22,children:n.map(e=>t(nl,{...e},e.title))}),h,!!a.length&&t(nS,{children:t(ui,{maxHeight:s,headerBackgroundColor:g.v2.colors.silver[800],variant:hi.Data,columns:a,rows:o,isLoading:p,getRowActions:l,withCheckboxes:c,noDataProps:d},r)})]})})},oS=(e,t)=>{switch(e){case"http.response.status_code":case"http.status_code":default:return t;case"rpc.grpc.status_code":return`gRPC ${t}`}},lS=({operationName:e,identityDimensions:t})=>{const i=e||"",n=t??[];return n.length?`${i} · ${n.map(e=>oS(e.key,e.value)).join(" · ")}`:i},rS=e=>{const t=e.indexOf("\t"),i=t>=0?e.slice(0,t):"",n=t>=0?e.slice(t+1):e,{operationName:a,identityDimensions:o}=sS(n),l=lS({operationName:a,identityDimensions:o});return i?`${i} ${l}`:l},sS=e=>{const t=e.indexOf(" [");if(t<0)return{operationName:e,identityDimensions:[]};const i=e.slice(0,t),n=[];let a=e.slice(t+1);for(;a.startsWith("[");){const e=a.indexOf("="),t=a.indexOf("]");if(e<0||t<0||e>t)break;n.push({key:a.slice(1,e),value:a.slice(e+1,t)}),a=a.slice(t+1)}return{operationName:i,identityDimensions:n}},cS=e=>{const t=`${e.namespace}/${e.service}`,i=lS(e);return i?`${t} · ${i}`:t},dS=({operationName:i,identityDimensions:n,tagVariant:a=Mt.Blue,fallback:o="-"})=>{const l=n??[];return e(T,{$gap:6,$alignItems:"center",children:[t(It,{label:i||o,variant:a}),l.map(e=>t(ce,{text:e.key,children:t(It,{label:oS(e.key,e.value)})},`${e.key}=${e.value}`))]})};var pS;(e=>{e.Title="title",e.TransactionId="transactionId",e.LastSeen="lastSeen",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"})(pS||(pS={}));const uS=e=>e.kind===ll.Anomaly?["anomaly",e.transactionId??"",e.signature??""].join("\0"):["violation",e.scopeKey??"",e.ruleKey??"",e.offending??""].join("\0"),hS=(e,t)=>uS(e)===uS(t);var gS;(e=>{e.Dismiss="dismiss",e.Allow="allow"})(gS||(gS={}));const mS={[gS.Dismiss]:[al.Dismissed,ol.Dismissed],[gS.Allow]:[al.Allowed,ol.Baselined]},bS=(e,t)=>[{id:`${e.id}-investigate`,label:"Investigate",rightIcon:Ss,variant:K.Primary,onClick:()=>{if(!e.id)return;const i=e.cells.find(e=>e.key===pS.Kind)?.rawValue;t(i===ll.Anomaly?Yy.Anomaly:Yy.Violation,e.id)}}],fS=[{label:"Severity",key:pS.Severity},{label:"Namespace",key:pS.Namespace},{label:"Service",key:pS.Service,noFilter:!0},{label:"Finding",key:pS.Title,noFilter:!0},{label:"Type",key:pS.Kind},{label:"Matched traces",key:pS.Occurrences,noFilter:!0},{label:"Status",key:pS.Status},{label:"Last seen",key:pS.LastSeen,noFilter:!0}],vS=[{label:"Namespace",key:pS.Namespace},{label:"Service",key:pS.Service,noFilter:!0},{label:"Events",key:pS.Occurrences,noFilter:!0},{label:"Last seen",key:pS.LastSeen,noFilter:!0}],yS=e=>{const t={open:0,violations:0,anomalies:0,critical:0,high:0,medium:0,low:0};return e?.forEach(e=>{switch(e.status!==al.Open&&e.status!==ol.Open||(t.open+=1),e.kind===ll.Violation?t.violations+=1:e.kind===ll.Anomaly&&(t.anomalies+=1),e.severity){case rl.Critical:t.critical+=1;break;case rl.High:t.high+=1;break;case rl.Medium:t.medium+=1;break;case rl.Low:t.low+=1}}),t},SS=(e,t)=>({label:t,backgroundColor:(()=>{switch(t){case rl.Low:return e.v2.colors.purple[900];case rl.Medium:return e.v2.colors.yellow[550];case rl.High:return e.v2.colors.orange[500];case rl.Critical:return e.v2.colors.red[800];default:return}})(),textColor:(()=>{switch(t){case rl.Low:case rl.Critical:return e.v2.colors.white[500];case rl.Medium:case rl.High:return e.v2.colors.black[500];default:return}})()}),xS=(e,t)=>({label:t,backgroundColor:(()=>{switch(t){case al.Open:case ol.Open:return e.v2.colors.beige[600];case al.Allowed:case ol.Baselined:return e.v2.colors.green[500];case al.Dismissed:case ol.Dismissed:default:return e.v2.colors.silver[500]}})(),textColor:(()=>{switch(t){case al.Open:case ol.Open:case al.Allowed:case ol.Baselined:return e.v2.colors.black[500];case al.Dismissed:case ol.Dismissed:default:return e.v2.colors.white[500]}})()}),wS=(e,i,n,a,o,l)=>n?.slice(0,a||n.length).map(n=>({id:uS(n),isSelected:!!o?.find(e=>hS(e,n)),onSelect:()=>l?.(n,!0),onDeselect:()=>l?.(n,!1),cells:[{key:pS.Title,rawValue:n.kind===ll.Anomaly&&lS(n)||n.title,component:()=>n.kind===ll.Anomaly?t(dS,{operationName:n.operationName||n.title,identityDimensions:n.identityDimensions}):t(It,{label:n.title,variant:Mt.Blue})},{key:pS.TransactionId,rawValue:n.transactionId??"-"},{key:pS.LastSeen,rawValue:i(n.lastSeen,{style:"short"})},{key:pS.Namespace,rawValue:n.namespace},{key:pS.Service,rawValue:n.service},{key:pS.Kind,rawValue:n.kind,component:()=>t(E,{label:n.kind,backgroundColor:e.v2.colors.pink[1e3],textColor:e.v2.colors.pink[500]})},{key:pS.Status,rawValue:n.status,component:()=>t(E,{...xS(e,n.status)})},{key:pS.Score,rawValue:Number(n.score).toLocaleString()},{key:pS.Severity,rawValue:n.severity,component:()=>t(E,{...SS(e,n.severity)})},{key:pS.Occurrences,rawValue:Number(n.occurrences).toLocaleString()},{key:pS.Offending,rawValue:n.offending??"-"},{key:pS.Signature,rawValue:n.signature??"-"},{key:pS.RuleKey,rawValue:n.ruleKey??"-",component:n.ruleKey?()=>t(It,{label:n.ruleKey,variant:Mt.Blue}):void 0},{key:pS.ScopeKey,rawValue:n.scopeKey??"-",component:n.scopeKey?()=>t(It,{label:n.scopeKey,variant:Mt.Default}):void 0}]}))||[];var CS;(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"})(CS||(CS={}));const kS=(e,t,i,n)=>{const a=e.cells.find(e=>e.key===CS.TransactionId)?.rawValue,o="Promoted"===e.cells.find(e=>e.key===CS.Baseline)?.rawValue,l=[{id:`${e.id}-open-baseline`,label:"Open baseline",rightIcon:Ss,variant:K.Primary,onClick:()=>t(Yy.Transaction,a)}];return i&&l.push({id:`${e.id}-promote-baselines`,label:"Promote baselines",leftIcon:$s,variant:K.Secondary,disabled:o||!i.canPromote,onClick:()=>i.onPromote(a)}),n&&l.push({id:`${e.id}-delete`,label:"Delete",leftIcon:vs,variant:K.Secondary,disabled:!n.canDelete,onClick:()=>n.onDelete(a)}),l},TS=[{label:"Namespace",key:CS.Namespace},{label:"Service",key:CS.Service,noFilter:!0},{label:"Operation",key:CS.Operation,noFilter:!0},{label:"Kind",key:CS.Kind},{label:"Volume",key:CS.Volume,noFilter:!0},{label:"Baseline",key:CS.Baseline},{label:"Last seen",key:CS.LastSeen,noFilter:!0}],IS=[{label:"Namespace",key:CS.Namespace},{label:"Service",key:CS.Service,noFilter:!0},{label:"Baseline",key:CS.Baseline},{label:"Auto guardrail",key:CS.Guardrail},{label:"Transactions",key:CS.TransactionCount,noFilter:!0},{label:"Volume",key:CS.Volume,noFilter:!0}],$S=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}),NS=(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:CS.TransactionId,rawValue:n.id},{key:CS.LastSeen,rawValue:i(n.lastSeen,{style:"short"})},{key:CS.Namespace,rawValue:n.namespace},{key:CS.Service,rawValue:n.service},{key:CS.Kind,rawValue:n.kind,component:()=>t(E,{label:n.kind,backgroundColor:e.v2.colors.blue[900]})},{key:CS.Operation,rawValue:lS(n),component:()=>t(dS,{operationName:n.operationName,identityDimensions:n.identityDimensions})},{key:CS.Baseline,rawValue:n.promoted?"Promoted":"Learning",component:()=>n.promoted?t(E,{label:"Promoted",leftIcon:Ds,status:ie.Success,textSize:C.XXXS}):t(E,{label:"Learning",backgroundColor:e.v2.colors.beige[600],textColor:e.v2.colors.black[500],textSize:C.XXXS})},{key:CS.Volume,rawValue:Number(n.volume).toLocaleString()}]}))||[],AS=({setSelectedTab:i})=>{const n=v(),{openDrawer:o}=eS(),{formatDurationAgo:r}=Nt(),{insightsApi:s}=Lc(),[c,d]=l(dl),{data:p,loading:u,refetch:h}=s.useFindings({windowHours:c}),{data:g,loading:m,refetch:b}=s.useTransactions(),f=a(()=>yS(p),[p]),y=a(()=>wS(n,r,p,5),[p,n,r]),S=a(()=>$S(g),[g]),x=a(()=>NS(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(j,{variant:K.Text,size:W.S,leftIcon:Hs,label:"Refresh",onClick:()=>{h(),b()},disabled:u||m})]}),e($,{$gap:24,children:[t(aS,{tableMaxHeight:"380px",richTitle:{title:"Top 5 Findings",titleSize:C.M,icon:xc,badge:{label:p?.length||0}},textCards:[{bgTint:"900",title:"Open findings",cells:[{value:f.open.toLocaleString()}]},{bgTint:"900",title:"Critical / High",cells:[{value:(f.critical+f.high).toLocaleString()}]},{bgTint:"900",title:"Policy violations",cells:[{value:f.violations.toLocaleString()}]},{bgTint:"900",title:"Anomalies",cells:[{value:f.anomalies.toLocaleString()}]}],tableColumns:fS,tableRows:y,isLoading:u,actions:[{id:"search-by-time",type:Ft.PopupButton,buttonProps:ul(c),popupProps:{children:({close:e})=>t(pl,{defaultValue:c,onApply:d,onClose:e})}},{id:"view-all",type:Ft.Button,buttonProps:{label:"View all",rightIcon:Ss,variant:K.Secondary,size:W.S,onClick:()=>i(Ky.Findings)}}],getRowActions:e=>bS(e,o)}),t(aS,{tableMaxHeight:"380px",richTitle:{title:"Top 5 Transactions",titleSize:C.M,icon:wc,badge:{label:g?.length||0}},textCards:[{bgTint:"900",title:"Transactions",cells:[{value:S.total.toLocaleString()}]},{bgTint:"900",title:"Services",cells:[{value:S.services.toLocaleString()}]},{bgTint:"900",title:"Volume",cells:[{value:S.volume.toLocaleString()}]},{bgTint:"900",title:"Baseline Promoted",cells:[{value:((S.promoted||0)/(S.total||1)*100).toFixed(1)+"%"}]}],tableColumns:TS,tableRows:x,isLoading:m,actions:[{id:"view-all",type:Ft.Button,buttonProps:{label:"View all",rightIcon:Ss,variant:K.Secondary,size:W.S,onClick:()=>i(Ky.Transactions)}}],getRowActions:e=>kS(e,o)})]})]})},OS={[gS.Dismiss]:{label:"Dismiss",title:e=>`Dismiss selected findings (${e})`,description:"Are you sure you want to dismiss the selected findings?"},[gS.Allow]:{label:"Allow",title:e=>`Allow selected findings (${e})`,description:"Are you sure you want to allow the selected findings?"}},ES=({actionType:i,selectedFindings:n,onDone:o,buttonProps:s})=>{const[c,d]=l(!1),[p,u]=l(!1),h=()=>u(!1),{insightsApi:g}=Lc(),m=OS[i],b=a(()=>{return!n.length||(t=i,(e=n).length>0&&e.every(e=>((e,t)=>mS[t].includes(e.status))(e,t)));var e,t},[n,i]);return e(r,{children:[t(j,{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===ll.Anomaly&&e.transactionId&&e.signature),a=t.filter(e=>e.kind===ll.Violation),o=[],l=i===gS.Allow;if(n.length){const t=n.map(e=>({transactionId:e.transactionId,signature:e.signature}));if(e.bulkResolveAnomalies)o.push(e.bulkResolveAnomalies(l?sl.Accept:sl.Dismiss,t));else{const i=l?cl.Accept:cl.Dismiss;o.push(...t.map(t=>e.resolveAnomaly?.({...t,resolution:i})))}}if(a.length){const t=l?e.allowViolation: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 DS;(e=>{e.All="all",e.GroupByService="groupByService"})(DS||(DS={}));const RS=[{label:"All findings",value:DS.All},{label:"Group by service",value:DS.GroupByService}];var zS;(e=>{e.Open="open",e.Dismissed="dismissed",e.Allowed="allowed"})(zS||(zS={}));const XS=[{label:"Open",value:zS.Open},{label:"Dismissed",value:zS.Dismissed},{label:"Allowed",value:zS.Allowed}],PS=()=>{const i=v(),{openDrawer:n}=eS(),{formatDurationAgo:o}=Nt(),{insightsApi:r}=Lc(),[s,c]=l(dl),{data:p,loading:u,refetch:h}=r.useFindings({windowHours:s}),[g,m]=l([]),b=d((e,t)=>{m(i=>t?-1===i.findIndex(t=>hS(t,e))?[...i,e]:i:i.filter(t=>!hS(t,e)))},[]),[f,y]=l(""),[S,x]=l(DS.All),[w,k]=l(zS.Open),{openFindings:I,dismissedFindings:$,allowedFindings:A}=a(()=>{const e=[],t=[],i=[];return p?.forEach(n=>{[al.Open,ol.Open].includes(n.status)&&e.push(n),[al.Dismissed,ol.Dismissed].includes(n.status)&&t.push(n),[al.Allowed,ol.Baselined].includes(n.status)&&i.push(n)}),{openFindings:e,dismissedFindings:t,allowedFindings:i}},[p]),O=a(()=>w===zS.Open?I:w===zS.Dismissed?$:w===zS.Allowed?A:[],[w,I,$,A]),E=a(()=>f?O?.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))}):O,[O,f]),D=a(()=>yS(O),[O]),R=a(()=>{if(S===DS.GroupByService){const e=[];return E?.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:pS.Namespace,rawValue:a.namespace},{key:pS.Service,rawValue:a.service},{key:pS.Occurrences,rawValue:Number(a.occurrences).toLocaleString()},{key:pS.LastSeen,rawValue:new Date(a.lastSeen).toLocaleString()}],expandedContent:({maxHeight:r})=>t(ui,{fitContent:!0,variant:hi.DataSecondary,maxHeight:r,columns:fS,rows:wS(e,i,a.findings,void 0,o,l),getRowActions:e=>bS(e,n),withCheckboxes:!0})})))(i,o,n,e,g,b)}return wS(i,o,E,void 0,g,b)},[i,E,S,o,n,g,b]);return t(aS,{richTitle:{title:"Findings",titleSize:C.M,icon:xc,badge:{label:O?.length||0},children:t(N,{$padding:"0 0 0 32px",children:t(F,{options:XS,selected:w,setSelected:k,size:rt.L})})},textCards:[{bgTint:"900",title:(w===zS.Open?"Open":w===zS.Dismissed?"Dismissed":"Allowed")+" findings",cells:[{value:D.open.toLocaleString()}]},{bgTint:"900",title:"Critical / High",cells:[{value:(D.critical+D.high).toLocaleString()}]},{bgTint:"900",title:"Policy violations",cells:[{value:D.violations.toLocaleString()}]},{bgTint:"900",title:"Anomalies",cells:[{value:D.anomalies.toLocaleString()}]}],tableKey:S,tableColumns:S===DS.GroupByService?vS:fS,tableRows:R,tableWithCheckboxes:S===DS.All,tableNoDataProps:{icon:xc,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:Ft.PopupButton,buttonProps:ul(s),popupProps:{children:({close:e})=>t(pl,{defaultValue:s,onApply:c,onClose:e})}},{id:"refresh",type:Ft.Button,buttonProps:{label:"Refresh",leftIcon:Hs,variant:K.Secondary,size:W.S,disabled:u,onClick:()=>h()}}],getRowActions:S===DS.All?e=>bS(e,n):void 0,children:e(T,{$width:"100%",$gap:24,$justifyContent:"space-between",children:[e(T,{$gap:12,children:[t(tl,{title:"Findings list",titleSize:C.S,badge:{label:E?.length||0}}),t(Bt,{width:"400px",value:f,onChange:y}),t(F,{options:RS,selected:S,setSelected:x,size:rt.L})]}),e(T,{$gap:12,children:[t(ES,{actionType:gS.Dismiss,selectedFindings:g,onDone:()=>{m([]),h()},buttonProps:{label:"Dismiss selection"}}),t(ES,{actionType:gS.Allow,selectedFindings:g,onDone:()=>{m([]),h()},buttonProps:{label:"Allow selection",variant:K.Primary}})]})]})})};var LS;(e=>{e.All="all",e.GroupByService="groupByService"})(LS||(LS={}));const MS=[{label:"All transactions",value:LS.All},{label:"Group by service",value:LS.GroupByService}],_S=()=>{const i=v(),{openDrawer:n}=eS(),{formatDurationAgo:o}=Nt(),{insightsApi:r}=Lc(),{data:s,loading:c,refetch:p}=r.useTransactions(),{data:u}=r.useGuardrails(),[h,g]=l(""),[m,b]=l(LS.GroupByService),[f,y]=l([]),[S,x]=l(null),[w,k]=l(null),[I,$]=l(!1),[N,A]=l(!1),[O,D]=l(null),[R,z]=l(null),[X,P]=l(null),L=d((e,t)=>{y(i=>t?i.includes(e)?i:[...i,e]:i.filter(t=>t!==e))},[]),M=a(()=>({selectedIds:f,toggleSelection:L}),[f,L]),_=a(()=>({onPromote:x,canPromote:!!r.promoteTransactionBaselines}),[r.promoteTransactionBaselines]),B=a(()=>({onDelete:k,canDelete:!!r.deleteTransaction}),[r.deleteTransaction]),U=a(()=>{const e=new Set;return u?.forEach(t=>{t.rules.some(e=>"allowed_transactions"===e.key&&e.mode===hl.Enforce)&&e.add(t.scopeKey)}),e},[u]),V=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(()=>$S(s),[s]),H=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===LS.GroupByService){const e=[];return V?.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:CS.Namespace,rawValue:a.namespace},{key:CS.Service,rawValue:a.service},{key:CS.Baseline,rawValue:p?"Promoted":"Learning",component:()=>t(E,p?{label:`${d}/${c} Promoted`,rightIcon:Ds,status:ie.Success,textSize:C.XXXS}:{label:`${d}/${c} Learning`,backgroundColor:e.v2.colors.beige[600],textColor:e.v2.colors.black[500],textSize:C.XXXS})},{key:CS.Guardrail,rawValue:h?"Enabled":"Disabled",component:()=>t(E,h?{label:"Enabled",leftIcon:Ds,status:ie.Success,invertColors:!0,textSize:C.XXXS}:{label:"Disabled",leftIcon:Rs,status:ie.Disabled,invertColors:!0,textSize:C.XXXS})},{key:CS.TransactionCount,rawValue:a.transactions.length.toLocaleString()},{key:CS.Volume,rawValue:a.volume.toLocaleString()}],expandedContent:({maxHeight:o})=>t(ui,{fitContent:!0,variant:hi.DataSecondary,maxHeight:o,columns:TS,rows:NS(e,i,a.transactions,void 0,l),getRowActions:e=>kS(e,n,r,s),withCheckboxes:!!l})}}))(i,o,n,e,U,M,_,B)}return NS(i,o,V,void 0,M)},[i,V,m,o,n,U,M,_,B]);return e(aS,{richTitle:{title:"Transactions",titleSize:C.M,icon:wc,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===LS.GroupByService?IS:TS,tableRows:Y,tableWithCheckboxes:m===LS.All,tableNoDataProps:{icon:wc,title:h?"No matched transactions":"No transactions found",subTitle:h?`No transactions matched your search criteria: ${h}`:""},isLoading:c,actions:[{id:"refresh",type:Ft.Button,buttonProps:{label:"Refresh",leftIcon:Hs,variant:K.Secondary,size:W.S,disabled:c,onClick:()=>p()}}],getRowActions:e=>{if(m===LS.All)return kS(e,n,_,B);const t=e.cells.find(e=>e.key===CS.Namespace)?.rawValue,i=e.cells.find(e=>e.key===CS.Service)?.rawValue,a="Promoted"===e.cells.find(e=>e.key===CS.Baseline)?.rawValue,o=U.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:Cc,variant:K.Secondary,disabled:!r.disableTransactionGuardrail,onClick:()=>P(l)}):s.push({id:`${e.id}-enable-txn-guardrail`,label:"Enable transaction guardrail",leftIcon:Cc,variant:K.Primary,disabled:!r.enableTransactionGuardrail,onClick:()=>z(l)}),s.push({id:`${e.id}-promote-service`,label:"Promote service",leftIcon:$s,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(tl,{title:"Transactions list",titleSize:C.S,badge:{label:V?.length||0}}),t(Bt,{width:"400px",value:h,onChange:g}),t(F,{options:MS,selected:m,setSelected:b,size:rt.L})]}),e(T,{$gap:12,children:[t(j,{label:"Delete selection",leftIcon:vs,variant:K.Secondary,disabled:!f.length||!r.bulkDeleteTransactions,onClick:()=>A(!0)}),t(j,{label:"Promote selection",leftIcon:$s,variant:K.Primary,disabled:!H.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 (${H.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=H;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!==R,onClose:()=>z(null),title:"Enable transaction guardrail",description:`Create an allowed_transactions guardrail for ${R?.service??"this service"} from its current operations? New operations will become findings.`,approveButton:{label:"Enable",onClick:()=>(async()=>{if(!R)return;const e=R;z(null),await(r.enableTransactionGuardrail?.(e))})()},denyButton:{label:"Cancel",onClick:()=>z(null),variant:K.Secondary}}),t(Ce,{isOpen:null!==X,onClose:()=>P(null),title:"Disable transaction guardrail",description:`Disable the allowed_transactions guardrail for ${X?.service??"this service"}? New operations will no longer create findings until the guardrail is enabled again.`,approveButton:{label:"Disable",onClick:()=>(async()=>{if(!X)return;const e=X;P(null),await(r.disableTransactionGuardrail?.(e))})()},denyButton:{label:"Cancel",onClick:()=>P(null),variant:K.Secondary}})]})},FS=(e,t)=>({title:e,titleSize:C.S,subTitle:t,subTitleWrap:!0,subTitleSize:C.XXXS,textGap:4}),BS=f.div`
|
|
1306
1306
|
display: flex;
|
|
1307
1307
|
flex-direction: column;
|
|
1308
1308
|
gap: 8px;
|
|
@@ -1310,40 +1310,102 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
1310
1310
|
border-radius: 12px;
|
|
1311
1311
|
border-left: 2px solid ${({theme:e})=>e.v2.colors.red[500]};
|
|
1312
1312
|
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
1313
|
-
`,
|
|
1313
|
+
`,US=({classFindings:i})=>{const n=v();return i?.length?t(r,{children:i?.map((i,a)=>e(BS,{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},VS=["server.address","net.peer.name","net.host.name","http.host","url.full","http.url","db.system","db.name"],GS=(e,t)=>e.attrs?.find(e=>e?.key===t)?.value??"",HS=e=>{for(const t of VS){const i=GS(e,t);if(i)return i}return""},jS=e=>`${e.depth??0}::${e.name??""}::${HS(e)}`,WS=(e,t)=>{const i=HS(e),n=HS(t);return!(!i||!n||i===n)||(e.name??"")!==(t.name??"")},KS=e=>null==e||Number.isNaN(e)?null:gl(1e6*Math.max(0,e)),YS=e=>(e.attrs??[]).filter(e=>!!e?.key).map(e=>({key:e.key??null,value:e.value??null})),qS=()=>({placeholder:!0}),JS=(e,t,i,n)=>({id:t,index:i,service:e.service??null,name:e.name??null,durationLabel:KS(e.durationMs),depth:e.depth??0,scope:e.scope??null,attributes:YS(e),variant:"default",...n}),ZS=(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--)jS(e[o])===jS(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;)jS(e[l])===jS(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(qS()),c+=1):(r.push(qS()),s.push(n[d]),d+=1);for(;c<a;)r.push(i[c]),s.push(qS()),c+=1;for(;d<o;)r.push(qS()),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(WS(t,a)){s+=1,c+=1;const i=`baseline-only-${e.baselineIdx}`;h(JS(t,i,s),JS(t,i,c)),d+=1,c+=1,u+=1;const n=`new-${e.observedIdx}`;l.push({id:`placeholder-${u}`,variant:"placeholder",depth:a.depth??0,badge:{icon:ys}}),r.push(JS(a,n,c,{variant:"new",badge:{label:"New",tone:"danger",icon:ys}}));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(JS(t,i,s,{variant:"timing"}),JS(a,i,c,{variant:"timing",badge:{label:`${e}x Slower`,tone:"warning",icon:mc}}))}else h(JS(t,i,s),JS(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:ys}}),r.push(JS(a,t,c,{variant:"new",badge:{label:"New",tone:"danger",icon:ys}}));continue}if(t&&!a){s+=1,c+=1;const i=`baseline-only-${e.baselineIdx}`;h(JS(t,i,s),JS(t,i,c))}}const g=n.find(e=>0===(e.depth??0))??n[0],m=KS(g?.durationMs??null);return{baselineRows:l,observedRows:r,newSpanCount:d,timingChangeCount:p,observedDurationLabel:m,error:a}},QS=f(T)`
|
|
1314
1314
|
width: 100%;
|
|
1315
1315
|
min-width: 0;
|
|
1316
1316
|
align-items: flex-start;
|
|
1317
|
-
`,
|
|
1317
|
+
`,ex=f.div`
|
|
1318
1318
|
flex: 1;
|
|
1319
1319
|
min-width: 0;
|
|
1320
|
-
`,KS=e=>{let t=0;return e.scope&&(t+=1),t+=e.attributes?.filter(e=>!!e?.key).length??0,t},WS=(e,t)=>({id:e,variant:"placeholder",depth:t,badge:{icon:ys}}),YS=({baselineTrace:i,anomalyTrace:n})=>{const o=a(()=>((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--)FS(e[o])===FS(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;)FS(e[l])===FS(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;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(BS(t,a)){s+=1,c+=1;const i=`baseline-only-${e.baselineIdx}`;l.push(GS(t,i,s)),r.push(GS(t,i,c)),d+=1,c+=1,u+=1;const n=`new-${e.observedIdx}`;l.push({id:`placeholder-${u}`,variant:"placeholder",depth:a.depth??0,badge:{icon:ys}}),r.push(GS(a,n,c,{variant:"new",badge:{label:"New",tone:"danger",icon:ys}}));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));l.push(GS(t,i,s,{variant:"timing"})),r.push(GS(a,i,c,{variant:"timing",badge:{label:`${e}x Slower`,tone:"warning",icon:mc}}))}else l.push(GS(t,i,s)),r.push(GS(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:ys}}),r.push(GS(a,t,c,{variant:"new",badge:{label:"New",tone:"danger",icon:ys}}));continue}if(t&&!a){s+=1,c+=1;const i=`baseline-only-${e.baselineIdx}`;l.push(GS(t,i,s)),r.push(GS(t,i,c))}}const h=n.find(e=>0===(e.depth??0))??n[0];return{baselineRows:l,observedRows:r,newSpanCount:d,timingChangeCount:p,observedDurationLabel:US(h?.durationMs??null),error:a}})(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&&"placeholder"!==o.variant&&i.has(o.id),c=!!r&&"placeholder"!==r.variant&&i.has(r.id),d=s?KS(o):0,p=c?KS(r):0,u=Math.max(d,p),h=r?.depth??o?.depth??0;for(let e=0;e<u-d;e++)n.push(WS(`expand-filler-baseline-${r?.id??o?.id}-${l}-${e}`,h));for(let e=0;e<u-p;e++)a.push(WS(`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(HS,{children:[t(jS,{children:o.baselineRows.length?t(ml,{title:"Baseline trace",titleIcon:$s,headerBadge:{label:"Baseline",tone:"success"},meta:h,rows:p.baseline,expandedRowIds:r,onToggleRow:u,corner:"left"}):t(Me,{children:t(Z,{title:"No trace available",subTitle:o.error?`Unable to compare traces: ${o.error}`:"No baseline spans available"})})}),t(jS,{children:o.observedRows.length?t(ml,{title:"Observed trace",titleIcon:mc,headerBadge:{label:"Flagged",tone:"danger"},meta:g,rows:p.observed,expandedRowIds:r,onToggleRow:u,corner:"right"}):t(Me,{children:t(Z,{title:"No trace available",subTitle:o.error?`Unable to compare traces: ${o.error}`:"No observed spans available"})})})]})},JS=(e,t,i)=>t?[{id:"severity",title:"Severity",badge:gS(e,t.severity)},{id:"status",title:"Status",badge:mS(e,t.status)},{id:"operation",title:"Operation",tag:{label:t.operation||"-"}},{id:"spacer",spacer:!0},{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"}):"-"}]:[],qS=[{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."}],ZS=({finding:i,onClose:n})=>{const o=v(),{formatDurationAgo:l}=At(),{insightsApi:s}=Pc(),c=i.transactionId||"",d=i.signature||"",p=!!c&&!!d,{data:u,loading:h}=s.useAnomaly({transactionId:c,signature:d},{skip:!p}),g=a(()=>bl(u?.anomalyTrace?.rawOtlp),[u?.anomalyTrace?.rawOtlp]),m=a(()=>bl(u?.baselineTrace?.rawOtlp),[u?.baselineTrace?.rawOtlp]),{data:b,loading:f}=s.useBlastRadius({namespace:i.namespace,service:i.service},{skip:!i.namespace||!i.service}),{formData:y,handleFormChange:S}=St({responseOnNextMatch:""});return e(mt,{bgTint:"1000",moreSpacing:!0,children:[t(mt,{bgTint:"900",moreSpacing:!0,richTitle:{icon:xc,title:i?.title},renderOnRightSide:e(r,{children:[t(TS,{actionType:sS.Dismiss,selectedFindings:[i],onDone:n,buttonProps:{size:K.S}}),t(TS,{actionType:sS.Allow,selectedFindings:[i],onDone:n,buttonProps:{label:"Allow (Add to baseline)",variant:W.Primary,size:K.S}})]}),items:JS(o,u||null,l)}),t(mt,{bgTint:"900",richTitle:{title:"Why this fired",icon:Ys},withCollapse:!0,children:t(XS,{classFindings:u?.classFindings})}),t(mt,{bgTint:"900",richTitle:zS("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(Me,{children:t(Ve,{withSpinner:!0})}):t(YS,{baselineTrace:m,anomalyTrace:g})}),t(mt,{bgTint:"900",richTitle:zS("Blast Radius","Services and resources touched by traces matching this anomaly."),withCollapse:!0,collapseIsDefaultOpen:!0,children:f&&!b?t(Me,{children:t(Ve,{withSpinner:!0})}):t(Ad,{blastRadius:b})}),t(mt,{bgTint:"900",richTitle:{...zS("Response on next match","This action will be applied only when a future trace matches this anomaly pattern again."),badge:{label:"Coming soon",tooltip:"We are working on this feature and it will be available soon.",backgroundColor:o.v2.colors.pink[500],textColor:o.v2.colors.black[500]}},actions:[{id:"apply",type:Ft.Button,buttonProps:{label:"Apply on next match",rightIcon:Ss,variant:W.Primary,size:K.S,disabled:!0,onClick:()=>{}}}],withCollapse:!0,children:t(T,{$gap:16,children:t(QS,{options:qS,selectedId:y.responseOnNextMatch,setSelectedId:e=>S("responseOnNextMatch",e)})})})]})},QS=({options:i,selectedId:n,setSelectedId:a})=>i.map(i=>{const o=n===i.id,l=()=>a(i.id);return t(mt,{bgTint:"800",moreSpacing:!0,onClick:l,clickStylesRemainActive:o,children:e(T,{$gap:16,children:[t(V,{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)}),ex=f(T)`
|
|
1320
|
+
`,tx=e=>{let t=0;return(e.scope||e.scopePlaceholder)&&(t+=1),t+=e.attributes?.filter(e=>!!e?.key||!!e?.placeholder).length??0,t},ix=(e,t)=>({id:e,variant:"placeholder",depth:t,badge:{icon:ys}}),nx=({baselineTrace:i,anomalyTrace:n})=>{const o=a(()=>ZS(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&&"placeholder"!==o.variant&&i.has(o.id),c=!!r&&"placeholder"!==r.variant&&i.has(r.id),d=s?tx(o):0,p=c?tx(r):0,u=Math.max(d,p),h=r?.depth??o?.depth??0;for(let e=0;e<u-d;e++)n.push(ix(`expand-filler-baseline-${r?.id??o?.id}-${l}-${e}`,h));for(let e=0;e<u-p;e++)a.push(ix(`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(QS,{children:[t(ex,{children:o.baselineRows.length?t(ml,{title:"Baseline trace",titleIcon:$s,headerBadge:{label:"Baseline",tone:"success"},meta:h,rows:p.baseline,expandedRowIds:r,onToggleRow:u,corner:"left"}):t(Me,{children:t(Z,{title:"No trace available",subTitle:o.error?`Unable to compare traces: ${o.error}`:"No baseline spans available"})})}),t(ex,{children:o.observedRows.length?t(ml,{title:"Observed trace",titleIcon:mc,headerBadge:{label:"Flagged",tone:"danger"},meta:g,rows:p.observed,expandedRowIds:r,onToggleRow:u,corner:"right"}):t(Me,{children:t(Z,{title:"No trace available",subTitle:o.error?`Unable to compare traces: ${o.error}`:"No observed spans available"})})})]})},ax=e=>e.split("_").filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "),ox=(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}},lx=(e,t,i=[])=>{const n=t?.categories.find(t=>t.id===e);if(n)return{label:n.label||ax(e),mitre:n.mitre,owasp:n.owasp};const a=t?.deviationClasses.find(t=>t.category===e);if(a)return{label:a.categoryLabel||ax(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:ax(e),mitre:o?.mitre,owasp:o?.owasp}},rx={deviationClasses:[{id:bl.D1_call_edges,label:"New call edge",description:"A service→service call path not seen during learning.",baselineLabel:"Service call edges",baselineDescription:"Learned set of service→service call paths for this transaction.",category:"lateral_movement",categoryLabel:"Lateral movement",weight:20,mitre:"TA0008",owasp:null},{id:bl.D2_egress,label:"New egress destination",description:"An outbound destination (host/port) not seen during learning.",baselineLabel:"Outbound peers",baselineDescription:"Learned set of external destinations (host:port) this transaction reaches.",category:"exfiltration",categoryLabel:"Exfiltration",weight:35,mitre:"TA0010",owasp:null},{id:bl.D3_latency,label:"Latency above baseline",description:"Request latency well above the learned p99.",baselineLabel:"Request latency",baselineDescription:"Learned latency distribution for this transaction's entry request (e.g. p99).",category:"resource_abuse",categoryLabel:"Resource abuse",weight:10,mitre:"T1499",owasp:null},{id:bl.D4_args_returns,label:"Argument / return anomaly",description:"Arguments or return values outside the learned shape.",baselineLabel:"Args & returns",baselineDescription:"Learned shape of captured arguments and return values.",category:"injection",categoryLabel:"Injection",weight:40,mitre:"T1190",owasp:"A03"},{id:bl.D5_libraries,label:"New instrumentation library",description:"An instrumentation library/runtime not seen during learning.",baselineLabel:"Libraries",baselineDescription:"Learned set of instrumentation libraries and runtimes seen on this transaction.",category:"supply_chain",categoryLabel:"Supply chain",weight:30,mitre:"T1195",owasp:"A06"},{id:bl.D6_attr_relations,label:"Attribute-relation anomaly",description:"Span attribute relationships outside the learned pattern.",baselineLabel:"Attribute relations",baselineDescription:"Learned relationships between span attributes for this transaction.",category:"access_anomaly",categoryLabel:"Access anomaly",weight:35,mitre:"TA0004",owasp:"A01"},{id:bl.D7_db_access,label:"New database access",description:"A database table/operation not accessed during learning.",baselineLabel:"Database access",baselineDescription:"Learned set of database systems, tables, and operations touched.",category:"lateral_movement",categoryLabel:"Lateral movement",weight:25,mitre:"TA0008",owasp:null},{id:bl.D8_payload_size,label:"Payload size above baseline",description:"Request/response payload larger than the learned baseline.",baselineLabel:"Payload size",baselineDescription:"Learned request/response body-size distribution for this transaction.",category:"resource_abuse",categoryLabel:"Resource abuse",weight:20,mitre:"T1499",owasp:null}],enrichers:[{source:"d1_edge_fanout",parentClass:bl.D1_call_edges,category:"lateral_movement",weight:30,label:"Call fan-out",description:"One request reached many new services at once — possible lateral movement / enumeration."},{source:"d2_metadata_endpoint",parentClass:bl.D2_egress,category:"exfiltration",weight:50,label:"Cloud metadata endpoint",description:"New egress to a cloud metadata address (e.g. 169.254.169.254) — a hallmark of SSRF / credential theft.",list:{key:"metadata_endpoints",label:"Cloud metadata addresses",hint:"Comma- or newline-separated hosts/IPs. A new egress to any of these is flagged.",default:["169.254.169.254","fd00:ec2::254","metadata.google.internal","100.100.100.200"]}},{source:"d2_dangerous_port",parentClass:bl.D2_egress,category:"exfiltration",weight:45,label:"Suspicious egress port",description:"New egress on a port commonly used by reverse shells, C2, or tunneling (e.g. 4444, 1337).",list:{key:"dangerous_ports",label:"Suspicious ports",hint:"Comma- or newline-separated port numbers. New egress to any of these is flagged.",default:["23","1080","1337","2323","4444","6667","6697","9050","12345","31337"]}},{source:"d7_destructive_op",parentClass:bl.D7_db_access,category:"impact",weight:45,label:"Destructive operation",description:"New DELETE/DROP/TRUNCATE/ALTER/UPDATE not seen during learning."},{source:"d7_sensitive_table",parentClass:bl.D7_db_access,category:"exfiltration",weight:30,label:"Sensitive table access",description:"New access to a table whose name looks sensitive (credentials, payment, token…).",list:{key:"sensitive_tables",label:"Sensitive keywords",hint:"Comma- or newline-separated substrings. A newly-accessed table whose name contains any of these is flagged.",default:["credential","password","passwd","secret","token","apikey","api_key","payment","card","ssn","account","auth","session","admins","users"]}},{source:"d7_injection_shape",parentClass:bl.D7_db_access,category:"injection",weight:35,label:"Multi-table / join shape",description:"A new query joining several tables — a classic injection / data-harvesting shape."},{source:"d7_schema_recon",parentClass:bl.D7_db_access,category:"injection",weight:30,label:"Database schema recon",description:"New access to a DB system-catalog / metadata table (e.g. information_schema) — classic SQL-injection enumeration.",list:{key:"schema_catalog_tables",label:"Schema-catalog tables",hint:"Comma- or newline-separated names/substrings. A newly-accessed table matching any is flagged as schema reconnaissance.",default:["information_schema","pg_catalog","pg_class","pg_tables","pg_attribute","pg_shadow","pg_user","mysql.user","mysql.db","sqlite_master","sys.tables","sys.columns","sys.databases","all_tables","dba_tables","user_tables"]}},{source:"d8_response_exfil",parentClass:bl.D8_payload_size,category:"exfiltration",weight:40,label:"Oversized response (bulk data)",description:"Response body far larger than the learned baseline — possible bulk data extraction."}],categories:[{id:"impact",label:"Impact",base:45,mitre:"TA0040",owasp:null},{id:"injection",label:"Injection",base:40,mitre:"T1190",owasp:"A03"},{id:"exfiltration",label:"Exfiltration",base:35,mitre:"TA0010",owasp:null},{id:"access_anomaly",label:"Access anomaly",base:35,mitre:"TA0004",owasp:"A01"},{id:"supply_chain",label:"Supply chain",base:30,mitre:"T1195",owasp:"A06"},{id:"lateral_movement",label:"Lateral movement",base:25,mitre:"TA0008",owasp:null},{id:"recon",label:"Recon",base:15,mitre:"TA0043",owasp:null},{id:"resource_abuse",label:"Resource abuse",base:10,mitre:"T1499",owasp:null}],guardrailRules:[{key:"allowed_callers",label:"Allowed callers",description:"Restrict which services may call this service",category:"lateral_movement",weight:25,hint:"namespace/service"}],severityBands:[{severity:rl.Info,minScore:0},{severity:rl.Low,minScore:20},{severity:rl.Medium,minScore:35},{severity:rl.High,minScore:50},{severity:rl.Critical,minScore:75}],correlationBonus:15,tags:JSON.stringify({T1190:"Exploit Public-Facing Application",T1195:"Supply Chain Compromise",T1499:"Endpoint Denial of Service",TA0004:"Privilege Escalation (tactic)",TA0008:"Lateral Movement (tactic)",TA0010:"Exfiltration (tactic)",TA0040:"Impact (tactic)",TA0043:"Reconnaissance (tactic)",A01:"Broken Access Control",A03:"Injection",A06:"Vulnerable and Outdated Components"})};var sx;(e=>{e.Signal="signal",e.Category="category",e.Weight="weight",e.Confidence="confidence",e.Contribution="contribution"})(sx||(sx={}));const cx=[{key:sx.Signal,label:"Signal",flex:2.2},{key:sx.Category,label:"Category (MITRE/OWASP)",flex:1.4},{key:sx.Weight,label:"Weight",flex:.7},{key:sx.Confidence,label:"Confidence",flex:.8},{key:sx.Contribution,label:"Contribution",flex:.9}],dx=f.div`
|
|
1321
|
+
display: flex;
|
|
1322
|
+
flex-direction: column;
|
|
1323
|
+
width: 100%;
|
|
1324
|
+
border-radius: 12px;
|
|
1325
|
+
overflow: hidden;
|
|
1326
|
+
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
1327
|
+
`,px=f.div`
|
|
1328
|
+
display: grid;
|
|
1329
|
+
grid-template-columns: 2.2fr 1.4fr 0.7fr 0.8fr 0.9fr;
|
|
1330
|
+
width: 100%;
|
|
1331
|
+
align-items: stretch;
|
|
1332
|
+
`,ux=f.div`
|
|
1333
|
+
display: flex;
|
|
1334
|
+
align-items: center;
|
|
1335
|
+
min-height: 44px;
|
|
1336
|
+
padding: 0 12px;
|
|
1337
|
+
border-bottom: 1px solid ${({theme:e})=>e.v2.colors.silver[500]};
|
|
1338
|
+
`,hx=f.div`
|
|
1339
|
+
display: flex;
|
|
1340
|
+
align-items: center;
|
|
1341
|
+
gap: 8px;
|
|
1342
|
+
min-height: 40px;
|
|
1343
|
+
width: 100%;
|
|
1344
|
+
padding: 0 24px;
|
|
1345
|
+
border-left: 2px solid ${({theme:e})=>e.v2.colors.orange[500]};
|
|
1346
|
+
background-color: ${({theme:e})=>e.v2.colors.orange[1e3]};
|
|
1347
|
+
`,gx=f.div`
|
|
1348
|
+
display: flex;
|
|
1349
|
+
flex-direction: column;
|
|
1350
|
+
justify-content: center;
|
|
1351
|
+
align-items: ${({$align:e})=>"end"===e?"flex-end":"flex-start"};
|
|
1352
|
+
gap: 4px;
|
|
1353
|
+
min-height: 54px;
|
|
1354
|
+
padding: 8px 12px;
|
|
1355
|
+
border-bottom: 1px solid ${({theme:e})=>e.v2.colors.silver[500]};
|
|
1356
|
+
`,mx=f.div`
|
|
1357
|
+
display: flex;
|
|
1358
|
+
align-items: center;
|
|
1359
|
+
justify-content: space-between;
|
|
1360
|
+
gap: 16px;
|
|
1361
|
+
min-height: 56px;
|
|
1362
|
+
padding: 12px;
|
|
1363
|
+
border-top: 1px solid ${({theme:e})=>e.v2.colors.silver[500]};
|
|
1364
|
+
`,bx=f.div`
|
|
1365
|
+
display: flex;
|
|
1366
|
+
align-items: center;
|
|
1367
|
+
gap: 16px;
|
|
1368
|
+
flex: 1;
|
|
1369
|
+
min-width: 0;
|
|
1370
|
+
`,fx=f.div`
|
|
1371
|
+
position: relative;
|
|
1372
|
+
flex: 1;
|
|
1373
|
+
height: 8px;
|
|
1374
|
+
max-width: 280px;
|
|
1375
|
+
border-radius: 100px;
|
|
1376
|
+
overflow: hidden;
|
|
1377
|
+
background-color: ${({theme:e})=>e.v2.colors.grey[700]};
|
|
1378
|
+
`,vx=f.div`
|
|
1379
|
+
height: 100%;
|
|
1380
|
+
width: ${({$widthPct:e})=>`${Math.max(0,Math.min(100,e))}%`};
|
|
1381
|
+
background-color: ${({$color:e})=>e};
|
|
1382
|
+
`,yx=(e,t)=>e>=50?t.v2.colors.red[500]:e>=35?t.v2.colors.orange[500]:t.v2.colors.blue[500],Sx=({risk:i,catalog:n})=>{const o=v(),l=n?.deviationClasses?.length?n:rx,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=lx(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}=ox(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(dx,{children:[t(px,{children:cx.map(e=>t(ux,{children:t(w,{size:C.XS,color:k.Primary,children:e.label})},e.key))}),r.map(i=>e($,{$gap:0,$width:"100%",children:[e(hx,{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(px,{children:[e(gx,{children:[e(T,{$gap:4,$alignItems:"center",children:[t(w,{size:C.XS,color:k.Primary,children:n.name}),n.isEnricher?t(It,{label:"Enricher",variant:Mt.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(gx,{children:t(w,{size:C.XS,color:k.Primary,children:n.category})}),t(gx,{children:t(w,{size:C.XXS,color:k.Primary,children:n.weight})}),t(gx,{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(gx,{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(px,{children:[t(gx,{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(gx,{}),t(gx,{}),t(gx,{}),t(gx,{children:e(w,{size:C.XXS,color:k.Primary,children:["+",i.correlationBonus]})})]}):null,e(mx,{children:[e(bx,{children:[e(w,{size:C.S,color:k.Primary,children:["Total risk score ",i.score]}),t(fx,{children:t(vx,{$widthPct:i.score,$color:yx(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."})},xx=(e,t,i)=>t?[{id:"severity",title:"Severity",badge:SS(e,t.severity)},{id:"status",title:"Status",badge:xS(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:oS(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"}):"-"}]:[],wx=[{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."}],Cx=({finding:i,onClose:n})=>{const o=v(),{formatDurationAgo:l}=Nt(),{insightsApi:s}=Lc(),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(()=>fl(u?.anomalyTrace?.rawOtlp),[u?.anomalyTrace?.rawOtlp]),b=a(()=>fl(u?.baselineTrace?.rawOtlp),[u?.baselineTrace?.rawOtlp]),{data:f,loading:y}=s.useBlastRadius({namespace:i.namespace,service:i.service},{skip:!i.namespace||!i.service}),{formData:S,handleFormChange:x}=St({responseOnNextMatch:""});return e(mt,{bgTint:"1000",moreSpacing:!0,children:[t(mt,{bgTint:"900",moreSpacing:!0,richTitle:{icon:xc,title:i?.title},renderOnRightSide:e(r,{children:[t(ES,{actionType:gS.Dismiss,selectedFindings:[i],onDone:n,buttonProps:{size:W.S}}),t(ES,{actionType:gS.Allow,selectedFindings:[i],onDone:n,buttonProps:{label:"Allow (Add to baseline)",variant:K.Primary,size:W.S}})]}),items:xx(o,u||null,l)}),t(mt,{bgTint:"900",richTitle:{title:"Why this fired",icon:Ys},withCollapse:!0,children:t(US,{classFindings:u?.classFindings})}),t(mt,{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(Me,{children:t(Ve,{withSpinner:!0})}):t(Sx,{risk:u?.risk,catalog:g})}),t(mt,{bgTint:"900",richTitle:FS("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(Me,{children:t(Ve,{withSpinner:!0})}):t(nx,{baselineTrace:b,anomalyTrace:m})}),t(mt,{bgTint:"900",richTitle:FS("Blast Radius","Services and resources touched by traces matching this anomaly."),withCollapse:!0,collapseIsDefaultOpen:!0,children:y&&!f?t(Me,{children:t(Ve,{withSpinner:!0})}):t(Nd,{blastRadius:f})}),t(mt,{bgTint:"900",richTitle:{...FS("Response on next match","This action will be applied only when a future trace matches this anomaly pattern again."),badge:{label:"Coming soon",tooltip:"We are working on this feature and it will be available soon.",backgroundColor:o.v2.colors.pink[500],textColor:o.v2.colors.black[500]}},actions:[{id:"apply",type:Ft.Button,buttonProps:{label:"Apply on next match",rightIcon:Ss,variant:K.Primary,size:W.S,disabled:!0,onClick:()=>{}}}],withCollapse:!0,children:t(T,{$gap:16,children:t(kx,{options:wx,selectedId:S.responseOnNextMatch,setSelectedId:e=>x("responseOnNextMatch",e)})})})]})},kx=({options:i,selectedId:n,setSelectedId:a})=>i.map(i=>{const o=n===i.id,l=()=>a(i.id);return t(mt,{bgTint:"800",moreSpacing:!0,onClick:l,clickStylesRemainActive:o,children:e(T,{$gap:16,children:[t(V,{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)}),Tx=f(T)`
|
|
1321
1383
|
width: 100%;
|
|
1322
1384
|
min-width: 0;
|
|
1323
1385
|
align-items: flex-start;
|
|
1324
|
-
`,
|
|
1386
|
+
`,Ix=f.div`
|
|
1325
1387
|
flex: 1;
|
|
1326
1388
|
min-width: 0;
|
|
1327
|
-
|
|
1389
|
+
`,$x=e=>(e.attrs??[]).filter(e=>!!e?.key).map(e=>({key:e.key??null,value:e.value??null})),Nx=({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:gl(1e6*Math.max(0,a))),depth:e.depth??0,scope:e.scope??null,attributes:$x(e),variant:i?"new":"default",badge:i?{icon:mc,tone:"danger",label:i.reason}:null};var a})})(e,i),[e,i]),[o,r]=l([]);return e&&e.spans?.length?t(Tx,{children:t(Ix,{children:e&&e.spans?.length?t(ml,{title:"Evidence trace",rows:n,expandedRowIds:o,onToggleRow:e=>{r(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])}}):t(Me,{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(Me,{children:t(Z,{title:"No evidence retained",subTitle:e?.error?`Unable to parse traces: ${e.error}`:"No sample trace was captured for this violation."})})},Ax=(e,t,i)=>[{id:"severity",title:"Severity",badge:SS(e,t.severity)},{id:"status",title:"Status",badge:xS(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"}):"-"}],Ox=({finding:i,onClose:n})=>{const o=v(),{formatDurationAgo:l}=Nt(),{insightsApi:s}=Lc(),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(()=>fl(h?.evidenceTrace?.rawOtlp),[h?.evidenceTrace?.rawOtlp]),{data:b,loading:f}=s.useBlastRadius({namespace:i.namespace,service:i.service},{skip:!i.namespace||!i.service});return e(mt,{bgTint:"1000",moreSpacing:!0,children:[t(mt,{bgTint:"900",moreSpacing:!0,richTitle:{icon:xc,title:i?.title},renderOnRightSide:e(r,{children:[t(ES,{actionType:gS.Dismiss,selectedFindings:[i],onDone:n,buttonProps:{size:W.S}}),t(ES,{actionType:gS.Allow,selectedFindings:[i],onDone:n,buttonProps:{label:"Allow (Add to guardrails)",variant:K.Primary,size:W.S}})]}),items:Ax(o,i,l),children:t(mt,{bgTint:"800",items:[{id:"summary",title:"Summary",label:h?.summary||"-"}]})}),t(mt,{bgTint:"900",richTitle:FS("Evidence trace","The trace that triggered this violation."),withCollapse:!0,collapseIsDefaultOpen:!0,children:g&&!h?t(Me,{children:t(Ve,{withSpinner:!0})}):t(Nx,{evidenceTrace:m,spanHighlights:h?.spanHighlights})}),t(mt,{bgTint:"900",richTitle:FS("Blast Radius","Services and resources touched by traces matching this violation."),withCollapse:!0,collapseIsDefaultOpen:!0,children:f&&!b?t(Me,{children:t(Ve,{withSpinner:!0})}):t(Nd,{blastRadius:b})})]})},Ex=({type:i})=>{const n=v(),{drawerIsOpenFor:o,closeDrawer:l}=eS(),{insightsApi:s}=Lc(),{data:c,loading:d}=s.useFindings(void 0,{fetchPolicy:"cache-first"}),p=a(()=>{if(o.id)return((e,t)=>e?.find(e=>uS(e)===t))(c,o.id)},[c,o.id]);return t(ct,{width:"95vw",isOpen:!0,header:{onClose:l,icon:Xs,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===Yy.Anomaly&&t(Cx,{finding:p,onClose:l}),i===Yy.Violation&&t(Ox,{finding:p,onClose:l})]}):t(ct,{width:"95vw",isOpen:!0,header:{onClose:l},children:t(Me,{children:d?t(Ve,{withSpinner:!0}):t(Z,{title:"No finding found",subTitle:`No finding found for this ID ${o.id}`})})})})},Dx=f.div`
|
|
1328
1390
|
display: flex;
|
|
1329
1391
|
flex-direction: column;
|
|
1330
1392
|
gap: 12px;
|
|
1331
1393
|
width: 70vw;
|
|
1332
1394
|
height: 70vh;
|
|
1333
1395
|
padding: 12px;
|
|
1334
|
-
`,
|
|
1396
|
+
`,Rx=f.div`
|
|
1335
1397
|
display: flex;
|
|
1336
1398
|
align-items: center;
|
|
1337
1399
|
justify-content: space-between;
|
|
1338
1400
|
width: 100%;
|
|
1339
|
-
`,
|
|
1401
|
+
`,zx=e=>(e.attrs??[]).filter(e=>!!e?.key).map(e=>({key:e.key??null,value:e.value??null})),Xx=({isOpen:i,onClose:n,transactionId:o,traceId:s})=>{const{insightsApi:c}=Lc(),{data:d,loading:p}=c.useObservation({transactionId:o,traceId:s},{skip:!o||!s}),u=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:gl(1e6*Math.max(0,i))),depth:e.depth??0,scope:e.scope??null,attributes:zx(e),variant:"default",badge:null};var i})??[])(fl(d?.rawOtlp)),[d?.rawOtlp]),[h,g]=l([]);return t(Na,{isOpen:i,onClose:n,children:e(Dx,{children:[e(Rx,{children:[t(w,{size:C.XS,children:"JSON view"}),t(Be,{icon:e=>t(Rs,{...e}),size:Ue.L,onClick:n})]}),d?t(mt,{fullHeight:!0,overflow:"auto",children:t(ml,{rows:u,expandedRowIds:h,onToggleRow:e=>g(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])})}):t(r,{children:p?t(Ve,{withSpinner:!0}):t(Z,{})})]})})};var Px;(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"})(Px||(Px={}));const Lx=(e,i)=>i?.map((e,i)=>({id:`${e.transactionId}-${i}`,cells:[{key:Px.TransactionId,rawValue:e.transactionId},{key:Px.Class,rawValue:e.class,component:()=>t(ce,{text:e.classDescription,children:t(w,{size:C.XXXS,color:k.Primary,children:e.classLabel})})},{key:Px.Status,rawValue:e.learning?.phase||"",component:e.learning?.phase?()=>t(Fx,{phase:e.learning.phase,readyToPromote:e.learning.readyToPromote}):void 0},{key:Px.Learning,rawValue:e.learning?.phase||"",component:e.learning?()=>t(Bx,{learning:e.learning}):void 0},{key:Px.LearningStartedAt,rawValue:e.learningStartedAt?new Date(e.learningStartedAt).toLocaleString():""},{key:Px.ObservationCount,rawValue:Number(e.observationCount).toLocaleString()},{key:Px.ObservationCountAtLastChange,rawValue:Number(e.observationCountAtLastChange??0).toLocaleString()},{key:Px.LastChangedAt,rawValue:e.lastChangedAt?new Date(e.lastChangedAt).toLocaleString():""},{key:Px.Data,rawValue:e.data??""}]}))??[],Mx=f.div`
|
|
1340
1402
|
position: relative;
|
|
1341
1403
|
width: 100%;
|
|
1342
1404
|
height: 6px;
|
|
1343
1405
|
border-radius: 3px;
|
|
1344
1406
|
overflow: hidden;
|
|
1345
1407
|
background-color: ${({theme:e})=>e.v2.colors.silver[750]};
|
|
1346
|
-
`,
|
|
1408
|
+
`,_x=f.div`
|
|
1347
1409
|
position: absolute;
|
|
1348
1410
|
left: 0;
|
|
1349
1411
|
top: 0;
|
|
@@ -1351,7 +1413,7 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
1351
1413
|
width: ${({$pct:e})=>`${Math.max(0,Math.min(100,e))}%`};
|
|
1352
1414
|
border-radius: 3px;
|
|
1353
1415
|
background-color: ${({$color:e})=>e};
|
|
1354
|
-
`,
|
|
1416
|
+
`,Fx=({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 vl.Empty:case vl.Learning:return t(E,{label:"Learning",backgroundColor:n.v2.colors.beige[600],textColor:n.v2.colors.black[500],textSize:C.XXXS});case vl.Promoted:return t(E,{label:"Promoted",leftIcon:Ds,status:ie.Success,textSize:C.XXXS});default:return null}},Bx=({learning:i})=>{const n=v();if(!i)return null;switch(i.phase){case vl.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 vl.Promoted:return t(ce,{text:"Locked: this class is promoted - its baseline is frozen and no longer changes.",children:t(w,{size:C.XXXS,color:k.Secondary,children:"Baseline locked"})});case vl.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.":"Learning: progress toward the resolved stability targets. A full bar is not promotion - Locked is only when phase is promoted.",children:e($,{$gap:4,children:[e(w,{size:C.XXXS,color:k.Primary,children:[l.current.toLocaleString()," / ",l.target.toLocaleString()," observations"]}),t(Mx,{children:t(_x,{$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 ${yl(r.current,{units:2,style:"long",suffix:!0})}`})]})})}default:return null}var a,o},Ux=({transactionId:i})=>{const n=v(),{openModal:o}=eS(),{insightsApi:r}=Lc(),{data:s,loading:c,refetch:d}=r.useBaseline({transactionId:i},{pollInterval:3e4}),{baselinesColumns:p,baselinesRows:u}=a(()=>({baselinesColumns:[{key:Px.Class,label:"Class"},{key:Px.Status,label:"Status"},{key:Px.Learning,label:"Learning stability",noFilter:!0,noSort:!0},{key:Px.ObservationCount,label:"Observations",noFilter:!0},{key:Px.LearningStartedAt,label:"First observed",noFilter:!0}],baselinesRows:Lx(0,s)}),[n,s]),h=a(()=>!!s?.length&&s.every(e=>e.promoted),[s]),[g,m]=l(!1),[b,f]=l(!1),[y,S]=l(null),[x,w]=l(null);return t(mt,{bgTint:"900",richTitle:FS("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:Ft.Button,buttonProps:{label:"Promote all baselines",leftIcon:$s,variant:K.Primary,disabled:h||!r.promoteTransactionBaselines,onClick:()=>f(!0)}},{id:"reset-all-baselines",type:Ft.Button,buttonProps:{label:"Reset all baselines",leftIcon:tc,variant:K.Secondary,onClick:()=>m(!0)}},{id:"refetch-baselines",type:Ft.Button,buttonProps:{tooltip:"Refetch",hideTooltipIcon:!0,leftIcon:Hs,variant:K.Secondary,onClick:d,loading:c}}],children:e(mt,{bgTint:"800",children:[t(ui,{maxHeight:"35vh",variant:hi.Data,isLoading:c,columns:p,rows:u,getRowActions:e=>{const t=e.cells.find(e=>e.key===Px.Class)?.rawValue,i=e.cells.find(e=>e.key===Px.Status)?.rawValue,n=i===vl.Promoted;return[{id:`${e.id}-view-json-data`,label:"View JSON data",leftIcon:Bs,variant:K.Primary,onClick:()=>{const t=e.cells.find(e=>e.key===Px.Data)?.rawValue;o(qy.JsonCode,{jsonCode:t})}},{id:`${e.id}-promote-now`,label:"Promote now",leftIcon:$s,disabled:n||!r.promoteBaselineClass,onClick:()=>w(t)},{id:`${e.id}-re-learn`,label:"Re-learn (reset)",leftIcon:tc,onClick:()=>S(t)}]}}),t(Ce,{isOpen:b,onClose:()=>f(!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()=>{f(!1),await(r?.promoteTransactionBaselines?.(i)),d()})()},denyButton:{label:"Cancel",onClick:()=>f(!1),variant:K.Secondary}}),t(Ce,{isOpen:g,onClose:()=>m(!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()=>{m(!1),await(r?.resetTransactionBaselines?.(i)),d()})()},denyButton:{label:"Cancel",onClick:()=>m(!1),variant:K.Secondary}}),t(Ce,{isOpen:null!==y,onClose:()=>S(null),title:"Reset baseline class",description:"Are you sure you want to reset the baseline class?",approveButton:{label:"Reset baseline class",onClick:()=>(async e=>{S(null),await(r?.resetBaselineClass?.(i,e)),d()})(y)},denyButton:{label:"Cancel",onClick:()=>S(null),variant:K.Secondary}}),t(Ce,{isOpen:null!==x,onClose:()=>w(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=>{w(null),await(r?.promoteBaselineClass?.({transactionId:i,class:e})),d()})(x)},denyButton:{label:"Cancel",onClick:()=>w(null),variant:K.Secondary}})]})})};var Vx;(e=>{e.TraceId="traceId",e.TransactionId="transactionId",e.ObservedAt="observedAt",e.DurationMs="durationMs",e.SampleReason="sampleReason"})(Vx||(Vx={}));const Gx=e=>e?.map((e,i)=>({id:`${e.transactionId}-${e.traceId}-${i}`,cells:[{key:Vx.TraceId,rawValue:e.traceId},{key:Vx.TransactionId,rawValue:e.transactionId},{key:Vx.ObservedAt,rawValue:e.observedAt?new Date(e.observedAt).toLocaleString():""},{key:Vx.DurationMs,rawValue:`${e.durationMs}ms`},{key:Vx.SampleReason,rawValue:e.sampleReason,component:()=>t(E,{label:e.sampleReason})}]}))??[];var Hx;(e=>{e.Examples="examples",e.Anomalies="anomalies"})(Hx||(Hx={}));const jx=({transactionId:e})=>{const{openModal:i}=eS(),{insightsApi:n}=Lc(),{data:o,loading:r,refetch:s}=n.useObservations({transactionId:e},{pollInterval:3e4}),{observationsColumns:c,observationsRows:d}=a(()=>({observationsColumns:[{key:Vx.TraceId,label:"Trace ID",noFilter:!0},{key:Vx.ObservedAt,label:"Observed at",noFilter:!0},{key:Vx.DurationMs,label:"Duration",noFilter:!0},{key:Vx.SampleReason,label:"Sample reason"}],observationsRows:Gx(o)}),[o]),[p,u]=l(Hx.Examples),{examplesRows:h,anomaliesRows:g}=a(()=>{const e=[],t=[];return d.forEach(i=>{const n=i.cells.find(e=>e.key===Vx.SampleReason)?.rawValue;[Sl.Example].includes(n)&&e.push(i),[Sl.AnomalyEvidence,Sl.GuardrailEvidence].includes(n)&&t.push(i)}),{examplesRows:e,anomaliesRows:t}},[d]);return t(mt,{bgTint:"900",richTitle:FS("Trace observations","Representative sample of normal traffic - up to 10 collected while learning, then collection stops."),actions:[{id:"refetch-observations",type:Ft.Button,buttonProps:{tooltip:"Refetch",hideTooltipIcon:!0,leftIcon:Hs,variant:K.Secondary,onClick:s,loading:r}}],renderOnRightSide:t(F,{options:(m=h.length,b=g.length,[{label:"Examples",value:Hx.Examples,badge:{label:m.toString()}},{label:"Anomaly issues",value:Hx.Anomalies,badge:{label:b.toString()}}]),selected:p,setSelected:u,size:rt.L}),children:t(mt,{bgTint:"800",children:t(ui,{maxHeight:"35vh",variant:hi.Data,isLoading:r,columns:c,rows:p===Hx.Examples?h:g,getRowActions:e=>[{id:`${e.id}-view-trace`,label:"View trace",rightIcon:Bs,variant:K.Primary,onClick:()=>{const t=e.cells.find(e=>e.key===Vx.TransactionId)?.rawValue,n=e.cells.find(e=>e.key===Vx.TraceId)?.rawValue;i(qy.TraceView,{transactionId:t,traceId:n})}}]})})});var m,b},Wx=()=>{const{drawerIsOpenFor:e,closeDrawer:i}=eS(),{insightsApi:n}=Lc(),{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(ct,{width:"95vw",isOpen:!0,header:{onClose:i,icon:wc,title:r?.id},children:r?t(Kx,{transaction:r}):t(Me,{children:l?t(Ve,{withSpinner:!0}):t(Z,{title:"No transaction found",subTitle:`No transaction found for this ID ${e.id}`})})})},Kx=({transaction:i})=>{const n=v();return e(mt,{bgTint:"1000",moreSpacing:!0,children:[e(T,{$gap:8,children:[t(w,{size:C.M,children:i.service}),t(dS,{operationName:i.operationName,identityDimensions:i.identityDimensions}),t(E,{backgroundColor:n.v2.colors.blue[900],label:i.kind}),t(It,{disabled:!0,label:`Transaction ID: ${i.id}`})]}),t(Ux,{transactionId:i.id}),t(jx,{transactionId:i.id})]})},Yx="System",qx="Storage",Jx=f($)`
|
|
1355
1417
|
flex: 1;
|
|
1356
1418
|
min-width: 0;
|
|
1357
1419
|
min-height: 0;
|
|
@@ -1359,33 +1421,33 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
1359
1421
|
overflow: hidden;
|
|
1360
1422
|
border-radius: 16px;
|
|
1361
1423
|
background-color: ${({theme:e})=>e.v2.colors.silver[1e3]};
|
|
1362
|
-
|
|
1424
|
+
`,Zx=f(T)`
|
|
1363
1425
|
width: 100%;
|
|
1364
1426
|
flex-shrink: 0;
|
|
1365
1427
|
align-items: center;
|
|
1366
1428
|
gap: 24px;
|
|
1367
1429
|
padding: 12px 12px 16px 12px;
|
|
1368
|
-
`,
|
|
1430
|
+
`,Qx=f(T)`
|
|
1369
1431
|
flex-shrink: 0;
|
|
1370
1432
|
align-items: center;
|
|
1371
1433
|
gap: 8px;
|
|
1372
|
-
`,
|
|
1434
|
+
`,ew=f(w)`
|
|
1373
1435
|
flex: 1;
|
|
1374
1436
|
min-width: 0;
|
|
1375
1437
|
white-space: pre-line;
|
|
1376
|
-
`,
|
|
1438
|
+
`,tw=f($)`
|
|
1377
1439
|
flex: 1;
|
|
1378
1440
|
min-height: 0;
|
|
1379
1441
|
width: 100%;
|
|
1380
1442
|
overflow: hidden;
|
|
1381
|
-
`,
|
|
1443
|
+
`,iw=({icon:i,title:n,count:a,description:o,children:l})=>{const r=v();return e(Jx,{"data-id":`settings-content-panel-${n}`,children:[e(Zx,{children:[e(Qx,{children:[i&&t(i,{size:18}),t(w,{size:C.S,children:n}),null!=a&&t(E,{label:a})]}),o&&t(ew,{size:C.XXS,color:r.v2.colors.silver[300],children:o})]}),t(tw,{children:l})]})},nw="Global",aw="Service",ow="Transaction",lw="Medium",rw="High",sw="Critical",cw=(e,t)=>`Fire when risk score ≥ ${e} · ${t} signal weight override(s)`,dw="Guardrails are rules you declare about how a service may communicate. A broken guardrail is a Policy violation.\nPick a service to see what it actually talks to, check the callers/callees/egress/transactions you want to allow.",pw="No guardrails yet",uw="Create a guardrail to declare allowed service communication.",hw="Namespace",gw="Service",mw="Callers",bw="Who may call this service (inbound)",fw="No Callers detected",vw="No callers found for this selection",yw="Callees",Sw="Internal services it may call (outbound)",xw="No Callees detected",ww="No callees found for this selection",Cw="Egress",kw="External destinations it may reach",Tw="No egress detected",Iw="No egress found for this selection",$w="Transactions",Nw="Operations this service may expose",Aw="No Transactions detected",Ow="No transactions found for this selection",Ew="Adopt as enforce",Dw="Alert on violation",Rw="Adopt as suggest",zw="Observe only",Xw="Create new guardrail",Pw="allowed_callers",Lw="allowed_callees",Mw="allowed_egress",_w="allowed_transactions";var Fw;(e=>{e.Minutes="minutes",e.Hours="hours",e.Days="days"})(Fw||(Fw={}));const Bw=e=>e.scope===xl.Global,Uw=[bl.D1_call_edges,bl.D2_egress,bl.D3_latency,bl.D5_libraries,bl.D7_db_access,bl.D8_payload_size],Vw="Configure when a class stops learning and how baselines are finalized.\nUse service overrides to adjust learning for specific services or transactions.",Gw="Global",Hw="Service",jw="Transaction",Ww="K of",Kw={[bl.D1_call_edges]:"D1 call edges",[bl.D2_egress]:"D2 egress",[bl.D3_latency]:"D3 latency",[bl.D4_args_returns]:"D4 args/returns",[bl.D5_libraries]:"D5 libraries",[bl.D6_attr_relations]:"D6 attr relations",[bl.D7_db_access]:"D7 db access",[bl.D8_payload_size]:"D8 payload size"},Yw={[wl.Any]:"Any",[wl.All]:"All",[wl.KOf]:Ww},qw=[{id:wl.Any,label:"Any (OR)"},{id:wl.All,label:"All (AND)"},{id:wl.KOf,label:"K of N"}],Jw=[{id:Cl.StableObservations,label:"Stable for N observations"},{id:Cl.StableDuration,label:"Stable for a duration"},{id:Cl.MinObservations,label:"Min observations"},{id:Cl.MinDuration,label:"Min duration"}],Zw=[{id:Fw.Minutes,label:"Minutes"},{id:Fw.Hours,label:"Hours"},{id:Fw.Days,label:"Days"}],Qw=e=>e===Cl.StableDuration||e===Cl.MinDuration;var eC;(e=>{e.Detection="detection",e.Guardrails="guardrails",e.Learning="learning",e.System="system",e.Storage="storage"})(eC||(eC={}));const tC=eC.Guardrails,iC=[{id:"threat-detection",title:"Threat detection",icon:kc,items:[{id:eC.Detection,title:"Detection",description:"When a finding fires",panelIcon:kc,panelDescription:"Configure when Odigos should create findings based on runtime risk signals.\nUse service overrides to adjust detection sensitivity for specific services."},{id:eC.Guardrails,title:"Guardrails",description:"L7 allowlist rules (Enforce / Suggest)",panelIcon:Tc,panelDescription:dw}]},{id:"learning",title:"Learning",icon:xs,items:[{id:eC.Learning,title:"Learning",description:"Control baseline learning",panelIcon:xs,panelDescription:Vw}]},{id:"advanced",title:"Advanced",icon:Ic,items:[{id:eC.System,title:Yx,description:"Sampling, retention, capacity",panelIcon:Ic,panelDescription:"Engine-wide operational configuration. Detection thresholds and learning rules live on their own tabs."},{id:eC.Storage,title:qx,description:"ClickHouse health",panelIcon:$c}]}],nC=e=>iC.flatMap(e=>e.items).find(t=>t.id===e),aC="seconds",oC="System settings are not available.",lC=[{key:"http.response.status_code",enabled:!0},{key:"rpc.grpc.status_code",enabled:!0}],rC={examplesPerTransaction:0,exampleSampleIntervalSeconds:0,observationRetentionDays:0,maxResidentTransactions:0,maxBaselineSetMembers:0,flushIntervalSeconds:0,autoTransactionGuardrail:!0,identityDimensions:[...lC]},sC="260px",cC=e=>e.map(e=>({key:e.key.trim(),enabled:e.enabled})).filter(e=>e.key.length>0),dC=(e,t)=>e.length===t.length&&e.every((e,i)=>e.key===t[i].key&&e.enabled===t[i].enabled),pC=e=>({examplesPerTransaction:e.sampling.examplesPerTransaction,exampleSampleIntervalSeconds:e.sampling.exampleSampleIntervalSeconds,observationRetentionDays:e.retention.observationRetentionDays,maxResidentTransactions:e.capacity.maxResidentTransactions,maxBaselineSetMembers:e.capacity.maxBaselineSetMembers,flushIntervalSeconds:e.writeback.flushIntervalSeconds,autoTransactionGuardrail:e.detection?.autoTransactionGuardrail??!0,identityDimensions:e.identity?.transactionIdentityDimensions?.length?e.identity.transactionIdentityDimensions.map(e=>({key:e.key,enabled:e.enabled})):[...lC]}),uC=f($)`
|
|
1382
1444
|
flex: 1;
|
|
1383
1445
|
min-height: 0;
|
|
1384
1446
|
width: 100%;
|
|
1385
1447
|
overflow-y: auto;
|
|
1386
1448
|
gap: 20px;
|
|
1387
1449
|
padding: 4px 12px 32px;
|
|
1388
|
-
`,
|
|
1450
|
+
`,hC=f.div`
|
|
1389
1451
|
flex-shrink: 0;
|
|
1390
1452
|
display: flex;
|
|
1391
1453
|
justify-content: flex-end;
|
|
@@ -1400,19 +1462,19 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
1400
1462
|
flex-direction: column-reverse;
|
|
1401
1463
|
align-items: stretch;
|
|
1402
1464
|
}
|
|
1403
|
-
`,
|
|
1465
|
+
`,gC=f(j)`
|
|
1404
1466
|
@media (max-width: 560px) {
|
|
1405
1467
|
width: 100%;
|
|
1406
1468
|
}
|
|
1407
|
-
`,
|
|
1469
|
+
`,mC=f($)`
|
|
1408
1470
|
width: 100%;
|
|
1409
1471
|
min-width: 0;
|
|
1410
1472
|
gap: 4px;
|
|
1411
|
-
`,
|
|
1473
|
+
`,bC=f($)`
|
|
1412
1474
|
width: 100%;
|
|
1413
1475
|
min-width: 0;
|
|
1414
1476
|
gap: 0;
|
|
1415
|
-
`,
|
|
1477
|
+
`,fC=f.div`
|
|
1416
1478
|
display: flex;
|
|
1417
1479
|
flex-wrap: wrap;
|
|
1418
1480
|
align-items: flex-start;
|
|
@@ -1420,7 +1482,7 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
1420
1482
|
gap: 16px;
|
|
1421
1483
|
width: 100%;
|
|
1422
1484
|
padding: 10px 0;
|
|
1423
|
-
`,
|
|
1485
|
+
`,vC=f.label`
|
|
1424
1486
|
display: flex;
|
|
1425
1487
|
flex-direction: column;
|
|
1426
1488
|
gap: 4px;
|
|
@@ -1428,27 +1490,46 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
1428
1490
|
max-width: 420px;
|
|
1429
1491
|
min-width: 0;
|
|
1430
1492
|
cursor: pointer;
|
|
1431
|
-
`,
|
|
1493
|
+
`,yC=f.div`
|
|
1432
1494
|
display: flex;
|
|
1433
1495
|
flex-direction: column;
|
|
1434
1496
|
gap: 4px;
|
|
1435
|
-
flex: 0 0 ${
|
|
1436
|
-
width: ${
|
|
1497
|
+
flex: 0 0 ${sC};
|
|
1498
|
+
width: ${sC};
|
|
1437
1499
|
max-width: 100%;
|
|
1438
1500
|
box-sizing: border-box;
|
|
1439
|
-
`,
|
|
1501
|
+
`,SC=f($)`
|
|
1502
|
+
width: 100%;
|
|
1503
|
+
gap: 8px;
|
|
1504
|
+
margin-top: 8px;
|
|
1505
|
+
`,xC=f(T)`
|
|
1506
|
+
width: 100%;
|
|
1507
|
+
gap: 12px;
|
|
1508
|
+
align-items: center;
|
|
1509
|
+
flex-wrap: wrap;
|
|
1510
|
+
`,wC=f.div`
|
|
1511
|
+
flex: 1 1 280px;
|
|
1512
|
+
min-width: 0;
|
|
1513
|
+
max-width: 420px;
|
|
1514
|
+
`,CC=f(T)`
|
|
1515
|
+
width: 100%;
|
|
1516
|
+
gap: 12px;
|
|
1517
|
+
align-items: center;
|
|
1518
|
+
margin-top: 8px;
|
|
1519
|
+
flex-wrap: wrap;
|
|
1520
|
+
`,kC=({title:i,tooltip:n,children:a})=>e(mC,{"data-id":`insights-system-section-${i}`,children:[e(T,{$width:"100%",$gap:6,$alignItems:"center",children:[t(w,{size:C.S,children:i}),n?t(ce,{text:n,withIcon:!0}):null]}),a]}),TC=({id:i,label:n,helper:a,hint:o,value:l,unit:r,min:s=1,max:c,disabled:d,onChange:p})=>{const u=`${i}-helper`,h=o?`${i}-hint`:void 0,g=h?`${u} ${h}`:u,m=l<s||null!=c&&l>c;return e(fC,{"data-id":`insights-system-row-${i}`,children:[e(vC,{htmlFor:i,children:[t(w,{size:C.XXS,children:n}),t("span",{id:u,children:t(w,{size:C.XXXS,color:k.Secondary,children:a})})]}),e(yC,{children:[t(Y,{id:i,name:i,"aria-label":n,"aria-describedby":g,type:st.Number,inputMode:"numeric",autoComplete:"off",value:l?String(l):"",onChange:e=>{const t=Number(e.target.value);p(Number.isFinite(t)?t:0)},width:"100%",min:s,max:c,disabled:d,hasError:m,suffix:r}),o?t("span",{id:h,children:t(w,{size:C.XXXS,color:k.Secondary,children:o})}):null]})]})},IC=({id:i,label:n,helper:a,value:o,disabled:l,onChange:r})=>{const s=`${i}-helper`;return e(fC,{"data-id":`insights-system-row-${i}`,children:[e(vC,{children:[t(w,{size:C.XXS,children:n}),t("span",{id:s,children:t(w,{size:C.XXXS,color:k.Secondary,children:a})})]}),t(yC,{children:t(L,{name:i,value:o,onChange:r,size:Je.S,disabled:l})})]})},$C=()=>{const n=nC(eC.System),{insightsApi:a}=Lc(),{data:r,loading:s,unsupported:c,error:p}=a.useSystemSettings(),[u,h]=l(rC),[g,m]=l(!1),[b,f]=l(!1);o(()=>{r&&h(pC(r))},[r?.sampling.examplesPerTransaction,r?.sampling.exampleSampleIntervalSeconds,r?.retention.observationRetentionDays,r?.capacity.maxResidentTransactions,r?.capacity.maxBaselineSetMembers,r?.writeback.flushIntervalSeconds,r?.detection?.autoTransactionGuardrail,r?.identity?.transactionIdentityDimensions]);const v=d(e=>t=>h(i=>({...i,[e]:t})),[]),y=!!r&&((e,t)=>{const i=pC(t);return e.examplesPerTransaction!==i.examplesPerTransaction||e.exampleSampleIntervalSeconds!==i.exampleSampleIntervalSeconds||e.observationRetentionDays!==i.observationRetentionDays||e.maxResidentTransactions!==i.maxResidentTransactions||e.maxBaselineSetMembers!==i.maxBaselineSetMembers||e.flushIntervalSeconds!==i.flushIntervalSeconds||e.autoTransactionGuardrail!==i.autoTransactionGuardrail||!dC(cC(e.identityDimensions),cC(i.identityDimensions))})(u,r),S=y&&(e=>{const t=e.identityDimensions.filter(e=>e.enabled&&e.key.trim()).length,i=e.identityDimensions.map(e=>e.key.trim()).filter(Boolean),n=new Set(i);return e.examplesPerTransaction>=1&&e.exampleSampleIntervalSeconds>=1&&e.observationRetentionDays>=1&&e.observationRetentionDays<=90&&e.maxResidentTransactions>=1&&e.maxBaselineSetMembers>=1&&e.flushIntervalSeconds>=1&&e.flushIntervalSeconds<=300&&t<=5&&n.size===i.length})(u)&&!g&&!!a.updateSystemSettings,x=y&&!g,T=u.identityDimensions.filter(e=>e.enabled&&e.key.trim()).length,I=async e=>{if(r&&a.updateSystemSettings){m(!0);try{await a.updateSystemSettings(((e,t)=>({sampling:{examplesPerTransaction:e.examplesPerTransaction,exampleSampleIntervalSeconds:e.exampleSampleIntervalSeconds},retention:{observationRetentionDays:e.observationRetentionDays},capacity:{maxResidentTransactions:e.maxResidentTransactions,maxBaselineSetMembers:e.maxBaselineSetMembers},writeback:{flushIntervalSeconds:e.flushIntervalSeconds},detection:{autoTransactionGuardrail:e.autoTransactionGuardrail},identity:{transactionIdentityDimensions:cC(e.identityDimensions)},resetTransactions:t||void 0}))(u,e))}finally{m(!1),f(!1)}}},$=async()=>{r&&S&&(((e,t)=>{const i=pC(t);return!dC(cC(e.identityDimensions),cC(i.identityDimensions))})(u,r)?f(!0):await I(!1))},N=()=>{r&&x&&h(pC(r))},A=(e,t)=>{h(i=>({...i,identityDimensions:i.identityDimensions.map((i,n)=>n===e?{...i,...t}:i)}))},O=()=>{h(e=>({...e,identityDimensions:[...e.identityDimensions,{key:"",enabled:T<5}]}))};return t(iw,{icon:n?.panelIcon,title:n?.title||Yx,description:n?.panelDescription,children:(()=>{if(c)return t(Me,{$height:"200px",children:t(w,{size:C.XS,color:k.Secondary,children:oC})});if(s&&!r)return t(Me,{$height:"200px",children:t(Ve,{})});if(!r)return t(Me,{$height:"200px",children:t(Z,{hideIcon:!0,title:oC,subTitle:p?.message})});const n=g;return e(i,{children:[e(uC,{"data-id":"insights-system-panel",children:[t(kC,{title:"Learning examples",tooltip:"Anomaly and guardrail evidence each keep a single write-once sample; occurrences are counted separately.",children:e(bC,{children:[t(TC,{id:"system-examples-per-transaction",label:"Maximum example traces",helper:"Maximum number of example traces collected per transaction.",value:u.examplesPerTransaction,unit:"traces",disabled:n,onChange:v("examplesPerTransaction")}),t(TC,{id:"system-example-sample-interval",label:"Minimum sampling interval",helper:"Minimum time between collected examples.",value:u.exampleSampleIntervalSeconds,unit:aC,disabled:n,onChange:v("exampleSampleIntervalSeconds")})]})}),t(kC,{title:"Retention",children:t(bC,{children:t(TC,{id:"system-observation-retention-days",label:"Sample trace retention",helper:"Stored sample traces are deleted after this period.",hint:"Default: 30 · Maximum: 90",value:u.observationRetentionDays,unit:"days",max:90,disabled:n,onChange:v("observationRetentionDays")})})}),t(kC,{title:"Memory limits",children:e(bC,{children:[t(TC,{id:"system-max-resident-transactions",label:"Maximum transactions in memory",helper:"Least-recently used baselines are unloaded when this limit is reached and loaded again if traffic returns.",value:u.maxResidentTransactions,unit:"transactions",disabled:n,onChange:v("maxResidentTransactions")}),t(TC,{id:"system-max-baseline-set-members",label:"Maximum members per baseline",helper:"Limits the size of an individual baseline set, such as unique call edges or paths.",value:u.maxBaselineSetMembers,unit:"members",disabled:n,onChange:v("maxBaselineSetMembers")})]})}),t(kC,{title:"Database writeback",children:t(bC,{children:t(TC,{id:"system-flush-interval-seconds",label:"Flush interval",helper:"How often pending learning data and occurrence counts are written to ClickHouse. Changes apply without a restart.",hint:"Default: 5 · Maximum: 300",value:u.flushIntervalSeconds,unit:aC,max:300,disabled:n,onChange:v("flushIntervalSeconds")})})}),t(kC,{title:"Transaction guardrails",children:t(bC,{children:t(IC,{id:"system-auto-transaction-guardrail",label:"Auto-enable transaction guardrail when a service is promoted",helper:"When a service finishes promoting (every transaction leaves learning), automatically create an enforced allowed_transactions guardrail. Applies only from that moment forward — services already promoted are not backfilled; enable their guardrail from the by-service transactions menu.",value:u.autoTransactionGuardrail,disabled:n,onChange:e=>h(t=>({...t,autoTransactionGuardrail:e}))})})}),e(kC,{title:"Transaction identity dimensions",children:[t(w,{size:C.XXXS,color:k.Secondary,children:"Low-cardinality only. Each enabled dimension multiplies transaction count, resident memory, and baseline rows. Good: http.response.status_code, rpc.grpc.status_code. Bad: user.id, URLs, request ids. Values come from the entry span only."}),t(SC,{"data-id":"insights-system-identity-dims",children:0===u.identityDimensions.length?t(w,{size:C.XXXS,color:k.Secondary,children:"No dimensions configured — transactions use the entry span name only."}):u.identityDimensions.map((i,a)=>e(xC,{children:[t(L,{name:`system-identity-enabled-${a}`,value:i.enabled,onChange:e=>A(a,{enabled:e}),size:Je.S,disabled:n||!i.enabled&&T>=5}),t(w,{size:C.XXXS,color:k.Secondary,children:"On"}),t(wC,{children:t(Y,{id:`system-identity-key-${a}`,name:`system-identity-key-${a}`,placeholder:"e.g. http.response.status_code",value:i.key,onChange:e=>A(a,{key:e.target.value}),width:"100%",disabled:n,spellCheck:!1})}),t(j,{"data-id":`insights-system-identity-remove-${a}`,variant:K.Secondary,size:W.S,leftIcon:vs,disabled:n,onClick:()=>(e=>{h(t=>({...t,identityDimensions:t.identityDimensions.filter((t,i)=>i!==e)}))})(a)})]},`dim-${a}`))}),e(CC,{children:[t(j,{"data-id":"insights-system-identity-add",label:"Add dimension",variant:K.Secondary,size:W.S,disabled:n,onClick:O}),t(w,{size:C.XXXS,color:k.Secondary,children:"Up to 5 enabled at once. Changing dimensions creates new transaction identities."})]})]})]}),e(hC,{children:[y?t(gC,{"data-id":"insights-system-discard",label:"Discard changes",variant:K.Secondary,size:W.M,disabled:!x,onClick:N}):null,t(gC,{"data-id":"insights-system-save",label:"Save settings",variant:K.Primary,size:W.M,disabled:!S,loading:g,onClick:$})]}),t(Ce,{isOpen:b,onClose:()=>f(!1),title:"Identity dimensions changed",description:"New traffic will mint new transaction identities. Existing transactions stop receiving volume and become stale.\nReset deletes every transaction and related baselines/samples/findings, then relearns from new traffic. Keep only saves the new dimension config.",denyButton:{label:"Keep existing transactions",variant:K.Secondary,disabled:g,onClick:()=>I(!1)},approveButton:{label:"Reset all transactions",variant:K.Primary,disabled:g,loading:g,onClick:()=>I(!0)}})]})})()})},NC=f(T)`
|
|
1440
1521
|
padding: 8px 12px 4px 12px;
|
|
1441
|
-
`,
|
|
1522
|
+
`,AC=({icon:i,title:n,count:a})=>{const o=v().v2.colors.purple[200];return e(NC,{$gap:8,children:[t(i,{size:14,fill:o}),t(w,{size:C.XXS,color:o,children:n}),t(E,{label:a})]})},OC=f($)`
|
|
1442
1523
|
width: 280px;
|
|
1443
1524
|
flex-shrink: 0;
|
|
1444
1525
|
height: 100%;
|
|
1445
1526
|
gap: 16px;
|
|
1446
1527
|
overflow-y: auto;
|
|
1447
|
-
`,
|
|
1528
|
+
`,EC=f(T)`
|
|
1448
1529
|
padding: 4px 12px;
|
|
1449
|
-
`,
|
|
1530
|
+
`,DC=f($)`
|
|
1450
1531
|
gap: 0;
|
|
1451
|
-
`,
|
|
1532
|
+
`,RC=({selected:i,onSelect:n})=>{const a=v();return e(OC,{"data-id":"insights-settings-menu",children:[e(EC,{$gap:8,children:[t(js,{size:16,fill:a.v2.colors.silver[200]}),t(w,{size:C.XS,children:"Settings Menu"})]}),iC.map(a=>e(DC,{"data-id":`settings-menu-category-${a.id}`,children:[t(AC,{icon:a.icon,title:a.title,count:a.items.length}),a.items.map(e=>t(Qd,{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))]})},zC=f($)`
|
|
1452
1533
|
flex: 1;
|
|
1453
1534
|
min-width: 0;
|
|
1454
1535
|
height: 100%;
|
|
@@ -1457,41 +1538,41 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
1457
1538
|
overflow: hidden;
|
|
1458
1539
|
border-radius: 16px 0 16px 0;
|
|
1459
1540
|
background-color: ${({theme:e})=>e.v2.colors.silver[900]};
|
|
1460
|
-
`,
|
|
1541
|
+
`,XC=f($)`
|
|
1461
1542
|
width: 100%;
|
|
1462
1543
|
gap: 4px;
|
|
1463
|
-
`,
|
|
1544
|
+
`,PC=f(w)`
|
|
1464
1545
|
white-space: pre-line;
|
|
1465
|
-
`,
|
|
1546
|
+
`,LC=f($)`
|
|
1466
1547
|
width: 100%;
|
|
1467
1548
|
gap: 32px;
|
|
1468
1549
|
padding: 12px;
|
|
1469
1550
|
border-radius: 16px;
|
|
1470
1551
|
align-items: center;
|
|
1471
1552
|
background-color: ${({theme:e})=>e.v2.colors.silver[1e3]};
|
|
1472
|
-
`,
|
|
1553
|
+
`,MC=f($)`
|
|
1473
1554
|
width: 100%;
|
|
1474
1555
|
gap: 24px;
|
|
1475
1556
|
align-items: center;
|
|
1476
1557
|
padding: 0 12px;
|
|
1477
|
-
`,
|
|
1558
|
+
`,_C=f(T)`
|
|
1478
1559
|
width: 100%;
|
|
1479
1560
|
align-items: flex-end;
|
|
1480
1561
|
justify-content: center;
|
|
1481
1562
|
gap: 16px;
|
|
1482
1563
|
flex-wrap: wrap;
|
|
1483
|
-
`,
|
|
1564
|
+
`,FC=f($)`
|
|
1484
1565
|
gap: 4px;
|
|
1485
|
-
`,
|
|
1566
|
+
`,BC=f(FC)`
|
|
1486
1567
|
width: 530px;
|
|
1487
1568
|
max-width: 100%;
|
|
1488
|
-
`,
|
|
1569
|
+
`,UC=f(FC)`
|
|
1489
1570
|
width: 319px;
|
|
1490
1571
|
max-width: 100%;
|
|
1491
|
-
`,
|
|
1572
|
+
`,VC="32px",GC=f.div`
|
|
1492
1573
|
display: flex;
|
|
1493
1574
|
align-items: stretch;
|
|
1494
|
-
height: ${
|
|
1575
|
+
height: ${VC};
|
|
1495
1576
|
|
|
1496
1577
|
& > div {
|
|
1497
1578
|
height: 100%;
|
|
@@ -1501,21 +1582,21 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
1501
1582
|
height: 100%;
|
|
1502
1583
|
box-sizing: border-box;
|
|
1503
1584
|
}
|
|
1504
|
-
`,
|
|
1585
|
+
`,HC=f.div`
|
|
1505
1586
|
width: 100%;
|
|
1506
1587
|
|
|
1507
1588
|
& > div > div > div:first-child {
|
|
1508
|
-
height: ${
|
|
1589
|
+
height: ${VC};
|
|
1509
1590
|
box-sizing: border-box;
|
|
1510
1591
|
padding-top: 0;
|
|
1511
1592
|
padding-bottom: 0;
|
|
1512
1593
|
}
|
|
1513
|
-
`,
|
|
1594
|
+
`,jC=f(T)`
|
|
1514
1595
|
width: 100%;
|
|
1515
1596
|
justify-content: center;
|
|
1516
|
-
`,
|
|
1597
|
+
`,WC=f(j)`
|
|
1517
1598
|
min-width: 271px;
|
|
1518
|
-
`,
|
|
1599
|
+
`,KC=(e,t)=>`${e}/${t}`,YC=e=>cS(e),qC=Uw.map(e=>({id:e,label:Kw[e]})),JC=({services:i,transactions:n,existingOverrides:r,initialClass:s,onSubmit:c})=>{const d=v(),[p,u]=l(s||Uw[0]),[h,g]=l(xl.Service),[m,b]=l(""),[f,y]=l(!1);o(()=>{s&&u(s)},[s]);const S=a(()=>r.filter(e=>e.class===p).map(e=>e.scopeKey),[r,p]),x=a(()=>{const e=new Set,t=[];for(const n of i){if(!n.namespace||!n.service)continue;const i=KC(n.namespace,n.service);e.has(i)||(e.add(i),t.push({id:i,label:i}))}return t.sort((e,t)=>e.label.localeCompare(t.label))},[i]),T=a(()=>n.filter(e=>!!e.id).map(e=>({id:String(e.id),label:YC(e)})).sort((e,t)=>e.label.localeCompare(t.label)),[n]),I=h===xl.Service?x:T,$=h===xl.Service?"Select Service":"Select Transaction",N=h===xl.Service?"Select service…":"Select transaction…";o(()=>{const e=I.find(e=>!S.includes(e.id))?.id||I[0]?.id||"";b(t=>t&&I.some(e=>e.id===t)?t:e)},[I,S]);const A=!!p&&!!m&&!f;return e(zC,{"data-id":"learning-create-override-panel",children:[e(XC,{children:[t(w,{size:C.S,children:"Choose override scope"}),t(PC,{size:C.XXS,color:k.Secondary,children:"Select where this policy should override the global learning settings.\nYou can apply it to a specific service or transaction."})]}),e(LC,{children:[e(MC,{children:[e(BC,{children:[t(w,{size:C.XS,color:k.Secondary,children:"Select Deviation class"}),t(HC,{children:t(Fe,{"data-id":"learning-override-class",options:qC,values:[p],setValues:e=>u(e[0]||Uw[0]),placeholder:"Select deviation class…"})})]}),e(_C,{children:[e(FC,{children:[t(w,{size:C.XS,color:k.Secondary,children:"Choose Override type"}),t(GC,{children:t(F,{"data-id":"learning-override-type",size:rt.L,selected:h,setSelected:e=>g(e),options:[{value:xl.Service,label:Hw,selectedBgColor:d.v2.colors.purple[500],selectedBorderColor:d.v2.colors.purple[500]},{value:xl.Transaction,label:jw,selectedBgColor:d.v2.colors.purple[500],selectedBorderColor:d.v2.colors.purple[500]}]})})]}),e(UC,{children:[t(w,{size:C.XS,color:k.Secondary,children:$}),t(HC,{children:t(Fe,{"data-id":"learning-override-target",options:I,values:m?[m]:[],setValues:e=>b(e[0]||""),placeholder:N,withSearch:!0,disabled:!I.length})})]})]})]}),t(jC,{children:t(WC,{"data-id":"learning-add-selection",label:"Add selection",rightIcon:ys,variant:K.Primary,size:W.M,disabled:!A,onClick:async()=>{if(!A)return;const e=I.find(e=>e.id===m);y(!0);try{await c({class:p,scope:h,scopeKey:m,name:e?.label||m})}finally{y(!1)}}})})]})]})};let ZC=0;const QC=()=>"cond-"+ ++ZC,ek=(e,t,i)=>`${e}:${t||"global"}:${i}`,tk=(e,t)=>{switch(t){case Fw.Days:return Math.max(0,Math.round(24*e*60));case Fw.Hours:return Math.max(0,Math.round(60*e));case Fw.Minutes:default:return Math.max(0,Math.round(e))}},ik=e=>e<=0?{value:0,unit:Fw.Minutes}:e%1440==0?{value:e/1440,unit:Fw.Days}:e%60==0?{value:e/60,unit:Fw.Hours}:{value:e,unit:Fw.Minutes},nk=e=>{const{value:t,unit:i}=ik(e);return i===Fw.Days?7===t?"1w":`${t}d`:i===Fw.Hours?`${t}h`:`${t}m`},ak=e=>{const{value:t,unit:i}=ik(e);return i===Fw.Days?1===t?"1 day":`${t} days`:i===Fw.Hours?1===t?"1 hour":`${t} hours`:1===t?"1 minute":`${t} minutes`},ok=e=>{switch(e.type){case Cl.StableObservations:return`Unchanged for ${e.value} observations`;case Cl.StableDuration:return`unchanged for ${nk(tk(e.value,e.durationUnit))}`;case Cl.MinObservations:return`Min ${e.value} observations`;case Cl.MinDuration:return`min ${nk(tk(e.value,e.durationUnit))}`;default:return""}},lk=e=>{switch(e.type){case Cl.StableObservations:return`unchanged for ${e.value} observations`;case Cl.StableDuration:return`unchanged for ${ak(tk(e.value,e.durationUnit))}`;case Cl.MinObservations:return`at least ${e.value} observations`;case Cl.MinDuration:return`at least ${ak(tk(e.value,e.durationUnit))}`;default:return""}},rk=(e,t,i)=>t.length?((e,t,i)=>{if(!e.length)return"";const n=e.map((e,t)=>0===t?e.charAt(0).toUpperCase()+e.slice(1):0===t?e:e.charAt(0).toLowerCase()+e.slice(1));if(1===n.length)return n[0];const a=t===wl.All?" AND ":t===wl.KOf?` (${Ww} ${i??1}) `:" OR ";return n.join(a)})(t.map(ok),e,i):"Falls back to count-only default",sk=e=>{const{value:t,durationUnit:i}=(e=>{switch(e.type){case Cl.StableObservations:return{value:e.stableObservations??0,durationUnit:Fw.Hours};case Cl.MinObservations:return{value:e.minObservations??0,durationUnit:Fw.Hours};case Cl.StableDuration:{const t=e.stableMinutes??0,i=ik(t);return{value:i.value,durationUnit:i.unit}}case Cl.MinDuration:{const t=e.minDurationMinutes??0,i=ik(t);return{value:i.value,durationUnit:i.unit}}default:return{value:0,durationUnit:Fw.Hours}}})(e);return{key:QC(),type:e.type,value:t,durationUnit:i}},ck=e=>{const t=tk(e.value,e.durationUnit);switch(e.type){case Cl.StableObservations:return{type:e.type,minObservations:null,minDurationMinutes:null,stableObservations:e.value,stableMinutes:null};case Cl.MinObservations:return{type:e.type,minObservations:e.value,minDurationMinutes:null,stableObservations:null,stableMinutes:null};case Cl.StableDuration:return{type:e.type,minObservations:null,minDurationMinutes:null,stableObservations:null,stableMinutes:t};case Cl.MinDuration:return{type:e.type,minObservations:null,minDurationMinutes:t,stableObservations:null,stableMinutes:null};default:return{type:e.type}}},dk=(e=Cl.StableObservations)=>({key:QC(),type:e,value:Qw(e)?1:100,durationUnit:Fw.Hours}),pk=e=>{const t=(e.conditions??[]).map(sk),i=e.mode,n=e.minMatches??null,a=e.scope,o=Kw[e.class],l=a===xl.Global?o:`${o} · ${e.scopeKey}`;return{id:ek(a,e.scopeKey,e.class),name:l,class:e.class,mode:i,conditions:t,minMatches:n,scope:a,scopeKey:e.scopeKey,summary:rk(i,t,n)}},uk=e=>({class:e.class,mode:e.mode,conditions:e.conditions.map(ck),minMatches:e.mode===wl.KOf?e.minMatches??1:null,scope:e.scope,scopeKey:e.scopeKey}),hk=f.button`
|
|
1519
1600
|
display: flex;
|
|
1520
1601
|
align-items: center;
|
|
1521
1602
|
justify-content: space-between;
|
|
@@ -1531,29 +1612,29 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
1531
1612
|
&:hover {
|
|
1532
1613
|
background-color: ${({theme:e,$isSelected:t})=>t?e.v2.colors.silver[800]:e.v2.colors.silver[900]};
|
|
1533
1614
|
}
|
|
1534
|
-
`,
|
|
1615
|
+
`,gk=f($)`
|
|
1535
1616
|
flex: 1;
|
|
1536
1617
|
min-width: 0;
|
|
1537
|
-
`,
|
|
1618
|
+
`,mk=f(T)`
|
|
1538
1619
|
flex-wrap: wrap;
|
|
1539
1620
|
align-items: center;
|
|
1540
1621
|
gap: 4px;
|
|
1541
|
-
`,
|
|
1622
|
+
`,bk=({policy:i,isSelected:n,onSelect:a})=>{const o=v(),l=(e=>{switch(e){case xl.Global:return{label:Gw,status:ie.Warning};case xl.Service:return{label:Hw,status:ie.Info};case xl.Transaction:return{label:jw,status:ie.Info}}})(i.scope);return e(hk,{type:"button","data-id":`learning-policy-item-${i.id}`,$isSelected:n,onClick:()=>a(i.id),children:[e(gk,{$gap:4,children:[e(mk,{children:[t(w,{size:C.XXS,nowrap:!0,children:i.name}),Bw(i)&&t(E,{label:l.label,status:l.status,invertColors:!0}),t(E,{label:Yw[i.mode],invertColors:!0,backgroundColor:o.v2.colors.blue[900],textColor:o.v2.colors.blue[300]})]}),t(w,{size:C.XXXS,color:k.Secondary,nowrap:!0,children:i.summary})]}),t(bs,{size:18})]})},fk=f($)`
|
|
1542
1623
|
width: 320px;
|
|
1543
1624
|
flex-shrink: 0;
|
|
1544
1625
|
height: 100%;
|
|
1545
1626
|
gap: 16px;
|
|
1546
1627
|
padding: 8px 12px 12px 12px;
|
|
1547
1628
|
overflow-y: auto;
|
|
1548
|
-
`,
|
|
1629
|
+
`,vk=f($)`
|
|
1549
1630
|
width: 100%;
|
|
1550
1631
|
gap: 8px;
|
|
1551
|
-
`,
|
|
1632
|
+
`,yk=f(T)`
|
|
1552
1633
|
width: 100%;
|
|
1553
1634
|
align-items: center;
|
|
1554
1635
|
gap: 4px;
|
|
1555
1636
|
padding: 8px 12px 4px 8px;
|
|
1556
|
-
`,
|
|
1637
|
+
`,Sk=f($)`
|
|
1557
1638
|
width: 100%;
|
|
1558
1639
|
min-height: 60px;
|
|
1559
1640
|
align-items: stretch;
|
|
@@ -1562,7 +1643,7 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
1562
1643
|
padding: 12px 8px;
|
|
1563
1644
|
border-radius: 12px;
|
|
1564
1645
|
text-align: center;
|
|
1565
|
-
`,
|
|
1646
|
+
`,xk=f(j)`
|
|
1566
1647
|
&&:enabled {
|
|
1567
1648
|
background-color: ${({theme:e})=>e.v2.colors.purple[900]};
|
|
1568
1649
|
|
|
@@ -1574,7 +1655,7 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
1574
1655
|
background-color: ${({theme:e})=>e.v2.colors.purple[700]};
|
|
1575
1656
|
}
|
|
1576
1657
|
}
|
|
1577
|
-
`,
|
|
1658
|
+
`,wk=({defaultPolicies:i,overridePolicies:n,selectedId:a,onSelect:o,onAddOverride:l})=>{const r=v();return e(fk,{"data-id":"learning-policies-menu",children:[e(vk,{children:[e(yk,{children:[t(w,{size:C.XXS,color:r.v2.colors.purple[300],children:"Default policy"}),t(E,{label:i.length})]}),i.map(e=>t(bk,{policy:e,isSelected:a===e.id,onSelect:o},e.id))]}),e(vk,{children:[e(yk,{children:[t(w,{size:C.XXS,color:r.v2.colors.purple[300],children:"Overrides"}),t(E,{label:n.length})]}),0===n.length?e(Sk,{children:[t(w,{size:C.XXS,color:k.Secondary,align:"center",children:"No overrides yet"}),t(w,{size:C.XXXS,color:k.Disable,align:"center",children:"Add overrides to adjust learning for specific services."})]}):n.map(e=>t(bk,{policy:e,isSelected:a===e.id,onSelect:o},e.id)),t(xk,{"data-id":"learning-add-override-policy",label:"Add override policy",rightIcon:ys,variant:K.Primary,size:W.M,fullWidth:!0,textColor:r.v2.colors.purple[300],onClick:l})]})]})},Ck=f($)`
|
|
1578
1659
|
flex: 1;
|
|
1579
1660
|
min-width: 0;
|
|
1580
1661
|
height: 100%;
|
|
@@ -1583,37 +1664,37 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
1583
1664
|
overflow: hidden;
|
|
1584
1665
|
border-radius: 16px 0 16px 0;
|
|
1585
1666
|
background-color: ${({theme:e})=>e.v2.colors.silver[900]};
|
|
1586
|
-
`,
|
|
1667
|
+
`,kk=f($)`
|
|
1587
1668
|
flex: 1;
|
|
1588
1669
|
min-height: 0;
|
|
1589
1670
|
width: 100%;
|
|
1590
1671
|
gap: 12px;
|
|
1591
1672
|
overflow-y: auto;
|
|
1592
|
-
`,
|
|
1673
|
+
`,Tk=f($)`
|
|
1593
1674
|
width: 100%;
|
|
1594
1675
|
gap: 4px;
|
|
1595
1676
|
padding: 12px;
|
|
1596
|
-
`,
|
|
1677
|
+
`,Ik=f(T)`
|
|
1597
1678
|
width: 100%;
|
|
1598
1679
|
align-items: center;
|
|
1599
1680
|
gap: 4px;
|
|
1600
|
-
|
|
1681
|
+
`,$k=f($)`
|
|
1601
1682
|
width: 100%;
|
|
1602
1683
|
gap: 12px;
|
|
1603
1684
|
padding: 12px;
|
|
1604
1685
|
border-radius: 12px;
|
|
1605
1686
|
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
1606
|
-
`,
|
|
1687
|
+
`,Nk=f(T)`
|
|
1607
1688
|
width: 100%;
|
|
1608
1689
|
align-items: center;
|
|
1609
1690
|
gap: 12px;
|
|
1610
1691
|
flex-wrap: wrap;
|
|
1611
|
-
`,
|
|
1692
|
+
`,Ak=f(T)`
|
|
1612
1693
|
width: 100%;
|
|
1613
1694
|
align-items: center;
|
|
1614
1695
|
gap: 8px;
|
|
1615
1696
|
flex-wrap: wrap;
|
|
1616
|
-
`,
|
|
1697
|
+
`,Ok=f.button`
|
|
1617
1698
|
display: flex;
|
|
1618
1699
|
align-items: center;
|
|
1619
1700
|
gap: 8px;
|
|
@@ -1627,7 +1708,7 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
1627
1708
|
&:hover {
|
|
1628
1709
|
border-color: ${({theme:e})=>e.v2.colors.silver[300]};
|
|
1629
1710
|
}
|
|
1630
|
-
`,
|
|
1711
|
+
`,Ek=f.div`
|
|
1631
1712
|
height: 32px;
|
|
1632
1713
|
display: flex;
|
|
1633
1714
|
align-items: stretch;
|
|
@@ -1643,23 +1724,23 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
1643
1724
|
padding-top: 0;
|
|
1644
1725
|
padding-bottom: 0;
|
|
1645
1726
|
}
|
|
1646
|
-
`,
|
|
1727
|
+
`,Dk=f.div`
|
|
1647
1728
|
width: 100%;
|
|
1648
1729
|
display: flex;
|
|
1649
1730
|
align-items: center;
|
|
1650
1731
|
padding: 8px 16px;
|
|
1651
1732
|
border-radius: 4px;
|
|
1652
1733
|
background-color: ${({theme:e})=>e.v2.colors.silver[900]};
|
|
1653
|
-
`,
|
|
1734
|
+
`,Rk=f.p`
|
|
1654
1735
|
margin: 0;
|
|
1655
1736
|
font-family: ${({theme:e})=>e.font_family.primary};
|
|
1656
1737
|
font-size: 12px;
|
|
1657
1738
|
font-weight: 400;
|
|
1658
1739
|
line-height: normal;
|
|
1659
1740
|
color: ${({theme:e})=>e.v2.colors.white[500]};
|
|
1660
|
-
|
|
1741
|
+
`;f.span`
|
|
1661
1742
|
color: ${({theme:e})=>e.v2.colors.purple[400]};
|
|
1662
|
-
|
|
1743
|
+
`;const zk=f(T)`
|
|
1663
1744
|
flex-shrink: 0;
|
|
1664
1745
|
width: 100%;
|
|
1665
1746
|
align-items: center;
|
|
@@ -1669,7 +1750,7 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
1669
1750
|
border-radius: 8px;
|
|
1670
1751
|
background-color: ${({theme:e})=>e.v2.colors.black[500]+I["095"]};
|
|
1671
1752
|
box-shadow: 0 4px 16.7px 0 rgba(0, 0, 0, 0.83);
|
|
1672
|
-
`,
|
|
1753
|
+
`,Xk=f(T)`
|
|
1673
1754
|
flex: 1;
|
|
1674
1755
|
min-width: 0;
|
|
1675
1756
|
align-items: center;
|
|
@@ -1677,7 +1758,7 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
1677
1758
|
padding: 4px 12px 4px 4px;
|
|
1678
1759
|
border-radius: 8px;
|
|
1679
1760
|
background-color: ${({theme:e})=>e.v2.colors.blue[1e3]};
|
|
1680
|
-
`,
|
|
1761
|
+
`,Pk=f.div`
|
|
1681
1762
|
display: flex;
|
|
1682
1763
|
align-items: center;
|
|
1683
1764
|
justify-content: center;
|
|
@@ -1686,13 +1767,13 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
1686
1767
|
border-radius: 6px;
|
|
1687
1768
|
flex-shrink: 0;
|
|
1688
1769
|
background-color: ${({theme:e})=>e.v2.colors.blue[900]};
|
|
1689
|
-
`,
|
|
1770
|
+
`,Lk=f(T)`
|
|
1690
1771
|
gap: 16px;
|
|
1691
1772
|
align-items: center;
|
|
1692
1773
|
flex-shrink: 0;
|
|
1693
|
-
`,
|
|
1774
|
+
`,Mk=f(j)`
|
|
1694
1775
|
min-width: 140px;
|
|
1695
|
-
`,
|
|
1776
|
+
`,_k=f(j)`
|
|
1696
1777
|
&&:enabled {
|
|
1697
1778
|
background-color: ${({theme:e})=>e.v2.colors.purple[900]};
|
|
1698
1779
|
|
|
@@ -1704,7 +1785,7 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
1704
1785
|
background-color: ${({theme:e})=>e.v2.colors.purple[700]};
|
|
1705
1786
|
}
|
|
1706
1787
|
}
|
|
1707
|
-
`,
|
|
1788
|
+
`,Fk=f.button`
|
|
1708
1789
|
display: inline-flex;
|
|
1709
1790
|
align-items: center;
|
|
1710
1791
|
justify-content: center;
|
|
@@ -1718,17 +1799,17 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
1718
1799
|
&:hover {
|
|
1719
1800
|
background-color: ${({theme:e})=>e.v2.colors.silver[700]};
|
|
1720
1801
|
}
|
|
1721
|
-
`,
|
|
1802
|
+
`,Bk=e=>({...e,summary:rk(e.mode,e.conditions,e.minMatches)}),Uk=({policy:n,onAddOverride:r,onSave:s,onDelete:c})=>{const d=v(),[p,u]=l(n),[h,g]=l(!1),[m,b]=l(!1),f=!Bw(p);o(()=>{u(n)},[n]);const y=a(()=>qw.find(e=>e.id===p.mode),[p.mode]),S=((e,t,i)=>{if(!t.length)return{parts:["Falls back to the count-only default"],joiner:null};const n=t.map(lk).map((e,t)=>0===t?e:e.charAt(0).toLowerCase()+e.slice(1));return 1===n.length?{parts:n,joiner:null}:{parts:n,joiner:e===wl.All?"AND":e===wl.KOf?`${Ww} ${i??1}`:"OR"}})(p.mode,p.conditions,p.minMatches),x=rk(p.mode,p.conditions,p.minMatches),I=p.scope===xl.Service?Hw:p.scope===xl.Transaction?jw:Gw,$=`${Kw[p.class]} · `,N=p.name.startsWith($)?p.name.slice($.length):p.scopeKey,A=e=>{u(t=>Bk({...t,conditions:e(t.conditions)}))};return e(Ck,{"data-id":`learning-policy-editor-${n.id}`,children:[e(kk,{children:[e(Tk,{children:[e(Ik,{children:[e(i,f?{children:[t(E,{label:I,status:ie.Info,invertColors:!0}),t(w,{size:C.XS,nowrap:!0,children:N})]}:{children:[t(w,{size:C.XS,nowrap:!0,children:p.name}),t(E,{label:Gw,status:ie.Warning,invertColors:!0})]}),t(E,{label:Yw[p.mode],invertColors:!0,backgroundColor:d.v2.colors.blue[900],textColor:d.v2.colors.blue[300]})]}),e(w,{size:C.XXXS,color:k.Secondary,children:["Currently:"," ",x]})]}),e($k,{children:[e(Nk,{children:[t(w,{size:C.XS,children:"Combine"}),t(ka,{items:[...qw],selectedIds:[p.mode],setSelectedIds:e=>{const t=e[0]||p.mode;u(e=>Bk({...e,mode:t,minMatches:t===wl.KOf?e.minMatches??1:null}))},alignX:Ia.Left,children:({ChevronIcon:i,handleClick:n})=>e(Ok,{type:"button",onClick:n,"data-id":"learning-policy-combine-mode",children:[t(w,{size:C.XXS,children:y?.label||p.mode}),t(i,{size:18})]})}),p.mode===wl.KOf&&e(T,{$gap:8,style:{alignItems:"center"},children:[t(w,{size:C.XS,children:"Min matches"}),t(Ek,{children:t(Y,{"data-id":"learning-policy-min-matches",type:st.Number,value:String(p.minMatches??1),onChange:e=>u(t=>Bk({...t,minMatches:Math.max(1,Number(e.target.value)||1)})),width:"72px",small:!0,min:1})})]})]}),p.conditions.map(i=>{const n=Jw.find(e=>e.id===i.type),a=Zw.find(e=>e.id===i.durationUnit),o=Qw(i.type);return e(Ak,{"data-id":`learning-condition-${i.key}`,children:[t(ka,{items:[...Jw],selectedIds:[i.type],setSelectedIds:e=>{return t=i.key,n=e[0]||i.type,void A(e=>e.map(e=>e.key===t?((e,t)=>{const i=Qw(e.type),n=Qw(t);return i===n?{...e,type:t}:{...e,type:t,value:n?1:100,durationUnit:e.durationUnit||Fw.Hours}})(e,n):e));var t,n},alignX:Ia.Left,children:({ChevronIcon:a,handleClick:o})=>e(Ok,{type:"button",onClick:o,"data-id":`learning-condition-type-${i.key}`,children:[t(w,{size:C.XXS,children:n?.label||i.type}),t(a,{size:18})]})}),t(Ek,{children:t(Y,{"data-id":`learning-condition-value-${i.key}`,type:st.Number,value:String(i.value),onChange:e=>((e,t)=>{const i=Number(t);A(t=>t.map(t=>t.key===e?{...t,value:Number.isFinite(i)?i:0}:t))})(i.key,e.target.value),width:"79px",small:!0,min:0})}),o&&t(ka,{items:[...Zw],selectedIds:[i.durationUnit],setSelectedIds:e=>{return t=i.key,n=e[0]||i.durationUnit,void A(e=>e.map(e=>e.key===t?{...e,durationUnit:n}:e));var t,n},alignX:Ia.Left,children:({ChevronIcon:n,handleClick:o})=>e(Ok,{type:"button",onClick:o,"data-id":`learning-condition-unit-${i.key}`,children:[t(w,{size:C.XXS,children:a?.label||i.durationUnit}),t(n,{size:18})]})}),t(Fk,{type:"button","data-id":`learning-condition-remove-${i.key}`,onClick:()=>{return e=i.key,void A(t=>t.filter(t=>t.key!==e));var e},children:t(vs,{size:16,fill:d.v2.colors.red[500]})})]},i.key)}),t(Dk,{children:e(Rk,{children:["Promotes when"," ",S.parts[0],S.joiner]})}),t(_k,{"data-id":"learning-add-condition",label:"Add condition",rightIcon:ys,variant:K.Primary,size:W.M,fullWidth:!0,textColor:d.v2.colors.purple[300],onClick:()=>{A(e=>[...e,dk()])}})]})]}),e(zk,{children:[e(Xk,{children:[t(Pk,{children:t(Gs,{size:18,fill:d.v2.colors.blue[200]})}),t(w,{size:C.XXXS,color:d.v2.colors.blue[200],children:"A policy with no conditions falls back to the count-only default."})]}),e(Lk,{children:[f?t(j,{"data-id":"learning-policy-delete",label:"Delete override",rightIcon:vs,variant:K.Text,size:W.M,textColor:d.v2.colors.red[400],onClick:async()=>{if(c){b(!0);try{await c()}finally{b(!1)}}},disabled:m||h}):t(Mk,{"data-id":"learning-policy-add-override",label:"Add override",rightIcon:ys,variant:K.Secondary,size:W.M,onClick:r}),t(Mk,{"data-id":"learning-policy-save",label:"Save Changes",variant:K.Primary,size:W.M,onClick:async()=>{g(!0);try{await s(Bk(p))}finally{g(!1)}},disabled:h||m})]})]})]})},Vk=f(T)`
|
|
1722
1803
|
flex: 1;
|
|
1723
1804
|
min-height: 0;
|
|
1724
1805
|
width: 100%;
|
|
1725
1806
|
align-items: stretch;
|
|
1726
|
-
`,
|
|
1807
|
+
`,Gk=f.div`
|
|
1727
1808
|
flex: 1;
|
|
1728
1809
|
min-width: 0;
|
|
1729
1810
|
height: 100%;
|
|
1730
1811
|
overflow: hidden;
|
|
1731
|
-
`,
|
|
1812
|
+
`,Hk=()=>{const i=nC(eC.Learning),{insightsApi:n}=Lc(),{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,v]=l(null),y=a(()=>Array.isArray(d.data)?d.data:[],[d.data]),S=a(()=>Array.isArray(p.data)?p.data:[],[p.data]),x=a(()=>((e,t)=>{if(!t.length)return e;const i=new Map(t.map(e=>[String(e.id),e]));return e.map(e=>{if(e.scope!==xl.Transaction)return e;const t=i.get(e.scopeKey);return t?{...e,name:`${Kw[e.class]} · ${cS(t)}`}:e})})(u.map(pk),S),[u,S]),T=a(()=>(e=>{const t=new Map(Uw.map((e,t)=>[e,t]));return[...e].sort((e,i)=>(t.get(e.class)??99)-(t.get(i.class)??99))})(x.filter(Bw)),[x]),I=a(()=>x.filter(e=>!Bw(e)),[x]),$=a(()=>[...T,...I],[T,I]);o(()=>{h||($.length?b(e=>e&&$.some(t=>t.id===e)?e:$[0].id):b(null))},[$,h]);const N=a(()=>$.find(e=>e.id===m)??null,[$,m]),A=a(()=>h?$.find(e=>e.id===f)??T[0]??null:N??T[0]??null,[h,f,$,N,T]),O=a(()=>I.map(e=>({class:e.class,scopeKey:e.scopeKey})),[I]),E=()=>{v(m??T[0]?.id??null),g(!0),b(null)};return t(iw,{icon:i?.panelIcon,title:"Learning Policies",count:$.length,description:i?.panelDescription||Vw,children:!s||$.length||h?e(Vk,{children:[t(wk,{defaultPolicies:T,overridePolicies:I,selectedId:h?null:m,onSelect:e=>{g(!1),v(null),b(e)},onAddOverride:E}),t(Gk,{children:h?t(JC,{services:y,transactions:S,existingOverrides:O,initialClass:A?.class,onSubmit:async e=>{if(!n.upsertLearningPolicy)return;const t=T.find(t=>t.class===e.class)??$.find(t=>t.class===e.class&&Bw(t))??(e=>{const t=[dk()],i=wl.Any;return{id:ek(xl.Global,"",e),name:Kw[e],class:e,mode:i,conditions:t,minMatches:null,scope:xl.Global,scopeKey:"",summary:rk(i,t,null)}})(e.class),i=I.find(t=>t.class===e.class&&t.scope===e.scope&&t.scopeKey===e.scopeKey);if(i)return g(!1),void b(i.id);const a=(({scope:e,scopeKey:t,source:i,displayName:n})=>{const a=i.conditions.map(e=>({...e,key:QC()})),o=n||t;return{id:ek(e,t,i.class),name:`${Kw[i.class]} · ${o}`,class:i.class,mode:i.mode,conditions:a,minMatches:i.minMatches,scope:e,scopeKey:t,summary:rk(i.mode,a,i.minMatches)}})({scope:e.scope,scopeKey:e.scopeKey,source:{...t,class:e.class},displayName:e.name}),o=await n.upsertLearningPolicy(uk(a));o&&!o.error&&(await c(),g(!1),v(null),b(o.data?pk(o.data).id:a.id))}}):N?t(Uk,{policy:N,onAddOverride:E,onSave:async e=>{if(!n.upsertLearningPolicy)return;const t=await n.upsertLearningPolicy(uk(e));t&&!t.error&&await c()},onDelete:Bw(N)?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))})(N)},N.id):t(Me,{$height:"100%",children:t(w,{size:C.XS,color:k.Secondary,children:"Select a policy"})})})]}):t(Me,{$height:"100%",children:t(Ve,{withSpinner:!0})})})};var jk,Wk;(e=>{e.Global="global",e.Service="service",e.Transaction="transaction"})(jk||(jk={})),(e=>{e.Low="low",e.Medium="medium",e.High="high",e.Critical="critical"})(Wk||(Wk={}));const Kk=e=>e.scope===jk.Global,Yk=f($)`
|
|
1732
1813
|
flex: 1;
|
|
1733
1814
|
min-width: 0;
|
|
1734
1815
|
height: 100%;
|
|
@@ -1737,35 +1818,35 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
1737
1818
|
overflow: hidden;
|
|
1738
1819
|
border-radius: 16px 0 16px 0;
|
|
1739
1820
|
background-color: ${({theme:e})=>e.v2.colors.silver[900]};
|
|
1740
|
-
`,
|
|
1821
|
+
`,qk=f($)`
|
|
1741
1822
|
width: 100%;
|
|
1742
1823
|
gap: 4px;
|
|
1743
|
-
`,
|
|
1824
|
+
`,Jk=f(w)`
|
|
1744
1825
|
white-space: pre-line;
|
|
1745
|
-
`,
|
|
1826
|
+
`,Zk=f($)`
|
|
1746
1827
|
width: 100%;
|
|
1747
1828
|
gap: 32px;
|
|
1748
1829
|
padding: 12px;
|
|
1749
1830
|
border-radius: 16px;
|
|
1750
1831
|
background-color: ${({theme:e})=>e.v2.colors.silver[1e3]};
|
|
1751
|
-
`,
|
|
1832
|
+
`,Qk=f(T)`
|
|
1752
1833
|
width: 100%;
|
|
1753
1834
|
align-items: flex-end;
|
|
1754
1835
|
justify-content: center;
|
|
1755
1836
|
gap: 16px;
|
|
1756
1837
|
padding: 0 12px;
|
|
1757
1838
|
flex-wrap: wrap;
|
|
1758
|
-
`,
|
|
1839
|
+
`,eT=f($)`
|
|
1759
1840
|
gap: 4px;
|
|
1760
|
-
`,
|
|
1841
|
+
`,tT=f(eT)`
|
|
1761
1842
|
width: 319px;
|
|
1762
1843
|
max-width: 100%;
|
|
1763
|
-
`,
|
|
1844
|
+
`,iT=f(T)`
|
|
1764
1845
|
width: 100%;
|
|
1765
1846
|
justify-content: center;
|
|
1766
|
-
|
|
1847
|
+
`,nT=f(j)`
|
|
1767
1848
|
min-width: 271px;
|
|
1768
|
-
`,
|
|
1849
|
+
`,aT=(e,t)=>`${e}/${t}`,oT=e=>cS(e),lT=({services:i,transactions:n,existingScopeKeys:r,onSubmit:s})=>{const c=v(),[d,p]=l(jk.Service),[u,h]=l(""),[g,m]=l(!1),b=a(()=>{const e=new Set,t=[];for(const n of i){if(!n.namespace||!n.service)continue;const i=aT(n.namespace,n.service);e.has(i)||(e.add(i),t.push({id:i,label:i}))}return t.sort((e,t)=>e.label.localeCompare(t.label))},[i]),f=a(()=>n.filter(e=>!!e.id).map(e=>({id:e.id,label:oT(e)})).sort((e,t)=>e.label.localeCompare(t.label)),[n]),y=d===jk.Service?b:f,S=d===jk.Service?"Select Service":"Select Transaction",x=d===jk.Service?"Select service…":"Select transaction…";o(()=>{const e=y.find(e=>!r.includes(e.id))?.id||y[0]?.id||"";h(t=>t&&y.some(e=>e.id===t)?t:e)},[y,r]);const T=!!u&&!g;return e(Yk,{"data-id":"detection-create-override-panel",children:[e(qk,{children:[t(w,{size:C.S,children:"Choose override scope"}),t(Jk,{size:C.XXS,color:k.Secondary,children:"Select where this policy should override the global detection settings.\nYou can apply it to a specific service or transaction."})]}),e(Zk,{children:[e(Qk,{children:[e(eT,{children:[t(w,{size:C.XS,color:k.Secondary,children:"Choose Override type"}),t(F,{"data-id":"detection-override-type",size:rt.L,selected:d,setSelected:e=>p(e),options:[{value:jk.Service,label:aw,selectedBgColor:c.v2.colors.purple[500],selectedBorderColor:c.v2.colors.purple[500]},{value:jk.Transaction,label:ow,selectedBgColor:c.v2.colors.purple[500],selectedBorderColor:c.v2.colors.purple[500]}]})]}),t(tT,{children:t(Fe,{"data-id":"detection-override-target",label:S,options:y,values:u?[u]:[],setValues:e=>h(e[0]||""),placeholder:x,withSearch:!0,disabled:!y.length})})]}),t(iT,{children:t(nT,{"data-id":"detection-add-selection",label:"Add selection",rightIcon:ys,variant:K.Primary,size:W.M,disabled:!T,onClick:async()=>{if(!T)return;const e=y.find(e=>e.id===u);m(!0);try{await s({scope:d,scopeKey:u,name:e?.label||u})}finally{m(!1)}}})})]})]})},rT=[{id:Wk.Low,label:"Low"},{id:Wk.Medium,label:lw},{id:Wk.High,label:rw},{id:Wk.Critical,label:sw}],sT={[Wk.Low]:20,[Wk.Medium]:40,[Wk.High]:60,[Wk.Critical]:75},cT={[Wk.Low]:"Low",[Wk.Medium]:lw,[Wk.High]:rw,[Wk.Critical]:sw},dT=e=>{let t=Wk.Medium,i=Number.POSITIVE_INFINITY;for(const[n,a]of Object.entries(sT)){const o=Math.abs(a-e);o<i&&(t=n,i=o)}return t},pT=e=>`Triggers at ${cT[e]} risk or higher`,uT=e=>{const t=(e=>{switch(e){case jk.Global:return jk.Global;case jk.Transaction:return jk.Transaction;case jk.Service:default:return jk.Service}})(e.scope),i=dT(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===jk.Global?pT(i):cw(e.fireAtScore,n),fireAtScore:e.fireAtScore,riskLevel:i,signalWeightOverrideCount:n,signalWeights:e.signalWeights??null,enricherLists:e.enricherLists??null}},hT=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}),gT=[{id:"global-default",name:"Global default",scope:jk.Global,scopeKey:"",enabled:!0,summary:"Triggers at Medium risk or higher",fireAtScore:20,riskLevel:Wk.Low,signalWeightOverrideCount:1}],mT=[],bT=f.button`
|
|
1769
1850
|
display: flex;
|
|
1770
1851
|
align-items: center;
|
|
1771
1852
|
justify-content: space-between;
|
|
@@ -1781,29 +1862,29 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
1781
1862
|
&:hover {
|
|
1782
1863
|
background-color: ${({theme:e,$isSelected:t})=>t?e.v2.colors.silver[800]:e.v2.colors.silver[900]};
|
|
1783
1864
|
}
|
|
1784
|
-
`,
|
|
1865
|
+
`,fT=f($)`
|
|
1785
1866
|
flex: 1;
|
|
1786
1867
|
min-width: 0;
|
|
1787
|
-
`,
|
|
1868
|
+
`,vT=f(T)`
|
|
1788
1869
|
flex-wrap: wrap;
|
|
1789
1870
|
align-items: center;
|
|
1790
1871
|
gap: 4px;
|
|
1791
|
-
`,
|
|
1872
|
+
`,yT=({policy:i,isSelected:n,onSelect:a})=>{const o=v(),l=(e=>{switch(e){case jk.Global:return{label:nw,status:ie.Warning};case jk.Service:return{label:aw,status:ie.Info};case jk.Transaction:return{label:ow,status:ie.Info}}})(i.scope);return e(bT,{type:"button","data-id":`detection-policy-item-${i.id}`,$isSelected:n,onClick:()=>a(i.id),children:[e(fT,{$gap:4,children:[e(vT,{children:[t(w,{size:C.XXS,nowrap:!0,children:i.name}),t(E,{label:l.label,status:l.status,invertColors:!0}),t(E,{label:i.enabled?De:Re,status:i.enabled?ie.Success:ie.Error,invertColors:!0,backgroundColor:o.v2.colors.silver[750],textColor:i.enabled?o.v2.colors.green[400]:o.v2.colors.red[400]})]}),t(w,{size:C.XXXS,color:k.Secondary,nowrap:!0,children:i.summary})]}),t(bs,{size:18})]})},ST=f($)`
|
|
1792
1873
|
width: 320px;
|
|
1793
1874
|
flex-shrink: 0;
|
|
1794
1875
|
height: 100%;
|
|
1795
1876
|
gap: 16px;
|
|
1796
1877
|
padding: 8px 12px 12px 12px;
|
|
1797
1878
|
overflow-y: auto;
|
|
1798
|
-
`,
|
|
1879
|
+
`,xT=f($)`
|
|
1799
1880
|
width: 100%;
|
|
1800
1881
|
gap: 8px;
|
|
1801
|
-
`,
|
|
1882
|
+
`,wT=f(T)`
|
|
1802
1883
|
width: 100%;
|
|
1803
1884
|
align-items: center;
|
|
1804
1885
|
gap: 4px;
|
|
1805
1886
|
padding: 8px 12px 4px 8px;
|
|
1806
|
-
`,
|
|
1887
|
+
`,CT=f($)`
|
|
1807
1888
|
width: 100%;
|
|
1808
1889
|
min-height: 60px;
|
|
1809
1890
|
align-items: stretch;
|
|
@@ -1812,7 +1893,7 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
1812
1893
|
padding: 12px 8px;
|
|
1813
1894
|
border-radius: 12px;
|
|
1814
1895
|
text-align: center;
|
|
1815
|
-
`,
|
|
1896
|
+
`,kT=f(j)`
|
|
1816
1897
|
&&:enabled {
|
|
1817
1898
|
background-color: ${({theme:e})=>e.v2.colors.purple[900]};
|
|
1818
1899
|
|
|
@@ -1824,66 +1905,66 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
1824
1905
|
background-color: ${({theme:e})=>e.v2.colors.purple[700]};
|
|
1825
1906
|
}
|
|
1826
1907
|
}
|
|
1827
|
-
`,
|
|
1908
|
+
`,TT=({defaultPolicies:i,overridePolicies:n,selectedId:a,onSelect:o,onAddOverride:l})=>{const r=v();return e(ST,{"data-id":"detection-policies-menu",children:[e(xT,{children:[e(wT,{children:[t(w,{size:C.XXS,color:r.v2.colors.purple[300],children:"Default Policy"}),t(E,{label:i.length})]}),i.map(e=>t(yT,{policy:e,isSelected:a===e.id,onSelect:o},e.id))]}),e(xT,{children:[e(wT,{children:[t(w,{size:C.XXS,color:r.v2.colors.purple[300],children:"Overrides"}),t(E,{label:n.length})]}),0===n.length?e(CT,{children:[t(w,{size:C.XXS,color:k.Secondary,align:"center",children:"No overrides yet"}),t(w,{size:C.XXXS,color:k.Disable,align:"center",children:"Add overrides to adjust detection sensitivity for specific services."})]}):n.map(e=>t(yT,{policy:e,isSelected:a===e.id,onSelect:o},e.id)),t(kT,{"data-id":"detection-add-override-policy",label:"Add override policy",rightIcon:ys,variant:K.Primary,size:W.M,fullWidth:!0,textColor:r.v2.colors.purple[300],onClick:l})]})]})},IT=[{severity:rl.Critical,minScore:75},{severity:rl.High,minScore:50},{severity:rl.Medium,minScore:35},{severity:rl.Low,minScore:20},{severity:rl.Info,minScore:0}],$T={[rl.Info]:"Info",[rl.Low]:"Low",[rl.Medium]:"Medium",[rl.High]:"High",[rl.Critical]:"Critical"},NT=(e,t=IT)=>{const i=[...t].sort((e,t)=>t.minScore-e.minScore);for(const t of i)if(e>=t.minScore)return t.severity;return rl.Info},AT=e=>e.join(", "),OT=e=>e.split(/[\n,]+/).map(e=>e.trim()).filter(Boolean),ET=(e,t)=>e.length===t.length&&e.every((e,i)=>e===t[i]),DT=(e,t)=>e.enrichers.filter(e=>e.parentClass===t),RT=e=>{const t=Object.values(bl);return[...e.deviationClasses].sort((e,i)=>{const n=t.indexOf(e.id),a=t.indexOf(i.id);return-1===n&&-1===a?e.id.localeCompare(i.id):-1===n?1:-1===a?-1:n-a})},zT=f($)`
|
|
1828
1909
|
width: 100%;
|
|
1829
1910
|
gap: 12px;
|
|
1830
1911
|
padding: 0 4px 8px 4px;
|
|
1831
|
-
`,
|
|
1912
|
+
`,XT=f(w)`
|
|
1832
1913
|
white-space: pre-line;
|
|
1833
|
-
`,
|
|
1914
|
+
`,PT=f($)`
|
|
1834
1915
|
width: 100%;
|
|
1835
1916
|
gap: 12px;
|
|
1836
1917
|
padding: 12px;
|
|
1837
1918
|
border-radius: 12px;
|
|
1838
1919
|
background-color: ${({theme:e})=>e.v2.colors.silver[1e3]};
|
|
1839
|
-
`,
|
|
1920
|
+
`,LT=f(T)`
|
|
1840
1921
|
width: 100%;
|
|
1841
1922
|
align-items: center;
|
|
1842
1923
|
gap: 8px;
|
|
1843
1924
|
flex-wrap: wrap;
|
|
1844
|
-
`,
|
|
1925
|
+
`,MT=f(T)`
|
|
1845
1926
|
width: 100%;
|
|
1846
1927
|
align-items: center;
|
|
1847
1928
|
gap: 8px;
|
|
1848
1929
|
flex-wrap: wrap;
|
|
1849
|
-
`,
|
|
1930
|
+
`,_T=f(T)`
|
|
1850
1931
|
align-items: center;
|
|
1851
1932
|
gap: 8px;
|
|
1852
|
-
`,
|
|
1933
|
+
`,FT=f($)`
|
|
1853
1934
|
width: 100%;
|
|
1854
1935
|
gap: 16px;
|
|
1855
1936
|
padding: 8px 12px;
|
|
1856
1937
|
border-radius: 8px;
|
|
1857
1938
|
border-left: 2px solid ${({theme:e})=>e.v2.colors.purple[400]};
|
|
1858
1939
|
background-color: ${({theme:e})=>e.v2.colors.silver[1e3]};
|
|
1859
|
-
`,
|
|
1940
|
+
`,BT=f($)`
|
|
1860
1941
|
width: 100%;
|
|
1861
1942
|
gap: 8px;
|
|
1862
1943
|
padding: 8px 12px;
|
|
1863
1944
|
border-radius: 12px;
|
|
1864
1945
|
border: 1px solid ${({theme:e})=>e.v2.colors.silver[700]};
|
|
1865
|
-
`,
|
|
1946
|
+
`,UT=f(T)`
|
|
1866
1947
|
align-items: center;
|
|
1867
1948
|
gap: 8px;
|
|
1868
|
-
`,
|
|
1949
|
+
`,VT=({label:i,source:n,value:a,tooltip:o,onChange:l})=>{const r=v(),s=NT(a),c=((e,t)=>{switch(e){case rl.Info:return{backgroundColor:t.v2.colors.blue[900],textColor:t.v2.colors.white[500]};case rl.Low:return{backgroundColor:t.v2.colors.green[900],textColor:t.v2.colors.white[500]};case rl.Medium:return{backgroundColor:t.v2.colors.yellow[550],textColor:t.v2.colors.black[500]};case rl.High:return{backgroundColor:t.v2.colors.orange[500],textColor:t.v2.colors.white[500]};case rl.Critical:return{backgroundColor:t.v2.colors.red[800],textColor:t.v2.colors.white[500]}}})(s,r);return e(MT,{children:[e(UT,{children:[t(w,{size:C.XS,children:i}),o?t(ce,{text:o,withIcon:!0}):null]}),t(Y,{"data-id":`detection-weight-${n}`,type:st.Number,value:String(a),onChange:e=>{const t=Number(e.target.value);Number.isFinite(t)&&l(n,Math.max(0,Math.min(100,Math.round(t))))},width:"79px",small:!0,min:0,max:100}),e(_T,{children:[e(w,{size:C.XXXS,color:k.Secondary,children:["Risk points"," ",a]}),t(E,{label:$T[s],backgroundColor:c.backgroundColor,textColor:c.textColor})]})]})},GT=({enricher:n,weight:a,listText:o,onWeightChange:l,onListChange:r})=>e(BT,{children:[t(VT,{label:n.label,source:n.source,value:a,tooltip:n.description,onChange:l}),n.list?e(i,{children:[t(ee,{"data-id":`detection-list-${n.list.key}`,label:n.list.label,value:o,onChange:e=>r(n.list.key,e.target.value),minHeight:64}),n.list.hint?t(w,{size:C.XXXS,color:k.Secondary,children:n.list.hint}):null]}):null]}),HT=({catalog:i,signalWeights:n,enricherLists:o,onChange:r})=>{const s=v(),c=a(()=>RT(i),[i]),[d,p]=l(()=>((e,t)=>{const i=(e=>{if(!e)return{};try{const t=JSON.parse(e);if(!t||"object"!=typeof t||Array.isArray(t))return{};const i={};for(const[e,n]of Object.entries(t)){const t="number"==typeof n?n:Number(n);Number.isFinite(t)&&(i[e]=Math.max(0,Math.min(100,Math.round(t))))}return i}catch{return{}}})(t),n={};for(const t of e.deviationClasses)n[t.id]=i[t.id]??t.weight;for(const t of e.enrichers)n[t.source]=i[t.source]??t.weight;return n})(i,n)),[u,h]=l(()=>{const e=((e,t)=>{const i=(e=>{if(!e)return{};try{const t=JSON.parse(e);if(!t||"object"!=typeof t||Array.isArray(t))return{};const i={};for(const[e,n]of Object.entries(t))Array.isArray(n)&&(i[e]=n.map(String).map(e=>e.trim()).filter(Boolean));return i}catch{return{}}})(t),n={};for(const t of e.enrichers)t.list&&(n[t.list.key]=i[t.list.key]??t.list.default??[]);return n})(i,o);return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,AT(t)]))}),g=(e,t)=>{const n=Object.fromEntries(Object.entries(t).map(([e,t])=>[e,OT(t)])),a=((e,t)=>{const i={};for(const n of e.deviationClasses){const e=t[n.id];void 0!==e&&e!==n.weight&&(i[n.id]=e)}for(const n of e.enrichers){const e=t[n.source];void 0!==e&&e!==n.weight&&(i[n.source]=e)}return Object.keys(i).length?JSON.stringify(i):null})(i,e),o=((e,t)=>{const i={};for(const n of e.enrichers){if(!n.list)continue;const e=n.list.key,a=t[e]??n.list.default??[],o=n.list.default??[];ET(a,o)||(i[e]=a)}return Object.keys(i).length?JSON.stringify(i):null})(i,n);r({signalWeights:a,enricherLists:o,overrideCount:a?Object.keys(JSON.parse(a)).length:0})},m=(e,t)=>{const i={...d,[e]:t};p(i),g(i,u)},b=(e,t)=>{const i={...u,[e]:t};h(i),g(d,i)};return e(zT,{"data-id":"detection-signal-weights-panel",children:[t(XT,{size:C.XXXS,color:k.Secondary,children:"Every detected signal adds its weight (points) to a 0–100 risk score; the policy fires when the total reaches the threshold above. Sub-cases add on top of the base. Set any weight to 0 to mute that signal for this scope."}),c.map(n=>{const a=DT(i,n.id);return e(PT,{"data-id":`detection-signal-card-${n.id}`,children:[e($,{$gap:4,children:[e(LT,{children:[t(w,{size:C.XS,children:n.label}),t(w,{size:C.XXXS,color:k.Secondary,children:n.id}),t(E,{label:n.categoryLabel||n.category,backgroundColor:s.v2.colors.silver[750]})]}),n.description?t(w,{size:C.XXXS,color:k.Secondary,children:n.description}):null]}),t(VT,{label:"Base weight",source:n.id,value:d[n.id]??n.weight,onChange:m}),a.length>0?e(FT,{children:[t(w,{size:C.XXXS,color:s.v2.colors.purple[300],children:"Dangerous sub-cases - added on top of the base when detected:"}),a.map(e=>t(GT,{enricher:e,weight:d[e.source]??e.weight,listText:u[e.list?.key||""]??AT(e.list?.default??[]),onWeightChange:m,onListChange:b},e.source))]}):null]},n.id)})]})},jT=e=>`A trace whose signals span two or more kill-chain categories gets a +${e} correlation bonus on top of the summed weights — coordinated behavior across stages is riskier than any single novelty on its own.`,WT=(e,t)=>{const i=NT(e.weight,t);return{id:e.id,signal:e.label,source:e.id,weight:e.weight,weightLabel:String(e.weight),band:i,bandLabel:$T[i],category:e.categoryLabel||e.category,description:e.description||"",isSubCase:!1}},KT=(e,t,i)=>{const n=Math.min(100,t+e.weight),a=NT(n,i);return{id:e.source,signal:e.label,source:e.source,weight:e.weight,weightLabel:`${t} + ${e.weight} = ${n}`,band:a,bandLabel:$T[a],category:"",description:e.description||"",isSubCase:!0}},YT=f($)`
|
|
1869
1950
|
width: 100%;
|
|
1870
1951
|
gap: 24px;
|
|
1871
1952
|
padding: 0 2px 24px;
|
|
1872
|
-
`,
|
|
1953
|
+
`,qT=f(w)`
|
|
1873
1954
|
max-width: 820px;
|
|
1874
1955
|
line-height: 1.45;
|
|
1875
|
-
`,
|
|
1956
|
+
`,JT=f(T)`
|
|
1876
1957
|
flex-wrap: wrap;
|
|
1877
1958
|
align-items: center;
|
|
1878
1959
|
gap: 6px;
|
|
1879
|
-
`,
|
|
1960
|
+
`,ZT=f($)`
|
|
1880
1961
|
width: 100%;
|
|
1881
1962
|
gap: 10px;
|
|
1882
1963
|
padding: 14px 16px;
|
|
1883
1964
|
border-radius: 10px;
|
|
1884
1965
|
border: 1px solid ${({theme:e})=>e.v2.colors.silver[700]};
|
|
1885
1966
|
background-color: ${({theme:e})=>e.v2.colors.silver[1e3]};
|
|
1886
|
-
`,
|
|
1967
|
+
`,QT=f.div`
|
|
1887
1968
|
width: fit-content;
|
|
1888
1969
|
max-width: 100%;
|
|
1889
1970
|
padding: 8px 10px;
|
|
@@ -1894,25 +1975,25 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
1894
1975
|
font-size: 12px;
|
|
1895
1976
|
font-weight: 500;
|
|
1896
1977
|
line-height: 1.4;
|
|
1897
|
-
`,
|
|
1978
|
+
`,eI=f($)`
|
|
1898
1979
|
gap: 3px;
|
|
1899
|
-
`,
|
|
1980
|
+
`,tI=f(T)`
|
|
1900
1981
|
align-items: center;
|
|
1901
1982
|
flex-wrap: wrap;
|
|
1902
1983
|
gap: 6px;
|
|
1903
1984
|
font-variant-numeric: tabular-nums;
|
|
1904
|
-
`,
|
|
1985
|
+
`,iI=f.div`
|
|
1905
1986
|
width: 100%;
|
|
1906
1987
|
overflow: auto;
|
|
1907
1988
|
max-height: calc(100vh - 280px);
|
|
1908
1989
|
border-radius: 10px;
|
|
1909
1990
|
border: 1px solid ${({theme:e})=>e.v2.colors.silver[700]};
|
|
1910
|
-
|
|
1991
|
+
`,nI=f.table`
|
|
1911
1992
|
width: 100%;
|
|
1912
1993
|
min-width: 760px;
|
|
1913
1994
|
border-collapse: collapse;
|
|
1914
1995
|
table-layout: fixed;
|
|
1915
|
-
`,
|
|
1996
|
+
`,aI=f.th`
|
|
1916
1997
|
position: sticky;
|
|
1917
1998
|
top: 0;
|
|
1918
1999
|
z-index: 1;
|
|
@@ -1922,14 +2003,14 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
1922
2003
|
border-bottom: 1px solid ${({theme:e})=>e.v2.colors.silver[700]};
|
|
1923
2004
|
background-color: ${({theme:e})=>e.v2.colors.silver[900]};
|
|
1924
2005
|
white-space: nowrap;
|
|
1925
|
-
`,
|
|
2006
|
+
`,oI=f.tr`
|
|
1926
2007
|
background-color: ${({theme:e,$sub:t})=>t?e.v2.colors.silver[1e3]:"transparent"};
|
|
1927
2008
|
transition: background-color 0.12s ease;
|
|
1928
2009
|
|
|
1929
2010
|
&:hover {
|
|
1930
2011
|
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
1931
2012
|
}
|
|
1932
|
-
`,
|
|
2013
|
+
`,lI=f.td`
|
|
1933
2014
|
padding: 14px;
|
|
1934
2015
|
vertical-align: middle;
|
|
1935
2016
|
border-bottom: 1px solid ${({theme:e})=>e.v2.colors.silver[800]};
|
|
@@ -1938,27 +2019,27 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
1938
2019
|
tr:last-child > & {
|
|
1939
2020
|
border-bottom: none;
|
|
1940
2021
|
}
|
|
1941
|
-
`,
|
|
2022
|
+
`,rI=f(lI)`
|
|
1942
2023
|
padding-left: ${({$sub:e})=>e?"32px":"14px"};
|
|
1943
2024
|
position: relative;
|
|
1944
2025
|
|
|
1945
2026
|
${({$sub:e,theme:t})=>e&&`\n &::before {\n content: '•';\n position: absolute;\n left: 18px;\n top: 50%;\n transform: translateY(-50%);\n line-height: 1;\n color: ${t.v2.colors.silver[300]};\n }\n `}
|
|
1946
|
-
`,
|
|
2027
|
+
`,sI=f.code`
|
|
1947
2028
|
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
|
|
1948
2029
|
font-size: 10.5px;
|
|
1949
2030
|
line-height: 1.35;
|
|
1950
2031
|
color: ${({theme:e})=>e.v2.colors.silver[200]};
|
|
1951
|
-
`,
|
|
2032
|
+
`,cI=f(w)`
|
|
1952
2033
|
font-variant-numeric: tabular-nums;
|
|
1953
2034
|
white-space: nowrap;
|
|
1954
|
-
`,
|
|
2035
|
+
`,dI=f($)`
|
|
1955
2036
|
width: 100%;
|
|
1956
2037
|
gap: 6px;
|
|
1957
2038
|
padding: 14px 16px;
|
|
1958
2039
|
border-radius: 10px;
|
|
1959
2040
|
border: 1px solid ${({theme:e})=>e.v2.colors.silver[700]};
|
|
1960
2041
|
background-color: ${({theme:e})=>e.v2.colors.silver[1e3]};
|
|
1961
|
-
`,LT=(e,t)=>{switch(e){case rl.Info:return{backgroundColor:t.v2.colors.blue[900],textColor:t.v2.colors.white[500]};case rl.Low:return{backgroundColor:t.v2.colors.green[900],textColor:t.v2.colors.white[500]};case rl.Medium:return{backgroundColor:t.v2.colors.yellow[550],textColor:t.v2.colors.black[500]};case rl.High:return{backgroundColor:t.v2.colors.orange[500],textColor:t.v2.colors.white[500]};case rl.Critical:return{backgroundColor:t.v2.colors.red[800],textColor:t.v2.colors.white[500]}}},XT=({isOpen:i,onClose:n,catalog:a})=>{const o=v(),l=(e=>{const t=e.severityBands?.length?e.severityBands:void 0,i=[];for(const n of nT(e)){i.push(fT(n,t));for(const a of iT(e,n.id))i.push(vT(a,n.weight,t))}return i})(a),r=(e=>{const t=e.severityBands?.length?e.severityBands:void 0,i=[...e.enrichers].sort((e,t)=>t.weight-e.weight)[0],n=i?e.deviationClasses.find(e=>e.id===i.parentClass):void 0;if(!n||!i)return null;const a=Math.min(100,n.weight+i.weight),o=Zk(a,t);return{baseLabel:n.label,baseScore:n.weight,modifierLabel:i.label,modifierWeight:i.weight,finalScore:a,finalBand:o,finalBandLabel:qk[o]}})(a),s=(e=>[...e.severityBands?.length?e.severityBands:[]].filter(e=>e.severity!==rl.Info).sort((e,t)=>e.minScore-t.minScore).map(e=>({severity:e.severity,label:qk[e.severity],minScore:e.minScore})))(a),c=a.correlationBonus??15,d=r?LT(r.finalBand,o):null;return t(ct,{isOpen:i,width:"960px",minWidth:"720px",header:{icon:kc,title:"Risk model",onClose:n},children:e(yT,{"data-id":"insights-risk-model-drawer",children:[e($,{$gap:6,children:[t(ST,{size:C.XXXS,color:k.Secondary,children:"The default risk model every anomaly policy builds on. Each signal adds its weight (points) to a 0–100 risk score; dangerous sub-cases add on top of a class’s base novelty. Read-only reference — tune the weights per scope in this Detection policy."}),s.length?e(xT,{children:[t(w,{size:C.XXXS,color:k.Secondary,children:"A signal alone lands at"}),s.map(e=>{const i=LT(e.severity,o);return t(E,{label:`${e.label.toLowerCase()} ${e.minScore}`,backgroundColor:i.backgroundColor,textColor:i.textColor},e.label)})]}):null]}),e(wT,{children:[t(w,{size:C.XXS,children:"How scoring works"}),t(CT,{children:"Base signal + modifiers + cross-category bonus = final risk score"}),e(kT,{children:[t(w,{size:C.XXXS,color:k.Secondary,children:"Modifiers are not independent signals. They are added only when their parent base signal occurs."}),t(w,{size:C.XXXS,color:k.Secondary,children:(p=c,`Signals spanning two or more kill-chain categories receive a +${p} correlation bonus. The final risk score is capped at 100.`)})]}),r&&d?e(TT,{children:[t(w,{size:C.XXXS,children:`${r.baseLabel} ${r.baseScore}`}),t(w,{size:C.XXXS,color:k.Secondary,children:"+"}),t(w,{size:C.XXXS,children:`${r.modifierLabel} ${r.modifierWeight}`}),t(w,{size:C.XXXS,color:k.Secondary,children:"="}),t(E,{label:`${r.finalScore} · ${r.finalBandLabel}`,backgroundColor:d.backgroundColor,textColor:d.textColor})]}):null]}),t(IT,{children:e($T,{children:[t("thead",{children:e("tr",{children:[t(AT,{style:{width:"17%"},children:t(w,{size:C.XXXS,color:k.Secondary,children:"Signal"})}),t(AT,{style:{width:"15%"},children:t(w,{size:C.XXXS,color:k.Secondary,children:"Class / source"})}),t(AT,{style:{width:"13%"},children:t(w,{size:C.XXXS,color:k.Secondary,children:"Weight"})}),t(AT,{style:{width:"9%"},children:t(w,{size:C.XXXS,color:k.Secondary,children:"Band"})}),t(AT,{style:{width:"13%"},children:t(w,{size:C.XXXS,color:k.Secondary,children:"Category"})}),t(AT,{style:{width:"33%"},children:t(w,{size:C.XXXS,color:k.Secondary,children:"What it means"})})]})}),t("tbody",{children:l.map(i=>{const n=LT(i.band,o);return e(NT,{"data-id":`risk-model-row-${i.id}`,$sub:i.isSubCase,children:[t(ET,{$sub:i.isSubCase,children:t(w,{size:C.XXXS,children:i.isSubCase?i.signal:t("strong",{children:i.signal})})}),t(OT,{children:t(DT,{children:i.source})}),t(OT,{children:t(RT,{size:C.XXXS,children:i.weightLabel})}),t(OT,{children:t(E,{label:i.bandLabel.toLowerCase(),backgroundColor:n.backgroundColor,textColor:n.textColor})}),t(OT,{children:t(w,{size:C.XXXS,color:k.Secondary,children:i.isSubCase?"Modifier":i.category})}),t(OT,{children:t(w,{size:C.XXXS,color:k.Secondary,children:i.description})})]},i.id)})})]})}),e(zT,{children:[t(w,{size:C.XXS,children:"Cross-class correlation"}),t(w,{size:C.XXXS,color:k.Secondary,children:bT(c)})]})]})});var p},PT={deviationClasses:[{id:Sl.D1_call_edges,label:"New call edge",description:"A service→service call path not seen during learning.",category:"lateral_movement",categoryLabel:"Lateral movement",weight:20,mitre:"TA0008",owasp:null},{id:Sl.D2_egress,label:"New egress destination",description:"An outbound destination (host/port) not seen during learning.",category:"exfiltration",categoryLabel:"Exfiltration",weight:35,mitre:"TA0010",owasp:null},{id:Sl.D3_latency,label:"Latency above baseline",description:"Request latency well above the learned p99.",category:"resource_abuse",categoryLabel:"Resource abuse",weight:10,mitre:"T1499",owasp:null},{id:Sl.D4_args_returns,label:"Argument / return anomaly",description:"Arguments or return values outside the learned shape.",category:"injection",categoryLabel:"Injection",weight:40,mitre:"T1190",owasp:"A03"},{id:Sl.D5_libraries,label:"New instrumentation library",description:"An instrumentation library/runtime not seen during learning.",category:"supply_chain",categoryLabel:"Supply chain",weight:30,mitre:"T1195",owasp:"A06"},{id:Sl.D6_attr_relations,label:"Attribute-relation anomaly",description:"Span attribute relationships outside the learned pattern.",category:"access_anomaly",categoryLabel:"Access anomaly",weight:35,mitre:"TA0004",owasp:"A01"},{id:Sl.D7_db_access,label:"New database access",description:"A database table/operation not accessed during learning.",category:"lateral_movement",categoryLabel:"Lateral movement",weight:25,mitre:"TA0008",owasp:null},{id:Sl.D8_payload_size,label:"Payload size above baseline",description:"Request/response payload larger than the learned baseline.",category:"resource_abuse",categoryLabel:"Resource abuse",weight:20,mitre:"T1499",owasp:null}],enrichers:[{source:"d1_edge_fanout",parentClass:Sl.D1_call_edges,category:"lateral_movement",weight:30,label:"Call fan-out",description:"One request reached many new services at once — possible lateral movement / enumeration."},{source:"d2_metadata_endpoint",parentClass:Sl.D2_egress,category:"exfiltration",weight:50,label:"Cloud metadata endpoint",description:"New egress to a cloud metadata address (e.g. 169.254.169.254) — a hallmark of SSRF / credential theft.",list:{key:"metadata_endpoints",label:"Cloud metadata addresses",hint:"Comma- or newline-separated hosts/IPs. A new egress to any of these is flagged.",default:["169.254.169.254","fd00:ec2::254","metadata.google.internal","100.100.100.200"]}},{source:"d2_dangerous_port",parentClass:Sl.D2_egress,category:"exfiltration",weight:45,label:"Suspicious egress port",description:"New egress on a port commonly used by reverse shells, C2, or tunneling (e.g. 4444, 1337).",list:{key:"dangerous_ports",label:"Suspicious ports",hint:"Comma- or newline-separated port numbers. New egress to any of these is flagged.",default:["23","1080","1337","2323","4444","6667","6697","9050","12345","31337"]}},{source:"d7_destructive_op",parentClass:Sl.D7_db_access,category:"impact",weight:45,label:"Destructive operation",description:"New DELETE/DROP/TRUNCATE/ALTER/UPDATE not seen during learning."},{source:"d7_sensitive_table",parentClass:Sl.D7_db_access,category:"exfiltration",weight:30,label:"Sensitive table access",description:"New access to a table whose name looks sensitive (credentials, payment, token…).",list:{key:"sensitive_tables",label:"Sensitive keywords",hint:"Comma- or newline-separated substrings. A newly-accessed table whose name contains any of these is flagged.",default:["credential","password","passwd","secret","token","apikey","api_key","payment","card","ssn","account","auth","session","admins","users"]}},{source:"d7_injection_shape",parentClass:Sl.D7_db_access,category:"injection",weight:35,label:"Multi-table / join shape",description:"A new query joining several tables — a classic injection / data-harvesting shape."},{source:"d7_schema_recon",parentClass:Sl.D7_db_access,category:"injection",weight:30,label:"Database schema recon",description:"New access to a DB system-catalog / metadata table (e.g. information_schema) — classic SQL-injection enumeration.",list:{key:"schema_catalog_tables",label:"Schema-catalog tables",hint:"Comma- or newline-separated names/substrings. A newly-accessed table matching any is flagged as schema reconnaissance.",default:["information_schema","pg_catalog","pg_class","pg_tables","pg_attribute","pg_shadow","pg_user","mysql.user","mysql.db","sqlite_master","sys.tables","sys.columns","sys.databases","all_tables","dba_tables","user_tables"]}},{source:"d8_response_exfil",parentClass:Sl.D8_payload_size,category:"exfiltration",weight:40,label:"Oversized response (bulk data)",description:"Response body far larger than the learned baseline — possible bulk data extraction."}],categories:[{id:"impact",label:"Impact",base:45,mitre:"TA0040",owasp:null},{id:"injection",label:"Injection",base:40,mitre:"T1190",owasp:"A03"},{id:"exfiltration",label:"Exfiltration",base:35,mitre:"TA0010",owasp:null},{id:"access_anomaly",label:"Access anomaly",base:35,mitre:"TA0004",owasp:"A01"},{id:"supply_chain",label:"Supply chain",base:30,mitre:"T1195",owasp:"A06"},{id:"lateral_movement",label:"Lateral movement",base:25,mitre:"TA0008",owasp:null},{id:"recon",label:"Recon",base:15,mitre:"TA0043",owasp:null},{id:"resource_abuse",label:"Resource abuse",base:10,mitre:"T1499",owasp:null}],guardrailRules:[{key:"allowed_callers",label:"Allowed callers",description:"Restrict which services may call this service",category:"lateral_movement",weight:25,hint:"namespace/service"}],severityBands:[{severity:rl.Info,minScore:0},{severity:rl.Low,minScore:20},{severity:rl.Medium,minScore:35},{severity:rl.High,minScore:50},{severity:rl.Critical,minScore:75}],correlationBonus:15,tags:JSON.stringify({T1190:"Exploit Public-Facing Application",T1195:"Supply Chain Compromise",T1499:"Endpoint Denial of Service",TA0004:"Privilege Escalation (tactic)",TA0008:"Lateral Movement (tactic)",TA0010:"Exfiltration (tactic)",TA0040:"Impact (tactic)",TA0043:"Reconnaissance (tactic)",A01:"Broken Access Control",A03:"Injection",A06:"Vulnerable and Outdated Components"})},MT=f($)`
|
|
2042
|
+
`,pI=(e,t)=>{switch(e){case rl.Info:return{backgroundColor:t.v2.colors.blue[900],textColor:t.v2.colors.white[500]};case rl.Low:return{backgroundColor:t.v2.colors.green[900],textColor:t.v2.colors.white[500]};case rl.Medium:return{backgroundColor:t.v2.colors.yellow[550],textColor:t.v2.colors.black[500]};case rl.High:return{backgroundColor:t.v2.colors.orange[500],textColor:t.v2.colors.white[500]};case rl.Critical:return{backgroundColor:t.v2.colors.red[800],textColor:t.v2.colors.white[500]}}},uI=({isOpen:i,onClose:n,catalog:a})=>{const o=v(),l=(e=>{const t=e.severityBands?.length?e.severityBands:void 0,i=[];for(const n of RT(e)){i.push(WT(n,t));for(const a of DT(e,n.id))i.push(KT(a,n.weight,t))}return i})(a),r=(e=>{const t=e.severityBands?.length?e.severityBands:void 0,i=[...e.enrichers].sort((e,t)=>t.weight-e.weight)[0],n=i?e.deviationClasses.find(e=>e.id===i.parentClass):void 0;if(!n||!i)return null;const a=Math.min(100,n.weight+i.weight),o=NT(a,t);return{baseLabel:n.label,baseScore:n.weight,modifierLabel:i.label,modifierWeight:i.weight,finalScore:a,finalBand:o,finalBandLabel:$T[o]}})(a),s=(e=>[...e.severityBands?.length?e.severityBands:[]].filter(e=>e.severity!==rl.Info).sort((e,t)=>e.minScore-t.minScore).map(e=>({severity:e.severity,label:$T[e.severity],minScore:e.minScore})))(a),c=a.correlationBonus??15,d=r?pI(r.finalBand,o):null;return t(ct,{isOpen:i,width:"960px",minWidth:"720px",header:{icon:kc,title:"Risk model",onClose:n},children:e(YT,{"data-id":"insights-risk-model-drawer",children:[e($,{$gap:6,children:[t(qT,{size:C.XXXS,color:k.Secondary,children:"The default risk model every anomaly policy builds on. Each signal adds its weight (points) to a 0–100 risk score; dangerous sub-cases add on top of a class’s base novelty. Read-only reference — tune the weights per scope in this Detection policy."}),s.length?e(JT,{children:[t(w,{size:C.XXXS,color:k.Secondary,children:"A signal alone lands at"}),s.map(e=>{const i=pI(e.severity,o);return t(E,{label:`${e.label.toLowerCase()} ${e.minScore}`,backgroundColor:i.backgroundColor,textColor:i.textColor},e.label)})]}):null]}),e(ZT,{children:[t(w,{size:C.XXS,children:"How scoring works"}),t(QT,{children:"Base signal + modifiers + cross-category bonus = final risk score"}),e(eI,{children:[t(w,{size:C.XXXS,color:k.Secondary,children:"Modifiers are not independent signals. They are added only when their parent base signal occurs."}),t(w,{size:C.XXXS,color:k.Secondary,children:(p=c,`Signals spanning two or more kill-chain categories receive a +${p} correlation bonus. The final risk score is capped at 100.`)})]}),r&&d?e(tI,{children:[t(w,{size:C.XXXS,children:`${r.baseLabel} ${r.baseScore}`}),t(w,{size:C.XXXS,color:k.Secondary,children:"+"}),t(w,{size:C.XXXS,children:`${r.modifierLabel} ${r.modifierWeight}`}),t(w,{size:C.XXXS,color:k.Secondary,children:"="}),t(E,{label:`${r.finalScore} · ${r.finalBandLabel}`,backgroundColor:d.backgroundColor,textColor:d.textColor})]}):null]}),t(iI,{children:e(nI,{children:[t("thead",{children:e("tr",{children:[t(aI,{style:{width:"17%"},children:t(w,{size:C.XXXS,color:k.Secondary,children:"Signal"})}),t(aI,{style:{width:"15%"},children:t(w,{size:C.XXXS,color:k.Secondary,children:"Class / source"})}),t(aI,{style:{width:"13%"},children:t(w,{size:C.XXXS,color:k.Secondary,children:"Weight"})}),t(aI,{style:{width:"9%"},children:t(w,{size:C.XXXS,color:k.Secondary,children:"Band"})}),t(aI,{style:{width:"13%"},children:t(w,{size:C.XXXS,color:k.Secondary,children:"Category"})}),t(aI,{style:{width:"33%"},children:t(w,{size:C.XXXS,color:k.Secondary,children:"What it means"})})]})}),t("tbody",{children:l.map(i=>{const n=pI(i.band,o);return e(oI,{"data-id":`risk-model-row-${i.id}`,$sub:i.isSubCase,children:[t(rI,{$sub:i.isSubCase,children:t(w,{size:C.XXXS,children:i.isSubCase?i.signal:t("strong",{children:i.signal})})}),t(lI,{children:t(sI,{children:i.source})}),t(lI,{children:t(cI,{size:C.XXXS,children:i.weightLabel})}),t(lI,{children:t(E,{label:i.bandLabel.toLowerCase(),backgroundColor:n.backgroundColor,textColor:n.textColor})}),t(lI,{children:t(w,{size:C.XXXS,color:k.Secondary,children:i.isSubCase?"Modifier":i.category})}),t(lI,{children:t(w,{size:C.XXXS,color:k.Secondary,children:i.description})})]},i.id)})})]})}),e(dI,{children:[t(w,{size:C.XXS,children:"Cross-class correlation"}),t(w,{size:C.XXXS,color:k.Secondary,children:jT(c)})]})]})});var p},hI=f($)`
|
|
1962
2043
|
flex: 1;
|
|
1963
2044
|
min-width: 0;
|
|
1964
2045
|
height: 100%;
|
|
@@ -1967,34 +2048,34 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
1967
2048
|
overflow: hidden;
|
|
1968
2049
|
border-radius: 16px 0 16px 0;
|
|
1969
2050
|
background-color: ${({theme:e})=>e.v2.colors.silver[900]};
|
|
1970
|
-
`,
|
|
2051
|
+
`,gI=f($)`
|
|
1971
2052
|
flex: 1;
|
|
1972
2053
|
min-height: 0;
|
|
1973
2054
|
width: 100%;
|
|
1974
2055
|
gap: 12px;
|
|
1975
2056
|
overflow-y: auto;
|
|
1976
|
-
`,
|
|
2057
|
+
`,mI=f($)`
|
|
1977
2058
|
width: 100%;
|
|
1978
2059
|
gap: 4px;
|
|
1979
2060
|
padding: 12px;
|
|
1980
|
-
`,
|
|
2061
|
+
`,bI=f(T)`
|
|
1981
2062
|
width: 100%;
|
|
1982
2063
|
align-items: center;
|
|
1983
2064
|
gap: 4px;
|
|
1984
|
-
`,
|
|
2065
|
+
`,fI=f(T)`
|
|
1985
2066
|
flex: 1;
|
|
1986
2067
|
justify-content: flex-end;
|
|
1987
|
-
`,
|
|
2068
|
+
`,vI=f(T)`
|
|
1988
2069
|
width: 100%;
|
|
1989
2070
|
align-items: center;
|
|
1990
2071
|
gap: 16px;
|
|
1991
2072
|
padding: 8px 16px;
|
|
1992
2073
|
flex-wrap: wrap;
|
|
1993
|
-
`,
|
|
2074
|
+
`,yI=f(T)`
|
|
1994
2075
|
align-items: center;
|
|
1995
2076
|
gap: 8px;
|
|
1996
2077
|
flex-shrink: 0;
|
|
1997
|
-
`,
|
|
2078
|
+
`,SI=f.button`
|
|
1998
2079
|
display: flex;
|
|
1999
2080
|
align-items: center;
|
|
2000
2081
|
gap: 8px;
|
|
@@ -2008,10 +2089,10 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2008
2089
|
&:hover {
|
|
2009
2090
|
border-color: ${({theme:e})=>e.v2.colors.silver[300]};
|
|
2010
2091
|
}
|
|
2011
|
-
`,
|
|
2092
|
+
`,xI=f($)`
|
|
2012
2093
|
width: 100%;
|
|
2013
2094
|
gap: 8px;
|
|
2014
|
-
`,
|
|
2095
|
+
`,wI=f.button`
|
|
2015
2096
|
display: flex;
|
|
2016
2097
|
align-items: center;
|
|
2017
2098
|
gap: 4px;
|
|
@@ -2023,68 +2104,68 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2023
2104
|
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
2024
2105
|
cursor: pointer;
|
|
2025
2106
|
text-align: left;
|
|
2026
|
-
`,
|
|
2107
|
+
`,CI=f.span`
|
|
2027
2108
|
display: inline-flex;
|
|
2028
2109
|
transform: rotate(${({$open:e})=>e?90:0}deg);
|
|
2029
2110
|
transition: transform 0.15s ease;
|
|
2030
|
-
`,
|
|
2111
|
+
`,kI=f(T)`
|
|
2031
2112
|
flex-shrink: 0;
|
|
2032
2113
|
width: 100%;
|
|
2033
2114
|
justify-content: center;
|
|
2034
|
-
`,
|
|
2115
|
+
`,TI=f(T)`
|
|
2035
2116
|
gap: 24px;
|
|
2036
2117
|
align-items: center;
|
|
2037
2118
|
padding: 8px;
|
|
2038
2119
|
border-radius: 8px;
|
|
2039
2120
|
background-color: ${({theme:e})=>e.v2.colors.black[500]+I["095"]};
|
|
2040
2121
|
box-shadow: 0 4px 16.7px 0 rgba(0, 0, 0, 0.83);
|
|
2041
|
-
`,
|
|
2122
|
+
`,II=f(j)`
|
|
2042
2123
|
min-width: 160px;
|
|
2043
|
-
|
|
2124
|
+
`,$I=({policy:i,onAddOverride:n,onSave:r})=>{const s=v(),{insightsApi:c}=Lc(),d=c.useCatalog(),p=d.data?.deviationClasses?.length?d.data:rx,[u,h]=l(i),[g,m]=l(!1),[b,f]=l(!1),[y,S]=l(!1);o(()=>{h(i),m(!1)},[i]);const x=a(()=>rT.find(e=>e.id===u.riskLevel),[u.riskLevel]),T=((e,t)=>{switch(e){case Wk.Low:return{backgroundColor:t.v2.colors.green[900],textColor:t.v2.colors.white[500]};case Wk.Medium:return{backgroundColor:t.v2.colors.yellow[1e3],textColor:t.v2.colors.yellow[500]};case Wk.High:return{backgroundColor:t.v2.colors.orange[500],textColor:t.v2.colors.white[500]};case Wk.Critical:return{backgroundColor:t.v2.colors.red[800],textColor:t.v2.colors.white[500]}}})(u.riskLevel,s);return e(hI,{"data-id":`detection-policy-editor-${i.id}`,children:[e(gI,{children:[e(mI,{children:[e(bI,{children:[t(w,{size:C.XS,nowrap:!0,children:u.name}),Kk(u)&&t(E,{label:nw,status:ie.Warning,invertColors:!0}),t(fI,{children:t(j,{"data-id":"detection-view-risk-model",label:"View risk model",leftIcon:xs,variant:K.Text,size:W.S,onClick:()=>f(!0)})})]}),t(w,{size:C.XXXS,color:k.Secondary,children:cw(u.fireAtScore,u.signalWeightOverrideCount)}),e(vI,{children:[e(yI,{children:[t(w,{size:C.XS,children:"Name"}),t(Y,{value:u.name,onChange:e=>h(t=>({...t,name:e.target.value})),width:"205px",small:!0})]}),e(yI,{children:[t(w,{size:C.XS,children:"Trigger when risk level is"}),t(ka,{items:[...rT],selectedIds:[u.riskLevel],setSelectedIds:e=>{const t=e[0]||u.riskLevel;h(e=>({...e,riskLevel:t,fireAtScore:sT[t],summary:Kk(e)?e.summary:cw(sT[t],e.signalWeightOverrideCount)}))},alignX:Ia.Left,children:({ChevronIcon:i,handleClick:n})=>e(SI,{type:"button",onClick:n,"data-id":"detection-policy-risk-level",children:[t(E,{label:x?.label||u.riskLevel,backgroundColor:T.backgroundColor,textColor:T.textColor}),t(i,{size:18})]})})]})]})]}),e(xI,{children:[e(wI,{type:"button",onClick:e=>{e.preventDefault(),m(e=>!e)},"data-id":"detection-policy-advanced-toggle",children:[t(CI,{$open:g,children:t(bs,{size:18})}),t(w,{size:C.XXS,children:"Customize signal weights (advanced)"})]}),g?t(HT,{catalog:p,signalWeights:u.signalWeights,enricherLists:u.enricherLists,onChange:e=>{h(t=>({...t,signalWeights:e.signalWeights,enricherLists:e.enricherLists,signalWeightOverrideCount:e.overrideCount,summary:Kk(t)?t.summary:cw(t.fireAtScore,e.overrideCount)}))}},i.id):null]})]}),t(kI,{children:e(TI,{children:[t(II,{"data-id":"detection-policy-add-override",label:"Add override",rightIcon:ys,variant:K.Secondary,size:W.M,onClick:n}),t(II,{"data-id":"detection-policy-save",label:"Save Changes",variant:K.Primary,size:W.M,onClick:async()=>{S(!0);try{await r(u)}finally{S(!1)}},disabled:y})]})}),t(uI,{isOpen:b,onClose:()=>f(!1),catalog:p})]})},NI=f(T)`
|
|
2044
2125
|
flex: 1;
|
|
2045
2126
|
min-height: 0;
|
|
2046
2127
|
width: 100%;
|
|
2047
2128
|
align-items: stretch;
|
|
2048
|
-
`,
|
|
2129
|
+
`,AI=f.div`
|
|
2049
2130
|
flex: 1;
|
|
2050
2131
|
min-width: 0;
|
|
2051
2132
|
height: 100%;
|
|
2052
2133
|
overflow: hidden;
|
|
2053
|
-
`,
|
|
2134
|
+
`,OI=()=>{const i=nC(eC.Detection),{insightsApi:n}=Lc(),{data:r,loading:s,unsupported:c,refetch:d}=n.usePolicies(),p=n.useServices(),u=n.useTransactions(),h=Array.isArray(r)?r:[],[g,m]=l(gT),[b,f]=l(mT),[v,y]=l(!1),[S,x]=l(null),T=a(()=>h.map(uT),[h]),I=a(()=>c?g:T.filter(Kk),[c,g,T]),$=a(()=>c?b:T.filter(e=>!Kk(e)),[c,b,T]),N=a(()=>[...I,...$],[I,$]),A=a(()=>Array.isArray(p.data)?p.data:[],[p.data]),O=a(()=>Array.isArray(u.data)?u.data:[],[u.data]),E=a(()=>$.map(e=>e.scopeKey),[$]);o(()=>{v||(N.length?x(e=>e&&N.some(t=>t.id===e)?e:N[0].id):x(null))},[N,v]);const D=a(()=>N.find(e=>e.id===S)??null,[N,S]),R=I[0]??null,z=()=>{y(!0),x(null)};return t(iw,{icon:i?.panelIcon,title:"Anomaly Detection Policies",count:N.length,description:i?.panelDescription,children:!s||c||N.length||v?e(NI,{children:[t(TT,{defaultPolicies:I,overridePolicies:$,selectedId:v?null:S,onSelect:e=>{y(!1),x(e)},onAddOverride:z}),t(AI,{children:v?t(lT,{services:A,transactions:O,existingScopeKeys:E,onSubmit:async e=>{const t=$.find(t=>t.scope===e.scope&&t.scopeKey===e.scopeKey);if(t)return y(!1),void x(t.id);const i=(({scope:e,scopeKey:t,name:i,defaults:n})=>{const a=n?.fireAtScore??sT[Wk.Medium],o=dT(a),l=n?.signalWeightOverrideCount??0;return{id:`${e}:${t}`,name:i,scope:e,scopeKey:t,enabled:!0,summary:cw(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:R});if(c)return f(e=>[...e.filter(e=>!(e.scope===i.scope&&e.scopeKey===i.scopeKey)),i]),y(!1),void x(i.id);const a=hT(i),o=await(n.upsertPolicy?.({...a,id:null}));o?.error||(await d(),y(!1),x(o?.data?uT(o.data).id:i.id))}}):D?t($I,{policy:D,onAddOverride:z,onSave:async e=>{if(c){const t=t=>t.map(t=>t.id===e.id?e:t);return m(e=>t(e)),void f(e=>t(e))}const t=await(n.upsertPolicy?.(hT(e)));t?.error||await d()}},`${D.id}-${D.name}-${D.enabled}-${D.fireAtScore}-${D.summary}`):t(Me,{$height:"100%",children:t(w,{size:C.XS,color:k.Secondary,children:"Coming soon"})})})]}):t(Me,{$height:"100%",children:t(Ve,{withSpinner:!0})})})},EI=f($)`
|
|
2054
2135
|
width: 100%;
|
|
2055
2136
|
gap: 4px;
|
|
2056
2137
|
padding: 12px;
|
|
2057
2138
|
border-radius: 12px;
|
|
2058
2139
|
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
2059
|
-
`,
|
|
2140
|
+
`,DI=f($)`
|
|
2060
2141
|
width: 100%;
|
|
2061
2142
|
gap: 4px;
|
|
2062
|
-
`,
|
|
2143
|
+
`,RI=f(T)`
|
|
2063
2144
|
width: 100%;
|
|
2064
2145
|
align-items: center;
|
|
2065
2146
|
gap: 4px;
|
|
2066
|
-
`,
|
|
2147
|
+
`,zI=f.div`
|
|
2067
2148
|
margin-left: auto;
|
|
2068
|
-
`,
|
|
2149
|
+
`,XI=f.div`
|
|
2069
2150
|
width: 100%;
|
|
2070
2151
|
min-height: 99px;
|
|
2071
2152
|
padding: 8px 16px;
|
|
2072
2153
|
border-radius: 12px;
|
|
2073
2154
|
overflow: hidden;
|
|
2074
|
-
`,
|
|
2155
|
+
`,PI=f(T)`
|
|
2075
2156
|
width: 100%;
|
|
2076
2157
|
align-items: flex-start;
|
|
2077
2158
|
gap: 12px;
|
|
2078
|
-
`,
|
|
2159
|
+
`,LI=f($)`
|
|
2079
2160
|
flex: 1;
|
|
2080
2161
|
min-width: 0;
|
|
2081
2162
|
gap: 4px;
|
|
2082
|
-
`,
|
|
2163
|
+
`,MI=f.div`
|
|
2083
2164
|
display: flex;
|
|
2084
2165
|
align-items: center;
|
|
2085
2166
|
width: 100%;
|
|
2086
2167
|
min-height: 32px;
|
|
2087
|
-
`,
|
|
2168
|
+
`,_I=f($)`
|
|
2088
2169
|
width: 100%;
|
|
2089
2170
|
min-height: 80px;
|
|
2090
2171
|
align-items: center;
|
|
@@ -2092,7 +2173,7 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2092
2173
|
gap: 8px;
|
|
2093
2174
|
padding: 8px 0;
|
|
2094
2175
|
text-align: center;
|
|
2095
|
-
`,
|
|
2176
|
+
`,FI=f.div`
|
|
2096
2177
|
display: flex;
|
|
2097
2178
|
align-items: center;
|
|
2098
2179
|
justify-content: center;
|
|
@@ -2101,10 +2182,10 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2101
2182
|
padding: 4px;
|
|
2102
2183
|
border-radius: 23px;
|
|
2103
2184
|
background-color: ${({theme:e})=>e.v2.colors.silver[700]};
|
|
2104
|
-
`,
|
|
2185
|
+
`,BI=f($)`
|
|
2105
2186
|
align-items: center;
|
|
2106
2187
|
gap: 0;
|
|
2107
|
-
`,
|
|
2188
|
+
`,UI=e=>{const t=e.lastIndexOf("/");return t>=0?e.slice(t+1):e},VI=({title:i,description:n,items:o,selected:l,onToggle:r,formatLabel:s=UI,onToggleAll:c,emptyIcon:d,emptyTitle:p,emptyDescription:u})=>{const h=v(),g=a(()=>((e,t=3)=>{const i=Math.ceil(e.length/t)||1;return Array.from({length:t},(t,n)=>e.slice(n*i,(n+1)*i))})(o),[o]),m=a(()=>o.reduce((e,t)=>l.has(t)?e+1:e,0),[o,l]),b=o.length>0&&m===o.length,f=m>0&&!b;return e(EI,{"data-id":`guardrail-facet-${i.toLowerCase()}`,children:[e(DI,{children:[e(RI,{children:[t(w,{size:C.XXS,children:i}),t(E,{label:o.length,backgroundColor:h.v2.colors.blue[900],textSize:C.XXXS}),o.length>0&&c&&t(zI,{children:t(x,{name:`guardrail-facet-${i}-select-all`,label:"Select all",size:kl.S,value:b,partiallyChecked:f,onChange:e=>c(e)})})]}),t(w,{size:C.XXXS,color:k.Secondary,children:n})]}),t(XI,{children:0===o.length?e(_I,{children:[t(FI,{children:t(d,{size:32,fill:h.v2.colors.silver[400]})}),e(BI,{children:[t(w,{size:C.XS,color:k.Secondary,align:"center",children:p}),t(w,{size:C.XXXS,color:k.Disable,align:"center",children:u})]})]}):t(PI,{children:g.map((e,n)=>t(LI,{children:e.map((e,a)=>t(MI,{children:t(x,{name:`guardrail-facet-${i}-${n}-${a}`,label:s(e),size:kl.S,value:l.has(e),onChange:t=>r(e,t)})},`${e}-${n}-${a}`))},`col-${n}`))})})]})},GI=e=>{if(e.length)return e.reduce((e,t)=>{const i=e.allowlist?.length??0;return(t.allowlist?.length??0)>i?t:e})},HI=e=>{const t=GI(e.rules);return{id:e.scopeKey,scopeKey:e.scopeKey,ruleLabel:t?.label||"No rules",allowlistCount:t?.allowlist?.length??0,mode:t?.mode||hl.Suggest}},jI=e=>{const t=e.indexOf("/");return t<0?{namespace:"",service:e}:{namespace:e.slice(0,t),service:e.slice(t+1)}},WI=(e,t)=>e.rules.find(e=>e.key===t)?.allowlist?.filter(Boolean)??[],KI=e=>GI(e.rules)?.mode||hl.Suggest,YI=(...e)=>{const t=new Set,i=[];for(const n of e)for(const e of n??[])e&&!t.has(e)&&(t.add(e),i.push(e));return i},qI=e=>{const t=e.governed??{},i=[{key:Pw,label:"Allowed callers",allowlist:e.callers,keep:e.callers.length>0||!!t.callers},{key:Lw,label:"Allowed callees",allowlist:e.callees,keep:e.callees.length>0||!!t.callees},{key:Mw,label:"Allowed egress",allowlist:e.egress,keep:e.egress.length>0||!!t.egress},{key:_w,label:"Allowed transactions",allowlist:e.transactions,keep:e.transactions.length>0||!!t.transactions}].filter(e=>e.keep).map(t=>({key:t.key,label:t.label,allowlist:t.allowlist,mode:e.mode}));return{scope:e.scope,scopeKey:e.scopeKey,rules:i}},JI=f($)`
|
|
2108
2189
|
flex: 1;
|
|
2109
2190
|
min-width: 0;
|
|
2110
2191
|
height: 100%;
|
|
@@ -2113,25 +2194,25 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2113
2194
|
overflow: hidden;
|
|
2114
2195
|
border-radius: 16px 0 16px 0;
|
|
2115
2196
|
background-color: ${({theme:e})=>e.v2.colors.silver[900]};
|
|
2116
|
-
`,
|
|
2197
|
+
`,ZI=f($)`
|
|
2117
2198
|
flex: 1;
|
|
2118
2199
|
min-height: 0;
|
|
2119
2200
|
width: 100%;
|
|
2120
2201
|
gap: 16px;
|
|
2121
2202
|
overflow-y: auto;
|
|
2122
2203
|
padding-bottom: 8px;
|
|
2123
|
-
`,
|
|
2204
|
+
`,QI=f.div`
|
|
2124
2205
|
width: 100%;
|
|
2125
2206
|
padding: 0 16px;
|
|
2126
|
-
`,
|
|
2207
|
+
`,e$=f(T)`
|
|
2127
2208
|
width: 100%;
|
|
2128
2209
|
gap: 10px;
|
|
2129
2210
|
align-items: flex-start;
|
|
2130
2211
|
flex-wrap: wrap;
|
|
2131
|
-
`,
|
|
2212
|
+
`,t$=f.div`
|
|
2132
2213
|
width: 296px;
|
|
2133
2214
|
max-width: 100%;
|
|
2134
|
-
|
|
2215
|
+
`,i$=f(T)`
|
|
2135
2216
|
flex-shrink: 0;
|
|
2136
2217
|
width: 100%;
|
|
2137
2218
|
align-items: center;
|
|
@@ -2141,16 +2222,16 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2141
2222
|
border-radius: 8px;
|
|
2142
2223
|
background-color: rgba(31, 33, 37, 0.95);
|
|
2143
2224
|
box-shadow: 0 4px 16.7px 0 rgba(0, 0, 0, 0.83);
|
|
2144
|
-
`,
|
|
2225
|
+
`,n$=f(T)`
|
|
2145
2226
|
width: 100%;
|
|
2146
2227
|
justify-content: center;
|
|
2147
2228
|
padding: 48px 0;
|
|
2148
|
-
`,
|
|
2229
|
+
`,a$=f(T)`
|
|
2149
2230
|
flex: 1;
|
|
2150
2231
|
min-width: 0;
|
|
2151
2232
|
align-items: center;
|
|
2152
2233
|
gap: 8px;
|
|
2153
|
-
`,
|
|
2234
|
+
`,o$=f.button`
|
|
2154
2235
|
display: flex;
|
|
2155
2236
|
align-items: center;
|
|
2156
2237
|
gap: 8px;
|
|
@@ -2167,12 +2248,12 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2167
2248
|
&:hover {
|
|
2168
2249
|
border-color: ${({theme:e})=>e.v2.colors.purple[400]};
|
|
2169
2250
|
}
|
|
2170
|
-
`,
|
|
2251
|
+
`,l$=f($)`
|
|
2171
2252
|
gap: 0;
|
|
2172
|
-
`,
|
|
2253
|
+
`,r$=f(j)`
|
|
2173
2254
|
flex-shrink: 0;
|
|
2174
2255
|
height: 38px;
|
|
2175
|
-
`,
|
|
2256
|
+
`,s$=e=>new Set(e),c$=e=>rS(e),d$=({services:n,profile:r,profileLoading:s,namespace:c,service:d,onNamespaceChange:p,onServiceChange:u,onSubmit:h})=>{const[g,m]=l(hl.Enforce),[b,f]=l(new Set),[v,y]=l(new Set),[S,x]=l(new Set),[T,I]=l(new Set),[$,N]=l(!1),A=a(()=>{const e=new Set(n.map(e=>e.namespace).filter(Boolean));return Array.from(e).sort()},[n]),O=a(()=>n.filter(e=>e.namespace===c).map(e=>e.service).sort(),[n,c]),E=a(()=>A.map(e=>({id:e,label:e})),[A]),D=a(()=>O.map(e=>({id:e,label:e})),[O]);o(()=>{f(s$(r?.callers??[])),y(s$(r?.callees??[])),x(s$(r?.egress??[])),I(s$(r?.transactions??[]))},[r]);const R=a(()=>({callers:(r?.callers?.length??0)>0,callees:(r?.callees?.length??0)>0,egress:(r?.egress?.length??0)>0,transactions:(r?.transactions?.length??0)>0}),[r]),z=R.callers||R.callees||R.egress||R.transactions,X=!!c&&!!d&&!$&&z,P=e=>(t,i)=>{e(e=>{const n=new Set(e);return i?n.add(t):n.delete(t),n})},L=(e,t)=>i=>{e(i?new Set(t):new Set)};return e(JI,{"data-id":"guardrails-create-panel",children:[e(ZI,{children:[t(QI,{children:t(w,{size:C.S,children:"Inspect a service"})}),e(e$,{children:[t(t$,{children:t(Fe,{label:hw,options:E,values:c?[c]:[],setValues:e=>p(e[0]||""),placeholder:"Select namespace…"})}),t(t$,{children:t(Fe,{label:gw,options:D,values:d?[d]:[],setValues:e=>u(e[0]||""),placeholder:"Select service…",disabled:!c})})]}),s?t(n$,{children:t(Ve,{withSpinner:!0})}):e(i,{children:[t(VI,{title:mw,description:bw,items:r?.callers??[],selected:b,onToggle:P(f),onToggleAll:L(f,r?.callers??[]),emptyIcon:Js,emptyTitle:fw,emptyDescription:vw}),t(VI,{title:yw,description:Sw,items:r?.callees??[],selected:v,onToggle:P(y),onToggleAll:L(y,r?.callees??[]),emptyIcon:Zs,emptyTitle:xw,emptyDescription:ww}),t(VI,{title:Cw,description:kw,items:r?.egress??[],selected:S,onToggle:P(x),onToggleAll:L(x,r?.egress??[]),emptyIcon:As,emptyTitle:Tw,emptyDescription:Iw}),t(VI,{title:$w,description:Nw,items:r?.transactions??[],selected:T,onToggle:P(I),formatLabel:c$,onToggleAll:L(I,r?.transactions??[]),emptyIcon:wc,emptyTitle:Aw,emptyDescription:Ow})]})]}),e(i$,{children:[e(a$,{children:[e(o$,{type:"button",$selected:g===hl.Enforce,onClick:()=>m(hl.Enforce),children:[t(V,{"data-id":"guardrail-mode-enforce",value:g===hl.Enforce,onChange:()=>m(hl.Enforce),size:H.S}),e(l$,{children:[t(w,{size:C.XXS,children:Ew}),t(w,{size:C.XXXS,color:k.Secondary,children:Dw})]})]}),e(o$,{type:"button",$selected:g===hl.Suggest,onClick:()=>m(hl.Suggest),children:[t(V,{"data-id":"guardrail-mode-suggest",value:g===hl.Suggest,onChange:()=>m(hl.Suggest),size:H.S}),e(l$,{children:[t(w,{size:C.XXS,children:Rw}),t(w,{size:C.XXXS,color:k.Secondary,children:zw})]})]})]}),t(r$,{"data-id":"guardrails-add-to-guardrails",label:"Add to guardrails",rightIcon:ys,variant:K.Primary,size:W.M,disabled:!X,onClick:async()=>{if(X){N(!0);try{await h(qI({scope:xl.Service,scopeKey:`${c}/${d}`,mode:g,callers:Array.from(b),callees:Array.from(v),egress:Array.from(S),transactions:Array.from(T),governed:R}))}finally{N(!1)}}}})]})]})},p$=f($)`
|
|
2176
2257
|
flex: 1;
|
|
2177
2258
|
min-width: 0;
|
|
2178
2259
|
height: 100%;
|
|
@@ -2181,26 +2262,26 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2181
2262
|
overflow: hidden;
|
|
2182
2263
|
border-radius: 16px 0 16px 0;
|
|
2183
2264
|
background-color: ${({theme:e})=>e.v2.colors.silver[900]};
|
|
2184
|
-
`,
|
|
2265
|
+
`,u$=f($)`
|
|
2185
2266
|
flex: 1;
|
|
2186
2267
|
min-height: 0;
|
|
2187
2268
|
width: 100%;
|
|
2188
2269
|
gap: 16px;
|
|
2189
2270
|
overflow-y: auto;
|
|
2190
2271
|
padding-bottom: 8px;
|
|
2191
|
-
`,
|
|
2272
|
+
`,h$=f.div`
|
|
2192
2273
|
width: 100%;
|
|
2193
2274
|
padding: 0 16px;
|
|
2194
|
-
`,
|
|
2275
|
+
`,g$=f(T)`
|
|
2195
2276
|
width: 100%;
|
|
2196
2277
|
gap: 10px;
|
|
2197
2278
|
align-items: flex-start;
|
|
2198
2279
|
flex-wrap: wrap;
|
|
2199
|
-
`,
|
|
2280
|
+
`,m$=f($)`
|
|
2200
2281
|
width: 296px;
|
|
2201
2282
|
max-width: 100%;
|
|
2202
2283
|
gap: 4px;
|
|
2203
|
-
`,
|
|
2284
|
+
`,b$=f.div`
|
|
2204
2285
|
display: flex;
|
|
2205
2286
|
align-items: center;
|
|
2206
2287
|
min-height: 38px;
|
|
@@ -2208,7 +2289,7 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2208
2289
|
border-radius: 8px;
|
|
2209
2290
|
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
2210
2291
|
border: 1px solid ${({theme:e})=>e.v2.colors.silver[700]};
|
|
2211
|
-
`,
|
|
2292
|
+
`,f$=f(T)`
|
|
2212
2293
|
flex-shrink: 0;
|
|
2213
2294
|
width: 100%;
|
|
2214
2295
|
align-items: center;
|
|
@@ -2218,16 +2299,16 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2218
2299
|
border-radius: 8px;
|
|
2219
2300
|
background-color: rgba(31, 33, 37, 0.95);
|
|
2220
2301
|
box-shadow: 0 4px 16.7px 0 rgba(0, 0, 0, 0.83);
|
|
2221
|
-
`,
|
|
2302
|
+
`,v$=f(T)`
|
|
2222
2303
|
width: 100%;
|
|
2223
2304
|
justify-content: center;
|
|
2224
2305
|
padding: 48px 0;
|
|
2225
|
-
`,
|
|
2306
|
+
`,y$=f(T)`
|
|
2226
2307
|
flex: 1;
|
|
2227
2308
|
min-width: 0;
|
|
2228
2309
|
align-items: center;
|
|
2229
2310
|
gap: 8px;
|
|
2230
|
-
`,
|
|
2311
|
+
`,S$=f.button`
|
|
2231
2312
|
display: flex;
|
|
2232
2313
|
align-items: center;
|
|
2233
2314
|
gap: 8px;
|
|
@@ -2244,13 +2325,13 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2244
2325
|
&:hover {
|
|
2245
2326
|
border-color: ${({theme:e})=>e.v2.colors.purple[400]};
|
|
2246
2327
|
}
|
|
2247
|
-
`,
|
|
2328
|
+
`,x$=f($)`
|
|
2248
2329
|
gap: 0;
|
|
2249
|
-
`,
|
|
2330
|
+
`,w$=f(T)`
|
|
2250
2331
|
flex-shrink: 0;
|
|
2251
2332
|
align-items: center;
|
|
2252
2333
|
gap: 8px;
|
|
2253
|
-
`,
|
|
2334
|
+
`,C$=e=>new Set(e),k$=e=>rS(e),T$=({guardrail:n,profile:r,profileLoading:s,onSave:c,onDelete:d})=>{const{namespace:p,service:u}=a(()=>jI(n.scopeKey),[n.scopeKey]),[h,g]=l(()=>KI(n)),[m,b]=l(()=>C$(WI(n,Pw))),[f,v]=l(()=>C$(WI(n,Lw))),[y,S]=l(()=>C$(WI(n,Mw))),[x,T]=l(()=>C$(WI(n,_w))),[I,$]=l(!1);o(()=>{g(KI(n)),b(C$(WI(n,Pw))),v(C$(WI(n,Lw))),S(C$(WI(n,Mw))),T(C$(WI(n,_w)))},[n]);const N=a(()=>YI(WI(n,Pw),r?.callers),[n,r?.callers]),A=a(()=>YI(WI(n,Lw),r?.callees),[n,r?.callees]),O=a(()=>YI(WI(n,Mw),r?.egress),[n,r?.egress]),E=a(()=>YI(WI(n,_w),r?.transactions),[n,r?.transactions]),D=a(()=>({callers:N.length>0||n.rules.some(e=>e.key===Pw),callees:A.length>0||n.rules.some(e=>e.key===Lw),egress:O.length>0||n.rules.some(e=>e.key===Mw),transactions:E.length>0||n.rules.some(e=>e.key===_w)}),[N,A,O,E,n.rules]),R=!I,z=e=>(t,i)=>{e(e=>{const n=new Set(e);return i?n.add(t):n.delete(t),n})},X=(e,t)=>i=>{e(i?new Set(t):new Set)};return e(p$,{"data-id":"guardrails-edit-panel",children:[e(u$,{children:[t(h$,{children:t(w,{size:C.S,children:"Edit guardrail"})}),e(g$,{children:[e(m$,{children:[t(w,{size:C.XXXS,color:k.Secondary,children:hw}),t(b$,{children:t(w,{size:C.XXS,children:p||"—"})})]}),e(m$,{children:[t(w,{size:C.XXXS,color:k.Secondary,children:gw}),t(b$,{children:t(w,{size:C.XXS,children:u||"—"})})]})]}),s?t(v$,{children:t(Ve,{withSpinner:!0})}):e(i,{children:[t(VI,{title:mw,description:bw,items:N,selected:m,onToggle:z(b),onToggleAll:X(b,N),emptyIcon:Js,emptyTitle:fw,emptyDescription:vw}),t(VI,{title:yw,description:Sw,items:A,selected:f,onToggle:z(v),onToggleAll:X(v,A),emptyIcon:Zs,emptyTitle:xw,emptyDescription:ww}),t(VI,{title:Cw,description:kw,items:O,selected:y,onToggle:z(S),onToggleAll:X(S,O),emptyIcon:As,emptyTitle:Tw,emptyDescription:Iw}),t(VI,{title:$w,description:Nw,items:E,selected:x,onToggle:z(T),formatLabel:k$,onToggleAll:X(T,E),emptyIcon:wc,emptyTitle:Aw,emptyDescription:Ow})]})]}),e(f$,{children:[e(y$,{children:[e(S$,{type:"button",$selected:h===hl.Enforce,onClick:()=>g(hl.Enforce),children:[t(V,{"data-id":"guardrail-edit-mode-enforce",value:h===hl.Enforce,onChange:()=>g(hl.Enforce),size:H.S}),e(x$,{children:[t(w,{size:C.XXS,children:Ew}),t(w,{size:C.XXXS,color:k.Secondary,children:Dw})]})]}),e(S$,{type:"button",$selected:h===hl.Suggest,onClick:()=>g(hl.Suggest),children:[t(V,{"data-id":"guardrail-edit-mode-suggest",value:h===hl.Suggest,onChange:()=>g(hl.Suggest),size:H.S}),e(x$,{children:[t(w,{size:C.XXS,children:Rw}),t(w,{size:C.XXXS,color:k.Secondary,children:zw})]})]})]}),e(w$,{children:[t(j,{"data-id":"guardrails-delete",label:"Delete",leftIcon:vs,variant:K.Secondary,size:W.M,disabled:I,onClick:async()=>{if(!I){$(!0);try{await d(n.scopeKey)}finally{$(!1)}}}}),t(j,{"data-id":"guardrails-save-changes",label:"Save changes",variant:K.Primary,size:W.M,disabled:!R,onClick:async()=>{if(R){$(!0);try{await c(qI({scope:n.scope,scopeKey:n.scopeKey,mode:h,callers:Array.from(m),callees:Array.from(f),egress:Array.from(y),transactions:Array.from(x),governed:D}))}finally{$(!1)}}}})]})]})]})},I$=f.button`
|
|
2254
2335
|
display: flex;
|
|
2255
2336
|
align-items: center;
|
|
2256
2337
|
justify-content: space-between;
|
|
@@ -2266,29 +2347,29 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2266
2347
|
&:hover {
|
|
2267
2348
|
background-color: ${({theme:e,$isSelected:t})=>t?e.v2.colors.silver[800]:e.v2.colors.silver[900]};
|
|
2268
2349
|
}
|
|
2269
|
-
|
|
2350
|
+
`,$$=f($)`
|
|
2270
2351
|
flex: 1;
|
|
2271
2352
|
min-width: 0;
|
|
2272
|
-
`,
|
|
2353
|
+
`,N$=f(T)`
|
|
2273
2354
|
align-items: center;
|
|
2274
2355
|
gap: 4px;
|
|
2275
2356
|
min-width: 0;
|
|
2276
|
-
`,
|
|
2357
|
+
`,A$=({guardrail:i,isSelected:n,onSelect:a})=>{const o=v(),l=i.mode===hl.Enforce?"Enforce":"Suggest";return e(I$,{type:"button","data-id":`guardrail-item-${i.id}`,$isSelected:n,onClick:()=>a(i.id),children:[e($$,{children:[t(w,{size:C.XXS,nowrap:!0,children:i.scopeKey}),e(N$,{children:[t(w,{size:C.XXXS,color:k.Secondary,nowrap:!0,children:i.ruleLabel}),t(E,{label:i.allowlistCount,backgroundColor:o.v2.colors.blue[900]}),t(E,{label:l,backgroundColor:o.v2.colors.grey[800],textColor:i.mode===hl.Enforce?o.v2.colors.red[500]:o.v2.colors.purple[300]})]})]}),t(bs,{size:18})]})},O$=f($)`
|
|
2277
2358
|
width: 320px;
|
|
2278
2359
|
flex-shrink: 0;
|
|
2279
2360
|
height: 100%;
|
|
2280
2361
|
gap: 16px;
|
|
2281
2362
|
padding: 12px;
|
|
2282
2363
|
overflow-y: auto;
|
|
2283
|
-
`,
|
|
2364
|
+
`,E$=f($)`
|
|
2284
2365
|
width: 100%;
|
|
2285
2366
|
gap: 8px;
|
|
2286
|
-
`,
|
|
2367
|
+
`,D$=f(T)`
|
|
2287
2368
|
width: 100%;
|
|
2288
2369
|
align-items: center;
|
|
2289
2370
|
gap: 4px;
|
|
2290
2371
|
padding: 8px 12px 0 12px;
|
|
2291
|
-
`,
|
|
2372
|
+
`,R$=f($)`
|
|
2292
2373
|
width: 100%;
|
|
2293
2374
|
min-height: 60px;
|
|
2294
2375
|
align-items: stretch;
|
|
@@ -2297,7 +2378,7 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2297
2378
|
padding: 12px 8px;
|
|
2298
2379
|
border-radius: 12px;
|
|
2299
2380
|
text-align: center;
|
|
2300
|
-
`,
|
|
2381
|
+
`,z$=f(j)`
|
|
2301
2382
|
&&:enabled {
|
|
2302
2383
|
background-color: ${({theme:e})=>e.v2.colors.purple[900]};
|
|
2303
2384
|
|
|
@@ -2309,40 +2390,40 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2309
2390
|
background-color: ${({theme:e})=>e.v2.colors.purple[700]};
|
|
2310
2391
|
}
|
|
2311
2392
|
}
|
|
2312
|
-
`,
|
|
2393
|
+
`,X$=({guardrails:i,selectedId:n,onSelect:a,onCreate:o})=>{const l=v();return e(O$,{"data-id":"guardrails-menu",children:[t(z$,{"data-id":"guardrails-create-new",label:Xw,rightIcon:ys,variant:K.Primary,size:W.M,fullWidth:!0,textColor:l.v2.colors.purple[300],onClick:o}),e(E$,{children:[e(D$,{children:[t(w,{size:C.XXS,color:l.v2.colors.purple[300],children:"Created Guardrails"}),t(E,{label:i.length})]}),0===i.length?e(R$,{children:[t(w,{size:C.XXS,color:k.Secondary,align:"center",children:pw}),t(w,{size:C.XXXS,color:k.Disable,align:"center",children:uw})]}):i.map(e=>t(A$,{guardrail:e,isSelected:n===e.id,onSelect:a},e.id))]})]})},P$=f(T)`
|
|
2313
2394
|
flex: 1;
|
|
2314
2395
|
min-height: 0;
|
|
2315
2396
|
width: 100%;
|
|
2316
2397
|
align-items: stretch;
|
|
2317
|
-
`,
|
|
2398
|
+
`,L$=f.div`
|
|
2318
2399
|
flex: 1;
|
|
2319
2400
|
min-width: 0;
|
|
2320
2401
|
height: 100%;
|
|
2321
2402
|
overflow: hidden;
|
|
2322
2403
|
background-color: ${({theme:e})=>e.v2.colors.silver[900]};
|
|
2323
2404
|
border-radius: 16px 0 16px 0;
|
|
2324
|
-
`,
|
|
2405
|
+
`,M$=()=>{const i=nC(eC.Guardrails),{insightsApi:n}=Lc(),{data:r,loading:s,unsupported:c,refetch:d}=n.useGuardrails(),p=n.useServices(),u=Array.isArray(r)?r:[],[h,g]=l([]),[m,b]=l(!1),[f,v]=l(null),[y,S]=l(""),[x,w]=l(""),C=a(()=>c?h:u,[c,h,u]),k=a(()=>C.map(HI),[C]),T=a(()=>C.find(e=>e.scopeKey===f)??null,[C,f]),I=a(()=>Array.isArray(p.data)?p.data:[],[p.data]),$=a(()=>T?jI(T.scopeKey):null,[T]),N=m?y:$?.namespace||"",A=m?x:$?.service||"",O=n.useServiceProfile({namespace:N||null,service:A||""},{skip:!(m||T)||!A}),E=A?O.data??null:null;o(()=>{m||(k.length?v(e=>e&&k.some(t=>t.id===e)?e:k[0].id):v(null))},[k,m]),o(()=>{if(m&&I.length){if(!y){const e=I[0]?.namespace||"";return S(e),void w(I.find(t=>t.namespace===e)?.service||"")}x&&I.some(e=>e.namespace===y&&e.service===x)||w(I.find(e=>e.namespace===y)?.service||"")}},[m,I,y,x]);const D=()=>{b(!0),v(null)};return t(iw,{icon:i?.panelIcon,title:"Guardrails",count:k.length,description:dw,children:!s||c||k.length||m?e(P$,{children:[t(X$,{guardrails:k,selectedId:m?null:f,onSelect:e=>{b(!1),v(e)},onCreate:D}),t(L$,{children:m?t(d$,{services:I,profile:E,profileLoading:!!x&&O.loading,namespace:y,service:x,onNamespaceChange:e=>{S(e),w(I.find(t=>t.namespace===e)?.service||"")},onServiceChange:w,onSubmit:async e=>{if(c)return g(t=>[...t.filter(t=>t.scopeKey!==e.scopeKey),e]),b(!1),void v(e.scopeKey);const t=await(n.upsertGuardrail?.(e));t?.error||(await d(),b(!1),v(e.scopeKey))}}):k.length?T?t(T$,{guardrail:T,profile:E,profileLoading:!!A&&O.loading,onSave:async e=>{if(c)return g(t=>[...t.filter(t=>t.scopeKey!==e.scopeKey),e]),void v(e.scopeKey);const t=await(n.upsertGuardrail?.(e));t?.error||(await d(),v(e.scopeKey))},onDelete:async e=>{if(c)return g(t=>t.filter(t=>t.scopeKey!==e)),void v(null);const t=await(n.deleteGuardrail?.(e));t?.error||(await d(),v(null))}},T.scopeKey):null:t(Me,{$height:"100%",children:t(Z,{icon:Tc,title:pw,subTitle:uw,button:{"data-id":"guardrails-create-first",label:Xw,rightIcon:ys,size:W.M,onClick:D}})})})]}):t(Me,{$height:"100%",children:t(Ve,{withSpinner:!0})})})},_$="—",F$="Storage health is not available.",B$="Memory",U$="User",V$="Query",G$=["B","KB","MB","GB","TB","PB"],H$=e=>{if(null==e||e<=0)return"0 B";const t=Math.min(Math.floor(Math.log(e)/Math.log(1024)),G$.length-1);return`${(e/Math.pow(1024,t)).toFixed(0===t?0:1)} ${G$[t]}`},j$=e=>null==e||!Number.isFinite(e)||e<=0?"0 ms":gl(1e9*e),W$=e=>null!=e&&Number.isFinite(e)?Math.round(e).toLocaleString():"0",K$=e=>`${Math.round(e??0)}%`,Y$=f($)`
|
|
2325
2406
|
width: 100%;
|
|
2326
2407
|
min-width: 0;
|
|
2327
2408
|
gap: 12px;
|
|
2328
|
-
`,
|
|
2409
|
+
`,q$=f(T)`
|
|
2329
2410
|
width: 100%;
|
|
2330
2411
|
min-width: 0;
|
|
2331
2412
|
align-items: flex-start;
|
|
2332
2413
|
justify-content: space-between;
|
|
2333
2414
|
gap: 12px;
|
|
2334
2415
|
flex-wrap: wrap;
|
|
2335
|
-
`,
|
|
2416
|
+
`,J$=f($)`
|
|
2336
2417
|
min-width: 0;
|
|
2337
2418
|
flex: 1;
|
|
2338
2419
|
gap: 4px;
|
|
2339
|
-
`,
|
|
2420
|
+
`,Z$=({title:i,description:n,extra:a,children:o})=>e(Y$,{"data-id":`insights-storage-section-${i}`,children:[e(q$,{children:[e(J$,{children:[t(w,{size:C.XS,children:i}),n&&t(w,{size:C.XXXS,color:k.Secondary,children:n})]}),a]}),o]}),Q$=f.div`
|
|
2340
2421
|
display: flex;
|
|
2341
2422
|
flex-wrap: wrap;
|
|
2342
2423
|
gap: 12px;
|
|
2343
2424
|
width: 100%;
|
|
2344
2425
|
min-width: 0;
|
|
2345
|
-
`,
|
|
2426
|
+
`,eN=f($)`
|
|
2346
2427
|
flex: 1 1 160px;
|
|
2347
2428
|
min-width: min(100%, 160px);
|
|
2348
2429
|
max-width: 280px;
|
|
@@ -2350,34 +2431,34 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2350
2431
|
padding: 12px 16px;
|
|
2351
2432
|
border-radius: 12px;
|
|
2352
2433
|
background-color: ${({theme:e})=>e.v2.colors.silver[900]};
|
|
2353
|
-
`,
|
|
2434
|
+
`,tN=({label:i,value:n})=>{const a=v();return e(eN,{children:[t(w,{size:C.XXXS,color:a.v2.colors.grey[150],children:i}),t(w,{size:C.XS,children:n})]})},iN=f.div`
|
|
2354
2435
|
width: 100%;
|
|
2355
2436
|
padding: 12px 16px;
|
|
2356
2437
|
border-radius: 8px;
|
|
2357
2438
|
background-color: ${({theme:e})=>e.v2.colors.silver[900]};
|
|
2358
|
-
`,
|
|
2439
|
+
`,nN=f.div`
|
|
2359
2440
|
width: 100%;
|
|
2360
2441
|
min-width: 0;
|
|
2361
2442
|
overflow-x: auto;
|
|
2362
|
-
`,
|
|
2443
|
+
`,aN=f.div`
|
|
2363
2444
|
width: 100%;
|
|
2364
2445
|
min-width: 0;
|
|
2365
2446
|
overflow-x: auto;
|
|
2366
|
-
`;var
|
|
2447
|
+
`;var oN,lN,rN;(e=>{e.When="when",e.Duration="duration",e.Memory="memory",e.User="user",e.Query="query"})(oN||(oN={})),(e=>{e.Elapsed="elapsed",e.User="user",e.Memory="memory",e.Query="query"})(lN||(lN={})),(e=>{e.Table="table",e.Rows="rows",e.OnDisk="onDisk",e.ActiveParts="activeParts"})(rN||(rN={}));const sN=[{key:oN.When,label:"When",minWidth:"110px"},{key:oN.Duration,label:"Duration",minWidth:"100px"},{key:oN.Memory,label:B$,minWidth:"100px"},{key:oN.User,label:U$,minWidth:"140px"},{key:oN.Query,label:V$,minWidth:"280px",flex:1,noSort:!0,noFilter:!0}],cN=[{key:lN.Elapsed,label:"Elapsed",minWidth:"100px"},{key:lN.User,label:U$,minWidth:"140px"},{key:lN.Memory,label:B$,minWidth:"100px"},{key:lN.Query,label:V$,minWidth:"280px",flex:1,noSort:!0,noFilter:!0}],dN=[{key:rN.Table,label:"Table",minWidth:"200px",flex:1},{key:rN.Rows,label:"Rows (approx)",minWidth:"140px"},{key:rN.OnDisk,label:"On disk",minWidth:"120px"},{key:rN.ActiveParts,label:"Active parts",minWidth:"120px"}],pN=f($)`
|
|
2367
2448
|
flex: 1;
|
|
2368
2449
|
min-height: 0;
|
|
2369
2450
|
width: 100%;
|
|
2370
2451
|
overflow-y: auto;
|
|
2371
2452
|
gap: 24px;
|
|
2372
2453
|
padding: 4px 12px 24px;
|
|
2373
|
-
`,
|
|
2454
|
+
`,uN=e=>{switch(e){case $l.Critical:return ie.Error;case $l.Warning:return ie.Warning;default:return ie.Success}},hN=({title:e})=>t(iN,{children:t(w,{size:C.XXS,color:k.Secondary,children:e})}),gN=()=>{const i=v(),n=nC(eC.Storage),{formatDurationAgo:o}=Nt(),{insightsApi:r}=Lc(),{data:s,loading:c,unsupported:p,error:u}=r.useStorageHealth({pollInterval:15e3}),[h,g]=l("heaviest"),m=d(e=>e?o(e,{style:"short"}):_$,[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:oN.When,rawValue:t(e.finishedAt)},{key:oN.Duration,rawValue:j$(e.elapsedSeconds)},{key:oN.Memory,rawValue:H$(e.memoryBytes)},{key:oN.User,rawValue:e.user},{key:oN.Query,rawValue:e.query}]})))(b,m),[b,m]),y=a(()=>(s?.queries.items??[]).map((e,t)=>({id:`running-${t}`,cells:[{key:lN.Elapsed,rawValue:j$(e.elapsedSeconds)},{key:lN.User,rawValue:e.user},{key:lN.Memory,rawValue:H$(e.memoryBytes)},{key:lN.Query,rawValue:e.query}]})),[s?.queries.items]),S=a(()=>(s?.tables??[]).map(e=>({id:e.name,cells:[{key:rN.Table,rawValue:e.name},{key:rN.Rows,rawValue:W$(e.rows)},{key:rN.OnDisk,rawValue:H$(e.bytesOnDisk)},{key:rN.ActiveParts,rawValue:W$(e.activeParts)}]})),[s?.tables]),x=s?.disk.usedPercent??0,T=Math.max(0,100-x);return t(iw,{icon:n?.panelIcon,title:n?.title||qx,description:n?.panelDescription,children:(()=>{if(p)return t(Me,{$height:"200px",children:t(w,{size:C.XS,color:k.Secondary,children:F$})});if(c&&!s)return t(Me,{$height:"200px",children:t(Ve,{})});if(!s)return t(Me,{$height:"200px",children:t(Z,{hideIcon:!0,title:F$,subTitle:u?.message})});const n=s.connection.reachable,a=s.disk.totalBytes>0;return e(pN,{"data-id":"insights-storage-panel",children:[e(Z$,{title:"Connection",children:[e(Q$,{children:[t(tN,{label:"Reachable",value:n?"OK":"No"}),t(tN,{label:"Ping latency",value:n?(b=s.connection.pingLatencyMs,null!=b&&Number.isFinite(b)?`${Math.round(b)} ms`:"—"):_$}),t(tN,{label:"ClickHouse version",value:s.connection.version||_$}),t(tN,{label:"Database",value:s.connection.database||_$})]}),s.connection.error?t(w,{size:C.XXS,color:i.v2.colors.orange[500],children:s.connection.error}):null]}),t(q,{margin:"0",opacity:.45}),e(Z$,{title:"Disk",children:[t(Q$,{children:t(tN,{label:"Insights data",value:n?H$(s.disk.insightsBytes):_$})}),a?t(aN,{children:e(mt,{bgTint:"900",richTitle:{title:"Filesystem (ClickHouse volume)",titleSize:C.XS},badges:[{key:"disk-used",label:`${K$(s.disk.usedPercent)} used`,status:uN(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(Tl,{variant:Il.CurrentOfMax,gaugeWidth:150,min:0,max:"100%",current:`${Math.round(x)}%`,title:`Total ${H$(s.disk.totalBytes)}`,primaryLabel:`Used ${H$(s.disk.usedBytes)} (${K$(x)})`,secondaryLabel:`Available ${H$(s.disk.availableBytes)} (${K$(T)})`})]})}):t(hN,{title:"Filesystem usage is not available."})]}),t(q,{margin:"0",opacity:.45}),t(Z$,{title:"Memory",children:e(Q$,{children:[t(tN,{label:"Process RSS",value:n?H$(s.memory.processRssBytes):_$}),t(tN,{label:"Pod (cgroup)",value:n?(r=s.memory.cgroupUsedBytes,d=s.memory.cgroupTotalBytes,d>0?`${H$(r)} / ${H$(d)}`:H$(r)):_$}),t(tN,{label:"Uptime",value:n?j$(s.memory.uptimeSeconds):_$})]})}),t(q,{margin:"0",opacity:.45}),e(Z$,{title:"Running queries",children:[e(Q$,{children:[t(tN,{label:"Active now",value:n?String(s.queries.active):_$}),t(tN,{label:"Longest running",value:n?j$(s.queries.longestSeconds):_$}),t(tN,{label:"Peak memory (active)",value:n?H$(s.queries.peakMemoryBytes):_$})]}),y.length?t(nN,{children:t(ui,{variant:hi.DataSecondary,fitContent:!0,columns:cN,rows:y})}):t(hN,{title:"No active queries (idle is normal)."})]}),t(q,{margin:"0",opacity:.45}),t(Z$,{title:"Recent queries",description:"Last 5 min · max 5",extra:t(F,{"data-id":"insights-storage-recent-sort",size:rt.S,selected:h,setSelected:g,options:[{value:"heaviest",label:"Heaviest"},{value:"latest",label:"Latest"}]}),children:f.length?t(nN,{children:t(ui,{variant:hi.DataSecondary,fitContent:!0,maxHeight:320,columns:sN,rows:f})}):t(hN,{title:"No finished queries in the last 5 minutes."})}),t(q,{margin:"0",opacity:.45}),t(Z$,{title:"Database Tables",children:S.length?t(nN,{children:t(ui,{variant:hi.DataSecondary,fitContent:!0,maxHeight:400,columns:dN,rows:S})}):t(hN,{title:"No table stats."})}),t(q,{margin:"0",opacity:.45}),t(Z$,{title:"Write pressure",children:e(Q$,{children:[t(tN,{label:"Unfinished mutations",value:n?String(s.writePressure.unfinishedMutations):_$}),t(tN,{label:"Active parts",value:n?String(s.writePressure.activeParts):_$}),t(tN,{label:"Flush interval",value:s.writeback.flushIntervalSeconds?`${s.writeback.flushIntervalSeconds} s`:_$})]})}),t(q,{margin:"0",opacity:.45}),t(Z$,{title:"Insights <> DB",children:e(Q$,{children:[t(tN,{label:"Last flush",value:(o=s.writeback.everFlushed,l=s.writeback.lastFlushOk,o?l?"OK":"Error":_$)}),t(tN,{label:"Last flush at",value:s.writeback.everFlushed?m(s.writeback.lastFlushAt):_$}),t(tN,{label:"Last flush error",value:s.writeback.lastFlushError||_$})]})})]});var o,l,r,d,b})()})},mN=f(T)`
|
|
2374
2455
|
flex: 1;
|
|
2375
2456
|
min-height: 0;
|
|
2376
2457
|
width: 100%;
|
|
2377
2458
|
align-items: stretch;
|
|
2378
2459
|
gap: 24px;
|
|
2379
2460
|
padding-top: 16px;
|
|
2380
|
-
`,
|
|
2461
|
+
`,bN=()=>{const[i,n]=l(tC),a=d(()=>{switch(i){case eC.Detection:return t(OI,{});case eC.Guardrails:return t(M$,{});case eC.Learning:return t(Hk,{});case eC.System:return t($C,{});case eC.Storage:return t(gN,{});default:return null}},[i]);return e(mN,{"data-id":"insights-settings-and-configurations",children:[t(RC,{selected:i,onSelect:n}),a()]})},fN=[{label:"Overview",value:Ky.Overview},{label:"Findings",value:Ky.Findings},{label:"Transactions",value:Ky.Transactions},{label:"Settings & Configurations",value:Ky.SettingsAndConfigurations}],vN=({minSupportedVersion:i})=>{const{isVersionSupported:n,version:a,minSupportedVersion:o}=Pr(i),[r,s]=l(Ky.Overview),c=d(()=>{switch(r){case Ky.Overview:return t(AS,{setSelectedTab:s});case Ky.Findings:return t(PS,{});case Ky.Transactions:return t(_S,{});case Ky.SettingsAndConfigurations:return t(bN,{});default:return null}},[r]);return t(Qy,{children:t(Zy.Consumer,{children:({drawerIsOpenFor:i,modalIsOpenFor:l,closeModal:d})=>t(el,{children:e(Nl,{children:[!n&&t(Ad,{minSupportedVersion:o,currentVersion:a||""}),e($,{$fullHeight:!0,$gap:12,children:[e($,{$gap:0,children:[t(F,{variant:pi.Underline,size:rt.L,options:fN,selected:r,setSelected:s}),t(q,{margin:"0"})]}),c(),i.type===Yy.Anomaly&&!!i.id&&t(Ex,{type:Yy.Anomaly}),i.type===Yy.Violation&&!!i.id&&t(Ex,{type:Yy.Violation}),i.type===Yy.Transaction&&!!i.id&&t(Wx,{}),l.type===qy.JsonCode&&t(Od,{isOpen:!0,onClose:()=>d(),language:"json",code:l.payload?.jsonCode}),l.type===qy.TraceView&&t(Xx,{isOpen:!0,onClose:()=>d(),transactionId:l.payload?.transactionId,traceId:l.payload?.traceId})]})]})})})})},yN=f.div`
|
|
2381
2462
|
display: flex;
|
|
2382
2463
|
align-items: center;
|
|
2383
2464
|
justify-content: space-between;
|
|
@@ -2386,26 +2467,26 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2386
2467
|
width: 100%;
|
|
2387
2468
|
border-radius: 16px;
|
|
2388
2469
|
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
2389
|
-
`,
|
|
2470
|
+
`,SN=f.div`
|
|
2390
2471
|
display: flex;
|
|
2391
2472
|
align-items: center;
|
|
2392
2473
|
justify-content: center;
|
|
2393
2474
|
padding: 8px;
|
|
2394
2475
|
border-radius: 8px;
|
|
2395
2476
|
background-color: ${({theme:e})=>e.v2.colors.white[500]+I["004"]};
|
|
2396
|
-
`,
|
|
2477
|
+
`,xN=({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||qe.Namespace,l=o===qe.Namespace?i.namespace:`${i.namespace} → ${i.name}`;return e(yN,{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=He(i.option.type).icon;return e(yN,{children:[e(T,{$gap:8,children:[a&&t(SN,{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?Ds:Rs})]},`destination-${n}`)})||[],[l]);return t(Sd,{isOpen:!0,disableAnimation:r,onBack:()=>i(3),onSave:n,header:{icon:Us,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(Xs,{size:24}),t(w,{nowrap:!0,children:ke.SELECTED_SOURCES}),t(E,{label:p.length})]}),t(j,{"data-id":"summary-edit-sources",leftIcon:Cs,variant:K.Secondary,size:W.S,onClick:c})]}),list:p.length?p:[t(Me,{$height:"100%",children:t(Z,{icon:Xs,title:ke.NO_SOURCES_SELECTED,subTitle:ke.ADD_SOURCE_PROMPT,button:{leftIcon:ys,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(As,{size:24}),t(w,{nowrap:!0,children:ke.SELECTED_DESTINATIONS}),t(E,{label:u.length})]}),t(j,{"data-id":"summary-edit-destinations",leftIcon:Cs,variant:K.Secondary,size:W.S,onClick:d})]}),list:u.length?u:[t(Me,{"data-id":"summary-no-destinations",$height:"100%",children:t(Z,{icon:As,title:ke.NO_DESTINATIONS_SELECTED,subTitle:ke.ADD_DESTINATION_PROMPT,button:{leftIcon:ys,label:ke.ADD_DESTINATIONS,onClick:d}})},"no-destinations-data")]}})},wN=f.div`
|
|
2397
2478
|
position: relative;
|
|
2398
2479
|
overflow: hidden;
|
|
2399
2480
|
width: 100vw;
|
|
2400
2481
|
height: 100vh;
|
|
2401
2482
|
box-sizing: border-box;
|
|
2402
|
-
`,
|
|
2483
|
+
`,CN=f.svg`
|
|
2403
2484
|
position: absolute;
|
|
2404
2485
|
top: 50%;
|
|
2405
2486
|
left: 50%;
|
|
2406
2487
|
transform: translate(-50%, -50%);
|
|
2407
2488
|
z-index: -1;
|
|
2408
|
-
`,
|
|
2489
|
+
`,kN=[{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"}],TN=[{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:kN},{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:kN},{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:kN}],IN=({paddingXAxis:i="0px",paddingYAxis:n="0px",children:r})=>{const[s,c]=l(window.innerWidth),d=a(()=>s/TN[0].width,[s]);return o(()=>{const e=()=>c(window.innerWidth);return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),e(wN,{$paddingXAxis:i,$paddingYAxis:n,children:[TN.map(({width:i,height:n,pathOpacity:a,path:o,gradientTransform:l,stops:r},s)=>{const c=`purple-ring-${s}`;return e(CN,{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]})},$N=f.div`
|
|
2409
2490
|
display: flex;
|
|
2410
2491
|
flex-direction: column;
|
|
2411
2492
|
align-items: center;
|
|
@@ -2416,7 +2497,7 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2416
2497
|
width: 50vw;
|
|
2417
2498
|
border-radius: 16px;
|
|
2418
2499
|
background: ${({theme:e})=>e.v2.colors.silver[900]};
|
|
2419
|
-
`,
|
|
2500
|
+
`,NN=f.div`
|
|
2420
2501
|
display: flex;
|
|
2421
2502
|
flex-direction: column;
|
|
2422
2503
|
align-items: center;
|
|
@@ -2426,15 +2507,15 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2426
2507
|
& * {
|
|
2427
2508
|
text-align: center;
|
|
2428
2509
|
}
|
|
2429
|
-
`,
|
|
2510
|
+
`,AN=({onStart:i})=>t(ct,{width:"75vw",isOpen:!0,hideOverlay:!0,disableAnimation:!0,children:t(Me,{$height:"100%",children:e($N,{children:[e(NN,{children:[t(w,{size:C.L,weight:500,children:ke.GET_STARTED_WITH}),t(Id,{size:260}),t(w,{size:C.S,weight:400,children:ke.GET_STARTED_DESCRIPTION})]}),t(j,{"data-id":"onboarding-get-started",label:lt.GET_STARTED,rightIcon:Ss,size:W.L,onClick:i})]})})}),ON=[{step:1,label:ke.INSTALLATION,forceDoneBadge:!0},{step:2,label:ke.SOURCES_SETUP},{step:3,label:ke.DESTINATIONS_SETUP},{step:4,label:ke.SUMMARY}],EN=f.div`
|
|
2430
2511
|
display: flex;
|
|
2431
2512
|
flex-direction: column;
|
|
2432
2513
|
gap: 32px;
|
|
2433
2514
|
padding: 64px;
|
|
2434
|
-
`,
|
|
2515
|
+
`,DN=({pagePaddingXAxis:i,pagePaddingYAxis:n,onDone:a})=>{const{setDrawerType:o}=Vt(),{sourcesApi:r,destinationsApi:s}=Lc(),[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(IN,{paddingXAxis:i,paddingYAxis:n,children:[e(EN,{children:[t(Id,{useInline:!0}),t(Al,{currentStep:c,data:ON,gap:32})]}),t(Qc,{initialInputs:h,children:e(ed,{children:[1===c&&t(AN,{onStart:f}),2===c&&t(yu,{disableAnimation:!0,onBack:e=>{g(e),v()},onNext:e=>{g(e),f()}}),3===c&&t(iu,{disableAnimation:!0,onBack:e=>{b(e),v()},onNext:e=>{b(e),f()},initialInputs:m}),4===c&&t(xN,{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(Aa.OnboardingDone),a()}catch(e){return u(!1),{error:e instanceof Error?e.message:String(e)}}}},sourcesPayload:h,destinationsPayload:m})]})})]})},RN=e=>(e||[]).filter(e=>!!e.id).map(e=>String(e.id)),zN=e=>e.replace(/[_-]+/g," ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/\b\w/g,e=>e.toUpperCase()),XN=e=>{let t=0;return Object.values(e).forEach(e=>{Array.isArray(e)&&(t+=e.length)}),e.onlyErrors&&t++,t},PN=f.div`
|
|
2435
2516
|
position: relative;
|
|
2436
2517
|
display: inline-flex;
|
|
2437
|
-
`,
|
|
2518
|
+
`,LN=f.button`
|
|
2438
2519
|
display: inline-flex;
|
|
2439
2520
|
align-items: center;
|
|
2440
2521
|
gap: 8px;
|
|
@@ -2447,7 +2528,7 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2447
2528
|
&:hover {
|
|
2448
2529
|
background-color: ${({theme:e})=>e.v2.colors.silver[700]};
|
|
2449
2530
|
}
|
|
2450
|
-
`,
|
|
2531
|
+
`,MN=f.div`
|
|
2451
2532
|
position: absolute;
|
|
2452
2533
|
top: calc(100% + 8px);
|
|
2453
2534
|
right: 0;
|
|
@@ -2460,25 +2541,25 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2460
2541
|
border-radius: 12px;
|
|
2461
2542
|
background-color: ${({theme:e})=>e.v2.colors.silver[900]};
|
|
2462
2543
|
box-shadow: 0 0 24px 0 rgba(0, 0, 0, 0.3);
|
|
2463
|
-
`,
|
|
2544
|
+
`,_N=f.div`
|
|
2464
2545
|
display: flex;
|
|
2465
2546
|
flex-direction: column;
|
|
2466
2547
|
gap: 12px;
|
|
2467
2548
|
padding: 16px;
|
|
2468
2549
|
max-height: 60vh;
|
|
2469
2550
|
overflow-y: auto;
|
|
2470
|
-
`,
|
|
2551
|
+
`,FN=f.div`
|
|
2471
2552
|
display: flex;
|
|
2472
2553
|
align-items: center;
|
|
2473
2554
|
gap: 8px;
|
|
2474
2555
|
padding: 12px 16px;
|
|
2475
2556
|
border-top: 1px solid ${({theme:e})=>e.v2.colors.silver[700]};
|
|
2476
|
-
`,
|
|
2557
|
+
`,BN=f.div`
|
|
2477
2558
|
display: flex;
|
|
2478
2559
|
align-items: center;
|
|
2479
2560
|
gap: 8px;
|
|
2480
2561
|
margin-left: auto;
|
|
2481
|
-
`,
|
|
2562
|
+
`,UN=()=>{const i=v(),{platformType:n,isK8s:r,isConnector:s}=Pr(),{sourcesApi:c,namespacesApi:d}=Lc(),u=c.useSources().items,h=d.useNamespaces().items,{selectedStreamName:g}=Te(),{getItemSS:m,setItemSS:b,removeItemSS:f}=Xl(),{statuses:y,namespaces:S,regions:x,kinds:k,monitors:T,languages:I,onlyErrors:$,podsAgentInjectionStatus:N,enabledStatuses:A,setAll:O,clearFilters:D,getEmptyState:R}=Ol(),z=a(()=>El(u,g),[u,g]);o(()=>{const e=m(Dl.OVERVIEW_FILTERS,R());O(e)},[]);const[X,P]=l({statuses:y,namespaces:S,regions:x,kinds:k,monitors:T,languages:I,onlyErrors:$,podsAgentInjectionStatus:N,enabledStatuses:A}),[M,_]=l(XN(X)),[F,B]=l(!1),U=p(n);o(()=>{if(!F){const e={statuses:y,namespaces:S,regions:x,kinds:k,monitors:T,languages:I,onlyErrors:$,podsAgentInjectionStatus:N,enabledStatuses:A};P(e),_(XN(e))}},[F,y,S,x,k,T,I,$,N,A]),o(()=>{U.current!==n&&(U.current=n,f(Dl.OVERVIEW_FILTERS),D(),P(R()),_(0),B(!1))},[n]);const V=p(null);Qt(V,()=>B(!1)),wa({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]),H=a(()=>{const e=new Set,t=[];return z.forEach(({id:i})=>{const{kind:n}=i;e.has(n)||(e.add(n),t.push({id:n,label:qt(n),withCheckbox:!0}))}),t},[z]),Y=a(()=>{const e=new Set,t=[];return z.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))},[z]),q=a(()=>{const e=new Set,t=[];return z.forEach(({runtimeInfo:i})=>{i?.detectedLanguages?.forEach(i=>{e.has(i)||(e.add(i),t.push({id:i,label:Rl[i]||i,withCheckbox:!0}))})}),t.sort((e,t)=>e.id.localeCompare(t.id))},[z]),J=a(()=>zl.map(({id:e,value:t})=>({id:e,label:t,withCheckbox:!0})),[]),Z=a(()=>{const e=new Set,t=[];return z.forEach(({instrumentationReport:i})=>{const n=i?.state||i?.progressStage;n&&!e.has(n)&&(e.add(n),t.push({id:n,label:zN(n),withCheckbox:!0}))}),t.sort((e,t)=>e.label.localeCompare(t.label))},[z]),Q=a(()=>{const e=new Set,t=[];return z.forEach(({podsAgentInjectionStatus:i})=>{const{reasonEnum:n,message:a}=i||{};if(n){if(e.has(n))return;e.add(n),t.push({id:n,label:pt(n),withCheckbox:!0})}else if(a){if(e.has(a))return;e.add(a),t.push({id:a,label:a,withCheckbox:!0})}}),t},[z]),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));P(t=>{return{...t,[e]:(i=n,i.map(({id:e,label:t})=>({id:e,label:t})))};var i})},ne=F?Os:Es,ae=a(()=>RN(X.languages),[X.languages]);return e(PN,{ref:V,children:[e(LN,{"data-id":"filters-trigger",$isOpen:F,type:"button",onClick:()=>B(e=>!e),children:[t(Nc,{size:16,fill:i.v2.colors.white[500]}),t(w,{size:C.XS,weight:500,nowrap:!0,children:"Filters"}),M>0&&t(E,{label:M,status:ie.Unknown,textSize:C.XXXS}),t(ne,{size:16,fill:i.v2.colors.silver[200]})]}),F&&e(MN,{children:[e(_N,{children:[r&&t(Fe,{label:"Namespace",placeholder:"All",withSearch:!0,withMultiSelect:!0,disabled:!G.length,options:G,values:RN(X.namespaces),setValues:e=>te("namespaces",G,e)}),s&&t(Fe,{label:"Region",placeholder:"All",withSearch:!0,withMultiSelect:!0,disabled:!Y.length,options:Y,values:RN(X.regions),setValues:e=>te("regions",Y,e)}),t(Fe,{label:"Kind",placeholder:"All",withSearch:!0,withMultiSelect:!0,disabled:!H.length,options:H,values:RN(X.kinds),setValues:e=>te("kinds",H,e)}),t(Fe,{label:"Programming Language",placeholder:"All",withSearch:!0,withMultiSelect:!0,disabled:!q.length,options:q,values:ae,setValues:e=>te("languages",q,e)}),t(Fe,{label:"Monitors",placeholder:"All",withSearch:!0,withMultiSelect:!0,disabled:!J.length,options:J,values:RN(X.monitors),setValues:e=>te("monitors",J,e)}),t(Fe,r?{label:"Agent Injection Status",placeholder:"All",withSearch:!0,withMultiSelect:!0,disabled:!Q.length,options:Q,values:RN(X.podsAgentInjectionStatus),setValues:e=>te("podsAgentInjectionStatus",Q,e)}:{label:"Instrumentation Status",placeholder:"All",withSearch:!0,withMultiSelect:!0,disabled:!Z.length,options:Z,values:RN(X.statuses),setValues:e=>te("statuses",Z,e)}),t(Fe,{label:"Enabled Status",placeholder:"All",withMultiSelect:!0,options:ee,values:RN(X.enabledStatuses),setValues:e=>te("enabledStatuses",ee,e)}),t(L,{label:"Show only sources with errors",size:Je.L,value:!!X.onlyErrors,onChange:e=>P(t=>({...t,onlyErrors:e}))})]}),e(FN,{children:[t(j,{"data-id":"filters-reset",size:W.S,variant:K.Text,label:"Reset",onClick:()=>{f(Dl.OVERVIEW_FILTERS),D(),P(R()),_(0),B(!1)},textColor:i.v2.colors.red[500]}),e(BN,{children:[t(j,{"data-id":"filters-cancel",size:W.S,variant:K.Secondary,label:"Cancel",onClick:()=>B(!1)}),t(j,{"data-id":"filters-apply",size:W.S,variant:K.Primary,label:"Apply",onClick:()=>{b(Dl.OVERVIEW_FILTERS,X),O(X),_(XN(X)),B(!1)}})]})]})]})]})},VN=f.div`
|
|
2482
2563
|
position: relative;
|
|
2483
2564
|
display: flex;
|
|
2484
2565
|
align-items: center;
|
|
@@ -2489,7 +2570,7 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2489
2570
|
box-sizing: border-box;
|
|
2490
2571
|
border-radius: 16px 16px 0 0;
|
|
2491
2572
|
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
2492
|
-
`,
|
|
2573
|
+
`,GN=f.div`
|
|
2493
2574
|
position: absolute;
|
|
2494
2575
|
bottom: 0;
|
|
2495
2576
|
left: 0;
|
|
@@ -2498,7 +2579,7 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2498
2579
|
background-color: ${({theme:e})=>e.v2.colors.purple[500]};
|
|
2499
2580
|
border-radius: 32px;
|
|
2500
2581
|
transition: width 0.3s;
|
|
2501
|
-
`,
|
|
2582
|
+
`,HN=({entityType:i,badge:n,badgeTooltip:a,isLoading:o,refetch:l,partiallySelected:r,allSelected:s,onSelectAll:c,progressPercent:d})=>{const{setDrawerType:p}=Vt();return e(VN,{children:[e(T,{$gap:8,style:{flex:1,minWidth:0},children:[c&&t(x,{size:kl.S,partiallyChecked:r,value:!!s,onChange:c}),t(w,{size:C.S,nowrap:!0,children:`${pt(i)}s`}),t(E,{label:n,tooltip:a,status:ie.Unknown,textSize:C.XXXS})]}),e(T,{children:[t(Be,{"data-id":`add-${i}`,icon:ys,onClick:()=>p(Pl(i))}),t(Be,{"data-id":`refresh-${i}`,icon:Hs,onClick:l,disabled:o})]}),"number"==typeof d&&t(GN,{$percent:d})]})},jN=f($)`
|
|
2502
2583
|
align-items: center !important;
|
|
2503
2584
|
justify-content: center !important;
|
|
2504
2585
|
align-self: stretch;
|
|
@@ -2513,7 +2594,7 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2513
2594
|
&:hover {
|
|
2514
2595
|
background-color: ${({theme:e})=>e.v2.colors.silver[1e3]};
|
|
2515
2596
|
}
|
|
2516
|
-
`,
|
|
2597
|
+
`,WN=({entityType:i,description:n})=>{const{setDrawerType:a}=Vt();return e(jN,{onClick:()=>a(Pl(i)),children:[e(T,{$gap:4,children:[t(ys,{size:16}),t(w,{size:C.S,children:`Add ${pt(i)}`})]}),t(w,{size:C.XXS,align:"center",children:n})]})},KN=f.div`
|
|
2517
2598
|
display: flex;
|
|
2518
2599
|
align-items: center;
|
|
2519
2600
|
gap: 12px;
|
|
@@ -2528,10 +2609,10 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2528
2609
|
&:hover {
|
|
2529
2610
|
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
2530
2611
|
}
|
|
2531
|
-
`,
|
|
2612
|
+
`,YN=f(T)`
|
|
2532
2613
|
flex: 1;
|
|
2533
2614
|
min-width: 0;
|
|
2534
|
-
`,
|
|
2615
|
+
`,qN=({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===qe.Source,f="boolean"==typeof h,y=r||f&&!h,{setDrawerType:S,setDrawerEntityId:w}=Vt(),{selectedSources:k,setSelectedSources:I}=Ll(),$=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?li(ie.Info,m):l?li(l,m):void 0,D=b&&"object"==typeof i?`${i.namespace}-${i.name}-${i.kind}${i.region?`-${i.region}`:""}`:i;return e(KN,{"data-id":D,$faded:y,onClick:()=>{S(Kt(n)),w(i)},children:[b&&t(x,{size:kl.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(Wt,{icons:p,icon:d,iconSrc:u}),e(YN,{$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 JN(e){return Object.values(e.conditions??{}).filter(Boolean).some(({status:e})=>e===ie.Loading)?e:{...e,workloadOdigosHealthStatus:{status:Dt.Pending,name:"WorkloadOdigosHealthStatus",reasonEnum:"Pending",message:""}}}function ZN(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 QN=f.div`
|
|
2535
2616
|
position: absolute;
|
|
2536
2617
|
top: 0;
|
|
2537
2618
|
left: 0;
|
|
@@ -2542,21 +2623,21 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2542
2623
|
background-color: ${({theme:e})=>e.v2.colors.silver[900]};
|
|
2543
2624
|
border-bottom: 1px solid ${({theme:e})=>e.v2.colors.silver[700]};
|
|
2544
2625
|
pointer-events: none;
|
|
2545
|
-
`,
|
|
2626
|
+
`,eA=f.div`
|
|
2546
2627
|
display: flex;
|
|
2547
2628
|
align-items: center;
|
|
2548
2629
|
gap: 8px;
|
|
2549
2630
|
padding: 4px 8px 0;
|
|
2550
|
-
`,
|
|
2631
|
+
`,tA=f.div`
|
|
2551
2632
|
flex: 1;
|
|
2552
2633
|
height: 1px;
|
|
2553
2634
|
background: ${({theme:e})=>e.v2.colors.silver[700]};
|
|
2554
|
-
|
|
2635
|
+
`,iA=({namespace:e})=>{const i=v();return t(QN,{children:t(w,{size:C.XXS,nowrap:!0,color:i.v2.colors.grey[300],children:e})})},nA=({namespace:i})=>{const n=v();return e(eA,{children:[t(tA,{}),t(w,{size:C.XXS,nowrap:!0,color:n.v2.colors.grey[300],children:i}),t(tA,{})]})},aA={[qe.InstrumentationRule]:ke.NO_DATA_INSTRUMENTATION_RULES,[qe.Source]:ke.NO_DATA_SOURCES,[qe.Action]:ke.NO_DATA_ACTIONS,[qe.Destination]:ke.NO_DATA_DESTINATIONS},oA=f.div`
|
|
2555
2636
|
display: flex;
|
|
2556
2637
|
flex-direction: column;
|
|
2557
2638
|
flex: 1 0 0;
|
|
2558
2639
|
min-width: 0;
|
|
2559
|
-
`,
|
|
2640
|
+
`,lA=f.div`
|
|
2560
2641
|
display: flex;
|
|
2561
2642
|
flex-direction: column;
|
|
2562
2643
|
align-items: stretch;
|
|
@@ -2566,7 +2647,7 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2566
2647
|
border-radius: 0 0 16px 16px;
|
|
2567
2648
|
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
2568
2649
|
overflow: hidden;
|
|
2569
|
-
`,
|
|
2650
|
+
`,rA=f.div`
|
|
2570
2651
|
position: relative;
|
|
2571
2652
|
display: flex;
|
|
2572
2653
|
flex-direction: column;
|
|
@@ -2578,7 +2659,7 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2578
2659
|
background-color: ${({theme:e})=>e.v2.colors.silver[900]};
|
|
2579
2660
|
height: ${({$height:e})=>e}px;
|
|
2580
2661
|
overflow: hidden;
|
|
2581
|
-
`,
|
|
2662
|
+
`,sA=({entityType:i,entities:n,unfilteredCount:r,metrics:s,loading:c,maxHeight:p,refetch:u})=>{const h=i===qe.Source,g=n.length!==r,m=Qe(e=>h?e.progress[it.Instrumenting]?.percentage:void 0),b=Qe(e=>h?e.progress[it.Uninstrumenting]?.percentage:void 0),f=!h||void 0===m&&void 0===b?void 0:m||b||0,{selectedSources:v,setSelectedSources:y}=Ll(),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===qe.Source?s.sources:i===qe.Destination?s.destinations:void 0;if(t)for(const i of t)e.set(Ml(i),i.throughput);return e},[s,i]),w=a(()=>n.map(e=>((e,t,i)=>{const n=bt(e);if(!n)return null;const a=t===qe.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 Dt.Failure:return{status:ie.Error,faded:!1,tooltip:e.workloadOdigosHealthStatus?.message,displaySource:e};case Dt.Notice:return{status:ie.Warning,faded:!1,tooltip:e.workloadOdigosHealthStatus?.message,displaySource:e};case Dt.Pending:case Dt.Waiting:return{status:void 0,faded:!1,displaySource:JN(e)};case Dt.Unsupported:case Dt.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:ZN(e)}}})(e);o=t.status,r=t.faded,l=t.tooltip,s=t.displaySource}else{const i=t===qe.Action?_l(e):e.conditions,{priorotizedStatus:n,hasDisableds:a}=Fl(i);o=n,r=a}const c=Bl(e,t,{extended:a,prioritizeDisplayName:!a});let d,p,u,h,g;switch(t){case qe.Source:{d=jt(e),p=Vl(qe.Source);const t=i?.get(Ul(n));h=Jt(t);const a=e.markedForInstrumentation?.markedForInstrumentation;"boolean"==typeof a&&(g=a);break}case qe.Destination:{const t=He(e.destinationType.type);p=t.icon,u=t.iconSrc;const a=i?.get(Ul(n));h=Jt(a),g=!e.disabled;break}case qe.Action:p=yt(e.type),g=!e.disabled;break;case qe.InstrumentationRule:p=$t(e.type),g=!e.disabled}return{key:Ul(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(nA,{namespace:n.namespace},`ns-divider-${n.namespace}`)),a+=1),o=n.namespace),i.push(n.namespace||""),e.push(t(qN,{...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),R=Math.min(D,E)+8,z="number"==typeof f?`${f}%`:g?`${n.length}/${r}`:r;return e(oA,{children:[t(HN,{entityType:i,badge:z,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(lA,{children:n.length?e(rA,{$height:R,children:[$&&C&&t(iA,{namespace:C}),t(Ut,{gap:4,elements:T,onTopIndexChange:$?O:void 0})]}):c?t(A,{size:3}):t(WN,{entityType:i,description:aA[i]??ke.TO_COLLECT_OTEL_DATA})})]})},cA=f.div`
|
|
2582
2663
|
width: 100%;
|
|
2583
2664
|
flex: 1;
|
|
2584
2665
|
min-height: 0;
|
|
@@ -2586,10 +2667,10 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2586
2667
|
display: flex;
|
|
2587
2668
|
align-items: stretch;
|
|
2588
2669
|
gap: 16px;
|
|
2589
|
-
`,
|
|
2670
|
+
`,dA={sources:[],destinations:[]},pA=()=>{const i=Ol(),{selectedStreamName:n}=Te(),{containerRef:o,containerHeight:l}=Gl(),{sourcesApi:r,destinationsApi:s,actionsApi:c,instrumentationRulesApi:d,metricsApi:p,capabilities:u}=Lc(),{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=Vt(e=>e.drawerType),{data:w}=p.useMetrics({skip:!h.length||!m.length||!!x,pollInterval:1e4,fetchPolicy:"network-only"}),C=w?.getOverviewMetrics??dA,k=a(()=>El(h,n),[h,n]),T=a(()=>Ct(m,n),[m,n]),I=a(()=>Hl(k,i),[k,i]),$=a(()=>jl(T,i),[T,i]),N=a(()=>Wl(f,i),[f,i]);return e(cA,{ref:o,children:[u.canManageInstrumentationRules&&t(sA,{entityType:qe.InstrumentationRule,entities:y,unfilteredCount:y.length,loading:S,maxHeight:l,refetch:d.fetchAll}),t(sA,{entityType:qe.Source,entities:I,unfilteredCount:k.length,metrics:C,loading:g,maxHeight:l,refetch:r.fetchAll}),u.canManageActions&&t(sA,{entityType:qe.Action,entities:N,unfilteredCount:f.length,loading:v,maxHeight:l,refetch:c.fetchAll}),t(sA,{entityType:qe.Destination,entities:$,unfilteredCount:T.length,metrics:C,loading:b,maxHeight:l,refetch:s.fetchAll})]})},uA="40vw",hA=f.div`
|
|
2590
2671
|
position: relative;
|
|
2591
|
-
width: ${
|
|
2592
|
-
`,
|
|
2672
|
+
width: ${uA};
|
|
2673
|
+
`,gA=f.div`
|
|
2593
2674
|
position: absolute;
|
|
2594
2675
|
top: calc(100% + 8px);
|
|
2595
2676
|
left: 0;
|
|
@@ -2598,23 +2679,23 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2598
2679
|
flex-direction: column;
|
|
2599
2680
|
gap: 8px;
|
|
2600
2681
|
padding: 8px;
|
|
2601
|
-
width: calc(${
|
|
2682
|
+
width: calc(${uA} - 16px);
|
|
2602
2683
|
border-radius: 12px;
|
|
2603
2684
|
background-color: ${({theme:e})=>e.v2.colors.silver[900]};
|
|
2604
2685
|
box-shadow: 0 12px 24px 24px rgba(0, 0, 0, 0.5);
|
|
2605
|
-
`,
|
|
2686
|
+
`,mA=f.div`
|
|
2606
2687
|
display: flex;
|
|
2607
2688
|
align-items: center;
|
|
2608
2689
|
overflow-x: auto;
|
|
2609
|
-
`,
|
|
2690
|
+
`,bA=f.div`
|
|
2610
2691
|
display: flex;
|
|
2611
2692
|
flex-direction: column;
|
|
2612
2693
|
gap: 0;
|
|
2613
2694
|
max-height: 60vh;
|
|
2614
2695
|
overflow-y: auto;
|
|
2615
|
-
`,
|
|
2696
|
+
`,fA=f.div`
|
|
2616
2697
|
padding: 8px 12px 4px 12px;
|
|
2617
|
-
`,
|
|
2698
|
+
`,vA=f.div`
|
|
2618
2699
|
display: flex;
|
|
2619
2700
|
align-items: center;
|
|
2620
2701
|
gap: 8px;
|
|
@@ -2624,12 +2705,12 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2624
2705
|
&:hover {
|
|
2625
2706
|
background-color: ${({theme:e})=>e.v2.colors.silver[700]};
|
|
2626
2707
|
}
|
|
2627
|
-
`,
|
|
2708
|
+
`,yA=f.div`
|
|
2628
2709
|
padding: 16px 8px;
|
|
2629
|
-
`,
|
|
2710
|
+
`,SA=({preventPopup:i=!1})=>{const n=v(),{selectedStreamName:o}=Te(),{searchText:s,setSearchText:c}=Ol(),{setDrawerType:d,setDrawerEntityId:u}=Vt(),{sourcesApi:h,destinationsApi:g,actionsApi:m,instrumentationRulesApi:b,capabilities:f}=Lc(),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")};Qt(I,()=>D()),wa({key:"Escape",active:E},D);const{categories:R,searchResults:z}=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:qe.Source,label:"Sources",count:c.length,entities:[]},...l?[{category:qe.Action,label:"Actions",count:d.length,entities:[]}]:[],{category:qe.Destination,label:"Destinations",count:p.length,entities:[]},...r?[{category:qe.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===qe.InstrumentationRule?s:e.category===qe.Source?c:e.category===qe.Action?d:e.category===qe.Destination?p:[]}));return{categories:u,searchResults:h}})({instrumentationRules:T,sources:El(y,o),actions:x,destinations:Ct(S,o),searchText:s,selectedCategory:A,includeActions:f.canManageActions,includeInstrumentationRules:f.canManageInstrumentationRules}),[T,y,x,S,o,s,A,f.canManageActions,f.canManageInstrumentationRules]),X=a(()=>R.filter(({count:e,category:t})=>!!e||"all"===t).map(({category:e,label:t,count:i})=>({value:e,label:i?`${t} (${i})`:t})),[R]),P=z.some(({entities:e})=>e.length>0);return e(hA,{ref:I,children:[t(Bt,{value:s,onChange:e=>c(e.toLowerCase()),onFocus:()=>N(!0),width:uA}),E&&e(gA,{children:[X.length>1&&t(mA,{children:t(F,{options:X,selected:A,setSelected:O})}),P?t(bA,{children:z.map(({category:i,label:a,entities:o},l)=>{if(!o.length)return null;const s=Vl(i);return e(r,{children:[t(fA,{children:t(w,{size:C.XXS,color:k.Secondary,children:a})}),o.map((a,o)=>e(vA,{onClick:()=>{const e=bt(a);e&&(d(Kt(i)),u(e),D())},children:[s&&t(s,{size:16,fill:n.v2.colors.white[500]}),t(w,{size:C.XS,nowrap:!0,children:Bl(a,i,{extended:!0})})]},`entity-${l}-${o}`))]},`category-list-${i}`)})}):t(yA,{children:t(Z,{hideIcon:!0,title:"No results",subTitle:s?`No matches for "${s}"`:"Start typing to search"})})]})]})},xA=({onRedirectToSampling:n})=>{const{sourcesApi:o}=Lc(),{items:l}=o.useSources(),{drawerType:r,drawerEntityId:s,setDrawerType:c,setDrawerEntityId:d}=Vt(),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(Gv,{}),r===Aa.AddSource&&t(Qc,{children:t(yu,{onClose:p,withOverlay:!0})}),r===Aa.AddDestination&&t(ed,{children:t(iu,{onClose:p,withOverlay:!0})}),r===Aa.AddInstrumentationRule&&t(td,{sourceOptions:u,namespaceOptions:h,children:t(nu,{onClose:p,withOverlay:!0})}),r===Aa.AddAction&&t(id,{sourceOptions:u,namespaceOptions:h,children:t(jp,{onClose:p,withOverlay:!0})}),r===Aa.EditSource&&t(nd,{children:t(ef,{onClose:p,sourceId:s,onRedirectToSampling:n})}),r===Aa.EditDestination&&t(ed,{children:t(gg,{onClose:p,destinationId:s})}),r===Aa.EditInstrumentationRule&&t(td,{sourceOptions:u,namespaceOptions:h,children:t(bg,{onClose:p,ruleId:s})}),r===Aa.EditAction&&t(id,{sourceOptions:u,namespaceOptions:h,children:t(pg,{onClose:p,actionId:s})})]})},wA=f.div`
|
|
2630
2711
|
position: relative;
|
|
2631
2712
|
display: inline-flex;
|
|
2632
|
-
`,
|
|
2713
|
+
`,CA=f.div`
|
|
2633
2714
|
display: inline-flex;
|
|
2634
2715
|
align-items: center;
|
|
2635
2716
|
gap: 6px;
|
|
@@ -2640,7 +2721,7 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2640
2721
|
&:hover {
|
|
2641
2722
|
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
2642
2723
|
}
|
|
2643
|
-
`,
|
|
2724
|
+
`,kA=f.div`
|
|
2644
2725
|
position: absolute;
|
|
2645
2726
|
top: calc(100% + 8px);
|
|
2646
2727
|
left: 0;
|
|
@@ -2654,18 +2735,18 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2654
2735
|
border-radius: 12px;
|
|
2655
2736
|
background-color: ${({theme:e})=>e.v2.colors.silver[900]};
|
|
2656
2737
|
box-shadow: 0 0 24px 0 rgba(0, 0, 0, 0.3);
|
|
2657
|
-
`,
|
|
2738
|
+
`,TA=f.div`
|
|
2658
2739
|
display: flex;
|
|
2659
2740
|
align-items: center;
|
|
2660
2741
|
gap: 8px;
|
|
2661
2742
|
width: 100%;
|
|
2662
|
-
`,
|
|
2743
|
+
`,IA=f.div`
|
|
2663
2744
|
display: flex;
|
|
2664
2745
|
flex-direction: column;
|
|
2665
2746
|
gap: 0;
|
|
2666
2747
|
max-height: 240px;
|
|
2667
2748
|
overflow-y: auto;
|
|
2668
|
-
|
|
2749
|
+
`,$A=f.div`
|
|
2669
2750
|
display: flex;
|
|
2670
2751
|
align-items: center;
|
|
2671
2752
|
gap: 8px;
|
|
@@ -2676,41 +2757,41 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2676
2757
|
&:hover {
|
|
2677
2758
|
background-color: ${({$selected:e,theme:t})=>e?t.v2.colors.silver[600]:t.v2.colors.silver[700]};
|
|
2678
2759
|
}
|
|
2679
|
-
`,
|
|
2760
|
+
`,NA=f.div`
|
|
2680
2761
|
flex: 1;
|
|
2681
2762
|
min-width: 0;
|
|
2682
2763
|
overflow: hidden;
|
|
2683
2764
|
text-overflow: ellipsis;
|
|
2684
2765
|
white-space: nowrap;
|
|
2685
|
-
`,
|
|
2766
|
+
`,AA=f.div`
|
|
2686
2767
|
display: flex;
|
|
2687
2768
|
align-items: center;
|
|
2688
2769
|
gap: 2px;
|
|
2689
2770
|
flex-shrink: 0;
|
|
2690
|
-
`,
|
|
2771
|
+
`,OA=f.div`
|
|
2691
2772
|
display: flex;
|
|
2692
2773
|
padding-top: 4px;
|
|
2693
2774
|
border-top: 1px solid ${({theme:e})=>e.v2.colors.silver[700]};
|
|
2694
|
-
`,
|
|
2775
|
+
`,EA=()=>{const n=v(),{isK8s:r}=Pr(),{clearStore:s}=Kl(),{dataStreamsApi:c}=Lc();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,R]=l(""),[z,X]=l(!1);Qt(g,()=>b(!1)),o(()=>{m||y("")},[m]);const P=a(()=>{if(!f)return d;const e=f.toLowerCase();return d.filter(({name:t})=>t.toLowerCase().includes(e))},[d,f]),L=m?Os:Es;return r?e(i,{children:[e(wA,{ref:g,children:[e(CA,{"data-id":"data-stream-select",$isOpen:m,onClick:()=>b(e=>!e),children:[t(Ac,{size:24}),t(w,{size:C.S,weight:500,nowrap:!0,children:(M=u,`Data Stream: ${M}`)}),t(E,{label:d.length,status:ie.Unknown,textSize:C.XXXS}),t(L,{size:20,fill:n.v2.colors.silver[200]})]}),m&&e(kA,{children:[t(TA,{children:t(Bt,{value:f,onChange:y,placeholder:"Search streams...",width:"100%"})}),t(IA,{children:0===P.length?t($A,{children:t(w,{size:C.XS,color:k.Secondary,children:"No streams match"})}):P.map(({name:i})=>{const n=i===Yl;return e($A,{"data-id":`stream-row-${i}`,$selected:i===u,onClick:()=>(e=>{e!==u&&(s(),h(e)),b(!1)})(i),children:[t(NA,{children:t(w,{size:C.XS,nowrap:!0,children:i})}),e(AA,{children:[t(Be,{"data-id":`stream-edit-${i}`,icon:Cs,size:Ue.XS,onClick:e=>{e.stopPropagation(),b(!1),x(i),I(!0)}}),!n&&t(Be,{"data-id":`stream-delete-${i}`,icon:vs,size:Ue.XS,onClick:e=>{e.stopPropagation(),b(!1),R(i),X(!0)}})]})]},`stream-${i}`)})}),t(OA,{children:t(j,{"data-id":"add-stream-trigger",variant:K.Secondary,size:W.S,leftIcon:ys,label:`${lt.NEW} ${ke.STREAM_NAME}`,fullWidth:!0,onClick:()=>{b(!1),s(),O(!0),N(!0)}})})]})]}),A&&t(ad,{defaultExcludeName:u,children:t(Fv,{isOpen:$,onClose:()=>N(!1),onCloseEnd:()=>O(!1)})}),S&&t(ad,{children:t(Bv,{isOpen:T,dataStreamName:S,onClose:()=>I(!1),onCloseEnd:()=>x("")})}),t(Cd,{target:`${ke.STREAM_NAME.toLowerCase()} "${D}"`,isOpen:z,onClose:()=>X(!1),onApprove:async()=>{D&&await c.remove(D)}})]}):null;var M},DA=f($)`
|
|
2695
2776
|
width: 100%;
|
|
2696
2777
|
max-height: 320px;
|
|
2697
2778
|
overflow-y: auto;
|
|
2698
2779
|
gap: 8px;
|
|
2699
|
-
`,
|
|
2780
|
+
`,RA=f(T)`
|
|
2700
2781
|
width: 100%;
|
|
2701
2782
|
align-items: center;
|
|
2702
2783
|
gap: 8px;
|
|
2703
2784
|
padding: 8px 12px;
|
|
2704
2785
|
border-radius: 8px;
|
|
2705
2786
|
background: ${({theme:e})=>e.v2.colors.silver[900]};
|
|
2706
|
-
`,
|
|
2787
|
+
`,zA=()=>{const n=v(),{selectedStreamName:r}=Te(),{selectedSources:s,setSelectedSources:c}=Ll(),{sourcesApi:p}=Lc(),[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 R=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]),z=d(()=>{p.restartWorkloads(Object.values(s).flat().filter(e=>e.id.kind!==Yt.StaticPod).map(Gt)),$()},[p,s,$]),X=d(()=>{R(x,!0),$()},[R,x,$]),P=d(()=>{R(T,!1),$()},[R,T,$]),L=d(()=>{R(x,!0),R(T,!1),$()},[R,x,T,$]),M=x.length>0,_=T.length>0,F=M&&_,B=a(()=>{const e=[{id:"multi-source-deselect",type:Ft.Button,buttonProps:{variant:K.Text,size:W.S,label:"Deselect",onClick:$}},{id:"multi-source-restart",type:Ft.Button,buttonProps:{variant:K.Secondary,size:W.S,label:"Restart",leftIcon:tc,onClick:()=>h(!0)}}];return F?e.push({id:"multi-source-apply",type:Ft.Button,buttonProps:{variant:K.Primary,size:W.S,label:"Apply Changes",leftIcon:ys,onClick:()=>S(!0)}}):M?e.push({id:"multi-source-instrument",type:Ft.Button,buttonProps:{variant:K.Primary,size:W.S,label:"Instrument",leftIcon:ys,onClick:()=>f(!0)}}):_&&e.push({id:"multi-source-uninstrument",type:Ft.Button,buttonProps:{variant:K.Primary,size:W.S,label:"Uninstrument",leftIcon:vs,onClick:()=>m(!0)}}),e},[$,F,M,_]),U=e=>Bl(e,qe.Source,{extended:!0})||e.id.name;return e(i,{children:[t(gi,{isOpen:I>0,richTitle:{icon:Xs,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:()=>{z(),N()}}}),t(Cd,{isOpen:b,action:"instrument",target:`${x.length} source${1===x.length?"":"s"}`,onClose:O,onDeny:O,onApprove:X}),t(Cd,{isOpen:g,action:"uninstrument",target:`${T.length} source${1===T.length?"":"s"}`,onClose:A,onDeny:A,onApprove:P}),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(DA,{children:[x.map(i=>e(RA,{children:[t(E,{leftIcon:ys,status:ie.Success,useSecondaryTone:!0,textColor:n.v2.colors.white[500],textSize:C.XXS}),t(w,{size:C.XS,color:k.Primary,children:U(i)})]},`instrument-${i.id.namespace}-${i.id.kind}-${i.id.name}-${i.id.region??""}`)),T.map(i=>e(RA,{children:[t(E,{leftIcon:ic,status:ie.Error,useSecondaryTone:!0,textColor:n.v2.colors.white[500],textSize:C.XXS}),t(w,{size:C.XS,color:k.Primary,children:U(i)})]},`uninstrument-${i.id.namespace}-${i.id.kind}-${i.id.name}-${i.id.region??""}`))]})})]})},XA=S`
|
|
2707
2788
|
0% {
|
|
2708
2789
|
background-position: 200% 50%;
|
|
2709
2790
|
}
|
|
2710
2791
|
100% {
|
|
2711
2792
|
background-position: 0% 50%;
|
|
2712
2793
|
}
|
|
2713
|
-
`,
|
|
2794
|
+
`,PA=f.div`
|
|
2714
2795
|
display: flex;
|
|
2715
2796
|
align-items: center;
|
|
2716
2797
|
justify-content: space-evenly;
|
|
@@ -2721,24 +2802,24 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2721
2802
|
|
|
2722
2803
|
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%)`};
|
|
2723
2804
|
background-size: 200% 100%;
|
|
2724
|
-
animation: ${
|
|
2725
|
-
`,
|
|
2805
|
+
animation: ${XA} 15s linear infinite;
|
|
2806
|
+
`,LA=({onRedirectToSampling:i})=>{const n=v(),{capabilities:o}=Lc(),l=a(()=>{const e=[];return o.canManageInstrumentationRules&&e.push(zs),e.push(Xs),o.canManageActions&&e.push(fs),e.push(As),e},[o.canManageActions,o.canManageInstrumentationRules]);return e(el,{children:[e(ze,{fullHeight:!0,customTitle:t(EA,{}),customSearch:t(SA,{}),filters:t(UN,{}),children:[t(PA,{children:l.map((i,a)=>e(r,{children:[t(i,{size:24}),a<l.length-1&&t(bs,{fill:n.v2.colors.white[500]+I["020"],size:24})]},i.name))}),t(pA,{})]}),t(xA,{onRedirectToSampling:i}),t(zA,{})]})};var MA;(e=>{e.Gateway="gateway",e.Node="node"})(MA||(MA={}));const _A=({onClickDownloadDiagnose:i,onClickRefresh:n,loading:o,disabled:l})=>{const r=a(()=>{const e=[];return i&&e.push({id:$a(),type:Ft.Button,buttonProps:{label:"Download Diagnose",leftIcon:sc,size:W.S,variant:K.Text,onClick:i,disabled:l}}),n&&e.push({id:$a(),type:Ft.Button,buttonProps:{label:"Refresh",leftIcon:Hs,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(tl,{icon:Oc,title:"Collectors Pipeline"}),t(il,{actions:r})]})},FA=({pod:i,onClose:n})=>{const{formatTimeAgo:o}=Nt(),{collectorsApi:l}=Lc(),{data:r}=l.usePodInfo(i?{namespace:i.namespace,name:i.name}:void 0,{skip:!i}),s=a(()=>[{id:$a(),title:"Node",label:r?.node??"-",withCopy:!0},{id:$a(),title:"Status",badge:{status:ql(r?.status),label:r?.status??"-"}}],[r]),c=a(()=>r?.containers?.map(e=>({id:$a(),items:[{id:$a(),title:"Container",label:e.name??"-"},{id:$a(),title:"Status",label:e.startedAt?`${e.status} (since ${o(e.startedAt)})`:e.status},{id:$a(),title:"Ready",badge:{status:e.ready?ie.Success:ie.Error,leftIcon:e.ready?$s:Ns,label:e.ready?"True":"False",invertColors:!0}},{id:$a(),title:"Started",badge:{status:e.started?ie.Success:ie.Error,leftIcon:e.started?$s:Ns,label:e.started?"True":"False",invertColors:!0}},{id:$a(),title:"Image Version",label:e.image?.split(":")?.[1]??"-"},{id:$a(),title:"Image Repository",label:e.image?.split(":")?.[0]??"-"},{id:$a(),title:ke.RESTARTS,label:e.restarts.toString()},{id:$a(),title:"State Reason",label:e.stateReason??"-"},{id:$a(),title:"Resource Requests",label:`CPU ${e.resources.requests.cpu} • Memory ${e.resources.requests.memory}`},{id:$a(),title:"Resource Limits",label:`CPU ${e.resources.limits.cpu} • Memory ${e.resources.limits.memory}`}]}))||[],[r]);return t(ct,{isOpen:!!i,header:{icon:Ws,title:"Pod Information",onClose:n},children:r?e(mt,{bgTint:"1000",richTitle:{icon:Ws,title:r.name,withCopy:!0},children:[t(mt,{bgTint:"900",cellsPerRow:2,items:s}),e(mt,{bgTint:"900",richTitle:{icon:ec,title:ke.DEBUG_COMMANDS},withCollapse:!0,collapseIsDefaultOpen:!0,children:[t(_t,{value:`kubectl get pod ${r.name} -n ${r.namespace} -o yaml`}),t(_t,{value:`kubectl describe pod ${r.name} -n ${r.namespace}`}),t(_t,{value:`kubectl logs ${r.name} -n ${r.namespace}`})]}),t(mt,{bgTint:"900",richTitle:{title:"Containers Overview"},withCollapse:!0,collapseIsDefaultOpen:!0,children:c.length?c.map(({id:e,items:i})=>t(mt,{bgTint:"800",cellsPerRow:2,items:i},e)):t(Z,{title:"No containers",subTitle:"Pod has no containers"})}),t(kd,{bgTint:"900",yaml:r.manifestYAML,defaultOpen:!0})]}):t(Me,{$height:"50vh",children:t(Ve,{withSpinner:!0})})})};var BA;(e=>{e.PodName="podName",e.Status="status",e.Restarts="restarts",e.NodeName="nodeName",e.SpanDropRate="spanDropRate",e.Age="age",e.DockerImage="dockerImage"})(BA||(BA={}));const UA=e=>{const t=[{key:BA.PodName,label:"Pod Name"},{key:BA.Status,label:"Status"},{key:BA.Restarts,label:ke.RESTARTS},{key:BA.NodeName,label:"Node Name"},{key:BA.Age,label:"Age"},{key:BA.DockerImage,label:"Collector Version"}];return e&&t.splice(4,0,{key:BA.SpanDropRate,label:"Span Drop Rate",noSort:!0,noFilter:!0}),t},VA=({isLoading:i,pods:n,withSpanDropRate:o})=>{const r=v(),{formatTimeAgo:s}=Nt(),[c,d]=l(null),p=a(()=>n.map(i=>({onClick:()=>d(i),cells:[{key:BA.PodName,rawValue:i.name},{key:BA.Status,rawValue:i.status,component:()=>{return e=i.status,t(E,{status:ql(e),label:e});var e}},{key:BA.Restarts,rawValue:i.restartsCount.toString()},{key:BA.NodeName,rawValue:i.nodeName},{key:BA.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?Ec:Dc,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?Ec:Dc,useSecondaryTone:!0,invertColors:!0})})]})}},{key:BA.Age,rawValue:s(i.creationTimestamp)},{key:BA.DockerImage,rawValue:i.image}]})),[n,r]);return e(mt,{fullHeight:!0,bgTint:"1000",moreSpacing:!0,richTitle:{icon:Ws,title:"Pods"},children:[t(ui,{variant:hi.Data,isLoading:i,columns:UA(o),rows:p}),t(FA,{pod:c,onClose:()=>d(null)})]})},GA=({isOpen:e,onClose:i,title:n,yaml:a})=>t(ct,{isOpen:e,header:{icon:Rc,title:n,onClose:i},children:t(kd,{yaml:a,defaultOpen:!0})}),HA=e=>{switch(e){case Jl.Healthy:return"All desired replicas are updated, available, and ready";case Jl.Updating:return"Workload is progressing towards desired state (e.g., updating pods)";case Jl.Degraded:return"Progressing but with availability issues (e.g., not enough available replicas)";case Jl.Failed:return"Progress deadline exceeded or an unrecoverable error occurred";case Jl.Down:return"No available replicas";case Jl.Unknown:return"Status cannot be determined from current signals";default:return"Status unknown"}};var jA;(e=>{e.ManifestYaml="manifest-yaml",e.ConfigMapYaml="configmap-yaml"})(jA||(jA={}));const WA=f.div`
|
|
2726
2807
|
flex: 1;
|
|
2727
2808
|
min-width: 0;
|
|
2728
2809
|
padding: 12px;
|
|
2729
2810
|
border-radius: 12px;
|
|
2730
2811
|
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
2731
|
-
`,
|
|
2812
|
+
`,KA=f(T)`
|
|
2732
2813
|
width: 100%;
|
|
2733
2814
|
min-width: 0;
|
|
2734
2815
|
justify-content: space-between;
|
|
2735
2816
|
flex-wrap: wrap;
|
|
2736
2817
|
align-items: flex-start;
|
|
2737
2818
|
gap: 12px;
|
|
2738
|
-
`,
|
|
2819
|
+
`,YA=f.div`
|
|
2739
2820
|
flex: 1;
|
|
2740
2821
|
min-width: 0;
|
|
2741
|
-
`,
|
|
2822
|
+
`,qA=f.div`
|
|
2742
2823
|
flex-shrink: 0;
|
|
2743
2824
|
|
|
2744
2825
|
@media (max-width: 1099px) {
|
|
@@ -2746,11 +2827,11 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2746
2827
|
display: flex;
|
|
2747
2828
|
justify-content: flex-end;
|
|
2748
2829
|
}
|
|
2749
|
-
`,
|
|
2830
|
+
`,JA=f(T)`
|
|
2750
2831
|
width: 100%;
|
|
2751
2832
|
align-items: stretch;
|
|
2752
2833
|
flex-wrap: wrap;
|
|
2753
|
-
`,
|
|
2834
|
+
`,ZA=f.div`
|
|
2754
2835
|
flex: 2 1 440px;
|
|
2755
2836
|
min-width: 320px;
|
|
2756
2837
|
|
|
@@ -2758,7 +2839,7 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2758
2839
|
flex-basis: 100%;
|
|
2759
2840
|
min-width: 0;
|
|
2760
2841
|
}
|
|
2761
|
-
`,
|
|
2842
|
+
`,QA=f.div`
|
|
2762
2843
|
flex: 1 1 300px;
|
|
2763
2844
|
min-width: 280px;
|
|
2764
2845
|
|
|
@@ -2771,7 +2852,7 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2771
2852
|
flex-basis: 100%;
|
|
2772
2853
|
min-width: 0;
|
|
2773
2854
|
}
|
|
2774
|
-
`,
|
|
2855
|
+
`,eO=f.div`
|
|
2775
2856
|
flex: 1 1 260px;
|
|
2776
2857
|
min-width: 240px;
|
|
2777
2858
|
|
|
@@ -2784,37 +2865,37 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2784
2865
|
flex-basis: 100%;
|
|
2785
2866
|
min-width: 0;
|
|
2786
2867
|
}
|
|
2787
|
-
`,
|
|
2868
|
+
`,tO=({selectedTab:i,gatewayInfo:n,nodeCollectorInfo:o,isLoading:r})=>{const{formatTimeAgo:s}=Nt(),[c,p]=l(null),u=a(()=>(e=>{switch(e){case MA.Gateway:return"Deployment";case MA.Node:return"DaemonSet";default:return"Pipeline Collectors"}})(i),[i]),h=a(()=>((e,t,i,n)=>{const a={status:ie.Disabled,label:"No rollouts yet"};let o=!1,l=null;switch(e){case MA.Gateway:o=t?.rolloutInProgress??!1,l=t?.lastRolloutAt??null;break;case MA.Node:o=i?.rolloutInProgress??!1,l=i?.lastRolloutAt??null;break;default:return a}return o?{status:ie.Info,label:"Rollout in progress",rightIcon:Hs,useSecondaryTone:!0}:l?{status:ie.Disabled,label:`Last Rollout: ${n(l)}`}:a})(i,n,o,s),[n,o,i,s]),g=a(()=>((e,t,i,n)=>{let a=n?ie.Info:ie.Unknown,o=n?"Loading":Jl.Unknown,l=n?"Fetching data...":HA(Jl.Unknown);switch(e){case MA.Gateway:a=t?.status?ql(t?.status):a,o=t?.status??o,l=t?.status?HA(t.status):l;break;case MA.Node:a=i?.status?ql(i?.status):a,o=i?.status??o,l=i?.status?HA(i.status):l}return{status:a,title:o,description:l}})(i,n,o,r),[n,o,i,r]),m=a(()=>((e,t,i)=>{switch(e){case MA.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 MA.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]),b=a(()=>((e,t,i,n)=>{switch(e){case MA.Gateway:return[{title:"Data throughput",cells:[{label:"Traces data",value:Jt(t?.throughputTracesBytesPerSec??0),isLoading:n},{label:"Metrics data",value:Jt(t?.throughputMetricsBytesPerSec??0),isLoading:n},{label:"Logs data",value:Jt(t?.throughputLogsBytesPerSec??0),isLoading:n}]},{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}]}];case MA.Node:return[{title:"Data Throughput",cells:[{label:"Traces data",value:Jt(i?.throughputTracesBytesPerSec??0),isLoading:n},{label:"Metrics data",value:Jt(i?.throughputMetricsBytesPerSec??0),isLoading:n},{label:"Logs data",value:Jt(i?.throughputLogsBytesPerSec??0),isLoading:n}]},{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}]}];default:return[]}})(i,n,o,r),[n,o,i,r]),f=a(()=>(i===MA.Gateway?n?.manifestYAML:o?.manifestYAML)??"",[n,o,i]),v=a(()=>(i===MA.Gateway?n?.configMapYAML:o?.configMapYAML)??"",[n,o,i]),y=d(e=>p(e),[]),S=a(()=>[{id:"view-yaml",type:Ft.DropDataButton,buttonProps:{variant:K.Secondary,size:W.S,label:"View YAML",onClick:y},dropDataProps:{items:[{id:jA.ManifestYaml,label:u,icon:zc},{id:jA.ConfigMapYaml,label:"ConfigMap",icon:zc}]}}],[u,y]);return e(mt,{bgTint:"1000",moreSpacing:!0,children:[e(KA,{children:[t(YA,{children:t(tl,{icon:Rc,title:u,badge:h})}),t(qA,{children:t(il,{actions:S})})]}),e(JA,{$gap:16,children:[t(ZA,{children:t(Zl,{...g})}),m.map(e=>t(QA,{children:t(WA,{children:t(Tl,{...e})})},e.title)),b.map(e=>t(eO,{children:t(nl,{...e})},e.title))]}),t(GA,{isOpen:c===jA.ManifestYaml,onClose:()=>p(null),title:u,yaml:f}),t(GA,{isOpen:c===jA.ConfigMapYaml,onClose:()=>p(null),title:"ConfigMap",yaml:v})]})},iO=[{value:MA.Gateway,label:"Gateway"},{value:MA.Node,label:"Node Collector"}],nO=({minSupportedVersion:i})=>{const{isVersionSupported:n,version:o,minSupportedVersion:r}=Pr(i),[s,c]=l(MA.Gateway),p=s===MA.Gateway,u=s===MA.Node,{collectorsApi:h,configApi:g}=Lc(),{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]);return e(el,{children:[t(_A,{disabled:!n,loading:A,onClickDownloadDiagnose:void 0,onClickRefresh:O}),e(Nl,{children:[e($,{children:[t(F,{variant:pi.Underline,size:rt.L,options:iO,selected:s,setSelected:c}),t(tO,{selectedTab:s,gatewayInfo:b??null,nodeCollectorInfo:w??null,isLoading:A})]}),t(VA,{isLoading:A,pods:E,withSpanDropRate:!1===m?.odigosOwnTelemetryStore?.metricsStoreDisabled}),!n&&t(Ad,{minSupportedVersion:r,currentVersion:o||""})]})]})},aO=f.div`
|
|
2788
2869
|
display: inline-flex;
|
|
2789
2870
|
align-items: center;
|
|
2790
2871
|
min-width: 0;
|
|
2791
2872
|
overflow: hidden;
|
|
2792
2873
|
white-space: pre;
|
|
2793
2874
|
text-overflow: ellipsis;
|
|
2794
|
-
`,
|
|
2875
|
+
`,oO=f.div`
|
|
2795
2876
|
display: flex;
|
|
2796
2877
|
flex-direction: column;
|
|
2797
2878
|
gap: 4px;
|
|
2798
2879
|
min-width: 0;
|
|
2799
2880
|
flex: 1;
|
|
2800
2881
|
opacity: ${({$disabled:e})=>e?.4:1};
|
|
2801
|
-
`,
|
|
2882
|
+
`,lO=f(T)`
|
|
2802
2883
|
flex-shrink: 0;
|
|
2803
2884
|
gap: 6px;
|
|
2804
2885
|
align-items: center;
|
|
2805
2886
|
min-height: 22px;
|
|
2806
|
-
`,
|
|
2887
|
+
`,rO=[{key:"content",label:"Content",noSort:!0,noFilter:!0,flex:1},{key:"badges",label:"Type",noSort:!0,noFilter:!0,flex:"0 0 128px"}],sO=[{value:"all",label:nr},{value:"Relevance",label:"Relevance"},{value:"Duration",label:"Duration"},{value:"Error",label:"Error"}],cO=({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(oO,{$disabled:i.disabled,children:[t(aO,{children:t(Mr,{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(lO,{children:[i.disabled&&t(E,{label:mi,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(ws,{...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:ji,leftIcon:Cs,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(ze,{fullHeight:!0,richTitle:{icon:uc,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:sO,selected:b,setSelected:f}):void 0,children:t(ui,{variant:hi.Pretty,hideHeader:!0,isLoading:o,noDataProps:g.trim()?{hideIcon:!0,title:Ql,subTitle:ir(g)}:{hideIcon:!0,title:tr,button:{label:er,onClick:c}},columns:rO,rows:S,getRowActions:T})})},dO=({docsUrl:i})=>{const{samplingApi:n,sourcesApi:r}=Lc(),{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(Zr.Noisy),[O,E]=l(null),[D,R]=l(!1),[z,X]=l(!1),[P,L]=l(null),[M,_]=l(!1),[B,U]=l(!1),[V,G]=l(!1),[H,Y]=l(!1);p(!1),o(()=>{},[h,u]);const{pendingViewSamplingRule:q,setPendingViewSamplingRule:J}=Vt();o(()=>{if(!q)return;if(h||0===u.length)return;J(null);const e=Qr(u,q.ruleId,q.category);e&&(A(es[q.category]),R(!1),E(e))},[h,u,q,J]);const Z=a(()=>Kr(g),[g]),Q=a(()=>ts(u),[u]),ee=a(()=>Yr(Q?.rule??null),[Q]),ne=a(()=>is(u),[u]),ae=a(()=>ns(ne?.rule??null),[ne]),oe=p(O);oe.current=O,o(()=>{const e=oe.current;if(!e)return;const t=as(u,e);t?E(t):(E(null),R(!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(()=>os(u,N,le),[u,N,le]),se=d(()=>X(!0),[]),ce=d(()=>X(!1),[]);d(()=>Y(!1),[]);const de=d(async e=>{const t=u[0]?.id??"default";switch(ps[N]){case"noisy":await b(t,ss(e));break;case"highlyRelevant":await v(t,rs(e));break;case"costReduction":await S(t,ls(e))}X(!1)},[u,N,b,v,S]),pe=d(e=>{const t=cs(u,e);t&&(R(!1),E(t))},[u]),ue=d(()=>{E(null),R(!1)},[]),he=d((e,t)=>{const i=O;if(i&&i.rule.ruleId===e&&i.samplingId===t)R(!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 R(!0),void E({category:n.category,rule:n.rule,samplingId:t,summary:ds(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,ss(e));break;case"highlyRelevant":await y(i,t,rs(e));break;case"costReduction":await x(i,t,ls(e))}R(!1)}},[O,f,y,x]),me=d((e,t)=>{L({ruleId:e,samplingId:t})},[]),be=d(async()=>{if(!P)return;const{ruleId:e,samplingId:t}=P,i=O?.category||ps[N];await w(t,e,i),E(null),R(!1),L(null)},[P,O,N,w]),fe=d(()=>L(null),[]),ve=d(async(e,t)=>{await C(e,t),_(!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}),U(!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=ps[N];let i=null;switch(t){case"noisy":{const n=ss(e);i=us(u,t,{sourceScopes:n.sourceScopes,operation:n.operation});break}case"highlyRelevant":{const n=rs(e);i=us(u,t,{sourceScopes:n.sourceScopes,operation:n.operation,error:n.error??!1,durationAtLeastMs:n.durationAtLeastMs});break}case"costReduction":{const n=ls(e);i=us(u,t,{sourceScopes:n.sourceScopes,operation:n.operation});break}}return i?{message:ar,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=ss(e);n=us(u,t,{sourceScopes:a.sourceScopes,operation:a.operation},i);break}case"highlyRelevant":{const a=rs(e);n=us(u,t,{sourceScopes:a.sourceScopes,operation:a.operation,error:a.error??!1,durationAtLeastMs:a.durationAtLeastMs},i);break}case"costReduction":{const a=ls(e);n=us(u,t,{sourceScopes:a.sourceScopes,operation:a.operation},i);break}}return n?{message:ar,ruleId:n}:null},[u,O]),ke=d(e=>{X(!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 R(!0),void E({category:i.category,rule:i.rule,samplingId:t.id,summary:ds(i.category,i.rule)})}},[u]),Te=a(()=>{const e=[];return i&&e.push({id:$a(),type:Ft.Button,buttonProps:{"data-id":"sampling-btn-docs",label:or,leftIcon:xs,size:W.S,variant:K.Text,onClick:()=>window.open(i,"_blank")}}),e.push({id:$a(),type:Ft.Button,buttonProps:{"data-id":"sampling-btn-refresh",label:lr,leftIcon:Hs,size:W.S,variant:K.Text,onClick:m,loading:h}}),e.push({id:$a(),type:Ft.Button,buttonProps:{"data-id":"sampling-btn-create-rule",label:rr,rightIcon:ys,size:W.S,variant:K.Primary,onClick:se}}),e},[i,m,h,se]);return e(el,{children:[e(T,{$gap:12,$justifyContent:"space-between",children:[t(tl,{icon:uc,title:cr,subTitle:sr}),t(il,{actions:Te})]}),e($,{$gap:12,$fullHeight:!0,children:[t(F,{variant:pi.Underline,size:rt.L,options:hs,selected:N,setSelected:A}),e(T,{$justifyContent:"space-between",children:[t(te,{status:ie.Default,message:gs[N]}),i&&t(j,{"data-id":"sampling-btn-docs-banner",label:"Docs",leftIcon:xs,size:W.S,variant:K.Text,onClick:()=>window.open(i,"_blank")})]}),N===Zr.Noisy?t(pd,{title:Ee,summary:Z,onEdit:()=>_(!0)}):N===Zr.HighlyRelevant?t(pd,{title:Ie,summary:ee,onEdit:()=>U(!0)}):N===Zr.CostReduction?t(pd,{title:Ae,summary:ae,onEdit:()=>G(!0)}):null,t(cO,{title:ms[N],items:re,isLoading:h,showTypeFilter:N===Zr.HighlyRelevant,onRuleClick:pe,onCreateRule:se,onEditRule:he,onDeleteRule:me})]}),t(Bf,{formType:Vc.View,data:O,defaultEditMode:D,onClose:ue,onDelete:me,onSaveEdit:ge,sourceOptions:k,namespaceOptions:I,validateForm:we,onNavigateToDuplicate:ke}),t(Bf,{formType:Vc.Create,isOpen:z,category:ps[N],onClose:ce,onSubmit:de,sourceOptions:k,namespaceOptions:I,validateForm:xe,onNavigateToDuplicate:ke}),t(Bf,{formType:Vc.EditAutoNoisy,isOpen:M,enabled:g?.enabled??!1,keepPercentage:g?.keepPercentage??0,onClose:()=>_(!1),onSave:ve}),t(Bf,{formType:Vc.EditAutoHighlyRelevant,isOpen:B,enabled:!!Q&&!Q.rule.disabled,onClose:()=>U(!1),onSave:ye}),t(Bf,{formType:Vc.EditAutoCostReduction,isOpen:V,enabled:!!ne&&!ne.rule.disabled,dropPercentage:ne?.rule.percentageAtMost??25,onClose:()=>G(!1),onSave:Se}),t(Ce,{title:hr,description:ur,isOpen:!!P,onClose:fe,denyButton:{label:pr,variant:K.Secondary,onClick:fe},approveButton:{label:dr,variant:K.Primary,onClick:()=>{be(),fe()}}}),!1]})},pO=f.div`
|
|
2807
2888
|
padding: 12px;
|
|
2808
2889
|
border-radius: 12px;
|
|
2809
2890
|
background-color: ${({theme:e})=>e.v2.colors.silver[750]};
|
|
2810
|
-
`,
|
|
2891
|
+
`,uO=b(({id:e,data:i})=>t(pO,{"data-id":e,children:t(Z,{...i})}));var hO,gO;uO.displayName=uO.name,(e=>{e.MapItem="map-item",e.NoData="no-data"})(hO||(hO={})),(e=>{e.AnimatedTraffic="animated-traffic"})(gO||(gO={}));const mO=(e,t,i)=>{if(i)return{icons:[Qs],aggService:e,selected:!0};const n=e.isVirtual,a=n?[Ht(e)]:t?jt(t):[Xc],{priorotizedStatus:o}=n?{priorotizedStatus:void 0}:Fl(t?.conditions||[]);return{icons:a,status:o,isVirtual:n,aggService:e,selected:!0}},bO=e=>!(!e||e.serviceName!==Rg||e.id.namespace||e.id.name||e.id.kind),fO=new Wd,vO={"elk.algorithm":"layered","elk.direction":"RIGHT","elk.layered.spacing.nodeNodeBetweenLayers":"150","elk.spacing.nodeNode":"120","elk.layered.nodePlacement.strategy":"NETWORK_SIMPLEX","elk.layered.spacing.edgeEdgeBetweenLayers":"30","elk.layered.spacing.edgeNodeBetweenLayers":"40"},yO=e=>{const t=e.lastIndexOf("|");return-1===t?{graphKey:e,detail:""}:{graphKey:e.substring(0,t),detail:e.substring(t+1)}},SO={id:{namespace:"",name:"",kind:""},serviceName:Rg,markedForInstrumentation:{markedForInstrumentation:!0}},xO=h(null),wO=()=>{const e=g(xO);if(!e)throw new Error("useServiceMapContext must be used within a ServiceMapProvider");return e},CO=({serviceMap:e,children:i})=>{const n=v(),{sourcesApi:r}=Lc(),{items:s}=r.useSources(),[c,p,u]=zd([]),[h,g,m]=Xd([]),[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=d((e,t)=>{const i=new Set(e);p(e=>e.map(e=>e.type===hO.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}=yO(t.nodeId),o=n(e,t.serviceName);o.isVirtual=!1;for(const e of t.services){const{graphKey:t,detail:l}=yO(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=bO(t);i.push({id:a.graphKey,type:hO.MapItem,position:n,data:mO(a,t,o),measured:{width:80,height:80}})}else i.push({id:hO.NoData,type:hO.NoData,position:n,data:{subTitle:ke.ARE_SERVICES_INSTRUMENTED_AND_PRODUCING_TRAFFIC}});return i})({aggregatedServiceMap:i,sources:[SO].concat(s)});if(1===a.length&&a[0].id===hO.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;a.has(r)&&n.push({id:`${i}-to-${r}`,type:"smoothstep",source:i,target:r,data:{sourceGraphKey:t.graphKey,targetGraphKey:o.targetGraphKey},markerEnd:{type:Rd.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={})=>{const n={id:"root",layoutOptions:{...vO,...i},children:e.map(e=>({id:e.id,width:80,height:80,...e.id===Rg?{layoutOptions:{"elk.layered.layering.layerConstraint":"FIRST","elk.alignment":"CENTER"}}:{}})),edges:t.map(e=>({id:e.id,sources:[e.source],targets:[e.target]}))},a=await fO.layout(n),o=new Map;return a.children?.forEach(e=>{o.set(e.id,{x:e.x??0,y:e.y??0})}),{nodes:e.map(e=>({...e,position:o.get(e.id)??e.position})),edges:t}})(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===hO.MapItem&&i.type===hO.MapItem?{...e,position:i.position,data:{...e.data,selected:i.data.selected}}:{...e,position:i.position}:e})})},[n,e,s,S]);const A=a(()=>w||k?h.map(e=>{if(e.source===w||e.target===w||e.source===k||e.target===k)return{...e,type:gO.AnimatedTraffic};const t={opacity:.3};return{...e,style:{...e.style,...t},labelStyle:{...e.labelStyle,...t},labelBgStyle:{...e.labelBgStyle,...t}}}):h,[h,w,k]),O=a(()=>({nodes:c,edges:A,onNodesChange:u,onEdgesChange:m,setNodesSelected:N,fitViewTrigger:b,hoveredNodeId:w,setHoveredNodeId:C,activeNodeId:k,toggleActiveNode:I,resetActiveNode:$}),[c,A,u,m,N,b,w,k,I,$]);return t(xO.Provider,{value:O,children:i})},kO=f.div`
|
|
2811
2892
|
border: 1px ${({theme:e,$isSelected:t,$isVirtual:i})=>t?`solid ${e.v2.colors.blue[300]}`:i?`dashed ${e.v2.colors.silver[300]}`:"solid transparent"};
|
|
2812
2893
|
border-radius: 8px;
|
|
2813
2894
|
cursor: pointer;
|
|
2814
2895
|
opacity: ${({$isVirtual:e})=>e?.8:1};
|
|
2815
|
-
`,
|
|
2896
|
+
`,TO=f.div`
|
|
2816
2897
|
position: relative;
|
|
2817
|
-
`,
|
|
2898
|
+
`,IO=f.div`
|
|
2818
2899
|
position: absolute;
|
|
2819
2900
|
top: 100%;
|
|
2820
2901
|
left: 50%;
|
|
@@ -2823,7 +2904,7 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2823
2904
|
align-items: center;
|
|
2824
2905
|
gap: 4px;
|
|
2825
2906
|
margin-top: 4px;
|
|
2826
|
-
|
|
2907
|
+
`,$O=b(({id:n,data:o})=>{const{icons:l,status:r,isVirtual:s}=o,c=v(),{activeNodeId:d,hoveredNodeId:p}=wO(),{isUserSource:u,isNodeSelected:h,isHovered:g}=a(()=>({isUserSource:n===Rg,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?li(r,c):null;return e(i,{children:[t(Pd,{type:"source",position:Ld.Right,style:{visibility:"hidden"}}),t(Pd,{type:"target",position:Ld.Left,style:{visibility:"hidden"}}),e(TO,{"data-id":n,children:[t(kO,{$isSelected:m,$isVirtual:s,children:t(Wt,{padding:12,icons:l,status:b?ie.Info:r})}),e(IO,{children:[f&&t(f,{}),t(w,{size:C.XXS,nowrap:!0,children:n})]})]})]})});$O.displayName=$O.name;const NO=f.div`
|
|
2827
2908
|
display: flex;
|
|
2828
2909
|
flex-direction: column;
|
|
2829
2910
|
gap: 12px;
|
|
@@ -2836,10 +2917,10 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2836
2917
|
top: 16px;
|
|
2837
2918
|
left: 8px;
|
|
2838
2919
|
z-index: ${({theme:e})=>e.v2.zIndex.island};
|
|
2839
|
-
`,
|
|
2920
|
+
`,AO=({children:e})=>t(NO,{children:e});var OO,EO;(e=>{e.All="All",e.Inbound="Inbound",e.Outbound="Outbound"})(OO||(OO={})),(e=>{e.Inbound="Inbound",e.Outbound="Outbound"})(EO||(EO={}));const DO=f.div`
|
|
2840
2921
|
flex: 1 1 auto;
|
|
2841
2922
|
min-height: 0;
|
|
2842
|
-
`,
|
|
2923
|
+
`,RO=()=>{const{nodes:i,activeNodeId:n,resetActiveNode:o}=wO(),[r,s]=l(OO.All),c=a(()=>{const e=new Map;for(const t of i)t.type===hO.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:EO.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:EO.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=[OO.All,OO.Inbound].includes(r)&&p.length>0,g=[OO.All,OO.Outbound].includes(r)&&u.length>0;return e(AO,{children:[e(T,{$width:"100%",$gap:8,children:[t(j,{variant:K.Text,size:W.S,leftIcon:Vs,onClick:o}),t(Wt,{icons:d.data.icons}),t(w,{size:C.XS,children:d.id})]}),t(F,{fullWidth:!0,options:[{label:`${OO.All}`,value:OO.All,badge:{label:`${p.length+u.length}`}},{label:`${OO.Inbound}`,value:OO.Inbound,badge:{label:`${p.length}`}},{label:`${OO.Outbound}`,value:OO.Outbound,badge:{label:`${u.length}`}}],selected:r,setSelected:s}),h&&t(XO,{halfHeight:g,title:"Inbound",icon:Js,connections:p,mapNodesById:c}),g&&t(XO,{halfHeight:h,title:"Outbound",icon:Zs,connections:u,mapNodesById:c})]})},zO=f.div`
|
|
2843
2924
|
display: flex;
|
|
2844
2925
|
flex-direction: column;
|
|
2845
2926
|
gap: 8px;
|
|
@@ -2847,17 +2928,17 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2847
2928
|
border-radius: 12px;
|
|
2848
2929
|
background-color: ${({theme:e})=>e.v2.colors.silver[900]};
|
|
2849
2930
|
height: ${({$halfHeight:e})=>e?"48%":"100%"};
|
|
2850
|
-
`,
|
|
2931
|
+
`,XO=({halfHeight:i,title:n,icon:a,connections:o,mapNodesById:l})=>{const r=v();return e(zO,{$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(DO,{children:t(Ut,{gap:4,elements:o.map(e=>t(LO,{connection:e,peerNode:l.get(e.peerId)},`${e.direction}-${e.peerId}`))})})]})},PO=f.div`
|
|
2851
2932
|
display: flex;
|
|
2852
2933
|
align-items: center;
|
|
2853
2934
|
gap: 8px;
|
|
2854
2935
|
padding: 8px;
|
|
2855
2936
|
border-radius: 8px;
|
|
2856
2937
|
background-color: ${({theme:e})=>e.v2.colors.silver[900]};
|
|
2857
|
-
`,
|
|
2938
|
+
`,LO=({connection:i,peerNode:n})=>e(PO,{children:[n&&t(Wt,{icons:n.data.icons}),t(w,{size:C.XXS,children:i.peerId})]}),MO="0;0.5;1",_O=b(({id:n,sourceX:a,sourceY:o,targetX:l,targetY:r,sourcePosition:s,targetPosition:c,markerEnd:d})=>{const p=v(),[u]=Md({sourceX:a,sourceY:o,targetX:l,targetY:r,sourcePosition:s,targetPosition:c}),h=`${n}__animated-traffic-motion`,g=p.v2.colors.blue[700],m=p.v2.colors.blue[900],b=p.v2.colors.blue[500],f="4s";return e(i,{children:[t(_d,{id:n,path:u,markerEnd:d,style:{stroke:g,strokeWidth:1}}),t(Fd,{children:e("svg",{style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",overflow:"visible",pointerEvents:"none"},children:[t("path",{id:h,d:u,fill:"none",stroke:"none"}),Array.from({length:5}).map((i,n)=>{const a=`-${(.8*n).toFixed(3)}s`;return e("circle",{r:0,fill:m,children:[t("animateMotion",{dur:f,begin:a,repeatCount:"indefinite",children:t("mpath",{href:`#${h}`})}),t("animate",{attributeName:"r",dur:f,begin:a,repeatCount:"indefinite",keyTimes:MO,values:"0;3.5;3.5"}),t("animate",{attributeName:"fill",dur:f,begin:a,repeatCount:"indefinite",keyTimes:MO,values:`${m};${b};${b}`})]},n)})]})})]})});_O.displayName=_O.name;const FO=f.div`
|
|
2858
2939
|
flex: 1 1 auto;
|
|
2859
2940
|
min-height: 0;
|
|
2860
|
-
`,
|
|
2941
|
+
`,BO=({})=>{const{nodes:i,setNodesSelected:n,resetActiveNode:o}=wO(),[r,s]=l(""),c=a(()=>i.filter(e=>e.type===hO.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(AO,{children:[e(T,{$width:"100%",$gap:8,children:[t(w,{size:C.XS,children:"Services"}),t(E,{label:c.length})]}),t(Bt,{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(FO,{children:t(Ut,{gap:4,elements:u.map(e=>t(VO,{node:e},e.id))})})]}):null},UO=f.div`
|
|
2861
2942
|
display: flex;
|
|
2862
2943
|
align-items: center;
|
|
2863
2944
|
gap: 8px;
|
|
@@ -2865,7 +2946,7 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2865
2946
|
border-radius: 8px;
|
|
2866
2947
|
background-color: ${({theme:e})=>e.v2.colors.silver[900]};
|
|
2867
2948
|
cursor: pointer;
|
|
2868
|
-
`,
|
|
2949
|
+
`,VO=({node:i})=>{const{setNodesSelected:n,activeNodeId:a,resetActiveNode:o}=wO(),l=d(()=>{const e=!i.data.selected,t=a===i.id;n([i.id],e),!e&&t&&o()},[i,a,n,o]);return e(UO,{onClick:l,children:[t(x,{value:i.data.selected||!1,onChange:l}),t(Wt,{icons:i.data.icons}),t(w,{size:C.XXS,children:i.id})]},i.id)},GO=f.div`
|
|
2869
2950
|
position: relative;
|
|
2870
2951
|
height: 100%;
|
|
2871
2952
|
.react-flow__attribution {
|
|
@@ -2874,7 +2955,7 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2874
2955
|
* {
|
|
2875
2956
|
transition: none;
|
|
2876
2957
|
}
|
|
2877
|
-
`,
|
|
2958
|
+
`,HO=f.div`
|
|
2878
2959
|
.react-flow__controls {
|
|
2879
2960
|
display: flex;
|
|
2880
2961
|
align-items: center;
|
|
@@ -2900,33 +2981,33 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2900
2981
|
}
|
|
2901
2982
|
}
|
|
2902
2983
|
}
|
|
2903
|
-
`,
|
|
2984
|
+
`,jO={[hO.MapItem]:$O,[hO.NoData]:uO},WO={[gO.AnimatedTraffic]:_O},KO={duration:300,padding:.1,includeHiddenNodes:!0,maxZoom:1},YO=({trigger:e})=>{const{fitView:t}=jd(),i=p(!0);return o(()=>{i.current?i.current=!1:e>0&&requestAnimationFrame(()=>t(KO))},[e,t]),null},qO=({onRefresh:i})=>{const{nodes:n,edges:o,fitViewTrigger:l,onNodesChange:r,onEdgesChange:s,setHoveredNodeId:c,toggleActiveNode:d}=wO(),p=a(()=>{const e=new Set(n.filter(e=>e.type===hO.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!==hO.MapItem||e.data.selected||t.has(e.id))},[n,o]);return e(Ud,{zoomOnScroll:!0,nodes:p,nodeTypes:jO,edges:o,edgeTypes:WO,onNodeClick:(e,t)=>d(t.id),onNodeMouseEnter:(e,t)=>c(t.id),onNodeMouseLeave:()=>c(null),onNodesChange:r,onEdgesChange:s,children:[t(Vd,{}),t(YO,{trigger:l}),t(HO,{children:t(Gd,{position:"top-right",orientation:"horizontal",showInteractive:!1,showZoom:!0,showFitView:!0,fitViewOptions:KO,children:t(Hd,{onClick:i,children:t(Hs,{})})})})]})},JO=i=>t(Bd,{children:e(GO,{children:[t(qO,{...i}),t(BO,{}),t(RO,{})]})}),ZO=f.div`
|
|
2904
2985
|
width: 100%;
|
|
2905
2986
|
flex: 1;
|
|
2906
2987
|
align-self: stretch;
|
|
2907
2988
|
min-height: 0;
|
|
2908
2989
|
height: 100%;
|
|
2909
2990
|
position: relative;
|
|
2910
|
-
`,
|
|
2991
|
+
`,QO=()=>{const{serviceMapApi:e}=Lc(),{data:i,refetch:n}=e.useServiceMap({pollInterval:5e3,fetchPolicy:"cache-and-network"});return t(CO,{serviceMap:i?.serviceMap??[],children:t(ZO,{children:t(JO,{onRefresh:n})})})},eE=f.div`
|
|
2911
2992
|
display: flex;
|
|
2912
2993
|
align-items: center;
|
|
2913
2994
|
justify-content: space-between;
|
|
2914
2995
|
padding: 0 12px;
|
|
2915
|
-
`,
|
|
2996
|
+
`,tE=f.div`
|
|
2916
2997
|
display: flex;
|
|
2917
2998
|
align-items: center;
|
|
2918
2999
|
gap: 8px;
|
|
2919
|
-
|
|
3000
|
+
`,iE=f.div`
|
|
2920
3001
|
width: 1px;
|
|
2921
3002
|
height: 20px;
|
|
2922
3003
|
background-color: ${({theme:e})=>e.v2.colors.silver[500]};
|
|
2923
|
-
`,
|
|
3004
|
+
`,nE=({disabled:i,loading:n,onClickShowYaml:o,onClickReset:r,onClickRefresh:s})=>{const c=v(),[d,p]=l(!1),u=a(()=>o?[{id:$a(),type:Ft.Button,buttonProps:{label:"Show Config YAML",leftIcon:zc,size:W.S,variant:K.Secondary,onClick:o,disabled:i}}]:[],[o,i]),h=a(()=>{const e=[];return s&&e.push({id:$a(),type:Ft.Button,buttonProps:{leftIcon:Hs,tooltip:"Refresh",hideTooltipIcon:!0,size:W.S,variant:K.Text,onClick:s,disabled:i,loading:n}}),r&&e.push({id:$a(),type:Ft.Button,buttonProps:{leftIcon:vs,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(eE,{children:[t(tl,{icon:js,title:"Odigos Settings"}),e(tE,{children:[g&&t(il,{actions:u}),g&&m&&t(iE,{}),m&&t(il,{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)}}})]})},aE=f($)`
|
|
2924
3005
|
width: 220px;
|
|
2925
3006
|
flex-shrink: 0;
|
|
2926
3007
|
height: 100%;
|
|
2927
3008
|
gap: 4px;
|
|
2928
3009
|
overflow-y: auto;
|
|
2929
|
-
`,
|
|
3010
|
+
`,oE=({options:e,selected:i,setSelected:n,disabled:a})=>t(aE,{children:e.map(e=>t(Qd,{dataId:`settings-nav-${e.id}`,title:e.label,isSelected:i===e.id,disabled:a,onClick:()=>n(e.id)},e.id))}),lE=f($)`
|
|
2930
3011
|
width: 100%;
|
|
2931
3012
|
/* side menu (220) + gap (24) + form (600) = 844, so content fills exactly with no dead space */
|
|
2932
3013
|
max-width: 844px;
|
|
@@ -2936,25 +3017,25 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2936
3017
|
gap: 24px;
|
|
2937
3018
|
flex: 1;
|
|
2938
3019
|
min-height: 0;
|
|
2939
|
-
`,
|
|
3020
|
+
`,rE=f(T)`
|
|
2940
3021
|
flex: 1;
|
|
2941
3022
|
min-height: 0;
|
|
2942
3023
|
width: 100%;
|
|
2943
3024
|
align-self: stretch;
|
|
2944
|
-
`,
|
|
3025
|
+
`,sE=f($)`
|
|
2945
3026
|
flex: 1;
|
|
2946
3027
|
min-height: 0;
|
|
2947
3028
|
height: 100%;
|
|
2948
3029
|
max-width: 600px;
|
|
2949
3030
|
overflow-y: auto;
|
|
2950
|
-
`,
|
|
3031
|
+
`,cE=f(T)`
|
|
2951
3032
|
gap: 8px;
|
|
2952
3033
|
width: 100%;
|
|
2953
3034
|
align-items: center;
|
|
2954
|
-
`,
|
|
3035
|
+
`,dE=f.div`
|
|
2955
3036
|
flex: 1;
|
|
2956
3037
|
min-width: 0;
|
|
2957
|
-
`,
|
|
3038
|
+
`,pE=e=>"general"===e.name?0:"advanced"===e.name?2:1,uE=({minSupportedVersion:n})=>{const{isVersionSupported:r,version:s,isEnterprise:c,minSupportedVersion:d}=Pr(n),{configApi:p}=Lc(),{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}=St(S);o(()=>{"{}"!==JSON.stringify(S)&&"{}"===JSON.stringify(x)&&I(void 0,void 0,S)},[S,x]);const D=a(()=>[...f].sort((e,t)=>pE(e)-pE(t)),[f]),R=a(()=>(e=>{if(!e)return{};const t={};for(const i of e)t[i.helmPath]=i.reconciledFrom;return t})(g?.provenance),[g?.provenance]),z=a(()=>{const e=new Set;for(const t of f)for(const i of t.fields)i.componentType===gt.Dropdown&&e.add(i.helmValuePath);return e},[f]),X=a(()=>f.flatMap(e=>e.fields.map(e=>({name:e.helmValuePath,value:N("formData",e.helmValuePath)}))),[f,x,N]),[P,L]=l(!1),[M,_]=l(!1),F=a(()=>[{id:$a(),type:Ft.Button,buttonProps:{"data-id":"settings-save",variant:K.Primary,size:W.S,label:"Save Changes",leftIcon:Ds,loading:v,onClick:()=>L(!0)}},{id:$a(),type:Ft.Button,buttonProps:{"data-id":"settings-cancel",variant:K.Secondary,size:W.S,label:"Cancel",leftIcon:Rs,onClick:()=>I(void 0,void 0,S)}}],[v,A,S,x,I]),B=a(()=>D.map(e=>({id:e.name,label:e.displayName})),[D]),U=a(()=>D.map(e=>e.name),[D]),{selectedSection:V,setSelectedSection:G,setSectionRef:H,setScrollContainerRef:j}=gr({sectionNames:U});return t(el,{$gap:24,children:e(lE,{children:[t(nE,{disabled:!r,loading:h||m,onClickShowYaml:()=>_(!0),onClickReset:async()=>{await(async()=>{p.resetLocalUiConfigToDefaults&&await p.resetLocalUiConfigToDefaults()})(),await(b?.()),I(void 0,void 0,{})},onClickRefresh:b?()=>b():void 0}),e(Nl,{children:[!r&&t(Ad,{minSupportedVersion:d,currentVersion:s||""}),t(gi,{isOpen:O,richTitle:{icon:js,title:"Config Settings"},actions:F}),t(Ce,{isOpen:P,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),z);await(async e=>{p.updateLocalUiConfig&&(y(!0),await p.updateLocalUiConfig(e),y(!1),await b())})(e),I(void 0,void 0,{})})(),L(!1)}}}),e(rE,{$gap:24,$alignItems:"stretch",children:[!!f.length&&t(oE,{options:B,selected:V,setSelected:G,disabled:!r}),t(sE,{ref:j,$gap:24,$width:"100%",children:f.length?D.map(n=>t(ze,{id:n.name,bordered:!0,ref:e=>H(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&&!wt(n.renderCondition,[],X))return null;const a=We(n.componentProps||"{}",{}),o=R[n.helmValuePath],l=n.componentType===gt.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(Ed,{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:Je.S},n.helmValuePath),g=n.isHelmOnly?t(ce,{text:"This field can only be updated via the Helm values.yaml file",children:t(Cc,{})}):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(cE,{children:[t(dE,{children:h}),g]})]})},n.helmValuePath)})})},n.name)):h?t(Me,{$height:"30vh",children:t(Ve,{withSpinner:!0})}):t(ze,{richTitle:{icon:js,title:"Config Settings"},children:t(Z,{title:"YAML not found",subTitle:"The YAML for this resource is not available"})})})]}),t(ct,{isOpen:M,width:"40vw",minWidth:"480px",header:{icon:zc,title:"Effective Config YAML",onClose:()=>_(!1)},children:m&&!g?.manifestYAML?t(Me,{$height:"30vh",children:t(Ve,{withSpinner:!0})}):t(kd,{yaml:g?.manifestYAML?.replaceAll(" |",""),defaultOpen:!0,fullHeight:!0})})]})]})})},hE=f.div`
|
|
2958
3039
|
position: fixed;
|
|
2959
3040
|
bottom: 12px;
|
|
2960
3041
|
left: 12px;
|
|
@@ -2963,51 +3044,51 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
2963
3044
|
flex-direction: column-reverse;
|
|
2964
3045
|
gap: 6px;
|
|
2965
3046
|
max-width: 600px;
|
|
2966
|
-
`,
|
|
3047
|
+
`,gE=()=>{const{notifications:e,markAsDismissed:i,markAsSeen:n}=Tt(),a=e.filter(({dismissed:e})=>!e);return t(hE,{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}`)})})},mE=f($)`
|
|
2967
3048
|
width: 100%;
|
|
2968
3049
|
flex-shrink: 0;
|
|
2969
3050
|
border-radius: 16px;
|
|
2970
3051
|
background: ${({theme:e})=>e.v2.colors.silver[1e3]};
|
|
2971
3052
|
overflow: hidden;
|
|
2972
|
-
`,
|
|
3053
|
+
`,bE=f.div`
|
|
2973
3054
|
display: flex;
|
|
2974
3055
|
align-items: flex-start;
|
|
2975
3056
|
justify-content: space-between;
|
|
2976
3057
|
gap: 8px;
|
|
2977
3058
|
padding: 16px 16px 8px;
|
|
2978
|
-
`,
|
|
3059
|
+
`,fE=f($)`
|
|
2979
3060
|
gap: 0;
|
|
2980
3061
|
flex: 1;
|
|
2981
3062
|
min-width: 0;
|
|
2982
|
-
`,
|
|
3063
|
+
`,vE=f($)`
|
|
2983
3064
|
gap: 0;
|
|
2984
3065
|
padding: 8px 16px 16px;
|
|
2985
|
-
`,
|
|
3066
|
+
`,yE=f($)`
|
|
2986
3067
|
gap: 8px;
|
|
2987
3068
|
padding: 12px;
|
|
2988
3069
|
border-radius: 12px;
|
|
2989
3070
|
background: ${({theme:e})=>e.v2.colors.silver[900]};
|
|
2990
|
-
`,
|
|
3071
|
+
`,SE=f.div`
|
|
2991
3072
|
display: flex;
|
|
2992
3073
|
align-items: center;
|
|
2993
3074
|
gap: 4px;
|
|
2994
3075
|
height: 40px;
|
|
2995
3076
|
width: 100%;
|
|
2996
|
-
`,
|
|
3077
|
+
`,xE=f.div`
|
|
2997
3078
|
display: flex;
|
|
2998
3079
|
align-items: center;
|
|
2999
3080
|
gap: 8px;
|
|
3000
3081
|
flex: 1;
|
|
3001
3082
|
min-width: 0;
|
|
3002
|
-
`,
|
|
3083
|
+
`,wE=f.div`
|
|
3003
3084
|
display: flex;
|
|
3004
3085
|
align-items: center;
|
|
3005
3086
|
gap: 8px;
|
|
3006
3087
|
flex-shrink: 0;
|
|
3007
|
-
`,
|
|
3088
|
+
`,CE=f($)`
|
|
3008
3089
|
gap: 8px;
|
|
3009
3090
|
width: 100%;
|
|
3010
|
-
`,
|
|
3091
|
+
`,kE=f.div`
|
|
3011
3092
|
display: flex;
|
|
3012
3093
|
align-items: center;
|
|
3013
3094
|
gap: 24px;
|
|
@@ -3024,26 +3105,26 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
3024
3105
|
opacity: 1;
|
|
3025
3106
|
pointer-events: auto;
|
|
3026
3107
|
}
|
|
3027
|
-
`,
|
|
3108
|
+
`,TE=f.div`
|
|
3028
3109
|
flex-shrink: 0;
|
|
3029
|
-
`,
|
|
3110
|
+
`,IE=f.div`
|
|
3030
3111
|
display: flex;
|
|
3031
3112
|
align-items: center;
|
|
3032
3113
|
gap: 8px;
|
|
3033
3114
|
flex-wrap: wrap;
|
|
3034
|
-
|
|
3115
|
+
`,$E=f.div`
|
|
3035
3116
|
display: flex;
|
|
3036
3117
|
align-items: center;
|
|
3037
3118
|
gap: 8px;
|
|
3038
3119
|
flex-wrap: wrap;
|
|
3039
|
-
`,
|
|
3120
|
+
`,NE=f.div`
|
|
3040
3121
|
display: flex;
|
|
3041
3122
|
align-items: center;
|
|
3042
3123
|
height: 24px;
|
|
3043
3124
|
padding: 0 8px;
|
|
3044
3125
|
border-radius: 4px;
|
|
3045
3126
|
background: ${({theme:e})=>e.v2.colors.blue[1e3]};
|
|
3046
|
-
`,
|
|
3127
|
+
`,AE=f.div`
|
|
3047
3128
|
display: flex;
|
|
3048
3129
|
align-items: center;
|
|
3049
3130
|
justify-content: center;
|
|
@@ -3051,7 +3132,7 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
3051
3132
|
padding: 0 8px;
|
|
3052
3133
|
border-radius: 100px;
|
|
3053
3134
|
background: ${({theme:e,$variant:t})=>"enabled"===t?e.v2.colors.green[1e3]:e.v2.colors.silver[600]};
|
|
3054
|
-
`,
|
|
3135
|
+
`,OE=f.div`
|
|
3055
3136
|
display: flex;
|
|
3056
3137
|
flex-shrink: 0;
|
|
3057
3138
|
padding: 4px;
|
|
@@ -3061,7 +3142,7 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
3061
3142
|
opacity: 0;
|
|
3062
3143
|
pointer-events: none;
|
|
3063
3144
|
transition: opacity 0.15s ease;
|
|
3064
|
-
`,
|
|
3145
|
+
`,EE=f.button`
|
|
3065
3146
|
display: flex;
|
|
3066
3147
|
align-items: center;
|
|
3067
3148
|
justify-content: center;
|
|
@@ -3070,73 +3151,73 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
3070
3151
|
background: transparent;
|
|
3071
3152
|
cursor: pointer;
|
|
3072
3153
|
flex-shrink: 0;
|
|
3073
|
-
`;function
|
|
3154
|
+
`;function DE(e){const t=!e.disabled,i=e.skipPolicy,n=(i?.skipHttpStatusCodes??[]).filter(e=>Number.isInteger(e));return i?.skipForNonSuccessCodes?"Skip default templatization for non-2xx responses":1===n.length?`Skip default templatization for HTTP ${n[0]}`:n.length>1?"Skip default templatization for selected HTTP codes":t?"Default heuristic templatization enabled":"Default heuristic templatization disabled"}const RE=({actionName:i,groups:n,onAddRule:a,onEditRule:o})=>{const r=v(),[s,c]=l(!0),[d,p]=l(!0);return e(mE,{"data-id":"url-templatization-default-rules-list",children:[e(bE,{children:[e(fE,{children:[t(w,{size:C.S,children:mr}),t(w,{size:C.XXS,color:k.Secondary,children:br})]}),t(EE,{type:"button","aria-label":s?"Collapse section":"Expand section",onClick:()=>c(e=>!e),children:t(s?Os:Es,{size:18})})]}),s&&t(vE,{children:e(yE,{children:[e(SE,{children:[t(EE,{type:"button","aria-label":d?"Collapse action rules":"Expand action rules",onClick:()=>p(e=>!e),children:t(d?Es:Os,{size:18})}),e(xE,{children:[t(w,{size:C.XS,color:k.Secondary,children:i||"URL Templatization"}),e(wE,{children:[t(E,{label:`${n.length} rules`,backgroundColor:r.v2.colors.silver[600],textColor:r.v2.colors.white[500]}),t(E,{label:"UI",backgroundColor:"#062A31",textColor:"#4CD1F2"})]})]}),t(j,{"data-id":"url-templatization-default-rules-add",label:Hn,rightIcon:ys,variant:K.Text,size:W.S,onClick:a})]}),d&&t(CE,{children:n.map((i,n)=>{const a=!i.disabled,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),s=(c=i.scopes,jr(c)?"Entire cluster":`${(c?.sources?.length??0)+(c?.namespaces?.length??0)+(c?.languages?.length??0)} scoped filters`);var c;return e(kE,{$elevated:1===n,children:[t(TE,{children:t(w,{size:C.XXS,children:DE(i)})}),e(IE,{children:[e($E,{children:[t(NE,{children:t(w,{size:C.XXS,color:r.v2.colors.blue[300],children:s})}),t(AE,{$variant:"enabled",children:t(w,{size:C.XXXS,color:r.v2.colors.green[500],children:a?"Default Templating Enabled":"Default Templating Disabled"})}),!!l&&t(AE,{$variant:"secondary",children:t(w,{size:C.XXXS,children:l})})]}),t(OE,{className:"url-templatization-default-rule-edit",children:t(Be,{"data-id":`url-templatization-default-rule-edit-${n}`,icon:Cs,size:Ue.XS,onClick:()=>o?.(n)})})]})]},`default-rule-${n}`)})})]})})]})},zE=f($)`
|
|
3074
3155
|
width: 100%;
|
|
3075
3156
|
flex: 1;
|
|
3076
3157
|
min-height: 0;
|
|
3077
3158
|
border-radius: 16px;
|
|
3078
3159
|
background: ${({theme:e})=>e.v2.colors.silver[1e3]};
|
|
3079
3160
|
overflow: hidden;
|
|
3080
|
-
`,
|
|
3161
|
+
`,XE=f.div`
|
|
3081
3162
|
display: flex;
|
|
3082
3163
|
align-items: flex-start;
|
|
3083
3164
|
justify-content: space-between;
|
|
3084
3165
|
gap: 8px;
|
|
3085
3166
|
padding: 16px 16px 8px;
|
|
3086
|
-
`,
|
|
3167
|
+
`,PE=f($)`
|
|
3087
3168
|
gap: 0;
|
|
3088
3169
|
flex: 1;
|
|
3089
3170
|
min-width: 0;
|
|
3090
|
-
`,
|
|
3171
|
+
`,LE=f($)`
|
|
3091
3172
|
gap: 8px;
|
|
3092
3173
|
padding: 8px 16px 16px;
|
|
3093
3174
|
flex: 1;
|
|
3094
3175
|
min-height: 0;
|
|
3095
3176
|
overflow-y: auto;
|
|
3096
|
-
`,
|
|
3177
|
+
`,ME=f($)`
|
|
3097
3178
|
gap: 8px;
|
|
3098
3179
|
padding: 12px;
|
|
3099
3180
|
border-radius: 12px;
|
|
3100
3181
|
background: ${({theme:e})=>e.v2.colors.silver[900]};
|
|
3101
|
-
`,
|
|
3182
|
+
`,_E=f.div`
|
|
3102
3183
|
display: flex;
|
|
3103
3184
|
align-items: center;
|
|
3104
3185
|
gap: 4px;
|
|
3105
3186
|
height: 40px;
|
|
3106
3187
|
width: 100%;
|
|
3107
|
-
`,
|
|
3188
|
+
`,FE=f.div`
|
|
3108
3189
|
display: flex;
|
|
3109
3190
|
align-items: center;
|
|
3110
3191
|
gap: 8px;
|
|
3111
3192
|
flex: 1;
|
|
3112
3193
|
min-width: 0;
|
|
3113
|
-
`,
|
|
3194
|
+
`,BE=f($)`
|
|
3114
3195
|
gap: 8px;
|
|
3115
3196
|
padding: 8px;
|
|
3116
3197
|
border-radius: 8px;
|
|
3117
3198
|
background: ${({theme:e})=>e.v2.colors.silver[1e3]};
|
|
3118
|
-
`,
|
|
3199
|
+
`,UE=f.div`
|
|
3119
3200
|
display: flex;
|
|
3120
3201
|
align-items: center;
|
|
3121
3202
|
gap: 10px;
|
|
3122
3203
|
width: 100%;
|
|
3123
3204
|
padding: 8px 0 4px;
|
|
3124
|
-
`,
|
|
3205
|
+
`,VE=f.div`
|
|
3125
3206
|
display: flex;
|
|
3126
3207
|
align-items: center;
|
|
3127
3208
|
gap: 16px;
|
|
3128
3209
|
flex: 1;
|
|
3129
3210
|
min-width: 0;
|
|
3130
3211
|
flex-wrap: wrap;
|
|
3131
|
-
`,
|
|
3212
|
+
`,GE=f.div`
|
|
3132
3213
|
display: flex;
|
|
3133
3214
|
align-items: center;
|
|
3134
3215
|
gap: 8px;
|
|
3135
3216
|
flex-shrink: 0;
|
|
3136
|
-
`,
|
|
3217
|
+
`,HE=f($)`
|
|
3137
3218
|
gap: 8px;
|
|
3138
3219
|
width: 100%;
|
|
3139
|
-
`,
|
|
3220
|
+
`,jE=f.div`
|
|
3140
3221
|
display: flex;
|
|
3141
3222
|
align-items: center;
|
|
3142
3223
|
justify-content: space-between;
|
|
@@ -3155,7 +3236,7 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
3155
3236
|
opacity: 1;
|
|
3156
3237
|
pointer-events: auto;
|
|
3157
3238
|
}
|
|
3158
|
-
`,
|
|
3239
|
+
`,WE=f.div`
|
|
3159
3240
|
display: flex;
|
|
3160
3241
|
flex-shrink: 0;
|
|
3161
3242
|
padding: 4px;
|
|
@@ -3165,7 +3246,7 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
3165
3246
|
opacity: 0;
|
|
3166
3247
|
pointer-events: none;
|
|
3167
3248
|
transition: opacity 0.15s ease;
|
|
3168
|
-
`,
|
|
3249
|
+
`,KE=f.button`
|
|
3169
3250
|
display: flex;
|
|
3170
3251
|
align-items: center;
|
|
3171
3252
|
justify-content: center;
|
|
@@ -3174,19 +3255,19 @@ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n,{useMem
|
|
|
3174
3255
|
background: transparent;
|
|
3175
3256
|
cursor: pointer;
|
|
3176
3257
|
flex-shrink: 0;
|
|
3177
|
-
`;function
|
|
3258
|
+
`;function YE(e){return 1===e?"1 template":`${e} templates`}const qE=({actions:i,onCreateGroup:n,onAddTemplate:a,onEditGroup:o,onViewTemplate:r})=>{const s=v(),[c,d]=l("groups"),[p,u]=l({}),[h,g]=l({}),m=e=>!1!==p[e],b=e=>!1!==h[e];return e(zE,{"data-id":"url-templatization-custom-templates-list",children:[e(XE,{children:[e(PE,{children:[t(w,{size:C.S,children:fr}),t(w,{size:C.XXS,color:k.Secondary,children:vr})]}),e(T,{$gap:8,$alignItems:"center",children:[t(w,{size:C.XS,color:k.Secondary,children:yr}),t(F,{"data-id":"url-templatization-custom-view",size:rt.L,selected:c,setSelected:d,options:[{value:"groups",label:Sr},{value:"tree",label:xr,disabled:!0},{value:"list",label:wr,disabled:!0}]})]})]}),t(LE,{children:i.map(i=>{const l=m(i.id);return e(ME,{children:[e(_E,{children:[t(KE,{type:"button","aria-label":l?"Collapse action template groups":"Expand action template groups",onClick:()=>u(e=>({...e,[i.id]:!m(i.id)})),children:t(l?Es:Os,{size:18})}),e(FE,{children:[t(w,{size:C.XS,color:k.Secondary,children:i.name||bn}),t(E,{label:(c=i.groups.length,1===c?"1 template group":`${c} template groups`),backgroundColor:s.v2.colors.silver[600],textColor:s.v2.colors.white[500]}),t(E,{label:Bn,backgroundColor:"#062A31",textColor:"#4CD1F2"})]}),t(j,{"data-id":`url-templatization-create-group-${i.id}`,label:Cr,rightIcon:ys,variant:K.Text,size:W.S,onClick:()=>n?.(i.id)})]}),l&&i.groups.map((i,n)=>{const l=`${i.actionId}-${i.groupIndex}`,c=b(l),d=(i.group.templatizationRules??[]).map(e=>e.template).filter(e=>!!e?.trim()),p=Hf(i.group);return e(BE,{children:[e(UE,{children:[e(VE,{children:[e(T,{$gap:4,$alignItems:"center",children:[t(KE,{type:"button","aria-label":c?"Collapse template group":"Expand template group",onClick:()=>g(e=>({...e,[l]:!b(l)})),children:t(c?Es:Os,{size:18})}),t(w,{size:C.XS,color:k.Secondary,children:`Template Group ${n+1}`})]}),t(E,{label:YE(d.length),backgroundColor:s.v2.colors.silver[600],textColor:s.v2.colors.white[500]}),jr(p)?t(It,{variant:Mt.Blue,label:pn}):t(Yf,{scopes:p})]}),e(GE,{children:[o&&t(j,{"data-id":`url-templatization-edit-group-${l}`,label:kr,rightIcon:Cs,variant:K.Text,size:W.S,onClick:()=>o(i)}),t(j,{"data-id":`url-templatization-add-template-${l}`,label:Tr,rightIcon:ys,variant:K.Text,size:W.S,onClick:()=>a?.(i)})]})]}),c&&t(HE,{children:d.map((n,a)=>e(jE,{$clickable:!!r,onClick:()=>r?.(i,n),children:[t(vv,{template:n}),r&&t(WE,{className:"url-templatization-template-edit",children:t(Be,{"data-id":`url-templatization-view-template-${l}-${a}`,icon:Cs,size:Ue.XS,onClick:e=>{e.stopPropagation(),r(i,n)}})})]},`${l}-${a}`))})]},l)})]},i.id);var c})})]})},JE=f($)`
|
|
3178
3259
|
flex: 1;
|
|
3179
3260
|
min-height: 0;
|
|
3180
3261
|
width: 100%;
|
|
3181
3262
|
gap: 24px;
|
|
3182
3263
|
overflow-y: auto;
|
|
3183
|
-
`,
|
|
3264
|
+
`,ZE=f($)`
|
|
3184
3265
|
flex: 1;
|
|
3185
3266
|
min-height: 0;
|
|
3186
3267
|
width: 100%;
|
|
3187
3268
|
gap: 8px;
|
|
3188
|
-
`,
|
|
3269
|
+
`,QE=f(Me)`
|
|
3189
3270
|
flex: 1;
|
|
3190
3271
|
min-height: 220px;
|
|
3191
3272
|
width: 100%;
|
|
3192
|
-
`,
|
|
3273
|
+
`,eD=({title:i,icon:n,emptyTitle:a,emptySubtitle:o,action:l,dataId:r})=>e(ZE,{children:[t(w,{size:C.S,children:i}),t(ze,{fullHeight:!0,children:t(QE,{"data-id":r,children:t(Z,{icon:n,title:a,subTitle:o,action:l})})})]}),tD=({docsUrl:i=Ir})=>{const{actionsApi:n,sourcesApi:o}=Lc(),{items:r,loading:s,refetch:c}=n.useActions(),{items:p}=o.useSources(),[u,h]=l(!1),[g,m]=l(null),[b,f]=l(!1),[v,y]=l(!1),[S,x]=l(),[w,C]=l(!1),[k,I]=l(null),$=a(()=>yv(r),[r]),N=$[0]??null,A=N?.fields.urlTemplatizationDefaultGroups??[],O=a(()=>$.flatMap(e=>(e.fields.urlTemplatizationRulesGroups??[]).map((t,i)=>({actionId:e.id,actionName:e.name||bn,groupIndex:i,group:t}))),[$]),E=a(()=>{const e=[],t=new Map;for(const i of O){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},[O]),R=(e=>!!e&&(e.fields.urlTemplatizationDefaultGroups??[]).length>0)(N),z=(e=>yv(e).some(e=>(e=>!!e&&(e.fields.urlTemplatizationRulesGroups??[]).some(e=>e.templatizationRules?.some(e=>!!e.template?.trim())))(e)))(r),X=a(()=>p.map(e=>({id:`${e.id.namespace}/${e.id.kind}/${e.id.name}`,label:e.id.name,badge:e.id.kind,secondaryLabel:e.id.namespace})),[p]),P=a(()=>Array.from(new Set(p.map(e=>e.id.namespace))).sort().map(e=>({id:e,label:e})),[p]),L=d(()=>{m(null),h(!0)},[]),M=d(e=>{m(e),h(!0)},[]),_=d(()=>{b||(h(!1),m(null))},[b]),F=d(()=>{x(void 0),y(!0)},[]),B=d(e=>{x({step:2,destination:"template-group",groupMode:"new",existingGroupIndex:null,targetActionId:e,createNewAction:!1}),y(!0)},[]),U=d(e=>{const t=O.findIndex(t=>t.actionId===e.actionId&&t.groupIndex===e.groupIndex);t<0||(x({step:2,destination:"template-group",groupMode:"existing",existingGroupIndex:t,targetActionId:e.actionId,createNewAction:!1}),y(!0))},[O]),V=d(()=>{w||(y(!1),x(void 0))},[w]),G=d((e,t)=>{I({template:t,actionName:e.actionName,actionId:e.actionId})},[]),H=d(()=>{I(null)},[]),Y=a(()=>{if(null===g)return;const e=A[g];return e?(e=>{const t=e.skipPolicy,i=(t?.skipHttpStatusCodes??[]).filter(e=>Number.isInteger(e)),n=i.length>0;return{scopes:Lr(e.scopes),enabled:!e.disabled,skipForNonSuccessCodes:!!t?.skipForNonSuccessCodes,skipSelectedHttpStatusCodes:n,skipHttpStatusCodesInput:n?i.join(", "):""}})(e):void 0},[A,g]),q=d(async e=>{f(!0);try{const t=(e=>{const t=e.skipSelectedHttpStatusCodes?Vf(e.skipHttpStatusCodesInput)??[]:[];return{scopes:jr(e.scopes)?null:e.scopes,disabled:!e.enabled,skipPolicy:{skipForNonSuccessCodes:e.skipForNonSuccessCodes,skipHttpStatusCodes:t}}})(e);if(N){const e=N.fields.urlTemplatizationDefaultGroups??[],i=null===g?[...e,t]:e.map((e,i)=>i===g?t:e);await n.update(N.id,{type:N.type,name:N.name,notes:N.notes,disabled:N.disabled,signals:N.signals,fields:{...N.fields,[D.UrlTemplatizationDefaultGroups]:i}})}else{const e=await n.create({type:J.URLTemplatization,name:"URL Templatization",disabled:!1,signals:[ae.Traces],fields:{[D.UrlTemplatizationDefaultGroups]:[t]}});if(e?.error)return}h(!1),m(null)}finally{f(!1)}},[N,n,g]),Z=d(async e=>{C(!0);try{const i={scopes:jr((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=O[e.existingGroupIndex],i=$.find(e=>e.id===t?.actionId);if(!t||!i)return;const a=i.fields.urlTemplatizationRulesGroups??[];return await n.update(i.id,{type:i.type,name:i.name,notes:i.notes,disabled:i.disabled,signals:i.signals,fields:{...i.fields,[D.UrlTemplatizationRulesGroups]:a.map((i,n)=>n===t.groupIndex?((e,t)=>{const i=t.map(e=>e.trim()).filter(Boolean).map(e=>({template:e}));return{...e,templatizationRules:[...e.templatizationRules??[],...i]}})(i,e.templates):i)}}),y(!1),void x(void 0)}const a=e.createNewAction?null:$.find(t=>t.id===e.targetActionId)??$[0]??null;if(a)await n.update(a.id,{type:a.type,name:a.name,notes:a.notes,disabled:a.disabled,signals:a.signals,fields:{...a.fields,[D.UrlTemplatizationRulesGroups]:[...a.fields.urlTemplatizationRulesGroups??[],i]}});else{const t=await n.create({type:J.URLTemplatization,name:e.createNewAction?e.newActionName.trim()||Dn:bn,disabled:!1,signals:[ae.Traces],fields:{[D.UrlTemplatizationRulesGroups]:[i]}});if(t?.error)return}y(!1),x(void 0)}finally{C(!1)}var t},[n,O,$]),Q=a(()=>{const e=[];return i&&e.push({id:$a(),type:Ft.Button,buttonProps:{"data-id":"url-templatization-btn-docs",label:$r,leftIcon:xs,size:W.S,variant:K.Text,onClick:()=>window.open(i,"_blank")}}),z&&e.push({id:$a(),type:Ft.Button,buttonProps:{"data-id":"url-templatization-btn-create",label:Nr,rightIcon:ys,size:W.S,variant:K.Primary,onClick:F}}),e.push({id:$a(),type:Ft.Button,buttonProps:{"data-id":"url-templatization-btn-refresh",label:"Refresh",size:W.S,variant:K.Text,onClick:c,loading:s}}),e},[i,F,z,s,c]);return e(el,{"data-id":"url-templatization-page",children:[e(T,{$gap:12,$justifyContent:"space-between",children:[t(tl,{icon:gc,title:Or,subTitle:Ar}),t(il,{actions:Q})]}),s&&!r.length?t(Me,{$height:"320px",children:t(Ve,{})}):e(JE,{children:[R?t(RE,{actionName:N?.name,groups:A,onAddRule:L,onEditRule:M}):t(eD,{title:mr,icon:zc,emptyTitle:Dr,emptySubtitle:Er,dataId:"url-templatization-default-empty",action:t(j,{"data-id":"url-templatization-enable-default",label:Rr,rightIcon:$s,variant:K.Primary,size:W.M,onClick:L})}),z?t(qE,{actions:E,onCreateGroup:B,onAddTemplate:U,onViewTemplate:G}):t(eD,{title:fr,icon:Nc,emptyTitle:Xr,emptySubtitle:zr,dataId:"url-templatization-custom-empty",action:t(j,{"data-id":"url-templatization-create-template",label:Nr,rightIcon:ys,variant:K.Primary,size:W.M,onClick:F})})]}),t(bv,{isOpen:u,mode:null===g?"create":"edit",initialFormState:Y,submitting:b,onClose:_,onSubmit:q,sourceOptions:X,namespaceOptions:P}),t(dv,{isOpen:v,submitting:w,prefill:S,templatizationActions:$.map(e=>({id:e.id,name:e.name||bn})),existingGroups:O,onClose:V,onSubmit:Z,sourceOptions:X,namespaceOptions:P}),t(Ov,{isOpen:!!k,template:k?.template??"",actionName:k?.actionName,actionId:k?.actionId,onClose:H})]})};export{jp as AddActionDrawer,Cp as AddActionForm,Fv as AddDataStreamModal,iu as AddDestinationDrawer,Tp as AddDestinationForm,nu as AddRuleDrawer,Rp as AddRuleForm,yu as AddSourceDrawer,Wy as CentralConnections,ag as CloudConnectorStep,rg as CreateCloudConnectorDrawer,Fy as CreateNewType,Xp as DataStreamForm,zp as DataStreamMergeWarning,pg as EditActionDrawer,ug as EditConfigDrawer,Bv as EditDataStreamModal,gg as EditDestinationDrawer,bg as EditRuleDrawer,ef as EditSourceDrawer,Pp as EditSourceForm,vN as Insights,DN as Onboarding,Gv as OnboardingDone,LA as Overview,nO as PipelineCollectors,Af as RecommendationsDrawer,od as RegexTesterDrawer,uf as SECTION_ORDER,My as SamplingOnboardingModal,Bf as SamplingRuleDrawer,Up as SamplingRuleForm,dO as SamplingRules,QO as ServiceMap,uE as Settings,_v as SystemDrawer,iO as TABS,gE as ToastList,tD as UrlTemplatization,dv as UrlTemplatizationCustomTemplateDrawer,bv as UrlTemplatizationDefaultRuleDrawer,Ov as UrlTemplatizationTemplateViewDrawer,pf as countRecommended,cf as getRecommendationState,df as groupRecommendations};
|