@odigos/ui-kit 0.0.261 → 0.0.263
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 +26 -0
- package/lib/chunks/{connections-scope-DhNWocBO.js → connections-scope-JSsSeaII.js} +1 -1
- package/lib/chunks/{index-DILEVYlK.js → index-CpvWOJm_.js} +7 -7
- package/lib/chunks/{odigos-context-BYgtdAtj.js → odigos-context-DGZO6Njm.js} +1 -2
- package/lib/chunks/source-instrument-form-context-FYKFdAII.js +1 -0
- package/lib/chunks/ui-components-D1ehQI2Z.js +1704 -0
- package/lib/chunks/use-odigos-api-Ptz3Kdno.js +5 -0
- package/lib/components/_v2/cards/section-card/index.d.ts +2 -0
- package/lib/components/_v2/input-list/index.d.ts +2 -0
- package/lib/components/_v2/input-table/card-table.d.ts +10 -0
- package/lib/components/_v2/input-table/dynamic-field/index.d.ts +1 -0
- package/lib/components/_v2/input-table/index.d.ts +2 -0
- package/lib/components/_v2/input-table/types.d.ts +13 -1
- package/lib/components/v2.js +1 -1
- package/lib/components.js +1 -1
- package/lib/constants/instrumentation-rules/index.d.ts +2 -1
- package/lib/constants.js +1 -1
- package/lib/containers/_v2/_forms/add-action-form/dynamic-fields/index.d.ts +1 -0
- package/lib/containers/_v2/_forms/add-rule-form/custom-fields/index.d.ts +2 -1
- package/lib/containers/_v2/settings/side-menu/index.d.ts +12 -0
- package/lib/containers/_v2/settings/toolbar/index.d.ts +2 -5
- package/lib/containers/v2.js +177 -151
- package/lib/containers.js +1 -1
- package/lib/contexts/odigos-api/capabilities.d.ts +1 -0
- package/lib/contexts/odigos-api/hooks/use-instrumentation-rules-api.d.ts +13 -1
- package/lib/contexts/odigos-api/types.d.ts +2 -1
- package/lib/contexts/odigos-api.js +1 -1
- package/lib/contexts/rule-form-context.d.ts +1 -1
- package/lib/contexts.js +1 -1
- package/lib/functions.js +1 -1
- package/lib/hooks.js +1 -1
- package/lib/icons/common/index.d.ts +1 -0
- package/lib/icons/common/lock-icon/index.d.ts +2 -0
- package/lib/icons.js +1 -1
- package/lib/snippets/_v2/dynamic-field/index.d.ts +2 -1
- package/lib/snippets/v2.js +1 -1
- package/lib/snippets.js +1 -1
- package/lib/store.js +1 -1
- package/lib/theme.js +1 -1
- package/lib/types/common/index.d.ts +1 -0
- package/lib/types/instrumentation-rules/index.d.ts +22 -3
- package/lib/types.js +1 -1
- package/lib/visuals.js +1 -1
- package/package.json +1 -1
- package/lib/chunks/source-instrument-form-context-oDlfTrOD.js +0 -1
- package/lib/chunks/ui-components-BDSEcaSZ.js +0 -1692
- package/lib/chunks/use-odigos-api-DHCLONPK.js +0 -5
package/lib/containers/v2.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{useEffect as o,useMemo as a,useRef as i,useCallback as l,useState as r,Fragment as s,forwardRef as c,useImperativeHandle as d,Children as u,createContext as p,useContext as h,useLayoutEffect as m}from"react";import g,{useTheme as f,css as b,keyframes as
|
|
1
|
+
import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{useEffect as o,useMemo as a,useRef as i,useCallback as l,useState as r,Fragment as s,forwardRef as c,useImperativeHandle as d,Children as u,createContext as p,useContext as h,useLayoutEffect as m}from"react";import g,{useTheme as f,css as b,keyframes as y}from"styled-components";import{u as v,n as C,C as S,e as w,f as x,h as k,g as T,j as $,k as I,l as E,d as A,b as N,c as O,S as R,o as D,R as P,p as F,q as L,a as M,r as _,s as z,t as B,w as X,x as V,y as U,z as j,A as G,B as H,D as W,E as K,F as Y}from"../chunks/odigos-context-DGZO6Njm.js";import{f as J,a8 as q,a9 as Z,V as Q,aa as ee,ab as te,ac as ne,ad as oe,ae,af as ie,ag as le,ah as re,T as se,O as ce,a as de,y as ue,B as pe,z as he,L as me,M as ge,ai as fe,aj as be,ak as ye,al as ve,am as Ce,an as Se,ao as we,l as xe,ap as ke,s as Te,aq as $e,ar as Ie,g as Ee,N as Ae,as as Ne,at as Oe,au as Re,Y as De,o as Pe,av as Fe,S as Le,k as Me,m as _e,aw as ze,ax as Be,H as Xe,ay as Ve,G as Ue,J as je,C as Ge,n as He,R as We,az as Ke,aA as Ye,aB as Je,p as qe,h as Ze,aC as Qe,aD as et,aE as tt,aF as nt,aG as ot,aH as at,aI as it,aJ as lt,aK as rt,aL as st,aM as ct,aN as dt,aO as ut,aP as pt,aQ as ht,D as mt,aR as gt,aS as ft,aT as bt,aU as yt,aV as vt,aW as Ct,e as St,I as wt,E as xt,b as kt,aX as Tt,aY as $t,$ as It,aZ as Et,a_ as At,a1 as Nt,a4 as Ot,A as Rt,a$ as Dt,b0 as Pt,b1 as Ft,b2 as Lt,d as Mt,b3 as _t,b4 as zt,b5 as Bt,b6 as Xt,W as Vt,F as Ut,b7 as jt,b8 as Gt,b9 as Ht,ba as Wt,bb as Kt,bc as Yt,bd as Jt,be as qt,bf as Zt,bg as Qt,bh as en,bi as tn,bj as nn,U as on,Q as an,bk as ln,bl as rn,q as sn,r as cn,w as dn,K as un,bm as pn,bn as hn,bo as mn,bp as gn,bq as fn,br as bn,bs as yn,bt as vn,bu as Cn,bv as Sn,bw as wn,bx as xn,by as kn,bz as Tn,bA as $n,bB as In,bC as En,bD as An,bE as Nn,bF as On,bG as Rn,bH as Dn,bI as Pn,bJ as Fn,bK as Ln,bL as Mn,bM as _n,bN as zn,bO as Bn,bP as Xn,bQ as Vn,bR as Un,bS as jn,bT as Gn,bU as Hn,bV as Wn,bW as Kn,bX as Yn,bY as Jn,bZ as qn,b_ as Zn,b$ as Qn,c0 as eo,c1 as to,c2 as no,c3 as oo,c4 as ao,c5 as io,c6 as lo,c7 as ro,c8 as so,c9 as co,ca as uo,cb as po,cc as ho,cd as mo,ce as go,cf as fo,cg as bo,ch as yo,ci as vo,cj as Co,ck as So,cl as wo,cm as xo,cn as ko,co as To,cp as $o,cq as Io,cr as Eo,cs as Ao,ct as No,cu as Oo,cv as Ro,cw as Do,cx as Po,cy as Fo,cz as Lo,cA as Mo,cB as _o,cC as zo,cD as Bo,cE as Xo,cF as Vo,cG as Uo,cH as jo,cI as Go,cJ as Ho,cK as Wo,cL as Ko,cM as Yo,cN as Jo,cO as qo,cP as Zo,cQ as Qo,cR as ea,cS as ta,cT as na,cU as oa,cV as aa,cW as ia,cX as la,cY as ra,cZ as sa,c_ as ca,c$ as da,d0 as ua,d1 as pa,d2 as ha,d3 as ma,d4 as ga,d5 as fa,d6 as ba,d7 as ya,d8 as va,d9 as Ca,da as Sa,db as wa,c as xa,dc as ka,dd as Ta,de as $a,df as Ia,dg as Ea,dh as Aa,di as Na,dj as Oa,dk as Ra,x as Da,dl as Pa,v as Fa,dm as La,dn as Ma,dp as _a,dq as za,dr as Ba,ds as Xa,dt as Va,du as Ua,a0 as ja,dv as Ga,dw as Ha,dx as Wa,dy as Ka,dz as Ya,dA as Ja,dB as qa,dC as Za,dD as Qa,dE as ei,dF as ti,dG as ni,dH as oi,dI as ai,dJ as ii,dK as li,dL as ri,dM as si,dN as ci,dO as di,dP as ui,dQ as pi,dR as hi,dS as mi,dT as gi,dU as fi}from"../chunks/ui-components-D1ehQI2Z.js";import{TrashIcon as bi,PlusIcon as yi,ArrowRightIcon as vi,VSquareIcon as Ci,XSquareIcon as Si,BookIcon as wi,DeleteIcon as xi,EditIcon as ki,GoLogo as Ti,JavaLogo as $i,ChevronRightIcon as Ii,ActionIcon as Ei,DestinationIcon as Ai,ChevronUpIcon as Ni,ChevronDownIcon as Oi,VIcon as Ri,XIcon as Di,InstrumentationRuleIcon as Pi,SourceIcon as Fi,NamespacesIcon as Li,SettingsIcon as Mi,PodIcon as _i,OdigosLogo as zi,K8sLogo as Bi,RefreshIcon as Xi,ExclamationCircleIcon as Vi,QuestionCircleIcon as Ui,InboundIcon as ji,OutboundIcon as Gi,UserIcon as Hi,TerminalIcon as Wi,MinusIcon as Ki,SearchIcon as Yi,ExpandIcon as Ji,CopyIcon as qi,DotIcon as Zi,ArrowDownIcon as Qi,DownloadIcon as el,RefreshLeftArrowIcon as tl,VmLogo as nl,SamplingIcon as ol,ExclamationTriangleIcon as al,KeyIcon as il,DiagnoseIcon as ll,StarIcon as rl,ArrowIcon as sl,ConnectionsIcon as cl,FilterIcon as dl,DataStreamIcon as ul,PipelineCollectorIcon as pl,ArrowDownSquareIcon as hl,ArrowUpSquareIcon as ml,GatewayIcon as gl,YamlIcon as fl,LockIcon as bl}from"../icons.js";import{d as yl}from"../chunks/use-odigos-api-Ptz3Kdno.js";import{D as vl,S as Cl,I as Sl,a as wl,A as xl,P as kl,b as Tl,c as $l,R as Il,O as El,d as Al,e as Nl,f as Ol,W as Rl,g as Dl,C as Pl,Y as Fl,h as Ll,i as Ml,U as _l}from"../chunks/index-CpvWOJm_.js";import{O as zl}from"../chunks/connections-scope-JSsSeaII.js";import{u as Bl,f as Xl,g as Vl,e as Ul,i as jl,h as Gl,S as Hl,k as Wl,E as Kl,l as Yl,m as Jl,j as ql,b as Zl,d as Ql,a as er,A as tr,R as nr,c as or,D as ar}from"../chunks/source-instrument-form-context-FYKFdAII.js";import{U as ir}from"../chunks/consts-D6GCMJ6c.js";import{createPortal as lr}from"react-dom";import"zustand";import"javascript-time-ago";import"javascript-time-ago/locale/en";import"prism-react-renderer";import"../chunks/vendor-BFqT13Me.js";import"zustand/middleware";import"react-error-boundary";import"virtua";import"@apollo/client";import"@apollo/client/link/error";import"@apollo/client/link/context";import"@apollo/client/utilities";const rr=[{id:"CREDIT_CARD",label:"Credit card"}],sr=[{id:J.CollectContainerAttributes,label:"Collect container attributes"},{id:J.CollectReplicaSetAttributes,label:"Collect ReplicaSet attributes"},{id:J.CollectWorkloadId,label:"Collect workload ID"},{id:J.CollectClusterId,label:"Collect cluster ID"}],cr=[{id:ne.Pod,label:ne.Pod},{id:ne.Namespace,label:ne.Namespace},{id:ne.Node,label:ne.Node}],dr=[{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:cr}],ur=[{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:cr}],pr=/^[a-zA-Z]$/,hr=new Set(["*","+","?"]),mr=new Set(["^","$"]),gr={group:"rgba(102, 242, 102, 0.5)","anchor-quantifier":"rgba(102, 191, 255, 0.5)","class-bracket":"rgba(255, 153, 153, 0.5)","class-content":"rgba(178, 1, 1, 0.5)",alternation:"rgba(255, 153, 153, 0.5)",literal:"transparent"},fr=g.div`
|
|
2
2
|
padding: 8px 16px;
|
|
3
3
|
border-radius: 6px;
|
|
4
4
|
border: 1px solid ${({theme:e})=>e.v2.colors.silver[500]};
|
|
@@ -18,9 +18,9 @@ import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{useEffect
|
|
|
18
18
|
box-decoration-break: clone;
|
|
19
19
|
-webkit-box-decoration-break: clone;
|
|
20
20
|
}
|
|
21
|
-
`,
|
|
22
|
-
background: ${({$kind:e})=>
|
|
23
|
-
`,
|
|
21
|
+
`,br=g.span`
|
|
22
|
+
background: ${({$kind:e})=>gr[e]};
|
|
23
|
+
`,yr=({pattern:e,"data-id":n})=>{const o=a(()=>(e=>{const t=[];let n=0,o=!1;const a=(e,n)=>{const o=t[t.length-1];o&&o.kind===n?o.text+=e:t.push({text:e,kind:n})};for(;n<e.length;){const t=e[n];if(o){if("]"===t){a("]","class-bracket"),o=!1,n++;continue}if("\\"===t&&n+1<e.length){a(e.slice(n,n+2),"class-content"),n+=2;continue}a(t,"class-content"),n++}else{if("("===t&&"?"===e[n+1]){let t=2;const o=e[n+2];if(":"===o||"="===o||"!"===o)t=3;else if("<"===o){const o=e[n+3];if("="===o||"!"===o)t=4;else{const o=e.indexOf(">",n+2);-1!==o&&(t=o-n+1)}}a(e.slice(n,n+t),"group"),n+=t;continue}if("("!==t&&")"!==t)if("["!==t)if(hr.has(t)||mr.has(t))a(t,"anchor-quantifier"),n++;else{if("{"===t){const t=e.indexOf("}",n);if(t>n&&/^\{\d+,?\d*\}$/.test(e.slice(n,t+1))){a(e.slice(n,t+1),"anchor-quantifier"),n=t+1;continue}}if("\\"===t&&n+1<e.length){const t=e[n+1];pr.test(t)?a(e.slice(n,n+2),"anchor-quantifier"):a(e.slice(n,n+2),"literal"),n+=2;continue}"|"!==t?(a(t,"literal"),n++):(a("|","alternation"),n++)}else"^"===e[n+1]?(a("[^","class-bracket"),n+=2):(a("[","class-bracket"),n++),o=!0;else a(t,"group"),n++}}return t})(e),[e]);return t(fr,e?{"data-id":n,children:o.map((e,n)=>t(br,{$kind:e.kind,children:e.text},n))}:{"data-id":n,children:" "})},vr="rgba(102, 191, 255, 0.5)",Cr=b`
|
|
24
24
|
font-family: ${({theme:e})=>e.font_family.code};
|
|
25
25
|
font-size: 12px;
|
|
26
26
|
line-height: 20px;
|
|
@@ -33,7 +33,7 @@ import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{useEffect
|
|
|
33
33
|
-moz-tab-size: 4;
|
|
34
34
|
tab-size: 4;
|
|
35
35
|
margin: 0;
|
|
36
|
-
`,
|
|
36
|
+
`,Sr=g.div`
|
|
37
37
|
position: relative;
|
|
38
38
|
width: 100%;
|
|
39
39
|
min-height: ${({$minHeight:e})=>e}px;
|
|
@@ -45,8 +45,8 @@ import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{useEffect
|
|
|
45
45
|
&:focus-within {
|
|
46
46
|
border-color: ${({theme:e})=>e.v2.colors.silver[300]};
|
|
47
47
|
}
|
|
48
|
-
`,
|
|
49
|
-
${
|
|
48
|
+
`,wr=g.div`
|
|
49
|
+
${Cr}
|
|
50
50
|
position: absolute;
|
|
51
51
|
inset: 0;
|
|
52
52
|
padding: 12px;
|
|
@@ -59,8 +59,8 @@ import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{useEffect
|
|
|
59
59
|
box-decoration-break: clone;
|
|
60
60
|
-webkit-box-decoration-break: clone;
|
|
61
61
|
}
|
|
62
|
-
`,
|
|
63
|
-
${
|
|
62
|
+
`,xr=g.textarea`
|
|
63
|
+
${Cr}
|
|
64
64
|
position: relative;
|
|
65
65
|
z-index: 1;
|
|
66
66
|
display: block;
|
|
@@ -78,18 +78,18 @@ import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{useEffect
|
|
|
78
78
|
&::placeholder {
|
|
79
79
|
color: ${({theme:e})=>e.v2.colors.silver[600]};
|
|
80
80
|
}
|
|
81
|
-
`,
|
|
81
|
+
`,kr=e=>({before:e,matchPre:"",capture:"",matchPost:"",after:""}),Tr=({regex:n,value:o,onChange:r,minHeight:s=240,...c})=>{const d=i(null),u=i(null),p=a(()=>((e,t)=>{if(!e||!t)return kr(t);let n;try{n=new RegExp(e)}catch{return kr(t)}const o=n.exec(t);if(!o)return kr(t);const a=o.index,i=o.index+o[0].length;if(o.length<2||null==o[1])return{before:t.slice(0,a),matchPre:"",capture:t.slice(a,i),matchPost:"",after:t.slice(i)};const l=o[0].indexOf(o[1]),r=l>=0?a+l:a,s=r+o[1].length;return{before:t.slice(0,a),matchPre:t.slice(a,r),capture:t.slice(r,s),matchPost:t.slice(s,i),after:t.slice(i)}})(n,o),[n,o]),h=l(()=>{d.current&&u.current&&(d.current.scrollTop=u.current.scrollTop,d.current.scrollLeft=u.current.scrollLeft)},[]);return e(Sr,{$minHeight:s,children:[e(wr,{ref:d,"aria-hidden":!0,children:[p.before,t("span",{style:{background:vr},children:p.matchPre}),t("span",{style:{background:"rgba(102, 242, 102, 0.5)"},children:p.capture}),t("span",{style:{background:vr},children:p.matchPost}),p.after,o.endsWith("\n")?" ":""]}),t(xr,{ref:u,$minHeight:s,value:o,onChange:e=>r(e.target.value),onScroll:h,spellCheck:!1,...c})]})},$r=g.div`
|
|
82
82
|
flex: 1;
|
|
83
83
|
min-height: 0;
|
|
84
84
|
overflow-y: auto;
|
|
85
|
-
`,
|
|
85
|
+
`,Ir=g.div`
|
|
86
86
|
background: ${({theme:e})=>e.v2.colors.silver[900]};
|
|
87
87
|
border-radius: 8px;
|
|
88
88
|
padding: 8px;
|
|
89
89
|
display: flex;
|
|
90
90
|
flex-direction: column;
|
|
91
91
|
gap: 12px;
|
|
92
|
-
`,
|
|
92
|
+
`,Er=g.div`
|
|
93
93
|
padding: 8px 16px;
|
|
94
94
|
border-radius: 8px;
|
|
95
95
|
background: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
@@ -100,7 +100,7 @@ import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{useEffect
|
|
|
100
100
|
word-break: break-all;
|
|
101
101
|
white-space: pre-wrap;
|
|
102
102
|
user-select: text;
|
|
103
|
-
|
|
103
|
+
`,Ar=({isOpen:n,regex:o,onClose:i,initialTestString:l=""})=>{const[s,c]=r(l),d=a(()=>((e,t)=>{if(!e)return{ok:!0,isMatch:!1,message:re.RESULT_EMPTY_REGEX};if(!t)return{ok:!0,isMatch:!1,message:re.RESULT_EMPTY_INPUT};let n;try{n=new RegExp(e)}catch(e){return{ok:!1,message:e instanceof Error?e.message:re.RESULT_INVALID_REGEX_FALLBACK}}const o=n.exec(t);return o?{ok:!0,isMatch:!0,message:o.length>1?o[1]:o[0]}:{ok:!0,isMatch:!1,message:re.RESULT_NO_MATCH}})(o,s),[o,s]),u=d.ok?d.isMatch?"match":"neutral":"error";return t(le,{isOpen:n,header:{title:re.TITLE,onClose:()=>{c(""),i()}},children:t($r,{children:e(Ir,{children:[e(q,{$gap:6,children:[t(Z,{label:re.REGEX_LABEL}),t(yr,{pattern:o,"data-id":"regex-tester-regex"}),!o&&t(se,{size:de.XXS,color:ce.Secondary,children:re.REGEX_EMPTY_HINT})]}),e(q,{$gap:6,children:[e(ue,{$width:"100%",$justifyContent:"space-between",$alignItems:"center",children:[t(Z,{label:re.TEST_STRING_LABEL}),t(pe,{"data-id":"regex-tester-unescape",label:re.UNESCAPE_LABEL,tooltip:re.UNESCAPE_TOOLTIP,variant:me.Secondary,size:he.S,onClick:()=>c(e=>(e=>{let t="";for(let n=0;n<e.length;n++){if("\\"===e[n]&&n+1<e.length){const o=e[n+1],a="n"===o?"\n":"t"===o?"\t":"r"===o?"\r":'"'===o?'"':"'"===o?"'":"\\"===o?"\\":null;if(null!=a){t+=a,n++;continue}}t+=e[n]}return t})(e)),disabled:(p=s,!/\\["'\\nrt]/.test(p))})]}),t(Tr,{name:"regex-tester-test-string","data-id":"regex-tester-test-string",placeholder:re.TEST_STRING_PLACEHOLDER,regex:o,value:s,onChange:c,minHeight:240}),t(ee,{helpMessage:re.TEST_STRING_HELP})]}),e(q,{$gap:8,children:[t(Z,{label:re.RESULT_LABEL}),t(Er,{$tone:u,"data-id":"regex-tester-result",children:d.message}),d.ok&&d.isMatch&&t(se,{size:de.XXS,color:ce.Secondary,children:re.RESULT_CAPTURE_HINT})]})]})})});var p},Nr=J.ExtractAttribute;var Or;!function(e){e.Preset="preset",e.Regex="regex"}(Or||(Or={}));const Rr=[be.JSON,be.SQL,be.ResourcePath],Dr=(e=be.JSON)=>({targetAttributeName:"",lookupKey:"",dataFormat:e,regex:""}),Pr=e=>!!e.regex&&!e.lookupKey&&!e.dataFormat,Fr=g.div`
|
|
104
104
|
width: 100%;
|
|
105
105
|
background: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
106
106
|
border-radius: 8px;
|
|
@@ -108,13 +108,13 @@ import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{useEffect
|
|
|
108
108
|
display: flex;
|
|
109
109
|
flex-direction: column;
|
|
110
110
|
gap: 8px;
|
|
111
|
-
`,
|
|
111
|
+
`,Lr=g.div`
|
|
112
112
|
flex: 1;
|
|
113
113
|
min-width: 0;
|
|
114
|
-
`,
|
|
114
|
+
`,Mr=g.div`
|
|
115
115
|
/* Pushes the arrow down to sit next to the inputs rather than the field titles. */
|
|
116
116
|
padding-top: 24px;
|
|
117
|
-
`,Fr=e=>Object.entries(e||{}).map(([e,t])=>({oldKey:e,newKey:t})),Lr=e=>{const t={};return e.forEach(({oldKey:e,newKey:n})=>{t[e]=n}),t},_r=J.UrlTemplatizationRulesGroups,Mr=[{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"}],zr=e=>{if(Array.isArray(e))return e.map(e=>"string"==typeof e?{id:e,label:e}:e)},Br=e=>{if(Array.isArray(e))return e.map(e=>{const t=e;return{keyName:String(t.keyName??t.name??""),label:t.label??t.displayName,placeholder:t.placeholder,componentType:t.componentType,options:zr(t.options??t.values)}})},Xr=e=>{const t="string"==typeof e.componentProperties?Te(e.componentProperties,{}):e.componentProps||{};return{name:e.name,componentType:e.componentType,title:e.displayName,tooltip:t.tooltip,placeholder:t.placeholder,required:t.required,initialValue:e.initialValue,renderCondition:e.renderCondition,options:zr(t.options??t.values),itemWrapperKey:t.itemWrapperKey,columns:Br(t.columns),wrapKey:t.wrapKey,fields:Array.isArray(t.fields)?t.fields.map(Xr):void 0,addLabel:t.addLabel,itemLabel:t.itemLabel}},Vr=e=>Array.isArray(e)?e:[],Ur=({field:e,value:n,setValue:o,errorMessage:a,disabled:i})=>{const{name:l,componentType:r,title:s,tooltip:c,placeholder:d,required:u,initialValue:p,options:h,itemWrapperKey:m,columns:g,wrapKey:f}=e;if(r===ke.MultiTabledInput){const e=Vr(f?n?.[f]:n);return t(te,{name:l,label:s,tooltip:c,required:u,disabled:i,columns:g||[],values:e,setValues:e=>o(f?{[f]:e}:e),errorMessage:a})}if(r===ke.MultiInput&&m){const e=Vr(n).map(e=>String(e?.[m]??""));return t(ie,{name:l,label:s,tooltip:c,required:u,disabled:i,placeholder:d,values:e,setValues:e=>o(e.map(e=>({[m]:e}))),errorMessage:a})}return t(fl,{componentType:r,name:l,label:s,tooltip:c,disabled:i,required:u,placeholder:d,errorMessage:a,dropdownOptions:h,value:(null==n?p:n)??"",setValue:o})},Gr=({field:o,value:a,setValue:i,disabled:l})=>{const r=f(),c=Vr(a),d=c.length?c:[{}],u=o.fields||[],p=e=>i(e);return e(n,{children:[d.map((n,a)=>e(s,{children:[t(we,{}),e(q,{$gap:12,children:[e(ue,{$justifyContent:"space-between",$alignItems:"center",children:[t(Z,{label:`${o.itemLabel||o.title||"Item"} ${a+1}`}),t(pe,{leftIcon:()=>t(gi,{fill:r.v2.colors.red[500]}),variant:me.Secondary,size:he.S,onClick:()=>(e=>{const t=d.filter((t,n)=>n!==e);p(t)})(a),disabled:l||1===d.length})]}),u.map(e=>t(Ur,{field:e,value:n[e.name],setValue:t=>((e,t,n)=>p(d.map((o,a)=>a===e?{...o,[t]:n}:o)))(a,e.name,t),disabled:l},`${o.name}-group-${a}-${e.name}`))]})]},`${o.name}-group-${a}`)),t(pe,{variant:me.Secondary,label:o.addLabel||"Add",leftIcon:fi,onClick:()=>p([...d,{}]),disabled:l}),t(we,{})]})},Hr=({signals:e,fields:o,value:a,setValue:i,formErrors:l,disabled:r})=>{const s=(o||[]).filter(e=>!!e).map(e=>Xr(e));return t(n,{children:s.map(n=>{const o=Object.entries(a||{}).map(([e,t])=>({name:e,value:t}));if(!(!n.renderCondition||xe(n.renderCondition,e,o)))return null;const s=a?.[n.name];return n.componentType===ke.FieldGroup?t(Gr,{field:n,value:s,setValue:e=>i(n.name,e),disabled:r},n.name):t(Ur,{field:n,value:s,setValue:e=>i(n.name,e),errorMessage:l[n.name],disabled:r},n.name)})})},jr={[$e.K8sAttributes]:({value:a,setValue:i,formErrors:l})=>(o(()=>{a[J.CollectContainerAttributes]||a[J.CollectReplicaSetAttributes]||a[J.CollectWorkloadId]||a[J.CollectClusterId]||a[J.LabelsAttributes]?.length||a[J.AnnotationsAttributes]?.length||(i(J.CollectContainerAttributes,!0),i(J.CollectReplicaSetAttributes,!0),i(J.CollectWorkloadId,!0),i(J.CollectClusterId,!0),i(J.LabelsAttributes,[]),i(J.AnnotationsAttributes,[]))},[]),e(n,{children:[t(q,{$gap:6,children:ir.map(({id:n,label:o})=>e(q,{children:[t(Q,{label:o,value:a[n]||!1,onChange:e=>i(n,e)}),t(ee,{errorMessage:l[n]})]},n))}),t(te,{name:"labelsAttributes",label:"Label attributes",limitFieldsPerRow:2,columns:rr,values:a[J.LabelsAttributes]||[],setValues:e=>i(J.LabelsAttributes,e),errorMessage:l[J.LabelsAttributes]}),t(te,{name:"annotationsAttributes",label:"Annotation attributes",limitFieldsPerRow:2,columns:sr,values:a[J.AnnotationsAttributes]||[],setValues:e=>i(J.AnnotationsAttributes,e),errorMessage:l[J.AnnotationsAttributes]})]})),[$e.AddClusterInfo]:({value:o,setValue:a,formErrors:i})=>{const l=f();return e(n,{children:[t(oe,{label:"Overwrite existing values",labelAlign:ae.Left,labelColor:l.v2.colors.silver[200],tooltip:"If enabled, the resource attributes will overwrite any existing attributes with the same name.",value:o[J.OverwriteExistingValues]||!1,onChange:e=>a(J.OverwriteExistingValues,e)}),t(te,{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:o[J.ClusterAttributes]||[],setValues:e=>a(J.ClusterAttributes,e),errorMessage:i[J.ClusterAttributes]})]})},[$e.DeleteAttributes]:({value:e,setValue:n,formErrors:o})=>t(ie,{name:"attributeNamesToDelete",label:"Attributes to delete",values:e[J.AttributeNamesToDelete]||[],setValues:e=>n(J.AttributeNamesToDelete,e),errorMessage:o[J.AttributeNamesToDelete]}),[$e.RenameAttributes]:({value:e,setValue:n,formErrors:a})=>{const i=e[J.Renames],[l,s]=r(()=>Fr(i));return o(()=>{((e,t)=>{const n=Object.keys(e),o=Object.keys(t);return n.length===o.length&&n.every(n=>Object.prototype.hasOwnProperty.call(t,n)&&t[n]===e[n])})(Lr(l),i||{})||s(Fr(i))},[i]),t(te,{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:l,setValues:e=>{const t=e.map(e=>({oldKey:String(e.oldKey??""),newKey:String(e.newKey??"")}));s(t),n(J.Renames,Lr(t))},errorMessage:a[J.Renames]})},[$e.PiiMasking]:({value:n,setValue:a,formErrors:i})=>(o(()=>{n[J.PiiCategories]?.length||a(J.PiiCategories,ar.map(({id:e})=>e))},[]),e(q,{$gap:12,children:[t(Z,{label:"Attributes to mask"}),t(q,{$gap:6,children:ar.map(({id:e,label:o})=>t(Q,{label:o,value:n[J.PiiCategories]?.includes(e)||!1,onChange:t=>{const o=n[J.PiiCategories]||[],i=t?[...o,e]:o.filter(t=>t!==e);a(J.PiiCategories,i)}},e))}),t(ee,{errorMessage:i[J.PiiCategories]})]})),[$e.URLTemplatization]:({value:o,setValue:a,formErrors:i})=>{const l=f(),r=o[_r]||[{filterK8sNamespace:"",workloadFilters:[],templatizationRules:[{template:""}],notes:""}],c=e=>a(_r,e),d=(e,t)=>c(r.map((n,o)=>o===e?{...n,...t}:n));return e(n,{children:[r.map((n,o)=>e(s,{children:[t(we,{}),e(q,{$gap:12,children:[e(ue,{$justifyContent:"space-between",$alignItems:"center",children:[t(Z,{label:`Rule Group ${o+1}`}),t(pe,{leftIcon:()=>t(gi,{fill:l.v2.colors.red[500]}),variant:me.Secondary,size:he.S,onClick:()=>{return e=o,c(r.filter((t,n)=>n!==e));var e},disabled:1===r.length})]}),t(Se,{name:`urlGroup-${o}-namespace`,label:"Namespace",placeholder:"All namespaces",tooltip:"Filter rules to a specific Kubernetes namespace.",value:n.filterK8sNamespace||"",onChange:e=>d(o,{filterK8sNamespace:e.target.value})}),t(te,{name:`urlGroup-${o}-workloadFilters`,label:"Workload filters",tooltip:"Optionally scope templates to specific workloads.",columns:Mr,values:n.workloadFilters||[],setValues:e=>d(o,{workloadFilters:e})}),t(ie,{name:`urlGroup-${o}-templates`,label:"Templates",required:!0,placeholder:"e.g. /user/{id}",values:n.templatizationRules.map(e=>e.template),setValues:e=>d(o,{templatizationRules:e.map(e=>({template:e}))})})]}),t(ee,{errorMessage:i[_r]})]},`url-templatization-group-${o}`)),t(pe,{variant:me.Secondary,label:"Add rule group",leftIcon:fi,onClick:()=>c([...r,{filterK8sNamespace:"",workloadFilters:[],templatizationRules:[{template:""}],notes:""}])}),t(we,{})]})},[$e.ExtractAttribute]:({value:n,setValue:a,formErrors:i})=>{const l=f(),s=i[Ir],c=n[Ir]?.extractions||[],[d,u]=r(()=>(e=>e.length&&e.some(Or)?Er.Regex:Er.Preset)(c)),[p,h]=r(null),m=e=>a(Ir,{extractions:e});o(()=>{0===c.length&&m([d===Er.Preset?Nr():{targetAttributeName:"",lookupKey:"",dataFormat:"",regex:""}])},[]);const g=(e,t)=>{m(c.map((n,o)=>o===e?{...n,...t}:n))},b=()=>{m([...c,d===Er.Preset?Nr():{targetAttributeName:"",lookupKey:"",dataFormat:"",regex:""}])},v=d===Er.Preset,y=c.length?c:[v?Nr():{targetAttributeName:"",lookupKey:"",dataFormat:"",regex:""}],C=null!=p&&y[p]?.regex||"";return e(q,{$gap:16,$width:"100%",children:[t(ge,{options:[{value:Er.Preset,label:fe.SEGMENT_PRESET_LABEL,tooltip:fe.SEGMENT_PRESET_TOOLTIP,selectedBgColor:l.v2.colors.purple[500]},{value:Er.Regex,label:fe.SEGMENT_REGEX_LABEL,tooltip:fe.SEGMENT_REGEX_TOOLTIP,selectedBgColor:l.v2.colors.purple[500]}],selected:d,setSelected:e=>{u(e),m([e===Er.Preset?Nr():{targetAttributeName:"",lookupKey:"",dataFormat:"",regex:""}])}}),e(q,{$gap:8,$width:"100%",children:[y.map((n,o)=>{const a=o===y.length-1,i=n.dataFormat||be.JSON,r=ye[i];return e(Rr,{"data-id":`extract-row-${o}`,children:[e(ue,{$gap:10,$alignItems:"flex-start",$width:"100%",$justifyContent:"space-between",children:[e(q,{$gap:10,children:[t(Z,{label:v?fe.PRESET_ROW_TITLE(o):fe.REGEX_ROW_TITLE(o)}),v&&t(ue,{$gap:24,children:Ar.map(e=>t(ve,{"data-id":`extract-row-${o}-fmt-${e}`,size:Ce.L,label:ye[e].label,value:i===e,onChange:t=>t&&g(o,{dataFormat:e})},`extract-row-${o}-fmt-${e}`))})]}),e(ue,{$gap:4,$alignItems:"center",children:[!v&&t(pe,{"data-id":`extract-row-${o}-test-regex`,label:fe.TEST_REGEX_LABEL,variant:me.Secondary,size:he.S,onClick:()=>h(o),disabled:!n.regex?.trim()}),t(pe,{"data-id":`extract-row-${o}-delete`,leftIcon:()=>t(gi,{fill:l.v2.colors.red[500]}),variant:me.Secondary,size:he.S,onClick:()=>(e=>{const t=c.filter((t,n)=>n!==e);m(t.length?t:[d===Er.Preset?Nr():{targetAttributeName:"",lookupKey:"",dataFormat:"",regex:""}])})(o)}),a&&t(pe,{"data-id":`extract-row-${o}-add`,leftIcon:fi,variant:me.Secondary,size:he.S,onClick:b})]})]}),v?e(ue,{$gap:8,$alignItems:"flex-start",$width:"100%",children:[t(Dr,{children:t(Se,{name:`extract-row-${o}-lookupKey`,label:r.keyLabel,placeholder:r.placeholder,helpMessage:r.helpMessage,width:"100%",value:n.lookupKey||"",onChange:e=>g(o,{lookupKey:e.target.value})})}),t(Pr,{children:t(bi,{size:24,fill:l.v2.colors.silver[200]})}),t(Dr,{children:t(Se,{name:`extract-row-${o}-targetAttributeName`,label:fe.TARGET_LABEL,placeholder:fe.TARGET_PLACEHOLDER,helpMessage:fe.TARGET_HELP,width:"100%",value:n.targetAttributeName||"",onChange:e=>g(o,{targetAttributeName:e.target.value})})})]}):e(q,{$gap:12,$width:"100%",children:[t(Se,{name:`extract-row-${o}-regex`,label:fe.REGEX_LABEL,placeholder:fe.REGEX_PLACEHOLDER,helpMessage:fe.REGEX_HELP,width:"100%",value:n.regex||"",onChange:e=>g(o,{regex:e.target.value})}),t(Se,{name:`extract-row-${o}-targetAttributeName`,label:fe.TARGET_LABEL,placeholder:fe.TARGET_PLACEHOLDER,helpMessage:fe.TARGET_HELP,width:"100%",value:n.targetAttributeName||"",onChange:e=>g(o,{targetAttributeName:e.target.value})})]})]},`extract-row-${o}`)}),t(ee,{errorMessage:s})]}),t($r,{isOpen:null!=p,regex:C,onClose:()=>h(null)})]})}},Wr=({actionType:e,value:n,setValue:o,formErrors:a,dynamicFields:i,signals:l})=>{if(!e)return null;if(i?.length)return t(Hr,{fields:i,value:n,setValue:o,formErrors:a||{},signals:l||[]});const r=jr[e];return r?t(r,{value:n,setValue:o,formErrors:a}):null},Kr=()=>{const n=f(),{selectedOption:o,genericForm:a}=_l();if(!a||!o)return t(Ie,{title:"No active form"});const{formData:i,handleFormChange:l,formErrors:r}=a;return e(q,{$gap:24,children:[e(ue,{$gap:12,$justifyContent:"space-between",children:[t(Ee,{size:de.XXXS,maxLines:2,children:o.description}),e(ue,{$gap:12,children:[t(ge,{options:[{icon:vi,label:"Enabled",value:!1,selectedBgColor:n.v2.colors.green[800]},{icon:yi,label:"Disabled",value:!0,selectedBgColor:n.v2.colors.red[800]}],size:Ae.S,selected:i.disabled,setSelected:e=>l("disabled",e)}),t(pe,{leftIcon:Ci,variant:me.Secondary,size:he.S,onClick:()=>o.docsUrl&&window.open(o.docsUrl,"_blank","noopener noreferrer")})]})]}),t(bl,{title:"Signals for processing",allowedSignals:o.allowedSignals,selectedSignals:i.signals||[],setSelectedSignals:e=>l("signals",e),errorMessage:r.signals}),t(Se,{name:"actionName",label:"Action name",placeholder:"Use a name that describes the action...",value:i.name||"",onChange:({target:{value:e}})=>l("name",e),errorMessage:r.name}),t(Wr,{actionType:o.type,dynamicFields:o.fields,signals:i.signals||[],value:i.fields,setValue:(e,t)=>l(`fields.${e}`,t),formErrors:r}),t(Ne,{name:"notes",label:"Notes",placeholder:"Your personal notes...",value:i.notes||"",onChange:({target:{value:e}})=>l("notes",e),errorMessage:r.notes})]})},Yr=({signals:e,fields:n,disabled:o,formData:a,handleFormChange:i,formErrors:l})=>n?.map(({renderCondition:n,componentType:r,type:s,name:c,title:d,tooltip:u,placeholder:p,value:h,required:m,options:g})=>{if(!(!n||xe(n,e,a.fields)))return null;const f=c,b=a.fields.find(e=>e.key===f),v=b?b.value:h;return t(fl,{componentType:r,inputType:s,name:f,label:d,tooltip:u,disabled:o,required:m,placeholder:p,errorMessage:l[f],dropdownOptions:g,value:v||"",setValue:e=>i(f,e)},f)}),Jr=g(ue)`
|
|
117
|
+
`,_r=e=>Object.entries(e||{}).map(([e,t])=>({oldKey:e,newKey:t})),zr=e=>{const t={};return e.forEach(({oldKey:e,newKey:n})=>{t[e]=n}),t},Br=J.UrlTemplatizationRulesGroups,Xr=[{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"}],Vr=e=>{if(Array.isArray(e))return e.map(e=>"string"==typeof e?{id:e,label:e}:e)},Ur=e=>{if(!Array.isArray(e)||e.length<3)return;const[t,n,o]=e;return e=>{const a=null==e?.[t]?"":String(e[t]);switch(n){case"=":case"==":case"===":return a===o;case"!=":case"!==":return a!==o;default:return!0}}},jr=e=>{if(Array.isArray(e))return e.map(e=>{const t=e;return{keyName:String(t.keyName??t.name??""),label:t.label??t.displayName,tooltip:t.tooltip,placeholder:t.placeholder,helpMessage:t.helpMessage,componentType:t.componentType,options:Vr(t.options??t.values),fullRow:t.fullRow,defaultValue:t.defaultValue,withRegexTester:t.withRegexTester,separator:t.separator,copyByColumn:t.copyByColumn,renderCondition:Ur(t.renderCondition)}})},Gr=e=>{if(Array.isArray(e))return e.map(e=>{if("string"==typeof e)return{id:e,label:e};const t=e;return{id:String(t.id??t.keyName??t.name??""),label:t.label??t.displayName??String(t.id??""),tooltip:t.tooltip,fields:Array.isArray(t.fields)?t.fields.map(Hr):void 0}})},Hr=e=>{const t="string"==typeof e.componentProperties?Te(e.componentProperties,{}):e.componentProps||{};return{name:e.name,componentType:e.componentType,inputType:e.inputType??t.inputType,title:e.displayName,tooltip:t.tooltip,placeholder:t.placeholder,helpMessage:t.helpMessage,required:t.required,initialValue:e.initialValue,renderCondition:e.renderCondition,options:Vr(t.options??t.values),itemWrapperKey:t.itemWrapperKey,columns:jr(t.columns),limitFieldsPerRow:t.limitFieldsPerRow,variant:t.variant,wrapKey:t.wrapKey,checkboxOptions:Gr(t.options??t.values),checkedValue:t.checkedValue??"true",valueMode:t.valueMode??"object",fields:Array.isArray(t.fields)?t.fields.map(Hr):void 0,addLabel:t.addLabel,itemLabel:t.itemLabel,keyLabel:t.titleKey??t.keyLabel,valueLabel:t.titleValue??t.valueLabel}},Wr=e=>"object"==typeof e&&null!==e&&!Array.isArray(e),Kr=e=>Array.isArray(e)?e:[],Yr=e=>{const t={};return e.forEach(e=>{t[String(e.key??"")]=String(e.value??"")}),t},Jr=e=>Wr(e)?Object.entries(e).map(([e,t])=>({key:e,value:String(t??"")})):[],qr=({field:e,value:n,setValue:a,errorMessage:i,disabled:l})=>{const[s,c]=r(()=>Jr(n));return o(()=>{const e=Wr(n)?n:{};((e,t)=>{const n=Object.keys(e),o=Object.keys(t);return n.length===o.length&&n.every(n=>Object.prototype.hasOwnProperty.call(t,n)&&t[n]===e[n])})(Yr(s),e)||c(Jr(n))},[n]),t(te,{name:e.name,label:e.title,tooltip:e.tooltip,helpMessage:e.helpMessage,required:e.required,disabled:l,limitFieldsPerRow:2,columns:[{keyName:"key",label:e.keyLabel||"Key",placeholder:e.keyLabel||"Key"},{keyName:"value",label:e.valueLabel||"Value",placeholder:e.valueLabel||"Value"}],values:s,setValues:e=>{c(e),a(Yr(e))},errorMessage:i})},Zr=({field:o,value:a,setValue:i,errorMessage:l,disabled:s})=>{const{name:c,componentType:d,inputType:u,title:p,tooltip:h,placeholder:m,helpMessage:g,required:f,initialValue:b,options:y,itemWrapperKey:v,columns:C,limitFieldsPerRow:S,variant:w,wrapKey:x,checkboxOptions:k}=o,[T,$]=r({open:!1,value:""});if(d===xe.CheckboxList&&"array"===o.valueMode){const n=Kr(a),o=(e,t)=>i(t?[...n.filter(t=>t!==e),e]:n.filter(t=>t!==e));return e(q,{$gap:12,children:[p&&t(Z,{label:p,tooltip:h,required:f}),t(q,{$gap:8,children:(k||[]).map(e=>{const a=t(Q,{name:e.id,label:e.label,value:n.includes(e.id),disabled:s,onChange:t=>o(e.id,t)},e.id);return e.tooltip?t($e,{text:e.tooltip,withIcon:!0,children:a},e.id):a})}),t(ee,{errorMessage:l,helpMessage:g})]})}if(d===xe.CheckboxList){const n=Wr(a)?a:{},r=(e=>"emptyObject"!==e.checkedValue||{})(o),d=e=>"emptyObject"===o.checkedValue?Wr(e):!!e;return e(q,{$gap:12,children:[p&&t(se,{size:de.XS,color:ce.Secondary,nowrap:!0,children:p}),t(q,{$gap:12,children:(k||[]).map(o=>{const a=n[o.id],l=d(a),u=Wr(a)?a:{},p=t(Q,{label:o.label,value:l,disabled:s,onChange:e=>i({...n,[o.id]:e?Wr(a)?a:r:null})}),h=o.tooltip?t($e,{text:o.tooltip,withIcon:!0,children:p}):p,m=l&&o.fields?.length?t(q,{$gap:12,$padding:"0 0 0 24px",children:o.fields.map(e=>t(Zr,{field:e,value:u[e.name],setValue:t=>i({...n,[o.id]:{...u,[e.name]:t}}),disabled:s},`${c}-${o.id}-${e.name}`))}):null;return e(q,{$gap:12,children:[h,m]},o.id)})}),t(ee,{errorMessage:l,helpMessage:g})]})}if(d===xe.MultiTabledInput){const o=Kr(x?a?.[x]:a),r=e=>i(x?{...Wr(a)?a:{},[x]:e}:e),d=(C||[]).some(e=>e.withRegexTester);return e(n,{children:[t("cards"===w?Ie:te,{name:c,label:p,tooltip:h,helpMessage:g,required:f,disabled:s,columns:C||[],limitFieldsPerRow:S,values:o,setValues:r,errorMessage:l,onTestRegex:d?e=>$({open:!0,value:e}):void 0}),d&&t(Ar,{isOpen:T.open,regex:T.value,onClose:()=>$({open:!1,value:""})})]})}if(d===xe.MultiInput&&x){const e=Kr(a?.[x]);return t(ie,{name:c,label:p,tooltip:h,helpMessage:g,required:f,disabled:s,placeholder:m,values:e,setValues:e=>i({...Wr(a)?a:{},[x]:e}),errorMessage:l})}if(d===xe.MultiInput&&v){const e=Kr(a).map(e=>String(e?.[v]??""));return t(ie,{name:c,label:p,tooltip:h,helpMessage:g,required:f,disabled:s,placeholder:m,values:e,setValues:e=>i(e.map(e=>({[v]:e}))),errorMessage:l})}if(d===xe.KeyValuePair)return t(qr,{field:o,value:a,setValue:i,errorMessage:l,disabled:s});return t(vl,{componentType:d,inputType:u,name:c,label:p,tooltip:h,helpMessage:g,disabled:s,required:f,placeholder:m,errorMessage:l,dropdownOptions:y,value:(null==a?b:a)??"",setValue:i})},Qr=({field:o,value:a,setValue:i,disabled:l})=>{const r=f(),c=Kr(a),d=c.length?c:[{}],u=o.fields||[],p=e=>i(e);return e(n,{children:[d.map((n,a)=>e(s,{children:[t(we,{}),e(q,{$gap:12,children:[e(ue,{$justifyContent:"space-between",$alignItems:"center",children:[t(Z,{label:`${o.itemLabel||o.title||"Item"} ${a+1}`}),t(pe,{leftIcon:()=>t(bi,{fill:r.v2.colors.red[500]}),variant:me.Secondary,size:he.S,onClick:()=>(e=>{const t=d.filter((t,n)=>n!==e);p(t)})(a),disabled:l||1===d.length})]}),u.map(e=>t(Zr,{field:e,value:n[e.name],setValue:t=>((e,t,n)=>p(d.map((o,a)=>a===e?{...o,[t]:n}:o)))(a,e.name,t),disabled:l},`${o.name}-group-${a}-${e.name}`))]})]},`${o.name}-group-${a}`)),t(pe,{variant:me.Secondary,label:o.addLabel||"Add",leftIcon:yi,onClick:()=>p([...d,{}]),disabled:l}),t(we,{})]})},es=({field:n,value:o,setValue:a,errorMessage:i,disabled:l})=>e(q,{$gap:12,children:[n.title&&t(Z,{label:n.title,tooltip:n.tooltip,required:n.required}),t(q,{$gap:8,children:(n.checkboxOptions||[]).map(e=>{const n=t(Q,{name:e.id,label:e.label,value:!0===o?.[e.id],disabled:l,onChange:t=>a(e.id,t)},e.id);return e.tooltip?t($e,{text:e.tooltip,withIcon:!0,children:n},e.id):n})}),t(ee,{errorMessage:i,helpMessage:n.helpMessage})]}),ts=({signals:e,fields:a,value:i,setValue:l,formErrors:r,disabled:s,seedInitialValues:c})=>{const d=(a||[]).filter(e=>!!e).map(e=>Hr(e));return o(()=>{if(!c)return;const e=i||{},t={};d.forEach(n=>{const o=(e=>{const t=e.initialValue;if(void 0!==t&&""!==t)return e.componentType===xe.CheckboxList?"array"===e.valueMode?Te(t,[]):Te(t,{}):e.componentType!==xe.MultiInput&&e.componentType!==xe.MultiTabledInput||!e.wrapKey?e.componentType===xe.MultiInput||e.componentType===xe.MultiTabledInput?Te(t,[]):t:{[e.wrapKey]:Te(t,[])}})(n);if(void 0===o)return;if(n.componentType===xe.CheckboxList&&"flatFields"===n.valueMode&&Wr(o))return void Object.entries(o).forEach(([n,o])=>{void 0!==e[n]&&null!==e[n]||(t[n]=o)});const a=e[n.name];null==a&&(t[n.name]=Wr(o)&&Wr(t[n.name])?{...t[n.name],...o}:o)}),Object.entries(t).forEach(([e,t])=>l(e,t))},[]),t(n,{children:d.map(n=>{const o=Object.entries(i||{}).map(([e,t])=>({name:e,value:t}));if(!(!n.renderCondition||ke(n.renderCondition,e,o)))return null;const a=i?.[n.name];if(n.componentType===xe.FieldGroup)return t(Qr,{field:n,value:a,setValue:e=>l(n.name,e),disabled:s},n.name);if(n.componentType===xe.CheckboxList&&"flatFields"===n.valueMode){const e=n.checkboxOptions?.map(e=>r[e.id]).find(Boolean);return t(es,{field:n,value:i||{},setValue:l,errorMessage:e,disabled:s},n.name)}return t(Zr,{field:n,value:a,setValue:e=>l(n.name,e),errorMessage:r[n.name],disabled:s},n.name)})})},ns={[Ee.K8sAttributes]:({value:a,setValue:i,formErrors:l})=>(o(()=>{a[J.CollectContainerAttributes]||a[J.CollectReplicaSetAttributes]||a[J.CollectWorkloadId]||a[J.CollectClusterId]||a[J.LabelsAttributes]?.length||a[J.AnnotationsAttributes]?.length||(i(J.CollectContainerAttributes,!0),i(J.CollectReplicaSetAttributes,!0),i(J.CollectWorkloadId,!0),i(J.CollectClusterId,!0),i(J.LabelsAttributes,[]),i(J.AnnotationsAttributes,[]))},[]),e(n,{children:[t(q,{$gap:6,children:sr.map(({id:n,label:o})=>e(q,{children:[t(Q,{label:o,value:a[n]||!1,onChange:e=>i(n,e)}),t(ee,{errorMessage:l[n]})]},n))}),t(te,{name:"labelsAttributes",label:"Label attributes",limitFieldsPerRow:2,columns:dr,values:a[J.LabelsAttributes]||[],setValues:e=>i(J.LabelsAttributes,e),errorMessage:l[J.LabelsAttributes]}),t(te,{name:"annotationsAttributes",label:"Annotation attributes",limitFieldsPerRow:2,columns:ur,values:a[J.AnnotationsAttributes]||[],setValues:e=>i(J.AnnotationsAttributes,e),errorMessage:l[J.AnnotationsAttributes]})]})),[Ee.AddClusterInfo]:({value:o,setValue:a,formErrors:i})=>{const l=f();return e(n,{children:[t(oe,{label:"Overwrite existing values",labelAlign:ae.Left,labelColor:l.v2.colors.silver[200],tooltip:"If enabled, the resource attributes will overwrite any existing attributes with the same name.",value:o[J.OverwriteExistingValues]||!1,onChange:e=>a(J.OverwriteExistingValues,e)}),t(te,{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:o[J.ClusterAttributes]||[],setValues:e=>a(J.ClusterAttributes,e),errorMessage:i[J.ClusterAttributes]})]})},[Ee.DeleteAttributes]:({value:e,setValue:n,formErrors:o})=>t(ie,{name:"attributeNamesToDelete",label:"Attributes to delete",values:e[J.AttributeNamesToDelete]||[],setValues:e=>n(J.AttributeNamesToDelete,e),errorMessage:o[J.AttributeNamesToDelete]}),[Ee.RenameAttributes]:({value:e,setValue:n,formErrors:a})=>{const i=e[J.Renames],[l,s]=r(()=>_r(i));return o(()=>{((e,t)=>{const n=Object.keys(e),o=Object.keys(t);return n.length===o.length&&n.every(n=>Object.prototype.hasOwnProperty.call(t,n)&&t[n]===e[n])})(zr(l),i||{})||s(_r(i))},[i]),t(te,{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:l,setValues:e=>{const t=e.map(e=>({oldKey:String(e.oldKey??""),newKey:String(e.newKey??"")}));s(t),n(J.Renames,zr(t))},errorMessage:a[J.Renames]})},[Ee.PiiMasking]:({value:n,setValue:a,formErrors:i})=>(o(()=>{n[J.PiiCategories]?.length||a(J.PiiCategories,rr.map(({id:e})=>e))},[]),e(q,{$gap:12,children:[t(Z,{label:"Attributes to mask"}),t(q,{$gap:6,children:rr.map(({id:e,label:o})=>t(Q,{label:o,value:n[J.PiiCategories]?.includes(e)||!1,onChange:t=>{const o=n[J.PiiCategories]||[],i=t?[...o,e]:o.filter(t=>t!==e);a(J.PiiCategories,i)}},e))}),t(ee,{errorMessage:i[J.PiiCategories]})]})),[Ee.URLTemplatization]:({value:o,setValue:a,formErrors:i})=>{const l=f(),r=o[Br]||[{filterK8sNamespace:"",workloadFilters:[],templatizationRules:[{template:""}],notes:""}],c=e=>a(Br,e),d=(e,t)=>c(r.map((n,o)=>o===e?{...n,...t}:n));return e(n,{children:[r.map((n,o)=>e(s,{children:[t(we,{}),e(q,{$gap:12,children:[e(ue,{$justifyContent:"space-between",$alignItems:"center",children:[t(Z,{label:`Rule Group ${o+1}`}),t(pe,{leftIcon:()=>t(bi,{fill:l.v2.colors.red[500]}),variant:me.Secondary,size:he.S,onClick:()=>{return e=o,c(r.filter((t,n)=>n!==e));var e},disabled:1===r.length})]}),t(Se,{name:`urlGroup-${o}-namespace`,label:"Namespace",placeholder:"All namespaces",tooltip:"Filter rules to a specific Kubernetes namespace.",value:n.filterK8sNamespace||"",onChange:e=>d(o,{filterK8sNamespace:e.target.value})}),t(te,{name:`urlGroup-${o}-workloadFilters`,label:"Workload filters",tooltip:"Optionally scope templates to specific workloads.",columns:Xr,values:n.workloadFilters||[],setValues:e=>d(o,{workloadFilters:e})}),t(ie,{name:`urlGroup-${o}-templates`,label:"Templates",required:!0,placeholder:"e.g. /user/{id}",values:n.templatizationRules.map(e=>e.template),setValues:e=>d(o,{templatizationRules:e.map(e=>({template:e}))})})]}),t(ee,{errorMessage:i[Br]})]},`url-templatization-group-${o}`)),t(pe,{variant:me.Secondary,label:"Add rule group",leftIcon:yi,onClick:()=>c([...r,{filterK8sNamespace:"",workloadFilters:[],templatizationRules:[{template:""}],notes:""}])}),t(we,{})]})},[Ee.ExtractAttribute]:({value:n,setValue:a,formErrors:i})=>{const l=f(),s=i[Nr],c=n[Nr]?.extractions||[],[d,u]=r(()=>(e=>e.length&&e.some(Pr)?Or.Regex:Or.Preset)(c)),[p,h]=r(null),m=e=>a(Nr,{extractions:e});o(()=>{0===c.length&&m([d===Or.Preset?Dr():{targetAttributeName:"",lookupKey:"",dataFormat:"",regex:""}])},[]);const g=(e,t)=>{m(c.map((n,o)=>o===e?{...n,...t}:n))},b=()=>{m([...c,d===Or.Preset?Dr():{targetAttributeName:"",lookupKey:"",dataFormat:"",regex:""}])},y=d===Or.Preset,v=c.length?c:[y?Dr():{targetAttributeName:"",lookupKey:"",dataFormat:"",regex:""}],C=null!=p&&v[p]?.regex||"";return e(q,{$gap:16,$width:"100%",children:[t(ge,{options:[{value:Or.Preset,label:fe.SEGMENT_PRESET_LABEL,tooltip:fe.SEGMENT_PRESET_TOOLTIP,selectedBgColor:l.v2.colors.purple[500]},{value:Or.Regex,label:fe.SEGMENT_REGEX_LABEL,tooltip:fe.SEGMENT_REGEX_TOOLTIP,selectedBgColor:l.v2.colors.purple[500]}],selected:d,setSelected:e=>{u(e),m([e===Or.Preset?Dr():{targetAttributeName:"",lookupKey:"",dataFormat:"",regex:""}])}}),e(q,{$gap:8,$width:"100%",children:[v.map((n,o)=>{const a=o===v.length-1,i=n.dataFormat||be.JSON,r=ve[i];return e(Fr,{"data-id":`extract-row-${o}`,children:[e(ue,{$gap:10,$alignItems:"flex-start",$width:"100%",$justifyContent:"space-between",children:[e(q,{$gap:10,children:[t(Z,{label:y?fe.PRESET_ROW_TITLE(o):fe.REGEX_ROW_TITLE(o)}),y&&t(ue,{$gap:24,children:Rr.map(e=>t(ye,{"data-id":`extract-row-${o}-fmt-${e}`,size:Ce.L,label:ve[e].label,value:i===e,onChange:t=>t&&g(o,{dataFormat:e})},`extract-row-${o}-fmt-${e}`))})]}),e(ue,{$gap:4,$alignItems:"center",children:[!y&&t(pe,{"data-id":`extract-row-${o}-test-regex`,label:fe.TEST_REGEX_LABEL,variant:me.Secondary,size:he.S,onClick:()=>h(o),disabled:!n.regex?.trim()}),t(pe,{"data-id":`extract-row-${o}-delete`,leftIcon:()=>t(bi,{fill:l.v2.colors.red[500]}),variant:me.Secondary,size:he.S,onClick:()=>(e=>{const t=c.filter((t,n)=>n!==e);m(t.length?t:[d===Or.Preset?Dr():{targetAttributeName:"",lookupKey:"",dataFormat:"",regex:""}])})(o)}),a&&t(pe,{"data-id":`extract-row-${o}-add`,leftIcon:yi,variant:me.Secondary,size:he.S,onClick:b})]})]}),y?e(ue,{$gap:8,$alignItems:"flex-start",$width:"100%",children:[t(Lr,{children:t(Se,{name:`extract-row-${o}-lookupKey`,label:r.keyLabel,placeholder:r.placeholder,helpMessage:r.helpMessage,width:"100%",value:n.lookupKey||"",onChange:e=>g(o,{lookupKey:e.target.value})})}),t(Mr,{children:t(vi,{size:24,fill:l.v2.colors.silver[200]})}),t(Lr,{children:t(Se,{name:`extract-row-${o}-targetAttributeName`,label:fe.TARGET_LABEL,placeholder:fe.TARGET_PLACEHOLDER,helpMessage:fe.TARGET_HELP,width:"100%",value:n.targetAttributeName||"",onChange:e=>g(o,{targetAttributeName:e.target.value})})})]}):e(q,{$gap:12,$width:"100%",children:[t(Se,{name:`extract-row-${o}-regex`,label:fe.REGEX_LABEL,placeholder:fe.REGEX_PLACEHOLDER,helpMessage:fe.REGEX_HELP,width:"100%",value:n.regex||"",onChange:e=>g(o,{regex:e.target.value})}),t(Se,{name:`extract-row-${o}-targetAttributeName`,label:fe.TARGET_LABEL,placeholder:fe.TARGET_PLACEHOLDER,helpMessage:fe.TARGET_HELP,width:"100%",value:n.targetAttributeName||"",onChange:e=>g(o,{targetAttributeName:e.target.value})})]})]},`extract-row-${o}`)}),t(ee,{errorMessage:s})]}),t(Ar,{isOpen:null!=p,regex:C,onClose:()=>h(null)})]})}},os=({actionType:e,value:n,setValue:o,formErrors:a,dynamicFields:i,signals:l})=>{if(!e)return null;if(i?.length)return t(ts,{fields:i,value:n,setValue:o,formErrors:a||{},signals:l||[],seedInitialValues:!0},e);const r=ns[e];return r?t(r,{value:n,setValue:o,formErrors:a}):null},as=()=>{const n=f(),{selectedOption:o,genericForm:a}=Bl();if(!a||!o)return t(Ae,{title:"No active form"});const{formData:i,handleFormChange:l,formErrors:r}=a;return e(q,{$gap:24,children:[e(ue,{$gap:12,$justifyContent:"space-between",children:[t(Ne,{size:de.XXXS,maxLines:2,children:o.description}),e(ue,{$gap:12,children:[t(ge,{options:[{icon:Ci,label:"Enabled",value:!1,selectedBgColor:n.v2.colors.green[800]},{icon:Si,label:"Disabled",value:!0,selectedBgColor:n.v2.colors.red[800]}],size:Oe.S,selected:i.disabled,setSelected:e=>l("disabled",e)}),t(pe,{leftIcon:wi,variant:me.Secondary,size:he.S,onClick:()=>o.docsUrl&&window.open(o.docsUrl,"_blank","noopener noreferrer")})]})]}),t(Cl,{title:"Signals for processing",allowedSignals:o.allowedSignals,selectedSignals:i.signals||[],setSelectedSignals:e=>l("signals",e),errorMessage:r.signals}),t(Se,{name:"actionName",label:"Action name",placeholder:"Use a name that describes the action...",value:i.name||"",onChange:({target:{value:e}})=>l("name",e),errorMessage:r.name}),t(os,{actionType:o.type,dynamicFields:o.fields,signals:i.signals||[],value:i.fields,setValue:(e,t)=>l(`fields.${e}`,t),formErrors:r}),t(Re,{name:"notes",label:"Notes",placeholder:"Your personal notes...",value:i.notes||"",onChange:({target:{value:e}})=>l("notes",e),errorMessage:r.notes})]})},is=({signals:e,fields:n,disabled:o,formData:a,handleFormChange:i,formErrors:l})=>n?.map(({renderCondition:n,componentType:r,type:s,name:c,title:d,tooltip:u,placeholder:p,value:h,required:m,options:g})=>{if(!(!n||ke(n,e,a.fields)))return null;const f=c,b=a.fields.find(e=>e.key===f),y=b?b.value:h;return t(vl,{componentType:r,inputType:s,name:f,label:d,tooltip:u,disabled:o,required:m,placeholder:p,errorMessage:l[f],dropdownOptions:g,value:y||"",setValue:e=>i(f,e)},f)}),ls=g(ue)`
|
|
118
118
|
position: sticky;
|
|
119
119
|
bottom: 4px;
|
|
120
120
|
align-self: center;
|
|
@@ -125,17 +125,17 @@ import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{useEffect
|
|
|
125
125
|
background-color: ${({theme:e})=>e.v2.colors.black[500]};
|
|
126
126
|
box-shadow: 0 4px 16.7px 0 rgba(0, 0, 0, 0.83);
|
|
127
127
|
z-index: 1;
|
|
128
|
-
`,qr=c(({isEdit:n},a)=>{const i=f(),{isVm:l}=y(),{destinationsApi:s}=gl(),{activeForm:c,genericForm:u,validateFormData:p,thisUnsavedDestination:h,addUnsavedDestination:m,updateUnsavedDestination:g,deleteUnsavedDestination:b}=Ml(),[v,C]=r(h?.testResult),[S,w]=r(!!h);o(()=>{h?(C(h.testResult),w(!0)):(C(void 0),w(!1))},[h]);const x=async()=>{if(!c?.option.testConnectionSupported||!u||l)return;const e=await s.testConnection(_e(u.formData));return C(e),e};return d(a,()=>({testConnection:x,testConnectionSupported:!!c?.option.testConnectionSupported}),[c?.option.testConnectionSupported,u,s]),u&&c?e(q,{$gap:24,style:{minHeight:"100%"},children:[e(ue,{$gap:12,$justifyContent:"space-between",children:[v?v.succeeded?t(Oe,{status:Re.Success,message:v.message||"Connection OK",fullWidth:!0,smallIcon:!0}):t(Oe,{status:Re.Error,message:v.message||"Connection Failed",fullWidth:!0,smallIcon:!0}):t("div",{}),e(ue,{$gap:12,children:[!l&&t(ge,{options:[{icon:vi,label:"Enabled",value:!1,selectedBgColor:i.v2.colors.green[800]},{icon:yi,label:"Disabled",value:!0,selectedBgColor:i.v2.colors.red[800]}],size:Ae.S,selected:u.formData.disabled,setSelected:e=>u.handleFormChange("disabled",e),disabled:S}),t(pe,{"data-id":"dest-form-docs",leftIcon:Ci,variant:me.Secondary,size:he.S,onClick:()=>window.open(`${De}/backends/${c.option.type}`,"_blank","noopener noreferrer")})]})]}),t(bl,{title:"This connection will monitor:",allowedSignals:Le(c.option.supportedSignals),selectedSignals:Fe(u.formData.exportedSignals),setSelectedSignals:e=>u.handleFormChange("exportedSignals",{logs:e.includes(Pe.Logs),metrics:e.includes(Pe.Metrics),traces:e.includes(Pe.Traces),profiles:e.includes(Pe.Profiles)}),disabled:S,errorMessage:u.formErrors.exportedSignals}),t(Se,{name:"destinationName",label:"Destination name",placeholder:"Use a name that describes the destination...",value:u.formData.name,onChange:({target:{value:e}})=>u.handleFormChange("name",e),disabled:S,errorMessage:u.formErrors.name}),t(Yr,{signals:Fe(u.formData.exportedSignals),fields:c.dynamicFields,disabled:S,formData:u.formData,handleFormChange:(e,t)=>{u.handleFormChange("fields",u.formData.fields.map(n=>n.key===e?{...n,value:t}:n)),e&&u.formErrors[e]&&u.handleErrorChange(e,void 0)},formErrors:u.formErrors}),!n&&e(Jr,{$gap:8,$justifyContent:"center",children:[h&&t("div",{style:{width:"150px"},children:t(pe,{"data-id":"dest-form-delete",fullWidth:!0,label:"Delete",rightIcon:Si,variant:me.Secondary,textColor:i.v2.colors.red[500],onClick:()=>b(c.unsavedIdx)})}),!l&&(!h||h.option.testConnectionSupported&&!S)&&t("div",{style:{width:"150px"},children:t(pe,{"data-id":"dest-form-test-connection",fullWidth:!0,label:"Test Connection",variant:me.Secondary,onClick:x})}),h&&t("div",S?{style:{width:"150px"},children:t(pe,{"data-id":"dest-form-edit",fullWidth:!0,label:"Edit",rightIcon:wi,variant:me.Secondary,onClick:()=>w(!1)})}:{style:{width:"150px"},children:t(pe,{"data-id":"dest-form-save",fullWidth:!0,label:"Save Changes",variant:me.Primary,onClick:async()=>{const{errorMessage:e,preparedFormData:t}=p();if(!e){const e=await x(),n=!!e&&!e.succeeded;g(c.unsavedIdx,{formData:t,testResult:e},n)}}})}),!h&&t("div",{style:{width:"150px"},children:t(pe,{"data-id":"dest-form-add",fullWidth:!0,label:"Add Destination",variant:me.Primary,onClick:async()=>{const{errorMessage:e,preparedFormData:t}=p();if(!e){const e=await x(),n=!!e&&!e.succeeded;m({formData:t,testResult:e},n)}}})})]})]}):t(Ie,{title:"No active form"})});qr.displayName="AddDestinationForm";const Zr=[{id:Me.FilePath,label:"Collect file path",tooltip:"Indicates whether to record the `code.filepath` attribute."},{id:Me.Function,label:"Collect function",tooltip:"Indicates whether to record the `code.function` attribute."},{id:Me.LineNumber,label:"Collect line number",tooltip:"Indicates whether to record the `code.lineno` attribute."}],Qr=[{id:Me.Column,label:"Collect column",tooltip:"Indicates whether to record the `code.column` attribute."},{id:Me.Namespace,label:"Collect namespace",tooltip:"Indicates whether to record the `code.namespace` attribute."},{id:Me.StackTrace,label:"Collect stacktrace",tooltip:"Indicates whether to record the `code.stacktrace` attribute."}],es=["*"],ts=[{id:Xe.HttpRequest,label:"Collect HTTP request",tooltip:""},{id:Xe.HttpResponse,label:"Collect HTTP response",tooltip:""},{id:Xe.DbQuery,label:"Collect DB query",tooltip:""},{id:Xe.Messaging,label:"Collect messaging",tooltip:""}],ns={[Ge.Java]:[new Ue("","")],[Ge.Golang]:[new Ve("")]},os={[He.CodeAttributes]:({value:i,setValue:l,formErrors:r})=>{const s=r.codeAttributes,c=a(()=>Object.entries(i.codeAttributes||{}).filter(([e,t])=>!!t).map(([e])=>e),[i]);o(()=>{if(!c.length&&!s){const e={[Me.FilePath]:!0,[Me.Function]:!0,[Me.LineNumber]:!0,[Me.Column]:null,[Me.Namespace]:null,[Me.StackTrace]:null};l("codeAttributes",e)}},[]);const d=(e,t)=>{const n=t?[...c,e]:c.filter(t=>t!==e),o=Object.values(Me).reduce((e,t)=>(e[t]=!!n.includes(t)||null,e),{});l("codeAttributes",o)};return e(n,{children:[e(q,{$gap:12,children:[t(se,{size:de.XS,color:ce.Secondary,nowrap:!0,children:"Recommended data to collect"}),t(q,{$gap:6,children:Zr.map(({id:e,label:n,tooltip:o})=>t(ze,{text:o,withIcon:!0,children:t(Q,{label:n,value:c.includes(e),onChange:t=>d(e,t)})},e))}),t(ee,{errorMessage:s})]}),e(q,{$gap:12,children:[t(se,{size:de.XS,color:ce.Secondary,nowrap:!0,children:"Verbose data to collect"}),t(q,{$gap:6,children:Qr.map(({id:e,label:n,tooltip:o})=>t(ze,{text:o,withIcon:!0,children:t(Q,{label:n,value:c.includes(e),onChange:t=>d(e,t)})},e))}),t(ee,{errorMessage:s})]})]})},[He.CustomInstrumentation]:({value:i,setValue:l,formErrors:r})=>{const s=r.customInstrumentations,c=a(()=>(i?.customInstrumentations?.[Ge.Golang]||[]).map(e=>new Ve(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)),[i]),d=a(()=>(i?.customInstrumentations?.[Ge.Java]||[]).map(e=>new Ue(e.className,e.methodName)),[i]);return o(()=>{i?.customInstrumentations||s||l("customInstrumentations",{[Ge.Golang]:ns[Ge.Golang],[Ge.Java]:ns[Ge.Java]})},[]),e(n,{children:[e(q,{children:[e(ue,{$gap:8,children:[t(xi,{}),t(Z,{label:"Golang custom probes"})]}),t(te,{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:c,setValues:e=>{const t={};t[Ge.Golang]=e.map(e=>new Ve(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)),t[Ge.Java]=d,l("customInstrumentations",t)},errorMessage:s,limitFieldsPerRow:2})]}),e(q,{children:[e(ue,{$gap:8,children:[t(ki,{}),t(Z,{label:"Java custom probes"})]}),t(te,{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:d,setValues:e=>{const t={};t[Ge.Golang]=c,t[Ge.Java]=e.map(e=>new Ue(e.className,e.methodName)),l("customInstrumentations",t)},errorMessage:s,limitFieldsPerRow:2})]})]})},[He.HeadersCollection]:({value:e,setValue:n,formErrors:i})=>{const l=i.headersCollection,r=a(()=>e?.headersCollection?.[Be.HeaderKeys]||[],[e]),s=e=>{const t={[Be.HeaderKeys]:e};n("headersCollection",t)};return o(()=>{r.length||l||s(es)},[]),t(ie,{name:"headerKeys",label:"Header keys",tooltip:"Specify which headers you want to collect",helpMessage:"Asterisk (*) will collect all headers",values:r,setValues:s,errorMessage:l})},[He.PayloadCollection]:({value:n,setValue:i,formErrors:l})=>{const r=l.payloadCollection,s=a(()=>Object.entries(n.payloadCollection||{}).filter(([e,t])=>!!t).map(([e])=>e),[n]);o(()=>{if(!s.length&&!r){const e={[Xe.HttpRequest]:{},[Xe.HttpResponse]:{},[Xe.DbQuery]:{},[Xe.Messaging]:{}};i("payloadCollection",e)}},[]);return e(q,{$gap:12,children:[t(se,{size:de.XS,color:ce.Secondary,nowrap:!0,children:"Type of data to collect"}),t(q,{$gap:6,children:ts.map(({id:e,label:n,tooltip:o})=>t(ze,{text:o,withIcon:!0,children:t(Q,{label:n,value:s.includes(e),onChange:t=>((e,t)=>{const n=t?[...s,e]:s.filter(t=>t!==e),o={[Xe.HttpRequest]:n.includes(Xe.HttpRequest)?{}:null,[Xe.HttpResponse]:n.includes(Xe.HttpResponse)?{}:null,[Xe.DbQuery]:n.includes(Xe.DbQuery)?{}:null,[Xe.Messaging]:n.includes(Xe.Messaging)?{}:null};i("payloadCollection",o)})(e,t)})},e))}),t(ee,{errorMessage:r})]})},[He.UnknownType]:null},as=({ruleType:e,value:n,setValue:o,formErrors:a})=>{if(!e)return null;const i=os[e];return i?t(i,{value:n,setValue:o,formErrors:a}):null},is=()=>{const n=f(),{selectedOption:o,genericForm:a,sourceOptions:i,namespaceOptions:l}=zl();if(!a||!o)return t(Ie,{title:"No active form"});const{formData:r,handleFormChange:s,formErrors:c}=a;return e(q,{$gap:24,children:[e(ue,{$gap:12,$justifyContent:"space-between",children:[t(Ee,{size:de.XXXS,maxLines:2,children:o.docsDescription}),e(ue,{$gap:12,children:[t(ge,{options:[{icon:vi,label:"Enabled",value:!1,selectedBgColor:n.v2.colors.green[800]},{icon:yi,label:"Disabled",value:!0,selectedBgColor:n.v2.colors.red[800]}],size:Ae.S,selected:r.disabled,setSelected:e=>s("disabled",e)}),t(pe,{leftIcon:Ci,variant:me.Secondary,size:he.S,onClick:()=>window.open(`${De}${o.docsEndpoint}`,"_blank","noopener noreferrer")})]})]}),t(vl,{option:o,formState:r}),e(ue,{$gap:12,children:[t(se,{size:de.XS,color:ce.Secondary,nowrap:!0,children:"Supported Languages:"}),o.supportedLanguages.map(e=>t(je,{label:We[e],leftIcon:Ke(e),backgroundColor:n.v2.colors.purple[900]},e))]}),t(yl,{scopes:r.sourceScopes,onChange:e=>s("sourceScopes",e),sourceOptions:i,namespaceOptions:l,supportedLanguages:o.type===He.CustomInstrumentation?[]:o.supportedLanguages,dataIdPrefix:"instrumentation-rule",slim:!0}),t(Se,{name:"ruleName",label:"Rule name",placeholder:"Use a name that describes the rule...",value:r.ruleName,onChange:({target:{value:e}})=>s("ruleName",e),errorMessage:c.ruleName}),t(as,{ruleType:o.type,value:r,setValue:(e,t)=>s(e,t),formErrors:c}),t(Ne,{name:"notes",label:"Notes",placeholder:"Your personal notes...",value:r.notes,onChange:({target:{value:e}})=>s("notes",e),errorMessage:c.notes})]})},ls=()=>{const{pendingMerge:e,confirmMerge:n,cancelMerge:o}=Bl();if(!e)return null;const{existingName:a,editingName:i}=e;return t(Ye,{isOpen:!0,onClose:o,title:"Merge with existing Data Stream?",description:Je.DATA_STREAM_MERGE_WARNING(i,a),approveButton:{"data-id":"data-stream-merge-confirm",label:"Merge",variant:me.Primary,onClick:n},denyButton:{"data-id":"data-stream-merge-cancel",label:"Cancel",variant:me.Secondary,onClick:o}})},rs=({autoFocus:n})=>{const{dataStreams:o}=qe(),{genericForm:i,excludeName:l,editingName:r}=Bl(),{formData:s,formErrors:c,handleFormChange:d}=i,u=s.name,p=a(()=>o.find(e=>e.name===u&&e.name!==l),[o,u,l]);return e(q,{$width:"100%",$gap:12,children:[t(Se,{name:"data-stream-name",label:Je.STREAM_NAME,placeholder:Je.NAME_YOUR_STREAM_PLACEHOLDER,tooltip:Je.STREAM_DESCRIPTION,required:!0,autoFocus:n,value:u,onChange:e=>d("name",e.target.value),errorMessage:c.name}),p&&t(Oe,{status:Re.Warning,message:Je.DATA_STREAM_MERGE_WARNING(r,p.name),fullWidth:!0})]})},ss=()=>{const{selectedStreamName:e}=qe(),{genericForm:n}=Xl();if(!n)return t(Ie,{title:"No active form"});const{formData:o,handleFormChange:a,formErrors:i}=n;return t(Se,{name:"sourceName",label:Je.NAME,tooltip:"This overrides the default service name (service.name) reported in your telemetry.",placeholder:"Use a name that overrides the source name",value:o.otelServiceName,onChange:({target:{value:t}})=>{a("otelServiceName",t),a("currentStreamName",e)},errorMessage:i.otelServiceName})},cs=[{value:"all",label:"Drop All"},{value:"sample",label:"Sample"}],ds=g.div`
|
|
128
|
+
`,rs=c(({isEdit:n},a)=>{const i=f(),{isVm:l}=v(),{destinationsApi:s}=yl(),{activeForm:c,genericForm:u,validateFormData:p,thisUnsavedDestination:h,addUnsavedDestination:m,updateUnsavedDestination:g,deleteUnsavedDestination:b}=Xl(),[y,C]=r(h?.testResult),[S,w]=r(!!h);o(()=>{h?(C(h.testResult),w(!0)):(C(void 0),w(!1))},[h]);const x=async()=>{if(!c?.option.testConnectionSupported||!u||l)return;const e=await s.testConnection(ze(u.formData));return C(e),e};return d(a,()=>({testConnection:x,testConnectionSupported:!!c?.option.testConnectionSupported}),[c?.option.testConnectionSupported,u,s]),u&&c?e(q,{$gap:24,style:{minHeight:"100%"},children:[e(ue,{$gap:12,$justifyContent:"space-between",children:[y?y.succeeded?t(De,{status:Pe.Success,message:y.message||"Connection OK",fullWidth:!0,smallIcon:!0}):t(De,{status:Pe.Error,message:y.message||"Connection Failed",fullWidth:!0,smallIcon:!0}):t("div",{}),e(ue,{$gap:12,children:[!l&&t(ge,{options:[{icon:Ci,label:"Enabled",value:!1,selectedBgColor:i.v2.colors.green[800]},{icon:Si,label:"Disabled",value:!0,selectedBgColor:i.v2.colors.red[800]}],size:Oe.S,selected:u.formData.disabled,setSelected:e=>u.handleFormChange("disabled",e),disabled:S}),t(pe,{"data-id":"dest-form-docs",leftIcon:wi,variant:me.Secondary,size:he.S,onClick:()=>window.open(`${Fe}/backends/${c.option.type}`,"_blank","noopener noreferrer")})]})]}),t(Cl,{title:"This connection will monitor:",allowedSignals:_e(c.option.supportedSignals),selectedSignals:Me(u.formData.exportedSignals),setSelectedSignals:e=>u.handleFormChange("exportedSignals",{logs:e.includes(Le.Logs),metrics:e.includes(Le.Metrics),traces:e.includes(Le.Traces),profiles:e.includes(Le.Profiles)}),disabled:S,errorMessage:u.formErrors.exportedSignals}),t(Se,{name:"destinationName",label:"Destination name",placeholder:"Use a name that describes the destination...",value:u.formData.name,onChange:({target:{value:e}})=>u.handleFormChange("name",e),disabled:S,errorMessage:u.formErrors.name}),t(is,{signals:Me(u.formData.exportedSignals),fields:c.dynamicFields,disabled:S,formData:u.formData,handleFormChange:(e,t)=>{u.handleFormChange("fields",u.formData.fields.map(n=>n.key===e?{...n,value:t}:n)),e&&u.formErrors[e]&&u.handleErrorChange(e,void 0)},formErrors:u.formErrors}),!n&&e(ls,{$gap:8,$justifyContent:"center",children:[h&&t("div",{style:{width:"150px"},children:t(pe,{"data-id":"dest-form-delete",fullWidth:!0,label:"Delete",rightIcon:xi,variant:me.Secondary,textColor:i.v2.colors.red[500],onClick:()=>b(c.unsavedIdx)})}),!l&&(!h||h.option.testConnectionSupported&&!S)&&t("div",{style:{width:"150px"},children:t(pe,{"data-id":"dest-form-test-connection",fullWidth:!0,label:"Test Connection",variant:me.Secondary,onClick:x})}),h&&t("div",S?{style:{width:"150px"},children:t(pe,{"data-id":"dest-form-edit",fullWidth:!0,label:"Edit",rightIcon:ki,variant:me.Secondary,onClick:()=>w(!1)})}:{style:{width:"150px"},children:t(pe,{"data-id":"dest-form-save",fullWidth:!0,label:"Save Changes",variant:me.Primary,onClick:async()=>{const{errorMessage:e,preparedFormData:t}=p();if(!e){const e=await x(),n=!!e&&!e.succeeded;g(c.unsavedIdx,{formData:t,testResult:e},n)}}})}),!h&&t("div",{style:{width:"150px"},children:t(pe,{"data-id":"dest-form-add",fullWidth:!0,label:"Add Destination",variant:me.Primary,onClick:async()=>{const{errorMessage:e,preparedFormData:t}=p();if(!e){const e=await x(),n=!!e&&!e.succeeded;m({formData:t,testResult:e},n)}}})})]})]}):t(Ae,{title:"No active form"})});rs.displayName="AddDestinationForm";const ss=[{id:Be.FilePath,label:"Collect file path",tooltip:"Indicates whether to record the `code.filepath` attribute."},{id:Be.Function,label:"Collect function",tooltip:"Indicates whether to record the `code.function` attribute."},{id:Be.LineNumber,label:"Collect line number",tooltip:"Indicates whether to record the `code.lineno` attribute."}],cs=[{id:Be.Column,label:"Collect column",tooltip:"Indicates whether to record the `code.column` attribute."},{id:Be.Namespace,label:"Collect namespace",tooltip:"Indicates whether to record the `code.namespace` attribute."},{id:Be.StackTrace,label:"Collect stacktrace",tooltip:"Indicates whether to record the `code.stacktrace` attribute."}],ds=["*"],us=[{id:Ve.HttpRequest,label:"Collect HTTP request",tooltip:""},{id:Ve.HttpResponse,label:"Collect HTTP response",tooltip:""},{id:Ve.DbQuery,label:"Collect DB query",tooltip:""},{id:Ve.Messaging,label:"Collect messaging",tooltip:""}],ps={[Ge.Java]:[new je("","")],[Ge.Golang]:[new Ue("")]},hs={[He.CodeAttributes]:({value:i,setValue:l,formErrors:r})=>{const s=r.codeAttributes,c=a(()=>Object.entries(i.codeAttributes||{}).filter(([e,t])=>!!t).map(([e])=>e),[i]);o(()=>{if(!c.length&&!s){const e={[Be.FilePath]:!0,[Be.Function]:!0,[Be.LineNumber]:!0,[Be.Column]:null,[Be.Namespace]:null,[Be.StackTrace]:null};l("codeAttributes",e)}},[]);const d=(e,t)=>{const n=t?[...c,e]:c.filter(t=>t!==e),o=Object.values(Be).reduce((e,t)=>(e[t]=!!n.includes(t)||null,e),{});l("codeAttributes",o)};return e(n,{children:[e(q,{$gap:12,children:[t(se,{size:de.XS,color:ce.Secondary,nowrap:!0,children:"Recommended data to collect"}),t(q,{$gap:6,children:ss.map(({id:e,label:n,tooltip:o})=>t($e,{text:o,withIcon:!0,children:t(Q,{label:n,value:c.includes(e),onChange:t=>d(e,t)})},e))}),t(ee,{errorMessage:s})]}),e(q,{$gap:12,children:[t(se,{size:de.XS,color:ce.Secondary,nowrap:!0,children:"Verbose data to collect"}),t(q,{$gap:6,children:cs.map(({id:e,label:n,tooltip:o})=>t($e,{text:o,withIcon:!0,children:t(Q,{label:n,value:c.includes(e),onChange:t=>d(e,t)})},e))}),t(ee,{errorMessage:s})]})]})},[He.CustomInstrumentation]:({value:i,setValue:l,formErrors:r})=>{const s=r.customInstrumentations,c=a(()=>(i?.customInstrumentations?.[Ge.Golang]||[]).map(e=>new Ue(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)),[i]),d=a(()=>(i?.customInstrumentations?.[Ge.Java]||[]).map(e=>new je(e.className,e.methodName)),[i]);return o(()=>{i?.customInstrumentations||s||l("customInstrumentations",{[Ge.Golang]:ps[Ge.Golang],[Ge.Java]:ps[Ge.Java]})},[]),e(n,{children:[e(q,{children:[e(ue,{$gap:8,children:[t(Ti,{}),t(Z,{label:"Golang custom probes"})]}),t(te,{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:c,setValues:e=>{const t={};t[Ge.Golang]=e.map(e=>new Ue(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)),t[Ge.Java]=d,l("customInstrumentations",t)},errorMessage:s,limitFieldsPerRow:2})]}),e(q,{children:[e(ue,{$gap:8,children:[t($i,{}),t(Z,{label:"Java custom probes"})]}),t(te,{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:d,setValues:e=>{const t={};t[Ge.Golang]=c,t[Ge.Java]=e.map(e=>new je(e.className,e.methodName)),l("customInstrumentations",t)},errorMessage:s,limitFieldsPerRow:2})]})]})},[He.HeadersCollection]:({value:e,setValue:n,formErrors:i})=>{const l=i.headersCollection,r=a(()=>e?.headersCollection?.[Xe.HeaderKeys]||[],[e]),s=e=>{const t={[Xe.HeaderKeys]:e};n("headersCollection",t)};return o(()=>{r.length||l||s(ds)},[]),t(ie,{name:"headerKeys",label:"Header keys",tooltip:"Specify which headers you want to collect",helpMessage:"Asterisk (*) will collect all headers",values:r,setValues:s,errorMessage:l})},[He.PayloadCollection]:({value:n,setValue:i,formErrors:l})=>{const r=l.payloadCollection,s=a(()=>Object.entries(n.payloadCollection||{}).filter(([e,t])=>!!t).map(([e])=>e),[n]);o(()=>{if(!s.length&&!r){const e={[Ve.HttpRequest]:{},[Ve.HttpResponse]:{},[Ve.DbQuery]:{},[Ve.Messaging]:{}};i("payloadCollection",e)}},[]);return e(q,{$gap:12,children:[t(se,{size:de.XS,color:ce.Secondary,nowrap:!0,children:"Type of data to collect"}),t(q,{$gap:6,children:us.map(({id:e,label:n,tooltip:o})=>t($e,{text:o,withIcon:!0,children:t(Q,{label:n,value:s.includes(e),onChange:t=>((e,t)=>{const n=t?[...s,e]:s.filter(t=>t!==e),o={[Ve.HttpRequest]:n.includes(Ve.HttpRequest)?{}:null,[Ve.HttpResponse]:n.includes(Ve.HttpResponse)?{}:null,[Ve.DbQuery]:n.includes(Ve.DbQuery)?{}:null,[Ve.Messaging]:n.includes(Ve.Messaging)?{}:null};i("payloadCollection",o)})(e,t)})},e))}),t(ee,{errorMessage:r})]})},[He.UnknownType]:null},ms=({ruleType:e,value:n,setValue:o,formErrors:a,dynamicFields:i})=>{if(!e)return null;if(i?.length)return t(ts,{fields:i,value:n,setValue:o,formErrors:a||{},signals:[],seedInitialValues:!0});const l=hs[e];return l?t(l,{value:n,setValue:o,formErrors:a}):null},gs=()=>{const n=f(),{isVm:o}=v(),{selectedOption:a,genericForm:i,sourceOptions:l,namespaceOptions:r}=Vl();if(!i||!a)return t(Ae,{title:"No active form"});const{formData:s,handleFormChange:c,formErrors:d}=i;return e(q,{$gap:24,children:[e(ue,{$gap:12,$justifyContent:"space-between",children:[t(Ne,{size:de.XXXS,maxLines:2,children:a.description}),e(ue,{$gap:12,children:[t(ge,{options:[{icon:Ci,label:"Enabled",value:!1,selectedBgColor:n.v2.colors.green[800]},{icon:Si,label:"Disabled",value:!0,selectedBgColor:n.v2.colors.red[800]}],size:Oe.S,selected:s.disabled,setSelected:e=>c("disabled",e)}),t(pe,{leftIcon:wi,variant:me.Secondary,size:he.S,onClick:()=>a.docsUrl&&window.open(a.docsUrl,"_blank","noopener noreferrer")})]})]}),t(Sl,{option:a,formState:s}),e(ue,{$gap:12,children:[t(se,{size:de.XS,color:ce.Secondary,nowrap:!0,children:"Supported Languages:"}),a.supportedLanguages.map(e=>t(We,{label:Ke[e],leftIcon:Ye(e),backgroundColor:n.v2.colors.purple[900]},e))]}),!o&&t(wl,{scopes:s.sourceScopes,onChange:e=>c("sourceScopes",e),sourceOptions:l,namespaceOptions:r,supportedLanguages:a.type===He.CustomInstrumentation?[]:a.supportedLanguages,dataIdPrefix:"instrumentation-rule",slim:!0}),t(Se,{name:"ruleName",label:"Rule name",placeholder:"Use a name that describes the rule...",value:s.ruleName,onChange:({target:{value:e}})=>c("ruleName",e),errorMessage:d.ruleName}),t(ms,{ruleType:a.type,dynamicFields:a.fields,value:s,setValue:(e,t)=>c(e,t),formErrors:d}),t(Re,{name:"notes",label:"Notes",placeholder:"Your personal notes...",value:s.notes,onChange:({target:{value:e}})=>c("notes",e),errorMessage:d.notes})]})},fs=()=>{const{pendingMerge:e,confirmMerge:n,cancelMerge:o}=Ul();if(!e)return null;const{existingName:a,editingName:i}=e;return t(Je,{isOpen:!0,onClose:o,title:"Merge with existing Data Stream?",description:qe.DATA_STREAM_MERGE_WARNING(i,a),approveButton:{"data-id":"data-stream-merge-confirm",label:"Merge",variant:me.Primary,onClick:n},denyButton:{"data-id":"data-stream-merge-cancel",label:"Cancel",variant:me.Secondary,onClick:o}})},bs=({autoFocus:n})=>{const{dataStreams:o}=Ze(),{genericForm:i,excludeName:l,editingName:r}=Ul(),{formData:s,formErrors:c,handleFormChange:d}=i,u=s.name,p=a(()=>o.find(e=>e.name===u&&e.name!==l),[o,u,l]);return e(q,{$width:"100%",$gap:12,children:[t(Se,{name:"data-stream-name",label:qe.STREAM_NAME,placeholder:qe.NAME_YOUR_STREAM_PLACEHOLDER,tooltip:qe.STREAM_DESCRIPTION,required:!0,autoFocus:n,value:u,onChange:e=>d("name",e.target.value),errorMessage:c.name}),p&&t(De,{status:Pe.Warning,message:qe.DATA_STREAM_MERGE_WARNING(r,p.name),fullWidth:!0})]})},ys=()=>{const{selectedStreamName:e}=Ze(),{genericForm:n}=jl();if(!n)return t(Ae,{title:"No active form"});const{formData:o,handleFormChange:a,formErrors:i}=n;return t(Se,{name:"sourceName",label:qe.NAME,tooltip:"This overrides the default service name (service.name) reported in your telemetry.",placeholder:"Use a name that overrides the source name",value:o.otelServiceName,onChange:({target:{value:t}})=>{a("otelServiceName",t),a("currentStreamName",e)},errorMessage:i.otelServiceName})},vs=[{value:"all",label:"Drop All"},{value:"sample",label:"Sample"}],Cs=g.div`
|
|
129
129
|
display: flex;
|
|
130
130
|
flex-direction: column;
|
|
131
131
|
gap: 24px;
|
|
132
|
-
`,
|
|
132
|
+
`,Ss=g.div`
|
|
133
133
|
display: contents;
|
|
134
134
|
& > * {
|
|
135
135
|
opacity: ${({$faded:e})=>e?.4:1};
|
|
136
136
|
transition: opacity 0.2s ease;
|
|
137
137
|
}
|
|
138
|
-
`,
|
|
138
|
+
`,ws=({value:e})=>{const n=f();return t(We,e?{status:Pe.Success,label:it,leftIcon:Ci}:{label:lt,leftIcon:Si,backgroundColor:n.v2.colors.silver[500],textColor:n.v2.colors.white[500]})},xs=({value:e,onChange:n})=>{const o=f(),i=a(()=>[{icon:Ci,label:it,value:!0,selectedBgColor:o.v2.colors.green[800]},{icon:Si,label:lt,value:!1,selectedBgColor:o.v2.colors.silver[500]}],[o]);return t(ge,{options:i,selected:e,setSelected:n??(()=>{}),disabled:!n})},ks=()=>{const e=Gl();switch(e.formType){case Hl.Create:return t(Ts,{category:e.category,formData:e.formData,onChange:e.handleChange,sourceOptions:e.sourceOptions,namespaceOptions:e.namespaceOptions,renderAction:()=>t(xs,{value:!e.formData.disabled,onChange:t=>e.handleChange({disabled:!t})})});case Hl.View:return e.data?e.isEditing?t(Ts,{category:e.data.category,formData:e.formData,onChange:e.handleChange,sourceOptions:e.sourceOptions,namespaceOptions:e.namespaceOptions,renderAction:()=>t(xs,{value:!e.formData.disabled,onChange:t=>e.handleChange({disabled:!t})})}):t($s,{data:e.data,renderAction:()=>t(ws,{value:!e.data?.rule.disabled})}):null;case Hl.EditAutoNoisy:return t(Is,{enabled:e.localEnabled,summary:e.summary,inactiveTitle:at,sectionTitle:tt,sectionSubTitle:ot,presetLabel:et,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(xs,{value:e.localEnabled,onChange:e.setLocalEnabled})});case Hl.EditAutoCostReduction:return t(Is,{enabled:e.localEnabled,summary:e.summary,inactiveTitle:nt,sectionTitle:tt,presetLabel:et,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(xs,{value:e.localEnabled,onChange:e.setLocalEnabled})});case Hl.EditAutoHighlyRelevant:return t(Cs,{children:t(xl,{title:e.localEnabled?void 0:Qe,summary:e.summary,renderAction:()=>t(xs,{value:e.localEnabled,onChange:e.setLocalEnabled})})})}},Ts=({category:n,formData:o,onChange:a,sourceOptions:i,namespaceOptions:l,renderAction:r})=>e(Cs,{children:[t($l,{category:n,formState:o,renderAction:r}),e(Ss,{$faded:!!o.disabled,children:[t(Il,{category:n,formState:o,onChange:a}),t(wl,{scopes:o.sourceScopes,onChange:e=>a({sourceScopes:e}),sourceOptions:i,namespaceOptions:l,titleNumber:1,dataIdPrefix:"sampling"}),t(El,{category:n,formState:o,onChange:a}),"highlyRelevant"===n&&t(Al,{formState:o,onChange:a}),"highlyRelevant"===n&&t(Nl,{ruleType:o.ruleType,formState:o,onChange:a}),t(Ol,{category:n,formState:o,onChange:a})]})]}),$s=({data:n,renderAction:o})=>e(Cs,{children:[t($l,{readOnly:!0,summary:n.summary,renderAction:o}),t(Il,{readOnly:!0,data:n}),t(wl,{readOnly:!0,scopes:C(n.rule.sourceScopes)}),t(El,{readOnly:!0,data:n}),t(Ol,{readOnly:!0,data:n}),"highlyRelevant"===n.category&&t(Nl,{readOnly:!0,rule:n.rule})]}),Is=({enabled:n,summary:o,inactiveTitle:a,sectionTitle:i,sectionSubTitle:r,presetLabel:s,customInputName:c,showModeToggle:d=!0,percentageMode:u,setPercentageMode:p,percentagePreset:h,setPercentagePreset:m,customPercentage:g,setCustomPercentage:f,renderAction:b})=>{const y=l(e=>p(e),[p]),v=l(e=>m(e),[m]),C=l(e=>f(e.target.value),[f]),S=!d||"sample"===u;return e(Cs,{children:[t(xl,{title:n?void 0:a,summary:o,renderAction:b}),t(Ss,{$faded:!n,children:e(rt,{richTitle:{title:i,subTitle:r},children:[d&&t(q,{$alignItems:"flex-start",children:t(ge,{options:vs,selected:u,setSelected:y})}),S&&t(kl,{description:s,options:Tl,selected:h,onSelect:v,customName:c,customLabel:st,customPlaceholder:"5%",customValue:g,onCustomChange:C})]})})]})},Es=g.div`
|
|
139
139
|
display: flex;
|
|
140
140
|
align-items: center;
|
|
141
141
|
justify-content: space-between;
|
|
@@ -148,27 +148,27 @@ import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{useEffect
|
|
|
148
148
|
&:hover {
|
|
149
149
|
background-color: ${({$isSelected:e,$purpleColors:t,theme:n})=>n.v2.colors[t?"purple":"silver"][e?"700":"800"]};
|
|
150
150
|
}
|
|
151
|
-
`,
|
|
151
|
+
`,As=g.div`
|
|
152
152
|
display: flex;
|
|
153
153
|
align-items: center;
|
|
154
154
|
justify-content: center;
|
|
155
155
|
padding: 8px;
|
|
156
156
|
border-radius: 8px;
|
|
157
|
-
background-color: ${({theme:e})=>e.v2.colors.white[500]+
|
|
158
|
-
`,
|
|
157
|
+
background-color: ${({theme:e})=>e.v2.colors.white[500]+ct["004"]};
|
|
158
|
+
`,Ns=({dataId:n,icon:o,title:a,description:i,withCarret:l,purpleColors:r,disabled:s,children:c,isSelected:d,onClick:u,isChecked:p,isPartiallyChecked:h,onCheckboxChange:m})=>e(Es,{"data-id":n||`list-item-${a}`,$isSelected:d,$purpleColors:r,$disabled:s,onClick:()=>!d&&!s&&u(),children:[e(q,{$gap:4,children:[e(ue,{$gap:12,children:[m&&t(Q,{partiallyChecked:h||!1,value:p||!1,onChange:e=>m(e)}),o&&t(As,{children:t(o,{size:20})}),t(se,{size:de.XS,children:a})]}),i&&t(se,{size:de.XXXS,color:ce.Secondary,children:i})]}),(l||c)&&e(ue,{$gap:8,children:[c,l&&t(Ii,{size:18})]})]}),Os=({onClose:e,selectedConnectionIds:n,setSelectedConnectionIds:o,withOverlay:l})=>{const{actionsApi:s}=yl(),{platformType:c,version:d}=v(),[u,p]=r(""),h=i(null),{selectedOption:m,onSelectOption:g,genericForm:f,validateFormData:b}=Bl(),{options:y,loading:C}=s.useActionTypes(),S=a(()=>y.length?y:dt(c,d),[y,c,d]),w=a(()=>(u?S.filter(e=>e?.label?.toLowerCase().includes(u.toLowerCase())):S).filter(e=>!!e),[S,u]),x=a(()=>{if(C)return[t(ut,{$padding:"8px 12px",children:t(pt,{size:6})},"loading")];return w.map(e=>{const n=m?.type===e.type;return t(Ns,{dataId:e.type?`option-${e.type}`:void 0,title:e.label,description:e.description,withCarret:!0,isSelected:n,onClick:()=>{h.current?.clearErrors(),g(e)}},e.type)})},[C,m?.type,w,g]),k=a(()=>C?[t(ut,{$padding:"8px 12px",children:t(pt,{size:4})},"loading")]:m?[t(as,{},m.type)]:[t(ht,{$height:"100%",children:t(Ae,{icon:Ei,title:"Action not selected",subTitle:"Please select an action to add"})},"no-data")],[C,m]);return t(Rl,{ref:h,isOpen:!0,withOverlay:l,onClose:e,onSave:async()=>{const{errorMessage:e,preparedFormData:t}=b();if(e)return!1;await s.create(t)},disableSave:!m||!f?.isFormDirty,isFormDirty:f?.isFormDirty,hideDirtyNote:!0,progress:{title:qe.CREATING_ACTION,subTitle:qe.CREATING_ACTION_SUBTITLE},header:{icon:Ei,title:qe.ADD_ACTION,subTitle:qe.ADD_ACTION_DESCRIPTION},connectionIds:n&&o?{value:n,setValue:o}:void 0,search:{value:u,onChange:p},leftColumn:{width:"40%",list:x},rightColumn:{width:"60%",list:k}})},Rs=({destinationsByCategory:o,filters:i,setFilters:l})=>{const r=a(()=>Object.values(mt).map(e=>({id:e,label:e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()})).filter(e=>o[e.id]?.length),[o]),s=a(()=>{const e=Object.values(Le).map(e=>({value:e,label:e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}));return e.unshift({value:null,label:"All"}),e},[]);return e(n,{children:[t(gt,{placeholder:"Select category",options:r,values:i.categoryType?[i.categoryType]:[],setValues:e=>l({...i,categoryType:i.categoryType===e[0]?null:e[0]})}),t(ge,{options:s,selected:i.signalType,setSelected:e=>l({...i,signalType:e})})]})},Ds=g.div`
|
|
159
159
|
display: flex;
|
|
160
160
|
flex-direction: column;
|
|
161
161
|
padding: 8px;
|
|
162
162
|
border-radius: 16px;
|
|
163
163
|
border: ${({$purpleColors:e,theme:t})=>e?`1px solid ${t.v2.colors.purple[500]}`:"1px solid transparent"};
|
|
164
164
|
background-color: ${({$noBgColor:e,$purpleColors:t,theme:n})=>e?"transparent":t?n.v2.colors.purple[900]:n.v2.colors.silver[800]};
|
|
165
|
-
`,
|
|
165
|
+
`,Ps=g.div`
|
|
166
166
|
display: flex;
|
|
167
167
|
align-items: center;
|
|
168
168
|
justify-content: space-between;
|
|
169
169
|
gap: 12px;
|
|
170
170
|
padding: ${({$isOpen:e})=>e?"2px 12px 8px 12px":"2px 12px"};
|
|
171
|
-
`,
|
|
171
|
+
`,Fs=({title:n,tooltip:o,list:a,noBgColor:i,purpleColors:l})=>{const[s,c]=r(!0);return e(Ds,{"data-id":`collapse-${n}`,$noBgColor:i,$purpleColors:l,children:[e(Ps,{$isOpen:s,children:[e(ue,{$gap:10,children:[t(se,{size:de.XS,children:n}),o&&t($e,{text:o,withIcon:!0}),t(We,{label:a.length,status:l?Pe.Default:void 0})]}),t(ft,{icon:s?Ni:Oi,size:bt.M,onClick:()=>c(e=>!e)})]}),s?t(q,{children:a.length?u.toArray(a):t(ht,{$padding:"12px 0",children:t(Ae,{})})}):null]})},Ls=(e,t,n)=>t||n.signalType?e.filter(e=>e.displayName.toLowerCase().includes(t.toLowerCase())&&(!n.signalType||_e(e.supportedSignals).includes(n.signalType))):e,Ms=({option:e,formData:n,testResult:o,isSelected:a,onSelect:i})=>t(Ns,{icon:Ct(e.type).icon,title:n?.name||e.displayName,withCarret:!0,purpleColors:!!n,isSelected:a,onClick:()=>i(),children:o&&t(We,{status:o.succeeded?Pe.Success:Pe.Error,leftIcon:o.succeeded?Ri:Di})}),_s=({listType:e,destinationOptions:n,unsavedDestinations:o})=>{const{activeForm:a,onChangeActiveForm:i}=Xl();return n?.length?t(Fs,{title:vt[e].TITLE,tooltip:vt[e].DESCRIPTION,list:n.map((n,o)=>t(Ms,{option:n,isSelected:a?.listType===e&&"number"!=typeof a?.unsavedIdx&&(null!=n.id&&""!==n.id?a?.option.id===n.id:a?.option.type===n.type),onSelect:()=>i({listType:e,option:n})},`${e}-${n.id??n.type}-${o}`))}):o?.length?t(Fs,{purpleColors:!0,title:vt[e].TITLE,tooltip:vt[e].DESCRIPTION,list:o.map(({option:n,formData:o,testResult:l},r)=>t(Ms,{option:n,formData:o,testResult:l,isSelected:a?.unsavedIdx===r&&a?.listType===e,onSelect:()=>i({listType:e,option:n,unsavedIdx:r})},`${e}-${r}`))},e):void 0};var zs;!function(e){e.SELF_HOSTED="self hosted",e.MANAGED="managed"}(zs||(zs={}));const Bs=(e,t)=>{const n=[],o=[],a=[];return e&&e.destinationCategories.categories.forEach(e=>{e.name===zs.SELF_HOSTED?o.push(...e.items):e.name===zs.MANAGED&&a.push(...e.items)}),t&&t?.potentialDestinations.forEach(t=>{for(const o of e?.destinationCategories?.categories||[]){const e=St(o),a=e.items.findIndex(e=>e.type===t.type);if(-1!==a){const o=Te(t.fields,{});Object.keys(o).length&&(e.items[a].fields=e.items[a].fields.map(e=>({...e,initialValue:o[e.name]})),n.push(e.items[a]))}}}),{[mt.DETECTED]:n,[mt.SELF_HOSTED]:o,[mt.MANAGED]:a}},Xs=({onClose:e,onBack:n,onNext:i,selectedConnectionIds:s,setSelectedConnectionIds:c,initialInputs:d,withOverlay:u,disableAnimation:p})=>{const{destinationsApi:h}=yl(),[m,g]=r(""),[f,b]=r({categoryType:null,signalType:null}),{items:y}=h.useDestinations(),{data:v,loading:C}=h.useDestinationCategories(),{data:S,loading:w}=h.usePotentialDestinations(),{activeForm:x,genericForm:k,unsavedDestinations:T,setUnsavedDestinations:$}=Xl();o(()=>{d&&$(d)},[d]);const I=C||w,E=a(()=>v?.destinationCategories?.categories??[],[v]),[A,N]=r({[mt.ALL]:[],[mt.UNSAVED]:[],[mt.EXISTS]:[],[mt.DETECTED]:[],[mt.SELF_HOSTED]:[],[mt.MANAGED]:[]});o(()=>{const e=y.map(e=>{let t;for(const n of E){const o=n.items.find(t=>t.type===e.destinationType.type);if(o){t=o;break}}const n=Te(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:n[e.name]??e.initialValue})):[]}});N(t=>({...t,[mt.EXISTS]:e}))},[y,E]),o(()=>{(v||S)&&N(e=>({...e,...Bs(v,S)}))},[v,S]);const O=l(async()=>{for(const{option:e,formData:t}of T){const n=ze(t);if(e.id){const t=Object.fromEntries(e.fields.map(e=>[e.name,e.initialValue??""])),o=Object.fromEntries(n.fields.map(e=>[e.key,e.value??""]));if(!Object.keys(t).some(e=>t[e]!==o[e])){await h.update(e.id,n);continue}}await h.create(n)}},[T,h]),R=(({isFetching:e,destinationsByCategory:n,searchText:o,filters:i})=>{const{unsavedDestinations:l}=Xl();return{width:"40%",list:a(()=>{const a=[];l.length&&a.push(t(_s,{listType:mt.UNSAVED,unsavedDestinations:l},"unsaved"));for(const e of Object.values(mt)){if(i.categoryType&&i.categoryType!==e)continue;const l=Ls(n[e],o,i);l.length&&a.push(t(_s,{listType:e,destinationOptions:l},e))}return e&&a.push(t(ht,{$height:"100%",children:t(yt,{title:"Fetching destinations",withSpinner:!0})},"loading-more")),a},[l,n,o,i,e])}})({isFetching:I,destinationsByCategory:A,searchText:m,filters:f}),D=(()=>{const{activeForm:e}=Xl();return{width:"60%",list:e?[t(rs,{},e.option.type)]:[t(ht,{$height:"100%",children:t(Ae,{icon:Ai,title:"Select destination from the list",subTitle:"Add destination so your data has somewhere to go."})},"no-data")]}})();return t(Rl,{isOpen:!0,withOverlay:u,disableAnimation:p,onClose:e,onBack:n?()=>n(T):void 0,onNext:i?()=>i(T):void 0,nextIsSkip:!T.length,onSave:O,disableSave:!x&&!T.length,isFetching:I,isFormDirty:T.length>0||k?.isFormDirty,hideDirtyNote:!0,progress:{title:qe.CREATING_DESTINATION,subTitle:qe.CREATING_DESTINATION_SUBTITLE},header:{icon:Ai,title:qe.ADD_DESTINATIONS,subTitle:qe.ADD_DESTINATION_DRAWER_DESCRIPTION},connectionIds:s&&c?{value:s,setValue:c}:void 0,search:{value:m,onChange:g},filters:t(Rs,{destinationsByCategory:A,filters:f,setFilters:b}),leftColumn:R,rightColumn:D})},Vs=({onClose:e,selectedConnectionIds:n,setSelectedConnectionIds:o,withOverlay:l})=>{const{instrumentationRulesApi:s}=yl(),[c,d]=r(""),u=i(null),{selectedOption:p,onSelectOption:h,genericForm:m,validateFormData:g}=Vl(),{options:f,loading:b}=s.useRuleTypes(),y=a(()=>f.length?f:wt,[f]),v=a(()=>c?y.filter(e=>e.label.toLowerCase().includes(c.toLowerCase())):y,[y,c]),C=a(()=>b?[t(ut,{$padding:"8px 12px",children:t(pt,{size:4})},"loading")]:v.map(e=>{const n=p?.type===e.type;return t(Ns,{dataId:`option-${e.type}`,title:e.label,description:e.description,withCarret:!0,isSelected:n,onClick:()=>{u.current?.clearErrors(),h(e)}},e.type)}),[b,p?.type,v,h]),S=a(()=>b?[t(ut,{$padding:"8px 12px",children:t(pt,{size:4})},"loading")]:p?[t(gs,{},p.type)]:[t(ht,{$height:"100%",children:t(Ae,{icon:Pi,title:"Instrumentation rule not selected",subTitle:"Please select an instrumentation rule to add"})},"no-data")],[b,p]);return t(Rl,{ref:u,isOpen:!0,withOverlay:l,onClose:e,onSave:async()=>{const{errorMessage:e,preparedFormData:t}=g();if(e)return!1;await s.create(t,p?.type)},disableSave:!p||!m?.isFormDirty,isFormDirty:m?.isFormDirty,hideDirtyNote:!0,progress:{title:qe.CREATING_INSTRUMENTATION_RULE,subTitle:qe.CREATING_INSTRUMENTATION_RULE_SUBTITLE},header:{icon:Pi,title:qe.ADD_INSTRUMENTATION_RULE,subTitle:qe.ADD_INSTRUMENTATION_RULE_DESCRIPTION},connectionIds:n&&o?{value:n,setValue:o}:void 0,search:{value:c,onChange:d},leftColumn:{width:"40%",list:C},rightColumn:{width:"60%",list:S}})},Us={groupSegmentLabel:"Namespace",itemSegmentLabel:"Source",searchPlaceholder:()=>{},groupColumnHeader:"Namespaces",fetchingGroups:{title:qe.FETCHING_NAMESPACES,subTitle:qe.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:qe.SELECT_NAMESPACE,subTitle:qe.SELECT_NAMESPACE_SUBTITLE},noItemsInGroupSubTitle:"No sources found in this namespace"},js={groupSegmentLabel:"Kind",itemSegmentLabel:"Source",searchPlaceholder:e=>"Search by "+(e===xt.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"},Gs=e=>e?js:Us,Hs="No matches",Ws="No sources",Ks=e=>`No sources matched the filter '${e}'`,Ys=e=>(e?"Unselect":"Select")+" all",Js="Show only:",qs="Selected",Zs="Auto",Qs="Automatically instrument all workloads currently in the namespace, and all workloads that will be deployed to this namespace in the future",ec="Enterprise only",tc=g.div``,nc=g.div`
|
|
172
172
|
visibility: hidden;
|
|
173
173
|
|
|
174
174
|
transition: visibility 0s;
|
|
@@ -176,19 +176,19 @@ import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{useEffect
|
|
|
176
176
|
transition-duration: 0s;
|
|
177
177
|
}
|
|
178
178
|
|
|
179
|
-
${
|
|
179
|
+
${tc}:hover & {
|
|
180
180
|
visibility: visible;
|
|
181
181
|
}
|
|
182
|
-
`,
|
|
182
|
+
`,oc=({workloadName:e,workloadKind:n,isChecked:o,onToggle:a,disabled:i,disabledReason:l})=>{const r=f(),s=()=>{};return t(tc,{children:t(Ns,{dataId:`source-${e}`,title:e,disabled:i,onClick:i?s:a,isChecked:o,onCheckboxChange:i?s:a,children:i&&l?t(We,{label:l,status:Pe.Default,textSize:de.XXXS}):t(nc,{children:t(We,{label:n,status:Pe.Info,textSize:de.XXXS,backgroundColor:r.v2.colors.blue[900]})})})})},ac=g.div``,ic=g.div`
|
|
183
183
|
visibility: ${({$visible:e})=>e?"visible":"hidden"};
|
|
184
184
|
|
|
185
185
|
transition: visibility 0s;
|
|
186
186
|
${({$visible:e})=>!e&&"& * {\n transition-duration: 0s !important;\n }"}
|
|
187
187
|
|
|
188
|
-
${
|
|
188
|
+
${ac}:hover & {
|
|
189
189
|
visibility: visible;
|
|
190
190
|
}
|
|
191
|
-
`,Js=({clusterId:n,namespaceName:o,checkbox:a,isFutureApps:i,selectedCounts:l,isActive:r,onActive:s,handleSourceChange:c})=>{const{isVm:d}=y(),u=e=>{s(),c({clusterId:n,workloadId:{namespace:o},auto:e.auto,selected:e.all})};return t(Ks,{children:t(Cs,{dataId:`namespace-${o}`,withCarret:!0,title:o,isSelected:r,onClick:s,isPartiallyChecked:a.partial,isChecked:a.all,onCheckboxChange:e=>u({auto:e,all:e}),children:e(ue,{$gap:12,children:[!d&&t(Ys,{$visible:r||i,children:t(ze,{text:Us,children:t(oe,{label:Vs,labelAlign:ae.Left,size:kt.S,value:i,onChange:e=>u({auto:e,all:e||void 0})})})}),e(ue,{$gap:8,children:[t(se,{variant:Tt.Span,size:de.XXXS,color:ce.Secondary,align:"right",children:Xs}),t(je,{label:`${l.sourced}/${l.total}`,status:r?Re.Default:Re.Unknown,minWidth:"42px"})]})]})})})},qs=({withCollapse:e,clusterId:n,clusterName:o,namespaces:i,selectedArea:l,setSelectedArea:r,handleSourceChange:s})=>{const c=a(()=>i.map(({name:e,totalWorkloads:a,selectedCount:i,isAllSourced:c,isSomeSourced:d,isFutureApps:u})=>t(Js,{clusterId:n,namespaceName:e,isFutureApps:u,checkbox:{all:c||u,partial:d},selectedCounts:{sourced:i,total:a},isActive:l.clusterId===n&&l.namespaceName===e,onActive:()=>r({clusterId:n,clusterName:o,namespaceName:e}),handleSourceChange:s},`${n}#${e}`)),[n,o,i,l]);return e?t(Ts,{title:o,list:c,noBgColor:!0}):c},Zs=({onClose:n,onBack:i,onNext:l,selectedConnectionIds:s,setSelectedConnectionIds:c,withOverlay:d,disableAnimation:u})=>{const{isVm:p}=y(),{sourcesApi:h,snapshotsApi:m,namespacesApi:g}=gl(),{data:f,loading:b,refetch:v}=m.useSnapshots(),{items:C,loading:S,refetch:w}=g.useNamespaces(),x=Fs(p),{selectedStreamName:k}=qe(),{progress:T,resetProgress:$}=$t(),{isFetching:I,setIsFetching:E,setSnapshots:A,formData:N,handleSourceChange:O,handleSelectAll:R,formDiff:D,isFormDirty:P}=Kl();o(()=>{v(),w()},[]);const F=a(()=>{if(f)return f;const e=C;return e.length?{clusters:[{clusterId:Et,clusterName:It,namespaces:e.map(e=>({name:e.name,selected:e.markedForInstrumentation&&e.dataStreamNames.includes(k),workloads:e.workloads?.map(e=>({namespace:e.id.namespace,name:e.id.name,kind:e.id.kind,selected:(e.markedForInstrumentation?.markedForInstrumentation??!1)&&(e.dataStreamNames?.includes(k)??!1)}))||[]}))}]}:null},[f,C,k]);o(()=>{E(b||S),F&&A(F)},[F,b,S,E,A]);const[L,_]=r(""),[M,z]=r(wt.Namespace),[B,X]=r({showOnlySelected:!1}),[V,U]=r({clusterId:"",clusterName:"",namespaceName:""}),G=(({isFetching:n,formData:o,handleSourceChange:i,handleSelectAll:l,selectedArea:r,setSelectedArea:s,searchText:c,searchBy:d,filters:u})=>{const{isVm:p}=y(),h=Fs(p),m=a(()=>o.map(e=>{const t=[...e.namespaces].sort((e,t)=>e.name.localeCompare(t.name)).filter(e=>jl(e,c,u)).map(e=>({name:e.name,totalWorkloads:e.workloads.length,...Wl(e)}));return{clusterId:e.clusterId,clusterName:e.clusterName,visibleNamespaces:t}}),[o,c,u]),g=a(()=>{let e=!1;for(const{visibleNamespaces:t}of m)for(const{totalWorkloads:n,selectedCount:o}of t)if(e=!0,o!==n)return!1;return e},[m]),{list:f,withFilterCount:b,filteredCount:v,totalCount:C}=a(()=>{const e=m.map(({clusterId:e,clusterName:n,visibleNamespaces:o})=>o.length?t(qs,{withCollapse:m.length>1,clusterId:e,clusterName:n,namespaces:o,selectedArea:r,setSelectedArea:s,handleSourceChange:i},e):null).filter(e=>null!==e),n=m.reduce((e,{visibleNamespaces:t})=>e+t.length,0),a=o.reduce((e,{namespaces:t})=>e+t.length,0);return{list:e,withFilterCount:n!==a,filteredCount:n,totalCount:a}},[m,o,r]);return{width:"60%",header:e(ue,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(ue,{$gap:8,children:[t(se,{size:de.XS,nowrap:!0,children:h.groupColumnHeader}),t(ze,{text:b?Je.FILTERED_COUNT_TOOLTIP:void 0,children:t(je,{label:`${b?`${v} / ${C}`:C}`,status:Re.Unknown})})]}),t(se,{"data-id":"namespaces-select-all",onClick:()=>l({boolean:!g,searchText:c,searchBy:d,filters:u}),disabled:!f.length,size:de.XS,children:zs(g)})]}),list:f.length?f:n?[t(pt,{$height:"100%",children:t(bt,{title:h.fetchingGroups.title,subTitle:h.fetchingGroups.subTitle,withSpinner:!0})},"loading")]:[t(pt,{$height:"100%",children:t(Ie,c?{icon:Pi,title:Ls,subTitle:h.noGroupMatchedFilter(c)}:{icon:Pi,title:h.noGroups.title,subTitle:h.noGroups.subTitle})},"no-data")]}})({isFetching:I,formData:N,handleSourceChange:O,handleSelectAll:R,selectedArea:V,setSelectedArea:U,searchText:M===wt.Namespace?L:"",searchBy:M,filters:B}),H=(({formData:n,handleSourceChange:o,handleSelectAll:i,selectedArea:l,searchText:r,searchBy:s,filters:c})=>{const{tier:d,isVm:u}=y(),p=Fs(u),h=d===xt.Onprem,m=a(()=>l.value.namespaceName?n.find(({clusterId:e})=>e===l.value.clusterId)?.namespaces.find(({name:e})=>e===l.value.namespaceName):void 0,[n,l.value.clusterId,l.value.namespaceName]),g=a(()=>m?[...m.workloads].sort((e,t)=>e.name.localeCompare(t.name)).filter(e=>Gl(e,r,c)):[],[m,r,c]),f=a(()=>!!g.length&&g.every(({selected:e})=>e),[g]),b=a(()=>{if(!m)return[];const{clusterId:e}=l.value,{name:n}=m;return g.map(({name:a,selected:i,kind:l})=>{const r=!u&&!h&&Hl.has(l);return t(Ws,{workloadName:a,workloadKind:l,isChecked:!r&&(i||!1),onToggle:()=>o({clusterId:e,workloadId:{namespace:n,name:a,kind:l}}),disabled:r,disabledReason:Gs},`${e}#${n}#${a}#${l}`)})},[g,m,l.value.clusterId]),{withFilterCount:v,filteredCount:C,totalCount:S}=a(()=>{const e=m?.workloads.length??0;return{withFilterCount:g.length!==e,filteredCount:g.length,totalCount:e}},[g,m]);return{width:"40%",header:e(ue,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(ue,{$gap:8,children:[t(se,{size:de.XS,nowrap:!0,children:l.value.namespaceName?`${l.value.namespaceName} > ${p.itemColumnHeader}`:p.itemColumnHeader}),t(ze,{text:v?Je.FILTERED_COUNT_TOOLTIP:void 0,children:t(je,{label:`${v?`${C} / ${S}`:S}`,status:Re.Unknown})})]}),t(se,{"data-id":"workloads-select-all",onClick:()=>i({clusterId:l.value.clusterId,namespaceName:l.value.namespaceName,boolean:!f,searchText:r,searchBy:s,filters:c}),disabled:!b.length,size:de.XS,children:zs(f)})]}),list:b.length?b:[t(pt,{$height:"100%",children:t(Ie,m?r?{icon:Di,title:Ls,subTitle:Ms(r)}:{icon:Di,title:_s,subTitle:p.noItemsInGroupSubTitle}:{icon:Di,title:p.selectGroupPrompt.title,subTitle:p.selectGroupPrompt.subTitle})},"no-data")]}})({formData:N,handleSourceChange:O,handleSelectAll:R,selectedArea:{value:V},searchText:M===wt.Source?L:"",searchBy:M,filters:B});return t(Al,{isOpen:!0,withOverlay:d,disableAnimation:u,onClose:n?()=>{$(At.BulkInstrumenting),n()}:void 0,onBack:i?()=>i(D):void 0,onNext:l?()=>l(D):void 0,nextIsSkip:!P,onSave:()=>h.persistV2(D),header:{icon:Di,title:Je.ADD_SOURCE,subTitle:Je.ADD_SOURCES_DESCRIPTION},connectionIds:s&&c?{value:s,setValue:c}:void 0,search:{value:L,onChange:e=>{_(e),M===wt.Namespace&&U({clusterId:"",clusterName:"",namespaceName:""})},placeholder:x.searchPlaceholder(M),segment:{options:[{label:x.groupSegmentLabel,value:wt.Namespace},{label:x.itemSegmentLabel,value:wt.Source}],selected:M,setSelected:z}},filters:e(ue,{$gap:8,children:[t(se,{size:de.XXXS,color:ce.Secondary,nowrap:!0,children:Bs}),t(oe,{name:"filter-selected",size:kt.S,label:Xs,value:B.showOnlySelected,onChange:e=>X(t=>({...t,showOnlySelected:e}))})]}),isFormDirty:P,isFetching:I,progress:{title:Je.CREATING_SOURCES,subTitle:Je.CREATING_SOURCES_SUBTITLE,percentage:T[At.BulkInstrumenting]?.percentage||0},leftColumn:G,rightColumn:H})},Qs=(e,t)=>{const n=[{id:"type",title:Je.TYPE,label:t.label},{id:"status",title:Je.STATUS,badge:{status:e.disabled?Re.Unknown:Re.Success,label:e.disabled?Je.DISABLED:Je.ENABLED}}],o=e.signals?.map(e=>{let t=e.toLowerCase();return t=`${t.charAt(0).toUpperCase()}${t.slice(1)}`,t}).join(", ");return o&&n.push({id:"signals",title:Je.SIGNALS_FOR_PROCESSING,label:o}),e.name&&n.push({id:"name",title:Je.NAME,label:e.name}),e.notes&&n.push({id:"notes",title:Je.NOTES,label:e.notes}),n},ec=({onClose:i,actionId:s})=>{const c=f(),{actionsApi:d}=gl(),{items:u,refetch:p}=d.useActions(),{options:h}=d.useActionTypes(),{selectedOption:m,loadAction:g,validateFormData:b,genericForm:v}=_l();o(()=>{p()},[]);const[y,C]=r(!1),[S,w]=r(!1),[x,k]=r(null),T=y&&!!v?.isFormDirty,$=a(()=>u?.find(e=>Nt(e)===s),[s,u]),I=a(()=>h.find(({type:e})=>e===$?.type)??Ot.find(({type:e})=>e===$?.type)??null,[h,$?.type]);o(()=>{$&&g($,I)},[$,I]);const E=l(()=>{$&&C(!0)},[$]),A=l(()=>{$&&(g($,I),C(!1))},[$,I,g]),N=l(()=>{T?k("close"):i()},[T,i]),O=l(()=>{T?k("cancel"):A()},[T,A]),R=l(()=>{const e=x;k(null),"close"===e?(A(),i()):A()},[x,A,i]),D=l(async()=>{if($){const{errorMessage:e,preparedFormData:t}=b();e||(await d.update($.id,t),C(!1))}},[$,b,d]),P=l(()=>{$&&w(!0)},[$]),F=l(async()=>{$&&(await d.remove($.id,$.type),i())},[$,d,i]);if(!$||!I)return null;const L=(e=>{const t=[],{type:n,fields:o}=e,a=e=>({status:e?Re.Success:Re.Unknown,label:e?"True":"False",invertColors:!0});if(n===$e.K8sAttributes&&(t.push({id:"collectContainerAttributes",title:"Collect Container Attributes",badge:a(o.collectContainerAttributes)}),t.push({id:"collectReplicaSetAttributes",title:"Collect ReplicaSet Attributes",badge:a(o.collectReplicaSetAttributes)}),t.push({id:"collectWorkloadId",title:"Collect Workload ID",badge:a(o.collectWorkloadId)}),t.push({id:"collectClusterId",title:"Collect Cluster ID",badge:a(o.collectClusterId)}),o.labelsAttributes?.forEach(({labelKey:e,attributeKey:n,from:a,fromSources:i},l)=>{const r=i?.length?i.join(", "):a||ne.Pod,s=(o.labelsAttributes?.length??0)>1?`Label #${l+1} `:"Label ";t.push({id:`label-${l}-key`,title:`${s}Key`,label:e}),t.push({id:`label-${l}-attr`,title:`${s}Attribute Key`,label:n}),t.push({id:`label-${l}-from`,title:`${s}From`,label:r})}),o.annotationsAttributes?.forEach(({annotationKey:e,attributeKey:n,from:a,fromSources:i},l)=>{const r=i?.length?i.join(", "):a||ne.Pod,s=(o.annotationsAttributes?.length??0)>1?`Annotation #${l+1} `:"Annotation ";t.push({id:`annotation-${l}-key`,title:`${s}Key`,label:e}),t.push({id:`annotation-${l}-attr`,title:`${s}Attribute Key`,label:n}),t.push({id:`annotation-${l}-from`,title:`${s}From`,label:r})})),n===$e.AddClusterInfo&&(t.push({id:"overwriteExistingValues",title:"Overwrite Existing Values",badge:a(o.overwriteExistingValues)}),o.clusterAttributes?.forEach(({attributeName:e,attributeStringValue:n},o)=>{t.push({id:`cluster-attr-${o}`,title:e,label:n})})),n===$e.DeleteAttributes&&o.attributeNamesToDelete?.forEach((e,n)=>{t.push({id:`del-attr-${n}`,title:"Attribute"+((o.attributeNamesToDelete?.length??0)>1?` #${n+1}`:""),label:e})}),n===$e.RenameAttributes&&Object.entries(o.renames||{}).forEach(([e,n],o)=>{t.push({id:`rename-${o}`,title:e,label:n})}),n===$e.PiiMasking&&o.piiCategories?.forEach((e,n)=>{t.push({id:`pii-${n}`,title:"Category"+((o.piiCategories?.length??0)>1?` #${n+1}`:""),label:e})}),n===$e.ExtractAttribute){const e=o.extractAttribute?.extractions??[];e.forEach(({targetAttributeName:n,lookupKey:o,dataFormat:a,regex:i},l)=>{const r=e.length>1?`Extraction #${l+1} `:"Extraction ";t.push({id:`extract-${l}-target`,title:`${r}New Attribute Name`,label:n||"-"}),o&&t.push({id:`extract-${l}-lookupKey`,title:`${r}Lookup Key`,label:o}),a&&t.push({id:`extract-${l}-format`,title:`${r}Data Format`,label:a}),i&&t.push({id:`extract-${l}-regex`,title:`${r}Regex`,label:i})})}return n===$e.URLTemplatization&&o.urlTemplatizationRulesGroups?.forEach((e,n)=>{const a=(o.urlTemplatizationRulesGroups?.length??0)>1?`Group #${n+1} `:"Group ";e.filterK8sNamespace&&t.push({id:`group-${n}-ns`,title:`${a}Namespace`,label:e.filterK8sNamespace}),e.workloadFilters?.forEach((o,i)=>{const l=[o.kind,o.name].filter(Boolean).join("/");l&&t.push({id:`group-${n}-wf-${i}`,title:`${a}Workload${(e.workloadFilters?.length??0)>1?` #${i+1}`:""}`,label:l})});const i=e.templatizationRules?.map(e=>e.template).filter(Boolean).join(", ");i&&t.push({id:`group-${n}-templates`,title:`${a}Templates`,label:i}),e.notes&&t.push({id:`group-${n}-notes`,title:`${a}Notes`,label:e.notes})}),t})($);return e(n,{children:[t(le,{isOpen:!0,header:{icon:Ft($.type),title:I.label,onClose:N,actions:[{id:"edit-action-btn-edit",label:Rt.EDIT,icon:wi,active:y,onClick:E},{id:"edit-action-btn-delete",label:Rt.DELETE,icon:gi,color:c.v2.colors.red[500],active:S,onClick:P}]},footer:{actions:y?[{"data-id":"edit-action-btn-cancel",label:Rt.CANCEL,variant:me.Secondary,onClick:O},{"data-id":"edit-action-btn-save",label:Rt.SAVE,variant:me.Primary,onClick:D}]:[]},children:t(dt,{$padding:"4px 12px 12px",children:y&&m?t(Kr,{}):t(q,{$gap:16,children:e(Dt,{bgTint:"1000",children:[e(Dt,{bgTint:"900",children:[t(Pt,{conditions:$.conditions||[]}),t(Dt,{bgTint:"800",cellsPerRow:2,items:Qs($,I)})]}),!!L?.length&&t(Dt,{bgTint:"900",richTitle:{title:"Configuration"},withCollapse:!0,collapseIsDefaultOpen:!0,children:t(Dt,{bgTint:"800",cellsPerRow:2,items:L})})]})})})}),t(Nl,{target:"action",isOpen:S,onClose:()=>w(!1),onApprove:F}),t(Ol,{isOpen:null!==x,onClose:()=>k(null),onApprove:R})]})},tc=({onClose:n,connections:l,selectedConnectionIds:s,setSelectedConnectionIds:c})=>{const{configApi:d}=gl(),[u,p]=r(""),[h,m]=r({showOnlySelected:!1}),g=a(()=>l.filter(e=>{const t=!u||e.name.toLowerCase().includes(u.toLowerCase()),n=!h.showOnlySelected||h.showOnlySelected&&s.includes(e.id);return t&&n}),[l.length,s.length,u,h]),f=e=>{c(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},b=1===s.length?s[0]:void 0,{data:v,loading:y}=d.useEffectiveConfig(b?{id:b}:void 0,{skip:!b}),C=a(()=>{if(b&&v)return{rollout:{automaticRolloutDisabled:v.rollout?.automaticRolloutDisabled??!1}}},[b,v]),{formData:S,handleFormChange:w,areFormValuesEqual:x,resetFormData:k}=Lt(C||{rollout:{automaticRolloutDisabled:!1}}),T=i(k);T.current=k,o(()=>{C&&T.current(C)},[C]);const $=a(()=>s.length>1||void 0!==C&&!x(C,S),[s.length,C,S]);return t(Al,{isOpen:!0,onClose:n,onSave:async()=>await(d.applyConfigurations?.(S,s))??void 0,header:{icon:Fi,title:"Cluster Configuration"},connectionIds:{value:s,setValue:c},search:{placeholder:"Search by cluster name",value:u,onChange:p},filters:e(ue,{$gap:8,children:[t(se,{size:de.XXXS,color:ce.Secondary,nowrap:!0,children:"Show only:"}),t(oe,{size:kt.S,label:"Selected",value:h.showOnlySelected,onChange:e=>m(t=>({...t,showOnlySelected:e}))})]}),isFormDirty:$,isFetching:y,leftColumn:{width:"35%",header:e(ue,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(ue,{$gap:8,children:[t(se,{size:de.XS,children:"Clusters"}),t(je,{label:g.length,status:Re.Unknown})]}),e(ue,{$gap:8,children:[t(se,{size:de.XXXS,color:ce.Secondary,align:"right",children:"Selected clusters"}),t(je,{label:`${s.length}/${g.length}`,status:Re.Unknown})]})]}),list:g.map(e=>t(Cs,{title:e.name,isChecked:s.includes(e.id),onClick:()=>f(e.id),onCheckboxChange:()=>f(e.id)},e.id))},rightColumn:{width:"65%",header:t(se,{size:de.XS,children:"Configurations"}),list:[t(oe,{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=>w("rollout.automaticRolloutDisabled",e)},"automatic-rollout-disabled")]}})},nc=e=>{const t=[{id:"type",title:Je.TYPE,label:e.destinationType.displayName},{id:"status",title:Je.STATUS,badge:{status:e.disabled?Re.Unknown:Re.Success,label:e.disabled?Je.DISABLED:Je.ENABLED}}],n=Fe(e.exportedSignals).map(e=>{let t=e.toLowerCase();return t=`${t.charAt(0).toUpperCase()}${t.slice(1)}`,t}).join(", ");return n&&t.push({id:"monitors",title:Je.MONITORS,label:n}),e.name&&t.push({id:"name",title:Je.NAME,label:e.name}),t},oc=({onClose:s,destinationId:c})=>{const d=f(),{isVm:u}=y(),{destinationsApi:p}=gl(),{selectedStreamName:h}=qe(),{items:m,refetch:g}=p.useDestinations(),{data:b,loading:v}=p.useDestinationCategories(),{activeForm:C,loadDestination:S,validateFormData:w,genericForm:x}=Ml();o(()=>{g()},[]);const k=i(null),[T,$]=r(!1),[I,E]=r(!1),[A,N]=r(null),O=T&&!!x?.isFormDirty,R=a(()=>Mt(m,h),[m,h]),D=a(()=>R?.find(e=>Nt(e)===c),[c,R]),P=b?.destinationCategories?.categories??null;o(()=>{D&&P&&S(D,P)},[D,P]);const F=a(()=>D&&P?zt(P,D):[],[D,P]),L=l(()=>{D&&$(!0)},[D]),_=l(()=>{D&&P&&(S(D,P),$(!1))},[D,P,S]),M=l(()=>{O?N("close"):s()},[O,s]),z=l(()=>{O?N("cancel"):_()},[O,_]),B=l(()=>{const e=A;N(null),"close"===e?(_(),s()):_()},[A,_,s]),X=l(async()=>{if(D){const{errorMessage:e,preparedFormData:t}=w();e||(await p.update(D.id,_e(t)),$(!1))}},[D,w,p]),V=l(()=>{D&&E(!0)},[D]),U=l(async()=>{D&&(await p.remove(D.id),s())},[D,p,s]);if(!D)return null;const{icon:G,iconSrc:H}=yt(D.destinationType.type),j=((e,t)=>{const n=[],o=_t(e,t),a=o.map(e=>({name:e.key,value:e.value})),i=Fe(e.exportedSignals);let l=[];const r=()=>{l.length&&(n.push({kind:"cells",id:`cells-${n.length}`,items:l}),l=[])};return o.forEach(({key:e,name:o,value:s})=>{const c=t.find(t=>t.name===e),{secret:d,componentType:u,componentProperties:p,hideFromReadData:h,customReadDataLabels:m}=c||{};if(h?.length&&xe(h,i,a))return;const{type:g}=Te(p,{type:""}),f=d||"password"===g;if(m?.length)m.forEach(({condition:t,...n},o)=>{t==s&&l.push({id:`${e}-custom-${o}`,title:n.title,label:n.value})});else if(s)if(f)l.push({id:e,title:o,label:new Array(10).fill("•").join("")});else{if(u===ke.MultiInput){const t=Te(s,null);if(Array.isArray(t)&&t.length)return r(),void n.push({kind:"list",id:e,title:o,items:t.map((t,n)=>({id:`${e}-${n}`,label:String(t)}))})}if(u===ke.KeyValuePair){const t=Te(s,null);if(Array.isArray(t)&&t.length)return r(),void n.push({kind:"pairs",id:e,title:o,items:t.map((t,n)=>{const o=t&&"object"==typeof t?t:{};return{id:`${e}-${n}`,title:null!=o.key?String(o.key):"",label:null!=o.value?String(o.value):""}})})}l.push({id:e,title:o,label:s})}else l.push({id:e,title:o,label:"-"})}),r(),n})(D,F);return e(n,{children:[t(le,{isOpen:!0,header:{icon:G,iconSrc:H,title:D.name||D.destinationType.displayName,onClose:M,actions:[{id:"edit-destination-btn-edit",label:Rt.EDIT,icon:wi,active:T,onClick:L},{id:"edit-destination-btn-delete",label:Rt.DELETE,icon:gi,color:d.v2.colors.red[500],active:I,onClick:V}]},footer:{actions:T?[{"data-id":"edit-destination-btn-cancel",label:Rt.CANCEL,variant:me.Secondary,onClick:z},...C?.option.testConnectionSupported&&!u?[{"data-id":"edit-destination-btn-test-connection",label:Rt.TEST_CONNECTION,variant:me.Secondary,onClick:()=>k.current?.testConnection()}]:[],{"data-id":"edit-destination-btn-save",label:Rt.SAVE,variant:me.Primary,onClick:X}]:[]},children:t(dt,{$padding:"4px 12px 12px",children:v?t(pt,{$height:"50vh",children:t(bt,{withSpinner:!0})}):T&&C?t(qr,{ref:k,isEdit:!0}):t(q,{$gap:16,children:e(Dt,{bgTint:"1000",children:[e(Dt,{bgTint:"900",children:[!u&&t(Pt,{conditions:D.conditions||[]}),t(Dt,{bgTint:"800",cellsPerRow:2,items:nc(D)})]}),!!j.length&&t(Dt,{bgTint:"900",richTitle:{title:"Configuration"},withCollapse:!0,collapseIsDefaultOpen:!0,children:j.map(e=>"cells"===e.kind?t(Dt,{bgTint:"800",cellsPerRow:2,items:e.items},e.id):(e.kind,t(Dt,{bgTint:"800",richTitle:{title:e.title},cellsPerRow:2,items:e.items},e.id)))})]})})})}),t(Nl,{target:"destination",isOpen:I,onClose:()=>E(!1),onApprove:U}),t(Ol,{isOpen:null!==A,onClose:()=>N(null),onApprove:B})]})},ac=(e,t)=>{const n=[{id:"type",title:Je.TYPE,label:t.label},{id:"status",title:Je.STATUS,badge:{status:e.disabled?Re.Unknown:Re.Success,label:e.disabled?Je.DISABLED:Je.ENABLED}}];return e.ruleName&&n.push({id:"name",title:Je.NAME,label:e.ruleName}),e.profileName&&n.push({id:"profile",title:Je.MANAGED_BY_PROFILE,label:e.profileName}),e.notes&&n.push({id:"notes",title:Je.NOTES,label:e.notes}),n},ic=({onClose:i,ruleId:s})=>{const c=f(),{addNotification:d}=Xt(),{instrumentationRulesApi:u}=gl(),{items:p,refetch:h}=u.useRules(),{selectedOption:m,loadRule:g,validateFormData:b,genericForm:v}=zl();o(()=>{h()},[]);const[y,C]=r(!1),[S,w]=r(!1),[x,k]=r(null),T=y&&!!v?.isFormDirty,$=a(()=>p?.find(e=>Nt(e)===s),[s,p]),I=a(()=>St.find(({type:e})=>e===$?.type)??null,[$?.type]);o(()=>{$&&g($)},[$]);const E=l(()=>{if($){if(!$.mutable)return void d({type:Re.Warning,title:Vt.FORBIDDEN,message:Vt.CANNOT_EDIT_RULE,crdType:wt.InstrumentationRule,target:$.ruleId,hideFromHistory:!0});C(!0)}},[$,d]),A=l(()=>{$&&(g($),C(!1))},[$,g]),N=l(()=>{T?k("close"):i()},[T,i]),O=l(()=>{T?k("cancel"):A()},[T,A]),R=l(()=>{const e=x;k(null),"close"===e?(A(),i()):A()},[x,A,i]),D=l(async()=>{if($){const{errorMessage:e,preparedFormData:t}=b();e||(await u.update($.ruleId,t,$.type),C(!1))}},[$,b,u]),P=l(()=>{if($){if(!$.mutable)return void d({type:Re.Warning,title:Vt.FORBIDDEN,message:Vt.CANNOT_DELETE_RULE,crdType:wt.InstrumentationRule,target:$.ruleId,hideFromHistory:!0});w(!0)}},[$,d]),F=l(async()=>{$&&(await u.remove($.ruleId,$.type),i())},[$,u,i]);if(!$||!I)return null;const L=((e,n)=>{const o=[];return e.payloadCollection&&Object.entries(e.payloadCollection).forEach(([e,n])=>{n&&o.push(t(se,{size:de.XS,children:`• ${Bt(e).toLowerCase()}`},`payload-${e}`))}),e.codeAttributes&&Object.entries(e.codeAttributes).forEach(([e,n])=>{n&&o.push(t(se,{size:de.XS,children:`• ${Bt(e).toLowerCase()}`},`code-${e}`))}),e.headersCollection?.[Be.HeaderKeys]?.length&&e.headersCollection[Be.HeaderKeys].forEach((e,n)=>{e&&o.push(t(se,{size:de.XS,children:e},`header-${n}-${e}`))}),e.customInstrumentations&&(e.customInstrumentations[Ge.Java]?.forEach((e,a)=>{const i=new Ue(e.className,e.methodName);if(i.Verify()){0===a&&o.push(t(se,{size:de.XS,children:"Java Custom Probes:"},"java-custom-probes"));const e=i.toString();o.push(t(se,{size:de.XXS,color:n.v2.colors.grey[200],children:`• ${e}`},`java-probe-${a}-${e}`))}}),e.customInstrumentations[Ge.Golang]?.forEach((e,a)=>{const i=new Ve(e.packageName,e.functionName,e.receiverName,e.receiverMethodName);if(i.Verify()){0===a&&o.push(t(se,{size:de.XS,children:"Golang Custom Probes:"},"golang-custom-probes"));const e=i.toString();o.push(t(se,{size:de.XXS,color:n.v2.colors.grey[200],children:`• ${e}`},`golang-probe-${a}-${e}`))}})),o})($,c);return e(n,{children:[t(le,{isOpen:!0,header:{icon:Gt($.type),title:I.label,onClose:N,actions:[{id:"edit-rule-btn-edit",label:Rt.EDIT,icon:wi,active:y,onClick:E},{id:"edit-rule-btn-delete",label:Rt.DELETE,icon:gi,color:c.v2.colors.red[500],active:S,onClick:P}]},footer:{actions:y?[{"data-id":"edit-rule-btn-cancel",label:Rt.CANCEL,variant:me.Secondary,onClick:O},{"data-id":"edit-rule-btn-save",label:Rt.SAVE,variant:me.Primary,onClick:D}]:[]},children:t(dt,{$padding:"4px 12px 12px",children:y&&m?t(is,{}):t(q,{$gap:16,children:e(Dt,{bgTint:"1000",children:[e(Dt,{bgTint:"900",children:[t(Pt,{conditions:$.conditions||[]}),t(Dt,{bgTint:"800",cellsPerRow:2,items:ac($,I)})]}),t(yl,{readOnly:!0,scopes:$.sourceScopes??null}),!!L.length&&t(Dt,{bgTint:"900",richTitle:{title:"Collect"},withCollapse:!0,collapseIsDefaultOpen:!0,children:t(Dt,{bgTint:"800",children:L})}),!!I.supportedLanguages.length&&t(Dt,{bgTint:"900",richTitle:{title:"Supported languages"},withCollapse:!0,collapseIsDefaultOpen:!0,children:t(Dt,{bgTint:"800",children:t(ue,{$gap:12,$wrap:"wrap",children:I.supportedLanguages.map(e=>t(Ut,{label:We[e],leftIcon:Ke(e),flex:"0.5"},e))})})})]})})})}),t(Nl,{target:"instrumentation rule",isOpen:S,onClose:()=>w(!1),onApprove:F}),t(Ol,{isOpen:null!==x,onClose:()=>k(null),onApprove:R})]})};var lc;!function(e){e.Overview="overview",e.Pods="pods",e.PeerSources="peer-sources",e.Profiling="profiling",e.Sampling="sampling",e.Debug="debug"}(lc||(lc={}));const rc=({collapseIsDefaultOpen:e,isJumpToTarget:n,onClickRestartPod:o,namespace:i,podName:l,nodeName:r,startTime:s,agentInjectedStatus:c,odigosHealthStatus:d,k8sHealthStatus:u,children:p})=>{const{formatDurationAgo:h}=Ht(),m=jt(!!n),g=a(()=>({title:l,icon:Li,withCopy:!0}),[l]),f=a(()=>{const e=[],t=Wt(c);t&&e.push(t);const n=Wt(d,_i,"health");n&&e.push(n);const o=Wt(u,Mi,"health");return o&&e.push(o),e},[c,d,u]),b=a(()=>o?[{id:`restart-pod-${l}`,icon:zi,label:Rt.RESTART_POD,onClick:()=>o(i,l)}]:void 0,[o,i,l]),v=a(()=>[{id:"nodeName",title:Je.NODE,label:r,withCopy:!0},{id:"age",title:Je.AGE,label:s?h(s,{style:"short"}):Je.NOT_RUNNING,labelTooltip:s}],[r,s,h]);return t("div",{ref:m,children:t(Dt,{bgTint:"900",richTitle:g,badges:f,dropDataActions:b,items:v,withCollapse:!0,collapseIsDefaultOpen:e,children:p})})},sc=g.div`
|
|
191
|
+
`,lc=({clusterId:n,namespaceName:o,checkbox:a,isFutureApps:i,selectedCounts:l,isActive:r,onActive:s,handleSourceChange:c})=>{const{isVm:d}=v(),u=e=>{s(),c({clusterId:n,workloadId:{namespace:o},auto:e.auto,selected:e.all})};return t(ac,{children:t(Ns,{dataId:`namespace-${o}`,withCarret:!0,title:o,isSelected:r,onClick:s,isPartiallyChecked:a.partial,isChecked:a.all,onCheckboxChange:e=>u({auto:e,all:e}),children:e(ue,{$gap:12,children:[!d&&t(ic,{$visible:r||i,children:t($e,{text:Qs,children:t(oe,{label:Zs,labelAlign:ae.Left,size:Tt.S,value:i,onChange:e=>u({auto:e,all:e||void 0})})})}),e(ue,{$gap:8,children:[t(se,{variant:$t.Span,size:de.XXXS,color:ce.Secondary,align:"right",children:qs}),t(We,{label:`${l.sourced}/${l.total}`,status:r?Pe.Default:Pe.Unknown,minWidth:"42px"})]})]})})})},rc=({withCollapse:e,clusterId:n,clusterName:o,namespaces:i,selectedArea:l,setSelectedArea:r,handleSourceChange:s})=>{const c=a(()=>i.map(({name:e,totalWorkloads:a,selectedCount:i,isAllSourced:c,isSomeSourced:d,isFutureApps:u})=>t(lc,{clusterId:n,namespaceName:e,isFutureApps:u,checkbox:{all:c||u,partial:d},selectedCounts:{sourced:i,total:a},isActive:l.clusterId===n&&l.namespaceName===e,onActive:()=>r({clusterId:n,clusterName:o,namespaceName:e}),handleSourceChange:s},`${n}#${e}`)),[n,o,i,l]);return e?t(Fs,{title:o,list:c,noBgColor:!0}):c},sc=({onClose:n,onBack:i,onNext:l,selectedConnectionIds:s,setSelectedConnectionIds:c,withOverlay:d,disableAnimation:u})=>{const{isVm:p}=v(),{sourcesApi:h,snapshotsApi:m,namespacesApi:g}=yl(),{data:f,loading:b,refetch:y}=m.useSnapshots(),{items:C,loading:S,refetch:w}=g.useNamespaces(),x=Gs(p),{selectedStreamName:k}=Ze(),{progress:T,resetProgress:$}=It(),{isFetching:I,setIsFetching:E,setSnapshots:A,formData:N,handleSourceChange:O,handleSelectAll:R,formDiff:D,isFormDirty:P}=ql();o(()=>{y(),w()},[]);const F=a(()=>{if(f)return f;const e=C;return e.length?{clusters:[{clusterId:At,clusterName:Et,namespaces:e.map(e=>({name:e.name,selected:e.markedForInstrumentation&&e.dataStreamNames.includes(k),workloads:e.workloads?.map(e=>({namespace:e.id.namespace,name:e.id.name,kind:e.id.kind,selected:(e.markedForInstrumentation?.markedForInstrumentation??!1)&&(e.dataStreamNames?.includes(k)??!1)}))||[]}))}]}:null},[f,C,k]);o(()=>{E(b||S),F&&A(F)},[F,b,S,E,A]);const[L,M]=r(""),[_,z]=r(xt.Namespace),[B,X]=r({showOnlySelected:!1}),[V,U]=r({clusterId:"",clusterName:"",namespaceName:""}),j=(({isFetching:n,formData:o,handleSourceChange:i,handleSelectAll:l,selectedArea:r,setSelectedArea:s,searchText:c,searchBy:d,filters:u})=>{const{isVm:p}=v(),h=Gs(p),m=a(()=>o.map(e=>{const t=[...e.namespaces].sort((e,t)=>e.name.localeCompare(t.name)).filter(e=>Yl(e,c,u)).map(e=>({name:e.name,totalWorkloads:e.workloads.length,...Jl(e)}));return{clusterId:e.clusterId,clusterName:e.clusterName,visibleNamespaces:t}}),[o,c,u]),g=a(()=>{let e=!1;for(const{visibleNamespaces:t}of m)for(const{totalWorkloads:n,selectedCount:o}of t)if(e=!0,o!==n)return!1;return e},[m]),{list:f,withFilterCount:b,filteredCount:y,totalCount:C}=a(()=>{const e=m.map(({clusterId:e,clusterName:n,visibleNamespaces:o})=>o.length?t(rc,{withCollapse:m.length>1,clusterId:e,clusterName:n,namespaces:o,selectedArea:r,setSelectedArea:s,handleSourceChange:i},e):null).filter(e=>null!==e),n=m.reduce((e,{visibleNamespaces:t})=>e+t.length,0),a=o.reduce((e,{namespaces:t})=>e+t.length,0);return{list:e,withFilterCount:n!==a,filteredCount:n,totalCount:a}},[m,o,r]);return{width:"60%",header:e(ue,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(ue,{$gap:8,children:[t(se,{size:de.XS,nowrap:!0,children:h.groupColumnHeader}),t($e,{text:b?qe.FILTERED_COUNT_TOOLTIP:void 0,children:t(We,{label:`${b?`${y} / ${C}`:C}`,status:Pe.Unknown})})]}),t(se,{"data-id":"namespaces-select-all",onClick:()=>l({boolean:!g,searchText:c,searchBy:d,filters:u}),disabled:!f.length,size:de.XS,children:Ys(g)})]}),list:f.length?f:n?[t(ht,{$height:"100%",children:t(yt,{title:h.fetchingGroups.title,subTitle:h.fetchingGroups.subTitle,withSpinner:!0})},"loading")]:[t(ht,{$height:"100%",children:t(Ae,c?{icon:Li,title:Hs,subTitle:h.noGroupMatchedFilter(c)}:{icon:Li,title:h.noGroups.title,subTitle:h.noGroups.subTitle})},"no-data")]}})({isFetching:I,formData:N,handleSourceChange:O,handleSelectAll:R,selectedArea:V,setSelectedArea:U,searchText:_===xt.Namespace?L:"",searchBy:_,filters:B}),G=(({formData:n,handleSourceChange:o,handleSelectAll:i,selectedArea:l,searchText:r,searchBy:s,filters:c})=>{const{tier:d,isVm:u}=v(),p=Gs(u),h=d===kt.Onprem,m=a(()=>l.value.namespaceName?n.find(({clusterId:e})=>e===l.value.clusterId)?.namespaces.find(({name:e})=>e===l.value.namespaceName):void 0,[n,l.value.clusterId,l.value.namespaceName]),g=a(()=>m?[...m.workloads].sort((e,t)=>e.name.localeCompare(t.name)).filter(e=>Wl(e,r,c)):[],[m,r,c]),f=a(()=>!!g.length&&g.every(({selected:e})=>e),[g]),b=a(()=>{if(!m)return[];const{clusterId:e}=l.value,{name:n}=m;return g.map(({name:a,selected:i,kind:l})=>{const r=!u&&!h&&Kl.has(l);return t(oc,{workloadName:a,workloadKind:l,isChecked:!r&&(i||!1),onToggle:()=>o({clusterId:e,workloadId:{namespace:n,name:a,kind:l}}),disabled:r,disabledReason:ec},`${e}#${n}#${a}#${l}`)})},[g,m,l.value.clusterId]),{withFilterCount:y,filteredCount:C,totalCount:S}=a(()=>{const e=m?.workloads.length??0;return{withFilterCount:g.length!==e,filteredCount:g.length,totalCount:e}},[g,m]);return{width:"40%",header:e(ue,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(ue,{$gap:8,children:[t(se,{size:de.XS,nowrap:!0,children:l.value.namespaceName?`${l.value.namespaceName} > ${p.itemColumnHeader}`:p.itemColumnHeader}),t($e,{text:y?qe.FILTERED_COUNT_TOOLTIP:void 0,children:t(We,{label:`${y?`${C} / ${S}`:S}`,status:Pe.Unknown})})]}),t(se,{"data-id":"workloads-select-all",onClick:()=>i({clusterId:l.value.clusterId,namespaceName:l.value.namespaceName,boolean:!f,searchText:r,searchBy:s,filters:c}),disabled:!b.length,size:de.XS,children:Ys(f)})]}),list:b.length?b:[t(ht,{$height:"100%",children:t(Ae,m?r?{icon:Fi,title:Hs,subTitle:Ks(r)}:{icon:Fi,title:Ws,subTitle:p.noItemsInGroupSubTitle}:{icon:Fi,title:p.selectGroupPrompt.title,subTitle:p.selectGroupPrompt.subTitle})},"no-data")]}})({formData:N,handleSourceChange:O,handleSelectAll:R,selectedArea:{value:V},searchText:_===xt.Source?L:"",searchBy:_,filters:B});return t(Rl,{isOpen:!0,withOverlay:d,disableAnimation:u,onClose:n?()=>{$(Nt.BulkInstrumenting),n()}:void 0,onBack:i?()=>i(D):void 0,onNext:l?()=>l(D):void 0,nextIsSkip:!P,onSave:()=>h.persistV2(D),header:{icon:Fi,title:qe.ADD_SOURCE,subTitle:qe.ADD_SOURCES_DESCRIPTION},connectionIds:s&&c?{value:s,setValue:c}:void 0,search:{value:L,onChange:e=>{M(e),_===xt.Namespace&&U({clusterId:"",clusterName:"",namespaceName:""})},placeholder:x.searchPlaceholder(_),segment:{options:[{label:x.groupSegmentLabel,value:xt.Namespace},{label:x.itemSegmentLabel,value:xt.Source}],selected:_,setSelected:z}},filters:e(ue,{$gap:8,children:[t(se,{size:de.XXXS,color:ce.Secondary,nowrap:!0,children:Js}),t(oe,{name:"filter-selected",size:Tt.S,label:qs,value:B.showOnlySelected,onChange:e=>X(t=>({...t,showOnlySelected:e}))})]}),isFormDirty:P,isFetching:I,progress:{title:qe.CREATING_SOURCES,subTitle:qe.CREATING_SOURCES_SUBTITLE,percentage:T[Nt.BulkInstrumenting]?.percentage||0},leftColumn:j,rightColumn:G})},cc=(e,t)=>{const n=[{id:"type",title:qe.TYPE,label:t.label},{id:"status",title:qe.STATUS,badge:{status:e.disabled?Pe.Unknown:Pe.Success,label:e.disabled?qe.DISABLED:qe.ENABLED}}],o=e.signals?.map(e=>{let t=e.toLowerCase();return t=`${t.charAt(0).toUpperCase()}${t.slice(1)}`,t}).join(", ");return o&&n.push({id:"signals",title:qe.SIGNALS_FOR_PROCESSING,label:o}),e.name&&n.push({id:"name",title:qe.NAME,label:e.name}),e.notes&&n.push({id:"notes",title:qe.NOTES,label:e.notes}),n},dc=({onClose:i,actionId:s})=>{const c=f(),{isVm:d}=v(),{actionsApi:u}=yl(),{items:p,refetch:h}=u.useActions(),{options:m}=u.useActionTypes(),{selectedOption:g,loadAction:b,validateFormData:y,genericForm:C}=Bl();o(()=>{h()},[]);const[S,w]=r(!1),[x,k]=r(!1),[T,$]=r(null),I=S&&!!C?.isFormDirty,E=a(()=>p?.find(e=>Ot(e)===s),[s,p]),A=a(()=>m.find(({type:e})=>e===E?.type)??Rt.find(({type:e})=>e===E?.type)??null,[m,E?.type]);o(()=>{E&&b(E,A)},[E,A]);const N=l(()=>{E&&w(!0)},[E]),O=l(()=>{E&&(b(E,A),w(!1))},[E,A,b]),R=l(()=>{I?$("close"):i()},[I,i]),D=l(()=>{I?$("cancel"):O()},[I,O]),P=l(()=>{const e=T;$(null),"close"===e?(O(),i()):O()},[T,O,i]),F=l(async()=>{if(E){const{errorMessage:e,preparedFormData:t}=y();e||(await u.update(E.id,t),w(!1))}},[E,y,u]),L=l(()=>{E&&k(!0)},[E]),M=l(async()=>{E&&(await u.remove(E.id,E.type),i())},[E,u,i]);if(!E||!A)return null;const _=(e=>{const t=[],{type:n,fields:o}=e,a=e=>({status:e?Pe.Success:Pe.Unknown,label:e?"True":"False",invertColors:!0});if(n===Ee.K8sAttributes&&(t.push({id:"collectContainerAttributes",title:"Collect Container Attributes",badge:a(o.collectContainerAttributes)}),t.push({id:"collectReplicaSetAttributes",title:"Collect ReplicaSet Attributes",badge:a(o.collectReplicaSetAttributes)}),t.push({id:"collectWorkloadId",title:"Collect Workload ID",badge:a(o.collectWorkloadId)}),t.push({id:"collectClusterId",title:"Collect Cluster ID",badge:a(o.collectClusterId)}),o.labelsAttributes?.forEach(({labelKey:e,attributeKey:n,from:a,fromSources:i},l)=>{const r=i?.length?i.join(", "):a||ne.Pod,s=(o.labelsAttributes?.length??0)>1?`Label #${l+1} `:"Label ";t.push({id:`label-${l}-key`,title:`${s}Key`,label:e}),t.push({id:`label-${l}-attr`,title:`${s}Attribute Key`,label:n}),t.push({id:`label-${l}-from`,title:`${s}From`,label:r})}),o.annotationsAttributes?.forEach(({annotationKey:e,attributeKey:n,from:a,fromSources:i},l)=>{const r=i?.length?i.join(", "):a||ne.Pod,s=(o.annotationsAttributes?.length??0)>1?`Annotation #${l+1} `:"Annotation ";t.push({id:`annotation-${l}-key`,title:`${s}Key`,label:e}),t.push({id:`annotation-${l}-attr`,title:`${s}Attribute Key`,label:n}),t.push({id:`annotation-${l}-from`,title:`${s}From`,label:r})})),n===Ee.AddClusterInfo&&(t.push({id:"overwriteExistingValues",title:"Overwrite Existing Values",badge:a(o.overwriteExistingValues)}),o.clusterAttributes?.forEach(({attributeName:e,attributeStringValue:n},o)=>{t.push({id:`cluster-attr-${o}`,title:e,label:n})})),n===Ee.DeleteAttributes&&o.attributeNamesToDelete?.forEach((e,n)=>{t.push({id:`del-attr-${n}`,title:"Attribute"+((o.attributeNamesToDelete?.length??0)>1?` #${n+1}`:""),label:e})}),n===Ee.RenameAttributes&&Object.entries(o.renames||{}).forEach(([e,n],o)=>{t.push({id:`rename-${o}`,title:e,label:n})}),n===Ee.PiiMasking&&o.piiCategories?.forEach((e,n)=>{t.push({id:`pii-${n}`,title:"Category"+((o.piiCategories?.length??0)>1?` #${n+1}`:""),label:e})}),n===Ee.ExtractAttribute){const e=o.extractAttribute?.extractions??[];e.forEach(({targetAttributeName:n,lookupKey:o,dataFormat:a,regex:i},l)=>{const r=e.length>1?`Extraction #${l+1} `:"Extraction ";t.push({id:`extract-${l}-target`,title:`${r}New Attribute Name`,label:n||"-"}),o&&t.push({id:`extract-${l}-lookupKey`,title:`${r}Lookup Key`,label:o}),a&&t.push({id:`extract-${l}-format`,title:`${r}Data Format`,label:a}),i&&t.push({id:`extract-${l}-regex`,title:`${r}Regex`,label:i})})}return n===Ee.URLTemplatization&&o.urlTemplatizationRulesGroups?.forEach((e,n)=>{const a=(o.urlTemplatizationRulesGroups?.length??0)>1?`Group #${n+1} `:"Group ";e.filterK8sNamespace&&t.push({id:`group-${n}-ns`,title:`${a}Namespace`,label:e.filterK8sNamespace}),e.workloadFilters?.forEach((o,i)=>{const l=[o.kind,o.name].filter(Boolean).join("/");l&&t.push({id:`group-${n}-wf-${i}`,title:`${a}Workload${(e.workloadFilters?.length??0)>1?` #${i+1}`:""}`,label:l})});const i=e.templatizationRules?.map(e=>e.template).filter(Boolean).join(", ");i&&t.push({id:`group-${n}-templates`,title:`${a}Templates`,label:i}),e.notes&&t.push({id:`group-${n}-notes`,title:`${a}Notes`,label:e.notes})}),t})(E);return e(n,{children:[t(le,{isOpen:!0,header:{icon:Lt(E.type),title:A.label,onClose:R,actions:[{id:"edit-action-btn-edit",label:Dt.EDIT,icon:ki,active:S,onClick:N},{id:"edit-action-btn-delete",label:Dt.DELETE,icon:bi,color:c.v2.colors.red[500],active:x,onClick:L}]},footer:{actions:S?[{"data-id":"edit-action-btn-cancel",label:Dt.CANCEL,variant:me.Secondary,onClick:D},{"data-id":"edit-action-btn-save",label:Dt.SAVE,variant:me.Primary,onClick:F}]:[]},children:t(ut,{$padding:"4px 12px 12px",children:S&&g?t(as,{}):t(q,{$gap:16,children:e(Pt,{bgTint:"1000",children:[e(Pt,{bgTint:"900",children:[!d&&t(Ft,{conditions:E.conditions||[]}),t(Pt,{bgTint:"800",cellsPerRow:2,items:cc(E,A)})]}),!!_?.length&&t(Pt,{bgTint:"900",richTitle:{title:"Configuration"},withCollapse:!0,collapseIsDefaultOpen:!0,children:t(Pt,{bgTint:"800",cellsPerRow:2,items:_})})]})})})}),t(Dl,{target:"action",isOpen:x,onClose:()=>k(!1),onApprove:M}),t(Pl,{isOpen:null!==T,onClose:()=>$(null),onApprove:P})]})},uc=({onClose:n,connections:l,selectedConnectionIds:s,setSelectedConnectionIds:c})=>{const{configApi:d}=yl(),[u,p]=r(""),[h,m]=r({showOnlySelected:!1}),g=a(()=>l.filter(e=>{const t=!u||e.name.toLowerCase().includes(u.toLowerCase()),n=!h.showOnlySelected||h.showOnlySelected&&s.includes(e.id);return t&&n}),[l.length,s.length,u,h]),f=e=>{c(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},b=1===s.length?s[0]:void 0,{data:y,loading:v}=d.useEffectiveConfig(b?{id:b}:void 0,{skip:!b}),C=a(()=>{if(b&&y)return{rollout:{automaticRolloutDisabled:y.rollout?.automaticRolloutDisabled??!1}}},[b,y]),{formData:S,handleFormChange:w,areFormValuesEqual:x,resetFormData:k}=Mt(C||{rollout:{automaticRolloutDisabled:!1}}),T=i(k);T.current=k,o(()=>{C&&T.current(C)},[C]);const $=a(()=>s.length>1||void 0!==C&&!x(C,S),[s.length,C,S]);return t(Rl,{isOpen:!0,onClose:n,onSave:async()=>await(d.applyConfigurations?.(S,s))??void 0,header:{icon:Mi,title:"Cluster Configuration"},connectionIds:{value:s,setValue:c},search:{placeholder:"Search by cluster name",value:u,onChange:p},filters:e(ue,{$gap:8,children:[t(se,{size:de.XXXS,color:ce.Secondary,nowrap:!0,children:"Show only:"}),t(oe,{size:Tt.S,label:"Selected",value:h.showOnlySelected,onChange:e=>m(t=>({...t,showOnlySelected:e}))})]}),isFormDirty:$,isFetching:v,leftColumn:{width:"35%",header:e(ue,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(ue,{$gap:8,children:[t(se,{size:de.XS,children:"Clusters"}),t(We,{label:g.length,status:Pe.Unknown})]}),e(ue,{$gap:8,children:[t(se,{size:de.XXXS,color:ce.Secondary,align:"right",children:"Selected clusters"}),t(We,{label:`${s.length}/${g.length}`,status:Pe.Unknown})]})]}),list:g.map(e=>t(Ns,{title:e.name,isChecked:s.includes(e.id),onClick:()=>f(e.id),onCheckboxChange:()=>f(e.id)},e.id))},rightColumn:{width:"65%",header:t(se,{size:de.XS,children:"Configurations"}),list:[t(oe,{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=>w("rollout.automaticRolloutDisabled",e)},"automatic-rollout-disabled")]}})},pc=e=>{const t=[{id:"type",title:qe.TYPE,label:e.destinationType.displayName},{id:"status",title:qe.STATUS,badge:{status:e.disabled?Pe.Unknown:Pe.Success,label:e.disabled?qe.DISABLED:qe.ENABLED}}],n=Me(e.exportedSignals).map(e=>{let t=e.toLowerCase();return t=`${t.charAt(0).toUpperCase()}${t.slice(1)}`,t}).join(", ");return n&&t.push({id:"monitors",title:qe.MONITORS,label:n}),e.name&&t.push({id:"name",title:qe.NAME,label:e.name}),t},hc=({onClose:s,destinationId:c})=>{const d=f(),{isVm:u}=v(),{destinationsApi:p}=yl(),{selectedStreamName:h}=Ze(),{items:m,refetch:g}=p.useDestinations(),{data:b,loading:y}=p.useDestinationCategories(),{activeForm:C,loadDestination:S,validateFormData:w,genericForm:x}=Xl();o(()=>{g()},[]);const k=i(null),[T,$]=r(!1),[I,E]=r(!1),[A,N]=r(null),O=T&&!!x?.isFormDirty,R=a(()=>zt(m,h),[m,h]),D=a(()=>R?.find(e=>Ot(e)===c),[c,R]),P=b?.destinationCategories?.categories??null;o(()=>{D&&P&&S(D,P)},[D,P]);const F=a(()=>D&&P?Bt(P,D):[],[D,P]),L=l(()=>{D&&$(!0)},[D]),M=l(()=>{D&&P&&(S(D,P),$(!1))},[D,P,S]),_=l(()=>{O?N("close"):s()},[O,s]),z=l(()=>{O?N("cancel"):M()},[O,M]),B=l(()=>{const e=A;N(null),"close"===e?(M(),s()):M()},[A,M,s]),X=l(async()=>{if(D){const{errorMessage:e,preparedFormData:t}=w();e||(await p.update(D.id,ze(t)),$(!1))}},[D,w,p]),V=l(()=>{D&&E(!0)},[D]),U=l(async()=>{D&&(await p.remove(D.id),s())},[D,p,s]);if(!D)return null;const{icon:j,iconSrc:G}=Ct(D.destinationType.type),H=((e,t)=>{const n=[],o=_t(e,t),a=o.map(e=>({name:e.key,value:e.value})),i=Me(e.exportedSignals);let l=[];const r=()=>{l.length&&(n.push({kind:"cells",id:`cells-${n.length}`,items:l}),l=[])};return o.forEach(({key:e,name:o,value:s})=>{const c=t.find(t=>t.name===e),{secret:d,componentType:u,componentProperties:p,hideFromReadData:h,customReadDataLabels:m}=c||{};if(h?.length&&ke(h,i,a))return;const{type:g}=Te(p,{type:""}),f=d||"password"===g;if(m?.length)m.forEach(({condition:t,...n},o)=>{t==s&&l.push({id:`${e}-custom-${o}`,title:n.title,label:n.value})});else if(s)if(f)l.push({id:e,title:o,label:new Array(10).fill("•").join("")});else{if(u===xe.MultiInput){const t=Te(s,null);if(Array.isArray(t)&&t.length)return r(),void n.push({kind:"list",id:e,title:o,items:t.map((t,n)=>({id:`${e}-${n}`,label:String(t)}))})}if(u===xe.KeyValuePair){const t=Te(s,null);if(Array.isArray(t)&&t.length)return r(),void n.push({kind:"pairs",id:e,title:o,items:t.map((t,n)=>{const o=t&&"object"==typeof t?t:{};return{id:`${e}-${n}`,title:null!=o.key?String(o.key):"",label:null!=o.value?String(o.value):""}})})}l.push({id:e,title:o,label:s})}else l.push({id:e,title:o,label:"-"})}),r(),n})(D,F);return e(n,{children:[t(le,{isOpen:!0,header:{icon:j,iconSrc:G,title:D.name||D.destinationType.displayName,onClose:_,actions:[{id:"edit-destination-btn-edit",label:Dt.EDIT,icon:ki,active:T,onClick:L},{id:"edit-destination-btn-delete",label:Dt.DELETE,icon:bi,color:d.v2.colors.red[500],active:I,onClick:V}]},footer:{actions:T?[{"data-id":"edit-destination-btn-cancel",label:Dt.CANCEL,variant:me.Secondary,onClick:z},...C?.option.testConnectionSupported&&!u?[{"data-id":"edit-destination-btn-test-connection",label:Dt.TEST_CONNECTION,variant:me.Secondary,onClick:()=>k.current?.testConnection()}]:[],{"data-id":"edit-destination-btn-save",label:Dt.SAVE,variant:me.Primary,onClick:X}]:[]},children:t(ut,{$padding:"4px 12px 12px",children:y?t(ht,{$height:"50vh",children:t(yt,{withSpinner:!0})}):T&&C?t(rs,{ref:k,isEdit:!0}):t(q,{$gap:16,children:e(Pt,{bgTint:"1000",children:[e(Pt,{bgTint:"900",children:[!u&&t(Ft,{conditions:D.conditions||[]}),t(Pt,{bgTint:"800",cellsPerRow:2,items:pc(D)})]}),!!H.length&&t(Pt,{bgTint:"900",richTitle:{title:"Configuration"},withCollapse:!0,collapseIsDefaultOpen:!0,children:H.map(e=>"cells"===e.kind?t(Pt,{bgTint:"800",cellsPerRow:2,items:e.items},e.id):(e.kind,t(Pt,{bgTint:"800",richTitle:{title:e.title},cellsPerRow:2,items:e.items},e.id)))})]})})})}),t(Dl,{target:"destination",isOpen:I,onClose:()=>E(!1),onApprove:U}),t(Pl,{isOpen:null!==A,onClose:()=>N(null),onApprove:B})]})},mc=(e,t)=>{const n=[{id:"type",title:qe.TYPE,label:t.label},{id:"status",title:qe.STATUS,badge:{status:e.disabled?Pe.Unknown:Pe.Success,label:e.disabled?qe.DISABLED:qe.ENABLED}}];return e.ruleName&&n.push({id:"name",title:qe.NAME,label:e.ruleName}),e.profileName&&n.push({id:"profile",title:qe.MANAGED_BY_PROFILE,label:e.profileName}),e.notes&&n.push({id:"notes",title:qe.NOTES,label:e.notes}),n},gc=({onClose:i,ruleId:s})=>{const c=f(),{addNotification:d}=Vt(),{isVm:u}=v(),{instrumentationRulesApi:p}=yl(),{items:h,refetch:m}=p.useRules(),{selectedOption:g,loadRule:b,validateFormData:y,genericForm:C}=Vl();o(()=>{m()},[]);const[S,w]=r(!1),[x,k]=r(!1),[T,$]=r(null),I=S&&!!C?.isFormDirty,E=a(()=>h?.find(e=>Ot(e)===s),[s,h]),A=a(()=>wt.find(({type:e})=>e===E?.type)??null,[E?.type]);o(()=>{E&&b(E)},[E]);const N=l(()=>{if(E){if(!E.mutable)return void d({type:Pe.Warning,title:Ut.FORBIDDEN,message:Ut.CANNOT_EDIT_RULE,crdType:xt.InstrumentationRule,target:E.ruleId,hideFromHistory:!0});w(!0)}},[E,d]),O=l(()=>{E&&(b(E),w(!1))},[E,b]),R=l(()=>{I?$("close"):i()},[I,i]),D=l(()=>{I?$("cancel"):O()},[I,O]),P=l(()=>{const e=T;$(null),"close"===e?(O(),i()):O()},[T,O,i]),F=l(async()=>{if(E){const{errorMessage:e,preparedFormData:t}=y();e||(await p.update(E.ruleId,t,E.type),w(!1))}},[E,y,p]),L=l(()=>{if(E){if(!E.mutable)return void d({type:Pe.Warning,title:Ut.FORBIDDEN,message:Ut.CANNOT_DELETE_RULE,crdType:xt.InstrumentationRule,target:E.ruleId,hideFromHistory:!0});k(!0)}},[E,d]),M=l(async()=>{E&&(await p.remove(E.ruleId,E.type),i())},[E,p,i]);if(!E||!A)return null;const _=((e,n)=>{const o=[];return e.payloadCollection&&Object.entries(e.payloadCollection).forEach(([e,n])=>{n&&o.push(t(se,{size:de.XS,children:`• ${Xt(e).toLowerCase()}`},`payload-${e}`))}),e.codeAttributes&&Object.entries(e.codeAttributes).forEach(([e,n])=>{n&&o.push(t(se,{size:de.XS,children:`• ${Xt(e).toLowerCase()}`},`code-${e}`))}),e.headersCollection?.[Xe.HeaderKeys]?.length&&e.headersCollection[Xe.HeaderKeys].forEach((e,n)=>{e&&o.push(t(se,{size:de.XS,children:e},`header-${n}-${e}`))}),e.customInstrumentations&&(e.customInstrumentations[Ge.Java]?.forEach((e,a)=>{const i=new je(e.className,e.methodName);if(i.Verify()){0===a&&o.push(t(se,{size:de.XS,children:"Java Custom Probes:"},"java-custom-probes"));const e=i.toString();o.push(t(se,{size:de.XXS,color:n.v2.colors.grey[200],children:`• ${e}`},`java-probe-${a}-${e}`))}}),e.customInstrumentations[Ge.Golang]?.forEach((e,a)=>{const i=new Ue(e.packageName,e.functionName,e.receiverName,e.receiverMethodName);if(i.Verify()){0===a&&o.push(t(se,{size:de.XS,children:"Golang Custom Probes:"},"golang-custom-probes"));const e=i.toString();o.push(t(se,{size:de.XXS,color:n.v2.colors.grey[200],children:`• ${e}`},`golang-probe-${a}-${e}`))}})),o})(E,c);return e(n,{children:[t(le,{isOpen:!0,header:{icon:Gt(E.type),title:A.label,onClose:R,actions:[{id:"edit-rule-btn-edit",label:Dt.EDIT,icon:ki,active:S,onClick:N},{id:"edit-rule-btn-delete",label:Dt.DELETE,icon:bi,color:c.v2.colors.red[500],active:x,onClick:L}]},footer:{actions:S?[{"data-id":"edit-rule-btn-cancel",label:Dt.CANCEL,variant:me.Secondary,onClick:D},{"data-id":"edit-rule-btn-save",label:Dt.SAVE,variant:me.Primary,onClick:F}]:[]},children:t(ut,{$padding:"4px 12px 12px",children:S&&g?t(gs,{}):t(q,{$gap:16,children:e(Pt,{bgTint:"1000",children:[e(Pt,{bgTint:"900",children:[!u&&t(Ft,{conditions:E.conditions||[]}),t(Pt,{bgTint:"800",cellsPerRow:2,items:mc(E,A)})]}),!u&&t(wl,{readOnly:!0,scopes:E.sourceScopes??null}),!!_.length&&t(Pt,{bgTint:"900",richTitle:{title:"Collect"},withCollapse:!0,collapseIsDefaultOpen:!0,children:t(Pt,{bgTint:"800",children:_})}),!!A.supportedLanguages.length&&t(Pt,{bgTint:"900",richTitle:{title:"Supported languages"},withCollapse:!0,collapseIsDefaultOpen:!0,children:t(Pt,{bgTint:"800",children:t(ue,{$gap:12,$wrap:"wrap",children:A.supportedLanguages.map(e=>t(jt,{label:Ke[e],leftIcon:Ye(e),flex:"0.5"},e))})})})]})})})}),t(Dl,{target:"instrumentation rule",isOpen:x,onClose:()=>k(!1),onApprove:M}),t(Pl,{isOpen:null!==T,onClose:()=>$(null),onApprove:P})]})};var fc;!function(e){e.Overview="overview",e.Pods="pods",e.PeerSources="peer-sources",e.Profiling="profiling",e.Sampling="sampling",e.Debug="debug"}(fc||(fc={}));const bc=({collapseIsDefaultOpen:e,isJumpToTarget:n,onClickRestartPod:o,namespace:i,podName:l,nodeName:r,startTime:s,agentInjectedStatus:c,odigosHealthStatus:d,k8sHealthStatus:u,children:p})=>{const{formatDurationAgo:h}=Ht(),m=Wt(!!n),g=a(()=>({title:l,icon:_i,withCopy:!0}),[l]),f=a(()=>{const e=[],t=Kt(c);t&&e.push(t);const n=Kt(d,zi,"health");n&&e.push(n);const o=Kt(u,Bi,"health");return o&&e.push(o),e},[c,d,u]),b=a(()=>o?[{id:`restart-pod-${l}`,icon:Xi,label:Dt.RESTART_POD,onClick:()=>o(i,l)}]:void 0,[o,i,l]),y=a(()=>[{id:"nodeName",title:qe.NODE,label:r,withCopy:!0},{id:"age",title:qe.AGE,label:s?h(s,{style:"short"}):qe.NOT_RUNNING,labelTooltip:s}],[r,s,h]);return t("div",{ref:m,children:t(Pt,{bgTint:"900",richTitle:g,badges:f,dropDataActions:b,items:y,withCollapse:!0,collapseIsDefaultOpen:e,children:p})})},yc=g.div`
|
|
192
192
|
display: flex;
|
|
193
193
|
align-items: center;
|
|
194
194
|
justify-content: space-between;
|
|
@@ -196,7 +196,7 @@ import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{useEffect
|
|
|
196
196
|
padding: ${({$noPadding:e})=>e?"0":"12px"};
|
|
197
197
|
border-radius: 12px;
|
|
198
198
|
background-color: ${({theme:e})=>e.v2.colors.silver[900]};
|
|
199
|
-
`,
|
|
199
|
+
`,vc=({podsOdigosHealthStatus:n,pods:o,noPadding:i})=>{const l=qt(n?.status),r=Xt(n?.name),s=n?.message,{totalPodsCount:c,injectionsAsExpectedCount:d,odigosHealthyPodsCount:u,k8sHealthyPodsCount:p}=a(()=>({totalPodsCount:o?.length||0,injectionsAsExpectedCount:o?.reduce((e,t)=>e+(t.agentInjectedStatus?.status===Yt.Success?1:0),0)||0,odigosHealthyPodsCount:o?.reduce((e,t)=>e+(t.odigosHealthStatus?.status===Yt.Success?1:0),0)||0,k8sHealthyPodsCount:o?.reduce((e,t)=>e+(t.k8sHealthStatus?.status===Yt.Success?1:0),0)||0}),[o]);return o?.length&&n&&l?e(yc,{$noPadding:i,children:[t(Jt,{invertColors:!0,hideBackground:!0,status:l,title:r,subTitle:s}),e(ue,{$gap:8,children:[t(Sc,{label:qe.PODS,count:c}),t(Sc,{label:qe.INJECTIONS_AS_EXPECTED,count:d,total:c}),t(Sc,{label:qe.ODIGOS_HEALTHY,icon:zi,count:u,total:c}),t(Sc,{label:qe.KUBERNETES_HEALTHY,icon:Bi,count:p,total:c})]})]}):null},Cc=g.div`
|
|
200
200
|
display: flex;
|
|
201
201
|
flex-direction: column;
|
|
202
202
|
justify-content: center;
|
|
@@ -207,7 +207,7 @@ import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{useEffect
|
|
|
207
207
|
width: fit-content;
|
|
208
208
|
border-radius: 8px;
|
|
209
209
|
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
210
|
-
`,
|
|
210
|
+
`,Sc=({count:n,total:o,label:a,icon:i})=>{const l=f(),r=void 0===o?void 0:n===o?l.v2.colors.green[500]:l.v2.colors.red[500];return e(Cc,{children:[e(ue,{$gap:0,$alignItems:"flex-end",children:[t(se,{size:de.L,color:r,weight:500,nowrap:!0,children:n}),void 0!==o&&t(se,{size:de.S,color:r,weight:500,nowrap:!0,children:`/${o}`})]}),e(ue,{$alignItems:"center",$gap:4,children:[i&&t(i,{size:16}),t(se,{size:de.XXXS,nowrap:!0,children:a})]})]})},wc=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 xc;!function(e){e.IdentifyingAttributes="identifying-attributes",e.InstrumentationLibraries="instrumentation-libraries"}(xc||(xc={}));const kc=({overrideProcessNum:n,healthy:i,healthStatus:l,identifyingAttributes:s,instrumentations:c,isJumpToTarget:d})=>{const u=f(),[p,h]=r(xc.IdentifyingAttributes),m=Wt(!!d),{tabOptions:g,firstTabValue:b,bothTabsDisabled:y}=a(()=>{const e=c?.some(e=>!1===e.healthy),n=[{value:xc.IdentifyingAttributes,label:qe.IDENTIFYING_ATTRIBUTES,disabled:!s?.length,selectedBgColor:u.v2.colors.purple[500]},{value:xc.InstrumentationLibraries,label:qe.INSTRUMENTATION_LIBRARIES,icon:e?e=>t(Vi,{...e,fill:u.v2.colors.red[500]}):void 0,disabled:!c?.length,selectedBgColor:u.v2.colors.purple[500]}];return{tabOptions:n,firstTabValue:n.find(e=>!e.disabled)?.value||n[0].value,bothTabsDisabled:n.every(e=>e.disabled)}},[s,c]);o(()=>{b&&h(b)},[b]);const v=a(()=>{switch(p){case xc.IdentifyingAttributes:return t(q,{children:s?.map((e,n)=>t(Ac,{label:e.name,value:e.value},`attr-${n}-${e.name}`))});case xc.InstrumentationLibraries:return t(q,{children:c?.map((e,n)=>t(Ac,{label:e.name,isStandardLibrary:e.isStandardLibrary,healthy:e.healthy,message:e.message},`instr-${n}-${e.name}`))});default:return null}},[p,s,c]),C=a(()=>wc({overrideProcessNum:n,identifyingAttributes:s}),[n,s]);return t("div",{ref:m,children:e(Pt,{bgTint:"800",richTitle:{title:C?`${qe.PROCESS} ${qe.PID(C)}`:qe.PROCESS_FALLBACK_NAME},renderOnRightSide:t(se,{color:i?ce.Success:ce.Error,size:de.XXXS,children:l?.message}),badges:[{key:"odigos-healthy",status:i?Pe.Success:Pe.Error,leftIcon:zi,label:i?qe.HEALTHY:qe.NOT_HEALTHY,textSize:de.XXXS,invertColors:!0,useSecondaryTone:!0}],withCollapse:!y,collapseIsDefaultOpen:d,children:[!y&&t(ge,{options:g,selected:p,setSelected:h}),!y&&v]})})},Tc=g.div`
|
|
211
211
|
display: flex;
|
|
212
212
|
align-items: flex-start;
|
|
213
213
|
gap: 8px;
|
|
@@ -216,23 +216,23 @@ import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{useEffect
|
|
|
216
216
|
&:hover {
|
|
217
217
|
background-color: ${({theme:e})=>e.v2.colors.silver[700]};
|
|
218
218
|
}
|
|
219
|
-
|
|
219
|
+
`,$c=g(se)`
|
|
220
220
|
flex: 0 0 30%;
|
|
221
|
-
`,
|
|
221
|
+
`,Ic=g(se)`
|
|
222
222
|
flex: 1 1 auto;
|
|
223
223
|
min-width: 0;
|
|
224
|
-
`,
|
|
224
|
+
`,Ec=g(ue)`
|
|
225
225
|
flex: 1 1 auto;
|
|
226
226
|
justify-content: flex-end;
|
|
227
227
|
min-width: 0;
|
|
228
|
-
`,
|
|
228
|
+
`,Ac=({label:n,value:o,isStandardLibrary:a,healthy:i,message:l})=>{const r="boolean"==typeof i;return e(Tc,{children:[t($c,{size:de.XXS,color:ce.Secondary,children:n}),o&&t(Ic,{size:de.XXS,color:ce.Primary,align:"right",children:o}),(r||a)&&e(Ec,{children:[a&&t(We,{status:Pe.Info,label:qe.STANDARD,textSize:de.XXXS,invertColors:!0}),r&&t(We,{status:i?Pe.Success:Pe.Error,label:i?qe.HEALTHY:qe.NOT_HEALTHY,textSize:de.XXXS,invertColors:!0,tooltip:l??void 0})]})]})},Nc=p(null),Oc=({value:e,children:n})=>t(Nc.Provider,{value:e,children:n}),Rc=({podContainers:e,sourceContainers:n,jumpToTarget:o})=>{const i=e??[],l=a(()=>({title:qe.CONTAINERS,titleSize:de.XS,badge:{label:i.length}}),[i.length]),r=a(()=>{const e=new Map;return n?.forEach(t=>e.set(t.containerName,t)),e},[n]);return t(Pt,{bgTint:"800",richTitle:l,withCollapse:!0,collapseIsDefaultOpen:!0,children:t(q,{$gap:8,children:i.map(e=>{const n=o?.containerName===e.containerName;return t(Pc,{...e,language:Qt(r.get(e.containerName)),jumpToTarget:n?o:null},`pod-container-${e.containerName}`)})})})},Dc=g.div`
|
|
229
229
|
display: flex;
|
|
230
230
|
flex-direction: column;
|
|
231
231
|
gap: 12px;
|
|
232
232
|
padding: 8px 12px;
|
|
233
233
|
border-radius: 8px;
|
|
234
234
|
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
235
|
-
`,
|
|
235
|
+
`,Pc=({language:n,containerName:o,otelDistroName:i,runningStartedTime:l,started:r,ready:s,restartCount:c,isCrashLoop:d,waitingReasonEnum:u,waitingMessage:p,odigosHealthStatus:h,k8sHealthStatus:m,processes:g,jumpToTarget:f})=>{const b=!!f,y=b&&!f?.processPid,{formatDurationAgo:v}=Ht(),C=Wt(y),S=a(()=>({title:o,icon:n?Ye(n):Ui,iconWithWrapper:!0}),[o,n]),w=a(()=>{const e=[],t=Kt({status:i?Yt.Success:Yt.Disabled,reasonEnum:i?qe.INSTRUMENTED_WITH_DISTRO(i):qe.UNINSTRUMENTED,message:""});t&&e.push(t);const n=Kt(h,zi,"health");n&&e.push(n);const o=Kt(m,Bi,"health");return o&&e.push(o),e},[m,h,i]),x=a(()=>[{id:"runningTime",title:qe.RUNNING_TIME,label:l?v(l,{style:"short"}):qe.NOT_RUNNING,labelTooltip:`${qe.RUNNING_TIME_TOOLTIP}. (${l})`},{id:"blank",spacer:!0},{id:"started",badge:{status:r?Pe.Success:Pe.Disabled,leftIcon:r?Ci:Si,label:r?qe.STARTED:qe.NOT_STARTED,textSize:de.XXXS,invertColors:!0,useSecondaryTone:!0}},{id:"ready",badge:{status:s?Pe.Success:Pe.Disabled,leftIcon:s?Ci:Si,label:s?qe.READY:qe.NOT_READY,textSize:de.XXXS,invertColors:!0,useSecondaryTone:!0}},{id:"isCrashLoop",badge:{status:d?Pe.Error:Pe.Success,leftIcon:d?Si:Ci,label:d?qe.CRASHLOOP:qe.NO_CRASHLOOP,textSize:de.XXXS,invertColors:!0,useSecondaryTone:!0}},{id:"restartCount",title:qe.RESTARTS,badge:{status:c?Pe.Error:void 0,label:c||0,textSize:de.XXXS}}],[l,v,r,s,d,c]),k=a(()=>p?Xt(u):"",[p,u]);return t("div",{ref:C,children:e(Pt,{bgTint:"750",richTitle:S,badges:w,items:x,withCollapse:!0,collapseIsDefaultOpen:b,children:[p&&t(Dc,{children:e(ue,{$gap:10,$alignItems:"center",children:[t(jt,{variant:en.Pink,leftIcon:Bi,label:k}),t(se,{size:de.XXXS,color:ce.Error,children:p})]})}),(g??[]).map((e,n)=>{const a=n+1,i=b&&(l=f,r=e,!!l?.processPid&&wc({identifyingAttributes:r.identifyingAttributes})===l.processPid);var l,r;return t(kc,{...e,overrideProcessNum:a,isJumpToTarget:i},`pod-container-${o}-process-${a}`)})]})})},Fc=({podName:e,namespace:n,hasRestarted:o})=>{const i=a(()=>({title:qe.DEBUG_COMMANDS,titleSize:de.XS}),[]),l=a(()=>[{label:qe.GET_POD_YAML,value:`kubectl get pod ${e} -n ${n} -o yaml`},{label:qe.DESCRIBE_POD,value:`kubectl describe pod ${e} -n ${n}`},{label:qe.GET_POD_LOGS,value:`kubectl logs ${e} -n ${n}${o?" -p":""}`}],[e,n,o]);return t(Pt,{bgTint:"800",richTitle:i,withCollapse:!0,children:l.map(({label:e,value:n})=>t(tn,{bgTint:"700",label:e,value:n},e))})},Lc=({source:o,onClickRestartPod:i})=>{const{jumpToTarget:l}=(()=>{const e=h(Nc);if(!e)throw new Error("useJumpToTargetContext must be used within a JumpToTargetContextProvider");return e})(),r=l?.tab===fc.Pods?l:null,s=o?.pods??[],c=s.length>0,d=a(()=>s.some(e=>e.containers?.some(e=>e.restartCount&&e.restartCount>0)),[s]),u=a(()=>({title:qe.PODS,badge:{label:s.length}}),[s.length]);return t(q,{$gap:12,children:c?e(n,{children:[t(vc,{podsOdigosHealthStatus:o.podsOdigosHealthStatus,pods:s}),t(Pt,{bgTint:"1000",richTitle:u,children:s.map(n=>{const a=r?.podName===n.podName,l=a&&!r?.containerName;return e(bc,{...n,namespace:o.id.namespace,onClickRestartPod:i,collapseIsDefaultOpen:a,isJumpToTarget:l,children:[t(Fc,{podName:n.podName,namespace:o.id.namespace,hasRestarted:d}),t(Rc,{podContainers:n.containers,sourceContainers:o.containers,jumpToTarget:a?r:null})]},`pod-${n.podName}`)})})]}):t(ht,{$height:"70vh",children:t(Ae,{title:qe.NO_RUNNING_PODS,subTitle:qe.NO_RUNNING_PODS_SUBTITLE})})})},Mc=({source:n})=>{const o=a(()=>n.serviceName||n.id.name,[n]),{sourcesApi:i}=yl(),{data:l,loading:r,refetch:s}=i.usePeerSources({serviceName:o},{fetchPolicy:"network-only"}),c=l?.peerSources??null;return!c||r?t(ht,r?{$height:"70vh",children:t(yt,{withSpinner:!0})}:{$height:"70vh",children:t(Ae,{subTitle:qe.COULD_NOT_FETCH_PEER_SOURCES})}):e(ue,{$gap:16,$alignItems:"flex-start",children:[t(_c,{icon:ji,title:qe.INBOUND,subTitle:qe.INBOUND_DESCRIPTION(o),onRefresh:s,items:c?.inbound??[]}),t(_c,{icon:Gi,title:qe.OUTBOUND,subTitle:qe.OUTBOUND_DESCRIPTION(o),onRefresh:s,items:c?.outbound??[]})]})},_c=({icon:n,title:o,subTitle:i,onRefresh:l,items:s})=>{const[c,d]=r(""),u=a(()=>s.filter(e=>e.serviceName.toLowerCase().includes(c.toLowerCase())),[s,c]);return e(Pt,{bgTint:"1000",richTitle:{icon:n,title:o,titleSize:de.XS,subTitle:i,subTitleSize:de.XXXS,badge:{label:s.length}},actions:[{id:"refresh",type:nn.Button,buttonProps:{variant:me.Secondary,size:he.S,leftIcon:Xi,onClick:l}}],children:[t(on,{value:c,onChange:d,width:"100%"}),t(an,{height:"calc(100vh - 284px)",gap:4,elements:u.length||c?!u.length&&c?[t(ht,{$height:"50vh",children:t(Ae,{icon:n,title:qe.NO_RESULTS,subTitle:qe.NO_RESULTS_FOR_FILTER(c)})},"no-results")]:u.map(e=>t(Bc,{...e},`${o}-${e.serviceName}`)):[t(ht,{$height:"50vh",children:t(Ae,{icon:n,title:`No ${o} connections yet`,subTitle:o===qe.INBOUND?qe.NO_INBOUND_CONNECTIONS_DESCRIPTION:qe.NO_OUTBOUND_CONNECTIONS_DESCRIPTION})},"no-data")]})]})},zc=g.div`
|
|
236
236
|
display: flex;
|
|
237
237
|
align-items: center;
|
|
238
238
|
justify-content: space-between;
|
|
@@ -246,9 +246,9 @@ import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{useEffect
|
|
|
246
246
|
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
247
247
|
}
|
|
248
248
|
`}
|
|
249
|
-
`,
|
|
249
|
+
`,Bc=({serviceName:n,isVirtual:o,nodeAttributes:i})=>{const l=ln(e=>e.drawerEntityId),{items:r}=yl().sourcesApi.useSources(),s=a(()=>r.find(e=>e.id.name===n||e.serviceName===n),[r,n]),c=a(()=>s&&JSON.stringify(rn(s))!==JSON.stringify(rn(l)),[s,l]),d=a(()=>{if(o){const e=Object.fromEntries((i??[]).map(({key:e,value:t})=>[e,t]));return[sn({serviceName:n,attributes:e})]}if(n?.toLowerCase()===ir)return[Hi];const e=s?cn(s):void 0;return e?.length?e:[Ui]},[o,i,n,s]),u=c?()=>{const{setDrawerType:e,setDrawerEntityId:t}=ln.getState();e(xt.Source),t({namespace:s?.id.namespace??"",name:s?.id.name??"",kind:s?.id.kind??""})}:void 0;return e(zc,{onClick:u,$withClick:!!u,children:[e(ue,{$gap:8,children:[t(dn,{icons:d}),t(se,{size:de.XXS,children:n})]}),o&&t(We,{status:Pe.Info,label:qe.VIRTUAL,textSize:de.XXXS,invertColors:!0,tooltip:qe.VIRTUAL_TOOLTIP})]})},Xc=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}},Vc=({source:n})=>{const i=f(),{k8sManifestApi:l}=yl(),[s,c]=r(!0),[d,u]=r(void 0),[p,h]=r(!0),[m,g]=r(void 0);o(()=>{l.fetch({namespace:n.id.namespace,kind:n.id.kind,name:n.id.name}).then(({data:e})=>u(Xc(e))).finally(()=>c(!1)),l.fetch({namespace:n.id.namespace,kind:un.InstrumentationConfig,name:`${n.id.kind}-${n.id.name}`.toLowerCase()}).then(({data:e})=>g(Xc(e))).finally(()=>h(!1))},[l,n.id.namespace,n.id.kind,n.id.name]);const b=a(()=>[{label:qe.DESCRIBE_POD,value:`kubectl describe ${n.id.kind} ${n.id.name} -n ${n.id.namespace}`},{label:qe.GET_POD_YAML,value:`kubectl get ${n.id.kind} ${n.id.name} -n ${n.id.namespace} -o yaml`},{label:qe.GET_POD_YAML,value:`kubectl get ${un.InstrumentationConfig} ${n.id.kind}-${n.id.name} -n ${n.id.namespace} -o yaml`}],[n.id.kind,n.id.name,n.id.namespace]);return e(Pt,{bgTint:"1000",children:[t(Pt,{bgTint:"900",richTitle:{icon:Wi,title:qe.DEBUG_COMMANDS},withCollapse:!0,collapseIsDefaultOpen:!0,children:b.map(({label:e,value:n},o)=>t(tn,{label:e,value:n},`debug-cmd-${o}-${e}`))}),s?t(pt,{size:1}):t(Fl,{bgTint:"800",codeBgColor:i.v2.colors.silver[900],title:`${n.id.kind} YAML`,yaml:d}),p?t(pt,{size:1}):t(Fl,{bgTint:"800",codeBgColor:i.v2.colors.silver[900],title:"Instrumentation Config YAML",yaml:m})]})},Uc=({title:n,children:o})=>e(q,{$gap:8,children:[t(se,{size:de.XXXS,color:ce.Secondary,children:n}),o]}),jc=({source:n})=>{const o=a(()=>{const[e,t]=pn(n.telemetryMetrics?.[0]?.throughputBytes||0).split(" ");return{value:e,units:t}},[n]);return t(Uc,{title:qe.THROUGHPUT_LAST_10_SECONDS,children:e(ue,{$alignItems:"flex-end",$gap:4,children:[t(se,{size:de.L,children:o.value}),t(se,{size:de.XS,variant:$t.Span,children:o.units})]})})},Gc=({source:n})=>{const{CopyButton:o}=hn();return t(Uc,{title:qe.NAMESPACE,children:e(ue,{children:[t(jt,{variant:en.Blue,label:n.id.namespace}),t(o,{value:n.id.namespace,size:bt.XS})]})})},Hc=({source:e})=>t(Uc,{title:qe.KIND,children:t(ue,{children:t(jt,{variant:en.Blue,label:e.id.kind})})}),Wc=({source:n})=>{const{CopyButton:o}=hn();return t(Uc,{title:qe.NAME,children:e(ue,{children:[t(jt,{variant:en.Blue,label:n.id.name}),t(o,{value:n.id.name,size:bt.XS})]})})},Kc=({source:n})=>{const{isVm:o}=v();return t(Pt,{children:e(ue,{$gap:24,$alignItems:"flex-start",$justifyContent:"flex-start",$wrap:"wrap",children:[!o&&t(jc,{source:n}),!o&&t(Gc,{source:n}),t(Hc,{source:n}),t(Wc,{source:n})]})})},Yc=({source:e})=>e.pods?.length?t(Pt,{bgTint:"900",children:t(vc,{podsOdigosHealthStatus:e.podsOdigosHealthStatus,pods:e.pods,noPadding:!0})}):null,Jc=({source:e})=>{const n=a(()=>e.workloadOdigosHealthStatus?{status:e.workloadOdigosHealthStatus.status?mn(e.workloadOdigosHealthStatus.status):Pe.Unknown,title:Xt(e.workloadOdigosHealthStatus.reasonEnum),subTitle:e.workloadOdigosHealthStatus.message}:null,[e]);return n?t(Jt,{...n,width:"100%"}):null},qc="calc(50% - 6px)",Zc=({source:n,onClickRollout:o,onClickRollback:i})=>{const l=a(()=>{const{status:e,reasonEnum:t,message:a}=n.conditions?.rollout||{},i=qt(e);if(!i)return null;return{status:i,title:t?.toLowerCase().includes("rollout")?Xt(t):`${qe.ROLLOUT} ${Xt(t)}`,subTitle:a,action:i!==Pe.Success?{icon:Xi,tooltip:qe.ROLLOUT_RESTART,onClick:o}:void 0}},[n]),r=a(()=>{const{status:e,reasonEnum:t,message:o}=n.autoRollback?.autoRollbackStatus||{},a=qt(e);if(!a)return null;return{status:a,title:t?.toLowerCase().includes("rollback")?Xt(t):`${qe.ROLLBACK} ${Xt(t)}`,subTitle:o,action:a!==Pe.Success?{icon:Xi,tooltip:qe.ROLLBACK_RECOVER,onClick:i}:void 0}},[n]);return l||r?e(ue,{$gap:12,$alignItems:"stretch",children:[l&&t(Jt,{invertColors:!0,slim:!0,width:r?qc:"100%",...l}),r&&t(Jt,{invertColors:!0,slim:!0,width:qc,...r})]}):null},Qc=p(null),ed=g.div`
|
|
250
250
|
position: relative;
|
|
251
|
-
`,
|
|
251
|
+
`,td=({children:e})=>{const n=i(null);return t(ed,{ref:n,children:t(Qc.Provider,{value:n,children:e})})},nd=g.div`
|
|
252
252
|
position: fixed;
|
|
253
253
|
top: ${({$coords:e})=>e.top}px;
|
|
254
254
|
right: ${({$coords:e})=>e.right}px;
|
|
@@ -262,14 +262,14 @@ import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{useEffect
|
|
|
262
262
|
padding: 12px 16px;
|
|
263
263
|
border-radius: 12px;
|
|
264
264
|
background-color: ${({theme:e})=>e.v2.colors.silver[750]};
|
|
265
|
-
`,
|
|
265
|
+
`,od=g.div`
|
|
266
266
|
display: flex;
|
|
267
267
|
align-items: flex-end;
|
|
268
268
|
justify-content: space-between;
|
|
269
269
|
gap: 8px;
|
|
270
|
-
`,
|
|
270
|
+
`,ad=g.div`
|
|
271
271
|
flex: 1;
|
|
272
|
-
`,
|
|
272
|
+
`,id=({width:n,onClose:o,onSave:a,saveTooltip:i,onDelete:l,deleteTooltip:s,title:c,subTitle:d,warning:u,children:p,pushButtonsWith:g})=>{const b=f(),y=h(Qc),[v,C]=r(null);return gn(y??{current:null},o),m(()=>{const e=y?.current?.getBoundingClientRect();e&&C({top:e.bottom+4,right:window.innerWidth-e.left-24})},[y]),v?lr(e(nd,{$coords:v,$width:n,"data-ignore-outside-click":"true",children:[e(q,{$gap:4,children:[t(se,{size:de.XXS,children:c}),t(se,{size:de.XXXS,color:ce.Secondary,children:d})]}),e(od,{children:[t(ad,{children:p}),e(ue,{$gap:8,$width:"fit-content",$margin:`0 0 ${g||0} 0`,children:[t(pe,{variant:me.Secondary,onClick:l,leftIcon:bi,tooltip:s,hideTooltipIcon:!0,iconSize:16,size:he.S,textColor:b.v2.colors.red[500]}),t(pe,{variant:me.Primary,onClick:a,leftIcon:Ri,tooltip:i,hideTooltipIcon:!0,iconSize:16,size:he.S})]})]}),t("div",{children:t(De,{status:Pe.Warning,message:u})})]}),document.body):null},ld=({language:n,overridden:o,onOverride:i,defaultValues:l})=>{const{tier:s}=v(),{formData:c,handleFormChange:d,resetFormData:u}=Mt(l),p=a(()=>{if(!n)return[];const e=fn[n].community,t=s===kt.Onprem?fn[n].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))},[n,s]),[h,m]=r(!1),[g,f]=r(!1),b=()=>{h||(g&&u(),f(e=>!e))};return e(ue,{$gap:4,$alignItems:"center",children:[o?t(We,{status:Pe.Info,invertColors:!0,label:qe.OVERIDDEN}):null,e(td,{children:[t($e,{text:qe.OVERRIDE_OTEL_DISTRO_NAME,children:t(ft,{icon:ki,onClick:b})}),g&&t(id,{width:"500px",onClose:b,onSave:async()=>{m(!0),await i(c),m(!1),b()},saveTooltip:qe.OVERRIDE_OTEL_DISTRO_NAME_SAVE_TOOLTIP,onDelete:async()=>{m(!0),await i({otelDistroName:null}),m(!1),b()},deleteTooltip:qe.OVERRIDE_OTEL_DISTRO_NAME_DELETE_TOOLTIP,title:qe.OVERRIDE_OTEL_DISTRO_NAME,subTitle:qe.OVERRIDE_OTEL_DISTRO_NAME_SUBTITLE,warning:qe.OVERRIDE_OTEL_DISTRO_NAME_WARNING,children:t(gt,{label:qe.OTEL_DISTRO_NAME,options:p,values:c.otelDistroName?[c.otelDistroName]:[],setValues:e=>d("otelDistroName",e[0])})})]})]})},rd=({overridden:n,onOverride:o,defaultValues:i,originalValues:l})=>{const{addNotification:s}=Vt(),{formData:c,handleFormChange:d,resetFormData:u}=Mt(i),p=a(()=>bn.map(e=>({id:e.id,label:e.label,icon:e.icon||void 0})),[]),[h,m]=r(!1),[g,f]=r(!1),b=()=>{h||(g&&u(),f(e=>!e))};return e(ue,{children:[n?t(We,{status:Pe.Info,invertColors:!0,label:qe.OVERIDDEN}):null,e(td,{children:[t($e,{text:qe.OVERRIDE_RUNTIME_DETAILS,children:t(ft,{icon:ki,onClick:b})}),g&&t(id,{width:"500px",onClose:b,onSave:async()=>{!c.version||yn(c.version)?(m(!0),await o(c),m(!1),b()):s({type:Pe.Warning,message:Ut.INVALID_VERSION,hideFromHistory:!0})},saveTooltip:qe.OVERRIDE_RUNTIME_DETAILS_SAVE_TOOLTIP,onDelete:async()=>{m(!0),await o({language:null,version:""}),m(!1),b()},deleteTooltip:qe.OVERRIDE_RUNTIME_DETAILS_DELETE_TOOLTIP,title:qe.OVERRIDE_RUNTIME_DETAILS,subTitle:qe.OVERRIDE_RUNTIME_DETAILS_SUBTITLE,warning:qe.OVERRIDE_RUNTIME_WARNING,pushButtonsWith:"20px",children:e(ue,{$gap:8,children:[t(gt,{label:qe.LANGUAGE,options:p,values:c.language?[c.language]:[],setValues:e=>d("language",e[0]),helpMessage:`Auto-detected: ${l.language||"none"}`}),t(Se,{label:qe.RUNTIME_VERSION,placeholder:qe.VERSION_PLACEHOLDER,value:c.version,onChange:e=>d("version",e.target.value),helpMessage:`Auto-detected: ${l.version||"none"}`})]})})]})]})},sd=({source:e})=>{const{isVm:n}=v(),{containers:o,containersRichTitle:i}=a(()=>{const t=e?.conditions?.runtimeDetection;return{containers:e?.containers??[],containersRichTitle:{title:n?qe.DETECTED_PROCESSES:`${e.id.kind} ${qe.CONTAINERS}`,tooltip:t?.message||(n?qe.DETECTED_PROCESSES_DESCRIPTION:qe.DETECTED_CONTAINERS_DESCRIPTION),badge:qt(t?.status)===Pe.Loading?{status:Pe.Loading,backgroundColor:"transparent"}:{label:e?.containers?.length}}}},[e,n]);return t(Pt,{bgTint:"1000",richTitle:i,withCollapse:!0,collapseIsDefaultOpen:!0,children:t(q,{$gap:8,children:o.map(n=>n&&t(pd,{...n,sourceId:e.id},`source-container-${n.containerName}`))})})},cd=g.div`
|
|
273
273
|
display: flex;
|
|
274
274
|
flex-direction: column;
|
|
275
275
|
align-self: stretch;
|
|
@@ -277,26 +277,26 @@ import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{useEffect
|
|
|
277
277
|
padding: 8px 12px;
|
|
278
278
|
border-radius: 8px;
|
|
279
279
|
background-color: ${({theme:e})=>e.v2.colors.silver[900]};
|
|
280
|
-
`,
|
|
280
|
+
`,dd=g.div`
|
|
281
281
|
display: flex;
|
|
282
282
|
align-items: center;
|
|
283
283
|
justify-content: center;
|
|
284
284
|
padding: 8px;
|
|
285
285
|
border-radius: 10px;
|
|
286
286
|
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
287
|
-
`,
|
|
287
|
+
`,ud=g.div`
|
|
288
288
|
display: flex;
|
|
289
289
|
flex-direction: column;
|
|
290
290
|
gap: 12px;
|
|
291
291
|
padding: 8px 12px;
|
|
292
292
|
border-radius: 8px;
|
|
293
293
|
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
294
|
-
`,
|
|
294
|
+
`,pd=({sourceId:n,...o})=>{const{containerName:i,runtimeInfo:l,agentEnabled:r,overrides:s}=o,c=f(),{sourcesApi:d}=yl(),u=a(()=>!!s?.runtimeInfo?.language||!!s?.runtimeInfo?.runtimeVersion,[s]),p=a(()=>({language:Qt(o),version:vn(o)||void 0}),[o]),h=a(()=>!!s?.otelDistroName,[s]),m=a(()=>({otelDistroName:s?.otelDistroName||o.agentEnabled?.otelDistroName}),[s,o]),g=a(()=>!l&&!u,[l,u]),b=a(()=>g?Ui:Ye(p.language),[g,p]),y=a(()=>{if(g)return"";const{language:e,version:t}=p;return`${e}${t?` • ${t}`:""}`},[g,p]),v=a(()=>g?{status:Pe.Loading,label:qe.WAITING_FOR_RUNTIME_DETECTION}:{status:r?.otelDistroName?Pe.Success:Pe.Disabled,leftIcon:r?.otelDistroName?Ci:Si,label:r?.otelDistroName?`Instrumented | ${r.otelDistroName}`:"Uninstrumented",tooltip:r?.agentEnabledStatus?.message},[g,r]),C=e=>d.update(n,{containerName:i,...h?m:{},...u?p:{},...e}),S=a(()=>{const e=[];return o.agentConfig?.traces?.headSampling?.noisyOperations?.length&&e.push(qe.HEAD_SAMPLING),(o.collectorConfig?.tailSampling?.noisyOperations?.length||o.collectorConfig?.tailSampling?.highlyRelevantOperations?.length||o.collectorConfig?.tailSampling?.costReductionRules?.length)&&e.push(qe.TAIL_SAMPLING),e},[o]);return e(cd,{children:[e(ue,{$gap:16,$alignItems:"center",$justifyContent:"space-between",$wrap:"wrap",children:[e(ue,{$gap:8,$alignItems:"center",children:[t(dd,{children:t(b,{size:24,fill:l?void 0:c.v2.colors.grey[400]})}),t(se,{children:i}),t(jt,y?{variant:en.Blue,label:y}:{variant:en.Loader,label:qe.DETECTING_RUNTIME_INFO}),t(rd,{overridden:u,onOverride:C,defaultValues:p,originalValues:{language:o.runtimeInfo?.language,version:o.runtimeInfo?.runtimeVersion||""}})]}),e(ue,{$gap:8,$alignItems:"center",children:[t(We,{...v,textSize:de.XXXS}),t(ld,{language:p.language,overridden:h,onOverride:C,defaultValues:m})]})]}),!r||r.agentEnabled||g?null:t(ud,{children:e(ue,{$gap:10,$alignItems:"center",children:[t(jt,{variant:en.Pink,label:Xt(r.agentEnabledStatus?.reasonEnum)||qe.NO_AVAILABLE_AGENT}),t(se,{size:de.XXXS,color:ce.Secondary,children:r?.agentEnabledStatus?.message})]})}),S.length>0&&t(ud,{children:t(ue,{$gap:16,$wrap:"wrap",children:S.map((e,n)=>t(We,{label:e,leftIcon:Ci,status:Pe.Success,invertColors:!0,useSecondaryTone:!0},`${i}-rule-${n}`))})})]})},hd=({source:n,onClickRollout:o,onClickRollback:a})=>{const{isVm:i}=v();return e(q,{$gap:12,children:[t(Kc,{source:n}),t(Jc,{source:n}),!i&&t(Zc,{source:n,onClickRollout:o,onClickRollback:a}),!i&&t(sd,{source:n}),!i&&t(Yc,{source:n})]})},md=g(q)`
|
|
295
295
|
width: 100%;
|
|
296
296
|
max-height: 320px;
|
|
297
297
|
overflow-y: auto;
|
|
298
298
|
gap: 8px;
|
|
299
|
-
`,
|
|
299
|
+
`,gd=g(ue)`
|
|
300
300
|
width: 100%;
|
|
301
301
|
align-items: center;
|
|
302
302
|
gap: 8px;
|
|
@@ -306,14 +306,14 @@ import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{useEffect
|
|
|
306
306
|
& > * {
|
|
307
307
|
font-family: monospace !important;
|
|
308
308
|
}
|
|
309
|
-
`,ld=({pendingModify:n,onClose:o,onConfirm:a})=>{const i=f();return t(Ye,{isOpen:!!n,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:o,denyButton:{variant:me.Secondary,label:"Cancel",onClick:o},approveButton:{variant:me.Primary,label:"Confirm",onClick:a},children:n&&e(ad,{children:[n.add.map(n=>e(id,{children:[t(je,{leftIcon:fi,status:Re.Success,useSecondaryTone:!0,textColor:i.v2.colors.white[500],textSize:de.XXS}),t(se,{size:de.XS,color:ce.Primary,children:n})]},`add-${n}`)),n.remove.map(n=>e(id,{children:[t(je,{leftIcon:ji,status:Re.Error,useSecondaryTone:!0,textColor:i.v2.colors.white[500],textSize:de.XXS}),t(se,{size:de.XS,color:ce.Primary,children:n})]},`remove-${n}`))]})})};function rd(e,t){const n=e.names[t];if(null==n)return"";if("string"==typeof n)return n;if("object"==typeof n&&"name"in n){const e=n.name;if("string"==typeof e)return e}return"number"==typeof n||"boolean"==typeof n?String(n):""}function sd(e){const t=Math.abs(e);return t>=1e9?`${cd(e/1e9)}s`:t>=1e6?`${cd(e/1e6)}ms`:t>=1e3?`${cd(e/1e3)}μs`:String(Math.round(e))}function cd(e){return e.toFixed(2).replace(/\.?0+$/,"")}function dd(e){const t=[];for(let n=0;n<e.levels.length;n++){const o=e.levels[n];let a=0;for(let e=0;e+3<o.length;e+=4){const i=o[e],l=o[e+1],r=o[e+2],s=o[e+3],c=a+i;t.push({level:n,offset:c,size:l,self:r,nameIndex:s}),a=c+l}}return t}function ud(e){return`${e.level}:${e.offset}:${e.size}:${e.nameIndex}`}function pd(e,t){const n=e.reduce((e,t)=>Math.max(e,t.level),t.level),o=new Map;for(const t of e){const e=o.get(t.level);e?e.push(t):o.set(t.level,[t])}const a=[t];for(let e=t.level+1;e<=n;e++){const t=a.filter(t=>t.level===e-1);if(0===t.length)break;const n=o.get(e);if(n?.length)for(const e of n)for(const n of t)if(e.offset>=n.offset&&e.offset+e.size<=n.offset+n.size){a.push(e);break}}return a}function hd(e,t){const n=t.trim().toLowerCase();return!n||e.toLowerCase().includes(n)}function md(e,t,n,o,a,i={}){if(0===e.levels.length||t<2||n<2)return null;const{zoomRoot:l=null,shouldKeepName:r,collapseRecursive:s=!1,allRects:c}=i,d=c??dd(e);let u=l?pd(d,l):d;if(0===u.length)return null;if(r&&(u=u.filter(t=>r(rd(e,t.nameIndex))),0===u.length))return null;if(s&&(u=function(e,t){if(0===t.length)return t;const n=[...t].sort((e,t)=>e.level-t.level||e.offset-t.offset),o=new Map;for(const e of n){const t=o.get(e.level);t?t.push(e):o.set(e.level,[e])}const a=new Set;for(const t of n){const n=o.get(t.level+1);if(!n)continue;const i=n.filter(e=>e.offset>=t.offset&&e.offset+e.size<=t.offset+t.size);if(1!==i.length)continue;const l=i[0];l.size===t.size&&rd(e,l.nameIndex)===rd(e,t.nameIndex)&&a.add(ud(l))}if(0===a.size)return n;const i=[];for(const e of n){if(a.has(ud(e)))continue;let t=0;for(let n=0;n<e.level;n++){const i=o.get(n);if(!i)continue;const l=i.find(t=>e.offset>=t.offset&&e.offset+e.size<=t.offset+t.size);l&&a.has(ud(l))&&t++}i.push({...e,level:e.level-t})}return i}(e,u),0===u.length))return null;const p=l?.level??0,h=l?.offset??0,m=l?.size??e.numTicks;if(m<=0)return null;const g=u.reduce((e,t)=>Math.max(e,t.level-p),0)+1,f=o??Number.POSITIVE_INFINITY,b=Math.max(1,Math.min(n/g,f)),v=a.trim(),y=b>8?1:0;return u.map(n=>{const o=n.level-p,a=(n.offset-h)/m*t,i=Math.max(n.size/m*t,1),l=o*b,r=Math.max(b-y,1),s=rd(e,n.nameIndex);return{...n,x:a,y:l,w:i,h:r,name:s,matchesSearch:hd(s,v)}})}function gd(e,t){let n=0;for(let t=0;t<e.length;t++)n=31*n+e.charCodeAt(t)>>>0;const o=t.v2.colors.black[500],a=[{fill:t.v2.colors.purple[300],text:o},{fill:t.v2.colors.green[300],text:o},{fill:t.v2.colors.red[300],text:o},{fill:t.v2.colors.blue[300],text:o},{fill:t.v2.colors.yellow[300],text:o}];return a[n%a.length]}var fd,bd;!function(e){e[e.Fit=1]="Fit",e[e.X10=10]="X10"}(fd||(fd={})),function(e){e[e.Fit=1]="Fit",e[e.X10=10]="X10"}(bd||(bd={}));function vd(e,t){return t<=0?"0":(100*e/t).toFixed(e/t<.001?2:1)}function yd(e,t,n){for(const o of n)if(e>=o.x&&e<o.x+o.w&&t>=o.y&&t<o.y+o.h)return o;return null}function Cd(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`}const Sd=({flamebearer:n,maxRowPx:s,searchQuery:c="",shouldKeepName:d,minHostHeight:u=200,onFullscreenChange:p,profilingSlots:h,onFrameClick:g,onZoomedSymbolsChange:b,onResetZoom:v})=>{const y=f(),C=i(null),S=i(null),w=i({x:0,y:0}),x=i(n.numTicks),[k,T]=r({w:0,h:0}),[$,I]=r(""),[E,A]=r(null),[N,O]=r([]),[R,D]=r(!1),[P,F]=r(fd.Fit),[L,_]=r(bd.Fit),[M,z]=r(!1),B=Math.max(1,Math.min(Math.floor(k.w*P),8192)),X=Math.max(1,Math.min(Math.floor(k.h*L),8192)),V=N.length>0?N[N.length-1]:null,U=V?.size??n.numTicks,G=a(()=>dd(n),[n]);o(()=>{x.current!==n.numTicks&&(x.current=n.numTicks,O([]))},[n.numTicks]),o(()=>{if(!b)return;if(!V)return void b(null);const e=pd(G,V),t=new Set;for(const o of e){const e=rd(n,o.nameIndex);e&&t.add(e)}b([...t])},[V,n,G,b]),m(()=>{const e=C.current;if(!e)return;const t=new ResizeObserver(()=>{const t=e.getBoundingClientRect();T({w:Math.floor(t.width),h:Math.floor(t.height)})});return t.observe(e),()=>t.disconnect()},[]),o(()=>{if(!R)return;const e=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=e}},[R]),o(()=>(p?.(R),()=>{R&&p?.(!1)}),[R,p]);const H=a(()=>md(n,B,X,s,c,{zoomRoot:V,shouldKeepName:d,collapseRecursive:M,allRects:G}),[n,s,c,X,B,V,d,M,G]),j=a(()=>function(e){return[...e].sort((e,t)=>t.level-e.level)}(H?.length?c.trim()?H.filter(e=>e.matchesSearch):H:[]),[H,c]),W=l(e=>{if(B<2||X<2)return;const t=e.currentTarget.getBoundingClientRect();if(t.width<1||t.height<1)return;const o=yd((e.clientX-t.left)/t.width*B,(e.clientY-t.top)/t.height*X,j);if(o){const e=ud(o);A(e);const t=U>0?(100*o.size/U).toFixed(1):"0",a=n.numTicks>0?(100*o.size/n.numTicks).toFixed(1):"0";I(`${o.name}\ntotal ${sd(o.size)} (${t}% of view, ${a}% of profile) · self ${sd(o.self)}`)}else A(null),I("")},[j,n.numTicks,X,B,U]),K=l(e=>{W(e)},[W]),Y=l(()=>{A(null),I("")},[]),J=l(e=>{w.current={x:e.clientX,y:e.clientY}},[]),q=l(e=>{const{x:t,y:n}=w.current;if(Math.abs(e.clientX-t)>3||Math.abs(e.clientY-n)>3)return;if(B<2||X<2)return;const o=e.currentTarget.getBoundingClientRect();if(o.width<1||o.height<1)return;const a=yd((e.clientX-o.left)/o.width*B,(e.clientY-o.top)/o.height*X,j);if(!a)return;g?.(a.name);const i=function(e){return{level:e.level,offset:e.offset,size:e.size,self:e.self,nameIndex:e.nameIndex}}(a);O(e=>{const t=e.length>0?e[e.length-1]:null;return t&&function(e,t){return e.level===t.level&&e.offset===t.offset&&e.size===t.size&&e.nameIndex===t.nameIndex}(i,t)?e.slice(0,-1):[...e,i]})},[j,X,B,g]);m(()=>{const e=S.current;if(!e||B<2||X<2)return;const t="undefined"!=typeof window&&window.devicePixelRatio||1,o=Math.max(B,X),a=Math.min(t,16384/o);e.width=Math.floor(B*a),e.height=Math.floor(X*a),e.style.width=`${B}px`,e.style.height=`${X}px`;const i=e.getContext("2d");i&&(i.setTransform(a,0,0,a,0,0),i.clearRect(0,0,B,X),H?.length?function(e,t,n,o,a,i,l,r){const s=i.v2.colors.silver[900];e.fillStyle=s,e.fillRect(0,0,t,n);const c=a.trim().length>0;e.textRendering="optimizeLegibility";for(const t of o){const{x:n,y:o,w:a,h:l,name:s,size:d,matchesSearch:u}=t;if(c&&!u)continue;const{fill:p,text:h}=gd(s,i);e.fillStyle=p,e.fillRect(n,o,a,l),e.strokeStyle="rgba(255,255,255,0.14)",e.lineWidth=1,e.beginPath(),e.moveTo(n+.5,o+.5),e.lineTo(n+a-.5,o+.5),e.stroke(),e.strokeStyle="rgba(0,0,0,0.45)",e.lineWidth=1,e.strokeRect(n+.5,o+.5,Math.max(a-1,0),Math.max(l-1,0));const m=vd(d,r),g=`${s} (${sd(d)}, ${m}%)`,f=i.v2.text.size.xs,b=8,v=5,y=26,C=Math.min(f,Math.floor(l-2));if(a>=y&&C>=b){e.font=`${C}px ${i.font_family.primary}, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif`,e.textBaseline="middle",e.textAlign="left";let t=g;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,n+v,o+l/2),e.fillStyle=h,e.fillText(t,n+v,o+l/2))}}if(l)for(const t of o){if(ud(t)!==l)continue;if(c&&!t.matchesSearch)continue;const{x:n,y:o,w:a,h:i}=t;e.strokeStyle="rgba(255,255,255,0.88)",e.lineWidth=2,e.strokeRect(n+1,o+1,Math.max(a-2,0),Math.max(i-2,0));break}}(i,B,X,H,c,y,E,n.numTicks):(i.fillStyle=y.v2.colors.silver[900],i.fillRect(0,0,B,X)))},[H,n.numTicks,E,c,X,B,y]);const Z=l(()=>D(e=>!e),[]),Q=n.numTicks>0?Math.max(0,Math.min(100,Math.round(U/n.numTicks*100))):100,ee=a(()=>function(e,t,n){const o=n??dd(e),a=t?.offset??0,i=a+(t?.size??e.numTicks),l=(t?.level??-1)+1,r=t?.size??e.numTicks;let s=null;for(const e of o)e.level<l||e.offset<a||e.offset+e.size>i||e.size>=r||(!s||e.size>s.size||e.size===s.size&&e.level<s.level)&&(s=e);return s}(n,V,G),[n,V,G]),te=null!==ee,ne=N.length>0,ie=V?rd(n,V.nameIndex):"",le=l(()=>{O([]),v?.()},[v]),re=l(()=>O(e=>e.slice(0,-1)),[]),fe=l(()=>{ee&&O(e=>[...e,ee])},[ee]);return e("div",{style:R?{position:"fixed",inset:0,zIndex:9999,display:"flex",flexDirection:"column",gap:8,padding:16,background:y.v2.colors.silver[900]}:{flex:1,minHeight:u,minWidth:0,width:"100%",display:"flex",flexDirection:"column",gap:8,position:"relative"},children:[e(ue,{$gap:8,$wrap:"nowrap",$justifyContent:"space-between",children:[t(oe,{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:ae.Left,size:kt.S,value:M,onChange:z}),e(ue,{$gap:8,children:[e(ue,{children:[t(pe,{variant:me.Secondary,size:he.S,label:"Reset zoom",leftIcon:Wi,onClick:le,disabled:!N.length}),t(pe,{variant:me.Secondary,size:he.S,iconSize:20,leftIcon:ji,tooltip:"Zoom out",hideTooltipIcon:!0,disabled:!ne,onClick:re}),t("div",{style:{minWidth:36,textAlign:"center",fontVariantNumeric:"tabular-nums"},children:t(se,{size:de.XXS,color:ce.Secondary,nowrap:!0,align:"center",children:`${Q}%`})}),t(pe,{variant:me.Secondary,size:he.S,iconSize:20,leftIcon:fi,tooltip:"Zoom in",hideTooltipIcon:!0,disabled:!te,onClick:fe})]}),e(ue,{children:[t(ze,{text:"Horizontal width: stretch the canvas wider than the viewport so narrow stacks become hoverable / readable.",children:t(ge,{variant:yn.Filled,options:[{value:fd.Fit,label:"W: Fit"},{value:fd.X10,label:"10x"}],selected:P,setSelected:F})}),t(ze,{text:"Vertical height: scale rows taller than the viewport for deep call stacks. Scroll vertically to navigate.",children:t(ge,{variant:yn.Filled,options:[{value:bd.Fit,label:"H: Fit"},{value:bd.X10,label:"10x"}],selected:L,setSelected:_})})]}),t(pe,{variant:me.Secondary,size:he.S,iconSize:24,leftIcon:R?Oi:Ki,tooltip:R?"Exit fullscreen (Esc)":"Fullscreen",hideTooltipIcon:!0,onClick:Z})]})]}),t(ze,{fullWidth:!0,keepAlive:!0,text:$,children:t("div",{ref:C,style:{flex:1,minWidth:0,width:"100%",height:R?"calc(100vh - 80px)":"calc(100vh - 364px)",position:"relative",overflow:"hidden"},children:t("div",{style:{position:"absolute",inset:0,overflowX:P>1?"auto":"hidden",overflowY:L>1?"auto":"hidden"},children:t("div",{style:{width:B||"100%",height:X||"100%",position:"relative"},children:t("canvas",{ref:S,style:{display:"block",position:"absolute",left:0,top:0,width:"100%",height:"100%",borderRadius:8,cursor:E?"pointer":"default"},onPointerDown:J,onPointerMove:K,onPointerLeave:Y,onClick:q})})})})}),e(ue,{$justifyContent:"space-between",children:[t(se,V?{size:de.XXXS,color:y.v2.colors.silver[300],children:`Zoomed: ${ie} • ${sd(U)} samples in view`}:{size:de.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(se,{size:de.XXXS,color:y.v2.colors.silver[300],children:`${h.activeKeys.length} / ${h.maxSlots} profiling slots · ${Cd(h.totalBytesUsed)} / ${Cd(h.maxTotalBytesBudget)} budget · TTL ${h.slotTtlSeconds}s`})]})]})},wd=[Cn.Go,Cn.Java],xd="Profiling Symbols";function kd(e,t){if(0===t.length)return null;const n=1===t.length?t[0]:function(e){return e.includes("/")||/\.\(\*?[^)]+\)\./.test(e)?Cn.Go:e.includes(" ")||e.includes("(")?Cn.Java:Cn.Go}(e);if(n===Cn.Go){const t=function(e){let t=e.trim();if(!t)return null;t=t.replace(/\[[^\]]*\]/g,"");const n=t.lastIndexOf("/"),o=t.indexOf(".",n+1);if(-1===o)return null;const a=t.slice(0,o),i=t.slice(o+1);if(!a||!i)return null;const l=i.match(/^\(\*?([^)]+)\)\.(.+)$/);if(l){const e=new Ve(a,"",l[1],l[2]);return e.Verify()?e:null}const r=new Ve(a,i);return r.Verify()?r:null}(e);return t?{language:n,golang:t}:null}if(n===Cn.Java){const t=function(e){let t=e.trim();if(!t)return null;const n=t.indexOf("(");-1!==n&&(t=t.slice(0,n).trim());const o=t.split(/\s+/);t=o[o.length-1]??"";const a=t.lastIndexOf(".");if(-1===a)return null;const i=t.slice(0,a),l=t.slice(a+1),r=new Ue(i,l);return r.Verify()?r:null}(e);return t?{language:n,java:t}:null}return null}function Td(e,t){return e.namespace===t.namespace&&e.name===t.name&&e.kind===t.kind}function $d(e,t,n){if(!e)return!0;const{sources:o=[],namespaces:a=[],languages:i=[]}=e,l=!o.length||o.some(e=>Td(e,t.id)),r=!a.length||a.includes(t.id.namespace),s=!i.length||null==n||i.includes(n);return l&&r&&s}function Id(e,t){return e.packageName===t.packageName&&(e.functionName||"")===(t.functionName||"")&&(e.receiverName||"")===(t.receiverName||"")&&(e.receiverMethodName||"")===(t.receiverMethodName||"")}function Ed(e,t){return e.className===t.className&&e.methodName===t.methodName}function Ad(e,t,n,o){const a=kd(e,n);if(!a)return[];const i=[];for(const e of o){const n=e.customInstrumentations;if(!n)continue;if(!$d(e.sourceScopes,t,a.language))continue;const o=!!a.golang&&!!n[Ge.Golang]?.some(e=>Id(e,a.golang)),l=!!a.java&&!!n[Ge.Java]?.some(e=>Ed(e,a.java));(o||l)&&i.push({rule:e,resolved:a})}return i}function Nd({source:e,languages:t,rows:n}){const{instrumentationRulesApi:o,capabilities:i}=gl(),{items:s}=o.useRules(),[c,d]=r(new Set),[u,p]=r(new Set),[h,m]=r(null),g=a(()=>function(e){const t=new Set(e??[]);return wd.filter(e=>t.has(e))}(t),[t]),f=i.canCreateInstrumentationRule,b=a(()=>function(e,t){const n=e.filter(e=>e.type===He.CustomInstrumentation&&e.ruleName===xd&&$d(e.sourceScopes,t));return n.find(e=>e.sourceScopes?.sources?.some(e=>Td(e,t.id)))??n[0]??null}(s,e),[s,e]),v=f&&g.length>0,y=a(()=>{const t=new Map;for(const o of n){const n=!!kd(o.name,g),a=Ad(o.name,e,g,s),i=!!b&&a.some(e=>e.rule.ruleId===b.ruleId),l=a.filter(e=>e.rule.ruleId!==b?.ruleId),r=!i&&l.length>0,c=v&&n,d=r;let u;if(r){const e=[...new Set(l.map(e=>e.rule.ruleName))];u=`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 p=!1,h="Add this symbol to the “Profiling Symbols” rule";r?h=u??"Managed by another rule":0===a.length&&(0===g.length?h="Custom instrumentation is only available for Go and Java sources":f?n?p=!0:h="This symbol could not be parsed into a probe automatically":h="You don’t have permission to add custom instrumentation"),t.set(o.name,{parsable:n,inManagedRule:i,otherRules:l,showCheckbox:c,checkboxDisabled:d,checkboxTooltip:u,addEnabled:p,addTooltip:h})}return t},[n,s,e,g,f,v,b]),C=a(()=>{const e=new Set;return y.forEach((t,n)=>{t.inManagedRule&&e.add(n)}),e},[y]),S=a(()=>[...c].filter(e=>y.get(e)?.addEnabled&&!C.has(e)),[c,y,C]),w=a(()=>[...u].filter(e=>C.has(e)),[u,C]),x=S.length+w.length,k=l(e=>{const t=y.get(e);return t?.inManagedRule?!u.has(e):!!(t&&t.otherRules.length>0)||c.has(e)},[y,u,c]),T=l((e,t)=>{const n=y.get(e);n&&!n.checkboxDisabled&&(n.inManagedRule?p(n=>{const o=new Set(n);return t?o.delete(e):o.add(e),o}):d(n=>{const o=new Set(n);return t?o.add(e):o.delete(e),o}))},[y]),$=l(()=>{d(new Set),p(new Set)},[]),I=l(t=>{(async()=>{const n=t.add.map(e=>kd(e,g)).filter(e=>!!e),a=t.remove.map(e=>kd(e,g)).filter(e=>!!e);if(b){const{customInstrumentations:e,isEmpty:t}=function(e,t,n){const o=e.customInstrumentations??{};let a=[...o[Ge.Golang]??[]],i=[...o[Ge.Java]??[]];for(const e of n)e.golang&&(a=a.filter(t=>!Id(t,e.golang))),e.java&&(i=i.filter(t=>!Ed(t,e.java)));for(const e of t)e.golang&&!a.some(t=>Id(t,e.golang))&&a.push(e.golang),e.java&&!i.some(t=>Ed(t,e.java))&&i.push(e.java);return{customInstrumentations:{[Ge.Golang]:a,[Ge.Java]:i},isEmpty:0===a.length&&0===i.length}}(b,n,a);t?await o.remove(b.ruleId,He.CustomInstrumentation):await o.update(b.ruleId,function(e,t){return{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}}(b,e),He.CustomInstrumentation)}else n.length>0&&await o.create(function(e,t){const n=e.map(e=>e.golang).filter(e=>!!e),o=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:xd,notes:"Symbols selected from the profiling tab.",disabled:!1,sourceScopes:a,workloads:null,instrumentationLibraries:null,payloadCollection:null,codeAttributes:null,headersCollection:null,customInstrumentations:{[Ge.Golang]:n,[Ge.Java]:o}}}(n,e),He.CustomInstrumentation)})()},[b,g,e,o]),E=l(()=>{x&&m({add:S,remove:w})},[x,S,w]),A=l(e=>m({add:[e],remove:[]}),[]),N=l(e=>m({add:[],remove:[e]}),[]),O=l(()=>m(null),[]),R=l(()=>{h&&(I(h),m(null),$())},[h,I,$]),D=l(e=>y.get(e)??{parsable:!1,inManagedRule:!1,otherRules:[],showCheckbox:!1,checkboxDisabled:!1,addEnabled:!1,addTooltip:"Custom instrumentation is only available for Go and Java sources"},[y]);return{instrumentation:a(()=>({getSymbolState:D,onAdd:A,onRemove:N,selectionEnabled:v,isSelected:k,onToggleSymbol:T}),[D,A,N,v,k,T]),pendingCount:x,pendingModify:h,closeModify:O,openBulkModify:E,resetSelection:$,confirmModify:R}}var Od,Rd,Dd;!function(e){e.Symbol="symbol",e.Self="self",e.Total="total"}(Od||(Od={})),function(e){e.OnlyInstrumentable="only-instrumentable"}(Rd||(Rd={})),function(e){e.FilterOutVoid="filter-out-void",e.OnlyWithReturnValues="only-with-return-values"}(Dd||(Dd={}));const Pd=/^[A-Za-z_$][A-Za-z0-9_$]*(\[\])*$/;function Fd(e,t){const n=function(e){return e.split(" ")[0]??""}(e);if(t.includes(Dd.FilterOutVoid)&&"void"===n)return!1;if(t.includes(Dd.OnlyWithReturnValues)){if(!(e.includes(" ")&&"void"!==n&&Pd.test(n)))return!1}return!0}const Ld=({rows:e,languages:n,instrumentation:o,searchQuery:i,filters:r,onFiltersChange:s,zoomedSymbols:c,highlightSymbol:d,scrollSignal:u})=>{const p=!!n?.includes(Cn.Java),h=a(()=>{const t=c?new Set(c):null,n=i?.trim().toLowerCase();return e.filter(e=>(!t||t.has(e.name))&&(!n||e.name.toLowerCase().includes(n)))},[e,i,c]),m=a(()=>{const e=[];if(o.selectionEnabled&&e.push({id:Rd.OnlyInstrumentable,label:"Only show instrumentable symbols"}),p&&(e.push({id:Dd.FilterOutVoid,label:"Filter out void symbols"}),e.push({id:Dd.OnlyWithReturnValues,label:"Only show functions with return values"})),0!==e.length)return{options:e,filterRow:(e,t)=>{const n=e.cells.find(e=>e.key===Od.Symbol)?.rawValue?.toString()??"";return!(t.includes(Rd.OnlyInstrumentable)&&!o.getSymbolState(n).showCheckbox)&&Fd(n,t)}}},[o,p]),g=a(()=>[{key:Od.Symbol,label:"Symbol",flex:"0 0 160px",filterOverride:m,noFilter:!m},{key:Od.Self,label:"Self",tooltip:"Time spent in this function itself, excluding time in functions it calls.",textAlign:"right",noFilter:!0},{key:Od.Total,label:"Total",tooltip:"Time spent in this function and all functions it calls (inclusive).",textAlign:"right",noFilter:!0}],[m]),f=a(()=>h.map(e=>{const t=o.getSymbolState(e.name),n=t.showCheckbox;return{id:e.name,cells:[{key:Od.Symbol,rawValue:e.name},{key:Od.Self,rawValue:sd(e.self)},{key:Od.Total,rawValue:sd(e.total)}],isSelected:n?o.isSelected(e.name):void 0,onSelect:n?()=>o.onToggleSymbol(e.name,!0):void 0,onDeselect:n?()=>o.onToggleSymbol(e.name,!1):void 0,hideCheckbox:!n,checkboxDisabled:n?t.checkboxDisabled:void 0,checkboxTooltip:n?t.checkboxTooltip:void 0}}),[h,o]),b=l(e=>{const t=e.cells[0].rawValue,n=o.getSymbolState(t),a=[];return n.inManagedRule?a.push({id:`remove-instrumentation-${t}`,label:"",leftIcon:gi,tooltip:"Remove from the “Profiling Symbols” rule",onClick:()=>o.onRemove(t)}):a.push({id:`add-instrumentation-${t}`,label:"",leftIcon:fi,tooltip:n.addTooltip,disabled:!n.addEnabled,onClick:()=>o.onAdd(t)}),a.push({id:`copy-${t}`,label:"",leftIcon:Yi,tooltip:"Copy symbol name",onClick:()=>{navigator.clipboard.writeText(t)}}),a},[o]);return t(Sn,{variant:wn.Data,maxHeight:"calc(100vh - 306px)",columns:g,rows:f,withCheckboxes:o.selectionEnabled,filters:r,onFiltersChange:s,activeRowId:d,scrollSignal:u,getRowActions:b})};var _d;!function(e){e.Table="table",e.Flame="flame",e.Both="both"}(_d||(_d={}));const Md=g(q)`
|
|
309
|
+
`,fd=({pendingModify:n,onClose:o,onConfirm:a})=>{const i=f();return t(Je,{isOpen:!!n,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:o,denyButton:{variant:me.Secondary,label:"Cancel",onClick:o},approveButton:{variant:me.Primary,label:"Confirm",onClick:a},children:n&&e(md,{children:[n.add.map(n=>e(gd,{children:[t(We,{leftIcon:yi,status:Pe.Success,useSecondaryTone:!0,textColor:i.v2.colors.white[500],textSize:de.XXS}),t(se,{size:de.XS,color:ce.Primary,children:n})]},`add-${n}`)),n.remove.map(n=>e(gd,{children:[t(We,{leftIcon:Ki,status:Pe.Error,useSecondaryTone:!0,textColor:i.v2.colors.white[500],textSize:de.XXS}),t(se,{size:de.XS,color:ce.Primary,children:n})]},`remove-${n}`))]})})};function bd(e,t){const n=e.names[t];if(null==n)return"";if("string"==typeof n)return n;if("object"==typeof n&&"name"in n){const e=n.name;if("string"==typeof e)return e}return"number"==typeof n||"boolean"==typeof n?String(n):""}function yd(e){const t=Math.abs(e);return t>=1e9?`${vd(e/1e9)}s`:t>=1e6?`${vd(e/1e6)}ms`:t>=1e3?`${vd(e/1e3)}μs`:String(Math.round(e))}function vd(e){return e.toFixed(2).replace(/\.?0+$/,"")}function Cd(e){const t=[];for(let n=0;n<e.levels.length;n++){const o=e.levels[n];let a=0;for(let e=0;e+3<o.length;e+=4){const i=o[e],l=o[e+1],r=o[e+2],s=o[e+3],c=a+i;t.push({level:n,offset:c,size:l,self:r,nameIndex:s}),a=c+l}}return t}function Sd(e){return`${e.level}:${e.offset}:${e.size}:${e.nameIndex}`}function wd(e,t){const n=e.reduce((e,t)=>Math.max(e,t.level),t.level),o=new Map;for(const t of e){const e=o.get(t.level);e?e.push(t):o.set(t.level,[t])}const a=[t];for(let e=t.level+1;e<=n;e++){const t=a.filter(t=>t.level===e-1);if(0===t.length)break;const n=o.get(e);if(n?.length)for(const e of n)for(const n of t)if(e.offset>=n.offset&&e.offset+e.size<=n.offset+n.size){a.push(e);break}}return a}function xd(e,t){const n=t.trim().toLowerCase();return!n||e.toLowerCase().includes(n)}function kd(e,t,n,o,a,i={}){if(0===e.levels.length||t<2||n<2)return null;const{zoomRoot:l=null,shouldKeepName:r,collapseRecursive:s=!1,allRects:c}=i,d=c??Cd(e);let u=l?wd(d,l):d;if(0===u.length)return null;if(r&&(u=u.filter(t=>r(bd(e,t.nameIndex))),0===u.length))return null;if(s&&(u=function(e,t){if(0===t.length)return t;const n=[...t].sort((e,t)=>e.level-t.level||e.offset-t.offset),o=new Map;for(const e of n){const t=o.get(e.level);t?t.push(e):o.set(e.level,[e])}const a=new Set;for(const t of n){const n=o.get(t.level+1);if(!n)continue;const i=n.filter(e=>e.offset>=t.offset&&e.offset+e.size<=t.offset+t.size);if(1!==i.length)continue;const l=i[0];l.size===t.size&&bd(e,l.nameIndex)===bd(e,t.nameIndex)&&a.add(Sd(l))}if(0===a.size)return n;const i=[];for(const e of n){if(a.has(Sd(e)))continue;let t=0;for(let n=0;n<e.level;n++){const i=o.get(n);if(!i)continue;const l=i.find(t=>e.offset>=t.offset&&e.offset+e.size<=t.offset+t.size);l&&a.has(Sd(l))&&t++}i.push({...e,level:e.level-t})}return i}(e,u),0===u.length))return null;const p=l?.level??0,h=l?.offset??0,m=l?.size??e.numTicks;if(m<=0)return null;const g=u.reduce((e,t)=>Math.max(e,t.level-p),0)+1,f=o??Number.POSITIVE_INFINITY,b=Math.max(1,Math.min(n/g,f)),y=a.trim(),v=b>8?1:0;return u.map(n=>{const o=n.level-p,a=(n.offset-h)/m*t,i=Math.max(n.size/m*t,1),l=o*b,r=Math.max(b-v,1),s=bd(e,n.nameIndex);return{...n,x:a,y:l,w:i,h:r,name:s,matchesSearch:xd(s,y)}})}function Td(e,t){let n=0;for(let t=0;t<e.length;t++)n=31*n+e.charCodeAt(t)>>>0;const o=t.v2.colors.black[500],a=[{fill:t.v2.colors.purple[300],text:o},{fill:t.v2.colors.green[300],text:o},{fill:t.v2.colors.red[300],text:o},{fill:t.v2.colors.blue[300],text:o},{fill:t.v2.colors.yellow[300],text:o}];return a[n%a.length]}var $d,Id;!function(e){e[e.Fit=1]="Fit",e[e.X10=10]="X10"}($d||($d={})),function(e){e[e.Fit=1]="Fit",e[e.X10=10]="X10"}(Id||(Id={}));function Ed(e,t){return t<=0?"0":(100*e/t).toFixed(e/t<.001?2:1)}function Ad(e,t,n){for(const o of n)if(e>=o.x&&e<o.x+o.w&&t>=o.y&&t<o.y+o.h)return o;return null}function Nd(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`}const Od=({flamebearer:n,maxRowPx:s,searchQuery:c="",shouldKeepName:d,minHostHeight:u=200,onFullscreenChange:p,profilingSlots:h,onFrameClick:g,onZoomedSymbolsChange:b,onResetZoom:y})=>{const v=f(),C=i(null),S=i(null),w=i({x:0,y:0}),x=i(n.numTicks),[k,T]=r({w:0,h:0}),[$,I]=r(""),[E,A]=r(null),[N,O]=r([]),[R,D]=r(!1),[P,F]=r($d.Fit),[L,M]=r(Id.Fit),[_,z]=r(!1),B=Math.max(1,Math.min(Math.floor(k.w*P),8192)),X=Math.max(1,Math.min(Math.floor(k.h*L),8192)),V=N.length>0?N[N.length-1]:null,U=V?.size??n.numTicks,j=a(()=>Cd(n),[n]);o(()=>{x.current!==n.numTicks&&(x.current=n.numTicks,O([]))},[n.numTicks]),o(()=>{if(!b)return;if(!V)return void b(null);const e=wd(j,V),t=new Set;for(const o of e){const e=bd(n,o.nameIndex);e&&t.add(e)}b([...t])},[V,n,j,b]),m(()=>{const e=C.current;if(!e)return;const t=new ResizeObserver(()=>{const t=e.getBoundingClientRect();T({w:Math.floor(t.width),h:Math.floor(t.height)})});return t.observe(e),()=>t.disconnect()},[]),o(()=>{if(!R)return;const e=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=e}},[R]),o(()=>(p?.(R),()=>{R&&p?.(!1)}),[R,p]);const G=a(()=>kd(n,B,X,s,c,{zoomRoot:V,shouldKeepName:d,collapseRecursive:_,allRects:j}),[n,s,c,X,B,V,d,_,j]),H=a(()=>function(e){return[...e].sort((e,t)=>t.level-e.level)}(G?.length?c.trim()?G.filter(e=>e.matchesSearch):G:[]),[G,c]),W=l(e=>{if(B<2||X<2)return;const t=e.currentTarget.getBoundingClientRect();if(t.width<1||t.height<1)return;const o=Ad((e.clientX-t.left)/t.width*B,(e.clientY-t.top)/t.height*X,H);if(o){const e=Sd(o);A(e);const t=U>0?(100*o.size/U).toFixed(1):"0",a=n.numTicks>0?(100*o.size/n.numTicks).toFixed(1):"0";I(`${o.name}\ntotal ${yd(o.size)} (${t}% of view, ${a}% of profile) · self ${yd(o.self)}`)}else A(null),I("")},[H,n.numTicks,X,B,U]),K=l(e=>{W(e)},[W]),Y=l(()=>{A(null),I("")},[]),J=l(e=>{w.current={x:e.clientX,y:e.clientY}},[]),q=l(e=>{const{x:t,y:n}=w.current;if(Math.abs(e.clientX-t)>3||Math.abs(e.clientY-n)>3)return;if(B<2||X<2)return;const o=e.currentTarget.getBoundingClientRect();if(o.width<1||o.height<1)return;const a=Ad((e.clientX-o.left)/o.width*B,(e.clientY-o.top)/o.height*X,H);if(!a)return;g?.(a.name);const i=function(e){return{level:e.level,offset:e.offset,size:e.size,self:e.self,nameIndex:e.nameIndex}}(a);O(e=>{const t=e.length>0?e[e.length-1]:null;return t&&function(e,t){return e.level===t.level&&e.offset===t.offset&&e.size===t.size&&e.nameIndex===t.nameIndex}(i,t)?e.slice(0,-1):[...e,i]})},[H,X,B,g]);m(()=>{const e=S.current;if(!e||B<2||X<2)return;const t="undefined"!=typeof window&&window.devicePixelRatio||1,o=Math.max(B,X),a=Math.min(t,16384/o);e.width=Math.floor(B*a),e.height=Math.floor(X*a),e.style.width=`${B}px`,e.style.height=`${X}px`;const i=e.getContext("2d");i&&(i.setTransform(a,0,0,a,0,0),i.clearRect(0,0,B,X),G?.length?function(e,t,n,o,a,i,l,r){const s=i.v2.colors.silver[900];e.fillStyle=s,e.fillRect(0,0,t,n);const c=a.trim().length>0;e.textRendering="optimizeLegibility";for(const t of o){const{x:n,y:o,w:a,h:l,name:s,size:d,matchesSearch:u}=t;if(c&&!u)continue;const{fill:p,text:h}=Td(s,i);e.fillStyle=p,e.fillRect(n,o,a,l),e.strokeStyle="rgba(255,255,255,0.14)",e.lineWidth=1,e.beginPath(),e.moveTo(n+.5,o+.5),e.lineTo(n+a-.5,o+.5),e.stroke(),e.strokeStyle="rgba(0,0,0,0.45)",e.lineWidth=1,e.strokeRect(n+.5,o+.5,Math.max(a-1,0),Math.max(l-1,0));const m=Ed(d,r),g=`${s} (${yd(d)}, ${m}%)`,f=i.v2.text.size.xs,b=8,y=5,v=26,C=Math.min(f,Math.floor(l-2));if(a>=v&&C>=b){e.font=`${C}px ${i.font_family.primary}, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif`,e.textBaseline="middle",e.textAlign="left";let t=g;for(;t.length>2&&e.measureText(t).width>a-2*y;)t=`${t.slice(0,-2)}…`;e.measureText(t).width<=a-2*y&&(e.lineWidth=1,e.strokeStyle="rgba(0, 0, 0, 0.5)",e.lineJoin="round",e.miterLimit=1,e.strokeText(t,n+y,o+l/2),e.fillStyle=h,e.fillText(t,n+y,o+l/2))}}if(l)for(const t of o){if(Sd(t)!==l)continue;if(c&&!t.matchesSearch)continue;const{x:n,y:o,w:a,h:i}=t;e.strokeStyle="rgba(255,255,255,0.88)",e.lineWidth=2,e.strokeRect(n+1,o+1,Math.max(a-2,0),Math.max(i-2,0));break}}(i,B,X,G,c,v,E,n.numTicks):(i.fillStyle=v.v2.colors.silver[900],i.fillRect(0,0,B,X)))},[G,n.numTicks,E,c,X,B,v]);const Z=l(()=>D(e=>!e),[]),Q=n.numTicks>0?Math.max(0,Math.min(100,Math.round(U/n.numTicks*100))):100,ee=a(()=>function(e,t,n){const o=n??Cd(e),a=t?.offset??0,i=a+(t?.size??e.numTicks),l=(t?.level??-1)+1,r=t?.size??e.numTicks;let s=null;for(const e of o)e.level<l||e.offset<a||e.offset+e.size>i||e.size>=r||(!s||e.size>s.size||e.size===s.size&&e.level<s.level)&&(s=e);return s}(n,V,j),[n,V,j]),te=null!==ee,ne=N.length>0,ie=V?bd(n,V.nameIndex):"",le=l(()=>{O([]),y?.()},[y]),re=l(()=>O(e=>e.slice(0,-1)),[]),fe=l(()=>{ee&&O(e=>[...e,ee])},[ee]);return e("div",{style:R?{position:"fixed",inset:0,zIndex:9999,display:"flex",flexDirection:"column",gap:8,padding:16,background:v.v2.colors.silver[900]}:{flex:1,minHeight:u,minWidth:0,width:"100%",display:"flex",flexDirection:"column",gap:8,position:"relative"},children:[e(ue,{$gap:8,$wrap:"nowrap",$justifyContent:"space-between",children:[t(oe,{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:ae.Left,size:Tt.S,value:_,onChange:z}),e(ue,{$gap:8,children:[e(ue,{children:[t(pe,{variant:me.Secondary,size:he.S,label:"Reset zoom",leftIcon:Yi,onClick:le,disabled:!N.length}),t(pe,{variant:me.Secondary,size:he.S,iconSize:20,leftIcon:Ki,tooltip:"Zoom out",hideTooltipIcon:!0,disabled:!ne,onClick:re}),t("div",{style:{minWidth:36,textAlign:"center",fontVariantNumeric:"tabular-nums"},children:t(se,{size:de.XXS,color:ce.Secondary,nowrap:!0,align:"center",children:`${Q}%`})}),t(pe,{variant:me.Secondary,size:he.S,iconSize:20,leftIcon:yi,tooltip:"Zoom in",hideTooltipIcon:!0,disabled:!te,onClick:fe})]}),e(ue,{children:[t($e,{text:"Horizontal width: stretch the canvas wider than the viewport so narrow stacks become hoverable / readable.",children:t(ge,{variant:Cn.Filled,options:[{value:$d.Fit,label:"W: Fit"},{value:$d.X10,label:"10x"}],selected:P,setSelected:F})}),t($e,{text:"Vertical height: scale rows taller than the viewport for deep call stacks. Scroll vertically to navigate.",children:t(ge,{variant:Cn.Filled,options:[{value:Id.Fit,label:"H: Fit"},{value:Id.X10,label:"10x"}],selected:L,setSelected:M})})]}),t(pe,{variant:me.Secondary,size:he.S,iconSize:24,leftIcon:R?Di:Ji,tooltip:R?"Exit fullscreen (Esc)":"Fullscreen",hideTooltipIcon:!0,onClick:Z})]})]}),t($e,{fullWidth:!0,keepAlive:!0,text:$,children:t("div",{ref:C,style:{flex:1,minWidth:0,width:"100%",height:R?"calc(100vh - 80px)":"calc(100vh - 364px)",position:"relative",overflow:"hidden"},children:t("div",{style:{position:"absolute",inset:0,overflowX:P>1?"auto":"hidden",overflowY:L>1?"auto":"hidden"},children:t("div",{style:{width:B||"100%",height:X||"100%",position:"relative"},children:t("canvas",{ref:S,style:{display:"block",position:"absolute",left:0,top:0,width:"100%",height:"100%",borderRadius:8,cursor:E?"pointer":"default"},onPointerDown:J,onPointerMove:K,onPointerLeave:Y,onClick:q})})})})}),e(ue,{$justifyContent:"space-between",children:[t(se,V?{size:de.XXXS,color:v.v2.colors.silver[300],children:`Zoomed: ${ie} • ${yd(U)} samples in view`}:{size:de.XXXS,color:v.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(se,{size:de.XXXS,color:v.v2.colors.silver[300],children:`${h.activeKeys.length} / ${h.maxSlots} profiling slots · ${Nd(h.totalBytesUsed)} / ${Nd(h.maxTotalBytesBudget)} budget · TTL ${h.slotTtlSeconds}s`})]})]})},Rd=[Sn.Go,Sn.Java],Dd="Profiling Symbols";function Pd(e,t){if(0===t.length)return null;const n=1===t.length?t[0]:function(e){return e.includes("/")||/\.\(\*?[^)]+\)\./.test(e)?Sn.Go:e.includes(" ")||e.includes("(")?Sn.Java:Sn.Go}(e);if(n===Sn.Go){const t=function(e){let t=e.trim();if(!t)return null;t=t.replace(/\[[^\]]*\]/g,"");const n=t.lastIndexOf("/"),o=t.indexOf(".",n+1);if(-1===o)return null;const a=t.slice(0,o),i=t.slice(o+1);if(!a||!i)return null;const l=i.match(/^\(\*?([^)]+)\)\.(.+)$/);if(l){const e=new Ue(a,"",l[1],l[2]);return e.Verify()?e:null}const r=new Ue(a,i);return r.Verify()?r:null}(e);return t?{language:n,golang:t}:null}if(n===Sn.Java){const t=function(e){let t=e.trim();if(!t)return null;const n=t.indexOf("(");-1!==n&&(t=t.slice(0,n).trim());const o=t.split(/\s+/);t=o[o.length-1]??"";const a=t.lastIndexOf(".");if(-1===a)return null;const i=t.slice(0,a),l=t.slice(a+1),r=new je(i,l);return r.Verify()?r:null}(e);return t?{language:n,java:t}:null}return null}function Fd(e,t){return e.namespace===t.namespace&&e.name===t.name&&e.kind===t.kind}function Ld(e,t,n){if(!e)return!0;const{sources:o=[],namespaces:a=[],languages:i=[]}=e,l=!o.length||o.some(e=>Fd(e,t.id)),r=!a.length||a.includes(t.id.namespace),s=!i.length||null==n||i.includes(n);return l&&r&&s}function Md(e,t){return e.packageName===t.packageName&&(e.functionName||"")===(t.functionName||"")&&(e.receiverName||"")===(t.receiverName||"")&&(e.receiverMethodName||"")===(t.receiverMethodName||"")}function _d(e,t){return e.className===t.className&&e.methodName===t.methodName}function zd(e,t,n,o){const a=Pd(e,n);if(!a)return[];const i=[];for(const e of o){const n=e.customInstrumentations;if(!n)continue;if(!Ld(e.sourceScopes,t,a.language))continue;const o=!!a.golang&&!!n[Ge.Golang]?.some(e=>Md(e,a.golang)),l=!!a.java&&!!n[Ge.Java]?.some(e=>_d(e,a.java));(o||l)&&i.push({rule:e,resolved:a})}return i}function Bd({source:e,languages:t,rows:n}){const{instrumentationRulesApi:o,capabilities:i}=yl(),{items:s}=o.useRules(),[c,d]=r(new Set),[u,p]=r(new Set),[h,m]=r(null),g=a(()=>function(e){const t=new Set(e??[]);return Rd.filter(e=>t.has(e))}(t),[t]),f=i.canCreateInstrumentationRule,b=a(()=>function(e,t){const n=e.filter(e=>e.type===He.CustomInstrumentation&&e.ruleName===Dd&&Ld(e.sourceScopes,t));return n.find(e=>e.sourceScopes?.sources?.some(e=>Fd(e,t.id)))??n[0]??null}(s,e),[s,e]),y=f&&g.length>0,v=a(()=>{const t=new Map;for(const o of n){const n=!!Pd(o.name,g),a=zd(o.name,e,g,s),i=!!b&&a.some(e=>e.rule.ruleId===b.ruleId),l=a.filter(e=>e.rule.ruleId!==b?.ruleId),r=!i&&l.length>0,c=y&&n,d=r;let u;if(r){const e=[...new Set(l.map(e=>e.rule.ruleName))];u=`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 p=!1,h="Add this symbol to the “Profiling Symbols” rule";r?h=u??"Managed by another rule":0===a.length&&(0===g.length?h="Custom instrumentation is only available for Go and Java sources":f?n?p=!0:h="This symbol could not be parsed into a probe automatically":h="You don’t have permission to add custom instrumentation"),t.set(o.name,{parsable:n,inManagedRule:i,otherRules:l,showCheckbox:c,checkboxDisabled:d,checkboxTooltip:u,addEnabled:p,addTooltip:h})}return t},[n,s,e,g,f,y,b]),C=a(()=>{const e=new Set;return v.forEach((t,n)=>{t.inManagedRule&&e.add(n)}),e},[v]),S=a(()=>[...c].filter(e=>v.get(e)?.addEnabled&&!C.has(e)),[c,v,C]),w=a(()=>[...u].filter(e=>C.has(e)),[u,C]),x=S.length+w.length,k=l(e=>{const t=v.get(e);return t?.inManagedRule?!u.has(e):!!(t&&t.otherRules.length>0)||c.has(e)},[v,u,c]),T=l((e,t)=>{const n=v.get(e);n&&!n.checkboxDisabled&&(n.inManagedRule?p(n=>{const o=new Set(n);return t?o.delete(e):o.add(e),o}):d(n=>{const o=new Set(n);return t?o.add(e):o.delete(e),o}))},[v]),$=l(()=>{d(new Set),p(new Set)},[]),I=l(t=>{(async()=>{const n=t.add.map(e=>Pd(e,g)).filter(e=>!!e),a=t.remove.map(e=>Pd(e,g)).filter(e=>!!e);if(b){const{customInstrumentations:e,isEmpty:t}=function(e,t,n){const o=e.customInstrumentations??{};let a=[...o[Ge.Golang]??[]],i=[...o[Ge.Java]??[]];for(const e of n)e.golang&&(a=a.filter(t=>!Md(t,e.golang))),e.java&&(i=i.filter(t=>!_d(t,e.java)));for(const e of t)e.golang&&!a.some(t=>Md(t,e.golang))&&a.push(e.golang),e.java&&!i.some(t=>_d(t,e.java))&&i.push(e.java);return{customInstrumentations:{[Ge.Golang]:a,[Ge.Java]:i},isEmpty:0===a.length&&0===i.length}}(b,n,a);t?await o.remove(b.ruleId,He.CustomInstrumentation):await o.update(b.ruleId,function(e,t){return{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}}(b,e),He.CustomInstrumentation)}else n.length>0&&await o.create(function(e,t){const n=e.map(e=>e.golang).filter(e=>!!e),o=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:Dd,notes:"Symbols selected from the profiling tab.",disabled:!1,sourceScopes:a,workloads:null,instrumentationLibraries:null,payloadCollection:null,codeAttributes:null,headersCollection:null,customInstrumentations:{[Ge.Golang]:n,[Ge.Java]:o}}}(n,e),He.CustomInstrumentation)})()},[b,g,e,o]),E=l(()=>{x&&m({add:S,remove:w})},[x,S,w]),A=l(e=>m({add:[e],remove:[]}),[]),N=l(e=>m({add:[],remove:[e]}),[]),O=l(()=>m(null),[]),R=l(()=>{h&&(I(h),m(null),$())},[h,I,$]),D=l(e=>v.get(e)??{parsable:!1,inManagedRule:!1,otherRules:[],showCheckbox:!1,checkboxDisabled:!1,addEnabled:!1,addTooltip:"Custom instrumentation is only available for Go and Java sources"},[v]);return{instrumentation:a(()=>({getSymbolState:D,onAdd:A,onRemove:N,selectionEnabled:y,isSelected:k,onToggleSymbol:T}),[D,A,N,y,k,T]),pendingCount:x,pendingModify:h,closeModify:O,openBulkModify:E,resetSelection:$,confirmModify:R}}var Xd,Vd,Ud;!function(e){e.Symbol="symbol",e.Self="self",e.Total="total"}(Xd||(Xd={})),function(e){e.OnlyInstrumentable="only-instrumentable"}(Vd||(Vd={})),function(e){e.FilterOutVoid="filter-out-void",e.OnlyWithReturnValues="only-with-return-values"}(Ud||(Ud={}));const jd=/^[A-Za-z_$][A-Za-z0-9_$]*(\[\])*$/;function Gd(e,t){const n=function(e){return e.split(" ")[0]??""}(e);if(t.includes(Ud.FilterOutVoid)&&"void"===n)return!1;if(t.includes(Ud.OnlyWithReturnValues)){if(!(e.includes(" ")&&"void"!==n&&jd.test(n)))return!1}return!0}const Hd=({rows:e,languages:n,instrumentation:o,searchQuery:i,filters:r,onFiltersChange:s,zoomedSymbols:c,highlightSymbol:d,scrollSignal:u})=>{const p=!!n?.includes(Sn.Java),h=a(()=>{const t=c?new Set(c):null,n=i?.trim().toLowerCase();return e.filter(e=>(!t||t.has(e.name))&&(!n||e.name.toLowerCase().includes(n)))},[e,i,c]),m=a(()=>{const e=[];if(o.selectionEnabled&&e.push({id:Vd.OnlyInstrumentable,label:"Only show instrumentable symbols"}),p&&(e.push({id:Ud.FilterOutVoid,label:"Filter out void symbols"}),e.push({id:Ud.OnlyWithReturnValues,label:"Only show functions with return values"})),0!==e.length)return{options:e,filterRow:(e,t)=>{const n=e.cells.find(e=>e.key===Xd.Symbol)?.rawValue?.toString()??"";return!(t.includes(Vd.OnlyInstrumentable)&&!o.getSymbolState(n).showCheckbox)&&Gd(n,t)}}},[o,p]),g=a(()=>[{key:Xd.Symbol,label:"Symbol",flex:"0 0 160px",filterOverride:m,noFilter:!m},{key:Xd.Self,label:"Self",tooltip:"Time spent in this function itself, excluding time in functions it calls.",textAlign:"right",noFilter:!0},{key:Xd.Total,label:"Total",tooltip:"Time spent in this function and all functions it calls (inclusive).",textAlign:"right",noFilter:!0}],[m]),f=a(()=>h.map(e=>{const t=o.getSymbolState(e.name),n=t.showCheckbox;return{id:e.name,cells:[{key:Xd.Symbol,rawValue:e.name},{key:Xd.Self,rawValue:yd(e.self)},{key:Xd.Total,rawValue:yd(e.total)}],isSelected:n?o.isSelected(e.name):void 0,onSelect:n?()=>o.onToggleSymbol(e.name,!0):void 0,onDeselect:n?()=>o.onToggleSymbol(e.name,!1):void 0,hideCheckbox:!n,checkboxDisabled:n?t.checkboxDisabled:void 0,checkboxTooltip:n?t.checkboxTooltip:void 0}}),[h,o]),b=l(e=>{const t=e.cells[0].rawValue,n=o.getSymbolState(t),a=[];return n.inManagedRule?a.push({id:`remove-instrumentation-${t}`,label:"",leftIcon:bi,tooltip:"Remove from the “Profiling Symbols” rule",onClick:()=>o.onRemove(t)}):a.push({id:`add-instrumentation-${t}`,label:"",leftIcon:yi,tooltip:n.addTooltip,disabled:!n.addEnabled,onClick:()=>o.onAdd(t)}),a.push({id:`copy-${t}`,label:"",leftIcon:qi,tooltip:"Copy symbol name",onClick:()=>{navigator.clipboard.writeText(t)}}),a},[o]);return t(wn,{variant:xn.Data,maxHeight:"calc(100vh - 306px)",columns:g,rows:f,withCheckboxes:o.selectionEnabled,filters:r,onFiltersChange:s,activeRowId:d,scrollSignal:u,getRowActions:b})};var Wd;!function(e){e.Table="table",e.Flame="flame",e.Both="both"}(Wd||(Wd={}));const Kd=g(q)`
|
|
310
310
|
width: 100%;
|
|
311
311
|
flex: 1;
|
|
312
312
|
border-radius: 16px;
|
|
313
313
|
overflow: hidden;
|
|
314
314
|
background: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
315
315
|
box-shadow: 0 2px 14.1px 0 rgba(0, 0, 0, 0.25);
|
|
316
|
-
`,
|
|
316
|
+
`,Yd=g.div`
|
|
317
317
|
display: flex;
|
|
318
318
|
align-items: center;
|
|
319
319
|
gap: 10px;
|
|
@@ -321,11 +321,11 @@ import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{useEffect
|
|
|
321
321
|
padding: 12px 12px 8px;
|
|
322
322
|
background: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
323
323
|
border-radius: 16px 16px 0 0;
|
|
324
|
-
`,
|
|
324
|
+
`,Jd=g(ue)`
|
|
325
325
|
flex-shrink: 0;
|
|
326
326
|
align-items: center;
|
|
327
327
|
gap: 4px;
|
|
328
|
-
`,
|
|
328
|
+
`,qd=g.div`
|
|
329
329
|
flex: 1;
|
|
330
330
|
display: flex;
|
|
331
331
|
align-items: stretch;
|
|
@@ -333,20 +333,20 @@ import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{useEffect
|
|
|
333
333
|
padding: 16px;
|
|
334
334
|
background: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
335
335
|
border-radius: 0 0 16px 16px;
|
|
336
|
-
`,
|
|
336
|
+
`,Zd=g(q)`
|
|
337
337
|
flex: ${({$splitWithFlame:e})=>e?"0 0 min(413px, 42%)":"1 1 auto"};
|
|
338
338
|
width: ${({$splitWithFlame:e})=>e?"auto":"100%"};
|
|
339
339
|
max-width: ${({$splitWithFlame:e})=>e?"none":"100%"};
|
|
340
340
|
gap: 10px;
|
|
341
|
-
`,
|
|
341
|
+
`,Qd=g(q)`
|
|
342
342
|
flex: ${({$splitWithTable:e})=>e?"1":"1 1 auto"};
|
|
343
343
|
width: ${({$splitWithTable:e})=>e?"auto":"100%"};
|
|
344
344
|
gap: 10px;
|
|
345
|
-
`,
|
|
345
|
+
`,eu=g(ue)`
|
|
346
346
|
width: 100%;
|
|
347
347
|
min-height: 32px;
|
|
348
348
|
flex-shrink: 0;
|
|
349
|
-
`,
|
|
349
|
+
`,tu=({source:n,onFlameFullscreenChange:c})=>{const d=f(),u=n.id,{profilingApi:p}=yl(),[h,m]=r(!0),[g,b]=r(Wd.Both),[y,v]=r(""),[C,S]=r({}),[w,x]=r(!1),k=i(!1);o(()=>{k.current||(k.current=!0,p.enableProfiling?.(u),x(!0))},[p,u]);const{data:T}=p.useSlots({skip:!w,pollInterval:3e3,fetchPolicy:"network-only"}),{data:$,loading:I,refetch:E}=p.useSourceProfiling(u,{skip:!w,pollInterval:h?3e3:0,fetchPolicy:"network-only"}),A=$?.profileJson??null,N=a(()=>function(e){if(!e?.trim())return null;try{const t=JSON.parse(e),n=t.flamebearer;return!n?.names?.length||!Array.isArray(n.levels)||"number"!=typeof n.numTicks||n.numTicks<=0?null:{flamebearer:n,units:t.metadata?.units}}catch{return null}}(A),[A]),O=a(()=>N?function(e){const t=new Map;for(let n=0;n<e.levels.length;n++){const o=e.levels[n];for(let n=0;n+3<o.length;n+=4){const a=o[n+1],i=o[n+2],l=bd(e,o[n+3]);if(!l)continue;const r=t.get(l);(!r||a>r.total)&&t.set(l,{self:i,total:a})}}return[...t.entries()].map(([e,t])=>({name:e,self:t.self,total:t.total})).sort((e,t)=>t.self-e.self)}(N.flamebearer):[],[N]),R=g===Wd.Table||g===Wd.Both,D=g===Wd.Flame||g===Wd.Both,P=R&&D,F=a(()=>n.runtimeInfo?.detectedLanguages||n.containers?.map(e=>e.overrides?.runtimeInfo?.language??e.runtimeInfo?.language??""),[n]),L=a(()=>function(e,t){if(!t?.includes(Sn.Java))return;const n=(e?.[Xd.Symbol]?.filter(Boolean)??[]).filter(e=>e===Ud.FilterOutVoid||e===Ud.OnlyWithReturnValues);return 0!==n.length?e=>Gd(e,n):void 0}(C,F),[C,F]),{instrumentation:M,pendingCount:_,pendingModify:z,closeModify:B,openBulkModify:X,resetSelection:V,confirmModify:U}=Bd({source:n,languages:F,rows:O}),[j,G]=r(null),[H,W]=r(0),[K,Y]=r(null),J=l(e=>{G(e),W(e=>e+1),b(e=>e===Wd.Flame?Wd.Both:e)},[]);return!A&&I?t(ht,{$height:"70vh",children:t(yt,{withSpinner:!0})}):e(Kd,{$gap:0,$width:"100%",children:[e(Yd,{children:[t($e,{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(Jd,{children:t(se,{size:de.S,weight:500,color:ce.Primary,nowrap:!0,children:"CPU Profiling"})})}),e(ue,{style:{flex:1,minWidth:200,gap:10,alignItems:"center",flexWrap:"wrap"},children:[t("div",{style:{flex:"1 1 220px",minWidth:180},children:t(on,{value:y,onChange:v,placeholder:"Search by symbol name",width:"100%",idleBackgroundColor:d.v2.colors.silver[900],emphasizeBackgroundColor:d.v2.colors.silver[800]})}),t(ge,{variant:Cn.Filled,options:[{value:Wd.Table,label:"Top table"},{value:Wd.Flame,label:"Flame graph"},{value:Wd.Both,label:"Both"}],selected:g,setSelected:b}),t(pe,h?{variant:me.Secondary,size:he.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(Zi,{...e,size:8,fill:d.v2.colors.green[500]})}:{variant:me.Secondary,size:he.S,label:"Paused",tooltip:"Odigos profiler is still collecting data, but the UI is not updating in real time",leftIcon:e=>t(Zi,{...e,size:8,fill:d.v2.colors.red[500]})})]})]}),t(qd,{$gap:R&&D?16:0,children:N?e(s,{children:[R&&e(Zd,{$splitWithFlame:P,children:[e(eu,{$justifyContent:"space-between",children:[e(q,{$margin:"0 0 0 20px",children:[t(se,{size:de.XXXS,nowrap:!0,children:"Please select symbols to"}),e(ue,{$gap:8,children:[e(ue,{children:[t(Qi,{size:24}),t(se,{size:de.S,color:ce.Success,nowrap:!0,children:"Custom Instrument"})]}),t(pe,{leftIcon:wi,variant:me.Secondary,size:he.S,onClick:()=>window.open(`${Fe}/enterprise/pipeline/rules/custominstrumentation`,"_blank","noopener noreferrer")})]})]}),e(ue,{$gap:8,children:[K&&t($e,{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(We,{label:`Zoomed: ${K.length} symbols`,backgroundColor:d.v2.colors.silver[750],textColor:d.v2.colors.silver[200],textSize:de.XXS})}),t(pe,{variant:me.Secondary,size:he.S,label:"Download snapshot",rightIcon:el,onClick:()=>{if(!A)return;const e=new Blob([A],{type:"application/json"}),t=URL.createObjectURL(e),o=document.createElement("a");o.href=t,o.download=`cpu-profile-${n.id.namespace}-${n.id.kind}-${n.id.name}.json`,o.click(),URL.revokeObjectURL(t)},disabled:!A})]})]}),t(Hd,{rows:O,languages:F,instrumentation:M,searchQuery:y,filters:C,onFiltersChange:S,zoomedSymbols:K,highlightSymbol:j,scrollSignal:H})]}),D&&e(Qd,{$splitWithTable:P,children:[e(eu,{$justifyContent:"space-between",children:[t(We,{label:N?`Total in view ${yd(N.flamebearer.numTicks)}`:"No profile sample yet",backgroundColor:d.v2.colors.silver[750],textColor:d.v2.colors.silver[200],textSize:de.XXS}),e(ue,{$gap:12,children:[!h&&t(pe,{variant:me.Secondary,size:he.S,label:"Refresh",leftIcon:Xi,onClick:E}),t(oe,{label:"Auto refresh",labelAlign:ae.Left,size:Tt.S,value:h,onChange:m})]})]}),t(Od,{flamebearer:N.flamebearer,maxRowPx:24,searchQuery:y,shouldKeepName:L,minHostHeight:280,onFullscreenChange:c,profilingSlots:T??null,onFrameClick:J,onZoomedSymbolsChange:Y,onResetZoom:()=>G(null)},g)]})]}):t(ht,{children:t(Ae,{title:"No profile samples yet",subTitle:"Dynamically collecting profiling samples — keep this tab open while the agent sends OTLP profiles."})})}),t(fd,{pendingModify:z,onClose:B,onConfirm:U}),t(kn,{isOpen:_>0,richTitle:{icon:Pi,title:"Profiling Symbols",badge:{label:_}},actions:[{id:"profiling-bulk-cancel",type:nn.Button,buttonProps:{variant:me.Secondary,size:he.S,label:"Cancel",onClick:V}},{id:"profiling-bulk-apply",type:nn.Button,buttonProps:{variant:me.Primary,size:he.S,label:"Modify Rule",leftIcon:ki,onClick:X}}]})]})},nu=g.div`
|
|
350
350
|
position: relative;
|
|
351
351
|
display: flex;
|
|
352
352
|
align-items: center;
|
|
@@ -354,17 +354,17 @@ import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{useEffect
|
|
|
354
354
|
padding: 8px 16px;
|
|
355
355
|
border-radius: 12px;
|
|
356
356
|
background-color: ${({theme:e})=>e.v2.colors.silver[700]};
|
|
357
|
-
`,
|
|
357
|
+
`,ou=g.div`
|
|
358
358
|
display: flex;
|
|
359
359
|
flex-direction: column;
|
|
360
360
|
gap: 4px;
|
|
361
361
|
flex: 1;
|
|
362
362
|
min-width: 0;
|
|
363
|
-
`,
|
|
363
|
+
`,au=g.div`
|
|
364
364
|
min-width: 0;
|
|
365
365
|
white-space: pre;
|
|
366
366
|
overflow-x: auto;
|
|
367
|
-
`,
|
|
367
|
+
`,iu=g.div`
|
|
368
368
|
position: absolute;
|
|
369
369
|
top: 50%;
|
|
370
370
|
right: 8px;
|
|
@@ -373,24 +373,24 @@ import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{useEffect
|
|
|
373
373
|
pointer-events: none;
|
|
374
374
|
transition: opacity 0.15s ease;
|
|
375
375
|
|
|
376
|
-
${
|
|
376
|
+
${nu}:hover & {
|
|
377
377
|
opacity: 1;
|
|
378
378
|
pointer-events: auto;
|
|
379
379
|
}
|
|
380
|
-
`,
|
|
380
|
+
`,lu=({name:n,summary:o,onJumpToRule:a})=>e(nu,{children:[e(ou,{children:[n&&t(se,{size:de.XXXS,color:ce.Secondary,nowrap:!0,children:n}),t(au,{children:t(S,{parts:o})})]}),a&&t(iu,{children:t($e,{text:qe.OPEN_IN_SAMPLING_PAGE,children:t(pe,{"data-id":"sampling-rule-jump",variant:me.Primary,size:he.S,leftIcon:Ji,onClick:a})})})]}),ru=g.div`
|
|
381
381
|
opacity: 0;
|
|
382
382
|
pointer-events: none;
|
|
383
383
|
transition: opacity 0.15s ease;
|
|
384
|
-
`,
|
|
385
|
-
&:hover ${
|
|
384
|
+
`,su=g.div`
|
|
385
|
+
&:hover ${ru} {
|
|
386
386
|
opacity: 1;
|
|
387
387
|
pointer-events: auto;
|
|
388
388
|
}
|
|
389
|
-
`,
|
|
389
|
+
`,cu=g.div`
|
|
390
390
|
display: flex;
|
|
391
391
|
align-items: center;
|
|
392
392
|
padding: 4px 12px;
|
|
393
|
-
`,
|
|
393
|
+
`,du=({source:e,onRedirectToSampling:n})=>t(Pt,{bgTint:"1000",richTitle:{title:qe.CONTAINERS,badge:{label:e.containers?.length??0}},children:e.containers?.map(e=>t(hu,{container:e,onRedirectToSampling:n},e.containerName))});var uu;!function(e){e.All="all",e.Noisy="noisy",e.HighlyRelevant="highly-relevant",e.CostReduction="cost-reduction"}(uu||(uu={}));const pu=e=>"noisy"===e.type?w(e.rule,"source"):"highlyRelevant"===e.type?x(e.rule,"source"):"costReduction"===e.type?k(e.rule,"source"):[],hu=({container:n,onRedirectToSampling:o})=>{const[i,l]=r(uu.All),s=ln(e=>e.setPendingViewSamplingRule),c=n.agentConfig?.traces?.headSampling?.noisyOperations??[],d=a(()=>(n.collectorConfig?.tailSampling?.noisyOperations??[]).map(e=>({type:"noisy",rule:e})),[n.agentConfig?.traces?.headSampling?.noisyOperations]),u=a(()=>(n.collectorConfig?.tailSampling?.highlyRelevantOperations??[]).map(e=>({type:"highlyRelevant",rule:e})),[n.collectorConfig?.tailSampling?.highlyRelevantOperations]),p=a(()=>(n.collectorConfig?.tailSampling?.costReductionRules??[]).map(e=>({type:"costReduction",rule:e})),[n.collectorConfig?.tailSampling?.costReductionRules]),h=a(()=>i===uu.Noisy?d:i===uu.HighlyRelevant?u:i===uu.CostReduction?p:[...d,...u,...p],[i,u,p]),m=d.length+u.length+p.length,g=a(()=>(e,t)=>{s({ruleId:e,category:t}),o()},[o,s]),f=t(ru,{children:t(pe,{"data-id":"sampling-container-create-rule",variant:me.Secondary,size:he.S,label:Tn,rightIcon:yi,onClick:e=>{e.stopPropagation(),o()}})});return t(su,{children:e(Pt,{bgTint:"900",richTitle:{title:n.containerName},renderOnRightSide:f,withCollapse:!0,collapseIsDefaultOpen:!0,children:[c.length?e(Pt,{bgTint:"800",richTitle:{title:qe.HEAD_SAMPLING,badge:{label:c.length}},children:[t(se,{size:de.XXS,children:qe.NOISY_OPERATIONS}),t(q,{$gap:4,children:c.map(e=>t(lu,{name:e.name,summary:w(e),onJumpToRule:()=>g(e.ruleId,"noisy")},e.ruleId))})]}):t(cu,{children:t(se,{size:de.XS,color:ce.Secondary,children:qe.HEAD_SAMPLING})}),m?e(Pt,{bgTint:"800",richTitle:{title:qe.TAIL_SAMPLING,badge:{label:m}},children:[t(ge,{options:(b=d.length,y=u.length,v=p.length,[{value:uu.All,label:"All",badge:{label:b+y+v,textSize:de.XXXS}},{value:uu.Noisy,label:qe.NOISY_OPERATIONS,badge:{label:b,textSize:de.XXXS}},{value:uu.HighlyRelevant,label:qe.HIGHLY_RELEVANT_OPERATIONS,badge:{label:y,textSize:de.XXXS}},{value:uu.CostReduction,label:qe.COST_REDUCTION_OPERATIONS,badge:{label:v,textSize:de.XXXS}}]),selected:i,setSelected:l}),t(q,{$gap:4,children:h.length?h.map(e=>t(lu,{name:e.rule.name,summary:pu(e),onJumpToRule:()=>g(e.rule.ruleId,e.type)},e.rule.ruleId)):t(Ae,{title:`No ${i===uu.All?`${uu.Noisy}, ${uu.HighlyRelevant} and ${uu.CostReduction}`:i} operations`})})]}):t(cu,{children:t(se,{size:de.XS,color:ce.Secondary,children:qe.TAIL_SAMPLING})})]})});var b,y,v},mu=[un.Deployment,un.StatefulSet,un.DaemonSet,un.DeploymentConfig,un.Rollout,un.Pod];var gu;!function(e){e.Workload="Workload",e.Pod="Pod"}(gu||(gu={}));const fu=e=>!!e&&qt(e.status)===Pe.Error,bu=e=>fu(e.healthStatus),yu=e=>fu(e.odigosHealthStatus)||(e.processes??[]).some(bu),vu=e=>fu(e.agentInjectedStatus)||fu(e.odigosHealthStatus)||(e.containers??[]).some(yu),Cu=({onClose:n,sourceId:s,onRedirectToSampling:c})=>{const d=f(),{isVm:u}=v(),{sourcesApi:p,configApi:h}=yl(),{selectedStreamName:m}=Ze(),{genericForm:g,loadSource:b,validateFormData:y}=jl(),{data:C}=h.useEffectiveConfig(),[S,w]=r(!1),[x,k]=r(!1),[T,$]=r(!1),[I,E]=r(fc.Overview),[A,N]=r(null),[O,R]=r({openFor:null}),D=(()=>{const[e,t]=r(null),n=l(e=>{t({tab:fc.Pods,podName:e.podName})},[]),o=l((e,n)=>{t({tab:fc.Pods,podName:e.podName,containerName:n.containerName})},[]),i=l((e,n,o)=>{const a=wc({identifyingAttributes:o.identifyingAttributes});t({tab:fc.Pods,podName:e.podName,containerName:n.containerName,processPid:a})},[]),s=l(()=>t(null),[]);return a(()=>({jumpToTarget:e,jumpToPod:n,jumpToContainer:o,jumpToProcess:i,clearJumpToTarget:s}),[e,n,o,i,s])})();o(()=>{D.jumpToTarget&&E(D.jumpToTarget.tab)},[D.jumpToTarget]),o(()=>{A&&JSON.stringify(rn(s))!==JSON.stringify(rn(A))&&N(null)},[s,A]);const P=i(!1),F=l(async()=>N(await p.fetchById(s)||null),[s,p]);o(()=>{if(P.current||(F(),P.current=!0),!S){const e=setInterval(()=>F(),3e3);return()=>clearInterval(e)}},[F,S]),o(()=>{A&&b(A)},[A]);const L=A&&mu.includes(A.id.kind),M=a(()=>{const e=[],n=(A?.pods??[]).some(vu);return e.push({value:fc.Overview,label:qe.OVERVIEW}),u||(e.push({value:fc.Pods,label:qe.PODS,icon:n?e=>t(Vi,{...e,fill:d.v2.colors.red[500]}):void 0}),e.push({value:fc.PeerSources,label:qe.PEER_SOURCES}),C?.profiling?.enabled&&e.push({value:fc.Profiling,label:qe.PROFILING}),e.push({value:fc.Sampling,label:qe.SAMPLING}),e.push({value:fc.Debug,label:qe.DEBUG})),e},[u,C,A?.pods]),_=l(()=>w(!0),[]),z=a(()=>()=>{n(),c()},[n,c]),B=l(()=>{A&&b(A),w(!1)},[A]),X=l(async()=>{if(!A||!g)return;const{errorMessage:e,preparedFormData:t}=y();if(e)return;const n=t.otelServiceName!==A.id.name?t.otelServiceName:"";await p.update(s,{...t,otelServiceName:n}),w(!1)},[A,g,y,s,p]),V=l(()=>k(!0),[]),U=l(async()=>{A&&(await p.persistV2({[At]:[{namespace:A.id.namespace,name:A.id.name,kind:A.id.kind,selected:!1,currentStreamName:m}]}),k(!1),n())},[A,p,m,n]),j=l(()=>{R({openFor:gu.Workload})},[]),G=l(e=>{E(e),D.clearJumpToTarget()},[D]),H=l(async()=>{await p.recoverFromRollback(s)},[p,s]),W=l(()=>R({openFor:null}),[]),K=l(async()=>{O.openFor===gu.Workload?await p.restartWorkloads([s]):O.openFor===gu.Pod&&O.podNamespace&&O.podName&&await p.restartPod(O.podNamespace,O.podName),W()},[O,p,s,W]),Y=a(()=>{const{kind:e,name:t}=s;return{title:`Rollout ${e}`,description:`Are you sure you want to rollout the ${e.toLowerCase()} "${t}"?`}},[s]),J=a(()=>{const e=[];return S||I===fc.Overview&&(e.push({id:"edit-source-btn-edit",label:Dt.EDIT,icon:ki,active:S,onClick:_}),!u&&L&&e.push({id:"edit-source-btn-restart",label:qe.ROLLOUT,icon:tl,onClick:j}),e.push({id:"edit-source-btn-delete",label:Dt.UNINSTRUMENT,icon:bi,color:d.v2.colors.red[500],active:x,onClick:V})),e},[I,S,x,u,L,_,j,V,d]),Z=a(()=>{if(!A)return[];const e=[],t={backgroundColor:"transparent",textSize:de.S};return e.push({...t,label:A.id.name,leftIcon:u?void 0:Bi}),A.serviceName&&A.serviceName!==A.id.name&&e.push({...t,label:A.serviceName,leftIcon:zi,textColor:d.v2.colors.silver[200]}),e},[A,d,u]);if(!A)return t(le,{isOpen:!0,children:t(ht,{$height:"80vh",children:t(yt,{withSpinner:!0})})});const Q=I===fc.Profiling?T?"95vw":"fit-content":S?void 0:"60vw";return e(Oc,{value:D,children:[t(le,{isOpen:!0,width:Q,minWidth:"777px",header:{icon:u?nl:$n(A.containers)[0],titleBadges:Z,onClose:()=>{G(fc.Overview),N(null),$(!1),n()},actions:J},footer:{actions:S?[{"data-id":"edit-source-btn-cancel",label:Dt.CANCEL,variant:me.Secondary,onClick:B},{"data-id":"edit-source-btn-save",label:Dt.SAVE,variant:me.Primary,onClick:X}]:[]},children:t(ut,{$padding:"4px 12px 12px",children:e(q,{$gap:16,children:[!S&&M.length>1&&t(ge,{options:M,selected:I,setSelected:G}),(()=>{switch(I){case fc.Overview:return S?t(ys,{}):t(hd,{source:A,onClickRollout:j,onClickRollback:H});case fc.Pods:return t(Lc,{source:A,onClickRestartPod:L?(e,t)=>R({openFor:gu.Pod,podNamespace:e,podName:t}):void 0});case fc.PeerSources:return t(Mc,{source:A});case fc.Profiling:return t(tu,{source:A,onFlameFullscreenChange:$});case fc.Sampling:return t(du,{source:A,onRedirectToSampling:z});case fc.Debug:return t(Vc,{source:A});default:return null}})()]})})}),t(Dl,{target:"source",action:"uninstrument",isOpen:x,onClose:()=>k(!1),onApprove:U}),t(Je,{isOpen:O.openFor===gu.Workload,title:Y.title,description:Y.description,onClose:W,denyButton:{label:"Go back",variant:me.Secondary,onClick:W},approveButton:{label:Dt.CONFIRM,variant:me.Primary,onClick:K}}),t(Dl,{target:"pod",action:"restart",description:qe.ROLLOUT_RESTART_WORKLOADS_DESCRIPTION,isOpen:O.openFor===gu.Pod,onClose:W,onApprove:K,overrideApproveButtonLabel:qe.DELETE_POD_TO_RESTART})]})},Su=g.div`
|
|
394
394
|
display: flex;
|
|
395
395
|
align-items: center;
|
|
396
396
|
gap: 8px;
|
|
@@ -400,9 +400,9 @@ import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{useEffect
|
|
|
400
400
|
&:hover {
|
|
401
401
|
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
402
402
|
}
|
|
403
|
-
`,
|
|
403
|
+
`,wu=g.div`
|
|
404
404
|
flex: 1;
|
|
405
|
-
`,
|
|
405
|
+
`,xu=({onClick:n})=>{const o=f().v2.colors.red[500];return e(Su,{"data-id":"sampling-view-btn-delete",onClick:n,children:[t(se,{size:de.XS,weight:500,color:o,children:Nn}),t(bi,{size:16,fill:o})]})};function ku(o){if(o.isEditing){const{onCancelEdit:a,onSave:i,onDelete:l,duplicateWarning:r}=o;return{children:e(n,{children:[t(xu,{onClick:l}),r&&t(De,{status:Pe.Warning,message:r.message,action:r.onViewRule?{"data-id":"sampling-view-edit-btn-view-duplicate",label:"View rule",onClick:r.onViewRule}:void 0}),t(wu,{}),t(pe,{"data-id":"sampling-view-edit-btn-cancel",label:In,variant:me.Secondary,size:he.S,onClick:a}),t(pe,{"data-id":"sampling-view-edit-btn-save",label:En,variant:me.Primary,size:he.S,onClick:i,disabled:!!r})]})}}const{onDelete:a,onCancel:i,onEdit:l}=o;return{children:e(n,{children:[t(xu,{onClick:a}),t(wu,{}),t(pe,{"data-id":"sampling-view-btn-cancel",label:In,variant:me.Secondary,size:he.S,onClick:i}),t(pe,{"data-id":"sampling-view-btn-edit",label:An,variant:me.Primary,size:he.S,onClick:l})]})}}const Tu={[Hl.EditAutoNoisy]:{title:jn,subTitle:Un,cancelId:"sampling-edit-auto-rule-btn-cancel",saveId:"sampling-edit-auto-rule-btn-save"},[Hl.EditAutoCostReduction]:{title:Vn,subTitle:Xn,cancelId:"sampling-edit-cost-reduction-auto-rule-btn-cancel",saveId:"sampling-edit-cost-reduction-auto-rule-btn-save"},[Hl.EditAutoHighlyRelevant]:{title:Bn,subTitle:zn,cancelId:"sampling-edit-highly-relevant-auto-rule-btn-cancel",saveId:"sampling-edit-highly-relevant-auto-rule-btn-save"}},$u=({isOpen:e,title:n,subTitle:o,onClose:a,footer:i,renderBody:l})=>t(le,{isOpen:e,width:Hn,header:{icon:ol,title:n,subTitle:o,onClose:a},footer:i,children:l?l():t(ut,{$padding:"12px",children:t(ks,{})})}),Iu=({isOpen:i,onClose:s,onSubmit:c,validateForm:d,onNavigateToDuplicate:u})=>{const{category:p,formData:h,resetForm:m,duplicateWarning:g,setDuplicateWarning:f}=Gl(Hl.Create),[b,y]=r(!1);o(()=>{i&&(m(),y(!1))},[i]);const v=l(()=>{y(!1),c(h)},[h,c]),C=l(()=>{if(d){const e=d(h);if(e)return void f(e)}!function(e,t){return JSON.stringify(e)===JSON.stringify(T(t))}(h,p)?v():y(!0)},[h,p,d,f,v]),S=a(()=>b?function(e,t){switch(e){case"noisy":return w(E(t));case"highlyRelevant":return x(I(t));case"costReduction":return k($(t))}}(p,h):[],[b,p,h]),A={note:g?{status:Pe.Warning,message:g.message,action:u?{"data-id":"sampling-create-btn-view-duplicate",label:"View rule",onClick:()=>u(g.ruleId)}:void 0}:void 0,actions:[{"data-id":"sampling-create-btn-cancel",label:In,variant:me.Secondary,size:he.S,onClick:s},{"data-id":"sampling-create-btn-submit",label:Tn,variant:me.Primary,size:he.S,onClick:C,disabled:!!g}]};return e(n,{children:[t($u,{isOpen:i,title:Pn[p],subTitle:On[p],onClose:s,footer:A}),t(Je,{isOpen:b,title:Mn,description:Ln,onClose:()=>y(!1),denyButton:{"data-id":"sampling-create-default-continue-editing",label:Fn,variant:me.Secondary,onClick:()=>y(!1)},approveButton:{"data-id":"sampling-create-default-confirm",label:Tn,variant:me.Primary,onClick:v},children:e(q,{$gap:8,$alignItems:"flex-start",style:{width:"100%"},children:[t(se,{size:de.XS,weight:500,color:ce.Secondary,children:_n}),t("div",{style:{width:"100%"},children:t(xl,{summary:S})})]})})]})},Eu=({onClose:e,onDelete:n,onSaveEdit:o,validateForm:i,onNavigateToDuplicate:r})=>{const{data:s,isEditing:c,formData:d,handleEdit:u,handleCancelEdit:p,duplicateWarning:h,setDuplicateWarning:m}=Gl(Hl.View),g=s?.rule.name||Dn,f=c&&s?Rn[s.category]:`${g} preview`,b=l(()=>{if(s&&c){if(i){const e=i(d);if(e)return void m(e)}o(d,s.rule.ruleId,s.samplingId),p()}},[s,c,d,o,i,m,p]),y=l(()=>{s&&n(s.rule.ruleId,s.samplingId)},[s,n]),v=a(()=>{if(!s)return;const t=h?{message:h.message,onViewRule:r?()=>r(h.ruleId):void 0}:null;return ku(c?{isEditing:!0,onCancelEdit:p,onSave:b,onDelete:y,duplicateWarning:t}:{isEditing:!1,onDelete:y,onCancel:e,onEdit:u})},[s,c,h,p,b,y,u,e,r]);return t($u,{isOpen:!!s,title:f,subTitle:s?On[s.category]:"",onClose:e,footer:v})},Au=({isOpen:e,onClose:n,onSave:o})=>{const{localEnabled:a,resolvedPercentage:i}=Gl(Hl.EditAutoNoisy),r=l(()=>o(a,i),[o,a,i]);return t(Ru,{formType:Hl.EditAutoNoisy,isOpen:e,onClose:n,onSave:r})},Nu=({isOpen:e,onClose:n,onSave:o})=>{const{localEnabled:a,resolvedPercentage:i}=Gl(Hl.EditAutoCostReduction),r=l(()=>o(a,i),[o,a,i]);return t(Ru,{formType:Hl.EditAutoCostReduction,isOpen:e,onClose:n,onSave:r})},Ou=({isOpen:e,onClose:n,onSave:o})=>{const{localEnabled:a}=Gl(Hl.EditAutoHighlyRelevant),i=l(()=>o(a),[o,a]);return t(Ru,{formType:Hl.EditAutoHighlyRelevant,isOpen:e,onClose:n,onSave:i})},Ru=({formType:e,isOpen:n,onClose:o,onSave:a})=>{const i=Tu[e];return t($u,{isOpen:n,title:i.title,subTitle:i.subTitle,onClose:o,footer:{actions:[{"data-id":i.cancelId,label:In,variant:me.Secondary,size:he.S,onClick:o},{"data-id":i.saveId,label:Gn,variant:me.Primary,size:he.S,onClick:a}]}})},Du=e=>{switch(e.formType){case Hl.Create:return t(Zl,{formType:Hl.Create,category:e.category,sourceOptions:e.sourceOptions,namespaceOptions:e.namespaceOptions,children:t(Iu,{...e})});case Hl.View:return t(Zl,{formType:Hl.View,data:e.data,defaultEditMode:e.defaultEditMode,sourceOptions:e.sourceOptions,namespaceOptions:e.namespaceOptions,children:t(Eu,{...e})});case Hl.EditAutoNoisy:return t(Zl,{formType:Hl.EditAutoNoisy,enabled:e.enabled,keepPercentage:e.keepPercentage,children:t(Au,{...e})});case Hl.EditAutoCostReduction:return t(Zl,{formType:Hl.EditAutoCostReduction,enabled:e.enabled,dropPercentage:e.dropPercentage,children:t(Nu,{...e})});case Hl.EditAutoHighlyRelevant:return t(Zl,{formType:Hl.EditAutoHighlyRelevant,enabled:e.enabled,children:t(Ou,{...e})})}},Pu=({token:o,isLoading:a,isEditing:i,onEdit:l,onCancel:r,onSave:s,formData:c,handleFormChange:d,handleErrorChange:u,formErrors:p})=>{const{CopyButton:h}=hn(),m=!i||a||!c.newToken;return Wn({key:"Enter",active:!m},s),e(ue,i?{$justifyContent:"space-between",$alignItems:"flex-start",$gap:12,children:[t(Se,{type:"password",value:c.newToken,onChange:e=>{d("newToken",e.target.value),u("newToken",void 0)},width:"430px",autoFocus:!0,errorMessage:p.newToken}),t(ue,{$margin:a?"8px 0 0 0":"2px 0 0 0",$alignItems:"center",children:a?t(yt,{title:"Saving...",withGradient:!0}):e(n,{children:[t(pe,{variant:me.Secondary,size:he.S,leftIcon:Di,onClick:r,disabled:a}),t(pe,{variant:me.Primary,size:he.S,leftIcon:Ri,onClick:s,disabled:m})]})})]}:{$justifyContent:"space-between",$gap:12,children:[t(se,{size:de.XS,children:new Array(55).fill("•").join("")}),e(ue,{$alignItems:"center",$justifyContent:"space-between",children:[t(h,{value:o}),t(ft,{icon:ki,onClick:l})]})]})},Fu=({expiresAt:e,callbackValid:n,callbackExpired:i})=>{const{formatTimeAgo:l}=Ht(),r=a(()=>l(e),[e,l]),s=a(()=>new Date(e).toDateString().split(" ").slice(1).join(" "),[e]),c=a(()=>Kn(e,0)?Pe.Error:Kn(e,2592e6)?Pe.Warning:Pe.Success,[e]),d=a(()=>c===Pe.Success?Ri:c===Pe.Warning?al:Vi,[c]);return o(()=>{c===Pe.Success?n():c===Pe.Error&&i()},[c]),t($e,{text:s,children:t(We,{leftIcon:d,label:r,status:c,invertColors:!0,useSecondaryTone:!0})})},Lu=g.div`
|
|
406
406
|
display: flex;
|
|
407
407
|
flex-direction: column;
|
|
408
408
|
gap: 12px;
|
|
@@ -410,7 +410,7 @@ import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{useEffect
|
|
|
410
410
|
border-radius: 12px;
|
|
411
411
|
border: 1px solid ${({theme:e,$isExpired:t})=>t?e.v2.colors.red[500]:e.v2.colors.silver[600]};
|
|
412
412
|
background-color: ${({theme:e,$isExpired:t})=>t?e.v2.colors.red[1e3]:e.v2.colors.silver[800]};
|
|
413
|
-
`,
|
|
413
|
+
`,Mu=({children:e})=>{const n=f();return t(se,{size:de.XXXS,color:n.v2.colors.grey[150],children:e})},_u=({token:n})=>{const{tokensApi:o}=yl(),[a,i]=r(!1),[l,s]=r(!1),[c,d]=r(!1),{formData:u,handleFormChange:p,formErrors:h,handleErrorChange:m,resetFormData:g}=Mt({newToken:""});return t(rt,{richTitle:{icon:il,title:"Odigos Pro Token"},children:e(Lu,{$isExpired:c,children:[e(ue,{$justifyContent:"space-between",children:[e(q,{$gap:4,children:[t(Mu,{children:"Issued for"}),t(se,{size:de.XS,children:n.name||"N/A"})]}),e(q,{$gap:4,children:[t(Mu,{children:"Expiration"}),t(Fu,{expiresAt:n.expiresAt,callbackValid:()=>d(!1),callbackExpired:()=>d(!0)})]}),t(q,{})]}),t(ue,{children:e(q,{children:[t(Mu,{children:"Token"}),t(Pu,{token:n.token,newToken:u.newToken,isLoading:a,isEditing:l,onEdit:()=>s(!0),onCancel:()=>(s(!1),void p("newToken","")),onSave:()=>(async()=>{if(!o.updateToken)return;i(!0);const e=await o.updateToken(u.newToken.trim());i(!1),e?.error?m("newToken",e.error):(s(!1),g())})(),formData:u,handleFormChange:p,handleErrorChange:m,formErrors:h})]})})]})})},zu=g.div`
|
|
414
414
|
display: flex;
|
|
415
415
|
flex-direction: column;
|
|
416
416
|
align-items: center;
|
|
@@ -419,23 +419,23 @@ import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{useEffect
|
|
|
419
419
|
padding: 12px 24px;
|
|
420
420
|
border-radius: 8px;
|
|
421
421
|
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
422
|
-
`,Nu=()=>{const{progress:n}=$t(),{describeApi:o,namespacesApi:a}=gl(),{items:i}=a.useNamespaces(),[l,s]=r(null),{formData:c,handleFormChange:d,resetFormData:u}=Lt({includeProfiles:!0,includeMetrics:!0,includeSourceWorkloads:!1,sourceWorkloadNamespaces:[]});return t(lt,{richTitle:{icon:al,title:"Diagnose"},children:l?e(Au,{children:[t(bt,{title:"Creating file...",subTitle:"This may take a few moments. Do not refresh the page.",withGradient:!0,withSpinner:"number"==typeof n[At.DownloadingDiagnose]?.percentage,percentage:n[At.DownloadingDiagnose]?.percentage,withVisual:"number"!=typeof n[At.DownloadingDiagnose]?.percentage,visualIcon:Zi,startedAt:l}),n[At.DownloadingDiagnose]?.list?.length&&t(q,{$width:"100%",children:n[At.DownloadingDiagnose].list.map((n,o)=>e(ue,{$gap:4,$alignItems:"center",children:[n.status===Re.Success?t(Ni,{size:16}):n.status===Re.Error?t(Oi,{size:16}):t(bt,{withSpinnerOld:!0,scaleSpinnerOld:.7}),t(se,{size:de.XXXS,color:ce.Secondary,children:n.label})]},`diagnose-item-${o}-${n.label}`))})]}):e(q,{$gap:24,children:[t(se,{size:de.XXS,color:ce.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(q,{$gap:16,children:[e(ue,{$gap:8,children:[t(Q,{label:"Profiles",value:c.includeProfiles,onChange:e=>d("includeProfiles",e),tooltip:"Note: Adds 30s to diagnose download time to collect Profiles"}),t(se,{size:de.XXXS,color:ce.Secondary,children:"Include pprof profiles"})]}),e(ue,{$gap:8,children:[t(Q,{label:"Metrics",value:c.includeMetrics,onChange:e=>d("includeMetrics",e)}),t(se,{size:de.XXXS,color:ce.Secondary,children:"Include Prometheus metrics"})]}),e(ue,{$gap:8,children:[t(Q,{label:"Source Workloads",value:c.includeSourceWorkloads,onChange:e=>{d("includeSourceWorkloads",e),e&&d("sourceWorkloadNamespaces",[])}}),t(se,{size:de.XXXS,color:ce.Secondary,children:"Include workload and pod manifests for instrumented sources"})]})]}),t(Kn,{alignX:Jn.Left,alignY:Yn.Bottom,items:i.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:me.Secondary,disabled:c.includeSourceWorkloads,leftIcon:c.sourceWorkloadNamespaces.length?()=>t(je,{label:c.sourceWorkloadNamespaces.length,status:Re.Default}):void 0}}),t(ue,{$justifyContent:"flex-end",children:t(pe,{label:"Download Diagnose",rightIcon:Zi,variant:me.Primary,onClick:async()=>{o.downloadDiagnose&&(s(Date.now()),await o.downloadDiagnose(c),s(null),u())},disabled:null!==l})})]})})},Ou=()=>{const{platformType:e,version:n,tier:a}=y(),{describeApi:i}=gl(),[l,s]=r(null);return o(()=>{i.fetchDescribeOdigos&&i.fetchDescribeOdigos().then(({data:e})=>s(e?.describeOdigos??null))},[]),t(lt,{richTitle:{icon:Hi,title:"General Information"},children:t(Dt,{cellsPerRow:2,items:[{id:qn(),title:"Odigos Version",label:n},{id:qn(),title:`${e.toUpperCase()} Version`,label:l?.kubernetesVersion?.value||"-"},{id:qn(),title:"Installation Method",label:l?.installationMethod?.value||"-"},{id:qn(),title:"Tier",label:a}]})})},Ru=({isOpen:n,onClose:o})=>{const{describeApi:a,tokensApi:i}=gl(),l=i.useTokens().items[0];return e(le,{isOpen:n,header:{icon:Hi,title:"System Overview",onClose:o},children:[a.fetchDescribeOdigos&&t(Ou,{}),i.updateToken&&l&&t(Eu,{token:l}),a.downloadDiagnose&&t(Nu,{})]})},Du=({isOpen:o,onClose:a,onCloseEnd:i})=>{const{addDataStreams:r,setSelectedStreamName:s}=qe(),{dataStreamsApi:c}=gl(),{requestSubmit:d}=Bl(),u=l(async e=>{c.create?await c.create(e):(r([e]),s(e.name)),a()},[c,r,s,a]),p=l(()=>d(u),[d,u]);return jn({key:"Enter",active:o},p),e(n,{children:[t(Ye,{isOpen:o,onClose:a,onCloseEnd:i,title:Je.NAME_YOUR_STREAM,description:Je.STREAM_DESCRIPTION,approveButton:{"data-id":"add-stream-btn-done",label:Rt.DONE,variant:me.Primary,onClick:p},denyButton:{"data-id":"add-stream-btn-cancel",label:Rt.CANCEL,variant:me.Secondary,onClick:a},children:t(rs,{autoFocus:!0})}),t(ls,{})]})},Pu=({isOpen:a,onClose:i,onCloseEnd:r,dataStreamName:s})=>{const{dataStreamsApi:c}=gl(),{genericForm:d,loadDataStream:u,requestSubmit:p}=Bl();o(()=>{a&&s&&u(s)},[a,s]);const h=!!d?.isFormDirty,m=l(async e=>{await c.update(s,e),i()},[c,s,i]),g=l(()=>p(m),[p,m]);return jn({key:"Enter",active:a},g),e(n,{children:[t(Ye,{isOpen:a,onClose:i,onCloseEnd:r,title:Je.RENAME_STREAM(s),description:Je.STREAM_DESCRIPTION,approveButton:{"data-id":"edit-stream-btn-save",label:Rt.SAVE,variant:me.Primary,onClick:g,disabled:!h},denyButton:{"data-id":"edit-stream-btn-cancel",label:Rt.CANCEL,variant:me.Secondary,onClick:i},children:t(rs,{autoFocus:!0})}),t(ls,{})]})},Fu=({scale:n=1})=>e("svg",{width:742*n,height:533*n,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)"})})]})]}),Lu=g.div`
|
|
422
|
+
`,Bu=()=>{const{progress:n}=It(),{describeApi:o,namespacesApi:a}=yl(),{items:i}=a.useNamespaces(),[l,s]=r(null),{formData:c,handleFormChange:d,resetFormData:u}=Mt({includeProfiles:!0,includeMetrics:!0,includeSourceWorkloads:!1,sourceWorkloadNamespaces:[]});return t(rt,{richTitle:{icon:ll,title:"Diagnose"},children:l?e(zu,{children:[t(yt,{title:"Creating file...",subTitle:"This may take a few moments. Do not refresh the page.",withGradient:!0,withSpinner:"number"==typeof n[Nt.DownloadingDiagnose]?.percentage,percentage:n[Nt.DownloadingDiagnose]?.percentage,withVisual:"number"!=typeof n[Nt.DownloadingDiagnose]?.percentage,visualIcon:el,startedAt:l}),n[Nt.DownloadingDiagnose]?.list?.length&&t(q,{$width:"100%",children:n[Nt.DownloadingDiagnose].list.map((n,o)=>e(ue,{$gap:4,$alignItems:"center",children:[n.status===Pe.Success?t(Ri,{size:16}):n.status===Pe.Error?t(Di,{size:16}):t(yt,{withSpinnerOld:!0,scaleSpinnerOld:.7}),t(se,{size:de.XXXS,color:ce.Secondary,children:n.label})]},`diagnose-item-${o}-${n.label}`))})]}):e(q,{$gap:24,children:[t(se,{size:de.XXS,color:ce.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(q,{$gap:16,children:[e(ue,{$gap:8,children:[t(Q,{label:"Profiles",value:c.includeProfiles,onChange:e=>d("includeProfiles",e),tooltip:"Note: Adds 30s to diagnose download time to collect Profiles"}),t(se,{size:de.XXXS,color:ce.Secondary,children:"Include pprof profiles"})]}),e(ue,{$gap:8,children:[t(Q,{label:"Metrics",value:c.includeMetrics,onChange:e=>d("includeMetrics",e)}),t(se,{size:de.XXXS,color:ce.Secondary,children:"Include Prometheus metrics"})]}),e(ue,{$gap:8,children:[t(Q,{label:"Source Workloads",value:c.includeSourceWorkloads,onChange:e=>{d("includeSourceWorkloads",e),e&&d("sourceWorkloadNamespaces",[])}}),t(se,{size:de.XXXS,color:ce.Secondary,children:"Include workload and pod manifests for instrumented sources"})]})]}),t(Yn,{alignX:qn.Left,alignY:Jn.Bottom,items:i.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:me.Secondary,disabled:c.includeSourceWorkloads,leftIcon:c.sourceWorkloadNamespaces.length?()=>t(We,{label:c.sourceWorkloadNamespaces.length,status:Pe.Default}):void 0}}),t(ue,{$justifyContent:"flex-end",children:t(pe,{label:"Download Diagnose",rightIcon:el,variant:me.Primary,onClick:async()=>{o.downloadDiagnose&&(s(Date.now()),await o.downloadDiagnose(c),s(null),u())},disabled:null!==l})})]})})},Xu=()=>{const{platformType:e,version:n,tier:a}=v(),{describeApi:i}=yl(),[l,s]=r(null);return o(()=>{i.fetchDescribeOdigos&&i.fetchDescribeOdigos().then(({data:e})=>s(e?.describeOdigos??null))},[]),t(rt,{richTitle:{icon:Wi,title:"General Information"},children:t(Pt,{cellsPerRow:2,items:[{id:Zn(),title:"Odigos Version",label:n},{id:Zn(),title:`${e.toUpperCase()} Version`,label:l?.kubernetesVersion?.value||"-"},{id:Zn(),title:"Installation Method",label:l?.installationMethod?.value||"-"},{id:Zn(),title:"Tier",label:a}]})})},Vu=({isOpen:n,onClose:o})=>{const{describeApi:a,tokensApi:i}=yl(),l=i.useTokens().items[0];return e(le,{isOpen:n,header:{icon:Wi,title:"System Overview",onClose:o},children:[a.fetchDescribeOdigos&&t(Xu,{}),i.updateToken&&l&&t(_u,{token:l}),a.downloadDiagnose&&t(Bu,{})]})},Uu=({isOpen:o,onClose:a,onCloseEnd:i})=>{const{addDataStreams:r,setSelectedStreamName:s}=Ze(),{dataStreamsApi:c}=yl(),{requestSubmit:d}=Ul(),u=l(async e=>{c.create?await c.create(e):(r([e]),s(e.name)),a()},[c,r,s,a]),p=l(()=>d(u),[d,u]);return Wn({key:"Enter",active:o},p),e(n,{children:[t(Je,{isOpen:o,onClose:a,onCloseEnd:i,title:qe.NAME_YOUR_STREAM,description:qe.STREAM_DESCRIPTION,approveButton:{"data-id":"add-stream-btn-done",label:Dt.DONE,variant:me.Primary,onClick:p},denyButton:{"data-id":"add-stream-btn-cancel",label:Dt.CANCEL,variant:me.Secondary,onClick:a},children:t(bs,{autoFocus:!0})}),t(fs,{})]})},ju=({isOpen:a,onClose:i,onCloseEnd:r,dataStreamName:s})=>{const{dataStreamsApi:c}=yl(),{genericForm:d,loadDataStream:u,requestSubmit:p}=Ul();o(()=>{a&&s&&u(s)},[a,s]);const h=!!d?.isFormDirty,m=l(async e=>{await c.update(s,e),i()},[c,s,i]),g=l(()=>p(m),[p,m]);return Wn({key:"Enter",active:a},g),e(n,{children:[t(Je,{isOpen:a,onClose:i,onCloseEnd:r,title:qe.RENAME_STREAM(s),description:qe.STREAM_DESCRIPTION,approveButton:{"data-id":"edit-stream-btn-save",label:Dt.SAVE,variant:me.Primary,onClick:g,disabled:!h},denyButton:{"data-id":"edit-stream-btn-cancel",label:Dt.CANCEL,variant:me.Secondary,onClick:i},children:t(bs,{autoFocus:!0})}),t(fs,{})]})},Gu=({scale:n=1})=>e("svg",{width:742*n,height:533*n,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)"})})]})]}),Hu=g.div`
|
|
423
423
|
position: absolute;
|
|
424
424
|
top: 50%;
|
|
425
425
|
left: 50%;
|
|
426
426
|
transform: translate(-50%, -50%);
|
|
427
427
|
z-index: ${({theme:e})=>e.v2.zIndex.modal};
|
|
428
|
-
`,
|
|
428
|
+
`,Wu="onboarding-done",Ku=()=>{const{currentModal:n,setCurrentModal:o}=Qn(),a=()=>o("");return e(eo,{isOpen:n===Wu,onClose:a,children:[t(Gu,{}),t(Hu,{children:e(q,{$gap:32,$alignItems:"center",children:[e(q,{$gap:24,$alignItems:"center",children:[t(se,{size:de.L,weight:500,children:"Welcome to"}),t(Ll,{size:260}),t(se,{size:de.S,weight:400,children:"Your observability control plane is ready."})]}),t(pe,{label:"Get Started",rightIcon:vi,onClick:a})]})})]})},Yu=g.div`
|
|
429
429
|
display: flex;
|
|
430
430
|
flex-direction: column;
|
|
431
431
|
gap: 8px;
|
|
432
432
|
padding: 4px 8px;
|
|
433
433
|
border-radius: 8px;
|
|
434
434
|
width: 100%;
|
|
435
|
-
`,
|
|
435
|
+
`,Ju=g.div`
|
|
436
436
|
white-space: pre;
|
|
437
437
|
overflow-x: auto;
|
|
438
|
-
`,
|
|
438
|
+
`,qu=({name:n,recommended:o,toggleLabel:a,enabled:i,onEnabledChange:l,summary:r,toggleName:s})=>{const c=f();return e(Yu,{children:[e(ue,{$gap:8,$justifyContent:"space-between",children:[e(ue,{$gap:4,children:[t(se,{size:de.XS,color:c.v2.colors.white[500],nowrap:!0,children:n}),o&&t(We,{label:to,leftIcon:rl,backgroundColor:c.v2.colors.purple[700],textColor:c.v2.colors.white[500],textSize:de.XXXS})]}),t(oe,{name:s??`sampling-onboarding-toggle-${n}`,label:a,labelAlign:ae.Left,value:i,onChange:l,size:Tt.S})]}),t(Ju,{children:t(S,{parts:r})})]})},Zu=g.div`
|
|
439
439
|
position: relative;
|
|
440
440
|
display: flex;
|
|
441
441
|
align-items: center;
|
|
@@ -445,18 +445,18 @@ import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{useEffect
|
|
|
445
445
|
background-color: ${({theme:e})=>e.v2.colors.black[500]};
|
|
446
446
|
border-top-left-radius: 18px;
|
|
447
447
|
border-top-right-radius: 18px;
|
|
448
|
-
`,
|
|
448
|
+
`,Qu=g.div`
|
|
449
449
|
position: absolute;
|
|
450
450
|
left: 16px;
|
|
451
451
|
top: 50%;
|
|
452
452
|
transform: translateY(-50%);
|
|
453
|
-
`,
|
|
453
|
+
`,ep=g.div`
|
|
454
454
|
height: 16px;
|
|
455
455
|
width: 100%;
|
|
456
456
|
background-color: ${({theme:e})=>e.v2.colors.black[500]};
|
|
457
457
|
border-top-left-radius: 18px;
|
|
458
458
|
border-top-right-radius: 18px;
|
|
459
|
-
`,
|
|
459
|
+
`,tp=g.div`
|
|
460
460
|
width: ${({$width:e})=>e}px;
|
|
461
461
|
display: flex;
|
|
462
462
|
flex-direction: column;
|
|
@@ -464,7 +464,7 @@ import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{useEffect
|
|
|
464
464
|
gap: 22px;
|
|
465
465
|
padding: 8px 32px 32px 32px;
|
|
466
466
|
background-color: ${({theme:e})=>e.v2.colors.black[500]};
|
|
467
|
-
`,
|
|
467
|
+
`,np=e=>t(sl,{rotate:90,...e}),op=({children:n,center:o,onNext:a,nextLabel:i=no,nextLoading:l})=>e(ue,{$gap:8,$justifyContent:o?"center":"flex-end",$padding:"0 16px 16px 16px",children:[n,a&&t(pe,{"data-id":"sampling-onboarding-btn-next",label:i,rightIcon:np,variant:me.Primary,size:he.M,onClick:a,loading:l})]}),ap=e=>t(sl,{rotate:-90,...e}),ip=({title:n,onBack:o})=>{const a=f();return e(Zu,{$hasBack:!!o,children:[o&&t(Qu,{children:t(ft,{"data-id":"sampling-onboarding-back",icon:ap,size:bt.M,onClick:o})}),t(se,{size:de.M,weight:500,color:a.v2.colors.white[500],align:"center",children:n})]})},lp=g.div`
|
|
468
468
|
box-sizing: border-box;
|
|
469
469
|
width: ${({$width:e})=>e??"100%"};
|
|
470
470
|
${({$fillHeight:e})=>e&&b`
|
|
@@ -477,16 +477,16 @@ import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{useEffect
|
|
|
477
477
|
padding: 16px;
|
|
478
478
|
border-radius: 16px;
|
|
479
479
|
background-color: ${({theme:e})=>e.v2.colors.silver[1e3]};
|
|
480
|
-
`,
|
|
480
|
+
`,rp=({children:e,fillHeight:n,width:o})=>t(lp,{$fillHeight:n,$width:o,children:e}),sp=g.ul`
|
|
481
481
|
margin: 0;
|
|
482
482
|
padding: 0;
|
|
483
483
|
list-style: disc;
|
|
484
|
-
`,
|
|
484
|
+
`,cp=g.li`
|
|
485
485
|
margin-left: 18px;
|
|
486
486
|
& + & {
|
|
487
487
|
margin-top: 6px;
|
|
488
488
|
}
|
|
489
|
-
`,
|
|
489
|
+
`,dp=({items:e,color:n})=>{const o=f(),a=n||o.v2.colors.silver[200];return t(sp,{children:e.map((e,n)=>t(cp,{style:{color:a},children:t(se,{size:de.XXS,color:a,children:e})},n))})},up=({items:n})=>{const o=f();return t(q,{$gap:16,children:n.map((n,a)=>e(ue,{$gap:8,$alignItems:"flex-start",children:[e(se,{size:de.XS,color:o.v2.colors.silver[200],weight:400,children:[a+1,"."]}),e(q,{$gap:2,children:[t(se,{size:de.XS,color:o.v2.colors.white[500],weight:500,children:n.title}),t(se,{size:de.XS,color:o.v2.colors.silver[200],children:n.description})]})]},a))})},pp=({message:e})=>t(De,{status:Pe.Default,message:e,fullWidth:!0,smallIcon:!0}),hp=g.div`
|
|
490
490
|
width: 100%;
|
|
491
491
|
padding: 8px;
|
|
492
492
|
display: flex;
|
|
@@ -494,12 +494,12 @@ import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{useEffect
|
|
|
494
494
|
gap: 4px;
|
|
495
495
|
border-radius: 16px;
|
|
496
496
|
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
497
|
-
`,
|
|
497
|
+
`,mp=g.div`
|
|
498
498
|
display: flex;
|
|
499
499
|
align-items: center;
|
|
500
500
|
gap: 8px;
|
|
501
501
|
padding: 4px 8px 12px 8px;
|
|
502
|
-
`,
|
|
502
|
+
`,gp=g.div`
|
|
503
503
|
width: 100%;
|
|
504
504
|
display: flex;
|
|
505
505
|
flex-direction: column;
|
|
@@ -507,20 +507,20 @@ import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{useEffect
|
|
|
507
507
|
padding: 8px;
|
|
508
508
|
border-radius: 12px;
|
|
509
509
|
background-color: ${({theme:e})=>e.v2.colors.silver[900]};
|
|
510
|
-
`,
|
|
510
|
+
`,fp=({children:e})=>{const n=f();return t(se,{size:de.S,weight:500,color:n.v2.colors.white[500],align:"center",children:e})},bp=g.div`
|
|
511
511
|
white-space: pre-line;
|
|
512
|
-
`,
|
|
512
|
+
`,yp=({enabled:o,onEnabledChange:i,onBack:l,onNext:r})=>{const s=f(),c=a(()=>A({enabled:o,keepPercentage:0}),[o]);return e(n,{children:[t(ip,{title:oo,onBack:l}),e(tp,{$width:854,children:[t(fp,{children:ao}),e(q,{$gap:8,$width:"100%",children:[t(rp,{children:t(bp,{children:t(se,{size:de.XXS,color:s.v2.colors.silver[200],children:io})})}),e(q,{$gap:8,$width:"100%",children:[e(hp,{children:[t(mp,{children:t(se,{size:de.S,weight:500,color:s.v2.colors.white[500],children:lo})}),t(gp,{children:t(qu,{name:so,recommended:!0,toggleLabel:ro,enabled:o,onEnabledChange:i,summary:c,toggleName:"sampling-onboarding-noisy-toggle"})})]}),t(pp,{message:co})]})]})]}),t(op,{onNext:r})]})},vp=e=>t(sl,{rotate:90,...e}),Cp=({onClose:o})=>{const a=f();return e(n,{children:[t(ep,{}),e(tp,{$width:732,children:[t(uo,{icon:ol}),e(q,{$gap:16,$alignItems:"center",$width:"100%",children:[t(se,{size:de.M,weight:500,color:a.v2.colors.white[500],children:po}),ho.split("\n").map((e,n)=>t(fp,{children:e},`subtitle-${n}-${e}`)),e(rp,{children:[t(se,{size:de.XS,color:a.v2.colors.silver[200],children:mo}),t(dp,{color:a.v2.colors.white[500],items:[go,fo,bo]})]})]})]}),t(op,{center:!0,children:t(pe,{"data-id":"sampling-onboarding-btn-go-to",label:yo,rightIcon:vp,variant:me.Primary,size:he.M,onClick:o})})]})},Sp=e=>t(sl,{rotate:90,...e}),wp=g.div`
|
|
513
513
|
display: flex;
|
|
514
514
|
flex-direction: column;
|
|
515
515
|
align-items: center;
|
|
516
516
|
gap: 8px;
|
|
517
517
|
width: 100%;
|
|
518
|
-
`,
|
|
518
|
+
`,xp=({onSkip:o,onNext:a})=>{const i=f();return e(n,{children:[t(ep,{}),e(tp,{$width:732,children:[t(uo,{icon:ol}),e(q,{$gap:16,$alignItems:"center",$width:"100%",children:[e(wp,{children:[t(se,{size:de.M,weight:500,color:i.v2.colors.white[500],children:vo}),t(fp,{children:Co})]}),e(rp,{children:[t(se,{size:de.XS,color:i.v2.colors.silver[200],children:So}),t(up,{items:[{title:xo,description:wo},{title:To,description:ko},{title:Io,description:$o}]}),t(pp,{message:Eo})]})]})]}),e(op,{center:!0,children:[t(pe,{"data-id":"sampling-onboarding-btn-skip",label:Ao,variant:me.Secondary,onClick:o}),t(pe,{"data-id":"sampling-onboarding-btn-start",label:No,rightIcon:Sp,variant:me.Primary,onClick:a})]})]})},kp=g.div`
|
|
519
519
|
display: flex;
|
|
520
520
|
align-items: stretch;
|
|
521
521
|
gap: 16px;
|
|
522
522
|
width: 100%;
|
|
523
|
-
`,
|
|
523
|
+
`,Tp=g.div`
|
|
524
524
|
flex: 1;
|
|
525
525
|
display: flex;
|
|
526
526
|
flex-direction: column;
|
|
@@ -540,18 +540,18 @@ import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{useEffect
|
|
|
540
540
|
background-color: ${t.v2.colors.silver[700]};
|
|
541
541
|
}
|
|
542
542
|
`}
|
|
543
|
-
|
|
543
|
+
`,$p=g.div`
|
|
544
544
|
display: flex;
|
|
545
545
|
align-items: center;
|
|
546
546
|
gap: 8px;
|
|
547
547
|
padding: 12px 16px;
|
|
548
|
-
`,
|
|
548
|
+
`,Ip=g.div`
|
|
549
549
|
flex: 1;
|
|
550
550
|
padding: 8px;
|
|
551
551
|
display: flex;
|
|
552
552
|
flex-direction: column;
|
|
553
553
|
gap: 8px;
|
|
554
|
-
`,
|
|
554
|
+
`,Ep=g.div`
|
|
555
555
|
flex: 1;
|
|
556
556
|
display: flex;
|
|
557
557
|
flex-direction: column;
|
|
@@ -559,17 +559,17 @@ import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{useEffect
|
|
|
559
559
|
padding: 12px;
|
|
560
560
|
border-radius: 12px;
|
|
561
561
|
background-color: ${({theme:e,$selected:t})=>t?e.v2.colors.purple[900]:e.v2.colors.silver[900]};
|
|
562
|
-
`,
|
|
562
|
+
`,Ap=g.div`
|
|
563
563
|
display: flex;
|
|
564
564
|
justify-content: flex-end;
|
|
565
|
-
`,
|
|
565
|
+
`,Np=g.div`
|
|
566
566
|
display: flex;
|
|
567
567
|
align-items: center;
|
|
568
568
|
gap: 8px;
|
|
569
569
|
padding: 4px 12px 4px 4px;
|
|
570
570
|
border-radius: 8px;
|
|
571
571
|
background-color: ${({theme:e})=>e.v2.colors.yellow[1e3]};
|
|
572
|
-
`,
|
|
572
|
+
`,Op=g.div`
|
|
573
573
|
display: flex;
|
|
574
574
|
align-items: center;
|
|
575
575
|
justify-content: center;
|
|
@@ -577,13 +577,13 @@ import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{useEffect
|
|
|
577
577
|
height: 24px;
|
|
578
578
|
border-radius: 6px;
|
|
579
579
|
background-color: ${({theme:e})=>e.v2.colors.yellow[900]};
|
|
580
|
-
`,
|
|
580
|
+
`,Rp=({selected:n,onSelect:o,name:a,description:i,badgeProps:l,bullets:r,warning:s,onReadMore:c})=>{const d=f(),u=n?d.v2.colors.white[500]:d.v2.colors.silver[200];return e(Tp,{$selected:n,onClick:o,children:[e($p,{children:[t(ye,{"data-id":`sampling-onboarding-radio-${a}`,value:n,onChange:o,size:Ce.L}),t(ol,{size:24,fill:d.v2.colors.white[500]}),t(se,{size:de.S,weight:500,color:d.v2.colors.white[500],children:a})]}),e(Ip,{children:[e(Ep,{$selected:n,children:[e(q,{$gap:8,children:[t(We,{...l,textSize:de.XXXS}),t(se,{size:de.XXS,color:u,children:i})]}),r&&r.length>0&&t(dp,{color:u,items:r}),s&&e(Np,{children:[t(Op,{children:t(al,{size:18,fill:d.v2.colors.yellow[500]})}),t(se,{size:de.XXXS,color:d.v2.colors.yellow[500],children:s})]})]}),c&&t(Ap,{children:t(pe,{"data-id":`sampling-onboarding-btn-read-more-${a}`,label:Wo,rightIcon:wi,variant:me.Text,size:he.S,onClick:e=>{e.stopPropagation(),c()}})})]})]})},Dp=({strategy:o,onStrategyChange:a,onBack:i,onNext:l,docsUrl:r})=>{const s=f(),c=r?()=>window.open(r,"_blank"):void 0;return e(n,{children:[t(ip,{title:Oo,onBack:i}),e(tp,{$width:854,children:[t(fp,{children:Ro}),e(kp,{children:[t(Rp,{selected:"keep-list"===o,onSelect:()=>a("keep-list"),name:_o,description:Mo,badgeProps:{label:Lo,backgroundColor:s.v2.colors.purple[500],textColor:s.v2.colors.white[500]},bullets:[Po,Fo],warning:Do,onReadMore:c}),t(Rp,{selected:"drop-list"===o,onSelect:()=>a("drop-list"),name:Uo,description:Vo,badgeProps:{label:Xo,backgroundColor:s.v2.colors.green[500],textColor:s.v2.colors.black[500]},bullets:[zo,Bo],onReadMore:c}),t(Rp,{selected:"advanced"===o,onSelect:()=>a("advanced"),name:Ho,description:Go,badgeProps:{label:jo,backgroundColor:s.v2.colors.blue[700],textColor:s.v2.colors.white[500]},onReadMore:c})]})]}),t(op,{onNext:l})]})},Pp=({onBack:o,onNext:i,submitting:l})=>{const r=f(),s=a(()=>[{title:qo,bullets:[Ko,Yo,Jo]},{title:oa,bullets:[Zo,Qo,ea,ta,na]}],[]);return e(n,{children:[t(ip,{title:aa,onBack:o}),e(tp,{$width:854,children:[t(fp,{children:ia}),t(ue,{$gap:16,$width:"100%",$alignItems:"stretch",children:s.map((n,o)=>e(rp,{fillHeight:!0,width:"50%",children:[t(se,{size:de.XS,color:r.v2.colors.white[500],children:n.title}),t(dp,{items:n.bullets})]},o))}),t(pp,{message:la})]}),t(op,{onNext:i,nextLoading:l})]})},Fp=g.div`
|
|
581
581
|
white-space: pre-line;
|
|
582
|
-
|
|
582
|
+
`,Lp=({errorPresetEnabled:o,onErrorPresetChange:i,onBack:l,onNext:r,submitting:s})=>{const c=f(),d=a(()=>N(o?{disabled:!1}:null),[o]);return e(n,{children:[t(ip,{title:ra,onBack:l}),e(tp,{$width:854,children:[t(fp,{children:sa}),e(q,{$gap:8,$width:"100%",children:[e(rp,{children:[t(Fp,{children:t(se,{size:de.XXS,color:c.v2.colors.silver[200],children:ca})}),t(pp,{message:la})]}),e(hp,{children:[e(mp,{children:[t(se,{size:de.S,weight:500,color:c.v2.colors.white[500],children:da}),t(Ui,{size:16,fill:c.v2.colors.silver[200]})]}),t(gp,{children:t(qu,{name:pa,recommended:!0,toggleLabel:ua,enabled:o,onEnabledChange:i,summary:d,toggleName:"sampling-onboarding-drop-error-preset-toggle"})})]})]})]}),t(op,{onNext:r,nextLoading:s})]})},Mp=g.div`
|
|
583
583
|
white-space: pre-line;
|
|
584
|
-
`,
|
|
584
|
+
`,_p=g.div`
|
|
585
585
|
width: fit-content;
|
|
586
|
-
`,Ap=["50","25","10","1","0.1"],Np=({value:n,onChange:o,label:i})=>{const l=f(),r=a(()=>Ap.map(e=>({value:e,label:`${e}%`,selectedBgColor:l.v2.colors.purple[900],selectedBorderColor:l.v2.colors.purple[400]})),[l]);return e(q,{$gap:8,children:[t(se,{size:de.XS,color:l.v2.colors.white[500],children:i}),t(Ep,{children:t(ge,{"data-id":"sampling-onboarding-ambient",options:r,selected:n,setSelected:o})})]})},Op=({errorPresetEnabled:o,onErrorPresetChange:i,ambientPercentage:l,onAmbientPercentageChange:r,onBack:s,onNext:c,submitting:d})=>{const u=f(),p=a(()=>N(o?{disabled:!1}:null),[o]);return e(n,{children:[t(Yu,{title:pa,onBack:s}),e(Hu,{$width:854,children:[t(lp,{children:ha}),e(q,{$gap:8,$width:"100%",children:[e(qu,{children:[t(Ip,{children:t(se,{size:de.XXS,color:u.v2.colors.silver[200],children:ma})}),t(ep,{items:[ga,fa,ba,va,ya]}),t(np,{message:ia})]}),e(op,{children:[e(ap,{children:[t(se,{size:de.S,weight:500,color:u.v2.colors.white[500],children:Ca}),t(Xi,{size:16,fill:u.v2.colors.silver[200]})]}),t(ip,{children:t(Xu,{name:ua,recommended:!0,toggleLabel:da,enabled:o,onEnabledChange:i,summary:p,toggleName:"sampling-onboarding-error-preset-toggle"})}),t(ip,{children:t(Np,{value:l,onChange:r,label:Sa})})]})]})]}),t(Wu,{onNext:c,nextLoading:d})]})},Rp=({isOpen:e,onClose:n,k8sHealthProbesConfig:a,samplingId:i,docsUrl:s})=>{const{samplingApi:c}=gl(),[d,u]=r("welcome"),[p,h]=r(!0),[m,g]=r("keep-list"),[f,b]=r(!0),[v,y]=r("25"),[C,S]=r(!1);o(()=>{e&&(u("welcome"),h(a?.enabled??!0),g("keep-list"),b(!0),y("25"),S(!1))},[e,a?.enabled]);const w=l(async()=>{const e=i??"default",t=[];if(p!==(a?.enabled??!1)){const e=c.updateK8sHealthProbesConfig;e&&t.push(e({enabled:p,keepPercentage:a?.keepPercentage??0}))}if("advanced"!==m&&f){const n=c.createHighlyRelevant;n&&t.push(n({samplingId:e,rule:{name:"Auto - Keep All Error Traces",disabled:!1,error:!0,sourceScopes:null,operation:null,percentageAtLeast:null}}))}if("keep-list"===m){const n=c.createCostReduction;n&&t.push(n({samplingId:e,rule:{name:"Onboarding - Ambient sampling",disabled:!1,sourceScopes:null,operation:null,percentageAtMost:parseFloat(v)}}))}S(!0);try{await Promise.all(t),u("success")}catch{}finally{S(!1)}},[i,c,p,a?.enabled,a?.keepPercentage,m,f,v]);let x=null;switch(d){case"welcome":x=t(hp,{onSkip:n,onNext:()=>u("noisy")});break;case"noisy":x=t(sp,{enabled:p,onEnabledChange:h,onBack:()=>u("welcome"),onNext:()=>u("strategy")});break;case"strategy":x=t(xp,{strategy:m,onStrategyChange:g,onBack:()=>u("noisy"),onNext:()=>{u("keep-list"===m?"keep-list":"drop-list"===m?"drop-list":"advanced")},docsUrl:s});break;case"keep-list":x=t(Op,{errorPresetEnabled:f,onErrorPresetChange:b,ambientPercentage:v,onAmbientPercentageChange:y,onBack:()=>u("strategy"),onNext:w,submitting:C});break;case"drop-list":x=t($p,{errorPresetEnabled:f,onErrorPresetChange:b,onBack:()=>u("strategy"),onNext:w,submitting:C});break;case"advanced":x=t(kp,{onBack:()=>u("strategy"),onNext:w,submitting:C});break;case"success":x=t(dp,{onClose:n})}return t(Qn,{isOpen:e,onClose:n,children:x})};var Dp,Pp;!function(e){e.BulkConfig="bulk-config",e.BulkSource="bulk-source",e.BulkDestination="bulk-destination",e.BulkAction="bulk-action",e.BulkInstrumentationRule="bulk-instrumentation-rule",e.Delete="delete"}(Dp||(Dp={})),function(e){e.Id="id",e.Name="name",e.Type="type",e.Status="status",e.OdigosVersion="odigosVersion",e.ConnectedSince="connectedSince",e.LastActivity="lastActivity"}(Pp||(Pp={}));const Fp=[{key:Pp.Name,label:"Name"},{key:Pp.Type,label:"Type",textAlign:"right"},{key:Pp.Status,label:"Status"},{key:Pp.OdigosVersion,label:"Odigos Version"},{key:Pp.ConnectedSince,label:"Connected Since"},{key:Pp.LastActivity,label:"Last Activity"}],Lp=(e,t)=>{const n=e.find(e=>e.key===Pp.Id)?.rawValue;return t(n?.toString()||"")},_p=e=>{const{connections:t,configMinSupportedVersion:n,snapshotMinSupportedVersion:o,onDelete:a,onAddSource:i,onAddDestination:l,onAddAction:r,onAddInstrumentationRule:s,onEditConfiguration:c}=e;return({cells:e})=>{if(!(e=>e.find(e=>e.key===Pp.Status)?.rawValue===Re.Success)(e))return[{id:qn(),label:"Delete Connection",rightIcon:Si,onClick:()=>Lp(e,a)}];const d=Lp(e,e=>{const o=t.find(t=>t.id===e);return!!o&&O(o.odigosVersion,n)}),u=Lp(e,e=>{const n=t.find(t=>t.id===e);return!!n&&O(n.odigosVersion,o)}),p=[];return i&&p.push({id:qn(),tooltip:u?Je.ADD_SOURCE:`To use this feature, please upgrade to Odigos v${o} or later.`,rightIcon:Di,disabled:!u,onClick:()=>Lp(e,i)}),l&&p.push({id:qn(),tooltip:Je.ADD_DESTINATION,rightIcon:Ii,onClick:()=>Lp(e,l)}),r&&p.push({id:qn(),tooltip:Je.ADD_ACTION,rightIcon:$i,onClick:()=>Lp(e,r)}),s&&p.push({id:qn(),tooltip:Je.ADD_INSTRUMENTATION_RULE,rightIcon:Ri,onClick:()=>Lp(e,s)}),c&&p.push({id:qn(),tooltip:d?"Edit Configuration":`To use this feature, please upgrade to Odigos v${n} or later.`,rightIcon:Fi,disabled:!d,onClick:()=>Lp(e,c)}),p}},Mp=({connections:n,getConnections:i,onClickConnection:s,deleteConnection:c,configMinSupportedVersion:d=0,snapshotMinSupportedVersion:u=0})=>{const p=f(),{formatTimeAgo:h}=Ht(),{capabilities:m}=gl(),[g,b]=r(!1),[v,y]=r(n||[]),C=l(async()=>{try{b(!0),y(await i()??[])}catch(e){}finally{b(!1)}},[]);o(()=>{v.length||C()},[]);const[S,w]=r(""),[x,k]=r(null),[T,$]=r([]),I=a(()=>x===Dp.BulkConfig?d:x===Dp.BulkSource?u:0,[x,d,u]),{supportedConnections:E,supportedConnectionIds:A}=a(()=>{const e=((e,t)=>e.filter(e=>{const n=e.status===Re.Success,o=O(e.odigosVersion,t);return n&&o}))(v,I);return{supportedConnections:e,supportedConnectionIds:e.map(e=>e.id)}},[v,I]);o(()=>{if(!x||x===Dp.Delete)return;const e=T.filter(e=>!A.includes(e));e.length&&$(t=>t.filter(t=>!e.includes(t)))},[x,T.length,A.length]);const N=a(()=>v.filter(e=>!S||e.name.toLowerCase().includes(S.toLowerCase())).map(e=>({cells:[{key:Pp.Id,rawValue:e.id},{key:Pp.Name,rawValue:e.name},{key:Pp.Type,rawValue:e.type},{key:Pp.Status,rawValue:e.status,component:()=>(e=>{const n=e===Re.Success?"Connection live":"Connection lost",o=e===Re.Success?Ni:Oi;return t(je,{status:e,label:n,leftIcon:o})})(e.status)},{key:Pp.OdigosVersion,rawValue:e.odigosVersion},{key:Pp.ConnectedSince,rawValue:e.connectedAt?h(e.connectedAt):"-"},{key:Pp.LastActivity,rawValue:e.lastSeenAt?h(e.lastSeenAt):"-"}],onClick:e.status!==Re.Success||x?void 0:()=>s(e),isSelected:T.includes(e.id),onSelect:()=>$(t=>Array.from(new Set([...t,e.id]))),onDeselect:()=>$(t=>t.filter(t=>t!==e.id)),hideCheckbox:e.status!==Re.Success||x===Dp.BulkConfig&&!O(e.odigosVersion,d)||x===Dp.BulkSource&&!O(e.odigosVersion,u)})),[v,T,S,x,d,u,h,s]),R=a(()=>{const e=(e,t)=>{$([e]),k(t)};return _p({connections:v,configMinSupportedVersion:d,snapshotMinSupportedVersion:u,onDelete:t=>e(t,Dp.Delete),onAddSource:m.canFetchSnapshots&&m.canBulkPersistSources?t=>e(t,Dp.BulkSource):void 0,onAddDestination:m.canFetchDestinationCategories&&m.canFetchPotentialDestinations&&m.canCreateDestination?t=>e(t,Dp.BulkDestination):void 0,onAddAction:m.canCreateAction?t=>e(t,Dp.BulkAction):void 0,onAddInstrumentationRule:m.canCreateInstrumentationRule?t=>e(t,Dp.BulkInstrumentationRule):void 0,onEditConfiguration:m.canApplyEffectiveConfig?t=>e(t,Dp.BulkConfig):void 0})},[v,d,u,m]),D=a(()=>(e=>{const{onCancel:t,onAddSource:n,onAddDestination:o,onAddAction:a,onAddInstrumentationRule:i,onManageConfigurations:l}=e,r=[];n&&r.push({id:qn(),type:tn.Button,buttonProps:{variant:me.Primary,size:he.S,label:"Add Sources",rightIcon:Di,onClick:n}});const s=[o?{id:Dp.BulkDestination,label:Je.ADD_DESTINATION,icon:Ii}:null,a?{id:Dp.BulkAction,label:Je.ADD_ACTION,icon:$i}:null,i?{id:Dp.BulkInstrumentationRule,label:Je.ADD_INSTRUMENTATION_RULE,icon:Ri}:null,l?{id:Dp.BulkConfig,label:"Manage Configurations",icon:Fi}:null];return s.some(Boolean)&&r.push({id:qn(),type:tn.ButtonDropData,buttonProps:{variant:me.Secondary,size:he.S,label:"Bulk Operations",onClick:e=>{e===Dp.BulkSource?n?.():e===Dp.BulkDestination?o?.():e===Dp.BulkAction?a?.():e===Dp.BulkInstrumentationRule?i?.():e===Dp.BulkConfig&&l?.()}},dropDataProps:{alignX:Jn.Left,items:s}}),r.push({id:qn(),type:tn.Button,buttonProps:{variant:me.Text,size:he.S,label:Rt.CANCEL,onClick:t}}),r})({onCancel:()=>$([]),onAddSource:m.canFetchSnapshots&&m.canBulkPersistSources?()=>k(Dp.BulkSource):void 0,onAddDestination:m.canFetchDestinationCategories&&m.canFetchPotentialDestinations&&m.canCreateDestination?()=>k(Dp.BulkDestination):void 0,onAddAction:m.canCreateAction?()=>k(Dp.BulkAction):void 0,onAddInstrumentationRule:m.canCreateInstrumentationRule?()=>k(Dp.BulkInstrumentationRule):void 0,onManageConfigurations:m.canApplyEffectiveConfig?()=>k(Dp.BulkConfig):void 0}),[m]);return t(wa,{children:e(lt,{fullHeight:!0,richTitle:{icon:rl,title:Je.CONNECTIONS,badge:{label:v.length.toString(),status:Re.Unknown}},search:{placeholder:"Search by cluster name",value:S,onChange:e=>w(e),width:"300px"},actions:[{id:qn(),type:tn.Button,buttonProps:{variant:me.Secondary,size:he.S,leftIcon:zi,onClick:C,disabled:g}}],children:[t(Sn,{variant:wn.Pretty,headerBackgroundColor:p.v2.colors.silver[1e3],isLoading:g,withCheckboxes:!0,columns:Fp,rows:N,rowActionsPushRightPosition:x?`calc(${Pl} - 24px)`:void 0,getRowActions:R}),x===Dp.BulkConfig&&m.canApplyEffectiveConfig&&t(Ll,{connectionIds:T,children:t(tc,{onClose:()=>k(null),connections:E,selectedConnectionIds:T,setSelectedConnectionIds:$})}),x===Dp.BulkSource&&m.canFetchSnapshots&&m.canBulkPersistSources&&t(Ll,{connectionIds:T,children:t(Jl,{selectedConnectionIds:T,children:t(Zs,{onClose:()=>k(null),selectedConnectionIds:T,setSelectedConnectionIds:$})})}),x===Dp.BulkDestination&&m.canFetchDestinationCategories&&m.canFetchPotentialDestinations&&m.canTestConnection&&m.canCreateDestination&&t(Ll,{connectionIds:T,children:t(ql,{children:t(Os,{onClose:()=>k(null),selectedConnectionIds:T,setSelectedConnectionIds:$})})}),x===Dp.BulkAction&&m.canCreateAction&&t(Ll,{connectionIds:T,children:t(Zl,{children:t(Ss,{onClose:()=>k(null),selectedConnectionIds:T,setSelectedConnectionIds:$})})}),x===Dp.BulkInstrumentationRule&&m.canCreateInstrumentationRule&&t(Ll,{connectionIds:T,children:t(Ql,{children:t(Rs,{onClose:()=>k(null),selectedConnectionIds:T,setSelectedConnectionIds:$})})}),t(Nl,{target:"connection",isOpen:x===Dp.Delete,onClose:()=>{$([]),k(null)},onApprove:async()=>{const e=T[0];e&&(await c(e),await C())}}),t(xn,{isOpen:!!T.length&&!x,richTitle:{icon:vi,title:"Selected Clusters",badge:{label:T.length}},actions:D})]})})},zp=g.div`
|
|
586
|
+
`,zp=["50","25","10","1","0.1"],Bp=({value:n,onChange:o,label:i})=>{const l=f(),r=a(()=>zp.map(e=>({value:e,label:`${e}%`,selectedBgColor:l.v2.colors.purple[900],selectedBorderColor:l.v2.colors.purple[400]})),[l]);return e(q,{$gap:8,children:[t(se,{size:de.XS,color:l.v2.colors.white[500],children:i}),t(_p,{children:t(ge,{"data-id":"sampling-onboarding-ambient",options:r,selected:n,setSelected:o})})]})},Xp=({errorPresetEnabled:o,onErrorPresetChange:i,ambientPercentage:l,onAmbientPercentageChange:r,onBack:s,onNext:c,submitting:d})=>{const u=f(),p=a(()=>N(o?{disabled:!1}:null),[o]);return e(n,{children:[t(ip,{title:ha,onBack:s}),e(tp,{$width:854,children:[t(fp,{children:ma}),e(q,{$gap:8,$width:"100%",children:[e(rp,{children:[t(Mp,{children:t(se,{size:de.XXS,color:u.v2.colors.silver[200],children:ga})}),t(dp,{items:[fa,ba,ya,va,Ca]}),t(pp,{message:la})]}),e(hp,{children:[e(mp,{children:[t(se,{size:de.S,weight:500,color:u.v2.colors.white[500],children:Sa}),t(Ui,{size:16,fill:u.v2.colors.silver[200]})]}),t(gp,{children:t(qu,{name:pa,recommended:!0,toggleLabel:ua,enabled:o,onEnabledChange:i,summary:p,toggleName:"sampling-onboarding-error-preset-toggle"})}),t(gp,{children:t(Bp,{value:l,onChange:r,label:wa})})]})]})]}),t(op,{onNext:c,nextLoading:d})]})},Vp=({isOpen:e,onClose:n,k8sHealthProbesConfig:a,samplingId:i,docsUrl:s})=>{const{samplingApi:c}=yl(),[d,u]=r("welcome"),[p,h]=r(!0),[m,g]=r("keep-list"),[f,b]=r(!0),[y,v]=r("25"),[C,S]=r(!1);o(()=>{e&&(u("welcome"),h(a?.enabled??!0),g("keep-list"),b(!0),v("25"),S(!1))},[e,a?.enabled]);const w=l(async()=>{const e=i??"default",t=[];if(p!==(a?.enabled??!1)){const e=c.updateK8sHealthProbesConfig;e&&t.push(e({enabled:p,keepPercentage:a?.keepPercentage??0}))}if("advanced"!==m&&f){const n=c.createHighlyRelevant;n&&t.push(n({samplingId:e,rule:{name:"Auto - Keep All Error Traces",disabled:!1,error:!0,sourceScopes:null,operation:null,percentageAtLeast:null}}))}if("keep-list"===m){const n=c.createCostReduction;n&&t.push(n({samplingId:e,rule:{name:"Onboarding - Ambient sampling",disabled:!1,sourceScopes:null,operation:null,percentageAtMost:parseFloat(y)}}))}S(!0);try{await Promise.all(t),u("success")}catch{}finally{S(!1)}},[i,c,p,a?.enabled,a?.keepPercentage,m,f,y]);let x=null;switch(d){case"welcome":x=t(xp,{onSkip:n,onNext:()=>u("noisy")});break;case"noisy":x=t(yp,{enabled:p,onEnabledChange:h,onBack:()=>u("welcome"),onNext:()=>u("strategy")});break;case"strategy":x=t(Dp,{strategy:m,onStrategyChange:g,onBack:()=>u("noisy"),onNext:()=>{u("keep-list"===m?"keep-list":"drop-list"===m?"drop-list":"advanced")},docsUrl:s});break;case"keep-list":x=t(Xp,{errorPresetEnabled:f,onErrorPresetChange:b,ambientPercentage:y,onAmbientPercentageChange:v,onBack:()=>u("strategy"),onNext:w,submitting:C});break;case"drop-list":x=t(Lp,{errorPresetEnabled:f,onErrorPresetChange:b,onBack:()=>u("strategy"),onNext:w,submitting:C});break;case"advanced":x=t(Pp,{onBack:()=>u("strategy"),onNext:w,submitting:C});break;case"success":x=t(Cp,{onClose:n})}return t(eo,{isOpen:e,onClose:n,children:x})};var Up,jp;!function(e){e.BulkConfig="bulk-config",e.BulkSource="bulk-source",e.BulkDestination="bulk-destination",e.BulkAction="bulk-action",e.BulkInstrumentationRule="bulk-instrumentation-rule",e.Delete="delete"}(Up||(Up={})),function(e){e.Id="id",e.Name="name",e.Type="type",e.Status="status",e.OdigosVersion="odigosVersion",e.ConnectedSince="connectedSince",e.LastActivity="lastActivity"}(jp||(jp={}));const Gp=[{key:jp.Name,label:"Name"},{key:jp.Type,label:"Type"},{key:jp.Status,label:"Status"},{key:jp.OdigosVersion,label:"Odigos Version"},{key:jp.ConnectedSince,label:"Connected Since"},{key:jp.LastActivity,label:"Last Activity"}],Hp=(e,t)=>{const n=e.find(e=>e.key===jp.Id)?.rawValue;return t(n?.toString()||"")},Wp=e=>{const{connections:t,configMinSupportedVersion:n,snapshotMinSupportedVersion:o,onDelete:a,onAddSource:i,onAddDestination:l,onAddAction:r,onAddInstrumentationRule:s,onEditConfiguration:c}=e;return({cells:e})=>{if(!(e=>e.find(e=>e.key===jp.Status)?.rawValue===Pe.Success)(e))return[{id:Zn(),label:"Delete Connection",rightIcon:xi,onClick:()=>Hp(e,a)}];if(!Hp(e,e=>{const n=t.find(t=>t.id===e);return n?.type===xa.K8s}))return[];const d=Hp(e,e=>{const o=t.find(t=>t.id===e);return!!o&&O(o.odigosVersion,n)}),u=Hp(e,e=>{const n=t.find(t=>t.id===e);return!!n&&O(n.odigosVersion,o)}),p=[];return i&&p.push({id:Zn(),tooltip:u?qe.ADD_SOURCE:`To use this feature, please upgrade to Odigos v${o} or later.`,rightIcon:Fi,disabled:!u,onClick:()=>Hp(e,i)}),l&&p.push({id:Zn(),tooltip:qe.ADD_DESTINATION,rightIcon:Ai,onClick:()=>Hp(e,l)}),r&&p.push({id:Zn(),tooltip:qe.ADD_ACTION,rightIcon:Ei,onClick:()=>Hp(e,r)}),s&&p.push({id:Zn(),tooltip:qe.ADD_INSTRUMENTATION_RULE,rightIcon:Pi,onClick:()=>Hp(e,s)}),c&&p.push({id:Zn(),tooltip:d?"Edit Configuration":`To use this feature, please upgrade to Odigos v${n} or later.`,rightIcon:Mi,disabled:!d,onClick:()=>Hp(e,c)}),p}},Kp=({connections:n,getConnections:i,onClickConnection:s,deleteConnection:c,configMinSupportedVersion:d=0,snapshotMinSupportedVersion:u=0})=>{const p=f(),{formatTimeAgo:h}=Ht(),{capabilities:m}=yl(),[g,b]=r(!1),[y,v]=r(n||[]),C=l(async()=>{try{b(!0),v(await i()??[])}catch(e){}finally{b(!1)}},[]);o(()=>{y.length||C()},[]);const[S,w]=r(""),[x,k]=r(null),[T,$]=r([]),I=a(()=>x===Up.BulkConfig?d:x===Up.BulkSource?u:0,[x,d,u]),{supportedConnections:E,supportedConnectionIds:A}=a(()=>{const e=((e,t)=>e.filter(e=>{const n=e.status===Pe.Success,o=O(e.odigosVersion,t);return n&&o}))(y,I);return{supportedConnections:e,supportedConnectionIds:e.map(e=>e.id)}},[y,I]);o(()=>{if(!x||x===Up.Delete)return;const e=T.filter(e=>!A.includes(e));e.length&&$(t=>t.filter(t=>!e.includes(t)))},[x,T.length,A.length]);const N=a(()=>y.filter(e=>!S||e.name.toLowerCase().includes(S.toLowerCase())).map(e=>({cells:[{key:jp.Id,rawValue:e.id},{key:jp.Name,rawValue:e.name},{key:jp.Type,rawValue:e.type},{key:jp.Status,rawValue:e.status,component:()=>(e=>{const n=e===Pe.Success?"Connection live":"Connection lost",o=e===Pe.Success?Ri:Di;return t(We,{status:e,label:n,leftIcon:o})})(e.status)},{key:jp.OdigosVersion,rawValue:e.odigosVersion},{key:jp.ConnectedSince,rawValue:e.connectedAt?h(e.connectedAt):"-"},{key:jp.LastActivity,rawValue:e.lastSeenAt?h(e.lastSeenAt):"-"}],onClick:e.status!==Pe.Success||x?void 0:()=>s(e),isSelected:T.includes(e.id),onSelect:()=>$(t=>Array.from(new Set([...t,e.id]))),onDeselect:()=>$(t=>t.filter(t=>t!==e.id)),hideCheckbox:e.status!==Pe.Success||x===Up.BulkConfig&&!O(e.odigosVersion,d)||x===Up.BulkSource&&!O(e.odigosVersion,u)})),[y,T,S,x,d,u,h,s]),R=a(()=>y.length>0&&y.every(e=>e.type===xa.K8s),[y]),D=a(()=>{const e=(e,t)=>{$([e]),k(t)};return Wp({connections:y,configMinSupportedVersion:d,snapshotMinSupportedVersion:u,onDelete:t=>e(t,Up.Delete),onAddSource:m.canFetchSnapshots&&m.canBulkPersistSources?t=>e(t,Up.BulkSource):void 0,onAddDestination:m.canFetchDestinationCategories&&m.canFetchPotentialDestinations&&m.canCreateDestination?t=>e(t,Up.BulkDestination):void 0,onAddAction:m.canCreateAction?t=>e(t,Up.BulkAction):void 0,onAddInstrumentationRule:m.canCreateInstrumentationRule?t=>e(t,Up.BulkInstrumentationRule):void 0,onEditConfiguration:m.canApplyEffectiveConfig?t=>e(t,Up.BulkConfig):void 0})},[y,d,u,m]),P=a(()=>(e=>{const{onCancel:t,onAddSource:n,onAddDestination:o,onAddAction:a,onAddInstrumentationRule:i,onManageConfigurations:l}=e,r=[];n&&r.push({id:Zn(),type:nn.Button,buttonProps:{variant:me.Primary,size:he.S,label:"Add Sources",rightIcon:Fi,onClick:n}});const s=[o?{id:Up.BulkDestination,label:qe.ADD_DESTINATION,icon:Ai}:null,a?{id:Up.BulkAction,label:qe.ADD_ACTION,icon:Ei}:null,i?{id:Up.BulkInstrumentationRule,label:qe.ADD_INSTRUMENTATION_RULE,icon:Pi}:null,l?{id:Up.BulkConfig,label:"Manage Configurations",icon:Mi}:null];return s.some(Boolean)&&r.push({id:Zn(),type:nn.ButtonDropData,buttonProps:{variant:me.Secondary,size:he.S,label:"Bulk Operations",onClick:e=>{e===Up.BulkSource?n?.():e===Up.BulkDestination?o?.():e===Up.BulkAction?a?.():e===Up.BulkInstrumentationRule?i?.():e===Up.BulkConfig&&l?.()}},dropDataProps:{alignX:qn.Left,items:s}}),r.push({id:Zn(),type:nn.Button,buttonProps:{variant:me.Text,size:he.S,label:Dt.CANCEL,onClick:t}}),r})({onCancel:()=>$([]),onAddSource:m.canFetchSnapshots&&m.canBulkPersistSources?()=>k(Up.BulkSource):void 0,onAddDestination:m.canFetchDestinationCategories&&m.canFetchPotentialDestinations&&m.canCreateDestination?()=>k(Up.BulkDestination):void 0,onAddAction:m.canCreateAction?()=>k(Up.BulkAction):void 0,onAddInstrumentationRule:m.canCreateInstrumentationRule?()=>k(Up.BulkInstrumentationRule):void 0,onManageConfigurations:m.canApplyEffectiveConfig?()=>k(Up.BulkConfig):void 0}),[m]);return t(ka,{children:e(rt,{fullHeight:!0,richTitle:{icon:cl,title:qe.CONNECTIONS,badge:{label:y.length.toString(),status:Pe.Unknown}},search:{placeholder:"Search by cluster name",value:S,onChange:e=>w(e),width:"300px"},actions:[{id:Zn(),type:nn.Button,buttonProps:{variant:me.Secondary,size:he.S,leftIcon:Xi,onClick:C,disabled:g}}],children:[t(wn,{variant:xn.Pretty,headerBackgroundColor:p.v2.colors.silver[1e3],isLoading:g,withCheckboxes:R,columns:Gp,rows:N,rowActionsPushRightPosition:x?`calc(${Ml} - 24px)`:void 0,getRowActions:D}),x===Up.BulkConfig&&m.canApplyEffectiveConfig&&t(zl,{connectionIds:T,children:t(uc,{onClose:()=>k(null),connections:E,selectedConnectionIds:T,setSelectedConnectionIds:$})}),x===Up.BulkSource&&m.canFetchSnapshots&&m.canBulkPersistSources&&t(zl,{connectionIds:T,children:t(Ql,{selectedConnectionIds:T,children:t(sc,{onClose:()=>k(null),selectedConnectionIds:T,setSelectedConnectionIds:$})})}),x===Up.BulkDestination&&m.canFetchDestinationCategories&&m.canFetchPotentialDestinations&&m.canTestConnection&&m.canCreateDestination&&t(zl,{connectionIds:T,children:t(er,{children:t(Xs,{onClose:()=>k(null),selectedConnectionIds:T,setSelectedConnectionIds:$})})}),x===Up.BulkAction&&m.canCreateAction&&t(zl,{connectionIds:T,children:t(tr,{children:t(Os,{onClose:()=>k(null),selectedConnectionIds:T,setSelectedConnectionIds:$})})}),x===Up.BulkInstrumentationRule&&m.canCreateInstrumentationRule&&t(zl,{connectionIds:T,children:t(nr,{children:t(Vs,{onClose:()=>k(null),selectedConnectionIds:T,setSelectedConnectionIds:$})})}),t(Dl,{target:"connection",isOpen:x===Up.Delete,onClose:()=>{$([]),k(null)},onApprove:async()=>{const e=T[0];e&&(await c(e),await C())}}),t(kn,{isOpen:!!T.length&&!x,richTitle:{icon:Ci,title:"Selected Clusters",badge:{label:T.length}},actions:P})]})})},Yp=g.div`
|
|
587
587
|
display: flex;
|
|
588
588
|
align-items: center;
|
|
589
589
|
justify-content: space-between;
|
|
@@ -592,26 +592,26 @@ import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{useEffect
|
|
|
592
592
|
width: 100%;
|
|
593
593
|
border-radius: 16px;
|
|
594
594
|
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
595
|
-
`,
|
|
595
|
+
`,Jp=g.div`
|
|
596
596
|
display: flex;
|
|
597
597
|
align-items: center;
|
|
598
598
|
justify-content: center;
|
|
599
599
|
padding: 8px;
|
|
600
600
|
border-radius: 8px;
|
|
601
|
-
background-color: ${({theme:e})=>e.v2.colors.white[500]+
|
|
602
|
-
`,
|
|
601
|
+
background-color: ${({theme:e})=>e.v2.colors.white[500]+ct["004"]};
|
|
602
|
+
`,qp=({setStep:n,onSave:o,sourcesPayload:i,destinationsPayload:l,disableAnimation:r})=>{const s=f(),c=()=>n(2),d=()=>n(3),u=a(()=>Object.values(i||{}).flatMap((n,o)=>n.map((n,a)=>{if(!n.selected)return null;const i=n.kind||xt.Namespace,l=i===xt.Namespace?n.namespace:`${n.namespace} → ${n.name}`;return e(Yp,{children:[t(se,{nowrap:!0,children:l}),t(We,{label:i,status:Pe.Info,backgroundColor:s.v2.colors.blue[900]})]},`source-${o}-${a}`)})).filter(Boolean),[i]),p=a(()=>l?.map((n,o)=>{const a=Ct(n.option.type).icon;return e(Yp,{children:[e(ue,{$gap:8,children:[a&&t(Jp,{children:t(a,{size:24})}),t(se,{nowrap:!0,children:n.formData.name||n.option.displayName})]}),void 0!==n.testResult&&t(We,{status:n.testResult.succeeded?Pe.Success:Pe.Error,leftIcon:n.testResult.succeeded?Ri:Di})]},`destination-${o}`)})||[],[l]);return t(Rl,{isOpen:!0,disableAnimation:r,onBack:()=>n(3),onSave:o,header:{icon:zi,title:qe.SUMMARY,subTitle:qe.REVIEW_SETUP},leftColumn:{width:"50%",header:e(ue,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(ue,{$gap:8,children:[t(Fi,{size:24}),t(se,{nowrap:!0,children:qe.SELECTED_SOURCES}),t(We,{label:u.length})]}),t(pe,{"data-id":"summary-edit-sources",leftIcon:ki,variant:me.Secondary,size:he.S,onClick:c})]}),list:u.length?u:[t(ht,{$height:"100%",children:t(Ae,{icon:Fi,title:qe.NO_SOURCES_SELECTED,subTitle:qe.ADD_SOURCE_PROMPT,button:{leftIcon:yi,label:qe.ADD_SOURCE,onClick:c}})},"no-sources-data")]},rightColumn:{width:"50%",header:e(ue,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(ue,{$gap:8,children:[t(Ai,{size:24}),t(se,{nowrap:!0,children:qe.SELECTED_DESTINATIONS}),t(We,{label:p.length})]}),t(pe,{"data-id":"summary-edit-destinations",leftIcon:ki,variant:me.Secondary,size:he.S,onClick:d})]}),list:p.length?p:[t(ht,{"data-id":"summary-no-destinations",$height:"100%",children:t(Ae,{icon:Ai,title:qe.NO_DESTINATIONS_SELECTED,subTitle:qe.ADD_DESTINATION_PROMPT,button:{leftIcon:yi,label:qe.ADD_DESTINATIONS,onClick:d}})},"no-destinations-data")]}})},Zp=g.div`
|
|
603
603
|
position: relative;
|
|
604
604
|
overflow: hidden;
|
|
605
605
|
width: 100vw;
|
|
606
606
|
height: 100vh;
|
|
607
607
|
box-sizing: border-box;
|
|
608
|
-
`,
|
|
608
|
+
`,Qp=g.svg`
|
|
609
609
|
position: absolute;
|
|
610
610
|
top: 50%;
|
|
611
611
|
left: 50%;
|
|
612
612
|
transform: translate(-50%, -50%);
|
|
613
613
|
z-index: -1;
|
|
614
|
-
`,
|
|
614
|
+
`,eh=[{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"}],th=[{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:eh},{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:eh},{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:eh}],nh=({paddingXAxis:n="0px",paddingYAxis:i="0px",children:l})=>{const[s,c]=r(window.innerWidth),d=a(()=>s/th[0].width,[s]);return o(()=>{const e=()=>c(window.innerWidth);return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),e(Zp,{$paddingXAxis:n,$paddingYAxis:i,children:[th.map(({width:n,height:o,pathOpacity:a,path:i,gradientTransform:l,stops:r},s)=>{const c=`purple-ring-${s}`;return e(Qp,{width:n*d,height:"100%",viewBox:`0 0 ${n} ${o}`,fill:"none",children:[t("path",{opacity:a,d:i,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:n},o)=>t("stop",{offset:e,stopColor:"#7C3BFF",stopOpacity:n},o))})})]},c)}),l]})},oh=g.div`
|
|
615
615
|
display: flex;
|
|
616
616
|
flex-direction: column;
|
|
617
617
|
align-items: center;
|
|
@@ -622,7 +622,7 @@ import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{useEffect
|
|
|
622
622
|
width: 50vw;
|
|
623
623
|
border-radius: 16px;
|
|
624
624
|
background: ${({theme:e})=>e.v2.colors.silver[900]};
|
|
625
|
-
`,
|
|
625
|
+
`,ah=g.div`
|
|
626
626
|
display: flex;
|
|
627
627
|
flex-direction: column;
|
|
628
628
|
align-items: center;
|
|
@@ -632,15 +632,15 @@ import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{useEffect
|
|
|
632
632
|
& * {
|
|
633
633
|
text-align: center;
|
|
634
634
|
}
|
|
635
|
-
`,
|
|
635
|
+
`,ih=({onStart:n})=>t(le,{width:"75vw",isOpen:!0,hideOverlay:!0,disableAnimation:!0,children:t(ht,{$height:"100%",children:e(oh,{children:[e(ah,{children:[t(se,{size:de.L,weight:500,children:qe.GET_STARTED_WITH}),t(Ll,{size:260}),t(se,{size:de.S,weight:400,children:qe.GET_STARTED_DESCRIPTION})]}),t(pe,{"data-id":"onboarding-get-started",label:Dt.GET_STARTED,rightIcon:vi,size:he.L,onClick:n})]})})}),lh=[{step:1,label:qe.INSTALLATION,forceDoneBadge:!0},{step:2,label:qe.SOURCES_SETUP},{step:3,label:qe.DESTINATIONS_SETUP},{step:4,label:qe.SUMMARY}],rh=g.div`
|
|
636
636
|
display: flex;
|
|
637
637
|
flex-direction: column;
|
|
638
638
|
gap: 32px;
|
|
639
639
|
padding: 64px;
|
|
640
|
-
`,
|
|
640
|
+
`,sh=({pagePaddingXAxis:n,pagePaddingYAxis:o,onDone:a})=>{const{setCurrentModal:i}=Qn(),{sourcesApi:l,destinationsApi:s}=yl(),[c,d]=r(1),[u,p]=r(!1),[h,m]=r(null),[g,f]=r(null),b=()=>d(e=>e+1),y=()=>d(e=>e-1);return e(nh,{paddingXAxis:n,paddingYAxis:o,children:[e(rh,{children:[t(Ll,{useInline:!0}),t(Ta,{currentStep:c,data:lh,gap:32})]}),t(Ql,{initialInputs:h,children:e(er,{children:[1===c&&t(ih,{onStart:b}),2===c&&t(sc,{disableAnimation:!0,onBack:e=>{m(e),y()},onNext:e=>{m(e),b()}}),3===c&&t(Xs,{disableAnimation:!0,onBack:e=>{f(e),y()},onNext:e=>{f(e),b()},initialInputs:g}),4===c&&t(qp,{disableAnimation:!0,setStep:d,onSave:async()=>{if(!u){p(!0);try{const e=[];h&&e.push(l.persistV2(h)),g&&e.push(...g.map(e=>s.create(e.formData)));const t=await Promise.allSettled(e),n=[];for(const e of t)"rejected"===e.status?n.push(e.reason?.message||String(e.reason)):e.value&&"object"==typeof e.value&&"error"in e.value&&e.value.error&&n.push(e.value.error);if(n.length)return{error:n.join("\n")};i(Wu),a()}catch(e){return p(!1),{error:e instanceof Error?e.message:String(e)}}}},sourcesPayload:h,destinationsPayload:g})]})})]})},ch=e=>(e||[]).filter(e=>!!e.id).map(e=>String(e.id)),dh=e=>{let t=0;return Object.values(e).forEach(e=>{Array.isArray(e)&&(t+=e.length)}),e.onlyErrors&&t++,t},uh=g.div`
|
|
641
641
|
position: relative;
|
|
642
642
|
display: inline-flex;
|
|
643
|
-
`,
|
|
643
|
+
`,ph=g.button`
|
|
644
644
|
display: inline-flex;
|
|
645
645
|
align-items: center;
|
|
646
646
|
gap: 8px;
|
|
@@ -653,7 +653,7 @@ import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{useEffect
|
|
|
653
653
|
&:hover {
|
|
654
654
|
background-color: ${({theme:e})=>e.v2.colors.silver[700]};
|
|
655
655
|
}
|
|
656
|
-
`,
|
|
656
|
+
`,hh=g.div`
|
|
657
657
|
position: absolute;
|
|
658
658
|
top: calc(100% + 8px);
|
|
659
659
|
right: 0;
|
|
@@ -666,25 +666,25 @@ import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{useEffect
|
|
|
666
666
|
border-radius: 12px;
|
|
667
667
|
background-color: ${({theme:e})=>e.v2.colors.silver[900]};
|
|
668
668
|
box-shadow: 0 0 24px 0 rgba(0, 0, 0, 0.3);
|
|
669
|
-
`,
|
|
669
|
+
`,mh=g.div`
|
|
670
670
|
display: flex;
|
|
671
671
|
flex-direction: column;
|
|
672
672
|
gap: 12px;
|
|
673
673
|
padding: 16px;
|
|
674
674
|
max-height: 60vh;
|
|
675
675
|
overflow-y: auto;
|
|
676
|
-
`,
|
|
676
|
+
`,gh=g.div`
|
|
677
677
|
display: flex;
|
|
678
678
|
align-items: center;
|
|
679
679
|
gap: 8px;
|
|
680
680
|
padding: 12px 16px;
|
|
681
681
|
border-top: 1px solid ${({theme:e})=>e.v2.colors.silver[700]};
|
|
682
|
-
`,
|
|
682
|
+
`,fh=g.div`
|
|
683
683
|
display: flex;
|
|
684
684
|
align-items: center;
|
|
685
685
|
gap: 8px;
|
|
686
686
|
margin-left: auto;
|
|
687
|
-
`,
|
|
687
|
+
`,bh=()=>{const n=f(),{sourcesApi:l,namespacesApi:s}=yl(),c=l.useSources().items,d=s.useNamespaces().items,{selectedStreamName:u}=Ze(),{getItemSS:p,setItemSS:h,removeItemSS:m}=Na(),{namespaces:g,kinds:b,monitors:y,languages:v,onlyErrors:C,podsAgentInjectionStatus:S,setAll:w,clearAll:x,getEmptyState:k}=$a(),T=a(()=>Ia(c,u),[c,u]);o(()=>{const e=p(Ea.OVERVIEW_FILTERS,k());w(e)},[]);const[$,I]=r({namespaces:g,kinds:b,monitors:y,languages:v,onlyErrors:C,podsAgentInjectionStatus:S}),[E,A]=r(dh($)),[N,O]=r(!1);o(()=>{if(!N){const e={namespaces:g,kinds:b,monitors:y,languages:v,onlyErrors:C,podsAgentInjectionStatus:S};I(e),A(dh(e))}},[N,g,b,y,v,C,S]);const R=i(null);gn(R,()=>O(!1)),Wn({key:"Escape",active:N},()=>O(!1));const D=a(()=>{const e=new Set,t=[];return d.forEach(({name:n})=>{e.has(n)||(e.add(n),t.push({id:n,label:n,withCheckbox:!0}))}),t},[d]),P=a(()=>{const e=new Set,t=[];return T.forEach(({id:n})=>{const{kind:o}=n;e.has(o)||(e.add(o),t.push({id:o,label:o,withCheckbox:!0}))}),t},[T]),F=a(()=>{const e=new Set,t=[];return T.forEach(({runtimeInfo:n})=>{n?.detectedLanguages?.forEach(n=>{e.has(n)||(e.add(n),t.push({id:n,label:Ke[n]||n,withCheckbox:!0}))})}),t.sort((e,t)=>e.id.localeCompare(t.id))},[T]),L=a(()=>Aa.map(({id:e,value:t})=>({id:e,label:t,withCheckbox:!0})),[]),M=a(()=>{const e=new Set,t=[];return T.forEach(({podsAgentInjectionStatus:n})=>{const{reasonEnum:o,message:a}=n||{};if(o){if(e.has(o))return;e.add(o),t.push({id:o,label:Xt(o)})}else if(a){if(e.has(a))return;e.add(a),t.push({id:a,label:a,withCheckbox:!0})}}),t},[T]),_=(e,t,n)=>{const o=t.filter(e=>n.includes(e.id));I(t=>{return{...t,[e]:(n=o,n.map(({id:e,label:t})=>({id:e,label:t})))};var n})},z=N?Ni:Oi,B=a(()=>ch($.languages),[$.languages]);return e(uh,{ref:R,children:[e(ph,{"data-id":"filters-trigger",$isOpen:N,type:"button",onClick:()=>O(e=>!e),children:[t(dl,{size:16,fill:n.v2.colors.white[500]}),t(se,{size:de.XS,weight:500,nowrap:!0,children:"Filters"}),E>0&&t(We,{label:E,status:Pe.Unknown,textSize:de.XXXS}),t(z,{size:16,fill:n.v2.colors.silver[200]})]}),N&&e(hh,{children:[e(mh,{children:[t(gt,{label:"Namespace",placeholder:"All",withSearch:!0,withMultiSelect:!0,disabled:!D.length,options:D,values:ch($.namespaces),setValues:e=>_("namespaces",D,e)}),t(gt,{label:"Kind",placeholder:"All",withSearch:!0,withMultiSelect:!0,disabled:!P.length,options:P,values:ch($.kinds),setValues:e=>_("kinds",P,e)}),t(gt,{label:"Programming Language",placeholder:"All",withSearch:!0,withMultiSelect:!0,disabled:!F.length,options:F,values:B,setValues:e=>_("languages",F,e)}),t(gt,{label:"Monitors",placeholder:"All",withSearch:!0,withMultiSelect:!0,disabled:!L.length,options:L,values:ch($.monitors),setValues:e=>_("monitors",L,e)}),t(gt,{label:"Agent Injection Status",placeholder:"All",withSearch:!0,withMultiSelect:!0,disabled:!M.length,options:M,values:ch($.podsAgentInjectionStatus),setValues:e=>_("podsAgentInjectionStatus",M,e)}),t(oe,{label:"Show only sources with errors",size:Tt.L,value:!!$.onlyErrors,onChange:e=>I(t=>({...t,onlyErrors:e}))})]}),e(gh,{children:[t(pe,{"data-id":"filters-reset",size:he.S,variant:me.Text,label:"Reset",onClick:()=>{m(Ea.OVERVIEW_FILTERS),x(),I(k()),A(0),O(!1)},textColor:n.v2.colors.red[500]}),e(fh,{children:[t(pe,{"data-id":"filters-cancel",size:he.S,variant:me.Secondary,label:"Cancel",onClick:()=>O(!1)}),t(pe,{"data-id":"filters-apply",size:he.S,variant:me.Primary,label:"Apply",onClick:()=>{h(Ea.OVERVIEW_FILTERS,$),w($),A(dh($)),O(!1)}})]})]})]})]})},yh=g.div`
|
|
688
688
|
position: relative;
|
|
689
689
|
display: flex;
|
|
690
690
|
align-items: center;
|
|
@@ -695,7 +695,7 @@ import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{useEffect
|
|
|
695
695
|
box-sizing: border-box;
|
|
696
696
|
border-radius: 16px 16px 0 0;
|
|
697
697
|
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
698
|
-
`,
|
|
698
|
+
`,vh=g.div`
|
|
699
699
|
position: absolute;
|
|
700
700
|
bottom: 0;
|
|
701
701
|
left: 0;
|
|
@@ -704,7 +704,7 @@ import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{useEffect
|
|
|
704
704
|
background-color: ${({theme:e})=>e.v2.colors.purple[500]};
|
|
705
705
|
border-radius: 32px;
|
|
706
706
|
transition: width 0.3s;
|
|
707
|
-
`,
|
|
707
|
+
`,Ch=({entityType:n,badge:o,badgeTooltip:a,isLoading:i,refetch:l,partiallySelected:r,allSelected:s,onSelectAll:c,progressPercent:d})=>{const{setCurrentModal:u}=Qn();return e(yh,{children:[e(ue,{$gap:8,style:{flex:1,minWidth:0},children:[c&&t(Q,{size:Oa.S,partiallyChecked:r,value:!!s,onChange:c}),t(se,{size:de.S,nowrap:!0,children:`${Xt(n)}s`}),t(We,{label:o,tooltip:a,status:Pe.Unknown,textSize:de.XXXS})]}),e(ue,{children:[t(ft,{"data-id":`add-${n}`,icon:yi,onClick:()=>u(n)}),t(ft,{"data-id":`refresh-${n}`,icon:Xi,onClick:l,disabled:i})]}),"number"==typeof d&&t(vh,{$percent:d})]})},Sh=g(q)`
|
|
708
708
|
align-items: center !important;
|
|
709
709
|
justify-content: center !important;
|
|
710
710
|
align-self: stretch;
|
|
@@ -719,7 +719,7 @@ import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{useEffect
|
|
|
719
719
|
&:hover {
|
|
720
720
|
background-color: ${({theme:e})=>e.v2.colors.silver[1e3]};
|
|
721
721
|
}
|
|
722
|
-
`,
|
|
722
|
+
`,wh=({entityType:n,description:o})=>{const{setCurrentModal:a}=Qn();return e(Sh,{onClick:()=>a(n),children:[e(ue,{$gap:4,children:[t(yi,{size:16}),t(se,{size:de.S,children:`Add ${Xt(n)}`})]}),t(se,{size:de.XXS,align:"center",children:o})]})},xh=g.div`
|
|
723
723
|
display: flex;
|
|
724
724
|
align-items: center;
|
|
725
725
|
gap: 12px;
|
|
@@ -734,10 +734,10 @@ import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{useEffect
|
|
|
734
734
|
&:hover {
|
|
735
735
|
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
736
736
|
}
|
|
737
|
-
`,
|
|
737
|
+
`,kh=g(ue)`
|
|
738
738
|
flex: 1;
|
|
739
739
|
min-width: 0;
|
|
740
|
-
`,
|
|
740
|
+
`,Th=({entityId:n,entityType:o,title:i,status:l,faded:r,tooltip:s,throughput:c,icon:d,icons:u,iconSrc:p,isActive:h,raw:m})=>{const g=f(),b=o===xt.Source,y="boolean"==typeof h,v=r||y&&!h,{setDrawerType:C,setDrawerEntityId:S}=ln(),{selectedSources:w,setSelectedSources:x}=Ra(),k=m,T=b?k.id.namespace:"",$=a(()=>{if(!b)return-1;const e=w[T];return e?.length?e.findIndex(e=>e.id.name===k.id.name&&e.id.kind===k.id.kind):-1},[b,w,T,k.id]),I=y&&!h?Da(Pe.Info,g):l?Da(l,g):void 0,E=b&&"object"==typeof n?`${n.namespace}-${n.name}-${n.kind}`:n;return e(xh,{"data-id":E,$faded:v,onClick:()=>{C(o),S(n)},children:[b&&t(Q,{size:Oa.S,value:-1!==$,onChange:()=>{const e={...w};e[T]||(e[T]=[]),-1===$?e[T].push(k):e[T].splice($,1),x(e)}}),t(dn,{icons:u,icon:d,iconSrc:p}),e(kh,{$gap:4,children:[t(Ne,{size:de.XS,nowrap:!0,children:i}),t(ue,{$gap:6,$justifyContent:"flex-end",style:{marginLeft:"auto",flexShrink:0},children:c&&t($e,{text:s||"Heads up! The data-flow metrics you see are calculated over 10-second intervals.",children:t(We,{label:c,status:l&&[Pe.Error,Pe.Warning].includes(l)?l:Pe.Unknown,leftIcon:I,textSize:de.XXXS})})})]})]})};function $h(e){return Object.values(e.conditions??{}).filter(Boolean).some(({status:e})=>e===Pe.Loading)?e:{...e,workloadOdigosHealthStatus:{status:Yt.Pending,name:"WorkloadOdigosHealthStatus",reasonEnum:"Pending",message:""}}}function Ih(e){const t=Object.values(e.conditions??{}).filter(Boolean),n=t.filter(({status:e})=>e!==Pe.Loading);return n?.length===t?.length?e:{...e,conditions:n?.length?n.reduce((e,t)=>(e[t.name]=t,e),{}):{}}}const Eh=g.div`
|
|
741
741
|
position: absolute;
|
|
742
742
|
top: 0;
|
|
743
743
|
left: 0;
|
|
@@ -748,21 +748,21 @@ import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{useEffect
|
|
|
748
748
|
background-color: ${({theme:e})=>e.v2.colors.silver[900]};
|
|
749
749
|
border-bottom: 1px solid ${({theme:e})=>e.v2.colors.silver[700]};
|
|
750
750
|
pointer-events: none;
|
|
751
|
-
`,
|
|
751
|
+
`,Ah=g.div`
|
|
752
752
|
display: flex;
|
|
753
753
|
align-items: center;
|
|
754
754
|
gap: 8px;
|
|
755
755
|
padding: 4px 8px 0;
|
|
756
|
-
`,
|
|
756
|
+
`,Nh=g.div`
|
|
757
757
|
flex: 1;
|
|
758
758
|
height: 1px;
|
|
759
759
|
background: ${({theme:e})=>e.v2.colors.silver[700]};
|
|
760
|
-
`,
|
|
760
|
+
`,Oh=({namespace:e})=>{const n=f();return t(Eh,{children:t(se,{size:de.XXS,nowrap:!0,color:n.v2.colors.grey[300],children:e})})},Rh=({namespace:n})=>{const o=f();return e(Ah,{children:[t(Nh,{}),t(se,{size:de.XXS,nowrap:!0,color:o.v2.colors.grey[300],children:n}),t(Nh,{})]})},Dh={[xt.InstrumentationRule]:qe.NO_DATA_INSTRUMENTATION_RULES,[xt.Source]:qe.NO_DATA_SOURCES,[xt.Action]:qe.NO_DATA_ACTIONS,[xt.Destination]:qe.NO_DATA_DESTINATIONS},Ph=g.div`
|
|
761
761
|
display: flex;
|
|
762
762
|
flex-direction: column;
|
|
763
763
|
flex: 1 0 0;
|
|
764
764
|
min-width: 0;
|
|
765
|
-
`,
|
|
765
|
+
`,Fh=g.div`
|
|
766
766
|
display: flex;
|
|
767
767
|
flex-direction: column;
|
|
768
768
|
align-items: stretch;
|
|
@@ -772,7 +772,7 @@ import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{useEffect
|
|
|
772
772
|
border-radius: 0 0 16px 16px;
|
|
773
773
|
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
774
774
|
overflow: hidden;
|
|
775
|
-
|
|
775
|
+
`,Lh=g.div`
|
|
776
776
|
position: relative;
|
|
777
777
|
display: flex;
|
|
778
778
|
flex-direction: column;
|
|
@@ -784,7 +784,7 @@ import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{useEffect
|
|
|
784
784
|
background-color: ${({theme:e})=>e.v2.colors.silver[900]};
|
|
785
785
|
height: ${({$height:e})=>e}px;
|
|
786
786
|
overflow: hidden;
|
|
787
|
-
`,
|
|
787
|
+
`,Mh=(e,t,n)=>{const o=Ot(e);if(!o)return null;const a=t===xt.Source;let i,l,r=!1,s=e;if(a){const t=function(e){const t=e.workloadOdigosHealthStatus?.status;switch(t){case Yt.Failure:return{status:Pe.Error,faded:!1,tooltip:e.workloadOdigosHealthStatus?.message,displaySource:e};case Yt.Notice:return{status:Pe.Warning,faded:!1,tooltip:e.workloadOdigosHealthStatus?.message,displaySource:e};case Yt.Pending:case Yt.Waiting:return{status:void 0,faded:!1,displaySource:$h(e)};case Yt.Unsupported:case Yt.Disabled:return{status:void 0,faded:!0,tooltip:e.workloadOdigosHealthStatus?.message,displaySource:e};default:return{status:void 0,faded:!1,displaySource:Ih(e)}}}(e);i=t.status,r=t.faded,l=t.tooltip,s=t.displaySource}else{const{priorotizedStatus:t,hasDisableds:n}=Fa(e.conditions);i=t,r=n}const c=La(e,t,{extended:a,prioritizeDisplayName:!a});let d,u,p,h,m;switch(t){case xt.Source:{d=cn(e),u=_a(xt.Source);const t=n?.get(Ma(o));h=pn(t);break}case xt.Destination:{const t=Ct(e.destinationType.type);u=t.icon,p=t.iconSrc;const a=n?.get(Ma(o));h=pn(a),m=!e.disabled;break}case xt.Action:u=Lt(e.type),m=!e.disabled;break;case xt.InstrumentationRule:u=Gt(e.type),m=!e.disabled}return{key:Ma(o),entityId:o,namespace:a?e.id.namespace:void 0,raw:s,itemProps:{entityId:o,entityType:t,title:c,status:i,faded:r,tooltip:l,throughput:h,icon:u,icons:d,iconSrc:p,isActive:m,raw:s}}},_h=({entityType:n,entities:i,unfilteredCount:s,metrics:c,loading:d,maxHeight:u,refetch:p})=>{const h=n===xt.Source,m=i.length!==s,g=It(e=>h?e.progress[Nt.Instrumenting]?.percentage:void 0),f=It(e=>h?e.progress[Nt.Uninstrumenting]?.percentage:void 0),b=!h||void 0===g&&void 0===f?void 0:g||f||0,{selectedSources:y,setSelectedSources:v}=Ra(),C=a(()=>h?Object.values(y).reduce((e,t)=>e+t.length,0):0,[h,y]),S=a(()=>{if(!c)return;const e=new Map,t=n===xt.Source?c.sources:n===xt.Destination?c.destinations:void 0;if(t)for(const n of t)e.set(Pa(n),n.throughput);return e},[c,n]),w=a(()=>i.map(e=>Mh(e,n,S)).filter(Boolean),[i,n,S]),[x,k]=r(""),{elements:T,indexToNamespace:$,multipleNs:I,dividerCount:E}=a(()=>{const e=[],n=[],o=new Set(w.map(e=>e.namespace).filter(Boolean)).size>1;o&&(n.push(""),e.push(t("div",{style:{height:24}},"ns-spacer")));let a=0,i="";for(const o of w)h&&o.namespace&&o.namespace!==i&&(""!==i&&(n.push(o.namespace),e.push(t(Rh,{namespace:o.namespace},`ns-divider-${o.namespace}`)),a+=1),i=o.namespace),n.push(o.namespace||""),e.push(t(Th,{...o.itemProps},o.key));return{elements:e,indexToNamespace:n,multipleNs:o,dividerCount:a}},[w,h]);o(()=>{if(h&&$.length&&!x){const e=$.find(Boolean);e&&k(e)}},[h,$]);const A=l(e=>{if(!$.length)return;const t=$[Math.min(e,$.length-1)];t&&t!==x&&k(t)},[$,x]),N=58*w.length+(I?28:0)+32*E,O=Math.max(0,u-52-16),R=Math.min(O,N)+8,D="number"==typeof b?`${b}%`:m?`${i.length}/${s}`:s;return e(Ph,{children:[t(Ch,{entityType:n,badge:D,badgeTooltip:m?qe.FILTERED_COUNT_TOOLTIP:void 0,isLoading:d,refetch:p,partiallySelected:C>0&&i?.length!==C,allSelected:C>0&&i?.length===C,onSelectAll:h?e=>{if(h)if(e){const e={};i?.forEach(t=>{const{namespace:n}=t.id;e[n]?e[n].push(t):e[n]=[t]}),v(e)}else v({})}:void 0,progressPercent:b}),t(Fh,{children:i.length?e(Lh,{$height:R,children:[I&&x&&t(Oh,{namespace:x}),t(an,{gap:4,elements:T,onTopIndexChange:I?A:void 0})]}):d?t(pt,{size:3}):t(wh,{entityType:n,description:Dh[n]??qe.TO_COLLECT_OTEL_DATA})})]})},zh=g.div`
|
|
788
788
|
width: 100%;
|
|
789
789
|
flex: 1;
|
|
790
790
|
min-height: 0;
|
|
@@ -792,10 +792,10 @@ import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{useEffect
|
|
|
792
792
|
display: flex;
|
|
793
793
|
align-items: stretch;
|
|
794
794
|
gap: 16px;
|
|
795
|
-
`,
|
|
795
|
+
`,Bh={sources:[],destinations:[]},Xh=()=>{const n=$a(),{selectedStreamName:o}=Ze(),{containerRef:i,containerHeight:l}=za(),{sourcesApi:r,destinationsApi:s,actionsApi:c,instrumentationRulesApi:d,metricsApi:u}=yl(),{items:p,loading:h}=r.useSources(),{items:m,loading:g}=s.useDestinations(),{items:f,loading:b}=c.useActions(),{items:y,loading:v}=d.useRules(),C=ln(e=>e.drawerType),S=Qn(e=>e.currentModal),{data:w}=u.useMetrics({skip:!(p.length&&m.length&&!C&&!S),pollInterval:1e4,fetchPolicy:"network-only"}),x=w?.getOverviewMetrics??Bh,k=a(()=>Ia(p,o),[p,o]),T=a(()=>zt(m,o),[m,o]),$=a(()=>Ba(k,n),[k,n]),I=a(()=>Xa(T,n),[T,n]),E=a(()=>Va(f,n),[f,n]);return e(zh,{ref:i,children:[t(_h,{entityType:xt.InstrumentationRule,entities:y,unfilteredCount:y.length,loading:v,maxHeight:l,refetch:d.fetchAll}),t(_h,{entityType:xt.Source,entities:$,unfilteredCount:k.length,metrics:x,loading:h,maxHeight:l,refetch:r.fetchAll}),t(_h,{entityType:xt.Action,entities:E,unfilteredCount:f.length,loading:b,maxHeight:l,refetch:c.fetchAll}),t(_h,{entityType:xt.Destination,entities:I,unfilteredCount:T.length,metrics:x,loading:g,maxHeight:l,refetch:s.fetchAll})]})},Vh="40vw",Uh=g.div`
|
|
796
796
|
position: relative;
|
|
797
|
-
width: ${
|
|
798
|
-
`,
|
|
797
|
+
width: ${Vh};
|
|
798
|
+
`,jh=g.div`
|
|
799
799
|
position: absolute;
|
|
800
800
|
top: calc(100% + 8px);
|
|
801
801
|
left: 0;
|
|
@@ -804,23 +804,23 @@ import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{useEffect
|
|
|
804
804
|
flex-direction: column;
|
|
805
805
|
gap: 8px;
|
|
806
806
|
padding: 8px;
|
|
807
|
-
width: calc(${
|
|
807
|
+
width: calc(${Vh} - 16px);
|
|
808
808
|
border-radius: 12px;
|
|
809
809
|
background-color: ${({theme:e})=>e.v2.colors.silver[900]};
|
|
810
810
|
box-shadow: 0 12px 24px 24px rgba(0, 0, 0, 0.5);
|
|
811
|
-
`,
|
|
811
|
+
`,Gh=g.div`
|
|
812
812
|
display: flex;
|
|
813
813
|
align-items: center;
|
|
814
814
|
overflow-x: auto;
|
|
815
|
-
`,
|
|
815
|
+
`,Hh=g.div`
|
|
816
816
|
display: flex;
|
|
817
817
|
flex-direction: column;
|
|
818
818
|
gap: 0;
|
|
819
819
|
max-height: 60vh;
|
|
820
820
|
overflow-y: auto;
|
|
821
|
-
`,
|
|
821
|
+
`,Wh=g.div`
|
|
822
822
|
padding: 8px 12px 4px 12px;
|
|
823
|
-
`,
|
|
823
|
+
`,Kh=g.div`
|
|
824
824
|
display: flex;
|
|
825
825
|
align-items: center;
|
|
826
826
|
gap: 8px;
|
|
@@ -830,12 +830,12 @@ import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{useEffect
|
|
|
830
830
|
&:hover {
|
|
831
831
|
background-color: ${({theme:e})=>e.v2.colors.silver[700]};
|
|
832
832
|
}
|
|
833
|
-
`,
|
|
833
|
+
`,Yh=g.div`
|
|
834
834
|
padding: 16px 8px;
|
|
835
|
-
`,
|
|
835
|
+
`,Jh=({preventPopup:n=!1})=>{const o=f(),{onClickNode:l}=Ua(),{searchText:c,setSearchText:d}=$a(),{selectedStreamName:u}=Ze(),{sourcesApi:p,destinationsApi:h,actionsApi:m,instrumentationRulesApi:g}=yl(),b=p.useSources().items,y=h.useDestinations().items,v=m.useActions().items,C=g.useRules().items,S=i(null),[w,x]=r(!1),[k,T]=r("all"),$=!n&&(!!c||w),I=()=>{d(""),x(!1),T("all")};gn(S,()=>I()),Wn({key:"Escape",active:$},I);const{categories:E,searchResults:A}=a(()=>(({instrumentationRules:e,sources:t,actions:n,destinations:o,searchText:a,selectedCategory:i})=>{const l=a?e.filter(e=>e.type?.toLowerCase().includes(a)||e.ruleName?.toLowerCase().includes(a)):e,r=a?t.filter(e=>e.id.name?.toLowerCase().includes(a)||e.serviceName?.toLowerCase().includes(a)||e.id.namespace?.toLowerCase().includes(a)):t,s=a?n.filter(e=>e.type?.toLowerCase().includes(a)||e.name?.toLowerCase().includes(a)):n,c=a?o.filter(e=>e.destinationType.displayName?.toLowerCase().includes(a)||e.name?.toLowerCase().includes(a)):o,d=[{category:xt.Source,label:"Sources",count:r.length,entities:[]},{category:xt.Action,label:"Actions",count:s.length,entities:[]},{category:xt.Destination,label:"Destinations",count:c.length,entities:[]},{category:xt.InstrumentationRule,label:"Instrumentation Rules",count:l.length,entities:[]}];d.unshift({category:"all",label:"All",count:l.length+r.length+s.length+c.length,entities:[]});const u=d.filter(({count:e,category:t})=>!!e&&"all"!==t&&["all",t].includes(i)).map(e=>({...e,entities:e.category===xt.InstrumentationRule?l:e.category===xt.Source?r:e.category===xt.Action?s:e.category===xt.Destination?c:[]}));return{categories:d,searchResults:u}})({instrumentationRules:C,sources:Ia(b,u),actions:v,destinations:zt(y,u),searchText:c,selectedCategory:k}),[C,b,v,y,u,c,k]),N=a(()=>E.filter(({count:e,category:t})=>!!e||"all"===t).map(({category:e,label:t,count:n})=>({value:e,label:n?`${t} (${n})`:t})),[E]),O=A.some(({entities:e})=>e.length>0);return e(Uh,{ref:S,children:[t(on,{value:c,onChange:e=>d(e.toLowerCase()),onFocus:()=>x(!0),width:Vh}),$&&e(jh,{children:[N.length>1&&t(Gh,{children:t(ge,{options:N,selected:k,setSelected:T})}),O?t(Hh,{children:A.map(({category:n,label:a,entities:i},r)=>{if(!i.length)return null;const c=_a(n);return e(s,{children:[t(Wh,{children:t(se,{size:de.XXS,color:ce.Secondary,children:a})}),i.map((a,i)=>e(Kh,{onClick:()=>{const e=Ot(a);l(null,{data:{type:n,id:e}}),I()},children:[c&&t(c,{size:16,fill:o.v2.colors.white[500]}),t(se,{size:de.XS,nowrap:!0,children:La(a,n,{extended:!0})})]},`entity-${r}-${i}`))]},`category-list-${n}`)})}):t(Yh,{children:t(Ae,{hideIcon:!0,title:"No results",subTitle:c?`No matches for "${c}"`:"Start typing to search"})})]})]})},qh=({onRedirectToSampling:o})=>{const{sourcesApi:i}=yl(),{items:l}=i.useSources(),{currentModal:r,setCurrentModal:s}=Qn(),{drawerType:c,drawerEntityId:d,setDrawerType:u,setDrawerEntityId:p}=ln(),h=()=>{s("")},m=()=>{u(null),p(null)},g=a(()=>l.map(({id:e})=>({id:`${e.namespace}/${e.kind}/${e.name}`,label:e.name,badge:e.kind,secondaryLabel:e.namespace})),[l]),f=a(()=>Array.from(new Set(l.map(({id:e})=>e.namespace))).sort().map(e=>({id:e,label:e})),[l]);return e(n,{children:[t(Ku,{}),r===xt.Source&&t(Ql,{children:t(sc,{onClose:h,withOverlay:!0})}),r===xt.Destination&&t(er,{children:t(Xs,{onClose:h,withOverlay:!0})}),r===xt.InstrumentationRule&&t(nr,{sourceOptions:g,namespaceOptions:f,children:t(Vs,{onClose:h,withOverlay:!0})}),r===xt.Action&&t(tr,{children:t(Os,{onClose:h,withOverlay:!0})}),c===xt.Source&&d&&t(or,{children:t(Cu,{onClose:m,sourceId:d,onRedirectToSampling:o})}),c===xt.Destination&&d&&t(er,{children:t(hc,{onClose:m,destinationId:d})}),c===xt.InstrumentationRule&&d&&t(nr,{sourceOptions:g,namespaceOptions:f,children:t(gc,{onClose:m,ruleId:d})}),c===xt.Action&&d&&t(tr,{children:t(dc,{onClose:m,actionId:d})})]})},Zh=e=>`Data Stream: ${e}`,Qh="Search streams...",em="No streams match",tm=g.div`
|
|
836
836
|
position: relative;
|
|
837
837
|
display: inline-flex;
|
|
838
|
-
`,
|
|
838
|
+
`,nm=g.div`
|
|
839
839
|
display: inline-flex;
|
|
840
840
|
align-items: center;
|
|
841
841
|
gap: 6px;
|
|
@@ -846,7 +846,7 @@ import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{useEffect
|
|
|
846
846
|
&:hover {
|
|
847
847
|
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
848
848
|
}
|
|
849
|
-
`,
|
|
849
|
+
`,om=g.div`
|
|
850
850
|
position: absolute;
|
|
851
851
|
top: calc(100% + 8px);
|
|
852
852
|
left: 0;
|
|
@@ -860,18 +860,18 @@ import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{useEffect
|
|
|
860
860
|
border-radius: 12px;
|
|
861
861
|
background-color: ${({theme:e})=>e.v2.colors.silver[900]};
|
|
862
862
|
box-shadow: 0 0 24px 0 rgba(0, 0, 0, 0.3);
|
|
863
|
-
`,
|
|
863
|
+
`,am=g.div`
|
|
864
864
|
display: flex;
|
|
865
865
|
align-items: center;
|
|
866
866
|
gap: 8px;
|
|
867
867
|
width: 100%;
|
|
868
|
-
`,
|
|
868
|
+
`,im=g.div`
|
|
869
869
|
display: flex;
|
|
870
870
|
flex-direction: column;
|
|
871
871
|
gap: 0;
|
|
872
872
|
max-height: 240px;
|
|
873
873
|
overflow-y: auto;
|
|
874
|
-
`,
|
|
874
|
+
`,lm=g.div`
|
|
875
875
|
display: flex;
|
|
876
876
|
align-items: center;
|
|
877
877
|
gap: 8px;
|
|
@@ -882,29 +882,29 @@ import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{useEffect
|
|
|
882
882
|
&:hover {
|
|
883
883
|
background-color: ${({$selected:e,theme:t})=>e?t.v2.colors.silver[600]:t.v2.colors.silver[700]};
|
|
884
884
|
}
|
|
885
|
-
`,
|
|
885
|
+
`,rm=g.div`
|
|
886
886
|
flex: 1;
|
|
887
887
|
min-width: 0;
|
|
888
888
|
overflow: hidden;
|
|
889
889
|
text-overflow: ellipsis;
|
|
890
890
|
white-space: nowrap;
|
|
891
|
-
`,
|
|
891
|
+
`,sm=g.div`
|
|
892
892
|
display: flex;
|
|
893
893
|
align-items: center;
|
|
894
894
|
gap: 2px;
|
|
895
895
|
flex-shrink: 0;
|
|
896
|
-
`,
|
|
896
|
+
`,cm=g.div`
|
|
897
897
|
display: flex;
|
|
898
898
|
padding-top: 4px;
|
|
899
899
|
border-top: 1px solid ${({theme:e})=>e.v2.colors.silver[700]};
|
|
900
|
-
`,
|
|
900
|
+
`,dm=()=>{const l=f(),{isVm:s}=v(),{clearStore:c}=ja(),{dataStreamsApi:d}=yl();d.useDataStreams();const{dataStreams:u,selectedStreamName:p,setSelectedStreamName:h}=Ze(),m=i(null),[g,b]=r(!1),[y,C]=r(""),[S,w]=r(""),[x,k]=r(!1),[T,$]=r(!1),[I,E]=r(!1),[A,N]=r(""),[O,R]=r(!1);gn(m,()=>b(!1)),o(()=>{g||C("")},[g]);const D=a(()=>{if(!y)return u;const e=y.toLowerCase();return u.filter(({name:t})=>t.toLowerCase().includes(e))},[u,y]),P=g?Ni:Oi;return s?null:e(n,{children:[e(tm,{ref:m,children:[e(nm,{"data-id":"data-stream-select",$isOpen:g,onClick:()=>b(e=>!e),children:[t(ul,{size:24}),t(se,{size:de.S,weight:500,nowrap:!0,children:Zh(p)}),t(We,{label:u.length,status:Pe.Unknown,textSize:de.XXXS}),t(P,{size:20,fill:l.v2.colors.silver[200]})]}),g&&e(om,{children:[t(am,{children:t(on,{value:y,onChange:C,placeholder:Qh,width:"100%"})}),t(im,{children:0===D.length?t(lm,{children:t(se,{size:de.XS,color:ce.Secondary,children:em})}):D.map(({name:n})=>{const o=n===Ga;return e(lm,{"data-id":`stream-row-${n}`,$selected:n===p,onClick:()=>(e=>{e!==p&&(c(),h(e)),b(!1)})(n),children:[t(rm,{children:t(se,{size:de.XS,nowrap:!0,children:n})}),e(sm,{children:[t(ft,{"data-id":`stream-edit-${n}`,icon:ki,size:bt.XS,onClick:e=>{e.stopPropagation(),b(!1),w(n),k(!0)}}),!o&&t(ft,{"data-id":`stream-delete-${n}`,icon:bi,size:bt.XS,onClick:e=>{e.stopPropagation(),b(!1),N(n),R(!0)}})]})]},`stream-${n}`)})}),t(cm,{children:t(pe,{"data-id":"add-stream-trigger",variant:me.Secondary,size:he.S,leftIcon:yi,label:`${Dt.NEW} ${qe.STREAM_NAME}`,fullWidth:!0,onClick:()=>{b(!1),c(),E(!0),$(!0)}})})]})]}),I&&t(ar,{defaultExcludeName:p,children:t(Uu,{isOpen:T,onClose:()=>$(!1),onCloseEnd:()=>E(!1)})}),S&&t(ar,{children:t(ju,{isOpen:x,dataStreamName:S,onClose:()=>k(!1),onCloseEnd:()=>w("")})}),t(Dl,{target:`${qe.STREAM_NAME.toLowerCase()} "${A}"`,isOpen:O,onClose:()=>R(!1),onApprove:async()=>{A&&await d.remove(A)}})]})},um="multi-source-deselect",pm="multi-source-restart",hm="multi-source-uninstrument",mm="Selected sources",gm="Deselect",fm="Restart",bm="Uninstrument",ym="Rollout Restart Workloads",vm="Are you sure you want to rollout restart these workloads?",Cm="Go Back",Sm="Confirm",wm=()=>{const{selectedStreamName:i}=Ze(),{selectedSources:s,setSelectedSources:c}=Ra(),{sourcesApi:d}=yl(),[u,p]=r(!1),[h,m]=r(!1),g=a(()=>Object.values(s).reduce((e,t)=>e+t.length,0),[s]),f=l(()=>{c({})},[c]),b=l(()=>p(!1),[]),y=l(()=>m(!1),[]);o(()=>{f()},[i,f]);const v=l(()=>{d.restartWorkloads(Object.values(s).flat().filter(e=>e.id.kind!==un.StaticPod).map(rn)),f()},[d,s,f]),C=l(()=>{d.persistV2(Object.fromEntries(Object.entries(s).map(([e,t])=>[e,t.map(({id:e})=>({namespace:e.namespace,name:e.name,kind:e.kind||void 0,selected:!1,currentStreamName:i}))]))),f()},[d,s,i,f]),S=a(()=>[{id:um,type:nn.Button,buttonProps:{variant:me.Text,size:he.S,label:gm,onClick:f}},{id:pm,type:nn.Button,buttonProps:{variant:me.Secondary,size:he.S,label:fm,leftIcon:tl,onClick:()=>p(!0)}},{id:hm,type:nn.Button,buttonProps:{variant:me.Primary,size:he.S,label:bm,leftIcon:bi,onClick:()=>m(!0)}}],[f]);return e(n,{children:[t(kn,{isOpen:g>0,richTitle:{icon:Fi,title:mm,badge:{label:g}},actions:S}),t(Je,{isOpen:u,title:ym,description:vm,onClose:b,denyButton:{label:Cm,variant:me.Secondary,onClick:b},approveButton:{label:Sm,variant:me.Primary,onClick:()=>{v(),b()}}}),t(Dl,{isOpen:h,action:"uninstrument",target:`${g} source${1===g?"":"s"}`,onClose:y,onDeny:y,onApprove:C})]})},xm=y`
|
|
901
901
|
0% {
|
|
902
902
|
background-position: 200% 50%;
|
|
903
903
|
}
|
|
904
904
|
100% {
|
|
905
905
|
background-position: 0% 50%;
|
|
906
906
|
}
|
|
907
|
-
`,
|
|
907
|
+
`,km=g.div`
|
|
908
908
|
display: flex;
|
|
909
909
|
align-items: center;
|
|
910
910
|
justify-content: space-evenly;
|
|
@@ -915,50 +915,76 @@ import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{useEffect
|
|
|
915
915
|
|
|
916
916
|
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%)`};
|
|
917
917
|
background-size: 200% 100%;
|
|
918
|
-
animation: ${
|
|
919
|
-
`,
|
|
918
|
+
animation: ${xm} 15s linear infinite;
|
|
919
|
+
`,Tm=[Pi,Fi,Ei,Ai],$m=({onRedirectToSampling:n})=>{const o=f();return e(ka,{children:[e(rt,{fullHeight:!0,customTitle:t(dm,{}),customSearch:t(Jh,{}),filters:t(bh,{}),children:[t(km,{children:Tm.map((n,a)=>e(s,{children:[t(n,{size:24}),a<Tm.length-1&&t(Ii,{fill:o.v2.colors.white[500]+ct["020"],size:24})]},n.name))}),t(Xh,{})]}),t(qh,{onRedirectToSampling:n}),t(wm,{})]})};var Im;!function(e){e.Gateway="gateway",e.Node="node"}(Im||(Im={}));const Em=({onClickDownloadDiagnose:n,onClickRefresh:o,loading:i,disabled:l})=>{const r=a(()=>{const e=[];return n&&e.push({id:Zn(),type:nn.Button,buttonProps:{label:"Download Diagnose",leftIcon:el,size:he.S,variant:me.Text,onClick:n,disabled:l}}),o&&e.push({id:Zn(),type:nn.Button,buttonProps:{label:"Refresh",leftIcon:Xi,size:he.S,variant:me.Text,onClick:o,disabled:l,loading:i}}),e},[n,o,l,i]);return e(ue,{$alignItems:"center",$justifyContent:"space-between",children:[t(Ha,{icon:pl,title:"Collectors Pipeline"}),t(Wa,{actions:r})]})},Am=({pod:n,onClose:o})=>{const{formatTimeAgo:i}=Ht(),{collectorsApi:l}=yl(),{data:r}=l.usePodInfo(n?{namespace:n.namespace,name:n.name}:void 0,{skip:!n}),s=a(()=>[{id:Zn(),title:"Node",label:r?.node??"-",withCopy:!0},{id:Zn(),title:"Status",badge:{status:Ka(r?.status),label:r?.status??"-"}}],[r]),c=a(()=>r?.containers?.map(e=>({id:Zn(),items:[{id:Zn(),title:"Container",label:e.name??"-"},{id:Zn(),title:"Status",label:e.startedAt?`${e.status} (since ${i(e.startedAt)})`:e.status},{id:Zn(),title:"Ready",badge:{status:e.ready?Pe.Success:Pe.Error,leftIcon:e.ready?Ci:Si,label:e.ready?"True":"False",invertColors:!0}},{id:Zn(),title:"Started",badge:{status:e.started?Pe.Success:Pe.Error,leftIcon:e.started?Ci:Si,label:e.started?"True":"False",invertColors:!0}},{id:Zn(),title:"Image Version",label:e.image?.split(":")?.[1]??"-"},{id:Zn(),title:"Image Repository",label:e.image?.split(":")?.[0]??"-"},{id:Zn(),title:qe.RESTARTS,label:e.restarts.toString()},{id:Zn(),title:"State Reason",label:e.stateReason??"-"},{id:Zn(),title:"Resource Requests",label:`CPU ${e.resources.requests.cpu} • Memory ${e.resources.requests.memory}`},{id:Zn(),title:"Resource Limits",label:`CPU ${e.resources.limits.cpu} • Memory ${e.resources.limits.memory}`}]}))||[],[r]);return t(le,{isOpen:!!n,header:{icon:_i,title:"Pod Information",onClose:o},children:r?e(Pt,{bgTint:"1000",richTitle:{icon:_i,title:r.name,withCopy:!0},children:[t(Pt,{bgTint:"900",cellsPerRow:2,items:s}),e(Pt,{bgTint:"900",richTitle:{icon:Wi,title:qe.DEBUG_COMMANDS},withCollapse:!0,collapseIsDefaultOpen:!0,children:[t(tn,{value:`kubectl get pod ${r.name} -n ${r.namespace} -o yaml`}),t(tn,{value:`kubectl describe pod ${r.name} -n ${r.namespace}`}),t(tn,{value:`kubectl logs ${r.name} -n ${r.namespace}`})]}),t(Pt,{bgTint:"900",richTitle:{title:"Containers Overview"},withCollapse:!0,collapseIsDefaultOpen:!0,children:c.length?c.map(({id:e,items:n})=>t(Pt,{bgTint:"800",cellsPerRow:2,items:n},e)):t(Ae,{title:"No containers",subTitle:"Pod has no containers"})}),t(Fl,{bgTint:"900",yaml:r.manifestYAML,defaultOpen:!0})]}):t(ht,{$height:"50vh",children:t(yt,{withSpinner:!0})})})};var Nm;!function(e){e.PodName="podName",e.Status="status",e.Restarts="restarts",e.NodeName="nodeName",e.SpanDropRate="spanDropRate",e.Age="age",e.DockerImage="dockerImage"}(Nm||(Nm={}));const Om=e=>{const t=[{key:Nm.PodName,label:"Pod Name"},{key:Nm.Status,label:"Status"},{key:Nm.Restarts,label:qe.RESTARTS},{key:Nm.NodeName,label:"Node Name"},{key:Nm.Age,label:"Age"},{key:Nm.DockerImage,label:"Collector Version"}];return e&&t.splice(4,0,{key:Nm.SpanDropRate,label:"Span Drop Rate",noSort:!0,noFilter:!0}),t},Rm=({isLoading:n,pods:o,withSpanDropRate:i})=>{const l=f(),{formatTimeAgo:s}=Ht(),[c,d]=r(null),u=a(()=>o.map(n=>({onClick:()=>d(n),cells:[{key:Nm.PodName,rawValue:n.name},{key:Nm.Status,rawValue:n.status,component:()=>{return e=n.status,t(We,{status:Ka(e),label:e});var e}},{key:Nm.Restarts,rawValue:n.restartsCount.toString()},{key:Nm.NodeName,rawValue:n.nodeName},{key:Nm.SpanDropRate,rawValue:0,component:()=>{const{collectorMetrics:o}=n;if(!o)return t(se,{children:"-"});const a=(o?.metricsAcceptedRps??0)+(o?.metricsDroppedRps??0),i=a>0?Math.round((o?.metricsDroppedRps??0)/a*100):0,l=i>0?Pe.Error:Pe.Success,r=(o?.exporterSuccessRps??0)+(o?.exporterFailedRps??0),s=r>0?Math.round((o?.exporterFailedRps??0)/r*100):0,c=s>0?Pe.Error:Pe.Success;return e(ue,{$gap:4,children:[t($e,{text:`Accepted: ${o.metricsAcceptedRps.toLocaleString()} spans/s\nDropped: ${o.metricsDroppedRps.toLocaleString()} spans/s`,children:t(We,{status:l,label:`Receiver ${i}%`,leftIcon:l===Pe.Error?hl:ml,useSecondaryTone:!0,invertColors:!0})}),t($e,{text:`Success: ${o.exporterSuccessRps.toLocaleString()} spans/s\nFailed: ${o.exporterFailedRps.toLocaleString()} spans/s`,children:t(We,{status:c,label:`Exporter ${s}%`,leftIcon:c===Pe.Error?hl:ml,useSecondaryTone:!0,invertColors:!0})})]})}},{key:Nm.Age,rawValue:s(n.creationTimestamp)},{key:Nm.DockerImage,rawValue:n.image}]})),[o,l]);return e(Pt,{fullHeight:!0,bgTint:"1000",moreSpacing:!0,richTitle:{icon:_i,title:"Pods"},children:[t(wn,{variant:xn.Data,isLoading:n,columns:Om(i),rows:u}),t(Am,{pod:c,onClose:()=>d(null)})]})},Dm=({isOpen:e,onClose:n,title:o,yaml:a})=>t(le,{isOpen:e,header:{icon:gl,title:o,onClose:n},children:t(Fl,{yaml:a,defaultOpen:!0})}),Pm=e=>{switch(e){case Ya.Healthy:return"All desired replicas are updated, available, and ready";case Ya.Updating:return"Workload is progressing towards desired state (e.g., updating pods)";case Ya.Degraded:return"Progressing but with availability issues (e.g., not enough available replicas)";case Ya.Failed:return"Progress deadline exceeded or an unrecoverable error occurred";case Ya.Down:return"No available replicas";case Ya.Unknown:return"Status cannot be determined from current signals";default:return"Status unknown"}};var Fm;!function(e){e.ManifestYaml="manifest-yaml",e.ConfigMapYaml="configmap-yaml"}(Fm||(Fm={}));const Lm=g.div`
|
|
920
920
|
flex: 0.5;
|
|
921
921
|
padding: 12px;
|
|
922
922
|
border-radius: 12px;
|
|
923
923
|
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
924
|
-
`,
|
|
924
|
+
`,Mm=({selectedTab:n,gatewayInfo:o,nodeCollectorInfo:i,isLoading:l})=>{const{formatTimeAgo:s}=Ht(),[c,d]=r(null),u=a(()=>(e=>{switch(e){case Im.Gateway:return"Deployment";case Im.Node:return"DaemonSet";default:return"Pipeline Collectors"}})(n),[n]),p=a(()=>((e,t,n,o)=>{const a={status:Pe.Disabled,label:"No rollouts yet"};let i=!1,l=null;switch(e){case Im.Gateway:i=t?.rolloutInProgress??!1,l=t?.lastRolloutAt??null;break;case Im.Node:i=n?.rolloutInProgress??!1,l=n?.lastRolloutAt??null;break;default:return a}return i?{status:Pe.Info,label:"Rollout in progress",rightIcon:Xi,useSecondaryTone:!0}:l?{status:Pe.Disabled,label:`Last Rollout: ${o(l)}`}:a})(n,o,i,s),[o,i,n,s]),h=a(()=>((e,t,n,o)=>{let a=o?Pe.Info:Pe.Unknown,i=o?"Loading":Ya.Unknown,l=o?"Fetching data...":Pm(Ya.Unknown);switch(e){case Im.Gateway:a=t?.status?Ka(t?.status):a,i=t?.status??i,l=t?.status?Pm(t.status):l;break;case Im.Node:a=n?.status?Ka(n?.status):a,i=n?.status??i,l=n?.status?Pm(n.status):l}return{status:a,title:i,description:l}})(n,o,i,l),[o,i,n,l]),m=a(()=>((e,t,n)=>{switch(e){case Im.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 Im.Node:return[{gaugeWidth:128,min:0,max:n?.nodes?.desired??0,current:n?.nodes?.ready??0,title:"Nodes",primaryLabel:"Ready nodes",secondaryLabel:"Desired nodes"}];default:return[]}})(n,o,i),[o,i,n]),g=a(()=>((e,t,n,o)=>{switch(e){case Im.Gateway:return[{title:"Resources (request/limit)",cells:[{label:"CPU",value:`${t?.resources?.requests.cpu}/${t?.resources?.limits.cpu}`,isLoading:o},{label:"Memory",value:`${t?.resources?.requests.memory}/${t?.resources?.limits.memory}`,isLoading:o}]}];case Im.Node:return[{title:"Resources (request/limit)",cells:[{label:"CPU",value:`${n?.resources?.requests.cpu}/${n?.resources?.limits.cpu}`,isLoading:o},{label:"Memory",value:`${n?.resources?.requests.memory}/${n?.resources?.limits.memory}`,isLoading:o}]}];default:return[]}})(n,o,i,l),[o,i,n,l]),f=a(()=>(n===Im.Gateway?o?.manifestYAML:i?.manifestYAML)??"",[o,i,n]),b=a(()=>(n===Im.Gateway?o?.configMapYAML:i?.configMapYAML)??"",[o,i,n]);return e(Pt,{bgTint:"1000",moreSpacing:!0,richTitle:{icon:gl,title:u,badge:p},actions:[{id:Zn(),type:nn.ButtonDropData,buttonProps:{variant:me.Secondary,size:he.S,label:"View YAML",onClick:e=>d(e)},dropDataProps:{items:[{id:Fm.ManifestYaml,label:u,icon:fl},{id:Fm.ConfigMapYaml,label:"ConfigMap",icon:fl}]}}],children:[e(ue,{$gap:16,children:[t("div",{children:t(Ja,{...h})}),m.map(e=>t(Lm,{children:t("div",{children:t(qa,{...e})})},e.title)),g.map(e=>t(Za,{...e},e.title))]}),t(Dm,{isOpen:c===Fm.ManifestYaml,onClose:()=>d(null),title:u,yaml:f}),t(Dm,{isOpen:c===Fm.ConfigMapYaml,onClose:()=>d(null),title:"ConfigMap",yaml:b})]})},_m=[{value:Im.Gateway,label:"Gateway"},{value:Im.Node,label:"Node Collector"}],zm=({minSupportedVersion:n=0})=>{const{isVersionSupported:o,version:i}=v(n),[s,c]=r(Im.Gateway),d=s===Im.Gateway,u=s===Im.Node,{collectorsApi:p,configApi:h}=yl(),{data:m}=h.useEffectiveConfig(),{data:g,loading:f,refetch:b}=p.useGatewayInfo({skip:!d}),{data:y=[],loading:C,refetch:S}=p.useGatewayPods({skip:!d}),{data:w,loading:x,refetch:k}=p.useNodeCollectorInfo({skip:!u}),{data:T=[],loading:$,refetch:I}=p.useNodeCollectorPods({skip:!u}),E=d&&(f||C)||u&&(x||$),A=l(()=>{d?(b(),S()):u&&(k(),I())},[d,u,b,S,k,I]),N=a(()=>d?y:T,[y,T,d]);return e(ka,{children:[t(Em,{disabled:!o,loading:E,onClickDownloadDiagnose:void 0,onClickRefresh:A}),e(Qa,{children:[e(q,{children:[t(ge,{variant:Cn.Underline,size:Oe.L,options:_m,selected:s,setSelected:c}),t(Mm,{selectedTab:s,gatewayInfo:g??null,nodeCollectorInfo:w??null,isLoading:E})]}),t(Rm,{isLoading:E,pods:N,withSpanDropRate:!1===m?.odigosOwnTelemetryStore?.metricsStoreDisabled}),!o&&t(_l,{minSupportedVersion:n,currentVersion:i||""})]})]})},Bm=g.div`
|
|
925
925
|
display: inline-flex;
|
|
926
926
|
align-items: center;
|
|
927
927
|
min-width: 0;
|
|
928
928
|
overflow: hidden;
|
|
929
929
|
white-space: pre;
|
|
930
930
|
text-overflow: ellipsis;
|
|
931
|
-
`,
|
|
931
|
+
`,Xm=g.div`
|
|
932
932
|
display: flex;
|
|
933
933
|
flex-direction: column;
|
|
934
934
|
gap: 4px;
|
|
935
935
|
min-width: 0;
|
|
936
936
|
flex: 1;
|
|
937
937
|
opacity: ${({$disabled:e})=>e?.4:1};
|
|
938
|
-
`,
|
|
938
|
+
`,Vm=g(ue)`
|
|
939
939
|
flex-shrink: 0;
|
|
940
940
|
gap: 6px;
|
|
941
941
|
align-items: center;
|
|
942
942
|
min-height: 22px;
|
|
943
|
-
`;const
|
|
943
|
+
`;const Um=[{key:"content",label:"Content",noSort:!0,noFilter:!0,flex:1},{key:"badges",label:"Type",noSort:!0,noFilter:!0,flex:"0 0 128px"}],jm=[{value:"all",label:ti},{value:"Relevance",label:"Relevance"},{value:"Duration",label:"Duration"},{value:"Error",label:"Error"}],Gm=({title:n,items:o,isLoading:i,showTypeFilter:s,onRuleClick:c,onCreateRule:d,onEditRule:u,onDeleteRule:p})=>{const h=f(),[m,g]=r(""),[b,y]=r("all"),v=a(()=>{let e=function(e,t,n){return n&&"all"!==t?e.filter(e=>e.typeBadge===t):e}(o,b,s);return e=function(e,t){if(!t.trim())return e;const n=t.toLowerCase();return e.filter(e=>{const t=e.name?.toLowerCase().includes(n),o=e.summary.map(e=>e.text).join("").toLowerCase();return t||o.includes(n)})}(e,m),e},[o,b,s,m]),C=a(()=>v.map(n=>{const o=n.typeBadge?function(e,t){const n=e.v2.colors;switch(t){case"Relevance":return{bg:n.blue[700],text:n.white[500]};case"Duration":return{bg:n.purple[700],text:n.white[500]};case"Error":return{bg:n.red[500],text:n.black[500]}}}(h,n.typeBadge):void 0;return{cells:[{key:"content",rawValue:n.summary.map(e=>e.text).join(""),component:()=>e(Xm,{$disabled:n.disabled,children:[t(Bm,{children:t(S,{parts:n.summary})}),n.name&&t(se,{size:de.XXS,color:ce.Secondary,nowrap:!0,children:n.name})]})},{key:"badges",rawValue:n.typeBadge||"",component:()=>e(Vm,{children:[n.disabled&&t(We,{label:ei,textSize:de.XXXS,backgroundColor:h.v2.colors.grey[700],textColor:h.v2.colors.grey[300]}),n.typeBadge&&o&&t(We,{label:n.typeBadge,textSize:de.XXXS,backgroundColor:o.bg,textColor:o.text})]})}],onClick:()=>c(n)}}),[v,h,c]),w=a(()=>{const e=e=>t(xi,{...e,fill:h.v2.colors.red[500]});return e.displayName="RedDeleteIcon",e},[h]),x=l(e=>{const t=C.indexOf(e);if(t<0)return[];const n=v[t];return n?[{id:"edit","data-id":"sampling-rule-action-edit",label:An,leftIcon:ki,onClick:()=>u(n.ruleId,n.samplingId)},{id:"delete","data-id":"sampling-rule-action-delete",label:"",leftIcon:w,onClick:()=>p(n.ruleId,n.samplingId)}]:[]},[C,v,u,p,w]);return t(rt,{fullHeight:!0,richTitle:{icon:ol,title:n,badge:{label:o.length,backgroundColor:h.v2.colors.silver[600],textColor:h.v2.colors.white[500]}},search:{"data-id":"sampling-search-rules",value:m,onChange:g,placeholder:"Search..",width:"500px",...s?{segment:{"data-id":"sampling-segment-type-filter",options:jm,selected:b,setSelected:y}}:{}},children:t(wn,{variant:xn.Pretty,hideHeader:!0,isLoading:i,noDataProps:m.trim()?{hideIcon:!0,title:ni,subTitle:ii(m)}:{hideIcon:!0,title:ai,button:{label:oi,onClick:d}},columns:Um,rows:C,getRowActions:x})})},Hm=({docsUrl:n})=>{const{samplingApi:s,sourcesApi:c}=yl(),{items:d}=c.useSources(),u=a(()=>d.map(e=>({id:e.id})),[d]),{items:p,loading:h,k8sHealthProbesConfig:m,refetch:g}=s.useSamplingRules(),f=l((e,t)=>s.createNoisy?.({samplingId:e,rule:t}),[s]),b=l((e,t,n)=>s.updateNoisy?.(t,{samplingId:e,rule:n}),[s]),y=l((e,t)=>s.createHighlyRelevant?.({samplingId:e,rule:t}),[s]),v=l((e,t,n)=>s.updateHighlyRelevant?.(t,{samplingId:e,rule:n}),[s]),C=l((e,t)=>s.createCostReduction?.({samplingId:e,rule:t}),[s]),S=l((e,t,n)=>s.updateCostReduction?.(t,{samplingId:e,rule:n}),[s]),w=l((e,t,n)=>"noisy"===n?s.deleteNoisy?.(t,e):"highlyRelevant"===n?s.deleteHighlyRelevant?.(t,e):"costReduction"===n?s.deleteCostReduction?.(t,e):void 0,[s]),x=l((e,t)=>s.updateK8sHealthProbesConfig?.({enabled:e,keepPercentage:t}),[s]),k=a(()=>u.map(({id:e})=>({id:`${e.namespace}/${e.kind}/${e.name}`,label:e.name,badge:e.kind,secondaryLabel:e.namespace})),[u]),T=a(()=>Array.from(new Set(u.map(({id:e})=>e.namespace))).sort().map(e=>({id:e,label:e})),[u]),[$,I]=r(R.Noisy),[E,O]=r(null),[J,Z]=r(!1),[Q,ee]=r(!1),[te,ne]=r(null),[oe,ae]=r(!1),[ie,le]=r(!1),[re,se]=r(!1),[ce,de]=r(!1);i(!1),o(()=>{},[h,p]);const{pendingViewSamplingRule:fe,setPendingViewSamplingRule:be}=ln();o(()=>{if(!fe)return;if(h||0===p.length)return;be(null);const e=D(p,fe.ruleId,fe.category);e&&(I(P[fe.category]),Z(!1),O(e))},[h,p,fe,be]);const ye=a(()=>A(m),[m]),ve=a(()=>F(p),[p]),Ce=a(()=>N(ve?.rule??null),[ve]),Se=a(()=>L(p),[p]),we=a(()=>M(Se?.rule??null),[Se]),xe=i(E);xe.current=E,o(()=>{const e=xe.current;if(!e)return;const t=_(p,e);t?O(t):(O(null),Z(!1))},[p]);const ke=a(()=>{const e=new Set;return ve&&e.add(ve.rule.ruleId),Se&&e.add(Se.rule.ruleId),e},[ve,Se]),Te=a(()=>z(p,$,ke),[p,$,ke]),$e=l(()=>ee(!0),[]),Ie=l(()=>ee(!1),[]);l(()=>de(!1),[]);const Ee=l(async e=>{const t=p[0]?.id??"default";switch(G[$]){case"noisy":await f(t,V(e));break;case"highlyRelevant":await y(t,X(e));break;case"costReduction":await C(t,B(e))}ee(!1)},[p,$,f,y,C]),Ae=l(e=>{const t=U(p,e);t&&(Z(!1),O(t))},[p]),Ne=l(()=>{O(null),Z(!1)},[]),Re=l((e,t)=>{const n=E;if(n&&n.rule.ruleId===e&&n.samplingId===t)Z(!0),O({...n});else for(const n of p){if(n.id!==t)continue;const o=[...n.noisyOperations.map(e=>({category:"noisy",rule:e})),...n.highlyRelevantOperations.map(e=>({category:"highlyRelevant",rule:e})),...n.costReductionRules.map(e=>({category:"costReduction",rule:e}))].find(t=>t.rule.ruleId===e);if(o)return Z(!0),void O({category:o.category,rule:o.rule,samplingId:t,summary:j(o.category,o.rule)})}},[E,p]),Fe=l(async(e,t,n)=>{const o=E?.category;if(o){switch(o){case"noisy":await b(n,t,V(e));break;case"highlyRelevant":await v(n,t,X(e));break;case"costReduction":await S(n,t,B(e))}Z(!1)}},[E,b,v,S]),Le=l((e,t)=>{ne({ruleId:e,samplingId:t})},[]),Me=l(async()=>{if(!te)return;const{ruleId:e,samplingId:t}=te,n=E?.category||G[$];await w(t,e,n),O(null),Z(!1),ne(null)},[te,E,$,w]),_e=l(()=>ne(null),[]),ze=l(async(e,t)=>{await x(e,t),ae(!1)},[x]),Be=l(async e=>{const t=p[0]?.id??"default",n=ve;n?await v(n.samplingId,n.rule.ruleId,{name:n.rule.name,disabled:!e,error:!0,sourceScopes:null,operation:null,percentageAtLeast:null,notes:n.rule.notes}):e&&await y(t,{name:"Auto - Keep All Error Traces",disabled:!1,error:!0,sourceScopes:null,operation:null,percentageAtLeast:null}),le(!1)},[p,ve,y,v]),Xe=l(async(e,t)=>{const n=p[0]?.id??"default",o=Se;o?await S(o.samplingId,o.rule.ruleId,{name:o.rule.name,disabled:!e,sourceScopes:null,operation:null,percentageAtMost:t,notes:o.rule.notes}):e&&await C(n,{name:"Auto - Drop Traces Cluster-Wide",disabled:!1,sourceScopes:null,operation:null,percentageAtMost:t}),se(!1)},[p,Se,C,S]),Ve=l(e=>{const t=G[$];let n=null;switch(t){case"noisy":{const o=V(e);n=H(p,t,{sourceScopes:o.sourceScopes,operation:o.operation});break}case"highlyRelevant":{const o=X(e);n=H(p,t,{sourceScopes:o.sourceScopes,operation:o.operation,error:o.error??!1,durationAtLeastMs:o.durationAtLeastMs});break}case"costReduction":{const o=B(e);n=H(p,t,{sourceScopes:o.sourceScopes,operation:o.operation});break}}return n?{message:li,ruleId:n}:null},[p,$]),Ue=l(e=>{const t=E?.category,n=E?.rule.ruleId;if(!t)return null;let o=null;switch(t){case"noisy":{const a=V(e);o=H(p,t,{sourceScopes:a.sourceScopes,operation:a.operation},n);break}case"highlyRelevant":{const a=X(e);o=H(p,t,{sourceScopes:a.sourceScopes,operation:a.operation,error:a.error??!1,durationAtLeastMs:a.durationAtLeastMs},n);break}case"costReduction":{const a=B(e);o=H(p,t,{sourceScopes:a.sourceScopes,operation:a.operation},n);break}}return o?{message:li,ruleId:o}:null},[p,E]),je=l(e=>{ee(!1);for(const t of p){const n=[...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(n)return Z(!0),void O({category:n.category,rule:n.rule,samplingId:t.id,summary:j(n.category,n.rule)})}},[p]),Ge=a(()=>{const e=[];return n&&e.push({id:Zn(),type:nn.Button,buttonProps:{"data-id":"sampling-btn-docs",label:ri,leftIcon:wi,size:he.S,variant:me.Text,onClick:()=>window.open(n,"_blank")}}),e.push({id:Zn(),type:nn.Button,buttonProps:{"data-id":"sampling-btn-refresh",label:si,leftIcon:Xi,size:he.S,variant:me.Text,onClick:g,loading:h}}),e.push({id:Zn(),type:nn.Button,buttonProps:{"data-id":"sampling-btn-create-rule",label:ci,rightIcon:yi,size:he.S,variant:me.Primary,onClick:$e}}),e},[n,g,h,$e]);return e(ka,{children:[e(ue,{$gap:12,$justifyContent:"space-between",children:[t(Ha,{icon:ol,title:ui,subTitle:di}),t(Wa,{actions:Ge})]}),e(q,{$gap:12,$fullHeight:!0,children:[t(ge,{variant:Cn.Underline,size:Oe.L,options:W,selected:$,setSelected:I}),e(ue,{$justifyContent:"space-between",children:[t(De,{status:Pe.Default,message:K[$]}),n&&t(pe,{"data-id":"sampling-btn-docs-banner",label:"Docs",leftIcon:wi,size:he.S,variant:me.Text,onClick:()=>window.open(n,"_blank")})]}),$===R.Noisy?t(xl,{title:at,summary:ye,onEdit:()=>ae(!0)}):$===R.HighlyRelevant?t(xl,{title:Qe,summary:Ce,onEdit:()=>le(!0)}):$===R.CostReduction?t(xl,{title:nt,summary:we,onEdit:()=>se(!0)}):null,t(Gm,{title:Y[$],items:Te,isLoading:h,showTypeFilter:$===R.HighlyRelevant,onRuleClick:Ae,onCreateRule:$e,onEditRule:Re,onDeleteRule:Le})]}),t(Du,{formType:Hl.View,data:E,defaultEditMode:J,onClose:Ne,onDelete:Le,onSaveEdit:Fe,sourceOptions:k,namespaceOptions:T,validateForm:Ue,onNavigateToDuplicate:je}),t(Du,{formType:Hl.Create,isOpen:Q,category:G[$],onClose:Ie,onSubmit:Ee,sourceOptions:k,namespaceOptions:T,validateForm:Ve,onNavigateToDuplicate:je}),t(Du,{formType:Hl.EditAutoNoisy,isOpen:oe,enabled:m?.enabled??!1,keepPercentage:m?.keepPercentage??0,onClose:()=>ae(!1),onSave:ze}),t(Du,{formType:Hl.EditAutoHighlyRelevant,isOpen:ie,enabled:!!ve&&!ve.rule.disabled,onClose:()=>le(!1),onSave:Be}),t(Du,{formType:Hl.EditAutoCostReduction,isOpen:re,enabled:!!Se&&!Se.rule.disabled,dropPercentage:Se?.rule.percentageAtMost??25,onClose:()=>se(!1),onSave:Xe}),t(Je,{title:gi,description:mi,isOpen:!!te,onClose:_e,denyButton:{label:hi,variant:me.Secondary,onClick:_e},approveButton:{label:pi,variant:me.Primary,onClick:()=>{Me(),_e()}}}),false]})},Wm=g.div`
|
|
944
944
|
display: flex;
|
|
945
945
|
align-items: center;
|
|
946
946
|
justify-content: space-between;
|
|
947
947
|
padding: 0 12px;
|
|
948
|
-
`,
|
|
948
|
+
`,Km=g.div`
|
|
949
|
+
display: flex;
|
|
950
|
+
align-items: center;
|
|
951
|
+
gap: 8px;
|
|
952
|
+
`,Ym=g.div`
|
|
953
|
+
width: 1px;
|
|
954
|
+
height: 20px;
|
|
955
|
+
background-color: ${({theme:e})=>e.v2.colors.silver[500]};
|
|
956
|
+
`,Jm=({disabled:n,loading:o,onClickShowYaml:i,onClickReset:l,onClickRefresh:s})=>{const c=f(),[d,u]=r(!1),p=a(()=>i?[{id:Zn(),type:nn.Button,buttonProps:{label:"Show Config YAML",leftIcon:fl,size:he.S,variant:me.Secondary,onClick:i,disabled:n}}]:[],[i,n]),h=a(()=>{const e=[];return s&&e.push({id:Zn(),type:nn.Button,buttonProps:{leftIcon:Xi,tooltip:"Refresh",hideTooltipIcon:!0,size:he.S,variant:me.Text,onClick:s,disabled:n,loading:o}}),l&&e.push({id:Zn(),type:nn.Button,buttonProps:{leftIcon:bi,tooltip:"Reset to defaults",hideTooltipIcon:!0,size:he.S,variant:me.Text,textColor:c.v2.colors.red[500],onClick:()=>u(!0),disabled:n}}),e},[n,o,l,s,c]),m=p.length>0,g=h.length>0;return e(Wm,{children:[t(Ha,{icon:Mi,title:"Odigos Settings"}),e(Km,{children:[m&&t(Wa,{actions:p}),m&&g&&t(Ym,{}),g&&t(Wa,{actions:h})]}),t(Je,{isOpen:d,onClose:()=>u(!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:me.Secondary,onClick:()=>u(!1)},approveButton:{label:"Approve",variant:me.Primary,onClick:()=>{l?.(),u(!1)}}})]})},qm=g(q)`
|
|
957
|
+
width: 220px;
|
|
958
|
+
flex-shrink: 0;
|
|
959
|
+
height: 100%;
|
|
960
|
+
gap: 4px;
|
|
961
|
+
overflow-y: auto;
|
|
962
|
+
`,Zm=({options:e,selected:n,setSelected:o,disabled:a})=>t(qm,{children:e.map(e=>t(Ns,{dataId:`settings-nav-${e.id}`,title:e.label,isSelected:n===e.id,disabled:a,onClick:()=>o(e.id)},e.id))}),Qm=g(q)`
|
|
963
|
+
width: 100%;
|
|
964
|
+
/* side menu (220) + gap (24) + form (600) = 844, so content fills exactly with no dead space */
|
|
965
|
+
max-width: 844px;
|
|
966
|
+
/* Bias the content toward the left on wide screens: ~30% of the free space sits on the left, 70% on the right. */
|
|
967
|
+
margin-left: max(0px, calc((100% - 844px) * 0.3));
|
|
968
|
+
margin-right: auto;
|
|
969
|
+
gap: 24px;
|
|
970
|
+
flex: 1;
|
|
971
|
+
min-height: 0;
|
|
972
|
+
`,eg=g(ue)`
|
|
949
973
|
flex: 1;
|
|
950
974
|
min-height: 0;
|
|
951
975
|
width: 100%;
|
|
952
976
|
align-self: stretch;
|
|
953
|
-
`,
|
|
977
|
+
`,tg=g(q)`
|
|
954
978
|
flex: 1;
|
|
955
979
|
min-height: 0;
|
|
956
980
|
height: 100%;
|
|
981
|
+
max-width: 600px;
|
|
957
982
|
overflow-y: auto;
|
|
958
|
-
`,
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
983
|
+
`,ng=g(ue)`
|
|
984
|
+
gap: 8px;
|
|
985
|
+
width: 100%;
|
|
986
|
+
align-items: center;
|
|
987
|
+
`,og=g.div`
|
|
988
|
+
flex: 1;
|
|
989
|
+
min-width: 0;
|
|
990
|
+
`,ag=e=>"general"===e.name?0:"advanced"===e.name?2:1,ig=({minSupportedVersion:i=0})=>{const{isVersionSupported:l,version:s,isEnterprise:c}=v(i),{configApi:d}=yl(),{data:u,loading:p}=d.useConfigYamls(),{data:h,loading:m,refetch:g}=d.useEffectiveConfig(),f=u?.configYamls??[],[b,y]=r(!1),C=a(()=>{if(!h)return{};const{manifestYAML:e,provenance:t,...n}=h;return n},[h]),{formData:S,handleFormChange:w,getNestedValue:x,getFormDiff:k,isFormDirty:T}=Mt(C);o(()=>{"{}"!==JSON.stringify(C)&&"{}"===JSON.stringify(S)&&w(void 0,void 0,C)},[C,S]);const $=a(()=>[...f].sort((e,t)=>ag(e)-ag(t)),[f]),I=a(()=>(e=>{if(!e)return{};const t={};for(const n of e)t[n.helmPath]=n.reconciledFrom;return t})(h?.provenance),[h?.provenance]),E=a(()=>{const e=new Set;for(const t of f)for(const n of t.fields)n.componentType===xe.Dropdown&&e.add(n.helmValuePath);return e},[f]),A=a(()=>f.flatMap(e=>e.fields.map(e=>({name:e.helmValuePath,value:x("formData",e.helmValuePath)}))),[f,S,x]),[N,O]=r(!1),[R,D]=r(!1),P=async()=>{const e=((e,t)=>{const n=(e,t,n)=>{for(let n=0;n<t.length-1;n++){const o=t[n];o in e&&"object"==typeof e[o]&&null!==e[o]||(e[o]={}),e=e[o]}e[t[t.length-1]]=n},o=JSON.parse(JSON.stringify(e));for(const e of t){const t=e.split(".");let a=o;for(const e of t){if(null==a||"object"!=typeof a){a=void 0;break}a=a[e]}"string"==typeof a&&n(o,t,a.replaceAll("-","_"))}return o})(k(C,S),E);await(async e=>{d.updateLocalUiConfig&&(y(!0),await d.updateLocalUiConfig(e),y(!1),await g())})(e),w(void 0,void 0,{})},F=a(()=>[{id:Zn(),type:nn.Button,buttonProps:{"data-id":"settings-save",variant:me.Primary,size:he.S,label:"Save Changes",leftIcon:Ri,loading:b,onClick:()=>O(!0)}},{id:Zn(),type:nn.Button,buttonProps:{"data-id":"settings-cancel",variant:me.Secondary,size:he.S,label:"Cancel",leftIcon:Di,onClick:()=>w(void 0,void 0,C)}}],[b,k,C,S,w]),L=a(()=>$.map(e=>({id:e.name,label:e.displayName})),[$]),M=a(()=>$.map(e=>e.name),[$]),{selectedSection:_,setSelectedSection:z,setSectionRef:B,setScrollContainerRef:X}=fi({sectionNames:M});return t(ka,{$gap:24,children:e(Qm,{children:[t(Jm,{disabled:!l,loading:p||m,onClickShowYaml:()=>D(!0),onClickReset:async()=>{await(async()=>{d.resetLocalUiConfigToDefaults&&await d.resetLocalUiConfigToDefaults()})(),await(g?.()),w(void 0,void 0,{})},onClickRefresh:g?()=>g():void 0}),e(Qa,{children:[!l&&t(_l,{minSupportedVersion:i,currentVersion:s||""}),t(kn,{isOpen:T,richTitle:{icon:Mi,title:"Config Settings"},actions:F}),t(Je,{isOpen:N,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:()=>O(!1),denyButton:{label:"Keep editing",variant:me.Secondary,onClick:()=>O(!1)},approveButton:{label:"Save changes",variant:me.Primary,onClick:()=>{P(),O(!1)}}}),e(eg,{$gap:24,$alignItems:"stretch",children:[!!f.length&&t(Zm,{options:L,selected:_,setSelected:z,disabled:!l}),t(tg,{ref:X,$gap:24,$width:"100%",children:f.length?$.map(o=>t(rt,{id:o.name,bordered:!0,ref:e=>B(o.name,e),customTitle:t(se,{size:de.M,weight:500,color:ce.Primary,children:o.displayName}),children:t(q,{$gap:24,children:o.fields.map(o=>{if(o.isEnterpriseOnly&&!c)return null;if(o.renderCondition&&!ke(o.renderCondition,[],A))return null;const a=Te(o.componentProps||"{}",{}),i=I[o.helmValuePath],l=o.componentType===xe.Toggle,r=t(se,{size:de.XS,weight:500,color:ce.Primary,children:o.displayName}),s=(e=>{if(e)return"odigos-local-ui-config"===e?{status:Pe.Warning,label:"Edited in UI",tooltip:`Reconciled from ${e}`}:"odigos-configuration"===e?{status:Pe.Unknown,useSecondaryTone:!0,label:"Cluster config",tooltip:`Reconciled from ${e}`}:{status:Pe.Unknown,useSecondaryTone:!0,label:e,tooltip:`Reconciled from ${e}`}})(i),d=s?t(We,{...s}):null,u=o.description?t(se,{size:de.XXS,color:ce.Secondary,children:o.description}):null,p=e(q,{$gap:4,children:[e(ue,{$gap:8,$alignItems:"center",children:[r,d]}),u]}),h=t(vl,{componentType:o.componentType,inputType:a.type,name:o.helmValuePath,disabled:o.isHelmOnly||b,value:x("formData",o.helmValuePath),setValue:e=>w(o.helmValuePath,e),dropdownOptions:a.options?.map(e=>({id:e,label:e})),dropdownNoSearch:!0,dropdownNoCheckbox:!0,toggleSize:Tt.S},o.helmValuePath),m=o.isHelmOnly?t($e,{text:"This field can only be updated via the Helm values.yaml file",children:t(bl,{})}):null;return t(q,{$gap:8,children:l?e(ue,{$gap:12,$justifyContent:"space-between",$alignItems:"flex-start",children:[p,e(ue,{$gap:8,$alignItems:"center",children:[m,h]})]}):e(n,{children:[p,e(ng,{children:[t(og,{children:h}),m]})]})},o.helmValuePath)})})},o.name)):p?t(ht,{$height:"30vh",children:t(yt,{withSpinner:!0})}):t(rt,{richTitle:{icon:Mi,title:"Config Settings"},children:t(Ae,{title:"YAML not found",subTitle:"The YAML for this resource is not available"})})})]}),t(le,{isOpen:R,width:"40vw",minWidth:"480px",header:{icon:fl,title:"Effective Config YAML",onClose:()=>D(!1)},children:m&&!h?.manifestYAML?t(ht,{$height:"30vh",children:t(yt,{withSpinner:!0})}):t(Fl,{yaml:h?.manifestYAML?.replaceAll(" |",""),defaultOpen:!0,fullHeight:!0})})]})]})})};export{Os as AddActionDrawer,as as AddActionForm,Uu as AddDataStreamModal,Xs as AddDestinationDrawer,rs as AddDestinationForm,Vs as AddRuleDrawer,gs as AddRuleForm,sc as AddSourceDrawer,Kp as CentralConnections,bs as DataStreamForm,fs as DataStreamMergeWarning,dc as EditActionDrawer,uc as EditConfigDrawer,ju as EditDataStreamModal,hc as EditDestinationDrawer,gc as EditRuleDrawer,Cu as EditSourceDrawer,ys as EditSourceForm,Wu as ONBOARDING_DONE_MODAL_ID,sh as Onboarding,Ku as OnboardingDone,$m as Overview,zm as PipelineCollectors,Ar as RegexTesterDrawer,Vp as SamplingOnboardingModal,Du as SamplingRuleDrawer,ks as SamplingRuleForm,Hm as SamplingRules,ig as Settings,Vu as SystemDrawer,_m as TABS};
|