@odigos/ui-kit 0.0.261 → 0.0.263-dev.519

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 (82) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/lib/chunks/{connections-scope-DhNWocBO.js → connections-scope-DEVWbigK.js} +1 -1
  3. package/lib/chunks/index-BVtv0LGZ.js +155 -0
  4. package/lib/chunks/{odigos-context-BYgtdAtj.js → odigos-context-DGEWcwEQ.js} +1 -2
  5. package/lib/chunks/source-instrument-form-context-DMCdySjE.js +1 -0
  6. package/lib/chunks/ui-components-BDtk3K99.js +1742 -0
  7. package/lib/chunks/use-odigos-api-ZAJiPzPh.js +5 -0
  8. package/lib/components/_v2/cards/section-card/index.d.ts +2 -0
  9. package/lib/components/_v2/index.d.ts +1 -0
  10. package/lib/components/_v2/input-list/index.d.ts +2 -0
  11. package/lib/components/_v2/input-table/card-table.d.ts +10 -0
  12. package/lib/components/_v2/input-table/dynamic-field/index.d.ts +1 -0
  13. package/lib/components/_v2/input-table/index.d.ts +2 -0
  14. package/lib/components/_v2/input-table/types.d.ts +13 -1
  15. package/lib/components/_v2/radio-card/index.d.ts +16 -0
  16. package/lib/components/v2.js +1 -1
  17. package/lib/components.js +1 -1
  18. package/lib/constants/instrumentation-rules/index.d.ts +2 -1
  19. package/lib/constants/strings/index.d.ts +64 -0
  20. package/lib/constants.js +1 -1
  21. package/lib/containers/_v2/_drawers/add-source-drawer/strings.d.ts +1 -0
  22. package/lib/containers/_v2/_drawers/create-cloud-connector-drawer/index.d.ts +15 -0
  23. package/lib/containers/_v2/_drawers/create-cloud-connector-drawer/steps/select-provider/custom-resource-table.d.ts +9 -0
  24. package/lib/containers/_v2/_drawers/create-cloud-connector-drawer/steps/select-provider/helpers.d.ts +5 -0
  25. package/lib/containers/_v2/_drawers/create-cloud-connector-drawer/steps/select-provider/index.d.ts +2 -0
  26. package/lib/containers/_v2/_drawers/create-cloud-connector-drawer/steps/select-provider/permission-list.d.ts +12 -0
  27. package/lib/containers/_v2/_drawers/create-cloud-connector-drawer/steps/select-provider/permissions.d.ts +25 -0
  28. package/lib/containers/_v2/_drawers/create-cloud-connector-drawer/steps/select-provider/policy-preview.d.ts +5 -0
  29. package/lib/containers/_v2/_drawers/create-cloud-connector-drawer/steps/select-provider/provider-list.d.ts +8 -0
  30. package/lib/containers/_v2/_drawers/create-cloud-connector-drawer/steps/setup-credentials/create-role-section.d.ts +6 -0
  31. package/lib/containers/_v2/_drawers/create-cloud-connector-drawer/steps/setup-credentials/enter-arn-section.d.ts +5 -0
  32. package/lib/containers/_v2/_drawers/create-cloud-connector-drawer/steps/setup-credentials/index.d.ts +5 -0
  33. package/lib/containers/_v2/_drawers/create-cloud-connector-drawer/steps/setup-credentials/methods.d.ts +30 -0
  34. package/lib/containers/_v2/_drawers/create-cloud-connector-drawer/steps/setup-credentials/section.d.ts +9 -0
  35. package/lib/containers/_v2/_drawers/create-cloud-connector-drawer/steps/validate-connection/index.d.ts +8 -0
  36. package/lib/containers/_v2/_drawers/index.d.ts +1 -0
  37. package/lib/containers/_v2/_forms/add-action-form/dynamic-fields/index.d.ts +1 -0
  38. package/lib/containers/_v2/_forms/add-rule-form/custom-fields/index.d.ts +2 -1
  39. package/lib/containers/_v2/central-connections/helpers.d.ts +9 -0
  40. package/lib/containers/_v2/central-connections/index.d.ts +6 -1
  41. package/lib/containers/_v2/settings/side-menu/index.d.ts +12 -0
  42. package/lib/containers/_v2/settings/toolbar/index.d.ts +2 -5
  43. package/lib/containers/v2.js +598 -158
  44. package/lib/containers.js +1 -1
  45. package/lib/contexts/cloud-connector-form-context.d.ts +35 -0
  46. package/lib/contexts/index.d.ts +1 -0
  47. package/lib/contexts/odigos-api/capabilities.d.ts +1 -0
  48. package/lib/contexts/odigos-api/hooks/use-instrumentation-rules-api.d.ts +13 -1
  49. package/lib/contexts/odigos-api/types.d.ts +3 -1
  50. package/lib/contexts/odigos-api.js +1 -1
  51. package/lib/contexts/rule-form-context.d.ts +1 -1
  52. package/lib/contexts.js +1 -1
  53. package/lib/functions.js +1 -1
  54. package/lib/hooks.js +1 -1
  55. package/lib/icons/common/index.d.ts +1 -0
  56. package/lib/icons/common/lock-icon/index.d.ts +2 -0
  57. package/lib/icons/compute-platform/cloud-connector-icon/index.d.ts +2 -0
  58. package/lib/icons/compute-platform/cloud-connector-policy-icon/index.d.ts +2 -0
  59. package/lib/icons/compute-platform/index.d.ts +2 -0
  60. package/lib/icons.js +1 -1
  61. package/lib/snippets/_v2/connector-created-modal/index.d.ts +7 -0
  62. package/lib/snippets/_v2/dynamic-field/index.d.ts +2 -1
  63. package/lib/snippets/_v2/index.d.ts +1 -0
  64. package/lib/snippets/v2.js +1 -1
  65. package/lib/snippets.js +1 -1
  66. package/lib/store.js +1 -1
  67. package/lib/theme.js +1 -1
  68. package/lib/types/actions/index.d.ts +1 -4
  69. package/lib/types/cloud-connectors/index.d.ts +88 -0
  70. package/lib/types/common/index.d.ts +3 -1
  71. package/lib/types/index.d.ts +1 -0
  72. package/lib/types/instrumentation-rules/index.d.ts +22 -3
  73. package/lib/types/snapshot/index.d.ts +1 -0
  74. package/lib/types/sources/index.d.ts +1 -0
  75. package/lib/types/workload/index.d.ts +1 -0
  76. package/lib/types.js +1 -1
  77. package/lib/visuals.js +1 -1
  78. package/package.json +1 -1
  79. package/lib/chunks/index-DILEVYlK.js +0 -155
  80. package/lib/chunks/source-instrument-form-context-oDlfTrOD.js +0 -1
  81. package/lib/chunks/ui-components-BDSEcaSZ.js +0 -1692
  82. package/lib/chunks/use-odigos-api-DHCLONPK.js +0 -5
@@ -0,0 +1,7 @@
1
+ import { type FC } from 'react';
2
+ export interface ConnectorCreatedModalProps {
3
+ isOpen: boolean;
4
+ onClose: () => void;
5
+ onViewConnector?: () => void;
6
+ }
7
+ export declare const ConnectorCreatedModal: FC<ConnectorCreatedModalProps>;
@@ -1,6 +1,6 @@
1
1
  import { type FC } from 'react';
2
2
  import { FieldTypes, InputTypes } from '@/types';
3
- import { type FieldMessageProps, type TimeUnit, type BadgeProps, DropDataOption } from '@/components/_v2';
3
+ import { type FieldMessageProps, type TimeUnit, ToggleSize, type BadgeProps, DropDataOption } from '@/components/_v2';
4
4
  export interface DynamicFieldProps extends FieldMessageProps {
5
5
  componentType: FieldTypes;
6
6
  inputType?: InputTypes;
@@ -18,5 +18,6 @@ export interface DynamicFieldProps extends FieldMessageProps {
18
18
  dropdownNoCheckbox?: boolean;
19
19
  timeUnits?: TimeUnit[];
20
20
  timeDefaultUnit?: string;
21
+ toggleSize?: ToggleSize;
21
22
  }
22
23
  export declare const DynamicField: FC<DynamicFieldProps>;
@@ -1,6 +1,7 @@
1
1
  export * from './actions';
2
2
  export * from './cancel-modal';
3
3
  export * from './colored-span';
4
+ export * from './connector-created-modal';
4
5
  export * from './delete-modal';
5
6
  export * from './dynamic-field';
6
7
  export * from './instrumentation-rule-form-sections';
@@ -1 +1 @@
1
- export{bh as ActionType,dv as Actions,du as RichTitle}from"../chunks/ui-components-BDSEcaSZ.js";export{C as CancelModal,j as DURATION_OPTIONS,g as DeleteModal,e as DurationErrorsSection,D as DynamicField,I as InstrumentationPreviewSection,N as NOISY_PERCENTAGE_OPTIONS,h as OdigosLogoTextByTier,O as OperationSection,b as PERCENTAGE_OPTIONS,f as PercentageSection,P as PresetWithCustomInput,R as RuleInfoSection,d as RuleTypeSection,c as SamplingPreviewSection,S as SignalsCheckboxList,a as SourceScopeSection,U as UpgradeModal,i as WIDE_DRAWER_WIDTH,W as WideDrawer,Y as YamlSectionCard}from"../chunks/index-DILEVYlK.js";export{C as ColoredSpan,G as ColoredSpanVariant}from"../chunks/odigos-context-BYgtdAtj.js";import"react/jsx-runtime";import"styled-components";import"../icons.js";import"zustand";import"react";import"javascript-time-ago";import"javascript-time-ago/locale/en";import"prism-react-renderer";import"../chunks/vendor-BFqT13Me.js";import"zustand/middleware";import"react-error-boundary";import"react-dom";import"virtua";
1
+ export{bn as ActionType,dB as Actions,dA as RichTitle}from"../chunks/ui-components-BDtk3K99.js";export{C as CancelModal,j as ConnectorCreatedModal,k as DURATION_OPTIONS,h as DeleteModal,e as DurationErrorsSection,D as DynamicField,I as InstrumentationPreviewSection,N as NOISY_PERCENTAGE_OPTIONS,i as OdigosLogoTextByTier,O as OperationSection,b as PERCENTAGE_OPTIONS,f as PercentageSection,P as PresetWithCustomInput,R as RuleInfoSection,d as RuleTypeSection,c as SamplingPreviewSection,S as SignalsCheckboxList,a as SourceScopeSection,U as UpgradeModal,g as WIDE_DRAWER_WIDTH,W as WideDrawer,Y as YamlSectionCard}from"../chunks/index-BVtv0LGZ.js";export{C as ColoredSpan,G as ColoredSpanVariant}from"../chunks/odigos-context-DGEWcwEQ.js";import"react/jsx-runtime";import"styled-components";import"../icons.js";import"zustand";import"react";import"javascript-time-ago";import"javascript-time-ago/locale/en";import"prism-react-renderer";import"../chunks/vendor-BFqT13Me.js";import"zustand/middleware";import"react-error-boundary";import"react-dom";import"virtua";
package/lib/snippets.js CHANGED
@@ -1 +1 @@
1
- export{bh as ActionType,dv as Actions,du as RichTitle}from"./chunks/ui-components-BDSEcaSZ.js";export{C as CancelModal,j as DURATION_OPTIONS,g as DeleteModal,e as DurationErrorsSection,D as DynamicField,I as InstrumentationPreviewSection,N as NOISY_PERCENTAGE_OPTIONS,h as OdigosLogoTextByTier,O as OperationSection,b as PERCENTAGE_OPTIONS,f as PercentageSection,P as PresetWithCustomInput,R as RuleInfoSection,d as RuleTypeSection,c as SamplingPreviewSection,S as SignalsCheckboxList,a as SourceScopeSection,U as UpgradeModal,i as WIDE_DRAWER_WIDTH,W as WideDrawer,Y as YamlSectionCard}from"./chunks/index-DILEVYlK.js";export{C as ColoredSpan,G as ColoredSpanVariant}from"./chunks/odigos-context-BYgtdAtj.js";import"react/jsx-runtime";import"styled-components";import"./icons.js";import"zustand";import"react";import"javascript-time-ago";import"javascript-time-ago/locale/en";import"prism-react-renderer";import"./chunks/vendor-BFqT13Me.js";import"zustand/middleware";import"react-error-boundary";import"react-dom";import"virtua";
1
+ export{bn as ActionType,dB as Actions,dA as RichTitle}from"./chunks/ui-components-BDtk3K99.js";export{C as CancelModal,j as ConnectorCreatedModal,k as DURATION_OPTIONS,h as DeleteModal,e as DurationErrorsSection,D as DynamicField,I as InstrumentationPreviewSection,N as NOISY_PERCENTAGE_OPTIONS,i as OdigosLogoTextByTier,O as OperationSection,b as PERCENTAGE_OPTIONS,f as PercentageSection,P as PresetWithCustomInput,R as RuleInfoSection,d as RuleTypeSection,c as SamplingPreviewSection,S as SignalsCheckboxList,a as SourceScopeSection,U as UpgradeModal,g as WIDE_DRAWER_WIDTH,W as WideDrawer,Y as YamlSectionCard}from"./chunks/index-BVtv0LGZ.js";export{C as ColoredSpan,G as ColoredSpanVariant}from"./chunks/odigos-context-DGEWcwEQ.js";import"react/jsx-runtime";import"styled-components";import"./icons.js";import"zustand";import"react";import"javascript-time-ago";import"javascript-time-ago/locale/en";import"prism-react-renderer";import"./chunks/vendor-BFqT13Me.js";import"zustand/middleware";import"react-error-boundary";import"react-dom";import"virtua";
package/lib/store.js CHANGED
@@ -1 +1 @@
1
- export{a1 as ProgressKeys,fT as useDarkMode,h as useDataStreamStore,bi as useDrawerStore,dc as useFilterStore,bZ as useModalStore,W as useNotificationStore,$ as useProgressStore,di as useSelectedStore,a0 as useSetupStore}from"./chunks/ui-components-BDSEcaSZ.js";import"react/jsx-runtime";import"styled-components";import"./icons.js";import"zustand";import"react";import"javascript-time-ago";import"javascript-time-ago/locale/en";import"prism-react-renderer";import"./chunks/vendor-BFqT13Me.js";import"zustand/middleware";import"react-error-boundary";import"react-dom";import"virtua";
1
+ export{a1 as ProgressKeys,fX as useDarkMode,h as useDataStreamStore,bo as useDrawerStore,di as useFilterStore,c2 as useModalStore,W as useNotificationStore,$ as useProgressStore,dp as useSelectedStore,a0 as useSetupStore}from"./chunks/ui-components-BDtk3K99.js";import"react/jsx-runtime";import"styled-components";import"./icons.js";import"zustand";import"react";import"javascript-time-ago";import"javascript-time-ago/locale/en";import"prism-react-renderer";import"./chunks/vendor-BFqT13Me.js";import"zustand/middleware";import"react-error-boundary";import"react-dom";import"virtua";
package/lib/theme.js CHANGED
@@ -1 +1 @@
1
- export{g0 as Provider,g1 as animations,g2 as opacity,g3 as palettes}from"./chunks/ui-components-BDSEcaSZ.js";import"react/jsx-runtime";import"styled-components";import"./icons.js";import"zustand";import"react";import"javascript-time-ago";import"javascript-time-ago/locale/en";import"prism-react-renderer";import"./chunks/vendor-BFqT13Me.js";import"zustand/middleware";import"react-error-boundary";import"react-dom";import"virtua";
1
+ export{g4 as Provider,g5 as animations,g6 as opacity,g7 as palettes}from"./chunks/ui-components-BDtk3K99.js";import"react/jsx-runtime";import"styled-components";import"./icons.js";import"zustand";import"react";import"javascript-time-ago";import"javascript-time-ago/locale/en";import"prism-react-renderer";import"./chunks/vendor-BFqT13Me.js";import"zustand/middleware";import"react-error-boundary";import"react-dom";import"virtua";
@@ -64,10 +64,7 @@ export interface ActionOption {
64
64
  allowedSignals?: SignalType[];
65
65
  docsUrl?: string;
66
66
  fields?: ActionYamlProperties[];
67
- minVersion?: {
68
- [PlatformType.K8s]?: number;
69
- [PlatformType.Vm]?: number;
70
- };
67
+ minVersion?: Partial<Record<PlatformType, number>>;
71
68
  supportedPlatforms?: PlatformType[];
72
69
  items?: ActionOption[];
73
70
  }
@@ -0,0 +1,88 @@
1
+ export declare enum CloudConnectorFeatureKey {
2
+ Discovery = "discovery",
3
+ Instrumentation = "instrumentation",
4
+ ComputePlatforms = "computePlatforms",
5
+ Gateway = "gateway"
6
+ }
7
+ export interface CloudConnectorField {
8
+ name: string;
9
+ displayName: string;
10
+ componentType: string;
11
+ componentProps?: Record<string, unknown> | null;
12
+ required: boolean;
13
+ secret: boolean;
14
+ tooltip: string;
15
+ initialValue: string;
16
+ envVar: string;
17
+ }
18
+ export interface CloudConnectorAuthMethod {
19
+ id: string;
20
+ displayName: string;
21
+ description: string;
22
+ baseMethods: string[];
23
+ fields: CloudConnectorField[];
24
+ }
25
+ export interface CloudConnectorAuth {
26
+ permissions: string[];
27
+ methods: CloudConnectorAuthMethod[];
28
+ }
29
+ export interface CloudConnectorType {
30
+ name: string;
31
+ displayName: string;
32
+ description: string;
33
+ permissions: string[];
34
+ method: string;
35
+ implemented: boolean;
36
+ }
37
+ export interface CloudConnectorFeature {
38
+ key: string;
39
+ enabled: boolean;
40
+ displayName: string;
41
+ description: string;
42
+ permissions: string[];
43
+ types: CloudConnectorType[];
44
+ }
45
+ export interface CloudConnectorProvider {
46
+ provider: string;
47
+ displayName: string;
48
+ connectorFields: CloudConnectorField[];
49
+ auth: CloudConnectorAuth;
50
+ features: CloudConnectorFeature[];
51
+ }
52
+ export interface CloudConnectorTestCapability {
53
+ type: string;
54
+ discovery: boolean;
55
+ instrumentation: boolean;
56
+ computePlatforms: boolean;
57
+ }
58
+ export interface CloudConnectorTestInput {
59
+ provider: string;
60
+ credentials: Record<string, string>;
61
+ expectedAccountId: string;
62
+ capabilities: CloudConnectorTestCapability[];
63
+ }
64
+ export interface CloudConnectorTestCheck {
65
+ name: string;
66
+ displayName: string;
67
+ passed: boolean;
68
+ message: string;
69
+ remediation: string;
70
+ }
71
+ export interface CloudConnectorTestResult {
72
+ success: boolean;
73
+ accountId: string;
74
+ identity: string;
75
+ checks: CloudConnectorTestCheck[];
76
+ }
77
+ export interface CloudConnectorCreateInput {
78
+ provider: string;
79
+ displayName: string;
80
+ credentials: Record<string, string>;
81
+ expectedAccountId: string;
82
+ capabilities: CloudConnectorTestCapability[];
83
+ }
84
+ export interface CloudConnectorCreateResult {
85
+ created: boolean;
86
+ connectorId: string;
87
+ test: CloudConnectorTestResult;
88
+ }
@@ -40,7 +40,8 @@ export declare enum Tier {
40
40
  }
41
41
  export declare enum PlatformType {
42
42
  K8s = "k8s",
43
- Vm = "vm"
43
+ Vm = "vm",
44
+ Connector = "connector"
44
45
  }
45
46
  export declare enum InstallationMethod {
46
47
  Cli = "odigos-cli",
@@ -125,6 +126,7 @@ export declare enum FieldTypes {
125
126
  TextArea = "textarea",
126
127
  Dropdown = "dropdown",
127
128
  Checkbox = "checkbox",
129
+ CheckboxList = "checkboxList",
128
130
  Toggle = "toggle",// not used by dests, but is in form components
129
131
  Time = "time",
130
132
  FieldGroup = "fieldGroup"
@@ -1,4 +1,5 @@
1
1
  export * from './actions';
2
+ export * from './cloud-connectors';
2
3
  export * from './config';
3
4
  export * from './common';
4
5
  export * from './data-streams';
@@ -1,6 +1,6 @@
1
1
  import type { WorkloadId } from '../workload';
2
2
  import type { SourcesScopes } from '../sampling';
3
- import type { Condition, ProgrammingLanguages, SVG } from '../common';
3
+ import type { Condition, FieldTypes, ProgrammingLanguages, SVG } from '../common';
4
4
  export declare enum InstrumentationRuleType {
5
5
  CodeAttributes = "CodeAttributes",
6
6
  HeadersCollection = "HeadersCollection",
@@ -122,13 +122,32 @@ export interface PayloadCollection {
122
122
  [PayloadCollectionKeyTypes.DbQuery]?: DbQueryPayloadCollection | null;
123
123
  [PayloadCollectionKeyTypes.Messaging]?: MessagingPayloadCollection | null;
124
124
  }
125
+ export interface InstrumentationRuleYamlProperties {
126
+ name: string;
127
+ componentType: FieldTypes;
128
+ componentProperties?: string;
129
+ displayName?: string;
130
+ initialValue?: string;
131
+ renderCondition?: string[];
132
+ }
133
+ export interface InstrumentationRuleTypeOption {
134
+ type: InstrumentationRuleType;
135
+ displayName: string;
136
+ description: string;
137
+ supportedLanguages: ProgrammingLanguages[];
138
+ docsUrl: string;
139
+ fields: InstrumentationRuleYamlProperties[];
140
+ }
141
+ export interface GetInstrumentationRuleTypesResult {
142
+ instrumentationRuleTypes: InstrumentationRuleTypeOption[] | null;
143
+ }
125
144
  export interface InstrumentationRuleOption {
126
145
  type: InstrumentationRuleType;
127
146
  icon: SVG;
128
147
  label: string;
129
148
  description: string;
130
- docsEndpoint: string;
131
- docsDescription: string;
149
+ docsUrl: string;
132
150
  supportedLanguages: ProgrammingLanguages[];
151
+ fields?: InstrumentationRuleYamlProperties[];
133
152
  }
134
153
  export {};
@@ -6,6 +6,7 @@ export interface WorkloadSnapshot {
6
6
  selected: boolean;
7
7
  otelServiceName?: string | null;
8
8
  healthStatus?: string | null;
9
+ region?: string | null;
9
10
  }
10
11
  export interface NamespaceSnapshot {
11
12
  name: string;
@@ -5,6 +5,7 @@ export interface PersistSourceInput {
5
5
  namespace: string;
6
6
  name?: string;
7
7
  kind?: K8sResourceKind;
8
+ region?: string;
8
9
  selected: boolean;
9
10
  currentStreamName: string;
10
11
  }[];
@@ -5,6 +5,7 @@ export interface WorkloadId {
5
5
  namespace: string;
6
6
  name: string;
7
7
  kind: K8sResourceKind | '';
8
+ region?: string | null;
8
9
  }
9
10
  export interface DesiredConditionStatus {
10
11
  name?: string;
package/lib/types.js CHANGED
@@ -1 +1 @@
1
- export{f as ActionKeyTypes,g as ActionType,eN as AgentInjectedReason,eO as BooleanOperation,au as CodeAttributesKeyTypes,eP as ConditionType,_ as Crud,C as CustomInstrumentationsKeyTypes,ba as DesiredStateProgress,eQ as DestinationTypes,E as EntityTypes,ai as ExtractionDataFormat,l as FieldTypes,G as GolangCustomProbe,H as HeadersCollectionKeyTypes,dU as InputTypes,eR as InstallationMethod,eS as InstallationStatus,n as InstrumentationRuleType,eT as IntrumentationStatus,J as JavaCustomProbe,eU as JsonOperation,ab as K8sAttributesFrom,K as K8sResourceKind,eV as K8sWorkloadContainerAgentConfigTracesHeadSamplingSpanMetricsMode,eW as ListDirection,eX as NumberOperation,eY as OtelDistroName,eZ as OtherEntityTypes,aw as PayloadCollectionKeyTypes,c as PlatformType,e_ as PodContainerLifecycleStatus,e$ as PodContainerStatus,f0 as PodPhase,f1 as Profile,bt as ProgrammingLanguages,f2 as SIGNAL_KEY_TO_TYPE,f3 as SIGNAL_TYPE_TO_KEY,f4 as SignalKey,S as SignalType,f5 as SortDirection,o as StatusType,f6 as StringOperation,b as Tier,f7 as WorkloadRolloutReason,dx as WorkloadRolloutStatus}from"./chunks/ui-components-BDSEcaSZ.js";import"react/jsx-runtime";import"styled-components";import"./icons.js";import"zustand";import"react";import"javascript-time-ago";import"javascript-time-ago/locale/en";import"prism-react-renderer";import"./chunks/vendor-BFqT13Me.js";import"zustand/middleware";import"react-error-boundary";import"react-dom";import"virtua";
1
+ export{f as ActionKeyTypes,g as ActionType,eS as AgentInjectedReason,eT as BooleanOperation,a$ as CloudConnectorFeatureKey,ax as CodeAttributesKeyTypes,eU as ConditionType,_ as Crud,C as CustomInstrumentationsKeyTypes,bg as DesiredStateProgress,eV as DestinationTypes,E as EntityTypes,aj as ExtractionDataFormat,l as FieldTypes,G as GolangCustomProbe,H as HeadersCollectionKeyTypes,b3 as InputTypes,eW as InstallationMethod,eX as InstallationStatus,n as InstrumentationRuleType,eY as IntrumentationStatus,J as JavaCustomProbe,eZ as JsonOperation,ac as K8sAttributesFrom,K as K8sResourceKind,e_ as K8sWorkloadContainerAgentConfigTracesHeadSamplingSpanMetricsMode,e$ as ListDirection,f0 as NumberOperation,f1 as OtelDistroName,f2 as OtherEntityTypes,ay as PayloadCollectionKeyTypes,c as PlatformType,f3 as PodContainerLifecycleStatus,f4 as PodContainerStatus,f5 as PodPhase,f6 as Profile,by as ProgrammingLanguages,f7 as SIGNAL_KEY_TO_TYPE,f8 as SIGNAL_TYPE_TO_KEY,f9 as SignalKey,S as SignalType,fa as SortDirection,o as StatusType,fb as StringOperation,b as Tier,fc as WorkloadRolloutReason,dD as WorkloadRolloutStatus}from"./chunks/ui-components-BDtk3K99.js";import"react/jsx-runtime";import"styled-components";import"./icons.js";import"zustand";import"react";import"javascript-time-ago";import"javascript-time-ago/locale/en";import"prism-react-renderer";import"./chunks/vendor-BFqT13Me.js";import"zustand/middleware";import"react-error-boundary";import"react-dom";import"virtua";
package/lib/visuals.js CHANGED
@@ -1 +1 @@
1
- export{f8 as VISUAL_ODIGOS_LOGO_HEIGHT,f9 as VISUAL_ODIGOS_LOGO_WIDTH,eL as VisualGreenRings,fa as VisualOdigosLogo,c8 as VisualPurpleRings}from"./chunks/ui-components-BDSEcaSZ.js";import"react/jsx-runtime";import"styled-components";import"./icons.js";import"zustand";import"react";import"javascript-time-ago";import"javascript-time-ago/locale/en";import"prism-react-renderer";import"./chunks/vendor-BFqT13Me.js";import"zustand/middleware";import"react-error-boundary";import"react-dom";import"virtua";
1
+ export{fd as VISUAL_ODIGOS_LOGO_HEIGHT,fe as VISUAL_ODIGOS_LOGO_WIDTH,dZ as VisualGreenRings,ff as VisualOdigosLogo,cd as VisualPurpleRings}from"./chunks/ui-components-BDtk3K99.js";import"react/jsx-runtime";import"styled-components";import"./icons.js";import"zustand";import"react";import"javascript-time-ago";import"javascript-time-ago/locale/en";import"prism-react-renderer";import"./chunks/vendor-BFqT13Me.js";import"zustand/middleware";import"react-error-boundary";import"react-dom";import"virtua";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@odigos/ui-kit",
3
- "version": "0.0.261",
3
+ "version": "0.0.263-dev.519",
4
4
  "author": "Odigos",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -1,155 +0,0 @@
1
- import{az as e,L as a,l as t,ac as l,ad as r,dT as n,V as i,aP as s,ar as o,aa as d,s as c,ae as u,am as p,dU as h,B as g,z as m,dV as v,dW as f,n as b,C as y,J as x,G as C,H as S,aw as $,au as k,b4 as w,b as T,a7 as P,a8 as A,y as M,M as L,aI as O,dX as I,dY as D,aV as z,dZ as X,T as N,d_ as H,O as R,a as B,d$ as E,e0 as V,e1 as j,e2 as G,e3 as q,e4 as J,aj as U,e5 as K,e6 as W,e7 as Y,e8 as F,e9 as Z,bV as Q,ea as _,eb as ee,ec as ae,ed as te,ee as le,ef as re,eg as ne,eh as ie,ei as se,ej as oe,ek as de,el as ce,em as ue,en as pe,eo as he,ep as ge,bF as me,eq as ve,er as fe,es as be,et as ye,eu as xe,ev as Ce,ew as Se,ex as $e,ey as ke,a_ as we,Y as Te,ez as Pe,o as Ae,eA as Me,b5 as Le,eB as Oe,eC as Ie,eD as De,eE as ze,bt as Xe,ay as Ne,eF as He,eG as Re,eH as Be,dh as Ee,eI as Ve,eJ as je,eK as Ge,e as qe,df as Je,a9 as Ue,eL as Ke,Q as We,aO as Ye,N as Fe,af as Ze,aS as Qe,du as _e,U as ea,bl as aa,bh as ta,bY as la,eM as ra}from"./ui-components-BDSEcaSZ.js";import{G as na,C as ia,H as sa,u as oa,I as da,h as ca,f as ua,e as pa,j as ha,k as ga,l as ma,i as va,m as fa}from"./odigos-context-BYgtdAtj.js";import{jsx as ba,jsxs as ya,Fragment as xa}from"react/jsx-runtime";import Ca,{useMemo as Sa,useCallback as $a,useState as ka,useEffect as wa,useRef as Ta,forwardRef as Pa,useImperativeHandle as Aa}from"react";import Ma,{useTheme as La}from"styled-components";import{EditIcon as Oa,OdigosLogoTextCentral as Ia,OdigosLogoTextEnterprise as Da,OdigosLogoTextCommunity as za,OdigosLogoTextColoredCentral as Xa,OdigosLogoTextColoredEnterprise as Na,OdigosLogoTextColoredCommunity as Ha,ArrowLeftIcon as Ra,ArrowRightIcon as Ba,VSquareIcon as Ea,VIcon as Va,CopyIcon as ja,YamlIcon as Ga}from"../icons.js";const qa=({isOpen:t,onClose:l,onDeny:r,onApprove:n})=>ba(e,{title:"Discard changes?",description:"You have unsaved changes.\nIf you cancel now, your changes won't be saved.",isOpen:t,onClose:l,denyButton:{label:"Keep editing",variant:a.Secondary,onClick:()=>{r?.(),l()}},approveButton:{label:"Discard changes",variant:a.Primary,onClick:()=>{n?.(),l()}}}),Ja=({isOpen:t,onClose:l,onDeny:r,onApprove:n,action:i="delete",target:s,description:o,overrideApproveButtonLabel:d,overrideDenyButtonLabel:c})=>{const u=i.charAt(0).toUpperCase()+i.substring(1),p=s?.endsWith("s")?"these":"this";return ba(e,{title:`${u}${s?` ${s}`:""}?`,description:o??`Are you sure you want to ${i}${s?` ${p} ${s}`:""}?`,isOpen:t,onClose:l,denyButton:{label:c??"Go back",variant:a.Secondary,onClick:()=>{r?.(),l()}},approveButton:{label:d??u,variant:a.Primary,onClick:()=>{n?.(),l()}}})},Ua=({componentType:e,inputType:a,name:g,label:m,tooltip:v,badge:f,placeholder:b,required:y,disabled:x,value:C,setValue:S,errorMessage:$,warnMessage:k,helpMessage:w,dropdownOptions:T,dropdownNoSearch:P,dropdownNoCheckbox:A,timeUnits:M,timeDefaultUnit:L})=>{switch(e){case t.Input:return ba(p,{name:g,type:a,label:m,tooltip:v,badge:f,placeholder:b,required:y,disabled:x,value:C??"",onChange:e=>{const t=e.target.value;S(a===h.Number?""===t?null:Number(t):t)},errorMessage:$,warnMessage:k,helpMessage:w},g);case t.MultiInput:return ba(u,{name:g,label:m,tooltip:v,badge:f,placeholder:b,required:y,disabled:x,values:Array.isArray(C)?C:c(C,[]),setValues:e=>S(e),errorMessage:$,warnMessage:k,helpMessage:w},g);case t.KeyValuePair:return ba(d,{name:g,label:m,tooltip:v,badge:f,required:y,disabled:x,limitFieldsPerRow:2,columns:[{keyName:"key",label:"Key",placeholder:"Key"},{keyName:"value",label:"Value",placeholder:"Value"}],values:Array.isArray(C)?C:c(C,[]),setValues:e=>S(e),errorMessage:$,warnMessage:k,helpMessage:w},g);case t.TextArea:return ba(o,{name:g,label:m,tooltip:v,badge:f,required:y,disabled:x,placeholder:b,value:C??"",onChange:e=>S(e.target.value),errorMessage:$,warnMessage:k,helpMessage:w},g);case t.Dropdown:return ba(s,{name:g,label:m,tooltip:v,badge:f,placeholder:b,required:y,disabled:x,withSearch:!P,options:T?.map(e=>({id:e.id||"",label:e.label||"",withCheckbox:!A}))||[],values:C?[String(C)]:[],setValues:e=>S(e[0]),errorMessage:$,warnMessage:k,helpMessage:w},g);case t.Checkbox:return ba(i,{name:g,label:m,tooltip:v,badge:f,value:!0===C||"true"===C,onChange:e=>S(e),disabled:x,errorMessage:$,warnMessage:k,helpMessage:w},g);case t.Time:return ba(n,{name:g,label:m,tooltip:v,badge:f,placeholder:b,required:y,disabled:x,value:C??"",setValue:e=>S(e),units:M,defaultUnit:L,errorMessage:$,warnMessage:k,helpMessage:w},g);case t.Toggle:return ba(l,{name:g,labelAlign:r.Right,label:m,tooltip:v,badge:f,value:!0===C||"true"===C,onChange:e=>S(e),disabled:x,errorMessage:$,warnMessage:k,helpMessage:w},g);default:return null}},Ka=Ma.div`
2
- display: flex;
3
- align-items: center;
4
- gap: 24px;
5
- padding: 8px 16px;
6
- border-radius: 12px;
7
- background-color: ${({theme:e})=>e.v2.colors.silver[800]};
8
- `,Wa=Ma.div`
9
- flex: 1;
10
- min-width: 0;
11
- white-space: pre;
12
- overflow-x: auto;
13
- `,Ya=({title:e,summary:t,onEdit:l,renderAction:r})=>{const n=Sa(()=>{const a=[];return e&&(a.push({text:e,variant:na.Default}),a.push({text:" - ",variant:na.Default})),a.push(...t),a},[e,t]);return ya(Ka,{children:[ba(Wa,{children:ba(ia,{parts:n})}),r&&r(),l&&ba(g,{"data-id":"sampling-btn-edit-auto-rule",label:v,rightIcon:Oa,variant:a.Text,size:m.S,onClick:l})]})},Fa={[$.HttpRequest]:"HTTP request",[$.HttpResponse]:"HTTP response",[$.DbQuery]:"DB query",[$.Messaging]:"messaging"};function Za(e,a,t){return 1===e?a:t??`${a}s`}function Qa(e,a){const t=[],l=e.slice(0,3),r=e.slice(3);return l.forEach((e,l)=>{l>0&&t.push({text:", ",variant:na.Default}),t.push({text:e,variant:a})}),r.length>0&&t.push({text:` + ${r.length} more`,variant:na.Default,tooltipItems:r}),t}function _a(e,a){switch(e){case b.CodeAttributes:return function(e){const a=Object.values(k).filter(a=>!!e.codeAttributes?.[a]).map(e=>w(e).toLowerCase());return a.length?[{text:"Collect",variant:na.Action},{text:" ",variant:na.Default},...Qa(a,na.Endpoint)]:null}(a);case b.PayloadCollection:return function(e){const a=Object.values($).filter(a=>null!=e.payloadCollection?.[a]).map(e=>Fa[e]);return a.length?[{text:"Collect",variant:na.Action},{text:" ",variant:na.Default},...Qa(a,na.Endpoint)]:null}(a);case b.HeadersCollection:return function(e){const a=(e.headersCollection?.[S.HeaderKeys]??[]).map(e=>e.trim()).filter(e=>e.length>0);if(!a.length)return null;const t=Za(a.length,"HTTP header");return[{text:`Collect ${a.length} ${t}`,variant:na.Action},{text:"",variant:na.Default,tooltipItems:a}]}(a);case b.CustomInstrumentation:return function(e){const a=(e.customInstrumentations?.[y.Java]??[]).map(e=>new x(e.className,e.methodName)).filter(e=>e.Verify()),t=(e.customInstrumentations?.[y.Golang]??[]).map(e=>new C(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)).filter(e=>e.Verify());if(!(a.length+t.length))return null;const l=[];a.length&&l.push(`${a.length} Java ${Za(a.length,"probe")}`),t.length&&l.push(`${t.length} Go ${Za(t.length,"probe")}`);const r=[...a.map(e=>`Java: ${e.toString()}`),...t.map(e=>`Go: ${e.toString()}`)];return[{text:`Apply ${l.join(" + ")}`,variant:na.Action},{text:"",variant:na.Default,tooltipItems:r}]}(a);default:return null}}const et=({option:e,formState:a,renderAction:t})=>{const l=Sa(()=>{const t=_a(e?.type,a);return t?[...t,...sa(a.sourceScopes)]:[]},[e?.type,a]),r=0===l.length;return ba(Ya,{title:r?f:"Instrumentation Rule Preview",summary:l,renderAction:t})},at=({size:e=200,central:a=!1,useInline:t=!1})=>{const{tier:l}=oa();if(t){if(a)return ba(Ia,{size:e});switch(l){case T.Community:return ba(za,{size:e});case T.Onprem:return ba(Da,{size:e});default:return null}}if(a)return ba(Xa,{size:e});switch(l){case T.Community:return ba(Ha,{size:e});case T.Onprem:return ba(Na,{size:e});default:return null}},tt=[{value:"50",label:"50%"},{value:"25",label:"25%"},{value:"10",label:"10%"},{value:"1",label:"1%"},{value:"custom",label:"Custom"}],lt=[{value:"10",label:"10%"},{value:"1",label:"1%"},{value:"0.5",label:"0.5%"},{value:"0.1",label:"0.1%"},{value:"custom",label:"Custom"}],rt=[{value:"5000",label:"5s"},{value:"1000",label:"1s"},{value:"500",label:"500ms"},{value:"100",label:"100ms"},{value:"50",label:"50ms"},{value:"custom",label:"Custom"}],nt=({description:e,options:a,selected:t,onSelect:l,customName:r,customLabel:n,customPlaceholder:i,customValue:s,onCustomChange:o,customInputType:d=h.Number,customMin:c,customMax:u})=>ya(P,{$gap:6,children:[ba(A,{label:e}),ya(M,{$gap:8,$alignItems:"flex-end",children:[ba(L,{options:a,selected:t,setSelected:l}),"custom"===t&&ba(p,{name:r,label:n,placeholder:i,type:d,value:s,onChange:o,width:160,min:c,max:u})]})]}),it=()=>{},st=e=>e.readOnly?ba(ot,{rule:e.rule}):ba(dt,{ruleType:e.ruleType,formState:e.formState,onChange:e.onChange}),ot=({rule:e})=>{const a=null!=e.durationAtLeastMs;return e.error?ba(O,{richTitle:{title:I},children:ba(l,{name:"sampling-view-toggle-keep-errors",onChange:it,value:!0,size:z.S,label:D,labelAlign:r.Right})}):a?ba(O,{richTitle:{title:X},children:ya("div",{children:[ba(N,{size:B.XXXS,color:R.Secondary,children:H}),ba(N,{size:B.XS,children:`${e.durationAtLeastMs}ms`})]})}):null},dt=({ruleType:e,formState:a,onChange:t})=>{const l=$a(e=>t({durationPreset:e}),[t]),r=$a(e=>t({customDurationMs:e.target.value}),[t]);return"Duration"===e?ba(O,{richTitle:{title:X,subTitle:E},children:ba(nt,{description:H,options:rt,selected:a.durationPreset,onSelect:l,customName:"sampling-input-custom-duration",customLabel:V,customPlaceholder:"200ms",customValue:a.customDurationMs,onCustomChange:r})}):null},ct=Ma.div`
14
- display: flex;
15
- gap: 32px;
16
- `,ut=Ma.div`
17
- display: flex;
18
- flex-direction: column;
19
- gap: 4px;
20
- `,pt=Ma.div`
21
- display: flex;
22
- flex-wrap: wrap;
23
- align-items: flex-end;
24
- gap: 16px;
25
- `,ht=Ma.div`
26
- display: flex;
27
- align-items: flex-end;
28
- gap: 16px;
29
- padding: 12px 16px;
30
- border-radius: 8px;
31
- background-color: ${({theme:e})=>e.v2.colors.black[500]};
32
- `,gt=Ma.div`
33
- display: flex;
34
- align-items: flex-end;
35
- gap: 10px;
36
- flex: 1;
37
- `,mt=Ma.div`
38
- display: flex;
39
- align-items: center;
40
- height: 32px;
41
- `,vt=Ma.div`
42
- display: flex;
43
- align-items: flex-end;
44
- gap: 16px;
45
- margin-bottom: 12px;
46
- `,ft="Any",bt="Kafka topic",yt=()=>ba("div",{style:{marginBottom:"8px"},children:ba(N,{size:B.XS,weight:500,children:"And"})}),xt=[{value:"all",label:"All Operations"},{value:"httpServer",label:"HTTP Server"},{value:"httpClient",label:"HTTP Client"}],Ct=[{value:"all",label:"All Operations"},{value:"httpServer",label:"HTTP Server"},{value:"kafkaConsumer",label:"Kafka Consumer"},{value:"kafkaProducer",label:"Kafka Producer"}],St=[{id:"",label:ft},{id:"GET",label:"GET"},{id:"POST",label:"POST"},{id:"PUT",label:"PUT"},{id:"DELETE",label:"DELETE"},{id:"PATCH",label:"PATCH"}];const $t=e=>e.readOnly?ba(kt,{data:e.data}):ba(wt,{category:e.category,formState:e.formState,onChange:e.onChange}),kt=({data:e})=>{const a=Sa(()=>function(e){if("noisy"===e.category){const a=e.rule.operation;if(a?.httpServer)return[{id:"type",title:te,value:ae},{id:"route",title:Y,value:a.httpServer.route||a.httpServer.routePrefix||le},{id:"method",title:_,value:a.httpServer.method||ft}];if(a?.httpClient){const e=[{id:"type",title:te,value:re}];return a.httpClient.serverAddress&&e.push({id:"serverAddress",title:"Server address",value:a.httpClient.serverAddress}),e.push({id:"route",title:Y,value:a.httpClient.templatedPath||a.httpClient.templatedPathPrefix||le}),e.push({id:"method",title:_,value:a.httpClient.method||ft}),e}return[{id:"type",title:te,value:ne}]}const a=e.rule.operation;return a?.httpServer?[{id:"type",title:te,value:ae},{id:"route",title:Y,value:a.httpServer.route||a.httpServer.routePrefix||le},{id:"method",title:_,value:a.httpServer.method||ft}]:a?.kafkaConsumer?[{id:"type",title:te,value:ie},{id:"topic",title:bt,value:a.kafkaConsumer.kafkaTopic||le}]:a?.kafkaProducer?[{id:"type",title:te,value:se},{id:"topic",title:bt,value:a.kafkaProducer.kafkaTopic||le}]:[{id:"type",title:te,value:ne}]}(e),[e]);return ba(O,{richTitle:{title:j},children:ba(ct,{children:a.map(({id:e,title:a,value:t})=>ya(ut,{children:[ba(N,{size:B.XXXS,color:R.Secondary,nowrap:!0,children:a}),ba(N,{size:B.XS,nowrap:!0,children:t})]},e))})})},wt=({category:e,formState:t,onChange:l})=>{const r=Sa(()=>"noisy"===e?xt:Ct,[e]),n=$a(e=>l({operationType:e,route:"",serverAddress:"",method:"",kafkaTopic:""}),[l]),i=$a(e=>a=>{a&&l({routeType:e,route:""})},[l]),s=$a(e=>l({route:e.target.value}),[l]),o=$a(e=>l({serverAddress:e.target.value}),[l]),d=$a(e=>l({method:e[0]||""}),[l]),c=$a(e=>l({kafkaTopic:e.target.value}),[l]),u="httpServer"===t.operationType||"httpClient"===t.operationType,h="kafkaConsumer"===t.operationType||"kafkaProducer"===t.operationType,g="httpClient"===t.operationType?W:Y,v="httpClient"===t.operationType?F:Z;return ya(O,{richTitle:{title:`2. ${j}`,subTitle:G},children:[ba(P,{$alignItems:"flex-start",children:ba(L,{options:r,selected:t.operationType,setSelected:n})}),u&&ya(pt,{children:["httpClient"===t.operationType&&ya(vt,{children:[ba(p,{name:"sampling-input-server-address",label:J,placeholder:q,value:t.serverAddress,onChange:o}),ba(yt,{})]}),ya(ht,{children:[ya(gt,{children:[ba(mt,{children:ba(U,{"data-id":"sampling-radio-route",value:"route"===t.routeType,onChange:i("route")})}),ba(p,{name:"sampling-input-route",label:g,placeholder:K,value:"route"===t.routeType?t.route:"",onChange:s,disabled:"route"!==t.routeType})]}),ya(gt,{children:[ba(mt,{children:ba(U,{"data-id":"sampling-radio-route-prefix",value:"routePrefix"===t.routeType,onChange:i("routePrefix")})}),ba(p,{name:"sampling-input-route-prefix",label:v,placeholder:K,value:"routePrefix"===t.routeType?t.route:"",onChange:s,disabled:"routePrefix"!==t.routeType})]})]}),ya(vt,{children:[ba(yt,{}),ba(Q,{label:_,items:St,selectedIds:[t.method||""],setSelectedIds:e=>d(e),buttonProps:{"data-id":"sampling-btn-method",label:St.find(e=>e.id===t.method)?.label||ft,size:m.S,variant:a.Secondary}})]})]}),h&&ba(p,{name:"sampling-input-kafka-topic",label:ee,placeholder:"Type kafka topic",value:t.kafkaTopic,onChange:c,width:"320px"})]})},Tt=[{value:"all",label:"Drop All"},{value:"sample",label:"Sample"}],Pt=[{value:"all",label:"Keep All"},{value:"sample",label:"Sample"}];const At=e=>e.readOnly?ba(Mt,{data:e.data}):ba(Lt,{category:e.category,formState:e.formState,onChange:e.onChange}),Mt=({data:e})=>{const a=Sa(()=>function(e){switch(e.category){case"highlyRelevant":return null!=e.rule.percentageAtLeast?{title:de,method:pe,description:ce,value:`${e.rule.percentageAtLeast}%`}:{title:de,method:ge,description:null,value:null};case"noisy":return da(e.rule.percentageAtMost)?{title:de,method:he,description:null,value:null}:{title:de,method:pe,description:ue,value:`${e.rule.percentageAtMost}%`};case"costReduction":return{title:de,method:pe,description:ue,value:`${e.rule.percentageAtMost}%`}}}(e),[e]),t=[{id:"method",title:_,value:a.method},...null!=a.description?[{id:"value",title:a.description,value:a.value}]:[]];return ba(O,{richTitle:{title:a.title},children:ba(ct,{children:t.map(({id:e,title:a,value:t})=>ya(ut,{children:[ba(N,{size:B.XXXS,color:R.Secondary,nowrap:!0,children:a}),ba(N,{size:B.XS,nowrap:!0,children:t})]},e))})})},Lt=({category:e,formState:a,onChange:t})=>{const l="highlyRelevant"===e,r=l?Pt:Tt,n=`${l?4:3}. ${de}`,i=oe[e],s=l?ce:ue,o="noisy"===e?lt:tt,d=$a(e=>t({percentageMode:e}),[t]),c=$a(e=>t({percentagePreset:e}),[t]),u=$a(e=>t({customPercentage:e.target.value}),[t]);return ya(O,{richTitle:{title:n,subTitle:i},children:["costReduction"!==e&&ba(P,{$alignItems:"flex-start",children:ba(L,{options:r,selected:a.percentageMode,setSelected:d})}),("costReduction"===e||"sample"===a.percentageMode)&&ba(nt,{description:s,options:o,selected:a.percentagePreset,onSelect:c,customName:"sampling-input-custom-percentage",customPlaceholder:"5%",customValue:a.customPercentage,onCustomChange:u,customInputType:h.Decimal,customMin:0,customMax:100})]})},Ot=Ma.div`
47
- display: flex;
48
- align-items: flex-end;
49
- gap: 16px;
50
- `,It=Ma.div`
51
- width: 280px;
52
- flex-shrink: 0;
53
- `,Dt=Ma.div`
54
- flex: 1;
55
- min-width: 0;
56
- `;function zt(e){return"highlyRelevant"===e.category?e.rule.error?"Error":null!=e.rule.durationAtLeastMs?"Duration":"Relevance":Se[e.category]}const Xt=e=>e.readOnly?ba(Nt,{data:e.data}):ba(Ht,{formState:e.formState,onChange:e.onChange}),Nt=({data:e})=>{const a=Sa(()=>[{id:"name",title:ve,value:e.rule.name||me},{id:"type",title:fe,value:zt(e)}],[e]),t=e.rule.notes||le;return ya(O,{children:[ba(ct,{children:a.map(({id:e,title:a,value:t})=>ya(ut,{children:[ba(N,{size:B.XXXS,color:R.Secondary,nowrap:!0,children:a}),ba(N,{size:B.XS,nowrap:!0,children:t})]},e))}),ya(ut,{children:[ba(N,{size:B.XXXS,color:R.Secondary,children:be}),ba(N,{size:B.XS,children:t})]})]})},Ht=({formState:e,onChange:a})=>{const t=$a(e=>a({name:e.target.value}),[a]),l=$a(e=>a({notes:e.target.value}),[a]);return ba(O,{children:ya(Ot,{children:[ba(It,{children:ba(p,{name:"sampling-input-rule-name",label:ve,tooltip:"Optional. Give this rule a name for easier identification.",placeholder:ye,value:e.name,onChange:t})}),ba(Dt,{children:ba(p,{name:"sampling-input-note",label:be,tooltip:Ce,placeholder:xe,value:e.notes,onChange:l})})]})})},Rt=[{value:"Relevance",label:"Relevance"},{value:"Error",label:"Error"},{value:"Duration",label:"Duration"}],Bt=({formState:e,onChange:a})=>{const t=$a(e=>a({ruleType:e,keepErrors:"Error"===e}),[a]);return ba(O,{richTitle:{title:`3. ${fe}`,subTitle:$e},children:ba(P,{$alignItems:"flex-start",children:ba(L,{options:Rt,selected:e.ruleType,setSelected:t})})})},Et=e=>{const a=Sa(()=>{if(e.readOnly)return e.summary;switch(e.category){case"noisy":return pa(ma(e.formState));case"highlyRelevant":return ua(ga(e.formState));case"costReduction":return ca(ha(e.formState))}},[e]);if(e.readOnly)return ba(Ya,{title:ke,summary:a,renderAction:e.renderAction});const t=1===a.length&&"default"===a[0].variant;return ba(Ya,{title:t?f:ke,summary:t?[]:a,renderAction:e.renderAction})},Vt=Ma.div`
57
- display: flex;
58
- flex-wrap: wrap;
59
- gap: 8px;
60
- `,jt=Ma.div`
61
- display: flex;
62
- align-items: center;
63
- gap: 8px;
64
- padding: 8px 12px;
65
- border-radius: 8px;
66
- cursor: pointer;
67
- background: ${({theme:e,$selected:a})=>a?e.v2.colors.silver[700]:e.v2.colors.silver[800]};
68
- border: 1px solid ${({theme:e,$selected:a})=>a?e.v2.colors.silver[500]:e.v2.colors.silver[750]};
69
-
70
- &:hover {
71
- background: ${({theme:e})=>e.v2.colors.silver[700]};
72
- }
73
- `,Gt=Ma.div`
74
- display: flex;
75
- width: 32px;
76
- height: 32px;
77
- justify-content: center;
78
- align-items: center;
79
- flex-shrink: 0;
80
- `,qt=Ma.div`
81
- display: flex;
82
- flex-direction: column;
83
- gap: 12px;
84
- `,Jt=Ma.div`
85
- display: flex;
86
- flex-wrap: wrap;
87
- gap: 6px;
88
- `,Ut=Ma.div`
89
- display: flex;
90
- align-items: center;
91
- gap: 8px;
92
- &::before,
93
- &::after {
94
- content: '';
95
- flex: 1;
96
- height: 1px;
97
- background-color: ${({theme:e})=>e.v2.colors.silver[700]};
98
- }
99
- `,Kt=Ma.div`
100
- padding: 2px 10px;
101
- border-radius: 999px;
102
- background-color: ${({theme:e})=>e.v2.colors.silver[700]};
103
- border: 1px solid ${({theme:e})=>e.v2.colors.silver[600]};
104
- `,Wt={[Xe.JavaScript]:"Node.js",[Xe.DotNet]:".NET",[Xe.Php]:"PHP",[Xe.Java]:"Java",[Xe.Go]:"Go",[Xe.Python]:"Python",[Xe.Ruby]:"Ruby",[Xe.Rust]:"Rust"},Yt=[Xe.Python,Xe.Java,Xe.JavaScript,Xe.DotNet,Xe.Php,Xe.Ruby,Xe.Go],Ft=[{value:"all",label:"Entire Cluster"},{value:"source",label:"Specific Source"},{value:"namespace",label:"Specific Namespace"},{value:"language",label:"Specific Programming Language"}];function Zt(e){const a=Wt[e];return a||e.charAt(0).toUpperCase()+e.slice(1)}function Qt(e){return null!=e?`${e}. ${Ge}`:Ge}const _t=({readOnly:e,...a})=>ba(e?tl:rl,{...a}),el=({title:e,count:a,children:t})=>ya(P,{$gap:6,children:[ya(M,{$gap:8,$alignItems:"center",children:[ba(N,{size:B.XS,color:R.Primary,nowrap:!0,children:e}),a>1&&ya(N,{size:B.XXS,color:R.Secondary,nowrap:!0,children:["(",Ve,")"]})]}),ba(Jt,{children:t})]}),al=()=>{const e=La();return ba(Ut,{children:ba(Kt,{children:ba(N,{size:B.XXS,color:e.v2.colors.white[500],nowrap:!0,children:je})})})},tl=({scopes:e,titleNumber:a})=>{const t=Qt(a);if(va(e))return ba(we,{bgTint:"900",richTitle:{title:t},withCollapse:!0,collapseIsDefaultOpen:!0,children:ba(Te,{status:Ae.Default,message:Pe,fullWidth:!0})});const l=e.sources??[],r=e.namespaces??[],n=e.languages??[],i=[];return l.length&&i.push({kind:"sources",node:ba(el,{title:Me,count:l.length,children:l.map((e,a)=>{const t=[e.namespace,e.kind,e.name].filter(Boolean),l=t.length?t.join(" / "):Oe;return ba(Le,{label:l},`src-${a}-${l}`)})})}),r.length&&i.push({kind:"namespaces",node:ba(el,{title:Ie,count:r.length,children:r.map((e,a)=>ba(Le,{label:e},`ns-${a}-${e}`))})}),n.length&&i.push({kind:"languages",node:ba(el,{title:De,count:n.length,children:n.map((e,a)=>{const t=Ne(e);return ba(Le,{label:Zt(e),leftIcon:t},`lang-${a}-${e}`)})})}),ba(we,{bgTint:"900",richTitle:{title:t,subTitle:i.length>1?ze:void 0},withCollapse:!0,collapseIsDefaultOpen:!0,children:ba(we,{bgTint:"800",children:ba(qt,{children:i.map((e,a)=>ya(Ca.Fragment,{children:[a>0&&ba(al,{}),e.node]},e.kind))})})})},ll=e=>e.sources.length>0?"source":e.namespaces.length>0?"namespace":e.languages.length>0?"language":"all",rl=({scopes:e,onChange:a,sourceOptions:t=[],namespaceOptions:l=[],supportedLanguages:r,titleNumber:n,dataIdPrefix:s="source-scope",slim:o})=>{const d=e??fa(),[c,u]=ka(()=>ll(d)),{sources:p,namespaces:h,languages:g}=d,m=p.length>0||h.length>0||g.length>0;wa(()=>{m&&"all"===c&&u(ll(d))},[m,c]);const v=Sa(()=>Ft.map(e=>"language"===e.value&&0===r?.length?null:{...e,disabled:"all"===e.value&&m}).filter(Boolean),[m]),f=Sa(()=>p.map(e=>{return a=e.namespace,t=e.kind,l=e.name,`${a}/${t}/${l}`;var a,t,l}),[p]),b=Sa(()=>[...h],[h]),y=Sa(()=>new Set(g),[g]),x=$a(e=>{u(e)},[]),C=$a(e=>{const t=e.map(e=>function(e){const a=e.split("/");return 3!==a.length?null:{namespace:a[0],kind:a[1],name:a[2]}}(e)).filter(e=>null!=e).map(e=>({namespace:e.namespace,kind:e.kind,name:e.name}));a({...d,sources:t})},[d,a]),S=$a(e=>{a({...d,namespaces:e})},[d,a]),$=$a(e=>{const t=d.languages,l=t.includes(e)?t.filter(a=>a!==e):[...t,e];a({...d,languages:l})},[d,a]),k=!m&&"all"===c,w=(r||Yt).map(e=>({id:e,label:Wt[e]??e.charAt(0).toUpperCase()+e.slice(1),Icon:Ne(e)}));return ya(O,{richTitle:o?{title:Qt(n),titleSize:B.XS,titleColor:R.Secondary,tooltip:He}:{title:Qt(n),subTitle:He,subTitleWrap:!0},backgroundColor:o?"transparent":void 0,padding:o?0:void 0,children:[ba(Te,k?{status:Ae.Default,message:Pe,fullWidth:!0,smallIcon:!0}:{status:Ae.Info,message:ze,fullWidth:!0,smallIcon:!0}),ba(P,{$alignItems:"flex-start",children:ba(L,{options:v,selected:c,setSelected:x})}),"source"===c&&ba(Re,{multiple:!0,"data-id":`${s}-autocomplete-source`,options:t,value:f,onSelect:C,placeholder:Be}),"namespace"===c&&ba(Re,{multiple:!0,"data-id":`${s}-autocomplete-namespace`,options:l,value:b,onSelect:S,placeholder:"Search namespace"}),"language"===c&&w.length>0&&ba(Vt,{children:w.map(({id:e,label:a,Icon:t})=>{const l=y.has(e);return ya(jt,{$selected:l,onClick:()=>$(e),children:[ba(i,{name:`${s}-lang-${e}`,size:Ee.S,value:l,onChange:()=>$(e)}),ba(Gt,{children:ba(t,{size:20})}),ba(N,{size:B.XS,nowrap:!0,children:a})]},e)})})]})},nl=(e,a)=>!a?.length||!!a?.find(a=>a===e),il=({title:e="Signals",required:a,errorMessage:t,allowedSignals:l,selectedSignals:r,setSelectedSignals:n,disabled:s})=>{const[o,d]=ka(1===r.length),c=Ta(JSON.stringify(r));wa(()=>{let e=qe(r).filter(e=>nl(e,l));e.length||(e=Je.filter(({id:e})=>nl(e,l)).map(({id:e})=>e));const a=JSON.stringify(e);c.current!==a&&(c.current=a,n(e),d(1===e.length))},[l,r]);return ya(P,{$gap:12,children:[ba(A,{label:e,required:a}),ba(M,{$gap:12,children:Je.map(e=>{const a=nl(e.id,l),t=((e,a)=>!!a?.find(a=>a===e))(e.id,r);return a?ba(i,{label:e.value,disabled:s||!a||o&&t,value:t,onChange:a=>((e,a)=>{const t=e,l=a?[...r,t]:r.filter(e=>e!==t);n(l),d(1===l.length)})(e.id,a)},e.id):null})}),ba(Ue,{errorMessage:t})]})},sl=({minSupportedVersion:a,currentVersion:t})=>ba(e,{isOpen:!0,onClose:()=>{},relativeToParent:!0,visual:()=>ba(Ke,{scale:2.4,icon:()=>ba("svg",{xmlns:"http://www.w3.org/2000/svg",width:"22",height:"21",viewBox:"0 0 22 21",fill:"none",children:ba("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${a} or later.\nCurrent version: ${t}.`}),ol=Ma.div`
105
- display: flex;
106
- flex-direction: column;
107
- justify-content: flex-end;
108
- width: ${({$width:e})=>e};
109
- gap: ${({$columnHasHeader:e})=>e?"0":"12px"};
110
- `,dl=Ma.div`
111
- display: flex;
112
- align-items: center;
113
- min-height: 24px;
114
- padding: 12px;
115
- border-radius: 16px 16px 0 0;
116
- background-color: ${({theme:e})=>e.v2.colors.silver[800]};
117
- `,cl=Ma.div`
118
- display: flex;
119
- flex-direction: column;
120
- gap: ${({$gap:e})=>e}px;
121
- padding: 12px 12px 0 12px;
122
- width: 100%;
123
- height: ${({$heightOffset:e,$columnHasHeader:a})=>`calc(100vh - 180px - ${e}px ${a?"- 48px":""})`};
124
- border-radius: ${({$columnHasHeader:e,$isLeft:a,$isRight:t})=>e?a?"0 0 0 16px":t?"0 16px 0 0":"0":a?"16px 0 0 16px":t?"0 16px 16px 0":"16px"};
125
- background-color: ${({theme:e})=>e.v2.colors.silver[900]};
126
- overflow-y: auto;
127
- overflow-x: hidden;
128
- `,ul=({isLeft:e,isRight:a,heightOffset:t=0,width:l,header:r,list:n})=>ya(ol,{$width:l,$columnHasHeader:!!r,children:[r&&ba(dl,{children:r}),ba(cl,{$gap:8,$isLeft:e,$isRight:a,$heightOffset:t,$columnHasHeader:!!r,children:n.length?n.length>1?ba(We,{gap:8,elements:n}):ba(xa,{children:n[0]}):ba(Ye,{$height:"100%",children:ba(Fe,{})})})]}),pl="75vw",hl=Ma.div`
129
- display: flex;
130
- flex-direction: column;
131
- border-radius: 16px;
132
- background-color: ${({theme:e})=>e.v2.colors.silver[1e3]};
133
- overflow: hidden;
134
- `,gl=Ma.div`
135
- display: flex;
136
- gap: 12px;
137
- padding: 16px 16px 0 16px;
138
- background-color: ${({theme:e})=>e.v2.colors.silver[1e3]};
139
- position: sticky;
140
- top: 0;
141
- `,ml=Ma.div`
142
- padding: 12px 12px 0 12px;
143
- `,vl=Ma.div`
144
- display: flex;
145
- gap: 12px;
146
- padding: 16px;
147
- `,fl=Ma.div`
148
- padding: 5vh 10vw;
149
- border-radius: 12px;
150
- background-color: ${({theme:e})=>e.v2.colors.silver[800]};
151
- `,bl=Pa(({isOpen:t,withOverlay:l,disableAnimation:r,onClose:n,onBack:i,onNext:s,nextIsSkip:o,onSave:d,disableSave:c,connectionIds:u,header:p,subHeader:h,leftColumn:g,rightColumn:m,search:v,filters:f,errorMessage:b,isFormDirty:y,hideDirtyNote:x,isFetching:C,progress:S},$)=>{const[k,w]=ka(!1),[T,P]=ka(!1),[A,M]=ka(void 0);Aa($,()=>({clearErrors:()=>M(void 0)}));const L=T,O=$a(()=>{y&&!k?w(!0):(w(!1),n?.())},[y,k,n]),I=c||T||"boolean"==typeof y&&!y,D=$a(async()=>{P(!0);const e=await d();P(!1),!1!==e&&(e?.error?M(e.error):(u?.setValue([]),n?.()))},[d,u,n]),z=!!v||!!u||!!f,X=!!h,N=(z?48:0)+(X?50:0),H=Sa(()=>C?{status:Ae.Info,message:"Fetching Data..."}:T&&!S?{status:Ae.Info,message:"Saving Changes..."}:A||b?{status:Ae.Error,message:A||b}:"boolean"==typeof y&&y&&!x?{status:Ae.Info,message:'The values don\'t reflect the current configurations of the selected clusters.\n"Save" will override the current configurations.'}:void 0,[C,T,S,A,b,y,x]),R=Sa(()=>i?{label:"Back",leftIcon:Ra,variant:a.Secondary,onClick:i}:{label:"Cancel",variant:a.Secondary,onClick:O,disabled:L},[i,O,L]),[E,V]=ka(!1),j=Sa(()=>s?o?{"data-id":"wide-drawer-skip",label:"Skip",rightIcon:Ba,variant:a.Secondary,onClick:()=>V(!0)}:{"data-id":"wide-drawer-next",label:"Next",rightIcon:Ba,variant:a.Primary,onClick:s}:{"data-id":"wide-drawer-save",label:"Save",variant:a.Primary,onClick:D,disabled:I},[s,o,D,I]);return ya(Ze,{width:pl,isOpen:t,disableAnimation:r,hideOverlay:!T&&!l,header:{...p,onClose:n?O:void 0,onCloseDisabled:L},footer:{note:H,actions:[R,j]},children:[T?ba(Ye,{$height:"calc(100vh - 136px)",children:ba(fl,{children:ba(Qe,{titleSize:B.S,subTitleSize:B.XXXS,withGradient:!0,withSpinner:!0,...S})})}):ya(hl,{children:[z&&ya(gl,{children:[u&&ba(_e,{icon:Ea,title:"Selected Clusters",badge:{label:u.value.length}}),v&&ba(ea,{width:"100%",...v}),f]}),X&&ba(ml,{children:ba(_e,{icon:h.icon,title:h.title,subTitle:h.description,badge:h.badge})}),ya(vl,{children:[ba(ul,{isLeft:!0,heightOffset:N,...g}),ba(ul,{isRight:!0,heightOffset:N,...m})]})]}),ba(qa,{isOpen:k,onClose:()=>w(!1),onApprove:O}),ba(e,{title:"Skip setup?",description:"Without completing setup, Odigos won't be able to collect and send your telemetry data. This may interrupt your data flow and limit the platform's ability to provide value.",isOpen:E,onClose:()=>V(!1),denyButton:{label:"Go Back",variant:a.Secondary,onClick:()=>V(!1)},approveButton:{label:"Skip",variant:a.Primary,onClick:()=>{s?.(),V(!1)}}})]})});bl.displayName=bl.name;const yl=Ma.div`
152
- padding: 0 24px;
153
- border-radius: 12px;
154
- background-color: ${({$codeBgColor:e})=>e||"transparent"};
155
- `,xl=({title:e="YAML",yaml:t,defaultOpen:l,fullHeight:r,bgTint:n="1000",codeBgColor:i})=>{const{clickCopy:s,isCopied:o}=aa(),d=Sa(()=>t?[{id:la(),type:ta.Button,buttonProps:{variant:a.Text,size:m.S,leftIcon:o?Va:ja,onClick:()=>s(t||""),disabled:o}}]:[],[t,o]);return ba(we,{bgTint:n,richTitle:{icon:Ga,title:e},actions:d,withCollapse:!0,collapseIsDefaultOpen:l,fullHeight:r,children:ba(yl,{$codeBgColor:i,children:t?ba(ra,{code:t,language:"yaml",theme:"duotoneDark"}):ba(Ye,{children:ba(Fe,{title:"YAML not found",subTitle:"The YAML for this resource is not available"})})})})};export{Ya as A,qa as C,Ua as D,et as I,lt as N,$t as O,nt as P,Xt as R,il as S,sl as U,bl as W,xl as Y,_t as a,tt as b,Et as c,Bt as d,st as e,At as f,Ja as g,at as h,pl as i,rt as j};
@@ -1 +0,0 @@
1
- import{jsx as e}from"react/jsx-runtime";import{useState as t,useCallback as a,useMemo as n,useContext as r,createContext as s,useRef as o,useEffect as i}from"react";import{d as l,e as d,A as c,f as u,g as m,i as p,F as h,h as f,j as g,D as v,m as b,S as y,s as D,k as E,l as S,I as k,H as C,C as A,G as F,J as I,n as w,K as N,b as x,E as R}from"./ui-components-BDSEcaSZ.js";import{d as P}from"./use-odigos-api-DHCLONPK.js";import{n as O,m as T,i as L,b as M,a as U,d as j,v as K,g as G,u as V}from"./odigos-context-BYgtdAtj.js";const _={type:"",disabled:!1,name:"",notes:"",signals:[],fields:{}},q=s(null),H="All row fields are required",z="At least one row is required",J=(e,t)=>!!e&&t.every(t=>{const a=e[t];return Array.isArray(a)?a.length>0:!("string"==typeof(n=a)?!n.trim():p(n));var n}),Q=({children:r})=>{const[s,o]=t(null),i=l(_),f=a(e=>{i.resetFormData(),i.handleErrorChange(void 0,void 0,{}),e?.type&&i.handleFormChange("type",e.type),o(e)},[]),g=a((e,t)=>{var a;i.resetFormData((({type:e,name:t,notes:a,disabled:n,signals:r,fields:s})=>({type:e,name:t||"",notes:a||"",disabled:!!n,signals:r??[],fields:s??{}}))(e)),i.handleErrorChange(void 0,void 0,{}),o(t??(a=e.type,c.find(e=>e.type===a)??null))},[]),v=a(()=>{if(!s)return{errorMessage:"No action type selected",preparedFormData:d(_)};const e=(e=>{const t=d(e),a=t.fields||{},n=a[u.UrlTemplatizationRulesGroups];n?.length&&(a[u.UrlTemplatizationRulesGroups]=n.map(e=>({...e,templatizationRules:(e.templatizationRules||[]).filter(e=>!!e.template?.trim())})));const r=a[u.AttributeNamesToDelete];r?.length&&(a[u.AttributeNamesToDelete]=r.filter(e=>!!e?.trim()));const s=a[u.Renames];s&&(a[u.Renames]=Object.fromEntries(Object.entries(s).filter(([e,t])=>!!e?.trim()&&!!t?.trim())));const o=a[u.ExtractAttribute];return o?.extractions?.length&&(a[u.ExtractAttribute]={extractions:o.extractions.map(e=>({targetAttributeName:e.targetAttributeName?.trim()||"",lookupKey:e.lookupKey?.trim()||"",dataFormat:e.dataFormat||"",regex:e.regex?.trim()||""})).filter(e=>!!(e.targetAttributeName||e.lookupKey||e.dataFormat||e.regex))}),t.fields=a,t})(i.formData),t={};p(e.signals)&&(t.signals=h.FIELD_IS_REQUIRED),s.type&&Object.assign(t,((e,t,a)=>{const n={},r=t.fields||{},s=a.fields||{};switch(e){case m.K8sAttributes:{const e=!(r[u.CollectContainerAttributes]||r[u.CollectReplicaSetAttributes]||r[u.CollectWorkloadId]||r[u.CollectClusterId]),t=!r[u.LabelsAttributes]?.length,a=!r[u.AnnotationsAttributes]?.length;e&&t&&a&&(n[u.CollectContainerAttributes]="Enable at least one option or add a label/annotation row");const s=r[u.LabelsAttributes];s?.some(e=>!J(e,["labelKey","attributeKey","fromSources"]))&&(n[u.LabelsAttributes]=H);const o=r[u.AnnotationsAttributes];o?.some(e=>!J(e,["annotationKey","attributeKey","fromSources"]))&&(n[u.AnnotationsAttributes]=H);break}case m.AddClusterInfo:{const e=r[u.ClusterAttributes];e?.length?e.some(e=>!J(e,["attributeName","attributeStringValue"]))&&(n[u.ClusterAttributes]=H):n[u.ClusterAttributes]=z;break}case m.DeleteAttributes:{const e=s[u.AttributeNamesToDelete]||[],t=r[u.AttributeNamesToDelete]||[];t.length?e.length>t.length&&(n[u.AttributeNamesToDelete]=H):n[u.AttributeNamesToDelete]=e.length?H:z;break}case m.RenameAttributes:{const e=Object.entries(s[u.Renames]||{}),t=Object.entries(r[u.Renames]||{}),a=e.some(([e,t])=>!e?.trim()||!t?.trim());t.length?a&&(n[u.Renames]=H):n[u.Renames]=e.length?H:z;break}case m.PiiMasking:{const e=r[u.PiiCategories];e?.length||(n[u.PiiCategories]="Select at least one attribute to mask");break}case m.URLTemplatization:{const e=r[u.UrlTemplatizationRulesGroups];(!e?.length||e.some(e=>!e.templatizationRules?.length))&&(n[u.UrlTemplatizationRulesGroups]="Each rule group needs at least one non-blank template");break}case m.ExtractAttribute:{const e=r[u.ExtractAttribute]?.extractions||[],t=s[u.ExtractAttribute]?.extractions||[];if(e.length)if(e.some(e=>{if(!e.targetAttributeName?.trim())return!0;const t=!!e.regex?.trim(),a=!!e.lookupKey?.trim();return a!==!!e.dataFormat||t===a}))n[u.ExtractAttribute]="Each row needs a target attribute name and either a regex or both lookup key and data format";else{const t=new Set;e.some(e=>{const a=e.targetAttributeName?.trim()||"";return!!t.has(a)||(t.add(a),!1)})&&(n[u.ExtractAttribute]="Each new span attribute name must be unique")}else n[u.ExtractAttribute]=t.length?H:z;break}}return n})(s.type,e,i.formData)),i.handleErrorChange(void 0,void 0,t);return{errorMessage:Object.keys(t).length>0?"Invalid form values":void 0,preparedFormData:e}},[i,s]),b=n(()=>({selectedOption:s,onSelectOption:f,loadAction:g,genericForm:i,validateFormData:v}),[s,f,g,i,v]);return e(q.Provider,{value:b,children:r})},W=()=>{const e=r(q);if(!e)throw new Error("useActionFormContext must be used within an ActionFormContextProvider");return e},$={name:""},B=s(null),X=({children:r,defaultExcludeName:s=""})=>{const{dataStreams:i}=f(),[c,u]=t(void 0),[m,p]=t(s),[v,b]=t(void 0),[y,D]=t(null),E=o(null),S=l($),k=a(e=>{S.resetFormData({name:e}),S.handleErrorChange(void 0,void 0,{}),u(void 0),p(e),b(e),D(null),E.current=null},[]),C=a(()=>{const e=d(S.formData),t=(e=>{const t={};return e.name?g(e.name)||(t.name=h.ILLEGAL_K8S_LABEL):t.name=h.FIELD_IS_REQUIRED,t})(e);S.handleErrorChange(void 0,void 0,t);const a=Object.keys(t).length>0?h.REQUIRED_FIELDS:void 0;return u(a),{errorMessage:a,preparedFormData:e}},[S]),A=a(async e=>{const{errorMessage:t,preparedFormData:a}=C();if(t)return;const n=i.find(e=>e.name===a.name&&e.name!==m);if(n)return E.current=e,void D({preparedFormData:a,existingName:n.name,editingName:v});await e(a)},[C,i,m,v]),F=a(async()=>{const e=E.current,t=y?.preparedFormData;E.current=null,D(null),e&&t&&await e(t)},[y]),I=a(()=>{E.current=null,D(null)},[]),w=n(()=>({genericForm:S,loadDataStream:k,editingName:v,validateFormData:C,requestSubmit:A,pendingMerge:y,confirmMerge:F,cancelMerge:I,errorMessage:c,excludeName:m,setExcludeName:p}),[S,k,v,C,A,y,F,I,c,m]);return e(B.Provider,{value:w,children:r})},Y=()=>{const e=r(B);if(!e)throw new Error("useDataStreamFormContext must be used within a DataStreamFormContextProvider");return e},Z={type:"",name:"",currentStreamName:"",disabled:!1,exportedSignals:{logs:!1,metrics:!1,traces:!1,profiles:!1},fields:[]},ee={activeForm:null,onChangeActiveForm:()=>{},loadDestination:()=>{},genericForm:void 0,validateFormData:()=>({isOk:!1,preparedFormData:d(Z)}),unsavedDestinations:[],thisUnsavedDestination:void 0,setUnsavedDestinations:()=>{},addUnsavedDestination:()=>{},updateUnsavedDestination:()=>{},deleteUnsavedDestination:()=>{}},te=s(ee),ae=e=>e.filter(e=>!!e).map(e=>{const{name:t,componentType:a,componentProperties:n,displayName:r,initialValue:s,renderCondition:o}=e,i=a===S.Dropdown,l=D(n,{});return{componentType:a,renderCondition:o,name:t,title:r,value:s,placeholder:l.placeholder||(i?"Select an option":void 0),options:i&&Array.isArray(l.values)?l.values.map(e=>({id:e,label:e})):void 0,...l}}),ne=({children:r})=>{const{selectedStreamName:s}=f(),{items:o}=P().destinationsApi.useDestinations(),[c,u]=t(null),[m,g]=t(ee.unsavedDestinations),S=n(()=>"number"==typeof c?.unsavedIdx?m[c.unsavedIdx]:void 0,[c,m]),k=a((e,t)=>{c&&(g(t=>[...t,{...e,option:c.option}]),u(t?e=>e?{...e,listType:v.UNSAVED,unsavedIdx:m.length}:null:null))},[c,m.length]),C=a((e,t,a)=>{c&&(g(a=>a.map((a,n)=>n===e?{...a,...t,option:c.option}:a)),u(a?e=>e?{...e,listType:v.UNSAVED}:null:null))},[c]),A=a(e=>{g(t=>t.filter((t,a)=>a!==e)),u(null)},[]),F=l({...Z,currentStreamName:s});i(()=>{if(!c)return;if(S)return void F.resetFormData({...S.formData});if(c.listType===v.EXISTS&&c.option.id){const e=o.find(e=>e.id===c.option.id);if(e)return void F.resetFormData({type:e.destinationType.type,name:e.name||e.destinationType.displayName,currentStreamName:s,disabled:!!e.disabled,exportedSignals:{logs:!!e.exportedSignals?.logs,metrics:!!e.exportedSignals?.metrics,traces:!!e.exportedSignals?.traces,profiles:!!e.exportedSignals?.profiles},fields:c.dynamicFields.map(e=>({key:e.name,value:e.value}))})}const e=b(c.option.supportedSignals);F.resetFormData({type:c.option.type,name:c.option.displayName,currentStreamName:s,disabled:!1,exportedSignals:{logs:e.includes(y.Logs),metrics:e.includes(y.Metrics),traces:e.includes(y.Traces),profiles:e.includes(y.Profiles)},fields:c.dynamicFields.map(e=>({key:e.name,value:e.value}))})},[c,S]);const I=a(e=>{F.resetFormData(),F.handleErrorChange(void 0,void 0,{}),u(e?{...e,dynamicFields:e.option?.fields?ae(e.option.fields):[]}:null)},[]),w=a((e,t)=>{let a;for(const n of t){const t=n.items.find(t=>t.type===e.destinationType.type);if(t){a=t;break}}const n=D(e.fields,{}),r={id:e.id,type:e.destinationType.type,displayName:e.name||e.destinationType.displayName,selected:!0,testConnectionSupported:a?.testConnectionSupported??!1,supportedSignals:e.destinationType.supportedSignals,fields:a?a.fields.map(e=>({...e,initialValue:n[e.name]??e.initialValue})):[]},s=ae(r.fields);u({listType:v.EXISTS,option:r,dynamicFields:s})},[]),N=a(()=>{const e=d(F.formData),t={};c?.dynamicFields.forEach(({name:a,required:n})=>{if(n){const n=e.fields.find(e=>e.key===a)?.value;p(n)&&(t[a]=h.FIELD_IS_REQUIRED)}});return E(e.exportedSignals).length||(t.exportedSignals=h.FIELD_IS_REQUIRED),F.handleErrorChange(void 0,void 0,t),{errorMessage:0===Object.keys(t).length?void 0:"Invalid form values",preparedFormData:e}},[F,c]);return e(te.Provider,{value:{activeForm:c,onChangeActiveForm:I,loadDestination:w,genericForm:F,validateFormData:N,unsavedDestinations:m,thisUnsavedDestination:S,setUnsavedDestinations:g,addUnsavedDestination:k,updateUnsavedDestination:C,deleteUnsavedDestination:A},children:r})},re=()=>r(te),se={disabled:!1,ruleName:"",notes:"",sourceScopes:T(),workloads:null,instrumentationLibraries:null,payloadCollection:null,codeAttributes:null,headersCollection:null,customInstrumentations:null},oe=s(null),ie=({children:r,sourceOptions:s=[],namespaceOptions:o=[]})=>{const[i,c]=t(null),u=l(se),m=a(e=>{u.resetFormData(),u.handleErrorChange(void 0,void 0,{}),c(e)},[]),p=a(e=>{var t;u.resetFormData((({ruleName:e,notes:t,disabled:a,sourceScopes:n,instrumentationLibraries:r,payloadCollection:s,codeAttributes:o,headersCollection:i,customInstrumentations:l})=>({ruleName:e||"",notes:t||"",disabled:!!a,sourceScopes:O(n),workloads:null,instrumentationLibraries:r??null,payloadCollection:s??null,codeAttributes:o??null,headersCollection:i??null,customInstrumentations:l??null}))(e)),u.handleErrorChange(void 0,void 0,{}),c((t=e.type,k.find(e=>e.type===t)??null))},[]),h=a(()=>{if(!i)return{errorMessage:"No rule type selected",preparedFormData:d(se)};const e=(e=>{const t=d(e),a={...t,sourceScopes:L(t.sourceScopes)?null:t.sourceScopes,workloads:null};return a.headersCollection?.[C.HeaderKeys]?.length&&(a.headersCollection[C.HeaderKeys]=a.headersCollection[C.HeaderKeys].map(e=>e.trim()).filter(e=>e)),a.customInstrumentations?.[A.Golang]?.length&&(a.customInstrumentations[A.Golang]=a.customInstrumentations[A.Golang].map(e=>new F(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)).filter(e=>{return t=e,!!(t.packageName?.trim()||t.functionName?.trim()||t.receiverName?.trim()||t.receiverMethodName?.trim());var t})),a.customInstrumentations?.[A.Java]?.length&&(a.customInstrumentations[A.Java]=a.customInstrumentations[A.Java].map(e=>new I(e.className,e.methodName)).filter(e=>{return t=e,!(!t.className?.trim()&&!t.methodName?.trim());var t})),a})(u.formData),t=((e,t)=>{const a={};switch(e){case w.CodeAttributes:Object.values(t.codeAttributes||{}).some(e=>null!=e)||(a.codeAttributes="Code attributes are required");break;case w.PayloadCollection:Object.values(t.payloadCollection||{}).some(e=>null!=e)||(a.payloadCollection="Payload collection are required");break;case w.HeadersCollection:t.headersCollection?.[C.HeaderKeys]?.length||(a.headersCollection="Header keys are required");break;case w.CustomInstrumentation:{const e=t.customInstrumentations?.[A.Golang]||[],n=t.customInstrumentations?.[A.Java]||[];if(!e.length&&!n.length){a.customInstrumentations="Custom instrumentation are required";break}const r=e.findIndex(e=>!new F(e.packageName,e.functionName,e.receiverName,e.receiverMethodName).Verify());if(-1!==r){a.customInstrumentations=`Golang probe #${r+1} is invalid: provide a package name plus either a function name OR both a receiver name and receiver method name`;break}const s=n.findIndex(e=>!new I(e.className,e.methodName).Verify());if(-1!==s){a.customInstrumentations=`Java probe #${s+1} is invalid: both class name and method name are required`;break}break}}return a})(i.type,e);return u.handleErrorChange(void 0,void 0,t),{errorMessage:Object.keys(t).length>0?"Invalid form values":void 0,preparedFormData:e}},[u,i]),f=n(()=>({selectedOption:i,onSelectOption:m,loadRule:p,genericForm:u,validateFormData:h,sourceOptions:s,namespaceOptions:o}),[i,m,p,u,h,s,o]);return e(oe.Provider,{value:f,children:r})},le=()=>{const e=r(oe);if(!e)throw new Error("useRuleFormContext must be used within a RuleFormContextProvider");return e};var de;!function(e){e.Create="create",e.View="view",e.EditAutoNoisy="edit-auto-noisy",e.EditAutoCostReduction="edit-auto-cost-reduction",e.EditAutoHighlyRelevant="edit-auto-highly-relevant"}(de||(de={}));const ce=s(null),ue=["50","25","10","1"];function me(e){const t=String(e);return ue.includes(t)?t:"custom"}const pe=({category:r,sourceOptions:s=[],namespaceOptions:o=[],children:d})=>{const{formData:c,handleFormChange:u,resetFormData:m}=l(G(r)),[p,h]=t(null);i(()=>{m(G(r)),h(null)},[r]);const f=a(e=>{h(null),u(void 0,void 0,{...c,...e})},[c,u]),g=a(()=>{m(G(r)),h(null)},[r,m]),v=n(()=>({formType:de.Create,category:r,formData:c,handleChange:f,resetForm:g,duplicateWarning:p,setDuplicateWarning:h,sourceOptions:s,namespaceOptions:o}),[r,c,f,g,p,s,o]);return e(ce.Provider,{value:v,children:d})},he=({data:r,defaultEditMode:s,sourceOptions:d=[],namespaceOptions:c=[],children:u})=>{const[m,p]=t(!1),{formData:h,handleFormChange:f,resetFormData:g}=l(void 0),v=o(null),[b,y]=t(null);i(()=>{r!==v.current&&(v.current=r,r&&s?(g(K(r)),y(null),p(!0)):(p(!1),y(null)))},[r,s]);const D=a(e=>{y(null),f(void 0,void 0,{...h,...e})},[h,f]),E=a(()=>{r&&(g(K(r)),y(null),p(!0))},[r,g]),S=a(()=>{p(!1),y(null)},[]),k=n(()=>({formType:de.View,data:r,isEditing:m,formData:h,handleChange:D,handleEdit:E,handleCancelEdit:S,duplicateWarning:b,setDuplicateWarning:y,sourceOptions:d,namespaceOptions:c}),[r,m,h,D,E,S,b,d,c]);return e(ce.Provider,{value:k,children:u})};function fe(e){const[a,r]=t(()=>0===e?"all":"sample"),[s,o]=t(()=>me(e)),[l,d]=t(()=>"custom"===me(e)?String(e):"");i(()=>{r(0===e?"all":"sample");const t=me(e);o(t),d("custom"===t?String(e):"")},[e]);const c=n(()=>"all"===a?0:"custom"===s?Number(l)||0:Number(s),[a,s,l]);return{percentageMode:a,setPercentageMode:r,percentagePreset:s,setPercentagePreset:o,customPercentage:l,setCustomPercentage:d,resolvedPercentage:c}}const ge=({enabled:a,keepPercentage:r,children:s})=>{const[o,l]=t(a),d=fe(r);i(()=>{l(a)},[a]);const c=n(()=>j({enabled:o,keepPercentage:d.resolvedPercentage}),[o,d.resolvedPercentage]),u=n(()=>({formType:de.EditAutoNoisy,localEnabled:o,setLocalEnabled:l,...d,summary:c}),[o,d,c]);return e(ce.Provider,{value:u,children:s})},ve=({enabled:a,dropPercentage:r,children:s})=>{const[o,l]=t(a),d=fe(r);i(()=>{l(a)},[a]);const c=n(()=>U(o?{disabled:!1,percentageAtMost:d.resolvedPercentage}:null),[o,d.resolvedPercentage]),u=n(()=>({formType:de.EditAutoCostReduction,localEnabled:o,setLocalEnabled:l,...d,summary:c}),[o,d,c]);return e(ce.Provider,{value:u,children:s})},be=({enabled:a,children:r})=>{const[s,o]=t(a);i(()=>{o(a)},[a]);const l=n(()=>M(s?{disabled:!1}:null),[s]),d=n(()=>({formType:de.EditAutoHighlyRelevant,localEnabled:s,setLocalEnabled:o,summary:l}),[s,l]);return e(ce.Provider,{value:d,children:r})},ye=t=>{switch(t.formType){case de.Create:return e(pe,{...t});case de.View:return e(he,{...t});case de.EditAutoNoisy:return e(ge,{...t});case de.EditAutoCostReduction:return e(ve,{...t});case de.EditAutoHighlyRelevant:return e(be,{...t})}};function De(e){const t=r(ce);if(!t)throw new Error("useSamplingRulesFormContext must be used within a SamplingRulesFormProvider");if(e&&t.formType!==e)throw new Error(`Expected formType "${e}" but found "${t.formType}"`);return t}const Ee={otelServiceName:"",currentStreamName:""},Se=s(null),ke=({children:r})=>{const[s,o]=t(void 0),i=l(Ee),c=a(e=>{i.resetFormData((({serviceName:e,id:t})=>({otelServiceName:e||t.name||"",currentStreamName:""}))(e)),i.handleErrorChange(void 0,void 0,{}),o(void 0)},[]),u=a(()=>{const e=d(i.formData);return i.handleErrorChange(void 0,void 0,{}),o(void 0),{errorMessage:void 0,preparedFormData:e}},[i]),m=n(()=>({loadSource:c,genericForm:i,validateFormData:u,errorMessage:s}),[c,i,u,s]);return e(Se.Provider,{value:m,children:r})},Ce=()=>{const e=r(Se);if(!e)throw new Error("useSourceEditFormContext must be used within a SourceEditFormContextProvider");return e},Ae=new Set([N.StaticPod]),Fe=e=>{const t=e.workloads.filter(({selected:e})=>e).length,a=e.workloads.length;return{selectedCount:t,isAllSourced:t>0&&t===a,isSomeSourced:t>0&&t<a,isFutureApps:e.selected||!1}},Ie=(e,t,a)=>{if(t&&!e.name.toLowerCase().includes(t.toLowerCase()))return!1;if(a.showOnlySelected){const{isAllSourced:t,isSomeSourced:a,isFutureApps:n}=Fe(e);return t||a||n}return!0},we=(e,t,a)=>!(t&&!e.name.toLowerCase().includes(t.toLowerCase()))&&(!a.showOnlySelected||e.selected),Ne=s({snapshots:null,setSnapshots:()=>{},isFetching:!1,setIsFetching:()=>{},formData:[],handleSourceChange:()=>{},handleSelectAll:()=>{},formDiff:{},isFormDirty:!1}),xe=(e,t,a)=>{const n=[];return t.workloads.forEach(r=>{const s=e?.workloads.find(e=>e.name===r.name&&e.kind===r.kind);r.selected!==s?.selected&&n.push({namespace:t.name,name:r.name,kind:r.kind,selected:r.selected||!1,currentStreamName:a})}),n},Re=({children:r,selectedConnectionIds:s,initialInputs:o})=>{const{tier:l}=V(),c=l===x.Onprem,{capabilities:u}=P(),m=u.canInstrumentNamespaces,{selectedStreamName:p}=f(),[h,g]=t(!1),[v,b]=t(null),[y,D]=t([]);i(()=>{v&&D(e=>{const t=((e,t)=>d(((e,t)=>e.clusters.filter(({clusterId:e})=>!t||t.includes(e)))(e,t)))(v,s);return t.map(t=>{const a=e?.find(e=>e.clusterId===t.clusterId),n=a??t;if(o?.[t.clusterId]){const e=o[t.clusterId],a=d(n);return e.forEach(e=>{const t=a.namespaces.find(t=>t.name===e.namespace);if(t)if(e.name&&e.kind){const a=t.workloads.find(t=>t.name===e.name&&t.kind===e.kind);a&&(a.selected=e.selected)}else t.selected=e.selected,e.selected&&t.workloads.forEach(e=>{Ae.has(e.kind)&&!c||(e.selected=!0)})}),a}return n})})},[v,s,o]);const{formDiff:E,isFormDirty:S}=n(()=>{const e=((e,t,a,n)=>{const r={};return e.forEach(e=>{e.namespaces.forEach(s=>{const o=t.find(t=>t.clusterId===e.clusterId)?.namespaces.find(e=>e.name===s.name);if(!n){const t=xe(o,s,a);return void(t.length>0&&(r[e.clusterId]||(r[e.clusterId]=[]),r[e.clusterId].push(...t)))}const i=s.selected||!1;if(i!==o?.selected)r[e.clusterId]||(r[e.clusterId]=[]),r[e.clusterId].push({namespace:s.name,selected:i,currentStreamName:a}),i?r[e.clusterId]=r[e.clusterId].filter(e=>e.namespace!==s.name||e.namespace===s.name&&(!e.name||!e.kind)):s.workloads.forEach(t=>{t.selected&&r[e.clusterId].push({namespace:s.name,name:t.name,kind:t.kind,selected:!0,currentStreamName:a})});else{const t=xe(o,s,a);t.length>0&&(r[e.clusterId]||(r[e.clusterId]=[]),r[e.clusterId].push(...t))}})}),r})(y,v?.clusters||[],p,m);return{formDiff:e,isFormDirty:Object.keys(e).length>0}},[y,v,p,m]),k=a(e=>!c&&Ae.has(e),[c]),C=a(({clusterId:e,workloadId:t,selected:a,auto:n})=>{D(r=>{const s=d(r),o=s.findIndex(t=>t.clusterId===e);if(-1===o)return s;const i=s[o].namespaces.findIndex(e=>e.name===t.namespace);if(-1===i)return s;if(t.kind&&t.name){const e=s[o].namespaces[i].workloads.findIndex(e=>e.name===t.name&&e.kind===t.kind);if(-1===e)return s;const n="boolean"==typeof a?a:!s[o].namespaces[i].workloads[e].selected;if(s[o].namespaces[i].workloads[e].selected=n,m)if(n){s[o].namespaces[i].workloads.filter(e=>!k(e.kind)).every(e=>e.selected)&&(s[o].namespaces[i].selected=!0)}else s[o].namespaces[i].selected=!1}else if(m){const e="boolean"==typeof n?n:!s[o].namespaces[i].selected;s[o].namespaces[i].selected=e,e?s[o].namespaces[i].workloads.forEach(e=>{k(e.kind)||(e.selected=!0)}):"boolean"!=typeof a||a||s[o].namespaces[i].workloads.forEach(e=>{e.selected=!1})}else{const e="boolean"==typeof a?a:"boolean"!=typeof n||n;s[o].namespaces[i].workloads.forEach(t=>{e&&k(t.kind)||(t.selected=e)})}return s})},[k,m]),A=a(({clusterId:e,namespaceName:t,boolean:a,searchText:n="",searchBy:r="",filters:s})=>{D(o=>{const i=d(o),l=r===R.Namespace?n:"",c=r===R.Source?n:"",u=!!l||!!c||!!s?.showOnlySelected;return i.forEach((n,r)=>{e&&n.clusterId!==e||n.namespaces.forEach(({name:e,workloads:n},o)=>{if(!t||e===t)if(u)if(t){if(n.forEach((e,t)=>{a&&k(e.kind)||we(e,c,s||{showOnlySelected:!1})&&(i[r].namespaces[o].workloads[t].selected=a)}),m){const e=i[r].namespaces[o].workloads.filter(e=>!k(e.kind)).every(e=>e.selected);i[r].namespaces[o].selected=e}}else{if(!Ie(i[r].namespaces[o],l,s||{showOnlySelected:!1}))return;m&&(i[r].namespaces[o].selected=a),n.forEach((e,t)=>{a&&k(e.kind)||(i[r].namespaces[o].workloads[t].selected=a)})}else m&&(i[r].namespaces[o].selected=a),n.forEach((e,t)=>{a&&k(e.kind)||(i[r].namespaces[o].workloads[t].selected=a)})})}),i})},[k,m]);return e(Ne.Provider,{value:{snapshots:v,setSnapshots:b,isFetching:h,setIsFetching:g,formData:y,handleSourceChange:C,handleSelectAll:A,formDiff:E,isFormDirty:S},children:r})},Pe=()=>r(Ne);export{Q as A,X as D,Ae as E,ie as R,de as S,ne as a,ye as b,ke as c,Re as d,Y as e,re as f,le as g,De as h,Ce as i,Pe as j,we as k,Ie as l,Fe as m,W as u};