@odigos/ui-kit 0.0.230 → 0.0.231

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 (34) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/lib/chunks/index-DAOWyONO.js +145 -0
  3. package/lib/chunks/{index-DJZLguZq.js → index-tFZXUKvO.js} +1 -1
  4. package/lib/chunks/{ui-components-B4xHrszQ.js → ui-components-CvK0mvVN.js} +378 -378
  5. package/lib/components/_v2/table/index.d.ts +8 -1
  6. package/lib/components/v2.js +1 -1
  7. package/lib/components.js +1 -1
  8. package/lib/constants/sampling/index.d.ts +7 -0
  9. package/lib/constants.js +1 -1
  10. package/lib/containers/_v2/_drawers/add-destination-drawer/form-column/index.d.ts +1 -1
  11. package/lib/containers/_v2/_drawers/add-destination-drawer/lists-column/index.d.ts +1 -1
  12. package/lib/containers/_v2/_drawers/add-source-drawer/namespaces-column/index.d.ts +1 -1
  13. package/lib/containers/_v2/_drawers/add-source-drawer/workloads-column/index.d.ts +1 -1
  14. package/lib/containers/source-drawer/profiling/flame-graph-canvas.d.ts +12 -0
  15. package/lib/containers/source-drawer/profiling/flamebearer.d.ts +21 -2
  16. package/lib/containers/source-drawer/profiling/index.d.ts +1 -9
  17. package/lib/containers/source-drawer/profiling/symbol-table.d.ts +13 -0
  18. package/lib/containers/v2.js +46 -42
  19. package/lib/containers.js +42 -44
  20. package/lib/contexts/sampling-rules-form-context.d.ts +3 -1
  21. package/lib/contexts.js +1 -1
  22. package/lib/functions.js +1 -1
  23. package/lib/hooks.js +1 -1
  24. package/lib/snippets/_v2/sampling-rule-form-sections/index.d.ts +1 -0
  25. package/lib/snippets/_v2/sampling-rule-form-sections/rule-type.d.ts +8 -0
  26. package/lib/snippets/_v2/sampling-rule-form-sections/sampling-preview.d.ts +3 -1
  27. package/lib/snippets/v2.js +1 -1
  28. package/lib/snippets.js +1 -1
  29. package/lib/store.js +1 -1
  30. package/lib/theme.js +1 -1
  31. package/lib/types.js +1 -1
  32. package/lib/visuals.js +1 -1
  33. package/package.json +1 -1
  34. package/lib/chunks/index-CGrd7Nq0.js +0 -149
@@ -1,15 +1,25 @@
1
- import{jsxs as e,jsx as t,Fragment as a}from"react/jsx-runtime";import{useEffect as n,Fragment as o,forwardRef as l,useState as i,useImperativeHandle as s,useMemo as r,useCallback as c,useRef as d,Children as u}from"react";import p,{useTheme as m}from"styled-components";import{c as h,F as g,d as b,e as f,f as y,I as v,h as C,i as S,j as w,K as k,T,k as N,l as A,m as I,n as D,o as E,B as $,a as R,p as x,q as O,r as P,N as F,s as L,t as M,v as V,S as B,w as z,x as _,y as U,z as j,E as X,G as H,H as W,J as G,L as K,M as Y,O as q,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 ie,$ as se,a0 as re,a1 as ce,a2 as de,a3 as ue,a4 as pe,a5 as me,a6 as he,a7 as ge,a8 as be,a9 as fe,aa as ye,ab as ve,ac as Ce,ad as Se,ae as we,b as ke,af as Te,ag as Ne,ah as Ae,ai as Ie,aj as De,ak as Ee,al as $e,am as Re,an as xe,ao as Oe,ap as Pe,aq as Fe,ar as Le,as as Me,at as Ve,au as Be,av as ze,aw as _e,ax as Ue,ay as je,az as Xe,aA as He,aB as We,aC as Ge,aD as Ke,aE as Ye,aF as qe,aG as Je,aH as Qe,aI as Ze,aJ as et,aK as tt,D as at,aL as nt,aM as ot,aN as lt,aO as it,aP as st,aQ as rt,aR as ct,aS as dt,aT as ut,aU as pt,aV as mt,aW as ht,aX as gt,aY as bt,aZ as ft,a_ as yt,a$ as vt,b0 as Ct,b1 as St,b2 as wt,b3 as kt,b4 as Tt,b5 as Nt,b6 as At,b7 as It,b8 as Dt,b9 as Et,ba as $t,bb as Rt,bc as xt,bd as Ot,be as Pt,bf as Ft,u as Lt,bg as Mt,bh as Vt,bi as Bt,bj as zt,bk as _t,bl as Ut,g as jt,bm as Xt,A as Ht,bn as Wt,bo as Gt,bp as Kt,bq as Yt,br as qt,bs as Jt,bt as Qt,bu as Zt,bv as ea,bw as ta,bx as aa,by as na,bz as oa,bA as la,bB as ia,bC as sa,bD as ra,bE as ca,bF as da,bG as ua,bH as pa,bI as ma,bJ as ha,bK as ga,bL as ba,bM as fa,bN as ya,bO as va,bP as Ca,bQ as Sa,bR as wa,bS as ka,bT as Ta,bU as Na,bV as Aa,bW as Ia,bX as Da,bY as Ea,bZ as $a,b_ as Ra,b$ as xa,c0 as Oa,c1 as Pa,c2 as Fa,c3 as La,c4 as Ma,c5 as Va,c6 as Ba,c7 as za,c8 as _a,c9 as Ua,ca as ja}from"../chunks/ui-components-B4xHrszQ.js";import{TrashIcon as Xa,PlusIcon as Ha,BookIcon as Wa,VSquareIcon as Ga,XSquareIcon as Ka,DeleteIcon as Ya,EditIcon as qa,GoLogo as Ja,JavaLogo as Qa,ChevronRightIcon as Za,ActionIcon as en,DestinationIcon as tn,ChevronUpIcon as an,ChevronDownIcon as nn,VIcon as on,XIcon as ln,InstrumentationRuleIcon as sn,SourceIcon as rn,NamespacesIcon as cn,SettingsIcon as dn,SamplingIcon as un,ExclamationTriangleIcon as pn,ExclamationCircleIcon as mn,KeyIcon as hn,DiagnoseIcon as gn,DownloadIcon as bn,TerminalIcon as fn,RefreshIcon as yn,ConnectionsIcon as vn,OdigosLogo as Cn,ArrowRightIcon as Sn,PipelineCollectorIcon as wn,PodIcon as kn,ArrowDownSquareIcon as Tn,ArrowUpSquareIcon as Nn,GatewayIcon as An,YamlIcon as In}from"../icons.js";import{S as Dn,D as En,A as $n,P as Rn,a as xn,b as On,R as Pn,c as Fn,O as Ln,d as Mn,e as Vn,W as Bn,f as zn,C as _n,g as Un,h as jn,U as Xn}from"../chunks/index-CGrd7Nq0.js";import{Y as Hn}from"../chunks/index-DJZLguZq.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 Wn=[{id:"CREDIT_CARD",label:"Credit card"}],Gn=[{id:h.CollectContainerAttributes,label:"Collect container attributes"},{id:h.CollectReplicaSetAttributes,label:"Collect ReplicaSet attributes"},{id:h.CollectWorkloadId,label:"Collect workload ID"},{id:h.CollectClusterId,label:"Collect cluster ID"}],Kn=[{id:k.Pod,label:k.Pod},{id:k.Namespace,label:k.Namespace},{id:k.Node,label:k.Node}],Yn=[{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:Kn}],qn=[{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:Kn}],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:C.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:C.Number}],Qn=h.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:C.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:C.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:C.Number},{label:"Condition",keyName:"condition",tooltip:"An object representing the filters for span attributes filters.",componentType:x.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:x.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={[O.K8sAttributes]:({value:o,setValue:l,formErrors:i})=>(n(()=>{o[h.CollectContainerAttributes]||o[h.CollectReplicaSetAttributes]||o[h.CollectWorkloadId]||o[h.CollectClusterId]||o[h.LabelsAttributes]?.length||o[h.AnnotationsAttributes]?.length||(l(h.CollectContainerAttributes,!0),l(h.CollectReplicaSetAttributes,!0),l(h.CollectWorkloadId,!0),l(h.CollectClusterId,!0),l(h.LabelsAttributes,[]),l(h.AnnotationsAttributes,[]))},[]),e(a,{children:[t(g,{$gap:6,children:Gn.map(({id:a,label:n})=>e(g,{children:[t(f,{label:n,value:o[a]||!1,onChange:e=>l(a,e)}),t(y,{errorMessage:i[a]})]},a))}),t(w,{name:"labelsAttributes",label:"Label attributes",limitFieldsPerRow:2,columns:Yn,values:o[h.LabelsAttributes]||[],setValues:e=>l(h.LabelsAttributes,e),errorMessage:i[h.LabelsAttributes]}),t(w,{name:"annotationsAttributes",label:"Annotation attributes",limitFieldsPerRow:2,columns:qn,values:o[h.AnnotationsAttributes]||[],setValues:e=>l(h.AnnotationsAttributes,e),errorMessage:i[h.AnnotationsAttributes]})]})),[O.AddClusterInfo]:({value:n,setValue:o,formErrors:l})=>{const i=m();return e(a,{children:[t(T,{label:"Overwrite existing values",labelAlign:N.Left,labelColor:i.v2.colors.silver[200],tooltip:"If enabled, the resource attributes will overwrite any existing attributes with the same name.",value:n[h.OverwriteExistingValues]||!1,onChange:e=>o(h.OverwriteExistingValues,e)}),t(w,{name:"clusterAttributes",label:"Resource attributes",limitFieldsPerRow:2,columns:[{keyName:"attributeName",label:"Attribute name"},{keyName:"attributeStringValue",label:"Attribute value"}],values:n[h.ClusterAttributes]||[],setValues:e=>o(h.ClusterAttributes,e),errorMessage:l[h.ClusterAttributes]})]})},[O.DeleteAttributes]:({value:e,setValue:a,formErrors:n})=>t(A,{name:"attributeNamesToDelete",label:"Attributes to delete",values:e[h.AttributeNamesToDelete]||[],setValues:e=>a(h.AttributeNamesToDelete,e),errorMessage:n[h.AttributeNamesToDelete]}),[O.RenameAttributes]:({value:e,setValue:a,formErrors:n})=>t(w,{name:"renames",label:"Attributes to rename",limitFieldsPerRow:2,columns:[{keyName:"oldKey",label:"Old key"},{keyName:"newKey",label:"New key"}],values:Object.entries(e[h.Renames]||{}).map(([e,t])=>({oldKey:e,newKey:t})),setValues:e=>{const t={};e.forEach(e=>t[e.oldKey]=e.newKey),a(h.Renames,t)},errorMessage:n[h.Renames]}),[O.PiiMasking]:({value:a,setValue:o,formErrors:l})=>(n(()=>{a[h.PiiCategories]?.length||o(h.PiiCategories,Wn.map(({id:e})=>e))},[]),e(g,{$gap:12,children:[t(b,{label:"Attributes to mask"}),t(g,{$gap:6,children:Wn.map(({id:e,label:n})=>t(f,{label:n,value:a[h.PiiCategories]?.includes(e)||!1,onChange:t=>{const n=a[h.PiiCategories]||[],l=t?[...n,e]:n.filter(t=>t!==e);o(h.PiiCategories,l)}},e))}),t(y,{errorMessage:l[h.PiiCategories]})]})),[O.ErrorSampler]:({value:e,setValue:a,formErrors:n})=>{const o=n[h.FallbackSamplingRatio],l=S(e[h.FallbackSamplingRatio])?"":String(e[h.FallbackSamplingRatio]);return t(v,{name:"fallbackSamplingRatio",label:"Fallback sampling ratio",type:C.Number,min:0,max:100,value:l,placeholder:"0-100",onChange:e=>{return t=e.target.value,a(h.FallbackSamplingRatio,Math.max(0,Math.min(Number(t),100))||0);var t},errorMessage:o})},[O.ProbabilisticSampler]:({value:e,setValue:a,formErrors:n})=>{const o=n[h.SamplingPercentage],l=S(e[h.SamplingPercentage])?"":String(e[h.SamplingPercentage]);return t(v,{name:"samplingPercentage",label:"Sampling percentage",type:C.Number,min:0,max:100,value:l,placeholder:"0-100",onChange:e=>{return t=e.target.value,a(h.SamplingPercentage,Math.max(0,Math.min(Number(t),100))||0);var t},errorMessage:o})},[O.LatencySampler]:({value:e,setValue:a,formErrors:n})=>{const o=n[h.EndpointsFilters],l=e[h.EndpointsFilters]||[];return t(w,{name:"endpointsFilters",limitFieldsPerRow:2,columns:Jn,values:l,setValues:e=>{a(h.EndpointsFilters,e.map(({serviceName:e,httpRoute:t,minimumLatencyThreshold:a,fallbackSamplingRatio:n})=>({serviceName:e,httpRoute:t,minimumLatencyThreshold:Number(a),fallbackSamplingRatio:Number(n)})))},errorMessage:o})},[O.ServiceNameSampler]:({value:e,setValue:a,formErrors:n})=>{const o=n[h.ServicesNameFilters],l=e[h.ServicesNameFilters]||[];return t(w,{name:"servicesNameFilters",limitFieldsPerRow:2,columns:eo,values:l,setValues:e=>{a(h.ServicesNameFilters,e.map(({serviceName:e,samplingRatio:t,fallbackSamplingRatio:a})=>({serviceName:e,samplingRatio:Number(t),fallbackSamplingRatio:Number(a)})))},errorMessage:o})},[O.SpanAttributeSampler]:({value:e,setValue:a,formErrors:n})=>{const o=n[h.AttributeFilters],l=(e[h.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(w,{name:"attributeFilters",limitFieldsPerRow:2,columns:to,values:l,setValues:e=>{a(h.AttributeFilters,e.map(({serviceName:e,attributeKey:t,fallbackSamplingRatio:a,condition:n,operation:o,expectedValue:l,jsonPath:i})=>{const s={serviceName:e,attributeKey:t,fallbackSamplingRatio:Number(a),condition:{[n]:{operation:o,expectedValue:l}}};return i&&(s.condition[n].jsonPath=i),s}))},errorMessage:o})},[O.URLTemplatization]:({value:n,setValue:l,formErrors:i})=>{const s=m(),r=n[Qn]||[{filterK8sNamespace:"",workloadFilters:[],templatizationRules:[{template:""}],notes:""}],c=e=>l(Qn,e),d=(e,t)=>c(r.map((a,n)=>n===e?{...a,...t}:a));return e(a,{children:[r.map((a,n)=>e(o,{children:[t(I,{}),e(g,{$gap:12,children:[e(D,{$justifyContent:"space-between",$alignItems:"center",children:[t(b,{label:`Rule Group ${n+1}`}),t(E,{leftIcon:()=>t(Xa,{fill:s.v2.colors.red[500]}),variant:R.Secondary,size:$.S,onClick:()=>{return e=n,c(r.filter((t,a)=>a!==e));var e},disabled:1===r.length})]}),t(v,{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(w,{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(A,{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(y,{errorMessage:i[Qn]})]},`url-templatization-group-${n}`)),t(E,{variant:R.Secondary,label:"Add rule group",leftIcon:Ha,onClick:()=>c([...r,{filterK8sNamespace:"",workloadFilters:[],templatizationRules:[{template:""}],notes:""}])}),t(I,{})]})}},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=()=>{const a=m(),{selectedOption:n,genericForm:o}=P();if(!o||!n)return t(F,{title:"No active form"});const{formData:l,handleFormChange:i,formErrors:s}=o;return e(g,{$gap:24,children:[e(D,{$gap:12,$justifyContent:"space-between",children:[t(L,{size:M.XXS,children:n.docsDescription}),t(E,{label:"Docs",leftIcon:Wa,variant:R.Text,size:$.S,onClick:()=>window.open(`${V}${n.docsEndpoint}`,"_blank","noopener noreferrer")})]}),t(B,{options:[{icon:Ga,label:"Enabled",value:!1,selectedBgColor:a.v2.colors.green[800]},{icon:Ka,label:"Disabled",value:!0,selectedBgColor:a.v2.colors.red[800]}],selected:l.disabled,setSelected:e=>i("disabled",e)}),t(Dn,{title:"Signals for processing",allowedSignals:n.allowedSignals,selectedSignals:l.signals||[],setSelectedSignals:e=>i("signals",e),errorMessage:s.signals}),t(v,{name:"actionName",label:"Action name",placeholder:"Use a name that describes the action...",value:l.name||"",onChange:({target:{value:e}})=>i("name",e),errorMessage:s.name}),t(no,{actionType:n.type,value:l.fields,setValue:(e,t)=>i(`fields.${e}`,t),formErrors:s}),t(z,{name:"notes",label:"Notes",placeholder:"Your personal notes...",value:l.notes||"",onChange:({target:{value:e}})=>i("notes",e),errorMessage:s.notes})]})},lo=({signals:e,fields:a,disabled:n,formData:o,handleFormChange:l,formErrors:i})=>a?.map(({renderCondition:a,componentType:s,type:r,name:c,title:d,tooltip:u,placeholder:p,value:m,required:h,options:g})=>{if(!(!a||_(a,e,o.fields)))return null;const b=c,f=o.fields.find(e=>e.key===b),y=f?f.value:m;return t(En,{componentType:s,inputType:r,name:b,label:d,tooltip:u,disabled:n,required:h,placeholder:p,errorMessage:i[b],dropdownOptions:g,value:y||"",setValue:e=>l(b,e)},b)}),io=p(D)`
1
+ import{jsxs as e,jsx as t,Fragment as a}from"react/jsx-runtime";import{useEffect as n,Fragment as o,forwardRef as i,useState as l,useImperativeHandle as s,useMemo as r,useCallback as c,useRef as d,Children as u}from"react";import p,{useTheme as m}from"styled-components";import{c as h,F as g,d as b,e as f,f as y,I as v,h as C,i as S,j as w,K as k,T,k as A,l as N,m as I,n as D,o as E,B as $,a as R,p as x,q as O,r as P,N as F,s as M,t as L,v as V,S as B,w as z,x as _,y as U,z as j,E as X,G as H,H as W,J as G,L as K,M as Y,O as q,P as J,Q,R as Z,U as ee,V as te,W as ae,X as ne,Y as oe,Z as ie,_ as le,$ as se,a0 as re,a1 as ce,a2 as de,a3 as ue,a4 as pe,a5 as me,a6 as he,a7 as ge,a8 as be,a9 as fe,aa as ye,ab as ve,ac as Ce,ad as Se,ae as we,b as ke,af as Te,ag as Ae,ah as Ne,ai as Ie,aj as De,ak as Ee,al as $e,am as Re,an as xe,ao as Oe,ap as Pe,aq as Fe,ar as Me,as as Le,at as Ve,au as Be,av as ze,aw as _e,ax as Ue,ay as je,az as Xe,aA as He,aB as We,aC as Ge,aD as Ke,aE as Ye,aF as qe,aG as Je,aH as Qe,aI as Ze,aJ as et,D as tt,aK as at,aL as nt,aM as ot,aN as it,aO as lt,aP as st,aQ as rt,aR as ct,aS as dt,aT as ut,aU as pt,aV as mt,aW as ht,aX as gt,aY as bt,aZ as ft,a_ as yt,a$ as vt,b0 as Ct,b1 as St,b2 as wt,b3 as kt,b4 as Tt,b5 as At,b6 as Nt,b7 as It,b8 as Dt,b9 as Et,ba as $t,bb as Rt,u as xt,bc as Ot,bd as Pt,be as Ft,bf as Mt,bg as Lt,bh as Vt,g as Bt,bi as zt,A as _t,bj as Ut,bk as jt,bl as Xt,bm as Ht,bn as Wt,bo as Gt,bp as Kt,bq as Yt,br as qt,bs as Jt,bt as Qt,bu as Zt,bv as ea,bw as ta,bx as aa,by as na,bz as oa,bA as ia,bB as la,bC as sa,bD as ra,bE as ca,bF as da,bG as ua,bH as pa,bI as ma,bJ as ha,bK as ga,bL as ba,bM as fa,bN as ya,bO as va,bP as Ca,bQ as Sa,bR as wa,bS as ka,bT as Ta,bU as Aa,bV as Na,bW as Ia,bX as Da,bY as Ea,bZ as $a,b_ as Ra,b$ as xa,c0 as Oa,c1 as Pa,c2 as Fa,c3 as Ma,c4 as La,c5 as Va,c6 as Ba,c7 as za,c8 as _a,c9 as Ua,ca as ja}from"../chunks/ui-components-CvK0mvVN.js";import{TrashIcon as Xa,PlusIcon as Ha,BookIcon as Wa,VSquareIcon as Ga,XSquareIcon as Ka,DeleteIcon as Ya,EditIcon as qa,GoLogo as Ja,JavaLogo as Qa,ChevronRightIcon as Za,ActionIcon as en,DestinationIcon as tn,ChevronUpIcon as an,ChevronDownIcon as nn,VIcon as on,XIcon as ln,InstrumentationRuleIcon as sn,SourceIcon as rn,NamespacesIcon as cn,SettingsIcon as dn,SamplingIcon as un,ExclamationTriangleIcon as pn,ExclamationCircleIcon as mn,KeyIcon as hn,DiagnoseIcon as gn,DownloadIcon as bn,TerminalIcon as fn,RefreshIcon as yn,ConnectionsIcon as vn,OdigosLogo as Cn,ArrowRightIcon as Sn,PipelineCollectorIcon as wn,PodIcon as kn,ArrowDownSquareIcon as Tn,ArrowUpSquareIcon as An,GatewayIcon as Nn,YamlIcon as In}from"../icons.js";import{S as Dn,D as En,A as $n,P as Rn,a as xn,b as On,R as Pn,c as Fn,O as Mn,d as Ln,e as Vn,f as Bn,W as zn,g as _n,C as Un,h as jn,i as Xn,U as Hn}from"../chunks/index-DAOWyONO.js";import{Y as Wn}from"../chunks/index-tFZXUKvO.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 Gn=[{id:"CREDIT_CARD",label:"Credit card"}],Kn=[{id:h.CollectContainerAttributes,label:"Collect container attributes"},{id:h.CollectReplicaSetAttributes,label:"Collect ReplicaSet attributes"},{id:h.CollectWorkloadId,label:"Collect workload ID"},{id:h.CollectClusterId,label:"Collect cluster ID"}],Yn=[{id:k.Pod,label:k.Pod},{id:k.Namespace,label:k.Namespace},{id:k.Node,label:k.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:Yn}],Jn=[{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:Yn}],Qn=[{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:C.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:C.Number}],Zn=h.UrlTemplatizationRulesGroups,eo=[{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"}],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:"Sampling ratio",keyName:"samplingRatio",placeholder:"e.g. 10",tooltip:"Specifies the sample rate for all traces.",inputType:C.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:C.Number}],ao=[{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:C.Number},{label:"Condition",keyName:"condition",tooltip:"An object representing the filters for span attributes filters.",componentType:x.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:x.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}],no={[O.K8sAttributes]:({value:o,setValue:i,formErrors:l})=>(n(()=>{o[h.CollectContainerAttributes]||o[h.CollectReplicaSetAttributes]||o[h.CollectWorkloadId]||o[h.CollectClusterId]||o[h.LabelsAttributes]?.length||o[h.AnnotationsAttributes]?.length||(i(h.CollectContainerAttributes,!0),i(h.CollectReplicaSetAttributes,!0),i(h.CollectWorkloadId,!0),i(h.CollectClusterId,!0),i(h.LabelsAttributes,[]),i(h.AnnotationsAttributes,[]))},[]),e(a,{children:[t(g,{$gap:6,children:Kn.map(({id:a,label:n})=>e(g,{children:[t(f,{label:n,value:o[a]||!1,onChange:e=>i(a,e)}),t(y,{errorMessage:l[a]})]},a))}),t(w,{name:"labelsAttributes",label:"Label attributes",limitFieldsPerRow:2,columns:qn,values:o[h.LabelsAttributes]||[],setValues:e=>i(h.LabelsAttributes,e),errorMessage:l[h.LabelsAttributes]}),t(w,{name:"annotationsAttributes",label:"Annotation attributes",limitFieldsPerRow:2,columns:Jn,values:o[h.AnnotationsAttributes]||[],setValues:e=>i(h.AnnotationsAttributes,e),errorMessage:l[h.AnnotationsAttributes]})]})),[O.AddClusterInfo]:({value:n,setValue:o,formErrors:i})=>{const l=m();return e(a,{children:[t(T,{label:"Overwrite existing values",labelAlign:A.Left,labelColor:l.v2.colors.silver[200],tooltip:"If enabled, the resource attributes will overwrite any existing attributes with the same name.",value:n[h.OverwriteExistingValues]||!1,onChange:e=>o(h.OverwriteExistingValues,e)}),t(w,{name:"clusterAttributes",label:"Resource attributes",limitFieldsPerRow:2,columns:[{keyName:"attributeName",label:"Attribute name"},{keyName:"attributeStringValue",label:"Attribute value"}],values:n[h.ClusterAttributes]||[],setValues:e=>o(h.ClusterAttributes,e),errorMessage:i[h.ClusterAttributes]})]})},[O.DeleteAttributes]:({value:e,setValue:a,formErrors:n})=>t(N,{name:"attributeNamesToDelete",label:"Attributes to delete",values:e[h.AttributeNamesToDelete]||[],setValues:e=>a(h.AttributeNamesToDelete,e),errorMessage:n[h.AttributeNamesToDelete]}),[O.RenameAttributes]:({value:e,setValue:a,formErrors:n})=>t(w,{name:"renames",label:"Attributes to rename",limitFieldsPerRow:2,columns:[{keyName:"oldKey",label:"Old key"},{keyName:"newKey",label:"New key"}],values:Object.entries(e[h.Renames]||{}).map(([e,t])=>({oldKey:e,newKey:t})),setValues:e=>{const t={};e.forEach(e=>t[e.oldKey]=e.newKey),a(h.Renames,t)},errorMessage:n[h.Renames]}),[O.PiiMasking]:({value:a,setValue:o,formErrors:i})=>(n(()=>{a[h.PiiCategories]?.length||o(h.PiiCategories,Gn.map(({id:e})=>e))},[]),e(g,{$gap:12,children:[t(b,{label:"Attributes to mask"}),t(g,{$gap:6,children:Gn.map(({id:e,label:n})=>t(f,{label:n,value:a[h.PiiCategories]?.includes(e)||!1,onChange:t=>{const n=a[h.PiiCategories]||[],i=t?[...n,e]:n.filter(t=>t!==e);o(h.PiiCategories,i)}},e))}),t(y,{errorMessage:i[h.PiiCategories]})]})),[O.ErrorSampler]:({value:e,setValue:a,formErrors:n})=>{const o=n[h.FallbackSamplingRatio],i=S(e[h.FallbackSamplingRatio])?"":String(e[h.FallbackSamplingRatio]);return t(v,{name:"fallbackSamplingRatio",label:"Fallback sampling ratio",type:C.Number,min:0,max:100,value:i,placeholder:"0-100",onChange:e=>{return t=e.target.value,a(h.FallbackSamplingRatio,Math.max(0,Math.min(Number(t),100))||0);var t},errorMessage:o})},[O.ProbabilisticSampler]:({value:e,setValue:a,formErrors:n})=>{const o=n[h.SamplingPercentage],i=S(e[h.SamplingPercentage])?"":String(e[h.SamplingPercentage]);return t(v,{name:"samplingPercentage",label:"Sampling percentage",type:C.Number,min:0,max:100,value:i,placeholder:"0-100",onChange:e=>{return t=e.target.value,a(h.SamplingPercentage,Math.max(0,Math.min(Number(t),100))||0);var t},errorMessage:o})},[O.LatencySampler]:({value:e,setValue:a,formErrors:n})=>{const o=n[h.EndpointsFilters],i=e[h.EndpointsFilters]||[];return t(w,{name:"endpointsFilters",limitFieldsPerRow:2,columns:Qn,values:i,setValues:e=>{a(h.EndpointsFilters,e.map(({serviceName:e,httpRoute:t,minimumLatencyThreshold:a,fallbackSamplingRatio:n})=>({serviceName:e,httpRoute:t,minimumLatencyThreshold:Number(a),fallbackSamplingRatio:Number(n)})))},errorMessage:o})},[O.ServiceNameSampler]:({value:e,setValue:a,formErrors:n})=>{const o=n[h.ServicesNameFilters],i=e[h.ServicesNameFilters]||[];return t(w,{name:"servicesNameFilters",limitFieldsPerRow:2,columns:to,values:i,setValues:e=>{a(h.ServicesNameFilters,e.map(({serviceName:e,samplingRatio:t,fallbackSamplingRatio:a})=>({serviceName:e,samplingRatio:Number(t),fallbackSamplingRatio:Number(a)})))},errorMessage:o})},[O.SpanAttributeSampler]:({value:e,setValue:a,formErrors:n})=>{const o=n[h.AttributeFilters],i=(e[h.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(w,{name:"attributeFilters",limitFieldsPerRow:2,columns:ao,values:i,setValues:e=>{a(h.AttributeFilters,e.map(({serviceName:e,attributeKey:t,fallbackSamplingRatio:a,condition:n,operation:o,expectedValue:i,jsonPath:l})=>{const s={serviceName:e,attributeKey:t,fallbackSamplingRatio:Number(a),condition:{[n]:{operation:o,expectedValue:i}}};return l&&(s.condition[n].jsonPath=l),s}))},errorMessage:o})},[O.URLTemplatization]:({value:n,setValue:i,formErrors:l})=>{const s=m(),r=n[Zn]||[{filterK8sNamespace:"",workloadFilters:[],templatizationRules:[{template:""}],notes:""}],c=e=>i(Zn,e),d=(e,t)=>c(r.map((a,n)=>n===e?{...a,...t}:a));return e(a,{children:[r.map((a,n)=>e(o,{children:[t(I,{}),e(g,{$gap:12,children:[e(D,{$justifyContent:"space-between",$alignItems:"center",children:[t(b,{label:`Rule Group ${n+1}`}),t(E,{leftIcon:()=>t(Xa,{fill:s.v2.colors.red[500]}),variant:R.Secondary,size:$.S,onClick:()=>{return e=n,c(r.filter((t,a)=>a!==e));var e},disabled:1===r.length})]}),t(v,{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(w,{name:`urlGroup-${n}-workloadFilters`,label:"Workload filters",tooltip:"Optionally scope templates to specific workloads.",columns:eo,values:a.workloadFilters||[],setValues:e=>d(n,{workloadFilters:e})}),t(N,{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(y,{errorMessage:l[Zn]})]},`url-templatization-group-${n}`)),t(E,{variant:R.Secondary,label:"Add rule group",leftIcon:Ha,onClick:()=>c([...r,{filterK8sNamespace:"",workloadFilters:[],templatizationRules:[{template:""}],notes:""}])}),t(I,{})]})}},oo=({actionType:e,value:a,setValue:n,formErrors:o})=>{if(!e)return null;const i=no[e];return i?t(i,{value:a,setValue:n,formErrors:o}):null},io=()=>{const a=m(),{selectedOption:n,genericForm:o}=P();if(!o||!n)return t(F,{title:"No active form"});const{formData:i,handleFormChange:l,formErrors:s}=o;return e(g,{$gap:24,children:[e(D,{$gap:12,$justifyContent:"space-between",children:[t(M,{size:L.XXS,children:n.docsDescription}),t(E,{label:"Docs",leftIcon:Wa,variant:R.Text,size:$.S,onClick:()=>window.open(`${V}${n.docsEndpoint}`,"_blank","noopener noreferrer")})]}),t(B,{options:[{icon:Ga,label:"Enabled",value:!1,selectedBgColor:a.v2.colors.green[800]},{icon:Ka,label:"Disabled",value:!0,selectedBgColor:a.v2.colors.red[800]}],selected:i.disabled,setSelected:e=>l("disabled",e)}),t(Dn,{title:"Signals for processing",allowedSignals:n.allowedSignals,selectedSignals:i.signals||[],setSelectedSignals:e=>l("signals",e),errorMessage:s.signals}),t(v,{name:"actionName",label:"Action name",placeholder:"Use a name that describes the action...",value:i.name||"",onChange:({target:{value:e}})=>l("name",e),errorMessage:s.name}),t(oo,{actionType:n.type,value:i.fields,setValue:(e,t)=>l(`fields.${e}`,t),formErrors:s}),t(z,{name:"notes",label:"Notes",placeholder:"Your personal notes...",value:i.notes||"",onChange:({target:{value:e}})=>l("notes",e),errorMessage:s.notes})]})},lo=({signals:e,fields:a,disabled:n,formData:o,handleFormChange:i,formErrors:l})=>a?.map(({renderCondition:a,componentType:s,type:r,name:c,title:d,tooltip:u,placeholder:p,value:m,required:h,options:g})=>{if(!(!a||_(a,e,o.fields)))return null;const b=c,f=o.fields.find(e=>e.key===b),y=f?f.value:m;return t(En,{componentType:s,inputType:r,name:b,label:d,tooltip:u,disabled:n,required:h,placeholder:p,errorMessage:l[b],dropdownOptions:g,value:y||"",setValue:e=>i(b,e)},b)}),so=p(D)`
2
2
  position: sticky;
3
- bottom: 0;
3
+ bottom: 4px;
4
+ align-self: center;
5
+ width: fit-content;
6
+ padding: 12px 16px;
4
7
  margin-top: auto;
5
- padding: 12px 0;
6
- background-color: ${({theme:e})=>e.v2.colors.silver[900]};
8
+ border-radius: 8px;
9
+ background-color: ${({theme:e})=>e.v2.colors.black[500]};
10
+ box-shadow: 0 4px 16.7px 0 rgba(0, 0, 0, 0.83);
7
11
  z-index: 1;
8
- `,so=l(({testConnection:a,isEdit:o},l)=>{const r=m(),{activeForm:c,genericForm:d,validateFormData:u,thisUnsavedDestination:p,addUnsavedDestination:h,updateUnsavedDestination:b,deleteUnsavedDestination:f}=U(),[y,C]=i(p?.testResult),[S,w]=i(!!p);n(()=>{p?(C(p.testResult),w(!0)):(C(void 0),w(!1))},[p]);const k=async()=>{if(!c?.option.testConnectionSupported||!d)return;const e=await a(K(d.formData));return C(e),e};return s(l,()=>({testConnection:k,testConnectionSupported:!!c?.option.testConnectionSupported}),[c?.option.testConnectionSupported,d,a]),d&&c?e(g,{$gap:24,style:{minHeight:"100%"},children:[e(D,{$gap:12,$justifyContent:"space-between",children:[y?y.succeeded?t(j,{status:X.Success,message:y.message||"Connection OK",fullWidth:!0,smallIcon:!0}):t(j,{status:X.Error,message:y.message||"Connection Failed",fullWidth:!0,smallIcon:!0}):t("div",{}),t(E,{"data-id":"dest-form-docs",label:"Docs",leftIcon:Wa,variant:R.Text,size:$.S,onClick:()=>window.open(`${V}/backends/${c.option.type}`,"_blank","noopener noreferrer")})]}),t(B,{options:[{icon:Ga,label:"Enabled",value:!1,selectedBgColor:r.v2.colors.green[800]},{icon:Ka,label:"Disabled",value:!0,selectedBgColor:r.v2.colors.red[800]}],selected:d.formData.disabled,setSelected:e=>d.handleFormChange("disabled",e),disabled:S}),t(Dn,{title:"This connection will monitor:",allowedSignals:G(c.option.supportedSignals),selectedSignals:W(d.formData.exportedSignals),setSelectedSignals:e=>d.handleFormChange("exportedSignals",{logs:e.includes(H.Logs),metrics:e.includes(H.Metrics),traces:e.includes(H.Traces)}),disabled:S,errorMessage:d.formErrors.exportedSignals}),t(v,{name:"destinationName",label:"Destination name",placeholder:"Use a name that describes the destination...",value:d.formData.name,onChange:({target:{value:e}})=>d.handleFormChange("name",e),disabled:S,errorMessage:d.formErrors.name}),t(lo,{signals:W(d.formData.exportedSignals),fields:c.dynamicFields,disabled:S,formData:d.formData,handleFormChange:(e,t)=>{d.handleFormChange("fields",d.formData.fields.map(a=>a.key===e?{...a,value:t}:a))},formErrors:d.formErrors}),!o&&e(io,{$gap:8,$justifyContent:"flex-end",children:[p&&t("div",{style:{width:"150px"},children:t(E,{"data-id":"dest-form-delete",fullWidth:!0,label:"Delete",rightIcon:Ya,variant:R.Secondary,textColor:r.v2.colors.red[500],onClick:()=>f(c.unsavedIdx)})}),(!p||p.option.testConnectionSupported&&!S)&&t("div",{style:{width:"150px"},children:t(E,{"data-id":"dest-form-test-connection",fullWidth:!0,label:"Test Connection",variant:R.Secondary,onClick:k})}),p&&t("div",S?{style:{width:"150px"},children:t(E,{"data-id":"dest-form-edit",fullWidth:!0,label:"Edit",rightIcon:qa,variant:R.Secondary,onClick:()=>w(!1)})}:{style:{width:"150px"},children:t(E,{"data-id":"dest-form-save",fullWidth:!0,label:"Save Changes",variant:R.Primary,onClick:async()=>{const{errorMessage:e,preparedFormData:t}=u();if(!e){const e=await k(),a=!!e&&!e.succeeded;b(c.unsavedIdx,{formData:t,testResult:e},a)}}})}),!p&&t("div",{style:{width:"150px"},children:t(E,{"data-id":"dest-form-add",fullWidth:!0,label:"Add Destination",variant:R.Primary,onClick:async()=>{const{errorMessage:e,preparedFormData:t}=u();if(!e){const e=await k(),a=!!e&&!e.succeeded;h({formData:t,testResult:e},a)}}})})]})]}):t(F,{title:"No active form"})});so.displayName="AddDestinationForm";const ro=[{id:Y.FilePath,label:"Collect file path",tooltip:"Indicates whether to record the `code.filepath` attribute."},{id:Y.Function,label:"Collect function",tooltip:"Indicates whether to record the `code.function` attribute."},{id:Y.LineNumber,label:"Collect line number",tooltip:"Indicates whether to record the `code.lineno` attribute."}],co=[{id:Y.Column,label:"Collect column",tooltip:"Indicates whether to record the `code.column` attribute."},{id:Y.Namespace,label:"Collect namespace",tooltip:"Indicates whether to record the `code.namespace` attribute."},{id:Y.StackTrace,label:"Collect stacktrace",tooltip:"Indicates whether to record the `code.stacktrace` attribute."}],uo=["*"],po=[{id:Q.HttpRequest,label:"Collect HTTP request",tooltip:""},{id:Q.HttpResponse,label:"Collect HTTP response",tooltip:""},{id:Q.DbQuery,label:"Collect DB query",tooltip:""},{id:Q.Messaging,label:"Collect messaging",tooltip:""}],mo={[te.Java]:[new ee("","")],[te.Golang]:[new Z("")]},ho={[ae.CodeAttributes]:({value:o,setValue:l,formErrors:i})=>{const s=m(),c=i.codeAttributes,d=r(()=>Object.entries(o.codeAttributes||{}).filter(([e,t])=>!!t).map(([e])=>e),[o]);n(()=>{if(!d.length&&!c){const e={[Y.FilePath]:!0,[Y.Function]:!0,[Y.LineNumber]:!0,[Y.Column]:null,[Y.Namespace]:null,[Y.StackTrace]:null};l("codeAttributes",e)}},[]);const u=(e,t)=>{const a=t?[...d,e]:d.filter(t=>t!==e),n=Object.values(Y).reduce((e,t)=>(e[t]=!!a.includes(t)||null,e),{});l("codeAttributes",n)};return e(a,{children:[e(g,{$gap:12,children:[t(L,{size:M.XS,color:s.v2.colors.silver[200],nowrap:!0,children:"Recommended data to collect"}),t(g,{$gap:6,children:ro.map(({id:e,label:a,tooltip:n})=>t(q,{text:n,withIcon:!0,children:t(f,{label:a,value:d.includes(e),onChange:t=>u(e,t)})},e))}),t(y,{errorMessage:c})]}),e(g,{$gap:12,children:[t(L,{size:M.XS,color:s.v2.colors.silver[200],nowrap:!0,children:"Verbose data to collect"}),t(g,{$gap:6,children:co.map(({id:e,label:a,tooltip:n})=>t(q,{text:n,withIcon:!0,children:t(f,{label:a,value:d.includes(e),onChange:t=>u(e,t)})},e))}),t(y,{errorMessage:c})]})]})},[ae.CustomInstrumentation]:({value:o,setValue:l,formErrors:i})=>{const s=i.customInstrumentations,c=r(()=>(o?.customInstrumentations?.[te.Golang]||[]).map(e=>new Z(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)),[o]),d=r(()=>(o?.customInstrumentations?.[te.Java]||[]).map(e=>new ee(e.className,e.methodName)),[o]);return n(()=>{o?.customInstrumentations||s||l("customInstrumentations",{[te.Golang]:mo[te.Golang],[te.Java]:mo[te.Java]})},[]),e(a,{children:[e(g,{children:[e(D,{$gap:8,children:[t(Ja,{}),t(b,{label:"Golang custom probes"})]}),t(w,{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[te.Golang]=e.map(e=>new Z(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)),t[te.Java]=d,l("customInstrumentations",t)},errorMessage:s,limitFieldsPerRow:2})]}),e(g,{children:[e(D,{$gap:8,children:[t(Qa,{}),t(b,{label:"Java custom probes"})]}),t(w,{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[te.Golang]=c,t[te.Java]=e.map(e=>new ee(e.className,e.methodName)),l("customInstrumentations",t)},errorMessage:s,limitFieldsPerRow:2})]})]})},[ae.HeadersCollection]:({value:e,setValue:a,formErrors:o})=>{const l=o.headersCollection,i=r(()=>e?.headersCollection?.[J.HeaderKeys]||[],[e]),s=e=>{const t={[J.HeaderKeys]:e};a("headersCollection",t)};return n(()=>{i.length||l||s(uo)},[]),t(A,{name:"headerKeys",label:"Header keys",tooltip:"Specify which headers you want to collect",helpMessage:"Asterisk (*) will collect all headers",values:i,setValues:s,errorMessage:l})},[ae.PayloadCollection]:({value:a,setValue:o,formErrors:l})=>{const i=m(),s=l.payloadCollection,c=r(()=>Object.entries(a.payloadCollection||{}).filter(([e,t])=>!!t).map(([e])=>e),[a]);n(()=>{if(!c.length&&!s){const e={[Q.HttpRequest]:{},[Q.HttpResponse]:{},[Q.DbQuery]:{},[Q.Messaging]:{}};o("payloadCollection",e)}},[]);return e(g,{$gap:12,children:[t(L,{size:M.XS,color:i.v2.colors.silver[200],nowrap:!0,children:"Type of data to collect"}),t(g,{$gap:6,children:po.map(({id:e,label:a,tooltip:n})=>t(q,{text:n,withIcon:!0,children:t(f,{label:a,value:c.includes(e),onChange:t=>((e,t)=>{const a=t?[...c,e]:c.filter(t=>t!==e),n={[Q.HttpRequest]:a.includes(Q.HttpRequest)?{}:null,[Q.HttpResponse]:a.includes(Q.HttpResponse)?{}:null,[Q.DbQuery]:a.includes(Q.DbQuery)?{}:null,[Q.Messaging]:a.includes(Q.Messaging)?{}:null};o("payloadCollection",n)})(e,t)})},e))}),t(y,{errorMessage:s})]})},[ae.UnknownType]:null},go=({ruleType:e,value:a,setValue:n,formErrors:o})=>{if(!e)return null;const l=ho[e];return l?t(l,{value:a,setValue:n,formErrors:o}):null},bo=()=>{const a=m(),{selectedOption:n,genericForm:o}=ne();if(!o||!n)return t(F,{title:"No active form"});const{formData:l,handleFormChange:i,formErrors:s}=o;return e(g,{$gap:24,children:[e(D,{$gap:12,$justifyContent:"space-between",children:[t(L,{size:M.XXS,children:n.docsDescription}),t(E,{label:"Docs",leftIcon:Wa,variant:R.Text,size:$.S,onClick:()=>window.open(`${V}${n.docsEndpoint}`,"_blank","noopener noreferrer")})]}),e(D,{$gap:12,children:[t(L,{size:M.XS,color:a.v2.colors.silver[200],nowrap:!0,children:"Supported Languages:"}),n.supportedLanguages.map(e=>t(oe,{label:le[e],leftIcon:ie(e),status:X.Default,useSecondaryTone:!0},e))]}),t(B,{options:[{icon:Ga,label:"Enabled",value:!1,selectedBgColor:a.v2.colors.green[800]},{icon:Ka,label:"Disabled",value:!0,selectedBgColor:a.v2.colors.red[800]}],selected:l.disabled,setSelected:e=>i("disabled",e)}),t(v,{name:"ruleName",label:"Rule name",placeholder:"Use a name that describes the rule...",value:l.ruleName,onChange:({target:{value:e}})=>i("ruleName",e),errorMessage:s.ruleName}),t(go,{ruleType:n.type,value:l,setValue:(e,t)=>i(e,t),formErrors:s}),t(z,{name:"notes",label:"Notes",placeholder:"Your personal notes...",value:l.notes,onChange:({target:{value:e}})=>i("notes",e),errorMessage:s.notes})]})},fo=p.div`
12
+ `,ro=i(({testConnection:a,isEdit:o},i)=>{const r=m(),{activeForm:c,genericForm:d,validateFormData:u,thisUnsavedDestination:p,addUnsavedDestination:h,updateUnsavedDestination:b,deleteUnsavedDestination:f}=U(),[y,C]=l(p?.testResult),[S,w]=l(!!p);n(()=>{p?(C(p.testResult),w(!0)):(C(void 0),w(!1))},[p]);const k=async()=>{if(!c?.option.testConnectionSupported||!d)return;const e=await a(K(d.formData));return C(e),e};return s(i,()=>({testConnection:k,testConnectionSupported:!!c?.option.testConnectionSupported}),[c?.option.testConnectionSupported,d,a]),d&&c?e(g,{$gap:24,style:{minHeight:"100%"},children:[e(D,{$gap:12,$justifyContent:"space-between",children:[y?y.succeeded?t(j,{status:X.Success,message:y.message||"Connection OK",fullWidth:!0,smallIcon:!0}):t(j,{status:X.Error,message:y.message||"Connection Failed",fullWidth:!0,smallIcon:!0}):t("div",{}),t(E,{"data-id":"dest-form-docs",label:"Docs",leftIcon:Wa,variant:R.Text,size:$.S,onClick:()=>window.open(`${V}/backends/${c.option.type}`,"_blank","noopener noreferrer")})]}),t(B,{options:[{icon:Ga,label:"Enabled",value:!1,selectedBgColor:r.v2.colors.green[800]},{icon:Ka,label:"Disabled",value:!0,selectedBgColor:r.v2.colors.red[800]}],selected:d.formData.disabled,setSelected:e=>d.handleFormChange("disabled",e),disabled:S}),t(Dn,{title:"This connection will monitor:",allowedSignals:G(c.option.supportedSignals),selectedSignals:W(d.formData.exportedSignals),setSelectedSignals:e=>d.handleFormChange("exportedSignals",{logs:e.includes(H.Logs),metrics:e.includes(H.Metrics),traces:e.includes(H.Traces)}),disabled:S,errorMessage:d.formErrors.exportedSignals}),t(v,{name:"destinationName",label:"Destination name",placeholder:"Use a name that describes the destination...",value:d.formData.name,onChange:({target:{value:e}})=>d.handleFormChange("name",e),disabled:S,errorMessage:d.formErrors.name}),t(lo,{signals:W(d.formData.exportedSignals),fields:c.dynamicFields,disabled:S,formData:d.formData,handleFormChange:(e,t)=>{d.handleFormChange("fields",d.formData.fields.map(a=>a.key===e?{...a,value:t}:a))},formErrors:d.formErrors}),!o&&e(so,{$gap:8,$justifyContent:"center",children:[p&&t("div",{style:{width:"150px"},children:t(E,{"data-id":"dest-form-delete",fullWidth:!0,label:"Delete",rightIcon:Ya,variant:R.Secondary,textColor:r.v2.colors.red[500],onClick:()=>f(c.unsavedIdx)})}),(!p||p.option.testConnectionSupported&&!S)&&t("div",{style:{width:"150px"},children:t(E,{"data-id":"dest-form-test-connection",fullWidth:!0,label:"Test Connection",variant:R.Secondary,onClick:k})}),p&&t("div",S?{style:{width:"150px"},children:t(E,{"data-id":"dest-form-edit",fullWidth:!0,label:"Edit",rightIcon:qa,variant:R.Secondary,onClick:()=>w(!1)})}:{style:{width:"150px"},children:t(E,{"data-id":"dest-form-save",fullWidth:!0,label:"Save Changes",variant:R.Primary,onClick:async()=>{const{errorMessage:e,preparedFormData:t}=u();if(!e){const e=await k(),a=!!e&&!e.succeeded;b(c.unsavedIdx,{formData:t,testResult:e},a)}}})}),!p&&t("div",{style:{width:"150px"},children:t(E,{"data-id":"dest-form-add",fullWidth:!0,label:"Add Destination",variant:R.Primary,onClick:async()=>{const{errorMessage:e,preparedFormData:t}=u();if(!e){const e=await k(),a=!!e&&!e.succeeded;h({formData:t,testResult:e},a)}}})})]})]}):t(F,{title:"No active form"})});ro.displayName="AddDestinationForm";const co=[{id:Y.FilePath,label:"Collect file path",tooltip:"Indicates whether to record the `code.filepath` attribute."},{id:Y.Function,label:"Collect function",tooltip:"Indicates whether to record the `code.function` attribute."},{id:Y.LineNumber,label:"Collect line number",tooltip:"Indicates whether to record the `code.lineno` attribute."}],uo=[{id:Y.Column,label:"Collect column",tooltip:"Indicates whether to record the `code.column` attribute."},{id:Y.Namespace,label:"Collect namespace",tooltip:"Indicates whether to record the `code.namespace` attribute."},{id:Y.StackTrace,label:"Collect stacktrace",tooltip:"Indicates whether to record the `code.stacktrace` attribute."}],po=["*"],mo=[{id:Q.HttpRequest,label:"Collect HTTP request",tooltip:""},{id:Q.HttpResponse,label:"Collect HTTP response",tooltip:""},{id:Q.DbQuery,label:"Collect DB query",tooltip:""},{id:Q.Messaging,label:"Collect messaging",tooltip:""}],ho={[te.Java]:[new ee("","")],[te.Golang]:[new Z("")]},go={[ae.CodeAttributes]:({value:o,setValue:i,formErrors:l})=>{const s=m(),c=l.codeAttributes,d=r(()=>Object.entries(o.codeAttributes||{}).filter(([e,t])=>!!t).map(([e])=>e),[o]);n(()=>{if(!d.length&&!c){const e={[Y.FilePath]:!0,[Y.Function]:!0,[Y.LineNumber]:!0,[Y.Column]:null,[Y.Namespace]:null,[Y.StackTrace]:null};i("codeAttributes",e)}},[]);const u=(e,t)=>{const a=t?[...d,e]:d.filter(t=>t!==e),n=Object.values(Y).reduce((e,t)=>(e[t]=!!a.includes(t)||null,e),{});i("codeAttributes",n)};return e(a,{children:[e(g,{$gap:12,children:[t(M,{size:L.XS,color:s.v2.colors.silver[200],nowrap:!0,children:"Recommended data to collect"}),t(g,{$gap:6,children:co.map(({id:e,label:a,tooltip:n})=>t(q,{text:n,withIcon:!0,children:t(f,{label:a,value:d.includes(e),onChange:t=>u(e,t)})},e))}),t(y,{errorMessage:c})]}),e(g,{$gap:12,children:[t(M,{size:L.XS,color:s.v2.colors.silver[200],nowrap:!0,children:"Verbose data to collect"}),t(g,{$gap:6,children:uo.map(({id:e,label:a,tooltip:n})=>t(q,{text:n,withIcon:!0,children:t(f,{label:a,value:d.includes(e),onChange:t=>u(e,t)})},e))}),t(y,{errorMessage:c})]})]})},[ae.CustomInstrumentation]:({value:o,setValue:i,formErrors:l})=>{const s=l.customInstrumentations,c=r(()=>(o?.customInstrumentations?.[te.Golang]||[]).map(e=>new Z(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)),[o]),d=r(()=>(o?.customInstrumentations?.[te.Java]||[]).map(e=>new ee(e.className,e.methodName)),[o]);return n(()=>{o?.customInstrumentations||s||i("customInstrumentations",{[te.Golang]:ho[te.Golang],[te.Java]:ho[te.Java]})},[]),e(a,{children:[e(g,{children:[e(D,{$gap:8,children:[t(Ja,{}),t(b,{label:"Golang custom probes"})]}),t(w,{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[te.Golang]=e.map(e=>new Z(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)),t[te.Java]=d,i("customInstrumentations",t)},errorMessage:s,limitFieldsPerRow:2})]}),e(g,{children:[e(D,{$gap:8,children:[t(Qa,{}),t(b,{label:"Java custom probes"})]}),t(w,{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[te.Golang]=c,t[te.Java]=e.map(e=>new ee(e.className,e.methodName)),i("customInstrumentations",t)},errorMessage:s,limitFieldsPerRow:2})]})]})},[ae.HeadersCollection]:({value:e,setValue:a,formErrors:o})=>{const i=o.headersCollection,l=r(()=>e?.headersCollection?.[J.HeaderKeys]||[],[e]),s=e=>{const t={[J.HeaderKeys]:e};a("headersCollection",t)};return n(()=>{l.length||i||s(po)},[]),t(N,{name:"headerKeys",label:"Header keys",tooltip:"Specify which headers you want to collect",helpMessage:"Asterisk (*) will collect all headers",values:l,setValues:s,errorMessage:i})},[ae.PayloadCollection]:({value:a,setValue:o,formErrors:i})=>{const l=m(),s=i.payloadCollection,c=r(()=>Object.entries(a.payloadCollection||{}).filter(([e,t])=>!!t).map(([e])=>e),[a]);n(()=>{if(!c.length&&!s){const e={[Q.HttpRequest]:{},[Q.HttpResponse]:{},[Q.DbQuery]:{},[Q.Messaging]:{}};o("payloadCollection",e)}},[]);return e(g,{$gap:12,children:[t(M,{size:L.XS,color:l.v2.colors.silver[200],nowrap:!0,children:"Type of data to collect"}),t(g,{$gap:6,children:mo.map(({id:e,label:a,tooltip:n})=>t(q,{text:n,withIcon:!0,children:t(f,{label:a,value:c.includes(e),onChange:t=>((e,t)=>{const a=t?[...c,e]:c.filter(t=>t!==e),n={[Q.HttpRequest]:a.includes(Q.HttpRequest)?{}:null,[Q.HttpResponse]:a.includes(Q.HttpResponse)?{}:null,[Q.DbQuery]:a.includes(Q.DbQuery)?{}:null,[Q.Messaging]:a.includes(Q.Messaging)?{}:null};o("payloadCollection",n)})(e,t)})},e))}),t(y,{errorMessage:s})]})},[ae.UnknownType]:null},bo=({ruleType:e,value:a,setValue:n,formErrors:o})=>{if(!e)return null;const i=go[e];return i?t(i,{value:a,setValue:n,formErrors:o}):null},fo=()=>{const a=m(),{selectedOption:n,genericForm:o}=ne();if(!o||!n)return t(F,{title:"No active form"});const{formData:i,handleFormChange:l,formErrors:s}=o;return e(g,{$gap:24,children:[e(D,{$gap:12,$justifyContent:"space-between",children:[t(M,{size:L.XXS,children:n.docsDescription}),t(E,{label:"Docs",leftIcon:Wa,variant:R.Text,size:$.S,onClick:()=>window.open(`${V}${n.docsEndpoint}`,"_blank","noopener noreferrer")})]}),e(D,{$gap:12,children:[t(M,{size:L.XS,color:a.v2.colors.silver[200],nowrap:!0,children:"Supported Languages:"}),n.supportedLanguages.map(e=>t(oe,{label:ie[e],leftIcon:le(e),status:X.Default,useSecondaryTone:!0},e))]}),t(B,{options:[{icon:Ga,label:"Enabled",value:!1,selectedBgColor:a.v2.colors.green[800]},{icon:Ka,label:"Disabled",value:!0,selectedBgColor:a.v2.colors.red[800]}],selected:i.disabled,setSelected:e=>l("disabled",e)}),t(v,{name:"ruleName",label:"Rule name",placeholder:"Use a name that describes the rule...",value:i.ruleName,onChange:({target:{value:e}})=>l("ruleName",e),errorMessage:s.ruleName}),t(bo,{ruleType:n.type,value:i,setValue:(e,t)=>l(e,t),formErrors:s}),t(z,{name:"notes",label:"Notes",placeholder:"Your personal notes...",value:i.notes,onChange:({target:{value:e}})=>l("notes",e),errorMessage:s.notes})]})},yo=[{value:"all",label:"Drop All"},{value:"sample",label:"Sample"}],vo=p.div`
9
13
  display: flex;
10
14
  flex-direction: column;
11
15
  gap: 24px;
12
- `,yo=()=>{const e=se();switch(e.formType){case re.Create:return t(vo,{category:e.category,formData:e.formData,onChange:e.handleChange,sourceOptions:e.sourceOptions,namespaceOptions:e.namespaceOptions});case re.View:return e.data?e.isEditing?t(vo,{category:e.data.category,formData:e.formData,onChange:e.handleChange,sourceOptions:e.sourceOptions,namespaceOptions:e.namespaceOptions}):t(Co,{data:e.data}):null;case re.EditAutoNoisy:return t(So,{enabled:e.localEnabled,summary:e.summary,inactiveTitle:fe,sectionTitle:be,sectionSubTitle:ge,presetLabel:he,customInputName:"sampling-auto-input-custom-percentage",percentagePreset:e.percentagePreset,setPercentagePreset:e.setPercentagePreset,customPercentage:e.customPercentage,setCustomPercentage:e.setCustomPercentage});case re.EditAutoCostReduction:return t(So,{enabled:e.localEnabled,summary:e.summary,inactiveTitle:me,sectionTitle:pe,sectionSubTitle:ue,presetLabel:de,customInputName:"sampling-cr-auto-input-custom-percentage",percentagePreset:e.percentagePreset,setPercentagePreset:e.setPercentagePreset,customPercentage:e.customPercentage,setCustomPercentage:e.setCustomPercentage});case re.EditAutoHighlyRelevant:return t(fo,{children:t($n,{title:e.localEnabled?void 0:ce,summary:e.summary})})}},vo=({category:a,formData:n,onChange:o,sourceOptions:l,namespaceOptions:i})=>e(fo,{children:[t(On,{category:a,formState:n}),t(Pn,{category:a,formState:n,onChange:o}),t(Fn,{formState:n,onChange:o,sourceOptions:l,namespaceOptions:i}),t(Ln,{category:a,formState:n,onChange:o}),t(Mn,{category:a,formState:n,onChange:o}),"highlyRelevant"===a&&t(Vn,{ruleType:n.ruleType,formState:n,onChange:o})]}),Co=({data:a})=>e(fo,{children:[t(On,{readOnly:!0,summary:a.summary}),t(Pn,{readOnly:!0,data:a}),t(Fn,{readOnly:!0,scopes:a.rule.sourceScopes??[]}),t(Ln,{readOnly:!0,data:a}),t(Mn,{readOnly:!0,data:a}),"highlyRelevant"===a.category&&t(Vn,{readOnly:!0,rule:a.rule})]}),So=({enabled:a,summary:n,inactiveTitle:o,sectionTitle:l,sectionSubTitle:i,presetLabel:s,customInputName:r,percentagePreset:d,setPercentagePreset:u,customPercentage:p,setCustomPercentage:m})=>{const h=c(e=>u(e),[u]),g=c(e=>m(e.target.value),[m]);return e(fo,{children:[t($n,{title:a?void 0:o,summary:n}),t(ye,{richTitle:{title:l,subTitle:i},children:t(Rn,{description:s,options:xn,selected:d,onSelect:h,customName:r,customLabel:ve,customPlaceholder:"5%",customValue:p,onCustomChange:g})})]})},wo=p.div`
16
+ `,Co=p.div`
17
+ display: contents;
18
+ & > * {
19
+ opacity: ${({$faded:e})=>e?.4:1};
20
+ transition: opacity 0.2s ease;
21
+ }
22
+ `,So=({value:e})=>{const a=m();return t(oe,e?{status:X.Success,label:ge,leftIcon:Ga}:{label:be,leftIcon:Ka,backgroundColor:a.v2.colors.silver[500],textColor:a.v2.colors.white[500]})},wo=({value:e,onChange:a})=>{const n=m(),o=r(()=>[{icon:Ga,label:ge,value:!0,selectedBgColor:n.v2.colors.green[800]},{icon:Ka,label:be,value:!1,selectedBgColor:n.v2.colors.silver[500]}],[n]);return t(B,{size:fe.S,options:o,selected:e,setSelected:a??(()=>{}),disabled:!a})},ko=()=>{const e=se();switch(e.formType){case re.Create:return t(To,{category:e.category,formData:e.formData,onChange:e.handleChange,sourceOptions:e.sourceOptions,namespaceOptions:e.namespaceOptions,renderAction:()=>t(wo,{value:!e.formData.disabled,onChange:t=>e.handleChange({disabled:!t})})});case re.View:return e.data?e.isEditing?t(To,{category:e.data.category,formData:e.formData,onChange:e.handleChange,sourceOptions:e.sourceOptions,namespaceOptions:e.namespaceOptions,renderAction:()=>t(wo,{value:!e.formData.disabled,onChange:t=>e.handleChange({disabled:!t})})}):t(Ao,{data:e.data,renderAction:()=>t(So,{value:!e.data?.rule.disabled})}):null;case re.EditAutoNoisy:return t(No,{enabled:e.localEnabled,summary:e.summary,inactiveTitle:he,sectionTitle:pe,sectionSubTitle:ue,presetLabel:de,customInputName:"sampling-auto-input-custom-percentage",percentageMode:e.percentageMode,setPercentageMode:e.setPercentageMode,percentagePreset:e.percentagePreset,setPercentagePreset:e.setPercentagePreset,customPercentage:e.customPercentage,setCustomPercentage:e.setCustomPercentage,renderAction:()=>t(wo,{value:e.localEnabled,onChange:e.setLocalEnabled})});case re.EditAutoCostReduction:return t(No,{enabled:e.localEnabled,summary:e.summary,inactiveTitle:me,sectionTitle:pe,sectionSubTitle:ue,presetLabel:de,customInputName:"sampling-cr-auto-input-custom-percentage",showModeToggle:!1,percentageMode:e.percentageMode,setPercentageMode:e.setPercentageMode,percentagePreset:e.percentagePreset,setPercentagePreset:e.setPercentagePreset,customPercentage:e.customPercentage,setCustomPercentage:e.setCustomPercentage,renderAction:()=>t(wo,{value:e.localEnabled,onChange:e.setLocalEnabled})});case re.EditAutoHighlyRelevant:return t(vo,{children:t($n,{title:e.localEnabled?void 0:ce,summary:e.summary,renderAction:()=>t(wo,{value:e.localEnabled,onChange:e.setLocalEnabled})})})}},To=({category:a,formData:n,onChange:o,sourceOptions:i,namespaceOptions:l,renderAction:s})=>e(vo,{children:[t(On,{category:a,formState:n,renderAction:s}),e(Co,{$faded:!!n.disabled,children:[t(Pn,{category:a,formState:n,onChange:o}),t(Fn,{formState:n,onChange:o,sourceOptions:i,namespaceOptions:l}),t(Mn,{category:a,formState:n,onChange:o}),"highlyRelevant"===a&&t(Ln,{formState:n,onChange:o}),"highlyRelevant"===a&&t(Vn,{ruleType:n.ruleType,formState:n,onChange:o}),t(Bn,{category:a,formState:n,onChange:o})]})]}),Ao=({data:a,renderAction:n})=>e(vo,{children:[t(On,{readOnly:!0,summary:a.summary,renderAction:n}),t(Pn,{readOnly:!0,data:a}),t(Fn,{readOnly:!0,scopes:a.rule.sourceScopes??[]}),t(Mn,{readOnly:!0,data:a}),t(Bn,{readOnly:!0,data:a}),"highlyRelevant"===a.category&&t(Vn,{readOnly:!0,rule:a.rule})]}),No=({enabled:a,summary:n,inactiveTitle:o,sectionTitle:i,sectionSubTitle:l,presetLabel:s,customInputName:r,showModeToggle:d=!0,percentageMode:u,setPercentageMode:p,percentagePreset:m,setPercentagePreset:h,customPercentage:b,setCustomPercentage:f,renderAction:y})=>{const v=c(e=>p(e),[p]),C=c(e=>h(e),[h]),S=c(e=>f(e.target.value),[f]),w=!d||"sample"===u;return e(vo,{children:[t($n,{title:a?void 0:o,summary:n,renderAction:y}),t(Co,{$faded:!a,children:e(ye,{richTitle:{title:i,subTitle:l},children:[d&&t(g,{$alignItems:"flex-start",children:t(B,{size:fe.S,options:yo,selected:u,setSelected:v})}),w&&t(Rn,{description:s,options:xn,selected:m,onSelect:C,customName:r,customLabel:ve,customPlaceholder:"5%",customValue:b,onCustomChange:S})]})})]})},Io=p.div`
13
23
  display: flex;
14
24
  align-items: center;
15
25
  justify-content: space-between;
@@ -22,32 +32,32 @@ import{jsxs as e,jsx as t,Fragment as a}from"react/jsx-runtime";import{useEffect
22
32
  &:hover {
23
33
  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]};
24
34
  }
25
- `,ko=p.div`
35
+ `,Do=p.div`
26
36
  display: flex;
27
37
  align-items: center;
28
38
  justify-content: center;
29
39
  padding: 8px;
30
40
  border-radius: 8px;
31
41
  background-color: ${({theme:e})=>e.v2.colors.white[500]+Ce["004"]};
32
- `,To=({dataId:a,icon:n,title:o,description:l,withCarret:i,purpleColors:s,disabled:r,children:c,isSelected:d,onClick:u,isChecked:p,isPartiallyChecked:h,onCheckboxChange:b})=>{const y=m();return e(wo,{"data-id":a||`list-item-${o}`,$isSelected:d,$purpleColors:s,$disabled:r,onClick:()=>!d&&!r&&u(),children:[e(g,{$gap:4,children:[e(D,{$gap:12,children:[b&&t(f,{partiallyChecked:h||!1,value:p||!1,onChange:e=>b(e)}),n&&t(ko,{children:t(n,{size:20})}),t(L,{size:M.XS,children:o})]}),l&&t(L,{size:M.XXXS,color:y.v2.colors.silver[200],children:l})]}),(i||c)&&e(D,{$gap:8,children:[c,i&&t(Za,{size:18})]})]})},No=p.div`
42
+ `,Eo=({dataId:a,icon:n,title:o,description:i,withCarret:l,purpleColors:s,disabled:r,children:c,isSelected:d,onClick:u,isChecked:p,isPartiallyChecked:h,onCheckboxChange:b})=>{const y=m();return e(Io,{"data-id":a||`list-item-${o}`,$isSelected:d,$purpleColors:s,$disabled:r,onClick:()=>!d&&!r&&u(),children:[e(g,{$gap:4,children:[e(D,{$gap:12,children:[b&&t(f,{partiallyChecked:h||!1,value:p||!1,onChange:e=>b(e)}),n&&t(Do,{children:t(n,{size:20})}),t(M,{size:L.XS,children:o})]}),i&&t(M,{size:L.XXXS,color:y.v2.colors.silver[200],children:i})]}),(l||c)&&e(D,{$gap:8,children:[c,l&&t(Za,{size:18})]})]})},$o=p.div`
33
43
  display: flex;
34
44
  align-items: center;
35
45
  gap: 8px;
36
46
  padding: 8px;
37
- `,Ao=({onClose:a,selectedConnectionIds:n,setSelectedConnectionIds:o,createAction:l,withOverlay:s})=>{const c=m(),[u,p]=i(""),h=d(null),{selectedOption:g,onSelectOption:b,genericForm:f,validateFormData:y,errorMessage:v}=P(),C=r(()=>(u?Se.filter(e=>e?.label?.toLowerCase().includes(u.toLowerCase())):Se).filter(e=>!!e),[u]),S=r(()=>(u?we.filter(e=>e?.label?.toLowerCase().includes(u.toLowerCase())):we).filter(e=>!!e),[u]),w=r(()=>{const a=(a,n)=>e(No,{children:[t(L,{size:M.XS,color:c.v2.colors.silver[200],children:a}),t(oe,{label:n.toString()})]},a),n=e=>{const a=g?.type===e.type;return t(To,{dataId:e.type?`option-${e.type}`:void 0,title:e.label,description:e.description,withCarret:!0,isSelected:a,onClick:()=>{h.current?.clearErrors(),b(e)}},e.type)};return[a("Attributes",C.length),...C.map(n),a("Samplers",S.length),...S.map(n)]},[c,g?.type,C.length,S.length,b]),k=r(()=>g?[t(oo,{},g.type)]:[t(ke,{$height:"100%",children:t(F,{icon:en,title:"Action not selected",subTitle:"Please select an action to add"})},"no-data")],[g]);return t(Bn,{ref:h,isOpen:!0,withOverlay:s,onClose:a,onSave:async()=>{const{errorMessage:e,preparedFormData:t}=y();return e?Promise.resolve({error:e}):await l(t)},disableSave:!g||!f?.isFormDirty,isFormDirty:f?.isFormDirty,hideDirtyNote:!0,errorMessage:v,progress:{title:Te.CREATING_ACTION,subTitle:Te.CREATING_ACTION_SUBTITLE},header:{icon:en,title:Te.ADD_ACTION,subTitle:Te.ADD_ACTION_DESCRIPTION},connectionIds:n&&o?{value:n,setValue:o}:void 0,search:{value:u,onChange:p},leftColumn:{width:"40%",list:w},rightColumn:{width:"60%",list:k}})},Io=({testConnection:e})=>{const{activeForm:a}=U();return{width:"60%",list:a?[t(so,{testConnection:e},a.option.type)]:[t(ke,{$height:"100%",children:t(F,{icon:tn,title:"Select destination from the list",subTitle:"Add destination so your data has somewhere to go."})},"no-data")]}},Do=p.div`
47
+ `,Ro=({onClose:a,selectedConnectionIds:n,setSelectedConnectionIds:o,createAction:i,withOverlay:s})=>{const c=m(),[u,p]=l(""),h=d(null),{selectedOption:g,onSelectOption:b,genericForm:f,validateFormData:y,errorMessage:v}=P(),C=r(()=>(u?Se.filter(e=>e?.label?.toLowerCase().includes(u.toLowerCase())):Se).filter(e=>!!e),[u]),S=r(()=>(u?we.filter(e=>e?.label?.toLowerCase().includes(u.toLowerCase())):we).filter(e=>!!e),[u]),w=r(()=>{const a=(a,n)=>e($o,{children:[t(M,{size:L.XS,color:c.v2.colors.silver[200],children:a}),t(oe,{label:n.toString()})]},a),n=e=>{const a=g?.type===e.type;return t(Eo,{dataId:e.type?`option-${e.type}`:void 0,title:e.label,description:e.description,withCarret:!0,isSelected:a,onClick:()=>{h.current?.clearErrors(),b(e)}},e.type)};return[a("Attributes",C.length),...C.map(n),a("Samplers",S.length),...S.map(n)]},[c,g?.type,C.length,S.length,b]),k=r(()=>g?[t(io,{},g.type)]:[t(ke,{$height:"100%",children:t(F,{icon:en,title:"Action not selected",subTitle:"Please select an action to add"})},"no-data")],[g]);return t(zn,{ref:h,isOpen:!0,withOverlay:s,onClose:a,onSave:async()=>{const{errorMessage:e,preparedFormData:t}=y();return e?Promise.resolve({error:e}):await i(t)},disableSave:!g||!f?.isFormDirty,isFormDirty:f?.isFormDirty,hideDirtyNote:!0,errorMessage:v,progress:{title:Te.CREATING_ACTION,subTitle:Te.CREATING_ACTION_SUBTITLE},header:{icon:en,title:Te.ADD_ACTION,subTitle:Te.ADD_ACTION_DESCRIPTION},connectionIds:n&&o?{value:n,setValue:o}:void 0,search:{value:u,onChange:p},leftColumn:{width:"40%",list:w},rightColumn:{width:"60%",list:k}})},xo=({destinationsByCategory:n,filters:o,setFilters:i})=>{const l=r(()=>Object.values(Ae).map(e=>({id:e,label:e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()})).filter(e=>n[e.id]?.length),[n]),s=r(()=>{const e=Object.values(H).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(Ne,{placeholder:"Select category",options:l,values:o.categoryType?[o.categoryType]:[],setValues:e=>i({...o,categoryType:o.categoryType===e[0]?null:e[0]})}),t(B,{size:fe.S,options:s,selected:o.signalType,setSelected:e=>i({...o,signalType:e})})]})},Oo=p.div`
38
48
  display: flex;
39
49
  flex-direction: column;
40
50
  padding: 8px;
41
51
  border-radius: 16px;
42
52
  border: ${({$purpleColors:e,theme:t})=>e?`1px solid ${t.v2.colors.purple[500]}`:"1px solid transparent"};
43
53
  background-color: ${({$noBgColor:e,$purpleColors:t,theme:a})=>e?"transparent":t?a.v2.colors.purple[900]:a.v2.colors.silver[800]};
44
- `,Eo=p.div`
54
+ `,Po=p.div`
45
55
  display: flex;
46
56
  align-items: center;
47
57
  justify-content: space-between;
48
58
  gap: 12px;
49
59
  padding: ${({$isOpen:e})=>e?"2px 12px 8px 12px":"2px 12px"};
50
- `,$o=({title:a,tooltip:n,list:o,noBgColor:l,purpleColors:s})=>{const[r,c]=i(!0);return e(Do,{"data-id":`collapse-${a}`,$noBgColor:l,$purpleColors:s,children:[e(Eo,{$isOpen:r,children:[e(D,{$gap:10,children:[t(L,{size:M.XS,children:a}),n&&t(q,{text:n,withIcon:!0}),t(oe,{label:o.length,status:s?X.Default:void 0})]}),t(Ne,{icon:r?an:nn,size:Ae.M,onClick:()=>c(e=>!e)})]}),r?t(g,{children:o.length?u.toArray(o):t(ke,{$padding:"12px 0",children:t(F,{})})}):null]})},Ro=(e,t,a)=>t||a.signalType?e.filter(e=>e.displayName.toLowerCase().includes(t.toLowerCase())&&(!a.signalType||G(e.supportedSignals).includes(a.signalType))):e,xo=({option:e,formData:a,testResult:n,isSelected:o,onSelect:l})=>t(To,{icon:$e(e.type).icon,title:a?.name||e.displayName,withCarret:!0,purpleColors:!!a,isSelected:o,onClick:()=>l(),children:n&&t(oe,{status:n.succeeded?X.Success:X.Error,leftIcon:n.succeeded?on:ln})}),Oo=({listType:e,destinationOptions:a,unsavedDestinations:n})=>{const{activeForm:o,onChangeActiveForm:l}=U();return a?.length?t($o,{title:Ee[e].TITLE,tooltip:Ee[e].DESCRIPTION,list:a.map((a,n)=>t(xo,{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($o,{purpleColors:!0,title:Ee[e].TITLE,tooltip:Ee[e].DESCRIPTION,list:n.map(({option:a,formData:n,testResult:i},s)=>t(xo,{option:a,formData:n,testResult:i,isSelected:o?.unsavedIdx===s&&o?.listType===e,onSelect:()=>l({listType:e,option:a,unsavedIdx:s})},`${e}-${s}`))},e):void 0},Po=({isFetching:e,destinationsByCategory:a,searchText:n,filters:o})=>{const{unsavedDestinations:l}=U();return{width:"40%",list:r(()=>{const i=[];l.length&&i.push(t(Oo,{listType:Ie.UNSAVED,unsavedDestinations:l},"unsaved"));for(const e of Object.values(Ie)){if(o.categoryType&&o.categoryType!==e)continue;const l=Ro(a[e],n,o);l.length&&i.push(t(Oo,{listType:e,destinationOptions:l},e))}return e&&i.push(t(ke,{children:t(De,{title:"Fetching destinations",withSpinner:!0})},"loading-more")),i},[l,a,n,o,e])}},Fo=({destinationsByCategory:n,filters:o,setFilters:l})=>{const i=r(()=>Object.values(Ie).map(e=>({id:e,label:e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()})).filter(e=>n[e.id]?.length),[n]),s=r(()=>{const e=Object.values(H).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(Re,{placeholder:"Select category",options:i,values:o.categoryType?[o.categoryType]:[],setValues:e=>l({...o,categoryType:o.categoryType===e[0]?null:e[0]})}),t(B,{size:xe.S,options:s,selected:o.signalType,setSelected:e=>l({...o,signalType:e})})]})};var Lo;!function(e){e.SELF_HOSTED="self hosted",e.MANAGED="managed"}(Lo||(Lo={}));const Mo=(e,t)=>{const a=[],n=[],o=[];return e&&e.destinationCategories.categories.forEach(e=>{e.name===Lo.SELF_HOSTED?n.push(...e.items):e.name===Lo.MANAGED&&o.push(...e.items)}),t&&t?.potentialDestinations.forEach(t=>{for(const n of e?.destinationCategories?.categories||[]){const e=Oe(n),o=e.items.findIndex(e=>e.type===t.type);if(-1!==o){const n=Pe(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]))}}}),{[Ie.DETECTED]:a,[Ie.SELF_HOSTED]:n,[Ie.MANAGED]:o}},Vo=({onClose:e,onBack:a,onNext:o,selectedConnectionIds:l,setSelectedConnectionIds:s,getDestinationCategories:r,getPotentialDestinations:d,initialInputs:u,testConnection:p,createDestination:m,updateDestination:h,withOverlay:g,disableAnimation:b})=>{const[f,y]=i(""),[v,C]=i({categoryType:null,signalType:null}),{destinations:S}=Fe(),{activeForm:w,genericForm:k,formErrorMessage:T,unsavedDestinations:N,setUnsavedDestinations:A}=U();n(()=>{u&&A(u)},[u]);const[I,D]=i(!0),[E,$]=i([]),[R,x]=i({[Ie.ALL]:[],[Ie.UNSAVED]:[],[Ie.EXISTS]:[],[Ie.DETECTED]:[],[Ie.SELF_HOSTED]:[],[Ie.MANAGED]:[]});n(()=>{const e=S.map(e=>{let t;for(const a of E){const n=a.items.find(t=>t.type===e.destinationType.type);if(n){t=n;break}}const a=Pe(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})):[]}});x(t=>({...t,[Ie.EXISTS]:e}))},[S,E]);const O=c(async()=>{try{D(!0);const[e,t]=await Promise.all([r(),d()]);e&&$(e.destinationCategories.categories),x(a=>({...a,...Mo(e,t)}))}catch(e){}finally{D(!1)}},[]);n(()=>{O()},[]);const P=c(async()=>{const e=(await Promise.all(N.map(({option:e,formData:t})=>{const a=K(t);if(e.id){const t=Object.fromEntries(e.fields.map(e=>[e.name,e.initialValue??""])),n=Object.fromEntries(a.fields.map(e=>[e.key,e.value??""]));if(!Object.keys(t).some(e=>t[e]!==n[e]))return h(e.id,a,l)}return m(a,l)}))).filter(e=>e?.error);if(e.length)return{error:e.map(e=>e?.error).join("\n")}},[N,l,m,h]);return t(Bn,{isOpen:!0,withOverlay:g,disableAnimation:b,onClose:e,onBack:a?()=>a(N):void 0,onNext:o?()=>o(N):void 0,nextIsSkip:!N.length,onSave:P,disableSave:!w&&!N.length,isFetching:I,errorMessage:T,isFormDirty:N.length>0||k?.isFormDirty,hideDirtyNote:!0,progress:{title:Te.CREATING_DESTINATION,subTitle:Te.CREATING_DESTINATION_SUBTITLE},header:{icon:tn,title:Te.ADD_DESTINATIONS,subTitle:Te.ADD_DESTINATION_DRAWER_DESCRIPTION},connectionIds:l&&s?{value:l,setValue:s}:void 0,search:{value:f,onChange:y},filters:t(Fo,{destinationsByCategory:R,filters:v,setFilters:C}),leftColumn:Po({isFetching:I,destinationsByCategory:R,searchText:f,filters:v}),rightColumn:Io({testConnection:p})})},Bo=({onClose:e,selectedConnectionIds:a,setSelectedConnectionIds:n,createInstrumentationRule:o,withOverlay:l})=>{const[s,c]=i(""),u=d(null),{selectedOption:p,onSelectOption:m,genericForm:h,validateFormData:g,errorMessage:b}=ne(),f=r(()=>s?Le.filter(e=>e.label.toLowerCase().includes(s.toLowerCase())):Le,[s]),y=r(()=>f.map(e=>{const a=p?.type===e.type;return t(To,{dataId:`option-${e.type}`,title:e.label,description:e.description,withCarret:!0,isSelected:a,onClick:()=>{u.current?.clearErrors(),m(e)}},e.type)}),[p,f.length,m]),v=r(()=>p?[t(bo,{},p.type)]:[t(ke,{$height:"100%",children:t(F,{icon:sn,title:"Instrumentation rule not selected",subTitle:"Please select an instrumentation rule to add"})},"no-data")],[p]);return t(Bn,{ref:u,isOpen:!0,withOverlay:l,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:b,progress:{title:Te.CREATING_INSTRUMENTATION_RULE,subTitle:Te.CREATING_INSTRUMENTATION_RULE_SUBTITLE},header:{icon:sn,title:Te.ADD_INSTRUMENTATION_RULE,subTitle:Te.ADD_INSTRUMENTATION_RULE_DESCRIPTION},connectionIds:a&&n?{value:a,setValue:n}:void 0,search:{value:s,onChange:c},leftColumn:{width:"40%",list:y},rightColumn:{width:"60%",list:v}})},zo=p.div``,_o=p.div`
60
+ `,Fo=({title:a,tooltip:n,list:o,noBgColor:i,purpleColors:s})=>{const[r,c]=l(!0);return e(Oo,{"data-id":`collapse-${a}`,$noBgColor:i,$purpleColors:s,children:[e(Po,{$isOpen:r,children:[e(D,{$gap:10,children:[t(M,{size:L.XS,children:a}),n&&t(q,{text:n,withIcon:!0}),t(oe,{label:o.length,status:s?X.Default:void 0})]}),t(Ie,{icon:r?an:nn,size:De.M,onClick:()=>c(e=>!e)})]}),r?t(g,{children:o.length?u.toArray(o):t(ke,{$padding:"12px 0",children:t(F,{})})}):null]})},Mo=(e,t,a)=>t||a.signalType?e.filter(e=>e.displayName.toLowerCase().includes(t.toLowerCase())&&(!a.signalType||G(e.supportedSignals).includes(a.signalType))):e,Lo=({option:e,formData:a,testResult:n,isSelected:o,onSelect:i})=>t(Eo,{icon:Re(e.type).icon,title:a?.name||e.displayName,withCarret:!0,purpleColors:!!a,isSelected:o,onClick:()=>i(),children:n&&t(oe,{status:n.succeeded?X.Success:X.Error,leftIcon:n.succeeded?on:ln})}),Vo=({listType:e,destinationOptions:a,unsavedDestinations:n})=>{const{activeForm:o,onChangeActiveForm:i}=U();return a?.length?t(Fo,{title:$e[e].TITLE,tooltip:$e[e].DESCRIPTION,list:a.map((a,n)=>t(Lo,{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:()=>i({listType:e,option:a})},`${e}-${a.id??a.type}-${n}`))}):n?.length?t(Fo,{purpleColors:!0,title:$e[e].TITLE,tooltip:$e[e].DESCRIPTION,list:n.map(({option:a,formData:n,testResult:l},s)=>t(Lo,{option:a,formData:n,testResult:l,isSelected:o?.unsavedIdx===s&&o?.listType===e,onSelect:()=>i({listType:e,option:a,unsavedIdx:s})},`${e}-${s}`))},e):void 0};var Bo;!function(e){e.SELF_HOSTED="self hosted",e.MANAGED="managed"}(Bo||(Bo={}));const zo=(e,t)=>{const a=[],n=[],o=[];return e&&e.destinationCategories.categories.forEach(e=>{e.name===Bo.SELF_HOSTED?n.push(...e.items):e.name===Bo.MANAGED&&o.push(...e.items)}),t&&t?.potentialDestinations.forEach(t=>{for(const n of e?.destinationCategories?.categories||[]){const e=xe(n),o=e.items.findIndex(e=>e.type===t.type);if(-1!==o){const n=Oe(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]))}}}),{[Ae.DETECTED]:a,[Ae.SELF_HOSTED]:n,[Ae.MANAGED]:o}},_o=({onClose:e,onBack:a,onNext:o,selectedConnectionIds:i,setSelectedConnectionIds:s,getDestinationCategories:d,getPotentialDestinations:u,initialInputs:p,testConnection:m,createDestination:h,updateDestination:g,withOverlay:b,disableAnimation:f})=>{const[y,v]=l(""),[C,S]=l({categoryType:null,signalType:null}),{destinations:w}=Pe(),{activeForm:k,genericForm:T,formErrorMessage:A,unsavedDestinations:N,setUnsavedDestinations:I}=U();n(()=>{p&&I(p)},[p]);const[D,E]=l(!0),[$,R]=l([]),[x,O]=l({[Ae.ALL]:[],[Ae.UNSAVED]:[],[Ae.EXISTS]:[],[Ae.DETECTED]:[],[Ae.SELF_HOSTED]:[],[Ae.MANAGED]:[]});n(()=>{const e=w.map(e=>{let t;for(const a of $){const n=a.items.find(t=>t.type===e.destinationType.type);if(n){t=n;break}}const a=Oe(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})):[]}});O(t=>({...t,[Ae.EXISTS]:e}))},[w,$]);const P=c(async()=>{try{E(!0);const[e,t]=await Promise.all([d(),u()]);e&&R(e.destinationCategories.categories),O(a=>({...a,...zo(e,t)}))}catch(e){}finally{E(!1)}},[]);n(()=>{P()},[]);const M=c(async()=>{const e=(await Promise.all(N.map(({option:e,formData:t})=>{const a=K(t);if(e.id){const t=Object.fromEntries(e.fields.map(e=>[e.name,e.initialValue??""])),n=Object.fromEntries(a.fields.map(e=>[e.key,e.value??""]));if(!Object.keys(t).some(e=>t[e]!==n[e]))return g(e.id,a,i)}return h(a,i)}))).filter(e=>e?.error);if(e.length)return{error:e.map(e=>e?.error).join("\n")}},[N,i,h,g]),L=(({isFetching:e,destinationsByCategory:a,searchText:n,filters:o})=>{const{unsavedDestinations:i}=U();return{width:"40%",list:r(()=>{const l=[];i.length&&l.push(t(Vo,{listType:Ae.UNSAVED,unsavedDestinations:i},"unsaved"));for(const e of Object.values(Ae)){if(o.categoryType&&o.categoryType!==e)continue;const i=Mo(a[e],n,o);i.length&&l.push(t(Vo,{listType:e,destinationOptions:i},e))}return e&&l.push(t(ke,{children:t(Ee,{title:"Fetching destinations",withSpinner:!0})},"loading-more")),l},[i,a,n,o,e])}})({isFetching:D,destinationsByCategory:x,searchText:y,filters:C}),V=(({testConnection:e})=>{const{activeForm:a}=U();return{width:"60%",list:a?[t(ro,{testConnection:e},a.option.type)]:[t(ke,{$height:"100%",children:t(F,{icon:tn,title:"Select destination from the list",subTitle:"Add destination so your data has somewhere to go."})},"no-data")]}})({testConnection:m});return t(zn,{isOpen:!0,withOverlay:b,disableAnimation:f,onClose:e,onBack:a?()=>a(N):void 0,onNext:o?()=>o(N):void 0,nextIsSkip:!N.length,onSave:M,disableSave:!k&&!N.length,isFetching:D,errorMessage:A,isFormDirty:N.length>0||T?.isFormDirty,hideDirtyNote:!0,progress:{title:Te.CREATING_DESTINATION,subTitle:Te.CREATING_DESTINATION_SUBTITLE},header:{icon:tn,title:Te.ADD_DESTINATIONS,subTitle:Te.ADD_DESTINATION_DRAWER_DESCRIPTION},connectionIds:i&&s?{value:i,setValue:s}:void 0,search:{value:y,onChange:v},filters:t(xo,{destinationsByCategory:x,filters:C,setFilters:S}),leftColumn:L,rightColumn:V})},Uo=({onClose:e,selectedConnectionIds:a,setSelectedConnectionIds:n,createInstrumentationRule:o,withOverlay:i})=>{const[s,c]=l(""),u=d(null),{selectedOption:p,onSelectOption:m,genericForm:h,validateFormData:g,errorMessage:b}=ne(),f=r(()=>s?Fe.filter(e=>e.label.toLowerCase().includes(s.toLowerCase())):Fe,[s]),y=r(()=>f.map(e=>{const a=p?.type===e.type;return t(Eo,{dataId:`option-${e.type}`,title:e.label,description:e.description,withCarret:!0,isSelected:a,onClick:()=>{u.current?.clearErrors(),m(e)}},e.type)}),[p,f.length,m]),v=r(()=>p?[t(fo,{},p.type)]:[t(ke,{$height:"100%",children:t(F,{icon:sn,title:"Instrumentation rule not selected",subTitle:"Please select an instrumentation rule to add"})},"no-data")],[p]);return t(zn,{ref:u,isOpen:!0,withOverlay:i,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:b,progress:{title:Te.CREATING_INSTRUMENTATION_RULE,subTitle:Te.CREATING_INSTRUMENTATION_RULE_SUBTITLE},header:{icon:sn,title:Te.ADD_INSTRUMENTATION_RULE,subTitle:Te.ADD_INSTRUMENTATION_RULE_DESCRIPTION},connectionIds:a&&n?{value:a,setValue:n}:void 0,search:{value:s,onChange:c},leftColumn:{width:"40%",list:y},rightColumn:{width:"60%",list:v}})},jo=p.div``,Xo=p.div`
51
61
  visibility: hidden;
52
62
 
53
63
  transition: visibility 0s;
@@ -55,19 +65,19 @@ import{jsxs as e,jsx as t,Fragment as a}from"react/jsx-runtime";import{useEffect
55
65
  transition-duration: 0s;
56
66
  }
57
67
 
58
- ${zo}:hover & {
68
+ ${jo}:hover & {
59
69
  visibility: visible;
60
70
  }
61
- `,Uo=({workloadName:e,workloadKind:a,isChecked:n,onToggle:o,disabled:l,disabledReason:i})=>{const s=m(),r=()=>{};return t(zo,{children:t(To,{dataId:`source-${e}`,title:e,disabled:l,onClick:l?r:o,isChecked:n,onCheckboxChange:l?r:o,children:l&&i?t(oe,{label:i,status:X.Default,textSize:M.XXXS}):t(_o,{children:t(oe,{label:a,status:X.Info,textSize:M.XXXS,backgroundColor:s.v2.colors.blue[900]})})})})},jo=({formData:a,handleSourceChange:n,handleSelectAll:o,selectedArea:l,searchText:i,searchBy:s,filters:c})=>{const{tier:d}=Me(),u=d===_e.Onprem,p=r(()=>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=r(()=>p?[...p.workloads].sort((e,t)=>e.name.localeCompare(t.name)).filter(e=>Ve(e,i,c)):[],[p,i,c]),h=r(()=>!!m.length&&m.every(({selected:e})=>e),[m]),g=r(()=>{if(!p)return[];const{clusterId:e}=l.value,{name:a}=p;return m.map(({name:o,selected:l,kind:i})=>{const s=!u&&Be.has(i);return t(Uo,{workloadName:o,workloadKind:i,isChecked:!s&&(l||!1),onToggle:()=>n({clusterId:e,workloadId:{namespace:a,name:o,kind:i}}),disabled:s,disabledReason:"Enterprise only"},`${e}#${a}#${o}#${i}`)})},[m,p,l.value.clusterId]),{withFilterCount:b,filteredCount:f,totalCount:y}=r(()=>{const e=p?.workloads.length??0;return{withFilterCount:m.length!==e,filteredCount:m.length,totalCount:e}},[m,p]);return{width:"40%",header:e(D,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(D,{$gap:8,children:[t(L,{size:M.XS,nowrap:!0,children:l.value.namespaceName?`${l.value.namespaceName} > Workloads`:"Workloads"}),t(q,{text:b?Te.FILTERED_COUNT_TOOLTIP:void 0,children:t(oe,{label:`${b?`${f} / ${y}`:y}`,status:ze.Unknown})})]}),t(L,{"data-id":"workloads-select-all",onClick:()=>o({clusterId:l.value.clusterId,namespaceName:l.value.namespaceName,boolean:!h,searchText:i,searchBy:s,filters:c}),disabled:!g.length,size:M.XS,children:(h?"Unselect":"Select")+" all"})]}),list:g.length?g:[t(ke,{$height:"100%",children:t(F,p?i?{icon:rn,title:"No matches",subTitle:`No sources matched the filter '${i}'`}:{icon:rn,title:"No sources",subTitle:"No sources found in this namespace"}:{icon:rn,title:Te.SELECT_NAMESPACE,subTitle:Te.SELECT_NAMESPACE_SUBTITLE})},"no-data")]}},Xo=p.div``,Ho=p.div`
71
+ `,Ho=({workloadName:e,workloadKind:a,isChecked:n,onToggle:o,disabled:i,disabledReason:l})=>{const s=m(),r=()=>{};return t(jo,{children:t(Eo,{dataId:`source-${e}`,title:e,disabled:i,onClick:i?r:o,isChecked:n,onCheckboxChange:i?r:o,children:i&&l?t(oe,{label:l,status:X.Default,textSize:L.XXXS}):t(Xo,{children:t(oe,{label:a,status:X.Info,textSize:L.XXXS,backgroundColor:s.v2.colors.blue[900]})})})})},Wo=p.div``,Go=p.div`
62
72
  visibility: ${({$visible:e})=>e?"visible":"hidden"};
63
73
 
64
74
  transition: visibility 0s;
65
75
  ${({$visible:e})=>!e&&"& * {\n transition-duration: 0s !important;\n }"}
66
76
 
67
- ${Xo}:hover & {
77
+ ${Wo}:hover & {
68
78
  visibility: visible;
69
79
  }
70
- `,Wo=({clusterId:a,namespaceName:n,checkbox:o,isFutureApps:l,selectedCounts:i,isActive:s,onActive:r,handleSourceChange:c})=>{const d=m(),u=e=>{r(),c({clusterId:a,workloadId:{namespace:n},auto:e.auto,selected:e.all})};return t(Xo,{children:t(To,{dataId:`namespace-${n}`,withCarret:!0,title:n,isSelected:s,onClick:r,isPartiallyChecked:o.partial,isChecked:o.all,onCheckboxChange:e=>u({auto:e,all:e}),children:e(D,{$gap:12,children:[t(Ho,{$visible:s||l,children:t(q,{text:"Automatically instrument all workloads currently in the namespace, and all workloads that will be deployed to this namespace in the future",children:t(T,{label:"Auto",size:Ue.S,value:l,onChange:e=>u({auto:e,all:e||void 0})})})}),e(D,{$gap:8,children:[t(L,{variant:je.Span,size:M.XXXS,color:d.v2.colors.silver[200],align:"right",children:"Selected"}),t(oe,{label:`${i.sourced}/${i.total}`,status:s?X.Default:ze.Unknown,minWidth:"42px"})]})]})})})},Go=({withCollapse:e,clusterId:a,clusterName:n,namespaces:o,selectedArea:l,setSelectedArea:i,handleSourceChange:s})=>{const c=r(()=>o.map(({name:e,totalWorkloads:o,selectedCount:r,isAllSourced:c,isSomeSourced:d,isFutureApps:u})=>t(Wo,{clusterId:a,namespaceName:e,isFutureApps:u,checkbox:{all:c,partial:d},selectedCounts:{sourced:r,total:o},isActive:l.clusterId===a&&l.namespaceName===e,onActive:()=>i({clusterId:a,clusterName:n,namespaceName:e}),handleSourceChange:s},`${a}#${e}`)),[a,n,o,l]);return e?t($o,{title:n,list:c,noBgColor:!0}):c},Ko=({isFetching:a,formData:n,handleSourceChange:o,handleSelectAll:l,selectedArea:i,setSelectedArea:s,searchText:c,searchBy:d,filters:u})=>{const p=r(()=>n.map(e=>{const t=[...e.namespaces].sort((e,t)=>e.name.localeCompare(t.name)).filter(e=>Xe(e,c,u)).map(e=>({name:e.name,totalWorkloads:e.workloads.length,...He(e)}));return{clusterId:e.clusterId,clusterName:e.clusterName,visibleNamespaces:t}}),[n,c,u]),m=r(()=>{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:g,filteredCount:b,totalCount:f}=r(()=>{const e=p.map(({clusterId:e,clusterName:a,visibleNamespaces:n})=>n.length?t(Go,{withCollapse:p.length>1,clusterId:e,clusterName:a,namespaces:n,selectedArea:i,setSelectedArea:s,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,i]);return{width:"60%",header:e(D,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(D,{$gap:8,children:[t(L,{size:M.XS,nowrap:!0,children:"Namespaces"}),t(q,{text:g?Te.FILTERED_COUNT_TOOLTIP:void 0,children:t(oe,{label:`${g?`${b} / ${f}`:f}`,status:ze.Unknown})})]}),t(L,{"data-id":"namespaces-select-all",onClick:()=>l({boolean:!m,searchText:c,searchBy:d,filters:u}),disabled:!h.length,size:M.XS,children:(m?"Unselect":"Select")+" all"})]}),list:h.length?h:a?[t(ke,{$height:"100%",children:t(De,{title:Te.FETCHING_NAMESPACES,subTitle:Te.FETCHING_NAMESPACES_SUBTITLE,withSpinner:!0})},"loading")]:[t(ke,{$height:"100%",children:t(F,c?{icon:cn,title:"No matches",subTitle:`No namespace matched the filter '${c}'`}:{icon:cn,title:"No namespaces",subTitle:"No namespaces found in this cluster"})},"no-data")]}},Yo=({onClose:a,onBack:o,onNext:l,selectedConnectionIds:s,setSelectedConnectionIds:r,persistSources:c,getAllClusterSnapshots:d,fetchNamespacesWithWorkloads:u,withOverlay:p,disableAnimation:h})=>{const g=m(),{progress:b,resetProgress:f}=We(),{isFetching:y,setIsFetching:v,setSnapshots:C,formData:S,handleSourceChange:w,handleSelectAll:k,formDiff:N,isFormDirty:A}=Ge();n(()=>{let e=!1;v(!0);return(async()=>{try{if(d){const t=await d();!e&&t&&C(t)}else if(u){const t=await u();if(!e&&t.data?.length){const e={clusters:[{clusterId:Je,clusterName:qe,namespaces:t.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}))||[]}))}]};C(e)}}}catch(e){}finally{e||v(!1)}})(),()=>{e=!0}},[]);const[I,E]=i(""),[$,R]=i(Ke.Namespace),[x,O]=i({showOnlySelected:!1}),[P,F]=i({clusterId:"",clusterName:"",namespaceName:""});return t(Bn,{isOpen:!0,withOverlay:p,disableAnimation:h,onClose:a?()=>{f(Ye.BulkInstrumenting),a()}:void 0,onBack:o?()=>o(N):void 0,onNext:l?()=>l(N):void 0,nextIsSkip:!A,onSave:()=>c(N),header:{icon:rn,title:Te.ADD_SOURCE,subTitle:Te.ADD_SOURCES_DESCRIPTION},connectionIds:s&&r?{value:s,setValue:r}:void 0,search:{value:I,onChange:e=>{E(e),$===Ke.Namespace&&F({clusterId:"",clusterName:"",namespaceName:""})},segment:{options:[{label:"Namespace",value:Ke.Namespace},{label:"Source",value:Ke.Source}],selected:$,setSelected:R}},filters:e(D,{$gap:8,children:[t(L,{size:M.XXXS,color:g.v2.colors.silver[200],nowrap:!0,children:"Show only:"}),t(T,{name:"filter-selected",size:Ue.S,label:"Selected",value:x.showOnlySelected,onChange:e=>O(t=>({...t,showOnlySelected:e}))})]}),isFormDirty:A,isFetching:y,progress:{title:Te.CREATING_SOURCES,subTitle:Te.CREATING_SOURCES_SUBTITLE,percentage:b[Ye.BulkInstrumenting]?.percentage||0},leftColumn:Ko({isFetching:y,formData:S,handleSourceChange:w,handleSelectAll:k,selectedArea:P,setSelectedArea:F,searchText:$===Ke.Namespace?I:"",searchBy:$,filters:x}),rightColumn:jo({formData:S,handleSourceChange:w,handleSelectAll:k,selectedArea:{value:P},searchText:$===Ke.Source?I:"",searchBy:$,filters:x})})},qo=({onClose:o,actionId:l,updateAction:s,deleteAction:d})=>{const u=m(),{actions:p}=Fe(),{selectedOption:h,loadAction:b,validateFormData:f,errorMessage:y,genericForm:v}=P(),[C,S]=i(!1),[w,T]=i(!1),[N,A]=i(null),I=C&&!!v?.isFormDirty,D=r(()=>p?.find(e=>Qe(e)===l),[l,p]),E=r(()=>Se.find(({type:e})=>e===D?.type)??we.find(({type:e})=>e===D?.type)??null,[D?.type]);n(()=>{D&&b(D)},[D]);const $=c(()=>{D&&S(!0)},[D]),x=c(()=>{D&&(b(D),S(!1))},[D,b]),F=c(()=>{I?A("close"):o()},[I,o]),L=c(()=>{I?A("cancel"):x()},[I,x]),M=c(()=>{const e=N;A(null),"close"===e?(x(),o()):x()},[N,x,o]),V=c(async()=>{if(D){const{errorMessage:e,preparedFormData:t}=f();e||(await s(D.id,t),S(!1))}},[D,f,s]),B=c(()=>{D&&T(!0)},[D]),z=c(async()=>{D&&(await d(D.id,D.type),o())},[D,d,o]);if(!D||!E)return null;const _=(e=>{const t=[],{type:a,fields:n}=e,o=e=>({status:e?X.Success:ze.Unknown,label:e?"True":"False",invertColors:!0});return a===O.K8sAttributes&&(t.push({id:"collectContainerAttributes",title:"Collect Container Attributes",badge:o(n.collectContainerAttributes)}),t.push({id:"collectReplicaSetAttributes",title:"Collect ReplicaSet Attributes",badge:o(n.collectReplicaSetAttributes)}),t.push({id:"collectWorkloadId",title:"Collect Workload ID",badge:o(n.collectWorkloadId)}),t.push({id:"collectClusterId",title:"Collect Cluster ID",badge:o(n.collectClusterId)}),n.labelsAttributes?.forEach(({labelKey:e,attributeKey:a,from:o,fromSources:l},i)=>{const s=l?.length?l.join(", "):o||k.Pod,r=(n.labelsAttributes?.length??0)>1?`Label #${i+1} `:"Label ";t.push({id:`label-${i}-key`,title:`${r}Key`,label:e}),t.push({id:`label-${i}-attr`,title:`${r}Attribute Key`,label:a}),t.push({id:`label-${i}-from`,title:`${r}From`,label:s})}),n.annotationsAttributes?.forEach(({annotationKey:e,attributeKey:a,from:o,fromSources:l},i)=>{const s=l?.length?l.join(", "):o||k.Pod,r=(n.annotationsAttributes?.length??0)>1?`Annotation #${i+1} `:"Annotation ";t.push({id:`annotation-${i}-key`,title:`${r}Key`,label:e}),t.push({id:`annotation-${i}-attr`,title:`${r}Attribute Key`,label:a}),t.push({id:`annotation-${i}-from`,title:`${r}From`,label:s})})),a===O.AddClusterInfo&&(t.push({id:"overwriteExistingValues",title:"Overwrite Existing Values",badge:o(n.overwriteExistingValues)}),n.clusterAttributes?.forEach(({attributeName:e,attributeStringValue:a},n)=>{t.push({id:`cluster-attr-${n}`,title:e,label:a})})),a===O.DeleteAttributes&&n.attributeNamesToDelete?.forEach((e,a)=>{t.push({id:`del-attr-${a}`,title:"Attribute"+((n.attributeNamesToDelete?.length??0)>1?` #${a+1}`:""),label:e})}),a===O.RenameAttributes&&Object.entries(n.renames||{}).forEach(([e,a],n)=>{t.push({id:`rename-${n}`,title:e,label:a})}),a===O.PiiMasking&&n.piiCategories?.forEach((e,a)=>{t.push({id:`pii-${a}`,title:"Category"+((n.piiCategories?.length??0)>1?` #${a+1}`:""),label:e})}),a===O.ErrorSampler&&t.push({id:"fallbackSamplingRatio",title:"Sampling Ratio",label:String(n.fallbackSamplingRatio??"-")}),a===O.ProbabilisticSampler&&t.push({id:"samplingPercentage",title:"Sampling Percentage",label:String(n.samplingPercentage??"-")}),a===O.LatencySampler&&n.endpointsFilters?.forEach(({serviceName:e,httpRoute:a,minimumLatencyThreshold:o,fallbackSamplingRatio:l},i)=>{const s=(n.endpointsFilters?.length??0)>1?`Endpoint #${i+1} `:"Endpoint ";t.push({id:`endpoint-${i}-service`,title:`${s}Service Name`,label:e}),t.push({id:`endpoint-${i}-route`,title:`${s}HTTP Route`,label:a}),t.push({id:`endpoint-${i}-latency`,title:`${s}Min. Latency`,label:String(o)}),t.push({id:`endpoint-${i}-fallback`,title:`${s}Fallback Sampling Ratio`,label:String(l)})}),a===O.ServiceNameSampler&&n.servicesNameFilters?.forEach(({serviceName:e,samplingRatio:a,fallbackSamplingRatio:o},l)=>{const i=(n.servicesNameFilters?.length??0)>1?`Filter #${l+1} `:"Filter ";t.push({id:`service-${l}-name`,title:`${i}Service Name`,label:e}),t.push({id:`service-${l}-ratio`,title:`${i}Sampling Ratio`,label:String(a)}),t.push({id:`service-${l}-fallback`,title:`${i}Fallback Sampling Ratio`,label:String(o)})}),a===O.SpanAttributeSampler&&n.attributeFilters?.forEach(({serviceName:e,attributeKey:a,fallbackSamplingRatio:o,condition:l},i)=>{const s=Object.keys(l)[0],r=l[s],c=(n.attributeFilters?.length??0)>1?`Filter #${i+1} `:"Filter ";t.push({id:`attr-${i}-service`,title:`${c}Service Name`,label:e}),t.push({id:`attr-${i}-key`,title:`${c}Attribute Key`,label:a}),t.push({id:`attr-${i}-fallback`,title:`${c}Fallback Sampling Ratio`,label:String(o)}),t.push({id:`attr-${i}-condition`,title:`${c}Condition`,label:s}),t.push({id:`attr-${i}-operation`,title:`${c}Operation`,label:r?.operation??"-"}),t.push({id:`attr-${i}-expected`,title:`${c}Expected Value`,label:String(r?.expectedValue??"-")}),"jsonCondition"===s&&t.push({id:`attr-${i}-jsonpath`,title:`${c}JSON Path`,label:r?.jsonPath??"-"})}),a===O.URLTemplatization&&n.urlTemplatizationRulesGroups?.forEach((e,a)=>{const o=(n.urlTemplatizationRulesGroups?.length??0)>1?`Group #${a+1} `:"Group ";e.filterK8sNamespace&&t.push({id:`group-${a}-ns`,title:`${o}Namespace`,label:e.filterK8sNamespace}),e.workloadFilters?.forEach((n,l)=>{const i=[n.kind,n.name].filter(Boolean).join("/");i&&t.push({id:`group-${a}-wf-${l}`,title:`${o}Workload${(e.workloadFilters?.length??0)>1?` #${l+1}`:""}`,label:i})});const l=e.templatizationRules?.map(e=>e.template).filter(Boolean).join(", ");l&&t.push({id:`group-${a}-templates`,title:`${o}Templates`,label:l}),e.notes&&t.push({id:`group-${a}-notes`,title:`${o}Notes`,label:e.notes})}),t})(D);return e(a,{children:[t(Ze,{isOpen:!0,header:{icon:ot(D.type),title:E.label,onClose:F,actions:[{id:"edit-action-btn-edit",label:et.EDIT,icon:qa,active:C,onClick:$},{id:"edit-action-btn-delete",label:et.DELETE,icon:Xa,color:u.v2.colors.red[500],active:w,onClick:B}]},footer:{note:C&&y?{status:X.Error,message:y}:void 0,actions:C?[{"data-id":"edit-action-btn-cancel",label:et.CANCEL,variant:R.Secondary,onClick:L},{"data-id":"edit-action-btn-save",label:et.SAVE,variant:R.Primary,onClick:V}]:[]},children:t(tt,{$padding:"4px 12px 12px",children:C&&h?t(oo,{}):t(g,{$gap:16,children:e(at,{bgTint:"1000",children:[e(at,{bgTint:"900",children:[t(nt,{conditions:D.conditions||[]}),t(at,{bgTint:"800",cellsPerRow:2,items:(U=D,j=E,[{id:"type",title:Te.TYPE,label:j.label},{id:"status",title:Te.STATUS,badge:{status:U.disabled?ze.Unknown:X.Success,label:U.disabled?Te.DISABLED:Te.ENABLED}},{id:"signals",title:Te.SIGNALS_FOR_PROCESSING,label:U.signals?.map(e=>{let t=e.toLowerCase();return t=`${t.charAt(0).toUpperCase()}${t.slice(1)}`,t}).join(", ")||"-"},{id:"name",title:Te.NAME,label:U.name||"-"},{id:"notes",title:Te.NOTES,label:U.notes||"-"}])})]}),!!_?.length&&t(at,{bgTint:"900",richTitle:{title:"Configuration"},withCollapse:!0,collapseIsDefaultOpen:!0,children:t(at,{bgTint:"800",cellsPerRow:2,items:_})})]})})})}),t(zn,{target:"action",isOpen:w,onClose:()=>T(!1),onApprove:z}),t(_n,{isOpen:null!==N,onClose:()=>A(null),onApprove:M})]});var U,j},Jo=({onClose:a,connections:o,selectedConnectionIds:l,setSelectedConnectionIds:s,getEffectiveConfig:c,onApply:d})=>{const u=m(),[p,h]=i(""),[g,b]=i({showOnlySelected:!1}),f=r(()=>o.filter(e=>{const t=!p||e.name.toLowerCase().includes(p.toLowerCase()),a=!g.showOnlySelected||g.showOnlySelected&&l.includes(e.id);return t&&a}),[o.length,l.length,p,g]),y=e=>{s(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[v,C]=i(!1),[S,w]=i(void 0),{formData:k,handleFormChange:N,areFormValuesEqual:A,resetFormData:I}=lt(S||{rollout:{automaticRolloutDisabled:!1}}),E=r(()=>l.length>1||void 0!==S&&!A(S,k),[l.length,S,k]);return n(()=>{1===l.length?(async e=>{if(v)return;C(!0);const t=await c(e);if(t){const e={rollout:{automaticRolloutDisabled:t.rollout?.automaticRolloutDisabled??!1}};w(e),I(e)}C(!1)})(l[0]):w(void 0)},[l.length]),t(Bn,{isOpen:!0,onClose:a,onSave:()=>d(k,l),header:{icon:dn,title:"Cluster Configuration"},connectionIds:{value:l,setValue:s},search:{placeholder:"Search by cluster name",value:p,onChange:h},filters:e(D,{$gap:8,children:[t(L,{size:M.XXXS,color:u.v2.colors.silver[200],nowrap:!0,children:"Show only:"}),t(T,{size:Ue.S,label:"Selected",value:g.showOnlySelected,onChange:e=>b(t=>({...t,showOnlySelected:e}))})]}),isFormDirty:E,isFetching:v,leftColumn:{width:"35%",header:e(D,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(D,{$gap:8,children:[t(L,{size:M.XS,children:"Clusters"}),t(oe,{label:f.length,status:ze.Unknown})]}),e(D,{$gap:8,children:[t(L,{size:M.XXXS,color:u.v2.colors.silver[200],align:"right",children:"Selected clusters"}),t(oe,{label:`${l.length}/${f.length}`,status:ze.Unknown})]})]}),list:f.map(e=>t(To,{title:e.name,isChecked:l.includes(e.id),onClick:()=>y(e.id),onCheckboxChange:()=>y(e.id)},e.id))},rightColumn:{width:"65%",header:t(L,{size:M.XS,children:"Configurations"}),list:[t(T,{label:"Automatic rollout disabled",tooltip:"Odigos automatically triggers a one-time rollout for workloads when instrumenting or uninstrumenting, ensuring that changes are applied without requiring manual intervention. When automatic rollout is disabled, Odigos will not restart workloads, and users will need to manually trigger rollouts after adding or removing sources.",value:k.rollout?.automaticRolloutDisabled||!1,onChange:e=>N("rollout.automaticRolloutDisabled",e)},"automatic-rollout-disabled")]}})},Qo=({onClose:o,destinationId:l,getDestinationCategories:s,testConnection:u,updateDestination:p,deleteDestination:h})=>{const b=m(),{destinations:f}=Fe(),{selectedStreamName:y}=st(),{activeForm:v,loadDestination:C,validateFormData:S,formErrorMessage:w,genericForm:k}=U(),T=d(null),[N,A]=i(!1),[I,D]=i(!1),[E,$]=i(null),[O,P]=i(!0),[F,L]=i(null),M=N&&!!k?.isFormDirty,V=r(()=>rt(f,y),[f,y]),B=r(()=>V?.find(e=>Qe(e)===l),[l,V]);n(()=>{let e=!1;return P(!0),s().then(t=>{e||$(t?.destinationCategories.categories??[])}).catch(t=>{e||$([])}).finally(()=>{e||P(!1)}),()=>{e=!0}},[]),n(()=>{B&&E&&C(B,E)},[B,E]);const z=r(()=>B&&E?ct(E,B):[],[B,E]),j=c(()=>{B&&A(!0)},[B]),H=c(()=>{B&&E&&(C(B,E),A(!1))},[B,E,C]),G=c(()=>{M?L("close"):o()},[M,o]),Y=c(()=>{M?L("cancel"):H()},[M,H]),q=c(()=>{const e=F;L(null),"close"===e?(H(),o()):H()},[F,H,o]),J=c(async()=>{if(B){const{errorMessage:e,preparedFormData:t}=S();e||(await p(B.id,K(t)),A(!1))}},[B,S,p]),Q=c(()=>{B&&D(!0)},[B]),Z=c(async()=>{B&&(await h(B.id),o())},[B,h,o]);if(!B)return null;const{icon:ee,iconSrc:te}=$e(B.destinationType.type),ae=((e,t)=>{const a=[],n=it(e,t),o=n.map(e=>({name:e.key,value:e.value})),l=W(e.exportedSignals);let i=[];const s=()=>{i.length&&(a.push({kind:"cells",id:`cells-${a.length}`,items:i}),i=[])};return n.forEach(({key:e,name:n,value:r})=>{const c=t.find(t=>t.name===e),{secret:d,componentType:u,componentProperties:p,hideFromReadData:m,customReadDataLabels:h}=c||{};if(m?.length&&_(m,l,o))return;const{type:g}=Pe(p,{type:""}),b=d||"password"===g;if(h?.length)h.forEach(({condition:t,...a},n)=>{t==r&&i.push({id:`${e}-custom-${n}`,title:a.title,label:a.value})});else if(r)if(b)i.push({id:e,title:n,label:new Array(10).fill("•").join("")});else{if(u===x.MultiInput){const t=Pe(r,null);if(Array.isArray(t)&&t.length)return s(),void a.push({kind:"list",id:e,title:n,items:t.map((t,a)=>({id:`${e}-${a}`,label:String(t)}))})}if(u===x.KeyValuePair){const t=Pe(r,null);if(Array.isArray(t)&&t.length)return s(),void a.push({kind:"pairs",id:e,title:n,items:t.map((t,a)=>{const n=t&&"object"==typeof t?t:{};return{id:`${e}-${a}`,title:null!=n.key?String(n.key):"",label:null!=n.value?String(n.value):""}})})}i.push({id:e,title:n,label:r})}else i.push({id:e,title:n,label:"-"})}),s(),a})(B,z);return e(a,{children:[t(Ze,{isOpen:!0,header:{icon:ee,iconSrc:te,title:B.name||B.destinationType.displayName,onClose:G,actions:[{id:"edit-destination-btn-edit",label:et.EDIT,icon:qa,active:N,onClick:j},{id:"edit-destination-btn-delete",label:et.DELETE,icon:Xa,color:b.v2.colors.red[500],active:I,onClick:Q}]},footer:{note:N&&w?{status:X.Error,message:w}:void 0,actions:N?[{"data-id":"edit-destination-btn-cancel",label:et.CANCEL,variant:R.Secondary,onClick:Y},...v?.option.testConnectionSupported?[{"data-id":"edit-destination-btn-test-connection",label:et.TEST_CONNECTION,variant:R.Secondary,onClick:()=>T.current?.testConnection()}]:[],{"data-id":"edit-destination-btn-save",label:et.SAVE,variant:R.Primary,onClick:J}]:[]},children:t(tt,{$padding:"4px 12px 12px",children:O?t(ke,{$height:"50vh",children:t(De,{withSpinner:!0})}):N&&v?t(so,{ref:T,isEdit:!0,testConnection:u}):t(g,{$gap:16,children:e(at,{bgTint:"1000",children:[e(at,{bgTint:"900",children:[t(nt,{conditions:B.conditions||[]}),t(at,{bgTint:"800",cellsPerRow:2,items:(ne=B,[{id:"type",title:Te.TYPE,label:ne.destinationType.displayName},{id:"status",title:Te.STATUS,badge:{status:ne.disabled?ze.Unknown:X.Success,label:ne.disabled?Te.DISABLED:Te.ENABLED}},{id:"monitors",title:Te.MONITORS,label:W(ne.exportedSignals).map(e=>{let t=e.toLowerCase();return t=`${t.charAt(0).toUpperCase()}${t.slice(1)}`,t}).join(", ")||"-"},{id:"name",title:Te.NAME,label:ne.name||"-"}])})]}),!!ae.length&&t(at,{bgTint:"900",richTitle:{title:"Configuration"},withCollapse:!0,collapseIsDefaultOpen:!0,children:ae.map(e=>"cells"===e.kind?t(at,{bgTint:"800",cellsPerRow:2,items:e.items},e.id):(e.kind,t(at,{bgTint:"800",richTitle:{title:e.title},cellsPerRow:2,items:e.items},e.id)))})]})})})}),t(zn,{target:"destination",isOpen:I,onClose:()=>D(!1),onApprove:Z}),t(_n,{isOpen:null!==F,onClose:()=>L(null),onApprove:q})]});var ne},Zo=({onClose:o,ruleId:l,updateInstrumentationRule:s,deleteInstrumentationRule:d})=>{const u=m(),{instrumentationRules:p}=Fe(),{addNotification:h}=ut(),{selectedOption:b,loadRule:f,validateFormData:y,errorMessage:v,genericForm:C}=ne(),[S,w]=i(!1),[k,T]=i(!1),[N,A]=i(null),I=S&&!!C?.isFormDirty,E=r(()=>p?.find(e=>Qe(e)===l),[l,p]),$=r(()=>Le.find(({type:e})=>e===E?.type)??null,[E?.type]);n(()=>{E&&f(E)},[E]);const x=c(()=>{if(E){if(!E.mutable)return void h({type:X.Warning,title:pt.FORBIDDEN,message:pt.CANNOT_EDIT_RULE,crdType:Ke.InstrumentationRule,target:E.ruleId,hideFromHistory:!0});w(!0)}},[E,h]),O=c(()=>{E&&(f(E),w(!1))},[E,f]),P=c(()=>{I?A("close"):o()},[I,o]),F=c(()=>{I?A("cancel"):O()},[I,O]),V=c(()=>{const e=N;A(null),"close"===e?(O(),o()):O()},[N,O,o]),B=c(async()=>{if(E){const{errorMessage:e,preparedFormData:t}=y();e||(await s(E.ruleId,t),w(!1))}},[E,y,s]),z=c(()=>{if(E){if(!E.mutable)return void h({type:X.Warning,title:pt.FORBIDDEN,message:pt.CANNOT_DELETE_RULE,crdType:Ke.InstrumentationRule,target:E.ruleId,hideFromHistory:!0});T(!0)}},[E,h]),_=c(async()=>{E&&(await d(E.ruleId),o())},[E,d,o]);if(!E||!$)return null;const U=((e,a)=>{const n=[];return e.payloadCollection&&Object.entries(e.payloadCollection).forEach(([e,a])=>{a&&n.push(t(L,{size:M.XS,children:`• ${dt(e).toLowerCase()}`},e))}),e.codeAttributes&&Object.entries(e.codeAttributes).forEach(([e,a])=>{a&&n.push(t(L,{size:M.XS,children:`• ${dt(e).toLowerCase()}`},e))}),e.headersCollection?.[J.HeaderKeys]?.length&&e.headersCollection[J.HeaderKeys].forEach(e=>{e&&n.push(t(L,{size:M.XS,children:e},e))}),e.customInstrumentations&&(e.customInstrumentations[te.Java]?.forEach((e,o)=>{const l=new ee(e.className,e.methodName);if(l.Verify()){0===o&&n.push(t(L,{size:M.XS,children:"Java Custom Probes:"},"java-custom-probes"));const e=l.toString();n.push(t(L,{size:M.XXS,color:a.v2.colors.grey[200],children:`• ${e}`},e))}}),e.customInstrumentations[te.Golang]?.forEach((e,o)=>{const l=new Z(e.packageName,e.functionName,e.receiverName,e.receiverMethodName);if(l.Verify()){0===o&&n.push(t(L,{size:M.XS,children:"Golang Custom Probes:"},"golang-custom-probes"));const e=l.toString();n.push(t(L,{size:M.XXS,color:a.v2.colors.grey[200],children:`• ${e}`},e))}})),n})(E,u);return e(a,{children:[t(Ze,{isOpen:!0,header:{icon:ht(E.type),title:$.label,onClose:P,actions:[{id:"edit-rule-btn-edit",label:et.EDIT,icon:qa,active:S,onClick:x},{id:"edit-rule-btn-delete",label:et.DELETE,icon:Xa,color:u.v2.colors.red[500],active:k,onClick:z}]},footer:{note:S&&v?{status:X.Error,message:v}:void 0,actions:S?[{"data-id":"edit-rule-btn-cancel",label:et.CANCEL,variant:R.Secondary,onClick:F},{"data-id":"edit-rule-btn-save",label:et.SAVE,variant:R.Primary,onClick:B}]:[]},children:t(tt,{$padding:"4px 12px 12px",children:S&&b?t(bo,{}):t(g,{$gap:16,children:e(at,{bgTint:"1000",children:[e(at,{bgTint:"900",children:[t(nt,{conditions:E.conditions||[]}),t(at,{bgTint:"800",cellsPerRow:2,items:(j=E,H=$,[{id:"type",title:Te.TYPE,label:H.label},{id:"status",title:Te.STATUS,badge:{status:j.disabled?ze.Unknown:X.Success,label:j.disabled?Te.DISABLED:Te.ENABLED}},{id:"name",title:Te.NAME,label:j.ruleName||"-"},{id:"profile",title:Te.MANAGED_BY_PROFILE,label:j.profileName||"-"},{id:"notes",title:Te.NOTES,label:j.notes||"-"}])})]}),!!U.length&&t(at,{bgTint:"900",richTitle:{title:"Collect"},withCollapse:!0,collapseIsDefaultOpen:!0,children:t(at,{bgTint:"800",children:U})}),!!$.supportedLanguages.length&&t(at,{bgTint:"900",richTitle:{title:"Supported languages"},withCollapse:!0,collapseIsDefaultOpen:!0,children:t(at,{bgTint:"800",children:t(D,{$gap:12,$wrap:"wrap",children:$.supportedLanguages.map(e=>t(mt,{label:le[e],leftIcon:ie(e),flex:"0.5"},e))})})})]})})})}),t(zn,{target:"instrumentation rule",isOpen:k,onClose:()=>T(!1),onApprove:_}),t(_n,{isOpen:null!==N,onClose:()=>A(null),onApprove:V})]});var j,H},el=p.div`
80
+ `,Ko=({clusterId:a,namespaceName:n,checkbox:o,isFutureApps:i,selectedCounts:l,isActive:s,onActive:r,handleSourceChange:c})=>{const d=m(),u=e=>{r(),c({clusterId:a,workloadId:{namespace:n},auto:e.auto,selected:e.all})};return t(Wo,{children:t(Eo,{dataId:`namespace-${n}`,withCarret:!0,title:n,isSelected:s,onClick:r,isPartiallyChecked:o.partial,isChecked:o.all,onCheckboxChange:e=>u({auto:e,all:e}),children:e(D,{$gap:12,children:[t(Go,{$visible:s||i,children:t(q,{text:"Automatically instrument all workloads currently in the namespace, and all workloads that will be deployed to this namespace in the future",children:t(T,{label:"Auto",size:_e.S,value:i,onChange:e=>u({auto:e,all:e||void 0})})})}),e(D,{$gap:8,children:[t(M,{variant:Ue.Span,size:L.XXXS,color:d.v2.colors.silver[200],align:"right",children:"Selected"}),t(oe,{label:`${l.sourced}/${l.total}`,status:s?X.Default:Be.Unknown,minWidth:"42px"})]})]})})})},Yo=({withCollapse:e,clusterId:a,clusterName:n,namespaces:o,selectedArea:i,setSelectedArea:l,handleSourceChange:s})=>{const c=r(()=>o.map(({name:e,totalWorkloads:o,selectedCount:r,isAllSourced:c,isSomeSourced:d,isFutureApps:u})=>t(Ko,{clusterId:a,namespaceName:e,isFutureApps:u,checkbox:{all:c,partial:d},selectedCounts:{sourced:r,total:o},isActive:i.clusterId===a&&i.namespaceName===e,onActive:()=>l({clusterId:a,clusterName:n,namespaceName:e}),handleSourceChange:s},`${a}#${e}`)),[a,n,o,i]);return e?t(Fo,{title:n,list:c,noBgColor:!0}):c},qo=({onClose:a,onBack:o,onNext:i,selectedConnectionIds:s,setSelectedConnectionIds:c,persistSources:d,getAllClusterSnapshots:u,fetchNamespacesWithWorkloads:p,withOverlay:h,disableAnimation:g})=>{const b=m(),{progress:f,resetProgress:y}=He(),{isFetching:v,setIsFetching:C,setSnapshots:S,formData:w,handleSourceChange:k,handleSelectAll:A,formDiff:N,isFormDirty:I}=We();n(()=>{let e=!1;C(!0);return(async()=>{try{if(u){const t=await u();!e&&t&&S(t)}else if(p){const t=await p();if(!e&&t.data?.length){const e={clusters:[{clusterId:qe,clusterName:Ye,namespaces:t.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}))||[]}))}]};S(e)}}}catch(e){}finally{e||C(!1)}})(),()=>{e=!0}},[]);const[E,$]=l(""),[R,x]=l(Ge.Namespace),[O,P]=l({showOnlySelected:!1}),[V,B]=l({clusterId:"",clusterName:"",namespaceName:""}),z=(({isFetching:a,formData:n,handleSourceChange:o,handleSelectAll:i,selectedArea:l,setSelectedArea:s,searchText:c,searchBy:d,filters:u})=>{const p=r(()=>n.map(e=>{const t=[...e.namespaces].sort((e,t)=>e.name.localeCompare(t.name)).filter(e=>je(e,c,u)).map(e=>({name:e.name,totalWorkloads:e.workloads.length,...Xe(e)}));return{clusterId:e.clusterId,clusterName:e.clusterName,visibleNamespaces:t}}),[n,c,u]),m=r(()=>{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:g,filteredCount:b,totalCount:f}=r(()=>{const e=p.map(({clusterId:e,clusterName:a,visibleNamespaces:n})=>n.length?t(Yo,{withCollapse:p.length>1,clusterId:e,clusterName:a,namespaces:n,selectedArea:l,setSelectedArea:s,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,l]);return{width:"60%",header:e(D,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(D,{$gap:8,children:[t(M,{size:L.XS,nowrap:!0,children:"Namespaces"}),t(q,{text:g?Te.FILTERED_COUNT_TOOLTIP:void 0,children:t(oe,{label:`${g?`${b} / ${f}`:f}`,status:Be.Unknown})})]}),t(M,{"data-id":"namespaces-select-all",onClick:()=>i({boolean:!m,searchText:c,searchBy:d,filters:u}),disabled:!h.length,size:L.XS,children:(m?"Unselect":"Select")+" all"})]}),list:h.length?h:a?[t(ke,{$height:"100%",children:t(Ee,{title:Te.FETCHING_NAMESPACES,subTitle:Te.FETCHING_NAMESPACES_SUBTITLE,withSpinner:!0})},"loading")]:[t(ke,{$height:"100%",children:t(F,c?{icon:cn,title:"No matches",subTitle:`No namespace matched the filter '${c}'`}:{icon:cn,title:"No namespaces",subTitle:"No namespaces found in this cluster"})},"no-data")]}})({isFetching:v,formData:w,handleSourceChange:k,handleSelectAll:A,selectedArea:V,setSelectedArea:B,searchText:R===Ge.Namespace?E:"",searchBy:R,filters:O}),_=(({formData:a,handleSourceChange:n,handleSelectAll:o,selectedArea:i,searchText:l,searchBy:s,filters:c})=>{const{tier:d}=Me(),u=d===ze.Onprem,p=r(()=>i.value.namespaceName?a.find(({clusterId:e})=>e===i.value.clusterId)?.namespaces.find(({name:e})=>e===i.value.namespaceName):void 0,[a,i.value.clusterId,i.value.namespaceName]),m=r(()=>p?[...p.workloads].sort((e,t)=>e.name.localeCompare(t.name)).filter(e=>Le(e,l,c)):[],[p,l,c]),h=r(()=>!!m.length&&m.every(({selected:e})=>e),[m]),g=r(()=>{if(!p)return[];const{clusterId:e}=i.value,{name:a}=p;return m.map(({name:o,selected:i,kind:l})=>{const s=!u&&Ve.has(l);return t(Ho,{workloadName:o,workloadKind:l,isChecked:!s&&(i||!1),onToggle:()=>n({clusterId:e,workloadId:{namespace:a,name:o,kind:l}}),disabled:s,disabledReason:"Enterprise only"},`${e}#${a}#${o}#${l}`)})},[m,p,i.value.clusterId]),{withFilterCount:b,filteredCount:f,totalCount:y}=r(()=>{const e=p?.workloads.length??0;return{withFilterCount:m.length!==e,filteredCount:m.length,totalCount:e}},[m,p]);return{width:"40%",header:e(D,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(D,{$gap:8,children:[t(M,{size:L.XS,nowrap:!0,children:i.value.namespaceName?`${i.value.namespaceName} > Workloads`:"Workloads"}),t(q,{text:b?Te.FILTERED_COUNT_TOOLTIP:void 0,children:t(oe,{label:`${b?`${f} / ${y}`:y}`,status:Be.Unknown})})]}),t(M,{"data-id":"workloads-select-all",onClick:()=>o({clusterId:i.value.clusterId,namespaceName:i.value.namespaceName,boolean:!h,searchText:l,searchBy:s,filters:c}),disabled:!g.length,size:L.XS,children:(h?"Unselect":"Select")+" all"})]}),list:g.length?g:[t(ke,{$height:"100%",children:t(F,p?l?{icon:rn,title:"No matches",subTitle:`No sources matched the filter '${l}'`}:{icon:rn,title:"No sources",subTitle:"No sources found in this namespace"}:{icon:rn,title:Te.SELECT_NAMESPACE,subTitle:Te.SELECT_NAMESPACE_SUBTITLE})},"no-data")]}})({formData:w,handleSourceChange:k,handleSelectAll:A,selectedArea:{value:V},searchText:R===Ge.Source?E:"",searchBy:R,filters:O});return t(zn,{isOpen:!0,withOverlay:h,disableAnimation:g,onClose:a?()=>{y(Ke.BulkInstrumenting),a()}:void 0,onBack:o?()=>o(N):void 0,onNext:i?()=>i(N):void 0,nextIsSkip:!I,onSave:()=>d(N),header:{icon:rn,title:Te.ADD_SOURCE,subTitle:Te.ADD_SOURCES_DESCRIPTION},connectionIds:s&&c?{value:s,setValue:c}:void 0,search:{value:E,onChange:e=>{$(e),R===Ge.Namespace&&B({clusterId:"",clusterName:"",namespaceName:""})},segment:{options:[{label:"Namespace",value:Ge.Namespace},{label:"Source",value:Ge.Source}],selected:R,setSelected:x}},filters:e(D,{$gap:8,children:[t(M,{size:L.XXXS,color:b.v2.colors.silver[200],nowrap:!0,children:"Show only:"}),t(T,{name:"filter-selected",size:_e.S,label:"Selected",value:O.showOnlySelected,onChange:e=>P(t=>({...t,showOnlySelected:e}))})]}),isFormDirty:I,isFetching:v,progress:{title:Te.CREATING_SOURCES,subTitle:Te.CREATING_SOURCES_SUBTITLE,percentage:f[Ke.BulkInstrumenting]?.percentage||0},leftColumn:z,rightColumn:_})},Jo=({onClose:o,actionId:i,updateAction:s,deleteAction:d})=>{const u=m(),{actions:p}=Pe(),{selectedOption:h,loadAction:b,validateFormData:f,errorMessage:y,genericForm:v}=P(),[C,S]=l(!1),[w,T]=l(!1),[A,N]=l(null),I=C&&!!v?.isFormDirty,D=r(()=>p?.find(e=>Je(e)===i),[i,p]),E=r(()=>Se.find(({type:e})=>e===D?.type)??we.find(({type:e})=>e===D?.type)??null,[D?.type]);n(()=>{D&&b(D)},[D]);const $=c(()=>{D&&S(!0)},[D]),x=c(()=>{D&&(b(D),S(!1))},[D,b]),F=c(()=>{I?N("close"):o()},[I,o]),M=c(()=>{I?N("cancel"):x()},[I,x]),L=c(()=>{const e=A;N(null),"close"===e?(x(),o()):x()},[A,x,o]),V=c(async()=>{if(D){const{errorMessage:e,preparedFormData:t}=f();e||(await s(D.id,t),S(!1))}},[D,f,s]),B=c(()=>{D&&T(!0)},[D]),z=c(async()=>{D&&(await d(D.id,D.type),o())},[D,d,o]);if(!D||!E)return null;const _=(e=>{const t=[],{type:a,fields:n}=e,o=e=>({status:e?X.Success:Be.Unknown,label:e?"True":"False",invertColors:!0});return a===O.K8sAttributes&&(t.push({id:"collectContainerAttributes",title:"Collect Container Attributes",badge:o(n.collectContainerAttributes)}),t.push({id:"collectReplicaSetAttributes",title:"Collect ReplicaSet Attributes",badge:o(n.collectReplicaSetAttributes)}),t.push({id:"collectWorkloadId",title:"Collect Workload ID",badge:o(n.collectWorkloadId)}),t.push({id:"collectClusterId",title:"Collect Cluster ID",badge:o(n.collectClusterId)}),n.labelsAttributes?.forEach(({labelKey:e,attributeKey:a,from:o,fromSources:i},l)=>{const s=i?.length?i.join(", "):o||k.Pod,r=(n.labelsAttributes?.length??0)>1?`Label #${l+1} `:"Label ";t.push({id:`label-${l}-key`,title:`${r}Key`,label:e}),t.push({id:`label-${l}-attr`,title:`${r}Attribute Key`,label:a}),t.push({id:`label-${l}-from`,title:`${r}From`,label:s})}),n.annotationsAttributes?.forEach(({annotationKey:e,attributeKey:a,from:o,fromSources:i},l)=>{const s=i?.length?i.join(", "):o||k.Pod,r=(n.annotationsAttributes?.length??0)>1?`Annotation #${l+1} `:"Annotation ";t.push({id:`annotation-${l}-key`,title:`${r}Key`,label:e}),t.push({id:`annotation-${l}-attr`,title:`${r}Attribute Key`,label:a}),t.push({id:`annotation-${l}-from`,title:`${r}From`,label:s})})),a===O.AddClusterInfo&&(t.push({id:"overwriteExistingValues",title:"Overwrite Existing Values",badge:o(n.overwriteExistingValues)}),n.clusterAttributes?.forEach(({attributeName:e,attributeStringValue:a},n)=>{t.push({id:`cluster-attr-${n}`,title:e,label:a})})),a===O.DeleteAttributes&&n.attributeNamesToDelete?.forEach((e,a)=>{t.push({id:`del-attr-${a}`,title:"Attribute"+((n.attributeNamesToDelete?.length??0)>1?` #${a+1}`:""),label:e})}),a===O.RenameAttributes&&Object.entries(n.renames||{}).forEach(([e,a],n)=>{t.push({id:`rename-${n}`,title:e,label:a})}),a===O.PiiMasking&&n.piiCategories?.forEach((e,a)=>{t.push({id:`pii-${a}`,title:"Category"+((n.piiCategories?.length??0)>1?` #${a+1}`:""),label:e})}),a===O.ErrorSampler&&t.push({id:"fallbackSamplingRatio",title:"Sampling Ratio",label:String(n.fallbackSamplingRatio??"-")}),a===O.ProbabilisticSampler&&t.push({id:"samplingPercentage",title:"Sampling Percentage",label:String(n.samplingPercentage??"-")}),a===O.LatencySampler&&n.endpointsFilters?.forEach(({serviceName:e,httpRoute:a,minimumLatencyThreshold:o,fallbackSamplingRatio:i},l)=>{const s=(n.endpointsFilters?.length??0)>1?`Endpoint #${l+1} `:"Endpoint ";t.push({id:`endpoint-${l}-service`,title:`${s}Service Name`,label:e}),t.push({id:`endpoint-${l}-route`,title:`${s}HTTP Route`,label:a}),t.push({id:`endpoint-${l}-latency`,title:`${s}Min. Latency`,label:String(o)}),t.push({id:`endpoint-${l}-fallback`,title:`${s}Fallback Sampling Ratio`,label:String(i)})}),a===O.ServiceNameSampler&&n.servicesNameFilters?.forEach(({serviceName:e,samplingRatio:a,fallbackSamplingRatio:o},i)=>{const l=(n.servicesNameFilters?.length??0)>1?`Filter #${i+1} `:"Filter ";t.push({id:`service-${i}-name`,title:`${l}Service Name`,label:e}),t.push({id:`service-${i}-ratio`,title:`${l}Sampling Ratio`,label:String(a)}),t.push({id:`service-${i}-fallback`,title:`${l}Fallback Sampling Ratio`,label:String(o)})}),a===O.SpanAttributeSampler&&n.attributeFilters?.forEach(({serviceName:e,attributeKey:a,fallbackSamplingRatio:o,condition:i},l)=>{const s=Object.keys(i)[0],r=i[s],c=(n.attributeFilters?.length??0)>1?`Filter #${l+1} `:"Filter ";t.push({id:`attr-${l}-service`,title:`${c}Service Name`,label:e}),t.push({id:`attr-${l}-key`,title:`${c}Attribute Key`,label:a}),t.push({id:`attr-${l}-fallback`,title:`${c}Fallback Sampling Ratio`,label:String(o)}),t.push({id:`attr-${l}-condition`,title:`${c}Condition`,label:s}),t.push({id:`attr-${l}-operation`,title:`${c}Operation`,label:r?.operation??"-"}),t.push({id:`attr-${l}-expected`,title:`${c}Expected Value`,label:String(r?.expectedValue??"-")}),"jsonCondition"===s&&t.push({id:`attr-${l}-jsonpath`,title:`${c}JSON Path`,label:r?.jsonPath??"-"})}),a===O.URLTemplatization&&n.urlTemplatizationRulesGroups?.forEach((e,a)=>{const o=(n.urlTemplatizationRulesGroups?.length??0)>1?`Group #${a+1} `:"Group ";e.filterK8sNamespace&&t.push({id:`group-${a}-ns`,title:`${o}Namespace`,label:e.filterK8sNamespace}),e.workloadFilters?.forEach((n,i)=>{const l=[n.kind,n.name].filter(Boolean).join("/");l&&t.push({id:`group-${a}-wf-${i}`,title:`${o}Workload${(e.workloadFilters?.length??0)>1?` #${i+1}`:""}`,label:l})});const i=e.templatizationRules?.map(e=>e.template).filter(Boolean).join(", ");i&&t.push({id:`group-${a}-templates`,title:`${o}Templates`,label:i}),e.notes&&t.push({id:`group-${a}-notes`,title:`${o}Notes`,label:e.notes})}),t})(D);return e(a,{children:[t(Qe,{isOpen:!0,header:{icon:nt(D.type),title:E.label,onClose:F,actions:[{id:"edit-action-btn-edit",label:Ze.EDIT,icon:qa,active:C,onClick:$},{id:"edit-action-btn-delete",label:Ze.DELETE,icon:Xa,color:u.v2.colors.red[500],active:w,onClick:B}]},footer:{note:C&&y?{status:X.Error,message:y}:void 0,actions:C?[{"data-id":"edit-action-btn-cancel",label:Ze.CANCEL,variant:R.Secondary,onClick:M},{"data-id":"edit-action-btn-save",label:Ze.SAVE,variant:R.Primary,onClick:V}]:[]},children:t(et,{$padding:"4px 12px 12px",children:C&&h?t(io,{}):t(g,{$gap:16,children:e(tt,{bgTint:"1000",children:[e(tt,{bgTint:"900",children:[t(at,{conditions:D.conditions||[]}),t(tt,{bgTint:"800",cellsPerRow:2,items:(U=D,j=E,[{id:"type",title:Te.TYPE,label:j.label},{id:"status",title:Te.STATUS,badge:{status:U.disabled?Be.Unknown:X.Success,label:U.disabled?Te.DISABLED:Te.ENABLED}},{id:"signals",title:Te.SIGNALS_FOR_PROCESSING,label:U.signals?.map(e=>{let t=e.toLowerCase();return t=`${t.charAt(0).toUpperCase()}${t.slice(1)}`,t}).join(", ")||"-"},{id:"name",title:Te.NAME,label:U.name||"-"},{id:"notes",title:Te.NOTES,label:U.notes||"-"}])})]}),!!_?.length&&t(tt,{bgTint:"900",richTitle:{title:"Configuration"},withCollapse:!0,collapseIsDefaultOpen:!0,children:t(tt,{bgTint:"800",cellsPerRow:2,items:_})})]})})})}),t(_n,{target:"action",isOpen:w,onClose:()=>T(!1),onApprove:z}),t(Un,{isOpen:null!==A,onClose:()=>N(null),onApprove:L})]});var U,j},Qo=({onClose:a,connections:o,selectedConnectionIds:i,setSelectedConnectionIds:s,getEffectiveConfig:c,onApply:d})=>{const u=m(),[p,h]=l(""),[g,b]=l({showOnlySelected:!1}),f=r(()=>o.filter(e=>{const t=!p||e.name.toLowerCase().includes(p.toLowerCase()),a=!g.showOnlySelected||g.showOnlySelected&&i.includes(e.id);return t&&a}),[o.length,i.length,p,g]),y=e=>{s(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[v,C]=l(!1),[S,w]=l(void 0),{formData:k,handleFormChange:A,areFormValuesEqual:N,resetFormData:I}=ot(S||{rollout:{automaticRolloutDisabled:!1}}),E=r(()=>i.length>1||void 0!==S&&!N(S,k),[i.length,S,k]);return n(()=>{1===i.length?(async e=>{if(v)return;C(!0);const t=await c(e);if(t){const e={rollout:{automaticRolloutDisabled:t.rollout?.automaticRolloutDisabled??!1}};w(e),I(e)}C(!1)})(i[0]):w(void 0)},[i.length]),t(zn,{isOpen:!0,onClose:a,onSave:()=>d(k,i),header:{icon:dn,title:"Cluster Configuration"},connectionIds:{value:i,setValue:s},search:{placeholder:"Search by cluster name",value:p,onChange:h},filters:e(D,{$gap:8,children:[t(M,{size:L.XXXS,color:u.v2.colors.silver[200],nowrap:!0,children:"Show only:"}),t(T,{size:_e.S,label:"Selected",value:g.showOnlySelected,onChange:e=>b(t=>({...t,showOnlySelected:e}))})]}),isFormDirty:E,isFetching:v,leftColumn:{width:"35%",header:e(D,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(D,{$gap:8,children:[t(M,{size:L.XS,children:"Clusters"}),t(oe,{label:f.length,status:Be.Unknown})]}),e(D,{$gap:8,children:[t(M,{size:L.XXXS,color:u.v2.colors.silver[200],align:"right",children:"Selected clusters"}),t(oe,{label:`${i.length}/${f.length}`,status:Be.Unknown})]})]}),list:f.map(e=>t(Eo,{title:e.name,isChecked:i.includes(e.id),onClick:()=>y(e.id),onCheckboxChange:()=>y(e.id)},e.id))},rightColumn:{width:"65%",header:t(M,{size:L.XS,children:"Configurations"}),list:[t(T,{label:"Automatic rollout disabled",tooltip:"Odigos automatically triggers a one-time rollout for workloads when instrumenting or uninstrumenting, ensuring that changes are applied without requiring manual intervention. When automatic rollout is disabled, Odigos will not restart workloads, and users will need to manually trigger rollouts after adding or removing sources.",value:k.rollout?.automaticRolloutDisabled||!1,onChange:e=>A("rollout.automaticRolloutDisabled",e)},"automatic-rollout-disabled")]}})},Zo=({onClose:o,destinationId:i,getDestinationCategories:s,testConnection:u,updateDestination:p,deleteDestination:h})=>{const b=m(),{destinations:f}=Pe(),{selectedStreamName:y}=lt(),{activeForm:v,loadDestination:C,validateFormData:S,formErrorMessage:w,genericForm:k}=U(),T=d(null),[A,N]=l(!1),[I,D]=l(!1),[E,$]=l(null),[O,P]=l(!0),[F,M]=l(null),L=A&&!!k?.isFormDirty,V=r(()=>st(f,y),[f,y]),B=r(()=>V?.find(e=>Je(e)===i),[i,V]);n(()=>{let e=!1;return P(!0),s().then(t=>{e||$(t?.destinationCategories.categories??[])}).catch(t=>{e||$([])}).finally(()=>{e||P(!1)}),()=>{e=!0}},[]),n(()=>{B&&E&&C(B,E)},[B,E]);const z=r(()=>B&&E?rt(E,B):[],[B,E]),j=c(()=>{B&&N(!0)},[B]),H=c(()=>{B&&E&&(C(B,E),N(!1))},[B,E,C]),G=c(()=>{L?M("close"):o()},[L,o]),Y=c(()=>{L?M("cancel"):H()},[L,H]),q=c(()=>{const e=F;M(null),"close"===e?(H(),o()):H()},[F,H,o]),J=c(async()=>{if(B){const{errorMessage:e,preparedFormData:t}=S();e||(await p(B.id,K(t)),N(!1))}},[B,S,p]),Q=c(()=>{B&&D(!0)},[B]),Z=c(async()=>{B&&(await h(B.id),o())},[B,h,o]);if(!B)return null;const{icon:ee,iconSrc:te}=Re(B.destinationType.type),ae=((e,t)=>{const a=[],n=it(e,t),o=n.map(e=>({name:e.key,value:e.value})),i=W(e.exportedSignals);let l=[];const s=()=>{l.length&&(a.push({kind:"cells",id:`cells-${a.length}`,items:l}),l=[])};return n.forEach(({key:e,name:n,value:r})=>{const c=t.find(t=>t.name===e),{secret:d,componentType:u,componentProperties:p,hideFromReadData:m,customReadDataLabels:h}=c||{};if(m?.length&&_(m,i,o))return;const{type:g}=Oe(p,{type:""}),b=d||"password"===g;if(h?.length)h.forEach(({condition:t,...a},n)=>{t==r&&l.push({id:`${e}-custom-${n}`,title:a.title,label:a.value})});else if(r)if(b)l.push({id:e,title:n,label:new Array(10).fill("•").join("")});else{if(u===x.MultiInput){const t=Oe(r,null);if(Array.isArray(t)&&t.length)return s(),void a.push({kind:"list",id:e,title:n,items:t.map((t,a)=>({id:`${e}-${a}`,label:String(t)}))})}if(u===x.KeyValuePair){const t=Oe(r,null);if(Array.isArray(t)&&t.length)return s(),void a.push({kind:"pairs",id:e,title:n,items:t.map((t,a)=>{const n=t&&"object"==typeof t?t:{};return{id:`${e}-${a}`,title:null!=n.key?String(n.key):"",label:null!=n.value?String(n.value):""}})})}l.push({id:e,title:n,label:r})}else l.push({id:e,title:n,label:"-"})}),s(),a})(B,z);return e(a,{children:[t(Qe,{isOpen:!0,header:{icon:ee,iconSrc:te,title:B.name||B.destinationType.displayName,onClose:G,actions:[{id:"edit-destination-btn-edit",label:Ze.EDIT,icon:qa,active:A,onClick:j},{id:"edit-destination-btn-delete",label:Ze.DELETE,icon:Xa,color:b.v2.colors.red[500],active:I,onClick:Q}]},footer:{note:A&&w?{status:X.Error,message:w}:void 0,actions:A?[{"data-id":"edit-destination-btn-cancel",label:Ze.CANCEL,variant:R.Secondary,onClick:Y},...v?.option.testConnectionSupported?[{"data-id":"edit-destination-btn-test-connection",label:Ze.TEST_CONNECTION,variant:R.Secondary,onClick:()=>T.current?.testConnection()}]:[],{"data-id":"edit-destination-btn-save",label:Ze.SAVE,variant:R.Primary,onClick:J}]:[]},children:t(et,{$padding:"4px 12px 12px",children:O?t(ke,{$height:"50vh",children:t(Ee,{withSpinner:!0})}):A&&v?t(ro,{ref:T,isEdit:!0,testConnection:u}):t(g,{$gap:16,children:e(tt,{bgTint:"1000",children:[e(tt,{bgTint:"900",children:[t(at,{conditions:B.conditions||[]}),t(tt,{bgTint:"800",cellsPerRow:2,items:(ne=B,[{id:"type",title:Te.TYPE,label:ne.destinationType.displayName},{id:"status",title:Te.STATUS,badge:{status:ne.disabled?Be.Unknown:X.Success,label:ne.disabled?Te.DISABLED:Te.ENABLED}},{id:"monitors",title:Te.MONITORS,label:W(ne.exportedSignals).map(e=>{let t=e.toLowerCase();return t=`${t.charAt(0).toUpperCase()}${t.slice(1)}`,t}).join(", ")||"-"},{id:"name",title:Te.NAME,label:ne.name||"-"}])})]}),!!ae.length&&t(tt,{bgTint:"900",richTitle:{title:"Configuration"},withCollapse:!0,collapseIsDefaultOpen:!0,children:ae.map(e=>"cells"===e.kind?t(tt,{bgTint:"800",cellsPerRow:2,items:e.items},e.id):(e.kind,t(tt,{bgTint:"800",richTitle:{title:e.title},cellsPerRow:2,items:e.items},e.id)))})]})})})}),t(_n,{target:"destination",isOpen:I,onClose:()=>D(!1),onApprove:Z}),t(Un,{isOpen:null!==F,onClose:()=>M(null),onApprove:q})]});var ne},ei=({onClose:o,ruleId:i,updateInstrumentationRule:s,deleteInstrumentationRule:d})=>{const u=m(),{instrumentationRules:p}=Pe(),{addNotification:h}=dt(),{selectedOption:b,loadRule:f,validateFormData:y,errorMessage:v,genericForm:C}=ne(),[S,w]=l(!1),[k,T]=l(!1),[A,N]=l(null),I=S&&!!C?.isFormDirty,E=r(()=>p?.find(e=>Je(e)===i),[i,p]),$=r(()=>Fe.find(({type:e})=>e===E?.type)??null,[E?.type]);n(()=>{E&&f(E)},[E]);const x=c(()=>{if(E){if(!E.mutable)return void h({type:X.Warning,title:ut.FORBIDDEN,message:ut.CANNOT_EDIT_RULE,crdType:Ge.InstrumentationRule,target:E.ruleId,hideFromHistory:!0});w(!0)}},[E,h]),O=c(()=>{E&&(f(E),w(!1))},[E,f]),P=c(()=>{I?N("close"):o()},[I,o]),F=c(()=>{I?N("cancel"):O()},[I,O]),V=c(()=>{const e=A;N(null),"close"===e?(O(),o()):O()},[A,O,o]),B=c(async()=>{if(E){const{errorMessage:e,preparedFormData:t}=y();e||(await s(E.ruleId,t),w(!1))}},[E,y,s]),z=c(()=>{if(E){if(!E.mutable)return void h({type:X.Warning,title:ut.FORBIDDEN,message:ut.CANNOT_DELETE_RULE,crdType:Ge.InstrumentationRule,target:E.ruleId,hideFromHistory:!0});T(!0)}},[E,h]),_=c(async()=>{E&&(await d(E.ruleId),o())},[E,d,o]);if(!E||!$)return null;const U=((e,a)=>{const n=[];return e.payloadCollection&&Object.entries(e.payloadCollection).forEach(([e,a])=>{a&&n.push(t(M,{size:L.XS,children:`• ${ct(e).toLowerCase()}`},e))}),e.codeAttributes&&Object.entries(e.codeAttributes).forEach(([e,a])=>{a&&n.push(t(M,{size:L.XS,children:`• ${ct(e).toLowerCase()}`},e))}),e.headersCollection?.[J.HeaderKeys]?.length&&e.headersCollection[J.HeaderKeys].forEach(e=>{e&&n.push(t(M,{size:L.XS,children:e},e))}),e.customInstrumentations&&(e.customInstrumentations[te.Java]?.forEach((e,o)=>{const i=new ee(e.className,e.methodName);if(i.Verify()){0===o&&n.push(t(M,{size:L.XS,children:"Java Custom Probes:"},"java-custom-probes"));const e=i.toString();n.push(t(M,{size:L.XXS,color:a.v2.colors.grey[200],children:`• ${e}`},e))}}),e.customInstrumentations[te.Golang]?.forEach((e,o)=>{const i=new Z(e.packageName,e.functionName,e.receiverName,e.receiverMethodName);if(i.Verify()){0===o&&n.push(t(M,{size:L.XS,children:"Golang Custom Probes:"},"golang-custom-probes"));const e=i.toString();n.push(t(M,{size:L.XXS,color:a.v2.colors.grey[200],children:`• ${e}`},e))}})),n})(E,u);return e(a,{children:[t(Qe,{isOpen:!0,header:{icon:mt(E.type),title:$.label,onClose:P,actions:[{id:"edit-rule-btn-edit",label:Ze.EDIT,icon:qa,active:S,onClick:x},{id:"edit-rule-btn-delete",label:Ze.DELETE,icon:Xa,color:u.v2.colors.red[500],active:k,onClick:z}]},footer:{note:S&&v?{status:X.Error,message:v}:void 0,actions:S?[{"data-id":"edit-rule-btn-cancel",label:Ze.CANCEL,variant:R.Secondary,onClick:F},{"data-id":"edit-rule-btn-save",label:Ze.SAVE,variant:R.Primary,onClick:B}]:[]},children:t(et,{$padding:"4px 12px 12px",children:S&&b?t(fo,{}):t(g,{$gap:16,children:e(tt,{bgTint:"1000",children:[e(tt,{bgTint:"900",children:[t(at,{conditions:E.conditions||[]}),t(tt,{bgTint:"800",cellsPerRow:2,items:(j=E,H=$,[{id:"type",title:Te.TYPE,label:H.label},{id:"status",title:Te.STATUS,badge:{status:j.disabled?Be.Unknown:X.Success,label:j.disabled?Te.DISABLED:Te.ENABLED}},{id:"name",title:Te.NAME,label:j.ruleName||"-"},{id:"profile",title:Te.MANAGED_BY_PROFILE,label:j.profileName||"-"},{id:"notes",title:Te.NOTES,label:j.notes||"-"}])})]}),!!U.length&&t(tt,{bgTint:"900",richTitle:{title:"Collect"},withCollapse:!0,collapseIsDefaultOpen:!0,children:t(tt,{bgTint:"800",children:U})}),!!$.supportedLanguages.length&&t(tt,{bgTint:"900",richTitle:{title:"Supported languages"},withCollapse:!0,collapseIsDefaultOpen:!0,children:t(tt,{bgTint:"800",children:t(D,{$gap:12,$wrap:"wrap",children:$.supportedLanguages.map(e=>t(pt,{label:ie[e],leftIcon:le(e),flex:"0.5"},e))})})})]})})})}),t(_n,{target:"instrumentation rule",isOpen:k,onClose:()=>T(!1),onApprove:_}),t(Un,{isOpen:null!==A,onClose:()=>N(null),onApprove:V})]});var j,H},ti=p.div`
71
81
  display: flex;
72
82
  align-items: center;
73
83
  gap: 8px;
@@ -77,9 +87,9 @@ import{jsxs as e,jsx as t,Fragment as a}from"react/jsx-runtime";import{useEffect
77
87
  &:hover {
78
88
  background-color: ${({theme:e})=>e.v2.colors.silver[800]};
79
89
  }
80
- `,tl=p.div`
90
+ `,ai=p.div`
81
91
  flex: 1;
82
- `,al=({onClick:a})=>{const n=m().v2.colors.red[500];return e(el,{"data-id":"sampling-view-btn-delete",onClick:a,children:[t(L,{size:M.XS,weight:500,color:n,children:yt}),t(Xa,{size:16,fill:n})]})};function nl(n){if(n.isEditing){const{onCancelEdit:o,onSave:l,onDelete:i,duplicateWarning:s}=n;return{children:e(a,{children:[t(al,{onClick:i}),s&&t(j,{status:X.Warning,message:s.message,action:s.onViewRule?{"data-id":"sampling-view-edit-btn-view-duplicate",label:"View rule",onClick:s.onViewRule}:void 0}),t(tl,{}),t(E,{"data-id":"sampling-view-edit-btn-cancel",label:gt,variant:R.Secondary,size:$.S,onClick:o}),t(E,{"data-id":"sampling-view-edit-btn-save",label:bt,variant:R.Primary,size:$.S,onClick:l,disabled:!!s})]})}}const{onDelete:o,onCancel:l,onEdit:i}=n;return{children:e(a,{children:[t(al,{onClick:o}),t(tl,{}),t(E,{"data-id":"sampling-view-btn-cancel",label:gt,variant:R.Secondary,size:$.S,onClick:l}),t(E,{"data-id":"sampling-view-btn-edit",label:ft,variant:R.Primary,size:$.S,onClick:i})]})}}const ol={[re.EditAutoNoisy]:{title:$t,subTitle:Et,toggleId:"sampling-toggle-rule-enabled",cancelId:"sampling-edit-auto-rule-btn-cancel",saveId:"sampling-edit-auto-rule-btn-save"},[re.EditAutoCostReduction]:{title:Dt,subTitle:It,toggleId:"sampling-cr-auto-toggle-enabled",cancelId:"sampling-edit-cost-reduction-auto-rule-btn-cancel",saveId:"sampling-edit-cost-reduction-auto-rule-btn-save"},[re.EditAutoHighlyRelevant]:{title:At,subTitle:Nt,toggleId:"sampling-hr-auto-toggle-enabled",cancelId:"sampling-edit-highly-relevant-auto-rule-btn-cancel",saveId:"sampling-edit-highly-relevant-auto-rule-btn-save"}};function ll(e){return{name:e.name,value:e.value,onChange:e.onChange,variant:Ft.SuccessError,size:Ue.S,label:e.value?Ot:Pt,labelAlign:N.Left}}const il=({isOpen:e,title:a,subTitle:n,onClose:o,toggleProps:l,footer:i,renderBody:s})=>t(Ze,{isOpen:e,width:xt,header:{icon:un,title:a,subTitle:n,onClose:o,toggleProps:l},footer:i,children:s?s():t(tt,{$padding:"12px",children:t(yo,{})})}),sl=({isOpen:e,onClose:a,onSubmit:o,validateForm:l,onNavigateToDuplicate:i})=>{const{category:s,formData:r,handleChange:d,resetForm:u,duplicateWarning:p,setDuplicateWarning:m}=se(re.Create);n(()=>{e&&u()},[e]);const h=c(()=>{if(l){const e=l(r);if(e)return void m(e)}o(r)},[r,o,l,m]),g={note:p?{status:X.Warning,message:p.message,action:i?{"data-id":"sampling-create-btn-view-duplicate",label:"View rule",onClick:()=>i(p.ruleId)}:void 0}:void 0,actions:[{"data-id":"sampling-create-btn-cancel",label:gt,variant:R.Secondary,size:$.S,onClick:a},{"data-id":"sampling-create-btn-submit",label:kt,variant:R.Primary,size:$.S,onClick:h,disabled:!!p}]};return t(il,{isOpen:e,title:Tt[s],subTitle:Ct[s],onClose:a,toggleProps:ll({name:"sampling-toggle-rule-enabled",value:!r.disabled,onChange:e=>d({disabled:!e})}),footer:g})},rl=({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}=se(re.View),g=i?.rule.name||wt,b=s&&i?St[i.category]:`${g} preview`,f=c(()=>{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]),y=c(()=>{i&&a(i.rule.ruleId,i.samplingId)},[i,a]),v=r(()=>{if(!i)return;const t=m?{message:m.message,onViewRule:l?()=>l(m.ruleId):void 0}:null;return nl(s?{isEditing:!0,onCancelEdit:p,onSave:f,onDelete:y,duplicateWarning:t}:{isEditing:!1,onDelete:y,onCancel:e,onEdit:u})},[i,s,m,p,f,y,u,e,l]);return t(il,{isOpen:!!i,title:b,subTitle:i?Ct[i.category]:"",onClose:e,footer:v})},cl=({isOpen:e,onClose:a,onSave:n})=>{const{localEnabled:o,setLocalEnabled:l,resolvedPercentage:i}=se(re.EditAutoNoisy),s=c(()=>n(o,i),[n,o,i]);return t(pl,{formType:re.EditAutoNoisy,isOpen:e,onClose:a,localEnabled:o,setLocalEnabled:l,onSave:s})},dl=({isOpen:e,onClose:a,onSave:n})=>{const{localEnabled:o,setLocalEnabled:l,resolvedPercentage:i}=se(re.EditAutoCostReduction),s=c(()=>n(o,i),[n,o,i]);return t(pl,{formType:re.EditAutoCostReduction,isOpen:e,onClose:a,localEnabled:o,setLocalEnabled:l,onSave:s})},ul=({isOpen:e,onClose:a,onSave:n})=>{const{localEnabled:o,setLocalEnabled:l}=se(re.EditAutoHighlyRelevant),i=c(()=>n(o),[n,o]);return t(pl,{formType:re.EditAutoHighlyRelevant,isOpen:e,onClose:a,localEnabled:o,setLocalEnabled:l,onSave:i})},pl=({formType:e,isOpen:a,onClose:n,localEnabled:o,setLocalEnabled:l,onSave:i})=>{const s=ol[e];return t(il,{isOpen:a,title:s.title,subTitle:s.subTitle,onClose:n,toggleProps:ll({name:s.toggleId,value:o,onChange:l}),footer:{actions:[{"data-id":s.cancelId,label:gt,variant:R.Secondary,size:$.S,onClick:n},{"data-id":s.saveId,label:Rt,variant:R.Primary,size:$.S,onClick:i}]}})},ml=e=>{switch(e.formType){case re.Create:return t(vt,{formType:re.Create,category:e.category,sourceOptions:e.sourceOptions,namespaceOptions:e.namespaceOptions,children:t(sl,{...e})});case re.View:return t(vt,{formType:re.View,data:e.data,defaultEditMode:e.defaultEditMode,sourceOptions:e.sourceOptions,namespaceOptions:e.namespaceOptions,children:t(rl,{...e})});case re.EditAutoNoisy:return t(vt,{formType:re.EditAutoNoisy,enabled:e.enabled,keepPercentage:e.keepPercentage,children:t(cl,{...e})});case re.EditAutoCostReduction:return t(vt,{formType:re.EditAutoCostReduction,enabled:e.enabled,dropPercentage:e.dropPercentage,children:t(dl,{...e})});case re.EditAutoHighlyRelevant:return t(vt,{formType:re.EditAutoHighlyRelevant,enabled:e.enabled,children:t(ul,{...e})})}},hl=({token:n,isLoading:o,isEditing:l,onEdit:i,onCancel:s,onSave:r,formData:c,handleFormChange:d,handleErrorChange:u,formErrors:p})=>{const{CopyButton:m}=Lt(),h=!l||o||!c.newToken;return Mt({key:"Enter",active:!h},r),e(D,l?{$justifyContent:"space-between",$alignItems:"flex-start",$gap:12,children:[t(v,{type:"password",value:c.newToken,onChange:e=>{d("newToken",e.target.value),u("newToken",void 0)},width:"430px",autoFocus:!0,errorMessage:p.newToken}),t(D,{$margin:o?"8px 0 0 0":"2px 0 0 0",$alignItems:"center",children:o?t(De,{title:"Saving...",withGradient:!0}):e(a,{children:[t(E,{variant:R.Secondary,size:$.S,leftIcon:ln,onClick:s,disabled:o}),t(E,{variant:R.Primary,size:$.S,leftIcon:on,onClick:r,disabled:h})]})})]}:{$justifyContent:"space-between",$gap:12,children:[t(L,{size:M.XS,children:new Array(55).fill("•").join("")}),e(D,{$alignItems:"center",$justifyContent:"space-between",children:[t(m,{value:n}),t(Ne,{icon:qa,onClick:i})]})]})},gl=({expiresAt:e,callbackValid:a,callbackExpired:o})=>{const{formatTimeAgo:l}=Vt(),i=r(()=>l(e),[e]),s=r(()=>new Date(e).toDateString().split(" ").slice(1).join(" "),[e]),c=r(()=>Bt(e,0)?X.Error:Bt(e,2592e6)?X.Warning:X.Success,[e]),d=r(()=>c===X.Success?on:c===X.Warning?pn:mn,[c]);return n(()=>{c===X.Success?a():c===X.Error&&o()},[c]),t(q,{text:s,children:t(oe,{leftIcon:d,label:i,status:c,invertColors:!0,useSecondaryTone:!0})})},bl=p.div`
92
+ `,ni=({onClick:a})=>{const n=m().v2.colors.red[500];return e(ti,{"data-id":"sampling-view-btn-delete",onClick:a,children:[t(M,{size:L.XS,weight:500,color:n,children:ft}),t(Xa,{size:16,fill:n})]})};function oi(n){if(n.isEditing){const{onCancelEdit:o,onSave:i,onDelete:l,duplicateWarning:s}=n;return{children:e(a,{children:[t(ni,{onClick:l}),s&&t(j,{status:X.Warning,message:s.message,action:s.onViewRule?{"data-id":"sampling-view-edit-btn-view-duplicate",label:"View rule",onClick:s.onViewRule}:void 0}),t(ai,{}),t(E,{"data-id":"sampling-view-edit-btn-cancel",label:ht,variant:R.Secondary,size:$.S,onClick:o}),t(E,{"data-id":"sampling-view-edit-btn-save",label:gt,variant:R.Primary,size:$.S,onClick:i,disabled:!!s})]})}}const{onDelete:o,onCancel:i,onEdit:l}=n;return{children:e(a,{children:[t(ni,{onClick:o}),t(ai,{}),t(E,{"data-id":"sampling-view-btn-cancel",label:ht,variant:R.Secondary,size:$.S,onClick:i}),t(E,{"data-id":"sampling-view-btn-edit",label:bt,variant:R.Primary,size:$.S,onClick:l})]})}}const ii={[re.EditAutoNoisy]:{title:Et,subTitle:Dt,cancelId:"sampling-edit-auto-rule-btn-cancel",saveId:"sampling-edit-auto-rule-btn-save"},[re.EditAutoCostReduction]:{title:It,subTitle:Nt,cancelId:"sampling-edit-cost-reduction-auto-rule-btn-cancel",saveId:"sampling-edit-cost-reduction-auto-rule-btn-save"},[re.EditAutoHighlyRelevant]:{title:At,subTitle:Tt,cancelId:"sampling-edit-highly-relevant-auto-rule-btn-cancel",saveId:"sampling-edit-highly-relevant-auto-rule-btn-save"}},li=({isOpen:e,title:a,subTitle:n,onClose:o,footer:i,renderBody:l})=>t(Qe,{isOpen:e,width:Rt,header:{icon:un,title:a,subTitle:n,onClose:o},footer:i,children:l?l():t(et,{$padding:"12px",children:t(ko,{})})}),si=({isOpen:e,onClose:a,onSubmit:o,validateForm:i,onNavigateToDuplicate:l})=>{const{category:s,formData:r,resetForm:d,duplicateWarning:u,setDuplicateWarning:p}=se(re.Create);n(()=>{e&&d()},[e]);const m=c(()=>{if(i){const e=i(r);if(e)return void p(e)}o(r)},[r,o,i,p]),h={note:u?{status:X.Warning,message:u.message,action:l?{"data-id":"sampling-create-btn-view-duplicate",label:"View rule",onClick:()=>l(u.ruleId)}:void 0}:void 0,actions:[{"data-id":"sampling-create-btn-cancel",label:ht,variant:R.Secondary,size:$.S,onClick:a},{"data-id":"sampling-create-btn-submit",label:wt,variant:R.Primary,size:$.S,onClick:m,disabled:!!u}]};return t(li,{isOpen:e,title:kt[s],subTitle:vt[s],onClose:a,footer:h})},ri=({onClose:e,onDelete:a,onSaveEdit:n,validateForm:o,onNavigateToDuplicate:i})=>{const{data:l,isEditing:s,formData:d,handleEdit:u,handleCancelEdit:p,duplicateWarning:m,setDuplicateWarning:h}=se(re.View),g=l?.rule.name||St,b=s&&l?Ct[l.category]:`${g} preview`,f=c(()=>{if(l&&s){if(o){const e=o(d);if(e)return void h(e)}n(d,l.rule.ruleId,l.samplingId)}},[l,s,d,n,o,h]),y=c(()=>{l&&a(l.rule.ruleId,l.samplingId)},[l,a]),v=r(()=>{if(!l)return;const t=m?{message:m.message,onViewRule:i?()=>i(m.ruleId):void 0}:null;return oi(s?{isEditing:!0,onCancelEdit:p,onSave:f,onDelete:y,duplicateWarning:t}:{isEditing:!1,onDelete:y,onCancel:e,onEdit:u})},[l,s,m,p,f,y,u,e,i]);return t(li,{isOpen:!!l,title:b,subTitle:l?vt[l.category]:"",onClose:e,footer:v})},ci=({isOpen:e,onClose:a,onSave:n})=>{const{localEnabled:o,resolvedPercentage:i}=se(re.EditAutoNoisy),l=c(()=>n(o,i),[n,o,i]);return t(pi,{formType:re.EditAutoNoisy,isOpen:e,onClose:a,onSave:l})},di=({isOpen:e,onClose:a,onSave:n})=>{const{localEnabled:o,resolvedPercentage:i}=se(re.EditAutoCostReduction),l=c(()=>n(o,i),[n,o,i]);return t(pi,{formType:re.EditAutoCostReduction,isOpen:e,onClose:a,onSave:l})},ui=({isOpen:e,onClose:a,onSave:n})=>{const{localEnabled:o}=se(re.EditAutoHighlyRelevant),i=c(()=>n(o),[n,o]);return t(pi,{formType:re.EditAutoHighlyRelevant,isOpen:e,onClose:a,onSave:i})},pi=({formType:e,isOpen:a,onClose:n,onSave:o})=>{const i=ii[e];return t(li,{isOpen:a,title:i.title,subTitle:i.subTitle,onClose:n,footer:{actions:[{"data-id":i.cancelId,label:ht,variant:R.Secondary,size:$.S,onClick:n},{"data-id":i.saveId,label:$t,variant:R.Primary,size:$.S,onClick:o}]}})},mi=e=>{switch(e.formType){case re.Create:return t(yt,{formType:re.Create,category:e.category,sourceOptions:e.sourceOptions,namespaceOptions:e.namespaceOptions,children:t(si,{...e})});case re.View:return t(yt,{formType:re.View,data:e.data,defaultEditMode:e.defaultEditMode,sourceOptions:e.sourceOptions,namespaceOptions:e.namespaceOptions,children:t(ri,{...e})});case re.EditAutoNoisy:return t(yt,{formType:re.EditAutoNoisy,enabled:e.enabled,keepPercentage:e.keepPercentage,children:t(ci,{...e})});case re.EditAutoCostReduction:return t(yt,{formType:re.EditAutoCostReduction,enabled:e.enabled,dropPercentage:e.dropPercentage,children:t(di,{...e})});case re.EditAutoHighlyRelevant:return t(yt,{formType:re.EditAutoHighlyRelevant,enabled:e.enabled,children:t(ui,{...e})})}},hi=({token:n,isLoading:o,isEditing:i,onEdit:l,onCancel:s,onSave:r,formData:c,handleFormChange:d,handleErrorChange:u,formErrors:p})=>{const{CopyButton:m}=xt(),h=!i||o||!c.newToken;return Ot({key:"Enter",active:!h},r),e(D,i?{$justifyContent:"space-between",$alignItems:"flex-start",$gap:12,children:[t(v,{type:"password",value:c.newToken,onChange:e=>{d("newToken",e.target.value),u("newToken",void 0)},width:"430px",autoFocus:!0,errorMessage:p.newToken}),t(D,{$margin:o?"8px 0 0 0":"2px 0 0 0",$alignItems:"center",children:o?t(Ee,{title:"Saving...",withGradient:!0}):e(a,{children:[t(E,{variant:R.Secondary,size:$.S,leftIcon:ln,onClick:s,disabled:o}),t(E,{variant:R.Primary,size:$.S,leftIcon:on,onClick:r,disabled:h})]})})]}:{$justifyContent:"space-between",$gap:12,children:[t(M,{size:L.XS,children:new Array(55).fill("•").join("")}),e(D,{$alignItems:"center",$justifyContent:"space-between",children:[t(m,{value:n}),t(Ie,{icon:qa,onClick:l})]})]})},gi=({expiresAt:e,callbackValid:a,callbackExpired:o})=>{const{formatTimeAgo:i}=Pt(),l=r(()=>i(e),[e]),s=r(()=>new Date(e).toDateString().split(" ").slice(1).join(" "),[e]),c=r(()=>Ft(e,0)?X.Error:Ft(e,2592e6)?X.Warning:X.Success,[e]),d=r(()=>c===X.Success?on:c===X.Warning?pn:mn,[c]);return n(()=>{c===X.Success?a():c===X.Error&&o()},[c]),t(q,{text:s,children:t(oe,{leftIcon:d,label:l,status:c,invertColors:!0,useSecondaryTone:!0})})},bi=p.div`
83
93
  display: flex;
84
94
  flex-direction: column;
85
95
  gap: 12px;
@@ -87,7 +97,7 @@ import{jsxs as e,jsx as t,Fragment as a}from"react/jsx-runtime";import{useEffect
87
97
  border-radius: 12px;
88
98
  border: 1px solid ${({theme:e,$isExpired:t})=>t?e.v2.colors.red[500]:e.v2.colors.silver[600]};
89
99
  background-color: ${({theme:e,$isExpired:t})=>t?e.v2.colors.red[1e3]:e.v2.colors.silver[800]};
90
- `,fl=({children:e})=>{const a=m();return t(L,{size:M.XXXS,color:a.v2.colors.grey[150],children:e})},yl=({token:a,updateToken:n})=>{const[o,l]=i(!1),[s,r]=i(!1),[c,d]=i(!1),{formData:u,handleFormChange:p,formErrors:m,handleErrorChange:h,resetFormData:b}=lt({newToken:""});return t(ye,{richTitle:{icon:hn,title:"Odigos Pro Token"},children:e(bl,{$isExpired:c,children:[e(D,{$justifyContent:"space-between",children:[e(g,{$gap:4,children:[t(fl,{children:"Issued for"}),t(L,{size:M.XS,children:a.name||"N/A"})]}),e(g,{$gap:4,children:[t(fl,{children:"Expiration"}),t(gl,{expiresAt:a.expiresAt,callbackValid:()=>d(!1),callbackExpired:()=>d(!0)})]}),t(g,{})]}),t(D,{children:e(g,{children:[t(fl,{children:"Token"}),t(hl,{token:a.token,newToken:u.newToken,isLoading:s,isEditing:o,onEdit:()=>l(!0),onCancel:()=>(l(!1),r(!1),void p("newToken","")),onSave:()=>(async()=>{r(!0);const e=await n(u.newToken.trim());r(!1),e?.error?h("newToken",e.error):(l(!1),b())})(),formData:u,handleFormChange:p,handleErrorChange:h,formErrors:m})]})})]})})},vl=p.div`
100
+ `,fi=({children:e})=>{const a=m();return t(M,{size:L.XXXS,color:a.v2.colors.grey[150],children:e})},yi=({token:a,updateToken:n})=>{const[o,i]=l(!1),[s,r]=l(!1),[c,d]=l(!1),{formData:u,handleFormChange:p,formErrors:m,handleErrorChange:h,resetFormData:b}=ot({newToken:""});return t(ye,{richTitle:{icon:hn,title:"Odigos Pro Token"},children:e(bi,{$isExpired:c,children:[e(D,{$justifyContent:"space-between",children:[e(g,{$gap:4,children:[t(fi,{children:"Issued for"}),t(M,{size:L.XS,children:a.name||"N/A"})]}),e(g,{$gap:4,children:[t(fi,{children:"Expiration"}),t(gi,{expiresAt:a.expiresAt,callbackValid:()=>d(!1),callbackExpired:()=>d(!0)})]}),t(g,{})]}),t(D,{children:e(g,{children:[t(fi,{children:"Token"}),t(hi,{token:a.token,newToken:u.newToken,isLoading:s,isEditing:o,onEdit:()=>i(!0),onCancel:()=>(i(!1),r(!1),void p("newToken","")),onSave:()=>(async()=>{r(!0);const e=await n(u.newToken.trim());r(!1),e?.error?h("newToken",e.error):(i(!1),b())})(),formData:u,handleFormChange:p,handleErrorChange:h,formErrors:m})]})})]})})},vi=p.div`
91
101
  display: flex;
92
102
  flex-direction: column;
93
103
  align-items: center;
@@ -96,7 +106,7 @@ import{jsxs as e,jsx as t,Fragment as a}from"react/jsx-runtime";import{useEffect
96
106
  padding: 12px 24px;
97
107
  border-radius: 8px;
98
108
  background-color: ${({theme:e})=>e.v2.colors.silver[800]};
99
- `,Cl=({downloadDiagnose:a})=>{const n=m(),{progress:o}=We(),{namespaces:l}=Fe(),[s,r]=i(null),{formData:c,handleFormChange:d,resetFormData:u}=lt({includeProfiles:!0,includeMetrics:!0,includeSourceWorkloads:!1,sourceWorkloadNamespaces:[]});return t(ye,{richTitle:{icon:gn,title:"Diagnose"},children:s?e(vl,{children:[t(De,{title:"Creating file...",subTitle:"This may take a few moments. Do not refresh the page.",withGradient:!0,withSpinner:"number"==typeof o[Ye.DownloadingDiagnose]?.percentage,percentage:o[Ye.DownloadingDiagnose]?.percentage,withVisual:"number"!=typeof o[Ye.DownloadingDiagnose]?.percentage,visualIcon:bn,startedAt:s}),o[Ye.DownloadingDiagnose]?.list?.length&&t(g,{$width:"100%",children:o[Ye.DownloadingDiagnose].list.map(a=>e(D,{$gap:4,$alignItems:"center",children:[a.status===X.Success?t(on,{size:16}):a.status===X.Error?t(ln,{size:16}):t(De,{withSpinnerOld:!0,scaleSpinnerOld:.7}),t(L,{size:M.XXXS,color:n.v2.colors.silver[200],children:a.label})]},a.label))})]}):e(g,{$gap:24,children:[t(L,{size:M.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(g,{$gap:16,children:[e(D,{$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(L,{size:M.XXXS,color:n.v2.colors.silver[200],children:"Include pprof profiles"})]}),e(D,{$gap:8,children:[t(f,{label:"Metrics",value:c.includeMetrics,onChange:e=>d("includeMetrics",e)}),t(L,{size:M.XXXS,color:n.v2.colors.silver[200],children:"Include Prometheus metrics"})]}),e(D,{$gap:8,children:[t(f,{label:"Source Workloads",value:c.includeSourceWorkloads,onChange:e=>{d("includeSourceWorkloads",e),e&&d("sourceWorkloadNamespaces",[])}}),t(L,{size:M.XXXS,color:n.v2.colors.silver[200],children:"Include workload and pod manifests for instrumented sources"})]})]}),t(zt,{alignX:Ut.Left,alignY:_t.Bottom,items:l.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:R.Secondary,disabled:c.includeSourceWorkloads,leftIcon:c.sourceWorkloadNamespaces.length?()=>t(oe,{label:c.sourceWorkloadNamespaces.length,status:X.Default}):void 0}}),t(D,{$justifyContent:"flex-end",children:t(E,{label:"Download Diagnose",rightIcon:bn,variant:R.Primary,onClick:async()=>{r(Date.now()),await a(c),r(null),u()},disabled:null!==s})})]})})},Sl=({fetchDescribeOdigos:e})=>{const{platformType:a,version:o,tier:l}=Me(),[s,r]=i(null);return n(()=>{e().then(({data:e})=>r(e?.describeOdigos||null))},[]),t(ye,{richTitle:{icon:fn,title:"General Information"},children:t(at,{cellsPerRow:2,items:[{id:jt(),title:"Odigos Version",label:o},{id:jt(),title:`${a.toUpperCase()} Version`,label:s?.kubernetesVersion?.value||"-"},{id:jt(),title:"Installation Method",label:s?.installationMethod?.value||"-"},{id:jt(),title:"Tier",label:l}]})})},wl=({isOpen:a,onClose:n,token:o,updateToken:l,fetchDescribeOdigos:i,downloadDiagnose:s})=>e(Ze,{isOpen:a,header:{icon:fn,title:"System Overview",onClose:n},children:[i&&t(Sl,{fetchDescribeOdigos:i}),l&&o&&t(yl,{token:o,updateToken:l}),s&&t(Cl,{downloadDiagnose:s})]});var kl,Tl;!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"}(kl||(kl={})),function(e){e.Id="id",e.Name="name",e.Type="type",e.Status="status",e.OdigosVersion="odigosVersion",e.ConnectedSince="connectedSince",e.LastActivity="lastActivity"}(Tl||(Tl={}));const Nl=[{key:Tl.Name,label:"Name"},{key:Tl.Type,label:"Type",textAlign:"right"},{key:Tl.Status,label:"Status"},{key:Tl.OdigosVersion,label:"Odigos Version"},{key:Tl.ConnectedSince,label:"Connected Since"},{key:Tl.LastActivity,label:"Last Activity"}],Al=(e,t)=>{const a=e.find(e=>e.key===Tl.Id)?.rawValue;return t(a?.toString()||"")},Il=e=>{const{connections:t,configMinSupportedVersion:a,snapshotMinSupportedVersion:n,onDelete:o,onAddSource:l,onAddDestination:i,onAddAction:s,onAddInstrumentationRule:r,onEditConfiguration:c}=e;return({cells:e})=>{if(!(e=>e.find(e=>e.key===Tl.Status)?.rawValue===X.Success)(e))return[{id:jt(),label:"Delete Connection",rightIcon:Ya,onClick:()=>Al(e,o)}];const d=Al(e,e=>{const n=t.find(t=>t.id===e);return!!n&&Xt(n.odigosVersion,a)}),u=Al(e,e=>{const a=t.find(t=>t.id===e);return!!a&&Xt(a.odigosVersion,n)}),p=[];return l&&p.push({id:jt(),tooltip:u?Te.ADD_SOURCE:`To use this feature, please upgrade to Odigos v${n} or later.`,rightIcon:rn,disabled:!u,onClick:()=>Al(e,l)}),i&&p.push({id:jt(),tooltip:Te.ADD_DESTINATION,rightIcon:tn,onClick:()=>Al(e,i)}),s&&p.push({id:jt(),tooltip:Te.ADD_ACTION,rightIcon:en,onClick:()=>Al(e,s)}),r&&p.push({id:jt(),tooltip:Te.ADD_INSTRUMENTATION_RULE,rightIcon:sn,onClick:()=>Al(e,r)}),c&&p.push({id:jt(),tooltip:d?"Edit Configuration":`To use this feature, please upgrade to Odigos v${a} or later.`,rightIcon:dn,disabled:!d,onClick:()=>Al(e,c)}),p}},Dl=({tableRowsMaxHeight:a,connections:o,getConnections:l,onClickConnection:s,deleteConnection:d,configMinSupportedVersion:u=0,getEffectiveConfig:p,applyConfigurations:h,snapshotMinSupportedVersion:g=0,getAllClusterSnapshots:b,persistSources:f,getDestinationCategories:y,getPotentialDestinations:v,testConnection:C,createDestination:S,updateDestination:w,createAction:k,createInstrumentationRule:T})=>{const N=m(),{isVm:A}=Me(),{formatTimeAgo:I}=Vt(),[D,E]=i(!1),[x,O]=i(o||[]),P=c(async()=>{try{E(!0),O(await l()??[])}catch(e){}finally{E(!1)}},[]);n(()=>{x.length||P()},[]);const[F,L]=i(""),[M,V]=i(null),[B,z]=i([]),_=r(()=>M===kl.BulkConfig?u:M===kl.BulkSource?g:0,[M,u,g]),{supportedConnections:U,supportedConnectionIds:j}=r(()=>{const e=((e,t)=>e.filter(e=>{const a=e.status===X.Success,n=Xt(e.odigosVersion,t);return a&&n}))(x,_);return{supportedConnections:e,supportedConnectionIds:e.map(e=>e.id)}},[x.length,_]);n(()=>{if(!M||M===kl.Delete)return;const e=B.filter(e=>!j.includes(e));e.length&&z(t=>t.filter(t=>!e.includes(t)))},[M,B.length,j.length]);const H=r(()=>x.filter(e=>!F||e.name.toLowerCase().includes(F.toLowerCase())).map(e=>({cells:[{key:Tl.Id,rawValue:e.id},{key:Tl.Name,rawValue:e.name},{key:Tl.Type,rawValue:e.type},{key:Tl.Status,rawValue:e.status,component:()=>(e=>{const a=e===X.Success?"Connection live":"Connection lost",n=e===X.Success?on:ln;return t(oe,{status:e,label:a,leftIcon:n})})(e.status)},{key:Tl.OdigosVersion,rawValue:e.odigosVersion},{key:Tl.ConnectedSince,rawValue:e.connectedAt?I(e.connectedAt):"-"},{key:Tl.LastActivity,rawValue:e.lastSeenAt?I(e.lastSeenAt):"-"}],onClick:e.status!==X.Success||M?void 0:()=>s(e),isSelected:B.includes(e.id),onSelect:()=>z(t=>Array.from(new Set([...t,e.id]))),onDeselect:()=>z(t=>t.filter(t=>t!==e.id)),hideCheckbox:e.status!==X.Success||M===kl.BulkConfig&&!Xt(e.odigosVersion,u)||M===kl.BulkSource&&!Xt(e.odigosVersion,g)})),[x,B,F,M,u,g]),W=r(()=>{const e=(e,t)=>{z([e]),V(t)};return Il({connections:x,configMinSupportedVersion:u,snapshotMinSupportedVersion:g,onDelete:t=>e(t,kl.Delete),onAddSource:!A&&b&&f?t=>e(t,kl.BulkSource):void 0,onAddDestination:!A&&y&&v&&S?t=>e(t,kl.BulkDestination):void 0,onAddAction:!A&&k?t=>e(t,kl.BulkAction):void 0,onAddInstrumentationRule:!A&&T?t=>e(t,kl.BulkInstrumentationRule):void 0,onEditConfiguration:!A&&p&&h?t=>e(t,kl.BulkConfig):void 0})},[A,x,u,p,h,g,b,f,y,v,S,k,T]),G=r(()=>(e=>{const{onCancel:t,onAddSource:a,onAddDestination:n,onAddAction:o,onAddInstrumentationRule:l,onManageConfigurations:i}=e,s=[];a&&s.push({id:jt(),type:Ht.Button,buttonProps:{variant:R.Primary,size:$.S,label:"Add Sources",rightIcon:rn,onClick:a}});const r=[n?{id:kl.BulkDestination,label:Te.ADD_DESTINATION,icon:tn}:null,o?{id:kl.BulkAction,label:Te.ADD_ACTION,icon:en}:null,l?{id:kl.BulkInstrumentationRule,label:Te.ADD_INSTRUMENTATION_RULE,icon:sn}:null,i?{id:kl.BulkConfig,label:"Manage Configurations",icon:dn}:null];return r.some(Boolean)&&s.push({id:jt(),type:Ht.ButtonDropData,buttonProps:{variant:R.Secondary,size:$.S,label:"Bulk Operations",onClick:e=>{e===kl.BulkSource?a?.():e===kl.BulkDestination?n?.():e===kl.BulkAction?o?.():e===kl.BulkInstrumentationRule?l?.():e===kl.BulkConfig&&i?.()}},dropDataProps:{alignX:Ut.Left,items:r}}),s.push({id:jt(),type:Ht.Button,buttonProps:{variant:R.Text,size:$.S,label:et.CANCEL,onClick:t}}),s})({onCancel:()=>z([]),onAddSource:!A&&b&&f?()=>V(kl.BulkSource):void 0,onAddDestination:!A&&y&&v&&S?()=>V(kl.BulkDestination):void 0,onAddAction:!A&&k?()=>V(kl.BulkAction):void 0,onAddInstrumentationRule:!A&&T?()=>V(kl.BulkInstrumentationRule):void 0,onManageConfigurations:!A&&p&&h?()=>V(kl.BulkConfig):void 0}),[A,p,h,b,f,y,v,S,k,T]);return t(Wt,{children:e(ye,{richTitle:{icon:vn,title:Te.CONNECTIONS,badge:{label:x.length.toString(),status:ze.Unknown}},search:{placeholder:"Search by cluster name",value:F,onChange:e=>L(e),width:"300px"},actions:[{id:jt(),type:Ht.Button,buttonProps:{variant:R.Secondary,size:$.S,leftIcon:yn,onClick:P,disabled:D}}],children:[t(Gt,{variant:Kt.Pretty,maxHeight:a,headerBackgroundColor:N.v2.colors.silver[1e3],isLoading:D,withCheckboxes:!0,columns:Nl,rows:H,rowActionsPushRightPosition:M?`calc(${Un} - 24px)`:void 0,getRowActions:W}),M===kl.BulkConfig&&p&&h&&t(Jo,{onClose:()=>V(null),connections:U,selectedConnectionIds:B,setSelectedConnectionIds:z,getEffectiveConfig:p,onApply:h}),M===kl.BulkSource&&b&&f&&t(Yt,{selectedConnectionIds:B,children:t(Yo,{onClose:()=>V(null),selectedConnectionIds:B,setSelectedConnectionIds:z,getAllClusterSnapshots:b,persistSources:async e=>await(f?.(e))})}),M===kl.BulkDestination&&y&&v&&C&&S&&w&&t(qt,{children:t(Vo,{onClose:()=>V(null),selectedConnectionIds:B,setSelectedConnectionIds:z,getDestinationCategories:y,getPotentialDestinations:v,testConnection:e=>C(e,B),createDestination:e=>S(e,B),updateDestination:(e,t)=>w(e,t,B)})}),M===kl.BulkAction&&k&&t(Jt,{children:t(Ao,{onClose:()=>V(null),selectedConnectionIds:B,setSelectedConnectionIds:z,createAction:e=>k(e,B)})}),M===kl.BulkInstrumentationRule&&T&&t(Qt,{children:t(Bo,{onClose:()=>V(null),selectedConnectionIds:B,setSelectedConnectionIds:z,createInstrumentationRule:e=>T(e,B)})}),t(zn,{target:"connection",isOpen:M===kl.Delete,onClose:()=>{z([]),V(null)},onApprove:async()=>{const e=B[0];e&&(await d(e),await P())}}),t(Zt,{isOpen:!!B.length&&!M,richTitle:{icon:Ga,title:"Selected Clusters",badge:{label:B.length}},actions:G})]})})},El=p.div`
109
+ `,Ci=({downloadDiagnose:a})=>{const n=m(),{progress:o}=He(),{namespaces:i}=Pe(),[s,r]=l(null),{formData:c,handleFormChange:d,resetFormData:u}=ot({includeProfiles:!0,includeMetrics:!0,includeSourceWorkloads:!1,sourceWorkloadNamespaces:[]});return t(ye,{richTitle:{icon:gn,title:"Diagnose"},children:s?e(vi,{children:[t(Ee,{title:"Creating file...",subTitle:"This may take a few moments. Do not refresh the page.",withGradient:!0,withSpinner:"number"==typeof o[Ke.DownloadingDiagnose]?.percentage,percentage:o[Ke.DownloadingDiagnose]?.percentage,withVisual:"number"!=typeof o[Ke.DownloadingDiagnose]?.percentage,visualIcon:bn,startedAt:s}),o[Ke.DownloadingDiagnose]?.list?.length&&t(g,{$width:"100%",children:o[Ke.DownloadingDiagnose].list.map(a=>e(D,{$gap:4,$alignItems:"center",children:[a.status===X.Success?t(on,{size:16}):a.status===X.Error?t(ln,{size:16}):t(Ee,{withSpinnerOld:!0,scaleSpinnerOld:.7}),t(M,{size:L.XXXS,color:n.v2.colors.silver[200],children:a.label})]},a.label))})]}):e(g,{$gap:24,children:[t(M,{size:L.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(g,{$gap:16,children:[e(D,{$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(M,{size:L.XXXS,color:n.v2.colors.silver[200],children:"Include pprof profiles"})]}),e(D,{$gap:8,children:[t(f,{label:"Metrics",value:c.includeMetrics,onChange:e=>d("includeMetrics",e)}),t(M,{size:L.XXXS,color:n.v2.colors.silver[200],children:"Include Prometheus metrics"})]}),e(D,{$gap:8,children:[t(f,{label:"Source Workloads",value:c.includeSourceWorkloads,onChange:e=>{d("includeSourceWorkloads",e),e&&d("sourceWorkloadNamespaces",[])}}),t(M,{size:L.XXXS,color:n.v2.colors.silver[200],children:"Include workload and pod manifests for instrumented sources"})]})]}),t(Mt,{alignX:Vt.Left,alignY:Lt.Bottom,items:i.map(e=>({id:e.name,label:e.name,withCheckbox:!0})),selectedIds:c.sourceWorkloadNamespaces,setSelectedIds:e=>d("sourceWorkloadNamespaces",e),withMultiSelect:!0,withSearch:!0,fullWidth:!0,buttonProps:{label:(c.sourceWorkloadNamespaces.length?"Selected":"Select")+" Namespaces",variant:R.Secondary,disabled:c.includeSourceWorkloads,leftIcon:c.sourceWorkloadNamespaces.length?()=>t(oe,{label:c.sourceWorkloadNamespaces.length,status:X.Default}):void 0}}),t(D,{$justifyContent:"flex-end",children:t(E,{label:"Download Diagnose",rightIcon:bn,variant:R.Primary,onClick:async()=>{r(Date.now()),await a(c),r(null),u()},disabled:null!==s})})]})})},Si=({fetchDescribeOdigos:e})=>{const{platformType:a,version:o,tier:i}=Me(),[s,r]=l(null);return n(()=>{e().then(({data:e})=>r(e?.describeOdigos||null))},[]),t(ye,{richTitle:{icon:fn,title:"General Information"},children:t(tt,{cellsPerRow:2,items:[{id:Bt(),title:"Odigos Version",label:o},{id:Bt(),title:`${a.toUpperCase()} Version`,label:s?.kubernetesVersion?.value||"-"},{id:Bt(),title:"Installation Method",label:s?.installationMethod?.value||"-"},{id:Bt(),title:"Tier",label:i}]})})},wi=({isOpen:a,onClose:n,token:o,updateToken:i,fetchDescribeOdigos:l,downloadDiagnose:s})=>e(Qe,{isOpen:a,header:{icon:fn,title:"System Overview",onClose:n},children:[l&&t(Si,{fetchDescribeOdigos:l}),i&&o&&t(yi,{token:o,updateToken:i}),s&&t(Ci,{downloadDiagnose:s})]});var ki,Ti;!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"}(ki||(ki={})),function(e){e.Id="id",e.Name="name",e.Type="type",e.Status="status",e.OdigosVersion="odigosVersion",e.ConnectedSince="connectedSince",e.LastActivity="lastActivity"}(Ti||(Ti={}));const Ai=[{key:Ti.Name,label:"Name"},{key:Ti.Type,label:"Type",textAlign:"right"},{key:Ti.Status,label:"Status"},{key:Ti.OdigosVersion,label:"Odigos Version"},{key:Ti.ConnectedSince,label:"Connected Since"},{key:Ti.LastActivity,label:"Last Activity"}],Ni=(e,t)=>{const a=e.find(e=>e.key===Ti.Id)?.rawValue;return t(a?.toString()||"")},Ii=e=>{const{connections:t,configMinSupportedVersion:a,snapshotMinSupportedVersion:n,onDelete:o,onAddSource:i,onAddDestination:l,onAddAction:s,onAddInstrumentationRule:r,onEditConfiguration:c}=e;return({cells:e})=>{if(!(e=>e.find(e=>e.key===Ti.Status)?.rawValue===X.Success)(e))return[{id:Bt(),label:"Delete Connection",rightIcon:Ya,onClick:()=>Ni(e,o)}];const d=Ni(e,e=>{const n=t.find(t=>t.id===e);return!!n&&zt(n.odigosVersion,a)}),u=Ni(e,e=>{const a=t.find(t=>t.id===e);return!!a&&zt(a.odigosVersion,n)}),p=[];return i&&p.push({id:Bt(),tooltip:u?Te.ADD_SOURCE:`To use this feature, please upgrade to Odigos v${n} or later.`,rightIcon:rn,disabled:!u,onClick:()=>Ni(e,i)}),l&&p.push({id:Bt(),tooltip:Te.ADD_DESTINATION,rightIcon:tn,onClick:()=>Ni(e,l)}),s&&p.push({id:Bt(),tooltip:Te.ADD_ACTION,rightIcon:en,onClick:()=>Ni(e,s)}),r&&p.push({id:Bt(),tooltip:Te.ADD_INSTRUMENTATION_RULE,rightIcon:sn,onClick:()=>Ni(e,r)}),c&&p.push({id:Bt(),tooltip:d?"Edit Configuration":`To use this feature, please upgrade to Odigos v${a} or later.`,rightIcon:dn,disabled:!d,onClick:()=>Ni(e,c)}),p}},Di=({tableRowsMaxHeight:a,connections:o,getConnections:i,onClickConnection:s,deleteConnection:d,configMinSupportedVersion:u=0,getEffectiveConfig:p,applyConfigurations:h,snapshotMinSupportedVersion:g=0,getAllClusterSnapshots:b,persistSources:f,getDestinationCategories:y,getPotentialDestinations:v,testConnection:C,createDestination:S,updateDestination:w,createAction:k,createInstrumentationRule:T})=>{const A=m(),{isVm:N}=Me(),{formatTimeAgo:I}=Pt(),[D,E]=l(!1),[x,O]=l(o||[]),P=c(async()=>{try{E(!0),O(await i()??[])}catch(e){}finally{E(!1)}},[]);n(()=>{x.length||P()},[]);const[F,M]=l(""),[L,V]=l(null),[B,z]=l([]),_=r(()=>L===ki.BulkConfig?u:L===ki.BulkSource?g:0,[L,u,g]),{supportedConnections:U,supportedConnectionIds:j}=r(()=>{const e=((e,t)=>e.filter(e=>{const a=e.status===X.Success,n=zt(e.odigosVersion,t);return a&&n}))(x,_);return{supportedConnections:e,supportedConnectionIds:e.map(e=>e.id)}},[x.length,_]);n(()=>{if(!L||L===ki.Delete)return;const e=B.filter(e=>!j.includes(e));e.length&&z(t=>t.filter(t=>!e.includes(t)))},[L,B.length,j.length]);const H=r(()=>x.filter(e=>!F||e.name.toLowerCase().includes(F.toLowerCase())).map(e=>({cells:[{key:Ti.Id,rawValue:e.id},{key:Ti.Name,rawValue:e.name},{key:Ti.Type,rawValue:e.type},{key:Ti.Status,rawValue:e.status,component:()=>(e=>{const a=e===X.Success?"Connection live":"Connection lost",n=e===X.Success?on:ln;return t(oe,{status:e,label:a,leftIcon:n})})(e.status)},{key:Ti.OdigosVersion,rawValue:e.odigosVersion},{key:Ti.ConnectedSince,rawValue:e.connectedAt?I(e.connectedAt):"-"},{key:Ti.LastActivity,rawValue:e.lastSeenAt?I(e.lastSeenAt):"-"}],onClick:e.status!==X.Success||L?void 0:()=>s(e),isSelected:B.includes(e.id),onSelect:()=>z(t=>Array.from(new Set([...t,e.id]))),onDeselect:()=>z(t=>t.filter(t=>t!==e.id)),hideCheckbox:e.status!==X.Success||L===ki.BulkConfig&&!zt(e.odigosVersion,u)||L===ki.BulkSource&&!zt(e.odigosVersion,g)})),[x,B,F,L,u,g]),W=r(()=>{const e=(e,t)=>{z([e]),V(t)};return Ii({connections:x,configMinSupportedVersion:u,snapshotMinSupportedVersion:g,onDelete:t=>e(t,ki.Delete),onAddSource:!N&&b&&f?t=>e(t,ki.BulkSource):void 0,onAddDestination:!N&&y&&v&&S?t=>e(t,ki.BulkDestination):void 0,onAddAction:!N&&k?t=>e(t,ki.BulkAction):void 0,onAddInstrumentationRule:!N&&T?t=>e(t,ki.BulkInstrumentationRule):void 0,onEditConfiguration:!N&&p&&h?t=>e(t,ki.BulkConfig):void 0})},[N,x,u,p,h,g,b,f,y,v,S,k,T]),G=r(()=>(e=>{const{onCancel:t,onAddSource:a,onAddDestination:n,onAddAction:o,onAddInstrumentationRule:i,onManageConfigurations:l}=e,s=[];a&&s.push({id:Bt(),type:_t.Button,buttonProps:{variant:R.Primary,size:$.S,label:"Add Sources",rightIcon:rn,onClick:a}});const r=[n?{id:ki.BulkDestination,label:Te.ADD_DESTINATION,icon:tn}:null,o?{id:ki.BulkAction,label:Te.ADD_ACTION,icon:en}:null,i?{id:ki.BulkInstrumentationRule,label:Te.ADD_INSTRUMENTATION_RULE,icon:sn}:null,l?{id:ki.BulkConfig,label:"Manage Configurations",icon:dn}:null];return r.some(Boolean)&&s.push({id:Bt(),type:_t.ButtonDropData,buttonProps:{variant:R.Secondary,size:$.S,label:"Bulk Operations",onClick:e=>{e===ki.BulkSource?a?.():e===ki.BulkDestination?n?.():e===ki.BulkAction?o?.():e===ki.BulkInstrumentationRule?i?.():e===ki.BulkConfig&&l?.()}},dropDataProps:{alignX:Vt.Left,items:r}}),s.push({id:Bt(),type:_t.Button,buttonProps:{variant:R.Text,size:$.S,label:Ze.CANCEL,onClick:t}}),s})({onCancel:()=>z([]),onAddSource:!N&&b&&f?()=>V(ki.BulkSource):void 0,onAddDestination:!N&&y&&v&&S?()=>V(ki.BulkDestination):void 0,onAddAction:!N&&k?()=>V(ki.BulkAction):void 0,onAddInstrumentationRule:!N&&T?()=>V(ki.BulkInstrumentationRule):void 0,onManageConfigurations:!N&&p&&h?()=>V(ki.BulkConfig):void 0}),[N,p,h,b,f,y,v,S,k,T]);return t(Ut,{children:e(ye,{richTitle:{icon:vn,title:Te.CONNECTIONS,badge:{label:x.length.toString(),status:Be.Unknown}},search:{placeholder:"Search by cluster name",value:F,onChange:e=>M(e),width:"300px"},actions:[{id:Bt(),type:_t.Button,buttonProps:{variant:R.Secondary,size:$.S,leftIcon:yn,onClick:P,disabled:D}}],children:[t(jt,{variant:Xt.Pretty,maxHeight:a,headerBackgroundColor:A.v2.colors.silver[1e3],isLoading:D,withCheckboxes:!0,columns:Ai,rows:H,rowActionsPushRightPosition:L?`calc(${jn} - 24px)`:void 0,getRowActions:W}),L===ki.BulkConfig&&p&&h&&t(Qo,{onClose:()=>V(null),connections:U,selectedConnectionIds:B,setSelectedConnectionIds:z,getEffectiveConfig:p,onApply:h}),L===ki.BulkSource&&b&&f&&t(Ht,{selectedConnectionIds:B,children:t(qo,{onClose:()=>V(null),selectedConnectionIds:B,setSelectedConnectionIds:z,getAllClusterSnapshots:b,persistSources:async e=>await(f?.(e))})}),L===ki.BulkDestination&&y&&v&&C&&S&&w&&t(Wt,{children:t(_o,{onClose:()=>V(null),selectedConnectionIds:B,setSelectedConnectionIds:z,getDestinationCategories:y,getPotentialDestinations:v,testConnection:e=>C(e,B),createDestination:e=>S(e,B),updateDestination:(e,t)=>w(e,t,B)})}),L===ki.BulkAction&&k&&t(Gt,{children:t(Ro,{onClose:()=>V(null),selectedConnectionIds:B,setSelectedConnectionIds:z,createAction:e=>k(e,B)})}),L===ki.BulkInstrumentationRule&&T&&t(Kt,{children:t(Uo,{onClose:()=>V(null),selectedConnectionIds:B,setSelectedConnectionIds:z,createInstrumentationRule:e=>T(e,B)})}),t(_n,{target:"connection",isOpen:L===ki.Delete,onClose:()=>{z([]),V(null)},onApprove:async()=>{const e=B[0];e&&(await d(e),await P())}}),t(Yt,{isOpen:!!B.length&&!L,richTitle:{icon:Ga,title:"Selected Clusters",badge:{label:B.length}},actions:G})]})})},Ei=p.div`
100
110
  display: flex;
101
111
  align-items: center;
102
112
  justify-content: space-between;
@@ -105,26 +115,26 @@ import{jsxs as e,jsx as t,Fragment as a}from"react/jsx-runtime";import{useEffect
105
115
  width: calc(100% - 32px);
106
116
  border-radius: 16px;
107
117
  background-color: ${({theme:e})=>e.v2.colors.silver[800]};
108
- `,$l=p.div`
118
+ `,$i=p.div`
109
119
  display: flex;
110
120
  align-items: center;
111
121
  justify-content: center;
112
122
  padding: 8px;
113
123
  border-radius: 8px;
114
124
  background-color: ${({theme:e})=>e.v2.colors.white[500]+Ce["004"]};
115
- `,Rl=({setStep:a,onSave:n,sourcesPayload:o,destinationsPayload:l,disableAnimation:i})=>{const s=m(),c=()=>a(2),d=()=>a(3),u=r(()=>Object.values(o||{}).flatMap((a,n)=>a.map((a,o)=>{if(!a.selected)return null;const l=a.kind||Ke.Namespace,i=l===Ke.Namespace?a.namespace:`${a.namespace} → ${a.name}`;return e(El,{children:[t(L,{nowrap:!0,children:i}),t(oe,{label:l,status:X.Info,backgroundColor:s.v2.colors.blue[900]})]},`source-${n}-${o}`)})).filter(Boolean),[o]),p=r(()=>l?.map((a,n)=>{const o=$e(a.option.type).icon;return e(El,{children:[e(D,{$gap:8,children:[o&&t($l,{children:t(o,{size:24})}),t(L,{nowrap:!0,children:a.formData.name||a.option.displayName})]}),void 0!==a.testResult&&t(oe,{status:a.testResult.succeeded?X.Success:X.Error,leftIcon:a.testResult.succeeded?on:ln})]},`destination-${n}`)})||[],[l]);return t(Bn,{isOpen:!0,disableAnimation:i,onBack:()=>a(3),onSave:n,header:{icon:Cn,title:Te.SUMMARY,subTitle:Te.REVIEW_SETUP},leftColumn:{width:"50%",header:e(D,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(D,{$gap:8,children:[t(rn,{size:24}),t(L,{nowrap:!0,children:Te.SELECTED_SOURCES}),t(oe,{label:u.length})]}),t(E,{"data-id":"summary-edit-sources",leftIcon:qa,variant:R.Secondary,size:$.S,onClick:c})]}),list:u.length?u:[t(ke,{$height:"100%",children:t(F,{icon:rn,title:Te.NO_SOURCES_SELECTED,subTitle:Te.ADD_SOURCE_PROMPT,button:{leftIcon:Ha,label:Te.ADD_SOURCE,onClick:c}})},"no-sources-data")]},rightColumn:{width:"50%",header:e(D,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(D,{$gap:8,children:[t(tn,{size:24}),t(L,{nowrap:!0,children:Te.SELECTED_DESTINATIONS}),t(oe,{label:p.length})]}),t(E,{"data-id":"summary-edit-destinations",leftIcon:qa,variant:R.Secondary,size:$.S,onClick:d})]}),list:p.length?p:[t(ke,{"data-id":"summary-no-destinations",$height:"100%",children:t(F,{icon:tn,title:Te.NO_DESTINATIONS_SELECTED,subTitle:Te.ADD_DESTINATION_PROMPT,button:{leftIcon:Ha,label:Te.ADD_DESTINATIONS,onClick:d}})},"no-destinations-data")]}})},xl=p.div`
125
+ `,Ri=({setStep:a,onSave:n,sourcesPayload:o,destinationsPayload:i,disableAnimation:l})=>{const s=m(),c=()=>a(2),d=()=>a(3),u=r(()=>Object.values(o||{}).flatMap((a,n)=>a.map((a,o)=>{if(!a.selected)return null;const i=a.kind||Ge.Namespace,l=i===Ge.Namespace?a.namespace:`${a.namespace} → ${a.name}`;return e(Ei,{children:[t(M,{nowrap:!0,children:l}),t(oe,{label:i,status:X.Info,backgroundColor:s.v2.colors.blue[900]})]},`source-${n}-${o}`)})).filter(Boolean),[o]),p=r(()=>i?.map((a,n)=>{const o=Re(a.option.type).icon;return e(Ei,{children:[e(D,{$gap:8,children:[o&&t($i,{children:t(o,{size:24})}),t(M,{nowrap:!0,children:a.formData.name||a.option.displayName})]}),void 0!==a.testResult&&t(oe,{status:a.testResult.succeeded?X.Success:X.Error,leftIcon:a.testResult.succeeded?on:ln})]},`destination-${n}`)})||[],[i]);return t(zn,{isOpen:!0,disableAnimation:l,onBack:()=>a(3),onSave:n,header:{icon:Cn,title:Te.SUMMARY,subTitle:Te.REVIEW_SETUP},leftColumn:{width:"50%",header:e(D,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(D,{$gap:8,children:[t(rn,{size:24}),t(M,{nowrap:!0,children:Te.SELECTED_SOURCES}),t(oe,{label:u.length})]}),t(E,{"data-id":"summary-edit-sources",leftIcon:qa,variant:R.Secondary,size:$.S,onClick:c})]}),list:u.length?u:[t(ke,{$height:"100%",children:t(F,{icon:rn,title:Te.NO_SOURCES_SELECTED,subTitle:Te.ADD_SOURCE_PROMPT,button:{leftIcon:Ha,label:Te.ADD_SOURCE,onClick:c}})},"no-sources-data")]},rightColumn:{width:"50%",header:e(D,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(D,{$gap:8,children:[t(tn,{size:24}),t(M,{nowrap:!0,children:Te.SELECTED_DESTINATIONS}),t(oe,{label:p.length})]}),t(E,{"data-id":"summary-edit-destinations",leftIcon:qa,variant:R.Secondary,size:$.S,onClick:d})]}),list:p.length?p:[t(ke,{"data-id":"summary-no-destinations",$height:"100%",children:t(F,{icon:tn,title:Te.NO_DESTINATIONS_SELECTED,subTitle:Te.ADD_DESTINATION_PROMPT,button:{leftIcon:Ha,label:Te.ADD_DESTINATIONS,onClick:d}})},"no-destinations-data")]}})},xi=p.div`
116
126
  position: relative;
117
127
  overflow: hidden;
118
128
  width: calc(100vw - ${({$paddingXAxis:e})=>e});
119
129
  height: calc(100vh - ${({$paddingYAxis:e})=>e});
120
130
  box-sizing: border-box;
121
- `,Ol=p.svg`
131
+ `,Oi=p.svg`
122
132
  position: absolute;
123
133
  top: 50%;
124
134
  left: 50%;
125
135
  transform: translate(-50%, -50%);
126
136
  z-index: -1;
127
- `,Pl=[{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"}],Fl=[{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:Pl},{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:Pl},{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:Pl}],Ll=({paddingXAxis:a="0px",paddingYAxis:o="0px",children:l})=>{const[s,c]=i(window.innerWidth),d=r(()=>s/Fl[0].width,[s]);return n(()=>{const e=()=>c(window.innerWidth);return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),e(xl,{$paddingXAxis:a,$paddingYAxis:o,children:[Fl.map(({width:a,height:n,pathOpacity:o,path:l,gradientTransform:i,stops:s},r)=>{const c=`purple-ring-${r}`;return e(Ol,{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:i,children:s.map(({offset:e,opacity:a},n)=>t("stop",{offset:e,stopColor:"#7C3BFF",stopOpacity:a},n))})})]},c)}),l]})},Ml=p.div`
137
+ `,Pi=[{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"}],Fi=[{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:Pi},{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:Pi},{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:Pi}],Mi=({paddingXAxis:a="0px",paddingYAxis:o="0px",children:i})=>{const[s,c]=l(window.innerWidth),d=r(()=>s/Fi[0].width,[s]);return n(()=>{const e=()=>c(window.innerWidth);return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),e(xi,{$paddingXAxis:a,$paddingYAxis:o,children:[Fi.map(({width:a,height:n,pathOpacity:o,path:i,gradientTransform:l,stops:s},r)=>{const c=`purple-ring-${r}`;return e(Oi,{width:a*d,height:"100%",viewBox:`0 0 ${a} ${n}`,fill:"none",children:[t("path",{opacity:o,d:i,fill:`url(#${c})`}),t("defs",{children:t("radialGradient",{id:c,cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:l,children:s.map(({offset:e,opacity:a},n)=>t("stop",{offset:e,stopColor:"#7C3BFF",stopOpacity:a},n))})})]},c)}),i]})},Li=p.div`
128
138
  display: flex;
129
139
  flex-direction: column;
130
140
  align-items: center;
@@ -135,7 +145,7 @@ import{jsxs as e,jsx as t,Fragment as a}from"react/jsx-runtime";import{useEffect
135
145
  width: 50vw;
136
146
  border-radius: 16px;
137
147
  background: ${({theme:e})=>e.v2.colors.silver[900]};
138
- `,Vl=p.div`
148
+ `,Vi=p.div`
139
149
  display: flex;
140
150
  flex-direction: column;
141
151
  align-items: center;
@@ -145,54 +155,48 @@ import{jsxs as e,jsx as t,Fragment as a}from"react/jsx-runtime";import{useEffect
145
155
  & * {
146
156
  text-align: center;
147
157
  }
148
- `,Bl=({onStart:a})=>t(Ze,{width:"75vw",isOpen:!0,hideOverlay:!0,disableAnimation:!0,children:t(ke,{$height:"100%",children:e(Ml,{children:[e(Vl,{children:[t(L,{size:M.L,weight:500,children:Te.GET_STARTED_WITH}),t(jn,{size:260}),t(L,{size:M.S,weight:400,children:Te.GET_STARTED_DESCRIPTION})]}),t(E,{"data-id":"onboarding-get-started",label:et.GET_STARTED,rightIcon:Sn,size:$.L,onClick:a})]})})}),zl=[{step:1,label:Te.INSTALLATION,forceDoneBadge:!0},{step:2,label:Te.SOURCES_SETUP},{step:3,label:Te.DESTINATIONS_SETUP},{step:4,label:Te.SUMMARY}],_l=p.div`
158
+ `,Bi=({onStart:a})=>t(Qe,{width:"75vw",isOpen:!0,hideOverlay:!0,disableAnimation:!0,children:t(ke,{$height:"100%",children:e(Li,{children:[e(Vi,{children:[t(M,{size:L.L,weight:500,children:Te.GET_STARTED_WITH}),t(Xn,{size:260}),t(M,{size:L.S,weight:400,children:Te.GET_STARTED_DESCRIPTION})]}),t(E,{"data-id":"onboarding-get-started",label:Ze.GET_STARTED,rightIcon:Sn,size:$.L,onClick:a})]})})}),zi=[{step:1,label:Te.INSTALLATION,forceDoneBadge:!0},{step:2,label:Te.SOURCES_SETUP},{step:3,label:Te.DESTINATIONS_SETUP},{step:4,label:Te.SUMMARY}],_i=p.div`
149
159
  display: flex;
150
160
  flex-direction: column;
151
161
  gap: 32px;
152
162
  padding: 64px;
153
- `,Ul=({pagePaddingXAxis:a,pagePaddingYAxis:n,fetchNamespacesWithWorkloads:o,persistSources:l,getDestinationCategories:s,getPotentialDestinations:r,testConnection:c,createDestination:d,updateDestination:u,onDone:p})=>{const[m,h]=i(1),[g,b]=i(!1),[f,y]=i(null),[v,C]=i(null),S=()=>h(e=>e+1),w=()=>h(e=>e-1);return e(Ll,{paddingXAxis:a,paddingYAxis:n,children:[e(_l,{children:[t(jn,{}),t(ea,{currentStep:m,data:zl,gap:32})]}),t(Yt,{initialInputs:f,children:e(qt,{children:[1===m&&t(Bl,{onStart:S}),2===m&&t(Yo,{disableAnimation:!0,onBack:e=>{y(e),w()},onNext:e=>{y(e),S()},fetchNamespacesWithWorkloads:o,persistSources:l}),3===m&&t(Vo,{disableAnimation:!0,onBack:e=>{C(e),w()},onNext:e=>{C(e),S()},getDestinationCategories:s,getPotentialDestinations:r,initialInputs:v,testConnection:c,createDestination:d,updateDestination:u}),4===m&&t(Rl,{disableAnimation:!0,setStep:h,onSave:async()=>{if(!g){b(!0);try{const e=[];f&&e.push(l(f)),v&&e.push(...v.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 b(!1),{error:e instanceof Error?e.message:String(e)}}}},sourcesPayload:f,destinationsPayload:v})]})})]})};var jl;!function(e){e.Gateway="gateway",e.Node="node"}(jl||(jl={}));const Xl=({onClickDownloadDiagnose:a,onClickRefresh:n,loading:o,disabled:l})=>{const i=r(()=>{const e=[];return a&&e.push({id:jt(),type:Ht.Button,buttonProps:{label:"Download Diagnose",leftIcon:bn,size:$.S,variant:R.Text,onClick:a,disabled:l}}),n&&e.push({id:jt(),type:Ht.Button,buttonProps:{label:"Refresh",leftIcon:yn,size:$.S,variant:R.Text,onClick:n,disabled:l,loading:o}}),e},[a,n,l,o]);return e(D,{$alignItems:"center",$justifyContent:"space-between",children:[t(ta,{icon:wn,title:"Collectors Pipeline"}),t(aa,{actions:i})]})},Hl=({pod:a,getExtendedPodInfo:o,onClose:l})=>{const{formatTimeAgo:s}=Vt(),[c,d]=i(null);n(()=>{a?o(a.namespace,a.name).then(e=>d(e??null)):d(null)},[a]);const u=r(()=>[{id:jt(),title:"Node",label:c?.node??"-",withCopy:!0},{id:jt(),title:"Status",badge:{status:na(c?.status),label:c?.status??"-"}}],[c]),p=r(()=>c?.containers?.map(e=>({id:jt(),items:[{id:jt(),title:"Container",label:e.name??"-"},{id:jt(),title:"Status",label:e.startedAt?`${e.status} (since ${s(e.startedAt)})`:e.status},{id:jt(),title:"Ready",badge:{status:e.ready?X.Success:X.Error,leftIcon:e.ready?Ga:Ka,label:e.ready?"True":"False",invertColors:!0}},{id:jt(),title:"Started",badge:{status:e.started?X.Success:X.Error,leftIcon:e.started?Ga:Ka,label:e.started?"True":"False",invertColors:!0}},{id:jt(),title:"Image Version",label:e.image?.split(":")?.[1]??"-"},{id:jt(),title:"Image Repository",label:e.image?.split(":")?.[0]??"-"},{id:jt(),title:"Restarts",label:e.restarts.toString()},{id:jt(),title:"State Reason",label:e.stateReason??"-"},{id:jt(),title:"Resource Requests",label:`CPU ${e.resources.requests.cpu} • Memory ${e.resources.requests.memory}`},{id:jt(),title:"Resource Limits",label:`CPU ${e.resources.limits.cpu} • Memory ${e.resources.limits.memory}`}]}))||[],[c]);return t(Ze,{isOpen:!!a,header:{icon:kn,title:"Pod Information",onClose:l},children:c?e(at,{bgTint:"1000",richTitle:{icon:kn,title:c.name,withCopy:!0},children:[t(at,{bgTint:"900",cellsPerRow:2,items:u}),e(at,{bgTint:"900",richTitle:{icon:fn,title:"Kubectl Commands"},withCollapse:!0,collapseIsDefaultOpen:!0,children:[t(oa,{value:`kubectl get pod ${c.name} -n ${c.namespace} -o yaml`}),t(oa,{value:`kubectl describe pod ${c.name} -n ${c.namespace}`}),t(oa,{value:`kubectl logs ${c.name} -n ${c.namespace}`})]}),t(at,{bgTint:"900",richTitle:{title:"Containers Overview"},withCollapse:!0,collapseIsDefaultOpen:!0,children:p.length?p.map(({id:e,items:a})=>t(at,{bgTint:"800",cellsPerRow:2,items:a},e)):t(F,{title:"No containers",subTitle:"Pod has no containers"})}),t(Hn,{bgTint:"900",yaml:c.manifestYAML,defaultOpen:!0})]}):t(ke,{$height:"50vh",children:t(De,{withSpinner:!0})})})};var Wl;!function(e){e.PodName="podName",e.Status="status",e.Restarts="restarts",e.NodeName="nodeName",e.SpanDropDrate="spanDropDrate",e.Age="age",e.DockerImage="dockerImage"}(Wl||(Wl={}));const Gl=[{key:Wl.PodName,label:"Pod Name"},{key:Wl.Status,label:"Status"},{key:Wl.Restarts,label:"Restarts"},{key:Wl.NodeName,label:"Node Name"},{key:Wl.Age,label:"Age"},{key:Wl.DockerImage,label:"Collector Version"}],Kl=({isLoading:a,tableRowsMaxHeight:n,pods:o,getExtendedPodInfo:l})=>{const s=m(),{formatTimeAgo:c}=Vt(),[d,u]=i(null),p=r(()=>o.map(a=>({onClick:()=>u(a),cells:[{key:Wl.PodName,rawValue:a.name},{key:Wl.Status,rawValue:a.status,component:()=>{return e=a.status,t(oe,{status:na(e),label:e});var e}},{key:Wl.Restarts,rawValue:a.restartsCount.toString()},{key:Wl.NodeName,rawValue:a.nodeName},{key:Wl.SpanDropDrate,rawValue:0,component:()=>{const{collectorMetrics:n}=a;if(!n)return t(L,{children:"-"});const o=(n?.metricsAcceptedRps??0)+(n?.metricsDroppedRps??0),l=o>0?Math.round((n?.metricsDroppedRps??0)/o*100):0,i=l>0?X.Error:X.Success,s=(n?.exporterSuccessRps??0)+(n?.exporterFailedRps??0),r=s>0?Math.round((n?.exporterFailedRps??0)/s*100):0,c=r>0?X.Error:X.Success;return e(D,{$gap:4,children:[t(q,{text:`Accepted: ${n.metricsAcceptedRps.toLocaleString()}, Dropped: ${n.metricsDroppedRps.toLocaleString()}`,children:t(oe,{status:i,label:`Receiver ${l}%`,leftIcon:i===X.Error?Tn:Nn,useSecondaryTone:!0,invertColors:!0})}),t(q,{text:`Success: ${n.exporterSuccessRps.toLocaleString()}, Failed: ${n.exporterFailedRps.toLocaleString()}`,children:t(oe,{status:c,label:`Exporter ${r}%`,leftIcon:c===X.Error?Tn:Nn,useSecondaryTone:!0,invertColors:!0})})]})}},{key:Wl.Age,rawValue:c(a.creationTimestamp)},{key:Wl.DockerImage,rawValue:a.image}]})),[o,s]);return e(at,{bgTint:"1000",moreSpacing:!0,richTitle:{icon:kn,title:"Pods"},children:[t(Gt,{variant:Kt.Data,maxHeight:n,isLoading:a,columns:Gl,rows:p}),t(Hl,{pod:d,getExtendedPodInfo:l,onClose:()=>u(null)})]})},Yl=({isOpen:e,onClose:a,title:n,yaml:o})=>t(Ze,{isOpen:e,header:{icon:An,title:n,onClose:a},children:t(Hn,{yaml:o,defaultOpen:!0})}),ql=e=>{switch(e){case la.Healthy:return"All desired replicas are updated, available, and ready";case la.Updating:return"Workload is progressing towards desired state (e.g., updating pods)";case la.Degraded:return"Progressing but with availability issues (e.g., not enough available replicas)";case la.Failed:return"Progress deadline exceeded or an unrecoverable error occurred";case la.Down:return"No available replicas";case la.Unknown:return"Status cannot be determined from current signals";default:return"Status unknown"}};var Jl;!function(e){e.ManifestYaml="manifest-yaml",e.ConfigMapYaml="configmap-yaml"}(Jl||(Jl={}));const Ql=p.div`
163
+ `,Ui=({pagePaddingXAxis:a,pagePaddingYAxis:n,fetchNamespacesWithWorkloads:o,persistSources:i,getDestinationCategories:s,getPotentialDestinations:r,testConnection:c,createDestination:d,updateDestination:u,onDone:p})=>{const[m,h]=l(1),[g,b]=l(!1),[f,y]=l(null),[v,C]=l(null),S=()=>h(e=>e+1),w=()=>h(e=>e-1);return e(Mi,{paddingXAxis:a,paddingYAxis:n,children:[e(_i,{children:[t(Xn,{}),t(qt,{currentStep:m,data:zi,gap:32})]}),t(Ht,{initialInputs:f,children:e(Wt,{children:[1===m&&t(Bi,{onStart:S}),2===m&&t(qo,{disableAnimation:!0,onBack:e=>{y(e),w()},onNext:e=>{y(e),S()},fetchNamespacesWithWorkloads:o,persistSources:i}),3===m&&t(_o,{disableAnimation:!0,onBack:e=>{C(e),w()},onNext:e=>{C(e),S()},getDestinationCategories:s,getPotentialDestinations:r,initialInputs:v,testConnection:c,createDestination:d,updateDestination:u}),4===m&&t(Ri,{disableAnimation:!0,setStep:h,onSave:async()=>{if(!g){b(!0);try{const e=[];f&&e.push(i(f)),v&&e.push(...v.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 b(!1),{error:e instanceof Error?e.message:String(e)}}}},sourcesPayload:f,destinationsPayload:v})]})})]})};var ji;!function(e){e.Gateway="gateway",e.Node="node"}(ji||(ji={}));const Xi=({onClickDownloadDiagnose:a,onClickRefresh:n,loading:o,disabled:i})=>{const l=r(()=>{const e=[];return a&&e.push({id:Bt(),type:_t.Button,buttonProps:{label:"Download Diagnose",leftIcon:bn,size:$.S,variant:R.Text,onClick:a,disabled:i}}),n&&e.push({id:Bt(),type:_t.Button,buttonProps:{label:"Refresh",leftIcon:yn,size:$.S,variant:R.Text,onClick:n,disabled:i,loading:o}}),e},[a,n,i,o]);return e(D,{$alignItems:"center",$justifyContent:"space-between",children:[t(Jt,{icon:wn,title:"Collectors Pipeline"}),t(Qt,{actions:l})]})},Hi=({pod:a,getExtendedPodInfo:o,onClose:i})=>{const{formatTimeAgo:s}=Pt(),[c,d]=l(null);n(()=>{a?o(a.namespace,a.name).then(e=>d(e??null)):d(null)},[a]);const u=r(()=>[{id:Bt(),title:"Node",label:c?.node??"-",withCopy:!0},{id:Bt(),title:"Status",badge:{status:Zt(c?.status),label:c?.status??"-"}}],[c]),p=r(()=>c?.containers?.map(e=>({id:Bt(),items:[{id:Bt(),title:"Container",label:e.name??"-"},{id:Bt(),title:"Status",label:e.startedAt?`${e.status} (since ${s(e.startedAt)})`:e.status},{id:Bt(),title:"Ready",badge:{status:e.ready?X.Success:X.Error,leftIcon:e.ready?Ga:Ka,label:e.ready?"True":"False",invertColors:!0}},{id:Bt(),title:"Started",badge:{status:e.started?X.Success:X.Error,leftIcon:e.started?Ga:Ka,label:e.started?"True":"False",invertColors:!0}},{id:Bt(),title:"Image Version",label:e.image?.split(":")?.[1]??"-"},{id:Bt(),title:"Image Repository",label:e.image?.split(":")?.[0]??"-"},{id:Bt(),title:"Restarts",label:e.restarts.toString()},{id:Bt(),title:"State Reason",label:e.stateReason??"-"},{id:Bt(),title:"Resource Requests",label:`CPU ${e.resources.requests.cpu} • Memory ${e.resources.requests.memory}`},{id:Bt(),title:"Resource Limits",label:`CPU ${e.resources.limits.cpu} • Memory ${e.resources.limits.memory}`}]}))||[],[c]);return t(Qe,{isOpen:!!a,header:{icon:kn,title:"Pod Information",onClose:i},children:c?e(tt,{bgTint:"1000",richTitle:{icon:kn,title:c.name,withCopy:!0},children:[t(tt,{bgTint:"900",cellsPerRow:2,items:u}),e(tt,{bgTint:"900",richTitle:{icon:fn,title:"Kubectl Commands"},withCollapse:!0,collapseIsDefaultOpen:!0,children:[t(ea,{value:`kubectl get pod ${c.name} -n ${c.namespace} -o yaml`}),t(ea,{value:`kubectl describe pod ${c.name} -n ${c.namespace}`}),t(ea,{value:`kubectl logs ${c.name} -n ${c.namespace}`})]}),t(tt,{bgTint:"900",richTitle:{title:"Containers Overview"},withCollapse:!0,collapseIsDefaultOpen:!0,children:p.length?p.map(({id:e,items:a})=>t(tt,{bgTint:"800",cellsPerRow:2,items:a},e)):t(F,{title:"No containers",subTitle:"Pod has no containers"})}),t(Wn,{bgTint:"900",yaml:c.manifestYAML,defaultOpen:!0})]}):t(ke,{$height:"50vh",children:t(Ee,{withSpinner:!0})})})};var Wi;!function(e){e.PodName="podName",e.Status="status",e.Restarts="restarts",e.NodeName="nodeName",e.SpanDropDrate="spanDropDrate",e.Age="age",e.DockerImage="dockerImage"}(Wi||(Wi={}));const Gi=[{key:Wi.PodName,label:"Pod Name"},{key:Wi.Status,label:"Status"},{key:Wi.Restarts,label:"Restarts"},{key:Wi.NodeName,label:"Node Name"},{key:Wi.Age,label:"Age"},{key:Wi.DockerImage,label:"Collector Version"}],Ki=({isLoading:a,tableRowsMaxHeight:n,pods:o,getExtendedPodInfo:i})=>{const s=m(),{formatTimeAgo:c}=Pt(),[d,u]=l(null),p=r(()=>o.map(a=>({onClick:()=>u(a),cells:[{key:Wi.PodName,rawValue:a.name},{key:Wi.Status,rawValue:a.status,component:()=>{return e=a.status,t(oe,{status:Zt(e),label:e});var e}},{key:Wi.Restarts,rawValue:a.restartsCount.toString()},{key:Wi.NodeName,rawValue:a.nodeName},{key:Wi.SpanDropDrate,rawValue:0,component:()=>{const{collectorMetrics:n}=a;if(!n)return t(M,{children:"-"});const o=(n?.metricsAcceptedRps??0)+(n?.metricsDroppedRps??0),i=o>0?Math.round((n?.metricsDroppedRps??0)/o*100):0,l=i>0?X.Error:X.Success,s=(n?.exporterSuccessRps??0)+(n?.exporterFailedRps??0),r=s>0?Math.round((n?.exporterFailedRps??0)/s*100):0,c=r>0?X.Error:X.Success;return e(D,{$gap:4,children:[t(q,{text:`Accepted: ${n.metricsAcceptedRps.toLocaleString()}, Dropped: ${n.metricsDroppedRps.toLocaleString()}`,children:t(oe,{status:l,label:`Receiver ${i}%`,leftIcon:l===X.Error?Tn:An,useSecondaryTone:!0,invertColors:!0})}),t(q,{text:`Success: ${n.exporterSuccessRps.toLocaleString()}, Failed: ${n.exporterFailedRps.toLocaleString()}`,children:t(oe,{status:c,label:`Exporter ${r}%`,leftIcon:c===X.Error?Tn:An,useSecondaryTone:!0,invertColors:!0})})]})}},{key:Wi.Age,rawValue:c(a.creationTimestamp)},{key:Wi.DockerImage,rawValue:a.image}]})),[o,s]);return e(tt,{bgTint:"1000",moreSpacing:!0,richTitle:{icon:kn,title:"Pods"},children:[t(jt,{variant:Xt.Data,maxHeight:n,isLoading:a,columns:Gi,rows:p}),t(Hi,{pod:d,getExtendedPodInfo:i,onClose:()=>u(null)})]})},Yi=({isOpen:e,onClose:a,title:n,yaml:o})=>t(Qe,{isOpen:e,header:{icon:Nn,title:n,onClose:a},children:t(Wn,{yaml:o,defaultOpen:!0})}),qi=e=>{switch(e){case ta.Healthy:return"All desired replicas are updated, available, and ready";case ta.Updating:return"Workload is progressing towards desired state (e.g., updating pods)";case ta.Degraded:return"Progressing but with availability issues (e.g., not enough available replicas)";case ta.Failed:return"Progress deadline exceeded or an unrecoverable error occurred";case ta.Down:return"No available replicas";case ta.Unknown:return"Status cannot be determined from current signals";default:return"Status unknown"}};var Ji;!function(e){e.ManifestYaml="manifest-yaml",e.ConfigMapYaml="configmap-yaml"}(Ji||(Ji={}));const Qi=p.div`
154
164
  flex: 0.5;
155
165
  padding: 12px;
156
166
  border-radius: 12px;
157
167
  background-color: ${({theme:e})=>e.v2.colors.silver[800]};
158
- `,Zl=({selectedTab:a,gatewayInfo:n,nodeCollectorInfo:o,isLoading:l})=>{const{formatTimeAgo:s}=Vt(),[c,d]=i(null),u=r(()=>(e=>{switch(e){case jl.Gateway:return"Deployment";case jl.Node:return"DaemonSet";default:return"Pipeline Collectors"}})(a),[a]),p=r(()=>((e,t,a,n)=>{const o={status:ze.Disabled,label:"No rollouts yet"};let l=!1,i=null;switch(e){case jl.Gateway:l=t?.rolloutInProgress??!1,i=t?.lastRolloutAt??null;break;case jl.Node:l=a?.rolloutInProgress??!1,i=a?.lastRolloutAt??null;break;default:return o}return l?{status:X.Info,label:"Rollout in progress",rightIcon:yn,useSecondaryTone:!0}:i?{status:ze.Disabled,label:`Last Rollout: ${n(i)}`}:o})(a,n,o,s),[n,o,a,s]),m=r(()=>((e,t,a,n)=>{let o=n?X.Info:ze.Unknown,l=n?"Loading":la.Unknown,i=n?"Fetching data...":ql(la.Unknown);switch(e){case jl.Gateway:o=t?.status?na(t?.status):o,l=t?.status??l,i=t?.status?ql(t.status):i;break;case jl.Node:o=a?.status?na(a?.status):o,l=a?.status??l,i=a?.status?ql(a.status):i}return{status:o,title:l,description:i}})(a,n,o,l),[n,o,a,l]),h=r(()=>((e,t,a)=>{switch(e){case jl.Gateway:return[{gaugeWidth:128,min:0,max:t?.hpa?.max??0,current:t?.hpa?.current??0,title:"HPA Spec",primaryLabel:"Current replicas",secondaryLabel:"Max replicas"}];case jl.Node:return[{gaugeWidth:128,min:0,max:a?.nodes?.desired??0,current:a?.nodes?.ready??0,title:"Nodes",primaryLabel:"Ready nodes",secondaryLabel:"Desired nodes"}];default:return[]}})(a,n,o),[n,o,a]),g=r(()=>((e,t,a,n)=>{switch(e){case jl.Gateway:return[{title:"Resources (request/limit)",cells:[{label:"CPU",value:`${t?.resources?.requests.cpu}/${t?.resources?.limits.cpu}`,isLoading:n},{label:"Memory",value:`${t?.resources?.requests.memory}/${t?.resources?.limits.memory}`,isLoading:n}]}];case jl.Node:return[{title:"Resources (request/limit)",cells:[{label:"CPU",value:`${a?.resources?.requests.cpu}/${a?.resources?.limits.cpu}`,isLoading:n},{label:"Memory",value:`${a?.resources?.requests.memory}/${a?.resources?.limits.memory}`,isLoading:n}]}];default:return[]}})(a,n,o,l),[n,o,a,l]),b=r(()=>(a===jl.Gateway?n?.manifestYAML:o?.manifestYAML)??"",[n,o,a]),f=r(()=>(a===jl.Gateway?n?.configMapYAML:o?.configMapYAML)??"",[n,o,a]);return e(at,{bgTint:"1000",moreSpacing:!0,richTitle:{icon:An,title:u,badge:p},actions:[{id:jt(),type:Ht.ButtonDropData,buttonProps:{variant:R.Secondary,size:$.S,label:"View YAML",onClick:e=>d(e)},dropDataProps:{items:[{id:Jl.ManifestYaml,label:u,icon:In},{id:Jl.ConfigMapYaml,label:"ConfigMap",icon:In}]}}],children:[e(D,{$gap:16,children:[t("div",{children:t(ia,{...m})}),h.map(e=>t(Ql,{children:t("div",{children:t(sa,{...e})})},e.title)),g.map(e=>t(ra,{...e},e.title))]}),t(Yl,{isOpen:c===Jl.ManifestYaml,onClose:()=>d(null),title:u,yaml:b}),t(Yl,{isOpen:c===Jl.ConfigMapYaml,onClose:()=>d(null),title:"ConfigMap",yaml:f})]})},ei=[{value:jl.Gateway,label:"Gateway"},{value:jl.Node,label:"Node Collector"}],ti=({minSupportedVersion:a=0,tableRowsMaxHeight:o,getGatewayInfo:l,getGatewayPods:s,getNodeCollectorInfo:d,getNodeCollectorPods:u,getExtendedPodInfo:p})=>{const{isVersionSupported:m,version:h}=Me(a),[b,f]=i(!1),[y,v]=i(jl.Gateway),[C,S]=i(null),[w,k]=i([]),[T,N]=i(null),[A,I]=i([]),D=c(async()=>{f(!0);try{switch(y){case jl.Gateway:S(await l()??null),k(await s()??[]);break;case jl.Node:N(await d()??null),I(await u()??[])}}catch(e){}f(!1)},[y]);n(()=>{D()},[D]);const E=r(()=>y===jl.Gateway?w:A,[w,A,y]);return e(Wt,{children:[t(Xl,{disabled:!m,loading:b,onClickDownloadDiagnose:void 0,onClickRefresh:D}),e(ca,{children:[e(g,{children:[t(B,{variant:da.Underline,options:ei,selected:y,setSelected:v}),t(Zl,{selectedTab:y,gatewayInfo:C,nodeCollectorInfo:T,isLoading:b})]}),t(Kl,{isLoading:b,tableRowsMaxHeight:o,pods:E,getExtendedPodInfo:p}),!m&&t(Xn,{minSupportedVersion:a,currentVersion:h||""})]})]})},ai=p.div`
168
+ `,Zi=({selectedTab:a,gatewayInfo:n,nodeCollectorInfo:o,isLoading:i})=>{const{formatTimeAgo:s}=Pt(),[c,d]=l(null),u=r(()=>(e=>{switch(e){case ji.Gateway:return"Deployment";case ji.Node:return"DaemonSet";default:return"Pipeline Collectors"}})(a),[a]),p=r(()=>((e,t,a,n)=>{const o={status:Be.Disabled,label:"No rollouts yet"};let i=!1,l=null;switch(e){case ji.Gateway:i=t?.rolloutInProgress??!1,l=t?.lastRolloutAt??null;break;case ji.Node:i=a?.rolloutInProgress??!1,l=a?.lastRolloutAt??null;break;default:return o}return i?{status:X.Info,label:"Rollout in progress",rightIcon:yn,useSecondaryTone:!0}:l?{status:Be.Disabled,label:`Last Rollout: ${n(l)}`}:o})(a,n,o,s),[n,o,a,s]),m=r(()=>((e,t,a,n)=>{let o=n?X.Info:Be.Unknown,i=n?"Loading":ta.Unknown,l=n?"Fetching data...":qi(ta.Unknown);switch(e){case ji.Gateway:o=t?.status?Zt(t?.status):o,i=t?.status??i,l=t?.status?qi(t.status):l;break;case ji.Node:o=a?.status?Zt(a?.status):o,i=a?.status??i,l=a?.status?qi(a.status):l}return{status:o,title:i,description:l}})(a,n,o,i),[n,o,a,i]),h=r(()=>((e,t,a)=>{switch(e){case ji.Gateway:return[{gaugeWidth:128,min:0,max:t?.hpa?.max??0,current:t?.hpa?.current??0,title:"HPA Spec",primaryLabel:"Current replicas",secondaryLabel:"Max replicas"}];case ji.Node:return[{gaugeWidth:128,min:0,max:a?.nodes?.desired??0,current:a?.nodes?.ready??0,title:"Nodes",primaryLabel:"Ready nodes",secondaryLabel:"Desired nodes"}];default:return[]}})(a,n,o),[n,o,a]),g=r(()=>((e,t,a,n)=>{switch(e){case ji.Gateway:return[{title:"Resources (request/limit)",cells:[{label:"CPU",value:`${t?.resources?.requests.cpu}/${t?.resources?.limits.cpu}`,isLoading:n},{label:"Memory",value:`${t?.resources?.requests.memory}/${t?.resources?.limits.memory}`,isLoading:n}]}];case ji.Node:return[{title:"Resources (request/limit)",cells:[{label:"CPU",value:`${a?.resources?.requests.cpu}/${a?.resources?.limits.cpu}`,isLoading:n},{label:"Memory",value:`${a?.resources?.requests.memory}/${a?.resources?.limits.memory}`,isLoading:n}]}];default:return[]}})(a,n,o,i),[n,o,a,i]),b=r(()=>(a===ji.Gateway?n?.manifestYAML:o?.manifestYAML)??"",[n,o,a]),f=r(()=>(a===ji.Gateway?n?.configMapYAML:o?.configMapYAML)??"",[n,o,a]);return e(tt,{bgTint:"1000",moreSpacing:!0,richTitle:{icon:Nn,title:u,badge:p},actions:[{id:Bt(),type:_t.ButtonDropData,buttonProps:{variant:R.Secondary,size:$.S,label:"View YAML",onClick:e=>d(e)},dropDataProps:{items:[{id:Ji.ManifestYaml,label:u,icon:In},{id:Ji.ConfigMapYaml,label:"ConfigMap",icon:In}]}}],children:[e(D,{$gap:16,children:[t("div",{children:t(aa,{...m})}),h.map(e=>t(Qi,{children:t("div",{children:t(na,{...e})})},e.title)),g.map(e=>t(oa,{...e},e.title))]}),t(Yi,{isOpen:c===Ji.ManifestYaml,onClose:()=>d(null),title:u,yaml:b}),t(Yi,{isOpen:c===Ji.ConfigMapYaml,onClose:()=>d(null),title:"ConfigMap",yaml:f})]})},el=[{value:ji.Gateway,label:"Gateway"},{value:ji.Node,label:"Node Collector"}],tl=({minSupportedVersion:a=0,tableRowsMaxHeight:o,getGatewayInfo:i,getGatewayPods:s,getNodeCollectorInfo:d,getNodeCollectorPods:u,getExtendedPodInfo:p})=>{const{isVersionSupported:m,version:h}=Me(a),[b,f]=l(!1),[y,v]=l(ji.Gateway),[C,S]=l(null),[w,k]=l([]),[T,A]=l(null),[N,I]=l([]),D=c(async()=>{f(!0);try{switch(y){case ji.Gateway:S(await i()??null),k(await s()??[]);break;case ji.Node:A(await d()??null),I(await u()??[])}}catch(e){}f(!1)},[y]);n(()=>{D()},[D]);const E=r(()=>y===ji.Gateway?w:N,[w,N,y]);return e(Ut,{children:[t(Xi,{disabled:!m,loading:b,onClickDownloadDiagnose:void 0,onClickRefresh:D}),e(ia,{children:[e(g,{children:[t(B,{variant:la.Underline,options:el,selected:y,setSelected:v}),t(Zi,{selectedTab:y,gatewayInfo:C,nodeCollectorInfo:T,isLoading:b})]}),t(Ki,{isLoading:b,tableRowsMaxHeight:o,pods:E,getExtendedPodInfo:p}),!m&&t(Hn,{minSupportedVersion:a,currentVersion:h||""})]})]})},al=p.div`
159
169
  display: inline-flex;
160
170
  align-items: center;
161
- padding: 4px 8px;
162
- border-radius: 4px;
163
- background-color: ${({theme:e})=>e.v2.colors.silver[800]};
164
171
  min-width: 0;
165
172
  overflow: hidden;
166
173
  white-space: pre;
167
174
  text-overflow: ellipsis;
168
- `,ni=p.div`
169
- display: inline-flex;
170
- align-items: center;
171
- gap: 24px;
175
+ `,nl=p.div`
176
+ display: flex;
177
+ flex-direction: column;
178
+ gap: 4px;
172
179
  min-width: 0;
173
180
  flex: 1;
174
181
  opacity: ${({$disabled:e})=>e?.4:1};
175
- overflow: hidden;
176
- white-space: pre;
177
- text-overflow: ellipsis;
178
- `,oi=p(D)`
182
+ `,ol=p(D)`
179
183
  flex-shrink: 0;
180
184
  gap: 6px;
181
185
  align-items: center;
182
186
  min-height: 22px;
183
- `;const li=[{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"}],ii=[{value:"all",label:ma},{value:"Relevance",label:"Relevance"},{value:"Duration",label:"Duration"},{value:"Error",label:"Error"}],si=({title:a,items:n,isLoading:o,showTypeFilter:l,tableRowsMaxHeight:s,onRuleClick:d,onCreateRule:u,onEditRule:p,onDeleteRule:h})=>{const g=m(),[b,f]=i(""),[y,v]=i("all"),C=r(()=>{let e=function(e,t,a){return a&&"all"!==t?e.filter(e=>e.typeBadge===t):e}(n,y,l);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,b),e},[n,y,l,b]),S=r(()=>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]}}}(g,a.typeBadge):void 0;return{cells:[{key:"name",rawValue:a.name||"",component:()=>t(ni,{$disabled:a.disabled,children:a.name&&t(L,{size:M.XXS,color:g.v2.colors.white[500],nowrap:!0,children:a.name})})},{key:"summary",rawValue:a.summary.map(e=>e.text).join(""),component:()=>t(ni,{$disabled:a.disabled,children:t(ai,{children:t(ua,{parts:a.summary})})})},{key:"badges",rawValue:a.typeBadge||"",component:()=>e(oi,{children:[a.disabled&&t(oe,{label:pa,textSize:M.XXXS,backgroundColor:g.v2.colors.grey[700],textColor:g.v2.colors.grey[300]}),a.typeBadge&&n&&t(oe,{label:a.typeBadge,textSize:M.XXXS,backgroundColor:n.bg,textColor:n.text})]})}],onClick:()=>d(a)}}),[C,g,d]),w=r(()=>{const e=e=>t(Ya,{...e,fill:g.v2.colors.red[500]});return e.displayName="RedDeleteIcon",e},[g]),k=c(e=>{const t=S.indexOf(e);if(t<0)return[];const a=C[t];return a?[{id:"edit","data-id":"sampling-rule-action-edit",label:ft,leftIcon:qa,onClick:()=>p(a.ruleId,a.samplingId)},{id:"delete","data-id":"sampling-rule-action-delete",label:"",leftIcon:w,onClick:()=>h(a.ruleId,a.samplingId)}]:[]},[S,C,p,h,w]);return t(ye,{fullHeight:!0,richTitle:{icon:un,title:a,badge:{label:n.length,backgroundColor:g.v2.colors.silver[600],textColor:g.v2.colors.white[500]}},search:{"data-id":"sampling-search-rules",value:b,onChange:f,placeholder:"Search..",width:"500px",...l?{segment:{"data-id":"sampling-segment-type-filter",options:ii,selected:y,setSelected:v}}:{}},children:t(Gt,{variant:Kt.Pretty,hideHeader:!0,maxHeight:s,isLoading:o,noDataProps:{hideIcon:!0,title:"No Rules Exist",button:{label:"Create your first rule",onClick:u}},columns:li,rows:S,getRowActions:k})})},ri=a=>{const{workloads:o,samplingRules:l,k8sHealthProbesConfig:s,loading:u,tableRowsMaxHeight:p,fetchSamplingRules:m,createNoisyOperationRule:h,updateNoisyOperationRule:b,createHighlyRelevantOperationRule:f,updateHighlyRelevantOperationRule:y,createCostReductionRule:v,updateCostReductionRule:C,deleteSamplingRule:S,updateK8sHealthProbesConfig:w}=a,k=r(()=>o.map(({id:e})=>({id:`${e.namespace}/${e.kind}/${e.name}`,label:`${e.namespace} / ${e.kind} / ${e.name}`})),[o]),T=r(()=>Array.from(new Set(o.map(({id:e})=>e.namespace))).sort().map(e=>({id:e,label:e})),[o]),[N,A]=i(ha.Noisy),[I,x]=i(null),[O,P]=i(!1),[F,L]=i(!1),[M,V]=i(null),[z,_]=i(!1),[U,H]=i(!1),[W,G]=i(!1),K=r(()=>ga(s),[s]),Y=r(()=>ba(l),[l]),q=r(()=>fa(Y?.rule??null),[Y]),J=r(()=>ya(l),[l]),Q=r(()=>va(J?.rule??null),[J]),Z=d(I);Z.current=I,n(()=>{const e=Z.current;if(!e)return;const t=Ca(l,e);t?x(t):(x(null),P(!1))},[l]);const ee=r(()=>{const e=new Set;return Y&&e.add(Y.rule.ruleId),J&&e.add(J.rule.ruleId),e},[Y,J]),te=r(()=>Sa(l,N,ee),[l,N,ee]),ae=c(()=>L(!0),[]),ne=c(()=>L(!1),[]),oe=c(e=>{const t=l[0]?.id??"default";switch(Ia[N]){case"noisy":h(t,Ta(e));break;case"highlyRelevant":f(t,ka(e));break;case"costReduction":v(t,wa(e))}L(!1)},[l,N,h,f,v]),le=c(e=>{const t=Na(l,e);t&&(P(!1),x(t))},[l]),ie=c(()=>{x(null),P(!1)},[]),se=c((e,t)=>{const a=I;if(a&&a.rule.ruleId===e&&a.samplingId===t)P(!0),x({...a});else for(const a of l){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 P(!0),void x({category:n.category,rule:n.rule,samplingId:t,summary:Aa(n.category,n.rule)})}},[I,l]),de=c((e,t,a)=>{const n=I?.category;if(n){switch(n){case"noisy":b(a,t,Ta(e));break;case"highlyRelevant":y(a,t,ka(e));break;case"costReduction":C(a,t,wa(e))}P(!1)}},[I,b,y,C]),ue=c((e,t)=>{V({ruleId:e,samplingId:t})},[]),pe=c(()=>{if(!M)return;const{ruleId:e,samplingId:t}=M,a=I?.category||Ia[N];S(t,e,a),x(null),P(!1),V(null)},[M,I,N,S]),he=c(()=>V(null),[]),ge=c((e,t)=>{w(e,t),_(!1)},[w]),be=c(e=>{const t=l[0]?.id??"default",a=Y;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&&f(t,{name:"Auto - Keep All Error Traces",disabled:!1,error:!0,sourceScopes:[],operation:null,percentageAtLeast:null}),H(!1)},[l,Y,f,y]),ye=c((e,t)=>{const a=l[0]?.id??"default",n=J;n?C(n.samplingId,n.rule.ruleId,{name:n.rule.name,disabled:!e,sourceScopes:[],operation:null,percentageAtMost:t,notes:n.rule.notes}):e&&v(a,{name:"Auto - Drop Traces Cluster-Wide",disabled:!1,sourceScopes:[],operation:null,percentageAtMost:t}),G(!1)},[l,J,v,C]),ve=c(e=>{const t=Ia[N];let a=null;switch(t){case"noisy":{const n=Ta(e);a=Da(l,t,{sourceScopes:n.sourceScopes,operation:n.operation});break}case"highlyRelevant":{const n=ka(e);a=Da(l,t,{sourceScopes:n.sourceScopes,operation:n.operation,error:n.error??!1,durationAtLeastMs:n.durationAtLeastMs});break}case"costReduction":{const n=wa(e);a=Da(l,t,{sourceScopes:n.sourceScopes,operation:n.operation});break}}return a?{message:Ea,ruleId:a}:null},[l,N]),Ce=c(e=>{const t=I?.category,a=I?.rule.ruleId;if(!t)return null;let n=null;switch(t){case"noisy":{const o=Ta(e);n=Da(l,t,{sourceScopes:o.sourceScopes,operation:o.operation},a);break}case"highlyRelevant":{const o=ka(e);n=Da(l,t,{sourceScopes:o.sourceScopes,operation:o.operation,error:o.error??!1,durationAtLeastMs:o.durationAtLeastMs},a);break}case"costReduction":{const o=wa(e);n=Da(l,t,{sourceScopes:o.sourceScopes,operation:o.operation},a);break}}return n?{message:Ea,ruleId:n}:null},[l,I]),Se=c(e=>{L(!1);for(const t of l){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 P(!0),void x({category:a.category,rule:a.rule,samplingId:t.id,summary:Aa(a.category,a.rule)})}},[l]),we=r(()=>{const e=[];return a.docsUrl&&e.push({id:jt(),type:Ht.Button,buttonProps:{"data-id":"sampling-btn-docs",label:$a,leftIcon:Wa,size:$.S,variant:R.Text,onClick:()=>window.open(a.docsUrl,"_blank")}}),e.push({id:jt(),type:Ht.Button,buttonProps:{"data-id":"sampling-btn-refresh",label:Ra,leftIcon:yn,size:$.S,variant:R.Text,onClick:m,loading:u}}),e.push({id:jt(),type:Ht.Button,buttonProps:{"data-id":"sampling-btn-create-rule",label:xa,rightIcon:Ha,size:$.S,variant:R.Primary,onClick:ae}}),e},[a.docsUrl,m,u,ae]);return e(Wt,{children:[e(D,{$gap:12,$justifyContent:"space-between",children:[t(ta,{icon:un,title:Pa,subTitle:Oa}),t(aa,{actions:we})]}),e(g,{$gap:12,children:[t(B,{variant:da.Underline,options:Fa,selected:N,setSelected:A}),e(D,{$justifyContent:"space-between",children:[t(j,{status:X.Default,message:La[N]}),a.docsUrl&&t(E,{"data-id":"sampling-btn-docs-banner",label:"Docs",leftIcon:Wa,size:$.S,variant:R.Text,onClick:()=>window.open(a.docsUrl,"_blank")})]}),N===ha.Noisy?t($n,{title:fe,summary:K,onEdit:()=>_(!0)}):N===ha.HighlyRelevant?t($n,{title:ce,summary:q,onEdit:()=>H(!0)}):N===ha.CostReduction?t($n,{title:me,summary:Q,onEdit:()=>G(!0)}):null,t(si,{title:Ma[N],items:te,isLoading:u,showTypeFilter:N===ha.HighlyRelevant,tableRowsMaxHeight:p,onRuleClick:le,onCreateRule:ae,onEditRule:se,onDeleteRule:ue})]}),t(ml,{formType:re.View,data:I,defaultEditMode:O,onClose:ie,onDelete:ue,onSaveEdit:de,sourceOptions:k,namespaceOptions:T,validateForm:Ce,onNavigateToDuplicate:Se}),t(ml,{formType:re.Create,isOpen:F,category:Ia[N],onClose:ne,onSubmit:oe,sourceOptions:k,namespaceOptions:T,validateForm:ve,onNavigateToDuplicate:Se}),t(ml,{formType:re.EditAutoNoisy,isOpen:z,enabled:s?.enabled??!1,keepPercentage:s?.keepPercentage??0,onClose:()=>_(!1),onSave:ge}),t(ml,{formType:re.EditAutoHighlyRelevant,isOpen:U,enabled:!!Y&&!Y.rule.disabled,onClose:()=>H(!1),onSave:be}),t(ml,{formType:re.EditAutoCostReduction,isOpen:W,enabled:!!J&&!J.rule.disabled,dropPercentage:J?.rule.percentageAtMost??25,onClose:()=>G(!1),onSave:ye}),t(Va,{title:Ua,description:_a,isOpen:!!M,onClose:he,onApprove:pe,approveLabel:za,denyLabel:Ba})]})},ci=p.div`
187
+ `;const il=[{key:"content",label:"Content",noSort:!0,noFilter:!0},{key:"badges",label:"Type",noSort:!0,noFilter:!0,flex:"0 0 128px"}],ll=[{value:"all",label:ca},{value:"Relevance",label:"Relevance"},{value:"Duration",label:"Duration"},{value:"Error",label:"Error"}],sl=({title:a,items:n,isLoading:o,showTypeFilter:i,tableRowsMaxHeight:s,onRuleClick:d,onCreateRule:u,onEditRule:p,onDeleteRule:h})=>{const g=m(),[b,f]=l(""),[y,v]=l("all"),C=r(()=>{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,b),e},[n,y,i,b]),S=r(()=>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]}}}(g,a.typeBadge):void 0;return{cells:[{key:"content",rawValue:a.summary.map(e=>e.text).join(""),component:()=>e(nl,{$disabled:a.disabled,children:[t(al,{children:t(sa,{parts:a.summary})}),a.name&&t(M,{size:L.XXS,color:g.v2.colors.silver[200],nowrap:!0,children:a.name})]})},{key:"badges",rawValue:a.typeBadge||"",component:()=>e(ol,{children:[a.disabled&&t(oe,{label:ra,textSize:L.XXXS,backgroundColor:g.v2.colors.grey[700],textColor:g.v2.colors.grey[300]}),a.typeBadge&&n&&t(oe,{label:a.typeBadge,textSize:L.XXXS,backgroundColor:n.bg,textColor:n.text})]})}],onClick:()=>d(a)}}),[C,g,d]),w=r(()=>{const e=e=>t(Ya,{...e,fill:g.v2.colors.red[500]});return e.displayName="RedDeleteIcon",e},[g]),k=c(e=>{const t=S.indexOf(e);if(t<0)return[];const a=C[t];return a?[{id:"edit","data-id":"sampling-rule-action-edit",label:bt,leftIcon:qa,onClick:()=>p(a.ruleId,a.samplingId)},{id:"delete","data-id":"sampling-rule-action-delete",label:"",leftIcon:w,onClick:()=>h(a.ruleId,a.samplingId)}]:[]},[S,C,p,h,w]);return t(ye,{fullHeight:!0,richTitle:{icon:un,title:a,badge:{label:n.length,backgroundColor:g.v2.colors.silver[600],textColor:g.v2.colors.white[500]}},search:{"data-id":"sampling-search-rules",value:b,onChange:f,placeholder:"Search..",width:"500px",...i?{segment:{"data-id":"sampling-segment-type-filter",options:ll,selected:y,setSelected:v}}:{}},children:t(jt,{variant:Xt.Pretty,hideHeader:!0,maxHeight:s,isLoading:o,noDataProps:b.trim()?{hideIcon:!0,title:da,subTitle:ma(b)}:{hideIcon:!0,title:pa,button:{label:ua,onClick:u}},columns:il,rows:S,getRowActions:k})})},rl=a=>{const{workloads:o,samplingRules:i,k8sHealthProbesConfig:s,loading:u,tableRowsMaxHeight:p,fetchSamplingRules:m,createNoisyOperationRule:h,updateNoisyOperationRule:b,createHighlyRelevantOperationRule:f,updateHighlyRelevantOperationRule:y,createCostReductionRule:v,updateCostReductionRule:C,deleteSamplingRule:S,updateK8sHealthProbesConfig:w}=a,k=r(()=>o.map(({id:e})=>({id:`${e.namespace}/${e.kind}/${e.name}`,label:`${e.namespace} / ${e.kind} / ${e.name}`})),[o]),T=r(()=>Array.from(new Set(o.map(({id:e})=>e.namespace))).sort().map(e=>({id:e,label:e})),[o]),[A,N]=l(ha.Noisy),[I,x]=l(null),[O,P]=l(!1),[F,M]=l(!1),[L,V]=l(null),[z,_]=l(!1),[U,H]=l(!1),[W,G]=l(!1),K=r(()=>ga(s),[s]),Y=r(()=>ba(i),[i]),q=r(()=>fa(Y?.rule??null),[Y]),J=r(()=>ya(i),[i]),Q=r(()=>va(J?.rule??null),[J]),Z=d(I);Z.current=I,n(()=>{const e=Z.current;if(!e)return;const t=Ca(i,e);t?x(t):(x(null),P(!1))},[i]);const ee=r(()=>{const e=new Set;return Y&&e.add(Y.rule.ruleId),J&&e.add(J.rule.ruleId),e},[Y,J]),te=r(()=>Sa(i,A,ee),[i,A,ee]),ae=c(()=>M(!0),[]),ne=c(()=>M(!1),[]),oe=c(e=>{const t=i[0]?.id??"default";switch(Ia[A]){case"noisy":h(t,Ta(e));break;case"highlyRelevant":f(t,ka(e));break;case"costReduction":v(t,wa(e))}M(!1)},[i,A,h,f,v]),ie=c(e=>{const t=Aa(i,e);t&&(P(!1),x(t))},[i]),le=c(()=>{x(null),P(!1)},[]),se=c((e,t)=>{const a=I;if(a&&a.rule.ruleId===e&&a.samplingId===t)P(!0),x({...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 P(!0),void x({category:n.category,rule:n.rule,samplingId:t,summary:Na(n.category,n.rule)})}},[I,i]),de=c((e,t,a)=>{const n=I?.category;if(n){switch(n){case"noisy":b(a,t,Ta(e));break;case"highlyRelevant":y(a,t,ka(e));break;case"costReduction":C(a,t,wa(e))}P(!1)}},[I,b,y,C]),ue=c((e,t)=>{V({ruleId:e,samplingId:t})},[]),pe=c(()=>{if(!L)return;const{ruleId:e,samplingId:t}=L,a=I?.category||Ia[A];S(t,e,a),x(null),P(!1),V(null)},[L,I,A,S]),ge=c(()=>V(null),[]),be=c((e,t)=>{w(e,t),_(!1)},[w]),fe=c(e=>{const t=i[0]?.id??"default",a=Y;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&&f(t,{name:"Auto - Keep All Error Traces",disabled:!1,error:!0,sourceScopes:[],operation:null,percentageAtLeast:null}),H(!1)},[i,Y,f,y]),ye=c((e,t)=>{const a=i[0]?.id??"default",n=J;n?C(n.samplingId,n.rule.ruleId,{name:n.rule.name,disabled:!e,sourceScopes:[],operation:null,percentageAtMost:t,notes:n.rule.notes}):e&&v(a,{name:"Auto - Drop Traces Cluster-Wide",disabled:!1,sourceScopes:[],operation:null,percentageAtMost:t}),G(!1)},[i,J,v,C]),ve=c(e=>{const t=Ia[A];let a=null;switch(t){case"noisy":{const n=Ta(e);a=Da(i,t,{sourceScopes:n.sourceScopes,operation:n.operation});break}case"highlyRelevant":{const n=ka(e);a=Da(i,t,{sourceScopes:n.sourceScopes,operation:n.operation,error:n.error??!1,durationAtLeastMs:n.durationAtLeastMs});break}case"costReduction":{const n=wa(e);a=Da(i,t,{sourceScopes:n.sourceScopes,operation:n.operation});break}}return a?{message:Ea,ruleId:a}:null},[i,A]),Ce=c(e=>{const t=I?.category,a=I?.rule.ruleId;if(!t)return null;let n=null;switch(t){case"noisy":{const o=Ta(e);n=Da(i,t,{sourceScopes:o.sourceScopes,operation:o.operation},a);break}case"highlyRelevant":{const o=ka(e);n=Da(i,t,{sourceScopes:o.sourceScopes,operation:o.operation,error:o.error??!1,durationAtLeastMs:o.durationAtLeastMs},a);break}case"costReduction":{const o=wa(e);n=Da(i,t,{sourceScopes:o.sourceScopes,operation:o.operation},a);break}}return n?{message:Ea,ruleId:n}:null},[i,I]),Se=c(e=>{M(!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 P(!0),void x({category:a.category,rule:a.rule,samplingId:t.id,summary:Na(a.category,a.rule)})}},[i]),we=r(()=>{const e=[];return a.docsUrl&&e.push({id:Bt(),type:_t.Button,buttonProps:{"data-id":"sampling-btn-docs",label:$a,leftIcon:Wa,size:$.S,variant:R.Text,onClick:()=>window.open(a.docsUrl,"_blank")}}),e.push({id:Bt(),type:_t.Button,buttonProps:{"data-id":"sampling-btn-refresh",label:Ra,leftIcon:yn,size:$.S,variant:R.Text,onClick:m,loading:u}}),e.push({id:Bt(),type:_t.Button,buttonProps:{"data-id":"sampling-btn-create-rule",label:xa,rightIcon:Ha,size:$.S,variant:R.Primary,onClick:ae}}),e},[a.docsUrl,m,u,ae]);return e(Ut,{children:[e(D,{$gap:12,$justifyContent:"space-between",children:[t(Jt,{icon:un,title:Pa,subTitle:Oa}),t(Qt,{actions:we})]}),e(g,{$gap:12,children:[t(B,{variant:la.Underline,options:Fa,selected:A,setSelected:N}),e(D,{$justifyContent:"space-between",children:[t(j,{status:X.Default,message:Ma[A]}),a.docsUrl&&t(E,{"data-id":"sampling-btn-docs-banner",label:"Docs",leftIcon:Wa,size:$.S,variant:R.Text,onClick:()=>window.open(a.docsUrl,"_blank")})]}),A===ha.Noisy?t($n,{title:he,summary:K,onEdit:()=>_(!0)}):A===ha.HighlyRelevant?t($n,{title:ce,summary:q,onEdit:()=>H(!0)}):A===ha.CostReduction?t($n,{title:me,summary:Q,onEdit:()=>G(!0)}):null,t(sl,{title:La[A],items:te,isLoading:u,showTypeFilter:A===ha.HighlyRelevant,tableRowsMaxHeight:p,onRuleClick:ie,onCreateRule:ae,onEditRule:se,onDeleteRule:ue})]}),t(mi,{formType:re.View,data:I,defaultEditMode:O,onClose:le,onDelete:ue,onSaveEdit:de,sourceOptions:k,namespaceOptions:T,validateForm:Ce,onNavigateToDuplicate:Se}),t(mi,{formType:re.Create,isOpen:F,category:Ia[A],onClose:ne,onSubmit:oe,sourceOptions:k,namespaceOptions:T,validateForm:ve,onNavigateToDuplicate:Se}),t(mi,{formType:re.EditAutoNoisy,isOpen:z,enabled:s?.enabled??!1,keepPercentage:s?.keepPercentage??0,onClose:()=>_(!1),onSave:be}),t(mi,{formType:re.EditAutoHighlyRelevant,isOpen:U,enabled:!!Y&&!Y.rule.disabled,onClose:()=>H(!1),onSave:fe}),t(mi,{formType:re.EditAutoCostReduction,isOpen:W,enabled:!!J&&!J.rule.disabled,dropPercentage:J?.rule.percentageAtMost??25,onClose:()=>G(!1),onSave:ye}),t(Va,{title:Ua,description:_a,isOpen:!!L,onClose:ge,onApprove:pe,approveLabel:za,denyLabel:Ba})]})},cl=p.div`
184
188
  display: flex;
185
189
  align-items: center;
186
190
  justify-content: space-between;
187
191
  padding: 0 12px;
188
- `,di=({disabled:a,loading:n,tabs:o,selectedTab:l,setSelectedTab:s,onClickReset:c,onClickRefresh:d})=>{const[u,p]=i(!1),m=r(()=>{const e=[];return c&&e.push({id:jt(),type:Ht.Button,buttonProps:{label:"Reset",leftIcon:Xa,size:$.S,variant:R.Text,onClick:()=>p(!0),disabled:a}}),d&&e.push({id:jt(),type:Ht.Button,buttonProps:{label:"Refresh",leftIcon:yn,size:$.S,variant:R.Text,onClick:d,disabled:a,loading:n}}),e},[a,n,d]);return e(ci,{children:[e(D,{$gap:12,$alignItems:"center",children:[t(ta,{icon:dn,title:"Odigos Settings"}),t(Re,{width:"350px",options:o,values:[l],setValues:e=>s(e[0]),disabled:a})]}),t(aa,{actions:m}),t(Va,{isOpen:u,onClose:()=>p(!1),onDeny:()=>p(!1),onApprove:c,title:"Reset Settings",description:"Are you sure you want to reset the settings? This will clear the odigos-local-ui-config and reset the settings to the default values."})]})},ui=p(D)`
192
+ `,dl=({disabled:a,loading:n,tabs:o,selectedTab:i,setSelectedTab:s,onClickReset:c,onClickRefresh:d})=>{const[u,p]=l(!1),m=r(()=>{const e=[];return c&&e.push({id:Bt(),type:_t.Button,buttonProps:{label:"Reset",leftIcon:Xa,size:$.S,variant:R.Text,onClick:()=>p(!0),disabled:a}}),d&&e.push({id:Bt(),type:_t.Button,buttonProps:{label:"Refresh",leftIcon:yn,size:$.S,variant:R.Text,onClick:d,disabled:a,loading:n}}),e},[a,n,d]);return e(cl,{children:[e(D,{$gap:12,$alignItems:"center",children:[t(Jt,{icon:dn,title:"Odigos Settings"}),t(Ne,{width:"350px",options:o,values:[i],setValues:e=>s(e[0]),disabled:a})]}),t(Qt,{actions:m}),t(Va,{isOpen:u,onClose:()=>p(!1),onDeny:()=>p(!1),onApprove:c,title:"Reset Settings",description:"Are you sure you want to reset the settings? This will clear the odigos-local-ui-config and reset the settings to the default values."})]})},ul=p(D)`
189
193
  flex: 1;
190
194
  min-height: 0;
191
195
  width: 100%;
192
196
  align-self: stretch;
193
- `,pi=p(g)`
197
+ `,pl=p(g)`
194
198
  flex: 1;
195
199
  min-height: 0;
196
200
  height: 100%;
197
201
  overflow-y: auto;
198
- `,mi=e=>"general"===e.name?0:"advanced"===e.name?2:1,hi=({minSupportedVersion:a=0,pageHeightOffset:o=0,configYamls:l,configYamlsLoading:s,effectiveConfig:c,effectiveConfigLoading:d,refetch:u,factoryReset:p,onSave:m,saveLoading:h})=>{const{isVersionSupported:b,version:f,isEnterprise:y}=Me(a),v=r(()=>{if(!c)return{};const{manifestYAML:e,provenance:t,...a}=c;return a},[c]),{formData:C,handleFormChange:S,getNestedValue:w,getFormDiff:k,isFormDirty:T}=lt(v);n(()=>{"{}"!==JSON.stringify(v)&&"{}"===JSON.stringify(C)&&S(void 0,void 0,v)},[v,C]);const N=r(()=>[...l].sort((e,t)=>mi(e)-mi(t)),[l]),A=r(()=>(e=>{if(!e)return{};const t={};for(const a of e)t[a.helmPath]=a.reconciledFrom;return t})(c?.provenance),[c?.provenance]),I=r(()=>{const e=new Set;for(const t of l)for(const a of t.fields)a.componentType===x.Dropdown&&e.add(a.helmValuePath);return e},[l]),[D,E]=i(!1),O=r(()=>[{id:jt(),type:Ht.Button,buttonProps:{"data-id":"settings-save",variant:R.Primary,size:$.S,label:"Save Changes",leftIcon:on,loading:h,onClick:()=>E(!0)}},{id:jt(),type:Ht.Button,buttonProps:{"data-id":"settings-cancel",variant:R.Secondary,size:$.S,label:"Cancel",leftIcon:ln,onClick:()=>S(void 0,void 0,v)}}],[h,k,v,C,S]),P=r(()=>N.map(e=>({id:e.name,label:e.displayName})),[N]),L=r(()=>N.map(e=>e.name),[N]),{selectedSection:M,setSelectedSection:V,setSectionRef:B,setScrollContainerRef:z}=ja({sectionNames:L});return e(Wt,{$heightOffset:o,$gap:12,children:[t(di,{disabled:!b,loading:s||d,tabs:P,selectedTab:M,setSelectedTab:V,onClickReset:p?()=>p().then(()=>u?.()):void 0,onClickRefresh:u?()=>u():void 0}),e(ca,{children:[!b&&t(Xn,{minSupportedVersion:a,currentVersion:f||""}),t(Zt,{isOpen:T,richTitle:{icon:dn,title:"Config Settings"},actions:O}),t(Va,{isOpen:D,title:"Save Changes via UI?",description:"We recommend updating via your Helm values.yaml to ensure changes are version-controlled and go through a proper review process.",onClose:()=>E(!1),approveLabel:"Save changes",onApprove:async()=>{const e=((e,t)=>{const a=(e,t,a)=>{for(let a=0;a<t.length-1;a++){const n=t[a];n in e&&"object"==typeof e[n]&&null!==e[n]||(e[n]={}),e=e[n]}e[t[t.length-1]]=a},n=JSON.parse(JSON.stringify(e));for(const e of t){const t=e.split(".");let o=n;for(const e of t){if(null==o||"object"!=typeof o){o=void 0;break}o=o[e]}"string"==typeof o&&a(n,t,o.replaceAll("-","_"))}return n})(k(v,C),I);await(m?.(e)),S(void 0,void 0,{})},denyLabel:"Keep editing",onDeny:()=>E(!1)}),e(ui,{$gap:24,$alignItems:"stretch",children:[t(pi,{ref:z,$gap:24,$width:"100%",children:l.length?N.map(a=>t(ye,{id:a.name,ref:e=>B(a.name,e),richTitle:{icon:dn,title:a.displayName},children:a.fields.map(a=>{if(a.isEnterpriseOnly&&!y)return null;const n=Pe(a.componentProps||"{}",{}),o=A[a.helmValuePath];return e(g,{$gap:4,children:[t(En,{componentType:a.componentType,inputType:n.type,name:a.helmValuePath,label:a.displayName,tooltip:a.description,badge:o?{status:"odigos-local-ui-config"===o?X.Warning:ze.Unknown,label:o,tooltip:`This field is reconciled from the following resource: ${o}`}:void 0,disabled:a.isHelmOnly||h,value:w("formData",a.helmValuePath),setValue:e=>S(a.helmValuePath,e),dropdownOptions:n.options?.map(e=>({id:e,value:e})),dropdownNoSearch:!0,dropdownNoCheckbox:!0},a.helmValuePath),a.isHelmOnly?t(j,{status:X.Info,smallIcon:!0,message:"This field can only be updated via Helm values.yaml file"}):null]},a.helmValuePath)})},a.name)):s?t(ke,{$height:"30vh",children:t(De,{withSpinner:!0})}):t(ye,{richTitle:{icon:dn,title:"Config Settings"},children:t(F,{title:"YAML not found",subTitle:"The YAML for this resource is not available"})})}),t(pi,{children:d&&!c?.manifestYAML?t(ke,{$height:"30vh",children:t(De,{withSpinner:!0})}):t(Hn,{title:"Effective Config YAML",yaml:c?.manifestYAML?.replaceAll(" |",""),defaultOpen:!0,fullHeight:!0})})]})]})]})};export{Ao as AddActionDrawer,oo as AddActionForm,Vo as AddDestinationDrawer,so as AddDestinationForm,Bo as AddRuleDrawer,bo as AddRuleForm,Yo as AddSourceDrawer,Dl as CentralConnections,qo as EditActionDrawer,Jo as EditConfigDrawer,Qo as EditDestinationDrawer,Zo as EditRuleDrawer,Ul as Onboarding,ti as PipelineCollectors,ml as SamplingRuleDrawer,yo as SamplingRuleForm,ri as SamplingRules,hi as Settings,wl as SystemDrawer,ei as TABS};
202
+ `,ml=e=>"general"===e.name?0:"advanced"===e.name?2:1,hl=({minSupportedVersion:a=0,pageHeightOffset:o=0,configYamls:i,configYamlsLoading:s,effectiveConfig:c,effectiveConfigLoading:d,refetch:u,factoryReset:p,onSave:m,saveLoading:h})=>{const{isVersionSupported:b,version:f,isEnterprise:y}=Me(a),v=r(()=>{if(!c)return{};const{manifestYAML:e,provenance:t,...a}=c;return a},[c]),{formData:C,handleFormChange:S,getNestedValue:w,getFormDiff:k,isFormDirty:T}=ot(v);n(()=>{"{}"!==JSON.stringify(v)&&"{}"===JSON.stringify(C)&&S(void 0,void 0,v)},[v,C]);const A=r(()=>[...i].sort((e,t)=>ml(e)-ml(t)),[i]),N=r(()=>(e=>{if(!e)return{};const t={};for(const a of e)t[a.helmPath]=a.reconciledFrom;return t})(c?.provenance),[c?.provenance]),I=r(()=>{const e=new Set;for(const t of i)for(const a of t.fields)a.componentType===x.Dropdown&&e.add(a.helmValuePath);return e},[i]),[D,E]=l(!1),O=r(()=>[{id:Bt(),type:_t.Button,buttonProps:{"data-id":"settings-save",variant:R.Primary,size:$.S,label:"Save Changes",leftIcon:on,loading:h,onClick:()=>E(!0)}},{id:Bt(),type:_t.Button,buttonProps:{"data-id":"settings-cancel",variant:R.Secondary,size:$.S,label:"Cancel",leftIcon:ln,onClick:()=>S(void 0,void 0,v)}}],[h,k,v,C,S]),P=r(()=>A.map(e=>({id:e.name,label:e.displayName})),[A]),M=r(()=>A.map(e=>e.name),[A]),{selectedSection:L,setSelectedSection:V,setSectionRef:B,setScrollContainerRef:z}=ja({sectionNames:M});return e(Ut,{$heightOffset:o,$gap:12,children:[t(dl,{disabled:!b,loading:s||d,tabs:P,selectedTab:L,setSelectedTab:V,onClickReset:p?()=>p().then(()=>u?.()):void 0,onClickRefresh:u?()=>u():void 0}),e(ia,{children:[!b&&t(Hn,{minSupportedVersion:a,currentVersion:f||""}),t(Yt,{isOpen:T,richTitle:{icon:dn,title:"Config Settings"},actions:O}),t(Va,{isOpen:D,title:"Save Changes via UI?",description:"We recommend updating via your Helm values.yaml to ensure changes are version-controlled and go through a proper review process.",onClose:()=>E(!1),approveLabel:"Save changes",onApprove:async()=>{const e=((e,t)=>{const a=(e,t,a)=>{for(let a=0;a<t.length-1;a++){const n=t[a];n in e&&"object"==typeof e[n]&&null!==e[n]||(e[n]={}),e=e[n]}e[t[t.length-1]]=a},n=JSON.parse(JSON.stringify(e));for(const e of t){const t=e.split(".");let o=n;for(const e of t){if(null==o||"object"!=typeof o){o=void 0;break}o=o[e]}"string"==typeof o&&a(n,t,o.replaceAll("-","_"))}return n})(k(v,C),I);await(m?.(e)),S(void 0,void 0,{})},denyLabel:"Keep editing",onDeny:()=>E(!1)}),e(ul,{$gap:24,$alignItems:"stretch",children:[t(pl,{ref:z,$gap:24,$width:"100%",children:i.length?A.map(a=>t(ye,{id:a.name,ref:e=>B(a.name,e),richTitle:{icon:dn,title:a.displayName},children:a.fields.map(a=>{if(a.isEnterpriseOnly&&!y)return null;const n=Oe(a.componentProps||"{}",{}),o=N[a.helmValuePath];return e(g,{$gap:4,children:[t(En,{componentType:a.componentType,inputType:n.type,name:a.helmValuePath,label:a.displayName,tooltip:a.description,badge:o?{status:"odigos-local-ui-config"===o?X.Warning:Be.Unknown,label:o,tooltip:`This field is reconciled from the following resource: ${o}`}:void 0,disabled:a.isHelmOnly||h,value:w("formData",a.helmValuePath),setValue:e=>S(a.helmValuePath,e),dropdownOptions:n.options?.map(e=>({id:e,value:e})),dropdownNoSearch:!0,dropdownNoCheckbox:!0},a.helmValuePath),a.isHelmOnly?t(j,{status:X.Info,smallIcon:!0,message:"This field can only be updated via Helm values.yaml file"}):null]},a.helmValuePath)})},a.name)):s?t(ke,{$height:"30vh",children:t(Ee,{withSpinner:!0})}):t(ye,{richTitle:{icon:dn,title:"Config Settings"},children:t(F,{title:"YAML not found",subTitle:"The YAML for this resource is not available"})})}),t(pl,{children:d&&!c?.manifestYAML?t(ke,{$height:"30vh",children:t(Ee,{withSpinner:!0})}):t(Wn,{title:"Effective Config YAML",yaml:c?.manifestYAML?.replaceAll(" |",""),defaultOpen:!0,fullHeight:!0})})]})]})]})};export{Ro as AddActionDrawer,io as AddActionForm,_o as AddDestinationDrawer,ro as AddDestinationForm,Uo as AddRuleDrawer,fo as AddRuleForm,qo as AddSourceDrawer,Di as CentralConnections,Jo as EditActionDrawer,Qo as EditConfigDrawer,Zo as EditDestinationDrawer,ei as EditRuleDrawer,Ui as Onboarding,tl as PipelineCollectors,mi as SamplingRuleDrawer,ko as SamplingRuleForm,rl as SamplingRules,hl as Settings,wi as SystemDrawer,el as TABS};