@odigos/ui-kit 0.0.207 → 0.0.209

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 +1 @@
1
- export{_ as Badge,B as Button,h as ButtonSize,dS as ButtonTab,dT as ButtonTabList,j as ButtonVariants,C as Checkbox,dU as CheckboxList,dV as CheckboxSize,aH as CliCommand,aw as DataCard,o as Drawer,as as DropData,au as DropDataAlignX,at as DropDataAlignY,y as DropDown,b as FieldMessage,a as FieldTitle,dW as Header,ct as HoverActions,a7 as IconButton,a8 as IconButtonSize,I as Input,f as InputList,d as InputTable,aE as Island,L as Loader,dX as Modal,dY as Navbar,N as NoData,r as Note,dZ as Radio,d_ as RadioGroup,d$ as RadioSize,q as Search,aq as SectionCard,e0 as SectionCardSize,v as Segment,ac as SegmentSize,aK as StatusCard,aC as Table,aD as TableVariant,e1 as Tag,w as TextArea,aL as TextCard,T as Toggle,e as ToggleLabelAlign,e2 as ToggleList,ag as ToggleSize,e3 as ToggleVariant,t as Typography,p as TypographySize,ah as TypographyVariants,W as WarningModal}from"../chunks/ui-components-BlfhQM0V.js";import"../icons.js";import"react/jsx-runtime";import"styled-components";import"zustand";import"react";import"javascript-time-ago";import"../chunks/vendor-D99eCWta.js";import"@xyflow/react";import"react-dom";import"prism-react-renderer";import"react-error-boundary";import"lottie-react";import"virtua";
1
+ export{_ as Badge,B as Button,h as ButtonSize,dW as ButtonTab,dX as ButtonTabList,j as ButtonVariants,C as Checkbox,dY as CheckboxList,dZ as CheckboxSize,aM as CliCommand,aB as DataCard,o as Drawer,ay as DropData,aA as DropDataAlignX,az as DropDataAlignY,y as DropDown,b as FieldMessage,a as FieldTitle,d_ as Header,cy as HoverActions,a7 as IconButton,a8 as IconButtonSize,I as Input,f as InputList,d as InputTable,aJ as Island,L as Loader,d$ as Modal,e0 as Navbar,N as NoData,r as Note,e1 as Radio,e2 as RadioGroup,e3 as RadioSize,q as Search,aw as SectionCard,e4 as SectionCardSize,v as Segment,ac as SegmentSize,aP as StatusCard,aH as Table,aI as TableVariant,e5 as Tag,w as TextArea,aQ as TextCard,T as Toggle,e as ToggleLabelAlign,e6 as ToggleList,ak as ToggleSize,e7 as ToggleVariant,t as Typography,p as TypographySize,al as TypographyVariants,W as WarningModal}from"../chunks/ui-components-CwVshImz.js";import"../icons.js";import"react/jsx-runtime";import"styled-components";import"zustand";import"react";import"javascript-time-ago";import"../chunks/vendor-D99eCWta.js";import"@xyflow/react";import"react-dom";import"prism-react-renderer";import"react-error-boundary";import"lottie-react";import"virtua";
package/lib/components.js CHANGED
@@ -1 +1 @@
1
- export{bi as AutocompleteInput,bC as Badge,bE as Button,b6 as CancelWarning,n as CenterThis,aQ as Checkbox,cK as Code,ba as ConditionDetails,bb as DataCard,aO as DataCardFieldTypes,ca as DataCardFields,dC as DataFinger,bG as DataTab,b5 as DeleteWarning,cr as DescribeRow,D as Divider,a$ as DocsButton,b4 as Drawer,dD as DrawerFooter,dE as DrawerHeader,bY as Dropdown,dF as ErrorBoundary,c1 as ExtendArrow,aG as FadeLoader,aR as FieldError,aP as FieldLabel,F as FlexColumn,g as FlexRow,dG as Header,aX as IconButton,cC as IconGroup,bw as IconTitleBadge,br as IconWrapped,cn as IconsNav,dH as ImageControlled,aS as Input,aW as InputList,aT as InputTable,bz as InteractiveTable,aV as KeyValueInputsList,dI as LoadingText,bf as Modal,bg as ModalBody,b0 as MonitorsCheckboxes,bt as MonitorsIcons,bj as NavigationButtons,bA as NoDataFound,bh as NotificationNote,dJ as Overlay,aB as PageContent,bT as Popup,cE as PopupForm,cJ as ScrollX,S as ScrollY,a_ as SectionTitle,aZ as Segment,bV as SelectionButton,bL as SkeletonLoader,bl as Status,c9 as Stepper,dK as TabList,bu as TableContainer,bv as TableTitleWrap,by as TableWrap,cc as Tag,b2 as Text,b1 as TextArea,aU as Toggle,cH as ToggleCodeComponent,O as Tooltip,bB as TraceLoader,aN as UpgradeRequiredWrapper,bU as VerticalScroll,cg as WarningModal,dL as WhiteSpace,dM as getLinksFromText,dN as getStrongsFromText,dO as renderText}from"./chunks/ui-components-BlfhQM0V.js";import"./icons.js";import"react/jsx-runtime";import"styled-components";import"zustand";import"react";import"javascript-time-ago";import"./chunks/vendor-D99eCWta.js";import"@xyflow/react";import"react-dom";import"prism-react-renderer";import"react-error-boundary";import"lottie-react";import"virtua";
1
+ export{bo as AutocompleteInput,bI as Badge,bK as Button,bb as CancelWarning,n as CenterThis,aV as Checkbox,cP as Code,bf as ConditionDetails,bg as DataCard,aT as DataCardFieldTypes,cg as DataCardFields,dG as DataFinger,bM as DataTab,ba as DeleteWarning,cw as DescribeRow,D as Divider,b4 as DocsButton,b9 as Drawer,dH as DrawerFooter,dI as DrawerHeader,c2 as Dropdown,dJ as ErrorBoundary,c7 as ExtendArrow,aL as FadeLoader,aW as FieldError,aU as FieldLabel,F as FlexColumn,g as FlexRow,dK as Header,b0 as IconButton,cH as IconGroup,bC as IconTitleBadge,bx as IconWrapped,cs as IconsNav,dL as ImageControlled,aX as Input,a$ as InputList,aY as InputTable,bF as InteractiveTable,a_ as KeyValueInputsList,dM as LoadingText,bl as Modal,bm as ModalBody,b5 as MonitorsCheckboxes,bz as MonitorsIcons,bp as NavigationButtons,bG as NoDataFound,bn as NotificationNote,dN as Overlay,aG as PageContent,bZ as Popup,cJ as PopupForm,cO as ScrollX,S as ScrollY,b3 as SectionTitle,b2 as Segment,b$ as SelectionButton,bR as SkeletonLoader,br as Status,cf as Stepper,dO as TabList,bA as TableContainer,bB as TableTitleWrap,bE as TableWrap,ci as Tag,b7 as Text,b6 as TextArea,aZ as Toggle,cM as ToggleCodeComponent,O as Tooltip,bH as TraceLoader,aS as UpgradeRequiredWrapper,b_ as VerticalScroll,cl as WarningModal,dP as WhiteSpace,dQ as getLinksFromText,dR as getStrongsFromText,dS as renderText}from"./chunks/ui-components-CwVshImz.js";import"./icons.js";import"react/jsx-runtime";import"styled-components";import"zustand";import"react";import"javascript-time-ago";import"./chunks/vendor-D99eCWta.js";import"@xyflow/react";import"react-dom";import"prism-react-renderer";import"react-error-boundary";import"lottie-react";import"virtua";
package/lib/constants.js CHANGED
@@ -1 +1 @@
1
- export{a2 as ACTION_ATTRIBUTE_OPTIONS,b9 as ACTION_OPTIONS,a3 as ACTION_SAMPLER_OPTIONS,aA as BUTTON_TEXTS,aj as DEFAULT_DATA_STREAM_NAME,aa as DESTINATION_CATEGORIES,$ as DISPLAY_LANGUAGES,a5 as DISPLAY_TITLES,u as DOCS_BASE_URL,a9 as DestinationCategoryTypes,a6 as FORM_ALERTS,ae as INSTRUMENTATION_RULE_OPTIONS,dn as LANGUAGE_OPTIONS,M as MONITORS_OPTIONS,dp as OTEL_DISTRO_NAME_OPTIONS,bZ as STORAGE_KEYS,dq as TOKEN_ABOUT_TO_EXPIRE}from"./chunks/ui-components-BlfhQM0V.js";import"./icons.js";import"react/jsx-runtime";import"styled-components";import"zustand";import"react";import"javascript-time-ago";import"./chunks/vendor-D99eCWta.js";import"@xyflow/react";import"react-dom";import"prism-react-renderer";import"react-error-boundary";import"lottie-react";import"virtua";
1
+ export{a2 as ACTION_ATTRIBUTE_OPTIONS,be as ACTION_OPTIONS,a3 as ACTION_SAMPLER_OPTIONS,aF as BUTTON_TEXTS,ap as DEFAULT_DATA_STREAM_NAME,aa as DESTINATION_CATEGORIES,$ as DISPLAY_LANGUAGES,a5 as DISPLAY_TITLES,u as DOCS_BASE_URL,a9 as DestinationCategoryTypes,a6 as FORM_ALERTS,ae as INSTRUMENTATION_RULE_OPTIONS,ds as LANGUAGE_OPTIONS,M as MONITORS_OPTIONS,dt as OTEL_DISTRO_NAME_OPTIONS,c3 as STORAGE_KEYS,du as TOKEN_ABOUT_TO_EXPIRE}from"./chunks/ui-components-CwVshImz.js";import"./icons.js";import"react/jsx-runtime";import"styled-components";import"zustand";import"react";import"javascript-time-ago";import"./chunks/vendor-D99eCWta.js";import"@xyflow/react";import"react-dom";import"prism-react-renderer";import"react-error-boundary";import"lottie-react";import"virtua";
@@ -1,5 +1,6 @@
1
- import type { NamespaceSnapshot, WorkloadSnapshot } from '@/types';
1
+ import { type NamespaceSnapshot, type WorkloadSnapshot } from '@/types';
2
2
  import type { Filters } from './types';
3
+ export declare const ENTERPRISE_ONLY_KINDS: Set<string>;
3
4
  export interface NamespaceState {
4
5
  selectedCount: number;
5
6
  isAllSourced: boolean;
@@ -1,17 +1,17 @@
1
- import{jsxs as e,jsx as t,Fragment as l}from"react/jsx-runtime";import{useEffect as a,Fragment as n,useState as o,useRef as i,forwardRef as r,useImperativeHandle as s,useMemo as c,Children as d,useCallback as u}from"react";import p,{useTheme as h}from"styled-components";import{A as m,F as g,a as b,C as f,b as C,I as v,c as y,i as k,d as w,K as S,T as $,e as x,f as I,D as N,g as A,B as T,h as D,j as F,k as O,l as V,W as M,m as R,M as P,V as L,S as E,n as z,N as j,o as q,L as H,p as K,R as B,q as W,r as _,s as G,t as J,u as U,v as Y,w as X,x as Z,y as Q,z as ee,E as te,G as le,H as ae,J as ne,O as oe,P as ie,Q as re,U as se,X as ce,Y as de,Z as ue,_ as pe,$ as he,a0 as me,a1 as ge,a2 as be,a3 as fe,a4 as Ce,a5 as ve,a6 as ye,a7 as ke,a8 as we,a9 as Se,aa as $e,ab as xe,ac as Ie,ad as Ne,ae as Ae,af as Te,ag as De,ah as Fe,ai as Oe,aj as Ve,ak as Me,al as Re,am as Pe,an as Le,ao as Ee,ap as ze,aq as je,ar as qe,as as He,at as Ke,au as Be,av as We,aw as _e,ax as Ge,ay as Je,az as Ue,aA as Ye,aB as Xe,aC as Ze,aD as Qe,aE as et,aF as tt,aG as lt,aH as at,aI as nt,aJ as ot,aK as it,aL as rt,aM as st,aN as ct}from"../chunks/ui-components-BlfhQM0V.js";import{TrashIcon as dt,PlusIcon as ut,VSquareIcon as pt,OdigosLogo as ht,ArrowLeftIcon as mt,ArrowRightIcon as gt,BookIcon as bt,XSquareIcon as ft,GoLogo as Ct,JavaLogo as vt,ChevronRightIcon as yt,ActionIcon as kt,DestinationIcon as wt,ChevronUpIcon as St,ChevronDownIcon as $t,InstrumentationRuleIcon as xt,SourceIcon as It,SettingsIcon as Nt,XIcon as At,VIcon as Tt,EditIcon as Dt,ExclamationTriangleIcon as Ft,ExclamationCircleIcon as Ot,KeyIcon as Vt,DiagnoseIcon as Mt,DownloadIcon as Rt,TerminalIcon as Pt,DeleteIcon as Lt,RefreshIcon as Et,ConnectionsIcon as zt,PodIcon as jt,ArrowDownSquareIcon as qt,ArrowUpSquareIcon as Ht,PipelineCollectorIcon as Kt,GatewayIcon as Bt,YamlIcon as Wt}from"../icons.js";import{Y as _t}from"../chunks/index-BWrHoFMs.js";import"zustand";import"javascript-time-ago";import"../chunks/vendor-D99eCWta.js";import"@xyflow/react";import"react-dom";import"prism-react-renderer";import"react-error-boundary";import"lottie-react";import"virtua";const Gt=[{id:"CREDIT_CARD",label:"Credit card"}],Jt=[{id:m.CollectContainerAttributes,label:"Collect container attributes"},{id:m.CollectReplicaSetAttributes,label:"Collect ReplicaSet attributes"},{id:m.CollectWorkloadId,label:"Collect workload ID"},{id:m.CollectClusterId,label:"Collect cluster ID"}],Ut=[{id:S.Pod,label:S.Pod},{id:S.Namespace,label:S.Namespace},{id:S.Node,label:S.Node}],Yt=[{label:"Label key",keyName:"labelKey",placeholder:"app.kubernetes.io/name"},{label:"Attribute key",keyName:"attributeKey",placeholder:"app.kubernetes.name"},{label:"From sources",keyName:"fromSources",placeholder:"pod, namespace",tooltip:"Select multiple sources. Higher precedence sources (pod > namespace > node) will override lower ones.",componentType:"multi-dropdown",options:Ut}],Xt=[{label:"Annotation key",keyName:"annotationKey",placeholder:"kubectl.kubernetes.io/restartedAt"},{label:"Attribute key",keyName:"attributeKey",placeholder:"kubectl.kubernetes.restartedAt"},{label:"From sources",keyName:"fromSources",placeholder:"pod, namespace",tooltip:"Select multiple sources. Higher precedence sources (pod > namespace > node) will override lower ones.",componentType:"multi-dropdown",options:Ut}],Zt=[{label:"Service",keyName:"serviceName",placeholder:"e.g. my-service",tooltip:"Service name: The rule applies to a specific service name. Only traces originating from this service’s root span will be considered."},{label:"HTTP route",keyName:"httpRoute",placeholder:"e.g. /api/v1/users",tooltip:"HTTP route: The specific HTTP route prefix to match for sampling. Only traces with routes beginning with this prefix will be considered. For instance, configuring /buy will also match /buy/product."},{label:"Threshold",keyName:"minimumLatencyThreshold",placeholder:"e.g. 1000",tooltip:"Minimum latency threshold (ms): Specifies the minimum latency in milliseconds; traces with latency below this threshold are ignored.",inputType:y.Number},{label:"Fallback",keyName:"fallbackSamplingRatio",placeholder:"e.g. 100",tooltip:"Fallback sampling ratio: Specifies the percentage of traces that meet the service/http_route filter but fall below the threshold that you still want to retain. For example, if a rule is set for service A and http_route B with a minimum latency threshold of 1 second, you might still want to keep some traces below this threshold. Setting the ratio to 20% ensures that 20% of these traces will be retained.",inputType:y.Number}],Qt=m.UrlTemplatizationRulesGroups,el=[{keyName:"kind",label:"Kind",placeholder:"Any kind",componentType:"dropdown",options:[{id:"Deployment",label:"Deployment"},{id:"StatefulSet",label:"StatefulSet"},{id:"DaemonSet",label:"DaemonSet"}]},{keyName:"name",label:"Name",placeholder:"Any name"}],tl=[{label:"Service name",keyName:"serviceName",placeholder:"e.g. my-service",tooltip:"Specifies the service name to search within the trace (Across all available spans)."},{label:"Sampling ratio",keyName:"samplingRatio",placeholder:"e.g. 10",tooltip:"Specifies the sample rate for all traces.",inputType:y.Number},{label:"Fallback sampling ratio",keyName:"fallbackSamplingRatio",placeholder:"e.g. 100",tooltip:"Specifies the percentage of traces that don’t meet the service name filter and that you still like to retain.",inputType:y.Number}],ll=[{label:"Service name",keyName:"serviceName",placeholder:"e.g. my-service",tooltip:"Specifies the service name to search within the trace (across all available spans)."},{label:"Attribute key",keyName:"attributeKey",placeholder:"e.g. http.request.method",tooltip:"Specifies the attribute key inside of the span."},{label:"Fallback sampling ratio",keyName:"fallbackSamplingRatio",placeholder:"e.g. 100",tooltip:"Specifies the percentage of traces that don’t meet the service name filter and that you still like to retain.",inputType:y.Number},{label:"Condition",keyName:"condition",tooltip:"An object representing the filters for span attributes filters.",componentType:O.Dropdown,options:[{id:"stringCondition",label:"String condition"},{id:"numberCondition",label:"Number condition"},{id:"booleanCondition",label:"Boolean condition"},{id:"jsonCondition",label:"JSON condition"}]},{label:"Operation",keyName:"operation",tooltip:"Specifies the operation to run against the attribute.",componentType:O.Dropdown,options:[{id:"exists",label:"Exists"},{id:"equals",label:"Equals"},{id:"not_equals",label:"Not equals"},{id:"contains",label:"Contains"},{id:"not_contains",label:"Not contains"},{id:"regex",label:"Regex"},{id:"greater_than",label:"Greater than"},{id:"less_than",label:"Less than"},{id:"greater_than_or_equal",label:"Greater than or equal"},{id:"less_than_or_equal",label:"Less than or equal"},{id:"is_valid_json",label:"Is valid JSON"},{id:"is_invalid_json",label:"Is invalid JSON"},{id:"jsonpath_exists",label:"JSON path exists"},{id:"key_equals",label:"Key equals"},{id:"key_not_equals",label:"Key not equals"}]},{label:"Expected value",keyName:"expectedValue",placeholder:"e.g. GET",tooltip:"The values to test the attribute against."},{label:"JSON path",keyName:"jsonPath",placeholder:"e.g. $.user.role",tooltip:"An expression used to navigate the JSON structure.",renderCondition:e=>"jsonCondition"===e.condition}],al={[V.K8sAttributes]:({value:n,setValue:o,formErrors:i})=>(a(()=>{n[m.CollectContainerAttributes]||n[m.CollectReplicaSetAttributes]||n[m.CollectWorkloadId]||n[m.CollectClusterId]||n[m.LabelsAttributes]?.length||n[m.AnnotationsAttributes]?.length||(o(m.CollectContainerAttributes,!0),o(m.CollectReplicaSetAttributes,!0),o(m.CollectWorkloadId,!0),o(m.CollectClusterId,!0),o(m.LabelsAttributes,[]),o(m.AnnotationsAttributes,[]))},[]),e(l,{children:[t(g,{$gap:6,children:Jt.map(({id:l,label:a})=>e(g,{children:[t(f,{label:a,value:n[l]||!1,onChange:e=>o(l,e)}),t(C,{errorMessage:i[l]})]},l))}),t(w,{label:"Label attributes",limitFieldsPerRow:2,columns:Yt,values:n[m.LabelsAttributes]||[],setValues:e=>o(m.LabelsAttributes,e),errorMessage:i[m.LabelsAttributes]}),t(w,{label:"Annotation attributes",limitFieldsPerRow:2,columns:Xt,values:n[m.AnnotationsAttributes]||[],setValues:e=>o(m.AnnotationsAttributes,e),errorMessage:i[m.AnnotationsAttributes]})]})),[V.AddClusterInfo]:({value:a,setValue:n,formErrors:o})=>{const i=h();return e(l,{children:[t($,{label:"Overwrite existing values",labelAlign:x.Left,labelColor:i.v2.colors.silver[200],tooltip:"If enabled, the resource attributes will overwrite any existing attributes with the same name.",value:a[m.OverwriteExistingValues]||!1,onChange:e=>n(m.OverwriteExistingValues,e)}),t(w,{label:"Resource attributes",limitFieldsPerRow:2,columns:[{keyName:"attributeName",label:"Attribute name"},{keyName:"attributeStringValue",label:"Attribute value"}],values:a[m.ClusterAttributes]||[],setValues:e=>n(m.ClusterAttributes,e),errorMessage:o[m.ClusterAttributes]})]})},[V.DeleteAttributes]:({value:e,setValue:l,formErrors:a})=>t(I,{label:"Attributes to delete",values:e[m.AttributeNamesToDelete]||[],setValues:e=>l(m.AttributeNamesToDelete,e),errorMessage:a[m.AttributeNamesToDelete]}),[V.RenameAttributes]:({value:e,setValue:l,formErrors:a})=>t(w,{label:"Attributes to rename",limitFieldsPerRow:2,columns:[{keyName:"oldKey",label:"Old key"},{keyName:"newKey",label:"New key"}],values:Object.entries(e[m.Renames]||{}).map(([e,t])=>({oldKey:e,newKey:t})),setValues:e=>{const t={};e.forEach(e=>t[e.oldKey]=e.newKey),l(m.Renames,t)},errorMessage:a[m.Renames]}),[V.PiiMasking]:({value:l,setValue:n,formErrors:o})=>(a(()=>{l[m.PiiCategories]?.length||n(m.PiiCategories,Gt.map(({id:e})=>e))},[]),e(g,{$gap:12,children:[t(b,{label:"Attributes to mask"}),t(g,{$gap:6,children:Gt.map(({id:e,label:a})=>t(f,{label:a,value:l[m.PiiCategories]?.includes(e)||!1,onChange:t=>{const a=l[m.PiiCategories]||[],o=t?[...a,e]:a.filter(t=>t!==e);n(m.PiiCategories,o)}},e))}),t(C,{errorMessage:o[m.PiiCategories]})]})),[V.ErrorSampler]:({value:e,setValue:l,formErrors:a})=>{const n=a[m.FallbackSamplingRatio],o=k(e[m.FallbackSamplingRatio])?"":String(e[m.FallbackSamplingRatio]);return t(v,{label:"Fallback sampling ratio",type:y.Number,min:0,max:100,value:o,placeholder:"0-100",onChange:e=>{return t=e.target.value,l(m.FallbackSamplingRatio,Math.max(0,Math.min(Number(t),100))||0);var t},errorMessage:n})},[V.ProbabilisticSampler]:({value:e,setValue:l,formErrors:a})=>{const n=a[m.SamplingPercentage],o=k(e[m.SamplingPercentage])?"":String(e[m.SamplingPercentage]);return t(v,{label:"Sampling percentage",type:y.Number,min:0,max:100,value:o,placeholder:"0-100",onChange:e=>{return t=e.target.value,l(m.SamplingPercentage,Math.max(0,Math.min(Number(t),100))||0);var t},errorMessage:n})},[V.LatencySampler]:({value:e,setValue:l,formErrors:a})=>{const n=a[m.EndpointsFilters],o=e[m.EndpointsFilters]||[];return t(w,{limitFieldsPerRow:2,columns:Zt,values:o,setValues:e=>{l(m.EndpointsFilters,e.map(({serviceName:e,httpRoute:t,minimumLatencyThreshold:l,fallbackSamplingRatio:a})=>({serviceName:e,httpRoute:t,minimumLatencyThreshold:Number(l),fallbackSamplingRatio:Number(a)})))},errorMessage:n})},[V.ServiceNameSampler]:({value:e,setValue:l,formErrors:a})=>{const n=a[m.ServicesNameFilters],o=e[m.ServicesNameFilters]||[];return t(w,{limitFieldsPerRow:2,columns:tl,values:o,setValues:e=>{l(m.ServicesNameFilters,e.map(({serviceName:e,samplingRatio:t,fallbackSamplingRatio:l})=>({serviceName:e,samplingRatio:Number(t),fallbackSamplingRatio:Number(l)})))},errorMessage:n})},[V.SpanAttributeSampler]:({value:e,setValue:l,formErrors:a})=>{const n=a[m.AttributeFilters],o=(e[m.AttributeFilters]||[]).map(({serviceName:e,attributeKey:t,fallbackSamplingRatio:l,condition:a})=>{const n=Object.entries(a).filter(([e,t])=>t)[0][0];return{serviceName:e,attributeKey:t,fallbackSamplingRatio:l,condition:n,operation:a[n]?.operation,expectedValue:a[n]?.expectedValue,jsonPath:a[n]?.jsonPath}});return t(w,{limitFieldsPerRow:2,columns:ll,values:o,setValues:e=>{l(m.AttributeFilters,e.map(({serviceName:e,attributeKey:t,fallbackSamplingRatio:l,condition:a,operation:n,expectedValue:o,jsonPath:i})=>{const r={serviceName:e,attributeKey:t,fallbackSamplingRatio:Number(l),condition:{[a]:{operation:n,expectedValue:o}}};return i&&(r.condition[a].jsonPath=i),r}))},errorMessage:n})},[V.URLTemplatization]:({value:a,setValue:o,formErrors:i})=>{const r=h(),s=a[Qt]||[{filterK8sNamespace:"",workloadFilters:[],templatizationRules:[{template:""}],notes:""}],c=e=>o(Qt,e),d=(e,t)=>c(s.map((l,a)=>a===e?{...l,...t}:l));return e(l,{children:[s.map((l,a)=>e(n,{children:[t(N,{}),e(g,{$gap:12,children:[e(A,{$justifyContent:"space-between",$alignItems:"center",children:[t(b,{label:`Rule Group ${a+1}`}),t(T,{leftIcon:()=>t(dt,{fill:r.v2.colors.red[500]}),variant:F.Secondary,size:D.S,onClick:()=>{return e=a,c(s.filter((t,l)=>l!==e));var e},disabled:1===s.length})]}),t(v,{label:"Namespace",placeholder:"All namespaces",tooltip:"Filter rules to a specific Kubernetes namespace.",value:l.filterK8sNamespace||"",onChange:e=>d(a,{filterK8sNamespace:e.target.value})}),t(w,{label:"Workload filters",tooltip:"Optionally scope templates to specific workloads.",columns:el,values:l.workloadFilters||[],setValues:e=>d(a,{workloadFilters:e})}),t(I,{label:"Templates",required:!0,placeholder:"e.g. /user/{id}",values:l.templatizationRules.map(e=>e.template),setValues:e=>d(a,{templatizationRules:e.map(e=>({template:e}))})})]}),t(C,{errorMessage:i[Qt]})]},`url-templatization-group-${a}`)),t(T,{variant:F.Secondary,label:"Add rule group",leftIcon:ut,onClick:()=>c([...s,{filterK8sNamespace:"",workloadFilters:[],templatizationRules:[{template:""}],notes:""}])}),t(N,{})]})}},nl=({actionType:e,value:l,setValue:a,formErrors:n})=>{if(!e)return null;const o=al[e];return o?t(o,{value:l,setValue:a,formErrors:n}):null},ol=({isOpen:e,onClose:l,onDeny:a,onApprove:n})=>t(M,{title:"Discard changes?",description:"You have unsaved changes.\nIf you cancel now, your changes won't be saved.",isOpen:e,onClose:l,onDeny:a,denyLabel:"Keep editing",onApprove:n,approveLabel:"Discard changes"}),il=({isOpen:e,onClose:l,onDeny:a,onApprove:n,action:o="delete",target:i})=>{const r=o.charAt(0).toUpperCase()+o.substring(1),s=i?.endsWith("s")?"these":"this";return t(M,{title:`${r}${i?` ${i}`:""}?`,description:`Are you sure you want to ${o}${i?` ${s} ${i}`:""}?`,isOpen:e,onClose:l,onDeny:a,denyLabel:"Go back",onApprove:n,approveLabel:r})},rl=(e,t)=>!t?.length||!!t?.find(t=>t===e),sl=({title:l="Signals",required:n,errorMessage:r,allowedSignals:s,selectedSignals:c,setSelectedSignals:d,disabled:u})=>{const[p,h]=o(1===c.length),m=i(JSON.stringify(c));return a(()=>{const e=R(c);e.length||P.forEach(({id:t})=>{rl(t,s)&&e.push(t)});const t=JSON.stringify(e);m.current!==t&&(m.current=t,d(e),h(1===e.length))},[s,c]),e(g,{$gap:12,children:[t(b,{label:l,required:n}),t(A,{$gap:12,children:P.map(e=>{const l=rl(e.id,s),a=((e,t)=>!!t?.find(t=>t===e))(e.id,c);return l?t(f,{label:e.value,disabled:u||!l||p&&a,value:a,onChange:t=>((e,t)=>{const l=e,a=t?[...c,l]:c.filter(e=>e!==l);d(a),h(1===a.length)})(e.id,t)},e.id):null})}),t(C,{errorMessage:r})]})},cl=({minSupportedVersion:e,currentVersion:l})=>t(M,{isOpen:!0,onClose:()=>{},relativeToParent:!0,visual:()=>t(L,{scale:2.4,icon:()=>t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"22",height:"21",viewBox:"0 0 22 21",fill:"none",children:t("path",{fill:"#151618",d:"M9.4844 0.730003C9.99694 -0.243259 11.4076 -0.24341 11.92 0.730003L11.9685 0.831353L14.3039 6.22012L20.153 6.77755C21.3553 6.89211 21.841 8.38683 20.9358 9.18621L16.5314 13.0731L17.8091 18.8079C18.0716 19.9868 16.8005 20.9109 15.7605 20.2969L10.7017 17.3093L5.64282 20.2969C4.60289 20.9104 3.33173 19.9866 3.59427 18.8079L4.87192 13.0741L0.468608 9.18621C-0.43662 8.38693 0.0482932 6.8924 1.25029 6.77755L7.09837 6.22012L9.43588 0.831353L9.4844 0.730003ZM8.55284 7.02876C8.35287 7.48992 7.9179 7.80589 7.41751 7.85357L2.03952 8.36571L6.09027 11.941C6.46691 12.2737 6.63296 12.7852 6.5237 13.2758L5.34956 18.5459L10.0008 15.8009L10.1669 15.7179C10.5087 15.574 10.8945 15.5741 11.2364 15.7179L11.4036 15.8009L16.0538 18.5459L14.8807 13.2758C14.7714 12.7851 14.9374 12.2737 15.3141 11.941L19.3627 8.36571L13.9858 7.85357C13.4855 7.80587 13.0505 7.4899 12.8505 7.02876L10.7017 2.07342L8.55284 7.02876Z"})})}),title:"Upgrade Required",description:`To use this feature, please upgrade to Odigos v${e} or later.\nCurrent version: ${l}.`}),dl=p.div`
1
+ import{jsxs as e,jsx as t,Fragment as l}from"react/jsx-runtime";import{useEffect as a,Fragment as n,useState as o,useRef as i,forwardRef as r,useImperativeHandle as s,useMemo as c,Children as d,useCallback as u}from"react";import p,{useTheme as h}from"styled-components";import{A as m,F as g,a as b,C as f,b as C,I as y,c as v,i as k,d as w,K as S,T as $,e as x,f as I,D as N,g as T,B as A,h as D,j as O,k as V,l as F,W as R,m as M,M as P,V as L,S as E,n as z,N as j,o as q,L as H,p as K,R as B,q as W,r as _,s as G,t as J,u as U,v as Y,w as X,x as Z,y as Q,z as ee,E as te,G as le,H as ae,J as ne,O as oe,P as ie,Q as re,U as se,X as ce,Y as de,Z as ue,_ as pe,$ as he,a0 as me,a1 as ge,a2 as be,a3 as fe,a4 as Ce,a5 as ye,a6 as ve,a7 as ke,a8 as we,a9 as Se,aa as $e,ab as xe,ac as Ie,ad as Ne,ae as Te,af as Ae,ag as De,ah as Oe,ai as Ve,aj as Fe,ak as Re,al as Me,am as Pe,an as Le,ao as Ee,ap as ze,aq as je,ar as qe,as as He,at as Ke,au as Be,av as We,aw as _e,ax as Ge,ay as Je,az as Ue,aA as Ye,aB as Xe,aC as Ze,aD as Qe,aE as et,aF as tt,aG as lt,aH as at,aI as nt,aJ as ot,aK as it,aL as rt,aM as st,aN as ct,aO as dt,aP as ut,aQ as pt,aR as ht,aS as mt}from"../chunks/ui-components-CwVshImz.js";import{TrashIcon as gt,PlusIcon as bt,VSquareIcon as ft,OdigosLogo as Ct,ArrowLeftIcon as yt,ArrowRightIcon as vt,BookIcon as kt,XSquareIcon as wt,GoLogo as St,JavaLogo as $t,ChevronRightIcon as xt,ActionIcon as It,DestinationIcon as Nt,ChevronUpIcon as Tt,ChevronDownIcon as At,InstrumentationRuleIcon as Dt,SourceIcon as Ot,SettingsIcon as Vt,XIcon as Ft,VIcon as Rt,EditIcon as Mt,ExclamationTriangleIcon as Pt,ExclamationCircleIcon as Lt,KeyIcon as Et,DiagnoseIcon as zt,DownloadIcon as jt,TerminalIcon as qt,DeleteIcon as Ht,RefreshIcon as Kt,ConnectionsIcon as Bt,PodIcon as Wt,ArrowDownSquareIcon as _t,ArrowUpSquareIcon as Gt,PipelineCollectorIcon as Jt,GatewayIcon as Ut,YamlIcon as Yt}from"../icons.js";import{Y as Xt}from"../chunks/index-pLAVCKXo.js";import"zustand";import"javascript-time-ago";import"../chunks/vendor-D99eCWta.js";import"@xyflow/react";import"react-dom";import"prism-react-renderer";import"react-error-boundary";import"lottie-react";import"virtua";const Zt=[{id:"CREDIT_CARD",label:"Credit card"}],Qt=[{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"}],el=[{id:S.Pod,label:S.Pod},{id:S.Namespace,label:S.Namespace},{id:S.Node,label:S.Node}],tl=[{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:el}],ll=[{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:el}],al=[{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}],nl=m.UrlTemplatizationRulesGroups,ol=[{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"}],il=[{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}],rl=[{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}],sl={[F.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:Qt.map(({id:l,label:a})=>e(g,{children:[t(f,{label:a,value:n[l]||!1,onChange:e=>o(l,e)}),t(C,{errorMessage:i[l]})]},l))}),t(w,{label:"Label attributes",limitFieldsPerRow:2,columns:tl,values:n[m.LabelsAttributes]||[],setValues:e=>o(m.LabelsAttributes,e),errorMessage:i[m.LabelsAttributes]}),t(w,{label:"Annotation attributes",limitFieldsPerRow:2,columns:ll,values:n[m.AnnotationsAttributes]||[],setValues:e=>o(m.AnnotationsAttributes,e),errorMessage:i[m.AnnotationsAttributes]})]})),[F.AddClusterInfo]:({value:a,setValue:n,formErrors:o})=>{const i=h();return e(l,{children:[t($,{label:"Overwrite existing values",labelAlign:x.Left,labelColor:i.v2.colors.silver[200],tooltip:"If enabled, the resource attributes will overwrite any existing attributes with the same name.",value:a[m.OverwriteExistingValues]||!1,onChange:e=>n(m.OverwriteExistingValues,e)}),t(w,{label:"Resource attributes",limitFieldsPerRow:2,columns:[{keyName:"attributeName",label:"Attribute name"},{keyName:"attributeStringValue",label:"Attribute value"}],values:a[m.ClusterAttributes]||[],setValues:e=>n(m.ClusterAttributes,e),errorMessage:o[m.ClusterAttributes]})]})},[F.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]}),[F.RenameAttributes]:({value:e,setValue:l,formErrors:a})=>t(w,{label:"Attributes to rename",limitFieldsPerRow:2,columns:[{keyName:"oldKey",label:"Old key"},{keyName:"newKey",label:"New key"}],values:Object.entries(e[m.Renames]||{}).map(([e,t])=>({oldKey:e,newKey:t})),setValues:e=>{const t={};e.forEach(e=>t[e.oldKey]=e.newKey),l(m.Renames,t)},errorMessage:a[m.Renames]}),[F.PiiMasking]:({value:l,setValue:n,formErrors:o})=>(a(()=>{l[m.PiiCategories]?.length||n(m.PiiCategories,Zt.map(({id:e})=>e))},[]),e(g,{$gap:12,children:[t(b,{label:"Attributes to mask"}),t(g,{$gap:6,children:Zt.map(({id:e,label:a})=>t(f,{label:a,value:l[m.PiiCategories]?.includes(e)||!1,onChange:t=>{const a=l[m.PiiCategories]||[],o=t?[...a,e]:a.filter(t=>t!==e);n(m.PiiCategories,o)}},e))}),t(C,{errorMessage:o[m.PiiCategories]})]})),[F.ErrorSampler]:({value:e,setValue:l,formErrors:a})=>{const n=a[m.FallbackSamplingRatio],o=k(e[m.FallbackSamplingRatio])?"":String(e[m.FallbackSamplingRatio]);return t(y,{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})},[F.ProbabilisticSampler]:({value:e,setValue:l,formErrors:a})=>{const n=a[m.SamplingPercentage],o=k(e[m.SamplingPercentage])?"":String(e[m.SamplingPercentage]);return t(y,{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})},[F.LatencySampler]:({value:e,setValue:l,formErrors:a})=>{const n=a[m.EndpointsFilters],o=e[m.EndpointsFilters]||[];return t(w,{limitFieldsPerRow:2,columns:al,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})},[F.ServiceNameSampler]:({value:e,setValue:l,formErrors:a})=>{const n=a[m.ServicesNameFilters],o=e[m.ServicesNameFilters]||[];return t(w,{limitFieldsPerRow:2,columns:il,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})},[F.SpanAttributeSampler]:({value:e,setValue:l,formErrors:a})=>{const n=a[m.AttributeFilters],o=(e[m.AttributeFilters]||[]).map(({serviceName:e,attributeKey:t,fallbackSamplingRatio:l,condition:a})=>{const n=Object.entries(a).filter(([e,t])=>t)[0][0];return{serviceName:e,attributeKey:t,fallbackSamplingRatio:l,condition:n,operation:a[n]?.operation,expectedValue:a[n]?.expectedValue,jsonPath:a[n]?.jsonPath}});return t(w,{limitFieldsPerRow:2,columns:rl,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})},[F.URLTemplatization]:({value:a,setValue:o,formErrors:i})=>{const r=h(),s=a[nl]||[{filterK8sNamespace:"",workloadFilters:[],templatizationRules:[{template:""}],notes:""}],c=e=>o(nl,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(T,{$justifyContent:"space-between",$alignItems:"center",children:[t(b,{label:`Rule Group ${a+1}`}),t(A,{leftIcon:()=>t(gt,{fill:r.v2.colors.red[500]}),variant:O.Secondary,size:D.S,onClick:()=>{return e=a,c(s.filter((t,l)=>l!==e));var e},disabled:1===s.length})]}),t(y,{label:"Namespace",placeholder:"All namespaces",tooltip:"Filter rules to a specific Kubernetes namespace.",value:l.filterK8sNamespace||"",onChange:e=>d(a,{filterK8sNamespace:e.target.value})}),t(w,{label:"Workload filters",tooltip:"Optionally scope templates to specific workloads.",columns:ol,values:l.workloadFilters||[],setValues:e=>d(a,{workloadFilters:e})}),t(I,{label:"Templates",required:!0,placeholder:"e.g. /user/{id}",values:l.templatizationRules.map(e=>e.template),setValues:e=>d(a,{templatizationRules:e.map(e=>({template:e}))})})]}),t(C,{errorMessage:i[nl]})]},`url-templatization-group-${a}`)),t(A,{variant:O.Secondary,label:"Add rule group",leftIcon:bt,onClick:()=>c([...s,{filterK8sNamespace:"",workloadFilters:[],templatizationRules:[{template:""}],notes:""}])}),t(N,{})]})}},cl=({actionType:e,value:l,setValue:a,formErrors:n})=>{if(!e)return null;const o=sl[e];return o?t(o,{value:l,setValue:a,formErrors:n}):null},dl=({isOpen:e,onClose:l,onDeny:a,onApprove:n})=>t(R,{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"}),ul=({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(R,{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})},pl=(e,t)=>!t?.length||!!t?.find(t=>t===e),hl=({title:l="Signals",required:n,errorMessage:r,allowedSignals:s,selectedSignals:c,setSelectedSignals:d,disabled:u})=>{const[p,h]=o(1===c.length),m=i(JSON.stringify(c));return a(()=>{const e=M(c);e.length||P.forEach(({id:t})=>{pl(t,s)&&e.push(t)});const t=JSON.stringify(e);m.current!==t&&(m.current=t,d(e),h(1===e.length))},[s,c]),e(g,{$gap:12,children:[t(b,{label:l,required:n}),t(T,{$gap:12,children:P.map(e=>{const l=pl(e.id,s),a=((e,t)=>!!t?.find(t=>t===e))(e.id,c);return l?t(f,{label:e.value,disabled:u||!l||p&&a,value:a,onChange:t=>((e,t)=>{const l=e,a=t?[...c,l]:c.filter(e=>e!==l);d(a),h(1===a.length)})(e.id,t)},e.id):null})}),t(C,{errorMessage:r})]})},ml=({minSupportedVersion:e,currentVersion:l})=>t(R,{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}.`}),gl=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: ${({$columnHasHeader:e})=>e?"0":"12px"};
7
- `,ul=p.div`
7
+ `,bl=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
- `,pl=p.div`
14
+ `,fl=p.div`
15
15
  display: flex;
16
16
  flex-direction: column;
17
17
  gap: ${({$gap:e})=>e}px;
@@ -22,37 +22,37 @@ import{jsxs as e,jsx as t,Fragment as l}from"react/jsx-runtime";import{useEffect
22
22
  background-color: ${({theme:e})=>e.v2.colors.silver[900]};
23
23
  overflow-y: auto;
24
24
  overflow-x: hidden;
25
- `,hl=({isLeft:a,isRight:n,heightOffset:o=0,width:i,header:r,list:s})=>e(dl,{$width:i,$columnHasHeader:!!r,children:[r&&t(ul,{children:r}),t(pl,{$gap:8,$isLeft:a,$isRight:n,$heightOffset:o,$columnHasHeader:!!r,children:s.length?s.length>1?t(E,{gap:8,elements:s}):t(l,{children:s[0]}):t(z,{$height:"100%",children:t(j,{})})})]}),ml="75vw",gl=p.div`
25
+ `,Cl=({isLeft:a,isRight:n,heightOffset:o=0,width:i,header:r,list:s})=>e(gl,{$width:i,$columnHasHeader:!!r,children:[r&&t(bl,{children:r}),t(fl,{$gap:8,$isLeft:a,$isRight:n,$heightOffset:o,$columnHasHeader:!!r,children:s.length?s.length>1?t(E,{gap:8,elements:s}):t(l,{children:s[0]}):t(z,{$height:"100%",children:t(j,{})})})]}),yl="75vw",vl=p.div`
26
26
  display: flex;
27
27
  flex-direction: column;
28
28
  border-radius: 16px;
29
29
  background-color: ${({theme:e})=>e.v2.colors.silver[1e3]};
30
30
  overflow: hidden;
31
- `,bl=p.div`
31
+ `,kl=p.div`
32
32
  display: flex;
33
33
  gap: 12px;
34
34
  padding: 16px 16px 0 16px;
35
35
  background-color: ${({theme:e})=>e.v2.colors.silver[1e3]};
36
36
  position: sticky;
37
37
  top: 0;
38
- `,fl=p.div`
38
+ `,wl=p.div`
39
39
  padding: 12px 12px 0 12px;
40
- `,Cl=p.div`
40
+ `,Sl=p.div`
41
41
  display: flex;
42
42
  gap: 12px;
43
43
  padding: 16px;
44
- `,vl=p.div`
44
+ `,$l=p.div`
45
45
  padding: 5vh 10vw;
46
46
  border-radius: 12px;
47
47
  background-color: ${({theme:e})=>e.v2.colors.silver[800]};
48
- `,yl=p.div`
48
+ `,xl=p.div`
49
49
  display: flex;
50
50
  align-items: center;
51
51
  justify-content: flex-end;
52
52
  gap: 16px;
53
53
  padding: 0 12px;
54
54
  margin-top: auto;
55
- `,kl=r(({isOpen:l,onClose:a,onBack:n,onNext:i,nextIsSkip:r,onSave:c,disableSave:d,connectionIds:u,header:p,subHeader:h,leftColumn:m,rightColumn:g,search:b,filters:f,errorMessage:C,isFormDirty:v,hideDirtyNote:y,isFetching:k,progress:w},S)=>{const[$,x]=o(!1),[I,N]=o(!1),[D,O]=o(void 0);s(S,()=>({clearErrors:()=>O(void 0)}));const V=I,M=()=>{v&&!$?x(!0):(x(!1),a?.())},R=d||I||"boolean"==typeof v&&!v,P=!!b||!!u||!!f,L=!!h,E=(P?48:0)+(L?50:0);return e(q,{width:ml,isOpen:l,hideOverlay:!I,header:{...p,onClose:a?M:void 0,onCloseDisabled:V},children:[I?t(z,{$height:"calc(100vh - 136px)",children:t(vl,{children:t(H,{titleSize:K.S,subTitleSize:K.XXXS,withGradient:!0,withSpinner:!0,...w})})}):e(gl,{children:[P&&e(bl,{children:[u&&t(B,{icon:pt,title:"Selected Clusters",badge:{label:u.value.length}}),b&&t(W,{width:"100%",...b}),f]}),L&&t(fl,{children:t(B,{icon:h.icon,title:h.title,subTitle:h.description,badge:h.badge})}),e(Cl,{children:[t(hl,{isLeft:!0,heightOffset:E,...m}),t(hl,{isRight:!0,heightOffset:E,...g})]})]}),e(yl,{children:[k?t(H,{icon:ht,title:"Fetching Data...",titleSize:K.XXS,withGradient:!0}):I?w?null:t(H,{icon:ht,title:"Saving Changes...",titleSize:K.XXS,withGradient:!0}):D||C?t(_,{fullWidth:!0,status:G.Error,message:D||C}):"boolean"==typeof v&&v&&!y?t(_,{fullWidth:!0,status:G.Info,message:'The values don\'t reflect the current configurations of the selected clusters.\n"Save" will override the current configurations.'}):"boolean"!=typeof v||v||y?null:t(_,{fullWidth:!0,status:G.Success,message:"The values reflect the current configuration of the selected cluster."}),e(A,{$gap:8,children:[t("div",n?{style:{width:"150px"},children:t(T,{fullWidth:!0,variant:F.Secondary,label:"Back",leftIcon:mt,onClick:n})}:{style:{width:"150px"},children:t(T,{fullWidth:!0,variant:F.Secondary,label:"Cancel",onClick:M,disabled:V})}),t("div",i?{style:{width:"150px"},children:t(T,r?{fullWidth:!0,variant:F.Secondary,label:"Skip",rightIcon:gt,onClick:i}:{fullWidth:!0,variant:F.Primary,label:"Next",rightIcon:gt,onClick:i})}:{style:{width:"150px"},children:t(T,{fullWidth:!0,variant:F.Primary,label:"Save",onClick:async()=>{N(!0);const e=await c();N(!1),e?.error?O(e.error):(u?.setValue([]),a?.())},disabled:R})})]})]}),t(ol,{isOpen:$,onClose:()=>x(!1),onApprove:M})]})});kl.displayName=kl.name;const wl=({option:l,formData:a,handleFormChange:n,formErrors:o})=>{const i=h();return e(g,{$gap:24,children:[e(A,{$gap:12,$justifyContent:"space-between",children:[t(J,{size:K.XXS,children:l.docsDescription}),t(T,{label:"Docs",leftIcon:bt,variant:F.Text,size:D.S,onClick:()=>window.open(`${U}${l.docsEndpoint}`,"_blank","noopener noreferrer")})]}),t(Y,{options:[{icon:pt,label:"Enabled",value:!1,selectedBgColor:i.v2.colors.green[800]},{icon:ft,label:"Disabled",value:!0,selectedBgColor:i.v2.colors.red[800]}],selected:a.disabled,setSelected:e=>n("disabled",e)}),t(sl,{title:"Signals for processing",allowedSignals:l.allowedSignals,selectedSignals:a.signals||[],setSelectedSignals:e=>n("signals",e),errorMessage:o.signals}),t(v,{label:"Action name",placeholder:"Use a name that describes the action...",value:a.name||"",onChange:({target:{value:e}})=>n("name",e),errorMessage:o.name}),t(nl,{actionType:l.type,value:a.fields,setValue:(e,t)=>n(`fields.${e}`,t),formErrors:o}),t(X,{label:"Notes",placeholder:"Your personal notes...",value:a.notes||"",onChange:({target:{value:e}})=>n("notes",e),errorMessage:o.notes})]})},Sl=({signals:l,fields:a,formData:n,handleFormChange:o,formErrors:i})=>a?.map(({renderCondition:a,componentType:r,type:s,name:c,title:d,tooltip:u,placeholder:p,value:h,required:m,options:b})=>{if(a&&!Z(a,l,n.fields))return null;const y=c,k=n.fields.find(e=>e.key===y),S=k?k.value:h;switch(r){case O.Input:return t(v,{name:y,type:s,label:d,tooltip:u,required:m,placeholder:p,value:S,onChange:e=>o(y,e.target.value),errorMessage:i[y]},y);case O.MultiInput:return t(I,{label:d,tooltip:u,required:m,placeholder:p,values:ee(S,[]),setValues:e=>o(y,JSON.stringify(e)),errorMessage:i[y]},y);case O.KeyValuePair:return t(w,{label:d,tooltip:u,required:m,limitFieldsPerRow:2,columns:[{keyName:"key",label:"Key"},{keyName:"value",label:"Value"}],values:ee(S,[]),setValues:e=>o(y,JSON.stringify(e)),errorMessage:i[y]},y);case O.TextArea:return t(X,{name:y,label:d,tooltip:u,required:m,placeholder:p,value:S,onChange:e=>o(y,e.target.value),errorMessage:i[y]},y);case O.Checkbox:return e(g,{children:[t(f,{label:d,value:"true"==S,onChange:e=>o(y,e.toString())}),t(C,{errorMessage:i[y]})]},y);case O.Dropdown:return t(Q,{name:y,label:d,withSearch:!0,values:S?[S]:[],options:b?.map(e=>({id:e.id||"",label:e.value||""}))||[],setValues:e=>o(y,e[0]),errorMessage:i[y]},y);default:return null}}),$l=({option:l,dynamicFields:n,formData:o,handleFormChange:i,formErrors:r})=>{const s=h();return a(()=>{const e=n.map(e=>({key:e.name,value:e.value}));i("fields",e);const t=te(l.supportedSignals),a={logs:t.includes(le.Logs),metrics:t.includes(le.Metrics),traces:t.includes(le.Traces)};i("exportedSignals",a)},[n]),e(g,{$gap:24,children:[e(A,{$gap:12,$justifyContent:"space-between",children:[t("div",{}),t(T,{label:"Docs",leftIcon:bt,variant:F.Text,size:D.S,onClick:()=>window.open(`${U}/backends/${l.type}`,"_blank","noopener noreferrer")})]}),t(Y,{options:[{icon:pt,label:"Enabled",value:!1,selectedBgColor:s.v2.colors.green[800]},{icon:ft,label:"Disabled",value:!0,selectedBgColor:s.v2.colors.red[800]}],selected:o.disabled,setSelected:e=>i("disabled",e)}),t(sl,{title:"This connection will monitor:",allowedSignals:te(l.supportedSignals),selectedSignals:ae(o.exportedSignals),setSelectedSignals:e=>i("exportedSignals",{logs:e.includes(le.Logs),metrics:e.includes(le.Metrics),traces:e.includes(le.Traces)}),errorMessage:r.exportedSignals}),t(v,{label:"Destination name",placeholder:"Use a name that describes the destination...",value:o.name,onChange:({target:{value:e}})=>i("name",e),errorMessage:r.name}),t(Sl,{signals:ae(o.exportedSignals),fields:n,formData:o,handleFormChange:(e,t)=>{i("fields",o.fields.map(l=>l.key===e?{...l,value:t}:l))},formErrors:r})]})},xl=[{id:ne.FilePath,label:"Collect file path",tooltip:"Indicates whether to record the `code.filepath` attribute."},{id:ne.Function,label:"Collect function",tooltip:"Indicates whether to record the `code.function` attribute."},{id:ne.LineNumber,label:"Collect line number",tooltip:"Indicates whether to record the `code.lineno` attribute."}],Il=[{id:ne.Column,label:"Collect column",tooltip:"Indicates whether to record the `code.column` attribute."},{id:ne.Namespace,label:"Collect namespace",tooltip:"Indicates whether to record the `code.namespace` attribute."},{id:ne.StackTrace,label:"Collect stacktrace",tooltip:"Indicates whether to record the `code.stacktrace` attribute."}],Nl=["*"],Al=[{id:re.HttpRequest,label:"Collect HTTP request",tooltip:""},{id:re.HttpResponse,label:"Collect HTTP response",tooltip:""},{id:re.DbQuery,label:"Collect DB query",tooltip:""},{id:re.Messaging,label:"Collect messaging",tooltip:""}],Tl={[de.Java]:[new ce("","")],[de.Golang]:[new se("")]},Dl={[ue.CodeAttributes]:({value:n,setValue:o,formErrors:i})=>{const r=h(),s=i.codeAttributes,d=c(()=>Object.entries(n.codeAttributes||{}).filter(([e,t])=>!!t).map(([e])=>e),[n]);a(()=>{if(!d.length&&!s){const e={[ne.FilePath]:!0,[ne.Function]:!0,[ne.LineNumber]:!0,[ne.Column]:null,[ne.Namespace]:null,[ne.StackTrace]:null};o("codeAttributes",e)}},[]);const u=(e,t)=>{const l=t?[...d,e]:d.filter(t=>t!==e),a=Object.values(ne).reduce((e,t)=>(e[t]=!!l.includes(t)||null,e),{});o("codeAttributes",a)};return e(l,{children:[e(g,{$gap:12,children:[t(J,{size:K.XS,color:r.v2.colors.silver[200],nowrap:!0,children:"Recommended data to collect"}),t(g,{$gap:6,children:xl.map(({id:e,label:l,tooltip:a})=>t(oe,{text:a,withIcon:!0,children:t(f,{label:l,value:d.includes(e),onChange:t=>u(e,t)})},e))}),t(C,{errorMessage:s})]}),e(g,{$gap:12,children:[t(J,{size:K.XS,color:r.v2.colors.silver[200],nowrap:!0,children:"Verbose data to collect"}),t(g,{$gap:6,children:Il.map(({id:e,label:l,tooltip:a})=>t(oe,{text:a,withIcon:!0,children:t(f,{label:l,value:d.includes(e),onChange:t=>u(e,t)})},e))}),t(C,{errorMessage:s})]})]})},[ue.CustomInstrumentation]:({value:n,setValue:o,formErrors:i})=>{const r=i.customInstrumentations,s=c(()=>(n?.customInstrumentations?.[de.Golang]||[]).map(e=>new se(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)),[n]),d=c(()=>(n?.customInstrumentations?.[de.Java]||[]).map(e=>new ce(e.className,e.methodName)),[n]);return a(()=>{n?.customInstrumentations||r||o("customInstrumentations",{[de.Golang]:Tl[de.Golang],[de.Java]:Tl[de.Java]})},[]),e(l,{children:[e(g,{children:[e(A,{$gap:8,children:[t(Ct,{}),t(b,{label:"Golang custom probes"})]}),t(w,{columns:[{keyName:"packageName",label:"Package name",placeholder:"e.g. github.com/my-org/my-package",tooltip:"The full import path of the package containing the function or method to be instrumented."},{keyName:"functionName",label:"Function name",placeholder:"e.g. myFunction",tooltip:"The name of the function to be instrumented. Leave empty if instrumenting a receiver method."},{keyName:"receiverName",label:"Receiver name",placeholder:"e.g. myReceiver",tooltip:"The name of the receiver type if instrumenting a method. Leave empty if instrumenting a standalone function."},{keyName:"receiverMethodName",label:"Receiver method name",placeholder:"e.g. myMethod",tooltip:"The name of the method to be instrumented. Leave empty if instrumenting a standalone function."}],values:s,setValues:e=>{const t={};t[de.Golang]=e.map(e=>new se(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)),t[de.Java]=d,o("customInstrumentations",t)},errorMessage:r,limitFieldsPerRow:2})]}),e(g,{children:[e(A,{$gap:8,children:[t(vt,{}),t(b,{label:"Java custom probes"})]}),t(w,{columns:[{keyName:"className",label:"Class name",placeholder:"e.g. com.example.MyClass",tooltip:"The name of the class to be instrumented."},{keyName:"methodName",label:"Method name",placeholder:"e.g. myMethod",tooltip:"The name of the method to be instrumented."}],values:d,setValues:e=>{const t={};t[de.Golang]=s,t[de.Java]=e.map(e=>new ce(e.className,e.methodName)),o("customInstrumentations",t)},errorMessage:r,limitFieldsPerRow:2})]})]})},[ue.HeadersCollection]:({value:e,setValue:l,formErrors:n})=>{const o=n.headersCollection,i=c(()=>e?.headersCollection?.[ie.HeaderKeys]||[],[e]),r=e=>{const t={[ie.HeaderKeys]:e};l("headersCollection",t)};return a(()=>{i.length||o||r(Nl)},[]),t(I,{label:"Header keys",tooltip:"Specify which headers you want to collect",helpMessage:"Asterisk (*) will collect all headers",values:i,setValues:r,errorMessage:o})},[ue.PayloadCollection]:({value:l,setValue:n,formErrors:o})=>{const i=h(),r=o.payloadCollection,s=c(()=>Object.entries(l.payloadCollection||{}).filter(([e,t])=>!!t).map(([e])=>e),[l]);return a(()=>{if(!s.length&&!r){const e={[re.HttpRequest]:{},[re.HttpResponse]:{},[re.DbQuery]:{},[re.Messaging]:{}};n("payloadCollection",e)}},[]),e(g,{$gap:12,children:[t(J,{size:K.XS,color:i.v2.colors.silver[200],nowrap:!0,children:"Type of data to collect"}),t(g,{$gap:6,children:Al.map(({id:e,label:l,tooltip:a})=>t(oe,{text:a,withIcon:!0,children:t(f,{label:l,value:s.includes(e),onChange:t=>((e,t)=>{const l=t?[...s,e]:s.filter(t=>t!==e),a={[re.HttpRequest]:l.includes(re.HttpRequest)?{}:null,[re.HttpResponse]:l.includes(re.HttpResponse)?{}:null,[re.DbQuery]:l.includes(re.DbQuery)?{}:null,[re.Messaging]:l.includes(re.Messaging)?{}:null};n("payloadCollection",a)})(e,t)})},e))}),t(C,{errorMessage:r})]})},[ue.UnknownType]:null},Fl=({ruleType:e,value:l,setValue:a,formErrors:n})=>{if(!e)return null;const o=Dl[e];return o?t(o,{value:l,setValue:a,formErrors:n}):null},Ol=({option:l,formData:a,handleFormChange:n,formErrors:o})=>{const i=h();return e(g,{$gap:24,children:[e(A,{$gap:12,$justifyContent:"space-between",children:[t(J,{size:K.XXS,children:l.docsDescription}),t(T,{label:"Docs",leftIcon:bt,variant:F.Text,size:D.S,onClick:()=>window.open(`${U}${l.docsEndpoint}`,"_blank","noopener noreferrer")})]}),e(A,{$gap:12,children:[t(J,{size:K.XS,color:i.v2.colors.silver[200],nowrap:!0,children:"Supported Languages:"}),l.supportedLanguages.map(e=>t(pe,{label:he[e],leftIcon:me(e),status:G.Default,useSecondaryTone:!0},e))]}),t(Y,{options:[{icon:pt,label:"Enabled",value:!1,selectedBgColor:i.v2.colors.green[800]},{icon:ft,label:"Disabled",value:!0,selectedBgColor:i.v2.colors.red[800]}],selected:a.disabled,setSelected:e=>n("disabled",e)}),t(v,{label:"Rule name",placeholder:"Use a name that describes the rule...",value:a.ruleName,onChange:({target:{value:e}})=>n("ruleName",e),errorMessage:o.ruleName}),t(Fl,{ruleType:l.type,value:a,setValue:(e,t)=>n(e,t),formErrors:o}),t(X,{label:"Notes",placeholder:"Your personal notes...",value:a.notes,onChange:({target:{value:e}})=>n("notes",e),errorMessage:o.notes})]})},Vl={type:"",disabled:!1,name:"",notes:"",signals:[],fields:{}},Ml=p.div`
55
+ `,Il=r(({isOpen:l,onClose:a,onBack:n,onNext:i,nextIsSkip:r,onSave:c,disableSave:d,connectionIds:u,header:p,subHeader:h,leftColumn:m,rightColumn:g,search:b,filters:f,errorMessage:C,isFormDirty:y,hideDirtyNote:v,isFetching:k,progress:w},S)=>{const[$,x]=o(!1),[I,N]=o(!1),[D,V]=o(void 0);s(S,()=>({clearErrors:()=>V(void 0)}));const F=I,R=()=>{y&&!$?x(!0):(x(!1),a?.())},M=d||I||"boolean"==typeof y&&!y,P=!!b||!!u||!!f,L=!!h,E=(P?48:0)+(L?50:0);return e(q,{width:yl,isOpen:l,hideOverlay:!I,header:{...p,onClose:a?R:void 0,onCloseDisabled:F},children:[I?t(z,{$height:"calc(100vh - 136px)",children:t($l,{children:t(H,{titleSize:K.S,subTitleSize:K.XXXS,withGradient:!0,withSpinner:!0,...w})})}):e(vl,{children:[P&&e(kl,{children:[u&&t(B,{icon:ft,title:"Selected Clusters",badge:{label:u.value.length}}),b&&t(W,{width:"100%",...b}),f]}),L&&t(wl,{children:t(B,{icon:h.icon,title:h.title,subTitle:h.description,badge:h.badge})}),e(Sl,{children:[t(Cl,{isLeft:!0,heightOffset:E,...m}),t(Cl,{isRight:!0,heightOffset:E,...g})]})]}),e(xl,{children:[k?t(H,{icon:Ct,title:"Fetching Data...",titleSize:K.XXS,withGradient:!0}):I?w?null:t(H,{icon:Ct,title:"Saving Changes...",titleSize:K.XXS,withGradient:!0}):D||C?t(_,{fullWidth:!0,status:G.Error,message:D||C}):"boolean"==typeof y&&y&&!v?t(_,{fullWidth:!0,status:G.Info,message:'The values don\'t reflect the current configurations of the selected clusters.\n"Save" will override the current configurations.'}):"boolean"!=typeof y||y||v?null:t(_,{fullWidth:!0,status:G.Success,message:"The values reflect the current configuration of the selected cluster."}),e(T,{$gap:8,children:[t("div",n?{style:{width:"150px"},children:t(A,{fullWidth:!0,variant:O.Secondary,label:"Back",leftIcon:yt,onClick:n})}:{style:{width:"150px"},children:t(A,{fullWidth:!0,variant:O.Secondary,label:"Cancel",onClick:R,disabled:F})}),t("div",i?{style:{width:"150px"},children:t(A,r?{fullWidth:!0,variant:O.Secondary,label:"Skip",rightIcon:vt,onClick:i}:{fullWidth:!0,variant:O.Primary,label:"Next",rightIcon:vt,onClick:i})}:{style:{width:"150px"},children:t(A,{fullWidth:!0,variant:O.Primary,label:"Save",onClick:async()=>{N(!0);const e=await c();N(!1),e?.error?V(e.error):(u?.setValue([]),a?.())},disabled:M})})]})]}),t(dl,{isOpen:$,onClose:()=>x(!1),onApprove:R})]})});Il.displayName=Il.name;const Nl=({option:l,formData:a,handleFormChange:n,formErrors:o})=>{const i=h();return e(g,{$gap:24,children:[e(T,{$gap:12,$justifyContent:"space-between",children:[t(J,{size:K.XXS,children:l.docsDescription}),t(A,{label:"Docs",leftIcon:kt,variant:O.Text,size:D.S,onClick:()=>window.open(`${U}${l.docsEndpoint}`,"_blank","noopener noreferrer")})]}),t(Y,{options:[{icon:ft,label:"Enabled",value:!1,selectedBgColor:i.v2.colors.green[800]},{icon:wt,label:"Disabled",value:!0,selectedBgColor:i.v2.colors.red[800]}],selected:a.disabled,setSelected:e=>n("disabled",e)}),t(hl,{title:"Signals for processing",allowedSignals:l.allowedSignals,selectedSignals:a.signals||[],setSelectedSignals:e=>n("signals",e),errorMessage:o.signals}),t(y,{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(cl,{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})]})},Tl=({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,k=n.fields.find(e=>e.key===v),S=k?k.value:h;switch(r){case V.Input:return t(y,{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(w,{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(C,{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}}),Al=({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(T,{$gap:12,$justifyContent:"space-between",children:[t("div",{}),t(A,{label:"Docs",leftIcon:kt,variant:O.Text,size:D.S,onClick:()=>window.open(`${U}/backends/${l.type}`,"_blank","noopener noreferrer")})]}),t(Y,{options:[{icon:ft,label:"Enabled",value:!1,selectedBgColor:s.v2.colors.green[800]},{icon:wt,label:"Disabled",value:!0,selectedBgColor:s.v2.colors.red[800]}],selected:o.disabled,setSelected:e=>i("disabled",e)}),t(hl,{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(y,{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(Tl,{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})]})},Dl=[{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."}],Ol=[{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."}],Vl=["*"],Fl=[{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:""}],Rl={[de.Java]:[new ce("","")],[de.Golang]:[new se("")]},Ml={[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:Dl.map(({id:e,label:l,tooltip:a})=>t(oe,{text:a,withIcon:!0,children:t(f,{label:l,value:d.includes(e),onChange:t=>u(e,t)})},e))}),t(C,{errorMessage:s})]}),e(g,{$gap:12,children:[t(J,{size:K.XS,color:r.v2.colors.silver[200],nowrap:!0,children:"Verbose data to collect"}),t(g,{$gap:6,children:Ol.map(({id:e,label:l,tooltip:a})=>t(oe,{text:a,withIcon:!0,children:t(f,{label:l,value:d.includes(e),onChange:t=>u(e,t)})},e))}),t(C,{errorMessage:s})]})]})},[ue.CustomInstrumentation]:({value:n,setValue:o,formErrors:i})=>{const r=i.customInstrumentations,s=c(()=>(n?.customInstrumentations?.[de.Golang]||[]).map(e=>new se(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)),[n]),d=c(()=>(n?.customInstrumentations?.[de.Java]||[]).map(e=>new ce(e.className,e.methodName)),[n]);return a(()=>{n?.customInstrumentations||r||o("customInstrumentations",{[de.Golang]:Rl[de.Golang],[de.Java]:Rl[de.Java]})},[]),e(l,{children:[e(g,{children:[e(T,{$gap:8,children:[t(St,{}),t(b,{label:"Golang custom probes"})]}),t(w,{columns:[{keyName:"packageName",label:"Package name",placeholder:"e.g. github.com/my-org/my-package",tooltip:"The full import path of the package containing the function or method to be instrumented."},{keyName:"functionName",label:"Function name",placeholder:"e.g. myFunction",tooltip:"The name of the function to be instrumented. Leave empty if instrumenting a receiver method."},{keyName:"receiverName",label:"Receiver name",placeholder:"e.g. myReceiver",tooltip:"The name of the receiver type if instrumenting a method. Leave empty if instrumenting a standalone function."},{keyName:"receiverMethodName",label:"Receiver method name",placeholder:"e.g. myMethod",tooltip:"The name of the method to be instrumented. Leave empty if instrumenting a standalone function."}],values:s,setValues:e=>{const t={};t[de.Golang]=e.map(e=>new se(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)),t[de.Java]=d,o("customInstrumentations",t)},errorMessage:r,limitFieldsPerRow:2})]}),e(g,{children:[e(T,{$gap:8,children:[t($t,{}),t(b,{label:"Java custom probes"})]}),t(w,{columns:[{keyName:"className",label:"Class name",placeholder:"e.g. com.example.MyClass",tooltip:"The name of the class to be instrumented."},{keyName:"methodName",label:"Method name",placeholder:"e.g. myMethod",tooltip:"The name of the method to be instrumented."}],values:d,setValues:e=>{const t={};t[de.Golang]=s,t[de.Java]=e.map(e=>new ce(e.className,e.methodName)),o("customInstrumentations",t)},errorMessage:r,limitFieldsPerRow:2})]})]})},[ue.HeadersCollection]:({value:e,setValue:l,formErrors:n})=>{const o=n.headersCollection,i=c(()=>e?.headersCollection?.[ie.HeaderKeys]||[],[e]),r=e=>{const t={[ie.HeaderKeys]:e};l("headersCollection",t)};return a(()=>{i.length||o||r(Vl)},[]),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:Fl.map(({id:e,label:l,tooltip:a})=>t(oe,{text:a,withIcon:!0,children:t(f,{label:l,value:s.includes(e),onChange:t=>((e,t)=>{const l=t?[...s,e]:s.filter(t=>t!==e),a={[re.HttpRequest]:l.includes(re.HttpRequest)?{}:null,[re.HttpResponse]:l.includes(re.HttpResponse)?{}:null,[re.DbQuery]:l.includes(re.DbQuery)?{}:null,[re.Messaging]:l.includes(re.Messaging)?{}:null};n("payloadCollection",a)})(e,t)})},e))}),t(C,{errorMessage:r})]})},[ue.UnknownType]:null},Pl=({ruleType:e,value:l,setValue:a,formErrors:n})=>{if(!e)return null;const o=Ml[e];return o?t(o,{value:l,setValue:a,formErrors:n}):null},Ll=({option:l,formData:a,handleFormChange:n,formErrors:o})=>{const i=h();return e(g,{$gap:24,children:[e(T,{$gap:12,$justifyContent:"space-between",children:[t(J,{size:K.XXS,children:l.docsDescription}),t(A,{label:"Docs",leftIcon:kt,variant:O.Text,size:D.S,onClick:()=>window.open(`${U}${l.docsEndpoint}`,"_blank","noopener noreferrer")})]}),e(T,{$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:ft,label:"Enabled",value:!1,selectedBgColor:i.v2.colors.green[800]},{icon:wt,label:"Disabled",value:!0,selectedBgColor:i.v2.colors.red[800]}],selected:a.disabled,setSelected:e=>n("disabled",e)}),t(y,{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(Pl,{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})]})},El={type:"",disabled:!1,name:"",notes:"",signals:[],fields:{}},zl=p.div`
56
56
  display: flex;
57
57
  align-items: center;
58
58
  justify-content: space-between;
@@ -60,36 +60,37 @@ import{jsxs as e,jsx as t,Fragment as l}from"react/jsx-runtime";import{useEffect
60
60
  padding: 8px 12px;
61
61
  border-radius: 12px;
62
62
  background-color: ${({$isSelected:e,$purpleColors:t,theme:l})=>e?t?l.v2.colors.purple[800]:l.v2.colors.silver[600]:t?l.v2.colors.purple[900]:"transparent"};
63
- cursor: pointer;
63
+ cursor: ${({$disabled:e})=>e?"not-allowed":"pointer"};
64
+ opacity: ${({$disabled:e})=>e?.5:1};
64
65
  &:hover {
65
66
  background-color: ${({$isSelected:e,$purpleColors:t,theme:l})=>e?t?l.v2.colors.purple[700]:l.v2.colors.silver[600]:t?l.v2.colors.purple[800]:l.v2.colors.silver[700]};
66
67
  }
67
- `,Rl=p.div`
68
+ `,jl=p.div`
68
69
  display: flex;
69
70
  align-items: center;
70
71
  justify-content: center;
71
72
  padding: 8px;
72
73
  border-radius: 8px;
73
74
  background-color: ${({theme:e})=>e.v2.colors.white[500]+ge["004"]};
74
- `,Pl=({icon:l,title:a,description:n,withCarret:o,purpleColors:i,children:r,isSelected:s,onClick:c,isChecked:d,isPartiallyChecked:u,onCheckboxChange:p})=>{const m=h();return e(Ml,{$isSelected:s,$purpleColors:i,onClick:()=>!s&&c(),children:[e(g,{$gap:4,children:[e(A,{$gap:12,children:[p&&t(f,{partiallyChecked:u||!1,value:d||!1,onChange:e=>p(e)}),l&&t(Rl,{children:t(l,{size:20})}),t(J,{size:K.XS,children:a})]}),n&&t(J,{size:K.XXXS,color:m.v2.colors.silver[200],children:n})]}),(o||r)&&e(A,{$gap:8,children:[r,o&&t(yt,{size:18})]})]})},Ll=p.div`
75
+ `,ql=({icon:l,title:a,description:n,withCarret:o,purpleColors:i,disabled:r,children:s,isSelected:c,onClick:d,isChecked:u,isPartiallyChecked:p,onCheckboxChange:m})=>{const b=h();return e(zl,{$isSelected:c,$purpleColors:i,$disabled:r,onClick:()=>!c&&!r&&d(),children:[e(g,{$gap:4,children:[e(T,{$gap:12,children:[m&&t(f,{partiallyChecked:p||!1,value:u||!1,onChange:e=>m(e)}),l&&t(jl,{children:t(l,{size:20})}),t(J,{size:K.XS,children:a})]}),n&&t(J,{size:K.XXXS,color:b.v2.colors.silver[200],children:n})]}),(o||s)&&e(T,{$gap:8,children:[s,o&&t(xt,{size:18})]})]})},Hl=p.div`
75
76
  display: flex;
76
77
  align-items: center;
77
78
  gap: 8px;
78
79
  padding: 8px;
79
- `,El=({onClose:l,selectedConnectionIds:a,setSelectedConnectionIds:n,createAction:r})=>{const s=h(),[d,u]=o(""),[p,m]=o(null),g=c(()=>(d?be.filter(e=>e?.label?.toLowerCase().includes(d.toLowerCase())):be).filter(e=>!!e),[d]),b=c(()=>(d?fe.filter(e=>e?.label?.toLowerCase().includes(d.toLowerCase())):fe).filter(e=>!!e),[d]),f=Ce(Vl),C=i(null),v=c(()=>{const l=(l,a)=>e(Ll,{children:[t(J,{size:K.XS,color:s.v2.colors.silver[200],children:l}),t(pe,{label:a.toString()})]},l),a=e=>{const l=p?.type===e.type;return t(Pl,{title:e.label,description:e.description,withCarret:!0,isSelected:l,onClick:()=>{C.current?.clearErrors(),f.resetFormData(),f.handleFormChange("type",e.type),m(e)}},e.type)};return[l("Attributes",g.length),...g.map(a),l("Samplers",b.length),...b.map(a)]},[s,p?.type,g.length,b.length,f]),y=c(()=>p?[t(wl,{option:p,...f},p?.type)]:[t(z,{$height:"100%",children:t(j,{icon:kt,title:"Action not selected",subTitle:"Please select an action to add"})},"no-data")],[p,f]);return t(kl,{ref:C,isOpen:!0,onClose:l,onSave:async()=>{const{isOk:e,preparedFormData:t}=((e,t)=>{if(!e)return{isOk:!1,preparedFormData:R(Vl)};const l=(a=t.formData,R(a));var a;const n={};return t.handleErrorChange(void 0,void 0,n),{isOk:0===Object.keys(n).length,preparedFormData:l}})(p,f);return e?await r(t):Promise.resolve({error:"Invalid form values"})},disableSave:!p||!f.isFormDirty,isFormDirty:f.isFormDirty,hideDirtyNote:!0,progress:{title:ve.CREATING_ACTION,subTitle:ve.CREATING_ACTION_SUBTITLE},header:{icon:kt,title:ve.ADD_ACTION,subTitle:ve.ADD_ACTION_DESCRIPTION},connectionIds:{value:a,setValue:n},search:{value:d,onChange:u},leftColumn:{width:"40%",list:v},rightColumn:{width:"60%",list:y}})},zl=({selectedArea:e,genericForm:l})=>({width:"60%",list:e?[t($l,{option:e.option,dynamicFields:e.dynamicFields,...l},e?.option.type)]:[t(z,{$height:"100%",children:t(j,{icon:wt,title:"Select destination from the list",subTitle:"Add destination so your data has somewhere to go."})},"no-data")]});var jl;!function(e){e.SELF_HOSTED="self hosted",e.MANAGED="managed"}(jl||(jl={}));const ql=e=>({type:"",disabled:!1,name:"",currentStreamName:e,exportedSignals:{logs:!1,metrics:!1,traces:!1},fields:[]}),Hl=p.div`
80
+ `,Kl=({onClose:l,selectedConnectionIds:a,setSelectedConnectionIds:n,createAction:r})=>{const s=h(),[d,u]=o(""),[p,m]=o(null),g=c(()=>(d?be.filter(e=>e?.label?.toLowerCase().includes(d.toLowerCase())):be).filter(e=>!!e),[d]),b=c(()=>(d?fe.filter(e=>e?.label?.toLowerCase().includes(d.toLowerCase())):fe).filter(e=>!!e),[d]),f=Ce(El),C=i(null),y=c(()=>{const l=(l,a)=>e(Hl,{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(ql,{title:e.label,description:e.description,withCarret:!0,isSelected:l,onClick:()=>{C.current?.clearErrors(),f.resetFormData(),f.handleFormChange("type",e.type),m(e)}},e.type)};return[l("Attributes",g.length),...g.map(a),l("Samplers",b.length),...b.map(a)]},[s,p?.type,g.length,b.length,f]),v=c(()=>p?[t(Nl,{option:p,...f},p?.type)]:[t(z,{$height:"100%",children:t(j,{icon:It,title:"Action not selected",subTitle:"Please select an action to add"})},"no-data")],[p,f]);return t(Il,{ref:C,isOpen:!0,onClose:l,onSave:async()=>{const{isOk:e,preparedFormData:t}=((e,t)=>{if(!e)return{isOk:!1,preparedFormData:M(El)};const l=(a=t.formData,M(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:ye.CREATING_ACTION,subTitle:ye.CREATING_ACTION_SUBTITLE},header:{icon:It,title:ye.ADD_ACTION,subTitle:ye.ADD_ACTION_DESCRIPTION},connectionIds:{value:a,setValue:n},search:{value:d,onChange:u},leftColumn:{width:"40%",list:y},rightColumn:{width:"60%",list:v}})},Bl=({selectedArea:e,genericForm:l})=>({width:"60%",list:e?[t(Al,{option:e.option,dynamicFields:e.dynamicFields,...l},e?.option.type)]:[t(z,{$height:"100%",children:t(j,{icon:Nt,title:"Select destination from the list",subTitle:"Add destination so your data has somewhere to go."})},"no-data")]});var Wl;!function(e){e.SELF_HOSTED="self hosted",e.MANAGED="managed"}(Wl||(Wl={}));const _l=e=>({type:"",disabled:!1,name:"",currentStreamName:e,exportedSignals:{logs:!1,metrics:!1,traces:!1},fields:[]}),Gl=p.div`
80
81
  display: flex;
81
82
  flex-direction: column;
82
83
  padding: 8px;
83
84
  border-radius: 16px;
84
85
  border: ${({$purpleColors:e,theme:t})=>e?`1px solid ${t.v2.colors.purple[500]}`:"1px solid transparent"};
85
86
  background-color: ${({$noBgColor:e,$purpleColors:t,theme:l})=>e?"transparent":t?l.v2.colors.purple[900]:l.v2.colors.silver[800]};
86
- `,Kl=p.div`
87
+ `,Jl=p.div`
87
88
  display: flex;
88
89
  align-items: center;
89
90
  justify-content: space-between;
90
91
  gap: 12px;
91
92
  padding: ${({$isOpen:e})=>e?"2px 12px 8px 12px":"2px 12px"};
92
- `,Bl=({title:l,tooltip:a,list:n,noBgColor:i,purpleColors:r})=>{const[s,c]=o(!0);return e(Hl,{$noBgColor:i,$purpleColors:r,children:[e(Kl,{$isOpen:s,children:[e(A,{$gap:10,children:[t(J,{size:K.XS,children:l}),a&&t(oe,{text:a,withIcon:!0}),t(pe,{label:n.length,status:r?G.Default:void 0})]}),t(ke,{icon:s?St:$t,size:we.M,onClick:()=>c(e=>!e)})]}),s?t(g,{children:n.length?d.toArray(n):t(z,{$padding:"12px 0",children:t(j,{})})}):null]})},Wl=(e,t,l)=>t||l.signalType?e.filter(e=>e.displayName.toLowerCase().includes(t.toLowerCase())&&(!l.signalType||te(e.supportedSignals).includes(l.signalType))):e,_l=({listType:e,dest:l,isSelected:a,onSelect:n})=>t(Pl,{icon:xe(l.type).icon,title:l.displayName,withCarret:!0,isSelected:a,onClick:()=>{n()}},`${e}-${l.type}`),Gl=({listType:e,destinations:l,selectedArea:a,onSelect:n})=>t(Bl,{title:$e[e].TITLE,tooltip:$e[e].DESCRIPTION,list:l.map(l=>t(_l,{listType:e,dest:l,isSelected:a?.option.type===l.type&&a?.listType===e,onSelect:()=>{return n({listType:e,option:l,dynamicFields:(t=l.fields,t.filter(e=>!!e).map(e=>{const{name:t,componentType:l,componentProperties:a,displayName:n,initialValue:o,renderCondition:i}=e,r=l===O.Dropdown,s=ee(a,{});return{componentType:l,renderCondition:i,name:t,title:n,value:o,placeholder:s.placeholder||(r?"Select an option":void 0),options:r&&Array.isArray(s.values)?s.values.map(e=>({id:e,value:e})):void 0,...s}}))});var t}},`${e}-${l.type}`))},e),Jl=({isFetching:e,destinationsByCategory:l,searchText:a,filters:n,selectedArea:o,onSelect:i})=>{const r=c(()=>{const e=[];for(const r of Object.values(Se)){if(n.categoryType&&n.categoryType!==r)continue;const s=Wl(l[r],a,n);s.length&&e.push(t(Gl,{listType:r,destinations:s,selectedArea:o,onSelect:i},r))}return e},[l,a,n,o,i]);return{width:"40%",list:r.length?r:e?[t(z,{$height:"100%",children:t(H,{title:"Fetching destinations",subTitle:"Please wait while we fetch the destinations",withSpinner:!0})},"loading")]:[]}},Ul=({destinationsByCategory:a,filters:n,setFilters:o})=>{const i=c(()=>Object.values(Se).map(e=>({id:e,label:e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()})).filter(e=>a[e.id]?.length),[a]),r=c(()=>{const e=Object.values(le).map(e=>({value:e,label:e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}));return e.unshift({value:null,label:"All"}),e},[]);return e(l,{children:[t(Q,{placeholder:"Select category",options:i,values:n.categoryType?[n.categoryType]:[],setValues:e=>o({...n,categoryType:n.categoryType===e[0]?null:e[0]})}),t(Y,{size:Ie.S,options:r,selected:n.signalType,setSelected:e=>o({...n,signalType:e})})]})},Yl=({onClose:e,selectedConnectionIds:l,setSelectedConnectionIds:n,getDestinationCategories:r,getPotentialDestinations:s,createDestination:c})=>{const[d,p]=o(""),[h,m]=o({categoryType:null,signalType:null}),[g,b]=o(null),[f,C]=o(!0),[v,y]=o({[Se.ALL]:[],[Se.EXISTS]:[],[Se.DETECTED]:[],[Se.SELF_HOSTED]:[],[Se.MANAGED]:[]}),w=u(async()=>{try{C(!0);const[e,t]=await Promise.all([r(),s()]),{detectedDestinations:l,selfHostedDestinations:a,managedDestinations:n}=((e,t)=>{const l=[],a=[],n=[];return e&&e.destinationCategories.categories.forEach(e=>{e.name===jl.SELF_HOSTED?a.push(...e.items):e.name===jl.MANAGED&&n.push(...e.items)}),t&&t?.potentialDestinations.forEach(t=>{for(const a of e?.destinationCategories?.categories||[]){const e=R(a),n=e.items.findIndex(e=>e.type===t.type);if(-1!==n){const a=ee(t.fields,[]);a.length&&(e.items[n].fields=e.items[n].fields.map(e=>{const t=a.find(t=>t.name===e.name)?.initialValue;return{...e,initialValue:t}}),l.push(e.items[n]))}}}),{detectedDestinations:l,selfHostedDestinations:a,managedDestinations:n}})(e,t);y(e=>({...e,[Se.DETECTED]:l,[Se.SELF_HOSTED]:a,[Se.MANAGED]:n}))}catch(e){}finally{C(!1)}},[]);a(()=>{w()},[]);const{selectedStreamName:S}=Ne(),$=Ce(ql(S)),x=i(null);return t(kl,{ref:x,isOpen:!0,onClose:e,onSave:async()=>{const{isOk:e,preparedFormData:t}=((e,t)=>{if(!e)return{isOk:!1,preparedFormData:R(ql(t.formData.currentStreamName))};const l=R(t.formData),a={};return e.dynamicFields.forEach(({name:e,required:t})=>{if(t){const t=l.fields.find(t=>t.key===e)?.value;k(t)&&(a[e]=ye.FIELD_IS_REQUIRED)}}),ae(l.exportedSignals).length||(a.exportedSignals=ye.FIELD_IS_REQUIRED),t.handleErrorChange(void 0,void 0,a),{isOk:0===Object.keys(a).length,preparedFormData:l}})(g,$);return e?await c(t):Promise.resolve({error:"Invalid form values"})},disableSave:!g,isFetching:f,isFormDirty:$.isFormDirty,hideDirtyNote:!0,progress:{title:ve.CREATING_DESTINATION,subTitle:ve.CREATING_DESTINATION_SUBTITLE},header:{icon:wt,title:ve.ADD_DESTINATIONS,subTitle:ve.ADD_DESTINATION_DRAWER_DESCRIPTION},connectionIds:{value:l,setValue:n},search:{value:d,onChange:p},filters:t(Ul,{destinationsByCategory:v,filters:h,setFilters:m}),leftColumn:Jl({isFetching:f,destinationsByCategory:v,searchText:d,filters:h,selectedArea:g,onSelect:e=>{$.resetFormData(),x.current?.clearErrors(),b(e)}}),rightColumn:zl({selectedArea:g,genericForm:$})})},Xl={disabled:!1,ruleName:"",notes:"",workloads:null,instrumentationLibraries:null,payloadCollection:null,codeAttributes:null,headersCollection:null,customInstrumentations:null},Zl=({onClose:e,selectedConnectionIds:l,setSelectedConnectionIds:a,createInstrumentationRule:n})=>{const[r,s]=o(""),[d,u]=o(null),p=c(()=>r?Ae.filter(e=>e.label.toLowerCase().includes(r.toLowerCase())):Ae,[r]),h=Ce(Xl),m=i(null),g=c(()=>p.map(e=>{const l=d?.type===e.type;return t(Pl,{title:e.label,description:e.description,withCarret:!0,isSelected:l,onClick:()=>{h.resetFormData(),m.current?.clearErrors(),u(e)}},e.type)}),[d,p.length,h]),b=c(()=>d?[t(Ol,{option:d,...h},d?.type)]:[t(z,{$height:"100%",children:t(j,{icon:xt,title:"Instrumentation rule not selected",subTitle:"Please select an instrumentation rule to add"})},"no-data")],[d,h]);return t(kl,{ref:m,isOpen:!0,onClose:e,onSave:async()=>{const{isOk:e,preparedFormData:t}=((e,t)=>{if(!e)return{isOk:!1,preparedFormData:R(Xl)};const l=(e=>{const t=R(e);return t.headersCollection?.[ie.HeaderKeys]?.length&&(t.headersCollection[ie.HeaderKeys]=t.headersCollection[ie.HeaderKeys].map(e=>e.trim()).filter(e=>e)),t.customInstrumentations?.[de.Golang]?.length&&(t.customInstrumentations[de.Golang]=t.customInstrumentations[de.Golang].map(e=>new se(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)).filter(e=>e.Verify())),t.customInstrumentations?.[de.Java]?.length&&(t.customInstrumentations[de.Java]=t.customInstrumentations[de.Java].map(e=>new ce(e.className,e.methodName)).filter(e=>e.Verify())),t})(t.formData),a={};switch(e.type){case ue.CodeAttributes:Object.values(l.codeAttributes||{}).some(e=>null!=e)||(a.codeAttributes="Code attributes are required");break;case ue.PayloadCollection:Object.values(l.payloadCollection||{}).some(e=>null!=e)||(a.payloadCollection="Payload collection are required");break;case ue.HeadersCollection:l.headersCollection?.[ie.HeaderKeys]?.length||(a.headersCollection="Header keys are required");break;case ue.CustomInstrumentation:l.customInstrumentations?.[de.Golang]?.length||l.customInstrumentations?.[de.Java]?.length||(a.customInstrumentations="Custom instrumentation are required")}return t.handleErrorChange(void 0,void 0,a),{isOk:0===Object.keys(a).length,preparedFormData:l}})(d,h);return e?await n(t):Promise.resolve({error:"Invalid form values"})},disableSave:!d||!h.isFormDirty,isFormDirty:h.isFormDirty,hideDirtyNote:!0,progress:{title:ve.CREATING_INSTRUMENTATION_RULE,subTitle:ve.CREATING_INSTRUMENTATION_RULE_SUBTITLE},header:{icon:xt,title:ve.ADD_INSTRUMENTATION_RULE,subTitle:ve.ADD_INSTRUMENTATION_RULE_DESCRIPTION},connectionIds:{value:l,setValue:a},search:{value:r,onChange:s},leftColumn:{width:"40%",list:g},rightColumn:{width:"60%",list:b}})},Ql=e=>{const t=e.workloads.filter(({selected:e})=>e).length,l=e.workloads.length;return{selectedCount:t,isAllSourced:t>0&&t===l,isSomeSourced:t>0&&t<l,isFutureApps:e.selected||!1}},ea=(e,t,l)=>{if(t&&!e.name.toLowerCase().includes(t.toLowerCase()))return!1;if(l.showOnlySelected){const{isAllSourced:t,isSomeSourced:l,isFutureApps:a}=Ql(e);return t||l||a}return!0},ta=(e,t,l)=>!(t&&!e.name.toLowerCase().includes(t.toLowerCase()))&&(!l.showOnlySelected||e.selected),la=p.div``,aa=p.div`
93
+ `,Ul=({title:l,tooltip:a,list:n,noBgColor:i,purpleColors:r})=>{const[s,c]=o(!0);return e(Gl,{$noBgColor:i,$purpleColors:r,children:[e(Jl,{$isOpen:s,children:[e(T,{$gap:10,children:[t(J,{size:K.XS,children:l}),a&&t(oe,{text:a,withIcon:!0}),t(pe,{label:n.length,status:r?G.Default:void 0})]}),t(ke,{icon:s?Tt:At,size:we.M,onClick:()=>c(e=>!e)})]}),s?t(g,{children:n.length?d.toArray(n):t(z,{$padding:"12px 0",children:t(j,{})})}):null]})},Yl=(e,t,l)=>t||l.signalType?e.filter(e=>e.displayName.toLowerCase().includes(t.toLowerCase())&&(!l.signalType||te(e.supportedSignals).includes(l.signalType))):e,Xl=({listType:e,dest:l,isSelected:a,onSelect:n})=>t(ql,{icon:xe(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(Ul,{title:$e[e].TITLE,tooltip:$e[e].DESCRIPTION,list:l.map(l=>t(Xl,{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),Ql=({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=Yl(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(z,{$height:"100%",children:t(H,{title:"Fetching destinations",subTitle:"Please wait while we fetch the destinations",withSpinner:!0})},"loading")]:[]}},ea=({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})})]})},ta=({onClose:e,selectedConnectionIds:l,setSelectedConnectionIds:n,getDestinationCategories:r,getPotentialDestinations:s,createDestination:c})=>{const[d,p]=o(""),[h,m]=o({categoryType:null,signalType:null}),[g,b]=o(null),[f,C]=o(!0),[y,v]=o({[Se.ALL]:[],[Se.EXISTS]:[],[Se.DETECTED]:[],[Se.SELF_HOSTED]:[],[Se.MANAGED]:[]}),w=u(async()=>{try{C(!0);const[e,t]=await Promise.all([r(),s()]),{detectedDestinations:l,selfHostedDestinations:a,managedDestinations:n}=((e,t)=>{const l=[],a=[],n=[];return e&&e.destinationCategories.categories.forEach(e=>{e.name===Wl.SELF_HOSTED?a.push(...e.items):e.name===Wl.MANAGED&&n.push(...e.items)}),t&&t?.potentialDestinations.forEach(t=>{for(const a of e?.destinationCategories?.categories||[]){const e=M(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{C(!1)}},[]);a(()=>{w()},[]);const{selectedStreamName:S}=Ne(),$=Ce(_l(S)),x=i(null);return t(Il,{ref:x,isOpen:!0,onClose:e,onSave:async()=>{const{isOk:e,preparedFormData:t}=((e,t)=>{if(!e)return{isOk:!1,preparedFormData:M(_l(t.formData.currentStreamName))};const l=M(t.formData),a={};return e.dynamicFields.forEach(({name:e,required:t})=>{if(t){const t=l.fields.find(t=>t.key===e)?.value;k(t)&&(a[e]=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:ye.CREATING_DESTINATION,subTitle:ye.CREATING_DESTINATION_SUBTITLE},header:{icon:Nt,title:ye.ADD_DESTINATIONS,subTitle:ye.ADD_DESTINATION_DRAWER_DESCRIPTION},connectionIds:{value:l,setValue:n},search:{value:d,onChange:p},filters:t(ea,{destinationsByCategory:y,filters:h,setFilters:m}),leftColumn:Ql({isFetching:f,destinationsByCategory:y,searchText:d,filters:h,selectedArea:g,onSelect:e=>{$.resetFormData(),x.current?.clearErrors(),b(e)}}),rightColumn:Bl({selectedArea:g,genericForm:$})})},la={disabled:!1,ruleName:"",notes:"",workloads:null,instrumentationLibraries:null,payloadCollection:null,codeAttributes:null,headersCollection:null,customInstrumentations:null},aa=({onClose:e,selectedConnectionIds:l,setSelectedConnectionIds:a,createInstrumentationRule:n})=>{const[r,s]=o(""),[d,u]=o(null),p=c(()=>r?Te.filter(e=>e.label.toLowerCase().includes(r.toLowerCase())):Te,[r]),h=Ce(la),m=i(null),g=c(()=>p.map(e=>{const l=d?.type===e.type;return t(ql,{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(Ll,{option:d,...h},d?.type)]:[t(z,{$height:"100%",children:t(j,{icon:Dt,title:"Instrumentation rule not selected",subTitle:"Please select an instrumentation rule to add"})},"no-data")],[d,h]);return t(Il,{ref:m,isOpen:!0,onClose:e,onSave:async()=>{const{isOk:e,preparedFormData:t}=((e,t)=>{if(!e)return{isOk:!1,preparedFormData:M(la)};const l=(e=>{const t=M(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:ye.CREATING_INSTRUMENTATION_RULE,subTitle:ye.CREATING_INSTRUMENTATION_RULE_SUBTITLE},header:{icon:Dt,title:ye.ADD_INSTRUMENTATION_RULE,subTitle:ye.ADD_INSTRUMENTATION_RULE_DESCRIPTION},connectionIds:{value:l,setValue:a},search:{value:r,onChange:s},leftColumn:{width:"40%",list:g},rightColumn:{width:"60%",list:b}})},na=p.div``,oa=p.div`
93
94
  visibility: hidden;
94
95
 
95
96
  transition: visibility 0s;
@@ -97,19 +98,19 @@ import{jsxs as e,jsx as t,Fragment as l}from"react/jsx-runtime";import{useEffect
97
98
  transition-duration: 0s;
98
99
  }
99
100
 
100
- ${la}:hover & {
101
+ ${na}:hover & {
101
102
  visibility: visible;
102
103
  }
103
- `,na=({workloadName:e,workloadKind:l,isChecked:a,onToggle:n})=>{const o=h();return t(la,{children:t(Pl,{title:e,onClick:n,isChecked:a,onCheckboxChange:n,children:t(aa,{children:t(pe,{label:l,status:G.Info,textSize:K.XXXS,backgroundColor:o.v2.colors.blue[900]})})})})},oa=({formData:l,handleSourceChange:a,handleSelectAll:n,selectedArea:o,searchText:i,filters:r})=>{const s=c(()=>o.value.clusterId&&o.value.namespaceName?l.find(({clusterId:e})=>e===o.value.clusterId)?.namespaces.find(({name:e})=>e===o.value.namespaceName):void 0,[l,o.value.clusterId,o.value.namespaceName]),d=c(()=>s?[...s.workloads].sort((e,t)=>e.name.localeCompare(t.name)).filter(e=>ta(e,i,r)):[],[s,i,r]),u=c(()=>!!d.length&&d.every(({selected:e})=>e),[d]),p=c(()=>{if(!s)return[];const{clusterId:e}=o.value,{name:l}=s;return d.map(({name:n,selected:o,kind:i})=>t(na,{workloadName:n,workloadKind:i,isChecked:o||!1,onToggle:()=>a({clusterId:e,workloadId:{namespace:l,name:n,kind:i}})},`${e}#${l}#${n}#${i}`))},[d,s,o.value.clusterId]),{withFilterCount:h,filteredCount:m,totalCount:g}=c(()=>{const e=s?.workloads.length??0;return{withFilterCount:d.length!==e,filteredCount:d.length,totalCount:e}},[d,s]);return{width:"40%",header:e(A,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(A,{$gap:8,children:[t(J,{size:K.XS,nowrap:!0,children:o.value.namespaceName?`${o.value.namespaceName} > Workloads`:"Workloads"}),t(oe,{text:h?ve.FILTERED_COUNT_TOOLTIP:void 0,children:t(pe,{label:`${h?`${m} / ${g}`:g}`,status:Te.Unknown})})]}),t(J,{onClick:()=>n({clusterId:o.value.clusterId,namespaceName:o.value.namespaceName,boolean:!u}),disabled:!p.length,size:K.XS,children:(u?"Unselect":"Select")+" all"})]}),list:s?p:[t(z,{$height:"100%",children:t(j,{icon:It,title:ve.SELECT_NAMESPACE,subTitle:ve.SELECT_NAMESPACE_SUBTITLE})},"no-data")]}},ia=p.div``,ra=p.div`
104
+ `,ia=({workloadName:e,workloadKind:l,isChecked:a,onToggle:n,disabled:o,disabledReason:i})=>{const r=h(),s=()=>{};return t(na,{children:t(ql,{title:e,disabled:o,onClick:o?s:n,isChecked:a,onCheckboxChange:o?s:n,children:o&&i?t(pe,{label:i,status:G.Default,textSize:K.XXXS}):t(oa,{children:t(pe,{label:l,status:G.Info,textSize:K.XXXS,backgroundColor:r.v2.colors.blue[900]})})})})},ra=({formData:l,handleSourceChange:a,handleSelectAll:n,selectedArea:o,searchText:i,filters:r})=>{const{tier:s}=Ae(),d=s===Fe.Onprem,u=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]),p=c(()=>u?[...u.workloads].sort((e,t)=>e.name.localeCompare(t.name)).filter(e=>De(e,i,r)):[],[u,i,r]),h=c(()=>!!p.length&&p.every(({selected:e})=>e),[p]),m=c(()=>{if(!u)return[];const{clusterId:e}=o.value,{name:l}=u;return p.map(({name:n,selected:o,kind:i})=>{const r=!d&&Oe.has(i);return t(ia,{workloadName:n,workloadKind:i,isChecked:!r&&(o||!1),onToggle:()=>a({clusterId:e,workloadId:{namespace:l,name:n,kind:i}}),disabled:r,disabledReason:"Enterprise only"},`${e}#${l}#${n}#${i}`)})},[p,u,o.value.clusterId]),{withFilterCount:g,filteredCount:b,totalCount:f}=c(()=>{const e=u?.workloads.length??0;return{withFilterCount:p.length!==e,filteredCount:p.length,totalCount:e}},[p,u]);return{width:"40%",header:e(T,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(T,{$gap:8,children:[t(J,{size:K.XS,nowrap:!0,children:o.value.namespaceName?`${o.value.namespaceName} > Workloads`:"Workloads"}),t(oe,{text:g?ye.FILTERED_COUNT_TOOLTIP:void 0,children:t(pe,{label:`${g?`${b} / ${f}`:f}`,status:Ve.Unknown})})]}),t(J,{onClick:()=>n({clusterId:o.value.clusterId,namespaceName:o.value.namespaceName,boolean:!h}),disabled:!m.length,size:K.XS,children:(h?"Unselect":"Select")+" all"})]}),list:u?m:[t(z,{$height:"100%",children:t(j,{icon:Ot,title:ye.SELECT_NAMESPACE,subTitle:ye.SELECT_NAMESPACE_SUBTITLE})},"no-data")]}},sa=p.div``,ca=p.div`
104
105
  visibility: ${({$visible:e})=>e?"visible":"hidden"};
105
106
 
106
107
  transition: visibility 0s;
107
108
  ${({$visible:e})=>!e&&"& * {\n transition-duration: 0s !important;\n }"}
108
109
 
109
- ${ia}:hover & {
110
+ ${sa}:hover & {
110
111
  visibility: visible;
111
112
  }
112
- `,sa=({clusterId:l,namespaceName:a,checkbox:n,isFutureApps:o,selectedCounts:i,isActive:r,onActive:s,handleSourceChange:c})=>{const d=h(),u=e=>{s(),c({clusterId:l,workloadId:{namespace:a},auto:e.auto,selected:e.all})};return t(ia,{children:t(Pl,{title:a,isSelected:r,onClick:s,isPartiallyChecked:n.partial,isChecked:n.all,onCheckboxChange:e=>u({auto:e,all:e}),children:e(A,{$gap:12,children:[t(ra,{$visible:r||o,children:t(oe,{text:"Automatically instrument all workloads currently in the namespace, and all workloads that will be deployed to this namespace in the future",children:t($,{label:"Auto",size:De.S,value:o,onChange:e=>u({auto:e,all:e||void 0})})})}),e(A,{$gap:8,children:[t(J,{variant:Fe.Span,size:K.XXXS,color:d.v2.colors.silver[200],align:"right",children:"Selected"}),t(pe,{label:`${i.sourced}/${i.total}`,status:r?G.Default:Te.Unknown,minWidth:"42px"})]})]})})})},ca=({clusterId:e,clusterName:l,namespaces:a,selectedArea:n,setSelectedArea:o,handleSourceChange:i})=>{const r=c(()=>a.map(({name:a,totalWorkloads:r,selectedCount:s,isAllSourced:c,isSomeSourced:d,isFutureApps:u})=>t(sa,{clusterId:e,namespaceName:a,isFutureApps:u,checkbox:{all:c,partial:d},selectedCounts:{sourced:s,total:r},isActive:n.clusterId===e&&n.namespaceName===a,onActive:()=>o({clusterId:e,clusterName:l,namespaceName:a}),handleSourceChange:i},`${e}#${a}`)),[e,l,a,n]);return t(Bl,{title:l,list:r,noBgColor:!0})},da=({isFetching:l,formData:a,handleSourceChange:n,handleSelectAll:o,selectedArea:i,setSelectedArea:r,searchText:s,filters:d})=>{const u=c(()=>a.map(e=>{const t=[...e.namespaces].sort((e,t)=>e.name.localeCompare(t.name)).filter(e=>ea(e,s,d)).map(e=>({name:e.name,totalWorkloads:e.workloads.length,...Ql(e)}));return{clusterId:e.clusterId,clusterName:e.clusterName,visibleNamespaces:t}}),[a,s,d]),p=c(()=>{let e=!1;for(const{visibleNamespaces:t}of u)for(const{totalWorkloads:l,selectedCount:a}of t)if(e=!0,a!==l)return!1;return e},[u]),{list:h,withFilterCount:m,filteredCount:g,totalCount:b}=c(()=>{const e=u.map(({clusterId:e,clusterName:l,visibleNamespaces:a})=>a.length?t(ca,{clusterId:e,clusterName:l,namespaces:a,selectedArea:i,setSelectedArea:r,handleSourceChange:n},e):null),l=e.filter(e=>null!==e);return{list:l,withFilterCount:l.length!==e.length,filteredCount:l.length,totalCount:e.length}},[u,i]);return{width:"60%",header:e(A,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(A,{$gap:8,children:[t(J,{size:K.XS,nowrap:!0,children:"Namespaces"}),t(oe,{text:m?ve.FILTERED_COUNT_TOOLTIP:void 0,children:t(pe,{label:`${m?`${g} / ${b}`:b}`,status:Te.Unknown})})]}),t(J,{onClick:()=>o({boolean:!p}),disabled:!h.length,size:K.XS,children:(p?"Unselect":"Select")+" all"})]}),list:h.length?h:l?[t(z,{$height:"100%",children:t(H,{title:ve.FETCHING_NAMESPACES,subTitle:ve.FETCHING_NAMESPACES_SUBTITLE,withSpinner:!0})},"loading")]:[]}},ua=({onClose:l,selectedConnectionIds:n,setSelectedConnectionIds:i,getAllClusterSnapshots:r,persistSources:s})=>{const d=h(),{selectedStreamName:p}=Ne(),{progress:m,resetProgress:g}=Oe(),b=c(()=>p||Ve,[p]),[f,C]=o(!1),[v,y]=o(null),k=u(async()=>{try{C(!0),y(await r()??null)}catch(e){}finally{C(!1)}},[]);a(()=>{k()},[]);const[w,S]=o(""),[x,I]=o(Me.Namespace),[N,T]=o({showOnlySelected:!1}),[D,F]=o({clusterId:"",clusterName:"",namespaceName:""}),[O,V]=o([]);a(()=>{v&&V(e=>{const t=((e,t)=>R(((e,t)=>e.clusters.filter(({clusterId:e})=>t.includes(e)))(e,t)))(v,n);return t.map(t=>{const l=e?.find(e=>e.clusterId===t.clusterId);return l??t})})},[v,n]);const{formDiff:M,isFormDirty:P}=c(()=>{const e=((e,t,l)=>{const a={};return e.forEach(e=>{e.namespaces.forEach(n=>{const o=t.find(t=>t.clusterId===e.clusterId)?.namespaces.find(e=>e.name===n.name),i=n.selected||!1,r=i!==o?.selected;if(r&&(a[e.clusterId]||(a[e.clusterId]=[]),a[e.clusterId].push({namespace:n.name,selected:i,currentStreamName:l}),i&&(a[e.clusterId]=a[e.clusterId].filter(e=>e.namespace!==n.name||e.namespace===n.name&&(!e.name||!e.kind)))),!r||!i){const t=((e,t,l)=>{const a=[];return t.workloads.forEach(n=>{const o=e?.workloads.find(e=>e.name===n.name&&e.kind===n.kind);n.selected!==o?.selected&&a.push({namespace:t.name,name:n.name,kind:n.kind,selected:n.selected||!1,currentStreamName:l})}),a})(o,n,l);t.length>0&&(a[e.clusterId]||(a[e.clusterId]=[]),a[e.clusterId].push(...t))}})}),a})(O,v?.clusters||[],b);return{formDiff:e,isFormDirty:Object.keys(e).length>0}},[O,v,b]),L=u(({clusterId:e,workloadId:t,selected:l,auto:a})=>{V(n=>{const o=R(n),i=o.findIndex(t=>t.clusterId===e);if(-1===i)return o;const r=o[i].namespaces.findIndex(e=>e.name===t.namespace);if(-1===r)return o;if(t.kind&&t.name){const e=o[i].namespaces[r].workloads.findIndex(e=>e.name===t.name&&e.kind===t.kind);if(-1===e)return o;const a="boolean"==typeof l?l:!o[i].namespaces[r].workloads[e].selected;o[i].namespaces[r].workloads[e].selected=a,a?o[i].namespaces[r].workloads.every(e=>e.selected)&&(o[i].namespaces[r].selected=!0):o[i].namespaces[r].selected=!1}else{const e="boolean"==typeof a?a:!o[i].namespaces[r].selected;o[i].namespaces[r].selected=e,e?o[i].namespaces[r].workloads.forEach(e=>{e.selected=!0}):"boolean"!=typeof l||l||o[i].namespaces[r].workloads.forEach(e=>{e.selected=!1})}return o})},[]),E=u(({clusterId:e,namespaceName:t,boolean:l})=>{V(a=>{const n=R(a),o=x===Me.Namespace?w:"",i=x===Me.Source?w:"",r=!!o||!!i||!!N?.showOnlySelected;return n.forEach((a,s)=>{e&&a.clusterId!==e||a.namespaces.forEach(({name:e,workloads:a},c)=>{if(!t||e===t)if(r)if(t){a.forEach((e,t)=>{ta(e,i,N)&&(n[s].namespaces[c].workloads[t].selected=l)});const e=n[s].namespaces[c].workloads.every(e=>e.selected);n[s].namespaces[c].selected=e}else{if(!ea(n[s].namespaces[c],o,N))return;n[s].namespaces[c].selected=l,a.forEach((e,t)=>{n[s].namespaces[c].workloads[t].selected=l})}else n[s].namespaces[c].selected=l,a.forEach((e,t)=>{n[s].namespaces[c].workloads[t].selected=l})})}),n})},[x,w,N]);return t(kl,{isOpen:!0,onClose:()=>{g(Re.BulkInstrumenting),l()},onSave:()=>s(M),header:{icon:It,title:ve.ADD_SOURCE,subTitle:ve.ADD_SOURCES_DESCRIPTION},connectionIds:{value:n,setValue:i},search:{value:w,onChange:e=>{S(e),x===Me.Namespace&&F({clusterId:"",clusterName:"",namespaceName:""})},segment:{options:[{label:"Namespace",value:Me.Namespace},{label:"Source",value:Me.Source}],selected:x,setSelected:I}},filters:e(A,{$gap:8,children:[t(J,{size:K.XXXS,color:d.v2.colors.silver[200],nowrap:!0,children:"Show only:"}),t($,{size:De.S,label:"Selected",value:N.showOnlySelected,onChange:e=>T(t=>({...t,showOnlySelected:e}))})]}),isFormDirty:P,isFetching:f,progress:{title:ve.CREATING_SOURCES,subTitle:ve.CREATING_SOURCES_SUBTITLE,percentage:m[Re.BulkInstrumenting]?.percentage||0},leftColumn:da({isFetching:f,formData:O,handleSourceChange:L,handleSelectAll:E,selectedArea:D,setSelectedArea:F,searchText:x===Me.Namespace?w:"",filters:N}),rightColumn:oa({formData:O,handleSourceChange:L,handleSelectAll:E,selectedArea:{value:D},searchText:x===Me.Source?w:"",filters:N})})},pa=({onClose:l,connections:n,selectedConnectionIds:i,setSelectedConnectionIds:r,getEffectiveConfig:s,onApply:d})=>{const u=h(),[p,m]=o(""),[g,b]=o({showOnlySelected:!1}),f=c(()=>n.filter(e=>{const t=!p||e.name.toLowerCase().includes(p.toLowerCase()),l=!g.showOnlySelected||g.showOnlySelected&&i.includes(e.id);return t&&l}),[n.length,i.length,p,g]),C=e=>{r(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[v,y]=o(!1),[k,w]=o(void 0),{formData:S,handleFormChange:x,areFormValuesEqual:I,resetFormData:N}=Ce(k||{rollout:{automaticRolloutDisabled:!1}}),T=c(()=>i.length>1||void 0!==k&&!I(k,S),[i.length,k,S]);return a(()=>{1===i.length?(async e=>{if(v)return;y(!0);const t=await s(e);if(t){const e={rollout:{automaticRolloutDisabled:t.rollout?.automaticRolloutDisabled||!1}};w(e),N(e)}y(!1)})(i[0]):w(void 0)},[i.length]),t(kl,{isOpen:!0,onClose:l,onSave:()=>d(S,i),header:{icon:Nt,title:"Cluster Configuration"},connectionIds:{value:i,setValue:r},search:{placeholder:"Search by cluster name",value:p,onChange:m},filters:e(A,{$gap:8,children:[t(J,{size:K.XXXS,color:u.v2.colors.silver[200],nowrap:!0,children:"Show only:"}),t($,{size:De.S,label:"Selected",value:g.showOnlySelected,onChange:e=>b(t=>({...t,showOnlySelected:e}))})]}),isFormDirty:T,isFetching:v,leftColumn:{width:"35%",header:e(A,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(A,{$gap:8,children:[t(J,{size:K.XS,children:"Clusters"}),t(pe,{label:f.length,status:Te.Unknown})]}),e(A,{$gap:8,children:[t(J,{size:K.XXXS,color:u.v2.colors.silver[200],align:"right",children:"Selected clusters"}),t(pe,{label:`${i.length}/${f.length}`,status:Te.Unknown})]})]}),list:f.map(e=>t(Pl,{title:e.name,isChecked:i.includes(e.id),onClick:()=>C(e.id),onCheckboxChange:()=>C(e.id)},e.id))},rightColumn:{width:"65%",header:t(J,{size:K.XS,children:"Configurations"}),list:[t($,{label:"Automatic rollout disabled",tooltip:"Odigos automatically triggers a one-time rollout for workloads when instrumenting or uninstrumenting, ensuring that changes are applied without requiring manual intervention. When automatic rollout is disabled, Odigos will not restart workloads, and users will need to manually trigger rollouts after adding or removing sources.",value:S.rollout?.automaticRolloutDisabled||!1,onChange:e=>x("rollout.automaticRolloutDisabled",e)},"automatic-rollout-disabled")]}})},ha=({token:a,isLoading:n,isEditing:o,onEdit:i,onCancel:r,onSave:s,formData:c,handleFormChange:d,handleErrorChange:u,formErrors:p})=>{const{CopyButton:h}=Pe(),m=!o||n||!c.newToken;return Le({key:"Enter",active:!m},s),e(A,o?{$justifyContent:"space-between",$alignItems:"flex-start",$gap:12,children:[t(v,{type:"password",value:c.newToken,onChange:e=>{d("newToken",e.target.value),u("newToken",void 0)},width:"430px",autoFocus:!0,errorMessage:p.newToken}),t(A,{$margin:n?"8px 0 0 0":"2px 0 0 0",$alignItems:"center",children:n?t(H,{title:"Saving...",withGradient:!0}):e(l,{children:[t(T,{variant:F.Secondary,size:D.S,leftIcon:At,onClick:r,disabled:n}),t(T,{variant:F.Primary,size:D.S,leftIcon:Tt,onClick:s,disabled:m})]})})]}:{$justifyContent:"space-between",$gap:12,children:[t(J,{size:K.XS,children:new Array(55).fill("•").join("")}),e(A,{$alignItems:"center",$justifyContent:"space-between",children:[t(h,{value:a}),t(ke,{icon:Dt,onClick:i})]})]})},ma=({expiresAt:e,callbackValid:l,callbackExpired:n})=>{const{formatTimeAgo:o}=Ee(),i=c(()=>o(e),[e]),r=c(()=>new Date(e).toDateString().split(" ").slice(1).join(" "),[e]),s=c(()=>ze(e,0)?G.Error:ze(e,2592e6)?G.Warning:G.Success,[e]),d=c(()=>s===G.Success?Tt:s===G.Warning?Ft:Ot,[s]);return a(()=>{s===G.Success?l():s===G.Error&&n()},[s]),t(oe,{text:r,children:t(pe,{leftIcon:d,label:i,status:s,invertColors:!0,useSecondaryTone:!0})})},ga=p.div`
113
+ `,da=({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(sa,{children:t(ql,{title:a,isSelected:r,onClick:s,isPartiallyChecked:n.partial,isChecked:n.all,onCheckboxChange:e=>u({auto:e,all:e}),children:e(T,{$gap:12,children:[t(ca,{$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:Re.S,value:o,onChange:e=>u({auto:e,all:e||void 0})})})}),e(T,{$gap:8,children:[t(J,{variant:Me.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:Ve.Unknown,minWidth:"42px"})]})]})})})},ua=({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(da,{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(Ul,{title:l,list:r,noBgColor:!0})},pa=({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=>Pe(e,s,d)).map(e=>({name:e.name,totalWorkloads:e.workloads.length,...Le(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(ua,{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(T,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(T,{$gap:8,children:[t(J,{size:K.XS,nowrap:!0,children:"Namespaces"}),t(oe,{text:m?ye.FILTERED_COUNT_TOOLTIP:void 0,children:t(pe,{label:`${m?`${g} / ${b}`:b}`,status:Ve.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:ye.FETCHING_NAMESPACES,subTitle:ye.FETCHING_NAMESPACES_SUBTITLE,withSpinner:!0})},"loading")]:[]}},ha=({onClose:l,selectedConnectionIds:n,setSelectedConnectionIds:i,getAllClusterSnapshots:r,persistSources:s})=>{const d=h(),{tier:p}=Ae(),m=p===Fe.Onprem,{selectedStreamName:g}=Ne(),{progress:b,resetProgress:f}=Ee(),C=c(()=>g||ze,[g]),[y,v]=o(!1),[k,w]=o(null),S=u(async()=>{try{v(!0),w(await r()??null)}catch(e){}finally{v(!1)}},[]);a(()=>{S()},[]);const[x,I]=o(""),[N,A]=o(je.Namespace),[D,O]=o({showOnlySelected:!1}),[V,F]=o({clusterId:"",clusterName:"",namespaceName:""}),[R,P]=o([]);a(()=>{k&&P(e=>{const t=((e,t)=>M(((e,t)=>e.clusters.filter(({clusterId:e})=>t.includes(e)))(e,t)))(k,n);return t.map(t=>{const l=e?.find(e=>e.clusterId===t.clusterId);return l??t})})},[k,n]);const{formDiff:L,isFormDirty:E}=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})(R,k?.clusters||[],C);return{formDiff:e,isFormDirty:Object.keys(e).length>0}},[R,k,C]),z=u(e=>!m&&Oe.has(e),[m]),j=u(({clusterId:e,workloadId:t,selected:l,auto:a})=>{P(n=>{const o=M(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.filter(e=>!z(e.kind)).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=>{z(e.kind)||(e.selected=!0)}):"boolean"!=typeof l||l||o[i].namespaces[r].workloads.forEach(e=>{e.selected=!1})}return o})},[z]),q=u(({clusterId:e,namespaceName:t,boolean:l})=>{P(a=>{const n=M(a),o=N===je.Namespace?x:"",i=N===je.Source?x:"",r=!!o||!!i||!!D?.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)=>{l&&z(e.kind)||De(e,i,D)&&(n[s].namespaces[c].workloads[t].selected=l)});const e=n[s].namespaces[c].workloads.filter(e=>!z(e.kind)).every(e=>e.selected);n[s].namespaces[c].selected=e}else{if(!Pe(n[s].namespaces[c],o,D))return;n[s].namespaces[c].selected=l,a.forEach((e,t)=>{l&&z(e.kind)||(n[s].namespaces[c].workloads[t].selected=l)})}else n[s].namespaces[c].selected=l,a.forEach((e,t)=>{l&&z(e.kind)||(n[s].namespaces[c].workloads[t].selected=l)})})}),n})},[N,x,D,z]);return t(Il,{isOpen:!0,onClose:()=>{f(qe.BulkInstrumenting),l()},onSave:()=>s(L),header:{icon:Ot,title:ye.ADD_SOURCE,subTitle:ye.ADD_SOURCES_DESCRIPTION},connectionIds:{value:n,setValue:i},search:{value:x,onChange:e=>{I(e),N===je.Namespace&&F({clusterId:"",clusterName:"",namespaceName:""})},segment:{options:[{label:"Namespace",value:je.Namespace},{label:"Source",value:je.Source}],selected:N,setSelected:A}},filters:e(T,{$gap:8,children:[t(J,{size:K.XXXS,color:d.v2.colors.silver[200],nowrap:!0,children:"Show only:"}),t($,{size:Re.S,label:"Selected",value:D.showOnlySelected,onChange:e=>O(t=>({...t,showOnlySelected:e}))})]}),isFormDirty:E,isFetching:y,progress:{title:ye.CREATING_SOURCES,subTitle:ye.CREATING_SOURCES_SUBTITLE,percentage:b[qe.BulkInstrumenting]?.percentage||0},leftColumn:pa({isFetching:y,formData:R,handleSourceChange:j,handleSelectAll:q,selectedArea:V,setSelectedArea:F,searchText:N===je.Namespace?x:"",filters:D}),rightColumn:ra({formData:R,handleSourceChange:j,handleSelectAll:q,selectedArea:{value:V},searchText:N===je.Source?x:"",filters:D})})},ma=({onClose:l,connections:n,selectedConnectionIds:i,setSelectedConnectionIds:r,getEffectiveConfig:s,onApply:d})=>{const u=h(),[p,m]=o(""),[g,b]=o({showOnlySelected:!1}),f=c(()=>n.filter(e=>{const t=!p||e.name.toLowerCase().includes(p.toLowerCase()),l=!g.showOnlySelected||g.showOnlySelected&&i.includes(e.id);return t&&l}),[n.length,i.length,p,g]),C=e=>{r(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[y,v]=o(!1),[k,w]=o(void 0),{formData:S,handleFormChange:x,areFormValuesEqual:I,resetFormData:N}=Ce(k||{rollout:{automaticRolloutDisabled:!1}}),A=c(()=>i.length>1||void 0!==k&&!I(k,S),[i.length,k,S]);return a(()=>{1===i.length?(async e=>{if(y)return;v(!0);const t=await s(e);if(t){const e={rollout:{automaticRolloutDisabled:t.rollout?.automaticRolloutDisabled||!1}};w(e),N(e)}v(!1)})(i[0]):w(void 0)},[i.length]),t(Il,{isOpen:!0,onClose:l,onSave:()=>d(S,i),header:{icon:Vt,title:"Cluster Configuration"},connectionIds:{value:i,setValue:r},search:{placeholder:"Search by cluster name",value:p,onChange:m},filters:e(T,{$gap:8,children:[t(J,{size:K.XXXS,color:u.v2.colors.silver[200],nowrap:!0,children:"Show only:"}),t($,{size:Re.S,label:"Selected",value:g.showOnlySelected,onChange:e=>b(t=>({...t,showOnlySelected:e}))})]}),isFormDirty:A,isFetching:y,leftColumn:{width:"35%",header:e(T,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(T,{$gap:8,children:[t(J,{size:K.XS,children:"Clusters"}),t(pe,{label:f.length,status:Ve.Unknown})]}),e(T,{$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:Ve.Unknown})]})]}),list:f.map(e=>t(ql,{title:e.name,isChecked:i.includes(e.id),onClick:()=>C(e.id),onCheckboxChange:()=>C(e.id)},e.id))},rightColumn:{width:"65%",header:t(J,{size:K.XS,children:"Configurations"}),list:[t($,{label:"Automatic rollout disabled",tooltip:"Odigos automatically triggers a one-time rollout for workloads when instrumenting or uninstrumenting, ensuring that changes are applied without requiring manual intervention. When automatic rollout is disabled, Odigos will not restart workloads, and users will need to manually trigger rollouts after adding or removing sources.",value:S.rollout?.automaticRolloutDisabled||!1,onChange:e=>x("rollout.automaticRolloutDisabled",e)},"automatic-rollout-disabled")]}})},ga=({token:a,isLoading:n,isEditing:o,onEdit:i,onCancel:r,onSave:s,formData:c,handleFormChange:d,handleErrorChange:u,formErrors:p})=>{const{CopyButton:h}=He(),m=!o||n||!c.newToken;return Ke({key:"Enter",active:!m},s),e(T,o?{$justifyContent:"space-between",$alignItems:"flex-start",$gap:12,children:[t(y,{type:"password",value:c.newToken,onChange:e=>{d("newToken",e.target.value),u("newToken",void 0)},width:"430px",autoFocus:!0,errorMessage:p.newToken}),t(T,{$margin:n?"8px 0 0 0":"2px 0 0 0",$alignItems:"center",children:n?t(H,{title:"Saving...",withGradient:!0}):e(l,{children:[t(A,{variant:O.Secondary,size:D.S,leftIcon:Ft,onClick:r,disabled:n}),t(A,{variant:O.Primary,size:D.S,leftIcon:Rt,onClick:s,disabled:m})]})})]}:{$justifyContent:"space-between",$gap:12,children:[t(J,{size:K.XS,children:new Array(55).fill("•").join("")}),e(T,{$alignItems:"center",$justifyContent:"space-between",children:[t(h,{value:a}),t(ke,{icon:Mt,onClick:i})]})]})},ba=({expiresAt:e,callbackValid:l,callbackExpired:n})=>{const{formatTimeAgo:o}=Be(),i=c(()=>o(e),[e]),r=c(()=>new Date(e).toDateString().split(" ").slice(1).join(" "),[e]),s=c(()=>We(e,0)?G.Error:We(e,2592e6)?G.Warning:G.Success,[e]),d=c(()=>s===G.Success?Rt:s===G.Warning?Pt:Lt,[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})})},fa=p.div`
113
114
  display: flex;
114
115
  flex-direction: column;
115
116
  gap: 12px;
@@ -117,14 +118,14 @@ import{jsxs as e,jsx as t,Fragment as l}from"react/jsx-runtime";import{useEffect
117
118
  border-radius: 12px;
118
119
  border: 1px solid ${({theme:e,$isExpired:t})=>t?e.v2.colors.red[500]:e.v2.colors.silver[600]};
119
120
  background-color: ${({theme:e,$isExpired:t})=>t?e.v2.colors.red[1e3]:e.v2.colors.silver[800]};
120
- `,ba=({children:e})=>{const l=h();return t(J,{size:K.XXXS,color:l.v2.colors.grey[150],children:e})},fa=({token:l,updateToken:a})=>{const[n,i]=o(!1),[r,s]=o(!1),[c,d]=o(!1),{formData:u,handleFormChange:p,formErrors:h,handleErrorChange:m,resetFormData:b}=Ce({newToken:""});return t(je,{richTitle:{icon:Vt,title:"Odigos Pro Token"},children:e(ga,{$isExpired:c,children:[e(A,{$justifyContent:"space-between",children:[e(g,{$gap:4,children:[t(ba,{children:"Issued for"}),t(J,{size:K.XS,children:l.name||"N/A"})]}),e(g,{$gap:4,children:[t(ba,{children:"Expiration"}),t(ma,{expiresAt:l.expiresAt,callbackValid:()=>d(!1),callbackExpired:()=>d(!0)})]}),t(g,{})]}),t(A,{children:e(g,{children:[t(ba,{children:"Token"}),t(ha,{token:l.token,newToken:u.newToken,isLoading:r,isEditing:n,onEdit:()=>i(!0),onCancel:()=>(i(!1),s(!1),void p("newToken","")),onSave:()=>(async()=>{s(!0);const e=await a(u.newToken.trim());s(!1),e?.error?m("newToken",e.error):(i(!1),b())})(),formData:u,handleFormChange:p,handleErrorChange:m,formErrors:h})]})})]})})},Ca=p.div`
121
+ `,Ca=({children:e})=>{const l=h();return t(J,{size:K.XXXS,color:l.v2.colors.grey[150],children:e})},ya=({token:l,updateToken:a})=>{const[n,i]=o(!1),[r,s]=o(!1),[c,d]=o(!1),{formData:u,handleFormChange:p,formErrors:h,handleErrorChange:m,resetFormData:b}=Ce({newToken:""});return t(_e,{richTitle:{icon:Et,title:"Odigos Pro Token"},children:e(fa,{$isExpired:c,children:[e(T,{$justifyContent:"space-between",children:[e(g,{$gap:4,children:[t(Ca,{children:"Issued for"}),t(J,{size:K.XS,children:l.name||"N/A"})]}),e(g,{$gap:4,children:[t(Ca,{children:"Expiration"}),t(ba,{expiresAt:l.expiresAt,callbackValid:()=>d(!1),callbackExpired:()=>d(!0)})]}),t(g,{})]}),t(T,{children:e(g,{children:[t(Ca,{children:"Token"}),t(ga,{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})]})})]})})},va=p.div`
121
122
  display: flex;
122
123
  align-items: center;
123
124
  justify-content: center;
124
125
  padding: 12px 24px;
125
126
  border-radius: 8px;
126
127
  background-color: ${({theme:e})=>e.v2.colors.silver[800]};
127
- `,va=({downloadDiagnose:l})=>{const a=h(),{namespaces:n}=qe(),[i,r]=o(null),{formData:s,handleFormChange:c,resetFormData:d}=Ce({includeProfiles:!0,includeMetrics:!0,includeSourceWorkloads:!1,sourceWorkloadNamespaces:[]});return t(je,{richTitle:{icon:Mt,title:"Diagnose"},children:i?t(Ca,{children:t(H,{title:"Creating file...",subTitle:"This may take a few moments. Do not refresh the page.",startedAt:i,withGradient:!0,withVisual:!0,visualIcon:Rt})}):e(g,{$gap:24,children:[t(J,{size:K.XXS,color:a.v2.colors.silver[200],children:"Download a tar.gz file with diagnostics from this cluster. Select which data to include before downloading, and share the file with the Odigos support team for troubleshooting."}),e(g,{$gap:16,children:[e(A,{$gap:8,children:[t(f,{label:"Profiles",value:s.includeProfiles,onChange:e=>c("includeProfiles",e),tooltip:"Note: Adds 30s to diagnose download time to collect Profiles"}),t(J,{size:K.XXXS,color:a.v2.colors.silver[200],children:"Include pprof profiles"})]}),e(A,{$gap:8,children:[t(f,{label:"Metrics",value:s.includeMetrics,onChange:e=>c("includeMetrics",e)}),t(J,{size:K.XXXS,color:a.v2.colors.silver[200],children:"Include Prometheus metrics"})]}),e(A,{$gap:8,children:[t(f,{label:"Source Workloads",value:s.includeSourceWorkloads,onChange:e=>{c("includeSourceWorkloads",e),e&&c("sourceWorkloadNamespaces",[])}}),t(J,{size:K.XXXS,color:a.v2.colors.silver[200],children:"Include workload and pod manifests for instrumented sources"})]})]}),t(He,{alignX:Be.Left,alignY:Ke.Bottom,items:n.map(e=>({id:e.name,label:e.name,withCheckbox:!0})),selectedIds:s.sourceWorkloadNamespaces,setSelectedIds:e=>c("sourceWorkloadNamespaces",e),withMultiSelect:!0,withSearch:!0,fullWidth:!0,buttonProps:{label:(s.sourceWorkloadNamespaces.length?"Selected":"Select")+" Namespaces",variant:F.Secondary,disabled:s.includeSourceWorkloads,leftIcon:s.sourceWorkloadNamespaces.length?()=>t(pe,{label:s.sourceWorkloadNamespaces.length,status:G.Default}):void 0}}),t(A,{$justifyContent:"flex-end",children:t(T,{label:"Download Diagnose",rightIcon:Rt,variant:F.Primary,onClick:async()=>{r(Date.now()),await l(s),r(null),d()},disabled:null!==i})})]})})},ya=({fetchDescribeOdigos:e})=>{const{platformType:l,version:n,tier:i}=We(),[r,s]=o(null);return a(()=>{e().then(({data:e})=>s(e?.describeOdigos||null))},[]),t(je,{richTitle:{icon:Pt,title:"General Information"},children:t(_e,{cellsPerRow:2,items:[{id:Ge(),title:"Odigos Version",label:n},{id:Ge(),title:`${l.toUpperCase()} Version`,label:r?.kubernetesVersion?.value||"-"},{id:Ge(),title:"Installation Method",label:r?.installationMethod?.value||"-"},{id:Ge(),title:"Tier",label:i}]})})},ka=({isOpen:l,onClose:a,token:n,updateToken:o,fetchDescribeOdigos:i,downloadDiagnose:r})=>e(q,{isOpen:l,header:{icon:Pt,title:"System Overview",onClose:a},children:[i&&t(ya,{fetchDescribeOdigos:i}),o&&n&&t(fa,{token:n,updateToken:o}),r&&t(va,{downloadDiagnose:r})]});var wa,Sa;!function(e){e.BulkConfig="bulk-config",e.BulkSource="bulk-source",e.BulkDestination="bulk-destination",e.BulkAction="bulk-action",e.BulkInstrumentationRule="bulk-instrumentation-rule",e.Delete="delete"}(wa||(wa={})),function(e){e.Id="id",e.Name="name",e.Type="type",e.Status="status",e.OdigosVersion="odigosVersion",e.ConnectedSince="connectedSince",e.LastActivity="lastActivity"}(Sa||(Sa={}));const $a=[{key:Sa.Name,label:"Name"},{key:Sa.Type,label:"Type",textAlign:"right"},{key:Sa.Status,label:"Status"},{key:Sa.OdigosVersion,label:"Odigos Version"},{key:Sa.ConnectedSince,label:"Connected Since"},{key:Sa.LastActivity,label:"Last Activity"}],xa=(e,t)=>{const l=e.find(e=>e.key===Sa.Id)?.rawValue;return t(l?.toString()||"")},Ia=({tableRowsMaxHeight:l,connections:n,getConnections:i,onClickConnection:r,deleteConnection:s,configMinSupportedVersion:d=0,getEffectiveConfig:p,applyConfigurations:m,snapshotMinSupportedVersion:g=0,getAllClusterSnapshots:b,persistSources:f,getDestinationCategories:C,getPotentialDestinations:v,createDestination:y,createAction:k,createInstrumentationRule:w})=>{const S=h(),{formatTimeAgo:$}=Ee(),[x,I]=o(!1),[N,A]=o(n||[]),T=u(async()=>{try{I(!0),A(await i()??[])}catch(e){}finally{I(!1)}},[]);a(()=>{N.length||T()},[]);const[O,V]=o(""),[M,R]=o(null),[P,L]=o([]),E=c(()=>M===wa.BulkConfig?d:M===wa.BulkSource?g:0,[M,d,g]),{supportedConnections:z,supportedConnectionIds:j}=c(()=>{const e=((e,t)=>e.filter(e=>{const l=e.status===G.Success,a=Je(e.odigosVersion,t);return l&&a}))(N,E);return{supportedConnections:e,supportedConnectionIds:e.map(e=>e.id)}},[N.length,E]);a(()=>{if(!M||M===wa.Delete)return;const e=P.filter(e=>!j.includes(e));e.length&&L(t=>t.filter(t=>!e.includes(t)))},[M,P.length,j.length]);const q=c(()=>N.filter(e=>!O||e.name.toLowerCase().includes(O.toLowerCase())).map(e=>({cells:[{key:Sa.Id,rawValue:e.id},{key:Sa.Name,rawValue:e.name},{key:Sa.Type,rawValue:e.type},{key:Sa.Status,rawValue:e.status,component:()=>(e=>{const l=e===G.Success?"Connection live":"Connection lost",a=e===G.Success?Tt:At;return t(pe,{status:e,label:l,leftIcon:a})})(e.status)},{key:Sa.OdigosVersion,rawValue:e.odigosVersion},{key:Sa.ConnectedSince,rawValue:e.connectedAt?$(e.connectedAt):"-"},{key:Sa.LastActivity,rawValue:e.lastSeenAt?$(e.lastSeenAt):"-"}],onClick:e.status!==G.Success||M?void 0:()=>r(e),isSelected:P.includes(e.id),onSelect:()=>L(t=>Array.from(new Set([...t,e.id]))),onDeselect:()=>L(t=>t.filter(t=>t!==e.id)),hideCheckbox:e.status!==G.Success||M===wa.BulkConfig&&!Je(e.odigosVersion,d)||M===wa.BulkSource&&!Je(e.odigosVersion,g)})),[N,P,O,M,d,g]),H=c(()=>{const e=(e,t)=>{L([e]),R(t)};return(e=>{const{connections:t,configMinSupportedVersion:l,snapshotMinSupportedVersion:a,onDelete:n,onAddSource:o,onAddDestination:i,onAddAction:r,onAddInstrumentationRule:s,onEditConfiguration:c}=e;return({cells:e})=>{if(!(e=>e.find(e=>e.key===Sa.Status)?.rawValue===G.Success)(e))return[{id:Ge(),label:"Delete Connection",rightIcon:Lt,onClick:()=>xa(e,n)}];const d=xa(e,e=>{const a=t.find(t=>t.id===e);return!!a&&Je(a.odigosVersion,l)}),u=xa(e,e=>{const l=t.find(t=>t.id===e);return!!l&&Je(l.odigosVersion,a)}),p=[];return o&&p.push({id:Ge(),tooltip:u?ve.ADD_SOURCE:`To use this feature, please upgrade to Odigos v${a} or later.`,rightIcon:It,disabled:!u,onClick:()=>xa(e,o)}),i&&p.push({id:Ge(),tooltip:ve.ADD_DESTINATION,rightIcon:wt,onClick:()=>xa(e,i)}),r&&p.push({id:Ge(),tooltip:ve.ADD_ACTION,rightIcon:kt,onClick:()=>xa(e,r)}),s&&p.push({id:Ge(),tooltip:ve.ADD_INSTRUMENTATION_RULE,rightIcon:xt,onClick:()=>xa(e,s)}),c&&p.push({id:Ge(),tooltip:d?"Edit Configuration":`To use this feature, please upgrade to Odigos v${l} or later.`,rightIcon:Nt,disabled:!d,onClick:()=>xa(e,c)}),p}})({connections:N,configMinSupportedVersion:d,snapshotMinSupportedVersion:g,onDelete:t=>e(t,wa.Delete),onAddSource:b&&f?t=>e(t,wa.BulkSource):void 0,onAddDestination:C&&v&&y?t=>e(t,wa.BulkDestination):void 0,onAddAction:k?t=>e(t,wa.BulkAction):void 0,onAddInstrumentationRule:w?t=>e(t,wa.BulkInstrumentationRule):void 0,onEditConfiguration:p&&m?t=>e(t,wa.BulkConfig):void 0})},[N,d,p,m,g,b,f,C,v,y,k,w]),K=c(()=>(e=>{const{onCancel:t,onAddSource:l,onAddDestination:a,onAddAction:n,onAddInstrumentationRule:o,onManageConfigurations:i}=e,r=[];l&&r.push({id:Ge(),type:Ue.Button,buttonProps:{variant:F.Primary,size:D.S,label:"Add Sources",rightIcon:It,onClick:l}});const s=[a?{id:wa.BulkDestination,label:ve.ADD_DESTINATION,icon:wt}:null,n?{id:wa.BulkAction,label:ve.ADD_ACTION,icon:kt}:null,o?{id:wa.BulkInstrumentationRule,label:ve.ADD_INSTRUMENTATION_RULE,icon:xt}:null,i?{id:wa.BulkConfig,label:"Manage Configurations",icon:Nt}:null];return s.some(Boolean)&&r.push({id:Ge(),type:Ue.ButtonDropData,buttonProps:{variant:F.Secondary,size:D.S,label:"Bulk Actions",onClick:e=>{e===wa.BulkSource?l?.():e===wa.BulkDestination?a?.():e===wa.BulkAction?n?.():e===wa.BulkInstrumentationRule?o?.():e===wa.BulkConfig&&i?.()}},dropDataProps:{alignX:Be.Left,items:s}}),r.push({id:Ge(),type:Ue.Button,buttonProps:{variant:F.Text,size:D.S,label:Ye.CANCEL,onClick:t}}),r})({onCancel:()=>L([]),onAddSource:b&&f?()=>R(wa.BulkSource):void 0,onAddDestination:C&&v&&y?()=>R(wa.BulkDestination):void 0,onAddAction:k?()=>R(wa.BulkAction):void 0,onAddInstrumentationRule:w?()=>R(wa.BulkInstrumentationRule):void 0,onManageConfigurations:p&&m?()=>R(wa.BulkConfig):void 0}),[p,m,b,f,C,v,y,k,w]);return t(Xe,{children:e(je,{richTitle:{icon:zt,title:ve.CONNECTIONS,badge:{label:N.length.toString(),status:Te.Unknown}},search:{placeholder:"Search by cluster name",value:O,onChange:e=>V(e),width:"300px"},actions:[{id:Ge(),type:Ue.Button,buttonProps:{variant:F.Secondary,size:D.S,leftIcon:Et,onClick:T,disabled:x}}],children:[t(Ze,{variant:Qe.Pretty,maxHeight:l,headerBackgroundColor:S.v2.colors.silver[1e3],isLoading:x,withCheckboxes:!0,columns:$a,rows:q,rowActionsPushRightPosition:M?`calc(${ml} - 24px)`:void 0,getRowActions:H}),M===wa.BulkConfig&&p&&m&&t(pa,{onClose:()=>R(null),connections:z,selectedConnectionIds:P,setSelectedConnectionIds:L,getEffectiveConfig:p,onApply:m}),M===wa.BulkSource&&b&&f&&t(ua,{onClose:()=>R(null),selectedConnectionIds:P,setSelectedConnectionIds:L,getAllClusterSnapshots:b,persistSources:async e=>await(f?.(e))}),M===wa.BulkDestination&&C&&v&&y&&t(Yl,{onClose:()=>R(null),selectedConnectionIds:P,setSelectedConnectionIds:L,getDestinationCategories:C,getPotentialDestinations:v,createDestination:e=>y(e,P)}),M===wa.BulkAction&&k&&t(El,{onClose:()=>R(null),selectedConnectionIds:P,setSelectedConnectionIds:L,createAction:e=>k(e,P)}),M===wa.BulkInstrumentationRule&&w&&t(Zl,{onClose:()=>R(null),selectedConnectionIds:P,setSelectedConnectionIds:L,createInstrumentationRule:e=>w(e,P)}),t(il,{target:"connection",isOpen:M===wa.Delete,onClose:()=>{L([]),R(null)},onApprove:async()=>{const e=P[0];e&&(await s(e),await T())}}),t(et,{isOpen:!!P.length&&!M,richTitle:{icon:pt,title:"Selected Clusters",badge:{label:P.length}},actions:K})]})})},Na=p.div`
128
+ `,ka=({downloadDiagnose:l})=>{const a=h(),{namespaces:n}=Ge(),[i,r]=o(null),{formData:s,handleFormChange:c,resetFormData:d}=Ce({includeProfiles:!0,includeMetrics:!0,includeSourceWorkloads:!1,sourceWorkloadNamespaces:[]});return t(_e,{richTitle:{icon:zt,title:"Diagnose"},children:i?t(va,{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:jt})}):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(T,{$gap:8,children:[t(f,{label:"Profiles",value:s.includeProfiles,onChange:e=>c("includeProfiles",e),tooltip:"Note: Adds 30s to diagnose download time to collect Profiles"}),t(J,{size:K.XXXS,color:a.v2.colors.silver[200],children:"Include pprof profiles"})]}),e(T,{$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(T,{$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(Je,{alignX:Ye.Left,alignY:Ue.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:O.Secondary,disabled:s.includeSourceWorkloads,leftIcon:s.sourceWorkloadNamespaces.length?()=>t(pe,{label:s.sourceWorkloadNamespaces.length,status:G.Default}):void 0}}),t(T,{$justifyContent:"flex-end",children:t(A,{label:"Download Diagnose",rightIcon:jt,variant:O.Primary,onClick:async()=>{r(Date.now()),await l(s),r(null),d()},disabled:null!==i})})]})})},wa=({fetchDescribeOdigos:e})=>{const{platformType:l,version:n,tier:i}=Ae(),[r,s]=o(null);return a(()=>{e().then(({data:e})=>s(e?.describeOdigos||null))},[]),t(_e,{richTitle:{icon:qt,title:"General Information"},children:t(Xe,{cellsPerRow:2,items:[{id:Ze(),title:"Odigos Version",label:n},{id:Ze(),title:`${l.toUpperCase()} Version`,label:r?.kubernetesVersion?.value||"-"},{id:Ze(),title:"Installation Method",label:r?.installationMethod?.value||"-"},{id:Ze(),title:"Tier",label:i}]})})},Sa=({isOpen:l,onClose:a,token:n,updateToken:o,fetchDescribeOdigos:i,downloadDiagnose:r})=>e(q,{isOpen:l,header:{icon:qt,title:"System Overview",onClose:a},children:[i&&t(wa,{fetchDescribeOdigos:i}),o&&n&&t(ya,{token:n,updateToken:o}),r&&t(ka,{downloadDiagnose:r})]});var $a,xa;!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"}($a||($a={})),function(e){e.Id="id",e.Name="name",e.Type="type",e.Status="status",e.OdigosVersion="odigosVersion",e.ConnectedSince="connectedSince",e.LastActivity="lastActivity"}(xa||(xa={}));const Ia=[{key:xa.Name,label:"Name"},{key:xa.Type,label:"Type",textAlign:"right"},{key:xa.Status,label:"Status"},{key:xa.OdigosVersion,label:"Odigos Version"},{key:xa.ConnectedSince,label:"Connected Since"},{key:xa.LastActivity,label:"Last Activity"}],Na=(e,t)=>{const l=e.find(e=>e.key===xa.Id)?.rawValue;return t(l?.toString()||"")},Ta=({tableRowsMaxHeight:l,connections:n,getConnections:i,onClickConnection:r,deleteConnection:s,configMinSupportedVersion:d=0,getEffectiveConfig:p,applyConfigurations:m,snapshotMinSupportedVersion:g=0,getAllClusterSnapshots:b,persistSources:f,getDestinationCategories:C,getPotentialDestinations:y,createDestination:v,createAction:k,createInstrumentationRule:w})=>{const S=h(),{isVm:$}=Ae(),{formatTimeAgo:x}=Be(),[I,N]=o(!1),[T,A]=o(n||[]),V=u(async()=>{try{N(!0),A(await i()??[])}catch(e){}finally{N(!1)}},[]);a(()=>{T.length||V()},[]);const[F,R]=o(""),[M,P]=o(null),[L,E]=o([]),z=c(()=>M===$a.BulkConfig?d:M===$a.BulkSource?g:0,[M,d,g]),{supportedConnections:j,supportedConnectionIds:q}=c(()=>{const e=((e,t)=>e.filter(e=>{const l=e.status===G.Success,a=Qe(e.odigosVersion,t);return l&&a}))(T,z);return{supportedConnections:e,supportedConnectionIds:e.map(e=>e.id)}},[T.length,z]);a(()=>{if(!M||M===$a.Delete)return;const e=L.filter(e=>!q.includes(e));e.length&&E(t=>t.filter(t=>!e.includes(t)))},[M,L.length,q.length]);const H=c(()=>T.filter(e=>!F||e.name.toLowerCase().includes(F.toLowerCase())).map(e=>({cells:[{key:xa.Id,rawValue:e.id},{key:xa.Name,rawValue:e.name},{key:xa.Type,rawValue:e.type},{key:xa.Status,rawValue:e.status,component:()=>(e=>{const l=e===G.Success?"Connection live":"Connection lost",a=e===G.Success?Rt:Ft;return t(pe,{status:e,label:l,leftIcon:a})})(e.status)},{key:xa.OdigosVersion,rawValue:e.odigosVersion},{key:xa.ConnectedSince,rawValue:e.connectedAt?x(e.connectedAt):"-"},{key:xa.LastActivity,rawValue:e.lastSeenAt?x(e.lastSeenAt):"-"}],onClick:e.status!==G.Success||M?void 0:()=>r(e),isSelected:L.includes(e.id),onSelect:()=>E(t=>Array.from(new Set([...t,e.id]))),onDeselect:()=>E(t=>t.filter(t=>t!==e.id)),hideCheckbox:e.status!==G.Success||M===$a.BulkConfig&&!Qe(e.odigosVersion,d)||M===$a.BulkSource&&!Qe(e.odigosVersion,g)})),[T,L,F,M,d,g]),K=c(()=>{const e=(e,t)=>{E([e]),P(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===xa.Status)?.rawValue===G.Success)(e))return[{id:Ze(),label:"Delete Connection",rightIcon:Ht,onClick:()=>Na(e,n)}];const d=Na(e,e=>{const a=t.find(t=>t.id===e);return!!a&&Qe(a.odigosVersion,l)}),u=Na(e,e=>{const l=t.find(t=>t.id===e);return!!l&&Qe(l.odigosVersion,a)}),p=[];return o&&p.push({id:Ze(),tooltip:u?ye.ADD_SOURCE:`To use this feature, please upgrade to Odigos v${a} or later.`,rightIcon:Ot,disabled:!u,onClick:()=>Na(e,o)}),i&&p.push({id:Ze(),tooltip:ye.ADD_DESTINATION,rightIcon:Nt,onClick:()=>Na(e,i)}),r&&p.push({id:Ze(),tooltip:ye.ADD_ACTION,rightIcon:It,onClick:()=>Na(e,r)}),s&&p.push({id:Ze(),tooltip:ye.ADD_INSTRUMENTATION_RULE,rightIcon:Dt,onClick:()=>Na(e,s)}),c&&p.push({id:Ze(),tooltip:d?"Edit Configuration":`To use this feature, please upgrade to Odigos v${l} or later.`,rightIcon:Vt,disabled:!d,onClick:()=>Na(e,c)}),p}})({connections:T,configMinSupportedVersion:d,snapshotMinSupportedVersion:g,onDelete:t=>e(t,$a.Delete),onAddSource:!$&&b&&f?t=>e(t,$a.BulkSource):void 0,onAddDestination:!$&&C&&y&&v?t=>e(t,$a.BulkDestination):void 0,onAddAction:!$&&k?t=>e(t,$a.BulkAction):void 0,onAddInstrumentationRule:!$&&w?t=>e(t,$a.BulkInstrumentationRule):void 0,onEditConfiguration:!$&&p&&m?t=>e(t,$a.BulkConfig):void 0})},[$,T,d,p,m,g,b,f,C,y,v,k,w]),B=c(()=>(e=>{const{onCancel:t,onAddSource:l,onAddDestination:a,onAddAction:n,onAddInstrumentationRule:o,onManageConfigurations:i}=e,r=[];l&&r.push({id:Ze(),type:et.Button,buttonProps:{variant:O.Primary,size:D.S,label:"Add Sources",rightIcon:Ot,onClick:l}});const s=[a?{id:$a.BulkDestination,label:ye.ADD_DESTINATION,icon:Nt}:null,n?{id:$a.BulkAction,label:ye.ADD_ACTION,icon:It}:null,o?{id:$a.BulkInstrumentationRule,label:ye.ADD_INSTRUMENTATION_RULE,icon:Dt}:null,i?{id:$a.BulkConfig,label:"Manage Configurations",icon:Vt}:null];return s.some(Boolean)&&r.push({id:Ze(),type:et.ButtonDropData,buttonProps:{variant:O.Secondary,size:D.S,label:"Bulk Operations",onClick:e=>{e===$a.BulkSource?l?.():e===$a.BulkDestination?a?.():e===$a.BulkAction?n?.():e===$a.BulkInstrumentationRule?o?.():e===$a.BulkConfig&&i?.()}},dropDataProps:{alignX:Ye.Left,items:s}}),r.push({id:Ze(),type:et.Button,buttonProps:{variant:O.Text,size:D.S,label:tt.CANCEL,onClick:t}}),r})({onCancel:()=>E([]),onAddSource:!$&&b&&f?()=>P($a.BulkSource):void 0,onAddDestination:!$&&C&&y&&v?()=>P($a.BulkDestination):void 0,onAddAction:!$&&k?()=>P($a.BulkAction):void 0,onAddInstrumentationRule:!$&&w?()=>P($a.BulkInstrumentationRule):void 0,onManageConfigurations:!$&&p&&m?()=>P($a.BulkConfig):void 0}),[$,p,m,b,f,C,y,v,k,w]);return t(lt,{children:e(_e,{richTitle:{icon:Bt,title:ye.CONNECTIONS,badge:{label:T.length.toString(),status:Ve.Unknown}},search:{placeholder:"Search by cluster name",value:F,onChange:e=>R(e),width:"300px"},actions:[{id:Ze(),type:et.Button,buttonProps:{variant:O.Secondary,size:D.S,leftIcon:Kt,onClick:V,disabled:I}}],children:[t(at,{variant:nt.Pretty,maxHeight:l,headerBackgroundColor:S.v2.colors.silver[1e3],isLoading:I,withCheckboxes:!0,columns:Ia,rows:H,rowActionsPushRightPosition:M?`calc(${yl} - 24px)`:void 0,getRowActions:K}),M===$a.BulkConfig&&p&&m&&t(ma,{onClose:()=>P(null),connections:j,selectedConnectionIds:L,setSelectedConnectionIds:E,getEffectiveConfig:p,onApply:m}),M===$a.BulkSource&&b&&f&&t(ha,{onClose:()=>P(null),selectedConnectionIds:L,setSelectedConnectionIds:E,getAllClusterSnapshots:b,persistSources:async e=>await(f?.(e))}),M===$a.BulkDestination&&C&&y&&v&&t(ta,{onClose:()=>P(null),selectedConnectionIds:L,setSelectedConnectionIds:E,getDestinationCategories:C,getPotentialDestinations:y,createDestination:e=>v(e,L)}),M===$a.BulkAction&&k&&t(Kl,{onClose:()=>P(null),selectedConnectionIds:L,setSelectedConnectionIds:E,createAction:e=>k(e,L)}),M===$a.BulkInstrumentationRule&&w&&t(aa,{onClose:()=>P(null),selectedConnectionIds:L,setSelectedConnectionIds:E,createInstrumentationRule:e=>w(e,L)}),t(ul,{target:"connection",isOpen:M===$a.Delete,onClose:()=>{E([]),P(null)},onApprove:async()=>{const e=L[0];e&&(await s(e),await V())}}),t(ot,{isOpen:!!L.length&&!M,richTitle:{icon:ft,title:"Selected Clusters",badge:{label:L.length}},actions:B})]})})},Aa=p.div`
128
129
  display: flex;
129
130
  align-items: center;
130
131
  justify-content: space-between;
@@ -136,10 +137,10 @@ import{jsxs as e,jsx as t,Fragment as l}from"react/jsx-runtime";import{useEffect
136
137
  &:hover {
137
138
  background: ${({theme:e})=>e.v2.colors.silver[700]};
138
139
  }
139
- `,Aa=p.div`
140
- animation-name: ${nt.in};
141
- `,Ta=({pod:n,getExtendedPodInfo:i,onClose:r})=>{const{formatTimeAgo:s}=Ee(),[d,u]=o(null),[p,h]=o(!1);a(()=>{n?i(n.namespace,n.name).then(e=>u(e??null)):(u(null),h(!1))},[n]);const m=c(()=>[{id:Ge(),title:"Node",label:d?.node??"-",withCopy:!0},{id:Ge(),title:"Status",badge:{status:tt(d?.status),label:d?.status??"-"}}],[d]),b=c(()=>d?.containers?.map(e=>({id:Ge(),items:[{id:Ge(),title:"Container",label:e.name??"-"},{id:Ge(),title:"Status",label:e.startedAt?`${e.status} (since ${s(e.startedAt)})`:e.status},{id:Ge(),title:"Ready",badge:{status:e.ready?G.Success:G.Error,leftIcon:e.ready?pt:ft,label:e.ready?"True":"False",invertColors:!0}},{id:Ge(),title:"Started",badge:{status:e.started?G.Success:G.Error,leftIcon:e.started?pt:ft,label:e.started?"True":"False",invertColors:!0}},{id:Ge(),title:"Image Version",label:e.image?.split(":")?.[1]??"-"},{id:Ge(),title:"Image Repository",label:e.image?.split(":")?.[0]??"-"},{id:Ge(),title:"Restarts",label:e.restarts.toString()},{id:Ge(),title:"State Reason",label:e.stateReason??"-"},{id:Ge(),title:"Resource Requests",label:`CPU ${e.resources.requests.cpu} • Memory ${e.resources.requests.memory}`},{id:Ge(),title:"Resource Limits",label:`CPU ${e.resources.limits.cpu} • Memory ${e.resources.limits.memory}`}]}))||[],[d]);return e(q,{isOpen:!!n,header:{icon:jt,title:"Pod Information",onClose:r},children:[d?null:t(z,{children:t(lt,{})}),d?e(l,{children:[t(je,{richTitle:{icon:jt,title:d.name,withCopy:!0},children:e(g,{$gap:24,children:[t(_e,{cellsPerRow:2,items:m}),b.length>0&&e(g,{$gap:12,children:[e(Na,{onClick:()=>h(e=>!e),children:[t(J,{children:"Containers Overview"}),t(ke,{icon:p?St:$t})]}),p&&b.map(({id:e,items:l})=>t(Aa,{children:t(_e,{cellsPerRow:2,items:l})},e))]})]})}),t(je,{richTitle:{icon:Pt,title:"Kubectl Commands"},children:e(g,{$gap:12,children:[t(at,{value:`kubectl get pod ${d.name} -n ${d.namespace} -o yaml`}),t(at,{value:`kubectl describe pod ${d.name} -n ${d.namespace}`}),t(at,{value:`kubectl logs ${d.name} -n ${d.namespace}`})]})}),t(_t,{yaml:d.manifestYAML,defaultOpen:!0})]}):null]})};var Da;!function(e){e.PodName="podName",e.Status="status",e.Restarts="restarts",e.NodeName="nodeName",e.SpanDropDrate="spanDropDrate",e.Age="age",e.DockerImage="dockerImage"}(Da||(Da={}));const Fa=[{key:Da.PodName,label:"Pod Name"},{key:Da.Status,label:"Status"},{key:Da.Restarts,label:"Restarts",textAlign:"right"},{key:Da.NodeName,label:"Node Name"},{key:Da.Age,label:"Age",textAlign:"right"},{key:Da.DockerImage,label:"Docker Image",textAlign:"right"}],Oa=({isLoading:l,tableRowsMaxHeight:a,pods:n,getExtendedPodInfo:i})=>{const r=h(),{formatTimeAgo:s}=Ee(),[d,u]=o(null),p=c(()=>n.map(l=>({onClick:()=>u(l),cells:[{key:Da.PodName,rawValue:l.name},{key:Da.Status,rawValue:l.status,component:()=>{return e=l.status,t(pe,{status:tt(e),label:e});var e}},{key:Da.Restarts,rawValue:l.restartsCount.toString()},{key:Da.NodeName,rawValue:l.nodeName},{key:Da.SpanDropDrate,rawValue:0,component:()=>{const{collectorMetrics:a}=l;if(!a)return t(J,{children:"-"});const n=(a?.metricsAcceptedRps??0)+(a?.metricsDroppedRps??0),o=n>0?Math.round((a?.metricsDroppedRps??0)/n*100):0,i=o>0?G.Error:G.Success,r=(a?.exporterSuccessRps??0)+(a?.exporterFailedRps??0),s=r>0?Math.round((a?.exporterFailedRps??0)/r*100):0,c=s>0?G.Error:G.Success;return e(A,{$gap:4,children:[t(oe,{text:`Accepted: ${a.metricsAcceptedRps.toLocaleString()}, Dropped: ${a.metricsDroppedRps.toLocaleString()}`,children:t(pe,{status:i,label:`Receiver ${o}%`,leftIcon:i===G.Error?qt:Ht,useSecondaryTone:!0,invertColors:!0})}),t(oe,{text:`Success: ${a.exporterSuccessRps.toLocaleString()}, Failed: ${a.exporterFailedRps.toLocaleString()}`,children:t(pe,{status:c,label:`Exporter ${s}%`,leftIcon:c===G.Error?qt:Ht,useSecondaryTone:!0,invertColors:!0})})]})}},{key:Da.Age,rawValue:s(l.creationTimestamp)},{key:Da.DockerImage,rawValue:l.image}]})),[n,r]);return e(je,{richTitle:{icon:jt,title:"Pods"},children:[t(Ze,{variant:Qe.Data,maxHeight:a,isLoading:l,columns:Fa,rows:p}),t(Ta,{pod:d,getExtendedPodInfo:i,onClose:()=>u(null)})]})};var Va;!function(e){e.Gateway="gateway",e.Node="node"}(Va||(Va={}));const Ma=[{value:Va.Gateway,label:"Gateway"},{value:Va.Node,label:"Node Collector"}],Ra=p.div`
140
+ `,Da=p.div`
141
+ animation-name: ${ct.in};
142
+ `,Oa=({pod:n,getExtendedPodInfo:i,onClose:r})=>{const{formatTimeAgo:s}=Be(),[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:Ze(),title:"Node",label:d?.node??"-",withCopy:!0},{id:Ze(),title:"Status",badge:{status:it(d?.status),label:d?.status??"-"}}],[d]),b=c(()=>d?.containers?.map(e=>({id:Ze(),items:[{id:Ze(),title:"Container",label:e.name??"-"},{id:Ze(),title:"Status",label:e.startedAt?`${e.status} (since ${s(e.startedAt)})`:e.status},{id:Ze(),title:"Ready",badge:{status:e.ready?G.Success:G.Error,leftIcon:e.ready?ft:wt,label:e.ready?"True":"False",invertColors:!0}},{id:Ze(),title:"Started",badge:{status:e.started?G.Success:G.Error,leftIcon:e.started?ft:wt,label:e.started?"True":"False",invertColors:!0}},{id:Ze(),title:"Image Version",label:e.image?.split(":")?.[1]??"-"},{id:Ze(),title:"Image Repository",label:e.image?.split(":")?.[0]??"-"},{id:Ze(),title:"Restarts",label:e.restarts.toString()},{id:Ze(),title:"State Reason",label:e.stateReason??"-"},{id:Ze(),title:"Resource Requests",label:`CPU ${e.resources.requests.cpu} • Memory ${e.resources.requests.memory}`},{id:Ze(),title:"Resource Limits",label:`CPU ${e.resources.limits.cpu} • Memory ${e.resources.limits.memory}`}]}))||[],[d]);return e(q,{isOpen:!!n,header:{icon:Wt,title:"Pod Information",onClose:r},children:[d?null:t(z,{children:t(rt,{})}),d?e(l,{children:[t(_e,{richTitle:{icon:Wt,title:d.name,withCopy:!0},children:e(g,{$gap:24,children:[t(Xe,{cellsPerRow:2,items:m}),b.length>0&&e(g,{$gap:12,children:[e(Aa,{onClick:()=>h(e=>!e),children:[t(J,{children:"Containers Overview"}),t(ke,{icon:p?Tt:At})]}),p&&b.map(({id:e,items:l})=>t(Da,{children:t(Xe,{cellsPerRow:2,items:l})},e))]})]})}),t(_e,{richTitle:{icon:qt,title:"Kubectl Commands"},children:e(g,{$gap:12,children:[t(st,{value:`kubectl get pod ${d.name} -n ${d.namespace} -o yaml`}),t(st,{value:`kubectl describe pod ${d.name} -n ${d.namespace}`}),t(st,{value:`kubectl logs ${d.name} -n ${d.namespace}`})]})}),t(Xt,{yaml:d.manifestYAML,defaultOpen:!0})]}):null]})};var Va;!function(e){e.PodName="podName",e.Status="status",e.Restarts="restarts",e.NodeName="nodeName",e.SpanDropDrate="spanDropDrate",e.Age="age",e.DockerImage="dockerImage"}(Va||(Va={}));const Fa=[{key:Va.PodName,label:"Pod Name"},{key:Va.Status,label:"Status"},{key:Va.Restarts,label:"Restarts",textAlign:"right"},{key:Va.NodeName,label:"Node Name"},{key:Va.Age,label:"Age",textAlign:"right"},{key:Va.DockerImage,label:"Docker Image",textAlign:"right"}],Ra=({isLoading:l,tableRowsMaxHeight:a,pods:n,getExtendedPodInfo:i})=>{const r=h(),{formatTimeAgo:s}=Be(),[d,u]=o(null),p=c(()=>n.map(l=>({onClick:()=>u(l),cells:[{key:Va.PodName,rawValue:l.name},{key:Va.Status,rawValue:l.status,component:()=>{return e=l.status,t(pe,{status:it(e),label:e});var e}},{key:Va.Restarts,rawValue:l.restartsCount.toString()},{key:Va.NodeName,rawValue:l.nodeName},{key:Va.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(T,{$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?_t:Gt,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?_t:Gt,useSecondaryTone:!0,invertColors:!0})})]})}},{key:Va.Age,rawValue:s(l.creationTimestamp)},{key:Va.DockerImage,rawValue:l.image}]})),[n,r]);return e(_e,{richTitle:{icon:Wt,title:"Pods"},children:[t(at,{variant:nt.Data,maxHeight:a,isLoading:l,columns:Fa,rows:p}),t(Oa,{pod:d,getExtendedPodInfo:i,onClose:()=>u(null)})]})};var Ma;!function(e){e.Gateway="gateway",e.Node="node"}(Ma||(Ma={}));const Pa=[{value:Ma.Gateway,label:"Gateway"},{value:Ma.Node,label:"Node Collector"}],La=p.div`
142
143
  display: flex;
143
144
  align-items: center;
144
145
  justify-content: space-between;
145
- `,Pa=({selectedTab:l,setSelectedTab:a,onClickDownloadDiagnose:n,onClickRefresh:o,loading:i,disabled:r})=>{const s=c(()=>{const e=[];return n&&e.push({id:Ge(),type:Ue.Button,buttonProps:{label:"Download Diagnose",leftIcon:Rt,size:D.S,variant:F.Text,onClick:n,disabled:r}}),o&&e.push({id:Ge(),type:Ue.Button,buttonProps:{label:"Refresh",leftIcon:Et,size:D.S,variant:F.Text,onClick:o,disabled:r,loading:i}}),e},[n,o,r,i]);return e(Ra,{children:[e(A,{$gap:12,children:[e(A,{$gap:8,children:[t(Kt,{size:32}),t(J,{size:K.M,weight:500,children:"Pipeline Collectors"})]}),t(Y,{options:Ma,selected:l,setSelected:a,disabled:r})]}),t(ot,{actions:s})]})},La=({isOpen:e,onClose:l,title:a,yaml:n})=>t(q,{isOpen:e,header:{icon:Bt,title:a,onClose:l},children:t(_t,{yaml:n,defaultOpen:!0})});var Ea;!function(e){e.ManifestYaml="manifest-yaml",e.ConfigMapYaml="configmap-yaml"}(Ea||(Ea={}));const za=({richTitle:l,statusCard:a,textCards:n,manifestYaml:i,configMapYaml:r})=>{const[s,c]=o(null);return e(je,{richTitle:l,actions:[{id:Ge(),type:Ue.ButtonDropData,buttonProps:{variant:F.Secondary,size:D.S,label:"View YAML",onClick:e=>c(e)},dropDataProps:{items:[{id:Ea.ManifestYaml,label:l.title,icon:Wt},{id:Ea.ConfigMapYaml,label:"ConfigMap",icon:Wt}]}}],children:[e(A,{$gap:16,children:[t(it,{...a}),n.map(e=>t(rt,{...e},e.title))]}),t(La,{isOpen:s===Ea.ManifestYaml,onClose:()=>c(null),title:l.title,yaml:i}),t(La,{isOpen:s===Ea.ConfigMapYaml,onClose:()=>c(null),title:"ConfigMap",yaml:r})]})},ja=e=>{switch(e){case st.Healthy:return"All desired replicas are updated, available, and ready";case st.Updating:return"Workload is progressing towards desired state (e.g., updating pods)";case st.Degraded:return"Progressing but with availability issues (e.g., not enough available replicas)";case st.Failed:return"Progress deadline exceeded or an unrecoverable error occurred";case st.Down:return"No available replicas";case st.Unknown:return"Status cannot be determined from current signals";default:return"Status unknown"}},qa=({minSupportedVersion:l=0,tableRowsMaxHeight:n,getGatewayInfo:i,getGatewayPods:r,getNodeCollectorInfo:s,getNodeCollectorPods:d,getExtendedPodInfo:p})=>{const{formatTimeAgo:h}=Ee(),{isVersionSupported:m,version:g}=We(l),[b,f]=o(!1),[C,v]=o(Va.Gateway),[y,k]=o(null),[w,S]=o([]),[$,x]=o(null),[I,N]=o([]),A=u(async()=>{f(!0);try{switch(C){case Va.Gateway:k(await i()??null),S(await r()??[]);break;case Va.Node:x(await s()??null),N(await d()??[])}}catch(e){}f(!1)},[C]);a(()=>{A()},[A]);const T=c(()=>(e=>{switch(e){case Va.Gateway:return"Deployment";case Va.Node:return"DaemonSet";default:return"Pipeline Collectors"}})(C),[C]),D=c(()=>((e,t,l,a)=>{const n={status:Te.Disabled,label:"No rollouts yet"};let o=!1,i=null;switch(e){case Va.Gateway:o=t?.rolloutInProgress??!1,i=t?.lastRolloutAt??null;break;case Va.Node:o=l?.rolloutInProgress??!1,i=l?.lastRolloutAt??null;break;default:return n}return o?{status:G.Info,label:"Rollout in progress",rightIcon:Et,useSecondaryTone:!0}:i?{status:Te.Disabled,label:`Last Rollout: ${a(i)}`}:n})(C,y,$,h),[y,$,C,h]),F=c(()=>((e,t,l,a)=>{let n=a?G.Info:Te.Unknown,o=a?"Loading":st.Unknown,i=a?"Fetching data...":ja(st.Unknown);switch(e){case Va.Gateway:n=t?.status?tt(t?.status):n,o=t?.status??o,i=t?.status?ja(t.status):i;break;case Va.Node:n=l?.status?tt(l?.status):n,o=l?.status??o,i=l?.status?ja(l.status):i}return{status:n,title:o,description:i}})(C,y,$,b),[y,$,C,b]),O=c(()=>((e,t,l,a)=>{switch(e){case Va.Gateway:return[{title:"HPA Spec (Replicas)",cells:[{label:"Min.",value:t?.hpa?.min.toString()??"-",isLoading:a},{label:"Max.",value:t?.hpa?.max.toString()??"-",isLoading:a},{label:"Current",value:t?.hpa?.current.toString()??"-",isLoading:a},{label:"Desired",value:t?.hpa?.desired.toString()??"-",isLoading:a}]},{title:"Requests",cells:[{label:"CPU",value:t?.resources?.requests.cpu??"-",isLoading:a},{label:"Memory",value:t?.resources?.requests.memory??"-",isLoading:a}]},{title:"Limits",cells:[{label:"CPU",value:t?.resources?.limits.cpu??"-",isLoading:a},{label:"Memory",value:t?.resources?.limits.memory??"-",isLoading:a}]},{title:"Docker Image",cells:[{value:t?.imageVersion??"-",isLoading:a}]}];case Va.Node:return[{title:"Nodes",cells:[{label:"Desired",value:l?.nodes?.desired.toString()??"-",isLoading:a},{label:"Ready",value:l?.nodes?.ready.toString()??"-",isLoading:a}]},{title:"Requests",cells:[{label:"CPU",value:l?.resources?.requests.cpu??"-",isLoading:a},{label:"Memory",value:l?.resources?.requests.memory??"-",isLoading:a}]},{title:"Limits",cells:[{label:"CPU",value:l?.resources?.limits.cpu??"-",isLoading:a},{label:"Memory",value:l?.resources?.limits.memory??"-",isLoading:a}]},{title:"Docker Image",cells:[{value:l?.imageVersion??"-",isLoading:a}]}];default:return[]}})(C,y,$,b),[y,$,C,b]),V=c(()=>(C===Va.Gateway?y?.manifestYAML:$?.manifestYAML)??"",[y,$,C]),M=c(()=>(C===Va.Gateway?y?.configMapYAML:$?.configMapYAML)??"",[y,$,C]),R=c(()=>C===Va.Gateway?w:I,[w,I,C]);return e(Xe,{children:[t(Pa,{disabled:!m,loading:b,selectedTab:C,setSelectedTab:v,onClickDownloadDiagnose:void 0,onClickRefresh:A}),e(ct,{children:[t(za,{richTitle:{icon:Bt,title:T,badge:D},statusCard:F,textCards:O,manifestYaml:V,configMapYaml:M}),t(Oa,{isLoading:b,tableRowsMaxHeight:n,pods:R,getExtendedPodInfo:p}),!m&&t(cl,{minSupportedVersion:l,currentVersion:g||""})]})]})};export{El as AddActionDrawer,wl as AddActionForm,Yl as AddDestinationDrawer,$l as AddDestinationForm,Zl as AddRuleDrawer,Ol as AddRuleForm,ua as AddSourceDrawer,Ia as CentralConnections,pa as EditConfigDrawer,qa as PipelineCollectors,ka as SystemDrawer};
146
+ `,Ea=({selectedTab:l,setSelectedTab:a,onClickDownloadDiagnose:n,onClickRefresh:o,loading:i,disabled:r})=>{const s=c(()=>{const e=[];return n&&e.push({id:Ze(),type:et.Button,buttonProps:{label:"Download Diagnose",leftIcon:jt,size:D.S,variant:O.Text,onClick:n,disabled:r}}),o&&e.push({id:Ze(),type:et.Button,buttonProps:{label:"Refresh",leftIcon:Kt,size:D.S,variant:O.Text,onClick:o,disabled:r,loading:i}}),e},[n,o,r,i]);return e(La,{children:[e(T,{$gap:12,children:[e(T,{$gap:8,children:[t(Jt,{size:32}),t(J,{size:K.M,weight:500,children:"Pipeline Collectors"})]}),t(Y,{options:Pa,selected:l,setSelected:a,disabled:r})]}),t(dt,{actions:s})]})},za=({isOpen:e,onClose:l,title:a,yaml:n})=>t(q,{isOpen:e,header:{icon:Ut,title:a,onClose:l},children:t(Xt,{yaml:n,defaultOpen:!0})});var ja;!function(e){e.ManifestYaml="manifest-yaml",e.ConfigMapYaml="configmap-yaml"}(ja||(ja={}));const qa=({richTitle:l,statusCard:a,textCards:n,manifestYaml:i,configMapYaml:r})=>{const[s,c]=o(null);return e(_e,{richTitle:l,actions:[{id:Ze(),type:et.ButtonDropData,buttonProps:{variant:O.Secondary,size:D.S,label:"View YAML",onClick:e=>c(e)},dropDataProps:{items:[{id:ja.ManifestYaml,label:l.title,icon:Yt},{id:ja.ConfigMapYaml,label:"ConfigMap",icon:Yt}]}}],children:[e(T,{$gap:16,children:[t(ut,{...a}),n.map(e=>t(pt,{...e},e.title))]}),t(za,{isOpen:s===ja.ManifestYaml,onClose:()=>c(null),title:l.title,yaml:i}),t(za,{isOpen:s===ja.ConfigMapYaml,onClose:()=>c(null),title:"ConfigMap",yaml:r})]})},Ha=e=>{switch(e){case ht.Healthy:return"All desired replicas are updated, available, and ready";case ht.Updating:return"Workload is progressing towards desired state (e.g., updating pods)";case ht.Degraded:return"Progressing but with availability issues (e.g., not enough available replicas)";case ht.Failed:return"Progress deadline exceeded or an unrecoverable error occurred";case ht.Down:return"No available replicas";case ht.Unknown:return"Status cannot be determined from current signals";default:return"Status unknown"}},Ka=({minSupportedVersion:l=0,tableRowsMaxHeight:n,getGatewayInfo:i,getGatewayPods:r,getNodeCollectorInfo:s,getNodeCollectorPods:d,getExtendedPodInfo:p})=>{const{formatTimeAgo:h}=Be(),{isVersionSupported:m,version:g}=Ae(l),[b,f]=o(!1),[C,y]=o(Ma.Gateway),[v,k]=o(null),[w,S]=o([]),[$,x]=o(null),[I,N]=o([]),T=u(async()=>{f(!0);try{switch(C){case Ma.Gateway:k(await i()??null),S(await r()??[]);break;case Ma.Node:x(await s()??null),N(await d()??[])}}catch(e){}f(!1)},[C]);a(()=>{T()},[T]);const A=c(()=>(e=>{switch(e){case Ma.Gateway:return"Deployment";case Ma.Node:return"DaemonSet";default:return"Pipeline Collectors"}})(C),[C]),D=c(()=>((e,t,l,a)=>{const n={status:Ve.Disabled,label:"No rollouts yet"};let o=!1,i=null;switch(e){case Ma.Gateway:o=t?.rolloutInProgress??!1,i=t?.lastRolloutAt??null;break;case Ma.Node:o=l?.rolloutInProgress??!1,i=l?.lastRolloutAt??null;break;default:return n}return o?{status:G.Info,label:"Rollout in progress",rightIcon:Kt,useSecondaryTone:!0}:i?{status:Ve.Disabled,label:`Last Rollout: ${a(i)}`}:n})(C,v,$,h),[v,$,C,h]),O=c(()=>((e,t,l,a)=>{let n=a?G.Info:Ve.Unknown,o=a?"Loading":ht.Unknown,i=a?"Fetching data...":Ha(ht.Unknown);switch(e){case Ma.Gateway:n=t?.status?it(t?.status):n,o=t?.status??o,i=t?.status?Ha(t.status):i;break;case Ma.Node:n=l?.status?it(l?.status):n,o=l?.status??o,i=l?.status?Ha(l.status):i}return{status:n,title:o,description:i}})(C,v,$,b),[v,$,C,b]),V=c(()=>((e,t,l,a)=>{switch(e){case Ma.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 Ma.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=c(()=>(C===Ma.Gateway?v?.manifestYAML:$?.manifestYAML)??"",[v,$,C]),R=c(()=>(C===Ma.Gateway?v?.configMapYAML:$?.configMapYAML)??"",[v,$,C]),M=c(()=>C===Ma.Gateway?w:I,[w,I,C]);return e(lt,{children:[t(Ea,{disabled:!m,loading:b,selectedTab:C,setSelectedTab:y,onClickDownloadDiagnose:void 0,onClickRefresh:T}),e(mt,{children:[t(qa,{richTitle:{icon:Ut,title:A,badge:D},statusCard:O,textCards:V,manifestYaml:F,configMapYaml:R}),t(Ra,{isLoading:b,tableRowsMaxHeight:n,pods:M,getExtendedPodInfo:p}),!m&&t(ml,{minSupportedVersion:l,currentVersion:g||""})]})]})};export{Kl as AddActionDrawer,Nl as AddActionForm,ta as AddDestinationDrawer,Al as AddDestinationForm,aa as AddRuleDrawer,Ll as AddRuleForm,ha as AddSourceDrawer,Ta as CentralConnections,ma as EditConfigDrawer,Ka as PipelineCollectors,Sa as SystemDrawer};