@odigos/ui-kit 0.0.200 → 0.0.201

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.
@@ -1,17 +1,17 @@
1
- import{jsxs as e,jsx as t,Fragment as l}from"react/jsx-runtime";import{useEffect as a,useState as n,useRef as o,forwardRef as i,useImperativeHandle as r,useMemo as s,Children as c,useCallback as d}from"react";import u,{useTheme as h}from"styled-components";import{A as p,F as m,a as g,C as b,b as f,I as C,c as y,i as v,d as w,K as k,T as S,e as $,f as x,g as I,h as T,W as A,j as N,M as D,k as O,V,S as F,l as M,N as R,D as P,L,m as E,R as z,n as j,o as q,p as H,B as _,q as B,r as K,s as W,t as G,u as J,v as U,w as Y,x as X,y as Z,z as Q,E as ee,G as te,H as le,J as ae,O as ne,P as oe,Q as ie,U as re,X as se,Y as ce,Z as de,_ as ue,$ as he,a0 as pe,a1 as me,a2 as ge,a3 as be,a4 as fe,a5 as Ce,a6 as ye,a7 as ve,a8 as we,a9 as ke,aa as Se,ab as $e,ac as xe,ad as Ie,ae as Te,af as Ae,ag as Ne,ah as De,ai as Oe,aj as Ve,ak as Fe,al as Me,am as Re,an as Pe,ao as Le,ap as Ee,aq as ze,ar as je,as as qe,at as He,au as _e,av as Be,aw as Ke,ax as We,ay as Ge,az as Je,aA as Ue,aB as Ye,aC as Xe,aD as Ze,aE as Qe,aF as et,aG as tt,aH as lt,aI as at,aJ as nt,aK as ot,aL as it,aM as rt}from"../chunks/ui-components-Bw_jKy4u.js";import{VSquareIcon as st,OdigosLogo as ct,BookIcon as dt,XSquareIcon as ut,GoLogo as ht,JavaLogo as pt,ChevronRightIcon as mt,ActionIcon as gt,DestinationIcon as bt,ChevronUpIcon as ft,ChevronDownIcon as Ct,InstrumentationRuleIcon as yt,SourceIcon as vt,SettingsIcon as wt,XIcon as kt,VIcon as St,EditIcon as $t,ExclamationTriangleIcon as xt,ExclamationCircleIcon as It,KeyIcon as Tt,DiagnoseIcon as At,DownloadIcon as Nt,TerminalIcon as Dt,DeleteIcon as Ot,RefreshIcon as Vt,ConnectionsIcon as Ft,PodIcon as Mt,ArrowDownSquareIcon as Rt,ArrowUpSquareIcon as Pt,PipelineCollectorIcon as Lt,GatewayIcon as Et,YamlIcon as zt}from"../icons.js";import{Y as jt}from"../chunks/index-COFnKh_j.js";import"zustand";import"javascript-time-ago";import"../chunks/vendor-DUWBN0Mg.js";import"@xyflow/react";import"react-dom";import"prism-react-renderer";import"react-error-boundary";import"lottie-react";import"virtua";const qt=[{id:"CREDIT_CARD",label:"Credit card"}],Ht=[{id:p.CollectContainerAttributes,label:"Collect container attributes"},{id:p.CollectReplicaSetAttributes,label:"Collect ReplicaSet attributes"},{id:p.CollectWorkloadId,label:"Collect workload ID"},{id:p.CollectClusterId,label:"Collect cluster ID"}],_t=[{id:k.Pod,label:k.Pod},{id:k.Namespace,label:k.Namespace},{id:k.Node,label:k.Node}],Bt=[{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:_t}],Kt=[{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:_t}],Wt=[{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}],Gt=[{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}],Jt=[{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:I.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:I.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}],Ut={[T.K8sAttributes]:({value:n,setValue:o,formErrors:i})=>(a(()=>{n[p.CollectContainerAttributes]||n[p.CollectReplicaSetAttributes]||n[p.CollectWorkloadId]||n[p.CollectClusterId]||n[p.LabelsAttributes]?.length||n[p.AnnotationsAttributes]?.length||(o(p.CollectContainerAttributes,!0),o(p.CollectReplicaSetAttributes,!0),o(p.CollectWorkloadId,!0),o(p.CollectClusterId,!0),o(p.LabelsAttributes,[]),o(p.AnnotationsAttributes,[]))},[]),e(l,{children:[t(m,{$gap:6,children:Ht.map(({id:l,label:a})=>e(m,{children:[t(b,{label:a,value:n[l]||!1,onChange:e=>o(l,e)}),t(f,{errorMessage:i[l]})]},l))}),t(w,{label:"Label attributes",limitFieldsPerRow:2,columns:Bt,values:n[p.LabelsAttributes]||[],setValues:e=>o(p.LabelsAttributes,e),errorMessage:i[p.LabelsAttributes]}),t(w,{label:"Annotation attributes",limitFieldsPerRow:2,columns:Kt,values:n[p.AnnotationsAttributes]||[],setValues:e=>o(p.AnnotationsAttributes,e),errorMessage:i[p.AnnotationsAttributes]})]})),[T.AddClusterInfo]:({value:a,setValue:n,formErrors:o})=>{const i=h();return e(l,{children:[t(S,{label:"Overwrite existing values",labelAlign:$.Left,labelColor:i.v2.colors.silver[200],tooltip:"If enabled, the resource attributes will overwrite any existing attributes with the same name.",value:a[p.OverwriteExistingValues]||!1,onChange:e=>n(p.OverwriteExistingValues,e)}),t(w,{label:"Resource attributes",limitFieldsPerRow:2,columns:[{keyName:"attributeName",label:"Attribute name"},{keyName:"attributeStringValue",label:"Attribute value"}],values:a[p.ClusterAttributes]||[],setValues:e=>n(p.ClusterAttributes,e),errorMessage:o[p.ClusterAttributes]})]})},[T.DeleteAttributes]:({value:e,setValue:l,formErrors:a})=>t(x,{label:"Attributes to delete",values:e[p.AttributeNamesToDelete]||[],setValues:e=>l(p.AttributeNamesToDelete,e),errorMessage:a[p.AttributeNamesToDelete]}),[T.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[p.Renames]||{}).map(([e,t])=>({oldKey:e,newKey:t})),setValues:e=>{const t={};e.forEach(e=>t[e.oldKey]=e.newKey),l(p.Renames,t)},errorMessage:a[p.Renames]}),[T.PiiMasking]:({value:l,setValue:n,formErrors:o})=>(a(()=>{l[p.PiiCategories]?.length||n(p.PiiCategories,qt.map(({id:e})=>e))},[]),e(m,{$gap:12,children:[t(g,{label:"Attributes to mask"}),t(m,{$gap:6,children:qt.map(({id:e,label:a})=>t(b,{label:a,value:l[p.PiiCategories]?.includes(e)||!1,onChange:t=>{const a=l[p.PiiCategories]||[],o=t?[...a,e]:a.filter(t=>t!==e);n(p.PiiCategories,o)}},e))}),t(f,{errorMessage:o[p.PiiCategories]})]})),[T.ErrorSampler]:({value:e,setValue:l,formErrors:a})=>{const n=a[p.FallbackSamplingRatio],o=v(e[p.FallbackSamplingRatio])?"":String(e[p.FallbackSamplingRatio]);return t(C,{label:"Fallback sampling ratio",type:y.Number,min:0,max:100,value:o,placeholder:"0-100",onChange:e=>{return t=e.target.value,l(p.FallbackSamplingRatio,Math.max(0,Math.min(Number(t),100))||0);var t},errorMessage:n})},[T.ProbabilisticSampler]:({value:e,setValue:l,formErrors:a})=>{const n=a[p.SamplingPercentage],o=v(e[p.SamplingPercentage])?"":String(e[p.SamplingPercentage]);return t(C,{label:"Sampling percentage",type:y.Number,min:0,max:100,value:o,placeholder:"0-100",onChange:e=>{return t=e.target.value,l(p.SamplingPercentage,Math.max(0,Math.min(Number(t),100))||0);var t},errorMessage:n})},[T.LatencySampler]:({value:e,setValue:l,formErrors:a})=>{const n=a[p.EndpointsFilters],o=e[p.EndpointsFilters]||[];return t(w,{limitFieldsPerRow:2,columns:Wt,values:o,setValues:e=>{l(p.EndpointsFilters,e.map(({serviceName:e,httpRoute:t,minimumLatencyThreshold:l,fallbackSamplingRatio:a})=>({serviceName:e,httpRoute:t,minimumLatencyThreshold:Number(l),fallbackSamplingRatio:Number(a)})))},errorMessage:n})},[T.ServiceNameSampler]:({value:e,setValue:l,formErrors:a})=>{const n=a[p.ServicesNameFilters],o=e[p.ServicesNameFilters]||[];return t(w,{limitFieldsPerRow:2,columns:Gt,values:o,setValues:e=>{l(p.ServicesNameFilters,e.map(({serviceName:e,samplingRatio:t,fallbackSamplingRatio:l})=>({serviceName:e,samplingRatio:Number(t),fallbackSamplingRatio:Number(l)})))},errorMessage:n})},[T.SpanAttributeSampler]:({value:e,setValue:l,formErrors:a})=>{const n=a[p.AttributeFilters],o=(e[p.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:Jt,values:o,setValues:e=>{l(p.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})}},Yt=({actionType:e,value:l,setValue:a,formErrors:n})=>{if(!e)return null;const o=Ut[e];return o?t(o,{value:l,setValue:a,formErrors:n}):null},Xt=({isOpen:e,onClose:l,onDeny:a,onApprove:n})=>t(A,{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"}),Zt=({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(A,{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})},Qt=(e,t)=>!t?.length||!!t?.find(t=>t===e),el=({title:l="Signals",required:i,errorMessage:r,allowedSignals:s,selectedSignals:c,setSelectedSignals:d})=>{const[u,h]=n(1===c.length),p=o(JSON.stringify(c));return a(()=>{const e=N(c);e.length||D.forEach(({id:t})=>{Qt(t,s)&&e.push(t)});const t=JSON.stringify(e);p.current!==t&&(p.current=t,d(e),h(1===e.length))},[s,c]),e(m,{$gap:12,children:[t(g,{label:l,required:i}),t(O,{$gap:12,children:D.map(e=>{const l=Qt(e.id,s),a=((e,t)=>!!t?.find(t=>t===e))(e.id,c);return l?t(b,{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),h(1===a.length)})(e.id,t)},e.id):null})}),t(f,{errorMessage:r})]})},tl=({minSupportedVersion:e,currentVersion:l})=>t(A,{isOpen:!0,onClose:()=>{},relativeToParent:!0,visual:()=>t(V,{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}.`}),ll=u.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 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-BxG2GlHM.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-Bi_rpSHV.js";import"zustand";import"javascript-time-ago";import"../chunks/vendor-DUWBN0Mg.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`
2
2
  display: flex;
3
3
  flex-direction: column;
4
4
  justify-content: flex-end;
5
5
  width: ${({$width:e})=>e};
6
6
  gap: ${({$withHeader:e})=>e?"0":"12px"};
7
- `,al=u.div`
7
+ `,cl=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
- `,nl=u.div`
14
+ `,dl=p.div`
15
15
  display: flex;
16
16
  flex-direction: column;
17
17
  gap: ${({$gap:e})=>e}px;
@@ -25,37 +25,37 @@ import{jsxs as e,jsx as t,Fragment as l}from"react/jsx-runtime";import{useEffect
25
25
  background-color: ${({theme:e})=>e.v2.colors.silver[900]};
26
26
  overflow-y: auto;
27
27
  overflow-x: hidden;
28
- `,ol=({isLeft:a,isRight:n,parentHasSubHeader:o,width:i,header:r,list:s})=>e(ll,{$width:i,$withHeader:!!r,children:[r&&t(al,{children:r}),t(nl,{$gap:8,$isLeft:a,$isRight:n,$withHeader:!!r,$withSubHeader:!!o,children:s.length?s.length>1?t(F,{gap:8,elements:s}):t(l,{children:s[0]}):t(M,{$height:"100%",children:t(R,{})})})]}),il="75vw",rl=u.div`
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`
29
29
  display: flex;
30
30
  flex-direction: column;
31
31
  border-radius: 16px;
32
32
  background-color: ${({theme:e})=>e.v2.colors.silver[1e3]};
33
33
  overflow: hidden;
34
- `,sl=u.div`
34
+ `,ml=p.div`
35
35
  display: flex;
36
36
  gap: 12px;
37
37
  padding: 16px;
38
38
  background-color: ${({theme:e})=>e.v2.colors.silver[1e3]};
39
39
  position: sticky;
40
40
  top: 0;
41
- `,cl=u.div`
41
+ `,gl=p.div`
42
42
  padding: 0 12px;
43
- `,dl=u.div`
43
+ `,bl=p.div`
44
44
  display: flex;
45
45
  gap: 12px;
46
46
  padding: 16px;
47
- `,ul=u.div`
47
+ `,fl=p.div`
48
48
  padding: 5vh 10vw;
49
49
  border-radius: 12px;
50
50
  background-color: ${({theme:e})=>e.v2.colors.silver[800]};
51
- `,hl=u.div`
51
+ `,yl=p.div`
52
52
  display: flex;
53
53
  align-items: center;
54
54
  justify-content: flex-end;
55
55
  gap: 16px;
56
56
  padding: 0 12px;
57
57
  margin-top: auto;
58
- `,pl=i(({isOpen:l,onClose:a,onSave:o,disableSave:i,connectionIds:s,header:c,subHeader:d,leftColumn:u,rightColumn:h,search:p,filters:m,isFormDirty:g,hideDirtyNote:b,isFetching:f,progress:C},y)=>{const[v,w]=n(!1),[k,S]=n(!1),[$,x]=n(void 0);r(y,()=>({clearErrors:()=>x(void 0)}));const I=k,T=()=>{g&&!v?w(!0):(w(!1),a())},A=i||k||"boolean"==typeof g&&!g;return e(P,{width:il,isOpen:l,hideOverlay:!k,header:{...c,onClose:T,onCloseDisabled:I},children:[k?t(M,{$height:"calc(100vh - 136px)",children:t(ul,{children:t(L,{titleSize:E.S,subTitleSize:E.XXXS,withGradient:!0,withSpinner:!0,...C})})}):e(rl,{children:[e(sl,{children:[s&&t(z,{icon:st,title:"Selected Clusters",badge:{label:s.value.length}}),t(j,{width:"100%",...p}),m]}),d&&t(cl,{children:t(z,{icon:d.icon,title:d.title,subTitle:d.description,badge:d.badge})}),e(dl,{children:[t(ol,{isLeft:!0,parentHasSubHeader:!!d,...u}),t(ol,{isRight:!0,parentHasSubHeader:!!d,...h})]})]}),e(hl,{children:[f?t(L,{icon:ct,title:"Fetching Data...",titleSize:E.XXS,withGradient:!0}):k?C?null:t(L,{icon:ct,title:"Saving Changes...",titleSize:E.XXS,withGradient:!0}):$?t(q,{fullWidth:!0,status:H.Error,message:$}):"boolean"==typeof g&&g&&!b?t(q,{fullWidth:!0,status:H.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(q,{fullWidth:!0,status:H.Success,message:"The values reflect the current configuration of the selected cluster."}),e(O,{$gap:8,children:[t("div",{style:{width:"150px"},children:t(_,{fullWidth:!0,variant:B.Secondary,label:"Cancel",onClick:T,disabled:I})}),t("div",{style:{width:"150px"},children:t(_,{fullWidth:!0,variant:B.Primary,label:"Save",onClick:async()=>{S(!0);const e=await o();S(!1),e?.error?x(e.error):(s?.setValue([]),a())},disabled:A})})]})]}),t(Xt,{isOpen:v,onClose:()=>w(!1),onApprove:T})]})});pl.displayName=pl.name;const ml=({option:l,formData:a,handleFormChange:n,formErrors:o})=>{const i=h();return e(m,{$gap:24,children:[e(O,{$gap:12,$justifyContent:"space-between",children:[t(K,{size:E.XXS,children:l.docsDescription}),t(_,{label:"Docs",leftIcon:dt,variant:B.Text,size:W.S,onClick:()=>window.open(`${G}${l.docsEndpoint}`,"_blank","noopener noreferrer")})]}),t(J,{options:[{icon:st,label:"Enabled",value:!1,selectedBgColor:i.v2.colors.green[800]},{icon:ut,label:"Disabled",value:!0,selectedBgColor:i.v2.colors.red[800]}],selected:a.disabled,setSelected:e=>n("disabled",e)}),t(el,{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(Yt,{actionType:l.type,value:a.fields,setValue:(e,t)=>n(`fields.${e}`,t),formErrors:o}),t(U,{label:"Notes",placeholder:"Your personal notes...",value:a.notes||"",onChange:({target:{value:e}})=>n("notes",e),errorMessage:o.notes})]})},gl=({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:h,value:p,required:g,options:y})=>{if(a&&!Y(a,l,n.fields))return null;const v=c,k=n.fields.find(e=>e.key===v),S=k?k.value:p;switch(r){case I.Input:return t(C,{name:v,type:s,label:d,tooltip:u,required:g,placeholder:h,value:S,onChange:e=>o(v,e.target.value),errorMessage:i[v]},v);case I.MultiInput:return t(x,{label:d,tooltip:u,required:g,placeholder:h,values:Z(S,[]),setValues:e=>o(v,JSON.stringify(e)),errorMessage:i[v]},v);case I.KeyValuePair:return t(w,{label:d,tooltip:u,required:g,limitFieldsPerRow:2,columns:[{keyName:"key",label:"Key"},{keyName:"value",label:"Value"}],values:Z(S,[]),setValues:e=>o(v,JSON.stringify(e)),errorMessage:i[v]},v);case I.TextArea:return t(U,{name:v,label:d,tooltip:u,required:g,placeholder:h,value:S,onChange:e=>o(v,e.target.value),errorMessage:i[v]},v);case I.Checkbox:return e(m,{children:[t(b,{label:d,value:"true"==S,onChange:e=>o(v,e.toString())}),t(f,{errorMessage:i[v]})]},v);case I.Dropdown:return t(X,{name:v,label:d,withSearch:!0,values:S?[S]:[],options:y?.map(e=>({id:e.id||"",label:e.value||""}))||[],setValues:e=>o(v,e[0]),errorMessage:i[v]},v);default:return null}}),bl=({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=Q(l.supportedSignals),a={logs:t.includes(ee.Logs),metrics:t.includes(ee.Metrics),traces:t.includes(ee.Traces)};i("exportedSignals",a)},[n]),e(m,{$gap:24,children:[e(O,{$gap:12,$justifyContent:"space-between",children:[t("div",{}),t(_,{label:"Docs",leftIcon:dt,variant:B.Text,size:W.S,onClick:()=>window.open(`${G}/backends/${l.type}`,"_blank","noopener noreferrer")})]}),t(J,{options:[{icon:st,label:"Enabled",value:!1,selectedBgColor:s.v2.colors.green[800]},{icon:ut,label:"Disabled",value:!0,selectedBgColor:s.v2.colors.red[800]}],selected:o.disabled,setSelected:e=>i("disabled",e)}),t(el,{title:"This connection will monitor:",allowedSignals:Q(l.supportedSignals),selectedSignals:te(o.exportedSignals),setSelectedSignals:e=>i("exportedSignals",{logs:e.includes(ee.Logs),metrics:e.includes(ee.Metrics),traces:e.includes(ee.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(gl,{signals:te(o.exportedSignals),fields:n,formData:o,handleFormChange:(e,t)=>{i("fields",o.fields.map(l=>l.key===e?{...l,value:t}:l))},formErrors:r})]})},fl=[{id:le.FilePath,label:"Collect file path",tooltip:"Indicates whether to record the `code.filepath` attribute."},{id:le.Function,label:"Collect function",tooltip:"Indicates whether to record the `code.function` attribute."},{id:le.LineNumber,label:"Collect line number",tooltip:"Indicates whether to record the `code.lineno` attribute."}],Cl=[{id:le.Column,label:"Collect column",tooltip:"Indicates whether to record the `code.column` attribute."},{id:le.Namespace,label:"Collect namespace",tooltip:"Indicates whether to record the `code.namespace` attribute."},{id:le.StackTrace,label:"Collect stacktrace",tooltip:"Indicates whether to record the `code.stacktrace` attribute."}],yl=["*"],vl=[{id:oe.HttpRequest,label:"Collect HTTP request",tooltip:""},{id:oe.HttpResponse,label:"Collect HTTP response",tooltip:""},{id:oe.DbQuery,label:"Collect DB query",tooltip:""},{id:oe.Messaging,label:"Collect messaging",tooltip:""}],wl={[se.Java]:[new re("","")],[se.Golang]:[new ie("")]},kl={[ce.CodeAttributes]:({value:n,setValue:o,formErrors:i})=>{const r=h(),c=i.codeAttributes,d=s(()=>Object.entries(n.codeAttributes||{}).filter(([e,t])=>!!t).map(([e])=>e),[n]);a(()=>{if(!d.length&&!c){const e={[le.FilePath]:!0,[le.Function]:!0,[le.LineNumber]:!0,[le.Column]:null,[le.Namespace]:null,[le.StackTrace]:null};o("codeAttributes",e)}},[]);const u=(e,t)=>{const l=t?[...d,e]:d.filter(t=>t!==e),a=Object.values(le).reduce((e,t)=>(e[t]=!!l.includes(t)||null,e),{});o("codeAttributes",a)};return e(l,{children:[e(m,{$gap:12,children:[t(K,{size:E.XS,color:r.v2.colors.silver[200],nowrap:!0,children:"Recommended data to collect"}),t(m,{$gap:6,children:fl.map(({id:e,label:l,tooltip:a})=>t(ae,{text:a,withIcon:!0,children:t(b,{label:l,value:d.includes(e),onChange:t=>u(e,t)})},e))}),t(f,{errorMessage:c})]}),e(m,{$gap:12,children:[t(K,{size:E.XS,color:r.v2.colors.silver[200],nowrap:!0,children:"Verbose data to collect"}),t(m,{$gap:6,children:Cl.map(({id:e,label:l,tooltip:a})=>t(ae,{text:a,withIcon:!0,children:t(b,{label:l,value:d.includes(e),onChange:t=>u(e,t)})},e))}),t(f,{errorMessage:c})]})]})},[ce.CustomInstrumentation]:({value:n,setValue:o,formErrors:i})=>{const r=i.customInstrumentations,c=s(()=>(n?.customInstrumentations?.[se.Golang]||[]).map(e=>new ie(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)),[n]),d=s(()=>(n?.customInstrumentations?.[se.Java]||[]).map(e=>new re(e.className,e.methodName)),[n]);return a(()=>{n?.customInstrumentations||r||o("customInstrumentations",{[se.Golang]:wl[se.Golang],[se.Java]:wl[se.Java]})},[]),e(l,{children:[e(m,{children:[e(O,{$gap:8,children:[t(ht,{}),t(g,{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:c,setValues:e=>{const t={};t[se.Golang]=e.map(e=>new ie(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)),t[se.Java]=d,o("customInstrumentations",t)},errorMessage:r,limitFieldsPerRow:2})]}),e(m,{children:[e(O,{$gap:8,children:[t(pt,{}),t(g,{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[se.Golang]=c,t[se.Java]=e.map(e=>new re(e.className,e.methodName)),o("customInstrumentations",t)},errorMessage:r,limitFieldsPerRow:2})]})]})},[ce.HeadersCollection]:({value:e,setValue:l,formErrors:n})=>{const o=n.headersCollection,i=s(()=>e?.headersCollection?.[ne.HeaderKeys]||[],[e]),r=e=>{const t={[ne.HeaderKeys]:e};l("headersCollection",t)};return a(()=>{i.length||o||r(yl)},[]),t(x,{label:"Header keys",tooltip:"Specify which headers you want to collect",helpMessage:"Asterisk (*) will collect all headers",values:i,setValues:r,errorMessage:o})},[ce.PayloadCollection]:({value:l,setValue:n,formErrors:o})=>{const i=h(),r=o.payloadCollection,c=s(()=>Object.entries(l.payloadCollection||{}).filter(([e,t])=>!!t).map(([e])=>e),[l]);return a(()=>{if(!c.length&&!r){const e={[oe.HttpRequest]:{},[oe.HttpResponse]:{},[oe.DbQuery]:{},[oe.Messaging]:{}};n("payloadCollection",e)}},[]),e(m,{$gap:12,children:[t(K,{size:E.XS,color:i.v2.colors.silver[200],nowrap:!0,children:"Type of data to collect"}),t(m,{$gap:6,children:vl.map(({id:e,label:l,tooltip:a})=>t(ae,{text:a,withIcon:!0,children:t(b,{label:l,value:c.includes(e),onChange:t=>((e,t)=>{const l=t?[...c,e]:c.filter(t=>t!==e),a={[oe.HttpRequest]:l.includes(oe.HttpRequest)?{}:null,[oe.HttpResponse]:l.includes(oe.HttpResponse)?{}:null,[oe.DbQuery]:l.includes(oe.DbQuery)?{}:null,[oe.Messaging]:l.includes(oe.Messaging)?{}:null};n("payloadCollection",a)})(e,t)})},e))}),t(f,{errorMessage:r})]})},[ce.UnknownType]:null},Sl=({ruleType:e,value:l,setValue:a,formErrors:n})=>{if(!e)return null;const o=kl[e];return o?t(o,{value:l,setValue:a,formErrors:n}):null},$l=({option:l,formData:a,handleFormChange:n,formErrors:o})=>{const i=h();return e(m,{$gap:24,children:[e(O,{$gap:12,$justifyContent:"space-between",children:[t(K,{size:E.XXS,children:l.docsDescription}),t(_,{label:"Docs",leftIcon:dt,variant:B.Text,size:W.S,onClick:()=>window.open(`${G}${l.docsEndpoint}`,"_blank","noopener noreferrer")})]}),e(O,{$gap:12,children:[t(K,{size:E.XS,color:i.v2.colors.silver[200],nowrap:!0,children:"Supported Languages:"}),l.supportedLanguages.map(e=>t(de,{label:ue[e],leftIcon:he(e),status:H.Default,useSecondaryTone:!0},e))]}),t(J,{options:[{icon:st,label:"Enabled",value:!1,selectedBgColor:i.v2.colors.green[800]},{icon:ut,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(Sl,{ruleType:l.type,value:a,setValue:(e,t)=>n(e,t),formErrors:o}),t(U,{label:"Notes",placeholder:"Your personal notes...",value:a.notes,onChange:({target:{value:e}})=>n("notes",e),errorMessage:o.notes})]})},xl={type:"",disabled:!1,name:"",notes:"",signals:[],fields:{}},Il=u.div`
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`
59
59
  display: flex;
60
60
  align-items: center;
61
61
  justify-content: space-between;
@@ -67,31 +67,31 @@ import{jsxs as e,jsx as t,Fragment as l}from"react/jsx-runtime";import{useEffect
67
67
  &:hover {
68
68
  background-color: ${({theme:e})=>e.v2.colors.silver[800]};
69
69
  }
70
- `,Tl=u.div`
70
+ `,Ol=p.div`
71
71
  display: flex;
72
72
  align-items: center;
73
73
  justify-content: center;
74
74
  padding: 8px;
75
75
  border-radius: 8px;
76
- background-color: ${({theme:e})=>e.v2.colors.white[500]+pe["004"]};
77
- `,Al=({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(Il,{$isSelected:r,onClick:()=>!r&&s(),children:[e(m,{$gap:4,children:[e(O,{$gap:12,children:[u&&t(b,{partiallyChecked:d||!1,value:c||!1,onChange:e=>u(e)}),l&&t(Tl,{children:t(l,{size:20})}),t(K,{size:E.XS,children:a})]}),n&&t(K,{size:E.XXXS,color:p.v2.colors.silver[200],children:n})]}),i,o&&t("div",{children:t(mt,{size:18})})]})},Nl=u.div`
76
+ 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`
78
78
  display: flex;
79
79
  align-items: center;
80
80
  gap: 8px;
81
81
  padding: 8px;
82
- `,Dl=({onClose:l,selectedConnectionIds:a,setSelectedConnectionIds:i,createAction:r})=>{const c=h(),[d,u]=n(""),[p,m]=n(null),g=s(()=>(d?me.filter(e=>e?.label?.toLowerCase().includes(d.toLowerCase())):me).filter(e=>!!e),[d]),b=s(()=>(d?ge.filter(e=>e?.label?.toLowerCase().includes(d.toLowerCase())):ge).filter(e=>!!e),[d]),f=be(xl),C=o(null),y=s(()=>{const l=(l,a)=>e(Nl,{children:[t(K,{size:E.XS,color:c.v2.colors.silver[200],children:l}),t(de,{label:a.toString()})]},l),a=e=>{const l=p?.type===e.type;return t(Al,{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)]},[c,p?.type,g.length,b.length,f]),v=s(()=>p?[t(ml,{option:p,...f},p?.type)]:[t(M,{$height:"100%",children:t(R,{icon:gt,title:"Action not selected",subTitle:"Please select an action to add"})},"no-data")],[p,f]);return t(pl,{ref:C,isOpen:!0,onClose:l,onSave:async()=>{const{isOk:e,preparedFormData:t}=((e,t)=>{if(!e)return{isOk:!1,preparedFormData:N(xl)};const l=(a=t.formData,N(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:fe.CREATING_ACTION,subTitle:fe.CREATING_ACTION_SUBTITLE},header:{icon:gt,title:fe.ADD_ACTION,subTitle:fe.ADD_ACTION_DESCRIPTION},connectionIds:{value:a,setValue:i},search:{value:d,onChange:u},leftColumn:{width:"40%",list:y},rightColumn:{width:"60%",list:v}})},Ol=({selectedArea:e,genericForm:l})=>({width:"60%",list:e?[t(bl,{option:e.option,dynamicFields:e.dynamicFields,...l},e?.option.type)]:[t(M,{$height:"100%",children:t(R,{icon:bt,title:"Select destination from the list",subTitle:"Add destination so your data has somewhere to go."})},"no-data")]});var Vl;!function(e){e.SELF_HOSTED="self hosted",e.MANAGED="managed"}(Vl||(Vl={}));const Fl=e=>({type:"",disabled:!1,name:"",currentStreamName:e,exportedSignals:{logs:!1,metrics:!1,traces:!1},fields:[]}),Ml=u.div`
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`
83
83
  display: flex;
84
84
  flex-direction: column;
85
85
  padding: 8px;
86
86
  border-radius: 16px;
87
87
  background-color: ${({$noBgColor:e,theme:t})=>e?"transparent":t.v2.colors.silver[800]};
88
- `,Rl=u.div`
88
+ `,ql=p.div`
89
89
  display: flex;
90
90
  align-items: center;
91
91
  justify-content: space-between;
92
92
  gap: 12px;
93
93
  padding: ${({$isOpen:e})=>e?"2px 12px 8px 12px":"2px 12px"};
94
- `,Pl=({title:l,tooltip:a,list:o,noBgColor:i})=>{const[r,s]=n(!0);return e(Ml,{$noBgColor:i,children:[e(Rl,{$isOpen:r,children:[e(O,{$gap:10,children:[t(K,{size:E.XS,children:l}),a&&t(ae,{text:a,withIcon:!0}),t(de,{label:o.length})]}),t(ye,{icon:r?ft:Ct,size:ve.M,onClick:()=>s(e=>!e)})]}),r?t(m,{children:o.length?c.toArray(o):t(M,{$padding:"12px 0",children:t(R,{})})}):null]})},Ll=(e,t,l)=>t||l.signalType?e.filter(e=>e.displayName.toLowerCase().includes(t.toLowerCase())&&(!l.signalType||Q(e.supportedSignals).includes(l.signalType))):e,El=({listType:e,dest:l,isSelected:a,onSelect:n})=>t(Al,{icon:Se(l.type).icon,title:l.displayName,withCarret:!0,isSelected:a,onClick:()=>{n()}},`${e}-${l.type}`),zl=({listType:e,destinations:l,selectedArea:a,onSelect:n})=>t(Pl,{title:ke[e].TITLE,tooltip:ke[e].DESCRIPTION,list:l.map(l=>t(El,{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===I.Dropdown,s=Z(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=s(()=>{const e=[];for(const r of Object.values(we)){if(n.categoryType&&n.categoryType!==r)continue;const s=Ll(l[r],a,n);s.length&&e.push(t(zl,{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(M,{$height:"100%",children:t(L,{title:"Fetching destinations",subTitle:"Please wait while we fetch the destinations",withSpinner:!0})},"loading")]:[]}},ql=({destinationsByCategory:a,filters:n,setFilters:o})=>{const i=s(()=>Object.values(we).map(e=>({id:e,label:e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()})).filter(e=>a[e.id]?.length),[a]),r=s(()=>{const e=Object.values(ee).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(X,{placeholder:"Select category",options:i,values:n.categoryType?[n.categoryType]:[],setValues:e=>o({...n,categoryType:n.categoryType===e[0]?null:e[0]})}),t(J,{size:$e.S,options:r,selected:n.signalType,setSelected:e=>o({...n,signalType:e})})]})},Hl=({onClose:e,selectedConnectionIds:l,setSelectedConnectionIds:i,getDestinationCategories:r,getPotentialDestinations:s,createDestination:c})=>{const[u,h]=n(""),[p,m]=n({categoryType:null,signalType:null}),[g,b]=n(null),[f,C]=n(!0),[y,w]=n({[we.ALL]:[],[we.EXISTS]:[],[we.DETECTED]:[],[we.SELF_HOSTED]:[],[we.MANAGED]:[]}),k=d(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===Vl.SELF_HOSTED?a.push(...e.items):e.name===Vl.MANAGED&&n.push(...e.items)}),t&&t?.potentialDestinations.forEach(t=>{for(const a of e?.destinationCategories?.categories||[]){const e=N(a),n=e.items.findIndex(e=>e.type===t.type);if(-1!==n){const a=Z(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);w(e=>({...e,[we.DETECTED]:l,[we.SELF_HOSTED]:a,[we.MANAGED]:n}))}catch(e){}finally{C(!1)}},[]);a(()=>{k()},[]);const{selectedStreamName:S}=xe(),$=be(Fl(S)),x=o(null);return t(pl,{ref:x,isOpen:!0,onClose:e,onSave:async()=>{const{isOk:e,preparedFormData:t}=((e,t)=>{if(!e)return{isOk:!1,preparedFormData:N(Fl(t.formData.currentStreamName))};const l=N(t.formData),a={};return e.dynamicFields.forEach(({name:e,required:t})=>{if(t){const t=l.fields.find(t=>t.key===e)?.value;v(t)&&(a[e]=Ce.FIELD_IS_REQUIRED)}}),te(l.exportedSignals).length||(a.exportedSignals=Ce.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:fe.CREATING_DESTINATION,subTitle:fe.CREATING_DESTINATION_SUBTITLE},header:{icon:bt,title:fe.ADD_DESTINATIONS,subTitle:fe.ADD_DESTINATION_DRAWER_DESCRIPTION},connectionIds:{value:l,setValue:i},search:{value:u,onChange:h},filters:t(ql,{destinationsByCategory:y,filters:p,setFilters:m}),leftColumn:jl({isFetching:f,destinationsByCategory:y,searchText:u,filters:p,selectedArea:g,onSelect:e=>{$.resetFormData(),x.current?.clearErrors(),b(e)}}),rightColumn:Ol({selectedArea:g,genericForm:$})})},_l={disabled:!1,ruleName:"",notes:"",workloads:null,instrumentationLibraries:null,payloadCollection:null,codeAttributes:null,headersCollection:null,customInstrumentations:null},Bl=({onClose:e,selectedConnectionIds:l,setSelectedConnectionIds:a,createInstrumentationRule:i})=>{const[r,c]=n(""),[d,u]=n(null),h=s(()=>r?Ie.filter(e=>e.label.toLowerCase().includes(r.toLowerCase())):Ie,[r]),p=be(_l),m=o(null),g=s(()=>h.map(e=>{const l=d?.type===e.type;return t(Al,{title:e.label,description:e.description,withCarret:!0,isSelected:l,onClick:()=>{p.resetFormData(),m.current?.clearErrors(),u(e)}},e.type)}),[d,h.length,p]),b=s(()=>d?[t($l,{option:d,...p},d?.type)]:[t(M,{$height:"100%",children:t(R,{icon:yt,title:"Instrumentation rule not selected",subTitle:"Please select an instrumentation rule to add"})},"no-data")],[d,p]);return t(pl,{ref:m,isOpen:!0,onClose:e,onSave:async()=>{const{isOk:e,preparedFormData:t}=((e,t)=>{if(!e)return{isOk:!1,preparedFormData:N(_l)};const l=(e=>{const t=N(e);return t.headersCollection?.[ne.HeaderKeys]?.length&&(t.headersCollection[ne.HeaderKeys]=t.headersCollection[ne.HeaderKeys].map(e=>e.trim()).filter(e=>e)),t.customInstrumentations?.[se.Golang]?.length&&(t.customInstrumentations[se.Golang]=t.customInstrumentations[se.Golang].map(e=>new ie(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)).filter(e=>e.Verify())),t.customInstrumentations?.[se.Java]?.length&&(t.customInstrumentations[se.Java]=t.customInstrumentations[se.Java].map(e=>new re(e.className,e.methodName)).filter(e=>e.Verify())),t})(t.formData),a={};switch(e.type){case ce.CodeAttributes:Object.values(l.codeAttributes||{}).some(e=>null!=e)||(a.codeAttributes="Code attributes are required");break;case ce.PayloadCollection:Object.values(l.payloadCollection||{}).some(e=>null!=e)||(a.payloadCollection="Payload collection are required");break;case ce.HeadersCollection:l.headersCollection?.[ne.HeaderKeys]?.length||(a.headersCollection="Header keys are required");break;case ce.CustomInstrumentation:l.customInstrumentations?.[se.Golang]?.length||l.customInstrumentations?.[se.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,p);return e?await i(t):Promise.resolve({error:"Invalid form values"})},disableSave:!d||!p.isFormDirty,isFormDirty:p.isFormDirty,hideDirtyNote:!0,progress:{title:fe.CREATING_INSTRUMENTATION_RULE,subTitle:fe.CREATING_INSTRUMENTATION_RULE_SUBTITLE},header:{icon:yt,title:fe.ADD_INSTRUMENTATION_RULE,subTitle:fe.ADD_INSTRUMENTATION_RULE_DESCRIPTION},connectionIds:{value:l,setValue:a},search:{value:r,onChange:c},leftColumn:{width:"40%",list:g},rightColumn:{width:"60%",list:b}})},Kl=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}},Wl=(e,t,l)=>{if(t&&!e.name.toLowerCase().includes(t.toLowerCase()))return!1;if(l.showOnlySelected){const{isAllSourced:t,isSomeSourced:l,isFutureApps:a}=Kl(e);return t||l||a}return!0},Gl=(e,t,l)=>!(t&&!e.name.toLowerCase().includes(t.toLowerCase()))&&(!l.showOnlySelected||e.selected),Jl=u.div``,Ul=u.div`
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`
95
95
  visibility: hidden;
96
96
 
97
97
  transition: visibility 0s;
@@ -99,19 +99,19 @@ import{jsxs as e,jsx as t,Fragment as l}from"react/jsx-runtime";import{useEffect
99
99
  transition-duration: 0s;
100
100
  }
101
101
 
102
- ${Jl}:hover & {
102
+ ${ea}:hover & {
103
103
  visibility: visible;
104
104
  }
105
- `,Yl=({workloadName:e,workloadKind:l,isChecked:a,onToggle:n})=>{const o=h();return t(Jl,{children:t(Al,{title:e,onClick:n,isChecked:a,onCheckboxChange:n,children:t(Ul,{children:t(de,{label:l,status:H.Info,textSize:E.XXXS,backgroundColor:o.v2.colors.blue[900]})})})})},Xl=({formData:l,handleSourceChange:a,handleSelectAll:n,selectedArea:o,searchText:i,filters:r})=>{const c=s(()=>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=s(()=>c?[...c.workloads].sort((e,t)=>e.name.localeCompare(t.name)).filter(e=>Gl(e,i,r)):[],[c,i,r]),u=s(()=>!!d.length&&d.every(({selected:e})=>e),[d]),h=s(()=>{if(!c)return[];const{clusterId:e}=o.value,{name:l}=c;return d.map(({name:n,selected:o,kind:i})=>t(Yl,{workloadName:n,workloadKind:i,isChecked:o||!1,onToggle:()=>a({clusterId:e,workloadId:{namespace:l,name:n,kind:i}})},`${e}#${l}#${n}#${i}`))},[d,c,o.value.clusterId]),{withFilterCount:p,filteredCount:m,totalCount:g}=s(()=>{const e=c?.workloads.length??0;return{withFilterCount:d.length!==e,filteredCount:d.length,totalCount:e}},[d,c]);return{width:"40%",header:e(O,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(O,{$gap:8,children:[t(K,{size:E.XS,nowrap:!0,children:o.value.namespaceName?`${o.value.namespaceName} > Workloads`:"Workloads"}),t(ae,{text:p?fe.FILTERED_COUNT_TOOLTIP:void 0,children:t(de,{label:`${p?`${m} / ${g}`:g}`,status:Te.Unknown})})]}),t(K,{onClick:()=>n({clusterId:o.value.clusterId,namespaceName:o.value.namespaceName,boolean:!u}),disabled:!h.length,size:E.XS,children:(u?"Unselect":"Select")+" all"})]}),list:c?h:[t(M,{$height:"100%",children:t(R,{icon:vt,title:fe.SELECT_NAMESPACE,subTitle:fe.SELECT_NAMESPACE_SUBTITLE})},"no-data")]}},Zl=u.div``,Ql=u.div`
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`
106
106
  visibility: ${({$visible:e})=>e?"visible":"hidden"};
107
107
 
108
108
  transition: visibility 0s;
109
109
  ${({$visible:e})=>!e&&"& * {\n transition-duration: 0s !important;\n }"}
110
110
 
111
- ${Zl}:hover & {
111
+ ${na}:hover & {
112
112
  visibility: visible;
113
113
  }
114
- `,ea=({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(Zl,{children:t(Al,{title:a,isSelected:r,onClick:s,isPartiallyChecked:n.partial,isChecked:n.all,onCheckboxChange:e=>u({auto:e,all:e}),children:e(O,{$gap:12,children:[t(Ql,{$visible:r||o,children:t(ae,{text:"Automatically instrument all workloads currently in the namespace, and all workloads that will be deployed to this namespace in the future",children:t(S,{label:"Auto",size:Ae.S,value:o,onChange:e=>u({auto:e,all:e||void 0})})})}),e(O,{$gap:8,children:[t(K,{variant:Ne.Span,size:E.XXXS,color:d.v2.colors.silver[200],align:"right",children:"Selected"}),t(de,{label:`${i.sourced}/${i.total}`,status:r?H.Default:Te.Unknown,minWidth:"42px"})]})]})})})},ta=({clusterId:e,clusterName:l,namespaces:a,selectedArea:n,setSelectedArea:o,handleSourceChange:i})=>{const r=s(()=>a.map(({name:a,totalWorkloads:r,selectedCount:s,isAllSourced:c,isSomeSourced:d,isFutureApps:u})=>t(ea,{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(Pl,{title:l,list:r,noBgColor:!0})},la=({isFetching:l,formData:a,handleSourceChange:n,handleSelectAll:o,selectedArea:i,setSelectedArea:r,searchText:c,filters:d})=>{const u=s(()=>a.map(e=>{const t=[...e.namespaces].sort((e,t)=>e.name.localeCompare(t.name)).filter(e=>Wl(e,c,d)).map(e=>({name:e.name,totalWorkloads:e.workloads.length,...Kl(e)}));return{clusterId:e.clusterId,clusterName:e.clusterName,visibleNamespaces:t}}),[a,c,d]),h=s(()=>{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:p,withFilterCount:m,filteredCount:g,totalCount:b}=s(()=>{const e=u.map(({clusterId:e,clusterName:l,visibleNamespaces:a})=>a.length?t(ta,{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(O,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(O,{$gap:8,children:[t(K,{size:E.XS,nowrap:!0,children:"Namespaces"}),t(ae,{text:m?fe.FILTERED_COUNT_TOOLTIP:void 0,children:t(de,{label:`${m?`${g} / ${b}`:b}`,status:Te.Unknown})})]}),t(K,{onClick:()=>o({boolean:!h}),disabled:!p.length,size:E.XS,children:(h?"Unselect":"Select")+" all"})]}),list:p.length?p:l?[t(M,{$height:"100%",children:t(L,{title:fe.FETCHING_NAMESPACES,subTitle:fe.FETCHING_NAMESPACES_SUBTITLE,withSpinner:!0})},"loading")]:[]}},aa=({onClose:l,selectedConnectionIds:o,setSelectedConnectionIds:i,getAllClusterSnapshots:r,persistSources:c})=>{const u=h(),{selectedStreamName:p}=xe(),{progress:m,resetProgress:g}=De(),b=s(()=>p||Oe,[p]),[f,C]=n(!1),[y,v]=n(null),w=d(async()=>{try{C(!0),v(await r()??null)}catch(e){}finally{C(!1)}},[]);a(()=>{w()},[]);const[k,$]=n(""),[x,I]=n(Ve.Namespace),[T,A]=n({showOnlySelected:!1}),[D,V]=n({clusterId:"",clusterName:"",namespaceName:""}),[F,M]=n([]);a(()=>{y&&M(e=>{const t=((e,t)=>N(((e,t)=>e.clusters.filter(({clusterId:e})=>t.includes(e)))(e,t)))(y,o);return t.map(t=>{const l=e?.find(e=>e.clusterId===t.clusterId);return l??t})})},[y,o]);const{formDiff:R,isFormDirty:P}=s(()=>{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})(F,y?.clusters||[],b);return{formDiff:e,isFormDirty:Object.keys(e).length>0}},[F,y,b]),L=d(({clusterId:e,workloadId:t,selected:l,auto:a})=>{M(n=>{const o=N(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})},[]),z=d(({clusterId:e,namespaceName:t,boolean:l})=>{M(a=>{const n=N(a),o=x===Ve.Namespace?k:"",i=x===Ve.Source?k:"",r=!!o||!!i||!!T?.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)=>{Gl(e,i,T)&&(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(!Wl(n[s].namespaces[c],o,T))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,T]);return t(pl,{isOpen:!0,onClose:()=>{g(Fe.BulkInstrumenting),l()},onSave:()=>c(R),header:{icon:vt,title:fe.ADD_SOURCE,subTitle:fe.ADD_SOURCES_DESCRIPTION},connectionIds:{value:o,setValue:i},search:{value:k,onChange:e=>{$(e),x===Ve.Namespace&&V({clusterId:"",clusterName:"",namespaceName:""})},segment:{options:[{label:"Namespace",value:Ve.Namespace},{label:"Source",value:Ve.Source}],selected:x,setSelected:I}},filters:e(O,{$gap:8,children:[t(K,{size:E.XXXS,color:u.v2.colors.silver[200],nowrap:!0,children:"Show only:"}),t(S,{size:Ae.S,label:"Selected",value:T.showOnlySelected,onChange:e=>A(t=>({...t,showOnlySelected:e}))})]}),isFormDirty:P,isFetching:f,progress:{title:fe.CREATING_SOURCES,subTitle:fe.CREATING_SOURCES_SUBTITLE,percentage:m[Fe.BulkInstrumenting]?.percentage||0},leftColumn:la({isFetching:f,formData:F,handleSourceChange:L,handleSelectAll:z,selectedArea:D,setSelectedArea:V,searchText:x===Ve.Namespace?k:"",filters:T}),rightColumn:Xl({formData:F,handleSourceChange:L,handleSelectAll:z,selectedArea:{value:D},searchText:x===Ve.Source?k:"",filters:T})})},na=({onClose:l,connections:o,selectedConnectionIds:i,setSelectedConnectionIds:r,getEffectiveConfig:c,onApply:d})=>{const u=h(),[p,m]=n(""),[g,b]=n({showOnlySelected:!1}),f=s(()=>o.filter(e=>{const t=!p||e.name.toLowerCase().includes(p.toLowerCase()),l=!g.showOnlySelected||g.showOnlySelected&&i.includes(e.id);return t&&l}),[o.length,i.length,p,g]),C=e=>{r(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[y,v]=n(!1),[w,k]=n(void 0),{formData:$,handleFormChange:x,areFormValuesEqual:I,resetFormData:T}=be(w||{rollout:{automaticRolloutDisabled:!1}}),A=s(()=>i.length>1||void 0!==w&&!I(w,$),[i.length,w,$]);return a(()=>{1===i.length?(async e=>{if(y)return;v(!0);const t=await c(e);if(t){const e={rollout:{automaticRolloutDisabled:t.rollout?.automaticRolloutDisabled||!1}};k(e),T(e)}v(!1)})(i[0]):k(void 0)},[i.length]),t(pl,{isOpen:!0,onClose:l,onSave:()=>d($,i),header:{icon:wt,title:"Cluster Configuration"},connectionIds:{value:i,setValue:r},search:{placeholder:"Search by cluster name",value:p,onChange:m},filters:e(O,{$gap:8,children:[t(K,{size:E.XXXS,color:u.v2.colors.silver[200],nowrap:!0,children:"Show only:"}),t(S,{size:Ae.S,label:"Selected",value:g.showOnlySelected,onChange:e=>b(t=>({...t,showOnlySelected:e}))})]}),isFormDirty:A,isFetching:y,leftColumn:{width:"35%",header:e(O,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(O,{$gap:8,children:[t(K,{size:E.XS,children:"Clusters"}),t(de,{label:f.length,status:Te.Unknown})]}),e(O,{$gap:8,children:[t(K,{size:E.XXXS,color:u.v2.colors.silver[200],align:"right",children:"Selected clusters"}),t(de,{label:`${i.length}/${f.length}`,status:Te.Unknown})]})]}),list:f.map(e=>t(Al,{title:e.name,isChecked:i.includes(e.id),onClick:()=>C(e.id),onCheckboxChange:()=>C(e.id)},e.id))},rightColumn:{width:"65%",header:t(K,{size:E.XS,children:"Configurations"}),list:[t(S,{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:$.rollout?.automaticRolloutDisabled||!1,onChange:e=>x("rollout.automaticRolloutDisabled",e)},"automatic-rollout-disabled")]}})},oa=({token:a,isLoading:n,isEditing:o,onEdit:i,onCancel:r,onSave:s,formData:c,handleFormChange:d,handleErrorChange:u,formErrors:h})=>{const{CopyButton:p}=Me(),m=!o||n||!c.newToken;return Re({key:"Enter",active:!m},s),e(O,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:h.newToken}),t(O,{$margin:n?"8px 0 0 0":"2px 0 0 0",$alignItems:"center",children:n?t(L,{title:"Saving...",withGradient:!0}):e(l,{children:[t(_,{variant:B.Secondary,size:W.S,leftIcon:kt,onClick:r,disabled:n}),t(_,{variant:B.Primary,size:W.S,leftIcon:St,onClick:s,disabled:m})]})})]}:{$justifyContent:"space-between",$gap:12,children:[t(K,{size:E.XS,children:new Array(55).fill("•").join("")}),e(O,{$alignItems:"center",$justifyContent:"space-between",children:[t(p,{value:a}),t(ye,{icon:$t,onClick:i})]})]})},ia=({expiresAt:e,callbackValid:l,callbackExpired:n})=>{const{formatTimeAgo:o}=Pe(),i=s(()=>o(e),[e]),r=s(()=>new Date(e).toDateString().split(" ").slice(1).join(" "),[e]),c=s(()=>Le(e,0)?H.Error:Le(e,2592e6)?H.Warning:H.Success,[e]),d=s(()=>c===H.Success?St:c===H.Warning?xt:It,[c]);return a(()=>{c===H.Success?l():c===H.Error&&n()},[c]),t(ae,{text:r,children:t(de,{leftIcon:d,label:i,status:c,invertColors:!0,useSecondaryTone:!0})})},ra=u.div`
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`
115
115
  display: flex;
116
116
  flex-direction: column;
117
117
  gap: 12px;
@@ -119,14 +119,14 @@ import{jsxs as e,jsx as t,Fragment as l}from"react/jsx-runtime";import{useEffect
119
119
  border-radius: 12px;
120
120
  border: 1px solid ${({theme:e,$isExpired:t})=>t?e.v2.colors.red[500]:e.v2.colors.silver[600]};
121
121
  background-color: ${({theme:e,$isExpired:t})=>t?e.v2.colors.red[1e3]:e.v2.colors.silver[800]};
122
- `,sa=({children:e})=>{const l=h();return t(K,{size:E.XXXS,color:l.v2.colors.grey[150],children:e})},ca=({token:l,updateToken:a})=>{const[o,i]=n(!1),[r,s]=n(!1),[c,d]=n(!1),{formData:u,handleFormChange:h,formErrors:p,handleErrorChange:g,resetFormData:b}=be({newToken:""});return t(Ee,{richTitle:{icon:Tt,title:"Odigos Pro Token"},children:e(ra,{$isExpired:c,children:[e(O,{$justifyContent:"space-between",children:[e(m,{$gap:4,children:[t(sa,{children:"Issued for"}),t(K,{size:E.XS,children:l.name||"N/A"})]}),e(m,{$gap:4,children:[t(sa,{children:"Expiration"}),t(ia,{expiresAt:l.expiresAt,callbackValid:()=>d(!1),callbackExpired:()=>d(!0)})]}),t(m,{})]}),t(O,{children:e(m,{children:[t(sa,{children:"Token"}),t(oa,{token:l.token,newToken:u.newToken,isLoading:r,isEditing:o,onEdit:()=>i(!0),onCancel:()=>(i(!1),s(!1),void h("newToken","")),onSave:()=>(async()=>{s(!0);const e=await a(u.newToken.trim());s(!1),e?.error?g("newToken",e.error):(i(!1),b())})(),formData:u,handleFormChange:h,handleErrorChange:g,formErrors:p})]})})]})})},da=u.div`
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`
123
123
  display: flex;
124
124
  align-items: center;
125
125
  justify-content: center;
126
126
  padding: 12px 24px;
127
127
  border-radius: 8px;
128
128
  background-color: ${({theme:e})=>e.v2.colors.silver[800]};
129
- `,ua=({downloadDiagnose:l})=>{const a=h(),{namespaces:o}=ze(),[i,r]=n(null),{formData:s,handleFormChange:c,resetFormData:d}=be({includeProfiles:!0,includeMetrics:!0,includeSourceWorkloads:!1,sourceWorkloadNamespaces:[]});return t(Ee,{richTitle:{icon:At,title:"Diagnose"},children:i?t(da,{children:t(L,{title:"Creating file...",subTitle:"This may take a few moments. Do not refresh the page.",startedAt:i,withGradient:!0,withVisual:!0,visualIcon:Nt})}):e(m,{$gap:24,children:[t(K,{size:E.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(m,{$gap:16,children:[e(O,{$gap:8,children:[t(b,{label:"Profiles",value:s.includeProfiles,onChange:e=>c("includeProfiles",e)}),t(K,{size:E.XXXS,color:a.v2.colors.silver[200],children:"Include pprof profiles"})]}),e(O,{$gap:8,children:[t(b,{label:"Metrics",value:s.includeMetrics,onChange:e=>c("includeMetrics",e)}),t(K,{size:E.XXXS,color:a.v2.colors.silver[200],children:"Include Prometheus metrics"})]}),e(O,{$gap:8,children:[t(b,{label:"Source Workloads",value:s.includeSourceWorkloads,onChange:e=>{c("includeSourceWorkloads",e),e&&c("sourceWorkloadNamespaces",[])}}),t(K,{size:E.XXXS,color:a.v2.colors.silver[200],children:"Include workload and pod manifests for instrumented sources"})]})]}),t(je,{alignX:He.Left,alignY:qe.Bottom,items:o.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:B.Secondary,disabled:s.includeSourceWorkloads,leftIcon:s.sourceWorkloadNamespaces.length?()=>t(de,{label:s.sourceWorkloadNamespaces.length,status:H.Default}):void 0}}),t(O,{$justifyContent:"flex-end",children:t(_,{label:"Download Diagnose",rightIcon:Nt,variant:B.Primary,onClick:async()=>{r(Date.now()),await l(s),r(null),d()},disabled:null!==i})})]})})},ha=({fetchDescribeOdigos:e})=>{const{platformType:l,version:o,tier:i}=_e(),[r,s]=n(null);return a(()=>{e().then(({data:e})=>s(e?.describeOdigos||null))},[]),t(Ee,{richTitle:{icon:Dt,title:"General Information"},children:t(Be,{cellsPerRow:2,items:[{id:Ke(),title:"Odigos Version",label:o},{id:Ke(),title:`${l.toUpperCase()} Version`,label:r?.kubernetesVersion?.value||"-"},{id:Ke(),title:"Installation Method",label:r?.installationMethod?.value||"-"},{id:Ke(),title:"Tier",label:i}]})})},pa=({isOpen:l,onClose:a,token:n,updateToken:o,fetchDescribeOdigos:i,downloadDiagnose:r})=>e(P,{isOpen:l,header:{icon:Dt,title:"System Overview",onClose:a},children:[i&&t(ha,{fetchDescribeOdigos:i}),o&&n&&t(ca,{token:n,updateToken:o}),r&&t(ua,{downloadDiagnose:r})]});var ma,ga;!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"}(ma||(ma={})),function(e){e.Id="id",e.Name="name",e.Type="type",e.Status="status",e.OdigosVersion="odigosVersion",e.ConnectedSince="connectedSince",e.LastActivity="lastActivity"}(ga||(ga={}));const ba=[{key:ga.Name,label:"Name"},{key:ga.Type,label:"Type",textAlign:"right"},{key:ga.Status,label:"Status"},{key:ga.OdigosVersion,label:"Odigos Version"},{key:ga.ConnectedSince,label:"Connected Since"},{key:ga.LastActivity,label:"Last Activity"}],fa=(e,t)=>{const l=e.find(e=>e.key===ga.Id)?.rawValue;return t(l?.toString()||"")},Ca=({tableRowsMaxHeight:l,connections:o,getConnections:i,onClickConnection:r,deleteConnection:c,configMinSupportedVersion:u=0,getEffectiveConfig:p,applyConfigurations:m,snapshotMinSupportedVersion:g=0,getAllClusterSnapshots:b,persistSources:f,getDestinationCategories:C,getPotentialDestinations:y,createDestination:v,createAction:w,createInstrumentationRule:k})=>{const S=h(),{formatTimeAgo:$}=Pe(),[x,I]=n(!1),[T,A]=n(o||[]),N=d(async()=>{try{I(!0),A(await i()??[])}catch(e){}finally{I(!1)}},[]);a(()=>{T.length||N()},[]);const[D,O]=n(""),[V,F]=n(null),[M,R]=n([]),P=s(()=>V===ma.BulkConfig?u:V===ma.BulkSource?g:0,[V,u,g]),{supportedConnections:L,supportedConnectionIds:E}=s(()=>{const e=((e,t)=>e.filter(e=>{const l=e.status===H.Success,a=We(e.odigosVersion,t);return l&&a}))(T,P);return{supportedConnections:e,supportedConnectionIds:e.map(e=>e.id)}},[T.length,P]);a(()=>{if(!V||V===ma.Delete)return;const e=M.filter(e=>!E.includes(e));e.length&&R(t=>t.filter(t=>!e.includes(t)))},[V,M.length,E.length]);const z=s(()=>T.filter(e=>!D||e.name.toLowerCase().includes(D.toLowerCase())).map(e=>({cells:[{key:ga.Id,rawValue:e.id},{key:ga.Name,rawValue:e.name},{key:ga.Type,rawValue:e.type},{key:ga.Status,rawValue:e.status,component:()=>(e=>{const l=e===H.Success?"Connection live":"Connection lost",a=e===H.Success?St:kt;return t(de,{status:e,label:l,leftIcon:a})})(e.status)},{key:ga.OdigosVersion,rawValue:e.odigosVersion},{key:ga.ConnectedSince,rawValue:e.connectedAt?$(e.connectedAt):"-"},{key:ga.LastActivity,rawValue:e.lastSeenAt?$(e.lastSeenAt):"-"}],onClick:e.status!==H.Success||V?void 0:()=>r(e),isSelected:M.includes(e.id),onSelect:()=>R(t=>Array.from(new Set([...t,e.id]))),onDeselect:()=>R(t=>t.filter(t=>t!==e.id)),hideCheckbox:e.status!==H.Success||V===ma.BulkConfig&&!We(e.odigosVersion,u)||V===ma.BulkSource&&!We(e.odigosVersion,g)})),[T,M,D,V,u,g]),j=s(()=>{const e=(e,t)=>{R([e]),F(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===ga.Status)?.rawValue===H.Success)(e))return[{id:Ke(),label:"Delete Connection",rightIcon:Ot,onClick:()=>fa(e,n)}];const d=fa(e,e=>{const a=t.find(t=>t.id===e);return!!a&&We(a.odigosVersion,l)}),u=fa(e,e=>{const l=t.find(t=>t.id===e);return!!l&&We(l.odigosVersion,a)}),h=[];return o&&h.push({id:Ke(),tooltip:u?fe.ADD_SOURCE:`To use this feature, please upgrade to Odigos v${a} or later.`,rightIcon:vt,disabled:!u,onClick:()=>fa(e,o)}),i&&h.push({id:Ke(),tooltip:fe.ADD_DESTINATION,rightIcon:bt,onClick:()=>fa(e,i)}),r&&h.push({id:Ke(),tooltip:fe.ADD_ACTION,rightIcon:gt,onClick:()=>fa(e,r)}),s&&h.push({id:Ke(),tooltip:fe.ADD_INSTRUMENTATION_RULE,rightIcon:yt,onClick:()=>fa(e,s)}),c&&h.push({id:Ke(),tooltip:d?"Edit Configuration":`To use this feature, please upgrade to Odigos v${l} or later.`,rightIcon:wt,disabled:!d,onClick:()=>fa(e,c)}),h}})({connections:T,configMinSupportedVersion:u,snapshotMinSupportedVersion:g,onDelete:t=>e(t,ma.Delete),onAddSource:b&&f?t=>e(t,ma.BulkSource):void 0,onAddDestination:C&&y&&v?t=>e(t,ma.BulkDestination):void 0,onAddAction:w?t=>e(t,ma.BulkAction):void 0,onAddInstrumentationRule:k?t=>e(t,ma.BulkInstrumentationRule):void 0,onEditConfiguration:p&&m?t=>e(t,ma.BulkConfig):void 0})},[T,u,p,m,g,b,f,C,y,v,w,k]),q=s(()=>(e=>{const{onCancel:t,onAddSource:l,onAddDestination:a,onAddAction:n,onAddInstrumentationRule:o,onManageConfigurations:i}=e,r=[];l&&r.push({id:Ke(),type:Ge.Button,buttonProps:{variant:B.Primary,size:W.S,label:"Add Sources",rightIcon:vt,onClick:l}});const s=[a?{id:ma.BulkDestination,label:fe.ADD_DESTINATION,icon:bt}:null,n?{id:ma.BulkAction,label:fe.ADD_ACTION,icon:gt}:null,o?{id:ma.BulkInstrumentationRule,label:fe.ADD_INSTRUMENTATION_RULE,icon:yt}:null,i?{id:ma.BulkConfig,label:"Manage Configurations",icon:wt}:null];return s.some(Boolean)&&r.push({id:Ke(),type:Ge.ButtonDropData,buttonProps:{variant:B.Secondary,size:W.S,label:"Bulk Actions",onClick:e=>{e===ma.BulkSource?l?.():e===ma.BulkDestination?a?.():e===ma.BulkAction?n?.():e===ma.BulkInstrumentationRule?o?.():e===ma.BulkConfig&&i?.()}},dropDataProps:{alignX:He.Left,items:s}}),r.push({id:Ke(),type:Ge.Button,buttonProps:{variant:B.Text,size:W.S,label:Je.CANCEL,onClick:t}}),r})({onCancel:()=>R([]),onAddSource:b&&f?()=>F(ma.BulkSource):void 0,onAddDestination:C&&y&&v?()=>F(ma.BulkDestination):void 0,onAddAction:w?()=>F(ma.BulkAction):void 0,onAddInstrumentationRule:k?()=>F(ma.BulkInstrumentationRule):void 0,onManageConfigurations:p&&m?()=>F(ma.BulkConfig):void 0}),[p,m,b,f,C,y,v,w,k]);return t(Ue,{children:e(Ee,{richTitle:{icon:Ft,title:fe.CONNECTIONS,badge:{label:T.length.toString(),status:Te.Unknown}},search:{placeholder:"Search by cluster name",value:D,onChange:e=>O(e),width:"300px"},actions:[{id:Ke(),type:Ge.Button,buttonProps:{variant:B.Secondary,size:W.S,leftIcon:Vt,onClick:N,disabled:x}}],children:[t(Ye,{variant:Xe.Pretty,maxHeight:l,headerBackgroundColor:S.v2.colors.silver[1e3],isLoading:x,withCheckboxes:!0,columns:ba,rows:z,rowActionsPushRightPosition:V?`calc(${il} - 24px)`:void 0,getRowActions:j}),V===ma.BulkConfig&&p&&m&&t(na,{onClose:()=>F(null),connections:L,selectedConnectionIds:M,setSelectedConnectionIds:R,getEffectiveConfig:p,onApply:m}),V===ma.BulkSource&&b&&f&&t(aa,{onClose:()=>F(null),selectedConnectionIds:M,setSelectedConnectionIds:R,getAllClusterSnapshots:b,persistSources:async e=>await(f?.(e))}),V===ma.BulkDestination&&C&&y&&v&&t(Hl,{onClose:()=>F(null),selectedConnectionIds:M,setSelectedConnectionIds:R,getDestinationCategories:C,getPotentialDestinations:y,createDestination:e=>v(e,M)}),V===ma.BulkAction&&w&&t(Dl,{onClose:()=>F(null),selectedConnectionIds:M,setSelectedConnectionIds:R,createAction:e=>w(e,M)}),V===ma.BulkInstrumentationRule&&k&&t(Bl,{onClose:()=>F(null),selectedConnectionIds:M,setSelectedConnectionIds:R,createInstrumentationRule:e=>k(e,M)}),t(Zt,{target:"connection",isOpen:V===ma.Delete,onClose:()=>{R([]),F(null)},onApprove:async()=>{const e=M[0];e&&(await c(e),await N())}}),t(Ze,{isOpen:!!M.length&&!V,richTitle:{icon:st,title:"Selected Clusters",badge:{label:M.length}},actions:q})]})})},ya=u.div`
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)}),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`
130
130
  display: flex;
131
131
  align-items: center;
132
132
  justify-content: space-between;
@@ -138,10 +138,10 @@ import{jsxs as e,jsx as t,Fragment as l}from"react/jsx-runtime";import{useEffect
138
138
  &:hover {
139
139
  background: ${({theme:e})=>e.v2.colors.silver[700]};
140
140
  }
141
- `,va=u.div`
142
- animation-name: ${lt.in};
143
- `,wa=({pod:o,getExtendedPodInfo:i,onClose:r})=>{const{formatTimeAgo:c}=Pe(),[d,u]=n(null),[h,p]=n(!1);a(()=>{o?i(o.namespace,o.name).then(e=>u(e??null)):(u(null),p(!1))},[o]);const g=s(()=>[{id:Ke(),title:"Node",label:d?.node??"-",withCopy:!0},{id:Ke(),title:"Status",badge:{status:Qe(d?.status),label:d?.status??"-"}}],[d]),b=s(()=>d?.containers?.map(e=>({id:Ke(),items:[{id:Ke(),title:"Container",label:e.name??"-"},{id:Ke(),title:"Status",label:e.startedAt?`${e.status} (since ${c(e.startedAt)})`:e.status},{id:Ke(),title:"Ready",badge:{status:e.ready?H.Success:H.Error,leftIcon:e.ready?st:ut,label:e.ready?"True":"False",invertColors:!0}},{id:Ke(),title:"Started",badge:{status:e.started?H.Success:H.Error,leftIcon:e.started?st:ut,label:e.started?"True":"False",invertColors:!0}},{id:Ke(),title:"Image Version",label:e.image?.split(":")?.[1]??"-"},{id:Ke(),title:"Image Repository",label:e.image?.split(":")?.[0]??"-"},{id:Ke(),title:"Restarts",label:e.restarts.toString()},{id:Ke(),title:"State Reason",label:e.stateReason??"-"},{id:Ke(),title:"Resource Requests",label:`CPU ${e.resources.requests.cpu} • Memory ${e.resources.requests.memory}`},{id:Ke(),title:"Resource Limits",label:`CPU ${e.resources.limits.cpu} • Memory ${e.resources.limits.memory}`}]}))||[],[d]);return e(P,{isOpen:!!o,header:{icon:Mt,title:"Pod Information",onClose:r},children:[d?null:t(M,{children:t(et,{})}),d?e(l,{children:[t(Ee,{richTitle:{icon:Mt,title:d.name,withCopy:!0},children:e(m,{$gap:24,children:[t(Be,{cellsPerRow:2,items:g}),b.length>0&&e(m,{$gap:12,children:[e(ya,{onClick:()=>p(e=>!e),children:[t(K,{children:"Containers Overview"}),t(ye,{icon:h?ft:Ct})]}),h&&b.map(({id:e,items:l})=>t(va,{children:t(Be,{cellsPerRow:2,items:l})},e))]})]})}),t(Ee,{richTitle:{icon:Dt,title:"Kubectl Commands"},children:e(m,{$gap:12,children:[t(tt,{value:`kubectl get pod ${d.name} -n ${d.namespace} -o yaml`}),t(tt,{value:`kubectl describe pod ${d.name} -n ${d.namespace}`}),t(tt,{value:`kubectl logs ${d.name} -n ${d.namespace}`})]})}),t(jt,{yaml:d.manifestYAML,defaultOpen:!0})]}):null]})};var ka;!function(e){e.PodName="podName",e.Status="status",e.Restarts="restarts",e.NodeName="nodeName",e.SpanDropDrate="spanDropDrate",e.Age="age",e.DockerImage="dockerImage"}(ka||(ka={}));const Sa=[{key:ka.PodName,label:"Pod Name"},{key:ka.Status,label:"Status"},{key:ka.Restarts,label:"Restarts",textAlign:"right"},{key:ka.NodeName,label:"Node Name"},{key:ka.Age,label:"Age",textAlign:"right"},{key:ka.DockerImage,label:"Docker Image",textAlign:"right"}],$a=({isLoading:l,tableRowsMaxHeight:a,pods:o,getExtendedPodInfo:i})=>{const r=h(),{formatTimeAgo:c}=Pe(),[d,u]=n(null),p=s(()=>o.map(l=>({onClick:()=>u(l),cells:[{key:ka.PodName,rawValue:l.name},{key:ka.Status,rawValue:l.status,component:()=>{return e=l.status,t(de,{status:Qe(e),label:e});var e}},{key:ka.Restarts,rawValue:l.restartsCount.toString()},{key:ka.NodeName,rawValue:l.nodeName},{key:ka.SpanDropDrate,rawValue:0,component:()=>{const{collectorMetrics:a}=l;if(!a)return t(K,{children:"-"});const n=(a?.metricsAcceptedRps??0)+(a?.metricsDroppedRps??0),o=n>0?Math.round((a?.metricsDroppedRps??0)/n*100):0,i=o>0?H.Error:H.Success,r=(a?.exporterSuccessRps??0)+(a?.exporterFailedRps??0),s=r>0?Math.round((a?.exporterFailedRps??0)/r*100):0,c=s>0?H.Error:H.Success;return e(O,{$gap:4,children:[t(ae,{text:`Accepted: ${a.metricsAcceptedRps.toLocaleString()}, Dropped: ${a.metricsDroppedRps.toLocaleString()}`,children:t(de,{status:i,label:`Receiver ${o}%`,leftIcon:i===H.Error?Rt:Pt,useSecondaryTone:!0,invertColors:!0})}),t(ae,{text:`Success: ${a.exporterSuccessRps.toLocaleString()}, Failed: ${a.exporterFailedRps.toLocaleString()}`,children:t(de,{status:c,label:`Exporter ${s}%`,leftIcon:c===H.Error?Rt:Pt,useSecondaryTone:!0,invertColors:!0})})]})}},{key:ka.Age,rawValue:c(l.creationTimestamp)},{key:ka.DockerImage,rawValue:l.image}]})),[o,r]);return e(Ee,{richTitle:{icon:Mt,title:"Pods"},children:[t(Ye,{variant:Xe.Data,maxHeight:a,isLoading:l,columns:Sa,rows:p}),t(wa,{pod:d,getExtendedPodInfo:i,onClose:()=>u(null)})]})};var xa;!function(e){e.Gateway="gateway",e.Node="node"}(xa||(xa={}));const Ia=[{value:xa.Gateway,label:"Gateway"},{value:xa.Node,label:"Node Collector"}],Ta=u.div`
141
+ `,Ia=p.div`
142
+ 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`
144
144
  display: flex;
145
145
  align-items: center;
146
146
  justify-content: space-between;
147
- `,Aa=({selectedTab:l,setSelectedTab:a,onClickDownloadDiagnose:n,onClickRefresh:o,loading:i,disabled:r})=>{const c=s(()=>{const e=[];return n&&e.push({id:Ke(),type:Ge.Button,buttonProps:{label:"Download Diagnose",leftIcon:Nt,size:W.S,variant:B.Text,onClick:n,disabled:r}}),o&&e.push({id:Ke(),type:Ge.Button,buttonProps:{label:"Refresh",leftIcon:Vt,size:W.S,variant:B.Text,onClick:o,disabled:r,loading:i}}),e},[n,o,r,i]);return e(Ta,{children:[e(O,{$gap:12,children:[e(O,{$gap:8,children:[t(Lt,{size:32}),t(K,{size:E.M,weight:500,children:"Pipeline Collectors"})]}),t(J,{options:Ia,selected:l,setSelected:a,disabled:r})]}),t(at,{actions:c})]})},Na=({isOpen:e,onClose:l,title:a,yaml:n})=>t(P,{isOpen:e,header:{icon:Et,title:a,onClose:l},children:t(jt,{yaml:n,defaultOpen:!0})});var Da;!function(e){e.ManifestYaml="manifest-yaml",e.ConfigMapYaml="configmap-yaml"}(Da||(Da={}));const Oa=({richTitle:l,statusCard:a,textCards:o,manifestYaml:i,configMapYaml:r})=>{const[s,c]=n(null);return e(Ee,{richTitle:l,actions:[{id:Ke(),type:Ge.ButtonDropData,buttonProps:{variant:B.Secondary,size:W.S,label:"View YAML",onClick:e=>c(e)},dropDataProps:{items:[{id:Da.ManifestYaml,label:l.title,icon:zt},{id:Da.ConfigMapYaml,label:"ConfigMap",icon:zt}]}}],children:[e(O,{$gap:16,children:[t(nt,{...a}),o.map(e=>t(ot,{...e},e.title))]}),t(Na,{isOpen:s===Da.ManifestYaml,onClose:()=>c(null),title:l.title,yaml:i}),t(Na,{isOpen:s===Da.ConfigMapYaml,onClose:()=>c(null),title:"ConfigMap",yaml:r})]})},Va=e=>{switch(e){case it.Healthy:return"All desired replicas are updated, available, and ready";case it.Updating:return"Workload is progressing towards desired state (e.g., updating pods)";case it.Degraded:return"Progressing but with availability issues (e.g., not enough available replicas)";case it.Failed:return"Progress deadline exceeded or an unrecoverable error occurred";case it.Down:return"No available replicas";case it.Unknown:return"Status cannot be determined from current signals";default:return"Status unknown"}},Fa=({minSupportedVersion:l=0,tableRowsMaxHeight:o,getGatewayInfo:i,getGatewayPods:r,getNodeCollectorInfo:c,getNodeCollectorPods:u,getExtendedPodInfo:h})=>{const{formatTimeAgo:p}=Pe(),{isVersionSupported:m,version:g}=_e(l),[b,f]=n(!1),[C,y]=n(xa.Gateway),[v,w]=n(null),[k,S]=n([]),[$,x]=n(null),[I,T]=n([]),A=d(async()=>{f(!0);try{switch(C){case xa.Gateway:w(await i()??null),S(await r()??[]);break;case xa.Node:x(await c()??null),T(await u()??[])}}catch(e){}f(!1)},[C]);a(()=>{A()},[A]);const N=s(()=>(e=>{switch(e){case xa.Gateway:return"Deployment";case xa.Node:return"DaemonSet";default:return"Pipeline Collectors"}})(C),[C]),D=s(()=>((e,t,l,a)=>{const n={status:Te.Disabled,label:"No rollouts yet"};let o=!1,i=null;switch(e){case xa.Gateway:o=t?.rolloutInProgress??!1,i=t?.lastRolloutAt??null;break;case xa.Node:o=l?.rolloutInProgress??!1,i=l?.lastRolloutAt??null;break;default:return n}return o?{status:H.Info,label:"Rollout in progress",rightIcon:Vt,useSecondaryTone:!0}:i?{status:Te.Disabled,label:`Last Rollout: ${a(i)}`}:n})(C,v,$,p),[v,$,C,p]),O=s(()=>((e,t,l,a)=>{let n=a?H.Info:Te.Unknown,o=a?"Loading":it.Unknown,i=a?"Fetching data...":Va(it.Unknown);switch(e){case xa.Gateway:n=t?.status?Qe(t?.status):n,o=t?.status??o,i=t?.status?Va(t.status):i;break;case xa.Node:n=l?.status?Qe(l?.status):n,o=l?.status??o,i=l?.status?Va(l.status):i}return{status:n,title:o,description:i}})(C,v,$,b),[v,$,C,b]),V=s(()=>((e,t,l,a)=>{switch(e){case xa.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 xa.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,v,$,b),[v,$,C,b]),F=s(()=>(C===xa.Gateway?v?.manifestYAML:$?.manifestYAML)??"",[v,$,C]),M=s(()=>(C===xa.Gateway?v?.configMapYAML:$?.configMapYAML)??"",[v,$,C]),R=s(()=>C===xa.Gateway?k:I,[k,I,C]);return e(Ue,{children:[t(Aa,{disabled:!m,loading:b,selectedTab:C,setSelectedTab:y,onClickDownloadDiagnose:void 0,onClickRefresh:A}),e(rt,{children:[t(Oa,{richTitle:{icon:Et,title:N,badge:D},statusCard:O,textCards:V,manifestYaml:F,configMapYaml:M}),t($a,{isLoading:b,tableRowsMaxHeight:o,pods:R,getExtendedPodInfo:h}),!m&&t(tl,{minSupportedVersion:l,currentVersion:g||""})]})]})};export{Dl as AddActionDrawer,ml as AddActionForm,Hl as AddDestinationDrawer,bl as AddDestinationForm,Bl as AddRuleDrawer,$l as AddRuleForm,aa as AddSourceDrawer,Ca as CentralConnections,na as EditConfigDrawer,Fa as PipelineCollectors,pa as SystemDrawer};
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};