@odigos/ui-kit 0.0.189 → 0.0.191

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/lib/chunks/index-BgT3kLZa.js +3 -0
  3. package/lib/chunks/ui-components-CCA7B7ry.js +2364 -0
  4. package/lib/chunks/vendor-C-kwkNJP.js +1 -0
  5. package/lib/components/_v2/drop-data/index.d.ts +5 -1
  6. package/lib/components/_v2/drop-down/index.d.ts +9 -0
  7. package/lib/components/_v2/field-message/index.d.ts +6 -0
  8. package/lib/components/_v2/field-title/index.d.ts +9 -0
  9. package/lib/components/_v2/index.d.ts +6 -0
  10. package/lib/components/_v2/input/index.d.ts +3 -1
  11. package/lib/components/_v2/input-list/index.d.ts +15 -0
  12. package/lib/components/_v2/input-table/dynamic-field/index.d.ts +13 -0
  13. package/lib/components/_v2/input-table/index.d.ts +16 -0
  14. package/lib/components/_v2/input-table/types.d.ts +15 -0
  15. package/lib/components/_v2/island/index.d.ts +2 -1
  16. package/lib/components/_v2/segment/index.d.ts +2 -0
  17. package/lib/components/_v2/textarea/index.d.ts +11 -0
  18. package/lib/components/_v2/toggle/index.d.ts +2 -1
  19. package/lib/components/styled.d.ts +7 -0
  20. package/lib/components/v2.js +1 -1
  21. package/lib/components.js +1 -1
  22. package/lib/constants/strings/index.d.ts +1 -0
  23. package/lib/constants.js +1 -1
  24. package/lib/containers/_v2/_drawers/add-rule-drawer/helpers.d.ts +7 -0
  25. package/lib/containers/_v2/_drawers/add-rule-drawer/index.d.ts +10 -0
  26. package/lib/containers/_v2/{central-connections/source-drawer → _drawers/add-source-drawer}/index.d.ts +3 -4
  27. package/lib/containers/_v2/{central-connections/source-drawer → _drawers/add-source-drawer}/namespaces-column/index.d.ts +3 -2
  28. package/lib/containers/_v2/{central-connections/source-drawer → _drawers/add-source-drawer}/workloads-column/index.d.ts +3 -2
  29. package/lib/containers/_v2/_drawers/edit-config-drawer/index.d.ts +12 -0
  30. package/lib/containers/_v2/_drawers/index.d.ts +4 -0
  31. package/lib/containers/_v2/{system-drawer → _drawers/system-drawer}/index.d.ts +2 -3
  32. package/lib/containers/_v2/_drawers/system-drawer/tokens/index.d.ts +7 -0
  33. package/lib/containers/_v2/{system-drawer → _drawers/system-drawer}/tokens/token-expires-at.d.ts +2 -0
  34. package/lib/containers/_v2/_drawers/system-drawer/tokens/token-value.d.ts +14 -0
  35. package/lib/containers/_v2/_forms/add-rule-form/custom-fields/code-attributes/index.d.ts +5 -0
  36. package/lib/containers/_v2/_forms/add-rule-form/custom-fields/custom-instrumentation/index.d.ts +5 -0
  37. package/lib/containers/_v2/_forms/add-rule-form/custom-fields/headers-collection/index.d.ts +5 -0
  38. package/lib/containers/_v2/_forms/add-rule-form/custom-fields/index.d.ts +7 -0
  39. package/lib/containers/_v2/_forms/add-rule-form/custom-fields/payload-collection/index.d.ts +5 -0
  40. package/lib/containers/_v2/_forms/add-rule-form/index.d.ts +7 -0
  41. package/lib/containers/_v2/_forms/index.d.ts +1 -0
  42. package/lib/containers/_v2/central-connections/helpers.d.ts +44 -0
  43. package/lib/containers/_v2/central-connections/index.d.ts +5 -4
  44. package/lib/containers/_v2/index.d.ts +2 -1
  45. package/lib/containers/_v2/pipeline-collectors/index.d.ts +1 -0
  46. package/lib/containers/multi-source-control/index.d.ts +1 -1
  47. package/lib/containers/source-drawer/describe/index.d.ts +1 -1
  48. package/lib/containers/toggle-dark-mode/index.d.ts +1 -3
  49. package/lib/containers/v2.js +42 -73
  50. package/lib/containers.js +114 -114
  51. package/lib/contexts/index.d.ts +1 -0
  52. package/lib/contexts/storybook-context.d.ts +8 -0
  53. package/lib/contexts.js +1 -1
  54. package/lib/functions.js +1 -1
  55. package/lib/hooks/useActionFormData.d.ts +1 -1
  56. package/lib/hooks/useGenericForm.d.ts +5 -4
  57. package/lib/hooks.js +1 -1
  58. package/lib/icons.js +1 -1
  59. package/lib/snippets/_v2/index.d.ts +2 -0
  60. package/lib/snippets/_v2/rich-title/index.d.ts +1 -0
  61. package/lib/snippets/_v2/signals-checkbox-list/index.d.ts +11 -0
  62. package/lib/snippets/_v2/wide-drawer/column/index.d.ts +11 -0
  63. package/lib/snippets/_v2/wide-drawer/column-list-item/index.d.ts +13 -0
  64. package/lib/snippets/_v2/wide-drawer/index.d.ts +35 -0
  65. package/lib/snippets.js +1 -1
  66. package/lib/store/useSetupStore.d.ts +0 -4
  67. package/lib/store.js +1 -1
  68. package/lib/theme.js +1 -1
  69. package/lib/types/common/index.d.ts +4 -0
  70. package/lib/types/instrumentation-rules/index.d.ts +4 -1
  71. package/lib/types/tokens/index.d.ts +7 -0
  72. package/lib/types.js +1 -1
  73. package/lib/visuals.js +1 -1
  74. package/package.json +10 -10
  75. package/lib/chunks/ui-components-BiOIOsCC.js +0 -2296
  76. package/lib/chunks/vendor-1oZp1FpB.js +0 -1
  77. package/lib/containers/_v2/central-connections/config-drawer/index.d.ts +0 -18
  78. package/lib/containers/_v2/central-connections/source-drawer/styled.d.ts +0 -17
  79. package/lib/containers/_v2/system-drawer/tokens/index.d.ts +0 -7
  80. package/lib/containers/_v2/system-drawer/tokens/token-actions.d.ts +0 -12
  81. package/lib/containers/_v2/system-drawer/tokens/token-input.d.ts +0 -8
  82. /package/lib/containers/_v2/{central-connections/source-drawer → _drawers/add-source-drawer}/types.d.ts +0 -0
  83. /package/lib/containers/_v2/{system-drawer → _drawers/system-drawer}/describe/index.d.ts +0 -0
  84. /package/lib/containers/_v2/{system-drawer → _drawers/system-drawer}/diagnose/index.d.ts +0 -0
@@ -1,6 +1,7 @@
1
1
  import { type FC, type CSSProperties } from 'react';
2
2
  import { type GetExtendedPodInfo, type GetGatewayInfo, type GetGatewayPods, type GetNodeCollectorInfo, type GetNodeCollectorPods } from '@/types';
3
3
  export interface PipelineCollectorsProps {
4
+ minSupportedVersion?: number;
4
5
  tableRowsMaxHeight: CSSProperties['maxHeight'];
5
6
  getGatewayInfo: GetGatewayInfo;
6
7
  getGatewayPods: GetGatewayPods;
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
- import { WorkloadId } from '@/types';
3
2
  import { type SelectedState } from '@/store';
3
+ import { type WorkloadId } from '@/types';
4
4
  interface MultiSourceControlProps {
5
5
  totalSourceCount: number;
6
6
  uninstrumentSources: (payload: SelectedState['selectedSources']) => void;
@@ -7,7 +7,7 @@ interface DescribeProps {
7
7
  describeSource: DescribeSource;
8
8
  };
9
9
  }>;
10
- restartPod?: (namespace: string, name: string) => Promise<void>;
10
+ onClickRestartPod?: (namespace: string, name: string) => void;
11
11
  }
12
12
  declare const Describe: FC<DescribeProps>;
13
13
  export { Describe, type DescribeProps };
@@ -1,4 +1,2 @@
1
1
  import { type FC } from 'react';
2
- type ToggleDarkModeProps = object;
3
- declare const ToggleDarkMode: FC<ToggleDarkModeProps>;
4
- export { ToggleDarkMode, type ToggleDarkModeProps };
2
+ export declare const ToggleDarkMode: FC;
@@ -1,107 +1,83 @@
1
- import{jsxs as e,jsx as t,Fragment as l}from"react/jsx-runtime";import{useMemo as a,useState as n,useEffect as i,useCallback as o}from"react";import s,{useTheme as r}from"styled-components";import{F as c,a as d,C as u,T as p,b as h,B as g,S as m,c as b,O as f,N as w,d as y,e as k,f as C,u as v,g as x,D as $,E as S,h as I,i as T,j as D,L as A,P,R as z,k as R,l as N,m as O,n as V,o as M,p as L,q as W,r as F,s as j,t as E,v as G,A as U,w as H,x as Y,y as q,z as B,G as X,H as K,I as J,J as Q,K as Z,M as _,Q as ee,Y as te,U as le,V as ae,W as ne,X as ie,Z as oe,_ as se,$ as re,a0 as ce,a1 as de,a2 as ue,a3 as pe,a4 as he,a5 as ge,a6 as me,a7 as be}from"../chunks/ui-components-BiOIOsCC.js";import{SourceIcon as fe,VSquareIcon as we,SettingsIcon as ye,OdigosLogo as ke,DeleteIcon as Ce,RefreshIcon as ve,ConnectionsIcon as xe,VIcon as $e,XIcon as Se,XSquareIcon as Ie,PodIcon as Te,ChevronUpIcon as De,ChevronDownIcon as Ae,TerminalIcon as Pe,ArrowDownSquareIcon as ze,ArrowUpSquareIcon as Re,DownloadIcon as Ne,PipelineCollectorIcon as Oe,GatewayIcon as Ve,YamlIcon as Me,EditIcon as Le,KeyIcon as We,DiagnoseIcon as Fe}from"../icons.js";import"zustand";import"javascript-time-ago";import"../chunks/vendor-1oZp1FpB.js";import"react-dom";import"@xyflow/react";import"react-error-boundary";import"lottie-react";import"prism-react-renderer";const je=s(c)`
1
+ import{jsxs as e,Fragment as t,jsx as n}from"react/jsx-runtime";import{useMemo as l,useEffect as a,Children as o,forwardRef as i,useState as r,useImperativeHandle as s,useRef as c,useCallback as d}from"react";import u,{useTheme as h,css as p}from"styled-components";import{F as g,T as m,a as b,C as f,b as C,c as w,d as v,H as y,I as k,P as $,G as x,J as S,e as I,f as D,g as T,h as A,i as L,B as P,j as M,k as R,D as O,l as V,S as N,m as z,n as E,o as F,p as j,q as H,W,V as G,N as q,r as U,s as Y,L as B,R as K,t as X,u as Z,v as J,w as Q,x as _,y as ee,O as te,z as ne,A as le,E as ae,K as oe,M as ie,Q as re,U as se,X as ce,Y as de,Z as ue,_ as he,$ as pe,a0 as ge,a1 as me,a2 as be,a3 as fe,a4 as Ce,a5 as we,a6 as ve,a7 as ye,a8 as ke,a9 as $e,aa as xe,ab as Se,ac as Ie,ad as De,ae as Te,af as Ae,ag as Le,ah as Pe,ai as Me,aj as Re,ak as Oe,al as Ve,am as Ne,an as ze,ao as Ee}from"../chunks/ui-components-CCA7B7ry.js";import{GoLogo as Fe,JavaLogo as je,BookIcon as He,VSquareIcon as We,XSquareIcon as Ge,OdigosLogo as qe,ChevronRightIcon as Ue,InstrumentationRuleIcon as Ye,SourceIcon as Be,SettingsIcon as Ke,XIcon as Xe,VIcon as Ze,EditIcon as Je,ExclamationTriangleIcon as Qe,ExclamationCircleIcon as _e,KeyIcon as et,DiagnoseIcon as tt,DownloadIcon as nt,TerminalIcon as lt,DeleteIcon as at,DestinationIcon as ot,ActionIcon as it,RefreshIcon as rt,ConnectionsIcon as st,PodIcon as ct,ChevronUpIcon as dt,ChevronDownIcon as ut,ArrowDownSquareIcon as ht,ArrowUpSquareIcon as pt,PipelineCollectorIcon as gt,GatewayIcon as mt,YamlIcon as bt}from"../icons.js";import{Y as ft}from"../chunks/index-BgT3kLZa.js";import"zustand";import"javascript-time-ago";import"../chunks/vendor-C-kwkNJP.js";import"react-dom";import"@xyflow/react";import"prism-react-renderer";import"react-error-boundary";import"lottie-react";const Ct=[{id:f.FilePath,label:"Collect File Path",tooltip:"Indicates whether to record the `code.filepath` attribute."},{id:f.Function,label:"Collect Function",tooltip:"Indicates whether to record the `code.function` attribute."},{id:f.LineNumber,label:"Collect Line Number",tooltip:"Indicates whether to record the `code.lineno` attribute."}],wt=[{id:f.Column,label:"Collect Column",tooltip:"Indicates whether to record the `code.column` attribute."},{id:f.Namespace,label:"Collect Namespace",tooltip:"Indicates whether to record the `code.namespace` attribute."},{id:f.StackTrace,label:"Collect Stacktrace",tooltip:"Indicates whether to record the `code.stacktrace` attribute."}],vt=["*"],yt=[{id:$.HttpRequest,label:"Collect HTTP Request",tooltip:""},{id:$.HttpResponse,label:"Collect HTTP Response",tooltip:""},{id:$.DbQuery,label:"Collect DB Query",tooltip:""},{id:$.Messaging,label:"Collect Messaging",tooltip:""}],kt={[I.Java]:[new S("","")],[I.Golang]:[new x("")]},$t={[L.CodeAttributes]:({value:o,setValue:i,formErrors:r})=>{const s=h(),c=r.codeAttributes,d=l(()=>Object.entries(o.codeAttributes||{}).filter(([e,t])=>!!t).map(([e])=>e),[o]);a(()=>{if(!d.length&&!c){const e={[f.FilePath]:!0,[f.Function]:!0,[f.LineNumber]:!0,[f.Column]:null,[f.Namespace]:null,[f.StackTrace]:null};i("codeAttributes",e)}},[]);const u=(e,t)=>{const n=t?[...d,e]:d.filter(t=>t!==e),l=Object.values(f).reduce((e,t)=>(e[t]=!!n.includes(t)||null,e),{});i("codeAttributes",l)};return e(t,{children:[e(g,{$gap:12,children:[n(m,{size:b.XS,color:s.v2.colors.silver[200],nowrap:!0,children:"Recommended data to collect"}),n(g,{$gap:6,children:Ct.map(({id:e,label:t,tooltip:l})=>n(C,{text:l,withIcon:!0,children:n(w,{label:t,value:d.includes(e),onChange:t=>u(e,t)})},e))}),n(v,{errorMessage:c})]}),e(g,{$gap:12,children:[n(m,{size:b.XS,color:s.v2.colors.silver[200],nowrap:!0,children:"Verbose data to collect"}),n(g,{$gap:6,children:wt.map(({id:e,label:t,tooltip:l})=>n(C,{text:l,withIcon:!0,children:n(w,{label:t,value:d.includes(e),onChange:t=>u(e,t)})},e))}),n(v,{errorMessage:c})]})]})},[L.CustomInstrumentation]:({value:o,setValue:i,formErrors:r})=>{const s=r.customInstrumentations,c=l(()=>(o?.customInstrumentations?.[I.Golang]||[]).map(e=>new x(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)),[o]),d=l(()=>(o?.customInstrumentations?.[I.Java]||[]).map(e=>new S(e.className,e.methodName)),[o]);return a(()=>{o?.customInstrumentations||s||i("customInstrumentations",{[I.Golang]:kt[I.Golang],[I.Java]:kt[I.Java]})},[]),e(t,{children:[e(g,{children:[e(D,{$gap:8,children:[n(Fe,{}),n(T,{label:"Golang Custom Probes"})]}),n(A,{columns:[{keyName:"packageName",label:"Package name",placeholder:"e.g. github.com/my-org/my-package",tooltip:"The full import path of the package containing the function or method to be instrumented."},{keyName:"functionName",label:"Function name",placeholder:"e.g. myFunction",tooltip:"The name of the function to be instrumented. Leave empty if instrumenting a receiver method."},{keyName:"receiverName",label:"Receiver name",placeholder:"e.g. myReceiver",tooltip:"The name of the receiver type if instrumenting a method. Leave empty if instrumenting a standalone function."},{keyName:"receiverMethodName",label:"Receiver method name",placeholder:"e.g. myMethod",tooltip:"The name of the method to be instrumented. Leave empty if instrumenting a standalone function."}],values:c,setValues:e=>{const t={};t[I.Golang]=e.map(e=>new x(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)),t[I.Java]=d,i("customInstrumentations",t)},errorMessage:s,limitFieldsPerRow:2})]}),e(g,{children:[e(D,{$gap:8,children:[n(je,{}),n(T,{label:"Java Custom Probes"})]}),n(A,{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[I.Golang]=c,t[I.Java]=e.map(e=>new S(e.className,e.methodName)),i("customInstrumentations",t)},errorMessage:s,limitFieldsPerRow:2})]})]})},[L.HeadersCollection]:({value:e,setValue:t,formErrors:o})=>{const i=o.headersCollection,r=l(()=>e?.headersCollection?.[y.HeaderKeys]||[],[e]),s=e=>{const n={[y.HeaderKeys]:e};t("headersCollection",n)};return a(()=>{r.length||i||s(vt)},[]),n(k,{label:"Header Keys",tooltip:"Specify which headers you want to collect",helpMessage:"Asterisk (*) will collect all headers",values:r,setValues:s,errorMessage:i})},[L.PayloadCollection]:({value:t,setValue:o,formErrors:i})=>{const r=h(),s=i.payloadCollection,c=l(()=>Object.entries(t.payloadCollection||{}).filter(([e,t])=>!!t).map(([e])=>e),[t]);return a(()=>{if(!c.length&&!s){const e={[$.HttpRequest]:{},[$.HttpResponse]:{},[$.DbQuery]:{},[$.Messaging]:{}};o("payloadCollection",e)}},[]),e(g,{$gap:12,children:[n(m,{size:b.XS,color:r.v2.colors.silver[200],nowrap:!0,children:"Type of data to collect"}),n(g,{$gap:6,children:yt.map(({id:e,label:t,tooltip:l})=>n(C,{text:l,withIcon:!0,children:n(w,{label:t,value:c.includes(e),onChange:t=>((e,t)=>{const n=t?[...c,e]:c.filter(t=>t!==e),l={[$.HttpRequest]:n.includes($.HttpRequest)?{}:null,[$.HttpResponse]:n.includes($.HttpResponse)?{}:null,[$.DbQuery]:n.includes($.DbQuery)?{}:null,[$.Messaging]:n.includes($.Messaging)?{}:null};o("payloadCollection",l)})(e,t)})},e))}),n(v,{errorMessage:s})]})},[L.UnknownType]:null},xt=({ruleType:e,value:t,setValue:l,formErrors:a})=>{if(!e)return null;const o=$t[e];return o?n(o,{value:t,setValue:l,formErrors:a}):null},St=({option:t,formData:l,handleFormChange:a,formErrors:o})=>{const i=h();return e(g,{$gap:24,children:[e(D,{$gap:12,$alignItems:"flex-start",children:[n(m,{size:b.XXS,children:t.docsDescription}),n(P,{label:"Docs",leftIcon:He,variant:R.Secondary,size:M.S,onClick:()=>window.open(`${O}${t.docsEndpoint}`,"_blank","noopener noreferrer")})]}),e(D,{$gap:12,children:[n(m,{size:b.XS,color:i.v2.colors.silver[200],nowrap:!0,children:"Supported Languages:"}),t.supportedLanguages.map(e=>n(V,{label:z[e],leftIcon:E(e),status:N.Default,useSecondaryTone:!0},e))]}),n(F,{options:[{icon:We,label:"Enabled",value:!1,selectedBgColor:i.v2.colors.green[800]},{icon:Ge,label:"Disabled",value:!0,selectedBgColor:i.v2.colors.red[800]}],selected:l.disabled,setSelected:e=>a("disabled",e)}),n(j,{label:"Rule name",placeholder:"Use a name that describes the rule...",value:l.ruleName,onChange:({target:{value:e}})=>a("ruleName",e),errorMessage:o.ruleName}),n(xt,{ruleType:t.type,value:l,setValue:(e,t)=>a(e,t),formErrors:o}),n(H,{label:"Notes",placeholder:"Your personal notes...",value:l.notes,onChange:({target:{value:e}})=>a("notes",e),errorMessage:o.notes})]})},It=({isOpen:e,onClose:t,onDeny:l,onApprove:a})=>n(W,{title:"Discard changes?",description:"You have unsaved changes.\nIf you cancel now, your changes won't be saved.",isOpen:e,onClose:t,onDeny:l,denyLabel:"Keep editing",onApprove:a,approveLabel:"Discard changes"}),Dt=({isOpen:e,onClose:t,onDeny:l,onApprove:a,action:o="delete",target:i})=>{const r=o.charAt(0).toUpperCase()+o.substring(1),s=i?.endsWith("s")?"these":"this";return n(W,{title:`${r}${i?` ${i}`:""}?`,description:`Are you sure you want to ${o}${i?` ${s} ${i}`:""}?`,isOpen:e,onClose:t,onDeny:l,denyLabel:"Go back",onApprove:a,approveLabel:r})},Tt=({minSupportedVersion:e,currentVersion:t})=>n(W,{isOpen:!0,onClose:()=>{},relativeToParent:!0,visual:()=>n(G,{scale:2.4,icon:()=>n("svg",{xmlns:"http://www.w3.org/2000/svg",width:"22",height:"21",viewBox:"0 0 22 21",fill:"none",children:n("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: ${t}.`}),At=u.div`
2
+ display: flex;
3
+ flex-direction: column;
4
+ justify-content: flex-end;
2
5
  width: ${({$width:e})=>e};
3
6
  gap: 12px;
4
- justify-content: space-between;
5
- `,Ee=s.div`
7
+ ${({$withHeader:e})=>e&&p`
8
+ > :first-child {
9
+ min-height: 24px;
10
+ }
11
+ `}
12
+ `,Lt=u.div`
6
13
  display: flex;
7
14
  flex-direction: column;
15
+ gap: ${({$gap:e})=>e}px;
8
16
  padding: 12px;
9
- gap: ${({$gap:e=0})=>e}px;
10
17
  width: calc(100% - 24px);
11
- height: calc(100vh - 300px);
18
+ height: ${({$withHeaderAndParentSubHeader:e})=>`calc(100vh - 300px${e?" - 36px":""})`};
12
19
  border-radius: ${({$borderRadius:e})=>e};
13
20
  background-color: ${({theme:e})=>e.v2.colors.silver[900]};
14
21
  overflow-y: auto;
15
22
  overflow-x: hidden;
16
- `,Ge=s.div`
17
- display: flex;
18
- align-items: center;
19
- justify-content: space-between;
20
- gap: 12px;
21
- padding: 8px 16px;
22
- border-radius: 12px;
23
- background-color: ${({$isSelected:e,theme:t})=>e?t.v2.colors.silver[600]:"transparent"};
24
- cursor: pointer;
25
- &:hover {
26
- background-color: ${({theme:e})=>e.v2.colors.silver[600]};
27
- }
28
- `,Ue=({formData:l,handleSourceChange:n,handleSelectAll:i,selectedArea:o,searchText:s,filters:c})=>{const y=r(),{activeNamespace:k,isAll:C,isSome:v}=a(()=>{const e=o.value.clusterId&&o.value.namespaceName?l.find(({clusterId:e})=>e===o.value.clusterId)?.namespaces.find(({name:e})=>e===o.value.namespaceName):void 0;if(!e)return{activeNamespace:void 0,isAll:!1,isSome:!1};const t=e.workloads.filter(({selected:e})=>e).length;return{activeNamespace:e,isAll:t>0&&t===e.workloads.length,isSome:t>0&&t<e.workloads.length}},[l,o.value.clusterId,o.value.namespaceName]),x=a(()=>{if(!k)return[];const{clusterId:l}=o.value,{name:a,workloads:i}=k;return i.map(({name:i,selected:o,kind:r})=>{if(s&&!i.toLowerCase().includes(s.toLowerCase()))return null;const b=o||!1;if(c.showOnlySelected&&!b)return null;const f=()=>n({clusterId:l,workloadId:{namespace:a,name:i,kind:r}});return e(Ge,{onClick:f,children:[e(d,{$gap:12,children:[t(u,{value:b,onChange:f}),t(p,{size:h.XS,children:i})]}),t(g,{label:r,status:m.Info,textSize:h.XXXS,backgroundColor:y.v2.colors.blue[900]})]},`${l}#${a}#${i}#${r}`)})},[l,o.value.clusterId,k,s,c]);return e(je,{$width:"50%",children:[e(d,{$padding:"0 12px 0 28px",$gap:12,children:[t(b,{text:(C?"Unselect":"Select")+" all workloads in the selected namespace",children:t(u,{partiallyChecked:v,value:C,onChange:()=>i({clusterId:o.value.clusterId,namespaceName:o.value.namespaceName,boolean:!C}),disabled:!x.length})}),e(d,{$gap:8,children:[t(p,{size:h.XS,nowrap:!0,children:o.value.clusterId?`${o.value.clusterName} > ${o.value.namespaceName} > Workloads`:"Workloads"}),t(g,{label:x.length,status:f.Unknown})]})]}),t(Ee,{$borderRadius:"0 16px 16px 0",children:x.length?x:t(w,{title:"Workloads not found",subTitle:"Please select a namespace to view workloads"})})]})},He=({formData:l,handleSourceChange:n,handleSelectAll:i,selectedArea:o,searchText:s,filters:c})=>{const v=r(),{isAll:x,isSome:$}=a(()=>{const e=l.length>0&&l.every(({namespaces:e})=>e.every(({workloads:e})=>e.every(({selected:e})=>e)));return{isAll:e,isSome:!e&&l.length>0&&l.some(({namespaces:e})=>e.some(({workloads:e})=>e.some(({selected:e})=>e)))}},[l]),S=a(()=>l.flatMap(({clusterId:l,clusterName:a,namespaces:i})=>i.map(({name:i,workloads:r,selected:w})=>{if(s&&!i.toLowerCase().includes(s.toLowerCase()))return null;const x=r.filter(({selected:e})=>e).length,$=x>0&&x===r.length,S=x>0&&x<r.length,I=w||!1;if(c.showOnlySelected&&!$&&!S&&!I)return null;const T=o.value.clusterId===l&&o.value.namespaceName===i,D=()=>o.setValue({clusterId:l,clusterName:a,namespaceName:i}),A=e=>{D(),n({clusterId:l,workloadId:{namespace:i},auto:e.auto,selected:e.all})};return e(Ge,{$isSelected:T,onClick:D,children:[e(d,{$gap:12,children:[t(u,{partiallyChecked:S,value:$,onChange:e=>A({auto:e,all:e})}),t(p,{size:h.XS,children:`${a} > ${i}`})]}),e(d,{$gap:12,children:[t(b,{text:"Automatically instrument all workloads currently in the namespace, and all workloads that will be deployed to this namespace in the future",children:t(y,{label:"Auto",size:k.S,value:I,onChange:e=>A({auto:e,all:e||void 0})})}),e(d,{$gap:8,children:[t(p,{variant:C.Span,size:h.XXXS,color:v.v2.colors.silver[200],align:"right",children:"Selected"}),t(g,{label:`${x}/${r.length}`,status:T?m.Default:f.Unknown,minWidth:"42px"})]})]})]},`${l}#${i}`)})),[l,o.value.clusterId,o.value.namespaceName,s,c]);return e(je,{$width:"50%",children:[e(d,{$padding:"0 12px 0 28px",$gap:12,children:[t(b,{text:(x?"Unselect":"Select")+" all workloads in all namespaces",children:t(u,{partiallyChecked:$,value:x,onChange:()=>i({boolean:!x}),disabled:!S.length})}),e(d,{$gap:8,children:[t(p,{size:h.XS,nowrap:!0,children:"Namespaces"}),t(g,{label:S.length,status:f.Unknown})]})]}),t(Ee,{$borderRadius:"16px 0 0 16px",children:S.length?S:t(w,{title:"Namespaces not found",subTitle:""})})]})},Ye="75vw",qe=s.div`
23
+ `,Pt=({isLeft:t,isRight:l,parentHasSubHeader:a,width:i,header:r,list:s,listGap:c=0})=>e(At,{$width:i,$withHeader:!!r,children:[r,n(Lt,{$gap:c,$borderRadius:t?"16px 0 0 16px":l?"0 16px 16px 0":"16px",$withHeaderAndParentSubHeader:!!r&&!!a,children:s.length?o.toArray(s):n(q,{title:"Data not found",subTitle:""})})]}),Mt="75vw",Rt=u.div`
29
24
  display: flex;
30
25
  flex-direction: column;
31
26
  border-radius: 16px;
32
27
  background-color: ${({theme:e})=>e.v2.colors.silver[1e3]};
33
28
  overflow: hidden;
34
- `,Be=s.div`
29
+ `,Ot=u.div`
35
30
  display: flex;
36
31
  gap: 12px;
37
32
  padding: 16px;
33
+ margin-bottom: 12px;
38
34
  background-color: ${({theme:e})=>e.v2.colors.silver[1e3]};
39
35
  position: sticky;
40
36
  top: 0;
41
- `,Xe=s.div`
37
+ `,Vt=u.div`
38
+ padding: 0 12px;
39
+ `,Nt=u.div`
42
40
  display: flex;
43
41
  gap: 12px;
44
42
  padding: 16px;
45
- `,Ke=s.div`
43
+ `,zt=u.div`
46
44
  padding: 5vh 10vw;
47
45
  border-radius: 12px;
48
46
  background-color: ${({theme:e})=>e.v2.colors.silver[800]};
49
- `,Je=s.div`
47
+ `,Et=u.div`
50
48
  display: flex;
51
49
  align-items: center;
52
50
  justify-content: flex-end;
53
51
  gap: 16px;
54
52
  padding: 0 12px;
55
- `,Qe=({onClose:l,snapshots:s,selectedConnectionIds:c,setSelectedConnectionIds:u,persistSources:g})=>{const b=r(),{selectedStreamName:f}=v(),{progress:w,resetProgress:C}=x(),L=a(()=>f||$,[f]),[W,F]=n(""),[j,E]=n(S.Namespace),[G,U]=n({showOnlySelected:!1}),[H,Y]=n(!1),[q,B]=n(!1),[X,K]=n(void 0),[J,Q]=n({clusterId:"",clusterName:"",namespaceName:""}),[Z,_]=n([]);i(()=>{_(e=>{const t=((e,t)=>I(((e,t)=>e.clusters.filter(({clusterId:e})=>t.includes(e)))(e,t)))(s,c);return t.map(t=>{const l=e?.find(e=>e.clusterId===t.clusterId);return l??t})})},[s,c]);const{formDiff:ee,isFormDirty:te}=a(()=>{const e=((e,t,l)=>{const a={};return e.forEach(e=>{e.namespaces.forEach(n=>{const i=t.find(t=>t.clusterId===e.clusterId)?.namespaces.find(e=>e.name===n.name),o=n.selected||!1,s=o!==i?.selected;if(s&&(a[e.clusterId]||(a[e.clusterId]=[]),a[e.clusterId].push({namespace:n.name,selected:o,currentStreamName:l}),o&&(a[e.clusterId]=a[e.clusterId].filter(e=>e.namespace!==n.name||e.namespace===n.name&&(!e.name||!e.kind)))),!s||!o){const t=((e,t,l)=>{const a=[];return t.workloads.forEach(n=>{const i=e?.workloads.find(e=>e.name===n.name&&e.kind===n.kind);n.selected!==i?.selected&&a.push({namespace:t.name,name:n.name,kind:n.kind,selected:n.selected||!1,currentStreamName:l})}),a})(i,n,l);t.length>0&&(a[e.clusterId]||(a[e.clusterId]=[]),a[e.clusterId].push(...t))}})}),a})(Z,s.clusters,L);return{formDiff:e,isFormDirty:Object.keys(e).length>0}},[Z,s,L]),le=o(({clusterId:e,workloadId:t,selected:l,auto:a})=>{_(n=>{const i=I(n),o=i.findIndex(t=>t.clusterId===e);if(-1===o)return i;const s=i[o].namespaces.findIndex(e=>e.name===t.namespace);if(-1===s)return i;if(t.kind&&t.name){const e=i[o].namespaces[s].workloads.findIndex(e=>e.name===t.name&&e.kind===t.kind);if(-1===e)return i;const a="boolean"==typeof l?l:!i[o].namespaces[s].workloads[e].selected;i[o].namespaces[s].workloads[e].selected=a,a?i[o].namespaces[s].workloads.every(e=>e.selected)&&(i[o].namespaces[s].selected=!0):i[o].namespaces[s].selected=!1}else{const e="boolean"==typeof a?a:!i[o].namespaces[s].selected;i[o].namespaces[s].selected=e,e?i[o].namespaces[s].workloads.forEach(e=>{e.selected=!0}):"boolean"!=typeof l||l||i[o].namespaces[s].workloads.forEach(e=>{e.selected=!1})}return i})},[]),ae=o(({clusterId:e,namespaceName:t,boolean:l})=>{_(a=>{const n=I(a);return n.forEach((a,i)=>{e&&a.clusterId!==e||a.namespaces.forEach(({name:e,workloads:a},o)=>{t&&e!==t||(n[i].namespaces[o].selected=l,a.forEach((e,t)=>{n[i].namespaces[o].workloads[t].selected=l}))})}),n})},[]),ne=()=>{Y(!1),l()};return e(T,{isOpen:!0,hideOverlay:!q,width:Ye,header:{icon:fe,title:"Manage Sources",onClose:l,onCloseDisabled:q},children:[q?t(D,{$height:"calc(100vh - 136px)",children:t(Ke,{children:t(A,{title:"Creating Sources...",titleSize:h.S,subTitle:"This may take a few moments while sources are being created.",subTitleSize:h.XXXS,withGradient:!0,withSpinner:!0,percentage:w[P.BulkInstrumenting]?.percentage||0})})}):e(qe,{children:[e(Be,{children:[t(z,{icon:we,title:"Selected Clusters",badge:{label:c.length}}),t(R,{width:"300px",value:W,onChange:F,segment:{options:[{label:"Namespace",value:S.Namespace},{label:"Source",value:S.Source}],selected:j,setSelected:E}}),e(d,{$gap:8,children:[t(p,{size:h.XXXS,color:b.v2.colors.silver[200],nowrap:!0,children:"Show only:"}),t(y,{size:k.S,label:"Selected",value:G.showOnlySelected,onChange:e=>U(t=>({...t,showOnlySelected:e}))})]})]}),e(Xe,{children:[t(He,{formData:Z,handleSourceChange:le,handleSelectAll:ae,selectedArea:{value:J,setValue:Q},searchText:j===S.Namespace?W:"",filters:G}),t(Ue,{formData:Z,handleSourceChange:le,handleSelectAll:ae,selectedArea:{value:J,setValue:Q},searchText:j===S.Source?W:"",filters:G})]})]}),e(Je,{children:[q?null:X?t(N,{fullWidth:!0,status:m.Error,message:X}):te?t(N,{fullWidth:!0,status:m.Info,message:'The values don\'t reflect the current configuration of the selected clusters.\n"Apply" will override the current configurations.'}):te?null:t(N,{fullWidth:!0,status:m.Success,message:"The values reflect the current configuration of the selected cluster."}),e(d,{$gap:8,children:[t("div",{style:{width:"150px"},children:t(O,{fullWidth:!0,variant:V.Secondary,label:"Cancel",onClick:()=>te?Y(!0):ne(),disabled:!te||q})}),t("div",{style:{width:"150px"},children:t(O,{fullWidth:!0,variant:V.Primary,label:"Save",onClick:async()=>{B(!0);const e=await g(ee);C(P.BulkInstrumenting),B(!1),e?.error?K(e.error):(u([]),l())},disabled:!te||q})})]})]}),t(M,{isOpen:H,onClose:()=>Y(!1),onApprove:ne})]})},Ze="75vw",_e=1.16,et=s.div`
56
- display: flex;
57
- flex-direction: column;
58
- border-radius: 16px;
59
- background-color: ${({theme:e})=>e.v2.colors.silver[1e3]};
60
- overflow: hidden;
61
- `,tt=s.div`
62
- display: flex;
63
- gap: 12px;
64
- padding: 16px;
65
- background-color: ${({theme:e})=>e.v2.colors.silver[1e3]};
66
- position: sticky;
67
- top: 0;
68
- `,lt=s.div`
69
- display: flex;
70
- gap: 12px;
71
- padding: 16px;
72
- `,at=s(c)`
73
- width: ${({$width:e})=>e};
74
- gap: 12px;
75
- justify-content: space-between;
76
- `,nt=s.div`
77
- display: flex;
78
- flex-direction: column;
79
- padding: 12px;
80
- gap: ${({$gap:e=0})=>e}px;
81
- width: calc(100% - 24px);
82
- height: calc(100vh - 280px);
83
- border-radius: ${({$borderRadius:e})=>e};
84
- background-color: ${({theme:e})=>e.v2.colors.silver[900]};
85
- overflow-y: auto;
86
- overflow-x: hidden;
87
- `,it=s.div`
53
+ `,Ft=i(({isOpen:t,onClose:l,onSave:a,disableSave:o,connectionIds:i,header:c,subHeader:d,leftColumn:u,rightColumn:h,search:p,filters:g,isFormDirty:m,isFetching:f,progress:C},w)=>{const[v,y]=r(!1),[k,$]=r(!1),[x,S]=r(void 0);s(w,()=>({clearErrors:()=>S(void 0)}));const I=k,T=()=>{m?y(!0):(y(!1),l())},A=o||k||"boolean"==typeof m&&!m;return e(U,{width:Mt,isOpen:t,hideOverlay:!k,header:{icon:c.icon,title:c.title,onClose:l,onCloseDisabled:k},children:[k?n(Y,{$height:"calc(100vh - 136px)",children:n(zt,{children:n(B,{titleSize:b.S,subTitleSize:b.XXXS,withGradient:!0,withSpinner:!0,...C})})}):e(Rt,{children:[e(Ot,{children:[n(K,{icon:We,title:"Selected Clusters",badge:{label:i.value.length}}),n(X,{width:"300px",...p}),g]}),d&&n(Vt,{children:n(K,{icon:d.icon,title:d.title,subTitle:d.description,badge:d.badge})}),e(Nt,{children:[n(Pt,{isLeft:!0,parentHasSubHeader:!!d,...u}),n(Pt,{isRight:!0,parentHasSubHeader:!!d,...h})]})]}),e(Et,{children:[f?n(B,{icon:qe,title:"Fetching Data...",titleSize:b.XXS,withGradient:!0}):k?C?null:n(B,{icon:qe,title:"Saving Changes...",titleSize:b.XXS,withGradient:!0}):x?n(Z,{fullWidth:!0,status:N.Error,message:x}):"boolean"==typeof m&&m?n(Z,{fullWidth:!0,status:N.Info,message:'The values don\'t reflect the current configurations of the selected clusters.\n"Save" will override the current configurations.'}):"boolean"!=typeof m||m?null:n(Z,{fullWidth:!0,status:N.Success,message:"The values reflect the current configuration of the selected cluster."}),e(D,{$gap:8,children:[n("div",{style:{width:"150px"},children:n(P,{fullWidth:!0,variant:R.Secondary,label:"Cancel",onClick:T,disabled:I})}),n("div",{style:{width:"150px"},children:n(P,{fullWidth:!0,variant:R.Primary,label:"Save",onClick:async()=>{$(!0);const e=await a();$(!1),e?.error?S(e.error):(i.setValue([]),l())},disabled:A})})]})]}),n(It,{isOpen:v,onClose:()=>y(!1),onApprove:T})]})});Ft.displayName=Ft.name;const jt={disabled:!1,ruleName:"",notes:""},Ht=u.div`
88
54
  display: flex;
89
55
  align-items: center;
56
+ justify-content: space-between;
90
57
  gap: 12px;
91
- padding: 8px 16px;
58
+ padding: 12px 16px;
92
59
  border-radius: 12px;
93
- background-color: transparent;
60
+ background-color: ${({$isSelected:e,theme:t})=>e?t.v2.colors.silver[600]:"transparent"};
94
61
  cursor: pointer;
95
62
  &:hover {
96
63
  background-color: ${({theme:e})=>e.v2.colors.silver[600]};
97
64
  }
98
- `,ot=s.div`
65
+ `,Wt=({title:t,description:l,withCarret:a,children:o,isSelected:i,onClick:r,isChecked:s,isPartiallyChecked:c,onCheckboxChange:d})=>{const u=h();return e(Ht,{$isSelected:i,onClick:()=>!i&&r(),children:[e(g,{$gap:4,children:[e(D,{$gap:12,children:[d&&n(w,{partiallyChecked:c||!1,value:s||!1,onChange:e=>d(e)}),n(m,{size:b.XS,children:t})]}),l&&n(m,{size:b.XXXS,color:u.v2.colors.silver[200],children:l})]}),o,a&&n("div",{children:n(Ue,{size:18})})]})},Gt=({onClose:e,selectedConnectionIds:t,setSelectedConnectionIds:a,createInstrumentationRule:o})=>{const[i,s]=r(""),[d,u]=r(null),h=l(()=>i?Q.filter(e=>e.label.toLowerCase().includes(i.toLowerCase())):Q,[i]),p=_(jt),g=c(null);return n(Ft,{ref:g,isOpen:!0,onClose:e,onSave:async()=>{const{isOk:e,preparedFormData:t}=((e,t)=>{if(!e)return{isOk:!1,preparedFormData:J(jt)};const n=(e=>{const t=J(e);return t.headersCollection?.[y.HeaderKeys]?.length&&(t.headersCollection[y.HeaderKeys]=t.headersCollection[y.HeaderKeys].map(e=>e.trim()).filter(e=>e)),t.customInstrumentations?.[I.Golang]?.length&&(t.customInstrumentations[I.Golang]=t.customInstrumentations[I.Golang].map(e=>new x(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)).filter(e=>e.Verify())),t.customInstrumentations?.[I.Java]?.length&&(t.customInstrumentations[I.Java]=t.customInstrumentations[I.Java].map(e=>new S(e.className,e.methodName)).filter(e=>e.Verify())),t})(t.formData),l={};switch(e.type){case L.CodeAttributes:Object.values(n.codeAttributes||{}).some(e=>null!=e)||(l.codeAttributes="Code attributes are required");break;case L.PayloadCollection:Object.values(n.payloadCollection||{}).some(e=>null!=e)||(l.payloadCollection="Payload collection are required");break;case L.HeadersCollection:n.headersCollection?.[y.HeaderKeys]?.length||(l.headersCollection="Header keys are required");break;case L.CustomInstrumentation:n.customInstrumentations?.[I.Golang]?.length||n.customInstrumentations?.[I.Java]?.length||(l.customInstrumentations="Custom instrumentation are required")}return t.handleErrorChange(void 0,void 0,l),{isOk:0===Object.keys(l).length,preparedFormData:n}})(d,p);return e?await o(t):Promise.resolve({error:"Invalid form values"})},disableSave:!d,progress:{title:"Creating instrumentation rule",subTitle:"Please wait while we create the instrumentation rule"},header:{icon:Ye,title:ee.ADD_INSTRUMENTATION_RULE},subHeader:{icon:Ye,title:ee.INSTRUMENTATION_RULES,description:"Define how telemetry is recorded from your application. Choose a rule type and configure the details.",badge:{label:h.length.toString()}},connectionIds:{value:t,setValue:a},search:{value:i,onChange:s},leftColumn:{width:"40%",list:h.map(e=>{const t=d?.type===e.type;return n(Wt,{title:e.label,description:e.description,withCarret:!0,isSelected:t,onClick:()=>{p.resetFormData(),g.current?.clearErrors(),u(e)}},e.type)})},rightColumn:{width:"60%",list:d?[n(St,{option:d,...p},d?.type)]:[n(q,{title:"Instrumentation rule not selected",subTitle:"Please select an instrumentation rule to add"},"no-data")]}})},qt=({formData:t,handleSourceChange:a,handleSelectAll:o,selectedArea:i,searchText:r,filters:s})=>{const c=h(),{activeNamespace:d,isAll:u,isSome:p}=l(()=>{const e=i.value.clusterId&&i.value.namespaceName?t.find(({clusterId:e})=>e===i.value.clusterId)?.namespaces.find(({name:e})=>e===i.value.namespaceName):void 0;if(!e)return{activeNamespace:void 0,isAll:!1,isSome:!1};const n=e.workloads.filter(({selected:e})=>e).length;return{activeNamespace:e,isAll:n>0&&n===e.workloads.length,isSome:n>0&&n<e.workloads.length}},[t,i.value.clusterId,i.value.namespaceName]),g=l(()=>{if(!d)return[];const{clusterId:e}=i.value,{name:t,workloads:l}=d;return l.map(({name:l,selected:o,kind:i})=>{if(r&&!l.toLowerCase().includes(r.toLowerCase()))return null;const d=o||!1;if(s.showOnlySelected&&!d)return null;const u=()=>a({clusterId:e,workloadId:{namespace:t,name:l,kind:i}});return n(Wt,{title:l,onClick:u,isChecked:d,onCheckboxChange:u,children:n(V,{label:i,status:N.Info,textSize:b.XXXS,backgroundColor:c.v2.colors.blue[900]})},`${e}#${t}#${l}#${i}`)})},[t,i.value.clusterId,d,r,s]);return{width:"50%",header:e(D,{$gap:12,$padding:"0 0 0 28px",children:[n(C,{text:(u?"Unselect":"Select")+" all workloads in the selected namespace",children:n(w,{partiallyChecked:p,value:u,onChange:()=>o({clusterId:i.value.clusterId,namespaceName:i.value.namespaceName,boolean:!u}),disabled:!g.length})}),e(D,{$gap:8,children:[n(m,{size:b.XS,nowrap:!0,children:i.value.clusterId?`${i.value.clusterName} > ${i.value.namespaceName} > Workloads`:"Workloads"}),n(V,{label:g.length,status:te.Unknown})]})]}),list:g}},Ut=({formData:t,handleSourceChange:a,handleSelectAll:o,selectedArea:i,searchText:r,filters:s})=>{const c=h(),{isAll:d,isSome:u}=l(()=>{const e=t.length>0&&t.every(({namespaces:e})=>e.every(({workloads:e})=>e.every(({selected:e})=>e)));return{isAll:e,isSome:!e&&t.length>0&&t.some(({namespaces:e})=>e.some(({workloads:e})=>e.some(({selected:e})=>e)))}},[t]),p=l(()=>t.flatMap(({clusterId:t,clusterName:l,namespaces:o})=>o.map(({name:o,workloads:d,selected:u})=>{if(r&&!o.toLowerCase().includes(r.toLowerCase()))return null;const h=d.filter(({selected:e})=>e).length,p=h>0&&h===d.length,g=h>0&&h<d.length,f=u||!1;if(s.showOnlySelected&&!p&&!g&&!f)return null;const w=i.value.clusterId===t&&i.value.namespaceName===o,v=()=>i.setValue({clusterId:t,clusterName:l,namespaceName:o}),y=e=>{v(),a({clusterId:t,workloadId:{namespace:o},auto:e.auto,selected:e.all})};return n(Wt,{title:`${l} > ${o}`,isSelected:w,onClick:v,isPartiallyChecked:g,isChecked:p,onCheckboxChange:e=>y({auto:e,all:e}),children:e(D,{$gap:12,children:[n(C,{text:"Automatically instrument all workloads currently in the namespace, and all workloads that will be deployed to this namespace in the future",children:n(ne,{label:"Auto",size:le.S,value:f,onChange:e=>y({auto:e,all:e||void 0})})}),e(D,{$gap:8,children:[n(m,{variant:ae.Span,size:b.XXXS,color:c.v2.colors.silver[200],align:"right",children:"Selected"}),n(V,{label:`${h}/${d.length}`,status:w?N.Default:te.Unknown,minWidth:"42px"})]})]})},`${t}#${o}`)})),[t,i.value.clusterId,i.value.namespaceName,r,s]);return{width:"50%",header:e(D,{$gap:12,$padding:"0 0 0 28px",children:[n(C,{text:(d?"Unselect":"Select")+" all workloads in all namespaces",children:n(w,{partiallyChecked:u,value:d,onChange:()=>o({boolean:!d}),disabled:!p.length})}),e(D,{$gap:8,children:[n(m,{size:b.XS,nowrap:!0,children:"Namespaces"}),n(V,{label:p.length,status:te.Unknown})]})]}),list:p}},Yt=({onClose:t,selectedConnectionIds:o,setSelectedConnectionIds:i,snapshots:s,persistSources:c})=>{const u=h(),{selectedStreamName:p}=oe(),{progress:g,resetProgress:f}=ie(),C=l(()=>p||re,[p]),[w,v]=r(""),[y,k]=r(se.Namespace),[$,x]=r({showOnlySelected:!1}),[S,I]=r({clusterId:"",clusterName:"",namespaceName:""}),[T,A]=r([]);a(()=>{A(e=>{const t=((e,t)=>J(((e,t)=>e.clusters.filter(({clusterId:e})=>t.includes(e)))(e,t)))(s,o);return t.map(t=>{const n=e?.find(e=>e.clusterId===t.clusterId);return n??t})})},[s,o]);const{formDiff:L,isFormDirty:P}=l(()=>{const e=((e,t,n)=>{const l={};return e.forEach(e=>{e.namespaces.forEach(a=>{const o=t.find(t=>t.clusterId===e.clusterId)?.namespaces.find(e=>e.name===a.name),i=a.selected||!1,r=i!==o?.selected;if(r&&(l[e.clusterId]||(l[e.clusterId]=[]),l[e.clusterId].push({namespace:a.name,selected:i,currentStreamName:n}),i&&(l[e.clusterId]=l[e.clusterId].filter(e=>e.namespace!==a.name||e.namespace===a.name&&(!e.name||!e.kind)))),!r||!i){const t=((e,t,n)=>{const l=[];return t.workloads.forEach(a=>{const o=e?.workloads.find(e=>e.name===a.name&&e.kind===a.kind);a.selected!==o?.selected&&l.push({namespace:t.name,name:a.name,kind:a.kind,selected:a.selected||!1,currentStreamName:n})}),l})(o,a,n);t.length>0&&(l[e.clusterId]||(l[e.clusterId]=[]),l[e.clusterId].push(...t))}})}),l})(T,s.clusters,C);return{formDiff:e,isFormDirty:Object.keys(e).length>0}},[T,s,C]),M=d(({clusterId:e,workloadId:t,selected:n,auto:l})=>{A(a=>{const o=J(a),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 l="boolean"==typeof n?n:!o[i].namespaces[r].workloads[e].selected;o[i].namespaces[r].workloads[e].selected=l,l?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 l?l:!o[i].namespaces[r].selected;o[i].namespaces[r].selected=e,e?o[i].namespaces[r].workloads.forEach(e=>{e.selected=!0}):"boolean"!=typeof n||n||o[i].namespaces[r].workloads.forEach(e=>{e.selected=!1})}return o})},[]),R=d(({clusterId:e,namespaceName:t,boolean:n})=>{A(l=>{const a=J(l);return a.forEach((l,o)=>{e&&l.clusterId!==e||l.namespaces.forEach(({name:e,workloads:l},i)=>{t&&e!==t||(a[o].namespaces[i].selected=n,l.forEach((e,t)=>{a[o].namespaces[i].workloads[t].selected=n}))})}),a})},[]);return n(Ft,{isOpen:!0,onClose:()=>{f(ce.BulkInstrumenting),t()},onSave:()=>c(L),header:{icon:Be,title:"Manage Sources"},connectionIds:{value:o,setValue:i},search:{width:"400px",value:w,onChange:v,segment:{options:[{label:"Namespace",value:se.Namespace},{label:"Source",value:se.Source}],selected:y,setSelected:k}},filters:e(D,{$gap:8,children:[n(m,{size:b.XXXS,color:u.v2.colors.silver[200],nowrap:!0,children:"Show only:"}),n(ne,{size:le.S,label:"Selected",value:$.showOnlySelected,onChange:e=>x(t=>({...t,showOnlySelected:e}))})]}),isFormDirty:P,progress:{title:"Creating Sources...",subTitle:"This may take a few moments while sources are being created.",percentage:g[ce.BulkInstrumenting]?.percentage||0},leftColumn:Ut({formData:T,handleSourceChange:M,handleSelectAll:R,selectedArea:{value:S,setValue:I},searchText:y===se.Namespace?w:"",filters:$}),rightColumn:qt({formData:T,handleSourceChange:M,handleSelectAll:R,selectedArea:{value:S},searchText:y===se.Source?w:"",filters:$})})},Bt=({onClose:t,connections:o,selectedConnectionIds:i,setSelectedConnectionIds:s,getEffectiveConfig:c,onApply:d})=>{const u=h(),[p,g]=r(""),[f,C]=r({showOnlySelected:!1}),w=l(()=>o.filter(e=>{const t=!p||e.name.toLowerCase().includes(p.toLowerCase()),n=!f.showOnlySelected||f.showOnlySelected&&i.includes(e.id);return t&&n}),[o.length,i.length,p,f]),v=e=>{s(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[y,k]=r(!1),[$,x]=r(void 0),{formData:S,handleFormChange:I,areFormValuesEqual:T,resetFormData:A}=_($||{rollout:{automaticRolloutDisabled:!1}}),L=l(()=>i.length>1||void 0!==$&&!T($,S),[i.length,$,S]);return a(()=>{1===i.length?(async e=>{if(y)return;k(!0);const t=await c(e);if(t){const e={rollout:{automaticRolloutDisabled:t.rollout?.automaticRolloutDisabled||!1}};x(e),A(e)}k(!1)})(i[0]):x(void 0)},[i.length]),n(Ft,{isOpen:!0,onClose:t,onSave:()=>d(S,i),header:{icon:Ke,title:"Cluster Configuration"},connectionIds:{value:i,setValue:s},search:{placeholder:"Search by cluster name",value:p,onChange:g},filters:e(D,{$gap:8,children:[n(m,{size:b.XXXS,color:u.v2.colors.silver[200],nowrap:!0,children:"Show only:"}),n(ne,{size:le.S,label:"Selected",value:f.showOnlySelected,onChange:e=>C(t=>({...t,showOnlySelected:e}))})]}),isFormDirty:L,isFetching:y,leftColumn:{width:"35%",header:e(D,{$gap:12,$padding:"0 12px",$justifyContent:"space-between",children:[e(D,{$gap:8,children:[n(m,{size:b.XS,children:"Clusters"}),n(V,{label:w.length,status:te.Unknown})]}),e(D,{$gap:8,children:[n(m,{size:b.XXXS,color:u.v2.colors.silver[200],align:"right",children:"Selected clusters"}),n(V,{label:`${i.length}/${w.length}`,status:te.Unknown})]})]}),list:w.map(e=>n(Wt,{title:e.name,isChecked:i.includes(e.id),onClick:()=>v(e.id),onCheckboxChange:()=>v(e.id)},e.id))},rightColumn:{width:"65%",header:n(D,{$gap:12,$padding:"0 12px",children:n(m,{size:b.XS,children:"Configurations"})}),list:[n(ne,{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=>I("rollout.automaticRolloutDisabled",e)},"automatic-rollout-disabled")]}})},Kt=({token:l,isLoading:a,isEditing:o,onEdit:i,onCancel:r,onSave:s,formData:c,handleFormChange:d,handleErrorChange:u,formErrors:h})=>{const{CopyButton:p}=de(),g=!o||a||!c.newToken;return ue({key:"Enter",active:!g},s),e(D,o?{$justifyContent:"space-between",$alignItems:"flex-start",$gap:12,children:[n(j,{type:"password",value:c.newToken,onChange:e=>{d("newToken",e.target.value),u("newToken",void 0)},width:"430px",autoFocus:!0,errorMessage:h.newToken}),n(D,{$margin:a?"8px 0 0 0":"2px 0 0 0",$alignItems:"center",children:a?n(B,{title:"Saving...",withGradient:!0}):e(t,{children:[n(P,{variant:R.Secondary,size:M.S,leftIcon:Xe,onClick:r,disabled:a}),n(P,{variant:R.Primary,size:M.S,leftIcon:Ze,onClick:s,disabled:g})]})})]}:{$justifyContent:"space-between",$gap:12,children:[n(m,{size:b.XS,children:new Array(55).fill("•").join("")}),e(D,{$alignItems:"center",$justifyContent:"space-between",children:[n(p,{value:l}),n(he,{icon:Je,onClick:i})]})]})},Xt=({expiresAt:e,callbackValid:t,callbackExpired:o})=>{const{formatTimeAgo:i}=pe(),r=l(()=>i(e),[e]),s=l(()=>new Date(e).toDateString().split(" ").slice(1).join(" "),[e]),c=l(()=>ge(e,0)?N.Error:ge(e,2592e6)?N.Warning:N.Success,[e]),d=l(()=>c===N.Success?Ze:c===N.Warning?Qe:_e,[c]);return a(()=>{c===N.Success?t():c===N.Error&&o()},[c]),n(C,{text:s,children:n(V,{leftIcon:d,label:r,status:c,invertColors:!0,useSecondaryTone:!0})})},Zt=u.div`
66
+ display: flex;
67
+ flex-direction: column;
68
+ gap: 12px;
69
+ padding: 16px;
70
+ border-radius: 12px;
71
+ border: 1px solid ${({theme:e,$isExpired:t})=>t?e.v2.colors.red[500]:e.v2.colors.silver[600]};
72
+ background-color: ${({theme:e,$isExpired:t})=>t?e.v2.colors.red[1e3]:e.v2.colors.silver[800]};
73
+ `,Jt=({children:e})=>{const t=h();return n(m,{size:b.XXXS,color:t.v2.colors.grey[150],children:e})},Qt=({token:t,updateToken:l})=>{const[a,o]=r(!1),[i,s]=r(!1),[c,d]=r(!1),{formData:u,handleFormChange:h,formErrors:p,handleErrorChange:f,resetFormData:C}=_({newToken:""});return n(me,{richTitle:{icon:et,title:"Odigos Pro Token"},children:e(Zt,{$isExpired:c,children:[e(D,{$justifyContent:"space-between",children:[e(g,{$gap:4,children:[n(Jt,{children:"Issued for"}),n(m,{size:b.XS,children:t.name||"N/A"})]}),e(g,{$gap:4,children:[n(Jt,{children:"Expiration"}),n(Xt,{expiresAt:t.expiresAt,callbackValid:()=>d(!1),callbackExpired:()=>d(!0)})]}),n(g,{})]}),n(D,{children:e(g,{children:[n(Jt,{children:"Token"}),n(Kt,{token:t.token,newToken:u.newToken,isLoading:i,isEditing:a,onEdit:()=>o(!0),onCancel:()=>(o(!1),s(!1),void h("newToken","")),onSave:()=>(async()=>{s(!0);const e=await l(u.newToken.trim());s(!1),e?.error?f("newToken",e.error):(o(!1),C())})(),formData:u,handleFormChange:h,handleErrorChange:f,formErrors:p})]})})]})})},_t=u.div`
99
74
  display: flex;
100
75
  align-items: center;
101
- justify-content: flex-end;
102
- gap: 16px;
103
- padding: 0 12px;
104
- `,st=({onClose:l,connections:o,selectedConnectionIds:s,setSelectedConnectionIds:c,getEffectiveConfig:b,onApply:C})=>{const v=r(),[x,$]=n(""),[S,I]=n({showOnlySelected:!1}),D=a(()=>{const e=[],t=[];for(const l of o){const a=L(l.odigosVersion,_e),n=l.status===m.Success,i=s.includes(l.id),o=!S.showOnlySelected||i,r=!x||l.name.toLowerCase().includes(x.toLowerCase());a&&n&&o&&r?e.push(l):i&&t.push(l.id)}return t.length>0&&c(e=>e.filter(e=>!t.includes(e))),e},[o.length,s.length,x,S]),P=e=>{c(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[j,E]=n(!1),[G,U]=n(!1),[H,Y]=n(void 0),[q,B]=n(!1),[X,K]=n(void 0),{formData:J,handleFormChange:Q,areFormValuesEqual:Z,resetFormData:_}=W(X||{rollout:{automaticRolloutDisabled:!1}}),{isFormDirty:ee,isFormMatch:te}=a(()=>({isFormDirty:s.length>1||void 0!==X&&!Z(X,J),isFormMatch:1===s.length&&void 0!==X&&Z(X,J)}),[s.length,X,J]);i(()=>{1===s.length?(async e=>{if(q)return;B(!0);const t=await b(e);if(t){const e={rollout:{automaticRolloutDisabled:t.rollout?.automaticRolloutDisabled||!1}};K(e),_(e)}B(!1)})(s[0]):K(void 0)},[s.length]);const le=()=>{E(!1),l()};return e(T,{isOpen:!0,hideOverlay:!0,width:Ze,header:{icon:ye,title:"Cluster Configuration",onClose:l},children:[e(et,{children:[e(tt,{children:[t(z,{icon:we,title:"Selected Clusters",badge:{label:s.length}}),t(R,{width:"300px",placeholder:"Search by cluster name",value:x,onChange:$}),e(d,{$gap:8,children:[t(p,{size:h.XXXS,color:v.v2.colors.silver[200],nowrap:!0,children:"Show only:"}),t(y,{size:k.S,label:"Selected",value:S.showOnlySelected,onChange:e=>I(t=>({...t,showOnlySelected:e}))})]})]}),e(lt,{children:[e(at,{$width:"40%",children:[e(d,{$padding:"0 12px",$justifyContent:"space-between",children:[e(d,{$gap:8,children:[t(p,{size:h.XS,children:"Clusters"}),t(g,{label:D.length,status:f.Unknown})]}),e(d,{$gap:8,children:[t(p,{size:h.XXXS,color:v.v2.colors.silver[200],align:"right",children:"Selected clusters"}),t(g,{label:`${s.length}/${D.length}`,status:f.Unknown})]})]}),t(nt,{$borderRadius:"16px 0 0 16px",children:D.length?D.map(l=>e(it,{onClick:()=>P(l.id),children:[t(u,{value:s.includes(l.id),onChange:()=>P(l.id)}),t(p,{size:h.XS,children:l.name})]},l.id)):t(w,{title:"Clusters not found",subTitle:"Please select a cluster to update it's configuration"})})]}),e(at,{$width:"60%",children:[t(d,{$padding:"0 12px",children:t(p,{size:h.XS,children:"Configurations"})}),t(nt,{$borderRadius:"0 16px 16px 0",$gap:12,children:q?t(F,{}):t(y,{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:J.rollout?.automaticRolloutDisabled||!1,onChange:e=>Q("rollout.automaticRolloutDisabled",e)})})]})]})]}),e(ot,{children:[q?t(A,{icon:ke,title:"Fetching Configuration...",titleSize:h.XXS,withGradient:!0}):G?t(A,{icon:ke,title:"Applying Configurations...",titleSize:h.XXS,withGradient:!0}):H?t(N,{fullWidth:!0,status:m.Error,message:H}):ee?t(N,{fullWidth:!0,status:m.Info,message:'The values don\'t reflect the current configuration of the selected clusters.\n"Apply" will override the current configurations.'}):te?t(N,{fullWidth:!0,status:m.Success,message:"The values reflect the current configuration of the selected cluster."}):null,e(d,{$gap:8,children:[t("div",{style:{width:"150px"},children:t(O,{fullWidth:!0,variant:V.Secondary,label:"Cancel",onClick:()=>ee?E(!0):le(),disabled:G})}),t("div",{style:{width:"150px"},children:t(O,{fullWidth:!0,variant:V.Primary,label:"Save",onClick:async()=>{U(!0);const e=await C(s,J);U(!1),e?.error?Y(e.error):(c([]),l())},disabled:!ee||G})})]})]}),t(M,{isOpen:j,onClose:()=>E(!1),onApprove:le})]})};var rt,ct;!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"}(rt||(rt={})),function(e){e.Id="id",e.Name="name",e.Type="type",e.Status="status",e.OdigosVersion="odigosVersion",e.ConnectedSince="connectedSince",e.LastActivity="lastActivity"}(ct||(ct={}));const dt=[{key:ct.Name,label:"Name"},{key:ct.Type,label:"Type",textAlign:"right"},{key:ct.Status,label:"Status"},{key:ct.OdigosVersion,label:"Odigos Version"},{key:ct.ConnectedSince,label:"Connected Since"},{key:ct.LastActivity,label:"Last Activity"}],ut=(e,t)=>{const l=e.find(e=>e.key===ct.Id)?.rawValue;return t(l?.toString()||"")},pt=({tableRowsMaxHeight:l,connections:s,getConnections:c,onClickConnection:d,deleteConnection:u,getEffectiveConfig:p,applyConfigurations:h,getAllClusterSnapshots:b,persistSources:w})=>{const y=r(),{formatTimeAgo:k}=j(),[C,v]=n(!1),[x,$]=n(s||[]),[S,I]=n(!1),[T,D]=n(null),A=o(async()=>{try{v(!0),$(await c()??[])}catch(e){}finally{v(!1)}},[]),P=o(async()=>{if(b)try{I(!0),D(await b()??null)}catch(e){}finally{I(!1)}},[]);i(()=>{x.length||A()},[x.length,A]),i(()=>{T||P()},[T,P]);const[z,R]=n(""),[N,O]=n(null),[M,W]=n([]),F=a(()=>x.filter(e=>!z||e.name.toLowerCase().includes(z.toLowerCase())).map(e=>({cells:[{key:ct.Id,rawValue:e.id},{key:ct.Name,rawValue:e.name},{key:ct.Type,rawValue:e.type},{key:ct.Status,rawValue:e.status,component:()=>(e=>{const l=e===m.Success?"Connection live":"Connection lost",a=e===m.Success?$e:Se;return t(g,{status:e,label:l,leftIcon:a})})(e.status)},{key:ct.OdigosVersion,rawValue:e.odigosVersion},{key:ct.ConnectedSince,rawValue:e.connectedAt?k(e.connectedAt):"-"},{key:ct.LastActivity,rawValue:e.lastSeenAt?k(e.lastSeenAt):"-"}],onClick:e.status===m.Success?()=>d(e):void 0,isSelected:M.includes(e.id),onSelect:()=>W(t=>Array.from(new Set([...t,e.id]))),onDeselect:()=>W(t=>t.filter(t=>t!==e.id)),hideCheckbox:e.status!==m.Success||N===rt.BulkConfig&&!L(e.odigosVersion,_e)})),[x,M,z,N]),Q=o(({cells:e})=>{if(!(e=>e.find(e=>e.key===ct.Status)?.rawValue===m.Success)(e))return[{id:E(),label:"Delete Connection",rightIcon:Ce,onClick:()=>{ut(e,e=>{W([e]),O(rt.Delete)})}}];const t=ut(e,e=>{const t=x.find(t=>t.id===e);return t&&L(t.odigosVersion,_e)||!1});return[T&&w?{id:E(),tooltip:"Manage Sources",rightIcon:fe,onClick:async()=>{ut(e,e=>{W([e]),O(rt.BulkSource)})}}:null,p&&h?{id:E(),tooltip:t?"Edit Configuration":"To use this feature, please upgrade to Odigos v1.16 or later.",rightIcon:ye,disabled:!t,onClick:async()=>{ut(e,e=>{W([e]),O(rt.BulkConfig)})}}:null]},[x.length,T]),Z=a(()=>[{id:E(),type:U.Button,buttonProps:{variant:V.Text,size:G.S,label:"Cancel",onClick:()=>W([])}},T&&w?{id:E(),type:U.ButtonDropData,buttonProps:{variant:V.Secondary,size:G.S,label:"Add Component",onClick:e=>O(e)},dropDataProps:{alignX:H.Left,items:[{id:rt.BulkSource,label:"Add Source",icon:fe}]}}:null,p&&h?{id:E(),type:U.Button,buttonProps:{variant:V.Primary,size:G.S,label:"Manage Configurations",rightIcon:ye,onClick:()=>O(rt.BulkConfig)}}:null],[T]);return t(Y,{children:e(q,{richTitle:{icon:xe,title:"Connections",badge:{label:x.length.toString(),status:f.Unknown}},search:{placeholder:"Search by cluster name",value:z,onChange:e=>R(e),width:"300px"},actions:[{id:E(),type:U.Button,buttonProps:{variant:V.Secondary,size:G.S,leftIcon:ve,onClick:async()=>{await A(),await P()},disabled:C||S}}],children:[t(B,{variant:X.Pretty,maxHeight:l,headerBackgroundColor:y.v2.colors.silver[1e3],isLoading:C,withCheckboxes:!0,columns:dt,rows:F,rowActionsPushRightPosition:N?`calc(${N===rt.BulkConfig?Ze:Ye} - 24px)`:void 0,getRowActions:Q}),N===rt.BulkConfig&&p&&h&&t(st,{onClose:()=>O(null),connections:x,selectedConnectionIds:M,setSelectedConnectionIds:W,getEffectiveConfig:p,onApply:h}),N===rt.BulkSource&&T&&w&&t(Qe,{onClose:()=>O(null),snapshots:T,selectedConnectionIds:M,setSelectedConnectionIds:W,persistSources:async e=>{if(!w)return{error:"Persist sources function is not defined"};const t=await w(e);return t?.error||await P(),t}}),t(K,{target:"connection",isOpen:N===rt.Delete,onClose:()=>{W([]),O(null)},onApprove:async()=>{const e=M[0];e&&(await u(e),await A())}}),t(J,{isOpen:!!M.length&&!N,richTitle:{icon:we,title:"Selected Clusters",badge:{label:M.length}},actions:Z})]})})},ht=s.div`
76
+ justify-content: center;
77
+ padding: 12px 24px;
78
+ border-radius: 8px;
79
+ background-color: ${({theme:e})=>e.v2.colors.silver[800]};
80
+ `,en=({downloadDiagnose:t})=>{const l=h(),{namespaces:a}=be(),[o,i]=r(null),{formData:s,handleFormChange:c,resetFormData:d}=_({includeProfiles:!0,includeMetrics:!0,includeSourceWorkloads:!1,sourceWorkloadNamespaces:[]});return n(me,{richTitle:{icon:tt,title:"Diagnose"},children:o?n(_t,{children:n(B,{title:"Creating file...",subTitle:"This may take a few moments. Do not refresh the page.",startedAt:o,withGradient:!0,withVisual:!0,visualIcon:nt})}):e(g,{$gap:24,children:[n(m,{size:b.XXS,color:l.v2.colors.silver[200],children:"Download a tar.gz file with diagnostics from this cluster. Select which data to include before downloading, and share the file with the Odigos support team for troubleshooting."}),e(g,{$gap:16,children:[e(D,{$gap:8,children:[n(w,{label:"Profiles",value:s.includeProfiles,onChange:e=>c("includeProfiles",e)}),n(m,{size:b.XXXS,color:l.v2.colors.silver[200],children:"Include pprof profiles"})]}),e(D,{$gap:8,children:[n(w,{label:"Metrics",value:s.includeMetrics,onChange:e=>c("includeMetrics",e)}),n(m,{size:b.XXXS,color:l.v2.colors.silver[200],children:"Include Prometheus metrics"})]}),e(D,{$gap:8,children:[n(w,{label:"Source Workloads",value:s.includeSourceWorkloads,onChange:e=>{c("includeSourceWorkloads",e),e&&c("sourceWorkloadNamespaces",[])}}),n(m,{size:b.XXXS,color:l.v2.colors.silver[200],children:"Include workload and pod manifests for instrumented sources"})]})]}),n(fe,{alignX:we.Left,alignY:Ce.Bottom,items:a.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:R.Secondary,disabled:s.includeSourceWorkloads,leftIcon:s.sourceWorkloadNamespaces.length?()=>n(V,{label:s.sourceWorkloadNamespaces.length,status:N.Default}):void 0}}),n(D,{$justifyContent:"flex-end",children:n(P,{label:"Download Diagnose",rightIcon:nt,variant:R.Primary,onClick:async()=>{i(Date.now()),await t(s),i(null),d()},disabled:null!==o})})]})})},tn=({fetchDescribeOdigos:e})=>{const{platformType:t,version:l,tier:o}=ve(),[i,s]=r(null);return a(()=>{e().then(({data:e})=>s(e?.describeOdigos||null))},[]),n(me,{richTitle:{icon:lt,title:"General Information"},children:n(ye,{cellsPerRow:2,items:[{id:ke(),title:"Odigos Version",label:l},{id:ke(),title:`${t.toUpperCase()} Version`,label:i?.kubernetesVersion?.value||"-"},{id:ke(),title:"Installation Method",label:i?.installationMethod?.value||"-"},{id:ke(),title:"Tier",label:o}]})})},nn=({isOpen:t,onClose:l,token:a,updateToken:o,fetchDescribeOdigos:i,downloadDiagnose:r})=>e(U,{isOpen:t,header:{icon:lt,title:"System Overview",onClose:l},children:[i&&n(tn,{fetchDescribeOdigos:i}),o&&a&&n(Qt,{token:a,updateToken:o}),r&&n(en,{downloadDiagnose:r})]});var ln,an;!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"}(ln||(ln={})),function(e){e.Id="id",e.Name="name",e.Type="type",e.Status="status",e.OdigosVersion="odigosVersion",e.ConnectedSince="connectedSince",e.LastActivity="lastActivity"}(an||(an={}));const on=[{key:an.Name,label:"Name"},{key:an.Type,label:"Type",textAlign:"right"},{key:an.Status,label:"Status"},{key:an.OdigosVersion,label:"Odigos Version"},{key:an.ConnectedSince,label:"Connected Since"},{key:an.LastActivity,label:"Last Activity"}],rn=(e,t)=>{const n=e.find(e=>e.key===an.Id)?.rawValue;return t(n?.toString()||"")},sn=({tableRowsMaxHeight:t,connections:o,getConnections:i,onClickConnection:s,deleteConnection:c,configMinSupportedVersion:u=0,getEffectiveConfig:p,applyConfigurations:g,snapshotMinSupportedVersion:m=0,getAllClusterSnapshots:b,persistSources:f,createInstrumentationRule:C})=>{const w=h(),{formatTimeAgo:v}=pe(),[y,k]=r(!1),[$,x]=r(o||[]),[S,I]=r(!1),[D,T]=r(null),A=d(async()=>{try{k(!0),x(await i()??[])}catch(e){}finally{k(!1)}},[]),L=d(async()=>{if(b)try{I(!0),T(await b()??null)}catch(e){}finally{I(!1)}},[]);a(()=>{$.length||A()},[]),a(()=>{D||L()},[]);const[P,O]=r(""),[z,E]=r(null),[F,j]=r([]),H=l(()=>z===ln.BulkConfig?u:z===ln.BulkSource?m:0,[z,u,m]),{supportedConnections:W,supportedConnectionIds:G}=l(()=>{const e=((e,t)=>e.filter(e=>{const n=e.status===N.Success,l=$e(e.odigosVersion,t);return n&&l}))($,H);return{supportedConnections:e,supportedConnectionIds:e.map(e=>e.id)}},[$.length,H]);a(()=>{if(!z)return;const e=F.filter(e=>!G.includes(e));e.length&&j(t=>t.filter(t=>!e.includes(t)))},[z,F.length,G.length]);const q=l(()=>$.filter(e=>!P||e.name.toLowerCase().includes(P.toLowerCase())).map(e=>({cells:[{key:an.Id,rawValue:e.id},{key:an.Name,rawValue:e.name},{key:an.Type,rawValue:e.type},{key:an.Status,rawValue:e.status,component:()=>(e=>{const t=e===N.Success?"Connection live":"Connection lost",l=e===N.Success?Ze:Xe;return n(V,{status:e,label:t,leftIcon:l})})(e.status)},{key:an.OdigosVersion,rawValue:e.odigosVersion},{key:an.ConnectedSince,rawValue:e.connectedAt?v(e.connectedAt):"-"},{key:an.LastActivity,rawValue:e.lastSeenAt?v(e.lastSeenAt):"-"}],onClick:e.status===N.Success?()=>s(e):void 0,isSelected:F.includes(e.id),onSelect:()=>j(t=>Array.from(new Set([...t,e.id]))),onDeselect:()=>j(t=>t.filter(t=>t!==e.id)),hideCheckbox:e.status!==N.Success||z===ln.BulkConfig&&!$e(e.odigosVersion,u)||z===ln.BulkSource&&!$e(e.odigosVersion,m)})),[$,F,P,z,u,m]),U=l(()=>{const e=(e,t)=>{j([e]),E(t)};return(e=>{const{connections:t,configMinSupportedVersion:n,snapshotMinSupportedVersion:l,onDelete:a,onAddSource:o,onAddDestination:i,onAddAction:r,onAddInstrumentationRule:s,onEditConfiguration:c}=e;return({cells:e})=>{if(!(e=>e.find(e=>e.key===an.Status)?.rawValue===N.Success)(e))return[{id:ke(),label:"Delete Connection",rightIcon:at,onClick:()=>rn(e,a)}];const d=rn(e,e=>{const l=t.find(t=>t.id===e);return!!l&&$e(l.odigosVersion,n)}),u=rn(e,e=>{const n=t.find(t=>t.id===e);return!!n&&$e(n.odigosVersion,l)}),h=[];return o&&h.push({id:ke(),tooltip:u?ee.ADD_SOURCE:`To use this feature, please upgrade to Odigos v${l} or later.`,rightIcon:Be,disabled:!u,onClick:()=>rn(e,o)}),i&&h.push({id:ke(),tooltip:ee.ADD_DESTINATION,rightIcon:ot,onClick:()=>rn(e,i)}),r&&h.push({id:ke(),tooltip:ee.ADD_ACTION,rightIcon:it,onClick:()=>rn(e,r)}),s&&h.push({id:ke(),tooltip:ee.ADD_INSTRUMENTATION_RULE,rightIcon:Ye,onClick:()=>rn(e,s)}),c&&h.push({id:ke(),tooltip:d?"Edit Configuration":`To use this feature, please upgrade to Odigos v${n} or later.`,rightIcon:Ke,disabled:!d,onClick:()=>rn(e,c)}),h}})({connections:$,configMinSupportedVersion:u,snapshotMinSupportedVersion:m,onDelete:t=>e(t,ln.Delete),onAddSource:D&&f?t=>e(t,ln.BulkSource):void 0,onAddInstrumentationRule:C?t=>e(t,ln.BulkInstrumentationRule):void 0,onEditConfiguration:p&&g?t=>e(t,ln.BulkConfig):void 0})},[$,D,m,u,f,p,g,C]),Y=l(()=>(e=>{const{onCancel:t,onAddSource:n,onAddDestination:l,onAddAction:a,onAddInstrumentationRule:o,onManageConfigurations:i}=e,r=[{id:ke(),type:Se.Button,buttonProps:{variant:R.Text,size:M.S,label:xe.CANCEL,onClick:t}}],s=[n?{id:ln.BulkSource,label:ee.ADD_SOURCE,icon:Be}:null,l?{id:ln.BulkDestination,label:ee.ADD_DESTINATION,icon:ot}:null,a?{id:ln.BulkAction,label:ee.ADD_ACTION,icon:it}:null,o?{id:ln.BulkInstrumentationRule,label:ee.ADD_INSTRUMENTATION_RULE,icon:Ye}:null];return s.some(Boolean)&&r.push({id:ke(),type:Se.ButtonDropData,buttonProps:{variant:R.Secondary,size:M.S,label:"Add Component",onClick:e=>{e===ln.BulkSource?n?.():e===ln.BulkDestination?l?.():e===ln.BulkAction?a?.():e===ln.BulkInstrumentationRule&&o?.()}},dropDataProps:{alignX:we.Left,items:s}}),i&&r.push({id:ke(),type:Se.Button,buttonProps:{variant:R.Primary,size:M.S,label:"Manage Configurations",rightIcon:Ke,onClick:i}}),r})({onCancel:()=>j([]),onAddSource:D&&f?()=>E(ln.BulkSource):void 0,onAddInstrumentationRule:C?()=>E(ln.BulkInstrumentationRule):void 0,onManageConfigurations:p&&g?()=>E(ln.BulkConfig):void 0}),[D,f,p,g,C]);return n(Ie,{children:e(me,{richTitle:{icon:st,title:ee.CONNECTIONS,badge:{label:$.length.toString(),status:te.Unknown}},search:{placeholder:"Search by cluster name",value:P,onChange:e=>O(e),width:"300px"},actions:[{id:ke(),type:Se.Button,buttonProps:{variant:R.Secondary,size:M.S,leftIcon:rt,onClick:async()=>{await A(),await L()},disabled:y||S}}],children:[n(De,{variant:Te.Pretty,maxHeight:t,headerBackgroundColor:w.v2.colors.silver[1e3],isLoading:y,withCheckboxes:!0,columns:on,rows:q,rowActionsPushRightPosition:z?`calc(${Mt} - 24px)`:void 0,getRowActions:U}),z===ln.BulkConfig&&p&&g&&n(Bt,{onClose:()=>E(null),connections:W,selectedConnectionIds:F,setSelectedConnectionIds:j,getEffectiveConfig:p,onApply:g}),z===ln.BulkSource&&D&&f&&n(Yt,{onClose:()=>E(null),snapshots:D,selectedConnectionIds:F,setSelectedConnectionIds:j,persistSources:async e=>{const t=await(f?.(e));return t?.error||await L(),t}}),z===ln.BulkInstrumentationRule&&C&&n(Gt,{onClose:()=>E(null),selectedConnectionIds:F,setSelectedConnectionIds:j,createInstrumentationRule:C}),n(Dt,{target:"connection",isOpen:z===ln.Delete,onClose:()=>{j([]),E(null)},onApprove:async()=>{const e=F[0];e&&(await c(e),await A())}}),n(Ae,{isOpen:!!F.length&&!z,richTitle:{icon:We,title:"Selected Clusters",badge:{label:F.length}},actions:Y})]})})},cn=u.div`
105
81
  display: flex;
106
82
  align-items: center;
107
83
  justify-content: space-between;
@@ -113,17 +89,10 @@ import{jsxs as e,jsx as t,Fragment as l}from"react/jsx-runtime";import{useMemo a
113
89
  &:hover {
114
90
  background: ${({theme:e})=>e.v2.colors.silver[700]};
115
91
  }
116
- `,gt=s.div`
117
- animation-name: ${le.in};
118
- `,mt=({pod:o,getExtendedPodInfo:s,onClose:r})=>{const{formatTimeAgo:d}=j(),[u,h]=n(null),[g,b]=n(!1);i(()=>{o?s(o.namespace,o.name).then(e=>h(e??null)):(h(null),b(!1))},[o]);const f=a(()=>[{id:E(),title:"Node",label:u?.node??"-",withCopy:!0},{id:E(),title:"Status",badge:{status:Q(u?.status),label:u?.status??"-"}}],[u]),w=a(()=>u?.containers?.map(e=>({id:E(),items:[{id:E(),title:"Container",label:e.name??"-"},{id:E(),title:"Status",label:e.startedAt?`${e.status} (since ${d(e.startedAt)})`:e.status},{id:E(),title:"Ready",badge:{status:e.ready?m.Success:m.Error,leftIcon:e.ready?we:Ie,label:e.ready?"True":"False",invertColors:!0}},{id:E(),title:"Started",badge:{status:e.started?m.Success:m.Error,leftIcon:e.started?we:Ie,label:e.started?"True":"False",invertColors:!0}},{id:E(),title:"Image Version",label:e.image?.split(":")?.[1]??"-"},{id:E(),title:"Image Repository",label:e.image?.split(":")?.[0]??"-"},{id:E(),title:"Restarts",label:e.restarts.toString()},{id:E(),title:"State Reason",label:e.stateReason??"-"},{id:E(),title:"Resource Requests",label:`CPU ${e.resources.requests.cpu} • Memory ${e.resources.requests.memory}`},{id:E(),title:"Resource Limits",label:`CPU ${e.resources.limits.cpu} • Memory ${e.resources.limits.memory}`}]}))||[],[u]);return e(T,{isOpen:!!o,header:{icon:Te,title:"Pod Information",onClose:r},children:[u?null:t(D,{children:t(F,{})}),u?e(l,{children:[t(q,{richTitle:{icon:Te,title:u.name,withCopy:!0},children:e(c,{$gap:24,children:[t(Z,{cellsPerRow:2,items:f}),w.length>0&&e(c,{$gap:12,children:[e(ht,{onClick:()=>b(e=>!e),children:[t(p,{children:"Containers Overview"}),t(_,{icon:g?De:Ae})]}),g&&w.map(({id:e,items:l})=>t(gt,{children:t(Z,{cellsPerRow:2,items:l})},e))]})]})}),t(q,{richTitle:{icon:Pe,title:"Kubectl Commands"},children:e(c,{$gap:12,children:[t(ee,{value:`kubectl get pod ${u.name} -n ${u.namespace} -o yaml`}),t(ee,{value:`kubectl describe pod ${u.name} -n ${u.namespace}`}),t(ee,{value:`kubectl logs ${u.name} -n ${u.namespace}`})]})}),t(te,{yaml:u.manifestYAML,defaultOpen:!0})]}):null]})};var bt;!function(e){e.PodName="podName",e.Status="status",e.Restarts="restarts",e.NodeName="nodeName",e.SpanDropDrate="spanDropDrate",e.Age="age",e.DockerImage="dockerImage"}(bt||(bt={}));const ft=[{key:bt.PodName,label:"Pod Name"},{key:bt.Status,label:"Status"},{key:bt.Restarts,label:"Restarts",textAlign:"right"},{key:bt.NodeName,label:"Node Name"},{key:bt.Age,label:"Age",textAlign:"right"},{key:bt.DockerImage,label:"Docker Image",textAlign:"right"}],wt=({isLoading:l,tableRowsMaxHeight:i,pods:o,getExtendedPodInfo:s})=>{const c=r(),{formatTimeAgo:u}=j(),[h,f]=n(null),w=a(()=>o.map(l=>({onClick:()=>f(l),cells:[{key:bt.PodName,rawValue:l.name},{key:bt.Status,rawValue:l.status,component:()=>{return e=l.status,t(g,{status:Q(e),label:e});var e}},{key:bt.Restarts,rawValue:l.restartsCount.toString()},{key:bt.NodeName,rawValue:l.nodeName},{key:bt.SpanDropDrate,rawValue:0,component:()=>{const{collectorMetrics:a}=l;if(!a)return t(p,{children:"-"});const n=(a?.metricsAcceptedRps??0)+(a?.metricsDroppedRps??0),i=n>0?Math.round((a?.metricsDroppedRps??0)/n*100):0,o=i>0?m.Error:m.Success,s=(a?.exporterSuccessRps??0)+(a?.exporterFailedRps??0),r=s>0?Math.round((a?.exporterFailedRps??0)/s*100):0,c=r>0?m.Error:m.Success;return e(d,{$gap:4,children:[t(b,{text:`Accepted: ${a.metricsAcceptedRps.toLocaleString()}, Dropped: ${a.metricsDroppedRps.toLocaleString()}`,children:t(g,{status:o,label:`Receiver ${i}%`,leftIcon:o===m.Error?ze:Re,useSecondaryTone:!0,invertColors:!0})}),t(b,{text:`Success: ${a.exporterSuccessRps.toLocaleString()}, Failed: ${a.exporterFailedRps.toLocaleString()}`,children:t(g,{status:c,label:`Exporter ${r}%`,leftIcon:c===m.Error?ze:Re,useSecondaryTone:!0,invertColors:!0})})]})}},{key:bt.Age,rawValue:u(l.creationTimestamp)},{key:bt.DockerImage,rawValue:l.image}]})),[o,c]);return e(q,{richTitle:{icon:Te,title:"Pods"},children:[t(B,{variant:X.Data,maxHeight:i,isLoading:l,columns:ft,rows:w}),t(mt,{pod:h,getExtendedPodInfo:s,onClose:()=>f(null)})]})};var yt;!function(e){e.Gateway="gateway",e.Node="node"}(yt||(yt={}));const kt=[{value:yt.Gateway,label:"Gateway"},{value:yt.Node,label:"Node Collector"}],Ct=s.div`
92
+ `,dn=u.div`
93
+ animation-name: ${Re.in};
94
+ `,un=({pod:o,getExtendedPodInfo:i,onClose:s})=>{const{formatTimeAgo:c}=pe(),[d,u]=r(null),[h,p]=r(!1);a(()=>{o?i(o.namespace,o.name).then(e=>u(e??null)):(u(null),p(!1))},[o]);const b=l(()=>[{id:ke(),title:"Node",label:d?.node??"-",withCopy:!0},{id:ke(),title:"Status",badge:{status:Le(d?.status),label:d?.status??"-"}}],[d]),f=l(()=>d?.containers?.map(e=>({id:ke(),items:[{id:ke(),title:"Container",label:e.name??"-"},{id:ke(),title:"Status",label:e.startedAt?`${e.status} (since ${c(e.startedAt)})`:e.status},{id:ke(),title:"Ready",badge:{status:e.ready?N.Success:N.Error,leftIcon:e.ready?We:Ge,label:e.ready?"True":"False",invertColors:!0}},{id:ke(),title:"Started",badge:{status:e.started?N.Success:N.Error,leftIcon:e.started?We:Ge,label:e.started?"True":"False",invertColors:!0}},{id:ke(),title:"Image Version",label:e.image?.split(":")?.[1]??"-"},{id:ke(),title:"Image Repository",label:e.image?.split(":")?.[0]??"-"},{id:ke(),title:"Restarts",label:e.restarts.toString()},{id:ke(),title:"State Reason",label:e.stateReason??"-"},{id:ke(),title:"Resource Requests",label:`CPU ${e.resources.requests.cpu} • Memory ${e.resources.requests.memory}`},{id:ke(),title:"Resource Limits",label:`CPU ${e.resources.limits.cpu} • Memory ${e.resources.limits.memory}`}]}))||[],[d]);return e(U,{isOpen:!!o,header:{icon:ct,title:"Pod Information",onClose:s},children:[d?null:n(Y,{children:n(Pe,{})}),d?e(t,{children:[n(me,{richTitle:{icon:ct,title:d.name,withCopy:!0},children:e(g,{$gap:24,children:[n(ye,{cellsPerRow:2,items:b}),f.length>0&&e(g,{$gap:12,children:[e(cn,{onClick:()=>p(e=>!e),children:[n(m,{children:"Containers Overview"}),n(he,{icon:h?dt:ut})]}),h&&f.map(({id:e,items:t})=>n(dn,{children:n(ye,{cellsPerRow:2,items:t})},e))]})]})}),n(me,{richTitle:{icon:lt,title:"Kubectl Commands"},children:e(g,{$gap:12,children:[n(Me,{value:`kubectl get pod ${d.name} -n ${d.namespace} -o yaml`}),n(Me,{value:`kubectl describe pod ${d.name} -n ${d.namespace}`}),n(Me,{value:`kubectl logs ${d.name} -n ${d.namespace}`})]})}),n(ft,{yaml:d.manifestYAML,defaultOpen:!0})]}):null]})};var hn;!function(e){e.PodName="podName",e.Status="status",e.Restarts="restarts",e.NodeName="nodeName",e.SpanDropDrate="spanDropDrate",e.Age="age",e.DockerImage="dockerImage"}(hn||(hn={}));const pn=[{key:hn.PodName,label:"Pod Name"},{key:hn.Status,label:"Status"},{key:hn.Restarts,label:"Restarts",textAlign:"right"},{key:hn.NodeName,label:"Node Name"},{key:hn.Age,label:"Age",textAlign:"right"},{key:hn.DockerImage,label:"Docker Image",textAlign:"right"}],gn=({isLoading:t,tableRowsMaxHeight:a,pods:o,getExtendedPodInfo:i})=>{const s=h(),{formatTimeAgo:c}=pe(),[d,u]=r(null),p=l(()=>o.map(t=>({onClick:()=>u(t),cells:[{key:hn.PodName,rawValue:t.name},{key:hn.Status,rawValue:t.status,component:()=>{return e=t.status,n(V,{status:Le(e),label:e});var e}},{key:hn.Restarts,rawValue:t.restartsCount.toString()},{key:hn.NodeName,rawValue:t.nodeName},{key:hn.SpanDropDrate,rawValue:0,component:()=>{const{collectorMetrics:l}=t;if(!l)return n(m,{children:"-"});const a=(l?.metricsAcceptedRps??0)+(l?.metricsDroppedRps??0),o=a>0?Math.round((l?.metricsDroppedRps??0)/a*100):0,i=o>0?N.Error:N.Success,r=(l?.exporterSuccessRps??0)+(l?.exporterFailedRps??0),s=r>0?Math.round((l?.exporterFailedRps??0)/r*100):0,c=s>0?N.Error:N.Success;return e(D,{$gap:4,children:[n(C,{text:`Accepted: ${l.metricsAcceptedRps.toLocaleString()}, Dropped: ${l.metricsDroppedRps.toLocaleString()}`,children:n(V,{status:i,label:`Receiver ${o}%`,leftIcon:i===N.Error?ht:pt,useSecondaryTone:!0,invertColors:!0})}),n(C,{text:`Success: ${l.exporterSuccessRps.toLocaleString()}, Failed: ${l.exporterFailedRps.toLocaleString()}`,children:n(V,{status:c,label:`Exporter ${s}%`,leftIcon:c===N.Error?ht:pt,useSecondaryTone:!0,invertColors:!0})})]})}},{key:hn.Age,rawValue:c(t.creationTimestamp)},{key:hn.DockerImage,rawValue:t.image}]})),[o,s]);return e(me,{richTitle:{icon:ct,title:"Pods"},children:[n(De,{variant:Te.Data,maxHeight:a,isLoading:t,columns:pn,rows:p}),n(un,{pod:d,getExtendedPodInfo:i,onClose:()=>u(null)})]})};var mn;!function(e){e.Gateway="gateway",e.Node="node"}(mn||(mn={}));const bn=[{value:mn.Gateway,label:"Gateway"},{value:mn.Node,label:"Node Collector"}],fn=u.div`
119
95
  display: flex;
120
96
  align-items: center;
121
97
  justify-content: space-between;
122
- `,vt=({selectedTab:l,setSelectedTab:n,onClickDownloadDiagnose:i,onClickRefresh:o,loading:s,disabled:r})=>{const c=a(()=>{const e=[];return i&&e.push({id:E(),type:U.Button,buttonProps:{label:"Download Diagnose",leftIcon:Ne,size:G.S,variant:V.Text,onClick:i,disabled:r}}),o&&e.push({id:E(),type:U.Button,buttonProps:{label:"Refresh",leftIcon:ve,size:G.S,variant:V.Text,onClick:o,disabled:r,loading:s}}),e},[i,o,r,s]);return e(Ct,{children:[e(d,{$gap:12,children:[e(d,{$gap:8,children:[t(Oe,{size:32}),t(p,{size:h.M,weight:500,children:"Pipeline Collectors"})]}),t(ae,{options:kt,selected:l,setSelected:n,disabled:r})]}),t(ne,{actions:c})]})},xt=({isOpen:e,onClose:l,title:a,yaml:n})=>t(T,{isOpen:e,header:{icon:Ve,title:a,onClose:l},children:t(te,{yaml:n,defaultOpen:!0})});var $t;!function(e){e.ManifestYaml="manifest-yaml",e.ConfigMapYaml="configmap-yaml"}($t||($t={}));const St=({richTitle:l,statusCard:a,textCards:i,manifestYaml:o,configMapYaml:s})=>{const[r,c]=n(null);return e(q,{richTitle:l,actions:[{id:E(),type:U.ButtonDropData,buttonProps:{variant:V.Secondary,size:G.S,label:"View YAML",onClick:e=>c(e)},dropDataProps:{items:[{id:$t.ManifestYaml,label:l.title,icon:Me},{id:$t.ConfigMapYaml,label:"ConfigMap",icon:Me}]}}],children:[e(d,{$gap:16,children:[t(ie,{...a}),i.map(e=>t(oe,{...e},e.title))]}),t(xt,{isOpen:r===$t.ManifestYaml,onClose:()=>c(null),title:l.title,yaml:o}),t(xt,{isOpen:r===$t.ConfigMapYaml,onClose:()=>c(null),title:"ConfigMap",yaml:s})]})},It=e=>{switch(e){case se.Healthy:return"All desired replicas are updated, available, and ready";case se.Updating:return"Workload is progressing towards desired state (e.g., updating pods)";case se.Degraded:return"Progressing but with availability issues (e.g., not enough available replicas)";case se.Failed:return"Progress deadline exceeded or an unrecoverable error occurred";case se.Down:return"No available replicas";case se.Unknown:return"Status cannot be determined from current signals";default:return"Status unknown"}},Tt=({tableRowsMaxHeight:l,getGatewayInfo:s,getGatewayPods:r,getNodeCollectorInfo:c,getNodeCollectorPods:d,getExtendedPodInfo:u})=>{const{formatTimeAgo:p}=j(),{isVersionSupported:h,version:g}=re(1.12),[b,w]=n(!1),[y,k]=n(yt.Gateway),[C,v]=n(null),[x,$]=n([]),[S,I]=n(null),[T,D]=n([]),A=o(async()=>{w(!0);try{switch(y){case yt.Gateway:v(await s()??null),$(await r()??[]);break;case yt.Node:I(await c()??null),D(await d()??[])}}catch(e){}w(!1)},[y]);i(()=>{A()},[A]);const P=a(()=>(e=>{switch(e){case yt.Gateway:return"Deployment";case yt.Node:return"DaemonSet";default:return"Pipeline Collectors"}})(y),[y]),z=a(()=>((e,t,l,a)=>{const n={status:f.Disabled,label:"No rollouts yet"};let i=!1,o=null;switch(e){case yt.Gateway:i=t?.rolloutInProgress??!1,o=t?.lastRolloutAt??null;break;case yt.Node:i=l?.rolloutInProgress??!1,o=l?.lastRolloutAt??null;break;default:return n}return i?{status:m.Info,label:"Rollout in progress",rightIcon:ve,useSecondaryTone:!0}:o?{status:f.Disabled,label:`Last Rollout: ${a(o)}`}:n})(y,C,S,p),[C,S,y,p]),R=a(()=>((e,t,l,a)=>{let n=a?m.Info:f.Unknown,i=a?"Loading":se.Unknown,o=a?"Fetching data...":It(se.Unknown);switch(e){case yt.Gateway:n=t?.status?Q(t?.status):n,i=t?.status??i,o=t?.status?It(t.status):o;break;case yt.Node:n=l?.status?Q(l?.status):n,i=l?.status??i,o=l?.status?It(l.status):o}return{status:n,title:i,description:o}})(y,C,S,b),[C,S,y,b]),N=a(()=>((e,t,l,a)=>{switch(e){case yt.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 yt.Node:return[{title:"Nodes",cells:[{label:"Desired",value:l?.nodes?.desired.toString()??"-",isLoading:a},{label:"Ready",value:l?.nodes?.ready.toString()??"-",isLoading:a}]},{title:"Requests",cells:[{label:"CPU",value:l?.resources?.requests.cpu??"-",isLoading:a},{label:"Memory",value:l?.resources?.requests.memory??"-",isLoading:a}]},{title:"Limits",cells:[{label:"CPU",value:l?.resources?.limits.cpu??"-",isLoading:a},{label:"Memory",value:l?.resources?.limits.memory??"-",isLoading:a}]},{title:"Docker Image",cells:[{value:l?.imageVersion??"-",isLoading:a}]}];default:return[]}})(y,C,S,b),[C,S,y,b]),O=a(()=>(y===yt.Gateway?C?.manifestYAML:S?.manifestYAML)??"",[C,S,y]),V=a(()=>(y===yt.Gateway?C?.configMapYAML:S?.configMapYAML)??"",[C,S,y]),M=a(()=>y===yt.Gateway?x:T,[x,T,y]);return e(Y,{children:[t(vt,{disabled:!h,loading:b,selectedTab:y,setSelectedTab:k,onClickDownloadDiagnose:void 0,onClickRefresh:A}),e(ce,{children:[t(St,{richTitle:{icon:Ve,title:P,badge:z},statusCard:R,textCards:N,manifestYaml:O,configMapYaml:V}),t(wt,{isLoading:b,tableRowsMaxHeight:l,pods:M,getExtendedPodInfo:u}),!h&&t(de,{minSupportedVersion:1.12,currentVersion:g||""})]})]})},Dt=({value:e,setValue:l,error:a})=>t(ue,{small:!0,maxWidth:"88px",type:"password",value:e,onChange:e=>l(e.target.value),autoFocus:!0,errorMessage:a}),At=({token:l,newToken:a,isLoading:n,isEditing:i,onEdit:o,onCancel:s,onSave:r})=>{const{CopyButton:c}=pe();return n?t(d,{$width:"70px",$height:"32px",$alignItems:"center",$justifyContent:"center",children:t(A,{title:"Saving...",withGradient:!0})}):e(d,i?{$width:"70px",$height:"32px",$alignItems:"center",$justifyContent:"space-between",children:[t(O,{variant:V.Secondary,size:G.S,leftIcon:Se,onClick:s,disabled:n}),t(O,{variant:V.Primary,size:G.S,leftIcon:$e,onClick:r,disabled:n||!a})]}:{$width:"70px",$height:"32px",$alignItems:"center",$justifyContent:"space-between",children:[t(c,{value:l}),t(_,{icon:Le,onClick:o,disabled:n})]})},Pt=({expiresAt:e})=>{const l=new Date(e).toDateString().split(" ").slice(1).join(" "),a=he(e,0)?m.Error:he(e,6048e5)?m.Warning:m.Success;return t(g,{label:l,status:a,invertColors:!0,useSecondaryTone:!0})},zt=({tokens:e,updateToken:l})=>{const[i,o]=n(null),[s,r]=n(null),{formData:c,handleFormChange:d,resetFormData:u}=W({newToken:""}),p=a(()=>[{key:"name",label:"Name",noFilter:!0,noSort:!0},{key:"expiresAt",label:"Expires",noFilter:!0,noSort:!0},{key:"token",label:"Token",noFilter:!0,noSort:!0},{key:"actions",label:"Actions",noFilter:!0,noSort:!0}],[]),h=a(()=>e?.map((a,n)=>{const p=i===n,h=s===n;return{cells:[{key:"name",rawValue:a.name},{key:"expiresAt",rawValue:a.expiresAt,component:()=>t(Pt,{expiresAt:a.expiresAt})},{key:"token",rawValue:`${new Array(15).fill("•").join("")}`,component:p?()=>t(Dt,{value:c.newToken,setValue:e=>d("newToken",e.trim())}):void 0},{key:"actions",rawValue:"",component:()=>t(At,{token:a.token,newToken:c.newToken,isLoading:h,isEditing:p,onEdit:()=>o(n),onCancel:()=>(o(null),r(null),void d("newToken","")),onSave:()=>(async t=>{r(t),await l(e?.[t]?.token??"",c.newToken),r(null),o(null),u()})(n)})}]}})||[],[e,s,i,c.newToken]);return t(q,{richTitle:{icon:We,title:"Authorization Tokens"},children:t(B,{variant:X.Pretty,columns:p,rows:h})})},Rt=s.div`
123
- display: flex;
124
- align-items: center;
125
- justify-content: center;
126
- padding: 12px 24px;
127
- border-radius: 8px;
128
- background-color: ${({theme:e})=>e.v2.colors.silver[800]};
129
- `,Nt=({downloadDiagnose:l})=>{const a=r(),{namespaces:i}=ge(),[o,s]=n(null),{formData:b,handleFormChange:f,resetFormData:w}=W({includeProfiles:!0,includeMetrics:!0,includeSourceWorkloads:!1,sourceWorkloadNamespaces:[]});return t(q,{richTitle:{icon:Fe,title:"Diagnose"},children:o?t(Rt,{children:t(A,{title:"Creating file...",subTitle:"This may take a few moments. Do not refresh the page.",startedAt:o,withGradient:!0,withVisual:!0,visualIcon:Ne})}):e(c,{$gap:24,children:[t(p,{size:h.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(c,{$gap:16,children:[e(d,{$gap:8,children:[t(u,{label:"Profiles",value:b.includeProfiles,onChange:e=>f("includeProfiles",e)}),t(p,{size:h.XXXS,color:a.v2.colors.silver[200],children:"Include pprof profiles"})]}),e(d,{$gap:8,children:[t(u,{label:"Metrics",value:b.includeMetrics,onChange:e=>f("includeMetrics",e)}),t(p,{size:h.XXXS,color:a.v2.colors.silver[200],children:"Include Prometheus metrics"})]}),e(d,{$gap:8,children:[t(u,{label:"Source Workloads",value:b.includeSourceWorkloads,onChange:e=>{f("includeSourceWorkloads",e),e&&f("sourceWorkloadNamespaces",[])}}),t(p,{size:h.XXXS,color:a.v2.colors.silver[200],children:"Include workload and pod manifests for instrumented sources"})]})]}),t(me,{alignX:H.Left,alignY:be.Bottom,items:i.map(e=>({id:e.name,label:e.name,withCheckbox:!0})),selectedIds:b.sourceWorkloadNamespaces,setSelectedIds:e=>f("sourceWorkloadNamespaces",e),withMultiSelect:!0,withSearch:!0,fullWidth:!0,buttonProps:{label:(b.sourceWorkloadNamespaces.length?"Selected":"Select")+" Namespaces",variant:V.Secondary,disabled:b.includeSourceWorkloads,leftIcon:b.sourceWorkloadNamespaces.length?()=>t(g,{label:b.sourceWorkloadNamespaces.length,status:m.Default}):void 0}}),t(d,{$justifyContent:"flex-end",children:t(O,{label:"Download Diagnose",rightIcon:Ne,variant:V.Primary,onClick:async()=>{s(Date.now()),await l(b),s(null),w()},disabled:null!==o})})]})})},Ot=({fetchDescribeOdigos:e})=>{const{platformType:l,version:a,tier:o}=re(),[s,r]=n(null);return i(()=>{e().then(({data:e})=>r(e?.describeOdigos||null))},[]),t(q,{richTitle:{icon:Pe,title:"General Information"},children:t(Z,{cellsPerRow:2,items:[{id:E(),title:"Odigos Version",label:a},{id:E(),title:`${l.toUpperCase()} Version`,label:s?.kubernetesVersion?.value||"-"},{id:E(),title:"Installation Method",label:s?.installationMethod?.value||"-"},{id:E(),title:"Tier",label:o}]})})},Vt=({isOpen:l,onClose:a,tokens:n,updateToken:i,fetchDescribeOdigos:o,downloadDiagnose:s})=>e(T,{isOpen:l,header:{icon:Pe,title:"System Overview",onClose:a},children:[t(Ot,{fetchDescribeOdigos:o}),t(zt,{tokens:n,updateToken:i}),t(Nt,{downloadDiagnose:s})]});export{pt as CentralConnections,Tt as PipelineCollectors,Vt as SystemDrawer};
98
+ `,Cn=({selectedTab:t,setSelectedTab:a,onClickDownloadDiagnose:o,onClickRefresh:i,loading:r,disabled:s})=>{const c=l(()=>{const e=[];return o&&e.push({id:ke(),type:Se.Button,buttonProps:{label:"Download Diagnose",leftIcon:nt,size:M.S,variant:R.Text,onClick:o,disabled:s}}),i&&e.push({id:ke(),type:Se.Button,buttonProps:{label:"Refresh",leftIcon:rt,size:M.S,variant:R.Text,onClick:i,disabled:s,loading:r}}),e},[o,i,s,r]);return e(fn,{children:[e(D,{$gap:12,children:[e(D,{$gap:8,children:[n(gt,{size:32}),n(m,{size:b.M,weight:500,children:"Pipeline Collectors"})]}),n(F,{options:bn,selected:t,setSelected:a,disabled:s})]}),n(Oe,{actions:c})]})},wn=({isOpen:e,onClose:t,title:l,yaml:a})=>n(U,{isOpen:e,header:{icon:mt,title:l,onClose:t},children:n(ft,{yaml:a,defaultOpen:!0})});var vn;!function(e){e.ManifestYaml="manifest-yaml",e.ConfigMapYaml="configmap-yaml"}(vn||(vn={}));const yn=({richTitle:t,statusCard:l,textCards:a,manifestYaml:o,configMapYaml:i})=>{const[s,c]=r(null);return e(me,{richTitle:t,actions:[{id:ke(),type:Se.ButtonDropData,buttonProps:{variant:R.Secondary,size:M.S,label:"View YAML",onClick:e=>c(e)},dropDataProps:{items:[{id:vn.ManifestYaml,label:t.title,icon:bt},{id:vn.ConfigMapYaml,label:"ConfigMap",icon:bt}]}}],children:[e(D,{$gap:16,children:[n(Ve,{...l}),a.map(e=>n(Ne,{...e},e.title))]}),n(wn,{isOpen:s===vn.ManifestYaml,onClose:()=>c(null),title:t.title,yaml:o}),n(wn,{isOpen:s===vn.ConfigMapYaml,onClose:()=>c(null),title:"ConfigMap",yaml:i})]})},kn=e=>{switch(e){case ze.Healthy:return"All desired replicas are updated, available, and ready";case ze.Updating:return"Workload is progressing towards desired state (e.g., updating pods)";case ze.Degraded:return"Progressing but with availability issues (e.g., not enough available replicas)";case ze.Failed:return"Progress deadline exceeded or an unrecoverable error occurred";case ze.Down:return"No available replicas";case ze.Unknown:return"Status cannot be determined from current signals";default:return"Status unknown"}},$n=({minSupportedVersion:t=0,tableRowsMaxHeight:o,getGatewayInfo:i,getGatewayPods:s,getNodeCollectorInfo:c,getNodeCollectorPods:u,getExtendedPodInfo:h})=>{const{formatTimeAgo:p}=pe(),{isVersionSupported:g,version:m}=ve(t),[b,f]=r(!1),[C,w]=r(mn.Gateway),[v,y]=r(null),[k,$]=r([]),[x,S]=r(null),[I,D]=r([]),T=d(async()=>{f(!0);try{switch(C){case mn.Gateway:y(await i()??null),$(await s()??[]);break;case mn.Node:S(await c()??null),D(await u()??[])}}catch(e){}f(!1)},[C]);a(()=>{T()},[T]);const A=l(()=>(e=>{switch(e){case mn.Gateway:return"Deployment";case mn.Node:return"DaemonSet";default:return"Pipeline Collectors"}})(C),[C]),L=l(()=>((e,t,n,l)=>{const a={status:te.Disabled,label:"No rollouts yet"};let o=!1,i=null;switch(e){case mn.Gateway:o=t?.rolloutInProgress??!1,i=t?.lastRolloutAt??null;break;case mn.Node:o=n?.rolloutInProgress??!1,i=n?.lastRolloutAt??null;break;default:return a}return o?{status:N.Info,label:"Rollout in progress",rightIcon:rt,useSecondaryTone:!0}:i?{status:te.Disabled,label:`Last Rollout: ${l(i)}`}:a})(C,v,x,p),[v,x,C,p]),P=l(()=>((e,t,n,l)=>{let a=l?N.Info:te.Unknown,o=l?"Loading":ze.Unknown,i=l?"Fetching data...":kn(ze.Unknown);switch(e){case mn.Gateway:a=t?.status?Le(t?.status):a,o=t?.status??o,i=t?.status?kn(t.status):i;break;case mn.Node:a=n?.status?Le(n?.status):a,o=n?.status??o,i=n?.status?kn(n.status):i}return{status:a,title:o,description:i}})(C,v,x,b),[v,x,C,b]),M=l(()=>((e,t,n,l)=>{switch(e){case mn.Gateway:return[{title:"HPA Spec (Replicas)",cells:[{label:"Min.",value:t?.hpa?.min.toString()??"-",isLoading:l},{label:"Max.",value:t?.hpa?.max.toString()??"-",isLoading:l},{label:"Current",value:t?.hpa?.current.toString()??"-",isLoading:l},{label:"Desired",value:t?.hpa?.desired.toString()??"-",isLoading:l}]},{title:"Requests",cells:[{label:"CPU",value:t?.resources?.requests.cpu??"-",isLoading:l},{label:"Memory",value:t?.resources?.requests.memory??"-",isLoading:l}]},{title:"Limits",cells:[{label:"CPU",value:t?.resources?.limits.cpu??"-",isLoading:l},{label:"Memory",value:t?.resources?.limits.memory??"-",isLoading:l}]},{title:"Docker Image",cells:[{value:t?.imageVersion??"-",isLoading:l}]}];case mn.Node:return[{title:"Nodes",cells:[{label:"Desired",value:n?.nodes?.desired.toString()??"-",isLoading:l},{label:"Ready",value:n?.nodes?.ready.toString()??"-",isLoading:l}]},{title:"Requests",cells:[{label:"CPU",value:n?.resources?.requests.cpu??"-",isLoading:l},{label:"Memory",value:n?.resources?.requests.memory??"-",isLoading:l}]},{title:"Limits",cells:[{label:"CPU",value:n?.resources?.limits.cpu??"-",isLoading:l},{label:"Memory",value:n?.resources?.limits.memory??"-",isLoading:l}]},{title:"Docker Image",cells:[{value:n?.imageVersion??"-",isLoading:l}]}];default:return[]}})(C,v,x,b),[v,x,C,b]),R=l(()=>(C===mn.Gateway?v?.manifestYAML:x?.manifestYAML)??"",[v,x,C]),O=l(()=>(C===mn.Gateway?v?.configMapYAML:x?.configMapYAML)??"",[v,x,C]),V=l(()=>C===mn.Gateway?k:I,[k,I,C]);return e(Ie,{children:[n(Cn,{disabled:!g,loading:b,selectedTab:C,setSelectedTab:w,onClickDownloadDiagnose:void 0,onClickRefresh:T}),e(Ee,{children:[n(yn,{richTitle:{icon:mt,title:A,badge:L},statusCard:P,textCards:M,manifestYaml:R,configMapYaml:O}),n(gn,{isLoading:b,tableRowsMaxHeight:o,pods:V,getExtendedPodInfo:h}),!g&&n(Tt,{minSupportedVersion:t,currentVersion:m||""})]})]})};export{Gt as AddRuleDrawer,St as AddRuleForm,Yt as AddSourceDrawer,sn as CentralConnections,Bt as EditConfigDrawer,$n as PipelineCollectors,nn as SystemDrawer};