@odigos/ui-kit 0.0.214 → 0.0.216
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 +19 -0
- package/lib/chunks/index-3rwrQKyF.js +3 -0
- package/lib/chunks/ui-components-DvThY8Em.js +2422 -0
- package/lib/components/_v2/autocomplete/index.d.ts +13 -0
- package/lib/components/_v2/drawer/index.d.ts +1 -0
- package/lib/components/_v2/drop-data/index.d.ts +4 -0
- package/lib/components/_v2/index.d.ts +1 -0
- package/lib/components/_v2/segment/index.d.ts +8 -1
- package/lib/components/v2.js +1 -1
- package/lib/components.js +1 -1
- package/lib/constants.js +1 -1
- package/lib/containers/_v2/_drawers/add-action-drawer/index.d.ts +1 -0
- package/lib/containers/_v2/_drawers/add-destination-drawer/index.d.ts +4 -1
- package/lib/containers/_v2/_drawers/add-rule-drawer/index.d.ts +1 -0
- package/lib/containers/_v2/_drawers/add-source-drawer/index.d.ts +2 -0
- package/lib/containers/_v2/_drawers/create-sampling-rule-drawer/constants.d.ts +26 -0
- package/lib/containers/_v2/_drawers/create-sampling-rule-drawer/converters.d.ts +5 -0
- package/lib/containers/_v2/_drawers/create-sampling-rule-drawer/form-helpers.d.ts +5 -0
- package/lib/containers/_v2/_drawers/create-sampling-rule-drawer/index.d.ts +6 -0
- package/lib/containers/_v2/_drawers/create-sampling-rule-drawer/sections/duration-errors.d.ts +9 -0
- package/lib/containers/_v2/_drawers/create-sampling-rule-drawer/sections/operation.d.ts +9 -0
- package/lib/containers/_v2/_drawers/create-sampling-rule-drawer/sections/percentage.d.ts +9 -0
- package/lib/containers/_v2/_drawers/create-sampling-rule-drawer/sections/rule-info.d.ts +9 -0
- package/lib/containers/_v2/_drawers/create-sampling-rule-drawer/sections/sampling-preview.d.ts +9 -0
- package/lib/containers/_v2/_drawers/create-sampling-rule-drawer/sections/source-scope.d.ts +10 -0
- package/lib/containers/_v2/_drawers/create-sampling-rule-drawer/types.d.ts +54 -0
- package/lib/containers/_v2/_drawers/edit-auto-rule-drawer/constants.d.ts +10 -0
- package/lib/containers/_v2/_drawers/edit-auto-rule-drawer/index.d.ts +4 -0
- package/lib/containers/_v2/_drawers/edit-auto-rule-drawer/types.d.ts +8 -0
- package/lib/containers/_v2/_drawers/edit-cost-reduction-auto-rule-drawer/constants.d.ts +10 -0
- package/lib/containers/_v2/_drawers/edit-cost-reduction-auto-rule-drawer/index.d.ts +4 -0
- package/lib/containers/_v2/_drawers/edit-cost-reduction-auto-rule-drawer/types.d.ts +8 -0
- package/lib/containers/_v2/_drawers/edit-highly-relevant-auto-rule-drawer/constants.d.ts +6 -0
- package/lib/containers/_v2/_drawers/edit-highly-relevant-auto-rule-drawer/index.d.ts +4 -0
- package/lib/containers/_v2/_drawers/edit-highly-relevant-auto-rule-drawer/types.d.ts +6 -0
- package/lib/containers/_v2/_drawers/index.d.ts +5 -0
- package/lib/containers/_v2/_drawers/view-sampling-rule-drawer/constants.d.ts +19 -0
- package/lib/containers/_v2/_drawers/view-sampling-rule-drawer/footer.d.ts +21 -0
- package/lib/containers/_v2/_drawers/view-sampling-rule-drawer/index.d.ts +23 -0
- package/lib/containers/_v2/_drawers/view-sampling-rule-drawer/reverse-converters.d.ts +3 -0
- package/lib/containers/_v2/_drawers/view-sampling-rule-drawer/sections/duration-errors.d.ts +6 -0
- package/lib/containers/_v2/_drawers/view-sampling-rule-drawer/sections/operation-details.d.ts +6 -0
- package/lib/containers/_v2/_drawers/view-sampling-rule-drawer/sections/percentage.d.ts +6 -0
- package/lib/containers/_v2/_drawers/view-sampling-rule-drawer/sections/rule-info.d.ts +6 -0
- package/lib/containers/_v2/_drawers/view-sampling-rule-drawer/sections/sampling-preview.d.ts +6 -0
- package/lib/containers/_v2/_drawers/view-sampling-rule-drawer/sections/source-scopes.d.ts +6 -0
- package/lib/containers/_v2/_drawers/view-sampling-rule-drawer/sections/styled.d.ts +4 -0
- package/lib/containers/_v2/_drawers/view-sampling-rule-drawer/types.d.ts +1 -0
- package/lib/containers/_v2/_forms/add-destination-form/context.d.ts +3 -3
- package/lib/containers/_v2/auto-rule-card/constants.d.ts +1 -0
- package/lib/containers/_v2/auto-rule-card/helpers.d.ts +19 -0
- package/lib/containers/_v2/auto-rule-card/index.d.ts +5 -0
- package/lib/containers/_v2/auto-rule-card/types.d.ts +6 -0
- package/lib/containers/_v2/central-connections/index.d.ts +2 -1
- package/lib/containers/_v2/index.d.ts +3 -0
- package/lib/containers/_v2/onboarding/index.d.ts +2 -1
- package/lib/containers/_v2/onboarding/summary/index.d.ts +1 -0
- package/lib/containers/_v2/sampling-rules-list/constants.d.ts +23 -0
- package/lib/containers/_v2/sampling-rules-list/helpers.d.ts +30 -0
- package/lib/containers/_v2/sampling-rules-list/index.d.ts +6 -0
- package/lib/containers/_v2/sampling-rules-list/rule-row.d.ts +12 -0
- package/lib/containers/_v2/sampling-rules-list/summary-span.d.ts +10 -0
- package/lib/containers/_v2/sampling-rules-list/toolbar.d.ts +13 -0
- package/lib/containers/_v2/sampling-rules-list/types.d.ts +47 -0
- package/lib/containers/v2.js +446 -35
- package/lib/containers.js +2 -2
- package/lib/contexts.js +1 -1
- package/lib/functions.js +1 -1
- package/lib/hooks.js +1 -1
- package/lib/icons/destinations/aws-api-gateway-logo/index.d.ts +2 -0
- package/lib/icons/destinations/aws-bedrock-logo/index.d.ts +2 -0
- package/lib/icons/destinations/aws-dynamodb-logo/index.d.ts +2 -0
- package/lib/icons/destinations/aws-ec2-logo/index.d.ts +2 -0
- package/lib/icons/destinations/aws-eventbridge-logo/index.d.ts +2 -0
- package/lib/icons/destinations/aws-kinesis-logo/index.d.ts +2 -0
- package/lib/icons/destinations/aws-lambda-logo/index.d.ts +2 -0
- package/lib/icons/destinations/aws-secrets-manager-logo/index.d.ts +2 -0
- package/lib/icons/destinations/aws-sns-logo/index.d.ts +2 -0
- package/lib/icons/destinations/aws-sqs-logo/index.d.ts +2 -0
- package/lib/icons/destinations/aws-step-functions-logo/index.d.ts +2 -0
- package/lib/icons/destinations/aws-sts-logo/index.d.ts +2 -0
- package/lib/icons/destinations/index.d.ts +12 -0
- package/lib/icons/overview/index.d.ts +1 -0
- package/lib/icons/overview/sampling-icon/index.d.ts +2 -0
- package/lib/icons.js +1 -1
- package/lib/snippets/_v2/wide-drawer/index.d.ts +2 -0
- 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 +2 -1
- package/lib/types/destinations/index.d.ts +3 -0
- package/lib/types/index.d.ts +1 -0
- package/lib/types/sampling.d.ts +103 -0
- package/lib/types.js +1 -1
- package/lib/visuals.js +1 -1
- package/package.json +1 -1
- package/lib/chunks/index-CIjqAfew.js +0 -3
- package/lib/chunks/ui-components-Cu9XlyM0.js +0 -2391
package/lib/containers/v2.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import{jsx as e,jsxs as t,Fragment as a}from"react/jsx-runtime";import
|
|
1
|
+
import{jsx as e,jsxs as t,Fragment as a}from"react/jsx-runtime";import o,{useTheme as n}from"styled-components";import{W as l,u as r,T as i,d as s,M as c,F as d,a as u,b as p,C as h,c as m,V as g,S as f,e as v,N as y,D as b,L as S,f as C,R as k,g as w,h as x,i as T,B as N,j as D,k as A,l as I,A as $,I as R,m as E,n as P,o as O,K as M,p as L,q as F,r as z,s as X,t as V,v as _,w as B,x as U,y as H,z as j,E as K,G,H as W,J as q,O as J,P as Y,Q,U as Z,X as ee,Y as te,Z as ae,_ as oe,$ as ne,a0 as le,a1 as re,a2 as ie,a3 as se,a4 as ce,a5 as de,a6 as ue,a7 as pe,a8 as he,a9 as me,aa as ge,ab as fe,ac as ve,ad as ye,ae as be,af as Se,ag as Ce,ah as ke,ai as we,aj as xe,ak as Te,al as Ne,am as De,an as Ae,ao as Ie,ap as $e,aq as Re,ar as Ee,as as Pe,at as Oe,au as Me,av as Le,aw as Fe,ax as ze,ay as Xe,az as Ve,aA as _e,aB as Be,aC as Ue,aD as He,aE as je,aF as Ke,aG as Ge,aH as We,aI as qe,aJ as Je,aK as Ye,aL as Qe,aM as Ze,aN as et,aO as tt,aP as at,aQ as ot,aR as nt,aS as lt,aT as rt,aU as it,aV as st,aW as ct,aX as dt,aY as ut,aZ as pt}from"../chunks/ui-components-DvThY8Em.js";import{OdigosLogoTextEnterprise as ht,OdigosLogoTextCommunity as mt,VSquareIcon as gt,OdigosLogo as ft,ArrowLeftIcon as vt,ArrowRightIcon as yt,ChevronRightIcon as bt,TrashIcon as St,PlusIcon as Ct,BookIcon as kt,XSquareIcon as wt,DeleteIcon as xt,EditIcon as Tt,GoLogo as Nt,JavaLogo as Dt,ActionIcon as At,DestinationIcon as It,ChevronUpIcon as $t,ChevronDownIcon as Rt,VIcon as Et,XIcon as Pt,InstrumentationRuleIcon as Ot,SourceIcon as Mt,SamplingIcon as Lt,SettingsIcon as Ft,ExclamationTriangleIcon as zt,ExclamationCircleIcon as Xt,KeyIcon as Vt,DiagnoseIcon as _t,DownloadIcon as Bt,TerminalIcon as Ut,RefreshIcon as Ht,ConnectionsIcon as jt,PodIcon as Kt,ArrowDownSquareIcon as Gt,ArrowUpSquareIcon as Wt,PipelineCollectorIcon as qt,GatewayIcon as Jt,YamlIcon as Yt}from"../icons.js";import{useState as Qt,useRef as Zt,useEffect as ea,forwardRef as ta,useImperativeHandle as aa,Fragment as oa,useCallback as na,useContext as la,createContext as ra,useMemo as ia,Children as sa}from"react";import{Y as ca}from"../chunks/index-3rwrQKyF.js";import"zustand";import"javascript-time-ago";import"../chunks/vendor-C150cdxb.js";import"@xyflow/react";import"react-dom";import"prism-react-renderer";import"react-error-boundary";import"lottie-react";import"virtua";const da=({isOpen:t,onClose:a,onDeny:o,onApprove:n})=>e(l,{title:"Discard changes?",description:"You have unsaved changes.\nIf you cancel now, your changes won't be saved.",isOpen:t,onClose:a,onDeny:o,denyLabel:"Keep editing",onApprove:n,approveLabel:"Discard changes"}),ua=({isOpen:t,onClose:a,onDeny:o,onApprove:n,action:r="delete",target:i})=>{const s=r.charAt(0).toUpperCase()+r.substring(1),c=i?.endsWith("s")?"these":"this";return e(l,{title:`${s}${i?` ${i}`:""}?`,description:`Are you sure you want to ${r}${i?` ${c} ${i}`:""}?`,isOpen:t,onClose:a,onDeny:o,denyLabel:"Go back",onApprove:n,approveLabel:s})},pa=({size:t=200})=>{const{tier:a}=r();return a===i.Onprem?e(ht,{size:t}):e(mt,{size:t})},ha=(e,t)=>!t?.length||!!t?.find(t=>t===e),ma=({title:a="Signals",required:o,errorMessage:n,allowedSignals:l,selectedSignals:r,setSelectedSignals:i,disabled:g})=>{const[f,v]=Qt(1===r.length),y=Zt(JSON.stringify(r));ea(()=>{const e=s(r);e.length||c.forEach(({id:t})=>{ha(t,l)&&e.push(t)});const t=JSON.stringify(e);y.current!==t&&(y.current=t,i(e),v(1===e.length))},[l,r]);return t(d,{$gap:12,children:[e(u,{label:a,required:o}),e(p,{$gap:12,children:c.map(t=>{const a=ha(t.id,l),o=((e,t)=>!!t?.find(t=>t===e))(t.id,r);return a?e(h,{label:t.value,disabled:g||!a||f&&o,value:o,onChange:e=>((e,t)=>{const a=e,o=t?[...r,a]:r.filter(e=>e!==a);i(o),v(1===o.length)})(t.id,e)},t.id):null})}),e(m,{errorMessage:n})]})},ga=({minSupportedVersion:t,currentVersion:a})=>e(l,{isOpen:!0,onClose:()=>{},relativeToParent:!0,visual:()=>e(g,{scale:2.4,icon:()=>e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"22",height:"21",viewBox:"0 0 22 21",fill:"none",children:e("path",{fill:"#151618",d:"M9.4844 0.730003C9.99694 -0.243259 11.4076 -0.24341 11.92 0.730003L11.9685 0.831353L14.3039 6.22012L20.153 6.77755C21.3553 6.89211 21.841 8.38683 20.9358 9.18621L16.5314 13.0731L17.8091 18.8079C18.0716 19.9868 16.8005 20.9109 15.7605 20.2969L10.7017 17.3093L5.64282 20.2969C4.60289 20.9104 3.33173 19.9866 3.59427 18.8079L4.87192 13.0741L0.468608 9.18621C-0.43662 8.38693 0.0482932 6.8924 1.25029 6.77755L7.09837 6.22012L9.43588 0.831353L9.4844 0.730003ZM8.55284 7.02876C8.35287 7.48992 7.9179 7.80589 7.41751 7.85357L2.03952 8.36571L6.09027 11.941C6.46691 12.2737 6.63296 12.7852 6.5237 13.2758L5.34956 18.5459L10.0008 15.8009L10.1669 15.7179C10.5087 15.574 10.8945 15.5741 11.2364 15.7179L11.4036 15.8009L16.0538 18.5459L14.8807 13.2758C14.7714 12.7851 14.9374 12.2737 15.3141 11.941L19.3627 8.36571L13.9858 7.85357C13.4855 7.80587 13.0505 7.4899 12.8505 7.02876L10.7017 2.07342L8.55284 7.02876Z"})})}),title:"Upgrade Required",description:`To use this feature, please upgrade to Odigos v${t} or later.\nCurrent version: ${a}.`}),fa=o.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
justify-content: flex-end;
|
|
5
5
|
width: ${({$width:e})=>e};
|
|
6
6
|
gap: ${({$columnHasHeader:e})=>e?"0":"12px"};
|
|
7
|
-
`,
|
|
7
|
+
`,va=o.div`
|
|
8
8
|
display: flex;
|
|
9
9
|
align-items: center;
|
|
10
10
|
min-height: 24px;
|
|
11
11
|
padding: 12px;
|
|
12
12
|
border-radius: 16px 16px 0 0;
|
|
13
13
|
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
14
|
-
`,
|
|
14
|
+
`,ya=o.div`
|
|
15
15
|
display: flex;
|
|
16
16
|
flex-direction: column;
|
|
17
17
|
gap: ${({$gap:e})=>e}px;
|
|
@@ -22,37 +22,37 @@ import{jsx as e,jsxs as t,Fragment as a}from"react/jsx-runtime";import{useState
|
|
|
22
22
|
background-color: ${({theme:e})=>e.v2.colors.silver[900]};
|
|
23
23
|
overflow-y: auto;
|
|
24
24
|
overflow-x: hidden;
|
|
25
|
-
`,
|
|
25
|
+
`,ba=({isLeft:o,isRight:n,heightOffset:l=0,width:r,header:i,list:s})=>t(fa,{$width:r,$columnHasHeader:!!i,children:[i&&e(va,{children:i}),e(ya,{$gap:8,$isLeft:o,$isRight:n,$heightOffset:l,$columnHasHeader:!!i,children:s.length?s.length>1?e(f,{gap:8,elements:s}):e(a,{children:s[0]}):e(v,{$height:"100%",children:e(y,{})})})]}),Sa="75vw",Ca=o.div`
|
|
26
26
|
display: flex;
|
|
27
27
|
flex-direction: column;
|
|
28
28
|
border-radius: 16px;
|
|
29
29
|
background-color: ${({theme:e})=>e.v2.colors.silver[1e3]};
|
|
30
30
|
overflow: hidden;
|
|
31
|
-
`,
|
|
31
|
+
`,ka=o.div`
|
|
32
32
|
display: flex;
|
|
33
33
|
gap: 12px;
|
|
34
34
|
padding: 16px 16px 0 16px;
|
|
35
35
|
background-color: ${({theme:e})=>e.v2.colors.silver[1e3]};
|
|
36
36
|
position: sticky;
|
|
37
37
|
top: 0;
|
|
38
|
-
`,
|
|
38
|
+
`,wa=o.div`
|
|
39
39
|
padding: 12px 12px 0 12px;
|
|
40
|
-
`,
|
|
40
|
+
`,xa=o.div`
|
|
41
41
|
display: flex;
|
|
42
42
|
gap: 12px;
|
|
43
43
|
padding: 16px;
|
|
44
|
-
`,
|
|
44
|
+
`,Ta=o.div`
|
|
45
45
|
padding: 5vh 10vw;
|
|
46
46
|
border-radius: 12px;
|
|
47
47
|
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
48
|
-
`,
|
|
48
|
+
`,Na=o.div`
|
|
49
49
|
display: flex;
|
|
50
50
|
align-items: center;
|
|
51
51
|
justify-content: flex-end;
|
|
52
52
|
gap: 16px;
|
|
53
53
|
padding: 0 12px;
|
|
54
54
|
margin-top: auto;
|
|
55
|
-
`,
|
|
55
|
+
`,Da=ta(({isOpen:a,withOverlay:o,disableAnimation:n,onClose:l,onBack:r,onNext:i,nextIsSkip:s,onSave:c,disableSave:d,connectionIds:u,header:h,subHeader:m,leftColumn:g,rightColumn:f,search:y,filters:A,errorMessage:I,isFormDirty:$,hideDirtyNote:R,isFetching:E,progress:P},O)=>{const[M,L]=Qt(!1),[F,z]=Qt(!1),[X,V]=Qt(void 0);aa(O,()=>({clearErrors:()=>V(void 0)}));const _=F,B=()=>{$&&!M?L(!0):(L(!1),l?.())},U=d||F||"boolean"==typeof $&&!$,H=!!y||!!u||!!A,j=!!m,K=(H?48:0)+(j?50:0);return t(b,{width:Sa,isOpen:a,disableAnimation:n,hideOverlay:!F&&!o,header:{...h,onClose:l?B:void 0,onCloseDisabled:_},children:[F?e(v,{$height:"calc(100vh - 136px)",children:e(Ta,{children:e(S,{titleSize:C.S,subTitleSize:C.XXXS,withGradient:!0,withSpinner:!0,...P})})}):t(Ca,{children:[H&&t(ka,{children:[u&&e(k,{icon:gt,title:"Selected Clusters",badge:{label:u.value.length}}),y&&e(w,{width:"100%",...y}),A]}),j&&e(wa,{children:e(k,{icon:m.icon,title:m.title,subTitle:m.description,badge:m.badge})}),t(xa,{children:[e(ba,{isLeft:!0,heightOffset:K,...g}),e(ba,{isRight:!0,heightOffset:K,...f})]})]}),t(Na,{children:[E?e(S,{icon:ft,title:"Fetching Data...",titleSize:C.XXS,withGradient:!0}):F?P?null:e(S,{icon:ft,title:"Saving Changes...",titleSize:C.XXS,withGradient:!0}):X||I?e(x,{fullWidth:!0,status:T.Error,message:X||I}):"boolean"==typeof $&&$&&!R?e(x,{fullWidth:!0,status:T.Info,message:'The values don\'t reflect the current configurations of the selected clusters.\n"Save" will override the current configurations.'}):"boolean"!=typeof $||$||R?null:e(x,{fullWidth:!0,status:T.Success,message:"The values reflect the current configuration of the selected cluster."}),t(p,{$gap:8,children:[e("div",r?{style:{width:"150px"},children:e(N,{"data-id":"wide-drawer-back",fullWidth:!0,variant:D.Secondary,label:"Back",leftIcon:vt,onClick:r})}:{style:{width:"150px"},children:e(N,{"data-id":"wide-drawer-cancel",fullWidth:!0,variant:D.Secondary,label:"Cancel",onClick:B,disabled:_})}),e("div",i?{style:{width:"150px"},children:e(N,s?{"data-id":"wide-drawer-skip",fullWidth:!0,variant:D.Secondary,label:"Skip",rightIcon:yt,onClick:i}:{"data-id":"wide-drawer-next",fullWidth:!0,variant:D.Primary,label:"Next",rightIcon:yt,onClick:i})}:{style:{width:"150px"},children:e(N,{"data-id":"wide-drawer-save",fullWidth:!0,variant:D.Primary,label:"Save",onClick:async()=>{z(!0);const e=await c();z(!1),e?.error?V(e.error):(u?.setValue([]),l?.())},disabled:U})})]})]}),e(da,{isOpen:M,onClose:()=>L(!1),onApprove:B})]})});Da.displayName=Da.name;const Aa=o.div`
|
|
56
56
|
display: flex;
|
|
57
57
|
align-items: center;
|
|
58
58
|
justify-content: space-between;
|
|
@@ -65,39 +65,39 @@ import{jsx as e,jsxs as t,Fragment as a}from"react/jsx-runtime";import{useState
|
|
|
65
65
|
&:hover {
|
|
66
66
|
background-color: ${({$isSelected:e,$purpleColors:t,theme:a})=>e?t?a.v2.colors.purple[700]:a.v2.colors.silver[600]:t?a.v2.colors.purple[800]:a.v2.colors.silver[700]};
|
|
67
67
|
}
|
|
68
|
-
`,
|
|
68
|
+
`,Ia=o.div`
|
|
69
69
|
display: flex;
|
|
70
70
|
align-items: center;
|
|
71
71
|
justify-content: center;
|
|
72
72
|
padding: 8px;
|
|
73
73
|
border-radius: 8px;
|
|
74
|
-
background-color: ${({theme:e})=>e.v2.colors.white[500]+
|
|
75
|
-
`,Da=({dataId:a,icon:n,title:l,description:o,withCarret:i,purpleColors:s,disabled:r,children:c,isSelected:d,onClick:u,isChecked:p,isPartiallyChecked:m,onCheckboxChange:h})=>{const b=g();return t(ka,{"data-id":a||`list-item-${l}`,$isSelected:d,$purpleColors:s,$disabled:r,onClick:()=>!d&&!r&&u(),children:[t(S,{$gap:4,children:[t(w,{$gap:12,children:[h&&e(D,{partiallyChecked:m||!1,value:p||!1,onChange:e=>h(e)}),n&&e(wa,{children:e(n,{size:20})}),e(_,{size:R.XS,children:l})]}),o&&e(_,{size:R.XXXS,color:b.v2.colors.silver[200],children:o})]}),(i||c)&&t(w,{$gap:8,children:[c,i&&e(It,{size:18})]})]})},Ia=[{id:"CREDIT_CARD",label:"Credit card"}],Na=[{id:U.CollectContainerAttributes,label:"Collect container attributes"},{id:U.CollectReplicaSetAttributes,label:"Collect ReplicaSet attributes"},{id:U.CollectWorkloadId,label:"Collect workload ID"},{id:U.CollectClusterId,label:"Collect cluster ID"}],Ta=[{id:H.Pod,label:H.Pod},{id:H.Namespace,label:H.Namespace},{id:H.Node,label:H.Node}],Aa=[{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:Ta}],xa=[{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:Ta}],$a=[{label:"Service",keyName:"serviceName",placeholder:"e.g. my-service",tooltip:"Service name: The rule applies to a specific service name. Only traces originating from this service’s root span will be considered."},{label:"HTTP route",keyName:"httpRoute",placeholder:"e.g. /api/v1/users",tooltip:"HTTP route: The specific HTTP route prefix to match for sampling. Only traces with routes beginning with this prefix will be considered. For instance, configuring /buy will also match /buy/product."},{label:"Threshold",keyName:"minimumLatencyThreshold",placeholder:"e.g. 1000",tooltip:"Minimum latency threshold (ms): Specifies the minimum latency in milliseconds; traces with latency below this threshold are ignored.",inputType:X.Number},{label:"Fallback",keyName:"fallbackSamplingRatio",placeholder:"e.g. 100",tooltip:"Fallback sampling ratio: Specifies the percentage of traces that meet the service/http_route filter but fall below the threshold that you still want to retain. For example, if a rule is set for service A and http_route B with a minimum latency threshold of 1 second, you might still want to keep some traces below this threshold. Setting the ratio to 20% ensures that 20% of these traces will be retained.",inputType:X.Number}],Ea=U.UrlTemplatizationRulesGroups,Ra=[{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"}],Oa=[{label:"Service name",keyName:"serviceName",placeholder:"e.g. my-service",tooltip:"Specifies the service name to search within the trace (Across all available spans)."},{label:"Sampling ratio",keyName:"samplingRatio",placeholder:"e.g. 10",tooltip:"Specifies the sample rate for all traces.",inputType:X.Number},{label:"Fallback sampling ratio",keyName:"fallbackSamplingRatio",placeholder:"e.g. 100",tooltip:"Specifies the percentage of traces that don’t meet the service name filter and that you still like to retain.",inputType:X.Number}],Fa=[{label:"Service name",keyName:"serviceName",placeholder:"e.g. my-service",tooltip:"Specifies the service name to search within the trace (across all available spans)."},{label:"Attribute key",keyName:"attributeKey",placeholder:"e.g. http.request.method",tooltip:"Specifies the attribute key inside of the span."},{label:"Fallback sampling ratio",keyName:"fallbackSamplingRatio",placeholder:"e.g. 100",tooltip:"Specifies the percentage of traces that don’t meet the service name filter and that you still like to retain.",inputType:X.Number},{label:"Condition",keyName:"condition",tooltip:"An object representing the filters for span attributes filters.",componentType:Q.Dropdown,options:[{id:"stringCondition",label:"String condition"},{id:"numberCondition",label:"Number condition"},{id:"booleanCondition",label:"Boolean condition"},{id:"jsonCondition",label:"JSON condition"}]},{label:"Operation",keyName:"operation",tooltip:"Specifies the operation to run against the attribute.",componentType:Q.Dropdown,options:[{id:"exists",label:"Exists"},{id:"equals",label:"Equals"},{id:"not_equals",label:"Not equals"},{id:"contains",label:"Contains"},{id:"not_contains",label:"Not contains"},{id:"regex",label:"Regex"},{id:"greater_than",label:"Greater than"},{id:"less_than",label:"Less than"},{id:"greater_than_or_equal",label:"Greater than or equal"},{id:"less_than_or_equal",label:"Less than or equal"},{id:"is_valid_json",label:"Is valid JSON"},{id:"is_invalid_json",label:"Is invalid JSON"},{id:"jsonpath_exists",label:"JSON path exists"},{id:"key_equals",label:"Key equals"},{id:"key_not_equals",label:"Key not equals"}]},{label:"Expected value",keyName:"expectedValue",placeholder:"e.g. GET",tooltip:"The values to test the attribute against."},{label:"JSON path",keyName:"jsonPath",placeholder:"e.g. $.user.role",tooltip:"An expression used to navigate the JSON structure.",renderCondition:e=>"jsonCondition"===e.condition}],Ma={[Z.K8sAttributes]:({value:n,setValue:l,formErrors:i})=>(o(()=>{n[U.CollectContainerAttributes]||n[U.CollectReplicaSetAttributes]||n[U.CollectWorkloadId]||n[U.CollectClusterId]||n[U.LabelsAttributes]?.length||n[U.AnnotationsAttributes]?.length||(l(U.CollectContainerAttributes,!0),l(U.CollectReplicaSetAttributes,!0),l(U.CollectWorkloadId,!0),l(U.CollectClusterId,!0),l(U.LabelsAttributes,[]),l(U.AnnotationsAttributes,[]))},[]),t(a,{children:[e(S,{$gap:6,children:Na.map(({id:a,label:o})=>t(S,{children:[e(D,{label:o,value:n[a]||!1,onChange:e=>l(a,e)}),e(I,{errorMessage:i[a]})]},a))}),e(G,{name:"labelsAttributes",label:"Label attributes",limitFieldsPerRow:2,columns:Aa,values:n[U.LabelsAttributes]||[],setValues:e=>l(U.LabelsAttributes,e),errorMessage:i[U.LabelsAttributes]}),e(G,{name:"annotationsAttributes",label:"Annotation attributes",limitFieldsPerRow:2,columns:xa,values:n[U.AnnotationsAttributes]||[],setValues:e=>l(U.AnnotationsAttributes,e),errorMessage:i[U.AnnotationsAttributes]})]})),[Z.AddClusterInfo]:({value:n,setValue:l,formErrors:o})=>{const i=g();return t(a,{children:[e(W,{label:"Overwrite existing values",labelAlign:q.Left,labelColor:i.v2.colors.silver[200],tooltip:"If enabled, the resource attributes will overwrite any existing attributes with the same name.",value:n[U.OverwriteExistingValues]||!1,onChange:e=>l(U.OverwriteExistingValues,e)}),e(G,{name:"clusterAttributes",label:"Resource attributes",limitFieldsPerRow:2,columns:[{keyName:"attributeName",label:"Attribute name"},{keyName:"attributeStringValue",label:"Attribute value"}],values:n[U.ClusterAttributes]||[],setValues:e=>l(U.ClusterAttributes,e),errorMessage:o[U.ClusterAttributes]})]})},[Z.DeleteAttributes]:({value:t,setValue:a,formErrors:n})=>e(K,{name:"attributeNamesToDelete",label:"Attributes to delete",values:t[U.AttributeNamesToDelete]||[],setValues:e=>a(U.AttributeNamesToDelete,e),errorMessage:n[U.AttributeNamesToDelete]}),[Z.RenameAttributes]:({value:t,setValue:a,formErrors:n})=>e(G,{name:"renames",label:"Attributes to rename",limitFieldsPerRow:2,columns:[{keyName:"oldKey",label:"Old key"},{keyName:"newKey",label:"New key"}],values:Object.entries(t[U.Renames]||{}).map(([e,t])=>({oldKey:e,newKey:t})),setValues:e=>{const t={};e.forEach(e=>t[e.oldKey]=e.newKey),a(U.Renames,t)},errorMessage:n[U.Renames]}),[Z.PiiMasking]:({value:a,setValue:n,formErrors:l})=>(o(()=>{a[U.PiiCategories]?.length||n(U.PiiCategories,Ia.map(({id:e})=>e))},[]),t(S,{$gap:12,children:[e(k,{label:"Attributes to mask"}),e(S,{$gap:6,children:Ia.map(({id:t,label:l})=>e(D,{label:l,value:a[U.PiiCategories]?.includes(t)||!1,onChange:e=>{const l=a[U.PiiCategories]||[],o=e?[...l,t]:l.filter(e=>e!==t);n(U.PiiCategories,o)}},t))}),e(I,{errorMessage:l[U.PiiCategories]})]})),[Z.ErrorSampler]:({value:t,setValue:a,formErrors:n})=>{const l=n[U.FallbackSamplingRatio],o=j(t[U.FallbackSamplingRatio])?"":String(t[U.FallbackSamplingRatio]);return e(z,{name:"fallbackSamplingRatio",label:"Fallback sampling ratio",type:X.Number,min:0,max:100,value:o,placeholder:"0-100",onChange:e=>{return t=e.target.value,a(U.FallbackSamplingRatio,Math.max(0,Math.min(Number(t),100))||0);var t},errorMessage:l})},[Z.ProbabilisticSampler]:({value:t,setValue:a,formErrors:n})=>{const l=n[U.SamplingPercentage],o=j(t[U.SamplingPercentage])?"":String(t[U.SamplingPercentage]);return e(z,{name:"samplingPercentage",label:"Sampling percentage",type:X.Number,min:0,max:100,value:o,placeholder:"0-100",onChange:e=>{return t=e.target.value,a(U.SamplingPercentage,Math.max(0,Math.min(Number(t),100))||0);var t},errorMessage:l})},[Z.LatencySampler]:({value:t,setValue:a,formErrors:n})=>{const l=n[U.EndpointsFilters],o=t[U.EndpointsFilters]||[];return e(G,{name:"endpointsFilters",limitFieldsPerRow:2,columns:$a,values:o,setValues:e=>{a(U.EndpointsFilters,e.map(({serviceName:e,httpRoute:t,minimumLatencyThreshold:a,fallbackSamplingRatio:n})=>({serviceName:e,httpRoute:t,minimumLatencyThreshold:Number(a),fallbackSamplingRatio:Number(n)})))},errorMessage:l})},[Z.ServiceNameSampler]:({value:t,setValue:a,formErrors:n})=>{const l=n[U.ServicesNameFilters],o=t[U.ServicesNameFilters]||[];return e(G,{name:"servicesNameFilters",limitFieldsPerRow:2,columns:Oa,values:o,setValues:e=>{a(U.ServicesNameFilters,e.map(({serviceName:e,samplingRatio:t,fallbackSamplingRatio:a})=>({serviceName:e,samplingRatio:Number(t),fallbackSamplingRatio:Number(a)})))},errorMessage:l})},[Z.SpanAttributeSampler]:({value:t,setValue:a,formErrors:n})=>{const l=n[U.AttributeFilters],o=(t[U.AttributeFilters]||[]).map(({serviceName:e,attributeKey:t,fallbackSamplingRatio:a,condition:n})=>{const l=Object.entries(n).filter(([e,t])=>t)[0][0];return{serviceName:e,attributeKey:t,fallbackSamplingRatio:a,condition:l,operation:n[l]?.operation,expectedValue:n[l]?.expectedValue,jsonPath:n[l]?.jsonPath}});return e(G,{name:"attributeFilters",limitFieldsPerRow:2,columns:Fa,values:o,setValues:e=>{a(U.AttributeFilters,e.map(({serviceName:e,attributeKey:t,fallbackSamplingRatio:a,condition:n,operation:l,expectedValue:o,jsonPath:i})=>{const s={serviceName:e,attributeKey:t,fallbackSamplingRatio:Number(a),condition:{[n]:{operation:l,expectedValue:o}}};return i&&(s.condition[n].jsonPath=i),s}))},errorMessage:l})},[Z.URLTemplatization]:({value:n,setValue:l,formErrors:o})=>{const i=g(),s=n[Ea]||[{filterK8sNamespace:"",workloadFilters:[],templatizationRules:[{template:""}],notes:""}],c=e=>l(Ea,e),d=(e,t)=>c(s.map((a,n)=>n===e?{...a,...t}:a));return t(a,{children:[s.map((a,n)=>t(r,{children:[e(Y,{}),t(S,{$gap:12,children:[t(w,{$justifyContent:"space-between",$alignItems:"center",children:[e(k,{label:`Rule Group ${n+1}`}),e(P,{leftIcon:()=>e(Nt,{fill:i.v2.colors.red[500]}),variant:V.Secondary,size:J.S,onClick:()=>{return e=n,c(s.filter((t,a)=>a!==e));var e},disabled:1===s.length})]}),e(z,{name:`urlGroup-${n}-namespace`,label:"Namespace",placeholder:"All namespaces",tooltip:"Filter rules to a specific Kubernetes namespace.",value:a.filterK8sNamespace||"",onChange:e=>d(n,{filterK8sNamespace:e.target.value})}),e(G,{name:`urlGroup-${n}-workloadFilters`,label:"Workload filters",tooltip:"Optionally scope templates to specific workloads.",columns:Ra,values:a.workloadFilters||[],setValues:e=>d(n,{workloadFilters:e})}),e(K,{name:`urlGroup-${n}-templates`,label:"Templates",required:!0,placeholder:"e.g. /user/{id}",values:a.templatizationRules.map(e=>e.template),setValues:e=>d(n,{templatizationRules:e.map(e=>({template:e}))})})]}),e(I,{errorMessage:o[Ea]})]},`url-templatization-group-${n}`)),e(P,{variant:V.Secondary,label:"Add rule group",leftIcon:Tt,onClick:()=>c([...s,{filterK8sNamespace:"",workloadFilters:[],templatizationRules:[{template:""}],notes:""}])}),e(Y,{})]})}},La=({actionType:t,value:a,setValue:n,formErrors:l})=>{if(!t)return null;const o=Ma[t];return o?e(o,{value:a,setValue:n,formErrors:l}):null},Pa={type:"",disabled:!1,name:"",notes:"",signals:[],fields:{}},Va=u({selectedOption:null,onSelectOption:()=>{},genericForm:void 0,validateFormData:()=>({preparedFormData:y(Pa)}),errorMessage:void 0}),_a=({children:t})=>{const[a,l]=n(null),[o,i]=n(void 0),s=ee(Pa),r=c(e=>{s.resetFormData(),s.handleErrorChange(void 0,void 0,{}),i(void 0),e?.type&&s.handleFormChange("type",e.type),l(e)},[]),d=c(()=>{if(!a)return{errorMessage:"No action type selected",preparedFormData:y(Pa)};const e=(t=s.formData,y(t));var t;const n={};s.handleErrorChange(void 0,void 0,n);const l=Object.keys(n).length>0?"Invalid form values":void 0;return i(l),{errorMessage:l,preparedFormData:e}},[s,a]);return e(Va.Provider,{value:{selectedOption:a,onSelectOption:r,genericForm:s,validateFormData:d,errorMessage:o},children:t})},Ba=()=>d(Va),Ua=()=>{const a=g(),{selectedOption:n,genericForm:l}=Ba();if(!l||!n)return e(x,{title:"No active form"});const{formData:o,handleFormChange:i,formErrors:s}=l;return t(S,{$gap:24,children:[t(w,{$gap:12,$justifyContent:"space-between",children:[e(_,{size:R.XXS,children:n.docsDescription}),e(P,{label:"Docs",leftIcon:At,variant:V.Text,size:J.S,onClick:()=>window.open(`${te}${n.docsEndpoint}`,"_blank","noopener noreferrer")})]}),e(ae,{options:[{icon:St,label:"Enabled",value:!1,selectedBgColor:a.v2.colors.green[800]},{icon:xt,label:"Disabled",value:!0,selectedBgColor:a.v2.colors.red[800]}],selected:o.disabled,setSelected:e=>i("disabled",e)}),e(ra,{title:"Signals for processing",allowedSignals:n.allowedSignals,selectedSignals:o.signals||[],setSelectedSignals:e=>i("signals",e),errorMessage:s.signals}),e(z,{name:"actionName",label:"Action name",placeholder:"Use a name that describes the action...",value:o.name||"",onChange:({target:{value:e}})=>i("name",e),errorMessage:s.name}),e(La,{actionType:n.type,value:o.fields,setValue:(e,t)=>i(`fields.${e}`,t),formErrors:s}),e(ne,{name:"notes",label:"Notes",placeholder:"Your personal notes...",value:o.notes||"",onChange:({target:{value:e}})=>i("notes",e),errorMessage:s.notes})]})},za=({signals:a,fields:n,disabled:l,formData:o,handleFormChange:i,formErrors:s})=>n?.map(({renderCondition:n,componentType:r,type:c,name:d,title:u,tooltip:p,placeholder:m,value:h,required:g,options:b})=>{if(!(!n||le(n,a,o.fields)))return null;const f=d,v=o.fields.find(e=>e.key===f),y=v?v.value:h;switch(r){case Q.Input:return e(z,{name:f,type:c,label:u,tooltip:p,required:g,placeholder:m,value:y,onChange:e=>i(f,e.target.value),disabled:l,errorMessage:s[f]},f);case Q.MultiInput:return e(K,{label:u,tooltip:p,required:g,placeholder:m,values:ie(y,[]),setValues:e=>i(f,JSON.stringify(e)),disabled:l,errorMessage:s[f]},f);case Q.KeyValuePair:return e(G,{label:u,tooltip:p,required:g,limitFieldsPerRow:2,columns:[{keyName:"key",label:"Key"},{keyName:"value",label:"Value"}],values:ie(y,[]),setValues:e=>i(f,JSON.stringify(e)),disabled:l,errorMessage:s[f]},f);case Q.TextArea:return e(ne,{name:f,label:u,tooltip:p,required:g,placeholder:m,value:y,onChange:e=>i(f,e.target.value),disabled:l,errorMessage:s[f]},f);case Q.Checkbox:return t(S,{children:[e(D,{label:u,value:"true"==y,onChange:e=>i(f,e.toString()),disabled:l}),e(I,{errorMessage:s[f]})]},f);case Q.Dropdown:return e(oe,{name:f,label:u,withSearch:!0,values:y?[y]:[],options:b?.map(e=>({id:e.id||"",label:e.value||""}))||[],setValues:e=>i(f,e[0]),disabled:l,errorMessage:s[f]},f);default:return null}}),Xa={type:"",name:"",currentStreamName:"",disabled:!1,exportedSignals:{logs:!1,metrics:!1,traces:!1},fields:[]},ja={activeForm:null,onChangeActiveForm:()=>{},genericForm:void 0,validateFormData:()=>({isOk:!1,preparedFormData:y(Xa)}),unsavedDestinations:[],thisUnsavedDestination:void 0,setUnsavedDestinations:()=>{},addUnsavedDestination:()=>{},updateUnsavedDestination:()=>{},deleteUnsavedDestination:()=>{}},Ga=u(ja),Ha=({children:t})=>{const{selectedStreamName:a}=se(),[l,i]=n(null),[s,r]=n(ja.unsavedDestinations),d=p(()=>"number"==typeof l?.unsavedIdx?s[l.unsavedIdx]:void 0,[l,s]),u=c(e=>{l&&(r(t=>[...t,{...e,option:l.option}]),i(null))},[l]),m=c((e,t)=>{l&&(r(a=>a.map((a,n)=>n===e?{...a,...t,option:l.option}:a)),i(null))},[l]),h=c(e=>{r(t=>t.filter((t,a)=>a!==e)),i(null)},[]),g=ee({...Xa,currentStreamName:a});o(()=>{if(l)if(d)g.handleFormChange(void 0,void 0,d.formData);else{g.handleFormChange("type",l.option.type),g.handleFormChange("name",l.option.displayName),g.handleFormChange("disabled",!1);const e=re(l.option.supportedSignals);g.handleFormChange("exportedSignals",{logs:e.includes(ce.Logs),metrics:e.includes(ce.Metrics),traces:e.includes(ce.Traces)}),g.handleFormChange("fields",l.dynamicFields.map(e=>({key:e.name,value:e.value})))}},[l,d]);const b=c(e=>{var t;g.resetFormData(),g.handleErrorChange(void 0,void 0,{}),i(e?{...e,dynamicFields:e.option?.fields?(t=e.option.fields,t.filter(e=>!!e).map(e=>{const{name:t,componentType:a,componentProperties:n,displayName:l,initialValue:o,renderCondition:i}=e,s=a===Q.Dropdown,r=ie(n,{});return{componentType:a,renderCondition:i,name:t,title:l,value:o,placeholder:r.placeholder||(s?"Select an option":void 0),options:s&&Array.isArray(r.values)?r.values.map(e=>({id:e,value:e})):void 0,...r}})):[]}:null)},[]),f=c(()=>{const e=y(g.formData),t={};l?.dynamicFields.forEach(({name:a,required:n})=>{if(n){const n=e.fields.find(e=>e.key===a)?.value;j(n)&&(t[a]=ue.FIELD_IS_REQUIRED)}});de(e.exportedSignals).length||(t.exportedSignals=ue.FIELD_IS_REQUIRED);const a=0===Object.keys(t).length?void 0:"Invalid form values";return g.handleErrorChange(void 0,void 0,t),i(e=>e?{...e,errorMessage:a}:null),{errorMessage:a,preparedFormData:e}},[g,l]);return e(Ga.Provider,{value:{activeForm:l,onChangeActiveForm:b,genericForm:g,validateFormData:f,unsavedDestinations:s,thisUnsavedDestination:d,setUnsavedDestinations:r,addUnsavedDestination:u,updateUnsavedDestination:m,deleteUnsavedDestination:h},children:t})},Wa=()=>d(Ga),qa=h(w)`
|
|
74
|
+
background-color: ${({theme:e})=>e.v2.colors.white[500]+I["004"]};
|
|
75
|
+
`,$a=({dataId:a,icon:o,title:l,description:r,withCarret:i,purpleColors:s,disabled:c,children:u,isSelected:m,onClick:g,isChecked:f,isPartiallyChecked:v,onCheckboxChange:y})=>{const b=n();return t(Aa,{"data-id":a||`list-item-${l}`,$isSelected:m,$purpleColors:s,$disabled:c,onClick:()=>!m&&!c&&g(),children:[t(d,{$gap:4,children:[t(p,{$gap:12,children:[y&&e(h,{partiallyChecked:v||!1,value:f||!1,onChange:e=>y(e)}),o&&e(Ia,{children:e(o,{size:20})}),e(A,{size:C.XS,children:l})]}),r&&e(A,{size:C.XXXS,color:b.v2.colors.silver[200],children:r})]}),(i||u)&&t(p,{$gap:8,children:[u,i&&e(bt,{size:18})]})]})},Ra=[{id:"CREDIT_CARD",label:"Credit card"}],Ea=[{id:$.CollectContainerAttributes,label:"Collect container attributes"},{id:$.CollectReplicaSetAttributes,label:"Collect ReplicaSet attributes"},{id:$.CollectWorkloadId,label:"Collect workload ID"},{id:$.CollectClusterId,label:"Collect cluster ID"}],Pa=[{id:M.Pod,label:M.Pod},{id:M.Namespace,label:M.Namespace},{id:M.Node,label:M.Node}],Oa=[{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:Pa}],Ma=[{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:Pa}],La=[{label:"Service",keyName:"serviceName",placeholder:"e.g. my-service",tooltip:"Service name: The rule applies to a specific service name. Only traces originating from this service’s root span will be considered."},{label:"HTTP route",keyName:"httpRoute",placeholder:"e.g. /api/v1/users",tooltip:"HTTP route: The specific HTTP route prefix to match for sampling. Only traces with routes beginning with this prefix will be considered. For instance, configuring /buy will also match /buy/product."},{label:"Threshold",keyName:"minimumLatencyThreshold",placeholder:"e.g. 1000",tooltip:"Minimum latency threshold (ms): Specifies the minimum latency in milliseconds; traces with latency below this threshold are ignored.",inputType:E.Number},{label:"Fallback",keyName:"fallbackSamplingRatio",placeholder:"e.g. 100",tooltip:"Fallback sampling ratio: Specifies the percentage of traces that meet the service/http_route filter but fall below the threshold that you still want to retain. For example, if a rule is set for service A and http_route B with a minimum latency threshold of 1 second, you might still want to keep some traces below this threshold. Setting the ratio to 20% ensures that 20% of these traces will be retained.",inputType:E.Number}],Fa=$.UrlTemplatizationRulesGroups,za=[{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"}],Xa=[{label:"Service name",keyName:"serviceName",placeholder:"e.g. my-service",tooltip:"Specifies the service name to search within the trace (Across all available spans)."},{label:"Sampling ratio",keyName:"samplingRatio",placeholder:"e.g. 10",tooltip:"Specifies the sample rate for all traces.",inputType:E.Number},{label:"Fallback sampling ratio",keyName:"fallbackSamplingRatio",placeholder:"e.g. 100",tooltip:"Specifies the percentage of traces that don’t meet the service name filter and that you still like to retain.",inputType:E.Number}],Va=[{label:"Service name",keyName:"serviceName",placeholder:"e.g. my-service",tooltip:"Specifies the service name to search within the trace (across all available spans)."},{label:"Attribute key",keyName:"attributeKey",placeholder:"e.g. http.request.method",tooltip:"Specifies the attribute key inside of the span."},{label:"Fallback sampling ratio",keyName:"fallbackSamplingRatio",placeholder:"e.g. 100",tooltip:"Specifies the percentage of traces that don’t meet the service name filter and that you still like to retain.",inputType:E.Number},{label:"Condition",keyName:"condition",tooltip:"An object representing the filters for span attributes filters.",componentType:_.Dropdown,options:[{id:"stringCondition",label:"String condition"},{id:"numberCondition",label:"Number condition"},{id:"booleanCondition",label:"Boolean condition"},{id:"jsonCondition",label:"JSON condition"}]},{label:"Operation",keyName:"operation",tooltip:"Specifies the operation to run against the attribute.",componentType:_.Dropdown,options:[{id:"exists",label:"Exists"},{id:"equals",label:"Equals"},{id:"not_equals",label:"Not equals"},{id:"contains",label:"Contains"},{id:"not_contains",label:"Not contains"},{id:"regex",label:"Regex"},{id:"greater_than",label:"Greater than"},{id:"less_than",label:"Less than"},{id:"greater_than_or_equal",label:"Greater than or equal"},{id:"less_than_or_equal",label:"Less than or equal"},{id:"is_valid_json",label:"Is valid JSON"},{id:"is_invalid_json",label:"Is invalid JSON"},{id:"jsonpath_exists",label:"JSON path exists"},{id:"key_equals",label:"Key equals"},{id:"key_not_equals",label:"Key not equals"}]},{label:"Expected value",keyName:"expectedValue",placeholder:"e.g. GET",tooltip:"The values to test the attribute against."},{label:"JSON path",keyName:"jsonPath",placeholder:"e.g. $.user.role",tooltip:"An expression used to navigate the JSON structure.",renderCondition:e=>"jsonCondition"===e.condition}],_a={[B.K8sAttributes]:({value:o,setValue:n,formErrors:l})=>(ea(()=>{o[$.CollectContainerAttributes]||o[$.CollectReplicaSetAttributes]||o[$.CollectWorkloadId]||o[$.CollectClusterId]||o[$.LabelsAttributes]?.length||o[$.AnnotationsAttributes]?.length||(n($.CollectContainerAttributes,!0),n($.CollectReplicaSetAttributes,!0),n($.CollectWorkloadId,!0),n($.CollectClusterId,!0),n($.LabelsAttributes,[]),n($.AnnotationsAttributes,[]))},[]),t(a,{children:[e(d,{$gap:6,children:Ea.map(({id:a,label:r})=>t(d,{children:[e(h,{label:r,value:o[a]||!1,onChange:e=>n(a,e)}),e(m,{errorMessage:l[a]})]},a))}),e(O,{name:"labelsAttributes",label:"Label attributes",limitFieldsPerRow:2,columns:Oa,values:o[$.LabelsAttributes]||[],setValues:e=>n($.LabelsAttributes,e),errorMessage:l[$.LabelsAttributes]}),e(O,{name:"annotationsAttributes",label:"Annotation attributes",limitFieldsPerRow:2,columns:Ma,values:o[$.AnnotationsAttributes]||[],setValues:e=>n($.AnnotationsAttributes,e),errorMessage:l[$.AnnotationsAttributes]})]})),[B.AddClusterInfo]:({value:o,setValue:l,formErrors:r})=>{const i=n();return t(a,{children:[e(L,{label:"Overwrite existing values",labelAlign:F.Left,labelColor:i.v2.colors.silver[200],tooltip:"If enabled, the resource attributes will overwrite any existing attributes with the same name.",value:o[$.OverwriteExistingValues]||!1,onChange:e=>l($.OverwriteExistingValues,e)}),e(O,{name:"clusterAttributes",label:"Resource attributes",limitFieldsPerRow:2,columns:[{keyName:"attributeName",label:"Attribute name"},{keyName:"attributeStringValue",label:"Attribute value"}],values:o[$.ClusterAttributes]||[],setValues:e=>l($.ClusterAttributes,e),errorMessage:r[$.ClusterAttributes]})]})},[B.DeleteAttributes]:({value:t,setValue:a,formErrors:o})=>e(z,{name:"attributeNamesToDelete",label:"Attributes to delete",values:t[$.AttributeNamesToDelete]||[],setValues:e=>a($.AttributeNamesToDelete,e),errorMessage:o[$.AttributeNamesToDelete]}),[B.RenameAttributes]:({value:t,setValue:a,formErrors:o})=>e(O,{name:"renames",label:"Attributes to rename",limitFieldsPerRow:2,columns:[{keyName:"oldKey",label:"Old key"},{keyName:"newKey",label:"New key"}],values:Object.entries(t[$.Renames]||{}).map(([e,t])=>({oldKey:e,newKey:t})),setValues:e=>{const t={};e.forEach(e=>t[e.oldKey]=e.newKey),a($.Renames,t)},errorMessage:o[$.Renames]}),[B.PiiMasking]:({value:a,setValue:o,formErrors:n})=>(ea(()=>{a[$.PiiCategories]?.length||o($.PiiCategories,Ra.map(({id:e})=>e))},[]),t(d,{$gap:12,children:[e(u,{label:"Attributes to mask"}),e(d,{$gap:6,children:Ra.map(({id:t,label:n})=>e(h,{label:n,value:a[$.PiiCategories]?.includes(t)||!1,onChange:e=>{const n=a[$.PiiCategories]||[],l=e?[...n,t]:n.filter(e=>e!==t);o($.PiiCategories,l)}},t))}),e(m,{errorMessage:n[$.PiiCategories]})]})),[B.ErrorSampler]:({value:t,setValue:a,formErrors:o})=>{const n=o[$.FallbackSamplingRatio],l=P(t[$.FallbackSamplingRatio])?"":String(t[$.FallbackSamplingRatio]);return e(R,{name:"fallbackSamplingRatio",label:"Fallback sampling ratio",type:E.Number,min:0,max:100,value:l,placeholder:"0-100",onChange:e=>{return t=e.target.value,a($.FallbackSamplingRatio,Math.max(0,Math.min(Number(t),100))||0);var t},errorMessage:n})},[B.ProbabilisticSampler]:({value:t,setValue:a,formErrors:o})=>{const n=o[$.SamplingPercentage],l=P(t[$.SamplingPercentage])?"":String(t[$.SamplingPercentage]);return e(R,{name:"samplingPercentage",label:"Sampling percentage",type:E.Number,min:0,max:100,value:l,placeholder:"0-100",onChange:e=>{return t=e.target.value,a($.SamplingPercentage,Math.max(0,Math.min(Number(t),100))||0);var t},errorMessage:n})},[B.LatencySampler]:({value:t,setValue:a,formErrors:o})=>{const n=o[$.EndpointsFilters],l=t[$.EndpointsFilters]||[];return e(O,{name:"endpointsFilters",limitFieldsPerRow:2,columns:La,values:l,setValues:e=>{a($.EndpointsFilters,e.map(({serviceName:e,httpRoute:t,minimumLatencyThreshold:a,fallbackSamplingRatio:o})=>({serviceName:e,httpRoute:t,minimumLatencyThreshold:Number(a),fallbackSamplingRatio:Number(o)})))},errorMessage:n})},[B.ServiceNameSampler]:({value:t,setValue:a,formErrors:o})=>{const n=o[$.ServicesNameFilters],l=t[$.ServicesNameFilters]||[];return e(O,{name:"servicesNameFilters",limitFieldsPerRow:2,columns:Xa,values:l,setValues:e=>{a($.ServicesNameFilters,e.map(({serviceName:e,samplingRatio:t,fallbackSamplingRatio:a})=>({serviceName:e,samplingRatio:Number(t),fallbackSamplingRatio:Number(a)})))},errorMessage:n})},[B.SpanAttributeSampler]:({value:t,setValue:a,formErrors:o})=>{const n=o[$.AttributeFilters],l=(t[$.AttributeFilters]||[]).map(({serviceName:e,attributeKey:t,fallbackSamplingRatio:a,condition:o})=>{const n=Object.entries(o).filter(([e,t])=>t)[0][0];return{serviceName:e,attributeKey:t,fallbackSamplingRatio:a,condition:n,operation:o[n]?.operation,expectedValue:o[n]?.expectedValue,jsonPath:o[n]?.jsonPath}});return e(O,{name:"attributeFilters",limitFieldsPerRow:2,columns:Va,values:l,setValues:e=>{a($.AttributeFilters,e.map(({serviceName:e,attributeKey:t,fallbackSamplingRatio:a,condition:o,operation:n,expectedValue:l,jsonPath:r})=>{const i={serviceName:e,attributeKey:t,fallbackSamplingRatio:Number(a),condition:{[o]:{operation:n,expectedValue:l}}};return r&&(i.condition[o].jsonPath=r),i}))},errorMessage:n})},[B.URLTemplatization]:({value:o,setValue:l,formErrors:r})=>{const i=n(),s=o[Fa]||[{filterK8sNamespace:"",workloadFilters:[],templatizationRules:[{template:""}],notes:""}],c=e=>l(Fa,e),h=(e,t)=>c(s.map((a,o)=>o===e?{...a,...t}:a));return t(a,{children:[s.map((a,o)=>t(oa,{children:[e(X,{}),t(d,{$gap:12,children:[t(p,{$justifyContent:"space-between",$alignItems:"center",children:[e(u,{label:`Rule Group ${o+1}`}),e(N,{leftIcon:()=>e(St,{fill:i.v2.colors.red[500]}),variant:D.Secondary,size:V.S,onClick:()=>{return e=o,c(s.filter((t,a)=>a!==e));var e},disabled:1===s.length})]}),e(R,{name:`urlGroup-${o}-namespace`,label:"Namespace",placeholder:"All namespaces",tooltip:"Filter rules to a specific Kubernetes namespace.",value:a.filterK8sNamespace||"",onChange:e=>h(o,{filterK8sNamespace:e.target.value})}),e(O,{name:`urlGroup-${o}-workloadFilters`,label:"Workload filters",tooltip:"Optionally scope templates to specific workloads.",columns:za,values:a.workloadFilters||[],setValues:e=>h(o,{workloadFilters:e})}),e(z,{name:`urlGroup-${o}-templates`,label:"Templates",required:!0,placeholder:"e.g. /user/{id}",values:a.templatizationRules.map(e=>e.template),setValues:e=>h(o,{templatizationRules:e.map(e=>({template:e}))})})]}),e(m,{errorMessage:r[Fa]})]},`url-templatization-group-${o}`)),e(N,{variant:D.Secondary,label:"Add rule group",leftIcon:Ct,onClick:()=>c([...s,{filterK8sNamespace:"",workloadFilters:[],templatizationRules:[{template:""}],notes:""}])}),e(X,{})]})}},Ba=({actionType:t,value:a,setValue:o,formErrors:n})=>{if(!t)return null;const l=_a[t];return l?e(l,{value:a,setValue:o,formErrors:n}):null},Ua={type:"",disabled:!1,name:"",notes:"",signals:[],fields:{}},Ha=ra({selectedOption:null,onSelectOption:()=>{},genericForm:void 0,validateFormData:()=>({preparedFormData:s(Ua)}),errorMessage:void 0}),ja=({children:t})=>{const[a,o]=Qt(null),[n,l]=Qt(void 0),r=U(Ua),i=na(e=>{r.resetFormData(),r.handleErrorChange(void 0,void 0,{}),l(void 0),e?.type&&r.handleFormChange("type",e.type),o(e)},[]),c=na(()=>{if(!a)return{errorMessage:"No action type selected",preparedFormData:s(Ua)};const e=(t=r.formData,s(t));var t;const o={};r.handleErrorChange(void 0,void 0,o);const n=Object.keys(o).length>0?"Invalid form values":void 0;return l(n),{errorMessage:n,preparedFormData:e}},[r,a]);return e(Ha.Provider,{value:{selectedOption:a,onSelectOption:i,genericForm:r,validateFormData:c,errorMessage:n},children:t})},Ka=()=>la(Ha),Ga=()=>{const a=n(),{selectedOption:o,genericForm:l}=Ka();if(!l||!o)return e(y,{title:"No active form"});const{formData:r,handleFormChange:i,formErrors:s}=l;return t(d,{$gap:24,children:[t(p,{$gap:12,$justifyContent:"space-between",children:[e(A,{size:C.XXS,children:o.docsDescription}),e(N,{label:"Docs",leftIcon:kt,variant:D.Text,size:V.S,onClick:()=>window.open(`${H}${o.docsEndpoint}`,"_blank","noopener noreferrer")})]}),e(j,{options:[{icon:gt,label:"Enabled",value:!1,selectedBgColor:a.v2.colors.green[800]},{icon:wt,label:"Disabled",value:!0,selectedBgColor:a.v2.colors.red[800]}],selected:r.disabled,setSelected:e=>i("disabled",e)}),e(ma,{title:"Signals for processing",allowedSignals:o.allowedSignals,selectedSignals:r.signals||[],setSelectedSignals:e=>i("signals",e),errorMessage:s.signals}),e(R,{name:"actionName",label:"Action name",placeholder:"Use a name that describes the action...",value:r.name||"",onChange:({target:{value:e}})=>i("name",e),errorMessage:s.name}),e(Ba,{actionType:o.type,value:r.fields,setValue:(e,t)=>i(`fields.${e}`,t),formErrors:s}),e(K,{name:"notes",label:"Notes",placeholder:"Your personal notes...",value:r.notes||"",onChange:({target:{value:e}})=>i("notes",e),errorMessage:s.notes})]})},Wa=({signals:a,fields:o,disabled:n,formData:l,handleFormChange:r,formErrors:i})=>o?.map(({renderCondition:o,componentType:s,type:c,name:u,title:p,tooltip:g,placeholder:f,value:v,required:y,options:b})=>{if(!(!o||G(o,a,l.fields)))return null;const S=u,C=l.fields.find(e=>e.key===S),k=C?C.value:v;switch(s){case _.Input:return e(R,{name:S,type:c,label:p,tooltip:g,required:y,placeholder:f,value:k,onChange:e=>r(S,e.target.value),disabled:n,errorMessage:i[S]},S);case _.MultiInput:return e(z,{label:p,tooltip:g,required:y,placeholder:f,values:q(k,[]),setValues:e=>r(S,JSON.stringify(e)),disabled:n,errorMessage:i[S]},S);case _.KeyValuePair:return e(O,{label:p,tooltip:g,required:y,limitFieldsPerRow:2,columns:[{keyName:"key",label:"Key"},{keyName:"value",label:"Value"}],values:q(k,[]),setValues:e=>r(S,JSON.stringify(e)),disabled:n,errorMessage:i[S]},S);case _.TextArea:return e(K,{name:S,label:p,tooltip:g,required:y,placeholder:f,value:k,onChange:e=>r(S,e.target.value),disabled:n,errorMessage:i[S]},S);case _.Checkbox:return t(d,{children:[e(h,{label:p,value:"true"==k,onChange:e=>r(S,e.toString()),disabled:n}),e(m,{errorMessage:i[S]})]},S);case _.Dropdown:return e(W,{name:S,label:p,withSearch:!0,values:k?[k]:[],options:b?.map(e=>({id:e.id||"",label:e.value||""}))||[],setValues:e=>r(S,e[0]),disabled:n,errorMessage:i[S]},S);default:return null}}),qa={type:"",name:"",currentStreamName:"",disabled:!1,exportedSignals:{logs:!1,metrics:!1,traces:!1},fields:[]},Ja={activeForm:null,onChangeActiveForm:()=>{},genericForm:void 0,formErrorMessage:void 0,validateFormData:()=>({isOk:!1,preparedFormData:s(qa)}),unsavedDestinations:[],thisUnsavedDestination:void 0,setUnsavedDestinations:()=>{},addUnsavedDestination:()=>{},updateUnsavedDestination:()=>{},deleteUnsavedDestination:()=>{}},Ya=ra(Ja),Qa=({children:t})=>{const{selectedStreamName:a}=J(),[o,n]=Qt(null),[l,r]=Qt(),[i,c]=Qt(Ja.unsavedDestinations),d=ia(()=>"number"==typeof o?.unsavedIdx?i[o.unsavedIdx]:void 0,[o,i]),u=na((e,t)=>{o&&(c(t=>[...t,{...e,option:o.option}]),n(t?e=>e?{...e,unsavedIdx:i.length}:null:null))},[o,i.length]),p=na((e,t,a)=>{o&&(c(a=>a.map((a,n)=>n===e?{...a,...t,option:o.option}:a)),a||n(null))},[o]),h=na(e=>{c(t=>t.filter((t,a)=>a!==e)),n(null)},[]),m=U({...qa,currentStreamName:a});ea(()=>{if(o)if(d)m.handleFormChange(void 0,void 0,d.formData);else{m.handleFormChange("type",o.option.type),m.handleFormChange("name",o.option.displayName),m.handleFormChange("disabled",!1);const e=Y(o.option.supportedSignals);m.handleFormChange("exportedSignals",{logs:e.includes(Q.Logs),metrics:e.includes(Q.Metrics),traces:e.includes(Q.Traces)}),m.handleFormChange("fields",o.dynamicFields.map(e=>({key:e.name,value:e.value})))}},[o,d]);const g=na(e=>{var t;m.resetFormData(),m.handleErrorChange(void 0,void 0,{}),r(void 0),n(e?{...e,dynamicFields:e.option?.fields?(t=e.option.fields,t.filter(e=>!!e).map(e=>{const{name:t,componentType:a,componentProperties:o,displayName:n,initialValue:l,renderCondition:r}=e,i=a===_.Dropdown,s=q(o,{});return{componentType:a,renderCondition:r,name:t,title:n,value:l,placeholder:s.placeholder||(i?"Select an option":void 0),options:i&&Array.isArray(s.values)?s.values.map(e=>({id:e,value:e})):void 0,...s}})):[]}:null)},[]),f=na(()=>{const e=s(m.formData),t={};o?.dynamicFields.forEach(({name:a,required:o})=>{if(o){const o=e.fields.find(e=>e.key===a)?.value;P(o)&&(t[a]=ee.FIELD_IS_REQUIRED)}});Z(e.exportedSignals).length||(t.exportedSignals=ee.FIELD_IS_REQUIRED);const a=0===Object.keys(t).length?void 0:"Invalid form values";return m.handleErrorChange(void 0,void 0,t),r(a),{errorMessage:a,preparedFormData:e}},[m,o]);return e(Ya.Provider,{value:{activeForm:o,onChangeActiveForm:g,genericForm:m,formErrorMessage:l,validateFormData:f,unsavedDestinations:i,thisUnsavedDestination:d,setUnsavedDestinations:c,addUnsavedDestination:u,updateUnsavedDestination:p,deleteUnsavedDestination:h},children:t})},Za=()=>la(Ya),eo=o(p)`
|
|
76
76
|
position: sticky;
|
|
77
77
|
bottom: 0;
|
|
78
78
|
margin-top: auto;
|
|
79
79
|
padding: 12px 0;
|
|
80
80
|
background-color: ${({theme:e})=>e.v2.colors.silver[900]};
|
|
81
81
|
z-index: 1;
|
|
82
|
-
`,Ka=({testConnection:a})=>{const l=g(),{activeForm:i,genericForm:s,validateFormData:r,thisUnsavedDestination:c,addUnsavedDestination:d,updateUnsavedDestination:u,deleteUnsavedDestination:p}=Wa(),[m,h]=n(c?.testResult),[b,f]=n(!!c||!1);if(o(()=>{c?(h(c.testResult),f(!0)):(h(void 0),f(!1))},[c]),!s||!i)return e(x,{title:"No active form"});const v=async()=>{const e=await a(s.formData);return h(e),e};return t(S,{$gap:24,style:{minHeight:"100%"},children:[t(w,{$gap:12,$justifyContent:"space-between",children:[m?m.succeeded?e(M,{status:L.Success,message:m.message||"Connection OK",fullWidth:!0,smallIcon:!0}):e(M,{status:L.Error,message:m.message||"Connection Failed",fullWidth:!0,smallIcon:!0}):e("div",{}),e(P,{"data-id":"dest-form-docs",label:"Docs",leftIcon:At,variant:V.Text,size:J.S,onClick:()=>window.open(`${te}/backends/${i.option.type}`,"_blank","noopener noreferrer")})]}),e(ae,{options:[{icon:St,label:"Enabled",value:!1,selectedBgColor:l.v2.colors.green[800]},{icon:xt,label:"Disabled",value:!0,selectedBgColor:l.v2.colors.red[800]}],selected:s.formData.disabled,setSelected:e=>s.handleFormChange("disabled",e),disabled:b}),e(ra,{title:"This connection will monitor:",allowedSignals:re(i.option.supportedSignals),selectedSignals:de(s.formData.exportedSignals),setSelectedSignals:e=>s.handleFormChange("exportedSignals",{logs:e.includes(ce.Logs),metrics:e.includes(ce.Metrics),traces:e.includes(ce.Traces)}),disabled:b,errorMessage:s.formErrors.exportedSignals}),e(z,{label:"Destination name",placeholder:"Use a name that describes the destination...",value:s.formData.name,onChange:({target:{value:e}})=>s.handleFormChange("name",e),disabled:b,errorMessage:s.formErrors.name}),e(za,{signals:de(s.formData.exportedSignals),fields:i.dynamicFields,disabled:b,formData:s.formData,handleFormChange:(e,t)=>{s.handleFormChange("fields",s.formData.fields.map(a=>a.key===e?{...a,value:t}:a))},formErrors:s.formErrors}),t(qa,{$gap:8,$justifyContent:"flex-end",children:[c&&e("div",{style:{width:"150px"},children:e(P,{"data-id":"dest-form-delete",fullWidth:!0,label:"Delete",rightIcon:$t,variant:V.Secondary,textColor:l.v2.colors.red[500],onClick:()=>p(i.unsavedIdx)})}),(!c||c&&!b)&&e("div",{style:{width:"150px"},children:e(P,{"data-id":"dest-form-test-connection",fullWidth:!0,label:"Test Connection",variant:V.Secondary,onClick:v})}),c&&e("div",b?{style:{width:"150px"},children:e(P,{"data-id":"dest-form-edit",fullWidth:!0,label:"Edit",rightIcon:Et,variant:V.Secondary,onClick:()=>f(!1)})}:{style:{width:"150px"},children:e(P,{"data-id":"dest-form-save",fullWidth:!0,label:"Save Changes",variant:V.Primary,onClick:async()=>{const{errorMessage:e,preparedFormData:t}=r();if(!e){const e=await v();u(i.unsavedIdx,{formData:t,testResult:e})}}})}),!c&&e("div",{style:{width:"150px"},children:e(P,{"data-id":"dest-form-add",fullWidth:!0,label:"Add Destination",variant:V.Primary,onClick:async()=>{const{errorMessage:e,preparedFormData:t}=r();if(!e){const e=await v();d({formData:t,testResult:e})}}})})]})]})},Ya=[{id:pe.FilePath,label:"Collect file path",tooltip:"Indicates whether to record the `code.filepath` attribute."},{id:pe.Function,label:"Collect function",tooltip:"Indicates whether to record the `code.function` attribute."},{id:pe.LineNumber,label:"Collect line number",tooltip:"Indicates whether to record the `code.lineno` attribute."}],Ja=[{id:pe.Column,label:"Collect column",tooltip:"Indicates whether to record the `code.column` attribute."},{id:pe.Namespace,label:"Collect namespace",tooltip:"Indicates whether to record the `code.namespace` attribute."},{id:pe.StackTrace,label:"Collect stacktrace",tooltip:"Indicates whether to record the `code.stacktrace` attribute."}],Qa=["*"],Za=[{id:ge.HttpRequest,label:"Collect HTTP request",tooltip:""},{id:ge.HttpResponse,label:"Collect HTTP response",tooltip:""},{id:ge.DbQuery,label:"Collect DB query",tooltip:""},{id:ge.Messaging,label:"Collect messaging",tooltip:""}],en={[ve.Java]:[new fe("","")],[ve.Golang]:[new be("")]},tn={[ye.CodeAttributes]:({value:n,setValue:l,formErrors:i})=>{const s=g(),r=i.codeAttributes,c=p(()=>Object.entries(n.codeAttributes||{}).filter(([e,t])=>!!t).map(([e])=>e),[n]);o(()=>{if(!c.length&&!r){const e={[pe.FilePath]:!0,[pe.Function]:!0,[pe.LineNumber]:!0,[pe.Column]:null,[pe.Namespace]:null,[pe.StackTrace]:null};l("codeAttributes",e)}},[]);const d=(e,t)=>{const a=t?[...c,e]:c.filter(t=>t!==e),n=Object.values(pe).reduce((e,t)=>(e[t]=!!a.includes(t)||null,e),{});l("codeAttributes",n)};return t(a,{children:[t(S,{$gap:12,children:[e(_,{size:R.XS,color:s.v2.colors.silver[200],nowrap:!0,children:"Recommended data to collect"}),e(S,{$gap:6,children:Ya.map(({id:t,label:a,tooltip:n})=>e(me,{text:n,withIcon:!0,children:e(D,{label:a,value:c.includes(t),onChange:e=>d(t,e)})},t))}),e(I,{errorMessage:r})]}),t(S,{$gap:12,children:[e(_,{size:R.XS,color:s.v2.colors.silver[200],nowrap:!0,children:"Verbose data to collect"}),e(S,{$gap:6,children:Ja.map(({id:t,label:a,tooltip:n})=>e(me,{text:n,withIcon:!0,children:e(D,{label:a,value:c.includes(t),onChange:e=>d(t,e)})},t))}),e(I,{errorMessage:r})]})]})},[ye.CustomInstrumentation]:({value:n,setValue:l,formErrors:i})=>{const s=i.customInstrumentations,r=p(()=>(n?.customInstrumentations?.[ve.Golang]||[]).map(e=>new be(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)),[n]),c=p(()=>(n?.customInstrumentations?.[ve.Java]||[]).map(e=>new fe(e.className,e.methodName)),[n]);return o(()=>{n?.customInstrumentations||s||l("customInstrumentations",{[ve.Golang]:en[ve.Golang],[ve.Java]:en[ve.Java]})},[]),t(a,{children:[t(S,{children:[t(w,{$gap:8,children:[e(Rt,{}),e(k,{label:"Golang custom probes"})]}),e(G,{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:r,setValues:e=>{const t={};t[ve.Golang]=e.map(e=>new be(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)),t[ve.Java]=c,l("customInstrumentations",t)},errorMessage:s,limitFieldsPerRow:2})]}),t(S,{children:[t(w,{$gap:8,children:[e(Ot,{}),e(k,{label:"Java custom probes"})]}),e(G,{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:c,setValues:e=>{const t={};t[ve.Golang]=r,t[ve.Java]=e.map(e=>new fe(e.className,e.methodName)),l("customInstrumentations",t)},errorMessage:s,limitFieldsPerRow:2})]})]})},[ye.HeadersCollection]:({value:t,setValue:a,formErrors:n})=>{const l=n.headersCollection,i=p(()=>t?.headersCollection?.[he.HeaderKeys]||[],[t]),s=e=>{const t={[he.HeaderKeys]:e};a("headersCollection",t)};return o(()=>{i.length||l||s(Qa)},[]),e(K,{name:"headerKeys",label:"Header keys",tooltip:"Specify which headers you want to collect",helpMessage:"Asterisk (*) will collect all headers",values:i,setValues:s,errorMessage:l})},[ye.PayloadCollection]:({value:a,setValue:n,formErrors:l})=>{const i=g(),s=l.payloadCollection,r=p(()=>Object.entries(a.payloadCollection||{}).filter(([e,t])=>!!t).map(([e])=>e),[a]);o(()=>{if(!r.length&&!s){const e={[ge.HttpRequest]:{},[ge.HttpResponse]:{},[ge.DbQuery]:{},[ge.Messaging]:{}};n("payloadCollection",e)}},[]);return t(S,{$gap:12,children:[e(_,{size:R.XS,color:i.v2.colors.silver[200],nowrap:!0,children:"Type of data to collect"}),e(S,{$gap:6,children:Za.map(({id:t,label:a,tooltip:l})=>e(me,{text:l,withIcon:!0,children:e(D,{label:a,value:r.includes(t),onChange:e=>((e,t)=>{const a=t?[...r,e]:r.filter(t=>t!==e),l={[ge.HttpRequest]:a.includes(ge.HttpRequest)?{}:null,[ge.HttpResponse]:a.includes(ge.HttpResponse)?{}:null,[ge.DbQuery]:a.includes(ge.DbQuery)?{}:null,[ge.Messaging]:a.includes(ge.Messaging)?{}:null};n("payloadCollection",l)})(t,e)})},t))}),e(I,{errorMessage:s})]})},[ye.UnknownType]:null},an=({ruleType:t,value:a,setValue:n,formErrors:l})=>{if(!t)return null;const o=tn[t];return o?e(o,{value:a,setValue:n,formErrors:l}):null},nn={disabled:!1,ruleName:"",notes:"",workloads:null,instrumentationLibraries:null,payloadCollection:null,codeAttributes:null,headersCollection:null,customInstrumentations:null},ln=u({selectedOption:null,onSelectOption:()=>{},genericForm:void 0,validateFormData:()=>({preparedFormData:y(nn)}),errorMessage:void 0}),on=({children:t})=>{const[a,l]=n(null),[o,i]=n(void 0),s=ee(nn),r=c(e=>{s.resetFormData(),s.handleErrorChange(void 0,void 0,{}),i(void 0),l(e)},[]),d=c(()=>{if(!a)return{errorMessage:"No rule type selected",preparedFormData:y(nn)};const e=(e=>{const t=y(e);return t.headersCollection?.[he.HeaderKeys]?.length&&(t.headersCollection[he.HeaderKeys]=t.headersCollection[he.HeaderKeys].map(e=>e.trim()).filter(e=>e)),t.customInstrumentations?.[ve.Golang]?.length&&(t.customInstrumentations[ve.Golang]=t.customInstrumentations[ve.Golang].map(e=>new be(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)).filter(e=>e.Verify())),t.customInstrumentations?.[ve.Java]?.length&&(t.customInstrumentations[ve.Java]=t.customInstrumentations[ve.Java].map(e=>new fe(e.className,e.methodName)).filter(e=>e.Verify())),t})(s.formData),t={};switch(a.type){case ye.CodeAttributes:Object.values(e.codeAttributes||{}).some(e=>null!=e)||(t.codeAttributes="Code attributes are required");break;case ye.PayloadCollection:Object.values(e.payloadCollection||{}).some(e=>null!=e)||(t.payloadCollection="Payload collection are required");break;case ye.HeadersCollection:e.headersCollection?.[he.HeaderKeys]?.length||(t.headersCollection="Header keys are required");break;case ye.CustomInstrumentation:e.customInstrumentations?.[ve.Golang]?.length||e.customInstrumentations?.[ve.Java]?.length||(t.customInstrumentations="Custom instrumentation are required")}s.handleErrorChange(void 0,void 0,t);const n=Object.keys(t).length>0?"Invalid form values":void 0;return i(n),{errorMessage:n,preparedFormData:e}},[s,a]);return e(ln.Provider,{value:{selectedOption:a,onSelectOption:r,genericForm:s,validateFormData:d,errorMessage:o},children:t})},sn=()=>d(ln),rn=()=>{const a=g(),{selectedOption:n,genericForm:l}=sn();if(!l||!n)return e(x,{title:"No active form"});const{formData:o,handleFormChange:i,formErrors:s}=l;return t(S,{$gap:24,children:[t(w,{$gap:12,$justifyContent:"space-between",children:[e(_,{size:R.XXS,children:n.docsDescription}),e(P,{label:"Docs",leftIcon:At,variant:V.Text,size:J.S,onClick:()=>window.open(`${te}${n.docsEndpoint}`,"_blank","noopener noreferrer")})]}),t(w,{$gap:12,children:[e(_,{size:R.XS,color:a.v2.colors.silver[200],nowrap:!0,children:"Supported Languages:"}),n.supportedLanguages.map(t=>e(Ce,{label:Se[t],leftIcon:ke(t),status:L.Default,useSecondaryTone:!0},t))]}),e(ae,{options:[{icon:St,label:"Enabled",value:!1,selectedBgColor:a.v2.colors.green[800]},{icon:xt,label:"Disabled",value:!0,selectedBgColor:a.v2.colors.red[800]}],selected:o.disabled,setSelected:e=>i("disabled",e)}),e(z,{name:"ruleName",label:"Rule name",placeholder:"Use a name that describes the rule...",value:o.ruleName,onChange:({target:{value:e}})=>i("ruleName",e),errorMessage:s.ruleName}),e(an,{ruleType:n.type,value:o,setValue:(e,t)=>i(e,t),formErrors:s}),e(ne,{name:"notes",label:"Notes",placeholder:"Your personal notes...",value:o.notes,onChange:({target:{value:e}})=>i("notes",e),errorMessage:s.notes})]})},cn=u({isFetching:!1,formData:[],handleSourceChange:()=>{},handleSelectAll:()=>{},formDiff:{},isFormDirty:!1}),dn=({children:t,selectedConnectionIds:a,getAllClusterSnapshots:l,fetchNamespacesWithWorkloads:i,initialInputs:s})=>{const{tier:r}=f(),d=r===v.Onprem,{selectedStreamName:u}=se(),[m,h]=n(!1),[g,b]=n(null),C=c(async()=>{try{if(h(!0),l){const e=await l();e&&b(e)}else if(i){const e=await i();e.data?.length&&b({clusters:[{clusterId:De,clusterName:we,namespaces:e.data.map(e=>({name:e.name,selected:e.selected,workloads:e.sources?.map(e=>({namespace:e.namespace,name:e.name,kind:e.kind,selected:e.selected}))||[]}))}]})}}catch(e){}finally{h(!1)}},[]);o(()=>{C()},[]);const[S,k]=n([]);o(()=>{g&&k(e=>{const t=((e,t)=>y(((e,t)=>e.clusters.filter(({clusterId:e})=>!t||t.includes(e)))(e,t)))(g,a);return t.map(t=>{const a=e?.find(e=>e.clusterId===t.clusterId),n=a??t;if(s?.[t.clusterId]){const e=s[t.clusterId],a=y(n);return e.forEach(e=>{const t=a.namespaces.find(t=>t.name===e.namespace);if(t)if(e.name&&e.kind){const a=t.workloads.find(t=>t.name===e.name&&t.kind===e.kind);a&&(a.selected=e.selected)}else t.selected=e.selected,e.selected&&t.workloads.forEach(e=>{Ie.has(e.kind)&&!d||(e.selected=!0)})}),a}return n})})},[g,a,s]);const{formDiff:w,isFormDirty:D}=p(()=>{const e=((e,t,a)=>{const n={};return e.forEach(e=>{e.namespaces.forEach(l=>{const o=t.find(t=>t.clusterId===e.clusterId)?.namespaces.find(e=>e.name===l.name),i=l.selected||!1,s=i!==o?.selected;if(s&&(n[e.clusterId]||(n[e.clusterId]=[]),n[e.clusterId].push({namespace:l.name,selected:i,currentStreamName:a}),i&&(n[e.clusterId]=n[e.clusterId].filter(e=>e.namespace!==l.name||e.namespace===l.name&&(!e.name||!e.kind)))),!s||!i){const t=((e,t,a)=>{const n=[];return t.workloads.forEach(l=>{const o=e?.workloads.find(e=>e.name===l.name&&e.kind===l.kind);l.selected!==o?.selected&&n.push({namespace:t.name,name:l.name,kind:l.kind,selected:l.selected||!1,currentStreamName:a})}),n})(o,l,a);t.length>0&&(n[e.clusterId]||(n[e.clusterId]=[]),n[e.clusterId].push(...t))}})}),n})(S,g?.clusters||[],u);return{formDiff:e,isFormDirty:Object.keys(e).length>0}},[S,g,u]),I=c(e=>!d&&Ie.has(e),[d]),N=c(({clusterId:e,workloadId:t,selected:a,auto:n})=>{k(l=>{const o=y(l),i=o.findIndex(t=>t.clusterId===e);if(-1===i)return o;const s=o[i].namespaces.findIndex(e=>e.name===t.namespace);if(-1===s)return o;if(t.kind&&t.name){const e=o[i].namespaces[s].workloads.findIndex(e=>e.name===t.name&&e.kind===t.kind);if(-1===e)return o;const n="boolean"==typeof a?a:!o[i].namespaces[s].workloads[e].selected;if(o[i].namespaces[s].workloads[e].selected=n,n){o[i].namespaces[s].workloads.filter(e=>!I(e.kind)).every(e=>e.selected)&&(o[i].namespaces[s].selected=!0)}else o[i].namespaces[s].selected=!1}else{const e="boolean"==typeof n?n:!o[i].namespaces[s].selected;o[i].namespaces[s].selected=e,e?o[i].namespaces[s].workloads.forEach(e=>{I(e.kind)||(e.selected=!0)}):"boolean"!=typeof a||a||o[i].namespaces[s].workloads.forEach(e=>{e.selected=!1})}return o})},[I]),T=c(({clusterId:e,namespaceName:t,boolean:a,searchText:n="",searchBy:l="",filters:o})=>{k(i=>{const s=y(i),r=l===Ae.Namespace?n:"",c=l===Ae.Source?n:"",d=!!r||!!c||!!o?.showOnlySelected;return s.forEach((n,l)=>{e&&n.clusterId!==e||n.namespaces.forEach(({name:e,workloads:n},i)=>{if(!t||e===t)if(d)if(t){n.forEach((e,t)=>{a&&I(e.kind)||Ne(e,c,o||{showOnlySelected:!1})&&(s[l].namespaces[i].workloads[t].selected=a)});const e=s[l].namespaces[i].workloads.filter(e=>!I(e.kind)).every(e=>e.selected);s[l].namespaces[i].selected=e}else{if(!Te(s[l].namespaces[i],r,o||{showOnlySelected:!1}))return;s[l].namespaces[i].selected=a,n.forEach((e,t)=>{a&&I(e.kind)||(s[l].namespaces[i].workloads[t].selected=a)})}else s[l].namespaces[i].selected=a,n.forEach((e,t)=>{a&&I(e.kind)||(s[l].namespaces[i].workloads[t].selected=a)})})}),s})},[I]);return e(cn.Provider,{value:{isFetching:m,formData:S,handleSourceChange:N,handleSelectAll:T,formDiff:w,isFormDirty:D},children:t})},un=()=>d(cn),pn=h.div`
|
|
82
|
+
`,to=({testConnection:a})=>{const o=n(),{activeForm:l,genericForm:r,validateFormData:i,thisUnsavedDestination:s,addUnsavedDestination:c,updateUnsavedDestination:u,deleteUnsavedDestination:h}=Za(),[m,g]=Qt(s?.testResult),[f,v]=Qt(!!s||!1);if(ea(()=>{if(s){g(s.testResult);const e=s.testResult&&!s.testResult.succeeded;v(!e)}else g(void 0),v(!1)},[s]),!r||!l)return e(y,{title:"No active form"});const b=async()=>{if(!l.option.testConnectionSupported)return;const e=await a(r.formData);return g(e),e};return t(d,{$gap:24,style:{minHeight:"100%"},children:[t(p,{$gap:12,$justifyContent:"space-between",children:[m?m.succeeded?e(x,{status:T.Success,message:m.message||"Connection OK",fullWidth:!0,smallIcon:!0}):e(x,{status:T.Error,message:m.message||"Connection Failed",fullWidth:!0,smallIcon:!0}):e("div",{}),e(N,{"data-id":"dest-form-docs",label:"Docs",leftIcon:kt,variant:D.Text,size:V.S,onClick:()=>window.open(`${H}/backends/${l.option.type}`,"_blank","noopener noreferrer")})]}),e(j,{options:[{icon:gt,label:"Enabled",value:!1,selectedBgColor:o.v2.colors.green[800]},{icon:wt,label:"Disabled",value:!0,selectedBgColor:o.v2.colors.red[800]}],selected:r.formData.disabled,setSelected:e=>r.handleFormChange("disabled",e),disabled:f}),e(ma,{title:"This connection will monitor:",allowedSignals:Y(l.option.supportedSignals),selectedSignals:Z(r.formData.exportedSignals),setSelectedSignals:e=>r.handleFormChange("exportedSignals",{logs:e.includes(Q.Logs),metrics:e.includes(Q.Metrics),traces:e.includes(Q.Traces)}),disabled:f,errorMessage:r.formErrors.exportedSignals}),e(R,{label:"Destination name",placeholder:"Use a name that describes the destination...",value:r.formData.name,onChange:({target:{value:e}})=>r.handleFormChange("name",e),disabled:f,errorMessage:r.formErrors.name}),e(Wa,{signals:Z(r.formData.exportedSignals),fields:l.dynamicFields,disabled:f,formData:r.formData,handleFormChange:(e,t)=>{r.handleFormChange("fields",r.formData.fields.map(a=>a.key===e?{...a,value:t}:a))},formErrors:r.formErrors}),t(eo,{$gap:8,$justifyContent:"flex-end",children:[s&&e("div",{style:{width:"150px"},children:e(N,{"data-id":"dest-form-delete",fullWidth:!0,label:"Delete",rightIcon:xt,variant:D.Secondary,textColor:o.v2.colors.red[500],onClick:()=>h(l.unsavedIdx)})}),(!s||s.option.testConnectionSupported&&!f)&&e("div",{style:{width:"150px"},children:e(N,{"data-id":"dest-form-test-connection",fullWidth:!0,label:"Test Connection",variant:D.Secondary,onClick:b})}),s&&e("div",f?{style:{width:"150px"},children:e(N,{"data-id":"dest-form-edit",fullWidth:!0,label:"Edit",rightIcon:Tt,variant:D.Secondary,onClick:()=>v(!1)})}:{style:{width:"150px"},children:e(N,{"data-id":"dest-form-save",fullWidth:!0,label:"Save Changes",variant:D.Primary,onClick:async()=>{const{errorMessage:e,preparedFormData:t}=i();if(!e){const e=await b(),a=!!e&&!e.succeeded;u(l.unsavedIdx,{formData:t,testResult:e},a)}}})}),!s&&e("div",{style:{width:"150px"},children:e(N,{"data-id":"dest-form-add",fullWidth:!0,label:"Add Destination",variant:D.Primary,onClick:async()=>{const{errorMessage:e,preparedFormData:t}=i();if(!e){const e=await b(),a=!!e&&!e.succeeded;c({formData:t,testResult:e},a)}}})})]})]})},ao=[{id:te.FilePath,label:"Collect file path",tooltip:"Indicates whether to record the `code.filepath` attribute."},{id:te.Function,label:"Collect function",tooltip:"Indicates whether to record the `code.function` attribute."},{id:te.LineNumber,label:"Collect line number",tooltip:"Indicates whether to record the `code.lineno` attribute."}],oo=[{id:te.Column,label:"Collect column",tooltip:"Indicates whether to record the `code.column` attribute."},{id:te.Namespace,label:"Collect namespace",tooltip:"Indicates whether to record the `code.namespace` attribute."},{id:te.StackTrace,label:"Collect stacktrace",tooltip:"Indicates whether to record the `code.stacktrace` attribute."}],no=["*"],lo=[{id:ne.HttpRequest,label:"Collect HTTP request",tooltip:""},{id:ne.HttpResponse,label:"Collect HTTP response",tooltip:""},{id:ne.DbQuery,label:"Collect DB query",tooltip:""},{id:ne.Messaging,label:"Collect messaging",tooltip:""}],ro={[ie.Java]:[new re("","")],[ie.Golang]:[new le("")]},io={[se.CodeAttributes]:({value:o,setValue:l,formErrors:r})=>{const i=n(),s=r.codeAttributes,c=ia(()=>Object.entries(o.codeAttributes||{}).filter(([e,t])=>!!t).map(([e])=>e),[o]);ea(()=>{if(!c.length&&!s){const e={[te.FilePath]:!0,[te.Function]:!0,[te.LineNumber]:!0,[te.Column]:null,[te.Namespace]:null,[te.StackTrace]:null};l("codeAttributes",e)}},[]);const u=(e,t)=>{const a=t?[...c,e]:c.filter(t=>t!==e),o=Object.values(te).reduce((e,t)=>(e[t]=!!a.includes(t)||null,e),{});l("codeAttributes",o)};return t(a,{children:[t(d,{$gap:12,children:[e(A,{size:C.XS,color:i.v2.colors.silver[200],nowrap:!0,children:"Recommended data to collect"}),e(d,{$gap:6,children:ao.map(({id:t,label:a,tooltip:o})=>e(ae,{text:o,withIcon:!0,children:e(h,{label:a,value:c.includes(t),onChange:e=>u(t,e)})},t))}),e(m,{errorMessage:s})]}),t(d,{$gap:12,children:[e(A,{size:C.XS,color:i.v2.colors.silver[200],nowrap:!0,children:"Verbose data to collect"}),e(d,{$gap:6,children:oo.map(({id:t,label:a,tooltip:o})=>e(ae,{text:o,withIcon:!0,children:e(h,{label:a,value:c.includes(t),onChange:e=>u(t,e)})},t))}),e(m,{errorMessage:s})]})]})},[se.CustomInstrumentation]:({value:o,setValue:n,formErrors:l})=>{const r=l.customInstrumentations,i=ia(()=>(o?.customInstrumentations?.[ie.Golang]||[]).map(e=>new le(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)),[o]),s=ia(()=>(o?.customInstrumentations?.[ie.Java]||[]).map(e=>new re(e.className,e.methodName)),[o]);return ea(()=>{o?.customInstrumentations||r||n("customInstrumentations",{[ie.Golang]:ro[ie.Golang],[ie.Java]:ro[ie.Java]})},[]),t(a,{children:[t(d,{children:[t(p,{$gap:8,children:[e(Nt,{}),e(u,{label:"Golang custom probes"})]}),e(O,{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:i,setValues:e=>{const t={};t[ie.Golang]=e.map(e=>new le(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)),t[ie.Java]=s,n("customInstrumentations",t)},errorMessage:r,limitFieldsPerRow:2})]}),t(d,{children:[t(p,{$gap:8,children:[e(Dt,{}),e(u,{label:"Java custom probes"})]}),e(O,{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:s,setValues:e=>{const t={};t[ie.Golang]=i,t[ie.Java]=e.map(e=>new re(e.className,e.methodName)),n("customInstrumentations",t)},errorMessage:r,limitFieldsPerRow:2})]})]})},[se.HeadersCollection]:({value:t,setValue:a,formErrors:o})=>{const n=o.headersCollection,l=ia(()=>t?.headersCollection?.[oe.HeaderKeys]||[],[t]),r=e=>{const t={[oe.HeaderKeys]:e};a("headersCollection",t)};return ea(()=>{l.length||n||r(no)},[]),e(z,{name:"headerKeys",label:"Header keys",tooltip:"Specify which headers you want to collect",helpMessage:"Asterisk (*) will collect all headers",values:l,setValues:r,errorMessage:n})},[se.PayloadCollection]:({value:a,setValue:o,formErrors:l})=>{const r=n(),i=l.payloadCollection,s=ia(()=>Object.entries(a.payloadCollection||{}).filter(([e,t])=>!!t).map(([e])=>e),[a]);ea(()=>{if(!s.length&&!i){const e={[ne.HttpRequest]:{},[ne.HttpResponse]:{},[ne.DbQuery]:{},[ne.Messaging]:{}};o("payloadCollection",e)}},[]);return t(d,{$gap:12,children:[e(A,{size:C.XS,color:r.v2.colors.silver[200],nowrap:!0,children:"Type of data to collect"}),e(d,{$gap:6,children:lo.map(({id:t,label:a,tooltip:n})=>e(ae,{text:n,withIcon:!0,children:e(h,{label:a,value:s.includes(t),onChange:e=>((e,t)=>{const a=t?[...s,e]:s.filter(t=>t!==e),n={[ne.HttpRequest]:a.includes(ne.HttpRequest)?{}:null,[ne.HttpResponse]:a.includes(ne.HttpResponse)?{}:null,[ne.DbQuery]:a.includes(ne.DbQuery)?{}:null,[ne.Messaging]:a.includes(ne.Messaging)?{}:null};o("payloadCollection",n)})(t,e)})},t))}),e(m,{errorMessage:i})]})},[se.UnknownType]:null},so=({ruleType:t,value:a,setValue:o,formErrors:n})=>{if(!t)return null;const l=io[t];return l?e(l,{value:a,setValue:o,formErrors:n}):null},co={disabled:!1,ruleName:"",notes:"",workloads:null,instrumentationLibraries:null,payloadCollection:null,codeAttributes:null,headersCollection:null,customInstrumentations:null},uo=ra({selectedOption:null,onSelectOption:()=>{},genericForm:void 0,validateFormData:()=>({preparedFormData:s(co)}),errorMessage:void 0}),po=({children:t})=>{const[a,o]=Qt(null),[n,l]=Qt(void 0),r=U(co),i=na(e=>{r.resetFormData(),r.handleErrorChange(void 0,void 0,{}),l(void 0),o(e)},[]),c=na(()=>{if(!a)return{errorMessage:"No rule type selected",preparedFormData:s(co)};const e=(e=>{const t=s(e);return t.headersCollection?.[oe.HeaderKeys]?.length&&(t.headersCollection[oe.HeaderKeys]=t.headersCollection[oe.HeaderKeys].map(e=>e.trim()).filter(e=>e)),t.customInstrumentations?.[ie.Golang]?.length&&(t.customInstrumentations[ie.Golang]=t.customInstrumentations[ie.Golang].map(e=>new le(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)).filter(e=>e.Verify())),t.customInstrumentations?.[ie.Java]?.length&&(t.customInstrumentations[ie.Java]=t.customInstrumentations[ie.Java].map(e=>new re(e.className,e.methodName)).filter(e=>e.Verify())),t})(r.formData),t={};switch(a.type){case se.CodeAttributes:Object.values(e.codeAttributes||{}).some(e=>null!=e)||(t.codeAttributes="Code attributes are required");break;case se.PayloadCollection:Object.values(e.payloadCollection||{}).some(e=>null!=e)||(t.payloadCollection="Payload collection are required");break;case se.HeadersCollection:e.headersCollection?.[oe.HeaderKeys]?.length||(t.headersCollection="Header keys are required");break;case se.CustomInstrumentation:e.customInstrumentations?.[ie.Golang]?.length||e.customInstrumentations?.[ie.Java]?.length||(t.customInstrumentations="Custom instrumentation are required")}r.handleErrorChange(void 0,void 0,t);const o=Object.keys(t).length>0?"Invalid form values":void 0;return l(o),{errorMessage:o,preparedFormData:e}},[r,a]);return e(uo.Provider,{value:{selectedOption:a,onSelectOption:i,genericForm:r,validateFormData:c,errorMessage:n},children:t})},ho=()=>la(uo),mo=()=>{const a=n(),{selectedOption:o,genericForm:l}=ho();if(!l||!o)return e(y,{title:"No active form"});const{formData:r,handleFormChange:i,formErrors:s}=l;return t(d,{$gap:24,children:[t(p,{$gap:12,$justifyContent:"space-between",children:[e(A,{size:C.XXS,children:o.docsDescription}),e(N,{label:"Docs",leftIcon:kt,variant:D.Text,size:V.S,onClick:()=>window.open(`${H}${o.docsEndpoint}`,"_blank","noopener noreferrer")})]}),t(p,{$gap:12,children:[e(A,{size:C.XS,color:a.v2.colors.silver[200],nowrap:!0,children:"Supported Languages:"}),o.supportedLanguages.map(t=>e(ce,{label:de[t],leftIcon:ue(t),status:T.Default,useSecondaryTone:!0},t))]}),e(j,{options:[{icon:gt,label:"Enabled",value:!1,selectedBgColor:a.v2.colors.green[800]},{icon:wt,label:"Disabled",value:!0,selectedBgColor:a.v2.colors.red[800]}],selected:r.disabled,setSelected:e=>i("disabled",e)}),e(R,{name:"ruleName",label:"Rule name",placeholder:"Use a name that describes the rule...",value:r.ruleName,onChange:({target:{value:e}})=>i("ruleName",e),errorMessage:s.ruleName}),e(so,{ruleType:o.type,value:r,setValue:(e,t)=>i(e,t),formErrors:s}),e(K,{name:"notes",label:"Notes",placeholder:"Your personal notes...",value:r.notes,onChange:({target:{value:e}})=>i("notes",e),errorMessage:s.notes})]})},go=ra({isFetching:!1,formData:[],handleSourceChange:()=>{},handleSelectAll:()=>{},formDiff:{},isFormDirty:!1}),fo=({children:t,selectedConnectionIds:a,getAllClusterSnapshots:o,fetchNamespacesWithWorkloads:n,initialInputs:l})=>{const{tier:c}=r(),d=c===i.Onprem,{selectedStreamName:u}=J(),[p,h]=Qt(!1),[m,g]=Qt(null),f=na(async()=>{try{if(h(!0),o){const e=await o();e&&g(e)}else if(n){const e=await n();e.data?.length&&g({clusters:[{clusterId:he,clusterName:pe,namespaces:e.data.map(e=>({name:e.name,selected:e.selected,workloads:e.sources?.map(e=>({namespace:e.namespace,name:e.name,kind:e.kind,selected:e.selected}))||[]}))}]})}}catch(e){}finally{h(!1)}},[]);ea(()=>{f()},[]);const[v,y]=Qt([]);ea(()=>{m&&y(e=>{const t=((e,t)=>s(((e,t)=>e.clusters.filter(({clusterId:e})=>!t||t.includes(e)))(e,t)))(m,a);return t.map(t=>{const a=e?.find(e=>e.clusterId===t.clusterId),o=a??t;if(l?.[t.clusterId]){const e=l[t.clusterId],a=s(o);return e.forEach(e=>{const t=a.namespaces.find(t=>t.name===e.namespace);if(t)if(e.name&&e.kind){const a=t.workloads.find(t=>t.name===e.name&&t.kind===e.kind);a&&(a.selected=e.selected)}else t.selected=e.selected,e.selected&&t.workloads.forEach(e=>{me.has(e.kind)&&!d||(e.selected=!0)})}),a}return o})})},[m,a,l]);const{formDiff:b,isFormDirty:S}=ia(()=>{const e=((e,t,a)=>{const o={};return e.forEach(e=>{e.namespaces.forEach(n=>{const l=t.find(t=>t.clusterId===e.clusterId)?.namespaces.find(e=>e.name===n.name),r=n.selected||!1,i=r!==l?.selected;if(i&&(o[e.clusterId]||(o[e.clusterId]=[]),o[e.clusterId].push({namespace:n.name,selected:r,currentStreamName:a}),r&&(o[e.clusterId]=o[e.clusterId].filter(e=>e.namespace!==n.name||e.namespace===n.name&&(!e.name||!e.kind)))),!i||!r){const t=((e,t,a)=>{const o=[];return t.workloads.forEach(n=>{const l=e?.workloads.find(e=>e.name===n.name&&e.kind===n.kind);n.selected!==l?.selected&&o.push({namespace:t.name,name:n.name,kind:n.kind,selected:n.selected||!1,currentStreamName:a})}),o})(l,n,a);t.length>0&&(o[e.clusterId]||(o[e.clusterId]=[]),o[e.clusterId].push(...t))}})}),o})(v,m?.clusters||[],u);return{formDiff:e,isFormDirty:Object.keys(e).length>0}},[v,m,u]),C=na(e=>!d&&me.has(e),[d]),k=na(({clusterId:e,workloadId:t,selected:a,auto:o})=>{y(n=>{const l=s(n),r=l.findIndex(t=>t.clusterId===e);if(-1===r)return l;const i=l[r].namespaces.findIndex(e=>e.name===t.namespace);if(-1===i)return l;if(t.kind&&t.name){const e=l[r].namespaces[i].workloads.findIndex(e=>e.name===t.name&&e.kind===t.kind);if(-1===e)return l;const o="boolean"==typeof a?a:!l[r].namespaces[i].workloads[e].selected;if(l[r].namespaces[i].workloads[e].selected=o,o){l[r].namespaces[i].workloads.filter(e=>!C(e.kind)).every(e=>e.selected)&&(l[r].namespaces[i].selected=!0)}else l[r].namespaces[i].selected=!1}else{const e="boolean"==typeof o?o:!l[r].namespaces[i].selected;l[r].namespaces[i].selected=e,e?l[r].namespaces[i].workloads.forEach(e=>{C(e.kind)||(e.selected=!0)}):"boolean"!=typeof a||a||l[r].namespaces[i].workloads.forEach(e=>{e.selected=!1})}return l})},[C]),w=na(({clusterId:e,namespaceName:t,boolean:a,searchText:o="",searchBy:n="",filters:l})=>{y(r=>{const i=s(r),c=n===ve.Namespace?o:"",d=n===ve.Source?o:"",u=!!c||!!d||!!l?.showOnlySelected;return i.forEach((o,n)=>{e&&o.clusterId!==e||o.namespaces.forEach(({name:e,workloads:o},r)=>{if(!t||e===t)if(u)if(t){o.forEach((e,t)=>{a&&C(e.kind)||ge(e,d,l||{showOnlySelected:!1})&&(i[n].namespaces[r].workloads[t].selected=a)});const e=i[n].namespaces[r].workloads.filter(e=>!C(e.kind)).every(e=>e.selected);i[n].namespaces[r].selected=e}else{if(!fe(i[n].namespaces[r],c,l||{showOnlySelected:!1}))return;i[n].namespaces[r].selected=a,o.forEach((e,t)=>{a&&C(e.kind)||(i[n].namespaces[r].workloads[t].selected=a)})}else i[n].namespaces[r].selected=a,o.forEach((e,t)=>{a&&C(e.kind)||(i[n].namespaces[r].workloads[t].selected=a)})})}),i})},[C]);return e(go.Provider,{value:{isFetching:p,formData:v,handleSourceChange:k,handleSelectAll:w,formDiff:b,isFormDirty:S},children:t})},vo=()=>la(go),yo=o.div`
|
|
83
83
|
display: flex;
|
|
84
84
|
align-items: center;
|
|
85
85
|
gap: 8px;
|
|
86
86
|
padding: 8px;
|
|
87
|
-
`,
|
|
87
|
+
`,bo=({onClose:a,selectedConnectionIds:o,setSelectedConnectionIds:l,createAction:r,withOverlay:i})=>{const s=n(),[c,d]=Qt(""),u=Zt(null),{selectedOption:p,onSelectOption:h,genericForm:m,validateFormData:g,errorMessage:f}=Ka(),b=ia(()=>(c?ye.filter(e=>e?.label?.toLowerCase().includes(c.toLowerCase())):ye).filter(e=>!!e),[c]),S=ia(()=>(c?be.filter(e=>e?.label?.toLowerCase().includes(c.toLowerCase())):be).filter(e=>!!e),[c]),k=ia(()=>{const a=(a,o)=>t(yo,{children:[e(A,{size:C.XS,color:s.v2.colors.silver[200],children:a}),e(ce,{label:o.toString()})]},a),o=t=>{const a=p?.type===t.type;return e($a,{dataId:t.type?`option-${t.type}`:void 0,title:t.label,description:t.description,withCarret:!0,isSelected:a,onClick:()=>{u.current?.clearErrors(),h(t)}},t.type)};return[a("Attributes",b.length),...b.map(o),a("Samplers",S.length),...S.map(o)]},[s,p?.type,b.length,S.length,h]),w=ia(()=>p?[e(Ga,{},p.type)]:[e(v,{$height:"100%",children:e(y,{icon:At,title:"Action not selected",subTitle:"Please select an action to add"})},"no-data")],[p]);return e(Da,{ref:u,isOpen:!0,withOverlay:i,onClose:a,onSave:async()=>{const{errorMessage:e,preparedFormData:t}=g();return e?Promise.resolve({error:e}):await r(t)},disableSave:!p||!m?.isFormDirty,isFormDirty:m?.isFormDirty,hideDirtyNote:!0,errorMessage:f,progress:{title:Se.CREATING_ACTION,subTitle:Se.CREATING_ACTION_SUBTITLE},header:{icon:At,title:Se.ADD_ACTION,subTitle:Se.ADD_ACTION_DESCRIPTION},connectionIds:o&&l?{value:o,setValue:l}:void 0,search:{value:c,onChange:d},leftColumn:{width:"40%",list:k},rightColumn:{width:"60%",list:w}})},So=({testConnection:t})=>{const{activeForm:a}=Za();return{width:"60%",list:a?[e(to,{testConnection:t},a.option.type)]:[e(v,{$height:"100%",children:e(y,{icon:It,title:"Select destination from the list",subTitle:"Add destination so your data has somewhere to go."})},"no-data")]}},Co=o.div`
|
|
88
88
|
display: flex;
|
|
89
89
|
flex-direction: column;
|
|
90
90
|
padding: 8px;
|
|
91
91
|
border-radius: 16px;
|
|
92
92
|
border: ${({$purpleColors:e,theme:t})=>e?`1px solid ${t.v2.colors.purple[500]}`:"1px solid transparent"};
|
|
93
93
|
background-color: ${({$noBgColor:e,$purpleColors:t,theme:a})=>e?"transparent":t?a.v2.colors.purple[900]:a.v2.colors.silver[800]};
|
|
94
|
-
`,
|
|
94
|
+
`,ko=o.div`
|
|
95
95
|
display: flex;
|
|
96
96
|
align-items: center;
|
|
97
97
|
justify-content: space-between;
|
|
98
98
|
gap: 12px;
|
|
99
99
|
padding: ${({$isOpen:e})=>e?"2px 12px 8px 12px":"2px 12px"};
|
|
100
|
-
`,
|
|
100
|
+
`,wo=({title:a,tooltip:o,list:n,noBgColor:l,purpleColors:r})=>{const[i,s]=Qt(!0);return t(Co,{"data-id":`collapse-${a}`,$noBgColor:l,$purpleColors:r,children:[t(ko,{$isOpen:i,children:[t(p,{$gap:10,children:[e(A,{size:C.XS,children:a}),o&&e(ae,{text:o,withIcon:!0}),e(ce,{label:n.length,status:r?T.Default:void 0})]}),e(Ce,{icon:i?$t:Rt,size:ke.M,onClick:()=>s(e=>!e)})]}),i?e(d,{children:n.length?sa.toArray(n):e(v,{$padding:"12px 0",children:e(y,{})})}):null]})},xo=(e,t,a)=>t||a.signalType?e.filter(e=>e.displayName.toLowerCase().includes(t.toLowerCase())&&(!a.signalType||Y(e.supportedSignals).includes(a.signalType))):e,To=({option:t,formData:a,testResult:o,isSelected:n,onSelect:l})=>e($a,{icon:Te(t.type).icon,title:a?.name||t.displayName,withCarret:!0,purpleColors:!!a,isSelected:n,onClick:()=>l(),children:o&&e(ce,{status:o.succeeded?T.Success:T.Error,leftIcon:o.succeeded?Et:Pt})}),No=({listType:t,destinationOptions:a,unsavedDestinations:o})=>{const{activeForm:n,onChangeActiveForm:l}=Za();return a?.length?e(wo,{title:xe[t].TITLE,tooltip:xe[t].DESCRIPTION,list:a.map((a,o)=>e(To,{option:a,isSelected:n?.listType===t&&(null!=a.id&&""!==a.id?n?.option.id===a.id:n?.option.type===a.type),onSelect:()=>l({listType:t,option:a})},`${t}-${a.id??a.type}-${o}`))}):o?.length?e(wo,{purpleColors:!0,title:xe[t].TITLE,tooltip:xe[t].DESCRIPTION,list:o.map(({option:a,formData:o,testResult:r},i)=>e(To,{option:a,formData:o,testResult:r,isSelected:n?.unsavedIdx===i&&n?.listType===t,onSelect:()=>l({listType:t,option:a,unsavedIdx:i})},`${t}-${i}`))},t):void 0},Do=({isFetching:t,destinationsByCategory:a,searchText:o,filters:n})=>{const{unsavedDestinations:l}=Za(),r=ia(()=>{const t=[];l.length&&t.push(e(No,{listType:we.UNSAVED,unsavedDestinations:l},"unsaved"));for(const l of Object.values(we)){if(n.categoryType&&n.categoryType!==l)continue;const r=xo(a[l],o,n);r.length&&t.push(e(No,{listType:l,destinationOptions:r},l))}return t},[l,a,o,n]);return{width:"40%",list:r.length?r:t?[e(v,{$height:"100%",children:e(S,{title:"Fetching destinations",subTitle:"Please wait while we fetch the destinations",withSpinner:!0})},"loading")]:[]}},Ao=({destinationsByCategory:o,filters:n,setFilters:l})=>{const r=ia(()=>Object.values(we).map(e=>({id:e,label:e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()})).filter(e=>o[e.id]?.length),[o]),i=ia(()=>{const e=Object.values(Q).map(e=>({value:e,label:e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}));return e.unshift({value:null,label:"All"}),e},[]);return t(a,{children:[e(W,{placeholder:"Select category",options:r,values:n.categoryType?[n.categoryType]:[],setValues:e=>l({...n,categoryType:n.categoryType===e[0]?null:e[0]})}),e(j,{size:Ne.S,options:i,selected:n.signalType,setSelected:e=>l({...n,signalType:e})})]})};var Io;!function(e){e.SELF_HOSTED="self hosted",e.MANAGED="managed"}(Io||(Io={}));const $o=({onClose:t,onBack:a,onNext:o,selectedConnectionIds:n,setSelectedConnectionIds:l,getDestinationCategories:r,getPotentialDestinations:i,initialInputs:c,testConnection:d,createDestination:u,updateDestination:p,withOverlay:h,disableAnimation:m})=>{const[g,f]=Qt(""),[v,y]=Qt({categoryType:null,signalType:null}),{destinations:b}=De(),{activeForm:S,genericForm:C,formErrorMessage:k,unsavedDestinations:w,setUnsavedDestinations:x}=Za();ea(()=>{c&&x(c)},[c]);const[T,N]=Qt(!0),[D,A]=Qt([]),[I,$]=Qt({[we.ALL]:[],[we.UNSAVED]:[],[we.EXISTS]:[],[we.DETECTED]:[],[we.SELF_HOSTED]:[],[we.MANAGED]:[]});ea(()=>{const e=b.map(e=>{let t;for(const a of D){const o=a.items.find(t=>t.type===e.destinationType.type);if(o){t=o;break}}const a=q(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:a[e.name]??e.initialValue})):[]}});$(t=>({...t,[we.EXISTS]:e}))},[b,D]);const R=na(async()=>{try{N(!0);const[e,t]=await Promise.all([r(),i()]);e&&A(e.destinationCategories.categories);const{detectedDestinations:a,selfHostedDestinations:o,managedDestinations:n}=((e,t)=>{const a=[],o=[],n=[];return e&&e.destinationCategories.categories.forEach(e=>{e.name===Io.SELF_HOSTED?o.push(...e.items):e.name===Io.MANAGED&&n.push(...e.items)}),t&&t?.potentialDestinations.forEach(t=>{for(const o of e?.destinationCategories?.categories||[]){const e=s(o),n=e.items.findIndex(e=>e.type===t.type);if(-1!==n){const o=q(t.fields,{});Object.keys(o).length&&(e.items[n].fields=e.items[n].fields.map(e=>({...e,initialValue:o[e.name]})),a.push(e.items[n]))}}}),{detectedDestinations:a,selfHostedDestinations:o,managedDestinations:n}})(e,t);$(e=>({...e,[we.DETECTED]:a,[we.SELF_HOSTED]:o,[we.MANAGED]:n}))}catch(e){}finally{N(!1)}},[]);ea(()=>{R()},[]);const E=na(async()=>{const e=(await Promise.all(w.map(({option:e,formData:t})=>{if(e.id){const a=Object.fromEntries(e.fields.map(e=>[e.name,e.initialValue??""])),o=Object.fromEntries(t.fields.map(e=>[e.key,e.value??""]));if(!Object.keys(a).some(e=>a[e]!==o[e]))return p(e.id,t,n)}return u(t,n)}))).filter(e=>e?.error);if(e.length)return{error:e.map(e=>e?.error).join("\n")}},[w,n,u,p]);return e(Da,{isOpen:!0,withOverlay:h,disableAnimation:m,onClose:t,onBack:a?()=>a(w):void 0,onNext:o?()=>o(w):void 0,nextIsSkip:!w.length,onSave:E,disableSave:!S&&!w.length,isFetching:T,errorMessage:k,isFormDirty:C?.isFormDirty,hideDirtyNote:!0,progress:{title:Se.CREATING_DESTINATION,subTitle:Se.CREATING_DESTINATION_SUBTITLE},header:{icon:It,title:Se.ADD_DESTINATIONS,subTitle:Se.ADD_DESTINATION_DRAWER_DESCRIPTION},connectionIds:n&&l?{value:n,setValue:l}:void 0,search:{value:g,onChange:f},filters:e(Ao,{destinationsByCategory:I,filters:v,setFilters:y}),leftColumn:Do({isFetching:T,destinationsByCategory:I,searchText:g,filters:v}),rightColumn:So({testConnection:d})})},Ro=({onClose:t,selectedConnectionIds:a,setSelectedConnectionIds:o,createInstrumentationRule:n,withOverlay:l})=>{const[r,i]=Qt(""),s=Zt(null),{selectedOption:c,onSelectOption:d,genericForm:u,validateFormData:p,errorMessage:h}=ho(),m=ia(()=>r?Ae.filter(e=>e.label.toLowerCase().includes(r.toLowerCase())):Ae,[r]),g=ia(()=>m.map(t=>{const a=c?.type===t.type;return e($a,{dataId:`option-${t.type}`,title:t.label,description:t.description,withCarret:!0,isSelected:a,onClick:()=>{s.current?.clearErrors(),d(t)}},t.type)}),[c,m.length,d]),f=ia(()=>c?[e(mo,{},c.type)]:[e(v,{$height:"100%",children:e(y,{icon:Ot,title:"Instrumentation rule not selected",subTitle:"Please select an instrumentation rule to add"})},"no-data")],[c]);return e(Da,{ref:s,isOpen:!0,withOverlay:l,onClose:t,onSave:async()=>{const{errorMessage:e,preparedFormData:t}=p();return e?Promise.resolve({error:e}):await n(t)},disableSave:!c||!u?.isFormDirty,isFormDirty:u?.isFormDirty,hideDirtyNote:!0,errorMessage:h,progress:{title:Se.CREATING_INSTRUMENTATION_RULE,subTitle:Se.CREATING_INSTRUMENTATION_RULE_SUBTITLE},header:{icon:Ot,title:Se.ADD_INSTRUMENTATION_RULE,subTitle:Se.ADD_INSTRUMENTATION_RULE_DESCRIPTION},connectionIds:a&&o?{value:a,setValue:o}:void 0,search:{value:r,onChange:i},leftColumn:{width:"40%",list:g},rightColumn:{width:"60%",list:f}})},Eo=o.div``,Po=o.div`
|
|
101
101
|
visibility: hidden;
|
|
102
102
|
|
|
103
103
|
transition: visibility 0s;
|
|
@@ -105,19 +105,300 @@ import{jsx as e,jsxs as t,Fragment as a}from"react/jsx-runtime";import{useState
|
|
|
105
105
|
transition-duration: 0s;
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
${
|
|
108
|
+
${Eo}:hover & {
|
|
109
109
|
visibility: visible;
|
|
110
110
|
}
|
|
111
|
-
`,
|
|
111
|
+
`,Oo=({workloadName:t,workloadKind:a,isChecked:o,onToggle:l,disabled:r,disabledReason:i})=>{const s=n(),c=()=>{};return e(Eo,{children:e($a,{dataId:`source-${t}`,title:t,disabled:r,onClick:r?c:l,isChecked:o,onCheckboxChange:r?c:l,children:r&&i?e(ce,{label:i,status:T.Default,textSize:C.XXXS}):e(Po,{children:e(ce,{label:a,status:T.Info,textSize:C.XXXS,backgroundColor:s.v2.colors.blue[900]})})})})},Mo=({formData:a,handleSourceChange:o,handleSelectAll:n,selectedArea:l,searchText:s,searchBy:c,filters:d})=>{const{tier:u}=r(),h=u===i.Onprem,m=ia(()=>l.value.namespaceName?a.find(({clusterId:e})=>e===l.value.clusterId)?.namespaces.find(({name:e})=>e===l.value.namespaceName):void 0,[a,l.value.clusterId,l.value.namespaceName]),g=ia(()=>m?[...m.workloads].sort((e,t)=>e.name.localeCompare(t.name)).filter(e=>ge(e,s,d)):[],[m,s,d]),f=ia(()=>!!g.length&&g.every(({selected:e})=>e),[g]),b=ia(()=>{if(!m)return[];const{clusterId:t}=l.value,{name:a}=m;return g.map(({name:n,selected:l,kind:r})=>{const i=!h&&me.has(r);return e(Oo,{workloadName:n,workloadKind:r,isChecked:!i&&(l||!1),onToggle:()=>o({clusterId:t,workloadId:{namespace:a,name:n,kind:r}}),disabled:i,disabledReason:"Enterprise only"},`${t}#${a}#${n}#${r}`)})},[g,m,l.value.clusterId]),{withFilterCount:S,filteredCount:k,totalCount:w}=ia(()=>{const e=m?.workloads.length??0;return{withFilterCount:g.length!==e,filteredCount:g.length,totalCount:e}},[g,m]);return{width:"40%",header:t(p,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[t(p,{$gap:8,children:[e(A,{size:C.XS,nowrap:!0,children:l.value.namespaceName?`${l.value.namespaceName} > Workloads`:"Workloads"}),e(ae,{text:S?Se.FILTERED_COUNT_TOOLTIP:void 0,children:e(ce,{label:`${S?`${k} / ${w}`:w}`,status:Ie.Unknown})})]}),e(A,{"data-id":"workloads-select-all",onClick:()=>n({clusterId:l.value.clusterId,namespaceName:l.value.namespaceName,boolean:!f,searchText:s,searchBy:c,filters:d}),disabled:!b.length,size:C.XS,children:(f?"Unselect":"Select")+" all"})]}),list:m?b:[e(v,{$height:"100%",children:e(y,{icon:Mt,title:Se.SELECT_NAMESPACE,subTitle:Se.SELECT_NAMESPACE_SUBTITLE})},"no-data")]}},Lo=o.div``,Fo=o.div`
|
|
112
112
|
visibility: ${({$visible:e})=>e?"visible":"hidden"};
|
|
113
113
|
|
|
114
114
|
transition: visibility 0s;
|
|
115
115
|
${({$visible:e})=>!e&&"& * {\n transition-duration: 0s !important;\n }"}
|
|
116
116
|
|
|
117
|
-
${
|
|
117
|
+
${Lo}:hover & {
|
|
118
118
|
visibility: visible;
|
|
119
119
|
}
|
|
120
|
-
`,
|
|
120
|
+
`,zo=({clusterId:a,namespaceName:o,checkbox:l,isFutureApps:r,selectedCounts:i,isActive:s,onActive:c,handleSourceChange:d})=>{const u=n(),h=e=>{c(),d({clusterId:a,workloadId:{namespace:o},auto:e.auto,selected:e.all})};return e(Lo,{children:e($a,{dataId:`namespace-${o}`,withCarret:!0,title:o,isSelected:s,onClick:c,isPartiallyChecked:l.partial,isChecked:l.all,onCheckboxChange:e=>h({auto:e,all:e}),children:t(p,{$gap:12,children:[e(Fo,{$visible:s||r,children:e(ae,{text:"Automatically instrument all workloads currently in the namespace, and all workloads that will be deployed to this namespace in the future",children:e(L,{label:"Auto",size:$e.S,value:r,onChange:e=>h({auto:e,all:e||void 0})})})}),t(p,{$gap:8,children:[e(A,{variant:Re.Span,size:C.XXXS,color:u.v2.colors.silver[200],align:"right",children:"Selected"}),e(ce,{label:`${i.sourced}/${i.total}`,status:s?T.Default:Ie.Unknown,minWidth:"42px"})]})]})})})},Xo=({withCollapse:t,clusterId:a,clusterName:o,namespaces:n,selectedArea:l,setSelectedArea:r,handleSourceChange:i})=>{const s=ia(()=>n.map(({name:t,totalWorkloads:n,selectedCount:s,isAllSourced:c,isSomeSourced:d,isFutureApps:u})=>e(zo,{clusterId:a,namespaceName:t,isFutureApps:u,checkbox:{all:c,partial:d},selectedCounts:{sourced:s,total:n},isActive:l.clusterId===a&&l.namespaceName===t,onActive:()=>r({clusterId:a,clusterName:o,namespaceName:t}),handleSourceChange:i},`${a}#${t}`)),[a,o,n,l]);return t?e(wo,{title:o,list:s,noBgColor:!0}):s},Vo=({isFetching:a,formData:o,handleSourceChange:n,handleSelectAll:l,selectedArea:r,setSelectedArea:i,searchText:s,searchBy:c,filters:d})=>{const u=ia(()=>o.map(e=>{const t=[...e.namespaces].sort((e,t)=>e.name.localeCompare(t.name)).filter(e=>fe(e,s,d)).map(e=>({name:e.name,totalWorkloads:e.workloads.length,...Ee(e)}));return{clusterId:e.clusterId,clusterName:e.clusterName,visibleNamespaces:t}}),[o,s,d]),h=ia(()=>{let e=!1;for(const{visibleNamespaces:t}of u)for(const{totalWorkloads:a,selectedCount:o}of t)if(e=!0,o!==a)return!1;return e},[u]),{list:m,withFilterCount:g,filteredCount:f,totalCount:y}=ia(()=>{const t=u.map(({clusterId:t,clusterName:a,visibleNamespaces:o})=>o.length?e(Xo,{withCollapse:u.length>1,clusterId:t,clusterName:a,namespaces:o,selectedArea:r,setSelectedArea:i,handleSourceChange:n},t):null),a=t.filter(e=>null!==e);return{list:a,withFilterCount:a.length!==t.length,filteredCount:a.length,totalCount:t.length}},[u,r]);return{width:"60%",header:t(p,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[t(p,{$gap:8,children:[e(A,{size:C.XS,nowrap:!0,children:"Namespaces"}),e(ae,{text:g?Se.FILTERED_COUNT_TOOLTIP:void 0,children:e(ce,{label:`${g?`${f} / ${y}`:y}`,status:Ie.Unknown})})]}),e(A,{"data-id":"namespaces-select-all",onClick:()=>l({boolean:!h,searchText:s,searchBy:c,filters:d}),disabled:!m.length,size:C.XS,children:(h?"Unselect":"Select")+" all"})]}),list:m.length?m:a?[e(v,{$height:"100%",children:e(S,{title:Se.FETCHING_NAMESPACES,subTitle:Se.FETCHING_NAMESPACES_SUBTITLE,withSpinner:!0})},"loading")]:[]}},_o=({onClose:a,onBack:o,onNext:l,selectedConnectionIds:r,setSelectedConnectionIds:i,persistSources:s,withOverlay:c,disableAnimation:d})=>{const u=n(),{progress:h,resetProgress:m}=Pe(),{isFetching:g,formData:f,handleSourceChange:v,handleSelectAll:y,formDiff:b,isFormDirty:S}=vo(),[k,w]=Qt(""),[x,T]=Qt(ve.Namespace),[N,D]=Qt({showOnlySelected:!1}),[I,$]=Qt({clusterId:"",clusterName:"",namespaceName:""});return e(Da,{isOpen:!0,withOverlay:c,disableAnimation:d,onClose:a?()=>{m(Oe.BulkInstrumenting),a()}:void 0,onBack:o?()=>o(b):void 0,onNext:l?()=>l(b):void 0,nextIsSkip:!S,onSave:()=>s(b),header:{icon:Mt,title:Se.ADD_SOURCE,subTitle:Se.ADD_SOURCES_DESCRIPTION},connectionIds:r&&i?{value:r,setValue:i}:void 0,search:{value:k,onChange:e=>{w(e),x===ve.Namespace&&$({clusterId:"",clusterName:"",namespaceName:""})},segment:{options:[{label:"Namespace",value:ve.Namespace},{label:"Source",value:ve.Source}],selected:x,setSelected:T}},filters:t(p,{$gap:8,children:[e(A,{size:C.XXXS,color:u.v2.colors.silver[200],nowrap:!0,children:"Show only:"}),e(L,{name:"filter-selected",size:$e.S,label:"Selected",value:N.showOnlySelected,onChange:e=>D(t=>({...t,showOnlySelected:e}))})]}),isFormDirty:S,isFetching:g,progress:{title:Se.CREATING_SOURCES,subTitle:Se.CREATING_SOURCES_SUBTITLE,percentage:h[Oe.BulkInstrumenting]?.percentage||0},leftColumn:Vo({isFetching:g,formData:f,handleSourceChange:v,handleSelectAll:y,selectedArea:I,setSelectedArea:$,searchText:x===ve.Namespace?k:"",searchBy:x,filters:N}),rightColumn:Mo({formData:f,handleSourceChange:v,handleSelectAll:y,selectedArea:{value:I},searchText:x===ve.Source?k:"",searchBy:x,filters:N})})},Bo=["action","endpoint","scope","duration"],Uo=o.span`
|
|
121
|
+
font-family: ${({theme:e,$isMono:t})=>t?e.font_family.secondary:e.font_family.primary};
|
|
122
|
+
font-size: ${({theme:e})=>e.v2.text.size.xxxs}px;
|
|
123
|
+
line-height: 20px;
|
|
124
|
+
color: ${({theme:e,$variant:t})=>{const a=e.v2.colors;switch(t){case"action":return a.green[400];case"endpoint":return a.purple[300];case"scope":return a.yellow[400];case"duration":return a.orange[600];default:return a.white[500]}}};
|
|
125
|
+
`,Ho=({parts:t})=>e(a,{children:t.map((t,a)=>e(Uo,{$variant:t.variant,$isMono:Bo.includes(t.variant),children:t.text},a))});var jo;!function(e){e.Noisy="noisy",e.HighlyRelevant="highly-relevant",e.CostReduction="cost-reduction"}(jo||(jo={}));const Ko=[{value:jo.Noisy,label:"Noisy Operations",tooltip:"Rules that reduce noise from high-volume, low-value operations"},{value:jo.HighlyRelevant,label:"Highly Relevant Operations",tooltip:"Rules that prioritize important traces for retention"},{value:jo.CostReduction,label:"Cost Reduction",tooltip:"Rules that optimize costs by sampling less critical data"}],Go={[jo.Noisy]:"This is the most efficient way to sample (with Head Sampling). Prefer to use it where possible.",[jo.HighlyRelevant]:'Any trace from the "Noisy Operations" category is sampled prior to checking highly relevance.',[jo.CostReduction]:"Cost reduction rules use Tail Sampling to drop traces that are unlikely to be useful for debugging or monitoring."},Wo={[jo.Noisy]:"Noisy Operations rules list",[jo.HighlyRelevant]:"Highly Relevant Operations rules list",[jo.CostReduction]:"Cost Reduction rules list"},qo={[jo.Noisy]:"noisy",[jo.HighlyRelevant]:"highlyRelevant",[jo.CostReduction]:"costReduction"};function Jo(e){if(e.workloadName){const t=e.workloadKind?.toLowerCase()||"deployment";return e.workloadNamespace?`${t} '${e.workloadName}' in namespace '${e.workloadNamespace}'`:`${t} '${e.workloadName}'`}return e.workloadNamespace?`namespace '${e.workloadNamespace}'`:e.workloadLanguage?`${e.workloadLanguage} services`:""}function Yo(e){if(!e?.length)return[{text:" for ",variant:"default"},{text:"entire cluster",variant:"scope"}];const t=e.map(Jo).filter(Boolean);if(!t.length)return[{text:" for ",variant:"default"},{text:"entire cluster",variant:"scope"}];const a=[{text:" for ",variant:"default"}],o=t.slice(0,2),n=t.length-2;return o.forEach((e,t)=>{t>0&&a.push({text:", ",variant:"default"}),a.push({text:e,variant:"scope"})}),n>0&&a.push({text:` + ${n} more`,variant:"default"}),a}function Qo(e,t){if(!e)return[];const a=[{text:" starting at ",variant:"default"}];return t?a.push({text:`${t} /${e}`,variant:"endpoint"}):a.push({text:`endpoint /${e}`,variant:"endpoint"}),a}function Zo(e){const t=[];if(null!=e.percentageAtMost?(t.push({text:`Drop ${100-e.percentageAtMost}%`,variant:"action"}),t.push({text:" of traces",variant:"default"})):t.push({text:"Drop all traces",variant:"action"}),e.operation){const a=e.operation.httpServer?.route||e.operation.httpServer?.routePrefix,o=e.operation.httpServer?.method||e.operation.httpClient?.method;t.push(...Qo(a,o));const n=e.operation.httpClient,l=n?.templatedPath||n?.templatedPathPrefix,r=n?.serverAddress;if((l||r)&&!a){const e=l&&r?`${r}/${l}`:l||r;t.push({text:" to ",variant:"default"}),o?t.push({text:`${o} /${e}`,variant:"endpoint"}):t.push({text:`/${e}`,variant:"endpoint"})}}else t.push({text:" on ",variant:"default"}),t.push({text:"any operation",variant:"endpoint"});return t.push(...Yo(e.sourceScopes)),t}function en(e){const t=[];if(null!=e.percentageAtLeast?(t.push({text:`Keep at least ${e.percentageAtLeast}%`,variant:"action"}),t.push({text:" of traces",variant:"default"})):t.push({text:"Keep all traces",variant:"action"}),e.operation){const a=e.operation.httpServer?.route||e.operation.httpServer?.routePrefix,o=e.operation.httpServer?.method;t.push(...Qo(a,o))}else t.push({text:" on ",variant:"default"}),t.push({text:"any operation",variant:"endpoint"});return t.push(...Yo(e.sourceScopes)),!e.error&&null!=e.durationAtLeastMs&&e.durationAtLeastMs>0&&(t.push({text:" with duration > ",variant:"default"}),t.push({text:`${e.durationAtLeastMs}ms`,variant:"duration"})),t}function tn(e){const t=[];if(t.push({text:`Drop ${e.percentageAtMost}%`,variant:"action"}),t.push({text:" of traces",variant:"default"}),e.operation){const a=e.operation.httpServer?.route||e.operation.httpServer?.routePrefix,o=e.operation.httpServer?.method;t.push(...Qo(a,o));const n=e.operation.kafkaConsumer?.kafkaTopic;n&&!a&&(t.push({text:" from ",variant:"default"}),t.push({text:`topic '${n}'`,variant:"endpoint"}))}else t.push({text:" on ",variant:"default"}),t.push({text:"any operation",variant:"endpoint"});return t.push(...Yo(e.sourceScopes)),t}function an(e){return e.error?"Error":null!=e.durationAtLeastMs?"Duration":"Relevance"}function on(e,t,a){const o=qo[t],n=[];for(const l of e)switch(t){case jo.Noisy:for(const e of l.noisyOperations)a?.has(e.ruleId)||n.push({ruleId:e.ruleId,samplingId:l.id,name:e.name??null,disabled:e.disabled,notes:e.notes??null,summary:Zo(e),category:o});break;case jo.HighlyRelevant:for(const e of l.highlyRelevantOperations)a?.has(e.ruleId)||n.push({ruleId:e.ruleId,samplingId:l.id,name:e.name??null,disabled:e.disabled,notes:e.notes??null,summary:en(e),category:o,typeBadge:an(e)});break;case jo.CostReduction:for(const e of l.costReductionRules)a?.has(e.ruleId)||n.push({ruleId:e.ruleId,samplingId:l.id,name:e.name??null,disabled:e.disabled,notes:e.notes??null,summary:tn(e),category:o})}return n}function nn(e,t){switch(e){case"noisy":return Zo(t);case"highlyRelevant":return en(t);case"costReduction":return tn(t)}}function ln(e,t,a,o){for(const n of e)if(n.id===t)switch(o){case"noisy":{const e=n.noisyOperations.find(e=>e.ruleId===a);if(e)return{category:"noisy",samplingId:n.id,rule:e};break}case"highlyRelevant":{const e=n.highlyRelevantOperations.find(e=>e.ruleId===a);if(e)return{category:"highlyRelevant",samplingId:n.id,rule:e};break}case"costReduction":{const e=n.costReductionRules.find(e=>e.ruleId===a);if(e)return{category:"costReduction",samplingId:n.id,rule:e};break}}return null}function rn(e,t){const a=ln(e,t.samplingId,t.rule.ruleId,t.category);return a?{...a,summary:nn(a.category,a.rule)}:null}function sn(e,t){const a=ln(e,t.samplingId,t.ruleId,t.category);return a?{...a,summary:t.summary}:null}function cn(e){return null==e||Array.isArray(e)&&0===e.length?null:e}function dn(e,t){return JSON.stringify({sourceScopes:cn(e),operation:cn(t)})}function un(e,t,a,o){return JSON.stringify({sourceScopes:cn(e),error:t??!1,durationAtLeastMs:cn(a),operation:cn(o)})}function pn(e,t){return JSON.stringify({sourceScopes:cn(e),operation:cn(t)})}function hn(e,t,a,o){switch(t){case"noisy":{const t=dn(a.sourceScopes,a.operation);for(const a of e)for(const e of a.noisyOperations)if((!o||e.ruleId!==o)&&dn(e.sourceScopes,e.operation)===t)return e.ruleId;return null}case"highlyRelevant":{const t=un(a.sourceScopes,a.error,a.durationAtLeastMs,a.operation);for(const a of e)for(const e of a.highlyRelevantOperations)if((!o||e.ruleId!==o)&&un(e.sourceScopes,e.error,e.durationAtLeastMs,e.operation)===t)return e.ruleId;return null}case"costReduction":{const t=pn(a.sourceScopes,a.operation);for(const a of e)for(const e of a.costReductionRules)if((!o||e.ruleId!==o)&&pn(e.sourceScopes,e.operation)===t)return e.ruleId;return null}}}function mn(e){if(!e.sourceScopes.length)return;const t=[];for(const a of e.sourceScopes)if("source"===a.scopeType&&a.workloadName){const e={workloadName:a.workloadName};a.workloadKind&&(e.workloadKind=a.workloadKind),a.workloadNamespace&&(e.workloadNamespace=a.workloadNamespace),t.push(e)}else"namespace"===a.scopeType&&a.workloadNamespace?t.push({workloadNamespace:a.workloadNamespace}):"language"===a.scopeType&&a.workloadLanguage&&t.push({workloadLanguage:a.workloadLanguage});return t.length?t:void 0}function gn(e){if("all"===e.percentageMode)return null;if("custom"===e.percentagePreset){const t=parseFloat(e.customPercentage);return isNaN(t)?null:t}return parseFloat(e.percentagePreset)}function fn(e){if("custom"===e.durationPreset){const t=parseFloat(e.customDurationMs);return isNaN(t)?null:t}return parseInt(e.durationPreset,10)}function vn(e){return{httpServer:{[e.routeType]:e.route||null,method:e.method||null}}}function yn(e){return"all"===e.operationType?null:"httpServer"===e.operationType?vn(e):"httpClient"===e.operationType?{httpClient:{serverAddress:e.serverAddress||null,["route"===e.routeType?"templatedPath":"templatedPathPrefix"]:e.route||null,method:e.method||null}}:null}function bn(e){return"all"===e.operationType?null:"httpServer"===e.operationType?vn(e):"kafkaConsumer"===e.operationType?{kafkaConsumer:{kafkaTopic:e.kafkaTopic||null}}:"kafkaProducer"===e.operationType?{kafkaProducer:{kafkaTopic:e.kafkaTopic||null}}:null}const Sn="Unnamed rule",Cn="Edit rule",kn="Cancel",wn="Sampling Preview",xn="Source Scope",Tn="Operation",Nn="Duration",Dn="Errors",An="Rule name",In="Rule type",$n="Note",Rn="HTTP route",En="Method",Pn="Keep Percentage",On="Drop Percentage",Mn="Keep traces with duration larger than",Ln="Keep traces with errors",Fn="Keep at least this percentage of matching traces",zn="Keep at most this percentage of matching traces",Xn={noisy:"Rules that reduce noise from high-volume, low-value operations using Head Sampling.",highlyRelevant:"Add a rule to identify highly relevant operations. Traces with errors, long duration, or from critical endpoints and key workflows will be retained so important transactions are always available for analysis.",costReduction:"Rules that optimize costs by sampling less critical data using Tail Sampling."},Vn="60vw",_n="Type here",Bn={noisy:"Create 'Noisy Operations' sampling rule",highlyRelevant:"Create 'Highly Relevant Operations' sampling rule",costReduction:"Create 'Cost Reduction' sampling rule"},Un=o.div`
|
|
126
|
+
display: flex;
|
|
127
|
+
flex-direction: column;
|
|
128
|
+
gap: 8px;
|
|
129
|
+
`,Hn=o(p)`
|
|
130
|
+
align-items: center;
|
|
131
|
+
gap: 8px;
|
|
132
|
+
`,jn=o.div`
|
|
133
|
+
flex: 1;
|
|
134
|
+
min-width: 0;
|
|
135
|
+
padding: 8px 16px;
|
|
136
|
+
border-radius: 8px;
|
|
137
|
+
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
138
|
+
white-space: pre;
|
|
139
|
+
overflow-x: auto;
|
|
140
|
+
`,Kn=({category:a,formState:o,onChange:l})=>{const r=n(),i=ia(()=>{switch(a){case"noisy":return Zo({ruleId:"",name:(e=o).name||null,disabled:!1,notes:e.notes||null,sourceScopes:mn(e)??null,percentageAtMost:gn(e),operation:yn(e)});case"highlyRelevant":return en(function(e){return{ruleId:"",name:e.name||null,disabled:!1,notes:e.notes||null,sourceScopes:mn(e)??null,error:e.keepErrors,durationAtLeastMs:"Duration"===e.ruleType?fn(e):null,percentageAtLeast:gn(e),operation:bn(e)}}(o));case"costReduction":return tn(function(e){return{ruleId:"",name:e.name||null,disabled:!1,notes:e.notes||null,sourceScopes:mn(e)??null,percentageAtMost:gn(e)??0,operation:bn(e)}}(o))}var e},[a,o]),s=1===i.length&&"default"===i[0].variant;return t(Un,{children:[e(A,{size:C.XXS,color:r.v2.colors.silver[200],children:wn}),t(Hn,{children:[e(jn,{children:s?e(A,{size:C.XXXS,color:r.v2.colors.grey[500],children:"No preview available"}):e(Ho,{parts:i})}),l&&e(L,{value:!o.disabled,onChange:e=>l({disabled:!e}),size:$e.S,label:"Rule Enabled",labelAlign:F.Right})]})]})},Gn=o.div`
|
|
141
|
+
display: flex;
|
|
142
|
+
flex-direction: column;
|
|
143
|
+
gap: 16px;
|
|
144
|
+
padding: 16px;
|
|
145
|
+
border-radius: 16px;
|
|
146
|
+
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
147
|
+
`,Wn=o(Gn)`
|
|
148
|
+
flex: 1;
|
|
149
|
+
`,qn=o.div`
|
|
150
|
+
display: flex;
|
|
151
|
+
gap: 32px;
|
|
152
|
+
`,Jn=o.div`
|
|
153
|
+
display: flex;
|
|
154
|
+
flex-direction: column;
|
|
155
|
+
gap: 4px;
|
|
156
|
+
`,Yn=o.div`
|
|
157
|
+
display: flex;
|
|
158
|
+
align-items: flex-end;
|
|
159
|
+
gap: 16px;
|
|
160
|
+
`,Qn=o.div`
|
|
161
|
+
width: 280px;
|
|
162
|
+
flex-shrink: 0;
|
|
163
|
+
`,Zn=o.div`
|
|
164
|
+
display: flex;
|
|
165
|
+
flex-direction: column;
|
|
166
|
+
gap: 4px;
|
|
167
|
+
`,el=o.div`
|
|
168
|
+
flex: 1;
|
|
169
|
+
min-width: 0;
|
|
170
|
+
`,tl=[{value:"Relevance",label:"Relevance"},{value:"Error",label:"Error"},{value:"Duration",label:"Duration"}],al=({category:a,formState:o,onChange:n})=>{const l=na(e=>n({name:e.target.value}),[n]),r=na(e=>n({notes:e.target.value}),[n]),i=na(e=>{n({ruleType:e,keepErrors:"Error"===e})},[n]);return e(Gn,{children:t(Yn,{children:[e(Qn,{children:e(R,{label:An,tooltip:"Optional. Give this rule a name for easier identification.",placeholder:"Type rule name",value:o.name,onChange:l})}),"highlyRelevant"===a&&t(Zn,{children:[e(u,{label:In}),e(j,{size:Ne.S,options:tl,selected:o.ruleType,setSelected:i})]}),e(el,{children:e(R,{label:$n,tooltip:"Optional notes (not used by the system). Add any context or details for this sampling rule.",placeholder:"Add note here...",value:o.notes,onChange:r})})]})})},ol=o.div`
|
|
171
|
+
display: flex;
|
|
172
|
+
flex-direction: column;
|
|
173
|
+
gap: 4px;
|
|
174
|
+
`,nl=o.div`
|
|
175
|
+
display: flex;
|
|
176
|
+
flex-wrap: wrap;
|
|
177
|
+
gap: 8px;
|
|
178
|
+
`,ll=o.div`
|
|
179
|
+
display: flex;
|
|
180
|
+
align-items: center;
|
|
181
|
+
gap: 8px;
|
|
182
|
+
padding: 8px 12px;
|
|
183
|
+
border-radius: 8px;
|
|
184
|
+
cursor: pointer;
|
|
185
|
+
background: ${({theme:e,$selected:t})=>t?e.v2.colors.silver[700]:e.v2.colors.silver[900]};
|
|
186
|
+
border: 1px solid ${({theme:e,$selected:t})=>t?e.v2.colors.silver[500]:e.v2.colors.silver[800]};
|
|
187
|
+
|
|
188
|
+
&:hover {
|
|
189
|
+
background: ${({theme:e})=>e.v2.colors.silver[700]};
|
|
190
|
+
}
|
|
191
|
+
`,rl=o.div`
|
|
192
|
+
display: flex;
|
|
193
|
+
width: 32px;
|
|
194
|
+
height: 32px;
|
|
195
|
+
justify-content: center;
|
|
196
|
+
align-items: center;
|
|
197
|
+
flex-shrink: 0;
|
|
198
|
+
`,il=o.div`
|
|
199
|
+
display: flex;
|
|
200
|
+
flex-wrap: wrap;
|
|
201
|
+
gap: 8px;
|
|
202
|
+
`,sl=o.div`
|
|
203
|
+
display: flex;
|
|
204
|
+
align-items: center;
|
|
205
|
+
gap: 6px;
|
|
206
|
+
padding: 4px 10px;
|
|
207
|
+
border-radius: 8px;
|
|
208
|
+
background-color: ${({theme:e})=>e.v2.colors.silver[700]};
|
|
209
|
+
border: 1px solid ${({theme:e})=>e.v2.colors.silver[500]};
|
|
210
|
+
`,cl=o.div`
|
|
211
|
+
display: flex;
|
|
212
|
+
align-items: center;
|
|
213
|
+
cursor: pointer;
|
|
214
|
+
opacity: 0.6;
|
|
215
|
+
&:hover {
|
|
216
|
+
opacity: 1;
|
|
217
|
+
}
|
|
218
|
+
`,dl={[Fe.JavaScript]:"Node.js",[Fe.DotNet]:".NET",[Fe.Php]:"PHP"},ul=[Fe.Python,Fe.Java,Fe.JavaScript,Fe.DotNet,Fe.Php,Fe.Ruby,Fe.Go].map(e=>({id:e,label:dl[e]??e.charAt(0).toUpperCase()+e.slice(1),Icon:ue(e)})),pl=[{value:"all",label:"Entire Cluster"},{value:"source",label:"Specific source"},{value:"namespace",label:"Specific Namespace"},{value:"language",label:"Specific programming language"}];function hl(e){if("source"===e.scopeType){return[e.workloadNamespace,e.workloadKind,e.workloadName].filter(Boolean).join(" / ")}if("namespace"===e.scopeType)return`namespace: ${e.workloadNamespace}`;if("language"===e.scopeType){return`language: ${dl[e.workloadLanguage]??e.workloadLanguage}`}return"Entire Cluster"}const ml=({formState:a,onChange:o,sourceOptions:l=[],namespaceOptions:r=[]})=>{const i=n(),[s,c]=Qt("all"),d=a.sourceScopes.length>0,u=ia(()=>pl.map(e=>({...e,disabled:"all"===e.value&&d})),[d]),p=na(e=>{c(e)},[]),m=na(e=>{if(!e)return;const t=function(e){const t=e.split("/");return 3!==t.length?null:{namespace:t[0],kind:t[1],name:t[2]}}(e.id);if(!t)return;const n={scopeType:"source",workloadName:t.name,workloadKind:t.kind,workloadNamespace:t.namespace,workloadLanguage:""};o({sourceScopes:[...a.sourceScopes,n]})},[a.sourceScopes,o]),g=na(e=>{if(!e)return;const t={scopeType:"namespace",workloadName:"",workloadKind:"",workloadNamespace:e.id,workloadLanguage:""};o({sourceScopes:[...a.sourceScopes,t]})},[a.sourceScopes,o]),f=na(e=>{const t={scopeType:"language",workloadName:"",workloadKind:"",workloadNamespace:"",workloadLanguage:e};o({sourceScopes:[...a.sourceScopes,t]})},[a.sourceScopes,o]),v=na(e=>{const t=a.sourceScopes.filter((t,a)=>a!==e);o({sourceScopes:t})},[a.sourceScopes,o]),y=ia(()=>{const e=new Set(a.sourceScopes.filter(e=>"source"===e.scopeType).map(e=>{return t=e.workloadNamespace,a=e.workloadKind,o=e.workloadName,`${t}/${a}/${o}`;var t,a,o}));return l.filter(t=>!e.has(t.id))},[l,a.sourceScopes]),b=ia(()=>{const e=new Set(a.sourceScopes.filter(e=>"namespace"===e.scopeType).map(e=>e.workloadNamespace));return r.filter(t=>!e.has(t.id))},[r,a.sourceScopes]),S=ia(()=>{const e=new Set(a.sourceScopes.filter(e=>"language"===e.scopeType).map(e=>e.workloadLanguage));return ul.filter(t=>!e.has(t.id))},[a.sourceScopes]),k=!d&&"all"===s;return t(Gn,{children:[t(ol,{children:[e(A,{size:C.XS,weight:500,children:xn}),e(A,{size:C.XXXS,color:i.v2.colors.grey[400],children:"Define which operations this rule applies to. You can target specific endpoints or requests, or apply the rule to all operations in the selected services."})]}),d&&e(il,{children:a.sourceScopes.map((a,o)=>t(sl,{children:[e(A,{size:C.XXXS,color:i.v2.colors.white[500],nowrap:!0,children:hl(a)}),e(cl,{onClick:()=>v(o),children:e(Pt,{size:12,fill:i.v2.colors.grey[400]})})]},o))}),e(j,{size:Ne.S,options:u,selected:s,setSelected:p}),k&&e(x,{status:T.Default,message:"Rule will apply to all sources in the cluster",fullWidth:!0}),"source"===s&&e(Me,{options:y,value:"",onSelect:m,placeholder:"Search source name"}),"namespace"===s&&e(Me,{options:b,value:"",onSelect:g,placeholder:"Search namespace"}),"language"===s&&e(nl,{children:S.map(({id:a,label:o,Icon:n})=>t(ll,{$selected:!1,onClick:()=>f(a),children:[e(h,{size:Le.S,value:!1,onChange:()=>f(a)}),e(rl,{children:e(n,{size:20})}),e(A,{size:C.XS,nowrap:!0,children:o})]},a))})]})},gl=o.div`
|
|
219
|
+
display: flex;
|
|
220
|
+
flex-direction: column;
|
|
221
|
+
gap: 4px;
|
|
222
|
+
`,fl=o.div`
|
|
223
|
+
display: flex;
|
|
224
|
+
flex-wrap: wrap;
|
|
225
|
+
align-items: flex-end;
|
|
226
|
+
gap: 16px;
|
|
227
|
+
`,vl=o.div`
|
|
228
|
+
display: flex;
|
|
229
|
+
align-items: flex-end;
|
|
230
|
+
gap: 16px;
|
|
231
|
+
padding: 12px 16px;
|
|
232
|
+
border-radius: 8px;
|
|
233
|
+
background-color: ${({theme:e})=>e.v2.colors.black[500]};
|
|
234
|
+
`,yl=o.div`
|
|
235
|
+
display: flex;
|
|
236
|
+
align-items: flex-end;
|
|
237
|
+
gap: 10px;
|
|
238
|
+
flex: 1;
|
|
239
|
+
`,bl=o.div`
|
|
240
|
+
display: flex;
|
|
241
|
+
align-items: center;
|
|
242
|
+
height: 32px;
|
|
243
|
+
`,Sl=o.div`
|
|
244
|
+
display: flex;
|
|
245
|
+
align-items: center;
|
|
246
|
+
height: 32px;
|
|
247
|
+
`,Cl=()=>e(Sl,{children:e(A,{size:C.XS,weight:500,children:"And"})}),kl=[{value:"all",label:"All operations"},{value:"httpServer",label:"HTTP server"},{value:"httpClient",label:"HTTP client"}],wl=[{value:"all",label:"All operations"},{value:"httpServer",label:"HTTP server"},{value:"kafkaConsumer",label:"Kafka consumer"},{value:"kafkaProducer",label:"Kafka producer"}],xl=[{id:"",label:"Any method"},{id:"GET",label:"GET"},{id:"POST",label:"POST"},{id:"PUT",label:"PUT"},{id:"DELETE",label:"DELETE"},{id:"PATCH",label:"PATCH"}],Tl=({category:o,formState:l,onChange:r})=>{const i=n(),s=ia(()=>"noisy"===o?kl:wl,[o]),c=na(e=>r({operationType:e,route:"",serverAddress:"",method:"",kafkaTopic:""}),[r]),d=na(e=>t=>{t&&r({routeType:e,route:""})},[r]),u=na(e=>r({route:e.target.value}),[r]),p=na(e=>r({serverAddress:e.target.value}),[r]),h=na(e=>r({method:e[0]||""}),[r]),m=na(e=>r({kafkaTopic:e.target.value}),[r]),g="httpServer"===l.operationType||"httpClient"===l.operationType,f="kafkaConsumer"===l.operationType||"kafkaProducer"===l.operationType,v="httpClient"===l.operationType?"Templated path":Rn,y="httpClient"===l.operationType?"Templated path prefix":"HTTP route prefix";return t(Gn,{children:[t(gl,{children:[e(A,{size:C.XS,weight:500,children:Tn}),e(A,{size:C.XXXS,color:i.v2.colors.grey[400],children:"Define which operations this rule applies to. You can target specific endpoints or requests, or apply the rule to all operations in the selected services."})]}),e(j,{size:Ne.S,options:s,selected:l.operationType,setSelected:c}),g&&t(fl,{children:["httpClient"===l.operationType&&t(a,{children:[e("div",{style:{flex:1},children:e(R,{label:"Server address",placeholder:"e.g. collector.my.vendor.com",value:l.serverAddress,onChange:p})}),e(Cl,{})]}),t(vl,{children:[t(yl,{children:[e(bl,{children:e(ze,{value:"route"===l.routeType,onChange:d("route")})}),e(R,{label:v,placeholder:_n,value:"route"===l.routeType?l.route:"",onChange:u,disabled:"route"!==l.routeType})]}),t(yl,{children:[e(bl,{children:e(ze,{value:"routePrefix"===l.routeType,onChange:d("routePrefix")})}),e(R,{label:y,placeholder:_n,value:"routePrefix"===l.routeType?l.route:"",onChange:u,disabled:"routePrefix"!==l.routeType})]})]}),e(Cl,{}),e(Xe,{items:xl,selectedIds:[l.method||""],setSelectedIds:e=>h(e),buttonProps:{label:xl.find(e=>e.id===l.method)?.label||"Any method",size:V.S,variant:D.Secondary}})]}),f&&e(R,{label:"Kafka topic",placeholder:"Type kafka topic",value:l.kafkaTopic,onChange:m,width:"320px"})]})},Nl=o.div`
|
|
248
|
+
display: flex;
|
|
249
|
+
gap: 12px;
|
|
250
|
+
`,Dl=o.div`
|
|
251
|
+
display: flex;
|
|
252
|
+
flex-direction: column;
|
|
253
|
+
gap: 4px;
|
|
254
|
+
`,Al=o.div`
|
|
255
|
+
display: flex;
|
|
256
|
+
align-items: flex-end;
|
|
257
|
+
gap: 16px;
|
|
258
|
+
`,Il=[{value:"5000",label:"5s"},{value:"1000",label:"1s"},{value:"500",label:"500ms"},{value:"100",label:"100ms"},{value:"50",label:"50ms"},{value:"custom",label:"Custom"}],$l=()=>{},Rl=({ruleType:a,formState:o,onChange:l})=>{const r=n(),i=na(e=>l({durationPreset:e}),[l]),s=na(e=>l({customDurationMs:e.target.value}),[l]);return"Relevance"===a?null:t(Nl,{children:["Duration"===a&&t(Wn,{children:[t(Dl,{children:[e(A,{size:C.XS,weight:500,children:Nn}),e(A,{size:C.XXXS,color:r.v2.colors.grey[400],children:"Define a duration threshold for this rule. Traces with a duration longer than the specified value will be considered important and retained."})]}),e(A,{size:C.XXXS,children:Mn}),t(Al,{children:[e(j,{size:Ne.S,options:Il,selected:o.durationPreset,setSelected:i}),"custom"===o.durationPreset&&e(R,{label:"Custom duration (ms)",placeholder:"200ms",type:E.Number,value:o.customDurationMs,onChange:s,width:160})]})]}),"Error"===a&&t(Wn,{children:[t(Dl,{children:[e(A,{size:C.XS,weight:500,children:Dn}),e(A,{size:C.XXXS,color:r.v2.colors.grey[400],children:"Retain traces with errors from the selected services and operations."})]}),e(L,{value:!0,onChange:$l,size:$e.S,label:Ln,labelAlign:F.Right})]})]})},El=o.div`
|
|
259
|
+
display: flex;
|
|
260
|
+
flex-direction: column;
|
|
261
|
+
gap: 4px;
|
|
262
|
+
`,Pl=o.div`
|
|
263
|
+
display: flex;
|
|
264
|
+
align-items: flex-end;
|
|
265
|
+
gap: 16px;
|
|
266
|
+
`,Ol=[{value:"all",label:"drop all"},{value:"sample",label:"sample"}],Ml=[{value:"all",label:"keep all"},{value:"sample",label:"sample"}],Ll=[{value:"50",label:"50%"},{value:"25",label:"25%"},{value:"10",label:"10%"},{value:"1",label:"1%"},{value:"custom",label:"Custom"}],Fl=[{value:"10",label:"10%"},{value:"1",label:"1%"},{value:"0.5",label:"0.5%"},{value:"0.1",label:"0.1%"},{value:"custom",label:"Custom"}],zl=({category:o,formState:l,onChange:r})=>{const i=n(),s="highlyRelevant"===o,c=s?Ml:Ol,d=s?Pn:On,u=s?"Specify the exact percentage of matching traces to keep":"Specify the exact percentage of matching traces to drop",p=s?Fn:zn,h="noisy"===o?Fl:Ll,m=na(e=>r({percentageMode:e}),[r]),g=na(e=>r({percentagePreset:e}),[r]),f=na(e=>r({customPercentage:e.target.value}),[r]);return t(Gn,{children:[t(El,{children:[e(A,{size:C.XS,weight:500,children:d}),e(A,{size:C.XXXS,color:i.v2.colors.grey[400],children:u})]}),"costReduction"!==o&&e(j,{size:Ne.S,options:c,selected:l.percentageMode,setSelected:m}),("costReduction"===o||"sample"===l.percentageMode)&&t(a,{children:[e(A,{size:C.XXXS,children:p}),t(Pl,{children:[e(j,{size:Ne.S,options:h,selected:l.percentagePreset,setSelected:g}),"custom"===l.percentagePreset&&e(R,{label:"Custom percentage",placeholder:"5%",type:E.Number,value:l.customPercentage,onChange:f,width:160})]})]})]})};function Xl(e){return{name:"",notes:"",disabled:!1,ruleType:"Relevance",sourceScopes:[],operationType:"all",routeType:"route",route:"",serverAddress:"",method:"",kafkaTopic:"",durationPreset:"500",customDurationMs:"",keepErrors:!1,percentageMode:"costReduction"===e?"sample":"all",percentagePreset:"noisy"===e?"10":"50",customPercentage:""}}function Vl(e){if(!e.sourceScopes.length)return null;const t=[];for(const a of e.sourceScopes)if("source"===a.scopeType&&a.workloadName){const e={workloadName:a.workloadName};a.workloadKind&&(e.workloadKind=a.workloadKind),a.workloadNamespace&&(e.workloadNamespace=a.workloadNamespace),t.push(e)}else"namespace"===a.scopeType&&a.workloadNamespace?t.push({workloadNamespace:a.workloadNamespace}):"language"===a.scopeType&&a.workloadLanguage&&t.push({workloadLanguage:a.workloadLanguage});return t.length?t:null}function _l(e){if("all"===e.percentageMode)return null;if("custom"===e.percentagePreset){const t=parseFloat(e.customPercentage);return isNaN(t)?null:t}return parseFloat(e.percentagePreset)}function Bl(e){if("custom"===e.durationPreset){const t=parseFloat(e.customDurationMs);return isNaN(t)?null:t}return parseInt(e.durationPreset,10)}function Ul(e){return"all"===e.operationType?null:"httpServer"===e.operationType?{httpServer:{[e.routeType]:e.route||null,method:e.method||null}}:"httpClient"===e.operationType?{httpClient:{serverAddress:e.serverAddress||null,["route"===e.routeType?"templatedPath":"templatedPathPrefix"]:e.route||null,method:e.method||null}}:null}function Hl(e){return"all"===e.operationType?null:"httpServer"===e.operationType?{httpServer:{[e.routeType]:e.route||null,method:e.method||null}}:"kafkaConsumer"===e.operationType?{kafkaConsumer:{kafkaTopic:e.kafkaTopic||null}}:"kafkaProducer"===e.operationType?{kafkaProducer:{kafkaTopic:e.kafkaTopic||null}}:null}function jl(e){return{name:e.name||null,disabled:e.disabled,sourceScopes:Vl(e),operation:Ul(e),percentageAtMost:_l(e),notes:e.notes||null}}function Kl(e){return{name:e.name||null,disabled:e.disabled,sourceScopes:Vl(e),error:"Error"===e.ruleType,durationAtLeastMs:"Duration"===e.ruleType?Bl(e):null,operation:Hl(e),percentageAtLeast:_l(e),notes:e.notes||null}}function Gl(e){const t=_l(e);return{name:e.name||null,disabled:e.disabled,sourceScopes:Vl(e),operation:Hl(e),percentageAtMost:t??0,notes:e.notes||null}}const Wl=o.div`
|
|
267
|
+
display: flex;
|
|
268
|
+
flex-direction: column;
|
|
269
|
+
gap: 16px;
|
|
270
|
+
padding: 28px;
|
|
271
|
+
flex: 1;
|
|
272
|
+
overflow-y: auto;
|
|
273
|
+
`,ql=o.div`
|
|
274
|
+
display: flex;
|
|
275
|
+
align-items: center;
|
|
276
|
+
gap: 8px;
|
|
277
|
+
padding: 16px 28px;
|
|
278
|
+
border-top: 1px solid ${({theme:e})=>e.v2.colors.silver[800]};
|
|
279
|
+
`,Jl=o.div`
|
|
280
|
+
flex: 1;
|
|
281
|
+
`,Yl=({isOpen:a,category:o,onClose:n,onSubmit:l,sourceOptions:r,namespaceOptions:i,validateForm:s,onNavigateToDuplicate:c})=>{const{formData:d,handleFormChange:u,resetFormData:p}=U(Xl(o)),[h,m]=Qt(null);ea(()=>{a&&(p(),m(null))},[a,o]);const g=na(e=>{m(null),u(void 0,void 0,{...d,...e})},[d,u]),f=na(()=>{if(s){const e=s(d);if(e)return void m(e)}l(d)},[d,l,s]);return t(b,{isOpen:a,width:Vn,header:{icon:Lt,title:Bn[o],subTitle:Xn[o],onClose:n},children:[t(Wl,{children:[e(Kn,{category:o,formState:d}),e(al,{category:o,formState:d,onChange:g}),e(ml,{formState:d,onChange:g,sourceOptions:r,namespaceOptions:i}),e(Tl,{category:o,formState:d,onChange:g}),"highlyRelevant"===o&&e(Rl,{ruleType:d.ruleType,formState:d,onChange:g}),e(zl,{category:o,formState:d,onChange:g})]}),t(ql,{children:[h&&e(x,{status:T.Warning,message:h.message,action:c?{label:"View rule",onClick:()=>c(h.ruleId)}:void 0}),e(Jl,{}),e(N,{label:kn,variant:D.Secondary,size:V.S,onClick:n}),e(N,{label:"Create rule",variant:D.Primary,size:V.S,onClick:f,disabled:!!h})]})]})};function Ql(e){if(!e||!e.enabled)return[{text:"Auto rule is ",variant:"default"},{text:"disabled",variant:"action"}];return[{text:`Keep ${e.keepPercentage??0}%`,variant:"action"},{text:" of ",variant:"default"},{text:"traces for kubelet health probes in the entire cluster",variant:"scope"}]}function Zl(e){return!(!0!==e.error||e.sourceScopes&&0!==e.sourceScopes.length||e.operation||null!=e.percentageAtLeast&&100!==e.percentageAtLeast)}function er(e){for(const t of e){const e=t.highlyRelevantOperations.find(Zl);if(e)return{rule:e,samplingId:t.id}}return null}function tr(e){return!e||e.disabled?[{text:"Auto rule is ",variant:"default"},{text:"disabled",variant:"action"}]:[{text:"Keep 100%",variant:"action"},{text:" of ",variant:"default"},{text:"error traces across the entire cluster",variant:"scope"}]}function ar(e){return!(e.sourceScopes&&0!==e.sourceScopes.length||e.operation)}function or(e){for(const t of e){const e=t.costReductionRules.find(ar);if(e)return{rule:e,samplingId:t.id}}return null}function nr(e){return!e||e.disabled?[{text:"Auto rule is ",variant:"default"},{text:"disabled",variant:"action"}]:[{text:`Drop ${e.percentageAtMost}%`,variant:"action"},{text:" of ",variant:"default"},{text:"traces across the entire cluster",variant:"scope"}]}const lr=o.div`
|
|
282
|
+
display: flex;
|
|
283
|
+
flex-direction: column;
|
|
284
|
+
gap: 12px;
|
|
285
|
+
padding: 12px 16px;
|
|
286
|
+
flex: 1;
|
|
287
|
+
overflow-y: auto;
|
|
288
|
+
`,rr=o.div`
|
|
289
|
+
display: flex;
|
|
290
|
+
flex-direction: column;
|
|
291
|
+
gap: 8px;
|
|
292
|
+
padding: 16px;
|
|
293
|
+
border-radius: 8px;
|
|
294
|
+
`,ir=o(p)`
|
|
295
|
+
align-items: center;
|
|
296
|
+
gap: 8px;
|
|
297
|
+
`,sr=o.div`
|
|
298
|
+
flex: 1;
|
|
299
|
+
min-width: 0;
|
|
300
|
+
padding: 8px 16px;
|
|
301
|
+
border-radius: 8px;
|
|
302
|
+
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
303
|
+
white-space: pre;
|
|
304
|
+
overflow-x: auto;
|
|
305
|
+
`,cr=o.div`
|
|
306
|
+
display: flex;
|
|
307
|
+
flex-direction: column;
|
|
308
|
+
gap: 16px;
|
|
309
|
+
padding: 16px;
|
|
310
|
+
border-radius: 16px;
|
|
311
|
+
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
312
|
+
`,dr=o.div`
|
|
313
|
+
display: flex;
|
|
314
|
+
flex-direction: column;
|
|
315
|
+
gap: 4px;
|
|
316
|
+
`,ur=o.div`
|
|
317
|
+
display: flex;
|
|
318
|
+
align-items: flex-end;
|
|
319
|
+
gap: 16px;
|
|
320
|
+
`,pr=o.div`
|
|
321
|
+
display: flex;
|
|
322
|
+
justify-content: flex-end;
|
|
323
|
+
gap: 8px;
|
|
324
|
+
padding: 16px 28px;
|
|
325
|
+
border-top: 1px solid ${({theme:e})=>e.v2.colors.silver[800]};
|
|
326
|
+
`,hr=[{value:"50",label:"50%"},{value:"25",label:"25%"},{value:"10",label:"10%"},{value:"1",label:"1%"},{value:"custom",label:"Custom"}];function mr(e){const t=String(e);return"50"===t||"25"===t||"10"===t||"1"===t?t:"custom"}const gr=({isOpen:a,enabled:o,keepPercentage:l,onClose:r,onSave:i})=>{const s=n(),[c,d]=Qt(o),[u,p]=Qt(()=>mr(l)),[h,m]=Qt(()=>"custom"===mr(l)?String(l):"");ea(()=>{if(a){d(o);const e=mr(l);p(e),m("custom"===e?String(l):"")}},[a,o,l]);const g=ia(()=>"custom"===u?Number(h)||0:Number(u),[u,h]),f=ia(()=>Ql({enabled:c,keepPercentage:g}),[c,g]),v=na(e=>p(e),[]),y=na(e=>m(e.target.value),[]),S=na(()=>{i(c,g)},[c,g,i]);return t(b,{isOpen:a,width:Vn,header:{icon:Lt,title:"Edit 'Noisy Operation' auto rule",subTitle:"Automatically detect and sample health probe traces across the cluster.",onClose:r},children:[t(lr,{children:[t(rr,{children:[e(A,{size:C.XXS,color:s.v2.colors.silver[200],children:"Auto rule - Kubernetes Health Probes"}),t(ir,{children:[e(sr,{children:e(Ho,{parts:f})}),e(L,{value:c,onChange:d,size:$e.S,label:"Rule Enabled",labelAlign:F.Right})]})]}),t(cr,{children:[t(dr,{children:[e(A,{size:C.XS,weight:500,children:"Keep Percentage"}),e(A,{size:C.XXXS,color:s.v2.colors.grey[400],children:"Specify the exact percentage of matching traces to keep"})]}),e(A,{size:C.XXXS,children:"Keep at least this percentage of matching traces"}),t(ur,{children:[e(j,{size:Ne.S,options:hr,selected:u,setSelected:v}),"custom"===u&&e(R,{label:"Custom percentage",placeholder:"5%",type:E.Number,value:h,onChange:y,width:160})]})]})]}),t(pr,{children:[e(N,{label:"Cancel",variant:D.Secondary,size:V.S,onClick:r}),e(N,{label:"Save",variant:D.Primary,size:V.S,onClick:S})]})]})},fr=o.div`
|
|
327
|
+
display: flex;
|
|
328
|
+
flex-direction: column;
|
|
329
|
+
gap: 12px;
|
|
330
|
+
padding: 12px 16px;
|
|
331
|
+
flex: 1;
|
|
332
|
+
overflow-y: auto;
|
|
333
|
+
`,vr=o.div`
|
|
334
|
+
display: flex;
|
|
335
|
+
flex-direction: column;
|
|
336
|
+
gap: 8px;
|
|
337
|
+
padding: 16px;
|
|
338
|
+
border-radius: 8px;
|
|
339
|
+
`,yr=o(p)`
|
|
340
|
+
align-items: center;
|
|
341
|
+
gap: 8px;
|
|
342
|
+
`,br=o.div`
|
|
343
|
+
flex: 1;
|
|
344
|
+
min-width: 0;
|
|
345
|
+
padding: 8px 16px;
|
|
346
|
+
border-radius: 8px;
|
|
347
|
+
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
348
|
+
white-space: pre;
|
|
349
|
+
overflow-x: auto;
|
|
350
|
+
`,Sr=o.div`
|
|
351
|
+
display: flex;
|
|
352
|
+
justify-content: flex-end;
|
|
353
|
+
gap: 8px;
|
|
354
|
+
padding: 16px 28px;
|
|
355
|
+
border-top: 1px solid ${({theme:e})=>e.v2.colors.silver[800]};
|
|
356
|
+
`,Cr=({isOpen:a,enabled:o,onClose:l,onSave:r})=>{const i=n(),[s,c]=Qt(o);ea(()=>{a&&c(o)},[a,o]);const d=ia(()=>tr(s?{disabled:!1}:null),[s]),u=na(()=>{r(s)},[s,r]);return t(b,{isOpen:a,width:Vn,header:{icon:Lt,title:"Edit 'Highly Relevant' auto rule",subTitle:"Automatically keep all error traces across the entire cluster.",onClose:l},children:[e(fr,{children:t(vr,{children:[e(A,{size:C.XXS,color:i.v2.colors.silver[200],children:"Auto rule - Keep All Error Traces"}),t(yr,{children:[e(br,{children:e(Ho,{parts:d})}),e(L,{value:s,onChange:c,size:$e.S,label:"Rule Enabled",labelAlign:F.Right})]})]})}),t(Sr,{children:[e(N,{label:"Cancel",variant:D.Secondary,size:V.S,onClick:l}),e(N,{label:"Save",variant:D.Primary,size:V.S,onClick:u})]})]})},kr=o.div`
|
|
357
|
+
display: flex;
|
|
358
|
+
flex-direction: column;
|
|
359
|
+
gap: 12px;
|
|
360
|
+
padding: 12px 16px;
|
|
361
|
+
flex: 1;
|
|
362
|
+
overflow-y: auto;
|
|
363
|
+
`,wr=o.div`
|
|
364
|
+
display: flex;
|
|
365
|
+
flex-direction: column;
|
|
366
|
+
gap: 8px;
|
|
367
|
+
padding: 16px;
|
|
368
|
+
border-radius: 8px;
|
|
369
|
+
`,xr=o(p)`
|
|
370
|
+
align-items: center;
|
|
371
|
+
gap: 8px;
|
|
372
|
+
`,Tr=o.div`
|
|
373
|
+
flex: 1;
|
|
374
|
+
min-width: 0;
|
|
375
|
+
padding: 8px 16px;
|
|
376
|
+
border-radius: 8px;
|
|
377
|
+
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
378
|
+
white-space: pre;
|
|
379
|
+
overflow-x: auto;
|
|
380
|
+
`,Nr=o.div`
|
|
381
|
+
display: flex;
|
|
382
|
+
flex-direction: column;
|
|
383
|
+
gap: 16px;
|
|
384
|
+
padding: 16px;
|
|
385
|
+
border-radius: 16px;
|
|
386
|
+
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
387
|
+
`,Dr=o.div`
|
|
388
|
+
display: flex;
|
|
389
|
+
flex-direction: column;
|
|
390
|
+
gap: 4px;
|
|
391
|
+
`,Ar=o.div`
|
|
392
|
+
display: flex;
|
|
393
|
+
align-items: flex-end;
|
|
394
|
+
gap: 16px;
|
|
395
|
+
`,Ir=o.div`
|
|
396
|
+
display: flex;
|
|
397
|
+
justify-content: flex-end;
|
|
398
|
+
gap: 8px;
|
|
399
|
+
padding: 16px 28px;
|
|
400
|
+
border-top: 1px solid ${({theme:e})=>e.v2.colors.silver[800]};
|
|
401
|
+
`,$r=[{value:"50",label:"50%"},{value:"25",label:"25%"},{value:"10",label:"10%"},{value:"1",label:"1%"},{value:"custom",label:"Custom"}];function Rr(e){const t=String(e);return"50"===t||"25"===t||"10"===t||"1"===t?t:"custom"}const Er=({isOpen:a,enabled:o,dropPercentage:l,onClose:r,onSave:i})=>{const s=n(),[c,d]=Qt(o),[u,p]=Qt(()=>Rr(l)),[h,m]=Qt(()=>"custom"===Rr(l)?String(l):"");ea(()=>{if(a){d(o);const e=Rr(l);p(e),m("custom"===e?String(l):"")}},[a,o,l]);const g=ia(()=>"custom"===u?Number(h)||0:Number(u),[u,h]),f=ia(()=>nr(c?{disabled:!1,percentageAtMost:g}:null),[c,g]),v=na(e=>p(e),[]),y=na(e=>m(e.target.value),[]),S=na(()=>{i(c,g)},[c,g,i]);return t(b,{isOpen:a,width:Vn,header:{icon:Lt,title:"Edit 'Cost Reduction' auto rule",subTitle:"Automatically drop a percentage of traces across the entire cluster.",onClose:r},children:[t(kr,{children:[t(wr,{children:[e(A,{size:C.XXS,color:s.v2.colors.silver[200],children:"Auto rule - Drop Traces Cluster-Wide"}),t(xr,{children:[e(Tr,{children:e(Ho,{parts:f})}),e(L,{value:c,onChange:d,size:$e.S,label:"Rule Enabled",labelAlign:F.Right})]})]}),t(Nr,{children:[t(Dr,{children:[e(A,{size:C.XS,weight:500,children:"Drop Percentage"}),e(A,{size:C.XXXS,color:s.v2.colors.grey[400],children:"Specify the exact percentage of matching traces to drop"})]}),e(A,{size:C.XXXS,children:"Drop at most this percentage of matching traces"}),t(Ar,{children:[e(j,{size:Ne.S,options:$r,selected:u,setSelected:v}),"custom"===u&&e(R,{label:"Custom percentage",placeholder:"5%",type:E.Number,value:h,onChange:y,width:160})]})]})]}),t(Ir,{children:[e(N,{label:"Cancel",variant:D.Secondary,size:V.S,onClick:r}),e(N,{label:"Save",variant:D.Primary,size:V.S,onClick:S})]})]})},Pr=({onClose:a,connections:o,selectedConnectionIds:l,setSelectedConnectionIds:r,getEffectiveConfig:i,onApply:s})=>{const c=n(),[d,u]=Qt(""),[h,m]=Qt({showOnlySelected:!1}),g=ia(()=>o.filter(e=>{const t=!d||e.name.toLowerCase().includes(d.toLowerCase()),a=!h.showOnlySelected||h.showOnlySelected&&l.includes(e.id);return t&&a}),[o.length,l.length,d,h]),f=e=>{r(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[v,y]=Qt(!1),[b,S]=Qt(void 0),{formData:k,handleFormChange:w,areFormValuesEqual:x,resetFormData:T}=U(b||{rollout:{automaticRolloutDisabled:!1}}),N=ia(()=>l.length>1||void 0!==b&&!x(b,k),[l.length,b,k]);return ea(()=>{1===l.length?(async e=>{if(v)return;y(!0);const t=await i(e);if(t){const e={rollout:{automaticRolloutDisabled:t.rollout?.automaticRolloutDisabled??!1}};S(e),T(e)}y(!1)})(l[0]):S(void 0)},[l.length]),e(Da,{isOpen:!0,onClose:a,onSave:()=>s(k,l),header:{icon:Ft,title:"Cluster Configuration"},connectionIds:{value:l,setValue:r},search:{placeholder:"Search by cluster name",value:d,onChange:u},filters:t(p,{$gap:8,children:[e(A,{size:C.XXXS,color:c.v2.colors.silver[200],nowrap:!0,children:"Show only:"}),e(L,{size:$e.S,label:"Selected",value:h.showOnlySelected,onChange:e=>m(t=>({...t,showOnlySelected:e}))})]}),isFormDirty:N,isFetching:v,leftColumn:{width:"35%",header:t(p,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[t(p,{$gap:8,children:[e(A,{size:C.XS,children:"Clusters"}),e(ce,{label:g.length,status:Ie.Unknown})]}),t(p,{$gap:8,children:[e(A,{size:C.XXXS,color:c.v2.colors.silver[200],align:"right",children:"Selected clusters"}),e(ce,{label:`${l.length}/${g.length}`,status:Ie.Unknown})]})]}),list:g.map(t=>e($a,{title:t.name,isChecked:l.includes(t.id),onClick:()=>f(t.id),onCheckboxChange:()=>f(t.id)},t.id))},rightColumn:{width:"65%",header:e(A,{size:C.XS,children:"Configurations"}),list:[e(L,{label:"Automatic rollout disabled",tooltip:"Odigos automatically triggers a one-time rollout for workloads when instrumenting or uninstrumenting, ensuring that changes are applied without requiring manual intervention. When automatic rollout is disabled, Odigos will not restart workloads, and users will need to manually trigger rollouts after adding or removing sources.",value:k.rollout?.automaticRolloutDisabled||!1,onChange:e=>w("rollout.automaticRolloutDisabled",e)},"automatic-rollout-disabled")]}})},Or=({token:o,isLoading:n,isEditing:l,onEdit:r,onCancel:i,onSave:s,formData:c,handleFormChange:d,handleErrorChange:u,formErrors:h})=>{const{CopyButton:m}=Ve(),g=!l||n||!c.newToken;return _e({key:"Enter",active:!g},s),t(p,l?{$justifyContent:"space-between",$alignItems:"flex-start",$gap:12,children:[e(R,{type:"password",value:c.newToken,onChange:e=>{d("newToken",e.target.value),u("newToken",void 0)},width:"430px",autoFocus:!0,errorMessage:h.newToken}),e(p,{$margin:n?"8px 0 0 0":"2px 0 0 0",$alignItems:"center",children:n?e(S,{title:"Saving...",withGradient:!0}):t(a,{children:[e(N,{variant:D.Secondary,size:V.S,leftIcon:Pt,onClick:i,disabled:n}),e(N,{variant:D.Primary,size:V.S,leftIcon:Et,onClick:s,disabled:g})]})})]}:{$justifyContent:"space-between",$gap:12,children:[e(A,{size:C.XS,children:new Array(55).fill("•").join("")}),t(p,{$alignItems:"center",$justifyContent:"space-between",children:[e(m,{value:o}),e(Ce,{icon:Tt,onClick:r})]})]})},Mr=({expiresAt:t,callbackValid:a,callbackExpired:o})=>{const{formatTimeAgo:n}=Be(),l=ia(()=>n(t),[t]),r=ia(()=>new Date(t).toDateString().split(" ").slice(1).join(" "),[t]),i=ia(()=>Ue(t,0)?T.Error:Ue(t,2592e6)?T.Warning:T.Success,[t]),s=ia(()=>i===T.Success?Et:i===T.Warning?zt:Xt,[i]);return ea(()=>{i===T.Success?a():i===T.Error&&o()},[i]),e(ae,{text:r,children:e(ce,{leftIcon:s,label:l,status:i,invertColors:!0,useSecondaryTone:!0})})},Lr=o.div`
|
|
121
402
|
display: flex;
|
|
122
403
|
flex-direction: column;
|
|
123
404
|
gap: 12px;
|
|
@@ -125,7 +406,7 @@ import{jsx as e,jsxs as t,Fragment as a}from"react/jsx-runtime";import{useState
|
|
|
125
406
|
border-radius: 12px;
|
|
126
407
|
border: 1px solid ${({theme:e,$isExpired:t})=>t?e.v2.colors.red[500]:e.v2.colors.silver[600]};
|
|
127
408
|
background-color: ${({theme:e,$isExpired:t})=>t?e.v2.colors.red[1e3]:e.v2.colors.silver[800]};
|
|
128
|
-
`,
|
|
409
|
+
`,Fr=({children:t})=>{const a=n();return e(A,{size:C.XXXS,color:a.v2.colors.grey[150],children:t})},zr=({token:a,updateToken:o})=>{const[n,l]=Qt(!1),[r,i]=Qt(!1),[s,c]=Qt(!1),{formData:u,handleFormChange:h,formErrors:m,handleErrorChange:g,resetFormData:f}=U({newToken:""});return e(He,{richTitle:{icon:Vt,title:"Odigos Pro Token"},children:t(Lr,{$isExpired:s,children:[t(p,{$justifyContent:"space-between",children:[t(d,{$gap:4,children:[e(Fr,{children:"Issued for"}),e(A,{size:C.XS,children:a.name||"N/A"})]}),t(d,{$gap:4,children:[e(Fr,{children:"Expiration"}),e(Mr,{expiresAt:a.expiresAt,callbackValid:()=>c(!1),callbackExpired:()=>c(!0)})]}),e(d,{})]}),e(p,{children:t(d,{children:[e(Fr,{children:"Token"}),e(Or,{token:a.token,newToken:u.newToken,isLoading:r,isEditing:n,onEdit:()=>l(!0),onCancel:()=>(l(!1),i(!1),void h("newToken","")),onSave:()=>(async()=>{i(!0);const e=await o(u.newToken.trim());i(!1),e?.error?g("newToken",e.error):(l(!1),f())})(),formData:u,handleFormChange:h,handleErrorChange:g,formErrors:m})]})})]})})},Xr=o.div`
|
|
129
410
|
display: flex;
|
|
130
411
|
flex-direction: column;
|
|
131
412
|
align-items: center;
|
|
@@ -134,7 +415,81 @@ import{jsx as e,jsxs as t,Fragment as a}from"react/jsx-runtime";import{useState
|
|
|
134
415
|
padding: 12px 24px;
|
|
135
416
|
border-radius: 8px;
|
|
136
417
|
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
137
|
-
`,Xn=({downloadDiagnose:a})=>{const l=g(),{progress:o}=Xe(),{namespaces:i}=Ye(),[s,r]=n(null),{formData:c,handleFormChange:d,resetFormData:u}=ee({includeProfiles:!0,includeMetrics:!0,includeSourceWorkloads:!1,sourceWorkloadNamespaces:[]});return e(Ke,{richTitle:{icon:Ht,title:"Diagnose"},children:s?t(zn,{children:[e(E,{title:"Creating file...",subTitle:"This may take a few moments. Do not refresh the page.",withGradient:!0,withSpinner:"number"==typeof o[je.DownloadingDiagnose]?.percentage,percentage:o[je.DownloadingDiagnose]?.percentage,withVisual:"number"!=typeof o[je.DownloadingDiagnose]?.percentage,visualIcon:Wt,startedAt:s}),o[je.DownloadingDiagnose]?.list?.length&&e(S,{$width:"100%",children:o[je.DownloadingDiagnose].list.map(a=>t(w,{$gap:4,$alignItems:"center",children:[a.status===L.Success?e(Vt,{size:16}):a.status===L.Error?e(_t,{size:16}):e(E,{withSpinnerOld:!0,scaleSpinnerOld:.7}),e(_,{size:R.XXXS,color:l.v2.colors.silver[200],children:a.label})]},a.label))})]}):t(S,{$gap:24,children:[e(_,{size:R.XXS,color:l.v2.colors.silver[200],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."}),t(S,{$gap:16,children:[t(w,{$gap:8,children:[e(D,{label:"Profiles",value:c.includeProfiles,onChange:e=>d("includeProfiles",e),tooltip:"Note: Adds 30s to diagnose download time to collect Profiles"}),e(_,{size:R.XXXS,color:l.v2.colors.silver[200],children:"Include pprof profiles"})]}),t(w,{$gap:8,children:[e(D,{label:"Metrics",value:c.includeMetrics,onChange:e=>d("includeMetrics",e)}),e(_,{size:R.XXXS,color:l.v2.colors.silver[200],children:"Include Prometheus metrics"})]}),t(w,{$gap:8,children:[e(D,{label:"Source Workloads",value:c.includeSourceWorkloads,onChange:e=>{d("includeSourceWorkloads",e),e&&d("sourceWorkloadNamespaces",[])}}),e(_,{size:R.XXXS,color:l.v2.colors.silver[200],children:"Include workload and pod manifests for instrumented sources"})]})]}),e(Je,{alignX:Ze.Left,alignY:Qe.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:V.Secondary,disabled:c.includeSourceWorkloads,leftIcon:c.sourceWorkloadNamespaces.length?()=>e(Ce,{label:c.sourceWorkloadNamespaces.length,status:L.Default}):void 0}}),e(w,{$justifyContent:"flex-end",children:e(P,{label:"Download Diagnose",rightIcon:Wt,variant:V.Primary,onClick:async()=>{r(Date.now()),await a(c),r(null),u()},disabled:null!==s})})]})})},jn=({fetchDescribeOdigos:t})=>{const{platformType:a,version:l,tier:i}=f(),[s,r]=n(null);return o(()=>{t().then(({data:e})=>r(e?.describeOdigos||null))},[]),e(Ke,{richTitle:{icon:qt,title:"General Information"},children:e(et,{cellsPerRow:2,items:[{id:tt(),title:"Odigos Version",label:l},{id:tt(),title:`${a.toUpperCase()} Version`,label:s?.kubernetesVersion?.value||"-"},{id:tt(),title:"Installation Method",label:s?.installationMethod?.value||"-"},{id:tt(),title:"Tier",label:i}]})})},Gn=({isOpen:a,onClose:n,token:l,updateToken:o,fetchDescribeOdigos:i,downloadDiagnose:s})=>t($,{isOpen:a,header:{icon:qt,title:"System Overview",onClose:n},children:[i&&e(jn,{fetchDescribeOdigos:i}),o&&l&&e(Un,{token:l,updateToken:o}),s&&e(Xn,{downloadDiagnose:s})]});var Hn,Wn;!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"}(Hn||(Hn={})),function(e){e.Id="id",e.Name="name",e.Type="type",e.Status="status",e.OdigosVersion="odigosVersion",e.ConnectedSince="connectedSince",e.LastActivity="lastActivity"}(Wn||(Wn={}));const qn=[{key:Wn.Name,label:"Name"},{key:Wn.Type,label:"Type",textAlign:"right"},{key:Wn.Status,label:"Status"},{key:Wn.OdigosVersion,label:"Odigos Version"},{key:Wn.ConnectedSince,label:"Connected Since"},{key:Wn.LastActivity,label:"Last Activity"}],Kn=(e,t)=>{const a=e.find(e=>e.key===Wn.Id)?.rawValue;return t(a?.toString()||"")},Yn=e=>{const{connections:t,configMinSupportedVersion:a,snapshotMinSupportedVersion:n,onDelete:l,onAddSource:o,onAddDestination:i,onAddAction:s,onAddInstrumentationRule:r,onEditConfiguration:c}=e;return({cells:e})=>{if(!(e=>e.find(e=>e.key===Wn.Status)?.rawValue===L.Success)(e))return[{id:tt(),label:"Delete Connection",rightIcon:$t,onClick:()=>Kn(e,l)}];const d=Kn(e,e=>{const n=t.find(t=>t.id===e);return!!n&&at(n.odigosVersion,a)}),u=Kn(e,e=>{const a=t.find(t=>t.id===e);return!!a&&at(a.odigosVersion,n)}),p=[];return o&&p.push({id:tt(),tooltip:u?Ee.ADD_SOURCE:`To use this feature, please upgrade to Odigos v${n} or later.`,rightIcon:Ut,disabled:!u,onClick:()=>Kn(e,o)}),i&&p.push({id:tt(),tooltip:Ee.ADD_DESTINATION,rightIcon:Mt,onClick:()=>Kn(e,i)}),s&&p.push({id:tt(),tooltip:Ee.ADD_ACTION,rightIcon:Ft,onClick:()=>Kn(e,s)}),r&&p.push({id:tt(),tooltip:Ee.ADD_INSTRUMENTATION_RULE,rightIcon:Bt,onClick:()=>Kn(e,r)}),c&&p.push({id:tt(),tooltip:d?"Edit Configuration":`To use this feature, please upgrade to Odigos v${a} or later.`,rightIcon:zt,disabled:!d,onClick:()=>Kn(e,c)}),p}},Jn=({tableRowsMaxHeight:a,connections:l,getConnections:i,onClickConnection:s,deleteConnection:r,configMinSupportedVersion:d=0,getEffectiveConfig:u,applyConfigurations:m,snapshotMinSupportedVersion:h=0,getAllClusterSnapshots:b,persistSources:v,getDestinationCategories:y,getPotentialDestinations:C,testConnection:S,createDestination:k,createAction:w,createInstrumentationRule:D})=>{const I=g(),{isVm:N}=f(),{formatTimeAgo:T}=We(),[A,x]=n(!1),[$,E]=n(l||[]),R=c(async()=>{try{x(!0),E(await i()??[])}catch(e){}finally{x(!1)}},[]);o(()=>{$.length||R()},[]);const[O,F]=n(""),[M,P]=n(null),[_,B]=n([]),U=p(()=>M===Hn.BulkConfig?d:M===Hn.BulkSource?h:0,[M,d,h]),{supportedConnections:z,supportedConnectionIds:X}=p(()=>{const e=((e,t)=>e.filter(e=>{const a=e.status===L.Success,n=at(e.odigosVersion,t);return a&&n}))($,U);return{supportedConnections:e,supportedConnectionIds:e.map(e=>e.id)}},[$.length,U]);o(()=>{if(!M||M===Hn.Delete)return;const e=_.filter(e=>!X.includes(e));e.length&&B(t=>t.filter(t=>!e.includes(t)))},[M,_.length,X.length]);const j=p(()=>$.filter(e=>!O||e.name.toLowerCase().includes(O.toLowerCase())).map(t=>({cells:[{key:Wn.Id,rawValue:t.id},{key:Wn.Name,rawValue:t.name},{key:Wn.Type,rawValue:t.type},{key:Wn.Status,rawValue:t.status,component:()=>(t=>{const a=t===L.Success?"Connection live":"Connection lost",n=t===L.Success?Vt:_t;return e(Ce,{status:t,label:a,leftIcon:n})})(t.status)},{key:Wn.OdigosVersion,rawValue:t.odigosVersion},{key:Wn.ConnectedSince,rawValue:t.connectedAt?T(t.connectedAt):"-"},{key:Wn.LastActivity,rawValue:t.lastSeenAt?T(t.lastSeenAt):"-"}],onClick:t.status!==L.Success||M?void 0:()=>s(t),isSelected:_.includes(t.id),onSelect:()=>B(e=>Array.from(new Set([...e,t.id]))),onDeselect:()=>B(e=>e.filter(e=>e!==t.id)),hideCheckbox:t.status!==L.Success||M===Hn.BulkConfig&&!at(t.odigosVersion,d)||M===Hn.BulkSource&&!at(t.odigosVersion,h)})),[$,_,O,M,d,h]),G=p(()=>{const e=(e,t)=>{B([e]),P(t)};return Yn({connections:$,configMinSupportedVersion:d,snapshotMinSupportedVersion:h,onDelete:t=>e(t,Hn.Delete),onAddSource:!N&&b&&v?t=>e(t,Hn.BulkSource):void 0,onAddDestination:!N&&y&&C&&k?t=>e(t,Hn.BulkDestination):void 0,onAddAction:!N&&w?t=>e(t,Hn.BulkAction):void 0,onAddInstrumentationRule:!N&&D?t=>e(t,Hn.BulkInstrumentationRule):void 0,onEditConfiguration:!N&&u&&m?t=>e(t,Hn.BulkConfig):void 0})},[N,$,d,u,m,h,b,v,y,C,k,w,D]),H=p(()=>(e=>{const{onCancel:t,onAddSource:a,onAddDestination:n,onAddAction:l,onAddInstrumentationRule:o,onManageConfigurations:i}=e,s=[];a&&s.push({id:tt(),type:nt.Button,buttonProps:{variant:V.Primary,size:J.S,label:"Add Sources",rightIcon:Ut,onClick:a}});const r=[n?{id:Hn.BulkDestination,label:Ee.ADD_DESTINATION,icon:Mt}:null,l?{id:Hn.BulkAction,label:Ee.ADD_ACTION,icon:Ft}:null,o?{id:Hn.BulkInstrumentationRule,label:Ee.ADD_INSTRUMENTATION_RULE,icon:Bt}:null,i?{id:Hn.BulkConfig,label:"Manage Configurations",icon:zt}:null];return r.some(Boolean)&&s.push({id:tt(),type:nt.ButtonDropData,buttonProps:{variant:V.Secondary,size:J.S,label:"Bulk Operations",onClick:e=>{e===Hn.BulkSource?a?.():e===Hn.BulkDestination?n?.():e===Hn.BulkAction?l?.():e===Hn.BulkInstrumentationRule?o?.():e===Hn.BulkConfig&&i?.()}},dropDataProps:{alignX:Ze.Left,items:r}}),s.push({id:tt(),type:nt.Button,buttonProps:{variant:V.Text,size:J.S,label:lt.CANCEL,onClick:t}}),s})({onCancel:()=>B([]),onAddSource:!N&&b&&v?()=>P(Hn.BulkSource):void 0,onAddDestination:!N&&y&&C&&k?()=>P(Hn.BulkDestination):void 0,onAddAction:!N&&w?()=>P(Hn.BulkAction):void 0,onAddInstrumentationRule:!N&&D?()=>P(Hn.BulkInstrumentationRule):void 0,onManageConfigurations:!N&&u&&m?()=>P(Hn.BulkConfig):void 0}),[N,u,m,b,v,y,C,k,w,D]);return e(ot,{children:t(Ke,{richTitle:{icon:Yt,title:Ee.CONNECTIONS,badge:{label:$.length.toString(),status:_e.Unknown}},search:{placeholder:"Search by cluster name",value:O,onChange:e=>F(e),width:"300px"},actions:[{id:tt(),type:nt.Button,buttonProps:{variant:V.Secondary,size:J.S,leftIcon:Kt,onClick:R,disabled:A}}],children:[e(it,{variant:st.Pretty,maxHeight:a,headerBackgroundColor:I.v2.colors.silver[1e3],isLoading:A,withCheckboxes:!0,columns:qn,rows:j,rowActionsPushRightPosition:M?`calc(${ha} - 24px)`:void 0,getRowActions:G}),M===Hn.BulkConfig&&u&&m&&e(Ln,{onClose:()=>P(null),connections:z,selectedConnectionIds:_,setSelectedConnectionIds:B,getEffectiveConfig:u,onApply:m}),M===Hn.BulkSource&&b&&v&&e(dn,{selectedConnectionIds:_,getAllClusterSnapshots:b,children:e(Mn,{onClose:()=>P(null),selectedConnectionIds:_,setSelectedConnectionIds:B,persistSources:async e=>await(v?.(e))})}),M===Hn.BulkDestination&&y&&C&&S&&k&&e(Ha,{children:e(Dn,{onClose:()=>P(null),selectedConnectionIds:_,setSelectedConnectionIds:B,getDestinationCategories:y,getPotentialDestinations:C,testConnection:e=>S(e,_),createDestination:e=>k(e,_)})}),M===Hn.BulkAction&&w&&e(_a,{children:e(mn,{onClose:()=>P(null),selectedConnectionIds:_,setSelectedConnectionIds:B,createAction:e=>w(e,_)})}),M===Hn.BulkInstrumentationRule&&D&&e(on,{children:e(In,{onClose:()=>P(null),selectedConnectionIds:_,setSelectedConnectionIds:B,createInstrumentationRule:e=>D(e,_)})}),e(oa,{target:"connection",isOpen:M===Hn.Delete,onClose:()=>{B([]),P(null)},onApprove:async()=>{const e=_[0];e&&(await r(e),await R())}}),e(rt,{isOpen:!!_.length&&!M,richTitle:{icon:St,title:"Selected Clusters",badge:{label:_.length}},actions:H})]})})},Qn=h.div`
|
|
418
|
+
`,Vr=({downloadDiagnose:a})=>{const o=n(),{progress:l}=Pe(),{namespaces:r}=De(),[i,s]=Qt(null),{formData:c,handleFormChange:u,resetFormData:m}=U({includeProfiles:!0,includeMetrics:!0,includeSourceWorkloads:!1,sourceWorkloadNamespaces:[]});return e(He,{richTitle:{icon:_t,title:"Diagnose"},children:i?t(Xr,{children:[e(S,{title:"Creating file...",subTitle:"This may take a few moments. Do not refresh the page.",withGradient:!0,withSpinner:"number"==typeof l[Oe.DownloadingDiagnose]?.percentage,percentage:l[Oe.DownloadingDiagnose]?.percentage,withVisual:"number"!=typeof l[Oe.DownloadingDiagnose]?.percentage,visualIcon:Bt,startedAt:i}),l[Oe.DownloadingDiagnose]?.list?.length&&e(d,{$width:"100%",children:l[Oe.DownloadingDiagnose].list.map(a=>t(p,{$gap:4,$alignItems:"center",children:[a.status===T.Success?e(Et,{size:16}):a.status===T.Error?e(Pt,{size:16}):e(S,{withSpinnerOld:!0,scaleSpinnerOld:.7}),e(A,{size:C.XXXS,color:o.v2.colors.silver[200],children:a.label})]},a.label))})]}):t(d,{$gap:24,children:[e(A,{size:C.XXS,color:o.v2.colors.silver[200],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."}),t(d,{$gap:16,children:[t(p,{$gap:8,children:[e(h,{label:"Profiles",value:c.includeProfiles,onChange:e=>u("includeProfiles",e),tooltip:"Note: Adds 30s to diagnose download time to collect Profiles"}),e(A,{size:C.XXXS,color:o.v2.colors.silver[200],children:"Include pprof profiles"})]}),t(p,{$gap:8,children:[e(h,{label:"Metrics",value:c.includeMetrics,onChange:e=>u("includeMetrics",e)}),e(A,{size:C.XXXS,color:o.v2.colors.silver[200],children:"Include Prometheus metrics"})]}),t(p,{$gap:8,children:[e(h,{label:"Source Workloads",value:c.includeSourceWorkloads,onChange:e=>{u("includeSourceWorkloads",e),e&&u("sourceWorkloadNamespaces",[])}}),e(A,{size:C.XXXS,color:o.v2.colors.silver[200],children:"Include workload and pod manifests for instrumented sources"})]})]}),e(Xe,{alignX:Ke.Left,alignY:je.Bottom,items:r.map(e=>({id:e.name,label:e.name,withCheckbox:!0})),selectedIds:c.sourceWorkloadNamespaces,setSelectedIds:e=>u("sourceWorkloadNamespaces",e),withMultiSelect:!0,withSearch:!0,fullWidth:!0,buttonProps:{label:(c.sourceWorkloadNamespaces.length?"Selected":"Select")+" Namespaces",variant:D.Secondary,disabled:c.includeSourceWorkloads,leftIcon:c.sourceWorkloadNamespaces.length?()=>e(ce,{label:c.sourceWorkloadNamespaces.length,status:T.Default}):void 0}}),e(p,{$justifyContent:"flex-end",children:e(N,{label:"Download Diagnose",rightIcon:Bt,variant:D.Primary,onClick:async()=>{s(Date.now()),await a(c),s(null),m()},disabled:null!==i})})]})})},_r=({fetchDescribeOdigos:t})=>{const{platformType:a,version:o,tier:n}=r(),[l,i]=Qt(null);return ea(()=>{t().then(({data:e})=>i(e?.describeOdigos||null))},[]),e(He,{richTitle:{icon:Ut,title:"General Information"},children:e(Ge,{cellsPerRow:2,items:[{id:We(),title:"Odigos Version",label:o},{id:We(),title:`${a.toUpperCase()} Version`,label:l?.kubernetesVersion?.value||"-"},{id:We(),title:"Installation Method",label:l?.installationMethod?.value||"-"},{id:We(),title:"Tier",label:n}]})})},Br=({isOpen:a,onClose:o,token:n,updateToken:l,fetchDescribeOdigos:r,downloadDiagnose:i})=>t(b,{isOpen:a,header:{icon:Ut,title:"System Overview",onClose:o},children:[r&&e(_r,{fetchDescribeOdigos:r}),l&&n&&e(zr,{token:n,updateToken:l}),i&&e(Vr,{downloadDiagnose:i})]}),Ur="-",Hr="Operation type",jr="Sample",Kr="Delete rule",Gr={noisy:"Edit 'Noisy Operations' sampling rule",highlyRelevant:"Edit 'Highly Relevant Operations' sampling rule",costReduction:"Edit 'Cost Reduction' sampling rule"},Wr="All operations",qr="HTTP server endpoint",Jr={noisy:"Noisy Operation",highlyRelevant:"Highly Relevant",costReduction:"Cost Reduction"},Yr=o.div`
|
|
419
|
+
display: flex;
|
|
420
|
+
flex-direction: column;
|
|
421
|
+
gap: 8px;
|
|
422
|
+
border-radius: 8px;
|
|
423
|
+
`,Qr=o.div`
|
|
424
|
+
min-width: 0;
|
|
425
|
+
padding: 8px 16px;
|
|
426
|
+
border-radius: 8px;
|
|
427
|
+
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
428
|
+
white-space: pre;
|
|
429
|
+
overflow-x: auto;
|
|
430
|
+
`,Zr=({summary:a})=>{const o=n();return t(Yr,{children:[e(A,{size:C.XXS,color:o.v2.colors.silver[200],children:wn}),e(Qr,{children:e(Ho,{parts:a})})]})};function ei(e){return"highlyRelevant"===e.category?e.rule.error?"Error":null!=e.rule.durationAtLeastMs?"Duration":"Relevance":Jr[e.category]}const ti=({data:a})=>{const o=n(),l=ia(()=>[{id:"name",title:An,value:a.rule.name||Sn},{id:"type",title:In,value:ei(a)}],[a]),r=a.rule.notes||Ur;return t(Gn,{children:[e(qn,{children:l.map(({id:a,title:n,value:l})=>t(Jn,{children:[e(A,{size:C.XXXS,color:o.v2.colors.silver[200],nowrap:!0,children:n}),e(A,{size:C.XS,nowrap:!0,children:l})]},a))}),t(Jn,{children:[e(A,{size:C.XXXS,color:o.v2.colors.silver[200],children:$n}),e(A,{size:C.XS,children:r})]})]})},ai=o.div`
|
|
431
|
+
display: flex;
|
|
432
|
+
flex-direction: column;
|
|
433
|
+
gap: 4px;
|
|
434
|
+
`,oi=o.div`
|
|
435
|
+
display: flex;
|
|
436
|
+
align-items: center;
|
|
437
|
+
gap: 8px;
|
|
438
|
+
padding: 8px 12px;
|
|
439
|
+
border-radius: 8px;
|
|
440
|
+
background-color: ${({theme:e})=>e.v2.colors.silver[700]};
|
|
441
|
+
`,ni=o.div`
|
|
442
|
+
display: flex;
|
|
443
|
+
width: 24px;
|
|
444
|
+
height: 24px;
|
|
445
|
+
justify-content: center;
|
|
446
|
+
align-items: center;
|
|
447
|
+
flex-shrink: 0;
|
|
448
|
+
`,li={[Fe.JavaScript]:"Node.js",[Fe.DotNet]:".NET",[Fe.Php]:"PHP",[Fe.Java]:"Java",[Fe.Go]:"Go",[Fe.Python]:"Python",[Fe.Ruby]:"Ruby",[Fe.Rust]:"Rust"};function ri(e){const t=li[e];return t||e.charAt(0).toUpperCase()+e.slice(1)}const ii=({scopes:a})=>{const o=n();return t(Gn,{children:[e(A,{size:C.XS,weight:500,children:xn}),a.length?e(ai,{children:a.map((a,n)=>function(a,o,n){if(a.workloadLanguage){const l=ue(a.workloadLanguage);return t(oi,{children:[l&&e(ni,{children:e(l,{size:18})}),e(A,{size:C.XS,color:n.v2.colors.white[500],children:ri(a.workloadLanguage)})]},o)}const l=[a.workloadNamespace,a.workloadKind,a.workloadName].filter(Boolean),r=l.length?l.join(" / "):"Unknown scope";return e(oi,{children:e(A,{size:C.XS,color:n.v2.colors.white[500],children:r})},o)}(a,n,o))}):e(x,{status:T.Default,message:"Rule will apply to all sources in the cluster",fullWidth:!0})]})},si="Kafka topic",ci="Any method";const di=({data:a})=>{const o=n(),l=ia(()=>function(e){if("noisy"===e.category){const t=e.rule.operation;if(t?.httpServer)return[{id:"type",title:Hr,value:qr},{id:"route",title:Rn,value:t.httpServer.route||t.httpServer.routePrefix||Ur},{id:"method",title:En,value:t.httpServer.method||ci}];if(t?.httpClient){const e=[{id:"type",title:Hr,value:"HTTP client endpoint"}];return t.httpClient.serverAddress&&e.push({id:"serverAddress",title:"Server address",value:t.httpClient.serverAddress}),e.push({id:"route",title:Rn,value:t.httpClient.templatedPath||t.httpClient.templatedPathPrefix||Ur}),e.push({id:"method",title:En,value:t.httpClient.method||ci}),e}return[{id:"type",title:Hr,value:Wr}]}const t=e.rule.operation;return t?.httpServer?[{id:"type",title:Hr,value:qr},{id:"route",title:Rn,value:t.httpServer.route||t.httpServer.routePrefix||Ur},{id:"method",title:En,value:t.httpServer.method||ci}]:t?.kafkaConsumer?[{id:"type",title:Hr,value:"Kafka consumer"},{id:"topic",title:si,value:t.kafkaConsumer.kafkaTopic||Ur}]:t?.kafkaProducer?[{id:"type",title:Hr,value:"Kafka producer"},{id:"topic",title:si,value:t.kafkaProducer.kafkaTopic||Ur}]:[{id:"type",title:Hr,value:Wr}]}(a),[a]);return t(Gn,{children:[e(A,{size:C.XS,children:Tn}),e(qn,{children:l.map(({id:a,title:n,value:l})=>t(Jn,{children:[e(A,{size:C.XXXS,color:o.v2.colors.silver[200],nowrap:!0,children:n}),e(A,{size:C.XS,nowrap:!0,children:l})]},a))})]})},ui=()=>{},pi=o.div`
|
|
449
|
+
display: flex;
|
|
450
|
+
gap: 12px;
|
|
451
|
+
`,hi=({rule:a})=>{const o=n(),l=null!=a.durationAtLeastMs,r=a.error;return l||r?t(pi,{children:[l&&t(Wn,{children:[e(A,{size:C.XS,children:Nn}),t("div",{children:[e(A,{size:C.XXXS,color:o.v2.colors.silver[200],children:Mn}),e(A,{size:C.XS,children:`${a.durationAtLeastMs}ms`})]})]}),r&&t(Wn,{children:[e(A,{size:C.XS,children:Dn}),e(L,{onChange:ui,value:!0,size:$e.S,label:Ln,labelAlign:F.Right})]})]}):null};const mi=({data:a})=>{const o=n(),l=ia(()=>function(e){switch(e.category){case"highlyRelevant":return null!=e.rule.percentageAtLeast?{title:Pn,method:jr,description:Fn,value:`${e.rule.percentageAtLeast}%`}:{title:Pn,method:"Keep all",description:null,value:null};case"noisy":return null!=e.rule.percentageAtMost?{title:On,method:jr,description:zn,value:`${e.rule.percentageAtMost}%`}:{title:On,method:"Drop all",description:null,value:null};case"costReduction":return{title:On,method:jr,description:zn,value:`${e.rule.percentageAtMost}%`}}}(a),[a]),r=[{id:"method",title:En,value:l.method},...null!=l.description?[{id:"value",title:l.description,value:l.value}]:[]];return t(Gn,{children:[e(A,{size:C.XS,children:l.title}),e(qn,{children:r.map(({id:a,title:n,value:l})=>t(Jn,{children:[e(A,{size:C.XXXS,color:o.v2.colors.silver[200],nowrap:!0,children:n}),e(A,{size:C.XS,nowrap:!0,children:l})]},a))})]})},gi=o.div`
|
|
452
|
+
display: flex;
|
|
453
|
+
align-items: center;
|
|
454
|
+
gap: 12px;
|
|
455
|
+
margin-top: auto;
|
|
456
|
+
padding: 12px 4px;
|
|
457
|
+
border-top: 1px solid ${({theme:e})=>e.v2.colors.silver[800]};
|
|
458
|
+
`,fi=o.div`
|
|
459
|
+
flex: 1;
|
|
460
|
+
`,vi=o.div`
|
|
461
|
+
display: flex;
|
|
462
|
+
align-items: center;
|
|
463
|
+
gap: 8px;
|
|
464
|
+
padding: 8px;
|
|
465
|
+
cursor: pointer;
|
|
466
|
+
border-radius: 6px;
|
|
467
|
+
&:hover {
|
|
468
|
+
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
469
|
+
}
|
|
470
|
+
`,yi=a=>{const o=n().v2.colors.red[500];if(a.isEditing){const{onCancelEdit:n,onSave:l,onDelete:r,duplicateWarning:i}=a;return t(gi,{children:[t(vi,{onClick:r,children:[e(A,{size:C.XS,weight:500,color:o,children:Kr}),e(St,{size:16,fill:o})]}),i&&e(x,{status:T.Warning,message:i.message,action:i.onViewRule?{label:"View rule",onClick:i.onViewRule}:void 0}),e(fi,{}),e(N,{label:kn,variant:D.Secondary,size:V.S,onClick:n}),e(N,{label:"Save",variant:D.Primary,size:V.S,onClick:l,disabled:!!i})]})}const{onDelete:l,onCancel:r,onEdit:i}=a;return t(gi,{children:[t(vi,{onClick:l,children:[e(A,{size:C.XS,weight:500,color:o,children:Kr}),e(St,{size:16,fill:o})]}),e(fi,{}),e(N,{label:kn,variant:D.Secondary,size:V.S,onClick:r}),e(N,{label:Cn,variant:D.Primary,size:V.S,onClick:i})]})},bi=["5000","1000","500","100","50"],Si=["50","25","10","1","0.5","0.1"];function Ci(e){if(null==e)return{percentageMode:"all",percentagePreset:"50",customPercentage:""};const t=Si.find(t=>Number(t)===e);return t?{percentageMode:"sample",percentagePreset:t,customPercentage:""}:{percentageMode:"sample",percentagePreset:"custom",customPercentage:String(e)}}function ki(e){if(!e)return{operationType:"all",routeType:"route",route:"",serverAddress:"",method:"",kafkaTopic:""};const t=e;if(t.httpServer){return{operationType:"httpServer",routeType:t.httpServer.routePrefix?"routePrefix":"route",route:t.httpServer.route||t.httpServer.routePrefix||"",serverAddress:"",method:t.httpServer.method||"",kafkaTopic:""}}return t.kafkaConsumer?{operationType:"kafkaConsumer",routeType:"route",route:"",serverAddress:"",method:"",kafkaTopic:t.kafkaConsumer.kafkaTopic||""}:t.kafkaProducer?{operationType:"kafkaProducer",routeType:"route",route:"",serverAddress:"",method:"",kafkaTopic:t.kafkaProducer.kafkaTopic||""}:{operationType:"all",routeType:"route",route:"",serverAddress:"",method:"",kafkaTopic:""}}function wi(e){const t=Xl(),a=(o=e.rule.sourceScopes,o?.length?o.map(e=>e.workloadLanguage?{scopeType:"language",workloadName:"",workloadKind:"",workloadNamespace:"",workloadLanguage:e.workloadLanguage}:e.workloadName?{scopeType:"source",workloadName:e.workloadName,workloadKind:e.workloadKind??"",workloadNamespace:e.workloadNamespace??"",workloadLanguage:""}:e.workloadNamespace?{scopeType:"namespace",workloadName:"",workloadKind:"",workloadNamespace:e.workloadNamespace,workloadLanguage:""}:{scopeType:"all",workloadName:"",workloadKind:"",workloadNamespace:"",workloadLanguage:""}).filter(e=>"all"!==e.scopeType):[]);var o;const n=function(e){return"highlyRelevant"!==e.category?"Relevance":e.rule.error?"Error":null!=e.rule.durationAtLeastMs?"Duration":"Relevance"}(e);let l,r,i={durationPreset:"500",customDurationMs:""},s=!1;switch(e.category){case"noisy":l=function(e){const t=e.rule.operation;if(!t)return{operationType:"all",routeType:"route",route:"",serverAddress:"",method:"",kafkaTopic:""};if(t.httpServer)return{operationType:"httpServer",routeType:t.httpServer.routePrefix?"routePrefix":"route",route:t.httpServer.route||t.httpServer.routePrefix||"",serverAddress:"",method:t.httpServer.method||"",kafkaTopic:""};if(t.httpClient)return{operationType:"httpClient",routeType:t.httpClient.templatedPathPrefix?"routePrefix":"route",route:t.httpClient.templatedPath||t.httpClient.templatedPathPrefix||"",serverAddress:t.httpClient.serverAddress||"",method:t.httpClient.method||"",kafkaTopic:""};return{operationType:"all",routeType:"route",route:"",serverAddress:"",method:"",kafkaTopic:""}}(e),r=Ci(e.rule.percentageAtMost);break;case"highlyRelevant":l=ki(e.rule.operation),r=Ci(e.rule.percentageAtLeast),i=function(e){if(null==e)return{durationPreset:"500",customDurationMs:""};const t=bi.find(t=>Number(t)===e);return t?{durationPreset:t,customDurationMs:""}:{durationPreset:"custom",customDurationMs:String(e)}}(e.rule.durationAtLeastMs),s=e.rule.error;break;case"costReduction":l=ki(e.rule.operation),r=Ci(e.rule.percentageAtMost)}return{...t,name:e.rule.name||"",notes:e.rule.notes||"",disabled:e.rule.disabled,ruleType:n,sourceScopes:a,...l,...i,keepErrors:s,...r}}const xi=o.div`
|
|
471
|
+
display: flex;
|
|
472
|
+
flex-direction: column;
|
|
473
|
+
gap: 16px;
|
|
474
|
+
padding: 32px 28px;
|
|
475
|
+
flex: 1;
|
|
476
|
+
overflow-y: auto;
|
|
477
|
+
`,Ti=({data:a,defaultEditMode:o,onClose:n,onDelete:l,onSaveEdit:r,sourceOptions:i,namespaceOptions:s,validateForm:c,onNavigateToDuplicate:d})=>{const[u,p]=Qt(!1),{formData:h,handleFormChange:m,resetFormData:g}=U(void 0),f=Zt(null),[v,y]=Qt(null);ea(()=>{a!==f.current&&(f.current=a,a&&o?(g(wi(a)),y(null),p(!0)):(p(!1),y(null)))},[a,o]);const S=a?.rule.name||Sn,C=u&&a?Gr[a.category]:`${S} preview`,k=na(()=>{a&&(g(wi(a)),y(null),p(!0))},[a,g]),w=na(()=>{p(!1),y(null)},[]),x=na(()=>{if(a&&u){if(c){const e=c(h);if(e)return void y(e)}r(h,a.rule.ruleId,a.samplingId)}},[a,u,h,r,c]),T=na(()=>{a&&l(a.rule.ruleId,a.samplingId)},[a,l]),N=na(e=>{y(null),m(void 0,void 0,{...h,...e})},[h,m]),D=v?{message:v.message,onViewRule:d?()=>d(v.ruleId):void 0}:null;return t(b,{isOpen:!!a,width:Vn,header:{icon:Lt,title:C,subTitle:a?Xn[a.category]:"",onClose:n},children:[a&&!u&&t(xi,{children:[e(Zr,{summary:a.summary}),e(ti,{data:a}),e(ii,{scopes:a.rule.sourceScopes??[]}),e(di,{data:a}),"highlyRelevant"===a.category&&e(hi,{rule:a.rule}),e(mi,{data:a}),e(yi,{isEditing:!1,onDelete:T,onCancel:n,onEdit:k})]}),a&&u&&t(xi,{children:[e(Kn,{category:a.category,formState:h,onChange:N}),e(al,{category:a.category,formState:h,onChange:N}),e(ml,{formState:h,onChange:N,sourceOptions:i,namespaceOptions:s}),e(Tl,{category:a.category,formState:h,onChange:N}),"highlyRelevant"===a.category&&e(Rl,{ruleType:h.ruleType,formState:h,onChange:N}),e(zl,{category:a.category,formState:h,onChange:N}),e(yi,{isEditing:!0,onCancelEdit:w,onSave:x,onDelete:T,duplicateWarning:D})]})]})},Ni=o.div`
|
|
478
|
+
display: flex;
|
|
479
|
+
flex-direction: column;
|
|
480
|
+
gap: 8px;
|
|
481
|
+
padding: 16px;
|
|
482
|
+
border-radius: 12px;
|
|
483
|
+
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
484
|
+
`,Di=o(p)`
|
|
485
|
+
align-items: center;
|
|
486
|
+
gap: 24px;
|
|
487
|
+
`,Ai=o.div`
|
|
488
|
+
flex: 1;
|
|
489
|
+
min-width: 0;
|
|
490
|
+
white-space: pre;
|
|
491
|
+
overflow-x: auto;
|
|
492
|
+
`,Ii=({title:a,summary:o,onEdit:l})=>{const r=n();return t(Ni,{children:[e(A,{size:C.XXS,color:r.v2.colors.silver[200],children:a}),t(Di,{children:[e(Ai,{children:e(Ho,{parts:o})}),e(N,{label:"Edit auto rule",rightIcon:Tt,variant:D.Text,size:V.S,onClick:l})]})]})};var $i,Ri;!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"}($i||($i={})),function(e){e.Id="id",e.Name="name",e.Type="type",e.Status="status",e.OdigosVersion="odigosVersion",e.ConnectedSince="connectedSince",e.LastActivity="lastActivity"}(Ri||(Ri={}));const Ei=[{key:Ri.Name,label:"Name"},{key:Ri.Type,label:"Type",textAlign:"right"},{key:Ri.Status,label:"Status"},{key:Ri.OdigosVersion,label:"Odigos Version"},{key:Ri.ConnectedSince,label:"Connected Since"},{key:Ri.LastActivity,label:"Last Activity"}],Pi=(e,t)=>{const a=e.find(e=>e.key===Ri.Id)?.rawValue;return t(a?.toString()||"")},Oi=e=>{const{connections:t,configMinSupportedVersion:a,snapshotMinSupportedVersion:o,onDelete:n,onAddSource:l,onAddDestination:r,onAddAction:i,onAddInstrumentationRule:s,onEditConfiguration:c}=e;return({cells:e})=>{if(!(e=>e.find(e=>e.key===Ri.Status)?.rawValue===T.Success)(e))return[{id:We(),label:"Delete Connection",rightIcon:xt,onClick:()=>Pi(e,n)}];const d=Pi(e,e=>{const o=t.find(t=>t.id===e);return!!o&&qe(o.odigosVersion,a)}),u=Pi(e,e=>{const a=t.find(t=>t.id===e);return!!a&&qe(a.odigosVersion,o)}),p=[];return l&&p.push({id:We(),tooltip:u?Se.ADD_SOURCE:`To use this feature, please upgrade to Odigos v${o} or later.`,rightIcon:Mt,disabled:!u,onClick:()=>Pi(e,l)}),r&&p.push({id:We(),tooltip:Se.ADD_DESTINATION,rightIcon:It,onClick:()=>Pi(e,r)}),i&&p.push({id:We(),tooltip:Se.ADD_ACTION,rightIcon:At,onClick:()=>Pi(e,i)}),s&&p.push({id:We(),tooltip:Se.ADD_INSTRUMENTATION_RULE,rightIcon:Ot,onClick:()=>Pi(e,s)}),c&&p.push({id:We(),tooltip:d?"Edit Configuration":`To use this feature, please upgrade to Odigos v${a} or later.`,rightIcon:Ft,disabled:!d,onClick:()=>Pi(e,c)}),p}},Mi=({tableRowsMaxHeight:a,connections:o,getConnections:l,onClickConnection:i,deleteConnection:s,configMinSupportedVersion:c=0,getEffectiveConfig:d,applyConfigurations:u,snapshotMinSupportedVersion:p=0,getAllClusterSnapshots:h,persistSources:m,getDestinationCategories:g,getPotentialDestinations:f,testConnection:v,createDestination:y,updateDestination:b,createAction:S,createInstrumentationRule:C})=>{const k=n(),{isVm:w}=r(),{formatTimeAgo:x}=Be(),[N,A]=Qt(!1),[I,$]=Qt(o||[]),R=na(async()=>{try{A(!0),$(await l()??[])}catch(e){}finally{A(!1)}},[]);ea(()=>{I.length||R()},[]);const[E,P]=Qt(""),[O,M]=Qt(null),[L,F]=Qt([]),z=ia(()=>O===$i.BulkConfig?c:O===$i.BulkSource?p:0,[O,c,p]),{supportedConnections:X,supportedConnectionIds:_}=ia(()=>{const e=((e,t)=>e.filter(e=>{const a=e.status===T.Success,o=qe(e.odigosVersion,t);return a&&o}))(I,z);return{supportedConnections:e,supportedConnectionIds:e.map(e=>e.id)}},[I.length,z]);ea(()=>{if(!O||O===$i.Delete)return;const e=L.filter(e=>!_.includes(e));e.length&&F(t=>t.filter(t=>!e.includes(t)))},[O,L.length,_.length]);const B=ia(()=>I.filter(e=>!E||e.name.toLowerCase().includes(E.toLowerCase())).map(t=>({cells:[{key:Ri.Id,rawValue:t.id},{key:Ri.Name,rawValue:t.name},{key:Ri.Type,rawValue:t.type},{key:Ri.Status,rawValue:t.status,component:()=>(t=>{const a=t===T.Success?"Connection live":"Connection lost",o=t===T.Success?Et:Pt;return e(ce,{status:t,label:a,leftIcon:o})})(t.status)},{key:Ri.OdigosVersion,rawValue:t.odigosVersion},{key:Ri.ConnectedSince,rawValue:t.connectedAt?x(t.connectedAt):"-"},{key:Ri.LastActivity,rawValue:t.lastSeenAt?x(t.lastSeenAt):"-"}],onClick:t.status!==T.Success||O?void 0:()=>i(t),isSelected:L.includes(t.id),onSelect:()=>F(e=>Array.from(new Set([...e,t.id]))),onDeselect:()=>F(e=>e.filter(e=>e!==t.id)),hideCheckbox:t.status!==T.Success||O===$i.BulkConfig&&!qe(t.odigosVersion,c)||O===$i.BulkSource&&!qe(t.odigosVersion,p)})),[I,L,E,O,c,p]),U=ia(()=>{const e=(e,t)=>{F([e]),M(t)};return Oi({connections:I,configMinSupportedVersion:c,snapshotMinSupportedVersion:p,onDelete:t=>e(t,$i.Delete),onAddSource:!w&&h&&m?t=>e(t,$i.BulkSource):void 0,onAddDestination:!w&&g&&f&&y?t=>e(t,$i.BulkDestination):void 0,onAddAction:!w&&S?t=>e(t,$i.BulkAction):void 0,onAddInstrumentationRule:!w&&C?t=>e(t,$i.BulkInstrumentationRule):void 0,onEditConfiguration:!w&&d&&u?t=>e(t,$i.BulkConfig):void 0})},[w,I,c,d,u,p,h,m,g,f,y,S,C]),H=ia(()=>(e=>{const{onCancel:t,onAddSource:a,onAddDestination:o,onAddAction:n,onAddInstrumentationRule:l,onManageConfigurations:r}=e,i=[];a&&i.push({id:We(),type:Je.Button,buttonProps:{variant:D.Primary,size:V.S,label:"Add Sources",rightIcon:Mt,onClick:a}});const s=[o?{id:$i.BulkDestination,label:Se.ADD_DESTINATION,icon:It}:null,n?{id:$i.BulkAction,label:Se.ADD_ACTION,icon:At}:null,l?{id:$i.BulkInstrumentationRule,label:Se.ADD_INSTRUMENTATION_RULE,icon:Ot}:null,r?{id:$i.BulkConfig,label:"Manage Configurations",icon:Ft}:null];return s.some(Boolean)&&i.push({id:We(),type:Je.ButtonDropData,buttonProps:{variant:D.Secondary,size:V.S,label:"Bulk Operations",onClick:e=>{e===$i.BulkSource?a?.():e===$i.BulkDestination?o?.():e===$i.BulkAction?n?.():e===$i.BulkInstrumentationRule?l?.():e===$i.BulkConfig&&r?.()}},dropDataProps:{alignX:Ke.Left,items:s}}),i.push({id:We(),type:Je.Button,buttonProps:{variant:D.Text,size:V.S,label:Ye.CANCEL,onClick:t}}),i})({onCancel:()=>F([]),onAddSource:!w&&h&&m?()=>M($i.BulkSource):void 0,onAddDestination:!w&&g&&f&&y?()=>M($i.BulkDestination):void 0,onAddAction:!w&&S?()=>M($i.BulkAction):void 0,onAddInstrumentationRule:!w&&C?()=>M($i.BulkInstrumentationRule):void 0,onManageConfigurations:!w&&d&&u?()=>M($i.BulkConfig):void 0}),[w,d,u,h,m,g,f,y,S,C]);return e(Qe,{children:t(He,{richTitle:{icon:jt,title:Se.CONNECTIONS,badge:{label:I.length.toString(),status:Ie.Unknown}},search:{placeholder:"Search by cluster name",value:E,onChange:e=>P(e),width:"300px"},actions:[{id:We(),type:Je.Button,buttonProps:{variant:D.Secondary,size:V.S,leftIcon:Ht,onClick:R,disabled:N}}],children:[e(Ze,{variant:et.Pretty,maxHeight:a,headerBackgroundColor:k.v2.colors.silver[1e3],isLoading:N,withCheckboxes:!0,columns:Ei,rows:B,rowActionsPushRightPosition:O?`calc(${Sa} - 24px)`:void 0,getRowActions:U}),O===$i.BulkConfig&&d&&u&&e(Pr,{onClose:()=>M(null),connections:X,selectedConnectionIds:L,setSelectedConnectionIds:F,getEffectiveConfig:d,onApply:u}),O===$i.BulkSource&&h&&m&&e(fo,{selectedConnectionIds:L,getAllClusterSnapshots:h,children:e(_o,{onClose:()=>M(null),selectedConnectionIds:L,setSelectedConnectionIds:F,persistSources:async e=>await(m?.(e))})}),O===$i.BulkDestination&&g&&f&&v&&y&&b&&e(Qa,{children:e($o,{onClose:()=>M(null),selectedConnectionIds:L,setSelectedConnectionIds:F,getDestinationCategories:g,getPotentialDestinations:f,testConnection:e=>v(e,L),createDestination:e=>y(e,L),updateDestination:(e,t)=>b(e,t,L)})}),O===$i.BulkAction&&S&&e(ja,{children:e(bo,{onClose:()=>M(null),selectedConnectionIds:L,setSelectedConnectionIds:F,createAction:e=>S(e,L)})}),O===$i.BulkInstrumentationRule&&C&&e(po,{children:e(Ro,{onClose:()=>M(null),selectedConnectionIds:L,setSelectedConnectionIds:F,createInstrumentationRule:e=>C(e,L)})}),e(ua,{target:"connection",isOpen:O===$i.Delete,onClose:()=>{F([]),M(null)},onApprove:async()=>{const e=L[0];e&&(await s(e),await R())}}),e(tt,{isOpen:!!L.length&&!O,richTitle:{icon:gt,title:"Selected Clusters",badge:{label:L.length}},actions:H})]})})},Li=o.div`
|
|
138
493
|
display: flex;
|
|
139
494
|
align-items: center;
|
|
140
495
|
justify-content: space-between;
|
|
@@ -143,26 +498,26 @@ import{jsx as e,jsxs as t,Fragment as a}from"react/jsx-runtime";import{useState
|
|
|
143
498
|
width: calc(100% - 32px);
|
|
144
499
|
border-radius: 16px;
|
|
145
500
|
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
146
|
-
`,
|
|
501
|
+
`,Fi=o.div`
|
|
147
502
|
display: flex;
|
|
148
503
|
align-items: center;
|
|
149
504
|
justify-content: center;
|
|
150
505
|
padding: 8px;
|
|
151
506
|
border-radius: 8px;
|
|
152
|
-
background-color: ${({theme:e})=>e.v2.colors.white[500]+
|
|
153
|
-
`,
|
|
507
|
+
background-color: ${({theme:e})=>e.v2.colors.white[500]+I["004"]};
|
|
508
|
+
`,zi=({setStep:a,onSave:o,sourcesPayload:l,destinationsPayload:r,disableAnimation:i})=>{const s=n(),c=()=>a(2),d=()=>a(3),u=ia(()=>Object.values(l||{}).flatMap((a,o)=>a.map((a,n)=>{if(!a.selected)return null;const l=a.kind||ve.Namespace,r=l===ve.Namespace?a.namespace:`${a.namespace} → ${a.name}`;return t(Li,{children:[e(A,{nowrap:!0,children:r}),e(ce,{label:l,status:T.Info,backgroundColor:s.v2.colors.blue[900]})]},`source-${o}-${n}`)})).filter(Boolean),[l]),h=ia(()=>r?.map((a,o)=>{const n=Te(a.option.type).icon;return t(Li,{children:[t(p,{$gap:8,children:[n&&e(Fi,{children:e(n,{size:24})}),e(A,{nowrap:!0,children:a.formData.name||a.option.displayName})]}),void 0!==a.testResult&&e(ce,{status:a.testResult.succeeded?T.Success:T.Error,leftIcon:a.testResult.succeeded?Et:Pt})]},`destination-${o}`)})||[],[r]);return e(Da,{isOpen:!0,disableAnimation:i,onBack:()=>a(3),onSave:o,header:{icon:ft,title:Se.SUMMARY,subTitle:Se.REVIEW_SETUP},leftColumn:{width:"50%",header:t(p,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[t(p,{$gap:8,children:[e(Mt,{size:24}),e(A,{nowrap:!0,children:Se.SELECTED_SOURCES}),e(ce,{label:u.length})]}),e(N,{"data-id":"summary-edit-sources",leftIcon:Tt,variant:D.Secondary,size:V.S,onClick:c})]}),list:u.length?u:[e(v,{$height:"100%",children:e(y,{icon:Mt,title:Se.NO_SOURCES_SELECTED,subTitle:Se.ADD_SOURCE_PROMPT,button:{leftIcon:Ct,label:Se.ADD_SOURCE,onClick:c}})},"no-sources-data")]},rightColumn:{width:"50%",header:t(p,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[t(p,{$gap:8,children:[e(It,{size:24}),e(A,{nowrap:!0,children:Se.SELECTED_DESTINATIONS}),e(ce,{label:h.length})]}),e(N,{"data-id":"summary-edit-destinations",leftIcon:Tt,variant:D.Secondary,size:V.S,onClick:d})]}),list:h.length?h:[e(v,{"data-id":"summary-no-destinations",$height:"100%",children:e(y,{icon:It,title:Se.NO_DESTINATIONS_SELECTED,subTitle:Se.ADD_DESTINATION_PROMPT,button:{leftIcon:Ct,label:Se.ADD_DESTINATIONS,onClick:d}})},"no-destinations-data")]}})},Xi=o.div`
|
|
154
509
|
position: relative;
|
|
155
510
|
overflow: hidden;
|
|
156
511
|
width: calc(100vw - ${({$paddingXAxis:e})=>e});
|
|
157
512
|
height: calc(100vh - ${({$paddingYAxis:e})=>e});
|
|
158
513
|
box-sizing: border-box;
|
|
159
|
-
`,
|
|
514
|
+
`,Vi=o.svg`
|
|
160
515
|
position: absolute;
|
|
161
516
|
top: 50%;
|
|
162
517
|
left: 50%;
|
|
163
518
|
transform: translate(-50%, -50%);
|
|
164
519
|
z-index: -1;
|
|
165
|
-
`,
|
|
520
|
+
`,_i=[{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"}],Bi=[{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:_i},{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:_i},{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:_i}],Ui=({paddingXAxis:a="0px",paddingYAxis:o="0px",children:n})=>{const[l,r]=Qt(window.innerWidth),i=ia(()=>l/Bi[0].width,[l]);return ea(()=>{const e=()=>r(window.innerWidth);return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),t(Xi,{$paddingXAxis:a,$paddingYAxis:o,children:[Bi.map(({width:a,height:o,pathOpacity:n,path:l,gradientTransform:r,stops:s},c)=>{const d=`purple-ring-${c}`;return t(Vi,{width:a*i,height:"100%",viewBox:`0 0 ${a} ${o}`,fill:"none",children:[e("path",{opacity:n,d:l,fill:`url(#${d})`}),e("defs",{children:e("radialGradient",{id:d,cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:r,children:s.map(({offset:t,opacity:a},o)=>e("stop",{offset:t,stopColor:"#7C3BFF",stopOpacity:a},o))})})]},d)}),n]})},Hi=o.div`
|
|
166
521
|
display: flex;
|
|
167
522
|
flex-direction: column;
|
|
168
523
|
align-items: center;
|
|
@@ -173,7 +528,7 @@ import{jsx as e,jsxs as t,Fragment as a}from"react/jsx-runtime";import{useState
|
|
|
173
528
|
width: 50vw;
|
|
174
529
|
border-radius: 16px;
|
|
175
530
|
background: ${({theme:e})=>e.v2.colors.silver[900]};
|
|
176
|
-
`,
|
|
531
|
+
`,ji=o.div`
|
|
177
532
|
display: flex;
|
|
178
533
|
flex-direction: column;
|
|
179
534
|
align-items: center;
|
|
@@ -183,12 +538,12 @@ import{jsx as e,jsxs as t,Fragment as a}from"react/jsx-runtime";import{useState
|
|
|
183
538
|
& * {
|
|
184
539
|
text-align: center;
|
|
185
540
|
}
|
|
186
|
-
`,
|
|
541
|
+
`,Ki=({onStart:a})=>e(b,{width:"75vw",isOpen:!0,hideOverlay:!0,disableAnimation:!0,children:e(v,{$height:"100%",children:t(Hi,{children:[t(ji,{children:[e(A,{size:C.L,weight:500,children:Se.GET_STARTED_WITH}),e(pa,{size:260}),e(A,{size:C.S,weight:400,children:Se.GET_STARTED_DESCRIPTION})]}),e(N,{"data-id":"onboarding-get-started",label:Ye.GET_STARTED,rightIcon:yt,size:V.L,onClick:a})]})})}),Gi=[{step:1,label:Se.INSTALLATION,forceDoneBadge:!0},{step:2,label:Se.SOURCES_SETUP},{step:3,label:Se.DESTINATIONS_SETUP},{step:4,label:Se.SUMMARY}],Wi=o.div`
|
|
187
542
|
display: flex;
|
|
188
543
|
flex-direction: column;
|
|
189
544
|
gap: 32px;
|
|
190
545
|
padding: 64px;
|
|
191
|
-
`,
|
|
546
|
+
`,qi=({pagePaddingXAxis:a,pagePaddingYAxis:o,fetchNamespacesWithWorkloads:n,persistSources:l,getDestinationCategories:r,getPotentialDestinations:i,testConnection:s,createDestination:c,updateDestination:d,onDone:u})=>{const[p,h]=Qt(1),[m,g]=Qt(!1),[f,v]=Qt(null),[y,b]=Qt(null),S=()=>h(e=>e+1),C=()=>h(e=>e-1);return t(Ui,{paddingXAxis:a,paddingYAxis:o,children:[t(Wi,{children:[e(pa,{}),e(at,{currentStep:p,data:Gi,gap:32})]}),e(fo,{fetchNamespacesWithWorkloads:n,initialInputs:f,children:t(Qa,{children:[1===p&&e(Ki,{onStart:S}),2===p&&e(_o,{disableAnimation:!0,onBack:e=>{v(e),C()},onNext:e=>{v(e),S()},persistSources:l}),3===p&&e($o,{disableAnimation:!0,onBack:e=>{b(e),C()},onNext:e=>{b(e),S()},getDestinationCategories:r,getPotentialDestinations:i,initialInputs:y,testConnection:s,createDestination:c,updateDestination:d}),4===p&&e(zi,{disableAnimation:!0,setStep:h,onSave:async()=>{if(!m){g(!0);try{const e=[];f&&e.push(l(f)),y&&e.push(...y.map(e=>c(e.formData)));const t=await Promise.allSettled(e),a=[];for(const e of t)"rejected"===e.status?a.push(e.reason?.message||String(e.reason)):e.value?.error&&a.push(e.value.error);if(a.length)return{error:a.join("\n")};u()}catch(e){return g(!1),{error:e instanceof Error?e.message:String(e)}}}},sourcesPayload:f,destinationsPayload:y})]})})]})},Ji=o.div`
|
|
192
547
|
display: flex;
|
|
193
548
|
align-items: center;
|
|
194
549
|
justify-content: space-between;
|
|
@@ -200,10 +555,66 @@ import{jsx as e,jsxs as t,Fragment as a}from"react/jsx-runtime";import{useState
|
|
|
200
555
|
&:hover {
|
|
201
556
|
background: ${({theme:e})=>e.v2.colors.silver[700]};
|
|
202
557
|
}
|
|
203
|
-
`,
|
|
204
|
-
animation-name: ${
|
|
205
|
-
`,
|
|
558
|
+
`,Yi=o.div`
|
|
559
|
+
animation-name: ${rt.in};
|
|
560
|
+
`,Qi=({pod:o,getExtendedPodInfo:n,onClose:l})=>{const{formatTimeAgo:r}=Be(),[i,s]=Qt(null),[c,u]=Qt(!1);ea(()=>{o?n(o.namespace,o.name).then(e=>s(e??null)):(s(null),u(!1))},[o]);const p=ia(()=>[{id:We(),title:"Node",label:i?.node??"-",withCopy:!0},{id:We(),title:"Status",badge:{status:ot(i?.status),label:i?.status??"-"}}],[i]),h=ia(()=>i?.containers?.map(e=>({id:We(),items:[{id:We(),title:"Container",label:e.name??"-"},{id:We(),title:"Status",label:e.startedAt?`${e.status} (since ${r(e.startedAt)})`:e.status},{id:We(),title:"Ready",badge:{status:e.ready?T.Success:T.Error,leftIcon:e.ready?gt:wt,label:e.ready?"True":"False",invertColors:!0}},{id:We(),title:"Started",badge:{status:e.started?T.Success:T.Error,leftIcon:e.started?gt:wt,label:e.started?"True":"False",invertColors:!0}},{id:We(),title:"Image Version",label:e.image?.split(":")?.[1]??"-"},{id:We(),title:"Image Repository",label:e.image?.split(":")?.[0]??"-"},{id:We(),title:"Restarts",label:e.restarts.toString()},{id:We(),title:"State Reason",label:e.stateReason??"-"},{id:We(),title:"Resource Requests",label:`CPU ${e.resources.requests.cpu} • Memory ${e.resources.requests.memory}`},{id:We(),title:"Resource Limits",label:`CPU ${e.resources.limits.cpu} • Memory ${e.resources.limits.memory}`}]}))||[],[i]);return t(b,{isOpen:!!o,header:{icon:Kt,title:"Pod Information",onClose:l},children:[i?null:e(v,{children:e(nt,{})}),i?t(a,{children:[e(He,{richTitle:{icon:Kt,title:i.name,withCopy:!0},children:t(d,{$gap:24,children:[e(Ge,{cellsPerRow:2,items:p}),h.length>0&&t(d,{$gap:12,children:[t(Ji,{onClick:()=>u(e=>!e),children:[e(A,{children:"Containers Overview"}),e(Ce,{icon:c?$t:Rt})]}),c&&h.map(({id:t,items:a})=>e(Yi,{children:e(Ge,{cellsPerRow:2,items:a})},t))]})]})}),e(He,{richTitle:{icon:Ut,title:"Kubectl Commands"},children:t(d,{$gap:12,children:[e(lt,{value:`kubectl get pod ${i.name} -n ${i.namespace} -o yaml`}),e(lt,{value:`kubectl describe pod ${i.name} -n ${i.namespace}`}),e(lt,{value:`kubectl logs ${i.name} -n ${i.namespace}`})]})}),e(ca,{yaml:i.manifestYAML,defaultOpen:!0})]}):null]})};var Zi;!function(e){e.PodName="podName",e.Status="status",e.Restarts="restarts",e.NodeName="nodeName",e.SpanDropDrate="spanDropDrate",e.Age="age",e.DockerImage="dockerImage"}(Zi||(Zi={}));const es=[{key:Zi.PodName,label:"Pod Name"},{key:Zi.Status,label:"Status"},{key:Zi.Restarts,label:"Restarts",textAlign:"right"},{key:Zi.NodeName,label:"Node Name"},{key:Zi.Age,label:"Age",textAlign:"right"},{key:Zi.DockerImage,label:"Docker Image",textAlign:"right"}],ts=({isLoading:a,tableRowsMaxHeight:o,pods:l,getExtendedPodInfo:r})=>{const i=n(),{formatTimeAgo:s}=Be(),[c,d]=Qt(null),u=ia(()=>l.map(a=>({onClick:()=>d(a),cells:[{key:Zi.PodName,rawValue:a.name},{key:Zi.Status,rawValue:a.status,component:()=>{return t=a.status,e(ce,{status:ot(t),label:t});var t}},{key:Zi.Restarts,rawValue:a.restartsCount.toString()},{key:Zi.NodeName,rawValue:a.nodeName},{key:Zi.SpanDropDrate,rawValue:0,component:()=>{const{collectorMetrics:o}=a;if(!o)return e(A,{children:"-"});const n=(o?.metricsAcceptedRps??0)+(o?.metricsDroppedRps??0),l=n>0?Math.round((o?.metricsDroppedRps??0)/n*100):0,r=l>0?T.Error:T.Success,i=(o?.exporterSuccessRps??0)+(o?.exporterFailedRps??0),s=i>0?Math.round((o?.exporterFailedRps??0)/i*100):0,c=s>0?T.Error:T.Success;return t(p,{$gap:4,children:[e(ae,{text:`Accepted: ${o.metricsAcceptedRps.toLocaleString()}, Dropped: ${o.metricsDroppedRps.toLocaleString()}`,children:e(ce,{status:r,label:`Receiver ${l}%`,leftIcon:r===T.Error?Gt:Wt,useSecondaryTone:!0,invertColors:!0})}),e(ae,{text:`Success: ${o.exporterSuccessRps.toLocaleString()}, Failed: ${o.exporterFailedRps.toLocaleString()}`,children:e(ce,{status:c,label:`Exporter ${s}%`,leftIcon:c===T.Error?Gt:Wt,useSecondaryTone:!0,invertColors:!0})})]})}},{key:Zi.Age,rawValue:s(a.creationTimestamp)},{key:Zi.DockerImage,rawValue:a.image}]})),[l,i]);return t(He,{richTitle:{icon:Kt,title:"Pods"},children:[e(Ze,{variant:et.Data,maxHeight:o,isLoading:a,columns:es,rows:u}),e(Qi,{pod:c,getExtendedPodInfo:r,onClose:()=>d(null)})]})};var as;!function(e){e.Gateway="gateway",e.Node="node"}(as||(as={}));const os=[{value:as.Gateway,label:"Gateway"},{value:as.Node,label:"Node Collector"}],ns=o.div`
|
|
206
561
|
display: flex;
|
|
207
562
|
align-items: center;
|
|
208
563
|
justify-content: space-between;
|
|
209
|
-
`,
|
|
564
|
+
`,ls=({selectedTab:a,setSelectedTab:o,onClickDownloadDiagnose:n,onClickRefresh:l,loading:r,disabled:i})=>{const s=ia(()=>{const e=[];return n&&e.push({id:We(),type:Je.Button,buttonProps:{label:"Download Diagnose",leftIcon:Bt,size:V.S,variant:D.Text,onClick:n,disabled:i}}),l&&e.push({id:We(),type:Je.Button,buttonProps:{label:"Refresh",leftIcon:Ht,size:V.S,variant:D.Text,onClick:l,disabled:i,loading:r}}),e},[n,l,i,r]);return t(ns,{children:[t(p,{$gap:12,$alignItems:"center",children:[e(k,{icon:qt,title:"Pipeline Collectors"}),e(j,{options:os,selected:a,setSelected:o,disabled:i})]}),e(it,{actions:s})]})},rs=({isOpen:t,onClose:a,title:o,yaml:n})=>e(b,{isOpen:t,header:{icon:Jt,title:o,onClose:a},children:e(ca,{yaml:n,defaultOpen:!0})});var is;!function(e){e.ManifestYaml="manifest-yaml",e.ConfigMapYaml="configmap-yaml"}(is||(is={}));const ss=({richTitle:a,statusCard:o,textCards:n,manifestYaml:l,configMapYaml:r})=>{const[i,s]=Qt(null);return t(He,{richTitle:a,actions:[{id:We(),type:Je.ButtonDropData,buttonProps:{variant:D.Secondary,size:V.S,label:"View YAML",onClick:e=>s(e)},dropDataProps:{items:[{id:is.ManifestYaml,label:a.title,icon:Yt},{id:is.ConfigMapYaml,label:"ConfigMap",icon:Yt}]}}],children:[t(p,{$gap:16,children:[e(st,{...o}),n.map(t=>e(ct,{...t},t.title))]}),e(rs,{isOpen:i===is.ManifestYaml,onClose:()=>s(null),title:a.title,yaml:l}),e(rs,{isOpen:i===is.ConfigMapYaml,onClose:()=>s(null),title:"ConfigMap",yaml:r})]})},cs=e=>{switch(e){case dt.Healthy:return"All desired replicas are updated, available, and ready";case dt.Updating:return"Workload is progressing towards desired state (e.g., updating pods)";case dt.Degraded:return"Progressing but with availability issues (e.g., not enough available replicas)";case dt.Failed:return"Progress deadline exceeded or an unrecoverable error occurred";case dt.Down:return"No available replicas";case dt.Unknown:return"Status cannot be determined from current signals";default:return"Status unknown"}},ds=({minSupportedVersion:a=0,tableRowsMaxHeight:o,getGatewayInfo:n,getGatewayPods:l,getNodeCollectorInfo:i,getNodeCollectorPods:s,getExtendedPodInfo:c})=>{const{formatTimeAgo:d}=Be(),{isVersionSupported:u,version:p}=r(a),[h,m]=Qt(!1),[g,f]=Qt(as.Gateway),[v,y]=Qt(null),[b,S]=Qt([]),[C,k]=Qt(null),[w,x]=Qt([]),N=na(async()=>{m(!0);try{switch(g){case as.Gateway:y(await n()??null),S(await l()??[]);break;case as.Node:k(await i()??null),x(await s()??[])}}catch(e){}m(!1)},[g]);ea(()=>{N()},[N]);const D=ia(()=>(e=>{switch(e){case as.Gateway:return"Deployment";case as.Node:return"DaemonSet";default:return"Pipeline Collectors"}})(g),[g]),A=ia(()=>((e,t,a,o)=>{const n={status:Ie.Disabled,label:"No rollouts yet"};let l=!1,r=null;switch(e){case as.Gateway:l=t?.rolloutInProgress??!1,r=t?.lastRolloutAt??null;break;case as.Node:l=a?.rolloutInProgress??!1,r=a?.lastRolloutAt??null;break;default:return n}return l?{status:T.Info,label:"Rollout in progress",rightIcon:Ht,useSecondaryTone:!0}:r?{status:Ie.Disabled,label:`Last Rollout: ${o(r)}`}:n})(g,v,C,d),[v,C,g,d]),I=ia(()=>((e,t,a,o)=>{let n=o?T.Info:Ie.Unknown,l=o?"Loading":dt.Unknown,r=o?"Fetching data...":cs(dt.Unknown);switch(e){case as.Gateway:n=t?.status?ot(t?.status):n,l=t?.status??l,r=t?.status?cs(t.status):r;break;case as.Node:n=a?.status?ot(a?.status):n,l=a?.status??l,r=a?.status?cs(a.status):r}return{status:n,title:l,description:r}})(g,v,C,h),[v,C,g,h]),$=ia(()=>((e,t,a,o)=>{switch(e){case as.Gateway:return[{title:"HPA Spec (Replicas)",cells:[{label:"Min.",value:t?.hpa?.min.toString()??"-",isLoading:o},{label:"Max.",value:t?.hpa?.max.toString()??"-",isLoading:o},{label:"Current",value:t?.hpa?.current.toString()??"-",isLoading:o},{label:"Desired",value:t?.hpa?.desired.toString()??"-",isLoading:o}]},{title:"Requests",cells:[{label:"CPU",value:t?.resources?.requests.cpu??"-",isLoading:o},{label:"Memory",value:t?.resources?.requests.memory??"-",isLoading:o}]},{title:"Limits",cells:[{label:"CPU",value:t?.resources?.limits.cpu??"-",isLoading:o},{label:"Memory",value:t?.resources?.limits.memory??"-",isLoading:o}]},{title:"Docker Image",cells:[{value:t?.imageVersion??"-",isLoading:o}]}];case as.Node:return[{title:"Nodes",cells:[{label:"Desired",value:a?.nodes?.desired.toString()??"-",isLoading:o},{label:"Ready",value:a?.nodes?.ready.toString()??"-",isLoading:o}]},{title:"Requests",cells:[{label:"CPU",value:a?.resources?.requests.cpu??"-",isLoading:o},{label:"Memory",value:a?.resources?.requests.memory??"-",isLoading:o}]},{title:"Limits",cells:[{label:"CPU",value:a?.resources?.limits.cpu??"-",isLoading:o},{label:"Memory",value:a?.resources?.limits.memory??"-",isLoading:o}]},{title:"Docker Image",cells:[{value:a?.imageVersion??"-",isLoading:o}]}];default:return[]}})(g,v,C,h),[v,C,g,h]),R=ia(()=>(g===as.Gateway?v?.manifestYAML:C?.manifestYAML)??"",[v,C,g]),E=ia(()=>(g===as.Gateway?v?.configMapYAML:C?.configMapYAML)??"",[v,C,g]),P=ia(()=>g===as.Gateway?b:w,[b,w,g]);return t(Qe,{children:[e(ls,{disabled:!u,loading:h,selectedTab:g,setSelectedTab:f,onClickDownloadDiagnose:void 0,onClickRefresh:N}),t(ut,{children:[e(ss,{richTitle:{icon:Jt,title:D,badge:A},statusCard:I,textCards:$,manifestYaml:R,configMapYaml:E}),e(ts,{isLoading:h,tableRowsMaxHeight:o,pods:P,getExtendedPodInfo:c}),!u&&e(ga,{minSupportedVersion:a,currentVersion:p||""})]})]})},us=o(p)`
|
|
565
|
+
align-items: center;
|
|
566
|
+
gap: 12px;
|
|
567
|
+
padding: 12px 16px;
|
|
568
|
+
`,ps=[{value:"all",label:"All"},{value:"Relevance",label:"Relevance"},{value:"Duration",label:"Duration"},{value:"Error",label:"Error"}],hs=({title:a,titleTooltip:o,itemCount:l,searchValue:r,onSearchChange:i,typeFilter:s,onTypeFilterChange:c,showTypeFilter:d})=>{const u=n();return t(us,{children:[t(p,{$gap:8,$alignItems:"center",children:[e(A,{size:C.XS,weight:500,nowrap:!0,children:a}),o&&e(ae,{text:o,withIcon:!0}),e(ce,{label:l,backgroundColor:u.v2.colors.grey[600],textColor:u.v2.colors.white[500]})]}),e(w,{value:r,onChange:i,placeholder:"Search...",width:"360px"}),d&&e(j,{size:Ne.S,options:ps,selected:s,setSelected:c})]})},ms=o.div`
|
|
569
|
+
position: relative;
|
|
570
|
+
display: flex;
|
|
571
|
+
align-items: center;
|
|
572
|
+
gap: 12px;
|
|
573
|
+
padding: 12px 16px;
|
|
574
|
+
border-radius: 12px;
|
|
575
|
+
background-color: ${({theme:e,$isHovered:t})=>t?e.v2.colors.silver[700]:e.v2.colors.silver[900]};
|
|
576
|
+
cursor: pointer;
|
|
577
|
+
transition: background-color 0.15s;
|
|
578
|
+
`,gs=o.div`
|
|
579
|
+
display: flex;
|
|
580
|
+
flex-direction: column;
|
|
581
|
+
gap: 4px;
|
|
582
|
+
min-width: 0;
|
|
583
|
+
flex: 1;
|
|
584
|
+
`,fs=o(A)`
|
|
585
|
+
overflow: hidden;
|
|
586
|
+
text-overflow: ellipsis;
|
|
587
|
+
`,vs=o.div`
|
|
588
|
+
min-width: 0;
|
|
589
|
+
display: inline-flex;
|
|
590
|
+
align-items: center;
|
|
591
|
+
|
|
592
|
+
border-radius: 4px;
|
|
593
|
+
opacity: ${({$disabled:e})=>e?.4:1};
|
|
594
|
+
transition: background-color 0.15s;
|
|
595
|
+
overflow: hidden;
|
|
596
|
+
white-space: pre;
|
|
597
|
+
text-overflow: ellipsis;
|
|
598
|
+
`,ys=o(p)`
|
|
599
|
+
flex-shrink: 0;
|
|
600
|
+
margin-left: auto;
|
|
601
|
+
gap: 6px;
|
|
602
|
+
align-items: center;
|
|
603
|
+
min-height: 22px;
|
|
604
|
+
`;const bs=({item:a,isHovered:o,onClick:l,onEdit:r,onDelete:i,onMouseEnter:s,onMouseLeave:c})=>{const d=n(),u=na(()=>{r(a.ruleId,a.samplingId)},[a.ruleId,a.samplingId,r]),p=na(()=>{i(a.ruleId,a.samplingId)},[a.ruleId,a.samplingId,i]),h=ia(()=>{const t=t=>e(xt,{...t,fill:d.v2.colors.red[500]});return t.displayName="RedDeleteIcon",t},[d]),m=[{id:"edit",label:Cn,leftIcon:Tt,onClick:u},{id:"delete",label:"",leftIcon:h,onClick:p}],g=a.typeBadge?function(e,t){const a=e.v2.colors;switch(t){case"Relevance":return{bg:a.blue[800],text:a.white[500]};case"Duration":return{bg:a.purple[600],text:a.white[500]};case"Error":return{bg:a.red[500],text:a.black[500]}}}(d,a.typeBadge):void 0;return t(ms,{$isHovered:o,onClick:()=>l(a),onMouseEnter:s,onMouseLeave:c,children:[t(gs,{children:[e(vs,{$disabled:a.disabled,$isHovered:o,children:e(Ho,{parts:a.summary})}),a.name&&e(fs,{size:C.XXXS,color:d.v2.colors.grey[400],nowrap:!0,children:a.name})]}),t(ys,{children:[a.disabled&&e(ce,{label:"Disabled rule",textSize:C.XXXS,backgroundColor:d.v2.colors.grey[700],textColor:d.v2.colors.grey[300]}),a.typeBadge&&g&&e(ce,{label:a.typeBadge,textSize:C.XXXS,backgroundColor:g.bg,textColor:g.text})]}),e(pt,{isOpen:o,actions:m})]})},Ss=o(d)`
|
|
605
|
+
flex: 1;
|
|
606
|
+
min-height: 0;
|
|
607
|
+
background-color: ${({theme:e})=>e.v2.colors.silver[1e3]};
|
|
608
|
+
border-radius: 16px;
|
|
609
|
+
`,Cs=o(d)`
|
|
610
|
+
flex: 1;
|
|
611
|
+
min-height: 0;
|
|
612
|
+
padding: 0 16px 16px;
|
|
613
|
+
gap: 4px;
|
|
614
|
+
overflow-y: auto;
|
|
615
|
+
`,ks=o.div`
|
|
616
|
+
display: flex;
|
|
617
|
+
align-items: center;
|
|
618
|
+
justify-content: center;
|
|
619
|
+
padding: 48px 16px;
|
|
620
|
+
`;const ws=({title:a,titleTooltip:o,items:n,isLoading:l,showTypeFilter:r=!1,onRuleClick:i,onEditRule:s,onDeleteRule:c})=>{const[d,u]=Qt(""),[p,h]=Qt(null),[m,g]=Qt("all"),f=d.trim()||r&&"all"!==m,v=ia(()=>{let e=function(e,t,a){return a&&"all"!==t?e.filter(e=>e.typeBadge===t):e}(n,m,r);return e=function(e,t){if(!t.trim())return e;const a=t.toLowerCase();return e.filter(e=>{const t=e.name?.toLowerCase().includes(a),o=e.summary.map(e=>e.text).join("").toLowerCase();return t||o.includes(a)})}(e,d),e},[n,m,r,d]),b=na(e=>{h(e)},[]),C=na(()=>{h(null)},[]);return t(Ss,{children:[e(hs,{title:a,titleTooltip:o,itemCount:n.length,searchValue:d,onSearchChange:u,typeFilter:m,onTypeFilterChange:g,showTypeFilter:r}),l?e(ks,{children:e(S,{title:"Loading rules...",withSpinner:!0})}):0===v.length?e(ks,{children:e(y,{title:f?"No matching rules":"No rules yet",subTitle:f?"Try adjusting your filters or search":"Create a rule to get started"})}):e(Cs,{children:v.map((t,a)=>e(bs,{item:t,isHovered:p===a,onClick:i,onEdit:s,onDelete:c,onMouseEnter:()=>b(a),onMouseLeave:C},t.ruleId))})]})};export{bo as AddActionDrawer,Ga as AddActionForm,ja as AddActionFormContextProvider,$o as AddDestinationDrawer,to as AddDestinationForm,Qa as AddDestinationFormContextProvider,Ro as AddRuleDrawer,mo as AddRuleForm,po as AddRuleFormContextProvider,_o as AddSourceDrawer,fo as AddSourceFormContextProvider,Ii as AutoRuleCard,qo as CATEGORY_TO_RULE_CATEGORY,Mi as CentralConnections,Yl as CreateSamplingRuleDrawer,gr as EditAutoRuleDrawer,Pr as EditConfigDrawer,Er as EditCostReductionAutoRuleDrawer,Cr as EditHighlyRelevantAutoRuleDrawer,qi as Onboarding,ds as PipelineCollectors,k as RichTitle,Wo as SAMPLING_CATEGORY_LIST_TITLES,Go as SAMPLING_CATEGORY_NOTES,Ko as SAMPLING_SEGMENT_OPTIONS,jo as SamplingCategory,ws as SamplingRulesList,Br as SystemDrawer,Ti as ViewSamplingRuleDrawer,Ql as buildAutoRuleSummary,nr as buildCostReductionAutoRuleSummary,tn as buildCostReductionSummary,tr as buildHighlyRelevantAutoRuleSummary,en as buildHighlyRelevantSummary,Zo as buildNoisySummary,on as buildSamplingRuleItems,nn as buildSummaryForRule,or as findCostReductionAutoRule,hn as findDuplicateRuleId,er as findHighlyRelevantAutoRule,Gl as formStateToCostReductionInput,Kl as formStateToHighlyRelevantInput,jl as formStateToNoisyInput,Xl as getDefaultFormState,an as getHighlyRelevantTypeBadge,sn as lookupViewRuleData,rn as refreshViewRuleData,Ka as useAddActionFormContext,Za as useAddDestinationFormContext,ho as useAddRuleFormContext,vo as useAddSourceFormContext,wi as viewRuleDataToFormState};
|