@odigos/ui-kit 0.0.203 → 0.0.205

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 (44) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/lib/chunks/{index-CmIINVHt.js → index-BWrHoFMs.js} +1 -1
  3. package/lib/chunks/{ui-components-Ci6lJdLr.js → ui-components-BlfhQM0V.js} +22 -15
  4. package/lib/components/_v2/badge/index.d.ts +1 -1
  5. package/lib/components/_v2/button/index.d.ts +3 -1
  6. package/lib/components/_v2/drawer/header/index.d.ts +3 -3
  7. package/lib/components/_v2/drawer/index.d.ts +1 -1
  8. package/lib/components/_v2/note/index.d.ts +1 -0
  9. package/lib/components/_v2/typography/index.d.ts +1 -0
  10. package/lib/components/v2.js +1 -1
  11. package/lib/components.js +1 -1
  12. package/lib/constants.js +1 -1
  13. package/lib/containers/_v2/_drawers/add-action-drawer/index.d.ts +2 -2
  14. package/lib/containers/_v2/_drawers/add-destination-drawer/index.d.ts +2 -2
  15. package/lib/containers/_v2/_drawers/add-rule-drawer/index.d.ts +2 -2
  16. package/lib/containers/_v2/_drawers/edit-config-drawer/index.d.ts +2 -2
  17. package/lib/containers/_v2/_drawers/system-drawer/index.d.ts +2 -1
  18. package/lib/containers/_v2/pipeline-collectors/general-info/yaml-drawer/index.d.ts +2 -1
  19. package/lib/containers/_v2/pipeline-collectors/pods-info/pod-drawer/index.d.ts +2 -2
  20. package/lib/containers/source-drawer/index.d.ts +2 -0
  21. package/lib/containers/source-drawer/peers/index.d.ts +12 -0
  22. package/lib/containers/v2.js +33 -35
  23. package/lib/containers.js +126 -115
  24. package/lib/contexts.js +1 -1
  25. package/lib/functions.js +1 -1
  26. package/lib/hooks.js +1 -1
  27. package/lib/icons/brand/index.d.ts +3 -1
  28. package/lib/icons/brand/odigos-logo-text-central/index.d.ts +2 -0
  29. package/lib/icons/brand/odigos-logo-text-community/index.d.ts +2 -0
  30. package/lib/icons/brand/odigos-logo-text-enterprise/index.d.ts +2 -0
  31. package/lib/icons.js +1 -1
  32. package/lib/snippets/_v2/signals-checkbox-list/index.d.ts +1 -0
  33. package/lib/snippets/_v2/wide-drawer/column/index.d.ts +1 -1
  34. package/lib/snippets/_v2/wide-drawer/column-list-collapse/index.d.ts +1 -0
  35. package/lib/snippets/_v2/wide-drawer/column-list-item/index.d.ts +1 -0
  36. package/lib/snippets/_v2/wide-drawer/index.d.ts +8 -3
  37. package/lib/snippets.js +1 -1
  38. package/lib/store.js +1 -1
  39. package/lib/theme.js +1 -1
  40. package/lib/types/service-map/index.d.ts +4 -0
  41. package/lib/types.js +1 -1
  42. package/lib/visuals.js +1 -1
  43. package/package.json +2 -2
  44. package/lib/icons/brand/odigos-central-logo-text/index.d.ts +0 -2
@@ -1,50 +1,47 @@
1
- import{jsxs as e,jsx as t,Fragment as l}from"react/jsx-runtime";import{useEffect as a,Fragment as n,useState as o,useRef as i,forwardRef as r,useImperativeHandle as s,useMemo as c,Children as d,useCallback as u}from"react";import p,{useTheme as h}from"styled-components";import{A as m,F as g,a as b,C as f,b as y,I as C,c as v,i as w,d as k,K as S,T as $,e as x,f as I,D as N,g as A,B as T,h as D,j as F,k as V,l as O,W as M,m as R,M as P,V as L,S as E,n as z,N as j,o as q,L as H,p as K,R as _,q as B,r as W,s as G,t as J,u as U,v as Y,w as X,x as Z,y as Q,z as ee,E as te,G as le,H as ae,J as ne,O as oe,P as ie,Q as re,U as se,X as ce,Y as de,Z as ue,_ as pe,$ as he,a0 as me,a1 as ge,a2 as be,a3 as fe,a4 as ye,a5 as Ce,a6 as ve,a7 as we,a8 as ke,a9 as Se,aa as $e,ab as xe,ac as Ie,ad as Ne,ae as Ae,af as Te,ag as De,ah as Fe,ai as Ve,aj as Oe,ak as Me,al as Re,am as Pe,an as Le,ao as Ee,ap as ze,aq as je,ar as qe,as as He,at as Ke,au as _e,av as Be,aw as We,ax as Ge,ay as Je,az as Ue,aA as Ye,aB as Xe,aC as Ze,aD as Qe,aE as et,aF as tt,aG as lt,aH as at,aI as nt,aJ as ot,aK as it,aL as rt,aM as st,aN as ct}from"../chunks/ui-components-Ci6lJdLr.js";import{TrashIcon as dt,PlusIcon as ut,VSquareIcon as pt,OdigosLogo as ht,BookIcon as mt,XSquareIcon as gt,GoLogo as bt,JavaLogo as ft,ChevronRightIcon as yt,ActionIcon as Ct,DestinationIcon as vt,ChevronUpIcon as wt,ChevronDownIcon as kt,InstrumentationRuleIcon as St,SourceIcon as $t,SettingsIcon as xt,XIcon as It,VIcon as Nt,EditIcon as At,ExclamationTriangleIcon as Tt,ExclamationCircleIcon as Dt,KeyIcon as Ft,DiagnoseIcon as Vt,DownloadIcon as Ot,TerminalIcon as Mt,DeleteIcon as Rt,RefreshIcon as Pt,ConnectionsIcon as Lt,PodIcon as Et,ArrowDownSquareIcon as zt,ArrowUpSquareIcon as jt,PipelineCollectorIcon as qt,GatewayIcon as Ht,YamlIcon as Kt}from"../icons.js";import{Y as _t}from"../chunks/index-CmIINVHt.js";import"zustand";import"javascript-time-ago";import"../chunks/vendor-D99eCWta.js";import"@xyflow/react";import"react-dom";import"prism-react-renderer";import"react-error-boundary";import"lottie-react";import"virtua";const Bt=[{id:"CREDIT_CARD",label:"Credit card"}],Wt=[{id:m.CollectContainerAttributes,label:"Collect container attributes"},{id:m.CollectReplicaSetAttributes,label:"Collect ReplicaSet attributes"},{id:m.CollectWorkloadId,label:"Collect workload ID"},{id:m.CollectClusterId,label:"Collect cluster ID"}],Gt=[{id:S.Pod,label:S.Pod},{id:S.Namespace,label:S.Namespace},{id:S.Node,label:S.Node}],Jt=[{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:Gt}],Ut=[{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:Gt}],Yt=[{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:v.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:v.Number}],Xt=m.UrlTemplatizationRulesGroups,Zt=[{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"}],Qt=[{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:v.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:v.Number}],el=[{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:v.Number},{label:"Condition",keyName:"condition",tooltip:"An object representing the filters for span attributes filters.",componentType:V.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:V.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}],tl={[O.K8sAttributes]:({value:n,setValue:o,formErrors:i})=>(a(()=>{n[m.CollectContainerAttributes]||n[m.CollectReplicaSetAttributes]||n[m.CollectWorkloadId]||n[m.CollectClusterId]||n[m.LabelsAttributes]?.length||n[m.AnnotationsAttributes]?.length||(o(m.CollectContainerAttributes,!0),o(m.CollectReplicaSetAttributes,!0),o(m.CollectWorkloadId,!0),o(m.CollectClusterId,!0),o(m.LabelsAttributes,[]),o(m.AnnotationsAttributes,[]))},[]),e(l,{children:[t(g,{$gap:6,children:Wt.map(({id:l,label:a})=>e(g,{children:[t(f,{label:a,value:n[l]||!1,onChange:e=>o(l,e)}),t(y,{errorMessage:i[l]})]},l))}),t(k,{label:"Label attributes",limitFieldsPerRow:2,columns:Jt,values:n[m.LabelsAttributes]||[],setValues:e=>o(m.LabelsAttributes,e),errorMessage:i[m.LabelsAttributes]}),t(k,{label:"Annotation attributes",limitFieldsPerRow:2,columns:Ut,values:n[m.AnnotationsAttributes]||[],setValues:e=>o(m.AnnotationsAttributes,e),errorMessage:i[m.AnnotationsAttributes]})]})),[O.AddClusterInfo]:({value:a,setValue:n,formErrors:o})=>{const i=h();return e(l,{children:[t($,{label:"Overwrite existing values",labelAlign:x.Left,labelColor:i.v2.colors.silver[200],tooltip:"If enabled, the resource attributes will overwrite any existing attributes with the same name.",value:a[m.OverwriteExistingValues]||!1,onChange:e=>n(m.OverwriteExistingValues,e)}),t(k,{label:"Resource attributes",limitFieldsPerRow:2,columns:[{keyName:"attributeName",label:"Attribute name"},{keyName:"attributeStringValue",label:"Attribute value"}],values:a[m.ClusterAttributes]||[],setValues:e=>n(m.ClusterAttributes,e),errorMessage:o[m.ClusterAttributes]})]})},[O.DeleteAttributes]:({value:e,setValue:l,formErrors:a})=>t(I,{label:"Attributes to delete",values:e[m.AttributeNamesToDelete]||[],setValues:e=>l(m.AttributeNamesToDelete,e),errorMessage:a[m.AttributeNamesToDelete]}),[O.RenameAttributes]:({value:e,setValue:l,formErrors:a})=>t(k,{label:"Attributes to rename",limitFieldsPerRow:2,columns:[{keyName:"oldKey",label:"Old key"},{keyName:"newKey",label:"New key"}],values:Object.entries(e[m.Renames]||{}).map(([e,t])=>({oldKey:e,newKey:t})),setValues:e=>{const t={};e.forEach(e=>t[e.oldKey]=e.newKey),l(m.Renames,t)},errorMessage:a[m.Renames]}),[O.PiiMasking]:({value:l,setValue:n,formErrors:o})=>(a(()=>{l[m.PiiCategories]?.length||n(m.PiiCategories,Bt.map(({id:e})=>e))},[]),e(g,{$gap:12,children:[t(b,{label:"Attributes to mask"}),t(g,{$gap:6,children:Bt.map(({id:e,label:a})=>t(f,{label:a,value:l[m.PiiCategories]?.includes(e)||!1,onChange:t=>{const a=l[m.PiiCategories]||[],o=t?[...a,e]:a.filter(t=>t!==e);n(m.PiiCategories,o)}},e))}),t(y,{errorMessage:o[m.PiiCategories]})]})),[O.ErrorSampler]:({value:e,setValue:l,formErrors:a})=>{const n=a[m.FallbackSamplingRatio],o=w(e[m.FallbackSamplingRatio])?"":String(e[m.FallbackSamplingRatio]);return t(C,{label:"Fallback sampling ratio",type:v.Number,min:0,max:100,value:o,placeholder:"0-100",onChange:e=>{return t=e.target.value,l(m.FallbackSamplingRatio,Math.max(0,Math.min(Number(t),100))||0);var t},errorMessage:n})},[O.ProbabilisticSampler]:({value:e,setValue:l,formErrors:a})=>{const n=a[m.SamplingPercentage],o=w(e[m.SamplingPercentage])?"":String(e[m.SamplingPercentage]);return t(C,{label:"Sampling percentage",type:v.Number,min:0,max:100,value:o,placeholder:"0-100",onChange:e=>{return t=e.target.value,l(m.SamplingPercentage,Math.max(0,Math.min(Number(t),100))||0);var t},errorMessage:n})},[O.LatencySampler]:({value:e,setValue:l,formErrors:a})=>{const n=a[m.EndpointsFilters],o=e[m.EndpointsFilters]||[];return t(k,{limitFieldsPerRow:2,columns:Yt,values:o,setValues:e=>{l(m.EndpointsFilters,e.map(({serviceName:e,httpRoute:t,minimumLatencyThreshold:l,fallbackSamplingRatio:a})=>({serviceName:e,httpRoute:t,minimumLatencyThreshold:Number(l),fallbackSamplingRatio:Number(a)})))},errorMessage:n})},[O.ServiceNameSampler]:({value:e,setValue:l,formErrors:a})=>{const n=a[m.ServicesNameFilters],o=e[m.ServicesNameFilters]||[];return t(k,{limitFieldsPerRow:2,columns:Qt,values:o,setValues:e=>{l(m.ServicesNameFilters,e.map(({serviceName:e,samplingRatio:t,fallbackSamplingRatio:l})=>({serviceName:e,samplingRatio:Number(t),fallbackSamplingRatio:Number(l)})))},errorMessage:n})},[O.SpanAttributeSampler]:({value:e,setValue:l,formErrors:a})=>{const n=a[m.AttributeFilters],o=(e[m.AttributeFilters]||[]).map(({serviceName:e,attributeKey:t,fallbackSamplingRatio:l,condition:a})=>{const n=Object.entries(a).filter(([e,t])=>t)[0][0];return{serviceName:e,attributeKey:t,fallbackSamplingRatio:l,condition:n,operation:a[n]?.operation,expectedValue:a[n]?.expectedValue,jsonPath:a[n]?.jsonPath}});return t(k,{limitFieldsPerRow:2,columns:el,values:o,setValues:e=>{l(m.AttributeFilters,e.map(({serviceName:e,attributeKey:t,fallbackSamplingRatio:l,condition:a,operation:n,expectedValue:o,jsonPath:i})=>{const r={serviceName:e,attributeKey:t,fallbackSamplingRatio:Number(l),condition:{[a]:{operation:n,expectedValue:o}}};return i&&(r.condition[a].jsonPath=i),r}))},errorMessage:n})},[O.URLTemplatization]:({value:a,setValue:o,formErrors:i})=>{const r=h(),s=a[Xt]||[{filterK8sNamespace:"",workloadFilters:[],templatizationRules:[{template:""}],notes:""}],c=e=>o(Xt,e),d=(e,t)=>c(s.map((l,a)=>a===e?{...l,...t}:l));return e(l,{children:[s.map((l,a)=>e(n,{children:[t(N,{}),e(g,{$gap:12,children:[e(A,{$justifyContent:"space-between",$alignItems:"center",children:[t(b,{label:`Rule Group ${a+1}`}),t(T,{leftIcon:()=>t(dt,{fill:r.v2.colors.red[500]}),variant:F.Secondary,size:D.S,onClick:()=>{return e=a,c(s.filter((t,l)=>l!==e));var e},disabled:1===s.length})]}),t(C,{label:"Namespace",placeholder:"All namespaces",tooltip:"Filter rules to a specific Kubernetes namespace.",value:l.filterK8sNamespace||"",onChange:e=>d(a,{filterK8sNamespace:e.target.value})}),t(k,{label:"Workload filters",tooltip:"Optionally scope templates to specific workloads.",columns:Zt,values:l.workloadFilters||[],setValues:e=>d(a,{workloadFilters:e})}),t(I,{label:"Templates",required:!0,placeholder:"e.g. /user/{id}",values:l.templatizationRules.map(e=>e.template),setValues:e=>d(a,{templatizationRules:e.map(e=>({template:e}))})})]}),t(y,{errorMessage:i[Xt]})]},`url-templatization-group-${a}`)),t(T,{variant:F.Secondary,label:"Add rule group",leftIcon:ut,onClick:()=>c([...s,{filterK8sNamespace:"",workloadFilters:[],templatizationRules:[{template:""}],notes:""}])}),t(N,{})]})}},ll=({actionType:e,value:l,setValue:a,formErrors:n})=>{if(!e)return null;const o=tl[e];return o?t(o,{value:l,setValue:a,formErrors:n}):null},al=({isOpen:e,onClose:l,onDeny:a,onApprove:n})=>t(M,{title:"Discard changes?",description:"You have unsaved changes.\nIf you cancel now, your changes won't be saved.",isOpen:e,onClose:l,onDeny:a,denyLabel:"Keep editing",onApprove:n,approveLabel:"Discard changes"}),nl=({isOpen:e,onClose:l,onDeny:a,onApprove:n,action:o="delete",target:i})=>{const r=o.charAt(0).toUpperCase()+o.substring(1),s=i?.endsWith("s")?"these":"this";return t(M,{title:`${r}${i?` ${i}`:""}?`,description:`Are you sure you want to ${o}${i?` ${s} ${i}`:""}?`,isOpen:e,onClose:l,onDeny:a,denyLabel:"Go back",onApprove:n,approveLabel:r})},ol=(e,t)=>!t?.length||!!t?.find(t=>t===e),il=({title:l="Signals",required:n,errorMessage:r,allowedSignals:s,selectedSignals:c,setSelectedSignals:d})=>{const[u,p]=o(1===c.length),h=i(JSON.stringify(c));return a(()=>{const e=R(c);e.length||P.forEach(({id:t})=>{ol(t,s)&&e.push(t)});const t=JSON.stringify(e);h.current!==t&&(h.current=t,d(e),p(1===e.length))},[s,c]),e(g,{$gap:12,children:[t(b,{label:l,required:n}),t(A,{$gap:12,children:P.map(e=>{const l=ol(e.id,s),a=((e,t)=>!!t?.find(t=>t===e))(e.id,c);return l?t(f,{label:e.value,disabled:!l||u&&a,value:a,onChange:t=>((e,t)=>{const l=e,a=t?[...c,l]:c.filter(e=>e!==l);d(a),p(1===a.length)})(e.id,t)},e.id):null})}),t(y,{errorMessage:r})]})},rl=({minSupportedVersion:e,currentVersion:l})=>t(M,{isOpen:!0,onClose:()=>{},relativeToParent:!0,visual:()=>t(L,{scale:2.4,icon:()=>t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"22",height:"21",viewBox:"0 0 22 21",fill:"none",children:t("path",{fill:"#151618",d:"M9.4844 0.730003C9.99694 -0.243259 11.4076 -0.24341 11.92 0.730003L11.9685 0.831353L14.3039 6.22012L20.153 6.77755C21.3553 6.89211 21.841 8.38683 20.9358 9.18621L16.5314 13.0731L17.8091 18.8079C18.0716 19.9868 16.8005 20.9109 15.7605 20.2969L10.7017 17.3093L5.64282 20.2969C4.60289 20.9104 3.33173 19.9866 3.59427 18.8079L4.87192 13.0741L0.468608 9.18621C-0.43662 8.38693 0.0482932 6.8924 1.25029 6.77755L7.09837 6.22012L9.43588 0.831353L9.4844 0.730003ZM8.55284 7.02876C8.35287 7.48992 7.9179 7.80589 7.41751 7.85357L2.03952 8.36571L6.09027 11.941C6.46691 12.2737 6.63296 12.7852 6.5237 13.2758L5.34956 18.5459L10.0008 15.8009L10.1669 15.7179C10.5087 15.574 10.8945 15.5741 11.2364 15.7179L11.4036 15.8009L16.0538 18.5459L14.8807 13.2758C14.7714 12.7851 14.9374 12.2737 15.3141 11.941L19.3627 8.36571L13.9858 7.85357C13.4855 7.80587 13.0505 7.4899 12.8505 7.02876L10.7017 2.07342L8.55284 7.02876Z"})})}),title:"Upgrade Required",description:`To use this feature, please upgrade to Odigos v${e} or later.\nCurrent version: ${l}.`}),sl=p.div`
1
+ import{jsxs as e,jsx as t,Fragment as l}from"react/jsx-runtime";import{useEffect as a,Fragment as n,useState as o,useRef as i,forwardRef as r,useImperativeHandle as s,useMemo as c,Children as d,useCallback as u}from"react";import p,{useTheme as h}from"styled-components";import{A as m,F as g,a as b,C as f,b as C,I as v,c as y,i as k,d as w,K as S,T as $,e as x,f as I,D as N,g as A,B as T,h as D,j as F,k as O,l as V,W as M,m as R,M as P,V as L,S as E,n as z,N as j,o as q,L as H,p as K,R as B,q as W,r as _,s as G,t as J,u as U,v as Y,w as X,x as Z,y as Q,z as ee,E as te,G as le,H as ae,J as ne,O as oe,P as ie,Q as re,U as se,X as ce,Y as de,Z as ue,_ as pe,$ as he,a0 as me,a1 as ge,a2 as be,a3 as fe,a4 as Ce,a5 as ve,a6 as ye,a7 as ke,a8 as we,a9 as Se,aa as $e,ab as xe,ac as Ie,ad as Ne,ae as Ae,af as Te,ag as De,ah as Fe,ai as Oe,aj as Ve,ak as Me,al as Re,am as Pe,an as Le,ao as Ee,ap as ze,aq as je,ar as qe,as as He,at as Ke,au as Be,av as We,aw as _e,ax as Ge,ay as Je,az as Ue,aA as Ye,aB as Xe,aC as Ze,aD as Qe,aE as et,aF as tt,aG as lt,aH as at,aI as nt,aJ as ot,aK as it,aL as rt,aM as st,aN as ct}from"../chunks/ui-components-BlfhQM0V.js";import{TrashIcon as dt,PlusIcon as ut,VSquareIcon as pt,OdigosLogo as ht,ArrowLeftIcon as mt,ArrowRightIcon as gt,BookIcon as bt,XSquareIcon as ft,GoLogo as Ct,JavaLogo as vt,ChevronRightIcon as yt,ActionIcon as kt,DestinationIcon as wt,ChevronUpIcon as St,ChevronDownIcon as $t,InstrumentationRuleIcon as xt,SourceIcon as It,SettingsIcon as Nt,XIcon as At,VIcon as Tt,EditIcon as Dt,ExclamationTriangleIcon as Ft,ExclamationCircleIcon as Ot,KeyIcon as Vt,DiagnoseIcon as Mt,DownloadIcon as Rt,TerminalIcon as Pt,DeleteIcon as Lt,RefreshIcon as Et,ConnectionsIcon as zt,PodIcon as jt,ArrowDownSquareIcon as qt,ArrowUpSquareIcon as Ht,PipelineCollectorIcon as Kt,GatewayIcon as Bt,YamlIcon as Wt}from"../icons.js";import{Y as _t}from"../chunks/index-BWrHoFMs.js";import"zustand";import"javascript-time-ago";import"../chunks/vendor-D99eCWta.js";import"@xyflow/react";import"react-dom";import"prism-react-renderer";import"react-error-boundary";import"lottie-react";import"virtua";const Gt=[{id:"CREDIT_CARD",label:"Credit card"}],Jt=[{id:m.CollectContainerAttributes,label:"Collect container attributes"},{id:m.CollectReplicaSetAttributes,label:"Collect ReplicaSet attributes"},{id:m.CollectWorkloadId,label:"Collect workload ID"},{id:m.CollectClusterId,label:"Collect cluster ID"}],Ut=[{id:S.Pod,label:S.Pod},{id:S.Namespace,label:S.Namespace},{id:S.Node,label:S.Node}],Yt=[{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:Ut}],Xt=[{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:Ut}],Zt=[{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:y.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:y.Number}],Qt=m.UrlTemplatizationRulesGroups,el=[{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"}],tl=[{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:y.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:y.Number}],ll=[{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:y.Number},{label:"Condition",keyName:"condition",tooltip:"An object representing the filters for span attributes filters.",componentType:O.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:O.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}],al={[V.K8sAttributes]:({value:n,setValue:o,formErrors:i})=>(a(()=>{n[m.CollectContainerAttributes]||n[m.CollectReplicaSetAttributes]||n[m.CollectWorkloadId]||n[m.CollectClusterId]||n[m.LabelsAttributes]?.length||n[m.AnnotationsAttributes]?.length||(o(m.CollectContainerAttributes,!0),o(m.CollectReplicaSetAttributes,!0),o(m.CollectWorkloadId,!0),o(m.CollectClusterId,!0),o(m.LabelsAttributes,[]),o(m.AnnotationsAttributes,[]))},[]),e(l,{children:[t(g,{$gap:6,children:Jt.map(({id:l,label:a})=>e(g,{children:[t(f,{label:a,value:n[l]||!1,onChange:e=>o(l,e)}),t(C,{errorMessage:i[l]})]},l))}),t(w,{label:"Label attributes",limitFieldsPerRow:2,columns:Yt,values:n[m.LabelsAttributes]||[],setValues:e=>o(m.LabelsAttributes,e),errorMessage:i[m.LabelsAttributes]}),t(w,{label:"Annotation attributes",limitFieldsPerRow:2,columns:Xt,values:n[m.AnnotationsAttributes]||[],setValues:e=>o(m.AnnotationsAttributes,e),errorMessage:i[m.AnnotationsAttributes]})]})),[V.AddClusterInfo]:({value:a,setValue:n,formErrors:o})=>{const i=h();return e(l,{children:[t($,{label:"Overwrite existing values",labelAlign:x.Left,labelColor:i.v2.colors.silver[200],tooltip:"If enabled, the resource attributes will overwrite any existing attributes with the same name.",value:a[m.OverwriteExistingValues]||!1,onChange:e=>n(m.OverwriteExistingValues,e)}),t(w,{label:"Resource attributes",limitFieldsPerRow:2,columns:[{keyName:"attributeName",label:"Attribute name"},{keyName:"attributeStringValue",label:"Attribute value"}],values:a[m.ClusterAttributes]||[],setValues:e=>n(m.ClusterAttributes,e),errorMessage:o[m.ClusterAttributes]})]})},[V.DeleteAttributes]:({value:e,setValue:l,formErrors:a})=>t(I,{label:"Attributes to delete",values:e[m.AttributeNamesToDelete]||[],setValues:e=>l(m.AttributeNamesToDelete,e),errorMessage:a[m.AttributeNamesToDelete]}),[V.RenameAttributes]:({value:e,setValue:l,formErrors:a})=>t(w,{label:"Attributes to rename",limitFieldsPerRow:2,columns:[{keyName:"oldKey",label:"Old key"},{keyName:"newKey",label:"New key"}],values:Object.entries(e[m.Renames]||{}).map(([e,t])=>({oldKey:e,newKey:t})),setValues:e=>{const t={};e.forEach(e=>t[e.oldKey]=e.newKey),l(m.Renames,t)},errorMessage:a[m.Renames]}),[V.PiiMasking]:({value:l,setValue:n,formErrors:o})=>(a(()=>{l[m.PiiCategories]?.length||n(m.PiiCategories,Gt.map(({id:e})=>e))},[]),e(g,{$gap:12,children:[t(b,{label:"Attributes to mask"}),t(g,{$gap:6,children:Gt.map(({id:e,label:a})=>t(f,{label:a,value:l[m.PiiCategories]?.includes(e)||!1,onChange:t=>{const a=l[m.PiiCategories]||[],o=t?[...a,e]:a.filter(t=>t!==e);n(m.PiiCategories,o)}},e))}),t(C,{errorMessage:o[m.PiiCategories]})]})),[V.ErrorSampler]:({value:e,setValue:l,formErrors:a})=>{const n=a[m.FallbackSamplingRatio],o=k(e[m.FallbackSamplingRatio])?"":String(e[m.FallbackSamplingRatio]);return t(v,{label:"Fallback sampling ratio",type:y.Number,min:0,max:100,value:o,placeholder:"0-100",onChange:e=>{return t=e.target.value,l(m.FallbackSamplingRatio,Math.max(0,Math.min(Number(t),100))||0);var t},errorMessage:n})},[V.ProbabilisticSampler]:({value:e,setValue:l,formErrors:a})=>{const n=a[m.SamplingPercentage],o=k(e[m.SamplingPercentage])?"":String(e[m.SamplingPercentage]);return t(v,{label:"Sampling percentage",type:y.Number,min:0,max:100,value:o,placeholder:"0-100",onChange:e=>{return t=e.target.value,l(m.SamplingPercentage,Math.max(0,Math.min(Number(t),100))||0);var t},errorMessage:n})},[V.LatencySampler]:({value:e,setValue:l,formErrors:a})=>{const n=a[m.EndpointsFilters],o=e[m.EndpointsFilters]||[];return t(w,{limitFieldsPerRow:2,columns:Zt,values:o,setValues:e=>{l(m.EndpointsFilters,e.map(({serviceName:e,httpRoute:t,minimumLatencyThreshold:l,fallbackSamplingRatio:a})=>({serviceName:e,httpRoute:t,minimumLatencyThreshold:Number(l),fallbackSamplingRatio:Number(a)})))},errorMessage:n})},[V.ServiceNameSampler]:({value:e,setValue:l,formErrors:a})=>{const n=a[m.ServicesNameFilters],o=e[m.ServicesNameFilters]||[];return t(w,{limitFieldsPerRow:2,columns:tl,values:o,setValues:e=>{l(m.ServicesNameFilters,e.map(({serviceName:e,samplingRatio:t,fallbackSamplingRatio:l})=>({serviceName:e,samplingRatio:Number(t),fallbackSamplingRatio:Number(l)})))},errorMessage:n})},[V.SpanAttributeSampler]:({value:e,setValue:l,formErrors:a})=>{const n=a[m.AttributeFilters],o=(e[m.AttributeFilters]||[]).map(({serviceName:e,attributeKey:t,fallbackSamplingRatio:l,condition:a})=>{const n=Object.entries(a).filter(([e,t])=>t)[0][0];return{serviceName:e,attributeKey:t,fallbackSamplingRatio:l,condition:n,operation:a[n]?.operation,expectedValue:a[n]?.expectedValue,jsonPath:a[n]?.jsonPath}});return t(w,{limitFieldsPerRow:2,columns:ll,values:o,setValues:e=>{l(m.AttributeFilters,e.map(({serviceName:e,attributeKey:t,fallbackSamplingRatio:l,condition:a,operation:n,expectedValue:o,jsonPath:i})=>{const r={serviceName:e,attributeKey:t,fallbackSamplingRatio:Number(l),condition:{[a]:{operation:n,expectedValue:o}}};return i&&(r.condition[a].jsonPath=i),r}))},errorMessage:n})},[V.URLTemplatization]:({value:a,setValue:o,formErrors:i})=>{const r=h(),s=a[Qt]||[{filterK8sNamespace:"",workloadFilters:[],templatizationRules:[{template:""}],notes:""}],c=e=>o(Qt,e),d=(e,t)=>c(s.map((l,a)=>a===e?{...l,...t}:l));return e(l,{children:[s.map((l,a)=>e(n,{children:[t(N,{}),e(g,{$gap:12,children:[e(A,{$justifyContent:"space-between",$alignItems:"center",children:[t(b,{label:`Rule Group ${a+1}`}),t(T,{leftIcon:()=>t(dt,{fill:r.v2.colors.red[500]}),variant:F.Secondary,size:D.S,onClick:()=>{return e=a,c(s.filter((t,l)=>l!==e));var e},disabled:1===s.length})]}),t(v,{label:"Namespace",placeholder:"All namespaces",tooltip:"Filter rules to a specific Kubernetes namespace.",value:l.filterK8sNamespace||"",onChange:e=>d(a,{filterK8sNamespace:e.target.value})}),t(w,{label:"Workload filters",tooltip:"Optionally scope templates to specific workloads.",columns:el,values:l.workloadFilters||[],setValues:e=>d(a,{workloadFilters:e})}),t(I,{label:"Templates",required:!0,placeholder:"e.g. /user/{id}",values:l.templatizationRules.map(e=>e.template),setValues:e=>d(a,{templatizationRules:e.map(e=>({template:e}))})})]}),t(C,{errorMessage:i[Qt]})]},`url-templatization-group-${a}`)),t(T,{variant:F.Secondary,label:"Add rule group",leftIcon:ut,onClick:()=>c([...s,{filterK8sNamespace:"",workloadFilters:[],templatizationRules:[{template:""}],notes:""}])}),t(N,{})]})}},nl=({actionType:e,value:l,setValue:a,formErrors:n})=>{if(!e)return null;const o=al[e];return o?t(o,{value:l,setValue:a,formErrors:n}):null},ol=({isOpen:e,onClose:l,onDeny:a,onApprove:n})=>t(M,{title:"Discard changes?",description:"You have unsaved changes.\nIf you cancel now, your changes won't be saved.",isOpen:e,onClose:l,onDeny:a,denyLabel:"Keep editing",onApprove:n,approveLabel:"Discard changes"}),il=({isOpen:e,onClose:l,onDeny:a,onApprove:n,action:o="delete",target:i})=>{const r=o.charAt(0).toUpperCase()+o.substring(1),s=i?.endsWith("s")?"these":"this";return t(M,{title:`${r}${i?` ${i}`:""}?`,description:`Are you sure you want to ${o}${i?` ${s} ${i}`:""}?`,isOpen:e,onClose:l,onDeny:a,denyLabel:"Go back",onApprove:n,approveLabel:r})},rl=(e,t)=>!t?.length||!!t?.find(t=>t===e),sl=({title:l="Signals",required:n,errorMessage:r,allowedSignals:s,selectedSignals:c,setSelectedSignals:d,disabled:u})=>{const[p,h]=o(1===c.length),m=i(JSON.stringify(c));return a(()=>{const e=R(c);e.length||P.forEach(({id:t})=>{rl(t,s)&&e.push(t)});const t=JSON.stringify(e);m.current!==t&&(m.current=t,d(e),h(1===e.length))},[s,c]),e(g,{$gap:12,children:[t(b,{label:l,required:n}),t(A,{$gap:12,children:P.map(e=>{const l=rl(e.id,s),a=((e,t)=>!!t?.find(t=>t===e))(e.id,c);return l?t(f,{label:e.value,disabled:u||!l||p&&a,value:a,onChange:t=>((e,t)=>{const l=e,a=t?[...c,l]:c.filter(e=>e!==l);d(a),h(1===a.length)})(e.id,t)},e.id):null})}),t(C,{errorMessage:r})]})},cl=({minSupportedVersion:e,currentVersion:l})=>t(M,{isOpen:!0,onClose:()=>{},relativeToParent:!0,visual:()=>t(L,{scale:2.4,icon:()=>t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"22",height:"21",viewBox:"0 0 22 21",fill:"none",children:t("path",{fill:"#151618",d:"M9.4844 0.730003C9.99694 -0.243259 11.4076 -0.24341 11.92 0.730003L11.9685 0.831353L14.3039 6.22012L20.153 6.77755C21.3553 6.89211 21.841 8.38683 20.9358 9.18621L16.5314 13.0731L17.8091 18.8079C18.0716 19.9868 16.8005 20.9109 15.7605 20.2969L10.7017 17.3093L5.64282 20.2969C4.60289 20.9104 3.33173 19.9866 3.59427 18.8079L4.87192 13.0741L0.468608 9.18621C-0.43662 8.38693 0.0482932 6.8924 1.25029 6.77755L7.09837 6.22012L9.43588 0.831353L9.4844 0.730003ZM8.55284 7.02876C8.35287 7.48992 7.9179 7.80589 7.41751 7.85357L2.03952 8.36571L6.09027 11.941C6.46691 12.2737 6.63296 12.7852 6.5237 13.2758L5.34956 18.5459L10.0008 15.8009L10.1669 15.7179C10.5087 15.574 10.8945 15.5741 11.2364 15.7179L11.4036 15.8009L16.0538 18.5459L14.8807 13.2758C14.7714 12.7851 14.9374 12.2737 15.3141 11.941L19.3627 8.36571L13.9858 7.85357C13.4855 7.80587 13.0505 7.4899 12.8505 7.02876L10.7017 2.07342L8.55284 7.02876Z"})})}),title:"Upgrade Required",description:`To use this feature, please upgrade to Odigos v${e} or later.\nCurrent version: ${l}.`}),dl=p.div`
2
2
  display: flex;
3
3
  flex-direction: column;
4
4
  justify-content: flex-end;
5
5
  width: ${({$width:e})=>e};
6
- gap: ${({$withHeader:e})=>e?"0":"12px"};
7
- `,cl=p.div`
6
+ gap: ${({$columnHasHeader:e})=>e?"0":"12px"};
7
+ `,ul=p.div`
8
8
  display: flex;
9
9
  align-items: center;
10
10
  min-height: 24px;
11
11
  padding: 12px;
12
12
  border-radius: 16px 16px 0 0;
13
13
  background-color: ${({theme:e})=>e.v2.colors.silver[800]};
14
- `,dl=p.div`
14
+ `,pl=p.div`
15
15
  display: flex;
16
16
  flex-direction: column;
17
17
  gap: ${({$gap:e})=>e}px;
18
- padding: 12px;
18
+ padding: 12px 12px 0 12px;
19
19
  width: calc(100% - 24px);
20
-
21
- // TODO: This is a hack to make the list height dynamic and scrollable. We need to find a better way to do this.
22
- height: ${({$withHeader:e,$withSubHeader:t})=>`calc(100vh - 288px${e&&t?" - 56px":e||t?e||t?" - 12px":"":" + 36px"})`};
23
-
24
- border-radius: ${({$withHeader:e,$isLeft:t,$isRight:l})=>e?t?"0 0 0 16px":l?"0 16px 0 0":"0":t?"16px 0 0 16px":l?"0 16px 16px 0":"16px"};
20
+ height: ${({$heightOffset:e,$columnHasHeader:t})=>`calc(100vh - 180px - ${e}px ${t?"- 48px":""})`};
21
+ border-radius: ${({$columnHasHeader:e,$isLeft:t,$isRight:l})=>e?t?"0 0 0 16px":l?"0 16px 0 0":"0":t?"16px 0 0 16px":l?"0 16px 16px 0":"16px"};
25
22
  background-color: ${({theme:e})=>e.v2.colors.silver[900]};
26
23
  overflow-y: auto;
27
24
  overflow-x: hidden;
28
- `,ul=({isLeft:a,isRight:n,parentHasSubHeader:o,width:i,header:r,list:s})=>e(sl,{$width:i,$withHeader:!!r,children:[r&&t(cl,{children:r}),t(dl,{$gap:8,$isLeft:a,$isRight:n,$withHeader:!!r,$withSubHeader:!!o,children:s.length?s.length>1?t(E,{gap:8,elements:s}):t(l,{children:s[0]}):t(z,{$height:"100%",children:t(j,{})})})]}),pl="75vw",hl=p.div`
25
+ `,hl=({isLeft:a,isRight:n,heightOffset:o=0,width:i,header:r,list:s})=>e(dl,{$width:i,$columnHasHeader:!!r,children:[r&&t(ul,{children:r}),t(pl,{$gap:8,$isLeft:a,$isRight:n,$heightOffset:o,$columnHasHeader:!!r,children:s.length?s.length>1?t(E,{gap:8,elements:s}):t(l,{children:s[0]}):t(z,{$height:"100%",children:t(j,{})})})]}),ml="75vw",gl=p.div`
29
26
  display: flex;
30
27
  flex-direction: column;
31
28
  border-radius: 16px;
32
29
  background-color: ${({theme:e})=>e.v2.colors.silver[1e3]};
33
30
  overflow: hidden;
34
- `,ml=p.div`
31
+ `,bl=p.div`
35
32
  display: flex;
36
33
  gap: 12px;
37
- padding: 16px;
34
+ padding: 16px 16px 0 16px;
38
35
  background-color: ${({theme:e})=>e.v2.colors.silver[1e3]};
39
36
  position: sticky;
40
37
  top: 0;
41
- `,gl=p.div`
42
- padding: 0 12px;
43
- `,bl=p.div`
38
+ `,fl=p.div`
39
+ padding: 12px 12px 0 12px;
40
+ `,Cl=p.div`
44
41
  display: flex;
45
42
  gap: 12px;
46
43
  padding: 16px;
47
- `,fl=p.div`
44
+ `,vl=p.div`
48
45
  padding: 5vh 10vw;
49
46
  border-radius: 12px;
50
47
  background-color: ${({theme:e})=>e.v2.colors.silver[800]};
@@ -55,43 +52,44 @@ import{jsxs as e,jsx as t,Fragment as l}from"react/jsx-runtime";import{useEffect
55
52
  gap: 16px;
56
53
  padding: 0 12px;
57
54
  margin-top: auto;
58
- `,Cl=r(({isOpen:l,onClose:a,onSave:n,disableSave:i,connectionIds:r,header:c,subHeader:d,leftColumn:u,rightColumn:p,search:h,filters:m,isFormDirty:g,hideDirtyNote:b,isFetching:f,progress:y},C)=>{const[v,w]=o(!1),[k,S]=o(!1),[$,x]=o(void 0);s(C,()=>({clearErrors:()=>x(void 0)}));const I=k,N=()=>{g&&!v?w(!0):(w(!1),a())},D=i||k||"boolean"==typeof g&&!g;return e(q,{width:pl,isOpen:l,hideOverlay:!k,header:{...c,onClose:N,onCloseDisabled:I},children:[k?t(z,{$height:"calc(100vh - 136px)",children:t(fl,{children:t(H,{titleSize:K.S,subTitleSize:K.XXXS,withGradient:!0,withSpinner:!0,...y})})}):e(hl,{children:[e(ml,{children:[r&&t(_,{icon:pt,title:"Selected Clusters",badge:{label:r.value.length}}),t(B,{width:"100%",...h}),m]}),d&&t(gl,{children:t(_,{icon:d.icon,title:d.title,subTitle:d.description,badge:d.badge})}),e(bl,{children:[t(ul,{isLeft:!0,parentHasSubHeader:!!d,...u}),t(ul,{isRight:!0,parentHasSubHeader:!!d,...p})]})]}),e(yl,{children:[f?t(H,{icon:ht,title:"Fetching Data...",titleSize:K.XXS,withGradient:!0}):k?y?null:t(H,{icon:ht,title:"Saving Changes...",titleSize:K.XXS,withGradient:!0}):$?t(W,{fullWidth:!0,status:G.Error,message:$}):"boolean"==typeof g&&g&&!b?t(W,{fullWidth:!0,status:G.Info,message:'The values don\'t reflect the current configurations of the selected clusters.\n"Save" will override the current configurations.'}):"boolean"!=typeof g||g||b?null:t(W,{fullWidth:!0,status:G.Success,message:"The values reflect the current configuration of the selected cluster."}),e(A,{$gap:8,children:[t("div",{style:{width:"150px"},children:t(T,{fullWidth:!0,variant:F.Secondary,label:"Cancel",onClick:N,disabled:I})}),t("div",{style:{width:"150px"},children:t(T,{fullWidth:!0,variant:F.Primary,label:"Save",onClick:async()=>{S(!0);const e=await n();S(!1),e?.error?x(e.error):(r?.setValue([]),a())},disabled:D})})]})]}),t(al,{isOpen:v,onClose:()=>w(!1),onApprove:N})]})});Cl.displayName=Cl.name;const vl=({option:l,formData:a,handleFormChange:n,formErrors:o})=>{const i=h();return e(g,{$gap:24,children:[e(A,{$gap:12,$justifyContent:"space-between",children:[t(J,{size:K.XXS,children:l.docsDescription}),t(T,{label:"Docs",leftIcon:mt,variant:F.Text,size:D.S,onClick:()=>window.open(`${U}${l.docsEndpoint}`,"_blank","noopener noreferrer")})]}),t(Y,{options:[{icon:pt,label:"Enabled",value:!1,selectedBgColor:i.v2.colors.green[800]},{icon:gt,label:"Disabled",value:!0,selectedBgColor:i.v2.colors.red[800]}],selected:a.disabled,setSelected:e=>n("disabled",e)}),t(il,{title:"Signals for processing",allowedSignals:l.allowedSignals,selectedSignals:a.signals||[],setSelectedSignals:e=>n("signals",e),errorMessage:o.signals}),t(C,{label:"Action name",placeholder:"Use a name that describes the action...",value:a.name||"",onChange:({target:{value:e}})=>n("name",e),errorMessage:o.name}),t(ll,{actionType:l.type,value:a.fields,setValue:(e,t)=>n(`fields.${e}`,t),formErrors:o}),t(X,{label:"Notes",placeholder:"Your personal notes...",value:a.notes||"",onChange:({target:{value:e}})=>n("notes",e),errorMessage:o.notes})]})},wl=({signals:l,fields:a,formData:n,handleFormChange:o,formErrors:i})=>a?.map(({renderCondition:a,componentType:r,type:s,name:c,title:d,tooltip:u,placeholder:p,value:h,required:m,options:b})=>{if(a&&!Z(a,l,n.fields))return null;const v=c,w=n.fields.find(e=>e.key===v),S=w?w.value:h;switch(r){case V.Input:return t(C,{name:v,type:s,label:d,tooltip:u,required:m,placeholder:p,value:S,onChange:e=>o(v,e.target.value),errorMessage:i[v]},v);case V.MultiInput:return t(I,{label:d,tooltip:u,required:m,placeholder:p,values:ee(S,[]),setValues:e=>o(v,JSON.stringify(e)),errorMessage:i[v]},v);case V.KeyValuePair:return t(k,{label:d,tooltip:u,required:m,limitFieldsPerRow:2,columns:[{keyName:"key",label:"Key"},{keyName:"value",label:"Value"}],values:ee(S,[]),setValues:e=>o(v,JSON.stringify(e)),errorMessage:i[v]},v);case V.TextArea:return t(X,{name:v,label:d,tooltip:u,required:m,placeholder:p,value:S,onChange:e=>o(v,e.target.value),errorMessage:i[v]},v);case V.Checkbox:return e(g,{children:[t(f,{label:d,value:"true"==S,onChange:e=>o(v,e.toString())}),t(y,{errorMessage:i[v]})]},v);case V.Dropdown:return t(Q,{name:v,label:d,withSearch:!0,values:S?[S]:[],options:b?.map(e=>({id:e.id||"",label:e.value||""}))||[],setValues:e=>o(v,e[0]),errorMessage:i[v]},v);default:return null}}),kl=({option:l,dynamicFields:n,formData:o,handleFormChange:i,formErrors:r})=>{const s=h();return a(()=>{const e=n.map(e=>({key:e.name,value:e.value}));i("fields",e);const t=te(l.supportedSignals),a={logs:t.includes(le.Logs),metrics:t.includes(le.Metrics),traces:t.includes(le.Traces)};i("exportedSignals",a)},[n]),e(g,{$gap:24,children:[e(A,{$gap:12,$justifyContent:"space-between",children:[t("div",{}),t(T,{label:"Docs",leftIcon:mt,variant:F.Text,size:D.S,onClick:()=>window.open(`${U}/backends/${l.type}`,"_blank","noopener noreferrer")})]}),t(Y,{options:[{icon:pt,label:"Enabled",value:!1,selectedBgColor:s.v2.colors.green[800]},{icon:gt,label:"Disabled",value:!0,selectedBgColor:s.v2.colors.red[800]}],selected:o.disabled,setSelected:e=>i("disabled",e)}),t(il,{title:"This connection will monitor:",allowedSignals:te(l.supportedSignals),selectedSignals:ae(o.exportedSignals),setSelectedSignals:e=>i("exportedSignals",{logs:e.includes(le.Logs),metrics:e.includes(le.Metrics),traces:e.includes(le.Traces)}),errorMessage:r.exportedSignals}),t(C,{label:"Destination name",placeholder:"Use a name that describes the destination...",value:o.name,onChange:({target:{value:e}})=>i("name",e),errorMessage:r.name}),t(wl,{signals:ae(o.exportedSignals),fields:n,formData:o,handleFormChange:(e,t)=>{i("fields",o.fields.map(l=>l.key===e?{...l,value:t}:l))},formErrors:r})]})},Sl=[{id:ne.FilePath,label:"Collect file path",tooltip:"Indicates whether to record the `code.filepath` attribute."},{id:ne.Function,label:"Collect function",tooltip:"Indicates whether to record the `code.function` attribute."},{id:ne.LineNumber,label:"Collect line number",tooltip:"Indicates whether to record the `code.lineno` attribute."}],$l=[{id:ne.Column,label:"Collect column",tooltip:"Indicates whether to record the `code.column` attribute."},{id:ne.Namespace,label:"Collect namespace",tooltip:"Indicates whether to record the `code.namespace` attribute."},{id:ne.StackTrace,label:"Collect stacktrace",tooltip:"Indicates whether to record the `code.stacktrace` attribute."}],xl=["*"],Il=[{id:re.HttpRequest,label:"Collect HTTP request",tooltip:""},{id:re.HttpResponse,label:"Collect HTTP response",tooltip:""},{id:re.DbQuery,label:"Collect DB query",tooltip:""},{id:re.Messaging,label:"Collect messaging",tooltip:""}],Nl={[de.Java]:[new ce("","")],[de.Golang]:[new se("")]},Al={[ue.CodeAttributes]:({value:n,setValue:o,formErrors:i})=>{const r=h(),s=i.codeAttributes,d=c(()=>Object.entries(n.codeAttributes||{}).filter(([e,t])=>!!t).map(([e])=>e),[n]);a(()=>{if(!d.length&&!s){const e={[ne.FilePath]:!0,[ne.Function]:!0,[ne.LineNumber]:!0,[ne.Column]:null,[ne.Namespace]:null,[ne.StackTrace]:null};o("codeAttributes",e)}},[]);const u=(e,t)=>{const l=t?[...d,e]:d.filter(t=>t!==e),a=Object.values(ne).reduce((e,t)=>(e[t]=!!l.includes(t)||null,e),{});o("codeAttributes",a)};return e(l,{children:[e(g,{$gap:12,children:[t(J,{size:K.XS,color:r.v2.colors.silver[200],nowrap:!0,children:"Recommended data to collect"}),t(g,{$gap:6,children:Sl.map(({id:e,label:l,tooltip:a})=>t(oe,{text:a,withIcon:!0,children:t(f,{label:l,value:d.includes(e),onChange:t=>u(e,t)})},e))}),t(y,{errorMessage:s})]}),e(g,{$gap:12,children:[t(J,{size:K.XS,color:r.v2.colors.silver[200],nowrap:!0,children:"Verbose data to collect"}),t(g,{$gap:6,children:$l.map(({id:e,label:l,tooltip:a})=>t(oe,{text:a,withIcon:!0,children:t(f,{label:l,value:d.includes(e),onChange:t=>u(e,t)})},e))}),t(y,{errorMessage:s})]})]})},[ue.CustomInstrumentation]:({value:n,setValue:o,formErrors:i})=>{const r=i.customInstrumentations,s=c(()=>(n?.customInstrumentations?.[de.Golang]||[]).map(e=>new se(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)),[n]),d=c(()=>(n?.customInstrumentations?.[de.Java]||[]).map(e=>new ce(e.className,e.methodName)),[n]);return a(()=>{n?.customInstrumentations||r||o("customInstrumentations",{[de.Golang]:Nl[de.Golang],[de.Java]:Nl[de.Java]})},[]),e(l,{children:[e(g,{children:[e(A,{$gap:8,children:[t(bt,{}),t(b,{label:"Golang custom probes"})]}),t(k,{columns:[{keyName:"packageName",label:"Package name",placeholder:"e.g. github.com/my-org/my-package",tooltip:"The full import path of the package containing the function or method to be instrumented."},{keyName:"functionName",label:"Function name",placeholder:"e.g. myFunction",tooltip:"The name of the function to be instrumented. Leave empty if instrumenting a receiver method."},{keyName:"receiverName",label:"Receiver name",placeholder:"e.g. myReceiver",tooltip:"The name of the receiver type if instrumenting a method. Leave empty if instrumenting a standalone function."},{keyName:"receiverMethodName",label:"Receiver method name",placeholder:"e.g. myMethod",tooltip:"The name of the method to be instrumented. Leave empty if instrumenting a standalone function."}],values:s,setValues:e=>{const t={};t[de.Golang]=e.map(e=>new se(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)),t[de.Java]=d,o("customInstrumentations",t)},errorMessage:r,limitFieldsPerRow:2})]}),e(g,{children:[e(A,{$gap:8,children:[t(ft,{}),t(b,{label:"Java custom probes"})]}),t(k,{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[de.Golang]=s,t[de.Java]=e.map(e=>new ce(e.className,e.methodName)),o("customInstrumentations",t)},errorMessage:r,limitFieldsPerRow:2})]})]})},[ue.HeadersCollection]:({value:e,setValue:l,formErrors:n})=>{const o=n.headersCollection,i=c(()=>e?.headersCollection?.[ie.HeaderKeys]||[],[e]),r=e=>{const t={[ie.HeaderKeys]:e};l("headersCollection",t)};return a(()=>{i.length||o||r(xl)},[]),t(I,{label:"Header keys",tooltip:"Specify which headers you want to collect",helpMessage:"Asterisk (*) will collect all headers",values:i,setValues:r,errorMessage:o})},[ue.PayloadCollection]:({value:l,setValue:n,formErrors:o})=>{const i=h(),r=o.payloadCollection,s=c(()=>Object.entries(l.payloadCollection||{}).filter(([e,t])=>!!t).map(([e])=>e),[l]);return a(()=>{if(!s.length&&!r){const e={[re.HttpRequest]:{},[re.HttpResponse]:{},[re.DbQuery]:{},[re.Messaging]:{}};n("payloadCollection",e)}},[]),e(g,{$gap:12,children:[t(J,{size:K.XS,color:i.v2.colors.silver[200],nowrap:!0,children:"Type of data to collect"}),t(g,{$gap:6,children:Il.map(({id:e,label:l,tooltip:a})=>t(oe,{text:a,withIcon:!0,children:t(f,{label:l,value:s.includes(e),onChange:t=>((e,t)=>{const l=t?[...s,e]:s.filter(t=>t!==e),a={[re.HttpRequest]:l.includes(re.HttpRequest)?{}:null,[re.HttpResponse]:l.includes(re.HttpResponse)?{}:null,[re.DbQuery]:l.includes(re.DbQuery)?{}:null,[re.Messaging]:l.includes(re.Messaging)?{}:null};n("payloadCollection",a)})(e,t)})},e))}),t(y,{errorMessage:r})]})},[ue.UnknownType]:null},Tl=({ruleType:e,value:l,setValue:a,formErrors:n})=>{if(!e)return null;const o=Al[e];return o?t(o,{value:l,setValue:a,formErrors:n}):null},Dl=({option:l,formData:a,handleFormChange:n,formErrors:o})=>{const i=h();return e(g,{$gap:24,children:[e(A,{$gap:12,$justifyContent:"space-between",children:[t(J,{size:K.XXS,children:l.docsDescription}),t(T,{label:"Docs",leftIcon:mt,variant:F.Text,size:D.S,onClick:()=>window.open(`${U}${l.docsEndpoint}`,"_blank","noopener noreferrer")})]}),e(A,{$gap:12,children:[t(J,{size:K.XS,color:i.v2.colors.silver[200],nowrap:!0,children:"Supported Languages:"}),l.supportedLanguages.map(e=>t(pe,{label:he[e],leftIcon:me(e),status:G.Default,useSecondaryTone:!0},e))]}),t(Y,{options:[{icon:pt,label:"Enabled",value:!1,selectedBgColor:i.v2.colors.green[800]},{icon:gt,label:"Disabled",value:!0,selectedBgColor:i.v2.colors.red[800]}],selected:a.disabled,setSelected:e=>n("disabled",e)}),t(C,{label:"Rule name",placeholder:"Use a name that describes the rule...",value:a.ruleName,onChange:({target:{value:e}})=>n("ruleName",e),errorMessage:o.ruleName}),t(Tl,{ruleType:l.type,value:a,setValue:(e,t)=>n(e,t),formErrors:o}),t(X,{label:"Notes",placeholder:"Your personal notes...",value:a.notes,onChange:({target:{value:e}})=>n("notes",e),errorMessage:o.notes})]})},Fl={type:"",disabled:!1,name:"",notes:"",signals:[],fields:{}},Vl=p.div`
55
+ `,kl=r(({isOpen:l,onClose:a,onBack:n,onNext:i,nextIsSkip:r,onSave:c,disableSave:d,connectionIds:u,header:p,subHeader:h,leftColumn:m,rightColumn:g,search:b,filters:f,errorMessage:C,isFormDirty:v,hideDirtyNote:y,isFetching:k,progress:w},S)=>{const[$,x]=o(!1),[I,N]=o(!1),[D,O]=o(void 0);s(S,()=>({clearErrors:()=>O(void 0)}));const V=I,M=()=>{v&&!$?x(!0):(x(!1),a?.())},R=d||I||"boolean"==typeof v&&!v,P=!!b||!!u||!!f,L=!!h,E=(P?48:0)+(L?50:0);return e(q,{width:ml,isOpen:l,hideOverlay:!I,header:{...p,onClose:a?M:void 0,onCloseDisabled:V},children:[I?t(z,{$height:"calc(100vh - 136px)",children:t(vl,{children:t(H,{titleSize:K.S,subTitleSize:K.XXXS,withGradient:!0,withSpinner:!0,...w})})}):e(gl,{children:[P&&e(bl,{children:[u&&t(B,{icon:pt,title:"Selected Clusters",badge:{label:u.value.length}}),b&&t(W,{width:"100%",...b}),f]}),L&&t(fl,{children:t(B,{icon:h.icon,title:h.title,subTitle:h.description,badge:h.badge})}),e(Cl,{children:[t(hl,{isLeft:!0,heightOffset:E,...m}),t(hl,{isRight:!0,heightOffset:E,...g})]})]}),e(yl,{children:[k?t(H,{icon:ht,title:"Fetching Data...",titleSize:K.XXS,withGradient:!0}):I?w?null:t(H,{icon:ht,title:"Saving Changes...",titleSize:K.XXS,withGradient:!0}):D||C?t(_,{fullWidth:!0,status:G.Error,message:D||C}):"boolean"==typeof v&&v&&!y?t(_,{fullWidth:!0,status:G.Info,message:'The values don\'t reflect the current configurations of the selected clusters.\n"Save" will override the current configurations.'}):"boolean"!=typeof v||v||y?null:t(_,{fullWidth:!0,status:G.Success,message:"The values reflect the current configuration of the selected cluster."}),e(A,{$gap:8,children:[t("div",n?{style:{width:"150px"},children:t(T,{fullWidth:!0,variant:F.Secondary,label:"Back",leftIcon:mt,onClick:n})}:{style:{width:"150px"},children:t(T,{fullWidth:!0,variant:F.Secondary,label:"Cancel",onClick:M,disabled:V})}),t("div",i?{style:{width:"150px"},children:t(T,r?{fullWidth:!0,variant:F.Secondary,label:"Skip",rightIcon:gt,onClick:i}:{fullWidth:!0,variant:F.Primary,label:"Next",rightIcon:gt,onClick:i})}:{style:{width:"150px"},children:t(T,{fullWidth:!0,variant:F.Primary,label:"Save",onClick:async()=>{N(!0);const e=await c();N(!1),e?.error?O(e.error):(u?.setValue([]),a?.())},disabled:R})})]})]}),t(ol,{isOpen:$,onClose:()=>x(!1),onApprove:M})]})});kl.displayName=kl.name;const wl=({option:l,formData:a,handleFormChange:n,formErrors:o})=>{const i=h();return e(g,{$gap:24,children:[e(A,{$gap:12,$justifyContent:"space-between",children:[t(J,{size:K.XXS,children:l.docsDescription}),t(T,{label:"Docs",leftIcon:bt,variant:F.Text,size:D.S,onClick:()=>window.open(`${U}${l.docsEndpoint}`,"_blank","noopener noreferrer")})]}),t(Y,{options:[{icon:pt,label:"Enabled",value:!1,selectedBgColor:i.v2.colors.green[800]},{icon:ft,label:"Disabled",value:!0,selectedBgColor:i.v2.colors.red[800]}],selected:a.disabled,setSelected:e=>n("disabled",e)}),t(sl,{title:"Signals for processing",allowedSignals:l.allowedSignals,selectedSignals:a.signals||[],setSelectedSignals:e=>n("signals",e),errorMessage:o.signals}),t(v,{label:"Action name",placeholder:"Use a name that describes the action...",value:a.name||"",onChange:({target:{value:e}})=>n("name",e),errorMessage:o.name}),t(nl,{actionType:l.type,value:a.fields,setValue:(e,t)=>n(`fields.${e}`,t),formErrors:o}),t(X,{label:"Notes",placeholder:"Your personal notes...",value:a.notes||"",onChange:({target:{value:e}})=>n("notes",e),errorMessage:o.notes})]})},Sl=({signals:l,fields:a,formData:n,handleFormChange:o,formErrors:i})=>a?.map(({renderCondition:a,componentType:r,type:s,name:c,title:d,tooltip:u,placeholder:p,value:h,required:m,options:b})=>{if(a&&!Z(a,l,n.fields))return null;const y=c,k=n.fields.find(e=>e.key===y),S=k?k.value:h;switch(r){case O.Input:return t(v,{name:y,type:s,label:d,tooltip:u,required:m,placeholder:p,value:S,onChange:e=>o(y,e.target.value),errorMessage:i[y]},y);case O.MultiInput:return t(I,{label:d,tooltip:u,required:m,placeholder:p,values:ee(S,[]),setValues:e=>o(y,JSON.stringify(e)),errorMessage:i[y]},y);case O.KeyValuePair:return t(w,{label:d,tooltip:u,required:m,limitFieldsPerRow:2,columns:[{keyName:"key",label:"Key"},{keyName:"value",label:"Value"}],values:ee(S,[]),setValues:e=>o(y,JSON.stringify(e)),errorMessage:i[y]},y);case O.TextArea:return t(X,{name:y,label:d,tooltip:u,required:m,placeholder:p,value:S,onChange:e=>o(y,e.target.value),errorMessage:i[y]},y);case O.Checkbox:return e(g,{children:[t(f,{label:d,value:"true"==S,onChange:e=>o(y,e.toString())}),t(C,{errorMessage:i[y]})]},y);case O.Dropdown:return t(Q,{name:y,label:d,withSearch:!0,values:S?[S]:[],options:b?.map(e=>({id:e.id||"",label:e.value||""}))||[],setValues:e=>o(y,e[0]),errorMessage:i[y]},y);default:return null}}),$l=({option:l,dynamicFields:n,formData:o,handleFormChange:i,formErrors:r})=>{const s=h();return a(()=>{const e=n.map(e=>({key:e.name,value:e.value}));i("fields",e);const t=te(l.supportedSignals),a={logs:t.includes(le.Logs),metrics:t.includes(le.Metrics),traces:t.includes(le.Traces)};i("exportedSignals",a)},[n]),e(g,{$gap:24,children:[e(A,{$gap:12,$justifyContent:"space-between",children:[t("div",{}),t(T,{label:"Docs",leftIcon:bt,variant:F.Text,size:D.S,onClick:()=>window.open(`${U}/backends/${l.type}`,"_blank","noopener noreferrer")})]}),t(Y,{options:[{icon:pt,label:"Enabled",value:!1,selectedBgColor:s.v2.colors.green[800]},{icon:ft,label:"Disabled",value:!0,selectedBgColor:s.v2.colors.red[800]}],selected:o.disabled,setSelected:e=>i("disabled",e)}),t(sl,{title:"This connection will monitor:",allowedSignals:te(l.supportedSignals),selectedSignals:ae(o.exportedSignals),setSelectedSignals:e=>i("exportedSignals",{logs:e.includes(le.Logs),metrics:e.includes(le.Metrics),traces:e.includes(le.Traces)}),errorMessage:r.exportedSignals}),t(v,{label:"Destination name",placeholder:"Use a name that describes the destination...",value:o.name,onChange:({target:{value:e}})=>i("name",e),errorMessage:r.name}),t(Sl,{signals:ae(o.exportedSignals),fields:n,formData:o,handleFormChange:(e,t)=>{i("fields",o.fields.map(l=>l.key===e?{...l,value:t}:l))},formErrors:r})]})},xl=[{id:ne.FilePath,label:"Collect file path",tooltip:"Indicates whether to record the `code.filepath` attribute."},{id:ne.Function,label:"Collect function",tooltip:"Indicates whether to record the `code.function` attribute."},{id:ne.LineNumber,label:"Collect line number",tooltip:"Indicates whether to record the `code.lineno` attribute."}],Il=[{id:ne.Column,label:"Collect column",tooltip:"Indicates whether to record the `code.column` attribute."},{id:ne.Namespace,label:"Collect namespace",tooltip:"Indicates whether to record the `code.namespace` attribute."},{id:ne.StackTrace,label:"Collect stacktrace",tooltip:"Indicates whether to record the `code.stacktrace` attribute."}],Nl=["*"],Al=[{id:re.HttpRequest,label:"Collect HTTP request",tooltip:""},{id:re.HttpResponse,label:"Collect HTTP response",tooltip:""},{id:re.DbQuery,label:"Collect DB query",tooltip:""},{id:re.Messaging,label:"Collect messaging",tooltip:""}],Tl={[de.Java]:[new ce("","")],[de.Golang]:[new se("")]},Dl={[ue.CodeAttributes]:({value:n,setValue:o,formErrors:i})=>{const r=h(),s=i.codeAttributes,d=c(()=>Object.entries(n.codeAttributes||{}).filter(([e,t])=>!!t).map(([e])=>e),[n]);a(()=>{if(!d.length&&!s){const e={[ne.FilePath]:!0,[ne.Function]:!0,[ne.LineNumber]:!0,[ne.Column]:null,[ne.Namespace]:null,[ne.StackTrace]:null};o("codeAttributes",e)}},[]);const u=(e,t)=>{const l=t?[...d,e]:d.filter(t=>t!==e),a=Object.values(ne).reduce((e,t)=>(e[t]=!!l.includes(t)||null,e),{});o("codeAttributes",a)};return e(l,{children:[e(g,{$gap:12,children:[t(J,{size:K.XS,color:r.v2.colors.silver[200],nowrap:!0,children:"Recommended data to collect"}),t(g,{$gap:6,children:xl.map(({id:e,label:l,tooltip:a})=>t(oe,{text:a,withIcon:!0,children:t(f,{label:l,value:d.includes(e),onChange:t=>u(e,t)})},e))}),t(C,{errorMessage:s})]}),e(g,{$gap:12,children:[t(J,{size:K.XS,color:r.v2.colors.silver[200],nowrap:!0,children:"Verbose data to collect"}),t(g,{$gap:6,children:Il.map(({id:e,label:l,tooltip:a})=>t(oe,{text:a,withIcon:!0,children:t(f,{label:l,value:d.includes(e),onChange:t=>u(e,t)})},e))}),t(C,{errorMessage:s})]})]})},[ue.CustomInstrumentation]:({value:n,setValue:o,formErrors:i})=>{const r=i.customInstrumentations,s=c(()=>(n?.customInstrumentations?.[de.Golang]||[]).map(e=>new se(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)),[n]),d=c(()=>(n?.customInstrumentations?.[de.Java]||[]).map(e=>new ce(e.className,e.methodName)),[n]);return a(()=>{n?.customInstrumentations||r||o("customInstrumentations",{[de.Golang]:Tl[de.Golang],[de.Java]:Tl[de.Java]})},[]),e(l,{children:[e(g,{children:[e(A,{$gap:8,children:[t(Ct,{}),t(b,{label:"Golang custom probes"})]}),t(w,{columns:[{keyName:"packageName",label:"Package name",placeholder:"e.g. github.com/my-org/my-package",tooltip:"The full import path of the package containing the function or method to be instrumented."},{keyName:"functionName",label:"Function name",placeholder:"e.g. myFunction",tooltip:"The name of the function to be instrumented. Leave empty if instrumenting a receiver method."},{keyName:"receiverName",label:"Receiver name",placeholder:"e.g. myReceiver",tooltip:"The name of the receiver type if instrumenting a method. Leave empty if instrumenting a standalone function."},{keyName:"receiverMethodName",label:"Receiver method name",placeholder:"e.g. myMethod",tooltip:"The name of the method to be instrumented. Leave empty if instrumenting a standalone function."}],values:s,setValues:e=>{const t={};t[de.Golang]=e.map(e=>new se(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)),t[de.Java]=d,o("customInstrumentations",t)},errorMessage:r,limitFieldsPerRow:2})]}),e(g,{children:[e(A,{$gap:8,children:[t(vt,{}),t(b,{label:"Java custom probes"})]}),t(w,{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[de.Golang]=s,t[de.Java]=e.map(e=>new ce(e.className,e.methodName)),o("customInstrumentations",t)},errorMessage:r,limitFieldsPerRow:2})]})]})},[ue.HeadersCollection]:({value:e,setValue:l,formErrors:n})=>{const o=n.headersCollection,i=c(()=>e?.headersCollection?.[ie.HeaderKeys]||[],[e]),r=e=>{const t={[ie.HeaderKeys]:e};l("headersCollection",t)};return a(()=>{i.length||o||r(Nl)},[]),t(I,{label:"Header keys",tooltip:"Specify which headers you want to collect",helpMessage:"Asterisk (*) will collect all headers",values:i,setValues:r,errorMessage:o})},[ue.PayloadCollection]:({value:l,setValue:n,formErrors:o})=>{const i=h(),r=o.payloadCollection,s=c(()=>Object.entries(l.payloadCollection||{}).filter(([e,t])=>!!t).map(([e])=>e),[l]);return a(()=>{if(!s.length&&!r){const e={[re.HttpRequest]:{},[re.HttpResponse]:{},[re.DbQuery]:{},[re.Messaging]:{}};n("payloadCollection",e)}},[]),e(g,{$gap:12,children:[t(J,{size:K.XS,color:i.v2.colors.silver[200],nowrap:!0,children:"Type of data to collect"}),t(g,{$gap:6,children:Al.map(({id:e,label:l,tooltip:a})=>t(oe,{text:a,withIcon:!0,children:t(f,{label:l,value:s.includes(e),onChange:t=>((e,t)=>{const l=t?[...s,e]:s.filter(t=>t!==e),a={[re.HttpRequest]:l.includes(re.HttpRequest)?{}:null,[re.HttpResponse]:l.includes(re.HttpResponse)?{}:null,[re.DbQuery]:l.includes(re.DbQuery)?{}:null,[re.Messaging]:l.includes(re.Messaging)?{}:null};n("payloadCollection",a)})(e,t)})},e))}),t(C,{errorMessage:r})]})},[ue.UnknownType]:null},Fl=({ruleType:e,value:l,setValue:a,formErrors:n})=>{if(!e)return null;const o=Dl[e];return o?t(o,{value:l,setValue:a,formErrors:n}):null},Ol=({option:l,formData:a,handleFormChange:n,formErrors:o})=>{const i=h();return e(g,{$gap:24,children:[e(A,{$gap:12,$justifyContent:"space-between",children:[t(J,{size:K.XXS,children:l.docsDescription}),t(T,{label:"Docs",leftIcon:bt,variant:F.Text,size:D.S,onClick:()=>window.open(`${U}${l.docsEndpoint}`,"_blank","noopener noreferrer")})]}),e(A,{$gap:12,children:[t(J,{size:K.XS,color:i.v2.colors.silver[200],nowrap:!0,children:"Supported Languages:"}),l.supportedLanguages.map(e=>t(pe,{label:he[e],leftIcon:me(e),status:G.Default,useSecondaryTone:!0},e))]}),t(Y,{options:[{icon:pt,label:"Enabled",value:!1,selectedBgColor:i.v2.colors.green[800]},{icon:ft,label:"Disabled",value:!0,selectedBgColor:i.v2.colors.red[800]}],selected:a.disabled,setSelected:e=>n("disabled",e)}),t(v,{label:"Rule name",placeholder:"Use a name that describes the rule...",value:a.ruleName,onChange:({target:{value:e}})=>n("ruleName",e),errorMessage:o.ruleName}),t(Fl,{ruleType:l.type,value:a,setValue:(e,t)=>n(e,t),formErrors:o}),t(X,{label:"Notes",placeholder:"Your personal notes...",value:a.notes,onChange:({target:{value:e}})=>n("notes",e),errorMessage:o.notes})]})},Vl={type:"",disabled:!1,name:"",notes:"",signals:[],fields:{}},Ml=p.div`
59
56
  display: flex;
60
57
  align-items: center;
61
58
  justify-content: space-between;
62
59
  gap: 12px;
63
60
  padding: 8px 12px;
64
61
  border-radius: 12px;
65
- background-color: ${({$isSelected:e,theme:t})=>e?t.v2.colors.silver[600]:"transparent"};
62
+ background-color: ${({$isSelected:e,$purpleColors:t,theme:l})=>e?t?l.v2.colors.purple[800]:l.v2.colors.silver[600]:t?l.v2.colors.purple[900]:"transparent"};
66
63
  cursor: pointer;
67
64
  &:hover {
68
- background-color: ${({theme:e})=>e.v2.colors.silver[800]};
65
+ background-color: ${({$isSelected:e,$purpleColors:t,theme:l})=>e?t?l.v2.colors.purple[700]:l.v2.colors.silver[600]:t?l.v2.colors.purple[800]:l.v2.colors.silver[700]};
69
66
  }
70
- `,Ol=p.div`
67
+ `,Rl=p.div`
71
68
  display: flex;
72
69
  align-items: center;
73
70
  justify-content: center;
74
71
  padding: 8px;
75
72
  border-radius: 8px;
76
73
  background-color: ${({theme:e})=>e.v2.colors.white[500]+ge["004"]};
77
- `,Ml=({icon:l,title:a,description:n,withCarret:o,children:i,isSelected:r,onClick:s,isChecked:c,isPartiallyChecked:d,onCheckboxChange:u})=>{const p=h();return e(Vl,{$isSelected:r,onClick:()=>!r&&s(),children:[e(g,{$gap:4,children:[e(A,{$gap:12,children:[u&&t(f,{partiallyChecked:d||!1,value:c||!1,onChange:e=>u(e)}),l&&t(Ol,{children:t(l,{size:20})}),t(J,{size:K.XS,children:a})]}),n&&t(J,{size:K.XXXS,color:p.v2.colors.silver[200],children:n})]}),i,o&&t("div",{children:t(yt,{size:18})})]})},Rl=p.div`
74
+ `,Pl=({icon:l,title:a,description:n,withCarret:o,purpleColors:i,children:r,isSelected:s,onClick:c,isChecked:d,isPartiallyChecked:u,onCheckboxChange:p})=>{const m=h();return e(Ml,{$isSelected:s,$purpleColors:i,onClick:()=>!s&&c(),children:[e(g,{$gap:4,children:[e(A,{$gap:12,children:[p&&t(f,{partiallyChecked:u||!1,value:d||!1,onChange:e=>p(e)}),l&&t(Rl,{children:t(l,{size:20})}),t(J,{size:K.XS,children:a})]}),n&&t(J,{size:K.XXXS,color:m.v2.colors.silver[200],children:n})]}),(o||r)&&e(A,{$gap:8,children:[r,o&&t(yt,{size:18})]})]})},Ll=p.div`
78
75
  display: flex;
79
76
  align-items: center;
80
77
  gap: 8px;
81
78
  padding: 8px;
82
- `,Pl=({onClose:l,selectedConnectionIds:a,setSelectedConnectionIds:n,createAction:r})=>{const s=h(),[d,u]=o(""),[p,m]=o(null),g=c(()=>(d?be.filter(e=>e?.label?.toLowerCase().includes(d.toLowerCase())):be).filter(e=>!!e),[d]),b=c(()=>(d?fe.filter(e=>e?.label?.toLowerCase().includes(d.toLowerCase())):fe).filter(e=>!!e),[d]),f=ye(Fl),y=i(null),C=c(()=>{const l=(l,a)=>e(Rl,{children:[t(J,{size:K.XS,color:s.v2.colors.silver[200],children:l}),t(pe,{label:a.toString()})]},l),a=e=>{const l=p?.type===e.type;return t(Ml,{title:e.label,description:e.description,withCarret:!0,isSelected:l,onClick:()=>{y.current?.clearErrors(),f.resetFormData(),f.handleFormChange("type",e.type),m(e)}},e.type)};return[l("Attributes",g.length),...g.map(a),l("Samplers",b.length),...b.map(a)]},[s,p?.type,g.length,b.length,f]),v=c(()=>p?[t(vl,{option:p,...f},p?.type)]:[t(z,{$height:"100%",children:t(j,{icon:Ct,title:"Action not selected",subTitle:"Please select an action to add"})},"no-data")],[p,f]);return t(Cl,{ref:y,isOpen:!0,onClose:l,onSave:async()=>{const{isOk:e,preparedFormData:t}=((e,t)=>{if(!e)return{isOk:!1,preparedFormData:R(Fl)};const l=(a=t.formData,R(a));var a;const n={};return t.handleErrorChange(void 0,void 0,n),{isOk:0===Object.keys(n).length,preparedFormData:l}})(p,f);return e?await r(t):Promise.resolve({error:"Invalid form values"})},disableSave:!p||!f.isFormDirty,isFormDirty:f.isFormDirty,hideDirtyNote:!0,progress:{title:Ce.CREATING_ACTION,subTitle:Ce.CREATING_ACTION_SUBTITLE},header:{icon:Ct,title:Ce.ADD_ACTION,subTitle:Ce.ADD_ACTION_DESCRIPTION},connectionIds:{value:a,setValue:n},search:{value:d,onChange:u},leftColumn:{width:"40%",list:C},rightColumn:{width:"60%",list:v}})},Ll=({selectedArea:e,genericForm:l})=>({width:"60%",list:e?[t(kl,{option:e.option,dynamicFields:e.dynamicFields,...l},e?.option.type)]:[t(z,{$height:"100%",children:t(j,{icon:vt,title:"Select destination from the list",subTitle:"Add destination so your data has somewhere to go."})},"no-data")]});var El;!function(e){e.SELF_HOSTED="self hosted",e.MANAGED="managed"}(El||(El={}));const zl=e=>({type:"",disabled:!1,name:"",currentStreamName:e,exportedSignals:{logs:!1,metrics:!1,traces:!1},fields:[]}),jl=p.div`
79
+ `,El=({onClose:l,selectedConnectionIds:a,setSelectedConnectionIds:n,createAction:r})=>{const s=h(),[d,u]=o(""),[p,m]=o(null),g=c(()=>(d?be.filter(e=>e?.label?.toLowerCase().includes(d.toLowerCase())):be).filter(e=>!!e),[d]),b=c(()=>(d?fe.filter(e=>e?.label?.toLowerCase().includes(d.toLowerCase())):fe).filter(e=>!!e),[d]),f=Ce(Vl),C=i(null),v=c(()=>{const l=(l,a)=>e(Ll,{children:[t(J,{size:K.XS,color:s.v2.colors.silver[200],children:l}),t(pe,{label:a.toString()})]},l),a=e=>{const l=p?.type===e.type;return t(Pl,{title:e.label,description:e.description,withCarret:!0,isSelected:l,onClick:()=>{C.current?.clearErrors(),f.resetFormData(),f.handleFormChange("type",e.type),m(e)}},e.type)};return[l("Attributes",g.length),...g.map(a),l("Samplers",b.length),...b.map(a)]},[s,p?.type,g.length,b.length,f]),y=c(()=>p?[t(wl,{option:p,...f},p?.type)]:[t(z,{$height:"100%",children:t(j,{icon:kt,title:"Action not selected",subTitle:"Please select an action to add"})},"no-data")],[p,f]);return t(kl,{ref:C,isOpen:!0,onClose:l,onSave:async()=>{const{isOk:e,preparedFormData:t}=((e,t)=>{if(!e)return{isOk:!1,preparedFormData:R(Vl)};const l=(a=t.formData,R(a));var a;const n={};return t.handleErrorChange(void 0,void 0,n),{isOk:0===Object.keys(n).length,preparedFormData:l}})(p,f);return e?await r(t):Promise.resolve({error:"Invalid form values"})},disableSave:!p||!f.isFormDirty,isFormDirty:f.isFormDirty,hideDirtyNote:!0,progress:{title:ve.CREATING_ACTION,subTitle:ve.CREATING_ACTION_SUBTITLE},header:{icon:kt,title:ve.ADD_ACTION,subTitle:ve.ADD_ACTION_DESCRIPTION},connectionIds:{value:a,setValue:n},search:{value:d,onChange:u},leftColumn:{width:"40%",list:v},rightColumn:{width:"60%",list:y}})},zl=({selectedArea:e,genericForm:l})=>({width:"60%",list:e?[t($l,{option:e.option,dynamicFields:e.dynamicFields,...l},e?.option.type)]:[t(z,{$height:"100%",children:t(j,{icon:wt,title:"Select destination from the list",subTitle:"Add destination so your data has somewhere to go."})},"no-data")]});var jl;!function(e){e.SELF_HOSTED="self hosted",e.MANAGED="managed"}(jl||(jl={}));const ql=e=>({type:"",disabled:!1,name:"",currentStreamName:e,exportedSignals:{logs:!1,metrics:!1,traces:!1},fields:[]}),Hl=p.div`
83
80
  display: flex;
84
81
  flex-direction: column;
85
82
  padding: 8px;
86
83
  border-radius: 16px;
87
- background-color: ${({$noBgColor:e,theme:t})=>e?"transparent":t.v2.colors.silver[800]};
88
- `,ql=p.div`
84
+ border: ${({$purpleColors:e,theme:t})=>e?`1px solid ${t.v2.colors.purple[500]}`:"1px solid transparent"};
85
+ background-color: ${({$noBgColor:e,$purpleColors:t,theme:l})=>e?"transparent":t?l.v2.colors.purple[900]:l.v2.colors.silver[800]};
86
+ `,Kl=p.div`
89
87
  display: flex;
90
88
  align-items: center;
91
89
  justify-content: space-between;
92
90
  gap: 12px;
93
91
  padding: ${({$isOpen:e})=>e?"2px 12px 8px 12px":"2px 12px"};
94
- `,Hl=({title:l,tooltip:a,list:n,noBgColor:i})=>{const[r,s]=o(!0);return e(jl,{$noBgColor:i,children:[e(ql,{$isOpen:r,children:[e(A,{$gap:10,children:[t(J,{size:K.XS,children:l}),a&&t(oe,{text:a,withIcon:!0}),t(pe,{label:n.length})]}),t(we,{icon:r?wt:kt,size:ke.M,onClick:()=>s(e=>!e)})]}),r?t(g,{children:n.length?d.toArray(n):t(z,{$padding:"12px 0",children:t(j,{})})}):null]})},Kl=(e,t,l)=>t||l.signalType?e.filter(e=>e.displayName.toLowerCase().includes(t.toLowerCase())&&(!l.signalType||te(e.supportedSignals).includes(l.signalType))):e,_l=({listType:e,dest:l,isSelected:a,onSelect:n})=>t(Ml,{icon:xe(l.type).icon,title:l.displayName,withCarret:!0,isSelected:a,onClick:()=>{n()}},`${e}-${l.type}`),Bl=({listType:e,destinations:l,selectedArea:a,onSelect:n})=>t(Hl,{title:$e[e].TITLE,tooltip:$e[e].DESCRIPTION,list:l.map(l=>t(_l,{listType:e,dest:l,isSelected:a?.option.type===l.type&&a?.listType===e,onSelect:()=>{return n({listType:e,option:l,dynamicFields:(t=l.fields,t.filter(e=>!!e).map(e=>{const{name:t,componentType:l,componentProperties:a,displayName:n,initialValue:o,renderCondition:i}=e,r=l===V.Dropdown,s=ee(a,{});return{componentType:l,renderCondition:i,name:t,title:n,value:o,placeholder:s.placeholder||(r?"Select an option":void 0),options:r&&Array.isArray(s.values)?s.values.map(e=>({id:e,value:e})):void 0,...s}}))});var t}},`${e}-${l.type}`))},e),Wl=({isFetching:e,destinationsByCategory:l,searchText:a,filters:n,selectedArea:o,onSelect:i})=>{const r=c(()=>{const e=[];for(const r of Object.values(Se)){if(n.categoryType&&n.categoryType!==r)continue;const s=Kl(l[r],a,n);s.length&&e.push(t(Bl,{listType:r,destinations:s,selectedArea:o,onSelect:i},r))}return e},[l,a,n,o,i]);return{width:"40%",list:r.length?r:e?[t(z,{$height:"100%",children:t(H,{title:"Fetching destinations",subTitle:"Please wait while we fetch the destinations",withSpinner:!0})},"loading")]:[]}},Gl=({destinationsByCategory:a,filters:n,setFilters:o})=>{const i=c(()=>Object.values(Se).map(e=>({id:e,label:e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()})).filter(e=>a[e.id]?.length),[a]),r=c(()=>{const e=Object.values(le).map(e=>({value:e,label:e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}));return e.unshift({value:null,label:"All"}),e},[]);return e(l,{children:[t(Q,{placeholder:"Select category",options:i,values:n.categoryType?[n.categoryType]:[],setValues:e=>o({...n,categoryType:n.categoryType===e[0]?null:e[0]})}),t(Y,{size:Ie.S,options:r,selected:n.signalType,setSelected:e=>o({...n,signalType:e})})]})},Jl=({onClose:e,selectedConnectionIds:l,setSelectedConnectionIds:n,getDestinationCategories:r,getPotentialDestinations:s,createDestination:c})=>{const[d,p]=o(""),[h,m]=o({categoryType:null,signalType:null}),[g,b]=o(null),[f,y]=o(!0),[C,v]=o({[Se.ALL]:[],[Se.EXISTS]:[],[Se.DETECTED]:[],[Se.SELF_HOSTED]:[],[Se.MANAGED]:[]}),k=u(async()=>{try{y(!0);const[e,t]=await Promise.all([r(),s()]),{detectedDestinations:l,selfHostedDestinations:a,managedDestinations:n}=((e,t)=>{const l=[],a=[],n=[];return e&&e.destinationCategories.categories.forEach(e=>{e.name===El.SELF_HOSTED?a.push(...e.items):e.name===El.MANAGED&&n.push(...e.items)}),t&&t?.potentialDestinations.forEach(t=>{for(const a of e?.destinationCategories?.categories||[]){const e=R(a),n=e.items.findIndex(e=>e.type===t.type);if(-1!==n){const a=ee(t.fields,[]);a.length&&(e.items[n].fields=e.items[n].fields.map(e=>{const t=a.find(t=>t.name===e.name)?.initialValue;return{...e,initialValue:t}}),l.push(e.items[n]))}}}),{detectedDestinations:l,selfHostedDestinations:a,managedDestinations:n}})(e,t);v(e=>({...e,[Se.DETECTED]:l,[Se.SELF_HOSTED]:a,[Se.MANAGED]:n}))}catch(e){}finally{y(!1)}},[]);a(()=>{k()},[]);const{selectedStreamName:S}=Ne(),$=ye(zl(S)),x=i(null);return t(Cl,{ref:x,isOpen:!0,onClose:e,onSave:async()=>{const{isOk:e,preparedFormData:t}=((e,t)=>{if(!e)return{isOk:!1,preparedFormData:R(zl(t.formData.currentStreamName))};const l=R(t.formData),a={};return e.dynamicFields.forEach(({name:e,required:t})=>{if(t){const t=l.fields.find(t=>t.key===e)?.value;w(t)&&(a[e]=ve.FIELD_IS_REQUIRED)}}),ae(l.exportedSignals).length||(a.exportedSignals=ve.FIELD_IS_REQUIRED),t.handleErrorChange(void 0,void 0,a),{isOk:0===Object.keys(a).length,preparedFormData:l}})(g,$);return e?await c(t):Promise.resolve({error:"Invalid form values"})},disableSave:!g,isFetching:f,isFormDirty:$.isFormDirty,hideDirtyNote:!0,progress:{title:Ce.CREATING_DESTINATION,subTitle:Ce.CREATING_DESTINATION_SUBTITLE},header:{icon:vt,title:Ce.ADD_DESTINATIONS,subTitle:Ce.ADD_DESTINATION_DRAWER_DESCRIPTION},connectionIds:{value:l,setValue:n},search:{value:d,onChange:p},filters:t(Gl,{destinationsByCategory:C,filters:h,setFilters:m}),leftColumn:Wl({isFetching:f,destinationsByCategory:C,searchText:d,filters:h,selectedArea:g,onSelect:e=>{$.resetFormData(),x.current?.clearErrors(),b(e)}}),rightColumn:Ll({selectedArea:g,genericForm:$})})},Ul={disabled:!1,ruleName:"",notes:"",workloads:null,instrumentationLibraries:null,payloadCollection:null,codeAttributes:null,headersCollection:null,customInstrumentations:null},Yl=({onClose:e,selectedConnectionIds:l,setSelectedConnectionIds:a,createInstrumentationRule:n})=>{const[r,s]=o(""),[d,u]=o(null),p=c(()=>r?Ae.filter(e=>e.label.toLowerCase().includes(r.toLowerCase())):Ae,[r]),h=ye(Ul),m=i(null),g=c(()=>p.map(e=>{const l=d?.type===e.type;return t(Ml,{title:e.label,description:e.description,withCarret:!0,isSelected:l,onClick:()=>{h.resetFormData(),m.current?.clearErrors(),u(e)}},e.type)}),[d,p.length,h]),b=c(()=>d?[t(Dl,{option:d,...h},d?.type)]:[t(z,{$height:"100%",children:t(j,{icon:St,title:"Instrumentation rule not selected",subTitle:"Please select an instrumentation rule to add"})},"no-data")],[d,h]);return t(Cl,{ref:m,isOpen:!0,onClose:e,onSave:async()=>{const{isOk:e,preparedFormData:t}=((e,t)=>{if(!e)return{isOk:!1,preparedFormData:R(Ul)};const l=(e=>{const t=R(e);return t.headersCollection?.[ie.HeaderKeys]?.length&&(t.headersCollection[ie.HeaderKeys]=t.headersCollection[ie.HeaderKeys].map(e=>e.trim()).filter(e=>e)),t.customInstrumentations?.[de.Golang]?.length&&(t.customInstrumentations[de.Golang]=t.customInstrumentations[de.Golang].map(e=>new se(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)).filter(e=>e.Verify())),t.customInstrumentations?.[de.Java]?.length&&(t.customInstrumentations[de.Java]=t.customInstrumentations[de.Java].map(e=>new ce(e.className,e.methodName)).filter(e=>e.Verify())),t})(t.formData),a={};switch(e.type){case ue.CodeAttributes:Object.values(l.codeAttributes||{}).some(e=>null!=e)||(a.codeAttributes="Code attributes are required");break;case ue.PayloadCollection:Object.values(l.payloadCollection||{}).some(e=>null!=e)||(a.payloadCollection="Payload collection are required");break;case ue.HeadersCollection:l.headersCollection?.[ie.HeaderKeys]?.length||(a.headersCollection="Header keys are required");break;case ue.CustomInstrumentation:l.customInstrumentations?.[de.Golang]?.length||l.customInstrumentations?.[de.Java]?.length||(a.customInstrumentations="Custom instrumentation are required")}return t.handleErrorChange(void 0,void 0,a),{isOk:0===Object.keys(a).length,preparedFormData:l}})(d,h);return e?await n(t):Promise.resolve({error:"Invalid form values"})},disableSave:!d||!h.isFormDirty,isFormDirty:h.isFormDirty,hideDirtyNote:!0,progress:{title:Ce.CREATING_INSTRUMENTATION_RULE,subTitle:Ce.CREATING_INSTRUMENTATION_RULE_SUBTITLE},header:{icon:St,title:Ce.ADD_INSTRUMENTATION_RULE,subTitle:Ce.ADD_INSTRUMENTATION_RULE_DESCRIPTION},connectionIds:{value:l,setValue:a},search:{value:r,onChange:s},leftColumn:{width:"40%",list:g},rightColumn:{width:"60%",list:b}})},Xl=e=>{const t=e.workloads.filter(({selected:e})=>e).length,l=e.workloads.length;return{selectedCount:t,isAllSourced:t>0&&t===l,isSomeSourced:t>0&&t<l,isFutureApps:e.selected||!1}},Zl=(e,t,l)=>{if(t&&!e.name.toLowerCase().includes(t.toLowerCase()))return!1;if(l.showOnlySelected){const{isAllSourced:t,isSomeSourced:l,isFutureApps:a}=Xl(e);return t||l||a}return!0},Ql=(e,t,l)=>!(t&&!e.name.toLowerCase().includes(t.toLowerCase()))&&(!l.showOnlySelected||e.selected),ea=p.div``,ta=p.div`
92
+ `,Bl=({title:l,tooltip:a,list:n,noBgColor:i,purpleColors:r})=>{const[s,c]=o(!0);return e(Hl,{$noBgColor:i,$purpleColors:r,children:[e(Kl,{$isOpen:s,children:[e(A,{$gap:10,children:[t(J,{size:K.XS,children:l}),a&&t(oe,{text:a,withIcon:!0}),t(pe,{label:n.length,status:r?G.Default:void 0})]}),t(ke,{icon:s?St:$t,size:we.M,onClick:()=>c(e=>!e)})]}),s?t(g,{children:n.length?d.toArray(n):t(z,{$padding:"12px 0",children:t(j,{})})}):null]})},Wl=(e,t,l)=>t||l.signalType?e.filter(e=>e.displayName.toLowerCase().includes(t.toLowerCase())&&(!l.signalType||te(e.supportedSignals).includes(l.signalType))):e,_l=({listType:e,dest:l,isSelected:a,onSelect:n})=>t(Pl,{icon:xe(l.type).icon,title:l.displayName,withCarret:!0,isSelected:a,onClick:()=>{n()}},`${e}-${l.type}`),Gl=({listType:e,destinations:l,selectedArea:a,onSelect:n})=>t(Bl,{title:$e[e].TITLE,tooltip:$e[e].DESCRIPTION,list:l.map(l=>t(_l,{listType:e,dest:l,isSelected:a?.option.type===l.type&&a?.listType===e,onSelect:()=>{return n({listType:e,option:l,dynamicFields:(t=l.fields,t.filter(e=>!!e).map(e=>{const{name:t,componentType:l,componentProperties:a,displayName:n,initialValue:o,renderCondition:i}=e,r=l===O.Dropdown,s=ee(a,{});return{componentType:l,renderCondition:i,name:t,title:n,value:o,placeholder:s.placeholder||(r?"Select an option":void 0),options:r&&Array.isArray(s.values)?s.values.map(e=>({id:e,value:e})):void 0,...s}}))});var t}},`${e}-${l.type}`))},e),Jl=({isFetching:e,destinationsByCategory:l,searchText:a,filters:n,selectedArea:o,onSelect:i})=>{const r=c(()=>{const e=[];for(const r of Object.values(Se)){if(n.categoryType&&n.categoryType!==r)continue;const s=Wl(l[r],a,n);s.length&&e.push(t(Gl,{listType:r,destinations:s,selectedArea:o,onSelect:i},r))}return e},[l,a,n,o,i]);return{width:"40%",list:r.length?r:e?[t(z,{$height:"100%",children:t(H,{title:"Fetching destinations",subTitle:"Please wait while we fetch the destinations",withSpinner:!0})},"loading")]:[]}},Ul=({destinationsByCategory:a,filters:n,setFilters:o})=>{const i=c(()=>Object.values(Se).map(e=>({id:e,label:e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()})).filter(e=>a[e.id]?.length),[a]),r=c(()=>{const e=Object.values(le).map(e=>({value:e,label:e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}));return e.unshift({value:null,label:"All"}),e},[]);return e(l,{children:[t(Q,{placeholder:"Select category",options:i,values:n.categoryType?[n.categoryType]:[],setValues:e=>o({...n,categoryType:n.categoryType===e[0]?null:e[0]})}),t(Y,{size:Ie.S,options:r,selected:n.signalType,setSelected:e=>o({...n,signalType:e})})]})},Yl=({onClose:e,selectedConnectionIds:l,setSelectedConnectionIds:n,getDestinationCategories:r,getPotentialDestinations:s,createDestination:c})=>{const[d,p]=o(""),[h,m]=o({categoryType:null,signalType:null}),[g,b]=o(null),[f,C]=o(!0),[v,y]=o({[Se.ALL]:[],[Se.EXISTS]:[],[Se.DETECTED]:[],[Se.SELF_HOSTED]:[],[Se.MANAGED]:[]}),w=u(async()=>{try{C(!0);const[e,t]=await Promise.all([r(),s()]),{detectedDestinations:l,selfHostedDestinations:a,managedDestinations:n}=((e,t)=>{const l=[],a=[],n=[];return e&&e.destinationCategories.categories.forEach(e=>{e.name===jl.SELF_HOSTED?a.push(...e.items):e.name===jl.MANAGED&&n.push(...e.items)}),t&&t?.potentialDestinations.forEach(t=>{for(const a of e?.destinationCategories?.categories||[]){const e=R(a),n=e.items.findIndex(e=>e.type===t.type);if(-1!==n){const a=ee(t.fields,[]);a.length&&(e.items[n].fields=e.items[n].fields.map(e=>{const t=a.find(t=>t.name===e.name)?.initialValue;return{...e,initialValue:t}}),l.push(e.items[n]))}}}),{detectedDestinations:l,selfHostedDestinations:a,managedDestinations:n}})(e,t);y(e=>({...e,[Se.DETECTED]:l,[Se.SELF_HOSTED]:a,[Se.MANAGED]:n}))}catch(e){}finally{C(!1)}},[]);a(()=>{w()},[]);const{selectedStreamName:S}=Ne(),$=Ce(ql(S)),x=i(null);return t(kl,{ref:x,isOpen:!0,onClose:e,onSave:async()=>{const{isOk:e,preparedFormData:t}=((e,t)=>{if(!e)return{isOk:!1,preparedFormData:R(ql(t.formData.currentStreamName))};const l=R(t.formData),a={};return e.dynamicFields.forEach(({name:e,required:t})=>{if(t){const t=l.fields.find(t=>t.key===e)?.value;k(t)&&(a[e]=ye.FIELD_IS_REQUIRED)}}),ae(l.exportedSignals).length||(a.exportedSignals=ye.FIELD_IS_REQUIRED),t.handleErrorChange(void 0,void 0,a),{isOk:0===Object.keys(a).length,preparedFormData:l}})(g,$);return e?await c(t):Promise.resolve({error:"Invalid form values"})},disableSave:!g,isFetching:f,isFormDirty:$.isFormDirty,hideDirtyNote:!0,progress:{title:ve.CREATING_DESTINATION,subTitle:ve.CREATING_DESTINATION_SUBTITLE},header:{icon:wt,title:ve.ADD_DESTINATIONS,subTitle:ve.ADD_DESTINATION_DRAWER_DESCRIPTION},connectionIds:{value:l,setValue:n},search:{value:d,onChange:p},filters:t(Ul,{destinationsByCategory:v,filters:h,setFilters:m}),leftColumn:Jl({isFetching:f,destinationsByCategory:v,searchText:d,filters:h,selectedArea:g,onSelect:e=>{$.resetFormData(),x.current?.clearErrors(),b(e)}}),rightColumn:zl({selectedArea:g,genericForm:$})})},Xl={disabled:!1,ruleName:"",notes:"",workloads:null,instrumentationLibraries:null,payloadCollection:null,codeAttributes:null,headersCollection:null,customInstrumentations:null},Zl=({onClose:e,selectedConnectionIds:l,setSelectedConnectionIds:a,createInstrumentationRule:n})=>{const[r,s]=o(""),[d,u]=o(null),p=c(()=>r?Ae.filter(e=>e.label.toLowerCase().includes(r.toLowerCase())):Ae,[r]),h=Ce(Xl),m=i(null),g=c(()=>p.map(e=>{const l=d?.type===e.type;return t(Pl,{title:e.label,description:e.description,withCarret:!0,isSelected:l,onClick:()=>{h.resetFormData(),m.current?.clearErrors(),u(e)}},e.type)}),[d,p.length,h]),b=c(()=>d?[t(Ol,{option:d,...h},d?.type)]:[t(z,{$height:"100%",children:t(j,{icon:xt,title:"Instrumentation rule not selected",subTitle:"Please select an instrumentation rule to add"})},"no-data")],[d,h]);return t(kl,{ref:m,isOpen:!0,onClose:e,onSave:async()=>{const{isOk:e,preparedFormData:t}=((e,t)=>{if(!e)return{isOk:!1,preparedFormData:R(Xl)};const l=(e=>{const t=R(e);return t.headersCollection?.[ie.HeaderKeys]?.length&&(t.headersCollection[ie.HeaderKeys]=t.headersCollection[ie.HeaderKeys].map(e=>e.trim()).filter(e=>e)),t.customInstrumentations?.[de.Golang]?.length&&(t.customInstrumentations[de.Golang]=t.customInstrumentations[de.Golang].map(e=>new se(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)).filter(e=>e.Verify())),t.customInstrumentations?.[de.Java]?.length&&(t.customInstrumentations[de.Java]=t.customInstrumentations[de.Java].map(e=>new ce(e.className,e.methodName)).filter(e=>e.Verify())),t})(t.formData),a={};switch(e.type){case ue.CodeAttributes:Object.values(l.codeAttributes||{}).some(e=>null!=e)||(a.codeAttributes="Code attributes are required");break;case ue.PayloadCollection:Object.values(l.payloadCollection||{}).some(e=>null!=e)||(a.payloadCollection="Payload collection are required");break;case ue.HeadersCollection:l.headersCollection?.[ie.HeaderKeys]?.length||(a.headersCollection="Header keys are required");break;case ue.CustomInstrumentation:l.customInstrumentations?.[de.Golang]?.length||l.customInstrumentations?.[de.Java]?.length||(a.customInstrumentations="Custom instrumentation are required")}return t.handleErrorChange(void 0,void 0,a),{isOk:0===Object.keys(a).length,preparedFormData:l}})(d,h);return e?await n(t):Promise.resolve({error:"Invalid form values"})},disableSave:!d||!h.isFormDirty,isFormDirty:h.isFormDirty,hideDirtyNote:!0,progress:{title:ve.CREATING_INSTRUMENTATION_RULE,subTitle:ve.CREATING_INSTRUMENTATION_RULE_SUBTITLE},header:{icon:xt,title:ve.ADD_INSTRUMENTATION_RULE,subTitle:ve.ADD_INSTRUMENTATION_RULE_DESCRIPTION},connectionIds:{value:l,setValue:a},search:{value:r,onChange:s},leftColumn:{width:"40%",list:g},rightColumn:{width:"60%",list:b}})},Ql=e=>{const t=e.workloads.filter(({selected:e})=>e).length,l=e.workloads.length;return{selectedCount:t,isAllSourced:t>0&&t===l,isSomeSourced:t>0&&t<l,isFutureApps:e.selected||!1}},ea=(e,t,l)=>{if(t&&!e.name.toLowerCase().includes(t.toLowerCase()))return!1;if(l.showOnlySelected){const{isAllSourced:t,isSomeSourced:l,isFutureApps:a}=Ql(e);return t||l||a}return!0},ta=(e,t,l)=>!(t&&!e.name.toLowerCase().includes(t.toLowerCase()))&&(!l.showOnlySelected||e.selected),la=p.div``,aa=p.div`
95
93
  visibility: hidden;
96
94
 
97
95
  transition: visibility 0s;
@@ -99,19 +97,19 @@ import{jsxs as e,jsx as t,Fragment as l}from"react/jsx-runtime";import{useEffect
99
97
  transition-duration: 0s;
100
98
  }
101
99
 
102
- ${ea}:hover & {
100
+ ${la}:hover & {
103
101
  visibility: visible;
104
102
  }
105
- `,la=({workloadName:e,workloadKind:l,isChecked:a,onToggle:n})=>{const o=h();return t(ea,{children:t(Ml,{title:e,onClick:n,isChecked:a,onCheckboxChange:n,children:t(ta,{children:t(pe,{label:l,status:G.Info,textSize:K.XXXS,backgroundColor:o.v2.colors.blue[900]})})})})},aa=({formData:l,handleSourceChange:a,handleSelectAll:n,selectedArea:o,searchText:i,filters:r})=>{const s=c(()=>o.value.clusterId&&o.value.namespaceName?l.find(({clusterId:e})=>e===o.value.clusterId)?.namespaces.find(({name:e})=>e===o.value.namespaceName):void 0,[l,o.value.clusterId,o.value.namespaceName]),d=c(()=>s?[...s.workloads].sort((e,t)=>e.name.localeCompare(t.name)).filter(e=>Ql(e,i,r)):[],[s,i,r]),u=c(()=>!!d.length&&d.every(({selected:e})=>e),[d]),p=c(()=>{if(!s)return[];const{clusterId:e}=o.value,{name:l}=s;return d.map(({name:n,selected:o,kind:i})=>t(la,{workloadName:n,workloadKind:i,isChecked:o||!1,onToggle:()=>a({clusterId:e,workloadId:{namespace:l,name:n,kind:i}})},`${e}#${l}#${n}#${i}`))},[d,s,o.value.clusterId]),{withFilterCount:h,filteredCount:m,totalCount:g}=c(()=>{const e=s?.workloads.length??0;return{withFilterCount:d.length!==e,filteredCount:d.length,totalCount:e}},[d,s]);return{width:"40%",header:e(A,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(A,{$gap:8,children:[t(J,{size:K.XS,nowrap:!0,children:o.value.namespaceName?`${o.value.namespaceName} > Workloads`:"Workloads"}),t(oe,{text:h?Ce.FILTERED_COUNT_TOOLTIP:void 0,children:t(pe,{label:`${h?`${m} / ${g}`:g}`,status:Te.Unknown})})]}),t(J,{onClick:()=>n({clusterId:o.value.clusterId,namespaceName:o.value.namespaceName,boolean:!u}),disabled:!p.length,size:K.XS,children:(u?"Unselect":"Select")+" all"})]}),list:s?p:[t(z,{$height:"100%",children:t(j,{icon:$t,title:Ce.SELECT_NAMESPACE,subTitle:Ce.SELECT_NAMESPACE_SUBTITLE})},"no-data")]}},na=p.div``,oa=p.div`
103
+ `,na=({workloadName:e,workloadKind:l,isChecked:a,onToggle:n})=>{const o=h();return t(la,{children:t(Pl,{title:e,onClick:n,isChecked:a,onCheckboxChange:n,children:t(aa,{children:t(pe,{label:l,status:G.Info,textSize:K.XXXS,backgroundColor:o.v2.colors.blue[900]})})})})},oa=({formData:l,handleSourceChange:a,handleSelectAll:n,selectedArea:o,searchText:i,filters:r})=>{const s=c(()=>o.value.clusterId&&o.value.namespaceName?l.find(({clusterId:e})=>e===o.value.clusterId)?.namespaces.find(({name:e})=>e===o.value.namespaceName):void 0,[l,o.value.clusterId,o.value.namespaceName]),d=c(()=>s?[...s.workloads].sort((e,t)=>e.name.localeCompare(t.name)).filter(e=>ta(e,i,r)):[],[s,i,r]),u=c(()=>!!d.length&&d.every(({selected:e})=>e),[d]),p=c(()=>{if(!s)return[];const{clusterId:e}=o.value,{name:l}=s;return d.map(({name:n,selected:o,kind:i})=>t(na,{workloadName:n,workloadKind:i,isChecked:o||!1,onToggle:()=>a({clusterId:e,workloadId:{namespace:l,name:n,kind:i}})},`${e}#${l}#${n}#${i}`))},[d,s,o.value.clusterId]),{withFilterCount:h,filteredCount:m,totalCount:g}=c(()=>{const e=s?.workloads.length??0;return{withFilterCount:d.length!==e,filteredCount:d.length,totalCount:e}},[d,s]);return{width:"40%",header:e(A,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(A,{$gap:8,children:[t(J,{size:K.XS,nowrap:!0,children:o.value.namespaceName?`${o.value.namespaceName} > Workloads`:"Workloads"}),t(oe,{text:h?ve.FILTERED_COUNT_TOOLTIP:void 0,children:t(pe,{label:`${h?`${m} / ${g}`:g}`,status:Te.Unknown})})]}),t(J,{onClick:()=>n({clusterId:o.value.clusterId,namespaceName:o.value.namespaceName,boolean:!u}),disabled:!p.length,size:K.XS,children:(u?"Unselect":"Select")+" all"})]}),list:s?p:[t(z,{$height:"100%",children:t(j,{icon:It,title:ve.SELECT_NAMESPACE,subTitle:ve.SELECT_NAMESPACE_SUBTITLE})},"no-data")]}},ia=p.div``,ra=p.div`
106
104
  visibility: ${({$visible:e})=>e?"visible":"hidden"};
107
105
 
108
106
  transition: visibility 0s;
109
107
  ${({$visible:e})=>!e&&"& * {\n transition-duration: 0s !important;\n }"}
110
108
 
111
- ${na}:hover & {
109
+ ${ia}:hover & {
112
110
  visibility: visible;
113
111
  }
114
- `,ia=({clusterId:l,namespaceName:a,checkbox:n,isFutureApps:o,selectedCounts:i,isActive:r,onActive:s,handleSourceChange:c})=>{const d=h(),u=e=>{s(),c({clusterId:l,workloadId:{namespace:a},auto:e.auto,selected:e.all})};return t(na,{children:t(Ml,{title:a,isSelected:r,onClick:s,isPartiallyChecked:n.partial,isChecked:n.all,onCheckboxChange:e=>u({auto:e,all:e}),children:e(A,{$gap:12,children:[t(oa,{$visible:r||o,children:t(oe,{text:"Automatically instrument all workloads currently in the namespace, and all workloads that will be deployed to this namespace in the future",children:t($,{label:"Auto",size:De.S,value:o,onChange:e=>u({auto:e,all:e||void 0})})})}),e(A,{$gap:8,children:[t(J,{variant:Fe.Span,size:K.XXXS,color:d.v2.colors.silver[200],align:"right",children:"Selected"}),t(pe,{label:`${i.sourced}/${i.total}`,status:r?G.Default:Te.Unknown,minWidth:"42px"})]})]})})})},ra=({clusterId:e,clusterName:l,namespaces:a,selectedArea:n,setSelectedArea:o,handleSourceChange:i})=>{const r=c(()=>a.map(({name:a,totalWorkloads:r,selectedCount:s,isAllSourced:c,isSomeSourced:d,isFutureApps:u})=>t(ia,{clusterId:e,namespaceName:a,isFutureApps:u,checkbox:{all:c,partial:d},selectedCounts:{sourced:s,total:r},isActive:n.clusterId===e&&n.namespaceName===a,onActive:()=>o({clusterId:e,clusterName:l,namespaceName:a}),handleSourceChange:i},`${e}#${a}`)),[e,l,a,n]);return t(Hl,{title:l,list:r,noBgColor:!0})},sa=({isFetching:l,formData:a,handleSourceChange:n,handleSelectAll:o,selectedArea:i,setSelectedArea:r,searchText:s,filters:d})=>{const u=c(()=>a.map(e=>{const t=[...e.namespaces].sort((e,t)=>e.name.localeCompare(t.name)).filter(e=>Zl(e,s,d)).map(e=>({name:e.name,totalWorkloads:e.workloads.length,...Xl(e)}));return{clusterId:e.clusterId,clusterName:e.clusterName,visibleNamespaces:t}}),[a,s,d]),p=c(()=>{let e=!1;for(const{visibleNamespaces:t}of u)for(const{totalWorkloads:l,selectedCount:a}of t)if(e=!0,a!==l)return!1;return e},[u]),{list:h,withFilterCount:m,filteredCount:g,totalCount:b}=c(()=>{const e=u.map(({clusterId:e,clusterName:l,visibleNamespaces:a})=>a.length?t(ra,{clusterId:e,clusterName:l,namespaces:a,selectedArea:i,setSelectedArea:r,handleSourceChange:n},e):null),l=e.filter(e=>null!==e);return{list:l,withFilterCount:l.length!==e.length,filteredCount:l.length,totalCount:e.length}},[u,i]);return{width:"60%",header:e(A,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(A,{$gap:8,children:[t(J,{size:K.XS,nowrap:!0,children:"Namespaces"}),t(oe,{text:m?Ce.FILTERED_COUNT_TOOLTIP:void 0,children:t(pe,{label:`${m?`${g} / ${b}`:b}`,status:Te.Unknown})})]}),t(J,{onClick:()=>o({boolean:!p}),disabled:!h.length,size:K.XS,children:(p?"Unselect":"Select")+" all"})]}),list:h.length?h:l?[t(z,{$height:"100%",children:t(H,{title:Ce.FETCHING_NAMESPACES,subTitle:Ce.FETCHING_NAMESPACES_SUBTITLE,withSpinner:!0})},"loading")]:[]}},ca=({onClose:l,selectedConnectionIds:n,setSelectedConnectionIds:i,getAllClusterSnapshots:r,persistSources:s})=>{const d=h(),{selectedStreamName:p}=Ne(),{progress:m,resetProgress:g}=Ve(),b=c(()=>p||Oe,[p]),[f,y]=o(!1),[C,v]=o(null),w=u(async()=>{try{y(!0),v(await r()??null)}catch(e){}finally{y(!1)}},[]);a(()=>{w()},[]);const[k,S]=o(""),[x,I]=o(Me.Namespace),[N,T]=o({showOnlySelected:!1}),[D,F]=o({clusterId:"",clusterName:"",namespaceName:""}),[V,O]=o([]);a(()=>{C&&O(e=>{const t=((e,t)=>R(((e,t)=>e.clusters.filter(({clusterId:e})=>t.includes(e)))(e,t)))(C,n);return t.map(t=>{const l=e?.find(e=>e.clusterId===t.clusterId);return l??t})})},[C,n]);const{formDiff:M,isFormDirty:P}=c(()=>{const e=((e,t,l)=>{const a={};return e.forEach(e=>{e.namespaces.forEach(n=>{const o=t.find(t=>t.clusterId===e.clusterId)?.namespaces.find(e=>e.name===n.name),i=n.selected||!1,r=i!==o?.selected;if(r&&(a[e.clusterId]||(a[e.clusterId]=[]),a[e.clusterId].push({namespace:n.name,selected:i,currentStreamName:l}),i&&(a[e.clusterId]=a[e.clusterId].filter(e=>e.namespace!==n.name||e.namespace===n.name&&(!e.name||!e.kind)))),!r||!i){const t=((e,t,l)=>{const a=[];return t.workloads.forEach(n=>{const o=e?.workloads.find(e=>e.name===n.name&&e.kind===n.kind);n.selected!==o?.selected&&a.push({namespace:t.name,name:n.name,kind:n.kind,selected:n.selected||!1,currentStreamName:l})}),a})(o,n,l);t.length>0&&(a[e.clusterId]||(a[e.clusterId]=[]),a[e.clusterId].push(...t))}})}),a})(V,C?.clusters||[],b);return{formDiff:e,isFormDirty:Object.keys(e).length>0}},[V,C,b]),L=u(({clusterId:e,workloadId:t,selected:l,auto:a})=>{O(n=>{const o=R(n),i=o.findIndex(t=>t.clusterId===e);if(-1===i)return o;const r=o[i].namespaces.findIndex(e=>e.name===t.namespace);if(-1===r)return o;if(t.kind&&t.name){const e=o[i].namespaces[r].workloads.findIndex(e=>e.name===t.name&&e.kind===t.kind);if(-1===e)return o;const a="boolean"==typeof l?l:!o[i].namespaces[r].workloads[e].selected;o[i].namespaces[r].workloads[e].selected=a,a?o[i].namespaces[r].workloads.every(e=>e.selected)&&(o[i].namespaces[r].selected=!0):o[i].namespaces[r].selected=!1}else{const e="boolean"==typeof a?a:!o[i].namespaces[r].selected;o[i].namespaces[r].selected=e,e?o[i].namespaces[r].workloads.forEach(e=>{e.selected=!0}):"boolean"!=typeof l||l||o[i].namespaces[r].workloads.forEach(e=>{e.selected=!1})}return o})},[]),E=u(({clusterId:e,namespaceName:t,boolean:l})=>{O(a=>{const n=R(a),o=x===Me.Namespace?k:"",i=x===Me.Source?k:"",r=!!o||!!i||!!N?.showOnlySelected;return n.forEach((a,s)=>{e&&a.clusterId!==e||a.namespaces.forEach(({name:e,workloads:a},c)=>{if(!t||e===t)if(r)if(t){a.forEach((e,t)=>{Ql(e,i,N)&&(n[s].namespaces[c].workloads[t].selected=l)});const e=n[s].namespaces[c].workloads.every(e=>e.selected);n[s].namespaces[c].selected=e}else{if(!Zl(n[s].namespaces[c],o,N))return;n[s].namespaces[c].selected=l,a.forEach((e,t)=>{n[s].namespaces[c].workloads[t].selected=l})}else n[s].namespaces[c].selected=l,a.forEach((e,t)=>{n[s].namespaces[c].workloads[t].selected=l})})}),n})},[x,k,N]);return t(Cl,{isOpen:!0,onClose:()=>{g(Re.BulkInstrumenting),l()},onSave:()=>s(M),header:{icon:$t,title:Ce.ADD_SOURCE,subTitle:Ce.ADD_SOURCES_DESCRIPTION},connectionIds:{value:n,setValue:i},search:{value:k,onChange:e=>{S(e),x===Me.Namespace&&F({clusterId:"",clusterName:"",namespaceName:""})},segment:{options:[{label:"Namespace",value:Me.Namespace},{label:"Source",value:Me.Source}],selected:x,setSelected:I}},filters:e(A,{$gap:8,children:[t(J,{size:K.XXXS,color:d.v2.colors.silver[200],nowrap:!0,children:"Show only:"}),t($,{size:De.S,label:"Selected",value:N.showOnlySelected,onChange:e=>T(t=>({...t,showOnlySelected:e}))})]}),isFormDirty:P,isFetching:f,progress:{title:Ce.CREATING_SOURCES,subTitle:Ce.CREATING_SOURCES_SUBTITLE,percentage:m[Re.BulkInstrumenting]?.percentage||0},leftColumn:sa({isFetching:f,formData:V,handleSourceChange:L,handleSelectAll:E,selectedArea:D,setSelectedArea:F,searchText:x===Me.Namespace?k:"",filters:N}),rightColumn:aa({formData:V,handleSourceChange:L,handleSelectAll:E,selectedArea:{value:D},searchText:x===Me.Source?k:"",filters:N})})},da=({onClose:l,connections:n,selectedConnectionIds:i,setSelectedConnectionIds:r,getEffectiveConfig:s,onApply:d})=>{const u=h(),[p,m]=o(""),[g,b]=o({showOnlySelected:!1}),f=c(()=>n.filter(e=>{const t=!p||e.name.toLowerCase().includes(p.toLowerCase()),l=!g.showOnlySelected||g.showOnlySelected&&i.includes(e.id);return t&&l}),[n.length,i.length,p,g]),y=e=>{r(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[C,v]=o(!1),[w,k]=o(void 0),{formData:S,handleFormChange:x,areFormValuesEqual:I,resetFormData:N}=ye(w||{rollout:{automaticRolloutDisabled:!1}}),T=c(()=>i.length>1||void 0!==w&&!I(w,S),[i.length,w,S]);return a(()=>{1===i.length?(async e=>{if(C)return;v(!0);const t=await s(e);if(t){const e={rollout:{automaticRolloutDisabled:t.rollout?.automaticRolloutDisabled||!1}};k(e),N(e)}v(!1)})(i[0]):k(void 0)},[i.length]),t(Cl,{isOpen:!0,onClose:l,onSave:()=>d(S,i),header:{icon:xt,title:"Cluster Configuration"},connectionIds:{value:i,setValue:r},search:{placeholder:"Search by cluster name",value:p,onChange:m},filters:e(A,{$gap:8,children:[t(J,{size:K.XXXS,color:u.v2.colors.silver[200],nowrap:!0,children:"Show only:"}),t($,{size:De.S,label:"Selected",value:g.showOnlySelected,onChange:e=>b(t=>({...t,showOnlySelected:e}))})]}),isFormDirty:T,isFetching:C,leftColumn:{width:"35%",header:e(A,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(A,{$gap:8,children:[t(J,{size:K.XS,children:"Clusters"}),t(pe,{label:f.length,status:Te.Unknown})]}),e(A,{$gap:8,children:[t(J,{size:K.XXXS,color:u.v2.colors.silver[200],align:"right",children:"Selected clusters"}),t(pe,{label:`${i.length}/${f.length}`,status:Te.Unknown})]})]}),list:f.map(e=>t(Ml,{title:e.name,isChecked:i.includes(e.id),onClick:()=>y(e.id),onCheckboxChange:()=>y(e.id)},e.id))},rightColumn:{width:"65%",header:t(J,{size:K.XS,children:"Configurations"}),list:[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:S.rollout?.automaticRolloutDisabled||!1,onChange:e=>x("rollout.automaticRolloutDisabled",e)},"automatic-rollout-disabled")]}})},ua=({token:a,isLoading:n,isEditing:o,onEdit:i,onCancel:r,onSave:s,formData:c,handleFormChange:d,handleErrorChange:u,formErrors:p})=>{const{CopyButton:h}=Pe(),m=!o||n||!c.newToken;return Le({key:"Enter",active:!m},s),e(A,o?{$justifyContent:"space-between",$alignItems:"flex-start",$gap:12,children:[t(C,{type:"password",value:c.newToken,onChange:e=>{d("newToken",e.target.value),u("newToken",void 0)},width:"430px",autoFocus:!0,errorMessage:p.newToken}),t(A,{$margin:n?"8px 0 0 0":"2px 0 0 0",$alignItems:"center",children:n?t(H,{title:"Saving...",withGradient:!0}):e(l,{children:[t(T,{variant:F.Secondary,size:D.S,leftIcon:It,onClick:r,disabled:n}),t(T,{variant:F.Primary,size:D.S,leftIcon:Nt,onClick:s,disabled:m})]})})]}:{$justifyContent:"space-between",$gap:12,children:[t(J,{size:K.XS,children:new Array(55).fill("•").join("")}),e(A,{$alignItems:"center",$justifyContent:"space-between",children:[t(h,{value:a}),t(we,{icon:At,onClick:i})]})]})},pa=({expiresAt:e,callbackValid:l,callbackExpired:n})=>{const{formatTimeAgo:o}=Ee(),i=c(()=>o(e),[e]),r=c(()=>new Date(e).toDateString().split(" ").slice(1).join(" "),[e]),s=c(()=>ze(e,0)?G.Error:ze(e,2592e6)?G.Warning:G.Success,[e]),d=c(()=>s===G.Success?Nt:s===G.Warning?Tt:Dt,[s]);return a(()=>{s===G.Success?l():s===G.Error&&n()},[s]),t(oe,{text:r,children:t(pe,{leftIcon:d,label:i,status:s,invertColors:!0,useSecondaryTone:!0})})},ha=p.div`
112
+ `,sa=({clusterId:l,namespaceName:a,checkbox:n,isFutureApps:o,selectedCounts:i,isActive:r,onActive:s,handleSourceChange:c})=>{const d=h(),u=e=>{s(),c({clusterId:l,workloadId:{namespace:a},auto:e.auto,selected:e.all})};return t(ia,{children:t(Pl,{title:a,isSelected:r,onClick:s,isPartiallyChecked:n.partial,isChecked:n.all,onCheckboxChange:e=>u({auto:e,all:e}),children:e(A,{$gap:12,children:[t(ra,{$visible:r||o,children:t(oe,{text:"Automatically instrument all workloads currently in the namespace, and all workloads that will be deployed to this namespace in the future",children:t($,{label:"Auto",size:De.S,value:o,onChange:e=>u({auto:e,all:e||void 0})})})}),e(A,{$gap:8,children:[t(J,{variant:Fe.Span,size:K.XXXS,color:d.v2.colors.silver[200],align:"right",children:"Selected"}),t(pe,{label:`${i.sourced}/${i.total}`,status:r?G.Default:Te.Unknown,minWidth:"42px"})]})]})})})},ca=({clusterId:e,clusterName:l,namespaces:a,selectedArea:n,setSelectedArea:o,handleSourceChange:i})=>{const r=c(()=>a.map(({name:a,totalWorkloads:r,selectedCount:s,isAllSourced:c,isSomeSourced:d,isFutureApps:u})=>t(sa,{clusterId:e,namespaceName:a,isFutureApps:u,checkbox:{all:c,partial:d},selectedCounts:{sourced:s,total:r},isActive:n.clusterId===e&&n.namespaceName===a,onActive:()=>o({clusterId:e,clusterName:l,namespaceName:a}),handleSourceChange:i},`${e}#${a}`)),[e,l,a,n]);return t(Bl,{title:l,list:r,noBgColor:!0})},da=({isFetching:l,formData:a,handleSourceChange:n,handleSelectAll:o,selectedArea:i,setSelectedArea:r,searchText:s,filters:d})=>{const u=c(()=>a.map(e=>{const t=[...e.namespaces].sort((e,t)=>e.name.localeCompare(t.name)).filter(e=>ea(e,s,d)).map(e=>({name:e.name,totalWorkloads:e.workloads.length,...Ql(e)}));return{clusterId:e.clusterId,clusterName:e.clusterName,visibleNamespaces:t}}),[a,s,d]),p=c(()=>{let e=!1;for(const{visibleNamespaces:t}of u)for(const{totalWorkloads:l,selectedCount:a}of t)if(e=!0,a!==l)return!1;return e},[u]),{list:h,withFilterCount:m,filteredCount:g,totalCount:b}=c(()=>{const e=u.map(({clusterId:e,clusterName:l,visibleNamespaces:a})=>a.length?t(ca,{clusterId:e,clusterName:l,namespaces:a,selectedArea:i,setSelectedArea:r,handleSourceChange:n},e):null),l=e.filter(e=>null!==e);return{list:l,withFilterCount:l.length!==e.length,filteredCount:l.length,totalCount:e.length}},[u,i]);return{width:"60%",header:e(A,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(A,{$gap:8,children:[t(J,{size:K.XS,nowrap:!0,children:"Namespaces"}),t(oe,{text:m?ve.FILTERED_COUNT_TOOLTIP:void 0,children:t(pe,{label:`${m?`${g} / ${b}`:b}`,status:Te.Unknown})})]}),t(J,{onClick:()=>o({boolean:!p}),disabled:!h.length,size:K.XS,children:(p?"Unselect":"Select")+" all"})]}),list:h.length?h:l?[t(z,{$height:"100%",children:t(H,{title:ve.FETCHING_NAMESPACES,subTitle:ve.FETCHING_NAMESPACES_SUBTITLE,withSpinner:!0})},"loading")]:[]}},ua=({onClose:l,selectedConnectionIds:n,setSelectedConnectionIds:i,getAllClusterSnapshots:r,persistSources:s})=>{const d=h(),{selectedStreamName:p}=Ne(),{progress:m,resetProgress:g}=Oe(),b=c(()=>p||Ve,[p]),[f,C]=o(!1),[v,y]=o(null),k=u(async()=>{try{C(!0),y(await r()??null)}catch(e){}finally{C(!1)}},[]);a(()=>{k()},[]);const[w,S]=o(""),[x,I]=o(Me.Namespace),[N,T]=o({showOnlySelected:!1}),[D,F]=o({clusterId:"",clusterName:"",namespaceName:""}),[O,V]=o([]);a(()=>{v&&V(e=>{const t=((e,t)=>R(((e,t)=>e.clusters.filter(({clusterId:e})=>t.includes(e)))(e,t)))(v,n);return t.map(t=>{const l=e?.find(e=>e.clusterId===t.clusterId);return l??t})})},[v,n]);const{formDiff:M,isFormDirty:P}=c(()=>{const e=((e,t,l)=>{const a={};return e.forEach(e=>{e.namespaces.forEach(n=>{const o=t.find(t=>t.clusterId===e.clusterId)?.namespaces.find(e=>e.name===n.name),i=n.selected||!1,r=i!==o?.selected;if(r&&(a[e.clusterId]||(a[e.clusterId]=[]),a[e.clusterId].push({namespace:n.name,selected:i,currentStreamName:l}),i&&(a[e.clusterId]=a[e.clusterId].filter(e=>e.namespace!==n.name||e.namespace===n.name&&(!e.name||!e.kind)))),!r||!i){const t=((e,t,l)=>{const a=[];return t.workloads.forEach(n=>{const o=e?.workloads.find(e=>e.name===n.name&&e.kind===n.kind);n.selected!==o?.selected&&a.push({namespace:t.name,name:n.name,kind:n.kind,selected:n.selected||!1,currentStreamName:l})}),a})(o,n,l);t.length>0&&(a[e.clusterId]||(a[e.clusterId]=[]),a[e.clusterId].push(...t))}})}),a})(O,v?.clusters||[],b);return{formDiff:e,isFormDirty:Object.keys(e).length>0}},[O,v,b]),L=u(({clusterId:e,workloadId:t,selected:l,auto:a})=>{V(n=>{const o=R(n),i=o.findIndex(t=>t.clusterId===e);if(-1===i)return o;const r=o[i].namespaces.findIndex(e=>e.name===t.namespace);if(-1===r)return o;if(t.kind&&t.name){const e=o[i].namespaces[r].workloads.findIndex(e=>e.name===t.name&&e.kind===t.kind);if(-1===e)return o;const a="boolean"==typeof l?l:!o[i].namespaces[r].workloads[e].selected;o[i].namespaces[r].workloads[e].selected=a,a?o[i].namespaces[r].workloads.every(e=>e.selected)&&(o[i].namespaces[r].selected=!0):o[i].namespaces[r].selected=!1}else{const e="boolean"==typeof a?a:!o[i].namespaces[r].selected;o[i].namespaces[r].selected=e,e?o[i].namespaces[r].workloads.forEach(e=>{e.selected=!0}):"boolean"!=typeof l||l||o[i].namespaces[r].workloads.forEach(e=>{e.selected=!1})}return o})},[]),E=u(({clusterId:e,namespaceName:t,boolean:l})=>{V(a=>{const n=R(a),o=x===Me.Namespace?w:"",i=x===Me.Source?w:"",r=!!o||!!i||!!N?.showOnlySelected;return n.forEach((a,s)=>{e&&a.clusterId!==e||a.namespaces.forEach(({name:e,workloads:a},c)=>{if(!t||e===t)if(r)if(t){a.forEach((e,t)=>{ta(e,i,N)&&(n[s].namespaces[c].workloads[t].selected=l)});const e=n[s].namespaces[c].workloads.every(e=>e.selected);n[s].namespaces[c].selected=e}else{if(!ea(n[s].namespaces[c],o,N))return;n[s].namespaces[c].selected=l,a.forEach((e,t)=>{n[s].namespaces[c].workloads[t].selected=l})}else n[s].namespaces[c].selected=l,a.forEach((e,t)=>{n[s].namespaces[c].workloads[t].selected=l})})}),n})},[x,w,N]);return t(kl,{isOpen:!0,onClose:()=>{g(Re.BulkInstrumenting),l()},onSave:()=>s(M),header:{icon:It,title:ve.ADD_SOURCE,subTitle:ve.ADD_SOURCES_DESCRIPTION},connectionIds:{value:n,setValue:i},search:{value:w,onChange:e=>{S(e),x===Me.Namespace&&F({clusterId:"",clusterName:"",namespaceName:""})},segment:{options:[{label:"Namespace",value:Me.Namespace},{label:"Source",value:Me.Source}],selected:x,setSelected:I}},filters:e(A,{$gap:8,children:[t(J,{size:K.XXXS,color:d.v2.colors.silver[200],nowrap:!0,children:"Show only:"}),t($,{size:De.S,label:"Selected",value:N.showOnlySelected,onChange:e=>T(t=>({...t,showOnlySelected:e}))})]}),isFormDirty:P,isFetching:f,progress:{title:ve.CREATING_SOURCES,subTitle:ve.CREATING_SOURCES_SUBTITLE,percentage:m[Re.BulkInstrumenting]?.percentage||0},leftColumn:da({isFetching:f,formData:O,handleSourceChange:L,handleSelectAll:E,selectedArea:D,setSelectedArea:F,searchText:x===Me.Namespace?w:"",filters:N}),rightColumn:oa({formData:O,handleSourceChange:L,handleSelectAll:E,selectedArea:{value:D},searchText:x===Me.Source?w:"",filters:N})})},pa=({onClose:l,connections:n,selectedConnectionIds:i,setSelectedConnectionIds:r,getEffectiveConfig:s,onApply:d})=>{const u=h(),[p,m]=o(""),[g,b]=o({showOnlySelected:!1}),f=c(()=>n.filter(e=>{const t=!p||e.name.toLowerCase().includes(p.toLowerCase()),l=!g.showOnlySelected||g.showOnlySelected&&i.includes(e.id);return t&&l}),[n.length,i.length,p,g]),C=e=>{r(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[v,y]=o(!1),[k,w]=o(void 0),{formData:S,handleFormChange:x,areFormValuesEqual:I,resetFormData:N}=Ce(k||{rollout:{automaticRolloutDisabled:!1}}),T=c(()=>i.length>1||void 0!==k&&!I(k,S),[i.length,k,S]);return a(()=>{1===i.length?(async e=>{if(v)return;y(!0);const t=await s(e);if(t){const e={rollout:{automaticRolloutDisabled:t.rollout?.automaticRolloutDisabled||!1}};w(e),N(e)}y(!1)})(i[0]):w(void 0)},[i.length]),t(kl,{isOpen:!0,onClose:l,onSave:()=>d(S,i),header:{icon:Nt,title:"Cluster Configuration"},connectionIds:{value:i,setValue:r},search:{placeholder:"Search by cluster name",value:p,onChange:m},filters:e(A,{$gap:8,children:[t(J,{size:K.XXXS,color:u.v2.colors.silver[200],nowrap:!0,children:"Show only:"}),t($,{size:De.S,label:"Selected",value:g.showOnlySelected,onChange:e=>b(t=>({...t,showOnlySelected:e}))})]}),isFormDirty:T,isFetching:v,leftColumn:{width:"35%",header:e(A,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(A,{$gap:8,children:[t(J,{size:K.XS,children:"Clusters"}),t(pe,{label:f.length,status:Te.Unknown})]}),e(A,{$gap:8,children:[t(J,{size:K.XXXS,color:u.v2.colors.silver[200],align:"right",children:"Selected clusters"}),t(pe,{label:`${i.length}/${f.length}`,status:Te.Unknown})]})]}),list:f.map(e=>t(Pl,{title:e.name,isChecked:i.includes(e.id),onClick:()=>C(e.id),onCheckboxChange:()=>C(e.id)},e.id))},rightColumn:{width:"65%",header:t(J,{size:K.XS,children:"Configurations"}),list:[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:S.rollout?.automaticRolloutDisabled||!1,onChange:e=>x("rollout.automaticRolloutDisabled",e)},"automatic-rollout-disabled")]}})},ha=({token:a,isLoading:n,isEditing:o,onEdit:i,onCancel:r,onSave:s,formData:c,handleFormChange:d,handleErrorChange:u,formErrors:p})=>{const{CopyButton:h}=Pe(),m=!o||n||!c.newToken;return Le({key:"Enter",active:!m},s),e(A,o?{$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(A,{$margin:n?"8px 0 0 0":"2px 0 0 0",$alignItems:"center",children:n?t(H,{title:"Saving...",withGradient:!0}):e(l,{children:[t(T,{variant:F.Secondary,size:D.S,leftIcon:At,onClick:r,disabled:n}),t(T,{variant:F.Primary,size:D.S,leftIcon:Tt,onClick:s,disabled:m})]})})]}:{$justifyContent:"space-between",$gap:12,children:[t(J,{size:K.XS,children:new Array(55).fill("•").join("")}),e(A,{$alignItems:"center",$justifyContent:"space-between",children:[t(h,{value:a}),t(ke,{icon:Dt,onClick:i})]})]})},ma=({expiresAt:e,callbackValid:l,callbackExpired:n})=>{const{formatTimeAgo:o}=Ee(),i=c(()=>o(e),[e]),r=c(()=>new Date(e).toDateString().split(" ").slice(1).join(" "),[e]),s=c(()=>ze(e,0)?G.Error:ze(e,2592e6)?G.Warning:G.Success,[e]),d=c(()=>s===G.Success?Tt:s===G.Warning?Ft:Ot,[s]);return a(()=>{s===G.Success?l():s===G.Error&&n()},[s]),t(oe,{text:r,children:t(pe,{leftIcon:d,label:i,status:s,invertColors:!0,useSecondaryTone:!0})})},ga=p.div`
115
113
  display: flex;
116
114
  flex-direction: column;
117
115
  gap: 12px;
@@ -119,14 +117,14 @@ import{jsxs as e,jsx as t,Fragment as l}from"react/jsx-runtime";import{useEffect
119
117
  border-radius: 12px;
120
118
  border: 1px solid ${({theme:e,$isExpired:t})=>t?e.v2.colors.red[500]:e.v2.colors.silver[600]};
121
119
  background-color: ${({theme:e,$isExpired:t})=>t?e.v2.colors.red[1e3]:e.v2.colors.silver[800]};
122
- `,ma=({children:e})=>{const l=h();return t(J,{size:K.XXXS,color:l.v2.colors.grey[150],children:e})},ga=({token:l,updateToken:a})=>{const[n,i]=o(!1),[r,s]=o(!1),[c,d]=o(!1),{formData:u,handleFormChange:p,formErrors:h,handleErrorChange:m,resetFormData:b}=ye({newToken:""});return t(je,{richTitle:{icon:Ft,title:"Odigos Pro Token"},children:e(ha,{$isExpired:c,children:[e(A,{$justifyContent:"space-between",children:[e(g,{$gap:4,children:[t(ma,{children:"Issued for"}),t(J,{size:K.XS,children:l.name||"N/A"})]}),e(g,{$gap:4,children:[t(ma,{children:"Expiration"}),t(pa,{expiresAt:l.expiresAt,callbackValid:()=>d(!1),callbackExpired:()=>d(!0)})]}),t(g,{})]}),t(A,{children:e(g,{children:[t(ma,{children:"Token"}),t(ua,{token:l.token,newToken:u.newToken,isLoading:r,isEditing:n,onEdit:()=>i(!0),onCancel:()=>(i(!1),s(!1),void p("newToken","")),onSave:()=>(async()=>{s(!0);const e=await a(u.newToken.trim());s(!1),e?.error?m("newToken",e.error):(i(!1),b())})(),formData:u,handleFormChange:p,handleErrorChange:m,formErrors:h})]})})]})})},ba=p.div`
120
+ `,ba=({children:e})=>{const l=h();return t(J,{size:K.XXXS,color:l.v2.colors.grey[150],children:e})},fa=({token:l,updateToken:a})=>{const[n,i]=o(!1),[r,s]=o(!1),[c,d]=o(!1),{formData:u,handleFormChange:p,formErrors:h,handleErrorChange:m,resetFormData:b}=Ce({newToken:""});return t(je,{richTitle:{icon:Vt,title:"Odigos Pro Token"},children:e(ga,{$isExpired:c,children:[e(A,{$justifyContent:"space-between",children:[e(g,{$gap:4,children:[t(ba,{children:"Issued for"}),t(J,{size:K.XS,children:l.name||"N/A"})]}),e(g,{$gap:4,children:[t(ba,{children:"Expiration"}),t(ma,{expiresAt:l.expiresAt,callbackValid:()=>d(!1),callbackExpired:()=>d(!0)})]}),t(g,{})]}),t(A,{children:e(g,{children:[t(ba,{children:"Token"}),t(ha,{token:l.token,newToken:u.newToken,isLoading:r,isEditing:n,onEdit:()=>i(!0),onCancel:()=>(i(!1),s(!1),void p("newToken","")),onSave:()=>(async()=>{s(!0);const e=await a(u.newToken.trim());s(!1),e?.error?m("newToken",e.error):(i(!1),b())})(),formData:u,handleFormChange:p,handleErrorChange:m,formErrors:h})]})})]})})},Ca=p.div`
123
121
  display: flex;
124
122
  align-items: center;
125
123
  justify-content: center;
126
124
  padding: 12px 24px;
127
125
  border-radius: 8px;
128
126
  background-color: ${({theme:e})=>e.v2.colors.silver[800]};
129
- `,fa=({downloadDiagnose:l})=>{const a=h(),{namespaces:n}=qe(),[i,r]=o(null),{formData:s,handleFormChange:c,resetFormData:d}=ye({includeProfiles:!0,includeMetrics:!0,includeSourceWorkloads:!1,sourceWorkloadNamespaces:[]});return t(je,{richTitle:{icon:Vt,title:"Diagnose"},children:i?t(ba,{children:t(H,{title:"Creating file...",subTitle:"This may take a few moments. Do not refresh the page.",startedAt:i,withGradient:!0,withVisual:!0,visualIcon:Ot})}):e(g,{$gap:24,children:[t(J,{size:K.XXS,color:a.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(A,{$gap:8,children:[t(f,{label:"Profiles",value:s.includeProfiles,onChange:e=>c("includeProfiles",e),tooltip:"Note: Adds 30s to diagnose download time to collect Profiles"}),t(J,{size:K.XXXS,color:a.v2.colors.silver[200],children:"Include pprof profiles"})]}),e(A,{$gap:8,children:[t(f,{label:"Metrics",value:s.includeMetrics,onChange:e=>c("includeMetrics",e)}),t(J,{size:K.XXXS,color:a.v2.colors.silver[200],children:"Include Prometheus metrics"})]}),e(A,{$gap:8,children:[t(f,{label:"Source Workloads",value:s.includeSourceWorkloads,onChange:e=>{c("includeSourceWorkloads",e),e&&c("sourceWorkloadNamespaces",[])}}),t(J,{size:K.XXXS,color:a.v2.colors.silver[200],children:"Include workload and pod manifests for instrumented sources"})]})]}),t(He,{alignX:_e.Left,alignY:Ke.Bottom,items:n.map(e=>({id:e.name,label:e.name,withCheckbox:!0})),selectedIds:s.sourceWorkloadNamespaces,setSelectedIds:e=>c("sourceWorkloadNamespaces",e),withMultiSelect:!0,withSearch:!0,fullWidth:!0,buttonProps:{label:(s.sourceWorkloadNamespaces.length?"Selected":"Select")+" Namespaces",variant:F.Secondary,disabled:s.includeSourceWorkloads,leftIcon:s.sourceWorkloadNamespaces.length?()=>t(pe,{label:s.sourceWorkloadNamespaces.length,status:G.Default}):void 0}}),t(A,{$justifyContent:"flex-end",children:t(T,{label:"Download Diagnose",rightIcon:Ot,variant:F.Primary,onClick:async()=>{r(Date.now()),await l(s),r(null),d()},disabled:null!==i})})]})})},ya=({fetchDescribeOdigos:e})=>{const{platformType:l,version:n,tier:i}=Be(),[r,s]=o(null);return a(()=>{e().then(({data:e})=>s(e?.describeOdigos||null))},[]),t(je,{richTitle:{icon:Mt,title:"General Information"},children:t(We,{cellsPerRow:2,items:[{id:Ge(),title:"Odigos Version",label:n},{id:Ge(),title:`${l.toUpperCase()} Version`,label:r?.kubernetesVersion?.value||"-"},{id:Ge(),title:"Installation Method",label:r?.installationMethod?.value||"-"},{id:Ge(),title:"Tier",label:i}]})})},Ca=({isOpen:l,onClose:a,token:n,updateToken:o,fetchDescribeOdigos:i,downloadDiagnose:r})=>e(q,{isOpen:l,header:{icon:Mt,title:"System Overview",onClose:a},children:[i&&t(ya,{fetchDescribeOdigos:i}),o&&n&&t(ga,{token:n,updateToken:o}),r&&t(fa,{downloadDiagnose:r})]});var va,wa;!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"}(va||(va={})),function(e){e.Id="id",e.Name="name",e.Type="type",e.Status="status",e.OdigosVersion="odigosVersion",e.ConnectedSince="connectedSince",e.LastActivity="lastActivity"}(wa||(wa={}));const ka=[{key:wa.Name,label:"Name"},{key:wa.Type,label:"Type",textAlign:"right"},{key:wa.Status,label:"Status"},{key:wa.OdigosVersion,label:"Odigos Version"},{key:wa.ConnectedSince,label:"Connected Since"},{key:wa.LastActivity,label:"Last Activity"}],Sa=(e,t)=>{const l=e.find(e=>e.key===wa.Id)?.rawValue;return t(l?.toString()||"")},$a=({tableRowsMaxHeight:l,connections:n,getConnections:i,onClickConnection:r,deleteConnection:s,configMinSupportedVersion:d=0,getEffectiveConfig:p,applyConfigurations:m,snapshotMinSupportedVersion:g=0,getAllClusterSnapshots:b,persistSources:f,getDestinationCategories:y,getPotentialDestinations:C,createDestination:v,createAction:w,createInstrumentationRule:k})=>{const S=h(),{formatTimeAgo:$}=Ee(),[x,I]=o(!1),[N,A]=o(n||[]),T=u(async()=>{try{I(!0),A(await i()??[])}catch(e){}finally{I(!1)}},[]);a(()=>{N.length||T()},[]);const[V,O]=o(""),[M,R]=o(null),[P,L]=o([]),E=c(()=>M===va.BulkConfig?d:M===va.BulkSource?g:0,[M,d,g]),{supportedConnections:z,supportedConnectionIds:j}=c(()=>{const e=((e,t)=>e.filter(e=>{const l=e.status===G.Success,a=Je(e.odigosVersion,t);return l&&a}))(N,E);return{supportedConnections:e,supportedConnectionIds:e.map(e=>e.id)}},[N.length,E]);a(()=>{if(!M||M===va.Delete)return;const e=P.filter(e=>!j.includes(e));e.length&&L(t=>t.filter(t=>!e.includes(t)))},[M,P.length,j.length]);const q=c(()=>N.filter(e=>!V||e.name.toLowerCase().includes(V.toLowerCase())).map(e=>({cells:[{key:wa.Id,rawValue:e.id},{key:wa.Name,rawValue:e.name},{key:wa.Type,rawValue:e.type},{key:wa.Status,rawValue:e.status,component:()=>(e=>{const l=e===G.Success?"Connection live":"Connection lost",a=e===G.Success?Nt:It;return t(pe,{status:e,label:l,leftIcon:a})})(e.status)},{key:wa.OdigosVersion,rawValue:e.odigosVersion},{key:wa.ConnectedSince,rawValue:e.connectedAt?$(e.connectedAt):"-"},{key:wa.LastActivity,rawValue:e.lastSeenAt?$(e.lastSeenAt):"-"}],onClick:e.status!==G.Success||M?void 0:()=>r(e),isSelected:P.includes(e.id),onSelect:()=>L(t=>Array.from(new Set([...t,e.id]))),onDeselect:()=>L(t=>t.filter(t=>t!==e.id)),hideCheckbox:e.status!==G.Success||M===va.BulkConfig&&!Je(e.odigosVersion,d)||M===va.BulkSource&&!Je(e.odigosVersion,g)})),[N,P,V,M,d,g]),H=c(()=>{const e=(e,t)=>{L([e]),R(t)};return(e=>{const{connections:t,configMinSupportedVersion:l,snapshotMinSupportedVersion:a,onDelete:n,onAddSource:o,onAddDestination:i,onAddAction:r,onAddInstrumentationRule:s,onEditConfiguration:c}=e;return({cells:e})=>{if(!(e=>e.find(e=>e.key===wa.Status)?.rawValue===G.Success)(e))return[{id:Ge(),label:"Delete Connection",rightIcon:Rt,onClick:()=>Sa(e,n)}];const d=Sa(e,e=>{const a=t.find(t=>t.id===e);return!!a&&Je(a.odigosVersion,l)}),u=Sa(e,e=>{const l=t.find(t=>t.id===e);return!!l&&Je(l.odigosVersion,a)}),p=[];return o&&p.push({id:Ge(),tooltip:u?Ce.ADD_SOURCE:`To use this feature, please upgrade to Odigos v${a} or later.`,rightIcon:$t,disabled:!u,onClick:()=>Sa(e,o)}),i&&p.push({id:Ge(),tooltip:Ce.ADD_DESTINATION,rightIcon:vt,onClick:()=>Sa(e,i)}),r&&p.push({id:Ge(),tooltip:Ce.ADD_ACTION,rightIcon:Ct,onClick:()=>Sa(e,r)}),s&&p.push({id:Ge(),tooltip:Ce.ADD_INSTRUMENTATION_RULE,rightIcon:St,onClick:()=>Sa(e,s)}),c&&p.push({id:Ge(),tooltip:d?"Edit Configuration":`To use this feature, please upgrade to Odigos v${l} or later.`,rightIcon:xt,disabled:!d,onClick:()=>Sa(e,c)}),p}})({connections:N,configMinSupportedVersion:d,snapshotMinSupportedVersion:g,onDelete:t=>e(t,va.Delete),onAddSource:b&&f?t=>e(t,va.BulkSource):void 0,onAddDestination:y&&C&&v?t=>e(t,va.BulkDestination):void 0,onAddAction:w?t=>e(t,va.BulkAction):void 0,onAddInstrumentationRule:k?t=>e(t,va.BulkInstrumentationRule):void 0,onEditConfiguration:p&&m?t=>e(t,va.BulkConfig):void 0})},[N,d,p,m,g,b,f,y,C,v,w,k]),K=c(()=>(e=>{const{onCancel:t,onAddSource:l,onAddDestination:a,onAddAction:n,onAddInstrumentationRule:o,onManageConfigurations:i}=e,r=[];l&&r.push({id:Ge(),type:Ue.Button,buttonProps:{variant:F.Primary,size:D.S,label:"Add Sources",rightIcon:$t,onClick:l}});const s=[a?{id:va.BulkDestination,label:Ce.ADD_DESTINATION,icon:vt}:null,n?{id:va.BulkAction,label:Ce.ADD_ACTION,icon:Ct}:null,o?{id:va.BulkInstrumentationRule,label:Ce.ADD_INSTRUMENTATION_RULE,icon:St}:null,i?{id:va.BulkConfig,label:"Manage Configurations",icon:xt}:null];return s.some(Boolean)&&r.push({id:Ge(),type:Ue.ButtonDropData,buttonProps:{variant:F.Secondary,size:D.S,label:"Bulk Actions",onClick:e=>{e===va.BulkSource?l?.():e===va.BulkDestination?a?.():e===va.BulkAction?n?.():e===va.BulkInstrumentationRule?o?.():e===va.BulkConfig&&i?.()}},dropDataProps:{alignX:_e.Left,items:s}}),r.push({id:Ge(),type:Ue.Button,buttonProps:{variant:F.Text,size:D.S,label:Ye.CANCEL,onClick:t}}),r})({onCancel:()=>L([]),onAddSource:b&&f?()=>R(va.BulkSource):void 0,onAddDestination:y&&C&&v?()=>R(va.BulkDestination):void 0,onAddAction:w?()=>R(va.BulkAction):void 0,onAddInstrumentationRule:k?()=>R(va.BulkInstrumentationRule):void 0,onManageConfigurations:p&&m?()=>R(va.BulkConfig):void 0}),[p,m,b,f,y,C,v,w,k]);return t(Xe,{children:e(je,{richTitle:{icon:Lt,title:Ce.CONNECTIONS,badge:{label:N.length.toString(),status:Te.Unknown}},search:{placeholder:"Search by cluster name",value:V,onChange:e=>O(e),width:"300px"},actions:[{id:Ge(),type:Ue.Button,buttonProps:{variant:F.Secondary,size:D.S,leftIcon:Pt,onClick:T,disabled:x}}],children:[t(Ze,{variant:Qe.Pretty,maxHeight:l,headerBackgroundColor:S.v2.colors.silver[1e3],isLoading:x,withCheckboxes:!0,columns:ka,rows:q,rowActionsPushRightPosition:M?`calc(${pl} - 24px)`:void 0,getRowActions:H}),M===va.BulkConfig&&p&&m&&t(da,{onClose:()=>R(null),connections:z,selectedConnectionIds:P,setSelectedConnectionIds:L,getEffectiveConfig:p,onApply:m}),M===va.BulkSource&&b&&f&&t(ca,{onClose:()=>R(null),selectedConnectionIds:P,setSelectedConnectionIds:L,getAllClusterSnapshots:b,persistSources:async e=>await(f?.(e))}),M===va.BulkDestination&&y&&C&&v&&t(Jl,{onClose:()=>R(null),selectedConnectionIds:P,setSelectedConnectionIds:L,getDestinationCategories:y,getPotentialDestinations:C,createDestination:e=>v(e,P)}),M===va.BulkAction&&w&&t(Pl,{onClose:()=>R(null),selectedConnectionIds:P,setSelectedConnectionIds:L,createAction:e=>w(e,P)}),M===va.BulkInstrumentationRule&&k&&t(Yl,{onClose:()=>R(null),selectedConnectionIds:P,setSelectedConnectionIds:L,createInstrumentationRule:e=>k(e,P)}),t(nl,{target:"connection",isOpen:M===va.Delete,onClose:()=>{L([]),R(null)},onApprove:async()=>{const e=P[0];e&&(await s(e),await T())}}),t(et,{isOpen:!!P.length&&!M,richTitle:{icon:pt,title:"Selected Clusters",badge:{label:P.length}},actions:K})]})})},xa=p.div`
127
+ `,va=({downloadDiagnose:l})=>{const a=h(),{namespaces:n}=qe(),[i,r]=o(null),{formData:s,handleFormChange:c,resetFormData:d}=Ce({includeProfiles:!0,includeMetrics:!0,includeSourceWorkloads:!1,sourceWorkloadNamespaces:[]});return t(je,{richTitle:{icon:Mt,title:"Diagnose"},children:i?t(Ca,{children:t(H,{title:"Creating file...",subTitle:"This may take a few moments. Do not refresh the page.",startedAt:i,withGradient:!0,withVisual:!0,visualIcon:Rt})}):e(g,{$gap:24,children:[t(J,{size:K.XXS,color:a.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(A,{$gap:8,children:[t(f,{label:"Profiles",value:s.includeProfiles,onChange:e=>c("includeProfiles",e),tooltip:"Note: Adds 30s to diagnose download time to collect Profiles"}),t(J,{size:K.XXXS,color:a.v2.colors.silver[200],children:"Include pprof profiles"})]}),e(A,{$gap:8,children:[t(f,{label:"Metrics",value:s.includeMetrics,onChange:e=>c("includeMetrics",e)}),t(J,{size:K.XXXS,color:a.v2.colors.silver[200],children:"Include Prometheus metrics"})]}),e(A,{$gap:8,children:[t(f,{label:"Source Workloads",value:s.includeSourceWorkloads,onChange:e=>{c("includeSourceWorkloads",e),e&&c("sourceWorkloadNamespaces",[])}}),t(J,{size:K.XXXS,color:a.v2.colors.silver[200],children:"Include workload and pod manifests for instrumented sources"})]})]}),t(He,{alignX:Be.Left,alignY:Ke.Bottom,items:n.map(e=>({id:e.name,label:e.name,withCheckbox:!0})),selectedIds:s.sourceWorkloadNamespaces,setSelectedIds:e=>c("sourceWorkloadNamespaces",e),withMultiSelect:!0,withSearch:!0,fullWidth:!0,buttonProps:{label:(s.sourceWorkloadNamespaces.length?"Selected":"Select")+" Namespaces",variant:F.Secondary,disabled:s.includeSourceWorkloads,leftIcon:s.sourceWorkloadNamespaces.length?()=>t(pe,{label:s.sourceWorkloadNamespaces.length,status:G.Default}):void 0}}),t(A,{$justifyContent:"flex-end",children:t(T,{label:"Download Diagnose",rightIcon:Rt,variant:F.Primary,onClick:async()=>{r(Date.now()),await l(s),r(null),d()},disabled:null!==i})})]})})},ya=({fetchDescribeOdigos:e})=>{const{platformType:l,version:n,tier:i}=We(),[r,s]=o(null);return a(()=>{e().then(({data:e})=>s(e?.describeOdigos||null))},[]),t(je,{richTitle:{icon:Pt,title:"General Information"},children:t(_e,{cellsPerRow:2,items:[{id:Ge(),title:"Odigos Version",label:n},{id:Ge(),title:`${l.toUpperCase()} Version`,label:r?.kubernetesVersion?.value||"-"},{id:Ge(),title:"Installation Method",label:r?.installationMethod?.value||"-"},{id:Ge(),title:"Tier",label:i}]})})},ka=({isOpen:l,onClose:a,token:n,updateToken:o,fetchDescribeOdigos:i,downloadDiagnose:r})=>e(q,{isOpen:l,header:{icon:Pt,title:"System Overview",onClose:a},children:[i&&t(ya,{fetchDescribeOdigos:i}),o&&n&&t(fa,{token:n,updateToken:o}),r&&t(va,{downloadDiagnose:r})]});var wa,Sa;!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"}(wa||(wa={})),function(e){e.Id="id",e.Name="name",e.Type="type",e.Status="status",e.OdigosVersion="odigosVersion",e.ConnectedSince="connectedSince",e.LastActivity="lastActivity"}(Sa||(Sa={}));const $a=[{key:Sa.Name,label:"Name"},{key:Sa.Type,label:"Type",textAlign:"right"},{key:Sa.Status,label:"Status"},{key:Sa.OdigosVersion,label:"Odigos Version"},{key:Sa.ConnectedSince,label:"Connected Since"},{key:Sa.LastActivity,label:"Last Activity"}],xa=(e,t)=>{const l=e.find(e=>e.key===Sa.Id)?.rawValue;return t(l?.toString()||"")},Ia=({tableRowsMaxHeight:l,connections:n,getConnections:i,onClickConnection:r,deleteConnection:s,configMinSupportedVersion:d=0,getEffectiveConfig:p,applyConfigurations:m,snapshotMinSupportedVersion:g=0,getAllClusterSnapshots:b,persistSources:f,getDestinationCategories:C,getPotentialDestinations:v,createDestination:y,createAction:k,createInstrumentationRule:w})=>{const S=h(),{formatTimeAgo:$}=Ee(),[x,I]=o(!1),[N,A]=o(n||[]),T=u(async()=>{try{I(!0),A(await i()??[])}catch(e){}finally{I(!1)}},[]);a(()=>{N.length||T()},[]);const[O,V]=o(""),[M,R]=o(null),[P,L]=o([]),E=c(()=>M===wa.BulkConfig?d:M===wa.BulkSource?g:0,[M,d,g]),{supportedConnections:z,supportedConnectionIds:j}=c(()=>{const e=((e,t)=>e.filter(e=>{const l=e.status===G.Success,a=Je(e.odigosVersion,t);return l&&a}))(N,E);return{supportedConnections:e,supportedConnectionIds:e.map(e=>e.id)}},[N.length,E]);a(()=>{if(!M||M===wa.Delete)return;const e=P.filter(e=>!j.includes(e));e.length&&L(t=>t.filter(t=>!e.includes(t)))},[M,P.length,j.length]);const q=c(()=>N.filter(e=>!O||e.name.toLowerCase().includes(O.toLowerCase())).map(e=>({cells:[{key:Sa.Id,rawValue:e.id},{key:Sa.Name,rawValue:e.name},{key:Sa.Type,rawValue:e.type},{key:Sa.Status,rawValue:e.status,component:()=>(e=>{const l=e===G.Success?"Connection live":"Connection lost",a=e===G.Success?Tt:At;return t(pe,{status:e,label:l,leftIcon:a})})(e.status)},{key:Sa.OdigosVersion,rawValue:e.odigosVersion},{key:Sa.ConnectedSince,rawValue:e.connectedAt?$(e.connectedAt):"-"},{key:Sa.LastActivity,rawValue:e.lastSeenAt?$(e.lastSeenAt):"-"}],onClick:e.status!==G.Success||M?void 0:()=>r(e),isSelected:P.includes(e.id),onSelect:()=>L(t=>Array.from(new Set([...t,e.id]))),onDeselect:()=>L(t=>t.filter(t=>t!==e.id)),hideCheckbox:e.status!==G.Success||M===wa.BulkConfig&&!Je(e.odigosVersion,d)||M===wa.BulkSource&&!Je(e.odigosVersion,g)})),[N,P,O,M,d,g]),H=c(()=>{const e=(e,t)=>{L([e]),R(t)};return(e=>{const{connections:t,configMinSupportedVersion:l,snapshotMinSupportedVersion:a,onDelete:n,onAddSource:o,onAddDestination:i,onAddAction:r,onAddInstrumentationRule:s,onEditConfiguration:c}=e;return({cells:e})=>{if(!(e=>e.find(e=>e.key===Sa.Status)?.rawValue===G.Success)(e))return[{id:Ge(),label:"Delete Connection",rightIcon:Lt,onClick:()=>xa(e,n)}];const d=xa(e,e=>{const a=t.find(t=>t.id===e);return!!a&&Je(a.odigosVersion,l)}),u=xa(e,e=>{const l=t.find(t=>t.id===e);return!!l&&Je(l.odigosVersion,a)}),p=[];return o&&p.push({id:Ge(),tooltip:u?ve.ADD_SOURCE:`To use this feature, please upgrade to Odigos v${a} or later.`,rightIcon:It,disabled:!u,onClick:()=>xa(e,o)}),i&&p.push({id:Ge(),tooltip:ve.ADD_DESTINATION,rightIcon:wt,onClick:()=>xa(e,i)}),r&&p.push({id:Ge(),tooltip:ve.ADD_ACTION,rightIcon:kt,onClick:()=>xa(e,r)}),s&&p.push({id:Ge(),tooltip:ve.ADD_INSTRUMENTATION_RULE,rightIcon:xt,onClick:()=>xa(e,s)}),c&&p.push({id:Ge(),tooltip:d?"Edit Configuration":`To use this feature, please upgrade to Odigos v${l} or later.`,rightIcon:Nt,disabled:!d,onClick:()=>xa(e,c)}),p}})({connections:N,configMinSupportedVersion:d,snapshotMinSupportedVersion:g,onDelete:t=>e(t,wa.Delete),onAddSource:b&&f?t=>e(t,wa.BulkSource):void 0,onAddDestination:C&&v&&y?t=>e(t,wa.BulkDestination):void 0,onAddAction:k?t=>e(t,wa.BulkAction):void 0,onAddInstrumentationRule:w?t=>e(t,wa.BulkInstrumentationRule):void 0,onEditConfiguration:p&&m?t=>e(t,wa.BulkConfig):void 0})},[N,d,p,m,g,b,f,C,v,y,k,w]),K=c(()=>(e=>{const{onCancel:t,onAddSource:l,onAddDestination:a,onAddAction:n,onAddInstrumentationRule:o,onManageConfigurations:i}=e,r=[];l&&r.push({id:Ge(),type:Ue.Button,buttonProps:{variant:F.Primary,size:D.S,label:"Add Sources",rightIcon:It,onClick:l}});const s=[a?{id:wa.BulkDestination,label:ve.ADD_DESTINATION,icon:wt}:null,n?{id:wa.BulkAction,label:ve.ADD_ACTION,icon:kt}:null,o?{id:wa.BulkInstrumentationRule,label:ve.ADD_INSTRUMENTATION_RULE,icon:xt}:null,i?{id:wa.BulkConfig,label:"Manage Configurations",icon:Nt}:null];return s.some(Boolean)&&r.push({id:Ge(),type:Ue.ButtonDropData,buttonProps:{variant:F.Secondary,size:D.S,label:"Bulk Actions",onClick:e=>{e===wa.BulkSource?l?.():e===wa.BulkDestination?a?.():e===wa.BulkAction?n?.():e===wa.BulkInstrumentationRule?o?.():e===wa.BulkConfig&&i?.()}},dropDataProps:{alignX:Be.Left,items:s}}),r.push({id:Ge(),type:Ue.Button,buttonProps:{variant:F.Text,size:D.S,label:Ye.CANCEL,onClick:t}}),r})({onCancel:()=>L([]),onAddSource:b&&f?()=>R(wa.BulkSource):void 0,onAddDestination:C&&v&&y?()=>R(wa.BulkDestination):void 0,onAddAction:k?()=>R(wa.BulkAction):void 0,onAddInstrumentationRule:w?()=>R(wa.BulkInstrumentationRule):void 0,onManageConfigurations:p&&m?()=>R(wa.BulkConfig):void 0}),[p,m,b,f,C,v,y,k,w]);return t(Xe,{children:e(je,{richTitle:{icon:zt,title:ve.CONNECTIONS,badge:{label:N.length.toString(),status:Te.Unknown}},search:{placeholder:"Search by cluster name",value:O,onChange:e=>V(e),width:"300px"},actions:[{id:Ge(),type:Ue.Button,buttonProps:{variant:F.Secondary,size:D.S,leftIcon:Et,onClick:T,disabled:x}}],children:[t(Ze,{variant:Qe.Pretty,maxHeight:l,headerBackgroundColor:S.v2.colors.silver[1e3],isLoading:x,withCheckboxes:!0,columns:$a,rows:q,rowActionsPushRightPosition:M?`calc(${ml} - 24px)`:void 0,getRowActions:H}),M===wa.BulkConfig&&p&&m&&t(pa,{onClose:()=>R(null),connections:z,selectedConnectionIds:P,setSelectedConnectionIds:L,getEffectiveConfig:p,onApply:m}),M===wa.BulkSource&&b&&f&&t(ua,{onClose:()=>R(null),selectedConnectionIds:P,setSelectedConnectionIds:L,getAllClusterSnapshots:b,persistSources:async e=>await(f?.(e))}),M===wa.BulkDestination&&C&&v&&y&&t(Yl,{onClose:()=>R(null),selectedConnectionIds:P,setSelectedConnectionIds:L,getDestinationCategories:C,getPotentialDestinations:v,createDestination:e=>y(e,P)}),M===wa.BulkAction&&k&&t(El,{onClose:()=>R(null),selectedConnectionIds:P,setSelectedConnectionIds:L,createAction:e=>k(e,P)}),M===wa.BulkInstrumentationRule&&w&&t(Zl,{onClose:()=>R(null),selectedConnectionIds:P,setSelectedConnectionIds:L,createInstrumentationRule:e=>w(e,P)}),t(il,{target:"connection",isOpen:M===wa.Delete,onClose:()=>{L([]),R(null)},onApprove:async()=>{const e=P[0];e&&(await s(e),await T())}}),t(et,{isOpen:!!P.length&&!M,richTitle:{icon:pt,title:"Selected Clusters",badge:{label:P.length}},actions:K})]})})},Na=p.div`
130
128
  display: flex;
131
129
  align-items: center;
132
130
  justify-content: space-between;
@@ -138,10 +136,10 @@ import{jsxs as e,jsx as t,Fragment as l}from"react/jsx-runtime";import{useEffect
138
136
  &:hover {
139
137
  background: ${({theme:e})=>e.v2.colors.silver[700]};
140
138
  }
141
- `,Ia=p.div`
139
+ `,Aa=p.div`
142
140
  animation-name: ${nt.in};
143
- `,Na=({pod:n,getExtendedPodInfo:i,onClose:r})=>{const{formatTimeAgo:s}=Ee(),[d,u]=o(null),[p,h]=o(!1);a(()=>{n?i(n.namespace,n.name).then(e=>u(e??null)):(u(null),h(!1))},[n]);const m=c(()=>[{id:Ge(),title:"Node",label:d?.node??"-",withCopy:!0},{id:Ge(),title:"Status",badge:{status:tt(d?.status),label:d?.status??"-"}}],[d]),b=c(()=>d?.containers?.map(e=>({id:Ge(),items:[{id:Ge(),title:"Container",label:e.name??"-"},{id:Ge(),title:"Status",label:e.startedAt?`${e.status} (since ${s(e.startedAt)})`:e.status},{id:Ge(),title:"Ready",badge:{status:e.ready?G.Success:G.Error,leftIcon:e.ready?pt:gt,label:e.ready?"True":"False",invertColors:!0}},{id:Ge(),title:"Started",badge:{status:e.started?G.Success:G.Error,leftIcon:e.started?pt:gt,label:e.started?"True":"False",invertColors:!0}},{id:Ge(),title:"Image Version",label:e.image?.split(":")?.[1]??"-"},{id:Ge(),title:"Image Repository",label:e.image?.split(":")?.[0]??"-"},{id:Ge(),title:"Restarts",label:e.restarts.toString()},{id:Ge(),title:"State Reason",label:e.stateReason??"-"},{id:Ge(),title:"Resource Requests",label:`CPU ${e.resources.requests.cpu} • Memory ${e.resources.requests.memory}`},{id:Ge(),title:"Resource Limits",label:`CPU ${e.resources.limits.cpu} • Memory ${e.resources.limits.memory}`}]}))||[],[d]);return e(q,{isOpen:!!n,header:{icon:Et,title:"Pod Information",onClose:r},children:[d?null:t(z,{children:t(lt,{})}),d?e(l,{children:[t(je,{richTitle:{icon:Et,title:d.name,withCopy:!0},children:e(g,{$gap:24,children:[t(We,{cellsPerRow:2,items:m}),b.length>0&&e(g,{$gap:12,children:[e(xa,{onClick:()=>h(e=>!e),children:[t(J,{children:"Containers Overview"}),t(we,{icon:p?wt:kt})]}),p&&b.map(({id:e,items:l})=>t(Ia,{children:t(We,{cellsPerRow:2,items:l})},e))]})]})}),t(je,{richTitle:{icon:Mt,title:"Kubectl Commands"},children:e(g,{$gap:12,children:[t(at,{value:`kubectl get pod ${d.name} -n ${d.namespace} -o yaml`}),t(at,{value:`kubectl describe pod ${d.name} -n ${d.namespace}`}),t(at,{value:`kubectl logs ${d.name} -n ${d.namespace}`})]})}),t(_t,{yaml:d.manifestYAML,defaultOpen:!0})]}):null]})};var Aa;!function(e){e.PodName="podName",e.Status="status",e.Restarts="restarts",e.NodeName="nodeName",e.SpanDropDrate="spanDropDrate",e.Age="age",e.DockerImage="dockerImage"}(Aa||(Aa={}));const Ta=[{key:Aa.PodName,label:"Pod Name"},{key:Aa.Status,label:"Status"},{key:Aa.Restarts,label:"Restarts",textAlign:"right"},{key:Aa.NodeName,label:"Node Name"},{key:Aa.Age,label:"Age",textAlign:"right"},{key:Aa.DockerImage,label:"Docker Image",textAlign:"right"}],Da=({isLoading:l,tableRowsMaxHeight:a,pods:n,getExtendedPodInfo:i})=>{const r=h(),{formatTimeAgo:s}=Ee(),[d,u]=o(null),p=c(()=>n.map(l=>({onClick:()=>u(l),cells:[{key:Aa.PodName,rawValue:l.name},{key:Aa.Status,rawValue:l.status,component:()=>{return e=l.status,t(pe,{status:tt(e),label:e});var e}},{key:Aa.Restarts,rawValue:l.restartsCount.toString()},{key:Aa.NodeName,rawValue:l.nodeName},{key:Aa.SpanDropDrate,rawValue:0,component:()=>{const{collectorMetrics:a}=l;if(!a)return t(J,{children:"-"});const n=(a?.metricsAcceptedRps??0)+(a?.metricsDroppedRps??0),o=n>0?Math.round((a?.metricsDroppedRps??0)/n*100):0,i=o>0?G.Error:G.Success,r=(a?.exporterSuccessRps??0)+(a?.exporterFailedRps??0),s=r>0?Math.round((a?.exporterFailedRps??0)/r*100):0,c=s>0?G.Error:G.Success;return e(A,{$gap:4,children:[t(oe,{text:`Accepted: ${a.metricsAcceptedRps.toLocaleString()}, Dropped: ${a.metricsDroppedRps.toLocaleString()}`,children:t(pe,{status:i,label:`Receiver ${o}%`,leftIcon:i===G.Error?zt:jt,useSecondaryTone:!0,invertColors:!0})}),t(oe,{text:`Success: ${a.exporterSuccessRps.toLocaleString()}, Failed: ${a.exporterFailedRps.toLocaleString()}`,children:t(pe,{status:c,label:`Exporter ${s}%`,leftIcon:c===G.Error?zt:jt,useSecondaryTone:!0,invertColors:!0})})]})}},{key:Aa.Age,rawValue:s(l.creationTimestamp)},{key:Aa.DockerImage,rawValue:l.image}]})),[n,r]);return e(je,{richTitle:{icon:Et,title:"Pods"},children:[t(Ze,{variant:Qe.Data,maxHeight:a,isLoading:l,columns:Ta,rows:p}),t(Na,{pod:d,getExtendedPodInfo:i,onClose:()=>u(null)})]})};var Fa;!function(e){e.Gateway="gateway",e.Node="node"}(Fa||(Fa={}));const Va=[{value:Fa.Gateway,label:"Gateway"},{value:Fa.Node,label:"Node Collector"}],Oa=p.div`
141
+ `,Ta=({pod:n,getExtendedPodInfo:i,onClose:r})=>{const{formatTimeAgo:s}=Ee(),[d,u]=o(null),[p,h]=o(!1);a(()=>{n?i(n.namespace,n.name).then(e=>u(e??null)):(u(null),h(!1))},[n]);const m=c(()=>[{id:Ge(),title:"Node",label:d?.node??"-",withCopy:!0},{id:Ge(),title:"Status",badge:{status:tt(d?.status),label:d?.status??"-"}}],[d]),b=c(()=>d?.containers?.map(e=>({id:Ge(),items:[{id:Ge(),title:"Container",label:e.name??"-"},{id:Ge(),title:"Status",label:e.startedAt?`${e.status} (since ${s(e.startedAt)})`:e.status},{id:Ge(),title:"Ready",badge:{status:e.ready?G.Success:G.Error,leftIcon:e.ready?pt:ft,label:e.ready?"True":"False",invertColors:!0}},{id:Ge(),title:"Started",badge:{status:e.started?G.Success:G.Error,leftIcon:e.started?pt:ft,label:e.started?"True":"False",invertColors:!0}},{id:Ge(),title:"Image Version",label:e.image?.split(":")?.[1]??"-"},{id:Ge(),title:"Image Repository",label:e.image?.split(":")?.[0]??"-"},{id:Ge(),title:"Restarts",label:e.restarts.toString()},{id:Ge(),title:"State Reason",label:e.stateReason??"-"},{id:Ge(),title:"Resource Requests",label:`CPU ${e.resources.requests.cpu} • Memory ${e.resources.requests.memory}`},{id:Ge(),title:"Resource Limits",label:`CPU ${e.resources.limits.cpu} • Memory ${e.resources.limits.memory}`}]}))||[],[d]);return e(q,{isOpen:!!n,header:{icon:jt,title:"Pod Information",onClose:r},children:[d?null:t(z,{children:t(lt,{})}),d?e(l,{children:[t(je,{richTitle:{icon:jt,title:d.name,withCopy:!0},children:e(g,{$gap:24,children:[t(_e,{cellsPerRow:2,items:m}),b.length>0&&e(g,{$gap:12,children:[e(Na,{onClick:()=>h(e=>!e),children:[t(J,{children:"Containers Overview"}),t(ke,{icon:p?St:$t})]}),p&&b.map(({id:e,items:l})=>t(Aa,{children:t(_e,{cellsPerRow:2,items:l})},e))]})]})}),t(je,{richTitle:{icon:Pt,title:"Kubectl Commands"},children:e(g,{$gap:12,children:[t(at,{value:`kubectl get pod ${d.name} -n ${d.namespace} -o yaml`}),t(at,{value:`kubectl describe pod ${d.name} -n ${d.namespace}`}),t(at,{value:`kubectl logs ${d.name} -n ${d.namespace}`})]})}),t(_t,{yaml:d.manifestYAML,defaultOpen:!0})]}):null]})};var Da;!function(e){e.PodName="podName",e.Status="status",e.Restarts="restarts",e.NodeName="nodeName",e.SpanDropDrate="spanDropDrate",e.Age="age",e.DockerImage="dockerImage"}(Da||(Da={}));const Fa=[{key:Da.PodName,label:"Pod Name"},{key:Da.Status,label:"Status"},{key:Da.Restarts,label:"Restarts",textAlign:"right"},{key:Da.NodeName,label:"Node Name"},{key:Da.Age,label:"Age",textAlign:"right"},{key:Da.DockerImage,label:"Docker Image",textAlign:"right"}],Oa=({isLoading:l,tableRowsMaxHeight:a,pods:n,getExtendedPodInfo:i})=>{const r=h(),{formatTimeAgo:s}=Ee(),[d,u]=o(null),p=c(()=>n.map(l=>({onClick:()=>u(l),cells:[{key:Da.PodName,rawValue:l.name},{key:Da.Status,rawValue:l.status,component:()=>{return e=l.status,t(pe,{status:tt(e),label:e});var e}},{key:Da.Restarts,rawValue:l.restartsCount.toString()},{key:Da.NodeName,rawValue:l.nodeName},{key:Da.SpanDropDrate,rawValue:0,component:()=>{const{collectorMetrics:a}=l;if(!a)return t(J,{children:"-"});const n=(a?.metricsAcceptedRps??0)+(a?.metricsDroppedRps??0),o=n>0?Math.round((a?.metricsDroppedRps??0)/n*100):0,i=o>0?G.Error:G.Success,r=(a?.exporterSuccessRps??0)+(a?.exporterFailedRps??0),s=r>0?Math.round((a?.exporterFailedRps??0)/r*100):0,c=s>0?G.Error:G.Success;return e(A,{$gap:4,children:[t(oe,{text:`Accepted: ${a.metricsAcceptedRps.toLocaleString()}, Dropped: ${a.metricsDroppedRps.toLocaleString()}`,children:t(pe,{status:i,label:`Receiver ${o}%`,leftIcon:i===G.Error?qt:Ht,useSecondaryTone:!0,invertColors:!0})}),t(oe,{text:`Success: ${a.exporterSuccessRps.toLocaleString()}, Failed: ${a.exporterFailedRps.toLocaleString()}`,children:t(pe,{status:c,label:`Exporter ${s}%`,leftIcon:c===G.Error?qt:Ht,useSecondaryTone:!0,invertColors:!0})})]})}},{key:Da.Age,rawValue:s(l.creationTimestamp)},{key:Da.DockerImage,rawValue:l.image}]})),[n,r]);return e(je,{richTitle:{icon:jt,title:"Pods"},children:[t(Ze,{variant:Qe.Data,maxHeight:a,isLoading:l,columns:Fa,rows:p}),t(Ta,{pod:d,getExtendedPodInfo:i,onClose:()=>u(null)})]})};var Va;!function(e){e.Gateway="gateway",e.Node="node"}(Va||(Va={}));const Ma=[{value:Va.Gateway,label:"Gateway"},{value:Va.Node,label:"Node Collector"}],Ra=p.div`
144
142
  display: flex;
145
143
  align-items: center;
146
144
  justify-content: space-between;
147
- `,Ma=({selectedTab:l,setSelectedTab:a,onClickDownloadDiagnose:n,onClickRefresh:o,loading:i,disabled:r})=>{const s=c(()=>{const e=[];return n&&e.push({id:Ge(),type:Ue.Button,buttonProps:{label:"Download Diagnose",leftIcon:Ot,size:D.S,variant:F.Text,onClick:n,disabled:r}}),o&&e.push({id:Ge(),type:Ue.Button,buttonProps:{label:"Refresh",leftIcon:Pt,size:D.S,variant:F.Text,onClick:o,disabled:r,loading:i}}),e},[n,o,r,i]);return e(Oa,{children:[e(A,{$gap:12,children:[e(A,{$gap:8,children:[t(qt,{size:32}),t(J,{size:K.M,weight:500,children:"Pipeline Collectors"})]}),t(Y,{options:Va,selected:l,setSelected:a,disabled:r})]}),t(ot,{actions:s})]})},Ra=({isOpen:e,onClose:l,title:a,yaml:n})=>t(q,{isOpen:e,header:{icon:Ht,title:a,onClose:l},children:t(_t,{yaml:n,defaultOpen:!0})});var Pa;!function(e){e.ManifestYaml="manifest-yaml",e.ConfigMapYaml="configmap-yaml"}(Pa||(Pa={}));const La=({richTitle:l,statusCard:a,textCards:n,manifestYaml:i,configMapYaml:r})=>{const[s,c]=o(null);return e(je,{richTitle:l,actions:[{id:Ge(),type:Ue.ButtonDropData,buttonProps:{variant:F.Secondary,size:D.S,label:"View YAML",onClick:e=>c(e)},dropDataProps:{items:[{id:Pa.ManifestYaml,label:l.title,icon:Kt},{id:Pa.ConfigMapYaml,label:"ConfigMap",icon:Kt}]}}],children:[e(A,{$gap:16,children:[t(it,{...a}),n.map(e=>t(rt,{...e},e.title))]}),t(Ra,{isOpen:s===Pa.ManifestYaml,onClose:()=>c(null),title:l.title,yaml:i}),t(Ra,{isOpen:s===Pa.ConfigMapYaml,onClose:()=>c(null),title:"ConfigMap",yaml:r})]})},Ea=e=>{switch(e){case st.Healthy:return"All desired replicas are updated, available, and ready";case st.Updating:return"Workload is progressing towards desired state (e.g., updating pods)";case st.Degraded:return"Progressing but with availability issues (e.g., not enough available replicas)";case st.Failed:return"Progress deadline exceeded or an unrecoverable error occurred";case st.Down:return"No available replicas";case st.Unknown:return"Status cannot be determined from current signals";default:return"Status unknown"}},za=({minSupportedVersion:l=0,tableRowsMaxHeight:n,getGatewayInfo:i,getGatewayPods:r,getNodeCollectorInfo:s,getNodeCollectorPods:d,getExtendedPodInfo:p})=>{const{formatTimeAgo:h}=Ee(),{isVersionSupported:m,version:g}=Be(l),[b,f]=o(!1),[y,C]=o(Fa.Gateway),[v,w]=o(null),[k,S]=o([]),[$,x]=o(null),[I,N]=o([]),A=u(async()=>{f(!0);try{switch(y){case Fa.Gateway:w(await i()??null),S(await r()??[]);break;case Fa.Node:x(await s()??null),N(await d()??[])}}catch(e){}f(!1)},[y]);a(()=>{A()},[A]);const T=c(()=>(e=>{switch(e){case Fa.Gateway:return"Deployment";case Fa.Node:return"DaemonSet";default:return"Pipeline Collectors"}})(y),[y]),D=c(()=>((e,t,l,a)=>{const n={status:Te.Disabled,label:"No rollouts yet"};let o=!1,i=null;switch(e){case Fa.Gateway:o=t?.rolloutInProgress??!1,i=t?.lastRolloutAt??null;break;case Fa.Node:o=l?.rolloutInProgress??!1,i=l?.lastRolloutAt??null;break;default:return n}return o?{status:G.Info,label:"Rollout in progress",rightIcon:Pt,useSecondaryTone:!0}:i?{status:Te.Disabled,label:`Last Rollout: ${a(i)}`}:n})(y,v,$,h),[v,$,y,h]),F=c(()=>((e,t,l,a)=>{let n=a?G.Info:Te.Unknown,o=a?"Loading":st.Unknown,i=a?"Fetching data...":Ea(st.Unknown);switch(e){case Fa.Gateway:n=t?.status?tt(t?.status):n,o=t?.status??o,i=t?.status?Ea(t.status):i;break;case Fa.Node:n=l?.status?tt(l?.status):n,o=l?.status??o,i=l?.status?Ea(l.status):i}return{status:n,title:o,description:i}})(y,v,$,b),[v,$,y,b]),V=c(()=>((e,t,l,a)=>{switch(e){case Fa.Gateway:return[{title:"HPA Spec (Replicas)",cells:[{label:"Min.",value:t?.hpa?.min.toString()??"-",isLoading:a},{label:"Max.",value:t?.hpa?.max.toString()??"-",isLoading:a},{label:"Current",value:t?.hpa?.current.toString()??"-",isLoading:a},{label:"Desired",value:t?.hpa?.desired.toString()??"-",isLoading:a}]},{title:"Requests",cells:[{label:"CPU",value:t?.resources?.requests.cpu??"-",isLoading:a},{label:"Memory",value:t?.resources?.requests.memory??"-",isLoading:a}]},{title:"Limits",cells:[{label:"CPU",value:t?.resources?.limits.cpu??"-",isLoading:a},{label:"Memory",value:t?.resources?.limits.memory??"-",isLoading:a}]},{title:"Docker Image",cells:[{value:t?.imageVersion??"-",isLoading:a}]}];case Fa.Node:return[{title:"Nodes",cells:[{label:"Desired",value:l?.nodes?.desired.toString()??"-",isLoading:a},{label:"Ready",value:l?.nodes?.ready.toString()??"-",isLoading:a}]},{title:"Requests",cells:[{label:"CPU",value:l?.resources?.requests.cpu??"-",isLoading:a},{label:"Memory",value:l?.resources?.requests.memory??"-",isLoading:a}]},{title:"Limits",cells:[{label:"CPU",value:l?.resources?.limits.cpu??"-",isLoading:a},{label:"Memory",value:l?.resources?.limits.memory??"-",isLoading:a}]},{title:"Docker Image",cells:[{value:l?.imageVersion??"-",isLoading:a}]}];default:return[]}})(y,v,$,b),[v,$,y,b]),O=c(()=>(y===Fa.Gateway?v?.manifestYAML:$?.manifestYAML)??"",[v,$,y]),M=c(()=>(y===Fa.Gateway?v?.configMapYAML:$?.configMapYAML)??"",[v,$,y]),R=c(()=>y===Fa.Gateway?k:I,[k,I,y]);return e(Xe,{children:[t(Ma,{disabled:!m,loading:b,selectedTab:y,setSelectedTab:C,onClickDownloadDiagnose:void 0,onClickRefresh:A}),e(ct,{children:[t(La,{richTitle:{icon:Ht,title:T,badge:D},statusCard:F,textCards:V,manifestYaml:O,configMapYaml:M}),t(Da,{isLoading:b,tableRowsMaxHeight:n,pods:R,getExtendedPodInfo:p}),!m&&t(rl,{minSupportedVersion:l,currentVersion:g||""})]})]})};export{Pl as AddActionDrawer,vl as AddActionForm,Jl as AddDestinationDrawer,kl as AddDestinationForm,Yl as AddRuleDrawer,Dl as AddRuleForm,ca as AddSourceDrawer,$a as CentralConnections,da as EditConfigDrawer,za as PipelineCollectors,Ca as SystemDrawer};
145
+ `,Pa=({selectedTab:l,setSelectedTab:a,onClickDownloadDiagnose:n,onClickRefresh:o,loading:i,disabled:r})=>{const s=c(()=>{const e=[];return n&&e.push({id:Ge(),type:Ue.Button,buttonProps:{label:"Download Diagnose",leftIcon:Rt,size:D.S,variant:F.Text,onClick:n,disabled:r}}),o&&e.push({id:Ge(),type:Ue.Button,buttonProps:{label:"Refresh",leftIcon:Et,size:D.S,variant:F.Text,onClick:o,disabled:r,loading:i}}),e},[n,o,r,i]);return e(Ra,{children:[e(A,{$gap:12,children:[e(A,{$gap:8,children:[t(Kt,{size:32}),t(J,{size:K.M,weight:500,children:"Pipeline Collectors"})]}),t(Y,{options:Ma,selected:l,setSelected:a,disabled:r})]}),t(ot,{actions:s})]})},La=({isOpen:e,onClose:l,title:a,yaml:n})=>t(q,{isOpen:e,header:{icon:Bt,title:a,onClose:l},children:t(_t,{yaml:n,defaultOpen:!0})});var Ea;!function(e){e.ManifestYaml="manifest-yaml",e.ConfigMapYaml="configmap-yaml"}(Ea||(Ea={}));const za=({richTitle:l,statusCard:a,textCards:n,manifestYaml:i,configMapYaml:r})=>{const[s,c]=o(null);return e(je,{richTitle:l,actions:[{id:Ge(),type:Ue.ButtonDropData,buttonProps:{variant:F.Secondary,size:D.S,label:"View YAML",onClick:e=>c(e)},dropDataProps:{items:[{id:Ea.ManifestYaml,label:l.title,icon:Wt},{id:Ea.ConfigMapYaml,label:"ConfigMap",icon:Wt}]}}],children:[e(A,{$gap:16,children:[t(it,{...a}),n.map(e=>t(rt,{...e},e.title))]}),t(La,{isOpen:s===Ea.ManifestYaml,onClose:()=>c(null),title:l.title,yaml:i}),t(La,{isOpen:s===Ea.ConfigMapYaml,onClose:()=>c(null),title:"ConfigMap",yaml:r})]})},ja=e=>{switch(e){case st.Healthy:return"All desired replicas are updated, available, and ready";case st.Updating:return"Workload is progressing towards desired state (e.g., updating pods)";case st.Degraded:return"Progressing but with availability issues (e.g., not enough available replicas)";case st.Failed:return"Progress deadline exceeded or an unrecoverable error occurred";case st.Down:return"No available replicas";case st.Unknown:return"Status cannot be determined from current signals";default:return"Status unknown"}},qa=({minSupportedVersion:l=0,tableRowsMaxHeight:n,getGatewayInfo:i,getGatewayPods:r,getNodeCollectorInfo:s,getNodeCollectorPods:d,getExtendedPodInfo:p})=>{const{formatTimeAgo:h}=Ee(),{isVersionSupported:m,version:g}=We(l),[b,f]=o(!1),[C,v]=o(Va.Gateway),[y,k]=o(null),[w,S]=o([]),[$,x]=o(null),[I,N]=o([]),A=u(async()=>{f(!0);try{switch(C){case Va.Gateway:k(await i()??null),S(await r()??[]);break;case Va.Node:x(await s()??null),N(await d()??[])}}catch(e){}f(!1)},[C]);a(()=>{A()},[A]);const T=c(()=>(e=>{switch(e){case Va.Gateway:return"Deployment";case Va.Node:return"DaemonSet";default:return"Pipeline Collectors"}})(C),[C]),D=c(()=>((e,t,l,a)=>{const n={status:Te.Disabled,label:"No rollouts yet"};let o=!1,i=null;switch(e){case Va.Gateway:o=t?.rolloutInProgress??!1,i=t?.lastRolloutAt??null;break;case Va.Node:o=l?.rolloutInProgress??!1,i=l?.lastRolloutAt??null;break;default:return n}return o?{status:G.Info,label:"Rollout in progress",rightIcon:Et,useSecondaryTone:!0}:i?{status:Te.Disabled,label:`Last Rollout: ${a(i)}`}:n})(C,y,$,h),[y,$,C,h]),F=c(()=>((e,t,l,a)=>{let n=a?G.Info:Te.Unknown,o=a?"Loading":st.Unknown,i=a?"Fetching data...":ja(st.Unknown);switch(e){case Va.Gateway:n=t?.status?tt(t?.status):n,o=t?.status??o,i=t?.status?ja(t.status):i;break;case Va.Node:n=l?.status?tt(l?.status):n,o=l?.status??o,i=l?.status?ja(l.status):i}return{status:n,title:o,description:i}})(C,y,$,b),[y,$,C,b]),O=c(()=>((e,t,l,a)=>{switch(e){case Va.Gateway:return[{title:"HPA Spec (Replicas)",cells:[{label:"Min.",value:t?.hpa?.min.toString()??"-",isLoading:a},{label:"Max.",value:t?.hpa?.max.toString()??"-",isLoading:a},{label:"Current",value:t?.hpa?.current.toString()??"-",isLoading:a},{label:"Desired",value:t?.hpa?.desired.toString()??"-",isLoading:a}]},{title:"Requests",cells:[{label:"CPU",value:t?.resources?.requests.cpu??"-",isLoading:a},{label:"Memory",value:t?.resources?.requests.memory??"-",isLoading:a}]},{title:"Limits",cells:[{label:"CPU",value:t?.resources?.limits.cpu??"-",isLoading:a},{label:"Memory",value:t?.resources?.limits.memory??"-",isLoading:a}]},{title:"Docker Image",cells:[{value:t?.imageVersion??"-",isLoading:a}]}];case Va.Node:return[{title:"Nodes",cells:[{label:"Desired",value:l?.nodes?.desired.toString()??"-",isLoading:a},{label:"Ready",value:l?.nodes?.ready.toString()??"-",isLoading:a}]},{title:"Requests",cells:[{label:"CPU",value:l?.resources?.requests.cpu??"-",isLoading:a},{label:"Memory",value:l?.resources?.requests.memory??"-",isLoading:a}]},{title:"Limits",cells:[{label:"CPU",value:l?.resources?.limits.cpu??"-",isLoading:a},{label:"Memory",value:l?.resources?.limits.memory??"-",isLoading:a}]},{title:"Docker Image",cells:[{value:l?.imageVersion??"-",isLoading:a}]}];default:return[]}})(C,y,$,b),[y,$,C,b]),V=c(()=>(C===Va.Gateway?y?.manifestYAML:$?.manifestYAML)??"",[y,$,C]),M=c(()=>(C===Va.Gateway?y?.configMapYAML:$?.configMapYAML)??"",[y,$,C]),R=c(()=>C===Va.Gateway?w:I,[w,I,C]);return e(Xe,{children:[t(Pa,{disabled:!m,loading:b,selectedTab:C,setSelectedTab:v,onClickDownloadDiagnose:void 0,onClickRefresh:A}),e(ct,{children:[t(za,{richTitle:{icon:Bt,title:T,badge:D},statusCard:F,textCards:O,manifestYaml:V,configMapYaml:M}),t(Oa,{isLoading:b,tableRowsMaxHeight:n,pods:R,getExtendedPodInfo:p}),!m&&t(cl,{minSupportedVersion:l,currentVersion:g||""})]})]})};export{El as AddActionDrawer,wl as AddActionForm,Yl as AddDestinationDrawer,$l as AddDestinationForm,Zl as AddRuleDrawer,Ol as AddRuleForm,ua as AddSourceDrawer,Ia as CentralConnections,pa as EditConfigDrawer,qa as PipelineCollectors,ka as SystemDrawer};