@odigos/ui-kit 0.0.44 → 0.0.46

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 (39) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/lib/components/data-tab/index.d.ts +1 -0
  3. package/lib/components/toggle/index.d.ts +1 -0
  4. package/lib/components.js +8 -8
  5. package/lib/constants/strings/index.d.ts +3 -0
  6. package/lib/constants.js +1 -1
  7. package/lib/containers/data-stream-form/index.d.ts +1 -1
  8. package/lib/containers/data-stream-modal/data-stream-modal.stories.d.ts +9 -0
  9. package/lib/containers/data-stream-modal/index.d.ts +5 -0
  10. package/lib/containers/destination-modal/choose-destination/destinations-list/index.d.ts +1 -0
  11. package/lib/containers/destination-modal/choose-destination/index.d.ts +2 -2
  12. package/lib/containers/destination-modal/index.d.ts +3 -2
  13. package/lib/containers.js +78 -45
  14. package/lib/functions/get-conditions-booleans/index.d.ts +4 -0
  15. package/lib/functions.js +5 -5
  16. package/lib/hooks/useSourceSelectionFormData.d.ts +4 -4
  17. package/lib/hooks.js +3 -3
  18. package/lib/icons.js +6 -6
  19. package/lib/{index-AM8c03-E.js → index-B1IScVBT.js} +16 -22
  20. package/lib/{index-b8zuk7ta.js → index-BJpPcCBm.js} +27 -4
  21. package/lib/{index-BD7meETN.js → index-BRGQ84pJ.js} +3 -0
  22. package/lib/{index-CY3kjYr3.js → index-BUCure0Q.js} +1 -1
  23. package/lib/{index-BL1s2-bo.js → index-C4aVlsHh.js} +1 -1
  24. package/lib/{index-Dxj04GUZ.js → index-C8vqcUbP.js} +2 -2
  25. package/lib/{index-DZWbhK14.js → index-CeHgnkLY.js} +1 -1
  26. package/lib/{index-Bup9Thvg.js → index-CpT8LSxY.js} +5 -20
  27. package/lib/{index-C3BU6Xe-.js → index-DypjdLnz.js} +1 -1
  28. package/lib/{index-BDBeg2A7.js → index-fEP_guwb.js} +4 -4
  29. package/lib/snippets.js +7 -7
  30. package/lib/store/useSetupStore.d.ts +7 -2
  31. package/lib/store.js +1 -1
  32. package/lib/theme.js +1 -1
  33. package/lib/types/common/index.d.ts +3 -0
  34. package/lib/types/namespaces/index.d.ts +1 -0
  35. package/lib/types/sources/index.d.ts +2 -6
  36. package/lib/types.js +5 -1
  37. package/lib/{useSourceSelectionFormData-DmZnRueA.js → useSourceSelectionFormData-CMXqoHZs.js} +52 -32
  38. package/lib/{useTransition-BWC_F-Pl.js → useTransition-DsrDiKOV.js} +1 -1
  39. package/package.json +3 -3
@@ -1,13 +1,13 @@
1
1
  import React, { useState, useEffect, useRef, forwardRef, createElement, useCallback, useMemo, Fragment } from 'react';
2
- import { T as Theme, t as ImageErrorIcon, M as MONITORS_OPTIONS, g as useNotificationStore, l as DISPLAY_TITLES, L as LANGUAGE_OPTIONS, F as FORM_ALERTS, p as getProgrammingLanguageIcon, D as DISPLAY_LANGUAGES, B as BUTTON_TEXTS } from './index-BD7meETN.js';
2
+ import { T as Theme, t as ImageErrorIcon, M as MONITORS_OPTIONS, g as useNotificationStore, l as DISPLAY_TITLES, L as LANGUAGE_OPTIONS, F as FORM_ALERTS, p as getProgrammingLanguageIcon, D as DISPLAY_LANGUAGES, B as BUTTON_TEXTS } from './index-BRGQ84pJ.js';
3
3
  import { StatusType, OtherStatus, ProgrammingLanguages, SortDirection, IntrumentationStatus, InputTypes, FieldTypes } from './types.js';
4
- import { M as MinusIcon, h as CheckIcon, L as ListIcon, C as CodeIcon, c as ExtendArrowIcon, E as EditIcon, i as CrossIcon, T as TrashIcon, e as SortArrowsIcon, b as EditedIcon, a as CopyIcon, d as NotebookIcon, X as XIcon, f as EyeClosedIcon, g as EyeOpenIcon, N as NoDataIcon, S as SearchIcon, P as PlusIcon, A as ArrowIcon } from './index-CY3kjYr3.js';
5
- import { a as getStatusIcon, r as removeEmptyValuesFromObject, s as safeJsonStringify, f as flattenObjectKeys, m as mapConditions, c as capitalizeFirstLetter, g as getMonitorIcon, i as isValidVersion, b as parseJsonStringToPrettyString, d as splitCamelString, p as parseBooleanFromString, n as numbersOnly } from './index-b8zuk7ta.js';
4
+ import { M as MinusIcon, h as CheckIcon, L as ListIcon, C as CodeIcon, c as ExtendArrowIcon, E as EditIcon, i as CrossIcon, T as TrashIcon, e as SortArrowsIcon, b as EditedIcon, a as CopyIcon, d as NotebookIcon, X as XIcon, f as EyeClosedIcon, g as EyeOpenIcon, N as NoDataIcon, S as SearchIcon, P as PlusIcon, A as ArrowIcon } from './index-BUCure0Q.js';
5
+ import { b as getStatusIcon, r as removeEmptyValuesFromObject, s as safeJsonStringify, f as flattenObjectKeys, m as mapConditions, g as getConditionsBooleans, c as capitalizeFirstLetter, a as getMonitorIcon, i as isValidVersion, d as parseJsonStringToPrettyString, e as splitCamelString, p as parseBooleanFromString, n as numbersOnly } from './index-BJpPcCBm.js';
6
6
  import styled, { css } from 'styled-components';
7
7
  import { s as safeJsonParse, i as isEmpty } from './index-BV85P9UP.js';
8
- import { b as useGenericForm, e as useOnClickOutside, d as useKeyDown, u as useContainerSize, a as useCopy, g as useTransition } from './useTransition-BWC_F-Pl.js';
8
+ import { b as useGenericForm, e as useOnClickOutside, d as useKeyDown, u as useContainerSize, a as useCopy, g as useTransition } from './useTransition-DsrDiKOV.js';
9
9
  import ReactDOM from 'react-dom';
10
- import { I as InfoIcon } from './index-DZWbhK14.js';
10
+ import { I as InfoIcon } from './index-CeHgnkLY.js';
11
11
 
12
12
  const TextWrapper$2 = styled.div `
13
13
  color: ${({ $color, theme }) => $color || theme.text.secondary};
@@ -3997,19 +3997,12 @@ const IconWrap$1 = styled(FlexColumn) `
3997
3997
  const ConditionDetails = ({ conditions: c, headerLabelError = 'Something Failed', headerLabelWarning = "Something isn't right", headerLabelSuccess = 'Everything Successful', }) => {
3998
3998
  const theme = Theme.useTheme();
3999
3999
  const [extend, setExtend] = useState(false);
4000
- const conditions = mapConditions(c);
4001
- const errors = useMemo(() => conditions.filter(({ status }) => status === StatusType.Error), [conditions]);
4002
- const hasErrors = !!errors.length;
4003
- const warnings = useMemo(() => conditions.filter(({ status }) => status === StatusType.Warning), [conditions]);
4004
- const hasWarnings = !!warnings.length;
4005
- const disableds = useMemo(() => conditions.filter(({ status }) => status === OtherStatus.Disabled), [conditions]);
4006
- const hasDisableds = !!disableds.length;
4007
- const loadings = useMemo(() => conditions.filter(({ status }) => status === OtherStatus.Loading), [conditions]);
4008
- const hasLoadings = !!loadings.length;
4009
- const loading = (!conditions.length || hasLoadings) && !hasErrors && !hasWarnings && !hasDisableds;
4000
+ const conditions = useMemo(() => mapConditions(c), [c]);
4001
+ const { errors, hasErrors, warnings, hasWarnings, hasDisableds, hasLoadings } = useMemo(() => getConditionsBooleans(conditions), [conditions]);
4010
4002
  useEffect(() => {
4011
4003
  setExtend(hasErrors || hasWarnings || hasDisableds || hasLoadings);
4012
4004
  }, [hasErrors, hasWarnings, hasDisableds, hasLoadings]);
4005
+ const loading = (!conditions.length || hasLoadings) && !hasErrors && !hasWarnings && !hasDisableds;
4013
4006
  const overallStatus = hasErrors ? StatusType.Error : hasWarnings ? StatusType.Warning : hasDisableds ? StatusType.Info : StatusType.Success;
4014
4007
  const HeaderIcon = getStatusIcon(overallStatus, theme);
4015
4008
  const headerText = hasErrors ? headerLabelError : hasWarnings ? headerLabelWarning : hasDisableds ? headerLabelWarning : loading ? 'Loading...' : headerLabelSuccess;
@@ -4310,7 +4303,7 @@ const SubText = styled(Text) `
4310
4303
  font-size: 10px;
4311
4304
  color: ${({ theme }) => theme.text.grey};
4312
4305
  `;
4313
- const DataTab = ({ title, subTitle, hoverText, onClick, renderActions, iconProps: { icon, icons, iconSrc, iconSrcs } = {}, visualProps: { status, faded, bgColor, bgColorHover, monitors, monitorsWithLabels, componentsUnderTitles } = {}, checkboxProps: { withCheckbox, isCheckboxDisabled, isChecked, onCheckboxChange } = {}, extendableProps: { withExtend, isExtended, renderExtended } = {}, ...props }) => {
4306
+ const DataTab = ({ title, subTitle, hoverText, onClick, renderActions, iconProps: { icon, icons, iconSrc, iconSrcs } = {}, visualProps: { status, faded, bgColor, bgColorHover, monitors, monitorsWithLabels, componentsUnderTitles } = {}, checkboxProps: { withCheckbox, isCheckboxDisabled, isChecked, isLoading: isCheckboxLoading, onCheckboxChange } = {}, extendableProps: { withExtend, isExtended, renderExtended } = {}, ...props }) => {
4314
4307
  const theme = Theme.useTheme();
4315
4308
  const [extend, setExtend] = useState(isExtended || false);
4316
4309
  const [textMaxWidth, setTextMaxWidth] = useState(0);
@@ -4331,7 +4324,7 @@ const DataTab = ({ title, subTitle, hoverText, onClick, renderActions, iconProps
4331
4324
  return (React.createElement(Container$m, { ref: containerRef, "$status": status, "$faded": faded, "$bgColor": bgColor, "$bgColorHover": bgColorHover, "$withClick": !!onClick, onClick: onClick, ...props },
4332
4325
  React.createElement(FlexRow, { "$gap": 8 },
4333
4326
  React.createElement(FlexRow, { "$gap": 16 },
4334
- withCheckbox && React.createElement(Checkbox, { value: isChecked, onChange: onCheckboxChange, disabled: isCheckboxDisabled }),
4327
+ isCheckboxLoading ? React.createElement(FadeLoader, null) : withCheckbox ? React.createElement(Checkbox, { value: isChecked, onChange: onCheckboxChange, disabled: isCheckboxDisabled }) : null,
4335
4328
  !!icons?.length || !!iconSrcs?.length ? (React.createElement(IconGroup, { icons: icons, iconSrcs: iconSrcs, status: status, id: `${title}-${subTitle}` })) : !!icon || !!iconSrc ? (React.createElement(IconWrapped, { icon: icon, src: iconSrc, status: status })) : null),
4336
4329
  React.createElement(FlexColumn, { "$gap": 4 },
4337
4330
  title && React.createElement(ScrollX, { maxWidth: textMaxWidth, text: title, textSize: 14 }),
@@ -4806,8 +4799,8 @@ const ActionWrapper = styled(FlexRow) `
4806
4799
  margin-left: auto;
4807
4800
  gap: 8px;
4808
4801
  `;
4809
- const DataCard = ({ title = 'Details', titleBadge, description, action: Action, withExtend, data, children }) => {
4810
- const [extend, setExtend] = useState(false);
4802
+ const DataCard = ({ title = 'Details', titleBadge, description, action: Action, withExtend, initialExtended = false, data, children }) => {
4803
+ const [extend, setExtend] = useState(initialExtended);
4811
4804
  const [hovered, setHovered] = useState(false);
4812
4805
  return (React.createElement(CardContainer, { "$hovered": hovered },
4813
4806
  !!title || !!description || !!Action ? (React.createElement(Header$1, { "$clickable": withExtend || false, onClick: () => withExtend && setExtend((prev) => !prev), onMouseEnter: () => withExtend && setHovered(true), onMouseLeave: () => withExtend && setHovered(false) },
@@ -6321,7 +6314,7 @@ const ToggleSwitch = styled.div `
6321
6314
  transition: background-color 0.3s, transform 0.3s;
6322
6315
  }
6323
6316
  `;
6324
- const Toggle = ({ title, tooltip, initialValue = false, onChange, disabled, allowPropagation = false }) => {
6317
+ const Toggle = ({ title, tooltip, initialValue = false, onChange, disabled, allowPropagation = false, flipHorizontally }) => {
6325
6318
  const [isActive, setIsActive] = useState(initialValue);
6326
6319
  useEffect(() => setIsActive(initialValue), [initialValue]);
6327
6320
  const handleToggle = (e) => {
@@ -6335,9 +6328,10 @@ const Toggle = ({ title, tooltip, initialValue = false, onChange, disabled, allo
6335
6328
  setIsActive((prev) => !prev);
6336
6329
  };
6337
6330
  return (React.createElement(Container$2, { "$disabled": disabled, onClick: handleToggle },
6338
- React.createElement(ToggleSwitch, { "$disabled": disabled, "$isActive": isActive }),
6331
+ !flipHorizontally && React.createElement(ToggleSwitch, { "$disabled": disabled, "$isActive": isActive }),
6339
6332
  React.createElement(Tooltip, { text: tooltip, withIcon: true },
6340
- React.createElement(Text, { size: 14 }, title))));
6333
+ React.createElement(Text, { size: 14 }, title)),
6334
+ flipHorizontally && React.createElement(ToggleSwitch, { "$disabled": disabled, "$isActive": isActive })));
6341
6335
  };
6342
6336
 
6343
6337
  function getDefaultExportFromCjs (x) {
@@ -1,8 +1,8 @@
1
- import { SignalType, StatusType } from './types.js';
1
+ import { StatusType, OtherStatus, SignalType } from './types.js';
2
2
  import 'react';
3
- import './index-BD7meETN.js';
3
+ import './index-BRGQ84pJ.js';
4
4
  import 'styled-components';
5
- import { T as TracesIcon, M as MetricsIcon, L as LogsIcon, O as OdigosLogo, I as InfoIcon, W as WarningTriangleIcon, E as ErrorTriangleIcon, C as CheckCircledIcon } from './index-DZWbhK14.js';
5
+ import { T as TracesIcon, M as MetricsIcon, L as LogsIcon, O as OdigosLogo, I as InfoIcon, W as WarningTriangleIcon, E as ErrorTriangleIcon, C as CheckCircledIcon } from './index-CeHgnkLY.js';
6
6
 
7
7
  const capitalizeFirstLetter = (string) => {
8
8
  return string.charAt(0).toUpperCase() + string.slice(1);
@@ -70,6 +70,29 @@ const flattenObjectKeys = (obj, prefix = '', result = {}) => {
70
70
  return result;
71
71
  };
72
72
 
73
+ const getConditionsBooleans = (conditions) => {
74
+ const errors = conditions?.filter(({ status }) => status === StatusType.Error);
75
+ const warnings = conditions?.filter(({ status }) => status === StatusType.Warning);
76
+ const disableds = conditions?.filter(({ status }) => status === OtherStatus.Disabled);
77
+ const loadings = conditions?.filter(({ status }) => status === OtherStatus.Loading);
78
+ const hasErrors = errors.length > 0;
79
+ const hasWarnings = warnings.length > 0;
80
+ const hasDisableds = disableds.length > 0;
81
+ const hasLoadings = loadings.length > 0;
82
+ const priorotizedStatus = hasErrors ? StatusType.Error : hasWarnings ? StatusType.Warning : hasDisableds ? StatusType.Info : undefined;
83
+ return {
84
+ errors,
85
+ hasErrors,
86
+ warnings,
87
+ hasWarnings,
88
+ disableds,
89
+ hasDisableds,
90
+ loadings,
91
+ hasLoadings,
92
+ priorotizedStatus,
93
+ };
94
+ };
95
+
73
96
  const getMonitorIcon = (type) => {
74
97
  const LOGOS = {
75
98
  [SignalType.Logs]: LogsIcon,
@@ -192,4 +215,4 @@ const safeJsonStringify = (obj, indent = 2) => {
192
215
  return JSON.stringify(obj || {}, null, indent);
193
216
  };
194
217
 
195
- export { getStatusIcon as a, parseJsonStringToPrettyString as b, capitalizeFirstLetter as c, splitCamelString as d, flattenObjectKeys as f, getMonitorIcon as g, isValidVersion as i, mapConditions as m, numbersOnly as n, parseBooleanFromString as p, removeEmptyValuesFromObject as r, safeJsonStringify as s };
218
+ export { getMonitorIcon as a, getStatusIcon as b, capitalizeFirstLetter as c, parseJsonStringToPrettyString as d, splitCamelString as e, flattenObjectKeys as f, getConditionsBooleans as g, isValidVersion as i, mapConditions as m, numbersOnly as n, parseBooleanFromString as p, removeEmptyValuesFromObject as r, safeJsonStringify as s };
@@ -917,6 +917,7 @@ const DISPLAY_TITLES = {
917
917
  NAME_YOUR_STREAM_PLACEHOLDER: 'e.g. Highest priority',
918
918
  STREAM_DESCRIPTION: 'Provide a clear and descriptive name for your pipeline to ensure its purpose is easily understood by you and your team.',
919
919
  STREAM_CONFIRM: 'Confirm your new Data Stream',
920
+ DATA_STREAM_EXISTS_WARNING: (curr, next) => `A Data Stream with this name already exists, you can still rename the current "${curr}", but it will merge into the existing "${next}".`,
920
921
  ACTION: 'Action',
921
922
  ACTIONS: 'Actions',
922
923
  ADD_ACTION: 'Add Action',
@@ -974,6 +975,8 @@ const DISPLAY_TITLES = {
974
975
  TO_MODIFY_OTEL_DATA: 'To modify OpenTelemetry data',
975
976
  QUICK_BACK_TO_SUMMARY: 'When you finish editing you can quickly go back to the summary.',
976
977
  GO_TO_SUMMARY: 'Go to summary',
978
+ FUTURE_APPS_TITLE: 'Auto-instrument new apps',
979
+ FUTURE_APPS_DESCRIPTION: 'When enabled, new applications will be instrumented automatically and included in the current data stream.',
977
980
  OVERIDE: 'Override',
978
981
  OVERIDDEN: 'Overridden',
979
982
  OVERRIDE_RUNTIME_DETAILS: 'Override Runtime Details',
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { T as Theme } from './index-BD7meETN.js';
2
+ import { T as Theme } from './index-BRGQ84pJ.js';
3
3
 
4
4
  const ArrowIcon = ({ size = 16, fill: f, rotate = 0, onClick }) => {
5
5
  const theme = Theme.useTheme();
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { T as Theme } from './index-BD7meETN.js';
2
+ import { T as Theme } from './index-BRGQ84pJ.js';
3
3
 
4
4
  const OdigosLogoText = ({ size = 16, fill: f, rotate = 0, onClick }) => {
5
5
  const theme = Theme.useTheme();
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
- import { _ as WarningModal } from './index-AM8c03-E.js';
2
+ import { _ as WarningModal } from './index-B1IScVBT.js';
3
3
  import { StatusType, EntityTypes } from './types.js';
4
- import './index-BD7meETN.js';
4
+ import './index-BRGQ84pJ.js';
5
5
  import 'styled-components';
6
6
 
7
7
  const CancelWarning = ({ isOpen, noOverlay, name, onApprove, onDeny }) => {
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { T as Theme } from './index-BD7meETN.js';
2
+ import { T as Theme } from './index-BRGQ84pJ.js';
3
3
 
4
4
  const OdigosLogo = ({ size = 16, fill: f, rotate = 0, onClick }) => {
5
5
  const theme = Theme.useTheme();
@@ -1,9 +1,9 @@
1
- import { StatusType, OtherStatus, DestinationTypes, EntityTypes, PlatformType } from './types.js';
2
- import { k as DEFAULT_DATA_STREAM_NAME, p as getProgrammingLanguageIcon, v as KafkaLogo, K as K8sLogo } from './index-BD7meETN.js';
1
+ import { StatusType, DestinationTypes, EntityTypes, PlatformType } from './types.js';
2
+ import { k as DEFAULT_DATA_STREAM_NAME, p as getProgrammingLanguageIcon, v as KafkaLogo, K as K8sLogo } from './index-BRGQ84pJ.js';
3
3
  import 'react';
4
4
  import 'styled-components';
5
- import { e as AwsXrayLogo, a2 as VictoriaMetricsLogo, a1 as UptraceLogo, a0 as TraceloopLogo, $ as TingyunLogo, _ as TempoLogo, Z as TelemetryHubLogo, Y as SumoLogicLogo, X as SplunkLogo, W as SignozLogo, U as SeqLogo, d as AwsS3Logo, T as QuickwitLogo, G as GigapipeLogo, S as QrynLogo, R as PrometheusLogo, F as OpenTelemetryLogo, Q as OracleLogo, P as OpsVerseLogo, z as OpenObserveLogo, y as OneUptimeLogo, O as ObserveLogo, N as NewRelicLogo, M as MiddlewareLogo, x as LumigoLogo, w as LokiLogo, v as LogzioLogo, u as LightstepLogo, L as Last9Logo, K as KloudmateLogo, J as JaegerLogo, I as InstanaLogo, t as HyperDxLogo, H as HoneycombLogo, s as GroundcoverLogo, r as GreptimeLogo, q as GrafanaLogo, p as GoogleCloudPlatformLogo, o as ElasticSearchLogo, E as ElasticApmLogo, n as DynatraceLogo, m as DatadogLogo, D as Dash0Logo, l as CoralogixLogo, c as AwsCloudwatchLogo, k as ClickhouseLogo, j as ChronosphereLogo, i as ChecklyLogo, C as CauselyLogo, h as BonreeLogo, B as BetterStackLogo, g as BlobStorageLogo, f as AxiomLogo, b as AppDynamicsLogo, a as AlibabaCloudLogo, A as AlaudaLogo, a6 as RulesIcon, a3 as ActionsIcon, a4 as DestinationsIcon, a7 as SourcesIcon, a5 as NamespacesIcon, V as VmLogo } from './index-C3BU6Xe-.js';
6
- import { O as OdigosLogo } from './index-DZWbhK14.js';
5
+ import { e as AwsXrayLogo, a2 as VictoriaMetricsLogo, a1 as UptraceLogo, a0 as TraceloopLogo, $ as TingyunLogo, _ as TempoLogo, Z as TelemetryHubLogo, Y as SumoLogicLogo, X as SplunkLogo, W as SignozLogo, U as SeqLogo, d as AwsS3Logo, T as QuickwitLogo, G as GigapipeLogo, S as QrynLogo, R as PrometheusLogo, F as OpenTelemetryLogo, Q as OracleLogo, P as OpsVerseLogo, z as OpenObserveLogo, y as OneUptimeLogo, O as ObserveLogo, N as NewRelicLogo, M as MiddlewareLogo, x as LumigoLogo, w as LokiLogo, v as LogzioLogo, u as LightstepLogo, L as Last9Logo, K as KloudmateLogo, J as JaegerLogo, I as InstanaLogo, t as HyperDxLogo, H as HoneycombLogo, s as GroundcoverLogo, r as GreptimeLogo, q as GrafanaLogo, p as GoogleCloudPlatformLogo, o as ElasticSearchLogo, E as ElasticApmLogo, n as DynatraceLogo, m as DatadogLogo, D as Dash0Logo, l as CoralogixLogo, c as AwsCloudwatchLogo, k as ClickhouseLogo, j as ChronosphereLogo, i as ChecklyLogo, C as CauselyLogo, h as BonreeLogo, B as BetterStackLogo, g as BlobStorageLogo, f as AxiomLogo, b as AppDynamicsLogo, a as AlibabaCloudLogo, A as AlaudaLogo, a6 as RulesIcon, a3 as ActionsIcon, a4 as DestinationsIcon, a7 as SourcesIcon, a5 as NamespacesIcon, V as VmLogo } from './index-DypjdLnz.js';
6
+ import { O as OdigosLogo } from './index-CeHgnkLY.js';
7
7
  import { s as safeJsonParse } from './index-BV85P9UP.js';
8
8
 
9
9
  const compareCondition = (renderCondition, fields) => {
@@ -95,21 +95,6 @@ const formatBytes = (bytes) => {
95
95
  return `${value.toFixed(i === 0 ? 0 : 1)} ${sizes[i]}`;
96
96
  };
97
97
 
98
- const getConditionsBooleans = (conditions) => {
99
- const hasErrors = !!conditions?.find(({ status }) => status === StatusType.Error);
100
- const hasWarnings = !!conditions?.find(({ status }) => status === StatusType.Warning);
101
- const hasDisableds = !!conditions?.find(({ status }) => status === OtherStatus.Disabled);
102
- const hasLoadings = !!conditions?.find(({ status }) => status === OtherStatus.Loading);
103
- const priorotizedStatus = hasErrors ? StatusType.Error : hasWarnings ? StatusType.Warning : hasDisableds ? StatusType.Info : undefined;
104
- return {
105
- hasErrors,
106
- hasWarnings,
107
- hasDisableds,
108
- hasLoadings,
109
- priorotizedStatus,
110
- };
111
- };
112
-
113
98
  const getContainersInstrumentedCount = (containers) => {
114
99
  const instrumentedCount = containers?.reduce((prev, curr) => (curr.instrumented ? prev + 1 : prev), 0);
115
100
  const totalCount = containers?.length || 0;
@@ -330,4 +315,4 @@ const mapDestinationFieldsForDisplay = (destination, yamlFields) => {
330
315
 
331
316
  const sleep = async (ms = 1000) => new Promise((resolve) => setTimeout(resolve, ms));
332
317
 
333
- export { filterDestinations as a, filterDestinationsByStream as b, compareCondition as c, deepClone as d, filterSources as e, filterActions as f, filterSourcesByStream as g, formatBytes as h, getConditionsBooleans as i, getContainersInstrumentedCount as j, getContainersIcons as k, getDestinationIcon as l, getEntityIcon as m, getEntityLabel as n, getMetricForEntity as o, getPlatformIcon as p, getPlatformLabel as q, getValueForRange as r, getWorkloadId as s, getYamlFieldsForDestination as t, isOverTime as u, mapDestinationFieldsForDisplay as v, sleep as w };
318
+ export { filterDestinations as a, filterDestinationsByStream as b, compareCondition as c, deepClone as d, filterSources as e, filterActions as f, filterSourcesByStream as g, formatBytes as h, getContainersInstrumentedCount as i, getContainersIcons as j, getDestinationIcon as k, getEntityIcon as l, getEntityLabel as m, getMetricForEntity as n, getPlatformIcon as o, getPlatformLabel as p, getValueForRange as q, getWorkloadId as r, getYamlFieldsForDestination as s, isOverTime as t, mapDestinationFieldsForDisplay as u, sleep as v };
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { T as Theme } from './index-BD7meETN.js';
2
+ import { T as Theme } from './index-BRGQ84pJ.js';
3
3
 
4
4
  const VmLogo = ({ size = 16, fill: f, rotate = 0, onClick }) => {
5
5
  const theme = Theme.useTheme();
@@ -1,10 +1,10 @@
1
1
  import React from 'react';
2
- import { T as Theme, B as BUTTON_TEXTS, l as DISPLAY_TITLES } from './index-BD7meETN.js';
3
- import { E as EditIcon } from './index-CY3kjYr3.js';
4
- import { B as Button, V as Text, J as NotificationNote } from './index-AM8c03-E.js';
2
+ import { T as Theme, B as BUTTON_TEXTS, l as DISPLAY_TITLES } from './index-BRGQ84pJ.js';
3
+ import { E as EditIcon } from './index-BUCure0Q.js';
4
+ import { B as Button, V as Text, J as NotificationNote } from './index-B1IScVBT.js';
5
5
  import { StatusType } from './types.js';
6
6
  import 'styled-components';
7
- import { I as InfoIcon } from './index-DZWbhK14.js';
7
+ import { I as InfoIcon } from './index-CeHgnkLY.js';
8
8
 
9
9
  const EditButton = ({ label, onClick, variant = 'tertiary', ...props }) => {
10
10
  const theme = Theme.useTheme();
package/lib/snippets.js CHANGED
@@ -1,12 +1,12 @@
1
- export { A as AddButton } from './index-AM8c03-E.js';
2
- export { E as EditButton, N as NoteBackToSummary } from './index-BDBeg2A7.js';
1
+ export { A as AddButton } from './index-B1IScVBT.js';
2
+ export { E as EditButton, N as NoteBackToSummary } from './index-fEP_guwb.js';
3
3
  import 'react';
4
- import './index-BD7meETN.js';
4
+ import './index-BRGQ84pJ.js';
5
5
  import './types.js';
6
6
  import 'styled-components';
7
- import './index-CY3kjYr3.js';
8
- import './index-b8zuk7ta.js';
9
- import './index-DZWbhK14.js';
7
+ import './index-BUCure0Q.js';
8
+ import './index-BJpPcCBm.js';
9
+ import './index-CeHgnkLY.js';
10
10
  import './index-BV85P9UP.js';
11
- import './useTransition-BWC_F-Pl.js';
11
+ import './useTransition-DsrDiKOV.js';
12
12
  import 'react-dom';
@@ -1,5 +1,5 @@
1
1
  import type { Destination, Source } from '@/types';
2
- export type AvailableSource = Pick<Source, 'name' | 'kind' | 'selected' | 'numberOfInstances'>;
2
+ export type AvailableSource = Pick<Source, 'namespace' | 'name' | 'kind' | 'selected' | 'numberOfInstances'>;
3
3
  export interface AvailableSourcesByNamespace {
4
4
  [namespace: string]: AvailableSource[];
5
5
  }
@@ -9,8 +9,13 @@ export type SelectedSource = AvailableSource & {
9
9
  export interface SourceSelectionFormData {
10
10
  [namespace: string]: SelectedSource[];
11
11
  }
12
+ export type SelectedNamespace = {
13
+ namespace: string;
14
+ selected: boolean;
15
+ currentStreamName: string;
16
+ };
12
17
  export interface NamespaceSelectionFormData {
13
- [namespace: string]: boolean;
18
+ [namespace: string]: SelectedNamespace;
14
19
  }
15
20
  export interface ISetupState {
16
21
  availableSources: AvailableSourcesByNamespace;
package/lib/store.js CHANGED
@@ -1,4 +1,4 @@
1
- export { u as useDarkMode, a as useDataStreamStore, b as useDrawerStore, c as useEntityStore, d as useFilterStore, e as useInstrumentStore, f as useModalStore, g as useNotificationStore, h as usePendingStore, i as useSelectedStore, j as useSetupStore } from './index-BD7meETN.js';
1
+ export { u as useDarkMode, a as useDataStreamStore, b as useDrawerStore, c as useEntityStore, d as useFilterStore, e as useInstrumentStore, f as useModalStore, g as useNotificationStore, h as usePendingStore, i as useSelectedStore, j as useSetupStore } from './index-BRGQ84pJ.js';
2
2
  import 'react';
3
3
  import './types.js';
4
4
  import 'styled-components';
package/lib/theme.js CHANGED
@@ -1,4 +1,4 @@
1
- export { T as default } from './index-BD7meETN.js';
1
+ export { T as default } from './index-BRGQ84pJ.js';
2
2
  import 'styled-components';
3
3
  import 'react';
4
4
  import './types.js';
@@ -63,6 +63,9 @@ export declare enum EntityTypes {
63
63
  Action = "Action",
64
64
  InstrumentationRule = "InstrumentationRule"
65
65
  }
66
+ export declare enum OtherEntityTypes {
67
+ DataStream = "DataStream"
68
+ }
66
69
  export declare enum FieldTypes {
67
70
  Input = "input",
68
71
  MultiInput = "multiInput",
@@ -2,6 +2,7 @@ import type { Source } from '../sources';
2
2
  export interface Namespace {
3
3
  name: string;
4
4
  selected: boolean;
5
+ dataStreamNames: string[];
5
6
  sources?: Source[];
6
7
  }
7
8
  export type FetchSingleNamespace = (payload: {
@@ -1,5 +1,5 @@
1
- import { SelectedSource } from '@/store';
2
1
  import { type Condition, ProgrammingLanguages } from '../common';
2
+ import type { NamespaceSelectionFormData, SourceSelectionFormData } from '@/store';
3
3
  export declare enum K8sResourceKind {
4
4
  Deployment = "Deployment",
5
5
  DaemonSet = "DaemonSet",
@@ -34,8 +34,4 @@ export interface SourceFormData {
34
34
  language?: ProgrammingLanguages | null;
35
35
  version?: string;
36
36
  }
37
- export type PersistSources = (selectAppsList: {
38
- [namespace: string]: SelectedSource[];
39
- }, futureSelectAppsList: {
40
- [namespace: string]: boolean;
41
- }) => void;
37
+ export type PersistSources = (selectAppsList: SourceSelectionFormData, futureSelectAppsList: NamespaceSelectionFormData) => void;
package/lib/types.js CHANGED
@@ -131,6 +131,10 @@ var EntityTypes;
131
131
  EntityTypes["Action"] = "Action";
132
132
  EntityTypes["InstrumentationRule"] = "InstrumentationRule";
133
133
  })(EntityTypes || (EntityTypes = {}));
134
+ var OtherEntityTypes;
135
+ (function (OtherEntityTypes) {
136
+ OtherEntityTypes["DataStream"] = "DataStream";
137
+ })(OtherEntityTypes || (OtherEntityTypes = {}));
134
138
  var FieldTypes;
135
139
  (function (FieldTypes) {
136
140
  FieldTypes["Input"] = "input";
@@ -309,4 +313,4 @@ var K8sResourceKind;
309
313
  K8sResourceKind["CronJob"] = "CronJob";
310
314
  })(K8sResourceKind || (K8sResourceKind = {}));
311
315
 
312
- export { ActionCategory, ActionKeyTypes, ActionType, AddNodeTypes, BooleanOperation, CodeAttributesKeyTypes, Crud, DestinationTypes, EdgeTypes, EntityTypes, FieldTypes, HeadersCollectionKeyTypes, InputTypes, InstrumentationRuleType, IntrumentationStatus, JsonOperation, K8sResourceKind, NodeTypes, NumberOperation, OtherStatus, PayloadCollectionKeyTypes, PlatformType, ProgrammingLanguages, SignalType, SortDirection, StatusType, StringOperation, Tier };
316
+ export { ActionCategory, ActionKeyTypes, ActionType, AddNodeTypes, BooleanOperation, CodeAttributesKeyTypes, Crud, DestinationTypes, EdgeTypes, EntityTypes, FieldTypes, HeadersCollectionKeyTypes, InputTypes, InstrumentationRuleType, IntrumentationStatus, JsonOperation, K8sResourceKind, NodeTypes, NumberOperation, OtherEntityTypes, OtherStatus, PayloadCollectionKeyTypes, PlatformType, ProgrammingLanguages, SignalType, SortDirection, StatusType, StringOperation, Tier };
@@ -1,9 +1,9 @@
1
1
  import { ActionKeyTypes, ActionType, StatusType, AddNodeTypes, EntityTypes, FieldTypes } from './types.js';
2
- import { g as useNotificationStore, F as FORM_ALERTS, f as useModalStore, b as useDrawerStore, c as useEntityStore, a as useDataStreamStore, j as useSetupStore } from './index-BD7meETN.js';
2
+ import { g as useNotificationStore, F as FORM_ALERTS, f as useModalStore, b as useDrawerStore, c as useEntityStore, a as useDataStreamStore, j as useSetupStore } from './index-BRGQ84pJ.js';
3
3
  import { useState, useEffect, useMemo } from 'react';
4
4
  import 'styled-components';
5
5
  import { i as isEmpty, s as safeJsonParse } from './index-BV85P9UP.js';
6
- import { b as useGenericForm } from './useTransition-BWC_F-Pl.js';
6
+ import { b as useGenericForm } from './useTransition-DsrDiKOV.js';
7
7
  import { g as getIdFromSseTarget, i as isLegalK8sLabel, m as mapExportedSignals } from './index-BlZKWuxe.js';
8
8
 
9
9
  const INITIAL$2 = {
@@ -454,31 +454,43 @@ const useSourceFormData = () => {
454
454
  };
455
455
  };
456
456
 
457
- const mapSourceToAvailableSource = (source, selectedStreamName, selectAll) => {
458
- const sourceIsInCurrentStream = source.dataStreamNames?.includes(selectedStreamName) || source.currentStreamName === selectedStreamName;
459
- const selected = typeof selectAll === 'boolean' ? selectAll : sourceIsInCurrentStream ? source.selected : false;
457
+ const mapToAvailableSource = (source, selectedStreamName, selectAll) => {
458
+ const isBooleanOverride = typeof selectAll === 'boolean';
459
+ const isInCurrentStream = source.dataStreamNames?.includes(selectedStreamName) || source.currentStreamName === selectedStreamName;
460
+ const selected = (isBooleanOverride ? selectAll : source.selected) || false;
460
461
  return {
462
+ namespace: source.namespace,
461
463
  name: source.name,
462
464
  kind: source.kind,
463
- selected,
465
+ selected: isInCurrentStream || isBooleanOverride ? selected : false,
464
466
  numberOfInstances: source.numberOfInstances,
465
467
  };
466
468
  };
467
- const mapSourceToSelectedSource = (source, selectedStreamName, selectAll) => {
469
+ const mapToSelectedSource = (source, selectedStreamName, selectAll) => {
468
470
  return {
469
- ...mapSourceToAvailableSource(source, selectedStreamName, selectAll),
471
+ ...mapToAvailableSource(source, selectedStreamName, selectAll),
472
+ currentStreamName: selectedStreamName,
473
+ };
474
+ };
475
+ const mapToSelectedNamespace = (ns, selectedStreamName, selectAll) => {
476
+ const isBooleanOverride = typeof selectAll === 'boolean';
477
+ const isInCurrentStream = ns.dataStreamNames?.includes(selectedStreamName);
478
+ const selected = (isBooleanOverride ? selectAll : ns.selected) || false;
479
+ return {
480
+ namespace: ns.name,
481
+ selected: isInCurrentStream || isBooleanOverride ? selected : false,
470
482
  currentStreamName: selectedStreamName,
471
483
  };
472
484
  };
473
485
  const mergeAvailableAndSelectedSources = (available, selected, currentStreamName) => {
474
486
  const payload = {};
475
487
  Object.entries(available).forEach(([namespace, sources]) => {
476
- payload[namespace] = sources.map((s) => mapSourceToSelectedSource(s, currentStreamName));
488
+ payload[namespace] = sources.map((s) => mapToSelectedSource(s, currentStreamName));
477
489
  });
478
490
  Object.entries(selected).forEach(([namespace, sources]) => {
479
491
  sources.forEach((s) => {
480
492
  const foundIdx = payload[namespace].findIndex((src) => src.name === s.name && src.kind === s.kind);
481
- const mapped = mapSourceToSelectedSource(s, currentStreamName);
493
+ const mapped = mapToSelectedSource(s, currentStreamName);
482
494
  if (foundIdx !== -1) {
483
495
  payload[namespace][foundIdx] = mapped;
484
496
  }
@@ -501,25 +513,25 @@ const useSourceSelectionFormData = (params) => {
501
513
  const [selectedNamespace, setSelectedNamespace] = useState('');
502
514
  const [selectedFutureApps, setSelectedFutureApps] = useState(configuredFutureApps);
503
515
  const [selectedSources, setSelectedSources] = useState(mergeAvailableAndSelectedSources(availableSourcesFromStore, configuredSources, selectedStreamName));
504
- const fetchAndSetThisNamespace = (ns, selectAll) => {
505
- fetchSingleNamespace?.({ variables: { namespaceName: ns } }).then(({ data }) => {
516
+ const fetchAndSetThisNamespace = async (ns, selectAll) => {
517
+ if (fetchSingleNamespace) {
518
+ const { data } = await fetchSingleNamespace({ variables: { namespaceName: ns.name } });
506
519
  const { name, sources = [] } = data?.computePlatform?.k8sActualNamespace || {};
507
520
  if (!name)
508
521
  return;
509
- // initialize sources for this namespace
510
522
  setRecordedInitialSources((prev) => ({
511
523
  ...prev,
512
- [name]: sources.map((s) => mapSourceToAvailableSource(s, selectedStreamName)),
524
+ [name]: sources.map((s) => mapToAvailableSource(s, selectedStreamName)),
513
525
  }));
514
526
  setSelectedSources((prev) => ({
515
527
  ...prev,
516
- [name]: typeof selectAll !== 'boolean' && prev[name]?.length ? prev[name] : sources.map((s) => mapSourceToSelectedSource(s, selectedStreamName, selectAll)),
528
+ [name]: typeof selectAll !== 'boolean' && prev[name]?.length ? prev[name] : sources.map((s) => mapToSelectedSource(s, selectedStreamName, selectAll)),
517
529
  }));
518
- });
530
+ }
519
531
  };
520
532
  useEffect(() => {
521
533
  if (!!namespaces?.length) {
522
- // initialize all states (to avoid undefined errors)
534
+ // initialize empty states to avoid undefined errors
523
535
  setRecordedInitialSources((prev) => {
524
536
  const payload = { ...prev };
525
537
  namespaces.forEach(({ name }) => (payload[name] = payload[name] || []));
@@ -532,22 +544,28 @@ const useSourceSelectionFormData = (params) => {
532
544
  });
533
545
  setSelectedFutureApps((prev) => {
534
546
  const payload = { ...prev };
535
- namespaces.forEach(({ name, selected }) => (payload[name] = payload[name] || selected || false));
547
+ namespaces.forEach((ns) => (payload[ns.name] = payload[ns.name] || mapToSelectedNamespace(ns, selectedStreamName)));
536
548
  return payload;
537
549
  });
538
- namespaces.forEach(({ name }) => fetchAndSetThisNamespace(name));
550
+ (async () => {
551
+ for await (const ns of namespaces)
552
+ await fetchAndSetThisNamespace(ns);
553
+ })();
539
554
  }
540
- }, [namespaces]);
555
+ }, [namespaces, selectedStreamName]);
541
556
  // form filters
542
557
  const [searchText, setSearchText] = useState('');
543
558
  const [searchBy, setSearchBy] = useState(EntityTypes.Source);
544
559
  const [showSelectedOnly, setShowSelectedOnly] = useState(false);
545
- const onSelectNamespace = (ns, selectAll) => {
546
- setSelectedNamespace((prev) => (prev === ns && typeof selectAll !== 'boolean' ? '' : ns));
547
- fetchAndSetThisNamespace(ns, selectAll);
560
+ const onSelectNamespace = (nsName, selectAll) => {
561
+ const ns = namespaces.find((namespace) => namespace.name === nsName);
562
+ if (ns) {
563
+ setSelectedNamespace((prev) => (prev === nsName && typeof selectAll !== 'boolean' ? '' : nsName));
564
+ fetchAndSetThisNamespace(ns, selectAll);
565
+ }
548
566
  };
549
- const onSelectSource = (source, namespace) => {
550
- const id = namespace || selectedNamespace;
567
+ const onSelectSource = (source, nsName) => {
568
+ const id = nsName || selectedNamespace;
551
569
  if (!id)
552
570
  return;
553
571
  const arr = [...(selectedSources[id] || [])];
@@ -562,11 +580,13 @@ const useSourceSelectionFormData = (params) => {
562
580
  }
563
581
  setSelectedSources((prev) => ({ ...prev, [id]: arr }));
564
582
  };
565
- const onSelectFutureApps = (bool, namespace) => {
566
- const id = namespace || selectedNamespace;
583
+ const onSelectFutureApps = (bool, nsName) => {
584
+ const id = nsName || selectedNamespace;
567
585
  if (!id)
568
586
  return;
569
- setSelectedFutureApps((prev) => ({ ...prev, [id]: bool }));
587
+ const ns = namespaces.find((namespace) => namespace.name === nsName);
588
+ if (ns)
589
+ setSelectedFutureApps((prev) => ({ ...prev, [id]: mapToSelectedNamespace(ns, selectedStreamName, bool) }));
570
590
  };
571
591
  const filteredNamespacesAndSources = useMemo(() => {
572
592
  const isSearchOk = (targetText, entityType) => !searchText || searchBy !== entityType || (searchBy === entityType && targetText.toLowerCase().includes(searchText));
@@ -585,7 +605,7 @@ const useSourceSelectionFormData = (params) => {
585
605
  const payload = {};
586
606
  Object.entries(selectedSources).forEach(([namespace, sources]) => {
587
607
  sources.forEach((source) => {
588
- const foundInitial = availableSources[namespace]?.find((initialSource) => initialSource.name === source.name && initialSource.kind === source.kind);
608
+ const foundInitial = availableSources[namespace]?.find((src) => src.name === source.name && src.kind === source.kind);
589
609
  if (foundInitial?.selected !== source.selected) {
590
610
  if (!payload[namespace])
591
611
  payload[namespace] = [];
@@ -598,10 +618,10 @@ const useSourceSelectionFormData = (params) => {
598
618
  // This is to filter the user-specific-selections, therebey minimizing the amount of data sent to the API on "persist namespaces".
599
619
  const getApiFutureAppsPayload = () => {
600
620
  const payload = {};
601
- Object.entries(selectedFutureApps).forEach(([namespace, selected]) => {
621
+ Object.entries(selectedFutureApps).forEach(([namespace, obj]) => {
602
622
  const foundInitial = namespaces?.find((ns) => ns.name === namespace);
603
- if (foundInitial?.selected !== selected) {
604
- payload[namespace] = selected;
623
+ if ((obj.selected && !foundInitial?.dataStreamNames?.includes(selectedStreamName)) || (!obj.selected && foundInitial?.dataStreamNames?.includes(selectedStreamName))) {
624
+ payload[namespace] = obj;
605
625
  }
606
626
  });
607
627
  return payload;
@@ -1,5 +1,5 @@
1
1
  import React, { useState, useRef, useEffect, useCallback } from 'react';
2
- import { g as useNotificationStore } from './index-BD7meETN.js';
2
+ import { g as useNotificationStore } from './index-BRGQ84pJ.js';
3
3
  import { CodeAttributesKeyTypes, PayloadCollectionKeyTypes } from './types.js';
4
4
  import styled from 'styled-components';
5
5
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@odigos/ui-kit",
3
- "version": "0.0.44",
3
+ "version": "0.0.46",
4
4
  "author": "Odigos",
5
5
  "repository": {
6
6
  "type": "git",
@@ -114,12 +114,12 @@
114
114
  "eslint": "^9.29.0",
115
115
  "eslint-config-next": "^15.3.3",
116
116
  "eslint-plugin-storybook": "9.0.11",
117
- "next": "^15.3.3",
117
+ "next": "^15.3.4",
118
118
  "postcss": "^8.5.6",
119
119
  "rollup": "^4.43.0",
120
120
  "rollup-plugin-postcss": "^4.0.2",
121
121
  "rollup-plugin-typescript2": "^0.36.0",
122
- "storybook": "9.0.11",
122
+ "storybook": "9.0.12",
123
123
  "typescript": "^5.8.3"
124
124
  }
125
125
  }