@odigos/ui-kit 0.0.228 → 0.0.230

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,4 +1,4 @@
1
- import{c5 as e,p as a,T as l,k as t,e9 as r,e as s,am as o,w as i,j as n,ap as d,l as c,I as p,h as u,as as h,aw as g,n as m,F as v,d as f,S as b,an as y,aa as x,ea as S,eb as w,ax as C,ec as k,s as T,ed as $,t as L,ee as P,ef as M,eg as A,eh as O,ei as N,ej as z,ek as D,el as R,em as X,en as I,eo as E,ep as H,eq as V,bj as j,a as K,B as U,er as q,es as G,et as J,eu as B,ev as F,ew as W,ex as Z,ey as Y,ez as _,a7 as Q,a3 as ee,eA as ae,eB as le,ab as te,a6 as re,eC as se,eD as oe,eE as ie,eF as ne,b2 as de,eG as ce,eH as pe,eI as ue,eJ as he,eK as ge,eL as me,eM as ve,eN as fe,bG as be,o as ye,eO as xe,eP as Se,eQ as we,eR as Ce,eS as ke,eT as Te,eU as $e,eV as Le,eW as Pe,eX as Me,z as Ae,eY as Oe,E as Ne,eZ as ze,e_ as De,e$ as Re,f0 as Xe,f1 as Ie,dO as Ee,_ as He,ao as Ve,dm as je,f as Ke,f2 as Ue,d7 as qe,b as Ge,N as Je,aI as Be,aj as Fe,bw as We,dP as Ze}from"./ui-components-B4xHrszQ.js";import{jsx as Ye,jsxs as _e,Fragment as Qe}from"react/jsx-runtime";import{OdigosLogoTextEnterprise as ea,OdigosLogoTextCommunity as aa,EditIcon as la,ArrowLeftIcon as ta,ArrowRightIcon as ra,VSquareIcon as sa}from"../icons.js";import{useCallback as oa,useMemo as ia,useState as na,useRef as da,useEffect as ca,forwardRef as pa,useImperativeHandle as ua}from"react";import ha,{useTheme as ga}from"styled-components";import"./index-DJZLguZq.js";const ma=({isOpen:a,onClose:l,onDeny:t,onApprove:r})=>Ye(e,{title:"Discard changes?",description:"You have unsaved changes.\nIf you cancel now, your changes won't be saved.",isOpen:a,onClose:l,onDeny:t,denyLabel:"Keep editing",onApprove:r,approveLabel:"Discard changes"}),va=({isOpen:a,onClose:l,onDeny:t,onApprove:r,action:s="delete",target:o})=>{const i=s.charAt(0).toUpperCase()+s.substring(1),n=o?.endsWith("s")?"these":"this";return Ye(e,{title:`${i}${o?` ${o}`:""}?`,description:`Are you sure you want to ${s}${o?` ${n} ${o}`:""}?`,isOpen:a,onClose:l,onDeny:t,denyLabel:"Go back",onApprove:r,approveLabel:i})},fa=({componentType:e,inputType:h,name:g,label:m,tooltip:v,badge:f,placeholder:b,required:y,disabled:x,value:S,setValue:w,errorMessage:C,warnMessage:k,helpMessage:T,dropdownOptions:$,dropdownNoSearch:L,dropdownNoCheckbox:P,timeUnits:M,timeDefaultUnit:A})=>{switch(e){case a.Input:return Ye(p,{name:g,type:h,label:m,tooltip:v,badge:f,placeholder:b,required:y,disabled:x,value:S??"",onChange:e=>{const a=e.target.value;w(h===u.Number?""===a?null:Number(a):a)},errorMessage:C,warnMessage:k,helpMessage:T},g);case a.MultiInput:return Ye(c,{name:g,label:m,tooltip:v,badge:f,placeholder:b,required:y,disabled:x,values:Array.isArray(S)?S:d(S,[]),setValues:e=>w(e),errorMessage:C,warnMessage:k,helpMessage:T},g);case a.KeyValuePair:return Ye(n,{name:g,label:m,tooltip:v,badge:f,required:y,disabled:x,limitFieldsPerRow:2,columns:[{keyName:"key",label:"Key"},{keyName:"value",label:"Value"}],values:Array.isArray(S)?S:d(S,[]),setValues:e=>w(e),errorMessage:C,warnMessage:k,helpMessage:T},g);case a.TextArea:return Ye(i,{name:g,label:m,tooltip:v,badge:f,required:y,disabled:x,placeholder:b,value:S??"",onChange:e=>w(e.target.value),errorMessage:C,warnMessage:k,helpMessage:T},g);case a.Dropdown:return Ye(o,{name:g,label:m,tooltip:v,badge:f,placeholder:b,required:y,disabled:x,withSearch:!L,options:$?.map(e=>({id:e.id||"",label:e.value||"",withCheckbox:!P}))||[],values:S?[String(S)]:[],setValues:e=>w(e[0]),errorMessage:C,warnMessage:k,helpMessage:T},g);case a.Checkbox:return Ye(s,{name:g,label:m,tooltip:v,badge:f,value:!0===S||"true"===S,onChange:e=>w(String(e)),disabled:x,errorMessage:C,warnMessage:k,helpMessage:T},g);case a.Time:return Ye(r,{name:g,label:m,tooltip:v,badge:f,placeholder:b,required:y,disabled:x,value:S??"",setValue:e=>w(e),units:M,defaultUnit:A,errorMessage:C,warnMessage:k,helpMessage:T},g);case a.Toggle:return Ye(l,{name:g,labelAlign:t.Right,label:m,tooltip:v,badge:f,value:!0===S||"true"===S,onChange:e=>w(String(e)),disabled:x,errorMessage:C,warnMessage:k,helpMessage:T},g);default:return null}},ba=({size:e=200})=>{const{tier:a}=h();return a===g.Onprem?Ye(ea,{size:e}):Ye(aa,{size:e})},ya=[{value:"50",label:"50%"},{value:"25",label:"25%"},{value:"10",label:"10%"},{value:"1",label:"1%"},{value:"0",label:"0%"},{value:"custom",label:"Custom"}],xa=[{value:"10",label:"10%"},{value:"1",label:"1%"},{value:"0.5",label:"0.5%"},{value:"0.1",label:"0.1%"},{value:"0",label:"0%"},{value:"custom",label:"Custom"}],Sa=[{value:"5000",label:"5s"},{value:"1000",label:"1s"},{value:"500",label:"500ms"},{value:"100",label:"100ms"},{value:"50",label:"50ms"},{value:"custom",label:"Custom"}],wa=({description:e,options:a,selected:l,onSelect:t,customName:r,customLabel:s,customPlaceholder:o,customValue:i,onCustomChange:n})=>_e(m,{$gap:16,$alignItems:"flex-end",children:[_e(v,{$gap:6,children:[Ye(f,{label:e}),Ye(b,{size:y.S,options:a,selected:l,setSelected:t})]}),"custom"===l&&Ye(p,{name:r,label:s,placeholder:o,type:u.Number,value:i,onChange:n,width:160})]}),Ca=()=>{},ka=e=>e.readOnly?Ye(Ta,{rule:e.rule}):Ye($a,{ruleType:e.ruleType,formState:e.formState,onChange:e.onChange}),Ta=({rule:e})=>{const a=ga(),r=null!=e.durationAtLeastMs;return e.error?Ye(x,{richTitle:{title:S},children:Ye(l,{name:"sampling-view-toggle-keep-errors",onChange:Ca,value:!0,size:C.S,label:w,labelAlign:t.Right})}):r?Ye(x,{richTitle:{title:k},children:_e("div",{children:[Ye(T,{size:L.XXXS,color:a.v2.colors.silver[200],children:$}),Ye(T,{size:L.XS,children:`${e.durationAtLeastMs}ms`})]})}):null},$a=({ruleType:e,formState:a,onChange:r})=>{const s=oa(e=>r({durationPreset:e}),[r]),o=oa(e=>r({customDurationMs:e.target.value}),[r]);return"Error"===e?Ye(x,{richTitle:{title:S,subTitle:P},children:Ye(l,{name:"sampling-toggle-keep-errors",value:!0,onChange:Ca,size:C.S,label:w,labelAlign:t.Right})}):"Duration"===e?Ye(x,{richTitle:{title:k,subTitle:M},children:Ye(wa,{description:$,options:Sa,selected:a.durationPreset,onSelect:s,customName:"sampling-input-custom-duration",customLabel:A,customPlaceholder:"200ms",customValue:a.customDurationMs,onCustomChange:o})}):null},La=ha.div`
1
+ import{c5 as e,p as a,T as l,k as t,e9 as r,e as s,am as o,w as i,j as n,ap as d,l as c,I as p,h as u,as as h,aw as g,n as m,F as v,d as f,S as b,an as y,aa as x,ea as S,eb as w,ax as C,ec as k,s as T,ed as $,t as L,ee as P,ef as M,eg as A,eh as O,ei as N,ej as z,ek as D,el as R,em as X,en as I,eo as E,ep as H,eq as V,bj as j,a as K,B as U,er as q,es as G,et as J,eu as B,ev as F,ew as W,ex as Z,ey as Y,ez as _,a7 as Q,a3 as ee,eA as ae,eB as le,ab as te,a6 as re,eC as se,eD as oe,eE as ie,eF as ne,b2 as de,eG as ce,eH as pe,eI as ue,eJ as he,eK as ge,eL as me,eM as ve,eN as fe,bG as be,o as ye,eO as xe,eP as Se,eQ as we,eR as Ce,eS as ke,eT as Te,eU as $e,eV as Le,eW as Pe,eX as Me,z as Ae,eY as Oe,E as Ne,eZ as ze,e_ as De,e$ as Re,f0 as Xe,f1 as Ie,dO as Ee,_ as He,ao as Ve,dm as je,f as Ke,f2 as Ue,d7 as qe,b as Ge,N as Je,aI as Be,aj as Fe,bw as We,dP as Ze}from"./ui-components-B4xHrszQ.js";import{jsx as Ye,jsxs as _e,Fragment as Qe}from"react/jsx-runtime";import{OdigosLogoTextEnterprise as ea,OdigosLogoTextCommunity as aa,EditIcon as la,ArrowLeftIcon as ta,ArrowRightIcon as ra,VSquareIcon as sa}from"../icons.js";import{useCallback as oa,useMemo as ia,useState as na,useRef as da,useEffect as ca,forwardRef as pa,useImperativeHandle as ua}from"react";import ha,{useTheme as ga}from"styled-components";import"./index-DJZLguZq.js";const ma=({isOpen:a,onClose:l,onDeny:t,onApprove:r})=>Ye(e,{title:"Discard changes?",description:"You have unsaved changes.\nIf you cancel now, your changes won't be saved.",isOpen:a,onClose:l,onDeny:t,denyLabel:"Keep editing",onApprove:r,approveLabel:"Discard changes"}),va=({isOpen:a,onClose:l,onDeny:t,onApprove:r,action:s="delete",target:o})=>{const i=s.charAt(0).toUpperCase()+s.substring(1),n=o?.endsWith("s")?"these":"this";return Ye(e,{title:`${i}${o?` ${o}`:""}?`,description:`Are you sure you want to ${s}${o?` ${n} ${o}`:""}?`,isOpen:a,onClose:l,onDeny:t,denyLabel:"Go back",onApprove:r,approveLabel:i})},fa=({componentType:e,inputType:h,name:g,label:m,tooltip:v,badge:f,placeholder:b,required:y,disabled:x,value:S,setValue:w,errorMessage:C,warnMessage:k,helpMessage:T,dropdownOptions:$,dropdownNoSearch:L,dropdownNoCheckbox:P,timeUnits:M,timeDefaultUnit:A})=>{switch(e){case a.Input:return Ye(p,{name:g,type:h,label:m,tooltip:v,badge:f,placeholder:b,required:y,disabled:x,value:S??"",onChange:e=>{const a=e.target.value;w(h===u.Number?""===a?null:Number(a):a)},errorMessage:C,warnMessage:k,helpMessage:T},g);case a.MultiInput:return Ye(c,{name:g,label:m,tooltip:v,badge:f,placeholder:b,required:y,disabled:x,values:Array.isArray(S)?S:d(S,[]),setValues:e=>w(e),errorMessage:C,warnMessage:k,helpMessage:T},g);case a.KeyValuePair:return Ye(n,{name:g,label:m,tooltip:v,badge:f,required:y,disabled:x,limitFieldsPerRow:2,columns:[{keyName:"key",label:"Key"},{keyName:"value",label:"Value"}],values:Array.isArray(S)?S:d(S,[]),setValues:e=>w(e),errorMessage:C,warnMessage:k,helpMessage:T},g);case a.TextArea:return Ye(i,{name:g,label:m,tooltip:v,badge:f,required:y,disabled:x,placeholder:b,value:S??"",onChange:e=>w(e.target.value),errorMessage:C,warnMessage:k,helpMessage:T},g);case a.Dropdown:return Ye(o,{name:g,label:m,tooltip:v,badge:f,placeholder:b,required:y,disabled:x,withSearch:!L,options:$?.map(e=>({id:e.id||"",label:e.value||"",withCheckbox:!P}))||[],values:S?[String(S)]:[],setValues:e=>w(e[0]),errorMessage:C,warnMessage:k,helpMessage:T},g);case a.Checkbox:return Ye(s,{name:g,label:m,tooltip:v,badge:f,value:!0===S||"true"===S,onChange:e=>w(e),disabled:x,errorMessage:C,warnMessage:k,helpMessage:T},g);case a.Time:return Ye(r,{name:g,label:m,tooltip:v,badge:f,placeholder:b,required:y,disabled:x,value:S??"",setValue:e=>w(e),units:M,defaultUnit:A,errorMessage:C,warnMessage:k,helpMessage:T},g);case a.Toggle:return Ye(l,{name:g,labelAlign:t.Right,label:m,tooltip:v,badge:f,value:!0===S||"true"===S,onChange:e=>w(e),disabled:x,errorMessage:C,warnMessage:k,helpMessage:T},g);default:return null}},ba=({size:e=200})=>{const{tier:a}=h();return a===g.Onprem?Ye(ea,{size:e}):Ye(aa,{size:e})},ya=[{value:"50",label:"50%"},{value:"25",label:"25%"},{value:"10",label:"10%"},{value:"1",label:"1%"},{value:"0",label:"0%"},{value:"custom",label:"Custom"}],xa=[{value:"10",label:"10%"},{value:"1",label:"1%"},{value:"0.5",label:"0.5%"},{value:"0.1",label:"0.1%"},{value:"0",label:"0%"},{value:"custom",label:"Custom"}],Sa=[{value:"5000",label:"5s"},{value:"1000",label:"1s"},{value:"500",label:"500ms"},{value:"100",label:"100ms"},{value:"50",label:"50ms"},{value:"custom",label:"Custom"}],wa=({description:e,options:a,selected:l,onSelect:t,customName:r,customLabel:s,customPlaceholder:o,customValue:i,onCustomChange:n})=>_e(m,{$gap:16,$alignItems:"flex-end",children:[_e(v,{$gap:6,children:[Ye(f,{label:e}),Ye(b,{size:y.S,options:a,selected:l,setSelected:t})]}),"custom"===l&&Ye(p,{name:r,label:s,placeholder:o,type:u.Number,value:i,onChange:n,width:160})]}),Ca=()=>{},ka=e=>e.readOnly?Ye(Ta,{rule:e.rule}):Ye($a,{ruleType:e.ruleType,formState:e.formState,onChange:e.onChange}),Ta=({rule:e})=>{const a=ga(),r=null!=e.durationAtLeastMs;return e.error?Ye(x,{richTitle:{title:S},children:Ye(l,{name:"sampling-view-toggle-keep-errors",onChange:Ca,value:!0,size:C.S,label:w,labelAlign:t.Right})}):r?Ye(x,{richTitle:{title:k},children:_e("div",{children:[Ye(T,{size:L.XXXS,color:a.v2.colors.silver[200],children:$}),Ye(T,{size:L.XS,children:`${e.durationAtLeastMs}ms`})]})}):null},$a=({ruleType:e,formState:a,onChange:r})=>{const s=oa(e=>r({durationPreset:e}),[r]),o=oa(e=>r({customDurationMs:e.target.value}),[r]);return"Error"===e?Ye(x,{richTitle:{title:S,subTitle:P},children:Ye(l,{name:"sampling-toggle-keep-errors",value:!0,onChange:Ca,size:C.S,label:w,labelAlign:t.Right})}):"Duration"===e?Ye(x,{richTitle:{title:k,subTitle:M},children:Ye(wa,{description:$,options:Sa,selected:a.durationPreset,onSelect:s,customName:"sampling-input-custom-duration",customLabel:A,customPlaceholder:"200ms",customValue:a.customDurationMs,onCustomChange:o})}):null},La=ha.div`
2
2
  display: flex;
3
3
  gap: 32px;
4
4
  `,Pa=ha.div`
@@ -17,7 +17,6 @@ interface SourceDrawerProps {
17
17
  profilingEnabled?: boolean;
18
18
  fetchProfilingSlots?: ProfilingProps['fetchProfilingSlots'];
19
19
  enableProfiling?: ProfilingProps['enableProfiling'];
20
- releaseProfiling?: ProfilingProps['releaseProfiling'];
21
20
  fetchSourceProfiling?: ProfilingProps['fetchSourceProfiling'];
22
21
  }
23
22
  declare const SourceDrawer: FC<SourceDrawerProps>;
@@ -1,10 +1,5 @@
1
1
  import { type FC } from 'react';
2
- import { type Source } from '@/types';
3
- interface SourceIdentifier {
4
- namespace: string;
5
- kind: string;
6
- name: string;
7
- }
2
+ import { type WorkloadId, type Source } from '@/types';
8
3
  interface ProfilingSlots {
9
4
  activeKeys: string[];
10
5
  keysWithData: string[];
@@ -25,10 +20,9 @@ interface EnableOrReleaseProfilingResult {
25
20
  }
26
21
  export interface ProfilingProps {
27
22
  source: Source;
23
+ enableProfiling: (source: WorkloadId) => Promise<EnableOrReleaseProfilingResult | undefined>;
28
24
  fetchProfilingSlots: () => Promise<ProfilingSlots | undefined>;
29
- enableProfiling: (source: SourceIdentifier) => Promise<EnableOrReleaseProfilingResult | undefined>;
30
- releaseProfiling: (source: SourceIdentifier) => Promise<EnableOrReleaseProfilingResult | undefined>;
31
- fetchSourceProfiling: (source: SourceIdentifier) => Promise<SourceProfilingResult | undefined>;
25
+ fetchSourceProfiling: (source: WorkloadId) => Promise<SourceProfilingResult | undefined>;
32
26
  /** Forwarded from the inner FlameGraphCanvas; lets the embedding container (e.g. SourceDrawer) react to fullscreen toggles. */
33
27
  onFlameFullscreenChange?: (isFullscreen: boolean) => void;
34
28
  }
@@ -1,4 +1,4 @@
1
- import{jsxs as e,jsx as t,Fragment as a}from"react/jsx-runtime";import{useEffect as n,Fragment as o,forwardRef as l,useState as i,useImperativeHandle as s,useMemo as r,useCallback as c,useRef as d,Children as u}from"react";import p,{useTheme as m}from"styled-components";import{c as h,F as g,d as b,e as f,f as y,I as v,h as C,i as S,j as w,K as k,T,k as N,l as A,m as I,n as D,o as E,B as $,a as R,p as x,q as O,r as P,N as F,s as L,t as M,v as V,S as B,w as z,x as _,y as U,z as j,E as X,G as H,H as W,J as G,L as K,M as Y,O as q,P as J,Q,R as Z,U as ee,V as te,W as ae,X as ne,Y as oe,Z as le,_ as ie,$ as se,a0 as re,a1 as ce,a2 as de,a3 as ue,a4 as pe,a5 as me,a6 as he,a7 as ge,a8 as be,a9 as fe,aa as ye,ab as ve,ac as Ce,ad as Se,ae as we,b as ke,af as Te,ag as Ne,ah as Ae,ai as Ie,aj as De,ak as Ee,al as $e,am as Re,an as xe,ao as Oe,ap as Pe,aq as Fe,ar as Le,as as Me,at as Ve,au as Be,av as ze,aw as _e,ax as Ue,ay as je,az as Xe,aA as He,aB as We,aC as Ge,aD as Ke,aE as Ye,aF as qe,aG as Je,aH as Qe,aI as Ze,aJ as et,aK as tt,D as at,aL as nt,aM as ot,aN as lt,aO as it,aP as st,aQ as rt,aR as ct,aS as dt,aT as ut,aU as pt,aV as mt,aW as ht,aX as gt,aY as bt,aZ as ft,a_ as yt,a$ as vt,b0 as Ct,b1 as St,b2 as wt,b3 as kt,b4 as Tt,b5 as Nt,b6 as At,b7 as It,b8 as Dt,b9 as Et,ba as $t,bb as Rt,bc as xt,bd as Ot,be as Pt,bf as Ft,u as Lt,bg as Mt,bh as Vt,bi as Bt,bj as zt,bk as _t,bl as Ut,g as jt,bm as Xt,A as Ht,bn as Wt,bo as Gt,bp as Kt,bq as Yt,br as qt,bs as Jt,bt as Qt,bu as Zt,bv as ea,bw as ta,bx as aa,by as na,bz as oa,bA as la,bB as ia,bC as sa,bD as ra,bE as ca,bF as da,bG as ua,bH as pa,bI as ma,bJ as ha,bK as ga,bL as ba,bM as fa,bN as ya,bO as va,bP as Ca,bQ as Sa,bR as wa,bS as ka,bT as Ta,bU as Na,bV as Aa,bW as Ia,bX as Da,bY as Ea,bZ as $a,b_ as Ra,b$ as xa,c0 as Oa,c1 as Pa,c2 as Fa,c3 as La,c4 as Ma,c5 as Va,c6 as Ba,c7 as za,c8 as _a,c9 as Ua,ca as ja}from"../chunks/ui-components-B4xHrszQ.js";import{TrashIcon as Xa,PlusIcon as Ha,BookIcon as Wa,VSquareIcon as Ga,XSquareIcon as Ka,DeleteIcon as Ya,EditIcon as qa,GoLogo as Ja,JavaLogo as Qa,ChevronRightIcon as Za,ActionIcon as en,DestinationIcon as tn,ChevronUpIcon as an,ChevronDownIcon as nn,VIcon as on,XIcon as ln,InstrumentationRuleIcon as sn,SourceIcon as rn,NamespacesIcon as cn,SettingsIcon as dn,SamplingIcon as un,ExclamationTriangleIcon as pn,ExclamationCircleIcon as mn,KeyIcon as hn,DiagnoseIcon as gn,DownloadIcon as bn,TerminalIcon as fn,RefreshIcon as yn,ConnectionsIcon as vn,OdigosLogo as Cn,ArrowRightIcon as Sn,PipelineCollectorIcon as wn,PodIcon as kn,ArrowDownSquareIcon as Tn,ArrowUpSquareIcon as Nn,GatewayIcon as An,YamlIcon as In}from"../icons.js";import{S as Dn,D as En,A as $n,P as Rn,a as xn,b as On,R as Pn,c as Fn,O as Ln,d as Mn,e as Vn,W as Bn,f as zn,C as _n,g as Un,h as jn,U as Xn}from"../chunks/index-hLSQkKAv.js";import{Y as Hn}from"../chunks/index-DJZLguZq.js";import"zustand";import"javascript-time-ago";import"../chunks/vendor-C150cdxb.js";import"@xyflow/react";import"react-dom";import"prism-react-renderer";import"react-error-boundary";import"lottie-react";import"virtua";const Wn=[{id:"CREDIT_CARD",label:"Credit card"}],Gn=[{id:h.CollectContainerAttributes,label:"Collect container attributes"},{id:h.CollectReplicaSetAttributes,label:"Collect ReplicaSet attributes"},{id:h.CollectWorkloadId,label:"Collect workload ID"},{id:h.CollectClusterId,label:"Collect cluster ID"}],Kn=[{id:k.Pod,label:k.Pod},{id:k.Namespace,label:k.Namespace},{id:k.Node,label:k.Node}],Yn=[{label:"Label key",keyName:"labelKey",placeholder:"app.kubernetes.io/name"},{label:"Attribute key",keyName:"attributeKey",placeholder:"app.kubernetes.name"},{label:"From sources",keyName:"fromSources",placeholder:"pod, namespace",tooltip:"Select multiple sources. Higher precedence sources (pod > namespace > node) will override lower ones.",componentType:"multi-dropdown",options:Kn}],qn=[{label:"Annotation key",keyName:"annotationKey",placeholder:"kubectl.kubernetes.io/restartedAt"},{label:"Attribute key",keyName:"attributeKey",placeholder:"kubectl.kubernetes.restartedAt"},{label:"From sources",keyName:"fromSources",placeholder:"pod, namespace",tooltip:"Select multiple sources. Higher precedence sources (pod > namespace > node) will override lower ones.",componentType:"multi-dropdown",options:Kn}],Jn=[{label:"Service",keyName:"serviceName",placeholder:"e.g. my-service",tooltip:"Service name: The rule applies to a specific service name. Only traces originating from this service’s root span will be considered."},{label:"HTTP route",keyName:"httpRoute",placeholder:"e.g. /api/v1/users",tooltip:"HTTP route: The specific HTTP route prefix to match for sampling. Only traces with routes beginning with this prefix will be considered. For instance, configuring /buy will also match /buy/product."},{label:"Threshold",keyName:"minimumLatencyThreshold",placeholder:"e.g. 1000",tooltip:"Minimum latency threshold (ms): Specifies the minimum latency in milliseconds; traces with latency below this threshold are ignored.",inputType:C.Number},{label:"Fallback",keyName:"fallbackSamplingRatio",placeholder:"e.g. 100",tooltip:"Fallback sampling ratio: Specifies the percentage of traces that meet the service/http_route filter but fall below the threshold that you still want to retain. For example, if a rule is set for service A and http_route B with a minimum latency threshold of 1 second, you might still want to keep some traces below this threshold. Setting the ratio to 20% ensures that 20% of these traces will be retained.",inputType:C.Number}],Qn=h.UrlTemplatizationRulesGroups,Zn=[{keyName:"kind",label:"Kind",placeholder:"Any kind",componentType:"dropdown",options:[{id:"Deployment",label:"Deployment"},{id:"StatefulSet",label:"StatefulSet"},{id:"DaemonSet",label:"DaemonSet"}]},{keyName:"name",label:"Name",placeholder:"Any name"}],eo=[{label:"Service name",keyName:"serviceName",placeholder:"e.g. my-service",tooltip:"Specifies the service name to search within the trace (Across all available spans)."},{label:"Sampling ratio",keyName:"samplingRatio",placeholder:"e.g. 10",tooltip:"Specifies the sample rate for all traces.",inputType:C.Number},{label:"Fallback sampling ratio",keyName:"fallbackSamplingRatio",placeholder:"e.g. 100",tooltip:"Specifies the percentage of traces that don’t meet the service name filter and that you still like to retain.",inputType:C.Number}],to=[{label:"Service name",keyName:"serviceName",placeholder:"e.g. my-service",tooltip:"Specifies the service name to search within the trace (across all available spans)."},{label:"Attribute key",keyName:"attributeKey",placeholder:"e.g. http.request.method",tooltip:"Specifies the attribute key inside of the span."},{label:"Fallback sampling ratio",keyName:"fallbackSamplingRatio",placeholder:"e.g. 100",tooltip:"Specifies the percentage of traces that don’t meet the service name filter and that you still like to retain.",inputType:C.Number},{label:"Condition",keyName:"condition",tooltip:"An object representing the filters for span attributes filters.",componentType:x.Dropdown,options:[{id:"stringCondition",label:"String condition"},{id:"numberCondition",label:"Number condition"},{id:"booleanCondition",label:"Boolean condition"},{id:"jsonCondition",label:"JSON condition"}]},{label:"Operation",keyName:"operation",tooltip:"Specifies the operation to run against the attribute.",componentType:x.Dropdown,options:[{id:"exists",label:"Exists"},{id:"equals",label:"Equals"},{id:"not_equals",label:"Not equals"},{id:"contains",label:"Contains"},{id:"not_contains",label:"Not contains"},{id:"regex",label:"Regex"},{id:"greater_than",label:"Greater than"},{id:"less_than",label:"Less than"},{id:"greater_than_or_equal",label:"Greater than or equal"},{id:"less_than_or_equal",label:"Less than or equal"},{id:"is_valid_json",label:"Is valid JSON"},{id:"is_invalid_json",label:"Is invalid JSON"},{id:"jsonpath_exists",label:"JSON path exists"},{id:"key_equals",label:"Key equals"},{id:"key_not_equals",label:"Key not equals"}]},{label:"Expected value",keyName:"expectedValue",placeholder:"e.g. GET",tooltip:"The values to test the attribute against."},{label:"JSON path",keyName:"jsonPath",placeholder:"e.g. $.user.role",tooltip:"An expression used to navigate the JSON structure.",renderCondition:e=>"jsonCondition"===e.condition}],ao={[O.K8sAttributes]:({value:o,setValue:l,formErrors:i})=>(n(()=>{o[h.CollectContainerAttributes]||o[h.CollectReplicaSetAttributes]||o[h.CollectWorkloadId]||o[h.CollectClusterId]||o[h.LabelsAttributes]?.length||o[h.AnnotationsAttributes]?.length||(l(h.CollectContainerAttributes,!0),l(h.CollectReplicaSetAttributes,!0),l(h.CollectWorkloadId,!0),l(h.CollectClusterId,!0),l(h.LabelsAttributes,[]),l(h.AnnotationsAttributes,[]))},[]),e(a,{children:[t(g,{$gap:6,children:Gn.map(({id:a,label:n})=>e(g,{children:[t(f,{label:n,value:o[a]||!1,onChange:e=>l(a,e)}),t(y,{errorMessage:i[a]})]},a))}),t(w,{name:"labelsAttributes",label:"Label attributes",limitFieldsPerRow:2,columns:Yn,values:o[h.LabelsAttributes]||[],setValues:e=>l(h.LabelsAttributes,e),errorMessage:i[h.LabelsAttributes]}),t(w,{name:"annotationsAttributes",label:"Annotation attributes",limitFieldsPerRow:2,columns:qn,values:o[h.AnnotationsAttributes]||[],setValues:e=>l(h.AnnotationsAttributes,e),errorMessage:i[h.AnnotationsAttributes]})]})),[O.AddClusterInfo]:({value:n,setValue:o,formErrors:l})=>{const i=m();return e(a,{children:[t(T,{label:"Overwrite existing values",labelAlign:N.Left,labelColor:i.v2.colors.silver[200],tooltip:"If enabled, the resource attributes will overwrite any existing attributes with the same name.",value:n[h.OverwriteExistingValues]||!1,onChange:e=>o(h.OverwriteExistingValues,e)}),t(w,{name:"clusterAttributes",label:"Resource attributes",limitFieldsPerRow:2,columns:[{keyName:"attributeName",label:"Attribute name"},{keyName:"attributeStringValue",label:"Attribute value"}],values:n[h.ClusterAttributes]||[],setValues:e=>o(h.ClusterAttributes,e),errorMessage:l[h.ClusterAttributes]})]})},[O.DeleteAttributes]:({value:e,setValue:a,formErrors:n})=>t(A,{name:"attributeNamesToDelete",label:"Attributes to delete",values:e[h.AttributeNamesToDelete]||[],setValues:e=>a(h.AttributeNamesToDelete,e),errorMessage:n[h.AttributeNamesToDelete]}),[O.RenameAttributes]:({value:e,setValue:a,formErrors:n})=>t(w,{name:"renames",label:"Attributes to rename",limitFieldsPerRow:2,columns:[{keyName:"oldKey",label:"Old key"},{keyName:"newKey",label:"New key"}],values:Object.entries(e[h.Renames]||{}).map(([e,t])=>({oldKey:e,newKey:t})),setValues:e=>{const t={};e.forEach(e=>t[e.oldKey]=e.newKey),a(h.Renames,t)},errorMessage:n[h.Renames]}),[O.PiiMasking]:({value:a,setValue:o,formErrors:l})=>(n(()=>{a[h.PiiCategories]?.length||o(h.PiiCategories,Wn.map(({id:e})=>e))},[]),e(g,{$gap:12,children:[t(b,{label:"Attributes to mask"}),t(g,{$gap:6,children:Wn.map(({id:e,label:n})=>t(f,{label:n,value:a[h.PiiCategories]?.includes(e)||!1,onChange:t=>{const n=a[h.PiiCategories]||[],l=t?[...n,e]:n.filter(t=>t!==e);o(h.PiiCategories,l)}},e))}),t(y,{errorMessage:l[h.PiiCategories]})]})),[O.ErrorSampler]:({value:e,setValue:a,formErrors:n})=>{const o=n[h.FallbackSamplingRatio],l=S(e[h.FallbackSamplingRatio])?"":String(e[h.FallbackSamplingRatio]);return t(v,{name:"fallbackSamplingRatio",label:"Fallback sampling ratio",type:C.Number,min:0,max:100,value:l,placeholder:"0-100",onChange:e=>{return t=e.target.value,a(h.FallbackSamplingRatio,Math.max(0,Math.min(Number(t),100))||0);var t},errorMessage:o})},[O.ProbabilisticSampler]:({value:e,setValue:a,formErrors:n})=>{const o=n[h.SamplingPercentage],l=S(e[h.SamplingPercentage])?"":String(e[h.SamplingPercentage]);return t(v,{name:"samplingPercentage",label:"Sampling percentage",type:C.Number,min:0,max:100,value:l,placeholder:"0-100",onChange:e=>{return t=e.target.value,a(h.SamplingPercentage,Math.max(0,Math.min(Number(t),100))||0);var t},errorMessage:o})},[O.LatencySampler]:({value:e,setValue:a,formErrors:n})=>{const o=n[h.EndpointsFilters],l=e[h.EndpointsFilters]||[];return t(w,{name:"endpointsFilters",limitFieldsPerRow:2,columns:Jn,values:l,setValues:e=>{a(h.EndpointsFilters,e.map(({serviceName:e,httpRoute:t,minimumLatencyThreshold:a,fallbackSamplingRatio:n})=>({serviceName:e,httpRoute:t,minimumLatencyThreshold:Number(a),fallbackSamplingRatio:Number(n)})))},errorMessage:o})},[O.ServiceNameSampler]:({value:e,setValue:a,formErrors:n})=>{const o=n[h.ServicesNameFilters],l=e[h.ServicesNameFilters]||[];return t(w,{name:"servicesNameFilters",limitFieldsPerRow:2,columns:eo,values:l,setValues:e=>{a(h.ServicesNameFilters,e.map(({serviceName:e,samplingRatio:t,fallbackSamplingRatio:a})=>({serviceName:e,samplingRatio:Number(t),fallbackSamplingRatio:Number(a)})))},errorMessage:o})},[O.SpanAttributeSampler]:({value:e,setValue:a,formErrors:n})=>{const o=n[h.AttributeFilters],l=(e[h.AttributeFilters]||[]).map(({serviceName:e,attributeKey:t,fallbackSamplingRatio:a,condition:n})=>{const o=Object.entries(n).filter(([e,t])=>t)[0][0];return{serviceName:e,attributeKey:t,fallbackSamplingRatio:a,condition:o,operation:n[o]?.operation,expectedValue:n[o]?.expectedValue,jsonPath:n[o]?.jsonPath}});return t(w,{name:"attributeFilters",limitFieldsPerRow:2,columns:to,values:l,setValues:e=>{a(h.AttributeFilters,e.map(({serviceName:e,attributeKey:t,fallbackSamplingRatio:a,condition:n,operation:o,expectedValue:l,jsonPath:i})=>{const s={serviceName:e,attributeKey:t,fallbackSamplingRatio:Number(a),condition:{[n]:{operation:o,expectedValue:l}}};return i&&(s.condition[n].jsonPath=i),s}))},errorMessage:o})},[O.URLTemplatization]:({value:n,setValue:l,formErrors:i})=>{const s=m(),r=n[Qn]||[{filterK8sNamespace:"",workloadFilters:[],templatizationRules:[{template:""}],notes:""}],c=e=>l(Qn,e),d=(e,t)=>c(r.map((a,n)=>n===e?{...a,...t}:a));return e(a,{children:[r.map((a,n)=>e(o,{children:[t(I,{}),e(g,{$gap:12,children:[e(D,{$justifyContent:"space-between",$alignItems:"center",children:[t(b,{label:`Rule Group ${n+1}`}),t(E,{leftIcon:()=>t(Xa,{fill:s.v2.colors.red[500]}),variant:R.Secondary,size:$.S,onClick:()=>{return e=n,c(r.filter((t,a)=>a!==e));var e},disabled:1===r.length})]}),t(v,{name:`urlGroup-${n}-namespace`,label:"Namespace",placeholder:"All namespaces",tooltip:"Filter rules to a specific Kubernetes namespace.",value:a.filterK8sNamespace||"",onChange:e=>d(n,{filterK8sNamespace:e.target.value})}),t(w,{name:`urlGroup-${n}-workloadFilters`,label:"Workload filters",tooltip:"Optionally scope templates to specific workloads.",columns:Zn,values:a.workloadFilters||[],setValues:e=>d(n,{workloadFilters:e})}),t(A,{name:`urlGroup-${n}-templates`,label:"Templates",required:!0,placeholder:"e.g. /user/{id}",values:a.templatizationRules.map(e=>e.template),setValues:e=>d(n,{templatizationRules:e.map(e=>({template:e}))})})]}),t(y,{errorMessage:i[Qn]})]},`url-templatization-group-${n}`)),t(E,{variant:R.Secondary,label:"Add rule group",leftIcon:Ha,onClick:()=>c([...r,{filterK8sNamespace:"",workloadFilters:[],templatizationRules:[{template:""}],notes:""}])}),t(I,{})]})}},no=({actionType:e,value:a,setValue:n,formErrors:o})=>{if(!e)return null;const l=ao[e];return l?t(l,{value:a,setValue:n,formErrors:o}):null},oo=()=>{const a=m(),{selectedOption:n,genericForm:o}=P();if(!o||!n)return t(F,{title:"No active form"});const{formData:l,handleFormChange:i,formErrors:s}=o;return e(g,{$gap:24,children:[e(D,{$gap:12,$justifyContent:"space-between",children:[t(L,{size:M.XXS,children:n.docsDescription}),t(E,{label:"Docs",leftIcon:Wa,variant:R.Text,size:$.S,onClick:()=>window.open(`${V}${n.docsEndpoint}`,"_blank","noopener noreferrer")})]}),t(B,{options:[{icon:Ga,label:"Enabled",value:!1,selectedBgColor:a.v2.colors.green[800]},{icon:Ka,label:"Disabled",value:!0,selectedBgColor:a.v2.colors.red[800]}],selected:l.disabled,setSelected:e=>i("disabled",e)}),t(Dn,{title:"Signals for processing",allowedSignals:n.allowedSignals,selectedSignals:l.signals||[],setSelectedSignals:e=>i("signals",e),errorMessage:s.signals}),t(v,{name:"actionName",label:"Action name",placeholder:"Use a name that describes the action...",value:l.name||"",onChange:({target:{value:e}})=>i("name",e),errorMessage:s.name}),t(no,{actionType:n.type,value:l.fields,setValue:(e,t)=>i(`fields.${e}`,t),formErrors:s}),t(z,{name:"notes",label:"Notes",placeholder:"Your personal notes...",value:l.notes||"",onChange:({target:{value:e}})=>i("notes",e),errorMessage:s.notes})]})},lo=({signals:e,fields:a,disabled:n,formData:o,handleFormChange:l,formErrors:i})=>a?.map(({renderCondition:a,componentType:s,type:r,name:c,title:d,tooltip:u,placeholder:p,value:m,required:h,options:g})=>{if(!(!a||_(a,e,o.fields)))return null;const b=c,f=o.fields.find(e=>e.key===b),y=f?f.value:m;return t(En,{componentType:s,inputType:r,name:b,label:d,tooltip:u,disabled:n,required:h,placeholder:p,errorMessage:i[b],dropdownOptions:g,value:y||"",setValue:e=>l(b,e)},b)}),io=p(D)`
1
+ import{jsxs as e,jsx as t,Fragment as a}from"react/jsx-runtime";import{useEffect as n,Fragment as o,forwardRef as l,useState as i,useImperativeHandle as s,useMemo as r,useCallback as c,useRef as d,Children as u}from"react";import p,{useTheme as m}from"styled-components";import{c as h,F as g,d as b,e as f,f as y,I as v,h as C,i as S,j as w,K as k,T,k as N,l as A,m as I,n as D,o as E,B as $,a as R,p as x,q as O,r as P,N as F,s as L,t as M,v as V,S as B,w as z,x as _,y as U,z as j,E as X,G as H,H as W,J as G,L as K,M as Y,O as q,P as J,Q,R as Z,U as ee,V as te,W as ae,X as ne,Y as oe,Z as le,_ as ie,$ as se,a0 as re,a1 as ce,a2 as de,a3 as ue,a4 as pe,a5 as me,a6 as he,a7 as ge,a8 as be,a9 as fe,aa as ye,ab as ve,ac as Ce,ad as Se,ae as we,b as ke,af as Te,ag as Ne,ah as Ae,ai as Ie,aj as De,ak as Ee,al as $e,am as Re,an as xe,ao as Oe,ap as Pe,aq as Fe,ar as Le,as as Me,at as Ve,au as Be,av as ze,aw as _e,ax as Ue,ay as je,az as Xe,aA as He,aB as We,aC as Ge,aD as Ke,aE as Ye,aF as qe,aG as Je,aH as Qe,aI as Ze,aJ as et,aK as tt,D as at,aL as nt,aM as ot,aN as lt,aO as it,aP as st,aQ as rt,aR as ct,aS as dt,aT as ut,aU as pt,aV as mt,aW as ht,aX as gt,aY as bt,aZ as ft,a_ as yt,a$ as vt,b0 as Ct,b1 as St,b2 as wt,b3 as kt,b4 as Tt,b5 as Nt,b6 as At,b7 as It,b8 as Dt,b9 as Et,ba as $t,bb as Rt,bc as xt,bd as Ot,be as Pt,bf as Ft,u as Lt,bg as Mt,bh as Vt,bi as Bt,bj as zt,bk as _t,bl as Ut,g as jt,bm as Xt,A as Ht,bn as Wt,bo as Gt,bp as Kt,bq as Yt,br as qt,bs as Jt,bt as Qt,bu as Zt,bv as ea,bw as ta,bx as aa,by as na,bz as oa,bA as la,bB as ia,bC as sa,bD as ra,bE as ca,bF as da,bG as ua,bH as pa,bI as ma,bJ as ha,bK as ga,bL as ba,bM as fa,bN as ya,bO as va,bP as Ca,bQ as Sa,bR as wa,bS as ka,bT as Ta,bU as Na,bV as Aa,bW as Ia,bX as Da,bY as Ea,bZ as $a,b_ as Ra,b$ as xa,c0 as Oa,c1 as Pa,c2 as Fa,c3 as La,c4 as Ma,c5 as Va,c6 as Ba,c7 as za,c8 as _a,c9 as Ua,ca as ja}from"../chunks/ui-components-B4xHrszQ.js";import{TrashIcon as Xa,PlusIcon as Ha,BookIcon as Wa,VSquareIcon as Ga,XSquareIcon as Ka,DeleteIcon as Ya,EditIcon as qa,GoLogo as Ja,JavaLogo as Qa,ChevronRightIcon as Za,ActionIcon as en,DestinationIcon as tn,ChevronUpIcon as an,ChevronDownIcon as nn,VIcon as on,XIcon as ln,InstrumentationRuleIcon as sn,SourceIcon as rn,NamespacesIcon as cn,SettingsIcon as dn,SamplingIcon as un,ExclamationTriangleIcon as pn,ExclamationCircleIcon as mn,KeyIcon as hn,DiagnoseIcon as gn,DownloadIcon as bn,TerminalIcon as fn,RefreshIcon as yn,ConnectionsIcon as vn,OdigosLogo as Cn,ArrowRightIcon as Sn,PipelineCollectorIcon as wn,PodIcon as kn,ArrowDownSquareIcon as Tn,ArrowUpSquareIcon as Nn,GatewayIcon as An,YamlIcon as In}from"../icons.js";import{S as Dn,D as En,A as $n,P as Rn,a as xn,b as On,R as Pn,c as Fn,O as Ln,d as Mn,e as Vn,W as Bn,f as zn,C as _n,g as Un,h as jn,U as Xn}from"../chunks/index-CGrd7Nq0.js";import{Y as Hn}from"../chunks/index-DJZLguZq.js";import"zustand";import"javascript-time-ago";import"../chunks/vendor-C150cdxb.js";import"@xyflow/react";import"react-dom";import"prism-react-renderer";import"react-error-boundary";import"lottie-react";import"virtua";const Wn=[{id:"CREDIT_CARD",label:"Credit card"}],Gn=[{id:h.CollectContainerAttributes,label:"Collect container attributes"},{id:h.CollectReplicaSetAttributes,label:"Collect ReplicaSet attributes"},{id:h.CollectWorkloadId,label:"Collect workload ID"},{id:h.CollectClusterId,label:"Collect cluster ID"}],Kn=[{id:k.Pod,label:k.Pod},{id:k.Namespace,label:k.Namespace},{id:k.Node,label:k.Node}],Yn=[{label:"Label key",keyName:"labelKey",placeholder:"app.kubernetes.io/name"},{label:"Attribute key",keyName:"attributeKey",placeholder:"app.kubernetes.name"},{label:"From sources",keyName:"fromSources",placeholder:"pod, namespace",tooltip:"Select multiple sources. Higher precedence sources (pod > namespace > node) will override lower ones.",componentType:"multi-dropdown",options:Kn}],qn=[{label:"Annotation key",keyName:"annotationKey",placeholder:"kubectl.kubernetes.io/restartedAt"},{label:"Attribute key",keyName:"attributeKey",placeholder:"kubectl.kubernetes.restartedAt"},{label:"From sources",keyName:"fromSources",placeholder:"pod, namespace",tooltip:"Select multiple sources. Higher precedence sources (pod > namespace > node) will override lower ones.",componentType:"multi-dropdown",options:Kn}],Jn=[{label:"Service",keyName:"serviceName",placeholder:"e.g. my-service",tooltip:"Service name: The rule applies to a specific service name. Only traces originating from this service’s root span will be considered."},{label:"HTTP route",keyName:"httpRoute",placeholder:"e.g. /api/v1/users",tooltip:"HTTP route: The specific HTTP route prefix to match for sampling. Only traces with routes beginning with this prefix will be considered. For instance, configuring /buy will also match /buy/product."},{label:"Threshold",keyName:"minimumLatencyThreshold",placeholder:"e.g. 1000",tooltip:"Minimum latency threshold (ms): Specifies the minimum latency in milliseconds; traces with latency below this threshold are ignored.",inputType:C.Number},{label:"Fallback",keyName:"fallbackSamplingRatio",placeholder:"e.g. 100",tooltip:"Fallback sampling ratio: Specifies the percentage of traces that meet the service/http_route filter but fall below the threshold that you still want to retain. For example, if a rule is set for service A and http_route B with a minimum latency threshold of 1 second, you might still want to keep some traces below this threshold. Setting the ratio to 20% ensures that 20% of these traces will be retained.",inputType:C.Number}],Qn=h.UrlTemplatizationRulesGroups,Zn=[{keyName:"kind",label:"Kind",placeholder:"Any kind",componentType:"dropdown",options:[{id:"Deployment",label:"Deployment"},{id:"StatefulSet",label:"StatefulSet"},{id:"DaemonSet",label:"DaemonSet"}]},{keyName:"name",label:"Name",placeholder:"Any name"}],eo=[{label:"Service name",keyName:"serviceName",placeholder:"e.g. my-service",tooltip:"Specifies the service name to search within the trace (Across all available spans)."},{label:"Sampling ratio",keyName:"samplingRatio",placeholder:"e.g. 10",tooltip:"Specifies the sample rate for all traces.",inputType:C.Number},{label:"Fallback sampling ratio",keyName:"fallbackSamplingRatio",placeholder:"e.g. 100",tooltip:"Specifies the percentage of traces that don’t meet the service name filter and that you still like to retain.",inputType:C.Number}],to=[{label:"Service name",keyName:"serviceName",placeholder:"e.g. my-service",tooltip:"Specifies the service name to search within the trace (across all available spans)."},{label:"Attribute key",keyName:"attributeKey",placeholder:"e.g. http.request.method",tooltip:"Specifies the attribute key inside of the span."},{label:"Fallback sampling ratio",keyName:"fallbackSamplingRatio",placeholder:"e.g. 100",tooltip:"Specifies the percentage of traces that don’t meet the service name filter and that you still like to retain.",inputType:C.Number},{label:"Condition",keyName:"condition",tooltip:"An object representing the filters for span attributes filters.",componentType:x.Dropdown,options:[{id:"stringCondition",label:"String condition"},{id:"numberCondition",label:"Number condition"},{id:"booleanCondition",label:"Boolean condition"},{id:"jsonCondition",label:"JSON condition"}]},{label:"Operation",keyName:"operation",tooltip:"Specifies the operation to run against the attribute.",componentType:x.Dropdown,options:[{id:"exists",label:"Exists"},{id:"equals",label:"Equals"},{id:"not_equals",label:"Not equals"},{id:"contains",label:"Contains"},{id:"not_contains",label:"Not contains"},{id:"regex",label:"Regex"},{id:"greater_than",label:"Greater than"},{id:"less_than",label:"Less than"},{id:"greater_than_or_equal",label:"Greater than or equal"},{id:"less_than_or_equal",label:"Less than or equal"},{id:"is_valid_json",label:"Is valid JSON"},{id:"is_invalid_json",label:"Is invalid JSON"},{id:"jsonpath_exists",label:"JSON path exists"},{id:"key_equals",label:"Key equals"},{id:"key_not_equals",label:"Key not equals"}]},{label:"Expected value",keyName:"expectedValue",placeholder:"e.g. GET",tooltip:"The values to test the attribute against."},{label:"JSON path",keyName:"jsonPath",placeholder:"e.g. $.user.role",tooltip:"An expression used to navigate the JSON structure.",renderCondition:e=>"jsonCondition"===e.condition}],ao={[O.K8sAttributes]:({value:o,setValue:l,formErrors:i})=>(n(()=>{o[h.CollectContainerAttributes]||o[h.CollectReplicaSetAttributes]||o[h.CollectWorkloadId]||o[h.CollectClusterId]||o[h.LabelsAttributes]?.length||o[h.AnnotationsAttributes]?.length||(l(h.CollectContainerAttributes,!0),l(h.CollectReplicaSetAttributes,!0),l(h.CollectWorkloadId,!0),l(h.CollectClusterId,!0),l(h.LabelsAttributes,[]),l(h.AnnotationsAttributes,[]))},[]),e(a,{children:[t(g,{$gap:6,children:Gn.map(({id:a,label:n})=>e(g,{children:[t(f,{label:n,value:o[a]||!1,onChange:e=>l(a,e)}),t(y,{errorMessage:i[a]})]},a))}),t(w,{name:"labelsAttributes",label:"Label attributes",limitFieldsPerRow:2,columns:Yn,values:o[h.LabelsAttributes]||[],setValues:e=>l(h.LabelsAttributes,e),errorMessage:i[h.LabelsAttributes]}),t(w,{name:"annotationsAttributes",label:"Annotation attributes",limitFieldsPerRow:2,columns:qn,values:o[h.AnnotationsAttributes]||[],setValues:e=>l(h.AnnotationsAttributes,e),errorMessage:i[h.AnnotationsAttributes]})]})),[O.AddClusterInfo]:({value:n,setValue:o,formErrors:l})=>{const i=m();return e(a,{children:[t(T,{label:"Overwrite existing values",labelAlign:N.Left,labelColor:i.v2.colors.silver[200],tooltip:"If enabled, the resource attributes will overwrite any existing attributes with the same name.",value:n[h.OverwriteExistingValues]||!1,onChange:e=>o(h.OverwriteExistingValues,e)}),t(w,{name:"clusterAttributes",label:"Resource attributes",limitFieldsPerRow:2,columns:[{keyName:"attributeName",label:"Attribute name"},{keyName:"attributeStringValue",label:"Attribute value"}],values:n[h.ClusterAttributes]||[],setValues:e=>o(h.ClusterAttributes,e),errorMessage:l[h.ClusterAttributes]})]})},[O.DeleteAttributes]:({value:e,setValue:a,formErrors:n})=>t(A,{name:"attributeNamesToDelete",label:"Attributes to delete",values:e[h.AttributeNamesToDelete]||[],setValues:e=>a(h.AttributeNamesToDelete,e),errorMessage:n[h.AttributeNamesToDelete]}),[O.RenameAttributes]:({value:e,setValue:a,formErrors:n})=>t(w,{name:"renames",label:"Attributes to rename",limitFieldsPerRow:2,columns:[{keyName:"oldKey",label:"Old key"},{keyName:"newKey",label:"New key"}],values:Object.entries(e[h.Renames]||{}).map(([e,t])=>({oldKey:e,newKey:t})),setValues:e=>{const t={};e.forEach(e=>t[e.oldKey]=e.newKey),a(h.Renames,t)},errorMessage:n[h.Renames]}),[O.PiiMasking]:({value:a,setValue:o,formErrors:l})=>(n(()=>{a[h.PiiCategories]?.length||o(h.PiiCategories,Wn.map(({id:e})=>e))},[]),e(g,{$gap:12,children:[t(b,{label:"Attributes to mask"}),t(g,{$gap:6,children:Wn.map(({id:e,label:n})=>t(f,{label:n,value:a[h.PiiCategories]?.includes(e)||!1,onChange:t=>{const n=a[h.PiiCategories]||[],l=t?[...n,e]:n.filter(t=>t!==e);o(h.PiiCategories,l)}},e))}),t(y,{errorMessage:l[h.PiiCategories]})]})),[O.ErrorSampler]:({value:e,setValue:a,formErrors:n})=>{const o=n[h.FallbackSamplingRatio],l=S(e[h.FallbackSamplingRatio])?"":String(e[h.FallbackSamplingRatio]);return t(v,{name:"fallbackSamplingRatio",label:"Fallback sampling ratio",type:C.Number,min:0,max:100,value:l,placeholder:"0-100",onChange:e=>{return t=e.target.value,a(h.FallbackSamplingRatio,Math.max(0,Math.min(Number(t),100))||0);var t},errorMessage:o})},[O.ProbabilisticSampler]:({value:e,setValue:a,formErrors:n})=>{const o=n[h.SamplingPercentage],l=S(e[h.SamplingPercentage])?"":String(e[h.SamplingPercentage]);return t(v,{name:"samplingPercentage",label:"Sampling percentage",type:C.Number,min:0,max:100,value:l,placeholder:"0-100",onChange:e=>{return t=e.target.value,a(h.SamplingPercentage,Math.max(0,Math.min(Number(t),100))||0);var t},errorMessage:o})},[O.LatencySampler]:({value:e,setValue:a,formErrors:n})=>{const o=n[h.EndpointsFilters],l=e[h.EndpointsFilters]||[];return t(w,{name:"endpointsFilters",limitFieldsPerRow:2,columns:Jn,values:l,setValues:e=>{a(h.EndpointsFilters,e.map(({serviceName:e,httpRoute:t,minimumLatencyThreshold:a,fallbackSamplingRatio:n})=>({serviceName:e,httpRoute:t,minimumLatencyThreshold:Number(a),fallbackSamplingRatio:Number(n)})))},errorMessage:o})},[O.ServiceNameSampler]:({value:e,setValue:a,formErrors:n})=>{const o=n[h.ServicesNameFilters],l=e[h.ServicesNameFilters]||[];return t(w,{name:"servicesNameFilters",limitFieldsPerRow:2,columns:eo,values:l,setValues:e=>{a(h.ServicesNameFilters,e.map(({serviceName:e,samplingRatio:t,fallbackSamplingRatio:a})=>({serviceName:e,samplingRatio:Number(t),fallbackSamplingRatio:Number(a)})))},errorMessage:o})},[O.SpanAttributeSampler]:({value:e,setValue:a,formErrors:n})=>{const o=n[h.AttributeFilters],l=(e[h.AttributeFilters]||[]).map(({serviceName:e,attributeKey:t,fallbackSamplingRatio:a,condition:n})=>{const o=Object.entries(n).filter(([e,t])=>t)[0][0];return{serviceName:e,attributeKey:t,fallbackSamplingRatio:a,condition:o,operation:n[o]?.operation,expectedValue:n[o]?.expectedValue,jsonPath:n[o]?.jsonPath}});return t(w,{name:"attributeFilters",limitFieldsPerRow:2,columns:to,values:l,setValues:e=>{a(h.AttributeFilters,e.map(({serviceName:e,attributeKey:t,fallbackSamplingRatio:a,condition:n,operation:o,expectedValue:l,jsonPath:i})=>{const s={serviceName:e,attributeKey:t,fallbackSamplingRatio:Number(a),condition:{[n]:{operation:o,expectedValue:l}}};return i&&(s.condition[n].jsonPath=i),s}))},errorMessage:o})},[O.URLTemplatization]:({value:n,setValue:l,formErrors:i})=>{const s=m(),r=n[Qn]||[{filterK8sNamespace:"",workloadFilters:[],templatizationRules:[{template:""}],notes:""}],c=e=>l(Qn,e),d=(e,t)=>c(r.map((a,n)=>n===e?{...a,...t}:a));return e(a,{children:[r.map((a,n)=>e(o,{children:[t(I,{}),e(g,{$gap:12,children:[e(D,{$justifyContent:"space-between",$alignItems:"center",children:[t(b,{label:`Rule Group ${n+1}`}),t(E,{leftIcon:()=>t(Xa,{fill:s.v2.colors.red[500]}),variant:R.Secondary,size:$.S,onClick:()=>{return e=n,c(r.filter((t,a)=>a!==e));var e},disabled:1===r.length})]}),t(v,{name:`urlGroup-${n}-namespace`,label:"Namespace",placeholder:"All namespaces",tooltip:"Filter rules to a specific Kubernetes namespace.",value:a.filterK8sNamespace||"",onChange:e=>d(n,{filterK8sNamespace:e.target.value})}),t(w,{name:`urlGroup-${n}-workloadFilters`,label:"Workload filters",tooltip:"Optionally scope templates to specific workloads.",columns:Zn,values:a.workloadFilters||[],setValues:e=>d(n,{workloadFilters:e})}),t(A,{name:`urlGroup-${n}-templates`,label:"Templates",required:!0,placeholder:"e.g. /user/{id}",values:a.templatizationRules.map(e=>e.template),setValues:e=>d(n,{templatizationRules:e.map(e=>({template:e}))})})]}),t(y,{errorMessage:i[Qn]})]},`url-templatization-group-${n}`)),t(E,{variant:R.Secondary,label:"Add rule group",leftIcon:Ha,onClick:()=>c([...r,{filterK8sNamespace:"",workloadFilters:[],templatizationRules:[{template:""}],notes:""}])}),t(I,{})]})}},no=({actionType:e,value:a,setValue:n,formErrors:o})=>{if(!e)return null;const l=ao[e];return l?t(l,{value:a,setValue:n,formErrors:o}):null},oo=()=>{const a=m(),{selectedOption:n,genericForm:o}=P();if(!o||!n)return t(F,{title:"No active form"});const{formData:l,handleFormChange:i,formErrors:s}=o;return e(g,{$gap:24,children:[e(D,{$gap:12,$justifyContent:"space-between",children:[t(L,{size:M.XXS,children:n.docsDescription}),t(E,{label:"Docs",leftIcon:Wa,variant:R.Text,size:$.S,onClick:()=>window.open(`${V}${n.docsEndpoint}`,"_blank","noopener noreferrer")})]}),t(B,{options:[{icon:Ga,label:"Enabled",value:!1,selectedBgColor:a.v2.colors.green[800]},{icon:Ka,label:"Disabled",value:!0,selectedBgColor:a.v2.colors.red[800]}],selected:l.disabled,setSelected:e=>i("disabled",e)}),t(Dn,{title:"Signals for processing",allowedSignals:n.allowedSignals,selectedSignals:l.signals||[],setSelectedSignals:e=>i("signals",e),errorMessage:s.signals}),t(v,{name:"actionName",label:"Action name",placeholder:"Use a name that describes the action...",value:l.name||"",onChange:({target:{value:e}})=>i("name",e),errorMessage:s.name}),t(no,{actionType:n.type,value:l.fields,setValue:(e,t)=>i(`fields.${e}`,t),formErrors:s}),t(z,{name:"notes",label:"Notes",placeholder:"Your personal notes...",value:l.notes||"",onChange:({target:{value:e}})=>i("notes",e),errorMessage:s.notes})]})},lo=({signals:e,fields:a,disabled:n,formData:o,handleFormChange:l,formErrors:i})=>a?.map(({renderCondition:a,componentType:s,type:r,name:c,title:d,tooltip:u,placeholder:p,value:m,required:h,options:g})=>{if(!(!a||_(a,e,o.fields)))return null;const b=c,f=o.fields.find(e=>e.key===b),y=f?f.value:m;return t(En,{componentType:s,inputType:r,name:b,label:d,tooltip:u,disabled:n,required:h,placeholder:p,errorMessage:i[b],dropdownOptions:g,value:y||"",setValue:e=>l(b,e)},b)}),io=p(D)`
2
2
  position: sticky;
3
3
  bottom: 0;
4
4
  margin-top: auto;
@@ -47,7 +47,7 @@ import{jsxs as e,jsx as t,Fragment as a}from"react/jsx-runtime";import{useEffect
47
47
  justify-content: space-between;
48
48
  gap: 12px;
49
49
  padding: ${({$isOpen:e})=>e?"2px 12px 8px 12px":"2px 12px"};
50
- `,$o=({title:a,tooltip:n,list:o,noBgColor:l,purpleColors:s})=>{const[r,c]=i(!0);return e(Do,{"data-id":`collapse-${a}`,$noBgColor:l,$purpleColors:s,children:[e(Eo,{$isOpen:r,children:[e(D,{$gap:10,children:[t(L,{size:M.XS,children:a}),n&&t(q,{text:n,withIcon:!0}),t(oe,{label:o.length,status:s?X.Default:void 0})]}),t(Ne,{icon:r?an:nn,size:Ae.M,onClick:()=>c(e=>!e)})]}),r?t(g,{children:o.length?u.toArray(o):t(ke,{$padding:"12px 0",children:t(F,{})})}):null]})},Ro=(e,t,a)=>t||a.signalType?e.filter(e=>e.displayName.toLowerCase().includes(t.toLowerCase())&&(!a.signalType||G(e.supportedSignals).includes(a.signalType))):e,xo=({option:e,formData:a,testResult:n,isSelected:o,onSelect:l})=>t(To,{icon:$e(e.type).icon,title:a?.name||e.displayName,withCarret:!0,purpleColors:!!a,isSelected:o,onClick:()=>l(),children:n&&t(oe,{status:n.succeeded?X.Success:X.Error,leftIcon:n.succeeded?on:ln})}),Oo=({listType:e,destinationOptions:a,unsavedDestinations:n})=>{const{activeForm:o,onChangeActiveForm:l}=U();return a?.length?t($o,{title:Ee[e].TITLE,tooltip:Ee[e].DESCRIPTION,list:a.map((a,n)=>t(xo,{option:a,isSelected:o?.listType===e&&"number"!=typeof o?.unsavedIdx&&(null!=a.id&&""!==a.id?o?.option.id===a.id:o?.option.type===a.type),onSelect:()=>l({listType:e,option:a})},`${e}-${a.id??a.type}-${n}`))}):n?.length?t($o,{purpleColors:!0,title:Ee[e].TITLE,tooltip:Ee[e].DESCRIPTION,list:n.map(({option:a,formData:n,testResult:i},s)=>t(xo,{option:a,formData:n,testResult:i,isSelected:o?.unsavedIdx===s&&o?.listType===e,onSelect:()=>l({listType:e,option:a,unsavedIdx:s})},`${e}-${s}`))},e):void 0},Po=({isFetching:e,destinationsByCategory:a,searchText:n,filters:o})=>{const{unsavedDestinations:l}=U();return{width:"40%",list:r(()=>{const i=[];l.length&&i.push(t(Oo,{listType:Ie.UNSAVED,unsavedDestinations:l},"unsaved"));for(const e of Object.values(Ie)){if(o.categoryType&&o.categoryType!==e)continue;const l=Ro(a[e],n,o);l.length&&i.push(t(Oo,{listType:e,destinationOptions:l},e))}return e&&i.push(t(ke,{children:t(De,{title:"Fetching destinations",withSpinner:!0})},"loading-more")),i},[l,a,n,o,e])}},Fo=({destinationsByCategory:n,filters:o,setFilters:l})=>{const i=r(()=>Object.values(Ie).map(e=>({id:e,label:e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()})).filter(e=>n[e.id]?.length),[n]),s=r(()=>{const e=Object.values(H).map(e=>({value:e,label:e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}));return e.unshift({value:null,label:"All"}),e},[]);return e(a,{children:[t(Re,{placeholder:"Select category",options:i,values:o.categoryType?[o.categoryType]:[],setValues:e=>l({...o,categoryType:o.categoryType===e[0]?null:e[0]})}),t(B,{size:xe.S,options:s,selected:o.signalType,setSelected:e=>l({...o,signalType:e})})]})};var Lo;!function(e){e.SELF_HOSTED="self hosted",e.MANAGED="managed"}(Lo||(Lo={}));const Mo=(e,t)=>{const a=[],n=[],o=[];return e&&e.destinationCategories.categories.forEach(e=>{e.name===Lo.SELF_HOSTED?n.push(...e.items):e.name===Lo.MANAGED&&o.push(...e.items)}),t&&t?.potentialDestinations.forEach(t=>{for(const n of e?.destinationCategories?.categories||[]){const e=Oe(n),o=e.items.findIndex(e=>e.type===t.type);if(-1!==o){const n=Pe(t.fields,{});Object.keys(n).length&&(e.items[o].fields=e.items[o].fields.map(e=>({...e,initialValue:n[e.name]})),a.push(e.items[o]))}}}),{[Ie.DETECTED]:a,[Ie.SELF_HOSTED]:n,[Ie.MANAGED]:o}},Vo=({onClose:e,onBack:a,onNext:o,selectedConnectionIds:l,setSelectedConnectionIds:s,getDestinationCategories:r,getPotentialDestinations:d,initialInputs:u,testConnection:p,createDestination:m,updateDestination:h,withOverlay:g,disableAnimation:b})=>{const[f,y]=i(""),[v,C]=i({categoryType:null,signalType:null}),{destinations:S}=Fe(),{activeForm:w,genericForm:k,formErrorMessage:T,unsavedDestinations:N,setUnsavedDestinations:A}=U();n(()=>{u&&A(u)},[u]);const[I,D]=i(!0),[E,$]=i([]),[R,x]=i({[Ie.ALL]:[],[Ie.UNSAVED]:[],[Ie.EXISTS]:[],[Ie.DETECTED]:[],[Ie.SELF_HOSTED]:[],[Ie.MANAGED]:[]});n(()=>{const e=S.map(e=>{let t;for(const a of E){const n=a.items.find(t=>t.type===e.destinationType.type);if(n){t=n;break}}const a=Pe(e.fields,{});return{id:e.id,type:e.destinationType.type,displayName:e.name||e.destinationType.displayName,selected:!0,testConnectionSupported:t?.testConnectionSupported??!1,supportedSignals:e.destinationType.supportedSignals,fields:t?t.fields.map(e=>({...e,initialValue:a[e.name]??e.initialValue})):[]}});x(t=>({...t,[Ie.EXISTS]:e}))},[S,E]);const O=c(async()=>{try{D(!0);const[e,t]=await Promise.all([r(),d()]);e&&$(e.destinationCategories.categories),x(a=>({...a,...Mo(e,t)}))}catch(e){}finally{D(!1)}},[]);n(()=>{O()},[]);const P=c(async()=>{const e=(await Promise.all(N.map(({option:e,formData:t})=>{const a=K(t);if(e.id){const t=Object.fromEntries(e.fields.map(e=>[e.name,e.initialValue??""])),n=Object.fromEntries(a.fields.map(e=>[e.key,e.value??""]));if(!Object.keys(t).some(e=>t[e]!==n[e]))return h(e.id,a,l)}return m(a,l)}))).filter(e=>e?.error);if(e.length)return{error:e.map(e=>e?.error).join("\n")}},[N,l,m,h]);return t(Bn,{isOpen:!0,withOverlay:g,disableAnimation:b,onClose:e,onBack:a?()=>a(N):void 0,onNext:o?()=>o(N):void 0,nextIsSkip:!N.length,onSave:P,disableSave:!w&&!N.length,isFetching:I,errorMessage:T,isFormDirty:k?.isFormDirty,hideDirtyNote:!0,progress:{title:Te.CREATING_DESTINATION,subTitle:Te.CREATING_DESTINATION_SUBTITLE},header:{icon:tn,title:Te.ADD_DESTINATIONS,subTitle:Te.ADD_DESTINATION_DRAWER_DESCRIPTION},connectionIds:l&&s?{value:l,setValue:s}:void 0,search:{value:f,onChange:y},filters:t(Fo,{destinationsByCategory:R,filters:v,setFilters:C}),leftColumn:Po({isFetching:I,destinationsByCategory:R,searchText:f,filters:v}),rightColumn:Io({testConnection:p})})},Bo=({onClose:e,selectedConnectionIds:a,setSelectedConnectionIds:n,createInstrumentationRule:o,withOverlay:l})=>{const[s,c]=i(""),u=d(null),{selectedOption:p,onSelectOption:m,genericForm:h,validateFormData:g,errorMessage:b}=ne(),f=r(()=>s?Le.filter(e=>e.label.toLowerCase().includes(s.toLowerCase())):Le,[s]),y=r(()=>f.map(e=>{const a=p?.type===e.type;return t(To,{dataId:`option-${e.type}`,title:e.label,description:e.description,withCarret:!0,isSelected:a,onClick:()=>{u.current?.clearErrors(),m(e)}},e.type)}),[p,f.length,m]),v=r(()=>p?[t(bo,{},p.type)]:[t(ke,{$height:"100%",children:t(F,{icon:sn,title:"Instrumentation rule not selected",subTitle:"Please select an instrumentation rule to add"})},"no-data")],[p]);return t(Bn,{ref:u,isOpen:!0,withOverlay:l,onClose:e,onSave:async()=>{const{errorMessage:e,preparedFormData:t}=g();return e?Promise.resolve({error:e}):await o(t)},disableSave:!p||!h?.isFormDirty,isFormDirty:h?.isFormDirty,hideDirtyNote:!0,errorMessage:b,progress:{title:Te.CREATING_INSTRUMENTATION_RULE,subTitle:Te.CREATING_INSTRUMENTATION_RULE_SUBTITLE},header:{icon:sn,title:Te.ADD_INSTRUMENTATION_RULE,subTitle:Te.ADD_INSTRUMENTATION_RULE_DESCRIPTION},connectionIds:a&&n?{value:a,setValue:n}:void 0,search:{value:s,onChange:c},leftColumn:{width:"40%",list:y},rightColumn:{width:"60%",list:v}})},zo=p.div``,_o=p.div`
50
+ `,$o=({title:a,tooltip:n,list:o,noBgColor:l,purpleColors:s})=>{const[r,c]=i(!0);return e(Do,{"data-id":`collapse-${a}`,$noBgColor:l,$purpleColors:s,children:[e(Eo,{$isOpen:r,children:[e(D,{$gap:10,children:[t(L,{size:M.XS,children:a}),n&&t(q,{text:n,withIcon:!0}),t(oe,{label:o.length,status:s?X.Default:void 0})]}),t(Ne,{icon:r?an:nn,size:Ae.M,onClick:()=>c(e=>!e)})]}),r?t(g,{children:o.length?u.toArray(o):t(ke,{$padding:"12px 0",children:t(F,{})})}):null]})},Ro=(e,t,a)=>t||a.signalType?e.filter(e=>e.displayName.toLowerCase().includes(t.toLowerCase())&&(!a.signalType||G(e.supportedSignals).includes(a.signalType))):e,xo=({option:e,formData:a,testResult:n,isSelected:o,onSelect:l})=>t(To,{icon:$e(e.type).icon,title:a?.name||e.displayName,withCarret:!0,purpleColors:!!a,isSelected:o,onClick:()=>l(),children:n&&t(oe,{status:n.succeeded?X.Success:X.Error,leftIcon:n.succeeded?on:ln})}),Oo=({listType:e,destinationOptions:a,unsavedDestinations:n})=>{const{activeForm:o,onChangeActiveForm:l}=U();return a?.length?t($o,{title:Ee[e].TITLE,tooltip:Ee[e].DESCRIPTION,list:a.map((a,n)=>t(xo,{option:a,isSelected:o?.listType===e&&"number"!=typeof o?.unsavedIdx&&(null!=a.id&&""!==a.id?o?.option.id===a.id:o?.option.type===a.type),onSelect:()=>l({listType:e,option:a})},`${e}-${a.id??a.type}-${n}`))}):n?.length?t($o,{purpleColors:!0,title:Ee[e].TITLE,tooltip:Ee[e].DESCRIPTION,list:n.map(({option:a,formData:n,testResult:i},s)=>t(xo,{option:a,formData:n,testResult:i,isSelected:o?.unsavedIdx===s&&o?.listType===e,onSelect:()=>l({listType:e,option:a,unsavedIdx:s})},`${e}-${s}`))},e):void 0},Po=({isFetching:e,destinationsByCategory:a,searchText:n,filters:o})=>{const{unsavedDestinations:l}=U();return{width:"40%",list:r(()=>{const i=[];l.length&&i.push(t(Oo,{listType:Ie.UNSAVED,unsavedDestinations:l},"unsaved"));for(const e of Object.values(Ie)){if(o.categoryType&&o.categoryType!==e)continue;const l=Ro(a[e],n,o);l.length&&i.push(t(Oo,{listType:e,destinationOptions:l},e))}return e&&i.push(t(ke,{children:t(De,{title:"Fetching destinations",withSpinner:!0})},"loading-more")),i},[l,a,n,o,e])}},Fo=({destinationsByCategory:n,filters:o,setFilters:l})=>{const i=r(()=>Object.values(Ie).map(e=>({id:e,label:e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()})).filter(e=>n[e.id]?.length),[n]),s=r(()=>{const e=Object.values(H).map(e=>({value:e,label:e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}));return e.unshift({value:null,label:"All"}),e},[]);return e(a,{children:[t(Re,{placeholder:"Select category",options:i,values:o.categoryType?[o.categoryType]:[],setValues:e=>l({...o,categoryType:o.categoryType===e[0]?null:e[0]})}),t(B,{size:xe.S,options:s,selected:o.signalType,setSelected:e=>l({...o,signalType:e})})]})};var Lo;!function(e){e.SELF_HOSTED="self hosted",e.MANAGED="managed"}(Lo||(Lo={}));const Mo=(e,t)=>{const a=[],n=[],o=[];return e&&e.destinationCategories.categories.forEach(e=>{e.name===Lo.SELF_HOSTED?n.push(...e.items):e.name===Lo.MANAGED&&o.push(...e.items)}),t&&t?.potentialDestinations.forEach(t=>{for(const n of e?.destinationCategories?.categories||[]){const e=Oe(n),o=e.items.findIndex(e=>e.type===t.type);if(-1!==o){const n=Pe(t.fields,{});Object.keys(n).length&&(e.items[o].fields=e.items[o].fields.map(e=>({...e,initialValue:n[e.name]})),a.push(e.items[o]))}}}),{[Ie.DETECTED]:a,[Ie.SELF_HOSTED]:n,[Ie.MANAGED]:o}},Vo=({onClose:e,onBack:a,onNext:o,selectedConnectionIds:l,setSelectedConnectionIds:s,getDestinationCategories:r,getPotentialDestinations:d,initialInputs:u,testConnection:p,createDestination:m,updateDestination:h,withOverlay:g,disableAnimation:b})=>{const[f,y]=i(""),[v,C]=i({categoryType:null,signalType:null}),{destinations:S}=Fe(),{activeForm:w,genericForm:k,formErrorMessage:T,unsavedDestinations:N,setUnsavedDestinations:A}=U();n(()=>{u&&A(u)},[u]);const[I,D]=i(!0),[E,$]=i([]),[R,x]=i({[Ie.ALL]:[],[Ie.UNSAVED]:[],[Ie.EXISTS]:[],[Ie.DETECTED]:[],[Ie.SELF_HOSTED]:[],[Ie.MANAGED]:[]});n(()=>{const e=S.map(e=>{let t;for(const a of E){const n=a.items.find(t=>t.type===e.destinationType.type);if(n){t=n;break}}const a=Pe(e.fields,{});return{id:e.id,type:e.destinationType.type,displayName:e.name||e.destinationType.displayName,selected:!0,testConnectionSupported:t?.testConnectionSupported??!1,supportedSignals:e.destinationType.supportedSignals,fields:t?t.fields.map(e=>({...e,initialValue:a[e.name]??e.initialValue})):[]}});x(t=>({...t,[Ie.EXISTS]:e}))},[S,E]);const O=c(async()=>{try{D(!0);const[e,t]=await Promise.all([r(),d()]);e&&$(e.destinationCategories.categories),x(a=>({...a,...Mo(e,t)}))}catch(e){}finally{D(!1)}},[]);n(()=>{O()},[]);const P=c(async()=>{const e=(await Promise.all(N.map(({option:e,formData:t})=>{const a=K(t);if(e.id){const t=Object.fromEntries(e.fields.map(e=>[e.name,e.initialValue??""])),n=Object.fromEntries(a.fields.map(e=>[e.key,e.value??""]));if(!Object.keys(t).some(e=>t[e]!==n[e]))return h(e.id,a,l)}return m(a,l)}))).filter(e=>e?.error);if(e.length)return{error:e.map(e=>e?.error).join("\n")}},[N,l,m,h]);return t(Bn,{isOpen:!0,withOverlay:g,disableAnimation:b,onClose:e,onBack:a?()=>a(N):void 0,onNext:o?()=>o(N):void 0,nextIsSkip:!N.length,onSave:P,disableSave:!w&&!N.length,isFetching:I,errorMessage:T,isFormDirty:N.length>0||k?.isFormDirty,hideDirtyNote:!0,progress:{title:Te.CREATING_DESTINATION,subTitle:Te.CREATING_DESTINATION_SUBTITLE},header:{icon:tn,title:Te.ADD_DESTINATIONS,subTitle:Te.ADD_DESTINATION_DRAWER_DESCRIPTION},connectionIds:l&&s?{value:l,setValue:s}:void 0,search:{value:f,onChange:y},filters:t(Fo,{destinationsByCategory:R,filters:v,setFilters:C}),leftColumn:Po({isFetching:I,destinationsByCategory:R,searchText:f,filters:v}),rightColumn:Io({testConnection:p})})},Bo=({onClose:e,selectedConnectionIds:a,setSelectedConnectionIds:n,createInstrumentationRule:o,withOverlay:l})=>{const[s,c]=i(""),u=d(null),{selectedOption:p,onSelectOption:m,genericForm:h,validateFormData:g,errorMessage:b}=ne(),f=r(()=>s?Le.filter(e=>e.label.toLowerCase().includes(s.toLowerCase())):Le,[s]),y=r(()=>f.map(e=>{const a=p?.type===e.type;return t(To,{dataId:`option-${e.type}`,title:e.label,description:e.description,withCarret:!0,isSelected:a,onClick:()=>{u.current?.clearErrors(),m(e)}},e.type)}),[p,f.length,m]),v=r(()=>p?[t(bo,{},p.type)]:[t(ke,{$height:"100%",children:t(F,{icon:sn,title:"Instrumentation rule not selected",subTitle:"Please select an instrumentation rule to add"})},"no-data")],[p]);return t(Bn,{ref:u,isOpen:!0,withOverlay:l,onClose:e,onSave:async()=>{const{errorMessage:e,preparedFormData:t}=g();return e?Promise.resolve({error:e}):await o(t)},disableSave:!p||!h?.isFormDirty,isFormDirty:h?.isFormDirty,hideDirtyNote:!0,errorMessage:b,progress:{title:Te.CREATING_INSTRUMENTATION_RULE,subTitle:Te.CREATING_INSTRUMENTATION_RULE_SUBTITLE},header:{icon:sn,title:Te.ADD_INSTRUMENTATION_RULE,subTitle:Te.ADD_INSTRUMENTATION_RULE_DESCRIPTION},connectionIds:a&&n?{value:a,setValue:n}:void 0,search:{value:s,onChange:c},leftColumn:{width:"40%",list:y},rightColumn:{width:"60%",list:v}})},zo=p.div``,_o=p.div`
51
51
  visibility: hidden;
52
52
 
53
53
  transition: visibility 0s;
package/lib/containers.js CHANGED
@@ -556,7 +556,7 @@ import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{useState
556
556
  flex-shrink: 0;
557
557
  `,ls=h.div`
558
558
  padding: 12px;
559
- `;function ss(e){return e>=1073741824?`${(e/1073741824).toFixed(1)} GiB`:e>=1048576?`${(e/1048576).toFixed(1)} MiB`:e>=1024?`${(e/1024).toFixed(1)} KiB`:`${e} B`}const cs=({source:n,fetchProfilingSlots:r,enableProfiling:s,releaseProfiling:u,fetchSourceProfiling:p,onFlameFullscreenChange:h})=>{const m=g(),f=c(()=>({namespace:n.namespace,kind:n.kind,name:n.name}),[n.namespace,n.kind,n.name]),[v,y]=i(!0),[b,S]=i(null),[x,C]=i(null),[w,k]=i(0),[T,E]=i(Zl.Both),[$,N]=i(""),D=l(null),I=d(async()=>{try{const e=[r()];v&&e.push(p(f));const[t,n]=await Promise.all(e);t&&S(t),n?.profileJson&&C(n.profileJson)}finally{k(e=>e+1)}},[r,p,f]);o(()=>{let e=!1;return(async()=>{await s(f),e||(await I(),e||(D.current=setInterval(I,3e3)))})(),()=>{e=!0,D.current&&clearInterval(D.current),u(f)}},[s,u,I,f]);const A=c(()=>function(e){if(!e?.trim())return null;try{const t=JSON.parse(e),n=t.flamebearer;return!n?.names?.length||!Array.isArray(n.levels)||"number"!=typeof n.numTicks||n.numTicks<=0?null:{flamebearer:n,units:t.metadata?.units}}catch{return null}}(x),[x]),R=c(()=>A?function(e){const t=new Map;for(let n=0;n<e.levels.length;n++){const i=e.levels[n];for(let n=0;n+3<i.length;n+=4){const o=i[n+1],a=i[n+2],r=Ll(e,i[n+3]);if(!r)continue;const l=t.get(r);(!l||o>l.total)&&t.set(r,{self:a,total:o})}}return[...t.entries()].map(([e,t])=>({name:e,self:t.self,total:t.total})).sort((e,t)=>t.self-e.self)}(A.flamebearer):[],[A]),M=c(()=>{const e=$.trim().toLowerCase();return e?R.filter(t=>t.name.toLowerCase().includes(e)):R},[R,$]),F=T===Zl.Table||T===Zl.Both,L=T===Zl.Flame||T===Zl.Both,P=F&&L;return w<2?t(Re,{$height:"70vh",children:t(Cn,{withSpinner:!0})}):e(es,{$gap:0,$width:"100%",children:[e(ts,{children:[t(be,{text:"Live CPU profile collected from the workload agent. Search symbols, switch between the table and flame graph, or download a JSON snapshot.",withIcon:!0,children:t(ns,{children:t(mn,{size:gn.S,weight:500,color:m.v2.colors.white[500],nowrap:!0,children:"CPU Profiling"})})}),e(O,{style:{flex:1,minWidth:200,gap:10,alignItems:"center",flexWrap:"wrap"},children:[t("div",{style:{flex:"1 1 220px",minWidth:180},children:t(wn,{value:$,onChange:N,placeholder:"Search by symbol name",width:"100%",idleBackgroundColor:m.v2.colors.silver[900],emphasizeBackgroundColor:m.v2.colors.silver[800]})}),t(bn,{size:xn.S,variant:Sn.Filled,options:[{value:Zl.Table,label:"Top table"},{value:Zl.Flame,label:"Flame graph"},{value:Zl.Both,label:"Both"}],selected:T,setSelected:E}),t(fn,v?{variant:yn.Secondary,size:vn.S,label:"Live",tooltip:"Odigos profiler works in-memory and doesn't store any data on disk, to keep minimum memory footprint we store only last 10 minutes of data on demand",leftIcon:e=>t(Ii,{...e,size:8,fill:m.v2.colors.green[500]})}:{variant:yn.Secondary,size:vn.S,label:"Paused",tooltip:"Odigos profiler is still collecting data, but the UI is not updating in real time",leftIcon:e=>t(Ii,{...e,size:8,fill:m.v2.colors.red[500]})})]})]}),t(is,{$gap:F&&L?16:0,children:A?e(a,{children:[F&&e(os,{$splitWithFlame:P,children:[t(rs,{$justifyContent:"flex-end",children:t(fn,{variant:yn.Secondary,size:vn.S,label:"Download snapshot",rightIcon:Ai,onClick:()=>{if(!x)return;const e=new Blob([x],{type:"application/json"}),t=URL.createObjectURL(e),i=document.createElement("a");i.href=t,i.download=`cpu-profile-${n.namespace}-${n.kind}-${n.name}.json`,i.click(),URL.revokeObjectURL(t)},disabled:!x})}),t(Gl,{rows:M,languages:n.detectedLanguages||n.containers?.map(e=>e.overrides?.runtimeInfo?.language??e.runtimeInfo?.language??"")})]}),L&&e(as,{$splitWithTable:P,children:[e(rs,{$justifyContent:"space-between",children:[t(Tn,{label:A?`Total in view ${Pl(A.flamebearer.numTicks)}`:"No profile sample yet",backgroundColor:m.v2.colors.silver[750],textColor:m.v2.colors.silver[200],textSize:gn.XXS}),e(O,{$gap:12,children:[!v&&t(fn,{variant:yn.Secondary,size:vn.S,label:"Refresh",leftIcon:li,onClick:I}),t(En,{label:"Auto refresh",labelAlign:Nn.Left,size:$n.S,value:v,onChange:y})]})]}),t(Ql,{flamebearer:A.flamebearer,maxRowPx:24,searchQuery:$,minHostHeight:280,onFullscreenChange:h},T)]})]}):t(Re,{children:t(kn,{title:"No profile samples yet",subTitle:"Dynamically collecting profiling samples — keep this tab open while the agent sends OTLP profiles."})})}),b&&t(ls,{children:t(mn,{size:gn.XXXS,color:m.v2.colors.silver[300],children:`${b.activeKeys.length} / ${b.maxSlots} profiling slots · ${ss(b.totalBytesUsed)} / ${ss(b.maxTotalBytesBudget)} budget · TTL ${b.slotTtlSeconds}s`})})]})},ds=(e,t)=>{const{name:n,kind:i,namespace:o}=e,a=[{title:f.KIND,value:i},{title:f.NAME,value:n,tooltip:"Resource name"}];return t||(a.unshift({title:f.NAMESPACE,value:o}),a.push({type:v.Divider}),a.push({type:v.CopyText,value:`kubectl get ${i} ${n} -n ${o}`.toLowerCase()})),a},us=h.div`
559
+ `;function ss(e){return e>=1073741824?`${(e/1073741824).toFixed(1)} GiB`:e>=1048576?`${(e/1048576).toFixed(1)} MiB`:e>=1024?`${(e/1024).toFixed(1)} KiB`:`${e} B`}const cs=({source:n,fetchProfilingSlots:r,enableProfiling:s,fetchSourceProfiling:u,onFlameFullscreenChange:p})=>{const h=g(),m=c(()=>({namespace:n.namespace,kind:n.kind,name:n.name}),[n.namespace,n.kind,n.name]),[f,v]=i(!0),[y,b]=i(null),[S,x]=i(null),[C,w]=i(0),[k,T]=i(Zl.Both),[E,$]=i(""),N=l(null),D=d(async()=>{try{const e=[r()];f&&e.push(u(m));const[t,n]=await Promise.all(e);t&&b(t),n?.profileJson&&x(n.profileJson)}finally{w(e=>e+1)}},[r,u,m]);o(()=>{let e=!1;return(async()=>{await s(m),e||(await D(),e||(N.current=setInterval(D,3e3)))})(),()=>{e=!0,N.current&&clearInterval(N.current)}},[s,D,m]);const I=c(()=>function(e){if(!e?.trim())return null;try{const t=JSON.parse(e),n=t.flamebearer;return!n?.names?.length||!Array.isArray(n.levels)||"number"!=typeof n.numTicks||n.numTicks<=0?null:{flamebearer:n,units:t.metadata?.units}}catch{return null}}(S),[S]),A=c(()=>I?function(e){const t=new Map;for(let n=0;n<e.levels.length;n++){const i=e.levels[n];for(let n=0;n+3<i.length;n+=4){const o=i[n+1],a=i[n+2],r=Ll(e,i[n+3]);if(!r)continue;const l=t.get(r);(!l||o>l.total)&&t.set(r,{self:a,total:o})}}return[...t.entries()].map(([e,t])=>({name:e,self:t.self,total:t.total})).sort((e,t)=>t.self-e.self)}(I.flamebearer):[],[I]),R=c(()=>{const e=E.trim().toLowerCase();return e?A.filter(t=>t.name.toLowerCase().includes(e)):A},[A,E]),M=k===Zl.Table||k===Zl.Both,F=k===Zl.Flame||k===Zl.Both,L=M&&F;return C<2?t(Re,{$height:"70vh",children:t(Cn,{withSpinner:!0})}):e(es,{$gap:0,$width:"100%",children:[e(ts,{children:[t(be,{text:"Live CPU profile collected from the workload agent. Search symbols, switch between the table and flame graph, or download a JSON snapshot.",withIcon:!0,children:t(ns,{children:t(mn,{size:gn.S,weight:500,color:h.v2.colors.white[500],nowrap:!0,children:"CPU Profiling"})})}),e(O,{style:{flex:1,minWidth:200,gap:10,alignItems:"center",flexWrap:"wrap"},children:[t("div",{style:{flex:"1 1 220px",minWidth:180},children:t(wn,{value:E,onChange:$,placeholder:"Search by symbol name",width:"100%",idleBackgroundColor:h.v2.colors.silver[900],emphasizeBackgroundColor:h.v2.colors.silver[800]})}),t(bn,{size:xn.S,variant:Sn.Filled,options:[{value:Zl.Table,label:"Top table"},{value:Zl.Flame,label:"Flame graph"},{value:Zl.Both,label:"Both"}],selected:k,setSelected:T}),t(fn,f?{variant:yn.Secondary,size:vn.S,label:"Live",tooltip:"Odigos profiler works in-memory and doesn't store any data on disk, to keep minimum memory footprint we store only last 10 minutes of data on demand",leftIcon:e=>t(Ii,{...e,size:8,fill:h.v2.colors.green[500]})}:{variant:yn.Secondary,size:vn.S,label:"Paused",tooltip:"Odigos profiler is still collecting data, but the UI is not updating in real time",leftIcon:e=>t(Ii,{...e,size:8,fill:h.v2.colors.red[500]})})]})]}),t(is,{$gap:M&&F?16:0,children:I?e(a,{children:[M&&e(os,{$splitWithFlame:L,children:[t(rs,{$justifyContent:"flex-end",children:t(fn,{variant:yn.Secondary,size:vn.S,label:"Download snapshot",rightIcon:Ai,onClick:()=>{if(!S)return;const e=new Blob([S],{type:"application/json"}),t=URL.createObjectURL(e),i=document.createElement("a");i.href=t,i.download=`cpu-profile-${n.namespace}-${n.kind}-${n.name}.json`,i.click(),URL.revokeObjectURL(t)},disabled:!S})}),t(Gl,{rows:R,languages:n.detectedLanguages||n.containers?.map(e=>e.overrides?.runtimeInfo?.language??e.runtimeInfo?.language??"")})]}),F&&e(as,{$splitWithTable:L,children:[e(rs,{$justifyContent:"space-between",children:[t(Tn,{label:I?`Total in view ${Pl(I.flamebearer.numTicks)}`:"No profile sample yet",backgroundColor:h.v2.colors.silver[750],textColor:h.v2.colors.silver[200],textSize:gn.XXS}),e(O,{$gap:12,children:[!f&&t(fn,{variant:yn.Secondary,size:vn.S,label:"Refresh",leftIcon:li,onClick:D}),t(En,{label:"Auto refresh",labelAlign:Nn.Left,size:$n.S,value:f,onChange:v})]})]}),t(Ql,{flamebearer:I.flamebearer,maxRowPx:24,searchQuery:E,minHostHeight:280,onFullscreenChange:p},k)]})]}):t(Re,{children:t(kn,{title:"No profile samples yet",subTitle:"Dynamically collecting profiling samples — keep this tab open while the agent sends OTLP profiles."})})}),y&&t(ls,{children:t(mn,{size:gn.XXXS,color:h.v2.colors.silver[300],children:`${y.activeKeys.length} / ${y.maxSlots} profiling slots · ${ss(y.totalBytesUsed)} / ${ss(y.maxTotalBytesBudget)} budget · TTL ${y.slotTtlSeconds}s`})})]})},ds=(e,t)=>{const{name:n,kind:i,namespace:o}=e,a=[{title:f.KIND,value:i},{title:f.NAME,value:n,tooltip:"Resource name"}];return t||(a.unshift({title:f.NAMESPACE,value:o}),a.push({type:v.Divider}),a.push({type:v.CopyText,value:`kubectl get ${i} ${n} -n ${o}`.toLowerCase()})),a},us=h.div`
560
560
  display: flex;
561
561
  flex-direction: column;
562
562
  gap: 24px;
@@ -586,7 +586,7 @@ import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{useState
586
586
  display: flex;
587
587
  flex-direction: column;
588
588
  gap: 12px;
589
- `;var Ds;!function(e){e.Workload="Workload",e.Pod="Pod"}(Ds||(Ds={}));const Is=({persistSources:a,updateSource:r,restartWorkloads:s,fetchSourceById:d,fetchSourceDescribe:u,fetchSourceLibraries:p,fetchPeerSources:h,restartPod:m,recoverFromRollback:g,profilingEnabled:v,fetchProfilingSlots:y,enableProfiling:b,releaseProfiling:S,fetchSourceProfiling:x})=>{const{isVm:C}=ae(),w=X(e=>e.sources),{selectedStreamName:k}=Ze(),{drawerType:T,drawerEntityId:E}=W(),$=c(()=>tt(w,k),[w,k]),N=l(null),D=T===J.Source,[I,A]=i(!1),[R,O]=i(!1),[M,F]=i(ws.Overview),[L,P]=i(null),[_,z]=i(!1);o(()=>{D&&E&&d(E).then(e=>P(e||null))},[D,E]);const{formData:K,handleFormChange:j,resetFormData:V,loadFormWithDrawerItem:U}=_n(),H=c(()=>{if(E)return L&&JSON.stringify(Zt(L))===JSON.stringify(Zt(E))?L:$?.find(e=>JSON.stringify(Zt(e))===JSON.stringify(Zt(E)))},[E,$,L]);o(()=>{D&&H?U(H):V()},[D,H]);const q=c(()=>{const e=H?.conditions?.find(({type:e})=>"RuntimeDetection"===e);return{description:e?.message,isLoading:e?.status===ve.Loading,containers:H?.containers||[]}},[H]),G=c(()=>!!H?.rollbackOccurred,[H?.rollbackOccurred]),Y=c(()=>{const e=[{label:ws.Overview,onClick:()=>F(ws.Overview),selected:M===ws.Overview}];return C||(ks.includes(H?.kind)&&e.push({label:ws.Pods,onClick:()=>F(ws.Pods),selected:M===ws.Pods}),H?.containers?.some(e=>Es.includes(e.overrides?.runtimeInfo?.language??e.runtimeInfo?.language))&&e.push({label:ws.Libraries,onClick:()=>F(ws.Libraries),selected:M===ws.Libraries}),e.push({label:ws.PeerSources,onClick:()=>F(ws.PeerSources),selected:M===ws.PeerSources}),v&&y&&b&&S&&x&&e.push({label:ws.Profiling,onClick:()=>F(ws.Profiling),selected:M===ws.Profiling})),e},[M,H,C,v,y,b,S,x]),Q=Ts.includes(H?.kind),[Z,ee]=i({openFor:null,workloadId:void 0,podNamespace:void 0,podName:void 0});if(!H)return null;return e(po,{ref:N,width:_?"95vw":M===ws.Profiling?"80vw":void 0,onClose:()=>{F(ws.Overview),P(null),z(!1)},title:H.otelServiceName||H.name,titleTooltip:"This attribute is used to identify the name of the service (service.name) that is generating telemetry data.",hideEditTitleFromEdit:!0,icons:jn(H.containers),isEdit:I,isFormDirty:R,onEdit:M===ws.Overview?e=>{A("boolean"!=typeof e||e)}:void 0,onSave:async()=>{const e=K.otelServiceName!==H.name?K.otelServiceName:"";j("otelServiceName",e),await r(E,{...K,otelServiceName:e}),P(null),O(!1),A(!1)},onDelete:M===ws.Overview?async()=>{const{namespace:e}=H;a({[e]:[{...H,selected:!1,currentStreamName:k}]},{}),P(null),O(!1),A(!1),N.current?.closeDrawer()}:void 0,onCancel:()=>{O(!1),A(!1),j("otelServiceName",H.otelServiceName||H.name||"")},isLastItem:1===$.length,tabs:Y,headerActionButtons:C?[]:Q?[{"data-id":"rollout-restart",variant:"tertiary",onClick:()=>ee({openFor:Ds.Workload,workloadId:E}),children:e(n,{children:[t(mi,{}),t(B,{size:14,family:"secondary",decoration:"underline",children:"Restart"})]})}]:[],children:[M===ws.Overview?I?t($s,{children:t(ps,{formData:K,handleFormChange:(...e)=>{O(!0),j(...e),j("currentStreamName",k)}})}):e(Ns,{children:[t(hs,{workloadOdigosHealthStatus:H.workloadOdigosHealthStatus}),G&&t(de,{type:ue.Warning,message:f.ROLLBACK_OCCURRED_MESSAGE,action:{label:f.ROLLBACK_RECOVER,onClick:async()=>{await g(E);const e=await d(E);e&&P(e)}}}),t(te,{conditions:H.conditions||[]}),t(ne,{title:f.SOURCE_DETAILS,data:H?ds(H,C):[]}),t(ne,{title:C?f.DETECTED_PROCESSES:f.DETECTED_CONTAINERS,titleBadge:q.isLoading?ve.Loading:q.containers.length,description:q.description||(C?f.DETECTED_PROCESSES_DESCRIPTION:f.DETECTED_CONTAINERS_DESCRIPTION),children:q.containers.map(e=>t(Kn,{...e,callbackRuntimeOverride:e=>r(E,e)},`source-container-${e.containerName}`))}),H.manifestYAML&&t(Ki,{title:`${H.kind} YAML`,yaml:H.manifestYAML,defaultOpen:!H.instrumentationConfigYAML}),H.instrumentationConfigYAML&&t(Ki,{title:"Instrumentation Config YAML",yaml:H.instrumentationConfigYAML,defaultOpen:!H.manifestYAML})]}):M===ws.Pods?t(ms,{source:H,fetchSourceDescribe:u,onClickRestartPod:Q?(e,t)=>ee({openFor:Ds.Pod,podNamespace:e,podName:t}):void 0}):M===ws.Libraries?t(fs,{source:H,fetchSourceLibraries:p}):M===ws.PeerSources?t(Cs,{source:H,fetchPeerSources:h}):M===ws.Profiling&&v&&y&&b&&S&&x?t(cs,{source:H,fetchProfilingSlots:y,enableProfiling:b,releaseProfiling:S,fetchSourceProfiling:x,onFlameFullscreenChange:z}):null,t(Xt,{isOpen:!!Z.openFor,title:`Rollout Restart ${Z.openFor}`,description:`Are you sure you want to rollout restart this ${Z.openFor?.toLowerCase()}?`,approveButton:{text:"Confirm",variant:ue.Warning,onClick:()=>{Z.openFor===Ds.Workload&&Z.workloadId?s([Z.workloadId]):Z.openFor===Ds.Pod&&Z.podNamespace&&Z.podName&&m(Z.podNamespace,Z.podName),ee({openFor:null})}},denyButton:{text:"Go Back",onClick:()=>{ee({openFor:null})}}})]})},As=h.div`
589
+ `;var Ds;!function(e){e.Workload="Workload",e.Pod="Pod"}(Ds||(Ds={}));const Is=({persistSources:a,updateSource:r,restartWorkloads:s,fetchSourceById:d,fetchSourceDescribe:u,fetchSourceLibraries:p,fetchPeerSources:h,restartPod:m,recoverFromRollback:g,profilingEnabled:v,fetchProfilingSlots:y,enableProfiling:b,fetchSourceProfiling:S})=>{const{isVm:x}=ae(),C=X(e=>e.sources),{selectedStreamName:w}=Ze(),{drawerType:k,drawerEntityId:T}=W(),E=c(()=>tt(C,w),[C,w]),$=l(null),N=k===J.Source,[D,I]=i(!1),[A,R]=i(!1),[O,M]=i(ws.Overview),[F,L]=i(null),[P,_]=i(!1);o(()=>{N&&T&&d(T).then(e=>L(e||null))},[N,T]);const{formData:z,handleFormChange:K,resetFormData:j,loadFormWithDrawerItem:V}=_n(),U=c(()=>{if(T)return F&&JSON.stringify(Zt(F))===JSON.stringify(Zt(T))?F:E?.find(e=>JSON.stringify(Zt(e))===JSON.stringify(Zt(T)))},[T,E,F]);o(()=>{N&&U?V(U):j()},[N,U]);const H=c(()=>{const e=U?.conditions?.find(({type:e})=>"RuntimeDetection"===e);return{description:e?.message,isLoading:e?.status===ve.Loading,containers:U?.containers||[]}},[U]),q=c(()=>!!U?.rollbackOccurred,[U?.rollbackOccurred]),G=c(()=>{const e=[{label:ws.Overview,onClick:()=>M(ws.Overview),selected:O===ws.Overview}];return x||(ks.includes(U?.kind)&&e.push({label:ws.Pods,onClick:()=>M(ws.Pods),selected:O===ws.Pods}),U?.containers?.some(e=>Es.includes(e.overrides?.runtimeInfo?.language??e.runtimeInfo?.language))&&e.push({label:ws.Libraries,onClick:()=>M(ws.Libraries),selected:O===ws.Libraries}),e.push({label:ws.PeerSources,onClick:()=>M(ws.PeerSources),selected:O===ws.PeerSources}),v&&y&&b&&S&&e.push({label:ws.Profiling,onClick:()=>M(ws.Profiling),selected:O===ws.Profiling})),e},[O,U,x,v,y,b,S]),Y=Ts.includes(U?.kind),[Q,Z]=i({openFor:null,workloadId:void 0,podNamespace:void 0,podName:void 0});if(!U)return null;return e(po,{ref:$,width:P?"95vw":O===ws.Profiling?"80vw":void 0,onClose:()=>{M(ws.Overview),L(null),_(!1)},title:U.otelServiceName||U.name,titleTooltip:"This attribute is used to identify the name of the service (service.name) that is generating telemetry data.",hideEditTitleFromEdit:!0,icons:jn(U.containers),isEdit:D,isFormDirty:A,onEdit:O===ws.Overview?e=>{I("boolean"!=typeof e||e)}:void 0,onSave:async()=>{const e=z.otelServiceName!==U.name?z.otelServiceName:"";K("otelServiceName",e),await r(T,{...z,otelServiceName:e}),L(null),R(!1),I(!1)},onDelete:O===ws.Overview?async()=>{const{namespace:e}=U;a({[e]:[{...U,selected:!1,currentStreamName:w}]},{}),L(null),R(!1),I(!1),$.current?.closeDrawer()}:void 0,onCancel:()=>{R(!1),I(!1),K("otelServiceName",U.otelServiceName||U.name||"")},isLastItem:1===E.length,tabs:G,headerActionButtons:x?[]:Y?[{"data-id":"rollout-restart",variant:"tertiary",onClick:()=>Z({openFor:Ds.Workload,workloadId:T}),children:e(n,{children:[t(mi,{}),t(B,{size:14,family:"secondary",decoration:"underline",children:"Restart"})]})}]:[],children:[O===ws.Overview?D?t($s,{children:t(ps,{formData:z,handleFormChange:(...e)=>{R(!0),K(...e),K("currentStreamName",w)}})}):e(Ns,{children:[t(hs,{workloadOdigosHealthStatus:U.workloadOdigosHealthStatus}),q&&t(de,{type:ue.Warning,message:f.ROLLBACK_OCCURRED_MESSAGE,action:{label:f.ROLLBACK_RECOVER,onClick:async()=>{await g(T);const e=await d(T);e&&L(e)}}}),t(te,{conditions:U.conditions||[]}),t(ne,{title:f.SOURCE_DETAILS,data:U?ds(U,x):[]}),t(ne,{title:x?f.DETECTED_PROCESSES:f.DETECTED_CONTAINERS,titleBadge:H.isLoading?ve.Loading:H.containers.length,description:H.description||(x?f.DETECTED_PROCESSES_DESCRIPTION:f.DETECTED_CONTAINERS_DESCRIPTION),children:H.containers.map(e=>t(Kn,{...e,callbackRuntimeOverride:e=>r(T,e)},`source-container-${e.containerName}`))}),U.manifestYAML&&t(Ki,{title:`${U.kind} YAML`,yaml:U.manifestYAML,defaultOpen:!U.instrumentationConfigYAML}),U.instrumentationConfigYAML&&t(Ki,{title:"Instrumentation Config YAML",yaml:U.instrumentationConfigYAML,defaultOpen:!U.manifestYAML})]}):O===ws.Pods?t(ms,{source:U,fetchSourceDescribe:u,onClickRestartPod:Y?(e,t)=>Z({openFor:Ds.Pod,podNamespace:e,podName:t}):void 0}):O===ws.Libraries?t(fs,{source:U,fetchSourceLibraries:p}):O===ws.PeerSources?t(Cs,{source:U,fetchPeerSources:h}):O===ws.Profiling&&v&&y&&b&&S?t(cs,{source:U,fetchProfilingSlots:y,enableProfiling:b,fetchSourceProfiling:S,onFlameFullscreenChange:_}):null,t(Xt,{isOpen:!!Q.openFor,title:`Rollout Restart ${Q.openFor}`,description:`Are you sure you want to rollout restart this ${Q.openFor?.toLowerCase()}?`,approveButton:{text:"Confirm",variant:ue.Warning,onClick:()=>{Q.openFor===Ds.Workload&&Q.workloadId?s([Q.workloadId]):Q.openFor===Ds.Pod&&Q.podNamespace&&Q.podName&&m(Q.podNamespace,Q.podName),Z({openFor:null})}},denyButton:{text:"Go Back",onClick:()=>{Z({openFor:null})}}})]})},As=h.div`
590
590
  max-width: ${({$fullWidth:e})=>e?"unset":"420px"};
591
591
  width: 100%;
592
592
  `,Rs=r(({isModal:n,fetchNamespacesWithWorkloads:i,onClickSummary:o},a)=>{const r=g(),{isVm:l}=ae(),c=Vn({fetchNamespacesWithWorkloads:i}),{selectedSources:d,loading:u,selectedAllNamespaces:p,onSelectAllNamespaces:h,getApiSourcesPayload:m,getApiFutureAppsPayload:v,searchText:y,setSearchText:b,searchBy:S,setSearchBy:x,showSelectedOnly:C,setShowSelectedOnly:w,showRunningOnly:T,setShowRunningOnly:E}=c;s(a,()=>({getFormValues:()=>({apps:m(),futureApps:v()})}));const $=Object.values(d).reduce((e,t)=>e+t.filter(e=>e.selected).length,0);return t(ce,{$isNotModal:!n,children:e(R,{$gap:12,children:[e(R,{$gap:24,children:[o&&t(xt,{onClick:o}),t(z,{title:f.SELECT_SOURCES,badgeLabel:$,description:f.SELECT_SOURCES_DESCRIPTION}),e(O,{$justifyContent:"space-between",children:[t(As,{$fullWidth:l,children:t(k,{placeholder:S===J.Source?f.SEARCH_SOURCES:f.SEARCH_NAMESPACES,icon:si,value:y,onChange:e=>b(e.target.value.toLowerCase())})}),!l&&t(P,{options:[{label:f.SOURCE,value:J.Source,selectedBgColor:r.text.secondary,selectedTextColor:r.text.primary},{label:f.NAMESPACE,value:J.Namespace,selectedBgColor:r.text.secondary,selectedTextColor:r.text.primary}],selected:S,setSelected:x})]}),e(O,{$gap:36,children:[t(N,{title:f.SELECT_ALL,initialValue:p,onChange:h,disabled:u}),t(N,{title:f.ONLY_SELECTED,initialValue:C,onChange:w}),t(N,{title:f.ONLY_RUNNING_INSTANCES,initialValue:T,onChange:E})]})]}),t(A,{}),t(Dl,{isModal:n,...c})]})})});Rs.displayName=Rs.name;const Os=({fetchNamespacesWithWorkloads:e,persistSources:n})=>{const{currentModal:i,setCurrentModal:o}=re(),a=i===J.Source,r=()=>{o("")},s=async()=>{if(c.current){const{apps:e,futureApps:t}=c.current.getFormValues();n(e,t),r()}},c=l(null);return U({key:"Enter",active:a},s),a?t(se,{isOpen:a,onClose:r,header:{title:"Add Source"},actionComponent:t(me,{buttons:[{label:"DONE",variant:"primary",onClick:s}]}),children:t(Rs,{ref:c,isModal:!0,fetchNamespacesWithWorkloads:e})}):null},Ms=e=>{const t=[{key:"checkbox-and-icon",title:""},{key:"name",title:f.NAME,sortable:!0},{key:"kind",title:"Kind",sortable:!0}];return e||t.push({key:"namespace",title:f.NAMESPACE,sortable:!0}),t.push({key:"containers",title:f.DETECTED_CONTAINERS}),t.push({key:"conditions",title:"Conditions"}),t.push({key:"throughput",title:"Throughput",sortable:!0}),t},Fs=({metrics:n,maxHeight:i,maxWidth:o})=>{const a=g(),{isVm:r}=ae(),l=xe(),{selectedStreamName:s}=Ze(),u=X(e=>e.sources),p=X(e=>e.sourcesLoading),{setDrawerType:h,setDrawerEntityId:m}=W(),{selectedSources:v,setSelectedSources:y}=ze(),{progress:b}=Je(),S=c(()=>b[Xe.Instrumenting]||b[Xe.Uninstrumenting]?b[Xe.Instrumenting]?.percentage||b[Xe.Uninstrumenting]?.percentage||0:void 0,[b[Xe.Instrumenting],b[Xe.Uninstrumenting]]),x=c(()=>tt(u,s),[u,s]),w=c(()=>Co({instrumentationRules:[],sources:it(x,l),actions:[],destinations:[],searchText:l.searchText,selectedCategory:J.Source}).searchResults.find(({category:e})=>e===J.Source)?.entities||[],[x,l]),[k,T]=c(()=>{let e=0;return Object.values(v).forEach(t=>{e+=t.length}),[0!==e,e]},[v]),E=d(e=>{if(e){const e={};w.forEach(t=>{const{namespace:n}=t;e[n]?e[n].push(t):e[n]=[t]}),y(e)}else y({})},[w]),$=d(e=>{const{namespace:t,name:n,kind:i}=e,o={...v};o[t]||(o[t]=[]);const a=o[t].findIndex(e=>e.name===n&&e.kind===i);-1===a?o[t].push(e):o[t].splice(a,1),y(o)},[v]),N=c(()=>w.map(i=>{const o=Zt(i),r=Be(o),{hasErrors:l,hasWarnings:s,hasDisableds:c}=ge(i.conditions||[]),d=!!v[o.namespace]?.find(e=>e.namespace===o.namespace&&e.name===o.name&&e.kind===o.kind);return{status:l?ue.Error:s?ue.Warning:void 0,faded:c,onClick:()=>{h(J.Source),m(o)},cells:[{columnKey:"checkbox-and-icon",component:()=>e(O,{$gap:16,children:[t(C,{value:d,onChange:()=>$(i)}),t(Bn,{icons:Ye(i),id:r})]})},{columnKey:"name",value:ke(i,J.Source,{extended:!0})},{columnKey:"kind",value:i.kind,textColor:a.text.info},{columnKey:"namespace",value:i.namespace,textColor:a.text.info},{columnKey:"throughput",value:He(Pt(n,J.Source,o).throughput),textColor:a.text.info},{columnKey:"conditions",component:()=>t(So,{conditions:i.conditions||[],id:r})},{columnKey:"containers",component:()=>t("div",{style:{lineHeight:1},children:t(fe,{status:ue.Info,title:Wn(i.containers),withBorder:!0})})}]}}),[w,v,n,$]),{badge:D,badgeTooltip:I}=c(()=>w.length!==x.length?{badge:`${w.length}/${x.length}`,badgeTooltip:f.FILTERED_COUNT_TOOLTIP}:{badge:x.length,badgeTooltip:void 0},[w,x]);return e(Ee,{$maxWidth:o,children:[e($e,{children:[t(C,{partiallyChecked:k&&w?.length!==T,value:k&&w?.length===T,onChange:E,disabled:!w?.length}),t(Ne,{icon:De(J.Source),title:f.SOURCES,badge:D,badgeTooltip:I,loading:p||"number"==typeof S})]}),t(Ie,{$maxHeight:i,children:t(Ae,{columns:Ms(r),rows:N})}),"number"!=typeof S||N.length?N.length?null:t(Re,{style:{marginTop:"2rem"},children:t(Oe,{})}):e(Re,{style:{marginTop:"2rem",gap:"24px"},children:[t(Me,{width:420}),e(O,{$gap:16,children:[e(B,{color:a.text.info,children:[b[Xe.Instrumenting]?"Instrumenting":"Uninstrumenting"," workloads..."]}),t(Fe,{label:`${S}%`})]})]})]})},Ls=({expiresAt:t})=>{const n=g(),{formatTimeAgo:i}=en(),o=i(t),a=new Date(t).toDateString().split(" ").slice(1).join(" "),r=Un(t,0)?n.text.error:Un(t,6048e5)?n.text.warning:n.text.success;return e(B,{size:14,color:r,children:[o," (",a,")"]})},Ps=h.div`
@@ -1,10 +1,8 @@
1
1
  import type { ProfilingProps } from '@/containers/source-drawer/profiling';
2
2
  type ProfilingSlots = Awaited<ReturnType<ProfilingProps['fetchProfilingSlots']>>;
3
3
  type EnableProfilingResult = Awaited<ReturnType<ProfilingProps['enableProfiling']>>;
4
- type ReleaseProfilingResult = Awaited<ReturnType<ProfilingProps['releaseProfiling']>>;
5
4
  type SourceProfilingResult = Awaited<ReturnType<ProfilingProps['fetchSourceProfiling']>>;
6
5
  export declare const MOCK_PROFILING_SLOTS: ProfilingSlots;
7
6
  export declare const MOCK_ENABLE_PROFILING_RESULT: EnableProfilingResult;
8
- export declare const MOCK_RELEASE_PROFILING_RESULT: ReleaseProfilingResult;
9
7
  export declare const MOCK_SOURCE_PROFILING_RESULT: SourceProfilingResult;
10
8
  export {};
@@ -1 +1 @@
1
- export{A as ActionType,bx as Actions,bG as ColoredSpan,eN as ColoredSpanVariant,bw as RichTitle}from"../chunks/ui-components-B4xHrszQ.js";export{C as CancelModal,i as DURATION_OPTIONS,f as DeleteModal,e as DurationErrorsSection,D as DynamicField,N as NOISY_PERCENTAGE_OPTIONS,h as OdigosLogoTextByTier,O as OperationSection,a as PERCENTAGE_OPTIONS,d as PercentageSection,P as PresetWithCustomInput,R as RuleInfoSection,b as SamplingPreviewSection,S as SignalsCheckboxList,c as SourceScopeSection,U as UpgradeModal,g as WIDE_DRAWER_WIDTH,W as WideDrawer}from"../chunks/index-hLSQkKAv.js";export{Y as YamlSectionCard}from"../chunks/index-DJZLguZq.js";import"react/jsx-runtime";import"styled-components";import"../icons.js";import"zustand";import"react";import"javascript-time-ago";import"../chunks/vendor-C150cdxb.js";import"@xyflow/react";import"react-dom";import"prism-react-renderer";import"react-error-boundary";import"lottie-react";import"virtua";
1
+ export{A as ActionType,bx as Actions,bG as ColoredSpan,eN as ColoredSpanVariant,bw as RichTitle}from"../chunks/ui-components-B4xHrszQ.js";export{C as CancelModal,i as DURATION_OPTIONS,f as DeleteModal,e as DurationErrorsSection,D as DynamicField,N as NOISY_PERCENTAGE_OPTIONS,h as OdigosLogoTextByTier,O as OperationSection,a as PERCENTAGE_OPTIONS,d as PercentageSection,P as PresetWithCustomInput,R as RuleInfoSection,b as SamplingPreviewSection,S as SignalsCheckboxList,c as SourceScopeSection,U as UpgradeModal,g as WIDE_DRAWER_WIDTH,W as WideDrawer}from"../chunks/index-CGrd7Nq0.js";export{Y as YamlSectionCard}from"../chunks/index-DJZLguZq.js";import"react/jsx-runtime";import"styled-components";import"../icons.js";import"zustand";import"react";import"javascript-time-ago";import"../chunks/vendor-C150cdxb.js";import"@xyflow/react";import"react-dom";import"prism-react-renderer";import"react-error-boundary";import"lottie-react";import"virtua";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@odigos/ui-kit",
3
- "version": "0.0.228",
3
+ "version": "0.0.230",
4
4
  "author": "Odigos",
5
5
  "license": "MIT",
6
6
  "repository": {