@odigos/ui-kit 0.0.217 → 0.0.219

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.
Files changed (109) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/lib/chunks/{index-eGTPcqRB.js → index-YIqbBRyO.js} +1 -1
  3. package/lib/chunks/ui-components-Dj10kYlT.js +2469 -0
  4. package/lib/components/_v2/autocomplete/index.d.ts +1 -0
  5. package/lib/components/_v2/button/index.d.ts +2 -0
  6. package/lib/components/_v2/cards/section-card/index.d.ts +1 -1
  7. package/lib/components/_v2/drawer/footer/index.d.ts +9 -0
  8. package/lib/components/_v2/drawer/index.d.ts +2 -0
  9. package/lib/components/_v2/hover-actions/index.d.ts +2 -0
  10. package/lib/components/_v2/note/index.d.ts +1 -0
  11. package/lib/components/_v2/radio/index.d.ts +1 -0
  12. package/lib/components/_v2/search/index.d.ts +6 -1
  13. package/lib/components/_v2/segment/index.d.ts +2 -1
  14. package/lib/components/_v2/table/index.d.ts +3 -1
  15. package/lib/components/_v2/table/styled.d.ts +2 -0
  16. package/lib/components/_v2/table/table-rows/index.d.ts +2 -1
  17. package/lib/components/_v2/table/types.d.ts +2 -0
  18. package/lib/components/styled.d.ts +3 -0
  19. package/lib/components/tooltip/index.d.ts +7 -0
  20. package/lib/components/v2.js +1 -1
  21. package/lib/components.js +1 -1
  22. package/lib/constants/index.d.ts +1 -0
  23. package/lib/constants/sampling/index.d.ts +87 -0
  24. package/lib/constants.js +1 -1
  25. package/lib/containers/_v2/_drawers/create-sampling-rule-drawer/index.d.ts +18 -4
  26. package/lib/containers/_v2/_drawers/edit-auto-rule-drawer/index.d.ts +7 -2
  27. package/lib/containers/_v2/_drawers/edit-cost-reduction-auto-rule-drawer/index.d.ts +7 -2
  28. package/lib/containers/_v2/_drawers/edit-highly-relevant-auto-rule-drawer/index.d.ts +6 -2
  29. package/lib/containers/_v2/_drawers/view-sampling-rule-drawer/index.d.ts +2 -4
  30. package/lib/containers/_v2/_forms/create-sampling-rule-form/context.d.ts +34 -0
  31. package/lib/containers/_v2/_forms/create-sampling-rule-form/index.d.ts +3 -0
  32. package/lib/containers/_v2/{_drawers/create-sampling-rule-drawer → _forms/create-sampling-rule-form}/sections/duration-errors.d.ts +1 -1
  33. package/lib/containers/_v2/{_drawers/create-sampling-rule-drawer → _forms/create-sampling-rule-form}/sections/operation.d.ts +1 -1
  34. package/lib/containers/_v2/{_drawers/create-sampling-rule-drawer → _forms/create-sampling-rule-form}/sections/percentage.d.ts +1 -1
  35. package/lib/containers/_v2/{_drawers/create-sampling-rule-drawer → _forms/create-sampling-rule-form}/sections/rule-info.d.ts +1 -1
  36. package/lib/containers/_v2/{_drawers/create-sampling-rule-drawer → _forms/create-sampling-rule-form}/sections/sampling-preview.d.ts +1 -1
  37. package/lib/containers/_v2/_forms/create-sampling-rule-form/styled.d.ts +5 -0
  38. package/lib/containers/_v2/{_drawers/create-sampling-rule-drawer → _forms/create-sampling-rule-form}/types.d.ts +1 -1
  39. package/lib/containers/_v2/_forms/edit-auto-rule-form/context.d.ts +21 -0
  40. package/lib/containers/_v2/_forms/edit-auto-rule-form/index.d.ts +3 -0
  41. package/lib/containers/_v2/_forms/edit-cost-reduction-auto-rule-form/context.d.ts +21 -0
  42. package/lib/containers/_v2/_forms/edit-cost-reduction-auto-rule-form/index.d.ts +3 -0
  43. package/lib/containers/_v2/_forms/edit-highly-relevant-auto-rule-form/context.d.ts +14 -0
  44. package/lib/containers/_v2/_forms/edit-highly-relevant-auto-rule-form/index.d.ts +3 -0
  45. package/lib/containers/_v2/_forms/index.d.ts +5 -0
  46. package/lib/containers/_v2/_forms/view-sampling-rule-form/context.d.ts +37 -0
  47. package/lib/containers/_v2/{_drawers/view-sampling-rule-drawer → _forms/view-sampling-rule-form}/footer.d.ts +3 -3
  48. package/lib/containers/_v2/_forms/view-sampling-rule-form/index.d.ts +3 -0
  49. package/lib/containers/_v2/{_drawers/view-sampling-rule-drawer → _forms/view-sampling-rule-form}/reverse-converters.d.ts +2 -2
  50. package/lib/containers/_v2/{_drawers/view-sampling-rule-drawer → _forms/view-sampling-rule-form}/sections/operation-details.d.ts +1 -1
  51. package/lib/containers/_v2/{_drawers/view-sampling-rule-drawer → _forms/view-sampling-rule-form}/sections/percentage.d.ts +1 -1
  52. package/lib/containers/_v2/{_drawers/view-sampling-rule-drawer → _forms/view-sampling-rule-form}/sections/rule-info.d.ts +1 -1
  53. package/lib/containers/_v2/{_drawers/view-sampling-rule-drawer → _forms/view-sampling-rule-form}/sections/sampling-preview.d.ts +2 -2
  54. package/lib/containers/_v2/index.d.ts +1 -2
  55. package/lib/containers/_v2/sampling-rules/auto-rule-card/index.d.ts +8 -0
  56. package/lib/containers/_v2/{sampling-rules-list → sampling-rules}/helpers.d.ts +23 -5
  57. package/lib/containers/_v2/sampling-rules/index.d.ts +3 -0
  58. package/lib/containers/_v2/sampling-rules/rules-table/index.d.ts +13 -0
  59. package/lib/containers/_v2/{sampling-rules-list/toolbar.d.ts → sampling-rules/toolbar/index.d.ts} +1 -1
  60. package/lib/containers/_v2/sampling-rules/types.d.ts +72 -0
  61. package/lib/containers/source-drawer/index.d.ts +5 -0
  62. package/lib/containers/source-drawer/profiling/flame-graph-canvas.d.ts +10 -0
  63. package/lib/containers/source-drawer/profiling/flamebearer.d.ts +70 -0
  64. package/lib/containers/source-drawer/profiling/index.d.ts +34 -0
  65. package/lib/containers/source-drawer/profiling/symbol-table.d.ts +6 -0
  66. package/lib/containers/v2.js +148 -341
  67. package/lib/containers.js +168 -120
  68. package/lib/contexts.js +1 -1
  69. package/lib/functions.js +1 -1
  70. package/lib/hooks/usePopup.d.ts +17 -1
  71. package/lib/hooks.js +1 -1
  72. package/lib/mock-data/index.d.ts +1 -0
  73. package/lib/mock-data/profiling/index.d.ts +10 -0
  74. package/lib/mock-data/service-map/index.d.ts +3 -1
  75. package/lib/snippets/_v2/colored-span/index.d.ts +16 -0
  76. package/lib/snippets/_v2/index.d.ts +1 -0
  77. package/lib/snippets/_v2/rich-title/index.d.ts +2 -2
  78. package/lib/snippets/v2.js +15 -17
  79. package/lib/snippets.js +1 -1
  80. package/lib/store.js +1 -1
  81. package/lib/theme.js +1 -1
  82. package/lib/types.js +1 -1
  83. package/lib/visuals.js +1 -1
  84. package/package.json +13 -13
  85. package/lib/chunks/ui-components-DaRAAytB.js +0 -2422
  86. package/lib/containers/_v2/_drawers/create-sampling-rule-drawer/constants.d.ts +0 -26
  87. package/lib/containers/_v2/_drawers/edit-auto-rule-drawer/constants.d.ts +0 -10
  88. package/lib/containers/_v2/_drawers/edit-auto-rule-drawer/types.d.ts +0 -8
  89. package/lib/containers/_v2/_drawers/edit-cost-reduction-auto-rule-drawer/constants.d.ts +0 -10
  90. package/lib/containers/_v2/_drawers/edit-cost-reduction-auto-rule-drawer/types.d.ts +0 -8
  91. package/lib/containers/_v2/_drawers/edit-highly-relevant-auto-rule-drawer/constants.d.ts +0 -6
  92. package/lib/containers/_v2/_drawers/edit-highly-relevant-auto-rule-drawer/types.d.ts +0 -6
  93. package/lib/containers/_v2/_drawers/view-sampling-rule-drawer/constants.d.ts +0 -19
  94. package/lib/containers/_v2/_drawers/view-sampling-rule-drawer/sections/styled.d.ts +0 -4
  95. package/lib/containers/_v2/_drawers/view-sampling-rule-drawer/types.d.ts +0 -1
  96. package/lib/containers/_v2/auto-rule-card/constants.d.ts +0 -1
  97. package/lib/containers/_v2/auto-rule-card/helpers.d.ts +0 -19
  98. package/lib/containers/_v2/auto-rule-card/index.d.ts +0 -5
  99. package/lib/containers/_v2/auto-rule-card/types.d.ts +0 -6
  100. package/lib/containers/_v2/sampling-rules-list/constants.d.ts +0 -23
  101. package/lib/containers/_v2/sampling-rules-list/index.d.ts +0 -6
  102. package/lib/containers/_v2/sampling-rules-list/rule-row.d.ts +0 -12
  103. package/lib/containers/_v2/sampling-rules-list/summary-span.d.ts +0 -10
  104. package/lib/containers/_v2/sampling-rules-list/types.d.ts +0 -47
  105. package/lib/containers/_v2/{_drawers/create-sampling-rule-drawer → _forms/create-sampling-rule-form}/converters.d.ts +0 -0
  106. package/lib/containers/_v2/{_drawers/create-sampling-rule-drawer → _forms/create-sampling-rule-form}/form-helpers.d.ts +0 -0
  107. package/lib/containers/_v2/{_drawers/create-sampling-rule-drawer → _forms/create-sampling-rule-form}/sections/source-scope.d.ts +1 -1
  108. /package/lib/containers/_v2/{_drawers/view-sampling-rule-drawer → _forms/view-sampling-rule-form}/sections/duration-errors.d.ts +0 -0
  109. /package/lib/containers/_v2/{_drawers/view-sampling-rule-drawer → _forms/view-sampling-rule-form}/sections/source-scopes.d.ts +0 -0
@@ -1,4 +1,4 @@
1
- import{jsxs as e,jsx as t,Fragment as a}from"react/jsx-runtime";import o,{useTheme as n}from"styled-components";import{F as l,c as r,d as i,T as s,e as c,h as d,f as u,i as p,j as h,I as m,k as g,l as f,m as v,K as y,n as b,o as S,p as C,D as k,q as w,B as x,a as T,r as N,s as D,t as A,v as I,N as E,w as R,x as $,y as P,z as O,E as M,G as F,H as L,J as z,L as X,M as V,O as _,P as B,Q as U,R as j,U as H,V as K,W as G,X as W,Y as q,Z as Y,_ as J,$ as Q,a0 as Z,a1 as ee,a2 as te,a3 as ae,a4 as oe,a5 as ne,a6 as le,a7 as re,a8 as ie,a9 as se,aa as ce,ab as de,b as ue,ac as pe,ad as he,ae as me,af as ge,ag as fe,ah as ve,ai as ye,aj as be,ak as Se,al as Ce,am as ke,an as we,ao as xe,ap as Te,aq as Ne,ar as De,as as Ae,at as Ie,au as Ee,av as Re,aw as $e,ax as Pe,u as Oe,ay as Me,az as Fe,aA as Le,S as ze,aB as Xe,aC as Ve,aD as _e,g as Be,aE as Ue,A as je,aF as He,aG as Ke,aH as Ge,aI as We,aJ as qe,aK as Ye,aL as Je,aM as Qe,aN as Ze,aO as et,aP as tt,aQ as at,aR as ot,aS as nt,aT as lt,aU as rt,aV as it,aW as st}from"../chunks/ui-components-DaRAAytB.js";import{ChevronRightIcon as ct,TrashIcon as dt,PlusIcon as ut,BookIcon as pt,VSquareIcon as ht,XSquareIcon as mt,DeleteIcon as gt,EditIcon as ft,GoLogo as vt,JavaLogo as yt,ActionIcon as bt,DestinationIcon as St,ChevronUpIcon as Ct,ChevronDownIcon as kt,VIcon as wt,XIcon as xt,InstrumentationRuleIcon as Tt,SourceIcon as Nt,SamplingIcon as Dt,SettingsIcon as At,ExclamationTriangleIcon as It,ExclamationCircleIcon as Et,KeyIcon as Rt,DiagnoseIcon as $t,DownloadIcon as Pt,TerminalIcon as Ot,RefreshIcon as Mt,ConnectionsIcon as Ft,OdigosLogo as Lt,ArrowRightIcon as zt,PodIcon as Xt,ArrowDownSquareIcon as Vt,ArrowUpSquareIcon as _t,PipelineCollectorIcon as Bt,GatewayIcon as Ut,YamlIcon as jt}from"../icons.js";import{useEffect as Ht,Fragment as Kt,useState as Gt,useCallback as Wt,useContext as qt,createContext as Yt,useMemo as Jt,useRef as Qt,Children as Zt}from"react";import{SignalsCheckboxList as ea,DynamicField as ta,WideDrawer as aa,WIDE_DRAWER_WIDTH as oa,DeleteModal as na,OdigosLogoTextByTier as la,UpgradeModal as ra}from"../snippets/v2.js";import{Y as ia}from"../chunks/index-eGTPcqRB.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 sa=o.div`
1
+ import{jsxs as e,jsx as t,Fragment as a}from"react/jsx-runtime";import{useEffect as n,Fragment as o,useState as l,useCallback as r,useContext as i,createContext as s,useMemo as c,useRef as d,Children as u}from"react";import p,{useTheme as m}from"styled-components";import{F as h,c as g,d as f,T as v,e as b,h as y,f as S,i as C,j as k,I as w,k as T,l as x,m as D,K as N,n as A,o as I,p as E,D as R,q as P,B as $,a as O,r as M,s as F,t as L,v as z,N as V,w as X,x as B,y as _,z as U,E as j,G as H,H as W,J as K,L as G,M as q,O as Y,P as J,Q,R as Z,U as ee,V as te,W as ae,X as ne,Y as oe,Z as le,_ as re,$ as ie,a0 as se,a1 as ce,a2 as de,a3 as ue,a4 as pe,a5 as me,a6 as he,a7 as ge,a8 as fe,a9 as ve,S as be,aa as ye,ab as Se,ac as Ce,ad as ke,ae as we,af as Te,ag as xe,ah as De,ai as Ne,aj as Ae,ak as Ie,al as Ee,am as Re,an as Pe,ao as $e,ap as Oe,aq as Me,ar as Fe,as as Le,at as ze,au as Ve,av as Xe,aw as Be,ax as _e,ay as Ue,az as je,aA as He,aB as We,aC as Ke,aD as Ge,aE as qe,aF as Ye,aG as Je,aH as Qe,aI as Ze,aJ as et,aK as tt,aL as at,aM as nt,aN as ot,aO as lt,aP as rt,aQ as it,aR as st,aS as ct,aT as dt,aU as ut,aV as pt,aW as mt,aX as ht,aY as gt,aZ as ft,a_ as vt,a$ as bt,b0 as yt,b1 as St,b2 as Ct,b3 as kt,b4 as wt,b5 as Tt,b6 as xt,b7 as Dt,b8 as Nt,b9 as At,ba as It,b as Et,bb as Rt,bc as Pt,bd as $t,be as Ot,bf as Mt,bg as Ft,bh as Lt,bi as zt,bj as Vt,bk as Xt,bl as Bt,bm as _t,bn as Ut,bo as jt,bp as Ht,bq as Wt,br as Kt,bs as Gt,bt as qt,bu as Yt,bv as Jt,bw as Qt,bx as Zt,by as ea,bz as ta,bA as aa,bB as na,bC as oa,u as la,bD as ra,bE as ia,bF as sa,bG as ca,bH as da,bI as ua,g as pa,bJ as ma,bK as ha,bL as ga,bM as fa,bN as va,A as ba,bO as ya,bP as Sa,bQ as Ca,bR as ka,bS as wa,bT as Ta,bU as xa,bV as Da,bW as Na,bX as Aa,bY as Ia,bZ as Ea,b_ as Ra,b$ as Pa,c0 as $a,c1 as Oa,c2 as Ma,c3 as Fa,c4 as La,c5 as za,c6 as Va,c7 as Xa,c8 as Ba,c9 as _a,ca as Ua,cb as ja,cc as Ha,cd as Wa,ce as Ka,cf as Ga,cg as qa}from"../chunks/ui-components-Dj10kYlT.js";import{ChevronRightIcon as Ya,TrashIcon as Ja,PlusIcon as Qa,BookIcon as Za,VSquareIcon as en,XSquareIcon as tn,DeleteIcon as an,EditIcon as nn,GoLogo as on,JavaLogo as ln,XIcon as rn,ActionIcon as sn,DestinationIcon as cn,ChevronUpIcon as dn,ChevronDownIcon as un,VIcon as pn,InstrumentationRuleIcon as mn,SourceIcon as hn,SamplingIcon as gn,SettingsIcon as fn,ExclamationTriangleIcon as vn,ExclamationCircleIcon as bn,KeyIcon as yn,DiagnoseIcon as Sn,DownloadIcon as Cn,TerminalIcon as kn,RefreshIcon as wn,ConnectionsIcon as Tn,OdigosLogo as xn,ArrowRightIcon as Dn,PodIcon as Nn,ArrowDownSquareIcon as An,ArrowUpSquareIcon as In,PipelineCollectorIcon as En,GatewayIcon as Rn,YamlIcon as Pn}from"../icons.js";import{SignalsCheckboxList as $n,DynamicField as On,ColoredSpanVariant as Mn,ColoredSpan as Fn,WideDrawer as Ln,WIDE_DRAWER_WIDTH as zn,DeleteModal as Vn,OdigosLogoTextByTier as Xn,UpgradeModal as Bn}from"../snippets/v2.js";import{Y as _n}from"../chunks/index-YIqbBRyO.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 Un=p.div`
2
2
  display: flex;
3
3
  align-items: center;
4
4
  justify-content: space-between;
@@ -11,117 +11,68 @@ import{jsxs as e,jsx as t,Fragment as a}from"react/jsx-runtime";import o,{useThe
11
11
  &:hover {
12
12
  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]};
13
13
  }
14
- `,ca=o.div`
14
+ `,jn=p.div`
15
15
  display: flex;
16
16
  align-items: center;
17
17
  justify-content: center;
18
18
  padding: 8px;
19
19
  border-radius: 8px;
20
- background-color: ${({theme:e})=>e.v2.colors.white[500]+d["004"]};
21
- `,da=({dataId:a,icon:o,title:d,description:u,withCarret:p,purpleColors:h,disabled:m,children:g,isSelected:f,onClick:v,isChecked:y,isPartiallyChecked:b,onCheckboxChange:S})=>{const C=n();return e(sa,{"data-id":a||`list-item-${d}`,$isSelected:f,$purpleColors:h,$disabled:m,onClick:()=>!f&&!m&&v(),children:[e(l,{$gap:4,children:[e(r,{$gap:12,children:[S&&t(i,{partiallyChecked:b||!1,value:y||!1,onChange:e=>S(e)}),o&&t(ca,{children:t(o,{size:20})}),t(s,{size:c.XS,children:d})]}),u&&t(s,{size:c.XXXS,color:C.v2.colors.silver[200],children:u})]}),(p||g)&&e(r,{$gap:8,children:[g,p&&t(ct,{size:18})]})]})},ua=[{id:"CREDIT_CARD",label:"Credit card"}],pa=[{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"}],ha=[{id:y.Pod,label:y.Pod},{id:y.Namespace,label:y.Namespace},{id:y.Node,label:y.Node}],ma=[{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:ha}],ga=[{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:ha}],fa=[{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:g.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:g.Number}],va=u.UrlTemplatizationRulesGroups,ya=[{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"}],ba=[{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:g.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:g.Number}],Sa=[{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:g.Number},{label:"Condition",keyName:"condition",tooltip:"An object representing the filters for span attributes filters.",componentType:N.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:N.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}],Ca={[D.K8sAttributes]:({value:o,setValue:n,formErrors:r})=>(Ht(()=>{o[u.CollectContainerAttributes]||o[u.CollectReplicaSetAttributes]||o[u.CollectWorkloadId]||o[u.CollectClusterId]||o[u.LabelsAttributes]?.length||o[u.AnnotationsAttributes]?.length||(n(u.CollectContainerAttributes,!0),n(u.CollectReplicaSetAttributes,!0),n(u.CollectWorkloadId,!0),n(u.CollectClusterId,!0),n(u.LabelsAttributes,[]),n(u.AnnotationsAttributes,[]))},[]),e(a,{children:[t(l,{$gap:6,children:pa.map(({id:a,label:s})=>e(l,{children:[t(i,{label:s,value:o[a]||!1,onChange:e=>n(a,e)}),t(h,{errorMessage:r[a]})]},a))}),t(v,{name:"labelsAttributes",label:"Label attributes",limitFieldsPerRow:2,columns:ma,values:o[u.LabelsAttributes]||[],setValues:e=>n(u.LabelsAttributes,e),errorMessage:r[u.LabelsAttributes]}),t(v,{name:"annotationsAttributes",label:"Annotation attributes",limitFieldsPerRow:2,columns:ga,values:o[u.AnnotationsAttributes]||[],setValues:e=>n(u.AnnotationsAttributes,e),errorMessage:r[u.AnnotationsAttributes]})]})),[D.AddClusterInfo]:({value:o,setValue:l,formErrors:r})=>{const i=n();return e(a,{children:[t(b,{label:"Overwrite existing values",labelAlign:S.Left,labelColor:i.v2.colors.silver[200],tooltip:"If enabled, the resource attributes will overwrite any existing attributes with the same name.",value:o[u.OverwriteExistingValues]||!1,onChange:e=>l(u.OverwriteExistingValues,e)}),t(v,{name:"clusterAttributes",label:"Resource attributes",limitFieldsPerRow:2,columns:[{keyName:"attributeName",label:"Attribute name"},{keyName:"attributeStringValue",label:"Attribute value"}],values:o[u.ClusterAttributes]||[],setValues:e=>l(u.ClusterAttributes,e),errorMessage:r[u.ClusterAttributes]})]})},[D.DeleteAttributes]:({value:e,setValue:a,formErrors:o})=>t(C,{name:"attributeNamesToDelete",label:"Attributes to delete",values:e[u.AttributeNamesToDelete]||[],setValues:e=>a(u.AttributeNamesToDelete,e),errorMessage:o[u.AttributeNamesToDelete]}),[D.RenameAttributes]:({value:e,setValue:a,formErrors:o})=>t(v,{name:"renames",label:"Attributes to rename",limitFieldsPerRow:2,columns:[{keyName:"oldKey",label:"Old key"},{keyName:"newKey",label:"New key"}],values:Object.entries(e[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:o[u.Renames]}),[D.PiiMasking]:({value:a,setValue:o,formErrors:n})=>(Ht(()=>{a[u.PiiCategories]?.length||o(u.PiiCategories,ua.map(({id:e})=>e))},[]),e(l,{$gap:12,children:[t(p,{label:"Attributes to mask"}),t(l,{$gap:6,children:ua.map(({id:e,label:n})=>t(i,{label:n,value:a[u.PiiCategories]?.includes(e)||!1,onChange:t=>{const n=a[u.PiiCategories]||[],l=t?[...n,e]:n.filter(t=>t!==e);o(u.PiiCategories,l)}},e))}),t(h,{errorMessage:n[u.PiiCategories]})]})),[D.ErrorSampler]:({value:e,setValue:a,formErrors:o})=>{const n=o[u.FallbackSamplingRatio],l=f(e[u.FallbackSamplingRatio])?"":String(e[u.FallbackSamplingRatio]);return t(m,{name:"fallbackSamplingRatio",label:"Fallback sampling ratio",type:g.Number,min:0,max:100,value:l,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:n})},[D.ProbabilisticSampler]:({value:e,setValue:a,formErrors:o})=>{const n=o[u.SamplingPercentage],l=f(e[u.SamplingPercentage])?"":String(e[u.SamplingPercentage]);return t(m,{name:"samplingPercentage",label:"Sampling percentage",type:g.Number,min:0,max:100,value:l,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:n})},[D.LatencySampler]:({value:e,setValue:a,formErrors:o})=>{const n=o[u.EndpointsFilters],l=e[u.EndpointsFilters]||[];return t(v,{name:"endpointsFilters",limitFieldsPerRow:2,columns:fa,values:l,setValues:e=>{a(u.EndpointsFilters,e.map(({serviceName:e,httpRoute:t,minimumLatencyThreshold:a,fallbackSamplingRatio:o})=>({serviceName:e,httpRoute:t,minimumLatencyThreshold:Number(a),fallbackSamplingRatio:Number(o)})))},errorMessage:n})},[D.ServiceNameSampler]:({value:e,setValue:a,formErrors:o})=>{const n=o[u.ServicesNameFilters],l=e[u.ServicesNameFilters]||[];return t(v,{name:"servicesNameFilters",limitFieldsPerRow:2,columns:ba,values:l,setValues:e=>{a(u.ServicesNameFilters,e.map(({serviceName:e,samplingRatio:t,fallbackSamplingRatio:a})=>({serviceName:e,samplingRatio:Number(t),fallbackSamplingRatio:Number(a)})))},errorMessage:n})},[D.SpanAttributeSampler]:({value:e,setValue:a,formErrors:o})=>{const n=o[u.AttributeFilters],l=(e[u.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 t(v,{name:"attributeFilters",limitFieldsPerRow:2,columns:Sa,values:l,setValues:e=>{a(u.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})},[D.URLTemplatization]:({value:o,setValue:i,formErrors:s})=>{const c=n(),d=o[va]||[{filterK8sNamespace:"",workloadFilters:[],templatizationRules:[{template:""}],notes:""}],u=e=>i(va,e),g=(e,t)=>u(d.map((a,o)=>o===e?{...a,...t}:a));return e(a,{children:[d.map((a,o)=>e(Kt,{children:[t(k,{}),e(l,{$gap:12,children:[e(r,{$justifyContent:"space-between",$alignItems:"center",children:[t(p,{label:`Rule Group ${o+1}`}),t(w,{leftIcon:()=>t(dt,{fill:c.v2.colors.red[500]}),variant:T.Secondary,size:x.S,onClick:()=>{return e=o,u(d.filter((t,a)=>a!==e));var e},disabled:1===d.length})]}),t(m,{name:`urlGroup-${o}-namespace`,label:"Namespace",placeholder:"All namespaces",tooltip:"Filter rules to a specific Kubernetes namespace.",value:a.filterK8sNamespace||"",onChange:e=>g(o,{filterK8sNamespace:e.target.value})}),t(v,{name:`urlGroup-${o}-workloadFilters`,label:"Workload filters",tooltip:"Optionally scope templates to specific workloads.",columns:ya,values:a.workloadFilters||[],setValues:e=>g(o,{workloadFilters:e})}),t(C,{name:`urlGroup-${o}-templates`,label:"Templates",required:!0,placeholder:"e.g. /user/{id}",values:a.templatizationRules.map(e=>e.template),setValues:e=>g(o,{templatizationRules:e.map(e=>({template:e}))})})]}),t(h,{errorMessage:s[va]})]},`url-templatization-group-${o}`)),t(w,{variant:T.Secondary,label:"Add rule group",leftIcon:ut,onClick:()=>u([...d,{filterK8sNamespace:"",workloadFilters:[],templatizationRules:[{template:""}],notes:""}])}),t(k,{})]})}},ka=({actionType:e,value:a,setValue:o,formErrors:n})=>{if(!e)return null;const l=Ca[e];return l?t(l,{value:a,setValue:o,formErrors:n}):null},wa={type:"",disabled:!1,name:"",notes:"",signals:[],fields:{}},xa=Yt({selectedOption:null,onSelectOption:()=>{},genericForm:void 0,validateFormData:()=>({preparedFormData:I(wa)}),errorMessage:void 0}),Ta=({children:e})=>{const[a,o]=Gt(null),[n,l]=Gt(void 0),r=A(wa),i=Wt(e=>{r.resetFormData(),r.handleErrorChange(void 0,void 0,{}),l(void 0),e?.type&&r.handleFormChange("type",e.type),o(e)},[]),s=Wt(()=>{if(!a)return{errorMessage:"No action type selected",preparedFormData:I(wa)};const e=(t=r.formData,I(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 t(xa.Provider,{value:{selectedOption:a,onSelectOption:i,genericForm:r,validateFormData:s,errorMessage:n},children:e})},Na=()=>qt(xa),Da=()=>{const a=n(),{selectedOption:o,genericForm:i}=Na();if(!i||!o)return t(E,{title:"No active form"});const{formData:d,handleFormChange:u,formErrors:p}=i;return e(l,{$gap:24,children:[e(r,{$gap:12,$justifyContent:"space-between",children:[t(s,{size:c.XXS,children:o.docsDescription}),t(w,{label:"Docs",leftIcon:pt,variant:T.Text,size:x.S,onClick:()=>window.open(`${R}${o.docsEndpoint}`,"_blank","noopener noreferrer")})]}),t($,{options:[{icon:ht,label:"Enabled",value:!1,selectedBgColor:a.v2.colors.green[800]},{icon:mt,label:"Disabled",value:!0,selectedBgColor:a.v2.colors.red[800]}],selected:d.disabled,setSelected:e=>u("disabled",e)}),t(ea,{title:"Signals for processing",allowedSignals:o.allowedSignals,selectedSignals:d.signals||[],setSelectedSignals:e=>u("signals",e),errorMessage:p.signals}),t(m,{name:"actionName",label:"Action name",placeholder:"Use a name that describes the action...",value:d.name||"",onChange:({target:{value:e}})=>u("name",e),errorMessage:p.name}),t(ka,{actionType:o.type,value:d.fields,setValue:(e,t)=>u(`fields.${e}`,t),formErrors:p}),t(P,{name:"notes",label:"Notes",placeholder:"Your personal notes...",value:d.notes||"",onChange:({target:{value:e}})=>u("notes",e),errorMessage:p.notes})]})},Aa=({signals:e,fields:a,disabled:o,formData:n,handleFormChange:l,formErrors:r})=>a?.map(({renderCondition:a,componentType:i,type:s,name:c,title:d,tooltip:u,placeholder:p,value:h,required:m,options:g})=>{if(!(!a||O(a,e,n.fields)))return null;const f=c,v=n.fields.find(e=>e.key===f),y=v?v.value:h;return t(ta,{componentType:i,inputType:s,name:f,label:d,tooltip:u,disabled:o,required:m,placeholder:p,errorMessage:r[f],dropdownOptions:g,value:y||"",setValue:e=>l(f,e)},f)}),Ia={type:"",name:"",currentStreamName:"",disabled:!1,exportedSignals:{logs:!1,metrics:!1,traces:!1},fields:[]},Ea={activeForm:null,onChangeActiveForm:()=>{},genericForm:void 0,formErrorMessage:void 0,validateFormData:()=>({isOk:!1,preparedFormData:I(Ia)}),unsavedDestinations:[],thisUnsavedDestination:void 0,setUnsavedDestinations:()=>{},addUnsavedDestination:()=>{},updateUnsavedDestination:()=>{},deleteUnsavedDestination:()=>{}},Ra=Yt(Ea),$a=({children:e})=>{const{selectedStreamName:a}=M(),[o,n]=Gt(null),[l,r]=Gt(),[i,s]=Gt(Ea.unsavedDestinations),c=Jt(()=>"number"==typeof o?.unsavedIdx?i[o.unsavedIdx]:void 0,[o,i]),d=Wt((e,t)=>{o&&(s(t=>[...t,{...e,option:o.option}]),n(t?e=>e?{...e,listType:F.UNSAVED,unsavedIdx:i.length}:null:null))},[o,i.length]),u=Wt((e,t,a)=>{o&&(s(a=>a.map((a,n)=>n===e?{...a,...t,option:o.option}:a)),n(a?e=>e?{...e,listType:F.UNSAVED}:null:null))},[o]),p=Wt(e=>{s(t=>t.filter((t,a)=>a!==e)),n(null)},[]),h=A({...Ia,currentStreamName:a});Ht(()=>{if(o)if(c)h.handleFormChange(void 0,void 0,c.formData);else{h.handleFormChange("type",o.option.type),h.handleFormChange("name",o.option.displayName),h.handleFormChange("disabled",!1);const e=L(o.option.supportedSignals);h.handleFormChange("exportedSignals",{logs:e.includes(z.Logs),metrics:e.includes(z.Metrics),traces:e.includes(z.Traces)}),h.handleFormChange("fields",o.dynamicFields.map(e=>({key:e.name,value:e.value})))}},[o,c]);const m=Wt(e=>{var t;h.resetFormData(),h.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===N.Dropdown,s=V(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)},[]),g=Wt(()=>{const e=I(h.formData),t={};o?.dynamicFields.forEach(({name:a,required:o})=>{if(o){const o=e.fields.find(e=>e.key===a)?.value;f(o)&&(t[a]=_.FIELD_IS_REQUIRED)}});X(e.exportedSignals).length||(t.exportedSignals=_.FIELD_IS_REQUIRED);const a=0===Object.keys(t).length?void 0:"Invalid form values";return h.handleErrorChange(void 0,void 0,t),r(a),{errorMessage:a,preparedFormData:e}},[h,o]);return t(Ra.Provider,{value:{activeForm:o,onChangeActiveForm:m,genericForm:h,formErrorMessage:l,validateFormData:g,unsavedDestinations:i,thisUnsavedDestination:c,setUnsavedDestinations:s,addUnsavedDestination:d,updateUnsavedDestination:u,deleteUnsavedDestination:p},children:e})},Pa=()=>qt(Ra),Oa=o(r)`
20
+ background-color: ${({theme:e})=>e.v2.colors.white[500]+y["004"]};
21
+ `,Hn=({dataId:a,icon:n,title:o,description:l,withCarret:r,purpleColors:i,disabled:s,children:c,isSelected:d,onClick:u,isChecked:p,isPartiallyChecked:y,onCheckboxChange:S})=>{const C=m();return e(Un,{"data-id":a||`list-item-${o}`,$isSelected:d,$purpleColors:i,$disabled:s,onClick:()=>!d&&!s&&u(),children:[e(h,{$gap:4,children:[e(g,{$gap:12,children:[S&&t(f,{partiallyChecked:y||!1,value:p||!1,onChange:e=>S(e)}),n&&t(jn,{children:t(n,{size:20})}),t(v,{size:b.XS,children:o})]}),l&&t(v,{size:b.XXXS,color:C.v2.colors.silver[200],children:l})]}),(r||c)&&e(g,{$gap:8,children:[c,r&&t(Ya,{size:18})]})]})},Wn=[{id:"CREDIT_CARD",label:"Credit card"}],Kn=[{id:S.CollectContainerAttributes,label:"Collect container attributes"},{id:S.CollectReplicaSetAttributes,label:"Collect ReplicaSet attributes"},{id:S.CollectWorkloadId,label:"Collect workload ID"},{id:S.CollectClusterId,label:"Collect cluster ID"}],Gn=[{id:N.Pod,label:N.Pod},{id:N.Namespace,label:N.Namespace},{id:N.Node,label:N.Node}],qn=[{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:Gn}],Yn=[{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:Gn}],Jn=[{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:T.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:T.Number}],Qn=S.UrlTemplatizationRulesGroups,Zn=[{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"}],eo=[{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:T.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:T.Number}],to=[{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:T.Number},{label:"Condition",keyName:"condition",tooltip:"An object representing the filters for span attributes filters.",componentType:M.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:M.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}],ao={[F.K8sAttributes]:({value:o,setValue:l,formErrors:r})=>(n(()=>{o[S.CollectContainerAttributes]||o[S.CollectReplicaSetAttributes]||o[S.CollectWorkloadId]||o[S.CollectClusterId]||o[S.LabelsAttributes]?.length||o[S.AnnotationsAttributes]?.length||(l(S.CollectContainerAttributes,!0),l(S.CollectReplicaSetAttributes,!0),l(S.CollectWorkloadId,!0),l(S.CollectClusterId,!0),l(S.LabelsAttributes,[]),l(S.AnnotationsAttributes,[]))},[]),e(a,{children:[t(h,{$gap:6,children:Kn.map(({id:a,label:n})=>e(h,{children:[t(f,{label:n,value:o[a]||!1,onChange:e=>l(a,e)}),t(k,{errorMessage:r[a]})]},a))}),t(D,{name:"labelsAttributes",label:"Label attributes",limitFieldsPerRow:2,columns:qn,values:o[S.LabelsAttributes]||[],setValues:e=>l(S.LabelsAttributes,e),errorMessage:r[S.LabelsAttributes]}),t(D,{name:"annotationsAttributes",label:"Annotation attributes",limitFieldsPerRow:2,columns:Yn,values:o[S.AnnotationsAttributes]||[],setValues:e=>l(S.AnnotationsAttributes,e),errorMessage:r[S.AnnotationsAttributes]})]})),[F.AddClusterInfo]:({value:n,setValue:o,formErrors:l})=>{const r=m();return e(a,{children:[t(A,{label:"Overwrite existing values",labelAlign:I.Left,labelColor:r.v2.colors.silver[200],tooltip:"If enabled, the resource attributes will overwrite any existing attributes with the same name.",value:n[S.OverwriteExistingValues]||!1,onChange:e=>o(S.OverwriteExistingValues,e)}),t(D,{name:"clusterAttributes",label:"Resource attributes",limitFieldsPerRow:2,columns:[{keyName:"attributeName",label:"Attribute name"},{keyName:"attributeStringValue",label:"Attribute value"}],values:n[S.ClusterAttributes]||[],setValues:e=>o(S.ClusterAttributes,e),errorMessage:l[S.ClusterAttributes]})]})},[F.DeleteAttributes]:({value:e,setValue:a,formErrors:n})=>t(E,{name:"attributeNamesToDelete",label:"Attributes to delete",values:e[S.AttributeNamesToDelete]||[],setValues:e=>a(S.AttributeNamesToDelete,e),errorMessage:n[S.AttributeNamesToDelete]}),[F.RenameAttributes]:({value:e,setValue:a,formErrors:n})=>t(D,{name:"renames",label:"Attributes to rename",limitFieldsPerRow:2,columns:[{keyName:"oldKey",label:"Old key"},{keyName:"newKey",label:"New key"}],values:Object.entries(e[S.Renames]||{}).map(([e,t])=>({oldKey:e,newKey:t})),setValues:e=>{const t={};e.forEach(e=>t[e.oldKey]=e.newKey),a(S.Renames,t)},errorMessage:n[S.Renames]}),[F.PiiMasking]:({value:a,setValue:o,formErrors:l})=>(n(()=>{a[S.PiiCategories]?.length||o(S.PiiCategories,Wn.map(({id:e})=>e))},[]),e(h,{$gap:12,children:[t(C,{label:"Attributes to mask"}),t(h,{$gap:6,children:Wn.map(({id:e,label:n})=>t(f,{label:n,value:a[S.PiiCategories]?.includes(e)||!1,onChange:t=>{const n=a[S.PiiCategories]||[],l=t?[...n,e]:n.filter(t=>t!==e);o(S.PiiCategories,l)}},e))}),t(k,{errorMessage:l[S.PiiCategories]})]})),[F.ErrorSampler]:({value:e,setValue:a,formErrors:n})=>{const o=n[S.FallbackSamplingRatio],l=x(e[S.FallbackSamplingRatio])?"":String(e[S.FallbackSamplingRatio]);return t(w,{name:"fallbackSamplingRatio",label:"Fallback sampling ratio",type:T.Number,min:0,max:100,value:l,placeholder:"0-100",onChange:e=>{return t=e.target.value,a(S.FallbackSamplingRatio,Math.max(0,Math.min(Number(t),100))||0);var t},errorMessage:o})},[F.ProbabilisticSampler]:({value:e,setValue:a,formErrors:n})=>{const o=n[S.SamplingPercentage],l=x(e[S.SamplingPercentage])?"":String(e[S.SamplingPercentage]);return t(w,{name:"samplingPercentage",label:"Sampling percentage",type:T.Number,min:0,max:100,value:l,placeholder:"0-100",onChange:e=>{return t=e.target.value,a(S.SamplingPercentage,Math.max(0,Math.min(Number(t),100))||0);var t},errorMessage:o})},[F.LatencySampler]:({value:e,setValue:a,formErrors:n})=>{const o=n[S.EndpointsFilters],l=e[S.EndpointsFilters]||[];return t(D,{name:"endpointsFilters",limitFieldsPerRow:2,columns:Jn,values:l,setValues:e=>{a(S.EndpointsFilters,e.map(({serviceName:e,httpRoute:t,minimumLatencyThreshold:a,fallbackSamplingRatio:n})=>({serviceName:e,httpRoute:t,minimumLatencyThreshold:Number(a),fallbackSamplingRatio:Number(n)})))},errorMessage:o})},[F.ServiceNameSampler]:({value:e,setValue:a,formErrors:n})=>{const o=n[S.ServicesNameFilters],l=e[S.ServicesNameFilters]||[];return t(D,{name:"servicesNameFilters",limitFieldsPerRow:2,columns:eo,values:l,setValues:e=>{a(S.ServicesNameFilters,e.map(({serviceName:e,samplingRatio:t,fallbackSamplingRatio:a})=>({serviceName:e,samplingRatio:Number(t),fallbackSamplingRatio:Number(a)})))},errorMessage:o})},[F.SpanAttributeSampler]:({value:e,setValue:a,formErrors:n})=>{const o=n[S.AttributeFilters],l=(e[S.AttributeFilters]||[]).map(({serviceName:e,attributeKey:t,fallbackSamplingRatio:a,condition:n})=>{const o=Object.entries(n).filter(([e,t])=>t)[0][0];return{serviceName:e,attributeKey:t,fallbackSamplingRatio:a,condition:o,operation:n[o]?.operation,expectedValue:n[o]?.expectedValue,jsonPath:n[o]?.jsonPath}});return t(D,{name:"attributeFilters",limitFieldsPerRow:2,columns:to,values:l,setValues:e=>{a(S.AttributeFilters,e.map(({serviceName:e,attributeKey:t,fallbackSamplingRatio:a,condition:n,operation:o,expectedValue:l,jsonPath:r})=>{const i={serviceName:e,attributeKey:t,fallbackSamplingRatio:Number(a),condition:{[n]:{operation:o,expectedValue:l}}};return r&&(i.condition[n].jsonPath=r),i}))},errorMessage:o})},[F.URLTemplatization]:({value:n,setValue:l,formErrors:r})=>{const i=m(),s=n[Qn]||[{filterK8sNamespace:"",workloadFilters:[],templatizationRules:[{template:""}],notes:""}],c=e=>l(Qn,e),d=(e,t)=>c(s.map((a,n)=>n===e?{...a,...t}:a));return e(a,{children:[s.map((a,n)=>e(o,{children:[t(R,{}),e(h,{$gap:12,children:[e(g,{$justifyContent:"space-between",$alignItems:"center",children:[t(C,{label:`Rule Group ${n+1}`}),t(P,{leftIcon:()=>t(Ja,{fill:i.v2.colors.red[500]}),variant:O.Secondary,size:$.S,onClick:()=>{return e=n,c(s.filter((t,a)=>a!==e));var e},disabled:1===s.length})]}),t(w,{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})}),t(D,{name:`urlGroup-${n}-workloadFilters`,label:"Workload filters",tooltip:"Optionally scope templates to specific workloads.",columns:Zn,values:a.workloadFilters||[],setValues:e=>d(n,{workloadFilters:e})}),t(E,{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}))})})]}),t(k,{errorMessage:r[Qn]})]},`url-templatization-group-${n}`)),t(P,{variant:O.Secondary,label:"Add rule group",leftIcon:Qa,onClick:()=>c([...s,{filterK8sNamespace:"",workloadFilters:[],templatizationRules:[{template:""}],notes:""}])}),t(R,{})]})}},no=({actionType:e,value:a,setValue:n,formErrors:o})=>{if(!e)return null;const l=ao[e];return l?t(l,{value:a,setValue:n,formErrors:o}):null},oo={type:"",disabled:!1,name:"",notes:"",signals:[],fields:{}},lo=s({selectedOption:null,onSelectOption:()=>{},genericForm:void 0,validateFormData:()=>({preparedFormData:z(oo)}),errorMessage:void 0}),ro=({children:e})=>{const[a,n]=l(null),[o,i]=l(void 0),s=L(oo),c=r(e=>{s.resetFormData(),s.handleErrorChange(void 0,void 0,{}),i(void 0),e?.type&&s.handleFormChange("type",e.type),n(e)},[]),d=r(()=>{if(!a)return{errorMessage:"No action type selected",preparedFormData:z(oo)};const e=(t=s.formData,z(t));var t;const n={};s.handleErrorChange(void 0,void 0,n);const o=Object.keys(n).length>0?"Invalid form values":void 0;return i(o),{errorMessage:o,preparedFormData:e}},[s,a]);return t(lo.Provider,{value:{selectedOption:a,onSelectOption:c,genericForm:s,validateFormData:d,errorMessage:o},children:e})},io=()=>i(lo),so=()=>{const a=m(),{selectedOption:n,genericForm:o}=io();if(!o||!n)return t(V,{title:"No active form"});const{formData:l,handleFormChange:r,formErrors:i}=o;return e(h,{$gap:24,children:[e(g,{$gap:12,$justifyContent:"space-between",children:[t(v,{size:b.XXS,children:n.docsDescription}),t(P,{label:"Docs",leftIcon:Za,variant:O.Text,size:$.S,onClick:()=>window.open(`${X}${n.docsEndpoint}`,"_blank","noopener noreferrer")})]}),t(B,{options:[{icon:en,label:"Enabled",value:!1,selectedBgColor:a.v2.colors.green[800]},{icon:tn,label:"Disabled",value:!0,selectedBgColor:a.v2.colors.red[800]}],selected:l.disabled,setSelected:e=>r("disabled",e)}),t($n,{title:"Signals for processing",allowedSignals:n.allowedSignals,selectedSignals:l.signals||[],setSelectedSignals:e=>r("signals",e),errorMessage:i.signals}),t(w,{name:"actionName",label:"Action name",placeholder:"Use a name that describes the action...",value:l.name||"",onChange:({target:{value:e}})=>r("name",e),errorMessage:i.name}),t(no,{actionType:n.type,value:l.fields,setValue:(e,t)=>r(`fields.${e}`,t),formErrors:i}),t(_,{name:"notes",label:"Notes",placeholder:"Your personal notes...",value:l.notes||"",onChange:({target:{value:e}})=>r("notes",e),errorMessage:i.notes})]})},co=({signals:e,fields:a,disabled:n,formData:o,handleFormChange:l,formErrors:r})=>a?.map(({renderCondition:a,componentType:i,type:s,name:c,title:d,tooltip:u,placeholder:p,value:m,required:h,options:g})=>{if(!(!a||U(a,e,o.fields)))return null;const f=c,v=o.fields.find(e=>e.key===f),b=v?v.value:m;return t(On,{componentType:i,inputType:s,name:f,label:d,tooltip:u,disabled:n,required:h,placeholder:p,errorMessage:r[f],dropdownOptions:g,value:b||"",setValue:e=>l(f,e)},f)}),uo={type:"",name:"",currentStreamName:"",disabled:!1,exportedSignals:{logs:!1,metrics:!1,traces:!1},fields:[]},po={activeForm:null,onChangeActiveForm:()=>{},genericForm:void 0,formErrorMessage:void 0,validateFormData:()=>({isOk:!1,preparedFormData:z(uo)}),unsavedDestinations:[],thisUnsavedDestination:void 0,setUnsavedDestinations:()=>{},addUnsavedDestination:()=>{},updateUnsavedDestination:()=>{},deleteUnsavedDestination:()=>{}},mo=s(po),ho=({children:e})=>{const{selectedStreamName:a}=j(),[o,i]=l(null),[s,d]=l(),[u,p]=l(po.unsavedDestinations),m=c(()=>"number"==typeof o?.unsavedIdx?u[o.unsavedIdx]:void 0,[o,u]),h=r((e,t)=>{o&&(p(t=>[...t,{...e,option:o.option}]),i(t?e=>e?{...e,listType:H.UNSAVED,unsavedIdx:u.length}:null:null))},[o,u.length]),g=r((e,t,a)=>{o&&(p(a=>a.map((a,n)=>n===e?{...a,...t,option:o.option}:a)),i(a?e=>e?{...e,listType:H.UNSAVED}:null:null))},[o]),f=r(e=>{p(t=>t.filter((t,a)=>a!==e)),i(null)},[]),v=L({...uo,currentStreamName:a});n(()=>{if(o)if(m)v.handleFormChange(void 0,void 0,m.formData);else{v.handleFormChange("type",o.option.type),v.handleFormChange("name",o.option.displayName),v.handleFormChange("disabled",!1);const e=W(o.option.supportedSignals);v.handleFormChange("exportedSignals",{logs:e.includes(K.Logs),metrics:e.includes(K.Metrics),traces:e.includes(K.Traces)}),v.handleFormChange("fields",o.dynamicFields.map(e=>({key:e.name,value:e.value})))}},[o,m]);const b=r(e=>{var t;v.resetFormData(),v.handleErrorChange(void 0,void 0,{}),d(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:o,initialValue:l,renderCondition:r}=e,i=a===M.Dropdown,s=q(n,{});return{componentType:a,renderCondition:r,name:t,title:o,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)},[]),y=r(()=>{const e=z(v.formData),t={};o?.dynamicFields.forEach(({name:a,required:n})=>{if(n){const n=e.fields.find(e=>e.key===a)?.value;x(n)&&(t[a]=Y.FIELD_IS_REQUIRED)}});G(e.exportedSignals).length||(t.exportedSignals=Y.FIELD_IS_REQUIRED);const a=0===Object.keys(t).length?void 0:"Invalid form values";return v.handleErrorChange(void 0,void 0,t),d(a),{errorMessage:a,preparedFormData:e}},[v,o]);return t(mo.Provider,{value:{activeForm:o,onChangeActiveForm:b,genericForm:v,formErrorMessage:s,validateFormData:y,unsavedDestinations:u,thisUnsavedDestination:m,setUnsavedDestinations:p,addUnsavedDestination:h,updateUnsavedDestination:g,deleteUnsavedDestination:f},children:e})},go=()=>i(mo),fo=p(g)`
22
22
  position: sticky;
23
23
  bottom: 0;
24
24
  margin-top: auto;
25
25
  padding: 12px 0;
26
26
  background-color: ${({theme:e})=>e.v2.colors.silver[900]};
27
27
  z-index: 1;
28
- `,Ma=({testConnection:a})=>{const o=n(),{activeForm:i,genericForm:s,validateFormData:c,thisUnsavedDestination:d,addUnsavedDestination:u,updateUnsavedDestination:p,deleteUnsavedDestination:h}=Pa(),[g,f]=Gt(d?.testResult),[v,y]=Gt(!!d);if(Ht(()=>{d?(f(d.testResult),y(!0)):(f(void 0),y(!1))},[d]),!s||!i)return t(E,{title:"No active form"});const b=async()=>{if(!i.option.testConnectionSupported)return;const e=await a(s.formData);return f(e),e};return e(l,{$gap:24,style:{minHeight:"100%"},children:[e(r,{$gap:12,$justifyContent:"space-between",children:[g?g.succeeded?t(B,{status:U.Success,message:g.message||"Connection OK",fullWidth:!0,smallIcon:!0}):t(B,{status:U.Error,message:g.message||"Connection Failed",fullWidth:!0,smallIcon:!0}):t("div",{}),t(w,{"data-id":"dest-form-docs",label:"Docs",leftIcon:pt,variant:T.Text,size:x.S,onClick:()=>window.open(`${R}/backends/${i.option.type}`,"_blank","noopener noreferrer")})]}),t($,{options:[{icon:ht,label:"Enabled",value:!1,selectedBgColor:o.v2.colors.green[800]},{icon:mt,label:"Disabled",value:!0,selectedBgColor:o.v2.colors.red[800]}],selected:s.formData.disabled,setSelected:e=>s.handleFormChange("disabled",e),disabled:v}),t(ea,{title:"This connection will monitor:",allowedSignals:L(i.option.supportedSignals),selectedSignals:X(s.formData.exportedSignals),setSelectedSignals:e=>s.handleFormChange("exportedSignals",{logs:e.includes(z.Logs),metrics:e.includes(z.Metrics),traces:e.includes(z.Traces)}),disabled:v,errorMessage:s.formErrors.exportedSignals}),t(m,{label:"Destination name",placeholder:"Use a name that describes the destination...",value:s.formData.name,onChange:({target:{value:e}})=>s.handleFormChange("name",e),disabled:v,errorMessage:s.formErrors.name}),t(Aa,{signals:X(s.formData.exportedSignals),fields:i.dynamicFields,disabled:v,formData:s.formData,handleFormChange:(e,t)=>{s.handleFormChange("fields",s.formData.fields.map(a=>a.key===e?{...a,value:t}:a))},formErrors:s.formErrors}),e(Oa,{$gap:8,$justifyContent:"flex-end",children:[d&&t("div",{style:{width:"150px"},children:t(w,{"data-id":"dest-form-delete",fullWidth:!0,label:"Delete",rightIcon:gt,variant:T.Secondary,textColor:o.v2.colors.red[500],onClick:()=>h(i.unsavedIdx)})}),(!d||d.option.testConnectionSupported&&!v)&&t("div",{style:{width:"150px"},children:t(w,{"data-id":"dest-form-test-connection",fullWidth:!0,label:"Test Connection",variant:T.Secondary,onClick:b})}),d&&t("div",v?{style:{width:"150px"},children:t(w,{"data-id":"dest-form-edit",fullWidth:!0,label:"Edit",rightIcon:ft,variant:T.Secondary,onClick:()=>y(!1)})}:{style:{width:"150px"},children:t(w,{"data-id":"dest-form-save",fullWidth:!0,label:"Save Changes",variant:T.Primary,onClick:async()=>{const{errorMessage:e,preparedFormData:t}=c();if(!e){const e=await b(),a=!!e&&!e.succeeded;p(i.unsavedIdx,{formData:t,testResult:e},a)}}})}),!d&&t("div",{style:{width:"150px"},children:t(w,{"data-id":"dest-form-add",fullWidth:!0,label:"Add Destination",variant:T.Primary,onClick:async()=>{const{errorMessage:e,preparedFormData:t}=c();if(!e){const e=await b(),a=!!e&&!e.succeeded;u({formData:t,testResult:e},a)}}})})]})]})},Fa=[{id:j.FilePath,label:"Collect file path",tooltip:"Indicates whether to record the `code.filepath` attribute."},{id:j.Function,label:"Collect function",tooltip:"Indicates whether to record the `code.function` attribute."},{id:j.LineNumber,label:"Collect line number",tooltip:"Indicates whether to record the `code.lineno` attribute."}],La=[{id:j.Column,label:"Collect column",tooltip:"Indicates whether to record the `code.column` attribute."},{id:j.Namespace,label:"Collect namespace",tooltip:"Indicates whether to record the `code.namespace` attribute."},{id:j.StackTrace,label:"Collect stacktrace",tooltip:"Indicates whether to record the `code.stacktrace` attribute."}],za=["*"],Xa=[{id:G.HttpRequest,label:"Collect HTTP request",tooltip:""},{id:G.HttpResponse,label:"Collect HTTP response",tooltip:""},{id:G.DbQuery,label:"Collect DB query",tooltip:""},{id:G.Messaging,label:"Collect messaging",tooltip:""}],Va={[Y.Java]:[new q("","")],[Y.Golang]:[new W("")]},_a={[J.CodeAttributes]:({value:o,setValue:r,formErrors:d})=>{const u=n(),p=d.codeAttributes,m=Jt(()=>Object.entries(o.codeAttributes||{}).filter(([e,t])=>!!t).map(([e])=>e),[o]);Ht(()=>{if(!m.length&&!p){const e={[j.FilePath]:!0,[j.Function]:!0,[j.LineNumber]:!0,[j.Column]:null,[j.Namespace]:null,[j.StackTrace]:null};r("codeAttributes",e)}},[]);const g=(e,t)=>{const a=t?[...m,e]:m.filter(t=>t!==e),o=Object.values(j).reduce((e,t)=>(e[t]=!!a.includes(t)||null,e),{});r("codeAttributes",o)};return e(a,{children:[e(l,{$gap:12,children:[t(s,{size:c.XS,color:u.v2.colors.silver[200],nowrap:!0,children:"Recommended data to collect"}),t(l,{$gap:6,children:Fa.map(({id:e,label:a,tooltip:o})=>t(H,{text:o,withIcon:!0,children:t(i,{label:a,value:m.includes(e),onChange:t=>g(e,t)})},e))}),t(h,{errorMessage:p})]}),e(l,{$gap:12,children:[t(s,{size:c.XS,color:u.v2.colors.silver[200],nowrap:!0,children:"Verbose data to collect"}),t(l,{$gap:6,children:La.map(({id:e,label:a,tooltip:o})=>t(H,{text:o,withIcon:!0,children:t(i,{label:a,value:m.includes(e),onChange:t=>g(e,t)})},e))}),t(h,{errorMessage:p})]})]})},[J.CustomInstrumentation]:({value:o,setValue:n,formErrors:i})=>{const s=i.customInstrumentations,c=Jt(()=>(o?.customInstrumentations?.[Y.Golang]||[]).map(e=>new W(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)),[o]),d=Jt(()=>(o?.customInstrumentations?.[Y.Java]||[]).map(e=>new q(e.className,e.methodName)),[o]);return Ht(()=>{o?.customInstrumentations||s||n("customInstrumentations",{[Y.Golang]:Va[Y.Golang],[Y.Java]:Va[Y.Java]})},[]),e(a,{children:[e(l,{children:[e(r,{$gap:8,children:[t(vt,{}),t(p,{label:"Golang custom probes"})]}),t(v,{name:"golangProbes",columns:[{keyName:"packageName",label:"Package name",placeholder:"e.g. github.com/my-org/my-package",tooltip:"The full import path of the package containing the function or method to be instrumented."},{keyName:"functionName",label:"Function name",placeholder:"e.g. myFunction",tooltip:"The name of the function to be instrumented. Leave empty if instrumenting a receiver method."},{keyName:"receiverName",label:"Receiver name",placeholder:"e.g. myReceiver",tooltip:"The name of the receiver type if instrumenting a method. Leave empty if instrumenting a standalone function."},{keyName:"receiverMethodName",label:"Receiver method name",placeholder:"e.g. myMethod",tooltip:"The name of the method to be instrumented. Leave empty if instrumenting a standalone function."}],values:c,setValues:e=>{const t={};t[Y.Golang]=e.map(e=>new W(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)),t[Y.Java]=d,n("customInstrumentations",t)},errorMessage:s,limitFieldsPerRow:2})]}),e(l,{children:[e(r,{$gap:8,children:[t(yt,{}),t(p,{label:"Java custom probes"})]}),t(v,{name:"javaProbes",columns:[{keyName:"className",label:"Class name",placeholder:"e.g. com.example.MyClass",tooltip:"The name of the class to be instrumented."},{keyName:"methodName",label:"Method name",placeholder:"e.g. myMethod",tooltip:"The name of the method to be instrumented."}],values:d,setValues:e=>{const t={};t[Y.Golang]=c,t[Y.Java]=e.map(e=>new q(e.className,e.methodName)),n("customInstrumentations",t)},errorMessage:s,limitFieldsPerRow:2})]})]})},[J.HeadersCollection]:({value:e,setValue:a,formErrors:o})=>{const n=o.headersCollection,l=Jt(()=>e?.headersCollection?.[K.HeaderKeys]||[],[e]),r=e=>{const t={[K.HeaderKeys]:e};a("headersCollection",t)};return Ht(()=>{l.length||n||r(za)},[]),t(C,{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})},[J.PayloadCollection]:({value:a,setValue:o,formErrors:r})=>{const d=n(),u=r.payloadCollection,p=Jt(()=>Object.entries(a.payloadCollection||{}).filter(([e,t])=>!!t).map(([e])=>e),[a]);Ht(()=>{if(!p.length&&!u){const e={[G.HttpRequest]:{},[G.HttpResponse]:{},[G.DbQuery]:{},[G.Messaging]:{}};o("payloadCollection",e)}},[]);return e(l,{$gap:12,children:[t(s,{size:c.XS,color:d.v2.colors.silver[200],nowrap:!0,children:"Type of data to collect"}),t(l,{$gap:6,children:Xa.map(({id:e,label:a,tooltip:n})=>t(H,{text:n,withIcon:!0,children:t(i,{label:a,value:p.includes(e),onChange:t=>((e,t)=>{const a=t?[...p,e]:p.filter(t=>t!==e),n={[G.HttpRequest]:a.includes(G.HttpRequest)?{}:null,[G.HttpResponse]:a.includes(G.HttpResponse)?{}:null,[G.DbQuery]:a.includes(G.DbQuery)?{}:null,[G.Messaging]:a.includes(G.Messaging)?{}:null};o("payloadCollection",n)})(e,t)})},e))}),t(h,{errorMessage:u})]})},[J.UnknownType]:null},Ba=({ruleType:e,value:a,setValue:o,formErrors:n})=>{if(!e)return null;const l=_a[e];return l?t(l,{value:a,setValue:o,formErrors:n}):null},Ua={disabled:!1,ruleName:"",notes:"",workloads:null,instrumentationLibraries:null,payloadCollection:null,codeAttributes:null,headersCollection:null,customInstrumentations:null},ja=Yt({selectedOption:null,onSelectOption:()=>{},genericForm:void 0,validateFormData:()=>({preparedFormData:I(Ua)}),errorMessage:void 0}),Ha=({children:e})=>{const[a,o]=Gt(null),[n,l]=Gt(void 0),r=A(Ua),i=Wt(e=>{r.resetFormData(),r.handleErrorChange(void 0,void 0,{}),l(void 0),o(e)},[]),s=Wt(()=>{if(!a)return{errorMessage:"No rule type selected",preparedFormData:I(Ua)};const e=(e=>{const t=I(e);return t.headersCollection?.[K.HeaderKeys]?.length&&(t.headersCollection[K.HeaderKeys]=t.headersCollection[K.HeaderKeys].map(e=>e.trim()).filter(e=>e)),t.customInstrumentations?.[Y.Golang]?.length&&(t.customInstrumentations[Y.Golang]=t.customInstrumentations[Y.Golang].map(e=>new W(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)).filter(e=>e.Verify())),t.customInstrumentations?.[Y.Java]?.length&&(t.customInstrumentations[Y.Java]=t.customInstrumentations[Y.Java].map(e=>new q(e.className,e.methodName)).filter(e=>e.Verify())),t})(r.formData),t={};switch(a.type){case J.CodeAttributes:Object.values(e.codeAttributes||{}).some(e=>null!=e)||(t.codeAttributes="Code attributes are required");break;case J.PayloadCollection:Object.values(e.payloadCollection||{}).some(e=>null!=e)||(t.payloadCollection="Payload collection are required");break;case J.HeadersCollection:e.headersCollection?.[K.HeaderKeys]?.length||(t.headersCollection="Header keys are required");break;case J.CustomInstrumentation:e.customInstrumentations?.[Y.Golang]?.length||e.customInstrumentations?.[Y.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 t(ja.Provider,{value:{selectedOption:a,onSelectOption:i,genericForm:r,validateFormData:s,errorMessage:n},children:e})},Ka=()=>qt(ja),Ga=()=>{const a=n(),{selectedOption:o,genericForm:i}=Ka();if(!i||!o)return t(E,{title:"No active form"});const{formData:d,handleFormChange:u,formErrors:p}=i;return e(l,{$gap:24,children:[e(r,{$gap:12,$justifyContent:"space-between",children:[t(s,{size:c.XXS,children:o.docsDescription}),t(w,{label:"Docs",leftIcon:pt,variant:T.Text,size:x.S,onClick:()=>window.open(`${R}${o.docsEndpoint}`,"_blank","noopener noreferrer")})]}),e(r,{$gap:12,children:[t(s,{size:c.XS,color:a.v2.colors.silver[200],nowrap:!0,children:"Supported Languages:"}),o.supportedLanguages.map(e=>t(Q,{label:Z[e],leftIcon:ee(e),status:U.Default,useSecondaryTone:!0},e))]}),t($,{options:[{icon:ht,label:"Enabled",value:!1,selectedBgColor:a.v2.colors.green[800]},{icon:mt,label:"Disabled",value:!0,selectedBgColor:a.v2.colors.red[800]}],selected:d.disabled,setSelected:e=>u("disabled",e)}),t(m,{name:"ruleName",label:"Rule name",placeholder:"Use a name that describes the rule...",value:d.ruleName,onChange:({target:{value:e}})=>u("ruleName",e),errorMessage:p.ruleName}),t(Ba,{ruleType:o.type,value:d,setValue:(e,t)=>u(e,t),formErrors:p}),t(P,{name:"notes",label:"Notes",placeholder:"Your personal notes...",value:d.notes,onChange:({target:{value:e}})=>u("notes",e),errorMessage:p.notes})]})},Wa=Yt({isFetching:!1,formData:[],handleSourceChange:()=>{},handleSelectAll:()=>{},formDiff:{},isFormDirty:!1}),qa=({children:e,selectedConnectionIds:a,getAllClusterSnapshots:o,fetchNamespacesWithWorkloads:n,initialInputs:l})=>{const{tier:r}=te(),i=r===ie.Onprem,{selectedStreamName:s}=M(),[c,d]=Gt(!1),[u,p]=Gt(null),h=Wt(async()=>{try{if(d(!0),o){const e=await o();e&&p(e)}else if(n){const e=await n();e.data?.length&&p({clusters:[{clusterId:oe,clusterName:ae,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{d(!1)}},[]);Ht(()=>{h()},[]);const[m,g]=Gt([]);Ht(()=>{u&&g(e=>{const t=((e,t)=>I(((e,t)=>e.clusters.filter(({clusterId:e})=>!t||t.includes(e)))(e,t)))(u,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=I(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=>{ne.has(e.kind)&&!i||(e.selected=!0)})}),a}return o})})},[u,a,l]);const{formDiff:f,isFormDirty:v}=Jt(()=>{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})(m,u?.clusters||[],s);return{formDiff:e,isFormDirty:Object.keys(e).length>0}},[m,u,s]),y=Wt(e=>!i&&ne.has(e),[i]),b=Wt(({clusterId:e,workloadId:t,selected:a,auto:o})=>{g(n=>{const l=I(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=>!y(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=>{y(e.kind)||(e.selected=!0)}):"boolean"!=typeof a||a||l[r].namespaces[i].workloads.forEach(e=>{e.selected=!1})}return l})},[y]),S=Wt(({clusterId:e,namespaceName:t,boolean:a,searchText:o="",searchBy:n="",filters:l})=>{g(r=>{const i=I(r),s=n===se.Namespace?o:"",c=n===se.Source?o:"",d=!!s||!!c||!!l?.showOnlySelected;return i.forEach((o,n)=>{e&&o.clusterId!==e||o.namespaces.forEach(({name:e,workloads:o},r)=>{if(!t||e===t)if(d)if(t){o.forEach((e,t)=>{a&&y(e.kind)||le(e,c,l||{showOnlySelected:!1})&&(i[n].namespaces[r].workloads[t].selected=a)});const e=i[n].namespaces[r].workloads.filter(e=>!y(e.kind)).every(e=>e.selected);i[n].namespaces[r].selected=e}else{if(!re(i[n].namespaces[r],s,l||{showOnlySelected:!1}))return;i[n].namespaces[r].selected=a,o.forEach((e,t)=>{a&&y(e.kind)||(i[n].namespaces[r].workloads[t].selected=a)})}else i[n].namespaces[r].selected=a,o.forEach((e,t)=>{a&&y(e.kind)||(i[n].namespaces[r].workloads[t].selected=a)})})}),i})},[y]);return t(Wa.Provider,{value:{isFetching:c,formData:m,handleSourceChange:b,handleSelectAll:S,formDiff:f,isFormDirty:v},children:e})},Ya=()=>qt(Wa),Ja=o.div`
28
+ `,vo=({testConnection:a})=>{const o=m(),{activeForm:r,genericForm:i,validateFormData:s,thisUnsavedDestination:c,addUnsavedDestination:d,updateUnsavedDestination:u,deleteUnsavedDestination:p}=go(),[f,v]=l(c?.testResult),[b,y]=l(!!c);if(n(()=>{c?(v(c.testResult),y(!0)):(v(void 0),y(!1))},[c]),!i||!r)return t(V,{title:"No active form"});const S=async()=>{if(!r.option.testConnectionSupported)return;const e=await a(i.formData);return v(e),e};return e(h,{$gap:24,style:{minHeight:"100%"},children:[e(g,{$gap:12,$justifyContent:"space-between",children:[f?f.succeeded?t(J,{status:Q.Success,message:f.message||"Connection OK",fullWidth:!0,smallIcon:!0}):t(J,{status:Q.Error,message:f.message||"Connection Failed",fullWidth:!0,smallIcon:!0}):t("div",{}),t(P,{"data-id":"dest-form-docs",label:"Docs",leftIcon:Za,variant:O.Text,size:$.S,onClick:()=>window.open(`${X}/backends/${r.option.type}`,"_blank","noopener noreferrer")})]}),t(B,{options:[{icon:en,label:"Enabled",value:!1,selectedBgColor:o.v2.colors.green[800]},{icon:tn,label:"Disabled",value:!0,selectedBgColor:o.v2.colors.red[800]}],selected:i.formData.disabled,setSelected:e=>i.handleFormChange("disabled",e),disabled:b}),t($n,{title:"This connection will monitor:",allowedSignals:W(r.option.supportedSignals),selectedSignals:G(i.formData.exportedSignals),setSelectedSignals:e=>i.handleFormChange("exportedSignals",{logs:e.includes(K.Logs),metrics:e.includes(K.Metrics),traces:e.includes(K.Traces)}),disabled:b,errorMessage:i.formErrors.exportedSignals}),t(w,{label:"Destination name",placeholder:"Use a name that describes the destination...",value:i.formData.name,onChange:({target:{value:e}})=>i.handleFormChange("name",e),disabled:b,errorMessage:i.formErrors.name}),t(co,{signals:G(i.formData.exportedSignals),fields:r.dynamicFields,disabled:b,formData:i.formData,handleFormChange:(e,t)=>{i.handleFormChange("fields",i.formData.fields.map(a=>a.key===e?{...a,value:t}:a))},formErrors:i.formErrors}),e(fo,{$gap:8,$justifyContent:"flex-end",children:[c&&t("div",{style:{width:"150px"},children:t(P,{"data-id":"dest-form-delete",fullWidth:!0,label:"Delete",rightIcon:an,variant:O.Secondary,textColor:o.v2.colors.red[500],onClick:()=>p(r.unsavedIdx)})}),(!c||c.option.testConnectionSupported&&!b)&&t("div",{style:{width:"150px"},children:t(P,{"data-id":"dest-form-test-connection",fullWidth:!0,label:"Test Connection",variant:O.Secondary,onClick:S})}),c&&t("div",b?{style:{width:"150px"},children:t(P,{"data-id":"dest-form-edit",fullWidth:!0,label:"Edit",rightIcon:nn,variant:O.Secondary,onClick:()=>y(!1)})}:{style:{width:"150px"},children:t(P,{"data-id":"dest-form-save",fullWidth:!0,label:"Save Changes",variant:O.Primary,onClick:async()=>{const{errorMessage:e,preparedFormData:t}=s();if(!e){const e=await S(),a=!!e&&!e.succeeded;u(r.unsavedIdx,{formData:t,testResult:e},a)}}})}),!c&&t("div",{style:{width:"150px"},children:t(P,{"data-id":"dest-form-add",fullWidth:!0,label:"Add Destination",variant:O.Primary,onClick:async()=>{const{errorMessage:e,preparedFormData:t}=s();if(!e){const e=await S(),a=!!e&&!e.succeeded;d({formData:t,testResult:e},a)}}})})]})]})},bo=[{id:Z.FilePath,label:"Collect file path",tooltip:"Indicates whether to record the `code.filepath` attribute."},{id:Z.Function,label:"Collect function",tooltip:"Indicates whether to record the `code.function` attribute."},{id:Z.LineNumber,label:"Collect line number",tooltip:"Indicates whether to record the `code.lineno` attribute."}],yo=[{id:Z.Column,label:"Collect column",tooltip:"Indicates whether to record the `code.column` attribute."},{id:Z.Namespace,label:"Collect namespace",tooltip:"Indicates whether to record the `code.namespace` attribute."},{id:Z.StackTrace,label:"Collect stacktrace",tooltip:"Indicates whether to record the `code.stacktrace` attribute."}],So=["*"],Co=[{id:ae.HttpRequest,label:"Collect HTTP request",tooltip:""},{id:ae.HttpResponse,label:"Collect HTTP response",tooltip:""},{id:ae.DbQuery,label:"Collect DB query",tooltip:""},{id:ae.Messaging,label:"Collect messaging",tooltip:""}],ko={[le.Java]:[new oe("","")],[le.Golang]:[new ne("")]},wo={[re.CodeAttributes]:({value:o,setValue:l,formErrors:r})=>{const i=m(),s=r.codeAttributes,d=c(()=>Object.entries(o.codeAttributes||{}).filter(([e,t])=>!!t).map(([e])=>e),[o]);n(()=>{if(!d.length&&!s){const e={[Z.FilePath]:!0,[Z.Function]:!0,[Z.LineNumber]:!0,[Z.Column]:null,[Z.Namespace]:null,[Z.StackTrace]:null};l("codeAttributes",e)}},[]);const u=(e,t)=>{const a=t?[...d,e]:d.filter(t=>t!==e),n=Object.values(Z).reduce((e,t)=>(e[t]=!!a.includes(t)||null,e),{});l("codeAttributes",n)};return e(a,{children:[e(h,{$gap:12,children:[t(v,{size:b.XS,color:i.v2.colors.silver[200],nowrap:!0,children:"Recommended data to collect"}),t(h,{$gap:6,children:bo.map(({id:e,label:a,tooltip:n})=>t(ee,{text:n,withIcon:!0,children:t(f,{label:a,value:d.includes(e),onChange:t=>u(e,t)})},e))}),t(k,{errorMessage:s})]}),e(h,{$gap:12,children:[t(v,{size:b.XS,color:i.v2.colors.silver[200],nowrap:!0,children:"Verbose data to collect"}),t(h,{$gap:6,children:yo.map(({id:e,label:a,tooltip:n})=>t(ee,{text:n,withIcon:!0,children:t(f,{label:a,value:d.includes(e),onChange:t=>u(e,t)})},e))}),t(k,{errorMessage:s})]})]})},[re.CustomInstrumentation]:({value:o,setValue:l,formErrors:r})=>{const i=r.customInstrumentations,s=c(()=>(o?.customInstrumentations?.[le.Golang]||[]).map(e=>new ne(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)),[o]),d=c(()=>(o?.customInstrumentations?.[le.Java]||[]).map(e=>new oe(e.className,e.methodName)),[o]);return n(()=>{o?.customInstrumentations||i||l("customInstrumentations",{[le.Golang]:ko[le.Golang],[le.Java]:ko[le.Java]})},[]),e(a,{children:[e(h,{children:[e(g,{$gap:8,children:[t(on,{}),t(C,{label:"Golang custom probes"})]}),t(D,{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:s,setValues:e=>{const t={};t[le.Golang]=e.map(e=>new ne(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)),t[le.Java]=d,l("customInstrumentations",t)},errorMessage:i,limitFieldsPerRow:2})]}),e(h,{children:[e(g,{$gap:8,children:[t(ln,{}),t(C,{label:"Java custom probes"})]}),t(D,{name:"javaProbes",columns:[{keyName:"className",label:"Class name",placeholder:"e.g. com.example.MyClass",tooltip:"The name of the class to be instrumented."},{keyName:"methodName",label:"Method name",placeholder:"e.g. myMethod",tooltip:"The name of the method to be instrumented."}],values:d,setValues:e=>{const t={};t[le.Golang]=s,t[le.Java]=e.map(e=>new oe(e.className,e.methodName)),l("customInstrumentations",t)},errorMessage:i,limitFieldsPerRow:2})]})]})},[re.HeadersCollection]:({value:e,setValue:a,formErrors:o})=>{const l=o.headersCollection,r=c(()=>e?.headersCollection?.[te.HeaderKeys]||[],[e]),i=e=>{const t={[te.HeaderKeys]:e};a("headersCollection",t)};return n(()=>{r.length||l||i(So)},[]),t(E,{name:"headerKeys",label:"Header keys",tooltip:"Specify which headers you want to collect",helpMessage:"Asterisk (*) will collect all headers",values:r,setValues:i,errorMessage:l})},[re.PayloadCollection]:({value:a,setValue:o,formErrors:l})=>{const r=m(),i=l.payloadCollection,s=c(()=>Object.entries(a.payloadCollection||{}).filter(([e,t])=>!!t).map(([e])=>e),[a]);n(()=>{if(!s.length&&!i){const e={[ae.HttpRequest]:{},[ae.HttpResponse]:{},[ae.DbQuery]:{},[ae.Messaging]:{}};o("payloadCollection",e)}},[]);return e(h,{$gap:12,children:[t(v,{size:b.XS,color:r.v2.colors.silver[200],nowrap:!0,children:"Type of data to collect"}),t(h,{$gap:6,children:Co.map(({id:e,label:a,tooltip:n})=>t(ee,{text:n,withIcon:!0,children:t(f,{label:a,value:s.includes(e),onChange:t=>((e,t)=>{const a=t?[...s,e]:s.filter(t=>t!==e),n={[ae.HttpRequest]:a.includes(ae.HttpRequest)?{}:null,[ae.HttpResponse]:a.includes(ae.HttpResponse)?{}:null,[ae.DbQuery]:a.includes(ae.DbQuery)?{}:null,[ae.Messaging]:a.includes(ae.Messaging)?{}:null};o("payloadCollection",n)})(e,t)})},e))}),t(k,{errorMessage:i})]})},[re.UnknownType]:null},To=({ruleType:e,value:a,setValue:n,formErrors:o})=>{if(!e)return null;const l=wo[e];return l?t(l,{value:a,setValue:n,formErrors:o}):null},xo={disabled:!1,ruleName:"",notes:"",workloads:null,instrumentationLibraries:null,payloadCollection:null,codeAttributes:null,headersCollection:null,customInstrumentations:null},Do=s({selectedOption:null,onSelectOption:()=>{},genericForm:void 0,validateFormData:()=>({preparedFormData:z(xo)}),errorMessage:void 0}),No=({children:e})=>{const[a,n]=l(null),[o,i]=l(void 0),s=L(xo),c=r(e=>{s.resetFormData(),s.handleErrorChange(void 0,void 0,{}),i(void 0),n(e)},[]),d=r(()=>{if(!a)return{errorMessage:"No rule type selected",preparedFormData:z(xo)};const e=(e=>{const t=z(e);return t.headersCollection?.[te.HeaderKeys]?.length&&(t.headersCollection[te.HeaderKeys]=t.headersCollection[te.HeaderKeys].map(e=>e.trim()).filter(e=>e)),t.customInstrumentations?.[le.Golang]?.length&&(t.customInstrumentations[le.Golang]=t.customInstrumentations[le.Golang].map(e=>new ne(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)).filter(e=>e.Verify())),t.customInstrumentations?.[le.Java]?.length&&(t.customInstrumentations[le.Java]=t.customInstrumentations[le.Java].map(e=>new oe(e.className,e.methodName)).filter(e=>e.Verify())),t})(s.formData),t={};switch(a.type){case re.CodeAttributes:Object.values(e.codeAttributes||{}).some(e=>null!=e)||(t.codeAttributes="Code attributes are required");break;case re.PayloadCollection:Object.values(e.payloadCollection||{}).some(e=>null!=e)||(t.payloadCollection="Payload collection are required");break;case re.HeadersCollection:e.headersCollection?.[te.HeaderKeys]?.length||(t.headersCollection="Header keys are required");break;case re.CustomInstrumentation:e.customInstrumentations?.[le.Golang]?.length||e.customInstrumentations?.[le.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 t(Do.Provider,{value:{selectedOption:a,onSelectOption:c,genericForm:s,validateFormData:d,errorMessage:o},children:e})},Ao=()=>i(Do),Io=()=>{const a=m(),{selectedOption:n,genericForm:o}=Ao();if(!o||!n)return t(V,{title:"No active form"});const{formData:l,handleFormChange:r,formErrors:i}=o;return e(h,{$gap:24,children:[e(g,{$gap:12,$justifyContent:"space-between",children:[t(v,{size:b.XXS,children:n.docsDescription}),t(P,{label:"Docs",leftIcon:Za,variant:O.Text,size:$.S,onClick:()=>window.open(`${X}${n.docsEndpoint}`,"_blank","noopener noreferrer")})]}),e(g,{$gap:12,children:[t(v,{size:b.XS,color:a.v2.colors.silver[200],nowrap:!0,children:"Supported Languages:"}),n.supportedLanguages.map(e=>t(ie,{label:se[e],leftIcon:ce(e),status:Q.Default,useSecondaryTone:!0},e))]}),t(B,{options:[{icon:en,label:"Enabled",value:!1,selectedBgColor:a.v2.colors.green[800]},{icon:tn,label:"Disabled",value:!0,selectedBgColor:a.v2.colors.red[800]}],selected:l.disabled,setSelected:e=>r("disabled",e)}),t(w,{name:"ruleName",label:"Rule name",placeholder:"Use a name that describes the rule...",value:l.ruleName,onChange:({target:{value:e}})=>r("ruleName",e),errorMessage:i.ruleName}),t(To,{ruleType:n.type,value:l,setValue:(e,t)=>r(e,t),formErrors:i}),t(_,{name:"notes",label:"Notes",placeholder:"Your personal notes...",value:l.notes,onChange:({target:{value:e}})=>r("notes",e),errorMessage:i.notes})]})},Eo=s({isFetching:!1,formData:[],handleSourceChange:()=>{},handleSelectAll:()=>{},formDiff:{},isFormDirty:!1}),Ro=({children:e,selectedConnectionIds:a,getAllClusterSnapshots:o,fetchNamespacesWithWorkloads:i,initialInputs:s})=>{const{tier:d}=de(),u=d===fe.Onprem,{selectedStreamName:p}=j(),[m,h]=l(!1),[g,f]=l(null),v=r(async()=>{try{if(h(!0),o){const e=await o();e&&f(e)}else if(i){const e=await i();e.data?.length&&f({clusters:[{clusterId:pe,clusterName:ue,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)}},[]);n(()=>{v()},[]);const[b,y]=l([]);n(()=>{g&&y(e=>{const t=((e,t)=>z(((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=z(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=>{me.has(e.kind)&&!u||(e.selected=!0)})}),a}return n})})},[g,a,s]);const{formDiff:S,isFormDirty:C}=c(()=>{const e=((e,t,a)=>{const n={};return e.forEach(e=>{e.namespaces.forEach(o=>{const l=t.find(t=>t.clusterId===e.clusterId)?.namespaces.find(e=>e.name===o.name),r=o.selected||!1,i=r!==l?.selected;if(i&&(n[e.clusterId]||(n[e.clusterId]=[]),n[e.clusterId].push({namespace:o.name,selected:r,currentStreamName:a}),r&&(n[e.clusterId]=n[e.clusterId].filter(e=>e.namespace!==o.name||e.namespace===o.name&&(!e.name||!e.kind)))),!i||!r){const t=((e,t,a)=>{const n=[];return t.workloads.forEach(o=>{const l=e?.workloads.find(e=>e.name===o.name&&e.kind===o.kind);o.selected!==l?.selected&&n.push({namespace:t.name,name:o.name,kind:o.kind,selected:o.selected||!1,currentStreamName:a})}),n})(l,o,a);t.length>0&&(n[e.clusterId]||(n[e.clusterId]=[]),n[e.clusterId].push(...t))}})}),n})(b,g?.clusters||[],p);return{formDiff:e,isFormDirty:Object.keys(e).length>0}},[b,g,p]),k=r(e=>!u&&me.has(e),[u]),w=r(({clusterId:e,workloadId:t,selected:a,auto:n})=>{y(o=>{const l=z(o),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 n="boolean"==typeof a?a:!l[r].namespaces[i].workloads[e].selected;if(l[r].namespaces[i].workloads[e].selected=n,n){l[r].namespaces[i].workloads.filter(e=>!k(e.kind)).every(e=>e.selected)&&(l[r].namespaces[i].selected=!0)}else l[r].namespaces[i].selected=!1}else{const e="boolean"==typeof n?n:!l[r].namespaces[i].selected;l[r].namespaces[i].selected=e,e?l[r].namespaces[i].workloads.forEach(e=>{k(e.kind)||(e.selected=!0)}):"boolean"!=typeof a||a||l[r].namespaces[i].workloads.forEach(e=>{e.selected=!1})}return l})},[k]),T=r(({clusterId:e,namespaceName:t,boolean:a,searchText:n="",searchBy:o="",filters:l})=>{y(r=>{const i=z(r),s=o===ve.Namespace?n:"",c=o===ve.Source?n:"",d=!!s||!!c||!!l?.showOnlySelected;return i.forEach((n,o)=>{e&&n.clusterId!==e||n.namespaces.forEach(({name:e,workloads:n},r)=>{if(!t||e===t)if(d)if(t){n.forEach((e,t)=>{a&&k(e.kind)||he(e,c,l||{showOnlySelected:!1})&&(i[o].namespaces[r].workloads[t].selected=a)});const e=i[o].namespaces[r].workloads.filter(e=>!k(e.kind)).every(e=>e.selected);i[o].namespaces[r].selected=e}else{if(!ge(i[o].namespaces[r],s,l||{showOnlySelected:!1}))return;i[o].namespaces[r].selected=a,n.forEach((e,t)=>{a&&k(e.kind)||(i[o].namespaces[r].workloads[t].selected=a)})}else i[o].namespaces[r].selected=a,n.forEach((e,t)=>{a&&k(e.kind)||(i[o].namespaces[r].workloads[t].selected=a)})})}),i})},[k]);return t(Eo.Provider,{value:{isFetching:m,formData:b,handleSourceChange:w,handleSelectAll:T,formDiff:S,isFormDirty:C},children:e})},Po=()=>i(Eo),$o=p.div`
29
29
  display: flex;
30
- align-items: center;
31
- gap: 8px;
32
- padding: 8px;
33
- `,Qa=({onClose:a,selectedConnectionIds:o,setSelectedConnectionIds:l,createAction:r,withOverlay:i})=>{const d=n(),[u,p]=Gt(""),h=Qt(null),{selectedOption:m,onSelectOption:g,genericForm:f,validateFormData:v,errorMessage:y}=Na(),b=Jt(()=>(u?ce.filter(e=>e?.label?.toLowerCase().includes(u.toLowerCase())):ce).filter(e=>!!e),[u]),S=Jt(()=>(u?de.filter(e=>e?.label?.toLowerCase().includes(u.toLowerCase())):de).filter(e=>!!e),[u]),C=Jt(()=>{const a=(a,o)=>e(Ja,{children:[t(s,{size:c.XS,color:d.v2.colors.silver[200],children:a}),t(Q,{label:o.toString()})]},a),o=e=>{const a=m?.type===e.type;return t(da,{dataId:e.type?`option-${e.type}`:void 0,title:e.label,description:e.description,withCarret:!0,isSelected:a,onClick:()=>{h.current?.clearErrors(),g(e)}},e.type)};return[a("Attributes",b.length),...b.map(o),a("Samplers",S.length),...S.map(o)]},[d,m?.type,b.length,S.length,g]),k=Jt(()=>m?[t(Da,{},m.type)]:[t(ue,{$height:"100%",children:t(E,{icon:bt,title:"Action not selected",subTitle:"Please select an action to add"})},"no-data")],[m]);return t(aa,{ref:h,isOpen:!0,withOverlay:i,onClose:a,onSave:async()=>{const{errorMessage:e,preparedFormData:t}=v();return e?Promise.resolve({error:e}):await r(t)},disableSave:!m||!f?.isFormDirty,isFormDirty:f?.isFormDirty,hideDirtyNote:!0,errorMessage:y,progress:{title:pe.CREATING_ACTION,subTitle:pe.CREATING_ACTION_SUBTITLE},header:{icon:bt,title:pe.ADD_ACTION,subTitle:pe.ADD_ACTION_DESCRIPTION},connectionIds:o&&l?{value:o,setValue:l}:void 0,search:{value:u,onChange:p},leftColumn:{width:"40%",list:C},rightColumn:{width:"60%",list:k}})},Za=({testConnection:e})=>{const{activeForm:a}=Pa();return{width:"60%",list:a?[t(Ma,{testConnection:e},a.option.type)]:[t(ue,{$height:"100%",children:t(E,{icon:St,title:"Select destination from the list",subTitle:"Add destination so your data has somewhere to go."})},"no-data")]}},eo=o.div`
34
- display: flex;
35
- flex-direction: column;
36
- padding: 8px;
37
- border-radius: 16px;
38
- border: ${({$purpleColors:e,theme:t})=>e?`1px solid ${t.v2.colors.purple[500]}`:"1px solid transparent"};
39
- background-color: ${({$noBgColor:e,$purpleColors:t,theme:a})=>e?"transparent":t?a.v2.colors.purple[900]:a.v2.colors.silver[800]};
40
- `,to=o.div`
41
- display: flex;
42
- align-items: center;
43
- justify-content: space-between;
44
- gap: 12px;
45
- padding: ${({$isOpen:e})=>e?"2px 12px 8px 12px":"2px 12px"};
46
- `,ao=({title:a,tooltip:o,list:n,noBgColor:i,purpleColors:d})=>{const[u,p]=Gt(!0);return e(eo,{"data-id":`collapse-${a}`,$noBgColor:i,$purpleColors:d,children:[e(to,{$isOpen:u,children:[e(r,{$gap:10,children:[t(s,{size:c.XS,children:a}),o&&t(H,{text:o,withIcon:!0}),t(Q,{label:n.length,status:d?U.Default:void 0})]}),t(he,{icon:u?Ct:kt,size:me.M,onClick:()=>p(e=>!e)})]}),u?t(l,{children:n.length?Zt.toArray(n):t(ue,{$padding:"12px 0",children:t(E,{})})}):null]})},oo=(e,t,a)=>t||a.signalType?e.filter(e=>e.displayName.toLowerCase().includes(t.toLowerCase())&&(!a.signalType||L(e.supportedSignals).includes(a.signalType))):e,no=({option:e,formData:a,testResult:o,isSelected:n,onSelect:l})=>t(da,{icon:ve(e.type).icon,title:a?.name||e.displayName,withCarret:!0,purpleColors:!!a,isSelected:n,onClick:()=>l(),children:o&&t(Q,{status:o.succeeded?U.Success:U.Error,leftIcon:o.succeeded?wt:xt})}),lo=({listType:e,destinationOptions:a,unsavedDestinations:o})=>{const{activeForm:n,onChangeActiveForm:l}=Pa();return a?.length?t(ao,{title:fe[e].TITLE,tooltip:fe[e].DESCRIPTION,list:a.map((a,o)=>t(no,{option:a,isSelected:n?.listType===e&&"number"!=typeof n?.unsavedIdx&&(null!=a.id&&""!==a.id?n?.option.id===a.id:n?.option.type===a.type),onSelect:()=>l({listType:e,option:a})},`${e}-${a.id??a.type}-${o}`))}):o?.length?t(ao,{purpleColors:!0,title:fe[e].TITLE,tooltip:fe[e].DESCRIPTION,list:o.map(({option:a,formData:o,testResult:r},i)=>t(no,{option:a,formData:o,testResult:r,isSelected:n?.unsavedIdx===i&&n?.listType===e,onSelect:()=>l({listType:e,option:a,unsavedIdx:i})},`${e}-${i}`))},e):void 0},ro=({isFetching:e,destinationsByCategory:a,searchText:o,filters:n})=>{const{unsavedDestinations:l}=Pa(),r=Jt(()=>{const e=[];l.length&&e.push(t(lo,{listType:F.UNSAVED,unsavedDestinations:l},"unsaved"));for(const l of Object.values(F)){if(n.categoryType&&n.categoryType!==l)continue;const r=oo(a[l],o,n);r.length&&e.push(t(lo,{listType:l,destinationOptions:r},l))}return e},[l,a,o,n]);return{width:"40%",list:r.length?r:e?[t(ue,{$height:"100%",children:t(ge,{title:"Fetching destinations",subTitle:"Please wait while we fetch the destinations",withSpinner:!0})},"loading")]:[]}},io=({destinationsByCategory:o,filters:n,setFilters:l})=>{const r=Jt(()=>Object.values(F).map(e=>({id:e,label:e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()})).filter(e=>o[e.id]?.length),[o]),i=Jt(()=>{const e=Object.values(z).map(e=>({value:e,label:e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}));return e.unshift({value:null,label:"All"}),e},[]);return e(a,{children:[t(ye,{placeholder:"Select category",options:r,values:n.categoryType?[n.categoryType]:[],setValues:e=>l({...n,categoryType:n.categoryType===e[0]?null:e[0]})}),t($,{size:be.S,options:i,selected:n.signalType,setSelected:e=>l({...n,signalType:e})})]})};var so;!function(e){e.SELF_HOSTED="self hosted",e.MANAGED="managed"}(so||(so={}));const co=({onClose:e,onBack:a,onNext:o,selectedConnectionIds:n,setSelectedConnectionIds:l,getDestinationCategories:r,getPotentialDestinations:i,initialInputs:s,testConnection:c,createDestination:d,updateDestination:u,withOverlay:p,disableAnimation:h})=>{const[m,g]=Gt(""),[f,v]=Gt({categoryType:null,signalType:null}),{destinations:y}=Se(),{activeForm:b,genericForm:S,formErrorMessage:C,unsavedDestinations:k,setUnsavedDestinations:w}=Pa();Ht(()=>{s&&w(s)},[s]);const[x,T]=Gt(!0),[N,D]=Gt([]),[A,E]=Gt({[F.ALL]:[],[F.UNSAVED]:[],[F.EXISTS]:[],[F.DETECTED]:[],[F.SELF_HOSTED]:[],[F.MANAGED]:[]});Ht(()=>{const e=y.map(e=>{let t;for(const a of N){const o=a.items.find(t=>t.type===e.destinationType.type);if(o){t=o;break}}const a=V(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})):[]}});E(t=>({...t,[F.EXISTS]:e}))},[y,N]);const R=Wt(async()=>{try{T(!0);const[e,t]=await Promise.all([r(),i()]);e&&D(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===so.SELF_HOSTED?o.push(...e.items):e.name===so.MANAGED&&n.push(...e.items)}),t&&t?.potentialDestinations.forEach(t=>{for(const o of e?.destinationCategories?.categories||[]){const e=I(o),n=e.items.findIndex(e=>e.type===t.type);if(-1!==n){const o=V(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=>({...e,[F.DETECTED]:a,[F.SELF_HOSTED]:o,[F.MANAGED]:n}))}catch(e){}finally{T(!1)}},[]);Ht(()=>{R()},[]);const $=Wt(async()=>{const e=(await Promise.all(k.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 u(e.id,t,n)}return d(t,n)}))).filter(e=>e?.error);if(e.length)return{error:e.map(e=>e?.error).join("\n")}},[k,n,d,u]);return t(aa,{isOpen:!0,withOverlay:p,disableAnimation:h,onClose:e,onBack:a?()=>a(k):void 0,onNext:o?()=>o(k):void 0,nextIsSkip:!k.length,onSave:$,disableSave:!b&&!k.length,isFetching:x,errorMessage:C,isFormDirty:S?.isFormDirty,hideDirtyNote:!0,progress:{title:pe.CREATING_DESTINATION,subTitle:pe.CREATING_DESTINATION_SUBTITLE},header:{icon:St,title:pe.ADD_DESTINATIONS,subTitle:pe.ADD_DESTINATION_DRAWER_DESCRIPTION},connectionIds:n&&l?{value:n,setValue:l}:void 0,search:{value:m,onChange:g},filters:t(io,{destinationsByCategory:A,filters:f,setFilters:v}),leftColumn:ro({isFetching:x,destinationsByCategory:A,searchText:m,filters:f}),rightColumn:Za({testConnection:c})})},uo=({onClose:e,selectedConnectionIds:a,setSelectedConnectionIds:o,createInstrumentationRule:n,withOverlay:l})=>{const[r,i]=Gt(""),s=Qt(null),{selectedOption:c,onSelectOption:d,genericForm:u,validateFormData:p,errorMessage:h}=Ka(),m=Jt(()=>r?Ce.filter(e=>e.label.toLowerCase().includes(r.toLowerCase())):Ce,[r]),g=Jt(()=>m.map(e=>{const a=c?.type===e.type;return t(da,{dataId:`option-${e.type}`,title:e.label,description:e.description,withCarret:!0,isSelected:a,onClick:()=>{s.current?.clearErrors(),d(e)}},e.type)}),[c,m.length,d]),f=Jt(()=>c?[t(Ga,{},c.type)]:[t(ue,{$height:"100%",children:t(E,{icon:Tt,title:"Instrumentation rule not selected",subTitle:"Please select an instrumentation rule to add"})},"no-data")],[c]);return t(aa,{ref:s,isOpen:!0,withOverlay:l,onClose:e,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:pe.CREATING_INSTRUMENTATION_RULE,subTitle:pe.CREATING_INSTRUMENTATION_RULE_SUBTITLE},header:{icon:Tt,title:pe.ADD_INSTRUMENTATION_RULE,subTitle:pe.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}})},po=o.div``,ho=o.div`
47
- visibility: hidden;
48
-
49
- transition: visibility 0s;
50
- & * {
51
- transition-duration: 0s;
52
- }
53
-
54
- ${po}:hover & {
55
- visibility: visible;
56
- }
57
- `,mo=({workloadName:e,workloadKind:a,isChecked:o,onToggle:l,disabled:r,disabledReason:i})=>{const s=n(),d=()=>{};return t(po,{children:t(da,{dataId:`source-${e}`,title:e,disabled:r,onClick:r?d:l,isChecked:o,onCheckboxChange:r?d:l,children:r&&i?t(Q,{label:i,status:U.Default,textSize:c.XXXS}):t(ho,{children:t(Q,{label:a,status:U.Info,textSize:c.XXXS,backgroundColor:s.v2.colors.blue[900]})})})})},go=({formData:a,handleSourceChange:o,handleSelectAll:n,selectedArea:l,searchText:i,searchBy:d,filters:u})=>{const{tier:p}=te(),h=p===ie.Onprem,m=Jt(()=>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=Jt(()=>m?[...m.workloads].sort((e,t)=>e.name.localeCompare(t.name)).filter(e=>le(e,i,u)):[],[m,i,u]),f=Jt(()=>!!g.length&&g.every(({selected:e})=>e),[g]),v=Jt(()=>{if(!m)return[];const{clusterId:e}=l.value,{name:a}=m;return g.map(({name:n,selected:l,kind:r})=>{const i=!h&&ne.has(r);return t(mo,{workloadName:n,workloadKind:r,isChecked:!i&&(l||!1),onToggle:()=>o({clusterId:e,workloadId:{namespace:a,name:n,kind:r}}),disabled:i,disabledReason:"Enterprise only"},`${e}#${a}#${n}#${r}`)})},[g,m,l.value.clusterId]),{withFilterCount:y,filteredCount:b,totalCount:S}=Jt(()=>{const e=m?.workloads.length??0;return{withFilterCount:g.length!==e,filteredCount:g.length,totalCount:e}},[g,m]);return{width:"40%",header:e(r,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(r,{$gap:8,children:[t(s,{size:c.XS,nowrap:!0,children:l.value.namespaceName?`${l.value.namespaceName} > Workloads`:"Workloads"}),t(H,{text:y?pe.FILTERED_COUNT_TOOLTIP:void 0,children:t(Q,{label:`${y?`${b} / ${S}`:S}`,status:ke.Unknown})})]}),t(s,{"data-id":"workloads-select-all",onClick:()=>n({clusterId:l.value.clusterId,namespaceName:l.value.namespaceName,boolean:!f,searchText:i,searchBy:d,filters:u}),disabled:!v.length,size:c.XS,children:(f?"Unselect":"Select")+" all"})]}),list:m?v:[t(ue,{$height:"100%",children:t(E,{icon:Nt,title:pe.SELECT_NAMESPACE,subTitle:pe.SELECT_NAMESPACE_SUBTITLE})},"no-data")]}},fo=o.div``,vo=o.div`
58
- visibility: ${({$visible:e})=>e?"visible":"hidden"};
59
-
60
- transition: visibility 0s;
61
- ${({$visible:e})=>!e&&"& * {\n transition-duration: 0s !important;\n }"}
62
-
63
- ${fo}:hover & {
64
- visibility: visible;
65
- }
66
- `,yo=({clusterId:a,namespaceName:o,checkbox:l,isFutureApps:i,selectedCounts:d,isActive:u,onActive:p,handleSourceChange:h})=>{const m=n(),g=e=>{p(),h({clusterId:a,workloadId:{namespace:o},auto:e.auto,selected:e.all})};return t(fo,{children:t(da,{dataId:`namespace-${o}`,withCarret:!0,title:o,isSelected:u,onClick:p,isPartiallyChecked:l.partial,isChecked:l.all,onCheckboxChange:e=>g({auto:e,all:e}),children:e(r,{$gap:12,children:[t(vo,{$visible:u||i,children:t(H,{text:"Automatically instrument all workloads currently in the namespace, and all workloads that will be deployed to this namespace in the future",children:t(b,{label:"Auto",size:we.S,value:i,onChange:e=>g({auto:e,all:e||void 0})})})}),e(r,{$gap:8,children:[t(s,{variant:xe.Span,size:c.XXXS,color:m.v2.colors.silver[200],align:"right",children:"Selected"}),t(Q,{label:`${d.sourced}/${d.total}`,status:u?U.Default:ke.Unknown,minWidth:"42px"})]})]})})})},bo=({withCollapse:e,clusterId:a,clusterName:o,namespaces:n,selectedArea:l,setSelectedArea:r,handleSourceChange:i})=>{const s=Jt(()=>n.map(({name:e,totalWorkloads:n,selectedCount:s,isAllSourced:c,isSomeSourced:d,isFutureApps:u})=>t(yo,{clusterId:a,namespaceName:e,isFutureApps:u,checkbox:{all:c,partial:d},selectedCounts:{sourced:s,total:n},isActive:l.clusterId===a&&l.namespaceName===e,onActive:()=>r({clusterId:a,clusterName:o,namespaceName:e}),handleSourceChange:i},`${a}#${e}`)),[a,o,n,l]);return e?t(ao,{title:o,list:s,noBgColor:!0}):s},So=({isFetching:a,formData:o,handleSourceChange:n,handleSelectAll:l,selectedArea:i,setSelectedArea:d,searchText:u,searchBy:p,filters:h})=>{const m=Jt(()=>o.map(e=>{const t=[...e.namespaces].sort((e,t)=>e.name.localeCompare(t.name)).filter(e=>re(e,u,h)).map(e=>({name:e.name,totalWorkloads:e.workloads.length,...Te(e)}));return{clusterId:e.clusterId,clusterName:e.clusterName,visibleNamespaces:t}}),[o,u,h]),g=Jt(()=>{let e=!1;for(const{visibleNamespaces:t}of m)for(const{totalWorkloads:a,selectedCount:o}of t)if(e=!0,o!==a)return!1;return e},[m]),{list:f,withFilterCount:v,filteredCount:y,totalCount:b}=Jt(()=>{const e=m.map(({clusterId:e,clusterName:a,visibleNamespaces:o})=>o.length?t(bo,{withCollapse:m.length>1,clusterId:e,clusterName:a,namespaces:o,selectedArea:i,setSelectedArea:d,handleSourceChange:n},e):null),a=e.filter(e=>null!==e);return{list:a,withFilterCount:a.length!==e.length,filteredCount:a.length,totalCount:e.length}},[m,i]);return{width:"60%",header:e(r,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(r,{$gap:8,children:[t(s,{size:c.XS,nowrap:!0,children:"Namespaces"}),t(H,{text:v?pe.FILTERED_COUNT_TOOLTIP:void 0,children:t(Q,{label:`${v?`${y} / ${b}`:b}`,status:ke.Unknown})})]}),t(s,{"data-id":"namespaces-select-all",onClick:()=>l({boolean:!g,searchText:u,searchBy:p,filters:h}),disabled:!f.length,size:c.XS,children:(g?"Unselect":"Select")+" all"})]}),list:f.length?f:a?[t(ue,{$height:"100%",children:t(ge,{title:pe.FETCHING_NAMESPACES,subTitle:pe.FETCHING_NAMESPACES_SUBTITLE,withSpinner:!0})},"loading")]:[]}},Co=({onClose:a,onBack:o,onNext:l,selectedConnectionIds:i,setSelectedConnectionIds:d,persistSources:u,withOverlay:p,disableAnimation:h})=>{const m=n(),{progress:g,resetProgress:f}=Ne(),{isFetching:v,formData:y,handleSourceChange:S,handleSelectAll:C,formDiff:k,isFormDirty:w}=Ya(),[x,T]=Gt(""),[N,D]=Gt(se.Namespace),[A,I]=Gt({showOnlySelected:!1}),[E,R]=Gt({clusterId:"",clusterName:"",namespaceName:""});return t(aa,{isOpen:!0,withOverlay:p,disableAnimation:h,onClose:a?()=>{f(De.BulkInstrumenting),a()}:void 0,onBack:o?()=>o(k):void 0,onNext:l?()=>l(k):void 0,nextIsSkip:!w,onSave:()=>u(k),header:{icon:Nt,title:pe.ADD_SOURCE,subTitle:pe.ADD_SOURCES_DESCRIPTION},connectionIds:i&&d?{value:i,setValue:d}:void 0,search:{value:x,onChange:e=>{T(e),N===se.Namespace&&R({clusterId:"",clusterName:"",namespaceName:""})},segment:{options:[{label:"Namespace",value:se.Namespace},{label:"Source",value:se.Source}],selected:N,setSelected:D}},filters:e(r,{$gap:8,children:[t(s,{size:c.XXXS,color:m.v2.colors.silver[200],nowrap:!0,children:"Show only:"}),t(b,{name:"filter-selected",size:we.S,label:"Selected",value:A.showOnlySelected,onChange:e=>I(t=>({...t,showOnlySelected:e}))})]}),isFormDirty:w,isFetching:v,progress:{title:pe.CREATING_SOURCES,subTitle:pe.CREATING_SOURCES_SUBTITLE,percentage:g[De.BulkInstrumenting]?.percentage||0},leftColumn:So({isFetching:v,formData:y,handleSourceChange:S,handleSelectAll:C,selectedArea:E,setSelectedArea:R,searchText:N===se.Namespace?x:"",searchBy:N,filters:A}),rightColumn:go({formData:y,handleSourceChange:S,handleSelectAll:C,selectedArea:{value:E},searchText:N===se.Source?x:"",searchBy:N,filters:A})})},ko=["action","endpoint","scope","duration"],wo=o.span`
67
- font-family: ${({theme:e,$isMono:t})=>t?e.font_family.secondary:e.font_family.primary};
68
- font-size: ${({theme:e})=>e.v2.text.size.xxxs}px;
69
- line-height: 20px;
70
- 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]}}};
71
- `,xo=({parts:e})=>t(a,{children:e.map((e,a)=>t(wo,{$variant:e.variant,$isMono:ko.includes(e.variant),children:e.text},a))});var To;!function(e){e.Noisy="noisy",e.HighlyRelevant="highly-relevant",e.CostReduction="cost-reduction"}(To||(To={}));const No=[{value:To.Noisy,label:"Noisy Operations",tooltip:"Rules that reduce noise from high-volume, low-value operations"},{value:To.HighlyRelevant,label:"Highly Relevant Operations",tooltip:"Rules that prioritize important traces for retention"},{value:To.CostReduction,label:"Cost Reduction",tooltip:"Rules that optimize costs by sampling less critical data"}],Do={[To.Noisy]:"This is the most efficient way to sample (with Head Sampling). Prefer to use it where possible.",[To.HighlyRelevant]:'Any trace from the "Noisy Operations" category is sampled prior to checking highly relevance.',[To.CostReduction]:"Cost reduction rules use Tail Sampling to drop traces that are unlikely to be useful for debugging or monitoring."},Ao={[To.Noisy]:"Noisy Operations rules list",[To.HighlyRelevant]:"Highly Relevant Operations rules list",[To.CostReduction]:"Cost Reduction rules list"},Io={[To.Noisy]:"noisy",[To.HighlyRelevant]:"highlyRelevant",[To.CostReduction]:"costReduction"};function Eo(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 Ro(e){if(!e?.length)return[{text:" for ",variant:"default"},{text:"entire cluster",variant:"scope"}];const t=e.map(Eo).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 $o(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 Po(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(...$o(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(...Ro(e.sourceScopes)),t}function Oo(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(...$o(a,o))}else t.push({text:" on ",variant:"default"}),t.push({text:"any operation",variant:"endpoint"});return t.push(...Ro(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 Mo(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(...$o(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(...Ro(e.sourceScopes)),t}function Fo(e){return e.error?"Error":null!=e.durationAtLeastMs?"Duration":"Relevance"}function Lo(e,t,a){const o=Io[t],n=[];for(const l of e)switch(t){case To.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:Po(e),category:o});break;case To.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:Oo(e),category:o,typeBadge:Fo(e)});break;case To.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:Mo(e),category:o})}return n}function zo(e,t){switch(e){case"noisy":return Po(t);case"highlyRelevant":return Oo(t);case"costReduction":return Mo(t)}}function Xo(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 Vo(e,t){const a=Xo(e,t.samplingId,t.rule.ruleId,t.category);return a?{...a,summary:zo(a.category,a.rule)}:null}function _o(e,t){const a=Xo(e,t.samplingId,t.ruleId,t.category);return a?{...a,summary:t.summary}:null}function Bo(e){return null==e||Array.isArray(e)&&0===e.length?null:e}function Uo(e,t){return JSON.stringify({sourceScopes:Bo(e),operation:Bo(t)})}function jo(e,t,a,o){return JSON.stringify({sourceScopes:Bo(e),error:t??!1,durationAtLeastMs:Bo(a),operation:Bo(o)})}function Ho(e,t){return JSON.stringify({sourceScopes:Bo(e),operation:Bo(t)})}function Ko(e,t,a,o){switch(t){case"noisy":{const t=Uo(a.sourceScopes,a.operation);for(const a of e)for(const e of a.noisyOperations)if((!o||e.ruleId!==o)&&Uo(e.sourceScopes,e.operation)===t)return e.ruleId;return null}case"highlyRelevant":{const t=jo(a.sourceScopes,a.error,a.durationAtLeastMs,a.operation);for(const a of e)for(const e of a.highlyRelevantOperations)if((!o||e.ruleId!==o)&&jo(e.sourceScopes,e.error,e.durationAtLeastMs,e.operation)===t)return e.ruleId;return null}case"costReduction":{const t=Ho(a.sourceScopes,a.operation);for(const a of e)for(const e of a.costReductionRules)if((!o||e.ruleId!==o)&&Ho(e.sourceScopes,e.operation)===t)return e.ruleId;return null}}}function Go(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 Wo(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 qo(e){if("custom"===e.durationPreset){const t=parseFloat(e.customDurationMs);return isNaN(t)?null:t}return parseInt(e.durationPreset,10)}function Yo(e){return{httpServer:{[e.routeType]:e.route||null,method:e.method||null}}}function Jo(e){return"all"===e.operationType?null:"httpServer"===e.operationType?Yo(e):"httpClient"===e.operationType?{httpClient:{serverAddress:e.serverAddress||null,["route"===e.routeType?"templatedPath":"templatedPathPrefix"]:e.route||null,method:e.method||null}}:null}function Qo(e){return"all"===e.operationType?null:"httpServer"===e.operationType?Yo(e):"kafkaConsumer"===e.operationType?{kafkaConsumer:{kafkaTopic:e.kafkaTopic||null}}:"kafkaProducer"===e.operationType?{kafkaProducer:{kafkaTopic:e.kafkaTopic||null}}:null}const Zo="Unnamed rule",en="Edit rule",tn="Cancel",an="Sampling Preview",on="Source Scope",nn="Operation",ln="Duration",rn="Errors",sn="Rule name",cn="Rule type",dn="Note",un="HTTP route",pn="Method",hn="Keep Percentage",mn="Drop Percentage",gn="Keep traces with duration larger than",fn="Keep traces with errors",vn="Keep at least this percentage of matching traces",yn="Keep at most this percentage of matching traces",bn={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."},Sn="60vw",Cn="Type here",kn={noisy:"Create 'Noisy Operations' sampling rule",highlyRelevant:"Create 'Highly Relevant Operations' sampling rule",costReduction:"Create 'Cost Reduction' sampling rule"},wn=o.div`
30
+ align-items: flex-end;
31
+ gap: 16px;
32
+ `,Oo=p.div`
33
+ width: 280px;
34
+ flex-shrink: 0;
35
+ `,Mo=p.div`
72
36
  display: flex;
73
37
  flex-direction: column;
74
- gap: 8px;
75
- `,xn=o(r)`
76
- align-items: center;
77
- gap: 8px;
78
- `,Tn=o.div`
38
+ gap: 4px;
39
+ `,Fo=p.div`
79
40
  flex: 1;
80
41
  min-width: 0;
81
- padding: 8px 16px;
82
- border-radius: 8px;
83
- background-color: ${({theme:e})=>e.v2.colors.silver[800]};
84
- white-space: pre;
85
- overflow-x: auto;
86
- `,Nn=({category:a,formState:o,onChange:l})=>{const r=n(),i=Jt(()=>{switch(a){case"noisy":return Po({ruleId:"",name:(e=o).name||null,disabled:!1,notes:e.notes||null,sourceScopes:Go(e)??null,percentageAtMost:Wo(e),operation:Jo(e)});case"highlyRelevant":return Oo(function(e){return{ruleId:"",name:e.name||null,disabled:!1,notes:e.notes||null,sourceScopes:Go(e)??null,error:e.keepErrors,durationAtLeastMs:"Duration"===e.ruleType?qo(e):null,percentageAtLeast:Wo(e),operation:Qo(e)}}(o));case"costReduction":return Mo(function(e){return{ruleId:"",name:e.name||null,disabled:!1,notes:e.notes||null,sourceScopes:Go(e)??null,percentageAtMost:Wo(e)??0,operation:Qo(e)}}(o))}var e},[a,o]),d=1===i.length&&"default"===i[0].variant;return e(wn,{children:[t(s,{size:c.XXS,color:r.v2.colors.silver[200],children:an}),e(xn,{children:[t(Tn,{children:d?t(s,{size:c.XXXS,color:r.v2.colors.grey[500],children:"No preview available"}):t(xo,{parts:i})}),l&&t(b,{value:!o.disabled,onChange:e=>l({disabled:!e}),size:we.S,label:"Rule Enabled",labelAlign:S.Right})]})]})},Dn=o.div`
42
+ `,Lo=[{value:"Relevance",label:"Relevance"},{value:"Error",label:"Error"},{value:"Duration",label:"Duration"}],zo=({category:a,formState:n,onChange:o})=>{const l=r(e=>o({name:e.target.value}),[o]),i=r(e=>o({notes:e.target.value}),[o]),s=r(e=>{o({ruleType:e,keepErrors:"Error"===e})},[o]);return t(be,{children:e($o,{children:[t(Oo,{children:t(w,{name:"sampling-input-rule-name",label:Se,tooltip:"Optional. Give this rule a name for easier identification.",placeholder:ye,value:n.name,onChange:l})}),"highlyRelevant"===a&&e(Mo,{children:[t(C,{label:Ce}),t(B,{size:ke.S,options:Lo,selected:n.ruleType,setSelected:s})]}),t(Fo,{children:t(w,{name:"sampling-input-note",label:xe,tooltip:Te,placeholder:we,value:n.notes,onChange:i})})]})})},Vo=p.div`
87
43
  display: flex;
88
- flex-direction: column;
44
+ flex-wrap: wrap;
45
+ align-items: flex-end;
89
46
  gap: 16px;
90
- padding: 16px;
91
- border-radius: 16px;
92
- background-color: ${({theme:e})=>e.v2.colors.silver[800]};
93
- `,An=o(Dn)`
94
- flex: 1;
95
- `,In=o.div`
96
- display: flex;
97
- gap: 32px;
98
- `,En=o.div`
99
- display: flex;
100
- flex-direction: column;
101
- gap: 4px;
102
- `,Rn=o.div`
47
+ `,Xo=p.div`
103
48
  display: flex;
104
49
  align-items: flex-end;
105
50
  gap: 16px;
106
- `,$n=o.div`
107
- width: 280px;
108
- flex-shrink: 0;
109
- `,Pn=o.div`
51
+ padding: 12px 16px;
52
+ border-radius: 8px;
53
+ background-color: ${({theme:e})=>e.v2.colors.black[500]};
54
+ `,Bo=p.div`
110
55
  display: flex;
111
- flex-direction: column;
112
- gap: 4px;
113
- `,On=o.div`
56
+ align-items: flex-end;
57
+ gap: 10px;
114
58
  flex: 1;
115
- min-width: 0;
116
- `,Mn=[{value:"Relevance",label:"Relevance"},{value:"Error",label:"Error"},{value:"Duration",label:"Duration"}],Fn=({category:a,formState:o,onChange:n})=>{const l=Wt(e=>n({name:e.target.value}),[n]),r=Wt(e=>n({notes:e.target.value}),[n]),i=Wt(e=>{n({ruleType:e,keepErrors:"Error"===e})},[n]);return t(Dn,{children:e(Rn,{children:[t($n,{children:t(m,{label:sn,tooltip:"Optional. Give this rule a name for easier identification.",placeholder:"Type rule name",value:o.name,onChange:l})}),"highlyRelevant"===a&&e(Pn,{children:[t(p,{label:cn}),t($,{size:be.S,options:Mn,selected:o.ruleType,setSelected:i})]}),t(On,{children:t(m,{label:dn,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})})]})})},Ln=o.div`
59
+ `,_o=p.div`
117
60
  display: flex;
118
- flex-direction: column;
119
- gap: 4px;
120
- `,zn=o.div`
61
+ align-items: center;
62
+ height: 32px;
63
+ `,Uo=p.div`
64
+ display: flex;
65
+ align-items: center;
66
+ height: 32px;
67
+ `,jo=()=>t(Uo,{children:t(v,{size:b.XS,weight:500,children:"And"})}),Ho=[{value:"all",label:"All operations"},{value:"httpServer",label:"HTTP server"},{value:"httpClient",label:"HTTP client"}],Wo=[{value:"all",label:"All operations"},{value:"httpServer",label:"HTTP server"},{value:"kafkaConsumer",label:"Kafka consumer"},{value:"kafkaProducer",label:"Kafka producer"}],Ko=[{id:"",label:"Any method"},{id:"GET",label:"GET"},{id:"POST",label:"POST"},{id:"PUT",label:"PUT"},{id:"DELETE",label:"DELETE"},{id:"PATCH",label:"PATCH"}],Go=({category:n,formState:o,onChange:l})=>{const i=c(()=>"noisy"===n?Ho:Wo,[n]),s=r(e=>l({operationType:e,route:"",serverAddress:"",method:"",kafkaTopic:""}),[l]),d=r(e=>t=>{t&&l({routeType:e,route:""})},[l]),u=r(e=>l({route:e.target.value}),[l]),p=r(e=>l({serverAddress:e.target.value}),[l]),m=r(e=>l({method:e[0]||""}),[l]),h=r(e=>l({kafkaTopic:e.target.value}),[l]),g="httpServer"===o.operationType||"httpClient"===o.operationType,f="kafkaConsumer"===o.operationType||"kafkaProducer"===o.operationType,v="httpClient"===o.operationType?Pe:$e,b="httpClient"===o.operationType?Oe:Me;return e(be,{richTitle:{title:Ne,subTitle:De},children:[t(B,{size:ke.S,options:i,selected:o.operationType,setSelected:s}),g&&e(Vo,{children:["httpClient"===o.operationType&&e(a,{children:[t("div",{style:{flex:1},children:t(w,{name:"sampling-input-server-address",label:Ie,placeholder:Ae,value:o.serverAddress,onChange:p})}),t(jo,{})]}),e(Xo,{children:[e(Bo,{children:[t(_o,{children:t(Ee,{"data-id":"sampling-radio-route",value:"route"===o.routeType,onChange:d("route")})}),t(w,{name:"sampling-input-route",label:v,placeholder:Re,value:"route"===o.routeType?o.route:"",onChange:u,disabled:"route"!==o.routeType})]}),e(Bo,{children:[t(_o,{children:t(Ee,{"data-id":"sampling-radio-route-prefix",value:"routePrefix"===o.routeType,onChange:d("routePrefix")})}),t(w,{name:"sampling-input-route-prefix",label:b,placeholder:Re,value:"routePrefix"===o.routeType?o.route:"",onChange:u,disabled:"routePrefix"!==o.routeType})]})]}),t(jo,{}),t(Fe,{items:Ko,selectedIds:[o.method||""],setSelectedIds:e=>m(e),buttonProps:{"data-id":"sampling-btn-method",label:Ko.find(e=>e.id===o.method)?.label||"Any method",size:$.S,variant:O.Secondary}})]}),f&&t(w,{name:"sampling-input-kafka-topic",label:Le,placeholder:"Type kafka topic",value:o.kafkaTopic,onChange:h,width:"320px"})]})},qo=p.div`
68
+ display: flex;
69
+ align-items: flex-end;
70
+ gap: 16px;
71
+ `,Yo=[{value:"all",label:"drop all"},{value:"sample",label:"sample"}],Jo=[{value:"all",label:"keep all"},{value:"sample",label:"sample"}],Qo=[{value:"50",label:"50%"},{value:"25",label:"25%"},{value:"10",label:"10%"},{value:"1",label:"1%"},{value:"custom",label:"Custom"}],Zo=[{value:"10",label:"10%"},{value:"1",label:"1%"},{value:"0.5",label:"0.5%"},{value:"0.1",label:"0.1%"},{value:"custom",label:"Custom"}],el=({category:n,formState:o,onChange:l})=>{const i="highlyRelevant"===n,s=i?Jo:Yo,c=i?Xe:Be,d=i?ze:Ve,u=i?_e:Ue,p="noisy"===n?Zo:Qo,m=r(e=>l({percentageMode:e}),[l]),h=r(e=>l({percentagePreset:e}),[l]),g=r(e=>l({customPercentage:e.target.value}),[l]);return e(be,{richTitle:{title:c,subTitle:d},children:["costReduction"!==n&&t(B,{size:ke.S,options:s,selected:o.percentageMode,setSelected:m}),("costReduction"===n||"sample"===o.percentageMode)&&e(a,{children:[t(v,{size:b.XXXS,children:u}),e(qo,{children:[t(B,{size:ke.S,options:p,selected:o.percentagePreset,setSelected:h}),"custom"===o.percentagePreset&&t(w,{name:"sampling-input-custom-percentage",label:je,placeholder:"5%",type:T.Number,value:o.customPercentage,onChange:g,width:160})]})]})]})},tl=p.div`
121
72
  display: flex;
122
73
  flex-wrap: wrap;
123
74
  gap: 8px;
124
- `,Xn=o.div`
75
+ `,al=p.div`
125
76
  display: flex;
126
77
  align-items: center;
127
78
  gap: 8px;
@@ -134,18 +85,18 @@ import{jsxs as e,jsx as t,Fragment as a}from"react/jsx-runtime";import o,{useThe
134
85
  &:hover {
135
86
  background: ${({theme:e})=>e.v2.colors.silver[700]};
136
87
  }
137
- `,Vn=o.div`
88
+ `,nl=p.div`
138
89
  display: flex;
139
90
  width: 32px;
140
91
  height: 32px;
141
92
  justify-content: center;
142
93
  align-items: center;
143
94
  flex-shrink: 0;
144
- `,_n=o.div`
95
+ `,ol=p.div`
145
96
  display: flex;
146
97
  flex-wrap: wrap;
147
98
  gap: 8px;
148
- `,Bn=o.div`
99
+ `,ll=p.div`
149
100
  display: flex;
150
101
  align-items: center;
151
102
  gap: 6px;
@@ -153,7 +104,7 @@ import{jsxs as e,jsx as t,Fragment as a}from"react/jsx-runtime";import o,{useThe
153
104
  border-radius: 8px;
154
105
  background-color: ${({theme:e})=>e.v2.colors.silver[700]};
155
106
  border: 1px solid ${({theme:e})=>e.v2.colors.silver[500]};
156
- `,Un=o.div`
107
+ `,rl=p.div`
157
108
  display: flex;
158
109
  align-items: center;
159
110
  cursor: pointer;
@@ -161,86 +112,21 @@ import{jsxs as e,jsx as t,Fragment as a}from"react/jsx-runtime";import o,{useThe
161
112
  &:hover {
162
113
  opacity: 1;
163
114
  }
164
- `,jn={[Ee.JavaScript]:"Node.js",[Ee.DotNet]:".NET",[Ee.Php]:"PHP"},Hn=[Ee.Python,Ee.Java,Ee.JavaScript,Ee.DotNet,Ee.Php,Ee.Ruby,Ee.Go].map(e=>({id:e,label:jn[e]??e.charAt(0).toUpperCase()+e.slice(1),Icon:ee(e)})),Kn=[{value:"all",label:"Entire Cluster"},{value:"source",label:"Specific source"},{value:"namespace",label:"Specific Namespace"},{value:"language",label:"Specific programming language"}];function Gn(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: ${jn[e.workloadLanguage]??e.workloadLanguage}`}return"Entire Cluster"}const Wn=({formState:a,onChange:o,sourceOptions:l=[],namespaceOptions:r=[]})=>{const d=n(),[u,p]=Gt("all"),h=a.sourceScopes.length>0,m=Jt(()=>Kn.map(e=>({...e,disabled:"all"===e.value&&h})),[h]),g=Wt(e=>{p(e)},[]),f=Wt(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]),v=Wt(e=>{if(!e)return;const t={scopeType:"namespace",workloadName:"",workloadKind:"",workloadNamespace:e.id,workloadLanguage:""};o({sourceScopes:[...a.sourceScopes,t]})},[a.sourceScopes,o]),y=Wt(e=>{const t={scopeType:"language",workloadName:"",workloadKind:"",workloadNamespace:"",workloadLanguage:e};o({sourceScopes:[...a.sourceScopes,t]})},[a.sourceScopes,o]),b=Wt(e=>{const t=a.sourceScopes.filter((t,a)=>a!==e);o({sourceScopes:t})},[a.sourceScopes,o]),S=Jt(()=>{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]),C=Jt(()=>{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]),k=Jt(()=>{const e=new Set(a.sourceScopes.filter(e=>"language"===e.scopeType).map(e=>e.workloadLanguage));return Hn.filter(t=>!e.has(t.id))},[a.sourceScopes]),w=!h&&"all"===u;return e(Dn,{children:[e(Ln,{children:[t(s,{size:c.XS,weight:500,children:on}),t(s,{size:c.XXXS,color:d.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."})]}),h&&t(_n,{children:a.sourceScopes.map((a,o)=>e(Bn,{children:[t(s,{size:c.XXXS,color:d.v2.colors.white[500],nowrap:!0,children:Gn(a)}),t(Un,{onClick:()=>b(o),children:t(xt,{size:12,fill:d.v2.colors.grey[400]})})]},o))}),t($,{size:be.S,options:m,selected:u,setSelected:g}),w&&t(B,{status:U.Default,message:"Rule will apply to all sources in the cluster",fullWidth:!0}),"source"===u&&t(Ae,{options:S,value:"",onSelect:f,placeholder:"Search source name"}),"namespace"===u&&t(Ae,{options:C,value:"",onSelect:v,placeholder:"Search namespace"}),"language"===u&&t(zn,{children:k.map(({id:a,label:o,Icon:n})=>e(Xn,{$selected:!1,onClick:()=>y(a),children:[t(i,{size:Ie.S,value:!1,onChange:()=>y(a)}),t(Vn,{children:t(n,{size:20})}),t(s,{size:c.XS,nowrap:!0,children:o})]},a))})]})},qn=o.div`
165
- display: flex;
166
- flex-direction: column;
167
- gap: 4px;
168
- `,Yn=o.div`
169
- display: flex;
170
- flex-wrap: wrap;
171
- align-items: flex-end;
172
- gap: 16px;
173
- `,Jn=o.div`
174
- display: flex;
175
- align-items: flex-end;
176
- gap: 16px;
177
- padding: 12px 16px;
178
- border-radius: 8px;
179
- background-color: ${({theme:e})=>e.v2.colors.black[500]};
180
- `,Qn=o.div`
181
- display: flex;
182
- align-items: flex-end;
183
- gap: 10px;
184
- flex: 1;
185
- `,Zn=o.div`
186
- display: flex;
187
- align-items: center;
188
- height: 32px;
189
- `,el=o.div`
190
- display: flex;
191
- align-items: center;
192
- height: 32px;
193
- `,tl=()=>t(el,{children:t(s,{size:c.XS,weight:500,children:"And"})}),al=[{value:"all",label:"All operations"},{value:"httpServer",label:"HTTP server"},{value:"httpClient",label:"HTTP client"}],ol=[{value:"all",label:"All operations"},{value:"httpServer",label:"HTTP server"},{value:"kafkaConsumer",label:"Kafka consumer"},{value:"kafkaProducer",label:"Kafka producer"}],nl=[{id:"",label:"Any method"},{id:"GET",label:"GET"},{id:"POST",label:"POST"},{id:"PUT",label:"PUT"},{id:"DELETE",label:"DELETE"},{id:"PATCH",label:"PATCH"}],ll=({category:o,formState:l,onChange:r})=>{const i=n(),d=Jt(()=>"noisy"===o?al:ol,[o]),u=Wt(e=>r({operationType:e,route:"",serverAddress:"",method:"",kafkaTopic:""}),[r]),p=Wt(e=>t=>{t&&r({routeType:e,route:""})},[r]),h=Wt(e=>r({route:e.target.value}),[r]),g=Wt(e=>r({serverAddress:e.target.value}),[r]),f=Wt(e=>r({method:e[0]||""}),[r]),v=Wt(e=>r({kafkaTopic:e.target.value}),[r]),y="httpServer"===l.operationType||"httpClient"===l.operationType,b="kafkaConsumer"===l.operationType||"kafkaProducer"===l.operationType,S="httpClient"===l.operationType?"Templated path":un,C="httpClient"===l.operationType?"Templated path prefix":"HTTP route prefix";return e(Dn,{children:[e(qn,{children:[t(s,{size:c.XS,weight:500,children:nn}),t(s,{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."})]}),t($,{size:be.S,options:d,selected:l.operationType,setSelected:u}),y&&e(Yn,{children:["httpClient"===l.operationType&&e(a,{children:[t("div",{style:{flex:1},children:t(m,{label:"Server address",placeholder:"e.g. collector.my.vendor.com",value:l.serverAddress,onChange:g})}),t(tl,{})]}),e(Jn,{children:[e(Qn,{children:[t(Zn,{children:t(Re,{value:"route"===l.routeType,onChange:p("route")})}),t(m,{label:S,placeholder:Cn,value:"route"===l.routeType?l.route:"",onChange:h,disabled:"route"!==l.routeType})]}),e(Qn,{children:[t(Zn,{children:t(Re,{value:"routePrefix"===l.routeType,onChange:p("routePrefix")})}),t(m,{label:C,placeholder:Cn,value:"routePrefix"===l.routeType?l.route:"",onChange:h,disabled:"routePrefix"!==l.routeType})]})]}),t(tl,{}),t($e,{items:nl,selectedIds:[l.method||""],setSelectedIds:e=>f(e),buttonProps:{label:nl.find(e=>e.id===l.method)?.label||"Any method",size:x.S,variant:T.Secondary}})]}),b&&t(m,{label:"Kafka topic",placeholder:"Type kafka topic",value:l.kafkaTopic,onChange:v,width:"320px"})]})},rl=o.div`
115
+ `,il={[Je.JavaScript]:"Node.js",[Je.DotNet]:".NET",[Je.Php]:"PHP"},sl=[Je.Python,Je.Java,Je.JavaScript,Je.DotNet,Je.Php,Je.Ruby,Je.Go].map(e=>({id:e,label:il[e]??e.charAt(0).toUpperCase()+e.slice(1),Icon:ce(e)})),cl=[{value:"all",label:"Entire Cluster"},{value:"source",label:"Specific source"},{value:"namespace",label:"Specific Namespace"},{value:"language",label:"Specific programming language"}];function dl(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: ${il[e.workloadLanguage]??e.workloadLanguage}`}return"Entire Cluster"}const ul=({formState:a,onChange:n,sourceOptions:o=[],namespaceOptions:i=[]})=>{const s=m(),[d,u]=l("all"),p=a.sourceScopes.length>0,h=c(()=>cl.map(e=>({...e,disabled:"all"===e.value&&p})),[p]),g=r(e=>{u(e)},[]),y=r(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 o={scopeType:"source",workloadName:t.name,workloadKind:t.kind,workloadNamespace:t.namespace,workloadLanguage:""};n({sourceScopes:[...a.sourceScopes,o]})},[a.sourceScopes,n]),S=r(e=>{if(!e)return;const t={scopeType:"namespace",workloadName:"",workloadKind:"",workloadNamespace:e.id,workloadLanguage:""};n({sourceScopes:[...a.sourceScopes,t]})},[a.sourceScopes,n]),C=r(e=>{const t={scopeType:"language",workloadName:"",workloadKind:"",workloadNamespace:"",workloadLanguage:e};n({sourceScopes:[...a.sourceScopes,t]})},[a.sourceScopes,n]),k=r(e=>{const t=a.sourceScopes.filter((t,a)=>a!==e);n({sourceScopes:t})},[a.sourceScopes,n]),w=c(()=>{const e=new Set(a.sourceScopes.filter(e=>"source"===e.scopeType).map(e=>{return t=e.workloadNamespace,a=e.workloadKind,n=e.workloadName,`${t}/${a}/${n}`;var t,a,n}));return o.filter(t=>!e.has(t.id))},[o,a.sourceScopes]),T=c(()=>{const e=new Set(a.sourceScopes.filter(e=>"namespace"===e.scopeType).map(e=>e.workloadNamespace));return i.filter(t=>!e.has(t.id))},[i,a.sourceScopes]),x=c(()=>{const e=new Set(a.sourceScopes.filter(e=>"language"===e.scopeType).map(e=>e.workloadLanguage));return sl.filter(t=>!e.has(t.id))},[a.sourceScopes]),D=!p&&"all"===d;return e(be,{richTitle:{title:We,subTitle:He},children:[p&&t(ol,{children:a.sourceScopes.map((a,n)=>e(ll,{children:[t(v,{size:b.XXXS,color:s.v2.colors.white[500],nowrap:!0,children:dl(a)}),t(rl,{"data-id":`sampling-scope-remove-${n}`,onClick:()=>k(n),children:t(rn,{size:12,fill:s.v2.colors.grey[400]})})]},n))}),t(B,{size:ke.S,options:h,selected:d,setSelected:g}),D&&t(J,{status:Q.Default,message:Ke,fullWidth:!0}),"source"===d&&t(Ge,{"data-id":"sampling-autocomplete-source",options:w,value:"",onSelect:y,placeholder:qe}),"namespace"===d&&t(Ge,{"data-id":"sampling-autocomplete-namespace",options:T,value:"",onSelect:S,placeholder:"Search namespace"}),"language"===d&&t(tl,{children:x.map(({id:a,label:n,Icon:o})=>e(al,{$selected:!1,onClick:()=>C(a),children:[t(f,{name:`sampling-scope-lang-${a}`,size:Ye.S,value:!1,onChange:()=>C(a)}),t(nl,{children:t(o,{size:20})}),t(v,{size:b.XS,nowrap:!0,children:n})]},a))})]})};function pl(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:""}}const ml=s({category:"noisy",formData:pl("noisy"),handleChange:()=>{},resetForm:()=>{},duplicateWarning:null,setDuplicateWarning:()=>{},sourceOptions:[],namespaceOptions:[]}),hl=({category:e,sourceOptions:a=[],namespaceOptions:o=[],children:i})=>{const{formData:s,handleFormChange:c,resetFormData:d}=L(pl(e)),[u,p]=l(null);n(()=>{d(pl(e)),p(null)},[e]);const m=r(e=>{p(null),c(void 0,void 0,{...s,...e})},[s,c]),h=r(()=>{d(pl(e)),p(null)},[e,d]);return t(ml.Provider,{value:{category:e,formData:s,handleChange:m,resetForm:h,duplicateWarning:u,setDuplicateWarning:p,sourceOptions:a,namespaceOptions:o},children:i})},gl=()=>i(ml),fl=p.div`
194
116
  display: flex;
195
117
  gap: 12px;
196
- `,il=o.div`
197
- display: flex;
198
- flex-direction: column;
199
- gap: 4px;
200
- `,sl=o.div`
118
+ `,vl=p.div`
201
119
  display: flex;
202
120
  align-items: flex-end;
203
121
  gap: 16px;
204
- `,cl=[{value:"5000",label:"5s"},{value:"1000",label:"1s"},{value:"500",label:"500ms"},{value:"100",label:"100ms"},{value:"50",label:"50ms"},{value:"custom",label:"Custom"}],dl=()=>{},ul=({ruleType:a,formState:o,onChange:l})=>{const r=n(),i=Wt(e=>l({durationPreset:e}),[l]),d=Wt(e=>l({customDurationMs:e.target.value}),[l]);return"Relevance"===a?null:e(rl,{children:["Duration"===a&&e(An,{children:[e(il,{children:[t(s,{size:c.XS,weight:500,children:ln}),t(s,{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."})]}),t(s,{size:c.XXXS,children:gn}),e(sl,{children:[t($,{size:be.S,options:cl,selected:o.durationPreset,setSelected:i}),"custom"===o.durationPreset&&t(m,{label:"Custom duration (ms)",placeholder:"200ms",type:g.Number,value:o.customDurationMs,onChange:d,width:160})]})]}),"Error"===a&&e(An,{children:[e(il,{children:[t(s,{size:c.XS,weight:500,children:rn}),t(s,{size:c.XXXS,color:r.v2.colors.grey[400],children:"Retain traces with errors from the selected services and operations."})]}),t(b,{value:!0,onChange:dl,size:we.S,label:fn,labelAlign:S.Right})]})]})},pl=o.div`
205
- display: flex;
206
- flex-direction: column;
207
- gap: 4px;
208
- `,hl=o.div`
209
- display: flex;
210
- align-items: flex-end;
211
- gap: 16px;
212
- `,ml=[{value:"all",label:"drop all"},{value:"sample",label:"sample"}],gl=[{value:"all",label:"keep all"},{value:"sample",label:"sample"}],fl=[{value:"50",label:"50%"},{value:"25",label:"25%"},{value:"10",label:"10%"},{value:"1",label:"1%"},{value:"custom",label:"Custom"}],vl=[{value:"10",label:"10%"},{value:"1",label:"1%"},{value:"0.5",label:"0.5%"},{value:"0.1",label:"0.1%"},{value:"custom",label:"Custom"}],yl=({category:o,formState:l,onChange:r})=>{const i=n(),d="highlyRelevant"===o,u=d?gl:ml,p=d?hn:mn,h=d?"Specify the exact percentage of matching traces to keep":"Specify the exact percentage of matching traces to drop",f=d?vn:yn,v="noisy"===o?vl:fl,y=Wt(e=>r({percentageMode:e}),[r]),b=Wt(e=>r({percentagePreset:e}),[r]),S=Wt(e=>r({customPercentage:e.target.value}),[r]);return e(Dn,{children:[e(pl,{children:[t(s,{size:c.XS,weight:500,children:p}),t(s,{size:c.XXXS,color:i.v2.colors.grey[400],children:h})]}),"costReduction"!==o&&t($,{size:be.S,options:u,selected:l.percentageMode,setSelected:y}),("costReduction"===o||"sample"===l.percentageMode)&&e(a,{children:[t(s,{size:c.XXXS,children:f}),e(hl,{children:[t($,{size:be.S,options:v,selected:l.percentagePreset,setSelected:b}),"custom"===l.percentagePreset&&t(m,{label:"Custom percentage",placeholder:"5%",type:g.Number,value:l.customPercentage,onChange:S,width:160})]})]})]})};function bl(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 Sl(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 Cl(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 kl(e){if("custom"===e.durationPreset){const t=parseFloat(e.customDurationMs);return isNaN(t)?null:t}return parseInt(e.durationPreset,10)}function wl(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 xl(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 Tl(e){return{name:e.name||null,disabled:e.disabled,sourceScopes:Sl(e),operation:wl(e),percentageAtMost:Cl(e),notes:e.notes||null}}function Nl(e){return{name:e.name||null,disabled:e.disabled,sourceScopes:Sl(e),error:"Error"===e.ruleType,durationAtLeastMs:"Duration"===e.ruleType?kl(e):null,operation:xl(e),percentageAtLeast:Cl(e),notes:e.notes||null}}function Dl(e){const t=Cl(e);return{name:e.name||null,disabled:e.disabled,sourceScopes:Sl(e),operation:xl(e),percentageAtMost:t??0,notes:e.notes||null}}const Al=o.div`
213
- display: flex;
214
- flex-direction: column;
215
- gap: 16px;
216
- padding: 28px;
217
- flex: 1;
218
- overflow-y: auto;
219
- `,Il=o.div`
220
- display: flex;
221
- align-items: center;
222
- gap: 8px;
223
- padding: 16px 28px;
224
- border-top: 1px solid ${({theme:e})=>e.v2.colors.silver[800]};
225
- `,El=o.div`
226
- flex: 1;
227
- `,Rl=({isOpen:a,category:o,onClose:n,onSubmit:l,sourceOptions:r,namespaceOptions:i,validateForm:s,onNavigateToDuplicate:c})=>{const{formData:d,handleFormChange:u,resetFormData:p}=A(bl(o)),[h,m]=Gt(null);Ht(()=>{a&&(p(),m(null))},[a,o]);const g=Wt(e=>{m(null),u(void 0,void 0,{...d,...e})},[d,u]),f=Wt(()=>{if(s){const e=s(d);if(e)return void m(e)}l(d)},[d,l,s]);return e(Pe,{isOpen:a,width:Sn,header:{icon:Dt,title:kn[o],subTitle:bn[o],onClose:n},children:[e(Al,{children:[t(Nn,{category:o,formState:d}),t(Fn,{category:o,formState:d,onChange:g}),t(Wn,{formState:d,onChange:g,sourceOptions:r,namespaceOptions:i}),t(ll,{category:o,formState:d,onChange:g}),"highlyRelevant"===o&&t(ul,{ruleType:d.ruleType,formState:d,onChange:g}),t(yl,{category:o,formState:d,onChange:g})]}),e(Il,{children:[h&&t(B,{status:U.Warning,message:h.message,action:c?{label:"View rule",onClick:()=>c(h.ruleId)}:void 0}),t(El,{}),t(w,{label:tn,variant:T.Secondary,size:x.S,onClick:n}),t(w,{label:"Create rule",variant:T.Primary,size:x.S,onClick:f,disabled:!!h})]})]})};function $l(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 Pl(e){return!(!0!==e.error||e.sourceScopes&&0!==e.sourceScopes.length||e.operation||null!=e.percentageAtLeast&&100!==e.percentageAtLeast)}function Ol(e){for(const t of e){const e=t.highlyRelevantOperations.find(Pl);if(e)return{rule:e,samplingId:t.id}}return null}function Ml(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 Fl(e){return!(e.sourceScopes&&0!==e.sourceScopes.length||e.operation)}function Ll(e){for(const t of e){const e=t.costReductionRules.find(Fl);if(e)return{rule:e,samplingId:t.id}}return null}function zl(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 Xl=o.div`
228
- display: flex;
229
- flex-direction: column;
230
- gap: 12px;
231
- padding: 12px 16px;
232
- flex: 1;
233
- overflow-y: auto;
234
- `,Vl=o.div`
122
+ `,bl=[{value:"5000",label:"5s"},{value:"1000",label:"1s"},{value:"500",label:"500ms"},{value:"100",label:"100ms"},{value:"50",label:"50ms"},{value:"custom",label:"Custom"}],yl=()=>{},Sl=({ruleType:a,formState:n,onChange:o})=>{const l=r(e=>o({durationPreset:e}),[o]),i=r(e=>o({customDurationMs:e.target.value}),[o]);return"Relevance"===a?null:e(fl,{children:["Duration"===a&&t("div",{style:{flex:1},children:e(be,{richTitle:{title:Ze,subTitle:Qe},children:[t(v,{size:b.XXXS,children:et}),e(vl,{children:[t(B,{size:ke.S,options:bl,selected:n.durationPreset,setSelected:l}),"custom"===n.durationPreset&&t(w,{name:"sampling-input-custom-duration",label:tt,placeholder:"200ms",type:T.Number,value:n.customDurationMs,onChange:i,width:160})]})]})}),"Error"===a&&t("div",{style:{flex:1},children:t(be,{richTitle:{title:nt,subTitle:at},children:t(A,{name:"sampling-toggle-keep-errors",value:!0,onChange:yl,size:lt.S,label:ot,labelAlign:I.Right})})})]})};function Cl(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 kl(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 wl(e){if("custom"===e.durationPreset){const t=parseFloat(e.customDurationMs);return isNaN(t)?null:t}return parseInt(e.durationPreset,10)}function Tl(e){return{httpServer:{[e.routeType]:e.route||null,method:e.method||null}}}function xl(e){return"all"===e.operationType?null:"httpServer"===e.operationType?Tl(e):"httpClient"===e.operationType?{httpClient:{serverAddress:e.serverAddress||null,["route"===e.routeType?"templatedPath":"templatedPathPrefix"]:e.route||null,method:e.method||null}}:null}function Dl(e){return"all"===e.operationType?null:"httpServer"===e.operationType?Tl(e):"kafkaConsumer"===e.operationType?{kafkaConsumer:{kafkaTopic:e.kafkaTopic||null}}:"kafkaProducer"===e.operationType?{kafkaProducer:{kafkaTopic:e.kafkaTopic||null}}:null}var Nl;!function(e){e.Noisy="noisy",e.HighlyRelevant="highly-relevant",e.CostReduction="cost-reduction"}(Nl||(Nl={}));const Al=[{value:Nl.Noisy,label:"Noisy Operations",tooltip:"Rules that reduce noise from high-volume, low-value operations"},{value:Nl.HighlyRelevant,label:"Highly Relevant Operations",tooltip:"Rules that prioritize important traces for retention"},{value:Nl.CostReduction,label:"Cost Reduction",tooltip:"Rules that optimize costs by sampling less critical data"}],Il={[Nl.Noisy]:"This is the most efficient way to sample (with Head Sampling). Prefer to use it where possible.",[Nl.HighlyRelevant]:'Any trace from the "Noisy Operations" category is sampled prior to checking highly relevance.',[Nl.CostReduction]:"Cost reduction rules use Tail Sampling to drop traces that are unlikely to be useful for debugging or monitoring."},El={[Nl.Noisy]:"Noisy Operations rules list",[Nl.HighlyRelevant]:"Highly Relevant Operations rules list",[Nl.CostReduction]:"Cost Reduction rules list"},Rl={[Nl.Noisy]:"noisy",[Nl.HighlyRelevant]:"highlyRelevant",[Nl.CostReduction]:"costReduction"};function Pl(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 $l(e){if(!e?.length)return[{text:" for ",variant:Mn.Default},{text:"entire cluster",variant:Mn.Scope}];const t=e.map(Pl).filter(Boolean);if(!t.length)return[{text:" for ",variant:Mn.Default},{text:"entire cluster",variant:Mn.Scope}];const a=[{text:" for ",variant:Mn.Default}],n=t.slice(0,2),o=t.length-2;return n.forEach((e,t)=>{t>0&&a.push({text:", ",variant:Mn.Default}),a.push({text:e,variant:Mn.Scope})}),o>0&&a.push({text:` + ${o} more`,variant:Mn.Default}),a}function Ol(e,t){if(!e)return[];const a=[{text:" starting at ",variant:Mn.Default}];return t?a.push({text:`${t} /${e}`,variant:Mn.Endpoint}):a.push({text:`endpoint /${e}`,variant:Mn.Endpoint}),a}function Ml(e){const t=[];if(null!=e.percentageAtMost?(t.push({text:`Drop ${100-e.percentageAtMost}%`,variant:Mn.Action}),t.push({text:" of traces",variant:Mn.Default})):t.push({text:"Drop all traces",variant:Mn.Action}),e.operation){const a=e.operation.httpServer?.route||e.operation.httpServer?.routePrefix,n=e.operation.httpServer?.method||e.operation.httpClient?.method;t.push(...Ol(a,n));const o=e.operation.httpClient,l=o?.templatedPath||o?.templatedPathPrefix,r=o?.serverAddress;if((l||r)&&!a){const e=l&&r?`${r}/${l}`:l||r;t.push({text:" to ",variant:Mn.Default}),n?t.push({text:`${n} /${e}`,variant:Mn.Endpoint}):t.push({text:`/${e}`,variant:Mn.Endpoint})}}else t.push({text:" on ",variant:Mn.Default}),t.push({text:"any operation",variant:Mn.Endpoint});return t.push(...$l(e.sourceScopes)),t}function Fl(e){const t=[];if(null!=e.percentageAtLeast?(t.push({text:`Keep at least ${e.percentageAtLeast}%`,variant:Mn.Action}),t.push({text:" of traces",variant:Mn.Default})):t.push({text:"Keep all traces",variant:Mn.Action}),e.operation){const a=e.operation.httpServer?.route||e.operation.httpServer?.routePrefix,n=e.operation.httpServer?.method;t.push(...Ol(a,n))}else t.push({text:" on ",variant:Mn.Default}),t.push({text:"any operation",variant:Mn.Endpoint});return t.push(...$l(e.sourceScopes)),!e.error&&null!=e.durationAtLeastMs&&e.durationAtLeastMs>0&&(t.push({text:" with duration > ",variant:Mn.Default}),t.push({text:`${e.durationAtLeastMs}ms`,variant:Mn.Duration})),t}function Ll(e){const t=[];if(t.push({text:`Drop ${e.percentageAtMost}%`,variant:Mn.Action}),t.push({text:" of traces",variant:Mn.Default}),e.operation){const a=e.operation.httpServer?.route||e.operation.httpServer?.routePrefix,n=e.operation.httpServer?.method;t.push(...Ol(a,n));const o=e.operation.kafkaConsumer?.kafkaTopic;o&&!a&&(t.push({text:" from ",variant:Mn.Default}),t.push({text:`topic '${o}'`,variant:Mn.Endpoint}))}else t.push({text:" on ",variant:Mn.Default}),t.push({text:"any operation",variant:Mn.Endpoint});return t.push(...$l(e.sourceScopes)),t}function zl(e){return e.error?"Error":null!=e.durationAtLeastMs?"Duration":"Relevance"}function Vl(e,t){switch(e){case"noisy":return Ml(t);case"highlyRelevant":return Fl(t);case"costReduction":return Ll(t)}}function Xl(e,t,a,n){for(const o of e)if(o.id===t)switch(n){case"noisy":{const e=o.noisyOperations.find(e=>e.ruleId===a);if(e)return{category:"noisy",samplingId:o.id,rule:e};break}case"highlyRelevant":{const e=o.highlyRelevantOperations.find(e=>e.ruleId===a);if(e)return{category:"highlyRelevant",samplingId:o.id,rule:e};break}case"costReduction":{const e=o.costReductionRules.find(e=>e.ruleId===a);if(e)return{category:"costReduction",samplingId:o.id,rule:e};break}}return null}function Bl(e){return null==e||Array.isArray(e)&&0===e.length?null:e}function _l(e,t){return JSON.stringify({sourceScopes:Bl(e),operation:Bl(t)})}function Ul(e,t,a,n){return JSON.stringify({sourceScopes:Bl(e),error:t??!1,durationAtLeastMs:Bl(a),operation:Bl(n)})}function jl(e,t){return JSON.stringify({sourceScopes:Bl(e),operation:Bl(t)})}function Hl(e,t,a,n){switch(t){case"noisy":{const t=_l(a.sourceScopes,a.operation);for(const a of e)for(const e of a.noisyOperations)if((!n||e.ruleId!==n)&&_l(e.sourceScopes,e.operation)===t)return e.ruleId;return null}case"highlyRelevant":{const t=Ul(a.sourceScopes,a.error,a.durationAtLeastMs,a.operation);for(const a of e)for(const e of a.highlyRelevantOperations)if((!n||e.ruleId!==n)&&Ul(e.sourceScopes,e.error,e.durationAtLeastMs,e.operation)===t)return e.ruleId;return null}case"costReduction":{const t=jl(a.sourceScopes,a.operation);for(const a of e)for(const e of a.costReductionRules)if((!n||e.ruleId!==n)&&jl(e.sourceScopes,e.operation)===t)return e.ruleId;return null}}}function Wl(e){if(!e||!e.enabled)return[{text:"Auto rule is ",variant:Mn.Default},{text:"disabled",variant:Mn.Action}];return[{text:`Keep ${e.keepPercentage??0}%`,variant:Mn.Action},{text:" of ",variant:Mn.Default},{text:"traces for kubelet health probes in the entire cluster",variant:Mn.Scope}]}function Kl(e){return!(!0!==e.error||e.sourceScopes&&0!==e.sourceScopes.length||e.operation||null!=e.percentageAtLeast&&100!==e.percentageAtLeast)}function Gl(e){return!e||e.disabled?[{text:"Auto rule is ",variant:Mn.Default},{text:"disabled",variant:Mn.Action}]:[{text:"Keep 100%",variant:Mn.Action},{text:" of ",variant:Mn.Default},{text:"error traces across the entire cluster",variant:Mn.Scope}]}function ql(e){return!(e.sourceScopes&&0!==e.sourceScopes.length||e.operation)}function Yl(e){return!e||e.disabled?[{text:"Auto rule is ",variant:Mn.Default},{text:"disabled",variant:Mn.Action}]:[{text:`Drop ${e.percentageAtMost}%`,variant:Mn.Action},{text:" of ",variant:Mn.Default},{text:"traces across the entire cluster",variant:Mn.Scope}]}const Jl=p.div`
235
123
  display: flex;
236
124
  flex-direction: column;
237
125
  gap: 8px;
238
- padding: 16px;
239
- border-radius: 8px;
240
- `,_l=o(r)`
126
+ `,Ql=p(g)`
241
127
  align-items: center;
242
128
  gap: 8px;
243
- `,Bl=o.div`
129
+ `,Zl=p.div`
244
130
  flex: 1;
245
131
  min-width: 0;
246
132
  padding: 8px 16px;
@@ -248,44 +134,19 @@ import{jsxs as e,jsx as t,Fragment as a}from"react/jsx-runtime";import o,{useThe
248
134
  background-color: ${({theme:e})=>e.v2.colors.silver[800]};
249
135
  white-space: pre;
250
136
  overflow-x: auto;
251
- `,Ul=o.div`
137
+ `,er=({category:a,formState:n,onChange:o})=>{const l=m(),r=c(()=>{switch(a){case"noisy":return Ml({ruleId:"",name:(e=n).name||null,disabled:!1,notes:e.notes||null,sourceScopes:Cl(e)??null,percentageAtMost:kl(e),operation:xl(e)});case"highlyRelevant":return Fl(function(e){return{ruleId:"",name:e.name||null,disabled:!1,notes:e.notes||null,sourceScopes:Cl(e)??null,error:e.keepErrors,durationAtLeastMs:"Duration"===e.ruleType?wl(e):null,percentageAtLeast:kl(e),operation:Dl(e)}}(n));case"costReduction":return Ll(function(e){return{ruleId:"",name:e.name||null,disabled:!1,notes:e.notes||null,sourceScopes:Cl(e)??null,percentageAtMost:kl(e)??0,operation:Dl(e)}}(n))}var e},[a,n]),i=1===r.length&&"default"===r[0].variant;return e(Jl,{children:[t(v,{size:b.XXS,color:l.v2.colors.silver[200],children:rt}),e(Ql,{children:[t(Zl,{children:i?t(v,{size:b.XXXS,color:l.v2.colors.grey[500],children:it}):t(Fn,{parts:r})}),o&&t(A,{name:"sampling-toggle-rule-enabled",value:!n.disabled,onChange:e=>o({disabled:!e}),size:lt.S,label:"Rule Enabled",labelAlign:I.Right})]})]})},tr=()=>{const{category:a,formData:n,handleChange:o,sourceOptions:l,namespaceOptions:r}=gl();return e(h,{$gap:12,children:[t(er,{category:a,formState:n,onChange:o}),t(zo,{category:a,formState:n,onChange:o}),t(ul,{formState:n,onChange:o,sourceOptions:l,namespaceOptions:r}),t(Go,{category:a,formState:n,onChange:o}),"highlyRelevant"===a&&t(Sl,{ruleType:n.ruleType,formState:n,onChange:o}),t(el,{category:a,formState:n,onChange:o})]})},ar=p.div`
252
138
  display: flex;
253
- flex-direction: column;
254
- gap: 16px;
255
- padding: 16px;
256
- border-radius: 16px;
257
- background-color: ${({theme:e})=>e.v2.colors.silver[800]};
258
- `,jl=o.div`
139
+ gap: 32px;
140
+ `,nr=p.div`
259
141
  display: flex;
260
142
  flex-direction: column;
261
143
  gap: 4px;
262
- `,Hl=o.div`
263
- display: flex;
264
- align-items: flex-end;
265
- gap: 16px;
266
- `,Kl=o.div`
267
- display: flex;
268
- justify-content: flex-end;
269
- gap: 8px;
270
- padding: 16px 28px;
271
- border-top: 1px solid ${({theme:e})=>e.v2.colors.silver[800]};
272
- `,Gl=[{value:"50",label:"50%"},{value:"25",label:"25%"},{value:"10",label:"10%"},{value:"1",label:"1%"},{value:"custom",label:"Custom"}];function Wl(e){const t=String(e);return"50"===t||"25"===t||"10"===t||"1"===t?t:"custom"}const ql=({isOpen:a,enabled:o,keepPercentage:l,onClose:r,onSave:i})=>{const d=n(),[u,p]=Gt(o),[h,f]=Gt(()=>Wl(l)),[v,y]=Gt(()=>"custom"===Wl(l)?String(l):"");Ht(()=>{if(a){p(o);const e=Wl(l);f(e),y("custom"===e?String(l):"")}},[a,o,l]);const C=Jt(()=>"custom"===h?Number(v)||0:Number(h),[h,v]),k=Jt(()=>$l({enabled:u,keepPercentage:C}),[u,C]),N=Wt(e=>f(e),[]),D=Wt(e=>y(e.target.value),[]),A=Wt(()=>{i(u,C)},[u,C,i]);return e(Pe,{isOpen:a,width:Sn,header:{icon:Dt,title:"Edit 'Noisy Operation' auto rule",subTitle:"Automatically detect and sample health probe traces across the cluster.",onClose:r},children:[e(Xl,{children:[e(Vl,{children:[t(s,{size:c.XXS,color:d.v2.colors.silver[200],children:"Auto rule - Kubernetes Health Probes"}),e(_l,{children:[t(Bl,{children:t(xo,{parts:k})}),t(b,{value:u,onChange:p,size:we.S,label:"Rule Enabled",labelAlign:S.Right})]})]}),e(Ul,{children:[e(jl,{children:[t(s,{size:c.XS,weight:500,children:"Keep Percentage"}),t(s,{size:c.XXXS,color:d.v2.colors.grey[400],children:"Specify the exact percentage of matching traces to keep"})]}),t(s,{size:c.XXXS,children:"Keep at least this percentage of matching traces"}),e(Hl,{children:[t($,{size:be.S,options:Gl,selected:h,setSelected:N}),"custom"===h&&t(m,{label:"Custom percentage",placeholder:"5%",type:g.Number,value:v,onChange:D,width:160})]})]})]}),e(Kl,{children:[t(w,{label:"Cancel",variant:T.Secondary,size:x.S,onClick:r}),t(w,{label:"Save",variant:T.Primary,size:x.S,onClick:A})]})]})},Yl=o.div`
273
- display: flex;
274
- flex-direction: column;
275
- gap: 12px;
276
- padding: 12px 16px;
277
- flex: 1;
278
- overflow-y: auto;
279
- `,Jl=o.div`
144
+ `,or=p.div`
280
145
  display: flex;
281
146
  flex-direction: column;
282
147
  gap: 8px;
283
- padding: 16px;
284
148
  border-radius: 8px;
285
- `,Ql=o(r)`
286
- align-items: center;
287
- gap: 8px;
288
- `,Zl=o.div`
149
+ `,lr=p.div`
289
150
  flex: 1;
290
151
  min-width: 0;
291
152
  padding: 8px 16px;
@@ -293,58 +154,82 @@ import{jsxs as e,jsx as t,Fragment as a}from"react/jsx-runtime";import o,{useThe
293
154
  background-color: ${({theme:e})=>e.v2.colors.silver[800]};
294
155
  white-space: pre;
295
156
  overflow-x: auto;
296
- `,er=o.div`
157
+ `,rr=p.div`
297
158
  display: flex;
298
- justify-content: flex-end;
299
- gap: 8px;
300
- padding: 16px 28px;
301
- border-top: 1px solid ${({theme:e})=>e.v2.colors.silver[800]};
302
- `,tr=({isOpen:a,enabled:o,onClose:l,onSave:r})=>{const i=n(),[d,u]=Gt(o);Ht(()=>{a&&u(o)},[a,o]);const p=Jt(()=>Ml(d?{disabled:!1}:null),[d]),h=Wt(()=>{r(d)},[d,r]);return e(Pe,{isOpen:a,width:Sn,header:{icon:Dt,title:"Edit 'Highly Relevant' auto rule",subTitle:"Automatically keep all error traces across the entire cluster.",onClose:l},children:[t(Yl,{children:e(Jl,{children:[t(s,{size:c.XXS,color:i.v2.colors.silver[200],children:"Auto rule - Keep All Error Traces"}),e(Ql,{children:[t(Zl,{children:t(xo,{parts:p})}),t(b,{value:d,onChange:u,size:we.S,label:"Rule Enabled",labelAlign:S.Right})]})]})}),e(er,{children:[t(w,{label:"Cancel",variant:T.Secondary,size:x.S,onClick:l}),t(w,{label:"Save",variant:T.Primary,size:x.S,onClick:h})]})]})},ar=o.div`
159
+ align-items: flex-end;
160
+ gap: 16px;
161
+ `;function ir(e){return"highlyRelevant"===e.category?e.rule.error?"Error":null!=e.rule.durationAtLeastMs?"Duration":"Relevance":dt[e.category]}const sr=({data:a})=>{const n=m(),o=c(()=>[{id:"name",title:Se,value:a.rule.name||st},{id:"type",title:Ce,value:ir(a)}],[a]),l=a.rule.notes||ct;return e(be,{children:[t(ar,{children:o.map(({id:a,title:o,value:l})=>e(nr,{children:[t(v,{size:b.XXXS,color:n.v2.colors.silver[200],nowrap:!0,children:o}),t(v,{size:b.XS,nowrap:!0,children:l})]},a))}),e(nr,{children:[t(v,{size:b.XXXS,color:n.v2.colors.silver[200],children:xe}),t(v,{size:b.XS,children:l})]})]})};const cr=({data:a})=>{const n=m(),o=c(()=>function(e){switch(e.category){case"highlyRelevant":return null!=e.rule.percentageAtLeast?{title:Xe,method:pt,description:_e,value:`${e.rule.percentageAtLeast}%`}:{title:Xe,method:ht,description:null,value:null};case"noisy":return null!=e.rule.percentageAtMost?{title:Be,method:pt,description:Ue,value:`${e.rule.percentageAtMost}%`}:{title:Be,method:mt,description:null,value:null};case"costReduction":return{title:Be,method:pt,description:Ue,value:`${e.rule.percentageAtMost}%`}}}(a),[a]),l=[{id:"method",title:ut,value:o.method},...null!=o.description?[{id:"value",title:o.description,value:o.value}]:[]];return t(be,{richTitle:{title:o.title},children:t(ar,{children:l.map(({id:a,title:o,value:l})=>e(nr,{children:[t(v,{size:b.XXXS,color:n.v2.colors.silver[200],nowrap:!0,children:o}),t(v,{size:b.XS,nowrap:!0,children:l})]},a))})})},dr=p.div`
303
162
  display: flex;
304
163
  flex-direction: column;
305
- gap: 12px;
306
- padding: 12px 16px;
307
- flex: 1;
308
- overflow-y: auto;
309
- `,or=o.div`
164
+ gap: 4px;
165
+ `,ur=p.div`
310
166
  display: flex;
311
- flex-direction: column;
167
+ align-items: center;
312
168
  gap: 8px;
313
- padding: 16px;
169
+ padding: 8px;
314
170
  border-radius: 8px;
315
- `,nr=o(r)`
171
+ background-color: ${({theme:e})=>e.v2.colors.silver[900]};
172
+ `,pr=p.div`
173
+ display: flex;
174
+ width: 24px;
175
+ height: 24px;
176
+ justify-content: center;
316
177
  align-items: center;
178
+ flex-shrink: 0;
179
+ `,mr={[Je.JavaScript]:"Node.js",[Je.DotNet]:".NET",[Je.Php]:"PHP",[Je.Java]:"Java",[Je.Go]:"Go",[Je.Python]:"Python",[Je.Ruby]:"Ruby",[Je.Rust]:"Rust"};function hr(e){const t=mr[e];return t||e.charAt(0).toUpperCase()+e.slice(1)}const gr=({scopes:a})=>{const n=m();return t(be,{richTitle:{title:We},children:a.length?t(dr,{children:a.map((a,o)=>function(a,n,o){if(a.workloadLanguage){const l=ce(a.workloadLanguage);return e(ur,{children:[l&&t(pr,{children:t(l,{size:18})}),t(v,{size:b.XS,color:o.v2.colors.white[500],children:hr(a.workloadLanguage)})]},n)}const l=[a.workloadNamespace,a.workloadKind,a.workloadName].filter(Boolean),r=l.length?l.join(" / "):"Unknown scope";return t(ur,{children:t(v,{size:b.XS,color:o.v2.colors.white[500],children:r})},n)}(a,o,n))}):t(J,{status:Q.Default,message:Ke,fullWidth:!0})})},fr=["5000","1000","500","100","50"],vr=["50","25","10","1","0.5","0.1"];function br(e){if(null==e)return{percentageMode:"all",percentagePreset:"50",customPercentage:""};const t=vr.find(t=>Number(t)===e);return t?{percentageMode:"sample",percentagePreset:t,customPercentage:""}:{percentageMode:"sample",percentagePreset:"custom",customPercentage:String(e)}}function yr(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 Sr(e){const t=pl(),a=(n=e.rule.sourceScopes,n?.length?n.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 n;const o=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=br(e.rule.percentageAtMost);break;case"highlyRelevant":l=yr(e.rule.operation),r=br(e.rule.percentageAtLeast),i=function(e){if(null==e)return{durationPreset:"500",customDurationMs:""};const t=fr.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=yr(e.rule.operation),r=br(e.rule.percentageAtMost)}return{...t,name:e.rule.name||"",notes:e.rule.notes||"",disabled:e.rule.disabled,ruleType:o,sourceScopes:a,...l,...i,keepErrors:s,...r}}const Cr=s({data:null,isEditing:!1,formData:void 0,handleChange:()=>{},handleEdit:()=>{},handleCancelEdit:()=>{},duplicateWarning:null,setDuplicateWarning:()=>{},sourceOptions:[],namespaceOptions:[]}),kr=({data:e,defaultEditMode:a,sourceOptions:o=[],namespaceOptions:i=[],children:s})=>{const[c,u]=l(!1),{formData:p,handleFormChange:m,resetFormData:h}=L(void 0),g=d(null),[f,v]=l(null);n(()=>{e!==g.current&&(g.current=e,e&&a?(h(Sr(e)),v(null),u(!0)):(u(!1),v(null)))},[e,a]);const b=r(e=>{v(null),m(void 0,void 0,{...p,...e})},[p,m]),y=r(()=>{e&&(h(Sr(e)),v(null),u(!0))},[e,h]),S=r(()=>{u(!1),v(null)},[]);return t(Cr.Provider,{value:{data:e,isEditing:c,formData:p,handleChange:b,handleEdit:y,handleCancelEdit:S,duplicateWarning:f,setDuplicateWarning:v,sourceOptions:o,namespaceOptions:i},children:s})},wr=()=>i(Cr),Tr=()=>{},xr=p.div`
180
+ display: flex;
181
+ gap: 12px;
182
+ `,Dr=({rule:a})=>{const n=m(),o=null!=a.durationAtLeastMs,l=a.error;return o||l?e(xr,{children:[o&&t("div",{style:{flex:1},children:t(be,{richTitle:{title:Ze},children:e("div",{children:[t(v,{size:b.XXXS,color:n.v2.colors.silver[200],children:et}),t(v,{size:b.XS,children:`${a.durationAtLeastMs}ms`})]})})}),l&&t("div",{style:{flex:1},children:t(be,{richTitle:{title:nt},children:t(A,{name:"sampling-view-toggle-keep-errors",onChange:Tr,value:!0,size:lt.S,label:ot,labelAlign:I.Right})})})]}):null},Nr=p.div`
183
+ display: flex;
184
+ flex-direction: column;
317
185
  gap: 8px;
318
- `,lr=o.div`
319
- flex: 1;
186
+ border-radius: 8px;
187
+ `,Ar=p.div`
320
188
  min-width: 0;
321
189
  padding: 8px 16px;
322
190
  border-radius: 8px;
323
191
  background-color: ${({theme:e})=>e.v2.colors.silver[800]};
324
192
  white-space: pre;
325
193
  overflow-x: auto;
326
- `,rr=o.div`
194
+ `,Ir=({summary:a})=>{const n=m();return e(Nr,{children:[t(v,{size:b.XXS,color:n.v2.colors.silver[200],children:rt}),t(Ar,{children:t(Fn,{parts:a})})]})},Er="Kafka topic",Rr="Any method";const Pr=({data:a})=>{const n=m(),o=c(()=>function(e){if("noisy"===e.category){const t=e.rule.operation;if(t?.httpServer)return[{id:"type",title:ft,value:gt},{id:"route",title:$e,value:t.httpServer.route||t.httpServer.routePrefix||ct},{id:"method",title:ut,value:t.httpServer.method||Rr}];if(t?.httpClient){const e=[{id:"type",title:ft,value:vt}];return t.httpClient.serverAddress&&e.push({id:"serverAddress",title:"Server address",value:t.httpClient.serverAddress}),e.push({id:"route",title:$e,value:t.httpClient.templatedPath||t.httpClient.templatedPathPrefix||ct}),e.push({id:"method",title:ut,value:t.httpClient.method||Rr}),e}return[{id:"type",title:ft,value:bt}]}const t=e.rule.operation;return t?.httpServer?[{id:"type",title:ft,value:gt},{id:"route",title:$e,value:t.httpServer.route||t.httpServer.routePrefix||ct},{id:"method",title:ut,value:t.httpServer.method||Rr}]:t?.kafkaConsumer?[{id:"type",title:ft,value:yt},{id:"topic",title:Er,value:t.kafkaConsumer.kafkaTopic||ct}]:t?.kafkaProducer?[{id:"type",title:ft,value:St},{id:"topic",title:Er,value:t.kafkaProducer.kafkaTopic||ct}]:[{id:"type",title:ft,value:bt}]}(a),[a]);return t(be,{richTitle:{title:Ne},children:t(ar,{children:o.map(({id:a,title:o,value:l})=>e(nr,{children:[t(v,{size:b.XXXS,color:n.v2.colors.silver[200],nowrap:!0,children:o}),t(v,{size:b.XS,nowrap:!0,children:l})]},a))})})},$r=()=>{const{data:a,isEditing:n,formData:o,handleChange:l,sourceOptions:r,namespaceOptions:i}=wr();return a?e(h,n?{$gap:12,children:[t(er,{category:a.category,formState:o,onChange:l}),t(zo,{category:a.category,formState:o,onChange:l}),t(ul,{formState:o,onChange:l,sourceOptions:r,namespaceOptions:i}),t(Go,{category:a.category,formState:o,onChange:l}),"highlyRelevant"===a.category&&t(Sl,{ruleType:o.ruleType,formState:o,onChange:l}),t(el,{category:a.category,formState:o,onChange:l})]}:{$gap:12,children:[t(Ir,{summary:a.summary}),t(sr,{data:a}),t(gr,{scopes:a.rule.sourceScopes??[]}),t(Pr,{data:a}),"highlyRelevant"===a.category&&t(Dr,{rule:a.rule}),t(cr,{data:a})]}):null},Or=s({localEnabled:!1,setLocalEnabled:()=>{},percentagePreset:"50",setPercentagePreset:()=>{},customPercentage:"",setCustomPercentage:()=>{},resolvedPercentage:0,summary:[]});function Mr(e){const t=String(e);return"50"===t||"25"===t||"10"===t||"1"===t?t:"custom"}const Fr=({enabled:e,keepPercentage:a,children:o})=>{const[r,i]=l(e),[s,d]=l(()=>Mr(a)),[u,p]=l(()=>"custom"===Mr(a)?String(a):"");n(()=>{i(e);const t=Mr(a);d(t),p("custom"===t?String(a):"")},[e,a]);const m=c(()=>"custom"===s?Number(u)||0:Number(s),[s,u]),h=c(()=>Wl({enabled:r,keepPercentage:m}),[r,m]);return t(Or.Provider,{value:{localEnabled:r,setLocalEnabled:i,percentagePreset:s,setPercentagePreset:d,customPercentage:u,setCustomPercentage:p,resolvedPercentage:m,summary:h},children:o})},Lr=()=>i(Or),zr=[{value:"50",label:"50%"},{value:"25",label:"25%"},{value:"10",label:"10%"},{value:"1",label:"1%"},{value:"custom",label:"Custom"}],Vr=()=>{const a=m(),{localEnabled:n,setLocalEnabled:o,percentagePreset:l,setPercentagePreset:i,customPercentage:s,setCustomPercentage:c,summary:d}=Lr(),u=r(e=>i(e),[i]),p=r(e=>c(e.target.value),[c]);return e(h,{$gap:12,children:[e(or,{children:[t(v,{size:b.XXS,color:a.v2.colors.silver[200],children:Ct}),e(g,{$gap:8,$alignItems:"center",children:[t(lr,{children:t(Fn,{parts:d})}),t(A,{name:"sampling-auto-toggle-enabled",value:n,onChange:o,size:lt.S,label:kt,labelAlign:I.Right})]})]}),e(be,{richTitle:{title:wt,subTitle:ze},children:[t(v,{size:b.XXXS,children:_e}),e(rr,{children:[t(B,{size:ke.S,options:zr,selected:l,setSelected:u}),"custom"===l&&t(w,{name:"sampling-auto-input-custom-percentage",label:je,placeholder:"5%",type:T.Number,value:s,onChange:p,width:160})]})]})]})},Xr=s({localEnabled:!1,setLocalEnabled:()=>{},summary:[]}),Br=({enabled:e,children:a})=>{const[o,r]=l(e);n(()=>{r(e)},[e]);const i=c(()=>Gl(o?{disabled:!1}:null),[o]);return t(Xr.Provider,{value:{localEnabled:o,setLocalEnabled:r,summary:i},children:a})},_r=()=>i(Xr),Ur=g,jr=()=>{const a=m(),{localEnabled:n,setLocalEnabled:o,summary:l}=_r();return t(h,{$gap:12,children:e(or,{children:[t(v,{size:b.XXS,color:a.v2.colors.silver[200],children:Tt}),e(Ur,{$gap:8,$alignItems:"center",children:[t(lr,{children:t(Fn,{parts:l})}),t(A,{name:"sampling-hr-auto-toggle-enabled",value:n,onChange:o,size:lt.S,label:kt,labelAlign:I.Right})]})]})})},Hr=s({localEnabled:!1,setLocalEnabled:()=>{},percentagePreset:"50",setPercentagePreset:()=>{},customPercentage:"",setCustomPercentage:()=>{},resolvedPercentage:0,summary:[]});function Wr(e){const t=String(e);return"50"===t||"25"===t||"10"===t||"1"===t?t:"custom"}const Kr=({enabled:e,dropPercentage:a,children:o})=>{const[r,i]=l(e),[s,d]=l(()=>Wr(a)),[u,p]=l(()=>"custom"===Wr(a)?String(a):"");n(()=>{i(e);const t=Wr(a);d(t),p("custom"===t?String(a):"")},[e,a]);const m=c(()=>"custom"===s?Number(u)||0:Number(s),[s,u]),h=c(()=>Yl(r?{disabled:!1,percentageAtMost:m}:null),[r,m]);return t(Hr.Provider,{value:{localEnabled:r,setLocalEnabled:i,percentagePreset:s,setPercentagePreset:d,customPercentage:u,setCustomPercentage:p,resolvedPercentage:m,summary:h},children:o})},Gr=()=>i(Hr),qr=[{value:"50",label:"50%"},{value:"25",label:"25%"},{value:"10",label:"10%"},{value:"1",label:"1%"},{value:"custom",label:"Custom"}],Yr=()=>{const a=m(),{localEnabled:n,setLocalEnabled:o,percentagePreset:l,setPercentagePreset:i,customPercentage:s,setCustomPercentage:c,summary:d}=Gr(),u=r(e=>i(e),[i]),p=r(e=>c(e.target.value),[c]);return e(h,{$gap:12,children:[e(or,{children:[t(v,{size:b.XXS,color:a.v2.colors.silver[200],children:xt}),e(g,{$gap:8,$alignItems:"center",children:[t(lr,{children:t(Fn,{parts:d})}),t(A,{name:"sampling-cr-auto-toggle-enabled",value:n,onChange:o,size:lt.S,label:kt,labelAlign:I.Right})]})]}),e(be,{richTitle:{title:Dt,subTitle:Ve},children:[t(v,{size:b.XXXS,children:Nt}),e(rr,{children:[t(B,{size:ke.S,options:qr,selected:l,setSelected:u}),"custom"===l&&t(w,{name:"sampling-cr-auto-input-custom-percentage",label:je,placeholder:"5%",type:T.Number,value:s,onChange:p,width:160})]})]})]})},Jr=p.div`
327
195
  display: flex;
328
- flex-direction: column;
329
- gap: 16px;
330
- padding: 16px;
331
- border-radius: 16px;
332
- background-color: ${({theme:e})=>e.v2.colors.silver[800]};
333
- `,ir=o.div`
196
+ align-items: center;
197
+ gap: 8px;
198
+ padding: 8px;
199
+ `,Qr=({onClose:a,selectedConnectionIds:n,setSelectedConnectionIds:o,createAction:r,withOverlay:i})=>{const s=m(),[u,p]=l(""),h=d(null),{selectedOption:g,onSelectOption:f,genericForm:y,validateFormData:S,errorMessage:C}=io(),k=c(()=>(u?At.filter(e=>e?.label?.toLowerCase().includes(u.toLowerCase())):At).filter(e=>!!e),[u]),w=c(()=>(u?It.filter(e=>e?.label?.toLowerCase().includes(u.toLowerCase())):It).filter(e=>!!e),[u]),T=c(()=>{const a=(a,n)=>e(Jr,{children:[t(v,{size:b.XS,color:s.v2.colors.silver[200],children:a}),t(ie,{label:n.toString()})]},a),n=e=>{const a=g?.type===e.type;return t(Hn,{dataId:e.type?`option-${e.type}`:void 0,title:e.label,description:e.description,withCarret:!0,isSelected:a,onClick:()=>{h.current?.clearErrors(),f(e)}},e.type)};return[a("Attributes",k.length),...k.map(n),a("Samplers",w.length),...w.map(n)]},[s,g?.type,k.length,w.length,f]),x=c(()=>g?[t(so,{},g.type)]:[t(Et,{$height:"100%",children:t(V,{icon:sn,title:"Action not selected",subTitle:"Please select an action to add"})},"no-data")],[g]);return t(Ln,{ref:h,isOpen:!0,withOverlay:i,onClose:a,onSave:async()=>{const{errorMessage:e,preparedFormData:t}=S();return e?Promise.resolve({error:e}):await r(t)},disableSave:!g||!y?.isFormDirty,isFormDirty:y?.isFormDirty,hideDirtyNote:!0,errorMessage:C,progress:{title:Rt.CREATING_ACTION,subTitle:Rt.CREATING_ACTION_SUBTITLE},header:{icon:sn,title:Rt.ADD_ACTION,subTitle:Rt.ADD_ACTION_DESCRIPTION},connectionIds:n&&o?{value:n,setValue:o}:void 0,search:{value:u,onChange:p},leftColumn:{width:"40%",list:T},rightColumn:{width:"60%",list:x}})},Zr=({testConnection:e})=>{const{activeForm:a}=go();return{width:"60%",list:a?[t(vo,{testConnection:e},a.option.type)]:[t(Et,{$height:"100%",children:t(V,{icon:cn,title:"Select destination from the list",subTitle:"Add destination so your data has somewhere to go."})},"no-data")]}},ei=p.div`
334
200
  display: flex;
335
201
  flex-direction: column;
336
- gap: 4px;
337
- `,sr=o.div`
338
- display: flex;
339
- align-items: flex-end;
340
- gap: 16px;
341
- `,cr=o.div`
202
+ padding: 8px;
203
+ border-radius: 16px;
204
+ border: ${({$purpleColors:e,theme:t})=>e?`1px solid ${t.v2.colors.purple[500]}`:"1px solid transparent"};
205
+ background-color: ${({$noBgColor:e,$purpleColors:t,theme:a})=>e?"transparent":t?a.v2.colors.purple[900]:a.v2.colors.silver[800]};
206
+ `,ti=p.div`
342
207
  display: flex;
343
- justify-content: flex-end;
344
- gap: 8px;
345
- padding: 16px 28px;
346
- border-top: 1px solid ${({theme:e})=>e.v2.colors.silver[800]};
347
- `,dr=[{value:"50",label:"50%"},{value:"25",label:"25%"},{value:"10",label:"10%"},{value:"1",label:"1%"},{value:"custom",label:"Custom"}];function ur(e){const t=String(e);return"50"===t||"25"===t||"10"===t||"1"===t?t:"custom"}const pr=({isOpen:a,enabled:o,dropPercentage:l,onClose:r,onSave:i})=>{const d=n(),[u,p]=Gt(o),[h,f]=Gt(()=>ur(l)),[v,y]=Gt(()=>"custom"===ur(l)?String(l):"");Ht(()=>{if(a){p(o);const e=ur(l);f(e),y("custom"===e?String(l):"")}},[a,o,l]);const C=Jt(()=>"custom"===h?Number(v)||0:Number(h),[h,v]),k=Jt(()=>zl(u?{disabled:!1,percentageAtMost:C}:null),[u,C]),N=Wt(e=>f(e),[]),D=Wt(e=>y(e.target.value),[]),A=Wt(()=>{i(u,C)},[u,C,i]);return e(Pe,{isOpen:a,width:Sn,header:{icon:Dt,title:"Edit 'Cost Reduction' auto rule",subTitle:"Automatically drop a percentage of traces across the entire cluster.",onClose:r},children:[e(ar,{children:[e(or,{children:[t(s,{size:c.XXS,color:d.v2.colors.silver[200],children:"Auto rule - Drop Traces Cluster-Wide"}),e(nr,{children:[t(lr,{children:t(xo,{parts:k})}),t(b,{value:u,onChange:p,size:we.S,label:"Rule Enabled",labelAlign:S.Right})]})]}),e(rr,{children:[e(ir,{children:[t(s,{size:c.XS,weight:500,children:"Drop Percentage"}),t(s,{size:c.XXXS,color:d.v2.colors.grey[400],children:"Specify the exact percentage of matching traces to drop"})]}),t(s,{size:c.XXXS,children:"Drop at most this percentage of matching traces"}),e(sr,{children:[t($,{size:be.S,options:dr,selected:h,setSelected:N}),"custom"===h&&t(m,{label:"Custom percentage",placeholder:"5%",type:g.Number,value:v,onChange:D,width:160})]})]})]}),e(cr,{children:[t(w,{label:"Cancel",variant:T.Secondary,size:x.S,onClick:r}),t(w,{label:"Save",variant:T.Primary,size:x.S,onClick:A})]})]})},hr=({onClose:a,connections:o,selectedConnectionIds:l,setSelectedConnectionIds:i,getEffectiveConfig:d,onApply:u})=>{const p=n(),[h,m]=Gt(""),[g,f]=Gt({showOnlySelected:!1}),v=Jt(()=>o.filter(e=>{const t=!h||e.name.toLowerCase().includes(h.toLowerCase()),a=!g.showOnlySelected||g.showOnlySelected&&l.includes(e.id);return t&&a}),[o.length,l.length,h,g]),y=e=>{i(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[S,C]=Gt(!1),[k,w]=Gt(void 0),{formData:x,handleFormChange:T,areFormValuesEqual:N,resetFormData:D}=A(k||{rollout:{automaticRolloutDisabled:!1}}),I=Jt(()=>l.length>1||void 0!==k&&!N(k,x),[l.length,k,x]);return Ht(()=>{1===l.length?(async e=>{if(S)return;C(!0);const t=await d(e);if(t){const e={rollout:{automaticRolloutDisabled:t.rollout?.automaticRolloutDisabled??!1}};w(e),D(e)}C(!1)})(l[0]):w(void 0)},[l.length]),t(aa,{isOpen:!0,onClose:a,onSave:()=>u(x,l),header:{icon:At,title:"Cluster Configuration"},connectionIds:{value:l,setValue:i},search:{placeholder:"Search by cluster name",value:h,onChange:m},filters:e(r,{$gap:8,children:[t(s,{size:c.XXXS,color:p.v2.colors.silver[200],nowrap:!0,children:"Show only:"}),t(b,{size:we.S,label:"Selected",value:g.showOnlySelected,onChange:e=>f(t=>({...t,showOnlySelected:e}))})]}),isFormDirty:I,isFetching:S,leftColumn:{width:"35%",header:e(r,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(r,{$gap:8,children:[t(s,{size:c.XS,children:"Clusters"}),t(Q,{label:v.length,status:ke.Unknown})]}),e(r,{$gap:8,children:[t(s,{size:c.XXXS,color:p.v2.colors.silver[200],align:"right",children:"Selected clusters"}),t(Q,{label:`${l.length}/${v.length}`,status:ke.Unknown})]})]}),list:v.map(e=>t(da,{title:e.name,isChecked:l.includes(e.id),onClick:()=>y(e.id),onCheckboxChange:()=>y(e.id)},e.id))},rightColumn:{width:"65%",header:t(s,{size:c.XS,children:"Configurations"}),list:[t(b,{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:x.rollout?.automaticRolloutDisabled||!1,onChange:e=>T("rollout.automaticRolloutDisabled",e)},"automatic-rollout-disabled")]}})},mr=({token:o,isLoading:n,isEditing:l,onEdit:i,onCancel:d,onSave:u,formData:p,handleFormChange:h,handleErrorChange:g,formErrors:f})=>{const{CopyButton:v}=Oe(),y=!l||n||!p.newToken;return Me({key:"Enter",active:!y},u),e(r,l?{$justifyContent:"space-between",$alignItems:"flex-start",$gap:12,children:[t(m,{type:"password",value:p.newToken,onChange:e=>{h("newToken",e.target.value),g("newToken",void 0)},width:"430px",autoFocus:!0,errorMessage:f.newToken}),t(r,{$margin:n?"8px 0 0 0":"2px 0 0 0",$alignItems:"center",children:n?t(ge,{title:"Saving...",withGradient:!0}):e(a,{children:[t(w,{variant:T.Secondary,size:x.S,leftIcon:xt,onClick:d,disabled:n}),t(w,{variant:T.Primary,size:x.S,leftIcon:wt,onClick:u,disabled:y})]})})]}:{$justifyContent:"space-between",$gap:12,children:[t(s,{size:c.XS,children:new Array(55).fill("•").join("")}),e(r,{$alignItems:"center",$justifyContent:"space-between",children:[t(v,{value:o}),t(he,{icon:ft,onClick:i})]})]})},gr=({expiresAt:e,callbackValid:a,callbackExpired:o})=>{const{formatTimeAgo:n}=Fe(),l=Jt(()=>n(e),[e]),r=Jt(()=>new Date(e).toDateString().split(" ").slice(1).join(" "),[e]),i=Jt(()=>Le(e,0)?U.Error:Le(e,2592e6)?U.Warning:U.Success,[e]),s=Jt(()=>i===U.Success?wt:i===U.Warning?It:Et,[i]);return Ht(()=>{i===U.Success?a():i===U.Error&&o()},[i]),t(H,{text:r,children:t(Q,{leftIcon:s,label:l,status:i,invertColors:!0,useSecondaryTone:!0})})},fr=o.div`
208
+ align-items: center;
209
+ justify-content: space-between;
210
+ gap: 12px;
211
+ padding: ${({$isOpen:e})=>e?"2px 12px 8px 12px":"2px 12px"};
212
+ `,ai=({title:a,tooltip:n,list:o,noBgColor:r,purpleColors:i})=>{const[s,c]=l(!0);return e(ei,{"data-id":`collapse-${a}`,$noBgColor:r,$purpleColors:i,children:[e(ti,{$isOpen:s,children:[e(g,{$gap:10,children:[t(v,{size:b.XS,children:a}),n&&t(ee,{text:n,withIcon:!0}),t(ie,{label:o.length,status:i?Q.Default:void 0})]}),t(Pt,{icon:s?dn:un,size:$t.M,onClick:()=>c(e=>!e)})]}),s?t(h,{children:o.length?u.toArray(o):t(Et,{$padding:"12px 0",children:t(V,{})})}):null]})},ni=(e,t,a)=>t||a.signalType?e.filter(e=>e.displayName.toLowerCase().includes(t.toLowerCase())&&(!a.signalType||W(e.supportedSignals).includes(a.signalType))):e,oi=({option:e,formData:a,testResult:n,isSelected:o,onSelect:l})=>t(Hn,{icon:Ft(e.type).icon,title:a?.name||e.displayName,withCarret:!0,purpleColors:!!a,isSelected:o,onClick:()=>l(),children:n&&t(ie,{status:n.succeeded?Q.Success:Q.Error,leftIcon:n.succeeded?pn:rn})}),li=({listType:e,destinationOptions:a,unsavedDestinations:n})=>{const{activeForm:o,onChangeActiveForm:l}=go();return a?.length?t(ai,{title:Mt[e].TITLE,tooltip:Mt[e].DESCRIPTION,list:a.map((a,n)=>t(oi,{option:a,isSelected:o?.listType===e&&"number"!=typeof o?.unsavedIdx&&(null!=a.id&&""!==a.id?o?.option.id===a.id:o?.option.type===a.type),onSelect:()=>l({listType:e,option:a})},`${e}-${a.id??a.type}-${n}`))}):n?.length?t(ai,{purpleColors:!0,title:Mt[e].TITLE,tooltip:Mt[e].DESCRIPTION,list:n.map(({option:a,formData:n,testResult:r},i)=>t(oi,{option:a,formData:n,testResult:r,isSelected:o?.unsavedIdx===i&&o?.listType===e,onSelect:()=>l({listType:e,option:a,unsavedIdx:i})},`${e}-${i}`))},e):void 0},ri=({isFetching:e,destinationsByCategory:a,searchText:n,filters:o})=>{const{unsavedDestinations:l}=go(),r=c(()=>{const e=[];l.length&&e.push(t(li,{listType:H.UNSAVED,unsavedDestinations:l},"unsaved"));for(const l of Object.values(H)){if(o.categoryType&&o.categoryType!==l)continue;const r=ni(a[l],n,o);r.length&&e.push(t(li,{listType:l,destinationOptions:r},l))}return e},[l,a,n,o]);return{width:"40%",list:r.length?r:e?[t(Et,{$height:"100%",children:t(Ot,{title:"Fetching destinations",subTitle:"Please wait while we fetch the destinations",withSpinner:!0})},"loading")]:[]}},ii=({destinationsByCategory:n,filters:o,setFilters:l})=>{const r=c(()=>Object.values(H).map(e=>({id:e,label:e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()})).filter(e=>n[e.id]?.length),[n]),i=c(()=>{const e=Object.values(K).map(e=>({value:e,label:e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}));return e.unshift({value:null,label:"All"}),e},[]);return e(a,{children:[t(Lt,{placeholder:"Select category",options:r,values:o.categoryType?[o.categoryType]:[],setValues:e=>l({...o,categoryType:o.categoryType===e[0]?null:e[0]})}),t(B,{size:ke.S,options:i,selected:o.signalType,setSelected:e=>l({...o,signalType:e})})]})};var si;!function(e){e.SELF_HOSTED="self hosted",e.MANAGED="managed"}(si||(si={}));const ci=({onClose:e,onBack:a,onNext:o,selectedConnectionIds:i,setSelectedConnectionIds:s,getDestinationCategories:c,getPotentialDestinations:d,initialInputs:u,testConnection:p,createDestination:m,updateDestination:h,withOverlay:g,disableAnimation:f})=>{const[v,b]=l(""),[y,S]=l({categoryType:null,signalType:null}),{destinations:C}=zt(),{activeForm:k,genericForm:w,formErrorMessage:T,unsavedDestinations:x,setUnsavedDestinations:D}=go();n(()=>{u&&D(u)},[u]);const[N,A]=l(!0),[I,E]=l([]),[R,P]=l({[H.ALL]:[],[H.UNSAVED]:[],[H.EXISTS]:[],[H.DETECTED]:[],[H.SELF_HOSTED]:[],[H.MANAGED]:[]});n(()=>{const e=C.map(e=>{let t;for(const a of I){const n=a.items.find(t=>t.type===e.destinationType.type);if(n){t=n;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})):[]}});P(t=>({...t,[H.EXISTS]:e}))},[C,I]);const $=r(async()=>{try{A(!0);const[e,t]=await Promise.all([c(),d()]);e&&E(e.destinationCategories.categories);const{detectedDestinations:a,selfHostedDestinations:n,managedDestinations:o}=((e,t)=>{const a=[],n=[],o=[];return e&&e.destinationCategories.categories.forEach(e=>{e.name===si.SELF_HOSTED?n.push(...e.items):e.name===si.MANAGED&&o.push(...e.items)}),t&&t?.potentialDestinations.forEach(t=>{for(const n of e?.destinationCategories?.categories||[]){const e=z(n),o=e.items.findIndex(e=>e.type===t.type);if(-1!==o){const n=q(t.fields,{});Object.keys(n).length&&(e.items[o].fields=e.items[o].fields.map(e=>({...e,initialValue:n[e.name]})),a.push(e.items[o]))}}}),{detectedDestinations:a,selfHostedDestinations:n,managedDestinations:o}})(e,t);P(e=>({...e,[H.DETECTED]:a,[H.SELF_HOSTED]:n,[H.MANAGED]:o}))}catch(e){}finally{A(!1)}},[]);n(()=>{$()},[]);const O=r(async()=>{const e=(await Promise.all(x.map(({option:e,formData:t})=>{if(e.id){const a=Object.fromEntries(e.fields.map(e=>[e.name,e.initialValue??""])),n=Object.fromEntries(t.fields.map(e=>[e.key,e.value??""]));if(!Object.keys(a).some(e=>a[e]!==n[e]))return h(e.id,t,i)}return m(t,i)}))).filter(e=>e?.error);if(e.length)return{error:e.map(e=>e?.error).join("\n")}},[x,i,m,h]);return t(Ln,{isOpen:!0,withOverlay:g,disableAnimation:f,onClose:e,onBack:a?()=>a(x):void 0,onNext:o?()=>o(x):void 0,nextIsSkip:!x.length,onSave:O,disableSave:!k&&!x.length,isFetching:N,errorMessage:T,isFormDirty:w?.isFormDirty,hideDirtyNote:!0,progress:{title:Rt.CREATING_DESTINATION,subTitle:Rt.CREATING_DESTINATION_SUBTITLE},header:{icon:cn,title:Rt.ADD_DESTINATIONS,subTitle:Rt.ADD_DESTINATION_DRAWER_DESCRIPTION},connectionIds:i&&s?{value:i,setValue:s}:void 0,search:{value:v,onChange:b},filters:t(ii,{destinationsByCategory:R,filters:y,setFilters:S}),leftColumn:ri({isFetching:N,destinationsByCategory:R,searchText:v,filters:y}),rightColumn:Zr({testConnection:p})})},di=({onClose:e,selectedConnectionIds:a,setSelectedConnectionIds:n,createInstrumentationRule:o,withOverlay:r})=>{const[i,s]=l(""),u=d(null),{selectedOption:p,onSelectOption:m,genericForm:h,validateFormData:g,errorMessage:f}=Ao(),v=c(()=>i?Vt.filter(e=>e.label.toLowerCase().includes(i.toLowerCase())):Vt,[i]),b=c(()=>v.map(e=>{const a=p?.type===e.type;return t(Hn,{dataId:`option-${e.type}`,title:e.label,description:e.description,withCarret:!0,isSelected:a,onClick:()=>{u.current?.clearErrors(),m(e)}},e.type)}),[p,v.length,m]),y=c(()=>p?[t(Io,{},p.type)]:[t(Et,{$height:"100%",children:t(V,{icon:mn,title:"Instrumentation rule not selected",subTitle:"Please select an instrumentation rule to add"})},"no-data")],[p]);return t(Ln,{ref:u,isOpen:!0,withOverlay:r,onClose:e,onSave:async()=>{const{errorMessage:e,preparedFormData:t}=g();return e?Promise.resolve({error:e}):await o(t)},disableSave:!p||!h?.isFormDirty,isFormDirty:h?.isFormDirty,hideDirtyNote:!0,errorMessage:f,progress:{title:Rt.CREATING_INSTRUMENTATION_RULE,subTitle:Rt.CREATING_INSTRUMENTATION_RULE_SUBTITLE},header:{icon:mn,title:Rt.ADD_INSTRUMENTATION_RULE,subTitle:Rt.ADD_INSTRUMENTATION_RULE_DESCRIPTION},connectionIds:a&&n?{value:a,setValue:n}:void 0,search:{value:i,onChange:s},leftColumn:{width:"40%",list:b},rightColumn:{width:"60%",list:y}})},ui=p.div``,pi=p.div`
213
+ visibility: hidden;
214
+
215
+ transition: visibility 0s;
216
+ & * {
217
+ transition-duration: 0s;
218
+ }
219
+
220
+ ${ui}:hover & {
221
+ visibility: visible;
222
+ }
223
+ `,mi=({workloadName:e,workloadKind:a,isChecked:n,onToggle:o,disabled:l,disabledReason:r})=>{const i=m(),s=()=>{};return t(ui,{children:t(Hn,{dataId:`source-${e}`,title:e,disabled:l,onClick:l?s:o,isChecked:n,onCheckboxChange:l?s:o,children:l&&r?t(ie,{label:r,status:Q.Default,textSize:b.XXXS}):t(pi,{children:t(ie,{label:a,status:Q.Info,textSize:b.XXXS,backgroundColor:i.v2.colors.blue[900]})})})})},hi=({formData:a,handleSourceChange:n,handleSelectAll:o,selectedArea:l,searchText:r,searchBy:i,filters:s})=>{const{tier:d}=de(),u=d===fe.Onprem,p=c(()=>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]),m=c(()=>p?[...p.workloads].sort((e,t)=>e.name.localeCompare(t.name)).filter(e=>he(e,r,s)):[],[p,r,s]),h=c(()=>!!m.length&&m.every(({selected:e})=>e),[m]),f=c(()=>{if(!p)return[];const{clusterId:e}=l.value,{name:a}=p;return m.map(({name:o,selected:l,kind:r})=>{const i=!u&&me.has(r);return t(mi,{workloadName:o,workloadKind:r,isChecked:!i&&(l||!1),onToggle:()=>n({clusterId:e,workloadId:{namespace:a,name:o,kind:r}}),disabled:i,disabledReason:"Enterprise only"},`${e}#${a}#${o}#${r}`)})},[m,p,l.value.clusterId]),{withFilterCount:y,filteredCount:S,totalCount:C}=c(()=>{const e=p?.workloads.length??0;return{withFilterCount:m.length!==e,filteredCount:m.length,totalCount:e}},[m,p]);return{width:"40%",header:e(g,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(g,{$gap:8,children:[t(v,{size:b.XS,nowrap:!0,children:l.value.namespaceName?`${l.value.namespaceName} > Workloads`:"Workloads"}),t(ee,{text:y?Rt.FILTERED_COUNT_TOOLTIP:void 0,children:t(ie,{label:`${y?`${S} / ${C}`:C}`,status:Xt.Unknown})})]}),t(v,{"data-id":"workloads-select-all",onClick:()=>o({clusterId:l.value.clusterId,namespaceName:l.value.namespaceName,boolean:!h,searchText:r,searchBy:i,filters:s}),disabled:!f.length,size:b.XS,children:(h?"Unselect":"Select")+" all"})]}),list:p?f:[t(Et,{$height:"100%",children:t(V,{icon:hn,title:Rt.SELECT_NAMESPACE,subTitle:Rt.SELECT_NAMESPACE_SUBTITLE})},"no-data")]}},gi=p.div``,fi=p.div`
224
+ visibility: ${({$visible:e})=>e?"visible":"hidden"};
225
+
226
+ transition: visibility 0s;
227
+ ${({$visible:e})=>!e&&"& * {\n transition-duration: 0s !important;\n }"}
228
+
229
+ ${gi}:hover & {
230
+ visibility: visible;
231
+ }
232
+ `,vi=({clusterId:a,namespaceName:n,checkbox:o,isFutureApps:l,selectedCounts:r,isActive:i,onActive:s,handleSourceChange:c})=>{const d=m(),u=e=>{s(),c({clusterId:a,workloadId:{namespace:n},auto:e.auto,selected:e.all})};return t(gi,{children:t(Hn,{dataId:`namespace-${n}`,withCarret:!0,title:n,isSelected:i,onClick:s,isPartiallyChecked:o.partial,isChecked:o.all,onCheckboxChange:e=>u({auto:e,all:e}),children:e(g,{$gap:12,children:[t(fi,{$visible:i||l,children:t(ee,{text:"Automatically instrument all workloads currently in the namespace, and all workloads that will be deployed to this namespace in the future",children:t(A,{label:"Auto",size:lt.S,value:l,onChange:e=>u({auto:e,all:e||void 0})})})}),e(g,{$gap:8,children:[t(v,{variant:Bt.Span,size:b.XXXS,color:d.v2.colors.silver[200],align:"right",children:"Selected"}),t(ie,{label:`${r.sourced}/${r.total}`,status:i?Q.Default:Xt.Unknown,minWidth:"42px"})]})]})})})},bi=({withCollapse:e,clusterId:a,clusterName:n,namespaces:o,selectedArea:l,setSelectedArea:r,handleSourceChange:i})=>{const s=c(()=>o.map(({name:e,totalWorkloads:o,selectedCount:s,isAllSourced:c,isSomeSourced:d,isFutureApps:u})=>t(vi,{clusterId:a,namespaceName:e,isFutureApps:u,checkbox:{all:c,partial:d},selectedCounts:{sourced:s,total:o},isActive:l.clusterId===a&&l.namespaceName===e,onActive:()=>r({clusterId:a,clusterName:n,namespaceName:e}),handleSourceChange:i},`${a}#${e}`)),[a,n,o,l]);return e?t(ai,{title:n,list:s,noBgColor:!0}):s},yi=({isFetching:a,formData:n,handleSourceChange:o,handleSelectAll:l,selectedArea:r,setSelectedArea:i,searchText:s,searchBy:d,filters:u})=>{const p=c(()=>n.map(e=>{const t=[...e.namespaces].sort((e,t)=>e.name.localeCompare(t.name)).filter(e=>ge(e,s,u)).map(e=>({name:e.name,totalWorkloads:e.workloads.length,..._t(e)}));return{clusterId:e.clusterId,clusterName:e.clusterName,visibleNamespaces:t}}),[n,s,u]),m=c(()=>{let e=!1;for(const{visibleNamespaces:t}of p)for(const{totalWorkloads:a,selectedCount:n}of t)if(e=!0,n!==a)return!1;return e},[p]),{list:h,withFilterCount:f,filteredCount:y,totalCount:S}=c(()=>{const e=p.map(({clusterId:e,clusterName:a,visibleNamespaces:n})=>n.length?t(bi,{withCollapse:p.length>1,clusterId:e,clusterName:a,namespaces:n,selectedArea:r,setSelectedArea:i,handleSourceChange:o},e):null),a=e.filter(e=>null!==e);return{list:a,withFilterCount:a.length!==e.length,filteredCount:a.length,totalCount:e.length}},[p,r]);return{width:"60%",header:e(g,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(g,{$gap:8,children:[t(v,{size:b.XS,nowrap:!0,children:"Namespaces"}),t(ee,{text:f?Rt.FILTERED_COUNT_TOOLTIP:void 0,children:t(ie,{label:`${f?`${y} / ${S}`:S}`,status:Xt.Unknown})})]}),t(v,{"data-id":"namespaces-select-all",onClick:()=>l({boolean:!m,searchText:s,searchBy:d,filters:u}),disabled:!h.length,size:b.XS,children:(m?"Unselect":"Select")+" all"})]}),list:h.length?h:a?[t(Et,{$height:"100%",children:t(Ot,{title:Rt.FETCHING_NAMESPACES,subTitle:Rt.FETCHING_NAMESPACES_SUBTITLE,withSpinner:!0})},"loading")]:[]}},Si=({onClose:a,onBack:n,onNext:o,selectedConnectionIds:r,setSelectedConnectionIds:i,persistSources:s,withOverlay:c,disableAnimation:d})=>{const u=m(),{progress:p,resetProgress:h}=Ut(),{isFetching:f,formData:y,handleSourceChange:S,handleSelectAll:C,formDiff:k,isFormDirty:w}=Po(),[T,x]=l(""),[D,N]=l(ve.Namespace),[I,E]=l({showOnlySelected:!1}),[R,P]=l({clusterId:"",clusterName:"",namespaceName:""});return t(Ln,{isOpen:!0,withOverlay:c,disableAnimation:d,onClose:a?()=>{h(jt.BulkInstrumenting),a()}:void 0,onBack:n?()=>n(k):void 0,onNext:o?()=>o(k):void 0,nextIsSkip:!w,onSave:()=>s(k),header:{icon:hn,title:Rt.ADD_SOURCE,subTitle:Rt.ADD_SOURCES_DESCRIPTION},connectionIds:r&&i?{value:r,setValue:i}:void 0,search:{value:T,onChange:e=>{x(e),D===ve.Namespace&&P({clusterId:"",clusterName:"",namespaceName:""})},segment:{options:[{label:"Namespace",value:ve.Namespace},{label:"Source",value:ve.Source}],selected:D,setSelected:N}},filters:e(g,{$gap:8,children:[t(v,{size:b.XXXS,color:u.v2.colors.silver[200],nowrap:!0,children:"Show only:"}),t(A,{name:"filter-selected",size:lt.S,label:"Selected",value:I.showOnlySelected,onChange:e=>E(t=>({...t,showOnlySelected:e}))})]}),isFormDirty:w,isFetching:f,progress:{title:Rt.CREATING_SOURCES,subTitle:Rt.CREATING_SOURCES_SUBTITLE,percentage:p[jt.BulkInstrumenting]?.percentage||0},leftColumn:yi({isFetching:f,formData:y,handleSourceChange:S,handleSelectAll:C,selectedArea:R,setSelectedArea:P,searchText:D===ve.Namespace?T:"",searchBy:D,filters:I}),rightColumn:hi({formData:y,handleSourceChange:S,handleSelectAll:C,selectedArea:{value:R},searchText:D===ve.Source?T:"",searchBy:D,filters:I})})},Ci=({isOpen:e,onClose:a,onSubmit:o,validateForm:l,onNavigateToDuplicate:i})=>{const{category:s,formData:c,resetForm:d,duplicateWarning:u,setDuplicateWarning:p}=gl();n(()=>{e&&d()},[e]);const m=r(()=>{if(l){const e=l(c);if(e)return void p(e)}o(c)},[c,o,l,p]),h={note:u?{status:Q.Warning,message:u.message,action:i?{"data-id":"sampling-create-btn-view-duplicate",label:"View rule",onClick:()=>i(u.ruleId)}:void 0}:void 0,actions:[{"data-id":"sampling-create-btn-cancel",label:Wt,variant:O.Secondary,size:$.S,onClick:a},{"data-id":"sampling-create-btn-submit",label:Kt,variant:O.Primary,size:$.S,onClick:m,disabled:!!u}]};return t(Ht,{isOpen:e,width:Yt,header:{icon:gn,title:qt[s],subTitle:Gt[s],onClose:a},footer:h,children:t(Jt,{$padding:"12px",children:t(tr,{})})})},ki=({category:e,sourceOptions:a,namespaceOptions:n,...o})=>t(hl,{category:e,sourceOptions:a,namespaceOptions:n,children:t(Ci,{...o})}),wi=({isOpen:e,onClose:a,onSave:n})=>{const{localEnabled:o,resolvedPercentage:l}=Lr(),i=r(()=>{n(o,l)},[o,l,n]);return t(Ht,{isOpen:e,width:Yt,header:{icon:gn,title:ea,subTitle:Zt,onClose:a},footer:{actions:[{"data-id":"sampling-edit-auto-rule-btn-cancel",label:Wt,variant:O.Secondary,size:$.S,onClick:a},{"data-id":"sampling-edit-auto-rule-btn-save",label:Qt,variant:O.Primary,size:$.S,onClick:i}]},children:t(Jt,{$padding:"12px",children:t(Vr,{})})})},Ti=({enabled:e,keepPercentage:a,...n})=>t(Fr,{enabled:e,keepPercentage:a,children:t(wi,{...n})}),xi=({isOpen:e,onClose:a,onSave:n})=>{const{localEnabled:o}=_r(),l=r(()=>{n(o)},[o,n]);return t(Ht,{isOpen:e,width:Yt,header:{icon:gn,title:aa,subTitle:ta,onClose:a},footer:{actions:[{"data-id":"sampling-edit-highly-relevant-auto-rule-btn-cancel",label:Wt,variant:O.Secondary,size:$.S,onClick:a},{"data-id":"sampling-edit-highly-relevant-auto-rule-btn-save",label:Qt,variant:O.Primary,size:$.S,onClick:l}]},children:t(Jt,{$padding:"12px",children:t(jr,{})})})},Di=({enabled:e,...a})=>t(Br,{enabled:e,children:t(xi,{...a})}),Ni=({isOpen:e,onClose:a,onSave:n})=>{const{localEnabled:o,resolvedPercentage:l}=Gr(),i=r(()=>{n(o,l)},[o,l,n]);return t(Ht,{isOpen:e,width:Yt,header:{icon:gn,title:oa,subTitle:na,onClose:a},footer:{actions:[{"data-id":"sampling-edit-cost-reduction-auto-rule-btn-cancel",label:Wt,variant:O.Secondary,size:$.S,onClick:a},{"data-id":"sampling-edit-cost-reduction-auto-rule-btn-save",label:Qt,variant:O.Primary,size:$.S,onClick:i}]},children:t(Jt,{$padding:"12px",children:t(Yr,{})})})},Ai=({enabled:e,dropPercentage:a,...n})=>t(Kr,{enabled:e,dropPercentage:a,children:t(Ni,{...n})}),Ii=({onClose:a,connections:o,selectedConnectionIds:r,setSelectedConnectionIds:i,getEffectiveConfig:s,onApply:d})=>{const u=m(),[p,h]=l(""),[f,y]=l({showOnlySelected:!1}),S=c(()=>o.filter(e=>{const t=!p||e.name.toLowerCase().includes(p.toLowerCase()),a=!f.showOnlySelected||f.showOnlySelected&&r.includes(e.id);return t&&a}),[o.length,r.length,p,f]),C=e=>{i(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[k,w]=l(!1),[T,x]=l(void 0),{formData:D,handleFormChange:N,areFormValuesEqual:I,resetFormData:E}=L(T||{rollout:{automaticRolloutDisabled:!1}}),R=c(()=>r.length>1||void 0!==T&&!I(T,D),[r.length,T,D]);return n(()=>{1===r.length?(async e=>{if(k)return;w(!0);const t=await s(e);if(t){const e={rollout:{automaticRolloutDisabled:t.rollout?.automaticRolloutDisabled??!1}};x(e),E(e)}w(!1)})(r[0]):x(void 0)},[r.length]),t(Ln,{isOpen:!0,onClose:a,onSave:()=>d(D,r),header:{icon:fn,title:"Cluster Configuration"},connectionIds:{value:r,setValue:i},search:{placeholder:"Search by cluster name",value:p,onChange:h},filters:e(g,{$gap:8,children:[t(v,{size:b.XXXS,color:u.v2.colors.silver[200],nowrap:!0,children:"Show only:"}),t(A,{size:lt.S,label:"Selected",value:f.showOnlySelected,onChange:e=>y(t=>({...t,showOnlySelected:e}))})]}),isFormDirty:R,isFetching:k,leftColumn:{width:"35%",header:e(g,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(g,{$gap:8,children:[t(v,{size:b.XS,children:"Clusters"}),t(ie,{label:S.length,status:Xt.Unknown})]}),e(g,{$gap:8,children:[t(v,{size:b.XXXS,color:u.v2.colors.silver[200],align:"right",children:"Selected clusters"}),t(ie,{label:`${r.length}/${S.length}`,status:Xt.Unknown})]})]}),list:S.map(e=>t(Hn,{title:e.name,isChecked:r.includes(e.id),onClick:()=>C(e.id),onCheckboxChange:()=>C(e.id)},e.id))},rightColumn:{width:"65%",header:t(v,{size:b.XS,children:"Configurations"}),list:[t(A,{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:D.rollout?.automaticRolloutDisabled||!1,onChange:e=>N("rollout.automaticRolloutDisabled",e)},"automatic-rollout-disabled")]}})},Ei=({token:n,isLoading:o,isEditing:l,onEdit:r,onCancel:i,onSave:s,formData:c,handleFormChange:d,handleErrorChange:u,formErrors:p})=>{const{CopyButton:m}=la(),h=!l||o||!c.newToken;return ra({key:"Enter",active:!h},s),e(g,l?{$justifyContent:"space-between",$alignItems:"flex-start",$gap:12,children:[t(w,{type:"password",value:c.newToken,onChange:e=>{d("newToken",e.target.value),u("newToken",void 0)},width:"430px",autoFocus:!0,errorMessage:p.newToken}),t(g,{$margin:o?"8px 0 0 0":"2px 0 0 0",$alignItems:"center",children:o?t(Ot,{title:"Saving...",withGradient:!0}):e(a,{children:[t(P,{variant:O.Secondary,size:$.S,leftIcon:rn,onClick:i,disabled:o}),t(P,{variant:O.Primary,size:$.S,leftIcon:pn,onClick:s,disabled:h})]})})]}:{$justifyContent:"space-between",$gap:12,children:[t(v,{size:b.XS,children:new Array(55).fill("•").join("")}),e(g,{$alignItems:"center",$justifyContent:"space-between",children:[t(m,{value:n}),t(Pt,{icon:nn,onClick:r})]})]})},Ri=({expiresAt:e,callbackValid:a,callbackExpired:o})=>{const{formatTimeAgo:l}=ia(),r=c(()=>l(e),[e]),i=c(()=>new Date(e).toDateString().split(" ").slice(1).join(" "),[e]),s=c(()=>sa(e,0)?Q.Error:sa(e,2592e6)?Q.Warning:Q.Success,[e]),d=c(()=>s===Q.Success?pn:s===Q.Warning?vn:bn,[s]);return n(()=>{s===Q.Success?a():s===Q.Error&&o()},[s]),t(ee,{text:i,children:t(ie,{leftIcon:d,label:r,status:s,invertColors:!0,useSecondaryTone:!0})})},Pi=p.div`
348
233
  display: flex;
349
234
  flex-direction: column;
350
235
  gap: 12px;
@@ -352,7 +237,7 @@ import{jsxs as e,jsx as t,Fragment as a}from"react/jsx-runtime";import o,{useThe
352
237
  border-radius: 12px;
353
238
  border: 1px solid ${({theme:e,$isExpired:t})=>t?e.v2.colors.red[500]:e.v2.colors.silver[600]};
354
239
  background-color: ${({theme:e,$isExpired:t})=>t?e.v2.colors.red[1e3]:e.v2.colors.silver[800]};
355
- `,vr=({children:e})=>{const a=n();return t(s,{size:c.XXXS,color:a.v2.colors.grey[150],children:e})},yr=({token:a,updateToken:o})=>{const[n,i]=Gt(!1),[d,u]=Gt(!1),[p,h]=Gt(!1),{formData:m,handleFormChange:g,formErrors:f,handleErrorChange:v,resetFormData:y}=A({newToken:""});return t(ze,{richTitle:{icon:Rt,title:"Odigos Pro Token"},children:e(fr,{$isExpired:p,children:[e(r,{$justifyContent:"space-between",children:[e(l,{$gap:4,children:[t(vr,{children:"Issued for"}),t(s,{size:c.XS,children:a.name||"N/A"})]}),e(l,{$gap:4,children:[t(vr,{children:"Expiration"}),t(gr,{expiresAt:a.expiresAt,callbackValid:()=>h(!1),callbackExpired:()=>h(!0)})]}),t(l,{})]}),t(r,{children:e(l,{children:[t(vr,{children:"Token"}),t(mr,{token:a.token,newToken:m.newToken,isLoading:d,isEditing:n,onEdit:()=>i(!0),onCancel:()=>(i(!1),u(!1),void g("newToken","")),onSave:()=>(async()=>{u(!0);const e=await o(m.newToken.trim());u(!1),e?.error?v("newToken",e.error):(i(!1),y())})(),formData:m,handleFormChange:g,handleErrorChange:v,formErrors:f})]})})]})})},br=o.div`
240
+ `,$i=({children:e})=>{const a=m();return t(v,{size:b.XXXS,color:a.v2.colors.grey[150],children:e})},Oi=({token:a,updateToken:n})=>{const[o,r]=l(!1),[i,s]=l(!1),[c,d]=l(!1),{formData:u,handleFormChange:p,formErrors:m,handleErrorChange:f,resetFormData:y}=L({newToken:""});return t(be,{richTitle:{icon:yn,title:"Odigos Pro Token"},children:e(Pi,{$isExpired:c,children:[e(g,{$justifyContent:"space-between",children:[e(h,{$gap:4,children:[t($i,{children:"Issued for"}),t(v,{size:b.XS,children:a.name||"N/A"})]}),e(h,{$gap:4,children:[t($i,{children:"Expiration"}),t(Ri,{expiresAt:a.expiresAt,callbackValid:()=>d(!1),callbackExpired:()=>d(!0)})]}),t(h,{})]}),t(g,{children:e(h,{children:[t($i,{children:"Token"}),t(Ei,{token:a.token,newToken:u.newToken,isLoading:i,isEditing:o,onEdit:()=>r(!0),onCancel:()=>(r(!1),s(!1),void p("newToken","")),onSave:()=>(async()=>{s(!0);const e=await n(u.newToken.trim());s(!1),e?.error?f("newToken",e.error):(r(!1),y())})(),formData:u,handleFormChange:p,handleErrorChange:f,formErrors:m})]})})]})})},Mi=p.div`
356
241
  display: flex;
357
242
  flex-direction: column;
358
243
  align-items: center;
@@ -361,49 +246,7 @@ import{jsxs as e,jsx as t,Fragment as a}from"react/jsx-runtime";import o,{useThe
361
246
  padding: 12px 24px;
362
247
  border-radius: 8px;
363
248
  background-color: ${({theme:e})=>e.v2.colors.silver[800]};
364
- `,Sr=({downloadDiagnose:a})=>{const o=n(),{progress:d}=Ne(),{namespaces:u}=Se(),[p,h]=Gt(null),{formData:m,handleFormChange:g,resetFormData:f}=A({includeProfiles:!0,includeMetrics:!0,includeSourceWorkloads:!1,sourceWorkloadNamespaces:[]});return t(ze,{richTitle:{icon:$t,title:"Diagnose"},children:p?e(br,{children:[t(ge,{title:"Creating file...",subTitle:"This may take a few moments. Do not refresh the page.",withGradient:!0,withSpinner:"number"==typeof d[De.DownloadingDiagnose]?.percentage,percentage:d[De.DownloadingDiagnose]?.percentage,withVisual:"number"!=typeof d[De.DownloadingDiagnose]?.percentage,visualIcon:Pt,startedAt:p}),d[De.DownloadingDiagnose]?.list?.length&&t(l,{$width:"100%",children:d[De.DownloadingDiagnose].list.map(a=>e(r,{$gap:4,$alignItems:"center",children:[a.status===U.Success?t(wt,{size:16}):a.status===U.Error?t(xt,{size:16}):t(ge,{withSpinnerOld:!0,scaleSpinnerOld:.7}),t(s,{size:c.XXXS,color:o.v2.colors.silver[200],children:a.label})]},a.label))})]}):e(l,{$gap:24,children:[t(s,{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."}),e(l,{$gap:16,children:[e(r,{$gap:8,children:[t(i,{label:"Profiles",value:m.includeProfiles,onChange:e=>g("includeProfiles",e),tooltip:"Note: Adds 30s to diagnose download time to collect Profiles"}),t(s,{size:c.XXXS,color:o.v2.colors.silver[200],children:"Include pprof profiles"})]}),e(r,{$gap:8,children:[t(i,{label:"Metrics",value:m.includeMetrics,onChange:e=>g("includeMetrics",e)}),t(s,{size:c.XXXS,color:o.v2.colors.silver[200],children:"Include Prometheus metrics"})]}),e(r,{$gap:8,children:[t(i,{label:"Source Workloads",value:m.includeSourceWorkloads,onChange:e=>{g("includeSourceWorkloads",e),e&&g("sourceWorkloadNamespaces",[])}}),t(s,{size:c.XXXS,color:o.v2.colors.silver[200],children:"Include workload and pod manifests for instrumented sources"})]})]}),t($e,{alignX:Ve.Left,alignY:Xe.Bottom,items:u.map(e=>({id:e.name,label:e.name,withCheckbox:!0})),selectedIds:m.sourceWorkloadNamespaces,setSelectedIds:e=>g("sourceWorkloadNamespaces",e),withMultiSelect:!0,withSearch:!0,fullWidth:!0,buttonProps:{label:(m.sourceWorkloadNamespaces.length?"Selected":"Select")+" Namespaces",variant:T.Secondary,disabled:m.includeSourceWorkloads,leftIcon:m.sourceWorkloadNamespaces.length?()=>t(Q,{label:m.sourceWorkloadNamespaces.length,status:U.Default}):void 0}}),t(r,{$justifyContent:"flex-end",children:t(w,{label:"Download Diagnose",rightIcon:Pt,variant:T.Primary,onClick:async()=>{h(Date.now()),await a(m),h(null),f()},disabled:null!==p})})]})})},Cr=({fetchDescribeOdigos:e})=>{const{platformType:a,version:o,tier:n}=te(),[l,r]=Gt(null);return Ht(()=>{e().then(({data:e})=>r(e?.describeOdigos||null))},[]),t(ze,{richTitle:{icon:Ot,title:"General Information"},children:t(_e,{cellsPerRow:2,items:[{id:Be(),title:"Odigos Version",label:o},{id:Be(),title:`${a.toUpperCase()} Version`,label:l?.kubernetesVersion?.value||"-"},{id:Be(),title:"Installation Method",label:l?.installationMethod?.value||"-"},{id:Be(),title:"Tier",label:n}]})})},kr=({isOpen:a,onClose:o,token:n,updateToken:l,fetchDescribeOdigos:r,downloadDiagnose:i})=>e(Pe,{isOpen:a,header:{icon:Ot,title:"System Overview",onClose:o},children:[r&&t(Cr,{fetchDescribeOdigos:r}),l&&n&&t(yr,{token:n,updateToken:l}),i&&t(Sr,{downloadDiagnose:i})]}),wr="-",xr="Operation type",Tr="Sample",Nr="Delete rule",Dr={noisy:"Edit 'Noisy Operations' sampling rule",highlyRelevant:"Edit 'Highly Relevant Operations' sampling rule",costReduction:"Edit 'Cost Reduction' sampling rule"},Ar="All operations",Ir="HTTP server endpoint",Er={noisy:"Noisy Operation",highlyRelevant:"Highly Relevant",costReduction:"Cost Reduction"},Rr=o.div`
365
- display: flex;
366
- flex-direction: column;
367
- gap: 8px;
368
- border-radius: 8px;
369
- `,$r=o.div`
370
- min-width: 0;
371
- padding: 8px 16px;
372
- border-radius: 8px;
373
- background-color: ${({theme:e})=>e.v2.colors.silver[800]};
374
- white-space: pre;
375
- overflow-x: auto;
376
- `,Pr=({summary:a})=>{const o=n();return e(Rr,{children:[t(s,{size:c.XXS,color:o.v2.colors.silver[200],children:an}),t($r,{children:t(xo,{parts:a})})]})};function Or(e){return"highlyRelevant"===e.category?e.rule.error?"Error":null!=e.rule.durationAtLeastMs?"Duration":"Relevance":Er[e.category]}const Mr=({data:a})=>{const o=n(),l=Jt(()=>[{id:"name",title:sn,value:a.rule.name||Zo},{id:"type",title:cn,value:Or(a)}],[a]),r=a.rule.notes||wr;return e(Dn,{children:[t(In,{children:l.map(({id:a,title:n,value:l})=>e(En,{children:[t(s,{size:c.XXXS,color:o.v2.colors.silver[200],nowrap:!0,children:n}),t(s,{size:c.XS,nowrap:!0,children:l})]},a))}),e(En,{children:[t(s,{size:c.XXXS,color:o.v2.colors.silver[200],children:dn}),t(s,{size:c.XS,children:r})]})]})},Fr=o.div`
377
- display: flex;
378
- flex-direction: column;
379
- gap: 4px;
380
- `,Lr=o.div`
381
- display: flex;
382
- align-items: center;
383
- gap: 8px;
384
- padding: 8px 12px;
385
- border-radius: 8px;
386
- background-color: ${({theme:e})=>e.v2.colors.silver[700]};
387
- `,zr=o.div`
388
- display: flex;
389
- width: 24px;
390
- height: 24px;
391
- justify-content: center;
392
- align-items: center;
393
- flex-shrink: 0;
394
- `,Xr={[Ee.JavaScript]:"Node.js",[Ee.DotNet]:".NET",[Ee.Php]:"PHP",[Ee.Java]:"Java",[Ee.Go]:"Go",[Ee.Python]:"Python",[Ee.Ruby]:"Ruby",[Ee.Rust]:"Rust"};function Vr(e){const t=Xr[e];return t||e.charAt(0).toUpperCase()+e.slice(1)}const _r=({scopes:a})=>{const o=n();return e(Dn,{children:[t(s,{size:c.XS,weight:500,children:on}),a.length?t(Fr,{children:a.map((a,n)=>function(a,o,n){if(a.workloadLanguage){const l=ee(a.workloadLanguage);return e(Lr,{children:[l&&t(zr,{children:t(l,{size:18})}),t(s,{size:c.XS,color:n.v2.colors.white[500],children:Vr(a.workloadLanguage)})]},o)}const l=[a.workloadNamespace,a.workloadKind,a.workloadName].filter(Boolean),r=l.length?l.join(" / "):"Unknown scope";return t(Lr,{children:t(s,{size:c.XS,color:n.v2.colors.white[500],children:r})},o)}(a,n,o))}):t(B,{status:U.Default,message:"Rule will apply to all sources in the cluster",fullWidth:!0})]})},Br="Kafka topic",Ur="Any method";const jr=({data:a})=>{const o=n(),l=Jt(()=>function(e){if("noisy"===e.category){const t=e.rule.operation;if(t?.httpServer)return[{id:"type",title:xr,value:Ir},{id:"route",title:un,value:t.httpServer.route||t.httpServer.routePrefix||wr},{id:"method",title:pn,value:t.httpServer.method||Ur}];if(t?.httpClient){const e=[{id:"type",title:xr,value:"HTTP client endpoint"}];return t.httpClient.serverAddress&&e.push({id:"serverAddress",title:"Server address",value:t.httpClient.serverAddress}),e.push({id:"route",title:un,value:t.httpClient.templatedPath||t.httpClient.templatedPathPrefix||wr}),e.push({id:"method",title:pn,value:t.httpClient.method||Ur}),e}return[{id:"type",title:xr,value:Ar}]}const t=e.rule.operation;return t?.httpServer?[{id:"type",title:xr,value:Ir},{id:"route",title:un,value:t.httpServer.route||t.httpServer.routePrefix||wr},{id:"method",title:pn,value:t.httpServer.method||Ur}]:t?.kafkaConsumer?[{id:"type",title:xr,value:"Kafka consumer"},{id:"topic",title:Br,value:t.kafkaConsumer.kafkaTopic||wr}]:t?.kafkaProducer?[{id:"type",title:xr,value:"Kafka producer"},{id:"topic",title:Br,value:t.kafkaProducer.kafkaTopic||wr}]:[{id:"type",title:xr,value:Ar}]}(a),[a]);return e(Dn,{children:[t(s,{size:c.XS,children:nn}),t(In,{children:l.map(({id:a,title:n,value:l})=>e(En,{children:[t(s,{size:c.XXXS,color:o.v2.colors.silver[200],nowrap:!0,children:n}),t(s,{size:c.XS,nowrap:!0,children:l})]},a))})]})},Hr=()=>{},Kr=o.div`
395
- display: flex;
396
- gap: 12px;
397
- `,Gr=({rule:a})=>{const o=n(),l=null!=a.durationAtLeastMs,r=a.error;return l||r?e(Kr,{children:[l&&e(An,{children:[t(s,{size:c.XS,children:ln}),e("div",{children:[t(s,{size:c.XXXS,color:o.v2.colors.silver[200],children:gn}),t(s,{size:c.XS,children:`${a.durationAtLeastMs}ms`})]})]}),r&&e(An,{children:[t(s,{size:c.XS,children:rn}),t(b,{onChange:Hr,value:!0,size:we.S,label:fn,labelAlign:S.Right})]})]}):null};const Wr=({data:a})=>{const o=n(),l=Jt(()=>function(e){switch(e.category){case"highlyRelevant":return null!=e.rule.percentageAtLeast?{title:hn,method:Tr,description:vn,value:`${e.rule.percentageAtLeast}%`}:{title:hn,method:"Keep all",description:null,value:null};case"noisy":return null!=e.rule.percentageAtMost?{title:mn,method:Tr,description:yn,value:`${e.rule.percentageAtMost}%`}:{title:mn,method:"Drop all",description:null,value:null};case"costReduction":return{title:mn,method:Tr,description:yn,value:`${e.rule.percentageAtMost}%`}}}(a),[a]),r=[{id:"method",title:pn,value:l.method},...null!=l.description?[{id:"value",title:l.description,value:l.value}]:[]];return e(Dn,{children:[t(s,{size:c.XS,children:l.title}),t(In,{children:r.map(({id:a,title:n,value:l})=>e(En,{children:[t(s,{size:c.XXXS,color:o.v2.colors.silver[200],nowrap:!0,children:n}),t(s,{size:c.XS,nowrap:!0,children:l})]},a))})]})},qr=o.div`
398
- display: flex;
399
- align-items: center;
400
- gap: 12px;
401
- margin-top: auto;
402
- padding: 12px 4px;
403
- border-top: 1px solid ${({theme:e})=>e.v2.colors.silver[800]};
404
- `,Yr=o.div`
405
- flex: 1;
406
- `,Jr=o.div`
249
+ `,Fi=({downloadDiagnose:a})=>{const n=m(),{progress:o}=Ut(),{namespaces:r}=zt(),[i,s]=l(null),{formData:c,handleFormChange:d,resetFormData:u}=L({includeProfiles:!0,includeMetrics:!0,includeSourceWorkloads:!1,sourceWorkloadNamespaces:[]});return t(be,{richTitle:{icon:Sn,title:"Diagnose"},children:i?e(Mi,{children:[t(Ot,{title:"Creating file...",subTitle:"This may take a few moments. Do not refresh the page.",withGradient:!0,withSpinner:"number"==typeof o[jt.DownloadingDiagnose]?.percentage,percentage:o[jt.DownloadingDiagnose]?.percentage,withVisual:"number"!=typeof o[jt.DownloadingDiagnose]?.percentage,visualIcon:Cn,startedAt:i}),o[jt.DownloadingDiagnose]?.list?.length&&t(h,{$width:"100%",children:o[jt.DownloadingDiagnose].list.map(a=>e(g,{$gap:4,$alignItems:"center",children:[a.status===Q.Success?t(pn,{size:16}):a.status===Q.Error?t(rn,{size:16}):t(Ot,{withSpinnerOld:!0,scaleSpinnerOld:.7}),t(v,{size:b.XXXS,color:n.v2.colors.silver[200],children:a.label})]},a.label))})]}):e(h,{$gap:24,children:[t(v,{size:b.XXS,color:n.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."}),e(h,{$gap:16,children:[e(g,{$gap:8,children:[t(f,{label:"Profiles",value:c.includeProfiles,onChange:e=>d("includeProfiles",e),tooltip:"Note: Adds 30s to diagnose download time to collect Profiles"}),t(v,{size:b.XXXS,color:n.v2.colors.silver[200],children:"Include pprof profiles"})]}),e(g,{$gap:8,children:[t(f,{label:"Metrics",value:c.includeMetrics,onChange:e=>d("includeMetrics",e)}),t(v,{size:b.XXXS,color:n.v2.colors.silver[200],children:"Include Prometheus metrics"})]}),e(g,{$gap:8,children:[t(f,{label:"Source Workloads",value:c.includeSourceWorkloads,onChange:e=>{d("includeSourceWorkloads",e),e&&d("sourceWorkloadNamespaces",[])}}),t(v,{size:b.XXXS,color:n.v2.colors.silver[200],children:"Include workload and pod manifests for instrumented sources"})]})]}),t(Fe,{alignX:da.Left,alignY:ca.Bottom,items:r.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:O.Secondary,disabled:c.includeSourceWorkloads,leftIcon:c.sourceWorkloadNamespaces.length?()=>t(ie,{label:c.sourceWorkloadNamespaces.length,status:Q.Default}):void 0}}),t(g,{$justifyContent:"flex-end",children:t(P,{label:"Download Diagnose",rightIcon:Cn,variant:O.Primary,onClick:async()=>{s(Date.now()),await a(c),s(null),u()},disabled:null!==i})})]})})},Li=({fetchDescribeOdigos:e})=>{const{platformType:a,version:o,tier:r}=de(),[i,s]=l(null);return n(()=>{e().then(({data:e})=>s(e?.describeOdigos||null))},[]),t(be,{richTitle:{icon:kn,title:"General Information"},children:t(ua,{cellsPerRow:2,items:[{id:pa(),title:"Odigos Version",label:o},{id:pa(),title:`${a.toUpperCase()} Version`,label:i?.kubernetesVersion?.value||"-"},{id:pa(),title:"Installation Method",label:i?.installationMethod?.value||"-"},{id:pa(),title:"Tier",label:r}]})})},zi=({isOpen:a,onClose:n,token:o,updateToken:l,fetchDescribeOdigos:r,downloadDiagnose:i})=>e(Ht,{isOpen:a,header:{icon:kn,title:"System Overview",onClose:n},children:[r&&t(Li,{fetchDescribeOdigos:r}),l&&o&&t(Oi,{token:o,updateToken:l}),i&&t(Fi,{downloadDiagnose:i})]}),Vi=p.div`
407
250
  display: flex;
408
251
  align-items: center;
409
252
  gap: 8px;
@@ -413,29 +256,9 @@ import{jsxs as e,jsx as t,Fragment as a}from"react/jsx-runtime";import o,{useThe
413
256
  &:hover {
414
257
  background-color: ${({theme:e})=>e.v2.colors.silver[800]};
415
258
  }
416
- `,Qr=a=>{const o=n().v2.colors.red[500];if(a.isEditing){const{onCancelEdit:n,onSave:l,onDelete:r,duplicateWarning:i}=a;return e(qr,{children:[e(Jr,{onClick:r,children:[t(s,{size:c.XS,weight:500,color:o,children:Nr}),t(dt,{size:16,fill:o})]}),i&&t(B,{status:U.Warning,message:i.message,action:i.onViewRule?{label:"View rule",onClick:i.onViewRule}:void 0}),t(Yr,{}),t(w,{label:tn,variant:T.Secondary,size:x.S,onClick:n}),t(w,{label:"Save",variant:T.Primary,size:x.S,onClick:l,disabled:!!i})]})}const{onDelete:l,onCancel:r,onEdit:i}=a;return e(qr,{children:[e(Jr,{onClick:l,children:[t(s,{size:c.XS,weight:500,color:o,children:Nr}),t(dt,{size:16,fill:o})]}),t(Yr,{}),t(w,{label:tn,variant:T.Secondary,size:x.S,onClick:r}),t(w,{label:en,variant:T.Primary,size:x.S,onClick:i})]})},Zr=["5000","1000","500","100","50"],ei=["50","25","10","1","0.5","0.1"];function ti(e){if(null==e)return{percentageMode:"all",percentagePreset:"50",customPercentage:""};const t=ei.find(t=>Number(t)===e);return t?{percentageMode:"sample",percentagePreset:t,customPercentage:""}:{percentageMode:"sample",percentagePreset:"custom",customPercentage:String(e)}}function ai(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 oi(e){const t=bl(),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=ti(e.rule.percentageAtMost);break;case"highlyRelevant":l=ai(e.rule.operation),r=ti(e.rule.percentageAtLeast),i=function(e){if(null==e)return{durationPreset:"500",customDurationMs:""};const t=Zr.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=ai(e.rule.operation),r=ti(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 ni=o.div`
417
- display: flex;
418
- flex-direction: column;
419
- gap: 16px;
420
- padding: 32px 28px;
421
- flex: 1;
422
- overflow-y: auto;
423
- `,li=({data:a,defaultEditMode:o,onClose:n,onDelete:l,onSaveEdit:r,sourceOptions:i,namespaceOptions:s,validateForm:c,onNavigateToDuplicate:d})=>{const[u,p]=Gt(!1),{formData:h,handleFormChange:m,resetFormData:g}=A(void 0),f=Qt(null),[v,y]=Gt(null);Ht(()=>{a!==f.current&&(f.current=a,a&&o?(g(oi(a)),y(null),p(!0)):(p(!1),y(null)))},[a,o]);const b=a?.rule.name||Zo,S=u&&a?Dr[a.category]:`${b} preview`,C=Wt(()=>{a&&(g(oi(a)),y(null),p(!0))},[a,g]),k=Wt(()=>{p(!1),y(null)},[]),w=Wt(()=>{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]),x=Wt(()=>{a&&l(a.rule.ruleId,a.samplingId)},[a,l]),T=Wt(e=>{y(null),m(void 0,void 0,{...h,...e})},[h,m]),N=v?{message:v.message,onViewRule:d?()=>d(v.ruleId):void 0}:null;return e(Pe,{isOpen:!!a,width:Sn,header:{icon:Dt,title:S,subTitle:a?bn[a.category]:"",onClose:n},children:[a&&!u&&e(ni,{children:[t(Pr,{summary:a.summary}),t(Mr,{data:a}),t(_r,{scopes:a.rule.sourceScopes??[]}),t(jr,{data:a}),"highlyRelevant"===a.category&&t(Gr,{rule:a.rule}),t(Wr,{data:a}),t(Qr,{isEditing:!1,onDelete:x,onCancel:n,onEdit:C})]}),a&&u&&e(ni,{children:[t(Nn,{category:a.category,formState:h,onChange:T}),t(Fn,{category:a.category,formState:h,onChange:T}),t(Wn,{formState:h,onChange:T,sourceOptions:i,namespaceOptions:s}),t(ll,{category:a.category,formState:h,onChange:T}),"highlyRelevant"===a.category&&t(ul,{ruleType:h.ruleType,formState:h,onChange:T}),t(yl,{category:a.category,formState:h,onChange:T}),t(Qr,{isEditing:!0,onCancelEdit:k,onSave:w,onDelete:x,duplicateWarning:N})]})]})},ri=o.div`
424
- display: flex;
425
- flex-direction: column;
426
- gap: 8px;
427
- padding: 16px;
428
- border-radius: 12px;
429
- background-color: ${({theme:e})=>e.v2.colors.silver[800]};
430
- `,ii=o(r)`
431
- align-items: center;
432
- gap: 24px;
433
- `,si=o.div`
259
+ `,Xi=p.div`
434
260
  flex: 1;
435
- min-width: 0;
436
- white-space: pre;
437
- overflow-x: auto;
438
- `,ci=({title:a,summary:o,onEdit:l})=>{const r=n();return e(ri,{children:[t(s,{size:c.XXS,color:r.v2.colors.silver[200],children:a}),e(ii,{children:[t(si,{children:t(xo,{parts:o})}),t(w,{label:"Edit auto rule",rightIcon:ft,variant:T.Text,size:x.S,onClick:l})]})]})};var di,ui;!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"}(di||(di={})),function(e){e.Id="id",e.Name="name",e.Type="type",e.Status="status",e.OdigosVersion="odigosVersion",e.ConnectedSince="connectedSince",e.LastActivity="lastActivity"}(ui||(ui={}));const pi=[{key:ui.Name,label:"Name"},{key:ui.Type,label:"Type",textAlign:"right"},{key:ui.Status,label:"Status"},{key:ui.OdigosVersion,label:"Odigos Version"},{key:ui.ConnectedSince,label:"Connected Since"},{key:ui.LastActivity,label:"Last Activity"}],hi=(e,t)=>{const a=e.find(e=>e.key===ui.Id)?.rawValue;return t(a?.toString()||"")},mi=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===ui.Status)?.rawValue===U.Success)(e))return[{id:Be(),label:"Delete Connection",rightIcon:gt,onClick:()=>hi(e,n)}];const d=hi(e,e=>{const o=t.find(t=>t.id===e);return!!o&&Ue(o.odigosVersion,a)}),u=hi(e,e=>{const a=t.find(t=>t.id===e);return!!a&&Ue(a.odigosVersion,o)}),p=[];return l&&p.push({id:Be(),tooltip:u?pe.ADD_SOURCE:`To use this feature, please upgrade to Odigos v${o} or later.`,rightIcon:Nt,disabled:!u,onClick:()=>hi(e,l)}),r&&p.push({id:Be(),tooltip:pe.ADD_DESTINATION,rightIcon:St,onClick:()=>hi(e,r)}),i&&p.push({id:Be(),tooltip:pe.ADD_ACTION,rightIcon:bt,onClick:()=>hi(e,i)}),s&&p.push({id:Be(),tooltip:pe.ADD_INSTRUMENTATION_RULE,rightIcon:Tt,onClick:()=>hi(e,s)}),c&&p.push({id:Be(),tooltip:d?"Edit Configuration":`To use this feature, please upgrade to Odigos v${a} or later.`,rightIcon:At,disabled:!d,onClick:()=>hi(e,c)}),p}},gi=({tableRowsMaxHeight:a,connections:o,getConnections:l,onClickConnection:r,deleteConnection:i,configMinSupportedVersion:s=0,getEffectiveConfig:c,applyConfigurations:d,snapshotMinSupportedVersion:u=0,getAllClusterSnapshots:p,persistSources:h,getDestinationCategories:m,getPotentialDestinations:g,testConnection:f,createDestination:v,updateDestination:y,createAction:b,createInstrumentationRule:S})=>{const C=n(),{isVm:k}=te(),{formatTimeAgo:w}=Fe(),[N,D]=Gt(!1),[A,I]=Gt(o||[]),E=Wt(async()=>{try{D(!0),I(await l()??[])}catch(e){}finally{D(!1)}},[]);Ht(()=>{A.length||E()},[]);const[R,$]=Gt(""),[P,O]=Gt(null),[M,F]=Gt([]),L=Jt(()=>P===di.BulkConfig?s:P===di.BulkSource?u:0,[P,s,u]),{supportedConnections:z,supportedConnectionIds:X}=Jt(()=>{const e=((e,t)=>e.filter(e=>{const a=e.status===U.Success,o=Ue(e.odigosVersion,t);return a&&o}))(A,L);return{supportedConnections:e,supportedConnectionIds:e.map(e=>e.id)}},[A.length,L]);Ht(()=>{if(!P||P===di.Delete)return;const e=M.filter(e=>!X.includes(e));e.length&&F(t=>t.filter(t=>!e.includes(t)))},[P,M.length,X.length]);const V=Jt(()=>A.filter(e=>!R||e.name.toLowerCase().includes(R.toLowerCase())).map(e=>({cells:[{key:ui.Id,rawValue:e.id},{key:ui.Name,rawValue:e.name},{key:ui.Type,rawValue:e.type},{key:ui.Status,rawValue:e.status,component:()=>(e=>{const a=e===U.Success?"Connection live":"Connection lost",o=e===U.Success?wt:xt;return t(Q,{status:e,label:a,leftIcon:o})})(e.status)},{key:ui.OdigosVersion,rawValue:e.odigosVersion},{key:ui.ConnectedSince,rawValue:e.connectedAt?w(e.connectedAt):"-"},{key:ui.LastActivity,rawValue:e.lastSeenAt?w(e.lastSeenAt):"-"}],onClick:e.status!==U.Success||P?void 0:()=>r(e),isSelected:M.includes(e.id),onSelect:()=>F(t=>Array.from(new Set([...t,e.id]))),onDeselect:()=>F(t=>t.filter(t=>t!==e.id)),hideCheckbox:e.status!==U.Success||P===di.BulkConfig&&!Ue(e.odigosVersion,s)||P===di.BulkSource&&!Ue(e.odigosVersion,u)})),[A,M,R,P,s,u]),_=Jt(()=>{const e=(e,t)=>{F([e]),O(t)};return mi({connections:A,configMinSupportedVersion:s,snapshotMinSupportedVersion:u,onDelete:t=>e(t,di.Delete),onAddSource:!k&&p&&h?t=>e(t,di.BulkSource):void 0,onAddDestination:!k&&m&&g&&v?t=>e(t,di.BulkDestination):void 0,onAddAction:!k&&b?t=>e(t,di.BulkAction):void 0,onAddInstrumentationRule:!k&&S?t=>e(t,di.BulkInstrumentationRule):void 0,onEditConfiguration:!k&&c&&d?t=>e(t,di.BulkConfig):void 0})},[k,A,s,c,d,u,p,h,m,g,v,b,S]),B=Jt(()=>(e=>{const{onCancel:t,onAddSource:a,onAddDestination:o,onAddAction:n,onAddInstrumentationRule:l,onManageConfigurations:r}=e,i=[];a&&i.push({id:Be(),type:je.Button,buttonProps:{variant:T.Primary,size:x.S,label:"Add Sources",rightIcon:Nt,onClick:a}});const s=[o?{id:di.BulkDestination,label:pe.ADD_DESTINATION,icon:St}:null,n?{id:di.BulkAction,label:pe.ADD_ACTION,icon:bt}:null,l?{id:di.BulkInstrumentationRule,label:pe.ADD_INSTRUMENTATION_RULE,icon:Tt}:null,r?{id:di.BulkConfig,label:"Manage Configurations",icon:At}:null];return s.some(Boolean)&&i.push({id:Be(),type:je.ButtonDropData,buttonProps:{variant:T.Secondary,size:x.S,label:"Bulk Operations",onClick:e=>{e===di.BulkSource?a?.():e===di.BulkDestination?o?.():e===di.BulkAction?n?.():e===di.BulkInstrumentationRule?l?.():e===di.BulkConfig&&r?.()}},dropDataProps:{alignX:Ve.Left,items:s}}),i.push({id:Be(),type:je.Button,buttonProps:{variant:T.Text,size:x.S,label:He.CANCEL,onClick:t}}),i})({onCancel:()=>F([]),onAddSource:!k&&p&&h?()=>O(di.BulkSource):void 0,onAddDestination:!k&&m&&g&&v?()=>O(di.BulkDestination):void 0,onAddAction:!k&&b?()=>O(di.BulkAction):void 0,onAddInstrumentationRule:!k&&S?()=>O(di.BulkInstrumentationRule):void 0,onManageConfigurations:!k&&c&&d?()=>O(di.BulkConfig):void 0}),[k,c,d,p,h,m,g,v,b,S]);return t(Ke,{children:e(ze,{richTitle:{icon:Ft,title:pe.CONNECTIONS,badge:{label:A.length.toString(),status:ke.Unknown}},search:{placeholder:"Search by cluster name",value:R,onChange:e=>$(e),width:"300px"},actions:[{id:Be(),type:je.Button,buttonProps:{variant:T.Secondary,size:x.S,leftIcon:Mt,onClick:E,disabled:N}}],children:[t(Ge,{variant:We.Pretty,maxHeight:a,headerBackgroundColor:C.v2.colors.silver[1e3],isLoading:N,withCheckboxes:!0,columns:pi,rows:V,rowActionsPushRightPosition:P?`calc(${oa} - 24px)`:void 0,getRowActions:_}),P===di.BulkConfig&&c&&d&&t(hr,{onClose:()=>O(null),connections:z,selectedConnectionIds:M,setSelectedConnectionIds:F,getEffectiveConfig:c,onApply:d}),P===di.BulkSource&&p&&h&&t(qa,{selectedConnectionIds:M,getAllClusterSnapshots:p,children:t(Co,{onClose:()=>O(null),selectedConnectionIds:M,setSelectedConnectionIds:F,persistSources:async e=>await(h?.(e))})}),P===di.BulkDestination&&m&&g&&f&&v&&y&&t($a,{children:t(co,{onClose:()=>O(null),selectedConnectionIds:M,setSelectedConnectionIds:F,getDestinationCategories:m,getPotentialDestinations:g,testConnection:e=>f(e,M),createDestination:e=>v(e,M),updateDestination:(e,t)=>y(e,t,M)})}),P===di.BulkAction&&b&&t(Ta,{children:t(Qa,{onClose:()=>O(null),selectedConnectionIds:M,setSelectedConnectionIds:F,createAction:e=>b(e,M)})}),P===di.BulkInstrumentationRule&&S&&t(Ha,{children:t(uo,{onClose:()=>O(null),selectedConnectionIds:M,setSelectedConnectionIds:F,createInstrumentationRule:e=>S(e,M)})}),t(na,{target:"connection",isOpen:P===di.Delete,onClose:()=>{F([]),O(null)},onApprove:async()=>{const e=M[0];e&&(await i(e),await E())}}),t(qe,{isOpen:!!M.length&&!P,richTitle:{icon:ht,title:"Selected Clusters",badge:{label:M.length}},actions:B})]})})},fi=o.div`
261
+ `,Bi=({onClick:a})=>{const n=m().v2.colors.red[500];return e(Vi,{"data-id":"sampling-view-btn-delete",onClick:a,children:[t(v,{size:b.XS,weight:500,color:n,children:ga}),t(Ja,{size:16,fill:n})]})};function _i(n){if(n.isEditing){const{onCancelEdit:o,onSave:l,onDelete:r,duplicateWarning:i}=n;return{children:e(a,{children:[t(Bi,{onClick:r}),i&&t(J,{status:Q.Warning,message:i.message,action:i.onViewRule?{"data-id":"sampling-view-edit-btn-view-duplicate",label:"View rule",onClick:i.onViewRule}:void 0}),t(Xi,{}),t(P,{"data-id":"sampling-view-edit-btn-cancel",label:Wt,variant:O.Secondary,size:$.S,onClick:o}),t(P,{"data-id":"sampling-view-edit-btn-save",label:ma,variant:O.Primary,size:$.S,onClick:l,disabled:!!i})]})}}const{onDelete:o,onCancel:l,onEdit:r}=n;return{children:e(a,{children:[t(Bi,{onClick:o}),t(Xi,{}),t(P,{"data-id":"sampling-view-btn-cancel",label:Wt,variant:O.Secondary,size:$.S,onClick:l}),t(P,{"data-id":"sampling-view-btn-edit",label:ha,variant:O.Primary,size:$.S,onClick:r})]})}}const Ui=({onClose:e,onDelete:a,onSaveEdit:n,validateForm:o,onNavigateToDuplicate:l})=>{const{data:i,isEditing:s,formData:d,handleEdit:u,handleCancelEdit:p,duplicateWarning:m,setDuplicateWarning:h}=wr(),g=i?.rule.name||st,f=s&&i?fa[i.category]:`${g} preview`,v=r(()=>{if(i&&s){if(o){const e=o(d);if(e)return void h(e)}n(d,i.rule.ruleId,i.samplingId)}},[i,s,d,n,o,h]),b=r(()=>{i&&a(i.rule.ruleId,i.samplingId)},[i,a]),y=c(()=>{if(!i)return;const t=m?{message:m.message,onViewRule:l?()=>l(m.ruleId):void 0}:null;return _i(s?{isEditing:!0,onCancelEdit:p,onSave:v,onDelete:b,duplicateWarning:t}:{isEditing:!1,onDelete:b,onCancel:e,onEdit:u})},[i,s,m,p,v,b,u,e,l]);return t(Ht,{isOpen:!!i,width:Yt,header:{icon:gn,title:f,subTitle:i?Gt[i.category]:"",onClose:e},footer:y,children:i&&t(Jt,{$padding:"12px",children:t($r,{})})})},ji=({data:e,defaultEditMode:a,sourceOptions:n,namespaceOptions:o,...l})=>t(kr,{data:e,defaultEditMode:a,sourceOptions:n,namespaceOptions:o,children:t(Ui,{data:e,...l})});var Hi,Wi;!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"}(Hi||(Hi={})),function(e){e.Id="id",e.Name="name",e.Type="type",e.Status="status",e.OdigosVersion="odigosVersion",e.ConnectedSince="connectedSince",e.LastActivity="lastActivity"}(Wi||(Wi={}));const Ki=[{key:Wi.Name,label:"Name"},{key:Wi.Type,label:"Type",textAlign:"right"},{key:Wi.Status,label:"Status"},{key:Wi.OdigosVersion,label:"Odigos Version"},{key:Wi.ConnectedSince,label:"Connected Since"},{key:Wi.LastActivity,label:"Last Activity"}],Gi=(e,t)=>{const a=e.find(e=>e.key===Wi.Id)?.rawValue;return t(a?.toString()||"")},qi=e=>{const{connections:t,configMinSupportedVersion:a,snapshotMinSupportedVersion:n,onDelete:o,onAddSource:l,onAddDestination:r,onAddAction:i,onAddInstrumentationRule:s,onEditConfiguration:c}=e;return({cells:e})=>{if(!(e=>e.find(e=>e.key===Wi.Status)?.rawValue===Q.Success)(e))return[{id:pa(),label:"Delete Connection",rightIcon:an,onClick:()=>Gi(e,o)}];const d=Gi(e,e=>{const n=t.find(t=>t.id===e);return!!n&&va(n.odigosVersion,a)}),u=Gi(e,e=>{const a=t.find(t=>t.id===e);return!!a&&va(a.odigosVersion,n)}),p=[];return l&&p.push({id:pa(),tooltip:u?Rt.ADD_SOURCE:`To use this feature, please upgrade to Odigos v${n} or later.`,rightIcon:hn,disabled:!u,onClick:()=>Gi(e,l)}),r&&p.push({id:pa(),tooltip:Rt.ADD_DESTINATION,rightIcon:cn,onClick:()=>Gi(e,r)}),i&&p.push({id:pa(),tooltip:Rt.ADD_ACTION,rightIcon:sn,onClick:()=>Gi(e,i)}),s&&p.push({id:pa(),tooltip:Rt.ADD_INSTRUMENTATION_RULE,rightIcon:mn,onClick:()=>Gi(e,s)}),c&&p.push({id:pa(),tooltip:d?"Edit Configuration":`To use this feature, please upgrade to Odigos v${a} or later.`,rightIcon:fn,disabled:!d,onClick:()=>Gi(e,c)}),p}},Yi=({tableRowsMaxHeight:a,connections:o,getConnections:i,onClickConnection:s,deleteConnection:d,configMinSupportedVersion:u=0,getEffectiveConfig:p,applyConfigurations:h,snapshotMinSupportedVersion:g=0,getAllClusterSnapshots:f,persistSources:v,getDestinationCategories:b,getPotentialDestinations:y,testConnection:S,createDestination:C,updateDestination:k,createAction:w,createInstrumentationRule:T})=>{const x=m(),{isVm:D}=de(),{formatTimeAgo:N}=ia(),[A,I]=l(!1),[E,R]=l(o||[]),P=r(async()=>{try{I(!0),R(await i()??[])}catch(e){}finally{I(!1)}},[]);n(()=>{E.length||P()},[]);const[M,F]=l(""),[L,z]=l(null),[V,X]=l([]),B=c(()=>L===Hi.BulkConfig?u:L===Hi.BulkSource?g:0,[L,u,g]),{supportedConnections:_,supportedConnectionIds:U}=c(()=>{const e=((e,t)=>e.filter(e=>{const a=e.status===Q.Success,n=va(e.odigosVersion,t);return a&&n}))(E,B);return{supportedConnections:e,supportedConnectionIds:e.map(e=>e.id)}},[E.length,B]);n(()=>{if(!L||L===Hi.Delete)return;const e=V.filter(e=>!U.includes(e));e.length&&X(t=>t.filter(t=>!e.includes(t)))},[L,V.length,U.length]);const j=c(()=>E.filter(e=>!M||e.name.toLowerCase().includes(M.toLowerCase())).map(e=>({cells:[{key:Wi.Id,rawValue:e.id},{key:Wi.Name,rawValue:e.name},{key:Wi.Type,rawValue:e.type},{key:Wi.Status,rawValue:e.status,component:()=>(e=>{const a=e===Q.Success?"Connection live":"Connection lost",n=e===Q.Success?pn:rn;return t(ie,{status:e,label:a,leftIcon:n})})(e.status)},{key:Wi.OdigosVersion,rawValue:e.odigosVersion},{key:Wi.ConnectedSince,rawValue:e.connectedAt?N(e.connectedAt):"-"},{key:Wi.LastActivity,rawValue:e.lastSeenAt?N(e.lastSeenAt):"-"}],onClick:e.status!==Q.Success||L?void 0:()=>s(e),isSelected:V.includes(e.id),onSelect:()=>X(t=>Array.from(new Set([...t,e.id]))),onDeselect:()=>X(t=>t.filter(t=>t!==e.id)),hideCheckbox:e.status!==Q.Success||L===Hi.BulkConfig&&!va(e.odigosVersion,u)||L===Hi.BulkSource&&!va(e.odigosVersion,g)})),[E,V,M,L,u,g]),H=c(()=>{const e=(e,t)=>{X([e]),z(t)};return qi({connections:E,configMinSupportedVersion:u,snapshotMinSupportedVersion:g,onDelete:t=>e(t,Hi.Delete),onAddSource:!D&&f&&v?t=>e(t,Hi.BulkSource):void 0,onAddDestination:!D&&b&&y&&C?t=>e(t,Hi.BulkDestination):void 0,onAddAction:!D&&w?t=>e(t,Hi.BulkAction):void 0,onAddInstrumentationRule:!D&&T?t=>e(t,Hi.BulkInstrumentationRule):void 0,onEditConfiguration:!D&&p&&h?t=>e(t,Hi.BulkConfig):void 0})},[D,E,u,p,h,g,f,v,b,y,C,w,T]),W=c(()=>(e=>{const{onCancel:t,onAddSource:a,onAddDestination:n,onAddAction:o,onAddInstrumentationRule:l,onManageConfigurations:r}=e,i=[];a&&i.push({id:pa(),type:ba.Button,buttonProps:{variant:O.Primary,size:$.S,label:"Add Sources",rightIcon:hn,onClick:a}});const s=[n?{id:Hi.BulkDestination,label:Rt.ADD_DESTINATION,icon:cn}:null,o?{id:Hi.BulkAction,label:Rt.ADD_ACTION,icon:sn}:null,l?{id:Hi.BulkInstrumentationRule,label:Rt.ADD_INSTRUMENTATION_RULE,icon:mn}:null,r?{id:Hi.BulkConfig,label:"Manage Configurations",icon:fn}:null];return s.some(Boolean)&&i.push({id:pa(),type:ba.ButtonDropData,buttonProps:{variant:O.Secondary,size:$.S,label:"Bulk Operations",onClick:e=>{e===Hi.BulkSource?a?.():e===Hi.BulkDestination?n?.():e===Hi.BulkAction?o?.():e===Hi.BulkInstrumentationRule?l?.():e===Hi.BulkConfig&&r?.()}},dropDataProps:{alignX:da.Left,items:s}}),i.push({id:pa(),type:ba.Button,buttonProps:{variant:O.Text,size:$.S,label:ya.CANCEL,onClick:t}}),i})({onCancel:()=>X([]),onAddSource:!D&&f&&v?()=>z(Hi.BulkSource):void 0,onAddDestination:!D&&b&&y&&C?()=>z(Hi.BulkDestination):void 0,onAddAction:!D&&w?()=>z(Hi.BulkAction):void 0,onAddInstrumentationRule:!D&&T?()=>z(Hi.BulkInstrumentationRule):void 0,onManageConfigurations:!D&&p&&h?()=>z(Hi.BulkConfig):void 0}),[D,p,h,f,v,b,y,C,w,T]);return t(Sa,{children:e(be,{richTitle:{icon:Tn,title:Rt.CONNECTIONS,badge:{label:E.length.toString(),status:Xt.Unknown}},search:{placeholder:"Search by cluster name",value:M,onChange:e=>F(e),width:"300px"},actions:[{id:pa(),type:ba.Button,buttonProps:{variant:O.Secondary,size:$.S,leftIcon:wn,onClick:P,disabled:A}}],children:[t(Ca,{variant:ka.Pretty,maxHeight:a,headerBackgroundColor:x.v2.colors.silver[1e3],isLoading:A,withCheckboxes:!0,columns:Ki,rows:j,rowActionsPushRightPosition:L?`calc(${zn} - 24px)`:void 0,getRowActions:H}),L===Hi.BulkConfig&&p&&h&&t(Ii,{onClose:()=>z(null),connections:_,selectedConnectionIds:V,setSelectedConnectionIds:X,getEffectiveConfig:p,onApply:h}),L===Hi.BulkSource&&f&&v&&t(Ro,{selectedConnectionIds:V,getAllClusterSnapshots:f,children:t(Si,{onClose:()=>z(null),selectedConnectionIds:V,setSelectedConnectionIds:X,persistSources:async e=>await(v?.(e))})}),L===Hi.BulkDestination&&b&&y&&S&&C&&k&&t(ho,{children:t(ci,{onClose:()=>z(null),selectedConnectionIds:V,setSelectedConnectionIds:X,getDestinationCategories:b,getPotentialDestinations:y,testConnection:e=>S(e,V),createDestination:e=>C(e,V),updateDestination:(e,t)=>k(e,t,V)})}),L===Hi.BulkAction&&w&&t(ro,{children:t(Qr,{onClose:()=>z(null),selectedConnectionIds:V,setSelectedConnectionIds:X,createAction:e=>w(e,V)})}),L===Hi.BulkInstrumentationRule&&T&&t(No,{children:t(di,{onClose:()=>z(null),selectedConnectionIds:V,setSelectedConnectionIds:X,createInstrumentationRule:e=>T(e,V)})}),t(Vn,{target:"connection",isOpen:L===Hi.Delete,onClose:()=>{X([]),z(null)},onApprove:async()=>{const e=V[0];e&&(await d(e),await P())}}),t(wa,{isOpen:!!V.length&&!L,richTitle:{icon:en,title:"Selected Clusters",badge:{label:V.length}},actions:W})]})})},Ji=p.div`
439
262
  display: flex;
440
263
  align-items: center;
441
264
  justify-content: space-between;
@@ -444,26 +267,26 @@ import{jsxs as e,jsx as t,Fragment as a}from"react/jsx-runtime";import o,{useThe
444
267
  width: calc(100% - 32px);
445
268
  border-radius: 16px;
446
269
  background-color: ${({theme:e})=>e.v2.colors.silver[800]};
447
- `,vi=o.div`
270
+ `,Qi=p.div`
448
271
  display: flex;
449
272
  align-items: center;
450
273
  justify-content: center;
451
274
  padding: 8px;
452
275
  border-radius: 8px;
453
- background-color: ${({theme:e})=>e.v2.colors.white[500]+d["004"]};
454
- `,yi=({setStep:a,onSave:o,sourcesPayload:l,destinationsPayload:i,disableAnimation:c})=>{const d=n(),u=()=>a(2),p=()=>a(3),h=Jt(()=>Object.values(l||{}).flatMap((a,o)=>a.map((a,n)=>{if(!a.selected)return null;const l=a.kind||se.Namespace,r=l===se.Namespace?a.namespace:`${a.namespace} → ${a.name}`;return e(fi,{children:[t(s,{nowrap:!0,children:r}),t(Q,{label:l,status:U.Info,backgroundColor:d.v2.colors.blue[900]})]},`source-${o}-${n}`)})).filter(Boolean),[l]),m=Jt(()=>i?.map((a,o)=>{const n=ve(a.option.type).icon;return e(fi,{children:[e(r,{$gap:8,children:[n&&t(vi,{children:t(n,{size:24})}),t(s,{nowrap:!0,children:a.formData.name||a.option.displayName})]}),void 0!==a.testResult&&t(Q,{status:a.testResult.succeeded?U.Success:U.Error,leftIcon:a.testResult.succeeded?wt:xt})]},`destination-${o}`)})||[],[i]);return t(aa,{isOpen:!0,disableAnimation:c,onBack:()=>a(3),onSave:o,header:{icon:Lt,title:pe.SUMMARY,subTitle:pe.REVIEW_SETUP},leftColumn:{width:"50%",header:e(r,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(r,{$gap:8,children:[t(Nt,{size:24}),t(s,{nowrap:!0,children:pe.SELECTED_SOURCES}),t(Q,{label:h.length})]}),t(w,{"data-id":"summary-edit-sources",leftIcon:ft,variant:T.Secondary,size:x.S,onClick:u})]}),list:h.length?h:[t(ue,{$height:"100%",children:t(E,{icon:Nt,title:pe.NO_SOURCES_SELECTED,subTitle:pe.ADD_SOURCE_PROMPT,button:{leftIcon:ut,label:pe.ADD_SOURCE,onClick:u}})},"no-sources-data")]},rightColumn:{width:"50%",header:e(r,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(r,{$gap:8,children:[t(St,{size:24}),t(s,{nowrap:!0,children:pe.SELECTED_DESTINATIONS}),t(Q,{label:m.length})]}),t(w,{"data-id":"summary-edit-destinations",leftIcon:ft,variant:T.Secondary,size:x.S,onClick:p})]}),list:m.length?m:[t(ue,{"data-id":"summary-no-destinations",$height:"100%",children:t(E,{icon:St,title:pe.NO_DESTINATIONS_SELECTED,subTitle:pe.ADD_DESTINATION_PROMPT,button:{leftIcon:ut,label:pe.ADD_DESTINATIONS,onClick:p}})},"no-destinations-data")]}})},bi=o.div`
276
+ background-color: ${({theme:e})=>e.v2.colors.white[500]+y["004"]};
277
+ `,Zi=({setStep:a,onSave:n,sourcesPayload:o,destinationsPayload:l,disableAnimation:r})=>{const i=m(),s=()=>a(2),d=()=>a(3),u=c(()=>Object.values(o||{}).flatMap((a,n)=>a.map((a,o)=>{if(!a.selected)return null;const l=a.kind||ve.Namespace,r=l===ve.Namespace?a.namespace:`${a.namespace} → ${a.name}`;return e(Ji,{children:[t(v,{nowrap:!0,children:r}),t(ie,{label:l,status:Q.Info,backgroundColor:i.v2.colors.blue[900]})]},`source-${n}-${o}`)})).filter(Boolean),[o]),p=c(()=>l?.map((a,n)=>{const o=Ft(a.option.type).icon;return e(Ji,{children:[e(g,{$gap:8,children:[o&&t(Qi,{children:t(o,{size:24})}),t(v,{nowrap:!0,children:a.formData.name||a.option.displayName})]}),void 0!==a.testResult&&t(ie,{status:a.testResult.succeeded?Q.Success:Q.Error,leftIcon:a.testResult.succeeded?pn:rn})]},`destination-${n}`)})||[],[l]);return t(Ln,{isOpen:!0,disableAnimation:r,onBack:()=>a(3),onSave:n,header:{icon:xn,title:Rt.SUMMARY,subTitle:Rt.REVIEW_SETUP},leftColumn:{width:"50%",header:e(g,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(g,{$gap:8,children:[t(hn,{size:24}),t(v,{nowrap:!0,children:Rt.SELECTED_SOURCES}),t(ie,{label:u.length})]}),t(P,{"data-id":"summary-edit-sources",leftIcon:nn,variant:O.Secondary,size:$.S,onClick:s})]}),list:u.length?u:[t(Et,{$height:"100%",children:t(V,{icon:hn,title:Rt.NO_SOURCES_SELECTED,subTitle:Rt.ADD_SOURCE_PROMPT,button:{leftIcon:Qa,label:Rt.ADD_SOURCE,onClick:s}})},"no-sources-data")]},rightColumn:{width:"50%",header:e(g,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(g,{$gap:8,children:[t(cn,{size:24}),t(v,{nowrap:!0,children:Rt.SELECTED_DESTINATIONS}),t(ie,{label:p.length})]}),t(P,{"data-id":"summary-edit-destinations",leftIcon:nn,variant:O.Secondary,size:$.S,onClick:d})]}),list:p.length?p:[t(Et,{"data-id":"summary-no-destinations",$height:"100%",children:t(V,{icon:cn,title:Rt.NO_DESTINATIONS_SELECTED,subTitle:Rt.ADD_DESTINATION_PROMPT,button:{leftIcon:Qa,label:Rt.ADD_DESTINATIONS,onClick:d}})},"no-destinations-data")]}})},es=p.div`
455
278
  position: relative;
456
279
  overflow: hidden;
457
280
  width: calc(100vw - ${({$paddingXAxis:e})=>e});
458
281
  height: calc(100vh - ${({$paddingYAxis:e})=>e});
459
282
  box-sizing: border-box;
460
- `,Si=o.svg`
283
+ `,ts=p.svg`
461
284
  position: absolute;
462
285
  top: 50%;
463
286
  left: 50%;
464
287
  transform: translate(-50%, -50%);
465
288
  z-index: -1;
466
- `,Ci=[{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"}],ki=[{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:Ci},{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:Ci},{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:Ci}],wi=({paddingXAxis:a="0px",paddingYAxis:o="0px",children:n})=>{const[l,r]=Gt(window.innerWidth),i=Jt(()=>l/ki[0].width,[l]);return Ht(()=>{const e=()=>r(window.innerWidth);return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),e(bi,{$paddingXAxis:a,$paddingYAxis:o,children:[ki.map(({width:a,height:o,pathOpacity:n,path:l,gradientTransform:r,stops:s},c)=>{const d=`purple-ring-${c}`;return e(Si,{width:a*i,height:"100%",viewBox:`0 0 ${a} ${o}`,fill:"none",children:[t("path",{opacity:n,d:l,fill:`url(#${d})`}),t("defs",{children:t("radialGradient",{id:d,cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:r,children:s.map(({offset:e,opacity:a},o)=>t("stop",{offset:e,stopColor:"#7C3BFF",stopOpacity:a},o))})})]},d)}),n]})},xi=o.div`
289
+ `,as=[{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"}],ns=[{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:as},{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:as},{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:as}],os=({paddingXAxis:a="0px",paddingYAxis:o="0px",children:r})=>{const[i,s]=l(window.innerWidth),d=c(()=>i/ns[0].width,[i]);return n(()=>{const e=()=>s(window.innerWidth);return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),e(es,{$paddingXAxis:a,$paddingYAxis:o,children:[ns.map(({width:a,height:n,pathOpacity:o,path:l,gradientTransform:r,stops:i},s)=>{const c=`purple-ring-${s}`;return e(ts,{width:a*d,height:"100%",viewBox:`0 0 ${a} ${n}`,fill:"none",children:[t("path",{opacity:o,d:l,fill:`url(#${c})`}),t("defs",{children:t("radialGradient",{id:c,cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:r,children:i.map(({offset:e,opacity:a},n)=>t("stop",{offset:e,stopColor:"#7C3BFF",stopOpacity:a},n))})})]},c)}),r]})},ls=p.div`
467
290
  display: flex;
468
291
  flex-direction: column;
469
292
  align-items: center;
@@ -474,7 +297,7 @@ import{jsxs as e,jsx as t,Fragment as a}from"react/jsx-runtime";import o,{useThe
474
297
  width: 50vw;
475
298
  border-radius: 16px;
476
299
  background: ${({theme:e})=>e.v2.colors.silver[900]};
477
- `,Ti=o.div`
300
+ `,rs=p.div`
478
301
  display: flex;
479
302
  flex-direction: column;
480
303
  align-items: center;
@@ -484,12 +307,12 @@ import{jsxs as e,jsx as t,Fragment as a}from"react/jsx-runtime";import o,{useThe
484
307
  & * {
485
308
  text-align: center;
486
309
  }
487
- `,Ni=({onStart:a})=>t(Pe,{width:"75vw",isOpen:!0,hideOverlay:!0,disableAnimation:!0,children:t(ue,{$height:"100%",children:e(xi,{children:[e(Ti,{children:[t(s,{size:c.L,weight:500,children:pe.GET_STARTED_WITH}),t(la,{size:260}),t(s,{size:c.S,weight:400,children:pe.GET_STARTED_DESCRIPTION})]}),t(w,{"data-id":"onboarding-get-started",label:He.GET_STARTED,rightIcon:zt,size:x.L,onClick:a})]})})}),Di=[{step:1,label:pe.INSTALLATION,forceDoneBadge:!0},{step:2,label:pe.SOURCES_SETUP},{step:3,label:pe.DESTINATIONS_SETUP},{step:4,label:pe.SUMMARY}],Ai=o.div`
310
+ `,is=({onStart:a})=>t(Ht,{width:"75vw",isOpen:!0,hideOverlay:!0,disableAnimation:!0,children:t(Et,{$height:"100%",children:e(ls,{children:[e(rs,{children:[t(v,{size:b.L,weight:500,children:Rt.GET_STARTED_WITH}),t(Xn,{size:260}),t(v,{size:b.S,weight:400,children:Rt.GET_STARTED_DESCRIPTION})]}),t(P,{"data-id":"onboarding-get-started",label:ya.GET_STARTED,rightIcon:Dn,size:$.L,onClick:a})]})})}),ss=[{step:1,label:Rt.INSTALLATION,forceDoneBadge:!0},{step:2,label:Rt.SOURCES_SETUP},{step:3,label:Rt.DESTINATIONS_SETUP},{step:4,label:Rt.SUMMARY}],cs=p.div`
488
311
  display: flex;
489
312
  flex-direction: column;
490
313
  gap: 32px;
491
314
  padding: 64px;
492
- `,Ii=({pagePaddingXAxis:a,pagePaddingYAxis:o,fetchNamespacesWithWorkloads:n,persistSources:l,getDestinationCategories:r,getPotentialDestinations:i,testConnection:s,createDestination:c,updateDestination:d,onDone:u})=>{const[p,h]=Gt(1),[m,g]=Gt(!1),[f,v]=Gt(null),[y,b]=Gt(null),S=()=>h(e=>e+1),C=()=>h(e=>e-1);return e(wi,{paddingXAxis:a,paddingYAxis:o,children:[e(Ai,{children:[t(la,{}),t(Ye,{currentStep:p,data:Di,gap:32})]}),t(qa,{fetchNamespacesWithWorkloads:n,initialInputs:f,children:e($a,{children:[1===p&&t(Ni,{onStart:S}),2===p&&t(Co,{disableAnimation:!0,onBack:e=>{v(e),C()},onNext:e=>{v(e),S()},persistSources:l}),3===p&&t(co,{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&&t(yi,{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})]})})]})},Ei=o.div`
315
+ `,ds=({pagePaddingXAxis:a,pagePaddingYAxis:n,fetchNamespacesWithWorkloads:o,persistSources:r,getDestinationCategories:i,getPotentialDestinations:s,testConnection:c,createDestination:d,updateDestination:u,onDone:p})=>{const[m,h]=l(1),[g,f]=l(!1),[v,b]=l(null),[y,S]=l(null),C=()=>h(e=>e+1),k=()=>h(e=>e-1);return e(os,{paddingXAxis:a,paddingYAxis:n,children:[e(cs,{children:[t(Xn,{}),t(Ta,{currentStep:m,data:ss,gap:32})]}),t(Ro,{fetchNamespacesWithWorkloads:o,initialInputs:v,children:e(ho,{children:[1===m&&t(is,{onStart:C}),2===m&&t(Si,{disableAnimation:!0,onBack:e=>{b(e),k()},onNext:e=>{b(e),C()},persistSources:r}),3===m&&t(ci,{disableAnimation:!0,onBack:e=>{S(e),k()},onNext:e=>{S(e),C()},getDestinationCategories:i,getPotentialDestinations:s,initialInputs:y,testConnection:c,createDestination:d,updateDestination:u}),4===m&&t(Zi,{disableAnimation:!0,setStep:h,onSave:async()=>{if(!g){f(!0);try{const e=[];v&&e.push(r(v)),y&&e.push(...y.map(e=>d(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")};p()}catch(e){return f(!1),{error:e instanceof Error?e.message:String(e)}}}},sourcesPayload:v,destinationsPayload:y})]})})]})},us=p.div`
493
316
  display: flex;
494
317
  align-items: center;
495
318
  justify-content: space-between;
@@ -501,66 +324,50 @@ import{jsxs as e,jsx as t,Fragment as a}from"react/jsx-runtime";import o,{useThe
501
324
  &:hover {
502
325
  background: ${({theme:e})=>e.v2.colors.silver[700]};
503
326
  }
504
- `,Ri=o.div`
505
- animation-name: ${et.in};
506
- `,$i=({pod:o,getExtendedPodInfo:n,onClose:r})=>{const{formatTimeAgo:i}=Fe(),[c,d]=Gt(null),[u,p]=Gt(!1);Ht(()=>{o?n(o.namespace,o.name).then(e=>d(e??null)):(d(null),p(!1))},[o]);const h=Jt(()=>[{id:Be(),title:"Node",label:c?.node??"-",withCopy:!0},{id:Be(),title:"Status",badge:{status:Je(c?.status),label:c?.status??"-"}}],[c]),m=Jt(()=>c?.containers?.map(e=>({id:Be(),items:[{id:Be(),title:"Container",label:e.name??"-"},{id:Be(),title:"Status",label:e.startedAt?`${e.status} (since ${i(e.startedAt)})`:e.status},{id:Be(),title:"Ready",badge:{status:e.ready?U.Success:U.Error,leftIcon:e.ready?ht:mt,label:e.ready?"True":"False",invertColors:!0}},{id:Be(),title:"Started",badge:{status:e.started?U.Success:U.Error,leftIcon:e.started?ht:mt,label:e.started?"True":"False",invertColors:!0}},{id:Be(),title:"Image Version",label:e.image?.split(":")?.[1]??"-"},{id:Be(),title:"Image Repository",label:e.image?.split(":")?.[0]??"-"},{id:Be(),title:"Restarts",label:e.restarts.toString()},{id:Be(),title:"State Reason",label:e.stateReason??"-"},{id:Be(),title:"Resource Requests",label:`CPU ${e.resources.requests.cpu} • Memory ${e.resources.requests.memory}`},{id:Be(),title:"Resource Limits",label:`CPU ${e.resources.limits.cpu} • Memory ${e.resources.limits.memory}`}]}))||[],[c]);return e(Pe,{isOpen:!!o,header:{icon:Xt,title:"Pod Information",onClose:r},children:[c?null:t(ue,{children:t(Qe,{})}),c?e(a,{children:[t(ze,{richTitle:{icon:Xt,title:c.name,withCopy:!0},children:e(l,{$gap:24,children:[t(_e,{cellsPerRow:2,items:h}),m.length>0&&e(l,{$gap:12,children:[e(Ei,{onClick:()=>p(e=>!e),children:[t(s,{children:"Containers Overview"}),t(he,{icon:u?Ct:kt})]}),u&&m.map(({id:e,items:a})=>t(Ri,{children:t(_e,{cellsPerRow:2,items:a})},e))]})]})}),t(ze,{richTitle:{icon:Ot,title:"Kubectl Commands"},children:e(l,{$gap:12,children:[t(Ze,{value:`kubectl get pod ${c.name} -n ${c.namespace} -o yaml`}),t(Ze,{value:`kubectl describe pod ${c.name} -n ${c.namespace}`}),t(Ze,{value:`kubectl logs ${c.name} -n ${c.namespace}`})]})}),t(ia,{yaml:c.manifestYAML,defaultOpen:!0})]}):null]})};var Pi;!function(e){e.PodName="podName",e.Status="status",e.Restarts="restarts",e.NodeName="nodeName",e.SpanDropDrate="spanDropDrate",e.Age="age",e.DockerImage="dockerImage"}(Pi||(Pi={}));const Oi=[{key:Pi.PodName,label:"Pod Name"},{key:Pi.Status,label:"Status"},{key:Pi.Restarts,label:"Restarts",textAlign:"right"},{key:Pi.NodeName,label:"Node Name"},{key:Pi.Age,label:"Age",textAlign:"right"},{key:Pi.DockerImage,label:"Docker Image",textAlign:"right"}],Mi=({isLoading:a,tableRowsMaxHeight:o,pods:l,getExtendedPodInfo:i})=>{const c=n(),{formatTimeAgo:d}=Fe(),[u,p]=Gt(null),h=Jt(()=>l.map(a=>({onClick:()=>p(a),cells:[{key:Pi.PodName,rawValue:a.name},{key:Pi.Status,rawValue:a.status,component:()=>{return e=a.status,t(Q,{status:Je(e),label:e});var e}},{key:Pi.Restarts,rawValue:a.restartsCount.toString()},{key:Pi.NodeName,rawValue:a.nodeName},{key:Pi.SpanDropDrate,rawValue:0,component:()=>{const{collectorMetrics:o}=a;if(!o)return t(s,{children:"-"});const n=(o?.metricsAcceptedRps??0)+(o?.metricsDroppedRps??0),l=n>0?Math.round((o?.metricsDroppedRps??0)/n*100):0,i=l>0?U.Error:U.Success,c=(o?.exporterSuccessRps??0)+(o?.exporterFailedRps??0),d=c>0?Math.round((o?.exporterFailedRps??0)/c*100):0,u=d>0?U.Error:U.Success;return e(r,{$gap:4,children:[t(H,{text:`Accepted: ${o.metricsAcceptedRps.toLocaleString()}, Dropped: ${o.metricsDroppedRps.toLocaleString()}`,children:t(Q,{status:i,label:`Receiver ${l}%`,leftIcon:i===U.Error?Vt:_t,useSecondaryTone:!0,invertColors:!0})}),t(H,{text:`Success: ${o.exporterSuccessRps.toLocaleString()}, Failed: ${o.exporterFailedRps.toLocaleString()}`,children:t(Q,{status:u,label:`Exporter ${d}%`,leftIcon:u===U.Error?Vt:_t,useSecondaryTone:!0,invertColors:!0})})]})}},{key:Pi.Age,rawValue:d(a.creationTimestamp)},{key:Pi.DockerImage,rawValue:a.image}]})),[l,c]);return e(ze,{richTitle:{icon:Xt,title:"Pods"},children:[t(Ge,{variant:We.Data,maxHeight:o,isLoading:a,columns:Oi,rows:h}),t($i,{pod:u,getExtendedPodInfo:i,onClose:()=>p(null)})]})};var Fi;!function(e){e.Gateway="gateway",e.Node="node"}(Fi||(Fi={}));const Li=[{value:Fi.Gateway,label:"Gateway"},{value:Fi.Node,label:"Node Collector"}],zi=o.div`
327
+ `,ps=p.div`
328
+ animation-name: ${Aa.in};
329
+ `,ms=({pod:o,getExtendedPodInfo:r,onClose:i})=>{const{formatTimeAgo:s}=ia(),[d,u]=l(null),[p,m]=l(!1);n(()=>{o?r(o.namespace,o.name).then(e=>u(e??null)):(u(null),m(!1))},[o]);const g=c(()=>[{id:pa(),title:"Node",label:d?.node??"-",withCopy:!0},{id:pa(),title:"Status",badge:{status:xa(d?.status),label:d?.status??"-"}}],[d]),f=c(()=>d?.containers?.map(e=>({id:pa(),items:[{id:pa(),title:"Container",label:e.name??"-"},{id:pa(),title:"Status",label:e.startedAt?`${e.status} (since ${s(e.startedAt)})`:e.status},{id:pa(),title:"Ready",badge:{status:e.ready?Q.Success:Q.Error,leftIcon:e.ready?en:tn,label:e.ready?"True":"False",invertColors:!0}},{id:pa(),title:"Started",badge:{status:e.started?Q.Success:Q.Error,leftIcon:e.started?en:tn,label:e.started?"True":"False",invertColors:!0}},{id:pa(),title:"Image Version",label:e.image?.split(":")?.[1]??"-"},{id:pa(),title:"Image Repository",label:e.image?.split(":")?.[0]??"-"},{id:pa(),title:"Restarts",label:e.restarts.toString()},{id:pa(),title:"State Reason",label:e.stateReason??"-"},{id:pa(),title:"Resource Requests",label:`CPU ${e.resources.requests.cpu} • Memory ${e.resources.requests.memory}`},{id:pa(),title:"Resource Limits",label:`CPU ${e.resources.limits.cpu} • Memory ${e.resources.limits.memory}`}]}))||[],[d]);return e(Ht,{isOpen:!!o,header:{icon:Nn,title:"Pod Information",onClose:i},children:[d?null:t(Et,{children:t(Da,{})}),d?e(a,{children:[t(be,{richTitle:{icon:Nn,title:d.name,withCopy:!0},children:e(h,{$gap:24,children:[t(ua,{cellsPerRow:2,items:g}),f.length>0&&e(h,{$gap:12,children:[e(us,{onClick:()=>m(e=>!e),children:[t(v,{children:"Containers Overview"}),t(Pt,{icon:p?dn:un})]}),p&&f.map(({id:e,items:a})=>t(ps,{children:t(ua,{cellsPerRow:2,items:a})},e))]})]})}),t(be,{richTitle:{icon:kn,title:"Kubectl Commands"},children:e(h,{$gap:12,children:[t(Na,{value:`kubectl get pod ${d.name} -n ${d.namespace} -o yaml`}),t(Na,{value:`kubectl describe pod ${d.name} -n ${d.namespace}`}),t(Na,{value:`kubectl logs ${d.name} -n ${d.namespace}`})]})}),t(_n,{yaml:d.manifestYAML,defaultOpen:!0})]}):null]})};var hs;!function(e){e.PodName="podName",e.Status="status",e.Restarts="restarts",e.NodeName="nodeName",e.SpanDropDrate="spanDropDrate",e.Age="age",e.DockerImage="dockerImage"}(hs||(hs={}));const gs=[{key:hs.PodName,label:"Pod Name"},{key:hs.Status,label:"Status"},{key:hs.Restarts,label:"Restarts",textAlign:"right"},{key:hs.NodeName,label:"Node Name"},{key:hs.Age,label:"Age",textAlign:"right"},{key:hs.DockerImage,label:"Docker Image",textAlign:"right"}],fs=({isLoading:a,tableRowsMaxHeight:n,pods:o,getExtendedPodInfo:r})=>{const i=m(),{formatTimeAgo:s}=ia(),[d,u]=l(null),p=c(()=>o.map(a=>({onClick:()=>u(a),cells:[{key:hs.PodName,rawValue:a.name},{key:hs.Status,rawValue:a.status,component:()=>{return e=a.status,t(ie,{status:xa(e),label:e});var e}},{key:hs.Restarts,rawValue:a.restartsCount.toString()},{key:hs.NodeName,rawValue:a.nodeName},{key:hs.SpanDropDrate,rawValue:0,component:()=>{const{collectorMetrics:n}=a;if(!n)return t(v,{children:"-"});const o=(n?.metricsAcceptedRps??0)+(n?.metricsDroppedRps??0),l=o>0?Math.round((n?.metricsDroppedRps??0)/o*100):0,r=l>0?Q.Error:Q.Success,i=(n?.exporterSuccessRps??0)+(n?.exporterFailedRps??0),s=i>0?Math.round((n?.exporterFailedRps??0)/i*100):0,c=s>0?Q.Error:Q.Success;return e(g,{$gap:4,children:[t(ee,{text:`Accepted: ${n.metricsAcceptedRps.toLocaleString()}, Dropped: ${n.metricsDroppedRps.toLocaleString()}`,children:t(ie,{status:r,label:`Receiver ${l}%`,leftIcon:r===Q.Error?An:In,useSecondaryTone:!0,invertColors:!0})}),t(ee,{text:`Success: ${n.exporterSuccessRps.toLocaleString()}, Failed: ${n.exporterFailedRps.toLocaleString()}`,children:t(ie,{status:c,label:`Exporter ${s}%`,leftIcon:c===Q.Error?An:In,useSecondaryTone:!0,invertColors:!0})})]})}},{key:hs.Age,rawValue:s(a.creationTimestamp)},{key:hs.DockerImage,rawValue:a.image}]})),[o,i]);return e(be,{richTitle:{icon:Nn,title:"Pods"},children:[t(Ca,{variant:ka.Data,maxHeight:n,isLoading:a,columns:gs,rows:p}),t(ms,{pod:d,getExtendedPodInfo:r,onClose:()=>u(null)})]})};var vs;!function(e){e.Gateway="gateway",e.Node="node"}(vs||(vs={}));const bs=[{value:vs.Gateway,label:"Gateway"},{value:vs.Node,label:"Node Collector"}],ys=p.div`
507
330
  display: flex;
508
331
  align-items: center;
509
332
  justify-content: space-between;
510
- `,Xi=({selectedTab:a,setSelectedTab:o,onClickDownloadDiagnose:n,onClickRefresh:l,loading:i,disabled:s})=>{const c=Jt(()=>{const e=[];return n&&e.push({id:Be(),type:je.Button,buttonProps:{label:"Download Diagnose",leftIcon:Pt,size:x.S,variant:T.Text,onClick:n,disabled:s}}),l&&e.push({id:Be(),type:je.Button,buttonProps:{label:"Refresh",leftIcon:Mt,size:x.S,variant:T.Text,onClick:l,disabled:s,loading:i}}),e},[n,l,s,i]);return e(zi,{children:[e(r,{$gap:12,$alignItems:"center",children:[t(tt,{icon:Bt,title:"Pipeline Collectors"}),t($,{options:Li,selected:a,setSelected:o,disabled:s})]}),t(at,{actions:c})]})},Vi=({isOpen:e,onClose:a,title:o,yaml:n})=>t(Pe,{isOpen:e,header:{icon:Ut,title:o,onClose:a},children:t(ia,{yaml:n,defaultOpen:!0})});var _i;!function(e){e.ManifestYaml="manifest-yaml",e.ConfigMapYaml="configmap-yaml"}(_i||(_i={}));const Bi=({richTitle:a,statusCard:o,textCards:n,manifestYaml:l,configMapYaml:i})=>{const[s,c]=Gt(null);return e(ze,{richTitle:a,actions:[{id:Be(),type:je.ButtonDropData,buttonProps:{variant:T.Secondary,size:x.S,label:"View YAML",onClick:e=>c(e)},dropDataProps:{items:[{id:_i.ManifestYaml,label:a.title,icon:jt},{id:_i.ConfigMapYaml,label:"ConfigMap",icon:jt}]}}],children:[e(r,{$gap:16,children:[t(ot,{...o}),n.map(e=>t(nt,{...e},e.title))]}),t(Vi,{isOpen:s===_i.ManifestYaml,onClose:()=>c(null),title:a.title,yaml:l}),t(Vi,{isOpen:s===_i.ConfigMapYaml,onClose:()=>c(null),title:"ConfigMap",yaml:i})]})},Ui=e=>{switch(e){case lt.Healthy:return"All desired replicas are updated, available, and ready";case lt.Updating:return"Workload is progressing towards desired state (e.g., updating pods)";case lt.Degraded:return"Progressing but with availability issues (e.g., not enough available replicas)";case lt.Failed:return"Progress deadline exceeded or an unrecoverable error occurred";case lt.Down:return"No available replicas";case lt.Unknown:return"Status cannot be determined from current signals";default:return"Status unknown"}},ji=({minSupportedVersion:a=0,tableRowsMaxHeight:o,getGatewayInfo:n,getGatewayPods:l,getNodeCollectorInfo:r,getNodeCollectorPods:i,getExtendedPodInfo:s})=>{const{formatTimeAgo:c}=Fe(),{isVersionSupported:d,version:u}=te(a),[p,h]=Gt(!1),[m,g]=Gt(Fi.Gateway),[f,v]=Gt(null),[y,b]=Gt([]),[S,C]=Gt(null),[k,w]=Gt([]),x=Wt(async()=>{h(!0);try{switch(m){case Fi.Gateway:v(await n()??null),b(await l()??[]);break;case Fi.Node:C(await r()??null),w(await i()??[])}}catch(e){}h(!1)},[m]);Ht(()=>{x()},[x]);const T=Jt(()=>(e=>{switch(e){case Fi.Gateway:return"Deployment";case Fi.Node:return"DaemonSet";default:return"Pipeline Collectors"}})(m),[m]),N=Jt(()=>((e,t,a,o)=>{const n={status:ke.Disabled,label:"No rollouts yet"};let l=!1,r=null;switch(e){case Fi.Gateway:l=t?.rolloutInProgress??!1,r=t?.lastRolloutAt??null;break;case Fi.Node:l=a?.rolloutInProgress??!1,r=a?.lastRolloutAt??null;break;default:return n}return l?{status:U.Info,label:"Rollout in progress",rightIcon:Mt,useSecondaryTone:!0}:r?{status:ke.Disabled,label:`Last Rollout: ${o(r)}`}:n})(m,f,S,c),[f,S,m,c]),D=Jt(()=>((e,t,a,o)=>{let n=o?U.Info:ke.Unknown,l=o?"Loading":lt.Unknown,r=o?"Fetching data...":Ui(lt.Unknown);switch(e){case Fi.Gateway:n=t?.status?Je(t?.status):n,l=t?.status??l,r=t?.status?Ui(t.status):r;break;case Fi.Node:n=a?.status?Je(a?.status):n,l=a?.status??l,r=a?.status?Ui(a.status):r}return{status:n,title:l,description:r}})(m,f,S,p),[f,S,m,p]),A=Jt(()=>((e,t,a,o)=>{switch(e){case Fi.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 Fi.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[]}})(m,f,S,p),[f,S,m,p]),I=Jt(()=>(m===Fi.Gateway?f?.manifestYAML:S?.manifestYAML)??"",[f,S,m]),E=Jt(()=>(m===Fi.Gateway?f?.configMapYAML:S?.configMapYAML)??"",[f,S,m]),R=Jt(()=>m===Fi.Gateway?y:k,[y,k,m]);return e(Ke,{children:[t(Xi,{disabled:!d,loading:p,selectedTab:m,setSelectedTab:g,onClickDownloadDiagnose:void 0,onClickRefresh:x}),e(rt,{children:[t(Bi,{richTitle:{icon:Ut,title:T,badge:N},statusCard:D,textCards:A,manifestYaml:I,configMapYaml:E}),t(Mi,{isLoading:p,tableRowsMaxHeight:o,pods:R,getExtendedPodInfo:s}),!d&&t(ra,{minSupportedVersion:a,currentVersion:u||""})]})]})},Hi=o(r)`
511
- align-items: center;
512
- gap: 12px;
513
- padding: 12px 16px;
514
- `,Ki=[{value:"all",label:"All"},{value:"Relevance",label:"Relevance"},{value:"Duration",label:"Duration"},{value:"Error",label:"Error"}],Gi=({title:a,titleTooltip:o,itemCount:l,searchValue:i,onSearchChange:d,typeFilter:u,onTypeFilterChange:p,showTypeFilter:h})=>{const m=n();return e(Hi,{children:[e(r,{$gap:8,$alignItems:"center",children:[t(s,{size:c.XS,weight:500,nowrap:!0,children:a}),o&&t(H,{text:o,withIcon:!0}),t(Q,{label:l,backgroundColor:m.v2.colors.grey[600],textColor:m.v2.colors.white[500]})]}),t(it,{value:i,onChange:d,placeholder:"Search...",width:"360px"}),h&&t($,{size:be.S,options:Ki,selected:u,setSelected:p})]})},Wi=o.div`
515
- position: relative;
516
- display: flex;
333
+ `,Ss=({selectedTab:a,setSelectedTab:n,onClickDownloadDiagnose:o,onClickRefresh:l,loading:r,disabled:i})=>{const s=c(()=>{const e=[];return o&&e.push({id:pa(),type:ba.Button,buttonProps:{label:"Download Diagnose",leftIcon:Cn,size:$.S,variant:O.Text,onClick:o,disabled:i}}),l&&e.push({id:pa(),type:ba.Button,buttonProps:{label:"Refresh",leftIcon:wn,size:$.S,variant:O.Text,onClick:l,disabled:i,loading:r}}),e},[o,l,i,r]);return e(ys,{children:[e(g,{$gap:12,$alignItems:"center",children:[t(Ia,{icon:En,title:"Pipeline Collectors"}),t(B,{options:bs,selected:a,setSelected:n,disabled:i})]}),t(Ea,{actions:s})]})},Cs=({isOpen:e,onClose:a,title:n,yaml:o})=>t(Ht,{isOpen:e,header:{icon:Rn,title:n,onClose:a},children:t(_n,{yaml:o,defaultOpen:!0})});var ks;!function(e){e.ManifestYaml="manifest-yaml",e.ConfigMapYaml="configmap-yaml"}(ks||(ks={}));const ws=({richTitle:a,statusCard:n,textCards:o,manifestYaml:r,configMapYaml:i})=>{const[s,c]=l(null);return e(be,{richTitle:a,actions:[{id:pa(),type:ba.ButtonDropData,buttonProps:{variant:O.Secondary,size:$.S,label:"View YAML",onClick:e=>c(e)},dropDataProps:{items:[{id:ks.ManifestYaml,label:a?.title??"",icon:Pn},{id:ks.ConfigMapYaml,label:"ConfigMap",icon:Pn}]}}],children:[e(g,{$gap:16,children:[t(Ra,{...n}),o.map(e=>t(Pa,{...e},e.title))]}),t(Cs,{isOpen:s===ks.ManifestYaml,onClose:()=>c(null),title:a?.title??"",yaml:r}),t(Cs,{isOpen:s===ks.ConfigMapYaml,onClose:()=>c(null),title:"ConfigMap",yaml:i})]})},Ts=e=>{switch(e){case $a.Healthy:return"All desired replicas are updated, available, and ready";case $a.Updating:return"Workload is progressing towards desired state (e.g., updating pods)";case $a.Degraded:return"Progressing but with availability issues (e.g., not enough available replicas)";case $a.Failed:return"Progress deadline exceeded or an unrecoverable error occurred";case $a.Down:return"No available replicas";case $a.Unknown:return"Status cannot be determined from current signals";default:return"Status unknown"}},xs=({minSupportedVersion:a=0,tableRowsMaxHeight:o,getGatewayInfo:i,getGatewayPods:s,getNodeCollectorInfo:d,getNodeCollectorPods:u,getExtendedPodInfo:p})=>{const{formatTimeAgo:m}=ia(),{isVersionSupported:h,version:g}=de(a),[f,v]=l(!1),[b,y]=l(vs.Gateway),[S,C]=l(null),[k,w]=l([]),[T,x]=l(null),[D,N]=l([]),A=r(async()=>{v(!0);try{switch(b){case vs.Gateway:C(await i()??null),w(await s()??[]);break;case vs.Node:x(await d()??null),N(await u()??[])}}catch(e){}v(!1)},[b]);n(()=>{A()},[A]);const I=c(()=>(e=>{switch(e){case vs.Gateway:return"Deployment";case vs.Node:return"DaemonSet";default:return"Pipeline Collectors"}})(b),[b]),E=c(()=>((e,t,a,n)=>{const o={status:Xt.Disabled,label:"No rollouts yet"};let l=!1,r=null;switch(e){case vs.Gateway:l=t?.rolloutInProgress??!1,r=t?.lastRolloutAt??null;break;case vs.Node:l=a?.rolloutInProgress??!1,r=a?.lastRolloutAt??null;break;default:return o}return l?{status:Q.Info,label:"Rollout in progress",rightIcon:wn,useSecondaryTone:!0}:r?{status:Xt.Disabled,label:`Last Rollout: ${n(r)}`}:o})(b,S,T,m),[S,T,b,m]),R=c(()=>((e,t,a,n)=>{let o=n?Q.Info:Xt.Unknown,l=n?"Loading":$a.Unknown,r=n?"Fetching data...":Ts($a.Unknown);switch(e){case vs.Gateway:o=t?.status?xa(t?.status):o,l=t?.status??l,r=t?.status?Ts(t.status):r;break;case vs.Node:o=a?.status?xa(a?.status):o,l=a?.status??l,r=a?.status?Ts(a.status):r}return{status:o,title:l,description:r}})(b,S,T,f),[S,T,b,f]),P=c(()=>((e,t,a,n)=>{switch(e){case vs.Gateway:return[{title:"HPA Spec (Replicas)",cells:[{label:"Min.",value:t?.hpa?.min.toString()??"-",isLoading:n},{label:"Max.",value:t?.hpa?.max.toString()??"-",isLoading:n},{label:"Current",value:t?.hpa?.current.toString()??"-",isLoading:n},{label:"Desired",value:t?.hpa?.desired.toString()??"-",isLoading:n}]},{title:"Requests",cells:[{label:"CPU",value:t?.resources?.requests.cpu??"-",isLoading:n},{label:"Memory",value:t?.resources?.requests.memory??"-",isLoading:n}]},{title:"Limits",cells:[{label:"CPU",value:t?.resources?.limits.cpu??"-",isLoading:n},{label:"Memory",value:t?.resources?.limits.memory??"-",isLoading:n}]},{title:"Docker Image",cells:[{value:t?.imageVersion??"-",isLoading:n}]}];case vs.Node:return[{title:"Nodes",cells:[{label:"Desired",value:a?.nodes?.desired.toString()??"-",isLoading:n},{label:"Ready",value:a?.nodes?.ready.toString()??"-",isLoading:n}]},{title:"Requests",cells:[{label:"CPU",value:a?.resources?.requests.cpu??"-",isLoading:n},{label:"Memory",value:a?.resources?.requests.memory??"-",isLoading:n}]},{title:"Limits",cells:[{label:"CPU",value:a?.resources?.limits.cpu??"-",isLoading:n},{label:"Memory",value:a?.resources?.limits.memory??"-",isLoading:n}]},{title:"Docker Image",cells:[{value:a?.imageVersion??"-",isLoading:n}]}];default:return[]}})(b,S,T,f),[S,T,b,f]),$=c(()=>(b===vs.Gateway?S?.manifestYAML:T?.manifestYAML)??"",[S,T,b]),O=c(()=>(b===vs.Gateway?S?.configMapYAML:T?.configMapYAML)??"",[S,T,b]),M=c(()=>b===vs.Gateway?k:D,[k,D,b]);return e(Sa,{children:[t(Ss,{disabled:!h,loading:f,selectedTab:b,setSelectedTab:y,onClickDownloadDiagnose:void 0,onClickRefresh:A}),e(Oa,{children:[t(ws,{richTitle:{icon:Rn,title:I,badge:E},statusCard:R,textCards:P,manifestYaml:$,configMapYaml:O}),t(fs,{isLoading:f,tableRowsMaxHeight:o,pods:M,getExtendedPodInfo:p}),!h&&t(Bn,{minSupportedVersion:a,currentVersion:g||""})]})]})},Ds=p.div`
334
+ display: inline-flex;
517
335
  align-items: center;
518
- gap: 12px;
519
- padding: 12px 16px;
520
- border-radius: 12px;
521
- background-color: ${({theme:e,$isHovered:t})=>t?e.v2.colors.silver[700]:e.v2.colors.silver[900]};
522
- cursor: pointer;
523
- transition: background-color 0.15s;
524
- `,qi=o.div`
525
- display: flex;
526
- flex-direction: column;
527
- gap: 4px;
336
+ padding: 4px 8px;
337
+ border-radius: 4px;
338
+ background-color: ${({theme:e})=>e.v2.colors.silver[800]};
528
339
  min-width: 0;
529
- flex: 1;
530
- `,Yi=o(s)`
531
340
  overflow: hidden;
341
+ white-space: pre;
532
342
  text-overflow: ellipsis;
533
- `,Ji=o.div`
534
- min-width: 0;
343
+ `,Ns=p.div`
535
344
  display: inline-flex;
536
345
  align-items: center;
537
-
538
- border-radius: 4px;
346
+ gap: 24px;
347
+ min-width: 0;
348
+ flex: 1;
539
349
  opacity: ${({$disabled:e})=>e?.4:1};
540
- transition: background-color 0.15s;
541
350
  overflow: hidden;
542
351
  white-space: pre;
543
352
  text-overflow: ellipsis;
544
- `,Qi=o(r)`
353
+ `,As=p(g)`
545
354
  flex-shrink: 0;
546
- margin-left: auto;
547
355
  gap: 6px;
548
356
  align-items: center;
549
357
  min-height: 22px;
550
- `;const Zi=({item:a,isHovered:o,onClick:l,onEdit:r,onDelete:i,onMouseEnter:s,onMouseLeave:d})=>{const u=n(),p=Wt(()=>{r(a.ruleId,a.samplingId)},[a.ruleId,a.samplingId,r]),h=Wt(()=>{i(a.ruleId,a.samplingId)},[a.ruleId,a.samplingId,i]),m=Jt(()=>{const e=e=>t(gt,{...e,fill:u.v2.colors.red[500]});return e.displayName="RedDeleteIcon",e},[u]),g=[{id:"edit",label:en,leftIcon:ft,onClick:p},{id:"delete",label:"",leftIcon:m,onClick:h}],f=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]}}}(u,a.typeBadge):void 0;return e(Wi,{$isHovered:o,onClick:()=>l(a),onMouseEnter:s,onMouseLeave:d,children:[e(qi,{children:[t(Ji,{$disabled:a.disabled,$isHovered:o,children:t(xo,{parts:a.summary})}),a.name&&t(Yi,{size:c.XXXS,color:u.v2.colors.grey[400],nowrap:!0,children:a.name})]}),e(Qi,{children:[a.disabled&&t(Q,{label:"Disabled rule",textSize:c.XXXS,backgroundColor:u.v2.colors.grey[700],textColor:u.v2.colors.grey[300]}),a.typeBadge&&f&&t(Q,{label:a.typeBadge,textSize:c.XXXS,backgroundColor:f.bg,textColor:f.text})]}),t(st,{isOpen:o,actions:g})]})},es=o(l)`
551
- flex: 1;
552
- min-height: 0;
553
- background-color: ${({theme:e})=>e.v2.colors.silver[1e3]};
554
- border-radius: 16px;
555
- `,ts=o(l)`
556
- flex: 1;
557
- min-height: 0;
558
- padding: 0 16px 16px;
559
- gap: 4px;
560
- overflow-y: auto;
561
- `,as=o.div`
358
+ `;const Is=[{key:"name",label:"Name",noSort:!0,noFilter:!0,flex:"0 0 156px",withTooltip:!0},{key:"summary",label:"Summary",noSort:!0,noFilter:!0},{key:"badges",label:"Type",noSort:!0,noFilter:!0,flex:"0 0 128px"}],Es=[{value:"all",label:Fa},{value:"Relevance",label:"Relevance"},{value:"Duration",label:"Duration"},{value:"Error",label:"Error"}],Rs=({title:a,items:n,isLoading:o,showTypeFilter:i,tableRowsMaxHeight:s,onRuleClick:d,onEditRule:u,onDeleteRule:p})=>{const h=m(),[g,f]=l(""),[y,S]=l("all"),C=c(()=>{let e=function(e,t,a){return a&&"all"!==t?e.filter(e=>e.typeBadge===t):e}(n,y,i);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),n=e.summary.map(e=>e.text).join("").toLowerCase();return t||n.includes(a)})}(e,g),e},[n,y,i,g]),k=c(()=>C.map(a=>{const n=a.typeBadge?function(e,t){const a=e.v2.colors;switch(t){case"Relevance":return{bg:a.blue[700],text:a.white[500]};case"Duration":return{bg:a.purple[700],text:a.white[500]};case"Error":return{bg:a.red[500],text:a.black[500]}}}(h,a.typeBadge):void 0;return{cells:[{key:"name",rawValue:a.name||"",component:()=>t(Ns,{$disabled:a.disabled,children:a.name&&t(v,{size:b.XXS,color:h.v2.colors.white[500],nowrap:!0,children:a.name})})},{key:"summary",rawValue:a.summary.map(e=>e.text).join(""),component:()=>t(Ns,{$disabled:a.disabled,children:t(Ds,{children:t(Fn,{parts:a.summary})})})},{key:"badges",rawValue:a.typeBadge||"",component:()=>e(As,{children:[a.disabled&&t(ie,{label:Ma,textSize:b.XXXS,backgroundColor:h.v2.colors.grey[700],textColor:h.v2.colors.grey[300]}),a.typeBadge&&n&&t(ie,{label:a.typeBadge,textSize:b.XXXS,backgroundColor:n.bg,textColor:n.text})]})}],onClick:()=>d(a)}}),[C,h,d]),w=c(()=>{const e=e=>t(an,{...e,fill:h.v2.colors.red[500]});return e.displayName="RedDeleteIcon",e},[h]),T=r(e=>{const t=k.indexOf(e);if(t<0)return[];const a=C[t];return a?[{id:"edit","data-id":"sampling-rule-action-edit",label:ha,leftIcon:nn,onClick:()=>u(a.ruleId,a.samplingId)},{id:"delete","data-id":"sampling-rule-action-delete",label:"",leftIcon:w,onClick:()=>p(a.ruleId,a.samplingId)}]:[]},[k,C,u,p,w]);return t(be,{fullHeight:!0,richTitle:{icon:gn,title:a,badge:{label:n.length,backgroundColor:h.v2.colors.silver[600],textColor:h.v2.colors.white[500]}},search:{"data-id":"sampling-search-rules",value:g,onChange:f,placeholder:"Search..",width:"500px",...i?{segment:{"data-id":"sampling-segment-type-filter",options:Es,selected:y,setSelected:S}}:{}},children:t(Ca,{variant:ka.Pretty,hideHeader:!0,maxHeight:s,isLoading:o,columns:Is,rows:k,getRowActions:T})})},Ps=p.div`
562
359
  display: flex;
360
+ flex-direction: column;
361
+ gap: 8px;
362
+ padding: 16px;
363
+ border-radius: 12px;
364
+ background-color: ${({theme:e})=>e.v2.colors.silver[900]};
365
+ `,$s=p(g)`
563
366
  align-items: center;
564
- justify-content: center;
565
- padding: 48px 16px;
566
- `;const os=({title:a,titleTooltip:o,items:n,isLoading:l,showTypeFilter:r=!1,onRuleClick:i,onEditRule:s,onDeleteRule:c})=>{const[d,u]=Gt(""),[p,h]=Gt(null),[m,g]=Gt("all"),f=d.trim()||r&&"all"!==m,v=Jt(()=>{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]),y=Wt(e=>{h(e)},[]),b=Wt(()=>{h(null)},[]);return e(es,{children:[t(Gi,{title:a,titleTooltip:o,itemCount:n.length,searchValue:d,onSearchChange:u,typeFilter:m,onTypeFilterChange:g,showTypeFilter:r}),l?t(as,{children:t(ge,{title:"Loading rules...",withSpinner:!0})}):0===v.length?t(as,{children:t(E,{title:f?"No matching rules":"No rules yet",subTitle:f?"Try adjusting your filters or search":"Create a rule to get started"})}):t(ts,{children:v.map((e,a)=>t(Zi,{item:e,isHovered:p===a,onClick:i,onEdit:s,onDelete:c,onMouseEnter:()=>y(a),onMouseLeave:b},e.ruleId))})]})},ns=e=>"general"===e.name?0:"advanced"===e.name?2:1,ls=e=>{const t=[N.Toggle,N.Checkbox].includes(e.componentType);return e.isHelmOnly?t?2:3:t?0:1},rs=({minSupportedVersion:a=0,pageHeightOffset:o=0,configYamls:n,configYamlsLoading:i,effectiveConfig:s,effectiveConfigLoading:c,onSave:d,saveLoading:u})=>{const{isVersionSupported:p,version:h}=te(a),m=Jt(()=>{if(!s)return{};const{manifestYAML:e,provenance:t,...a}=s;return a},[s]),{formData:g,handleFormChange:f,getNestedValue:v,getFormDiff:y,isFormDirty:b}=A(m);Ht(()=>{"{}"!==JSON.stringify(m)&&"{}"===JSON.stringify(g)&&f(void 0,void 0,m)},[m,g]);const S=Jt(()=>[...n].sort((e,t)=>ns(e)-ns(t)).map(e=>({...e,fields:[...e.fields].sort((e,t)=>ls(e)-ls(t))})),[n]),C=Jt(()=>(e=>{if(!e)return{};const t={};for(const a of e)t[a.helmPath]=a.reconciledFrom;return t})(s?.provenance),[s?.provenance]),k=Jt(()=>[{id:Be(),type:je.Button,buttonProps:{"data-id":"settings-save",variant:T.Primary,size:x.S,label:"Save Changes",leftIcon:wt,loading:u,onClick:()=>d?.(y(m,g))?.then(()=>f(void 0,void 0,{}))}},{id:Be(),type:je.Button,buttonProps:{"data-id":"settings-cancel",variant:T.Secondary,size:x.S,label:"Cancel",leftIcon:xt,onClick:()=>f(void 0,void 0,m)}}],[u,d,y,m,g,f]);return t(Ke,{$heightOffset:o,children:e(rt,{children:[!p&&t(ra,{minSupportedVersion:a,currentVersion:h||""}),t(qe,{isOpen:b,richTitle:{icon:At,title:"Config Settings"},actions:k}),e(r,{$gap:24,$alignItems:"flex-start",children:[t(l,{$gap:24,$width:"100%",children:n.length?S.map(e=>t(ze,{richTitle:{icon:At,title:e.displayName},children:e.fields.map(e=>{const a=V(e.componentProps||"{}",{}),o=C[e.helmValuePath]||"N/A";return t(ta,{componentType:e.componentType,inputType:a.type,name:e.helmValuePath,label:e.displayName,tooltip:e.description,badge:{status:ke.Unknown,label:o,tooltip:`This field is reconciled from the following resource: ${o}`},disabled:e.isHelmOnly||u,value:v("formData",e.helmValuePath),setValue:t=>f(e.helmValuePath,t),warnMessage:e.isHelmOnly?"This field can only be updated via Helm values.yaml file":"",dropdownOptions:a.options?.map(e=>({id:e,value:e}))},e.helmValuePath)})},e.name)):i?t(ue,{$height:"30vh",children:t(ge,{withSpinner:!0})}):t(ze,{richTitle:{icon:At,title:"Config Settings"},children:t(E,{title:"YAML not found",subTitle:"The YAML for this resource is not available"})})}),c&&!s?.manifestYAML?t(ue,{$height:"30vh",children:t(ge,{withSpinner:!0})}):t(ia,{title:"Effective Config YAML",yaml:s?.manifestYAML?.replaceAll(" |",""),defaultOpen:!0,fullHeight:!0})]})]})})};export{Qa as AddActionDrawer,Da as AddActionForm,Ta as AddActionFormContextProvider,co as AddDestinationDrawer,Ma as AddDestinationForm,$a as AddDestinationFormContextProvider,uo as AddRuleDrawer,Ga as AddRuleForm,Ha as AddRuleFormContextProvider,Co as AddSourceDrawer,qa as AddSourceFormContextProvider,ci as AutoRuleCard,Io as CATEGORY_TO_RULE_CATEGORY,gi as CentralConnections,Rl as CreateSamplingRuleDrawer,ql as EditAutoRuleDrawer,hr as EditConfigDrawer,pr as EditCostReductionAutoRuleDrawer,tr as EditHighlyRelevantAutoRuleDrawer,Ii as Onboarding,ji as PipelineCollectors,Ao as SAMPLING_CATEGORY_LIST_TITLES,Do as SAMPLING_CATEGORY_NOTES,No as SAMPLING_SEGMENT_OPTIONS,To as SamplingCategory,os as SamplingRulesList,rs as Settings,kr as SystemDrawer,li as ViewSamplingRuleDrawer,$l as buildAutoRuleSummary,zl as buildCostReductionAutoRuleSummary,Mo as buildCostReductionSummary,Ml as buildHighlyRelevantAutoRuleSummary,Oo as buildHighlyRelevantSummary,Po as buildNoisySummary,Lo as buildSamplingRuleItems,zo as buildSummaryForRule,Ll as findCostReductionAutoRule,Ko as findDuplicateRuleId,Ol as findHighlyRelevantAutoRule,Dl as formStateToCostReductionInput,Nl as formStateToHighlyRelevantInput,Tl as formStateToNoisyInput,bl as getDefaultFormState,Fo as getHighlyRelevantTypeBadge,_o as lookupViewRuleData,Vo as refreshViewRuleData,Na as useAddActionFormContext,Pa as useAddDestinationFormContext,Ka as useAddRuleFormContext,Ya as useAddSourceFormContext,oi as viewRuleDataToFormState};
367
+ gap: 24px;
368
+ `,Os=p.div`
369
+ flex: 1;
370
+ min-width: 0;
371
+ white-space: pre;
372
+ overflow-x: auto;
373
+ `,Ms=({title:a,summary:n,onEdit:o})=>{const l=m();return e(Ps,{children:[t(v,{size:b.XXS,color:l.v2.colors.silver[200],children:a}),e($s,{children:[t(Os,{children:t(Fn,{parts:n})}),t(P,{"data-id":"sampling-btn-edit-auto-rule",label:La,rightIcon:nn,variant:O.Text,size:$.S,onClick:o})]})]})};function Fs(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 Ls(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 zs(e){if("custom"===e.durationPreset){const t=parseFloat(e.customDurationMs);return isNaN(t)?null:t}return parseInt(e.durationPreset,10)}function Vs(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 Xs(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 Bs(e){return{name:e.name||null,disabled:e.disabled,sourceScopes:Fs(e),operation:Vs(e),percentageAtMost:Ls(e),notes:e.notes||null}}function _s(e){return{name:e.name||null,disabled:e.disabled,sourceScopes:Fs(e),error:"Error"===e.ruleType,durationAtLeastMs:"Duration"===e.ruleType?zs(e):null,operation:Xs(e),percentageAtLeast:Ls(e),notes:e.notes||null}}function Us(e){const t=Ls(e);return{name:e.name||null,disabled:e.disabled,sourceScopes:Fs(e),operation:Xs(e),percentageAtMost:t??0,notes:e.notes||null}}const js=a=>{const{workloads:o,samplingRules:i,k8sHealthProbesConfig:s,loading:u,tableRowsMaxHeight:p,fetchSamplingRules:m,createNoisyOperationRule:f,updateNoisyOperationRule:v,createHighlyRelevantOperationRule:b,updateHighlyRelevantOperationRule:y,createCostReductionRule:S,updateCostReductionRule:C,deleteSamplingRule:k,updateK8sHealthProbesConfig:w}=a,T=c(()=>o.map(({id:e})=>({id:`${e.namespace}/${e.kind}/${e.name}`,label:`${e.namespace} / ${e.kind} / ${e.name}`})),[o]),x=c(()=>Array.from(new Set(o.map(({id:e})=>e.namespace))).sort().map(e=>({id:e,label:e})),[o]),[D,N]=l(Nl.Noisy),[A,I]=l(null),[E,R]=l(!1),[M,F]=l(!1),[L,z]=l(null),[V,X]=l(!1),[_,U]=l(!1),[j,H]=l(!1),W=c(()=>Wl(s),[s]),K=c(()=>function(e){for(const t of e){const e=t.highlyRelevantOperations.find(Kl);if(e)return{rule:e,samplingId:t.id}}return null}(i),[i]),G=c(()=>Gl(K?.rule??null),[K]),q=c(()=>function(e){for(const t of e){const e=t.costReductionRules.find(ql);if(e)return{rule:e,samplingId:t.id}}return null}(i),[i]),Y=c(()=>Yl(q?.rule??null),[q]),Z=d(A);Z.current=A,n(()=>{const e=Z.current;if(!e)return;const t=function(e,t){const a=Xl(e,t.samplingId,t.rule.ruleId,t.category);return a?{...a,summary:Vl(a.category,a.rule)}:null}(i,e);t?I(t):(I(null),R(!1))},[i]);const ee=c(()=>{const e=new Set;return K&&e.add(K.rule.ruleId),q&&e.add(q.rule.ruleId),e},[K,q]),te=c(()=>function(e,t,a){const n=Rl[t],o=[];for(const l of e)switch(t){case Nl.Noisy:for(const e of l.noisyOperations)a?.has(e.ruleId)||o.push({ruleId:e.ruleId,samplingId:l.id,name:e.name??null,disabled:e.disabled,notes:e.notes??null,summary:Ml(e),category:n});break;case Nl.HighlyRelevant:for(const e of l.highlyRelevantOperations)a?.has(e.ruleId)||o.push({ruleId:e.ruleId,samplingId:l.id,name:e.name??null,disabled:e.disabled,notes:e.notes??null,summary:Fl(e),category:n,typeBadge:zl(e)});break;case Nl.CostReduction:for(const e of l.costReductionRules)a?.has(e.ruleId)||o.push({ruleId:e.ruleId,samplingId:l.id,name:e.name??null,disabled:e.disabled,notes:e.notes??null,summary:Ll(e),category:n})}return o}(i,D,ee),[i,D,ee]),ae=r(()=>F(!0),[]),ne=r(()=>F(!1),[]),oe=r(e=>{const t=i[0]?.id??"default";switch(Rl[D]){case"noisy":f(t,Bs(e));break;case"highlyRelevant":b(t,_s(e));break;case"costReduction":S(t,Us(e))}F(!1)},[i,D,f,b,S]),le=r(e=>{const t=function(e,t){const a=Xl(e,t.samplingId,t.ruleId,t.category);return a?{...a,summary:t.summary}:null}(i,e);t&&(R(!1),I(t))},[i]),re=r(()=>{I(null),R(!1)},[]),ie=r((e,t)=>{const a=A;if(a&&a.rule.ruleId===e&&a.samplingId===t)R(!0),I({...a});else for(const a of i){if(a.id!==t)continue;const n=[...a.noisyOperations.map(e=>({category:"noisy",rule:e})),...a.highlyRelevantOperations.map(e=>({category:"highlyRelevant",rule:e})),...a.costReductionRules.map(e=>({category:"costReduction",rule:e}))].find(t=>t.rule.ruleId===e);if(n)return R(!0),void I({category:n.category,rule:n.rule,samplingId:t,summary:Vl(n.category,n.rule)})}},[A,i]),se=r((e,t,a)=>{const n=A?.category;if(n){switch(n){case"noisy":v(a,t,Bs(e));break;case"highlyRelevant":y(a,t,_s(e));break;case"costReduction":C(a,t,Us(e))}R(!1)}},[A,v,y,C]),ce=r((e,t)=>{z({ruleId:e,samplingId:t})},[]),de=r(()=>{if(!L)return;const{ruleId:e,samplingId:t}=L;k(t,e,A?.category||Rl[D]),I(null),R(!1),z(null)},[L,A,D,k]),ue=r(()=>z(null),[]),pe=r((e,t)=>{w(e,t),X(!1)},[w]),me=r(e=>{const t=i[0]?.id??"default",a=K;a?y(a.samplingId,a.rule.ruleId,{name:a.rule.name,disabled:!e,error:!0,sourceScopes:[],operation:null,percentageAtLeast:null,notes:a.rule.notes}):e&&b(t,{name:"Auto - Keep All Error Traces",disabled:!1,error:!0,sourceScopes:[],operation:null,percentageAtLeast:null}),U(!1)},[i,K,b,y]),he=r((e,t)=>{const a=i[0]?.id??"default",n=q;n?C(n.samplingId,n.rule.ruleId,{name:n.rule.name,disabled:!e,sourceScopes:[],operation:null,percentageAtMost:t,notes:n.rule.notes}):e&&S(a,{name:"Auto - Drop Traces Cluster-Wide",disabled:!1,sourceScopes:[],operation:null,percentageAtMost:t}),H(!1)},[i,q,S,C]),ge=r(e=>{const t=Rl[D];let a=null;switch(t){case"noisy":{const n=Bs(e);a=Hl(i,t,{sourceScopes:n.sourceScopes,operation:n.operation});break}case"highlyRelevant":{const n=_s(e);a=Hl(i,t,{sourceScopes:n.sourceScopes,operation:n.operation,error:n.error??!1,durationAtLeastMs:n.durationAtLeastMs});break}case"costReduction":{const n=Us(e);a=Hl(i,t,{sourceScopes:n.sourceScopes,operation:n.operation});break}}return a?{message:za,ruleId:a}:null},[i,D]),fe=r(e=>{const t=A?.category,a=A?.rule.ruleId;if(!t)return null;let n=null;switch(t){case"noisy":{const o=Bs(e);n=Hl(i,t,{sourceScopes:o.sourceScopes,operation:o.operation},a);break}case"highlyRelevant":{const o=_s(e);n=Hl(i,t,{sourceScopes:o.sourceScopes,operation:o.operation,error:o.error??!1,durationAtLeastMs:o.durationAtLeastMs},a);break}case"costReduction":{const o=Us(e);n=Hl(i,t,{sourceScopes:o.sourceScopes,operation:o.operation},a);break}}return n?{message:za,ruleId:n}:null},[i,A]),ve=r(e=>{F(!1);for(const t of i){const a=[...t.noisyOperations.map(e=>({category:"noisy",rule:e})),...t.highlyRelevantOperations.map(e=>({category:"highlyRelevant",rule:e})),...t.costReductionRules.map(e=>({category:"costReduction",rule:e}))].find(t=>t.rule.ruleId===e);if(a)return R(!0),void I({category:a.category,rule:a.rule,samplingId:t.id,summary:Vl(a.category,a.rule)})}},[i]),be=c(()=>{const e=[];return a.docsUrl&&e.push({id:pa(),type:ba.Button,buttonProps:{"data-id":"sampling-btn-docs",label:Va,leftIcon:Za,size:$.S,variant:O.Text,onClick:()=>window.open(a.docsUrl,"_blank")}}),e.push({id:pa(),type:ba.Button,buttonProps:{"data-id":"sampling-btn-refresh",label:Xa,leftIcon:wn,size:$.S,variant:O.Text,onClick:m,loading:u}}),e.push({id:pa(),type:ba.Button,buttonProps:{"data-id":"sampling-btn-create-rule",label:Ba,rightIcon:Qa,size:$.S,variant:O.Primary,onClick:ae}}),e},[a.docsUrl,m,u,ae]);return e(Sa,{children:[e(g,{$gap:12,$justifyContent:"space-between",children:[t(Ia,{icon:gn,title:Ua,subTitle:_a}),t(Ea,{actions:be})]}),e(h,{$gap:12,children:[t(B,{variant:ja.Underline,options:Al,selected:D,setSelected:N}),e(g,{$justifyContent:"space-between",children:[t(J,{status:Q.Default,message:Il[D]}),a.docsUrl&&t(P,{"data-id":"sampling-btn-docs-banner",label:"Docs",leftIcon:Za,size:$.S,variant:O.Text,onClick:()=>window.open(a.docsUrl,"_blank")})]}),D===Nl.Noisy&&t(Ms,{title:Ct,summary:W,onEdit:()=>X(!0)}),D===Nl.HighlyRelevant&&t(Ms,{title:Tt,summary:G,onEdit:()=>U(!0)}),D===Nl.CostReduction&&t(Ms,{title:xt,summary:Y,onEdit:()=>H(!0)}),t(Rs,{title:El[D],items:te,isLoading:u,showTypeFilter:D===Nl.HighlyRelevant,tableRowsMaxHeight:p,onRuleClick:le,onEditRule:ie,onDeleteRule:ce})]}),t(ji,{data:A,defaultEditMode:E,onClose:re,onDelete:ce,onSaveEdit:se,sourceOptions:T,namespaceOptions:x,validateForm:fe,onNavigateToDuplicate:ve}),t(ki,{isOpen:M,category:Rl[D],onClose:ne,onSubmit:oe,sourceOptions:T,namespaceOptions:x,validateForm:ge,onNavigateToDuplicate:ve}),t(Ti,{isOpen:V,enabled:s?.enabled??!1,keepPercentage:s?.keepPercentage??0,onClose:()=>X(!1),onSave:pe}),t(Di,{isOpen:_,enabled:!!K&&!K.rule.disabled,onClose:()=>U(!1),onSave:me}),t(Ai,{isOpen:j,enabled:!!q&&!q.rule.disabled,dropPercentage:q?.rule.percentageAtMost??25,onClose:()=>H(!1),onSave:he}),t(Ha,{title:qa,description:Ga,isOpen:!!L,onClose:ue,onApprove:de,approveLabel:Ka,denyLabel:Wa})]})},Hs=e=>"general"===e.name?0:"advanced"===e.name?2:1,Ws=e=>{const t=[M.Toggle,M.Checkbox].includes(e.componentType);return e.isHelmOnly?t?2:3:t?0:1},Ks=({minSupportedVersion:a=0,pageHeightOffset:o=0,configYamls:l,configYamlsLoading:r,effectiveConfig:i,effectiveConfigLoading:s,onSave:d,saveLoading:u})=>{const{isVersionSupported:p,version:m}=de(a),f=c(()=>{if(!i)return{};const{manifestYAML:e,provenance:t,...a}=i;return a},[i]),{formData:v,handleFormChange:b,getNestedValue:y,getFormDiff:S,isFormDirty:C}=L(f);n(()=>{"{}"!==JSON.stringify(f)&&"{}"===JSON.stringify(v)&&b(void 0,void 0,f)},[f,v]);const k=c(()=>[...l].sort((e,t)=>Hs(e)-Hs(t)).map(e=>({...e,fields:[...e.fields].sort((e,t)=>Ws(e)-Ws(t))})),[l]),w=c(()=>(e=>{if(!e)return{};const t={};for(const a of e)t[a.helmPath]=a.reconciledFrom;return t})(i?.provenance),[i?.provenance]),T=c(()=>[{id:pa(),type:ba.Button,buttonProps:{"data-id":"settings-save",variant:O.Primary,size:$.S,label:"Save Changes",leftIcon:pn,loading:u,onClick:()=>d?.(S(f,v))?.then(()=>b(void 0,void 0,{}))}},{id:pa(),type:ba.Button,buttonProps:{"data-id":"settings-cancel",variant:O.Secondary,size:$.S,label:"Cancel",leftIcon:rn,onClick:()=>b(void 0,void 0,f)}}],[u,d,S,f,v,b]);return t(Sa,{$heightOffset:o,children:e(Oa,{children:[!p&&t(Bn,{minSupportedVersion:a,currentVersion:m||""}),t(wa,{isOpen:C,richTitle:{icon:fn,title:"Config Settings"},actions:T}),e(g,{$gap:24,$alignItems:"flex-start",children:[t(h,{$gap:24,$width:"100%",children:l.length?k.map(e=>t(be,{richTitle:{icon:fn,title:e.displayName},children:e.fields.map(e=>{const a=q(e.componentProps||"{}",{}),n=w[e.helmValuePath]||"N/A";return t(On,{componentType:e.componentType,inputType:a.type,name:e.helmValuePath,label:e.displayName,tooltip:e.description,badge:{status:Xt.Unknown,label:n,tooltip:`This field is reconciled from the following resource: ${n}`},disabled:e.isHelmOnly||u,value:y("formData",e.helmValuePath),setValue:t=>b(e.helmValuePath,t),warnMessage:e.isHelmOnly?"This field can only be updated via Helm values.yaml file":"",dropdownOptions:a.options?.map(e=>({id:e,value:e}))},e.helmValuePath)})},e.name)):r?t(Et,{$height:"30vh",children:t(Ot,{withSpinner:!0})}):t(be,{richTitle:{icon:fn,title:"Config Settings"},children:t(V,{title:"YAML not found",subTitle:"The YAML for this resource is not available"})})}),s&&!i?.manifestYAML?t(Et,{$height:"30vh",children:t(Ot,{withSpinner:!0})}):t(_n,{title:"Effective Config YAML",yaml:i?.manifestYAML?.replaceAll(" |",""),defaultOpen:!0,fullHeight:!0})]})]})})};export{Qr as AddActionDrawer,so as AddActionForm,ro as AddActionFormContextProvider,ci as AddDestinationDrawer,vo as AddDestinationForm,ho as AddDestinationFormContextProvider,di as AddRuleDrawer,Io as AddRuleForm,No as AddRuleFormContextProvider,Si as AddSourceDrawer,Ro as AddSourceFormContextProvider,Yi as CentralConnections,ki as CreateSamplingRuleDrawer,tr as CreateSamplingRuleForm,hl as CreateSamplingRuleFormContextProvider,Ti as EditAutoRuleDrawer,Vr as EditAutoRuleForm,Fr as EditAutoRuleFormContextProvider,Ii as EditConfigDrawer,Ai as EditCostReductionAutoRuleDrawer,Yr as EditCostReductionAutoRuleForm,Kr as EditCostReductionAutoRuleFormContextProvider,Di as EditHighlyRelevantAutoRuleDrawer,jr as EditHighlyRelevantAutoRuleForm,Br as EditHighlyRelevantAutoRuleFormContextProvider,ds as Onboarding,xs as PipelineCollectors,js as SamplingRules,Ks as Settings,zi as SystemDrawer,ji as ViewSamplingRuleDrawer,$r as ViewSamplingRuleForm,kr as ViewSamplingRuleFormContextProvider,io as useAddActionFormContext,go as useAddDestinationFormContext,Ao as useAddRuleFormContext,Po as useAddSourceFormContext,gl as useCreateSamplingRuleFormContext,Lr as useEditAutoRuleFormContext,Gr as useEditCostReductionAutoRuleFormContext,_r as useEditHighlyRelevantAutoRuleFormContext,wr as useViewSamplingRuleFormContext};