@odigos/ui-kit 0.0.95 → 0.0.98

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 (37) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/lib/components/data-card/data-card-fields/index.d.ts +2 -1
  3. package/lib/components/data-card/index.d.ts +2 -1
  4. package/lib/components/drawer/drawer-header/index.d.ts +2 -1
  5. package/lib/components/drawer/index.d.ts +2 -2
  6. package/lib/components/text/index.d.ts +2 -1
  7. package/lib/components.js +8 -8
  8. package/lib/constants/strings/index.d.ts +1 -0
  9. package/lib/constants.js +1 -1
  10. package/lib/containers/trace-view/index.d.ts +1 -0
  11. package/lib/containers/trace-view/span/index.d.ts +5 -0
  12. package/lib/containers/trace-view/span-drawer/build-details-card.d.ts +3 -0
  13. package/lib/containers/trace-view/span-drawer/build-logs-card.d.ts +3 -0
  14. package/lib/containers/trace-view/span-drawer/build-process-card.d.ts +3 -0
  15. package/lib/containers/trace-view/span-drawer/build-tags-card.d.ts +3 -0
  16. package/lib/containers/trace-view/span-drawer/index.d.ts +9 -0
  17. package/lib/containers.js +175 -53
  18. package/lib/functions.js +7 -7
  19. package/lib/hooks/useSourceSelectionFormData.d.ts +2 -0
  20. package/lib/hooks.js +43 -18
  21. package/lib/icons.js +8 -15
  22. package/lib/{index-333086d8.js → index-0a77c1be.js} +1 -1
  23. package/lib/{index-b0883db6.js → index-195415d4.js} +1 -1
  24. package/lib/{index-a53852b3.js → index-77cf7846.js} +9 -2
  25. package/lib/{index-40dfa720.js → index-89edd01d.js} +1 -0
  26. package/lib/{index-d92ef50b.js → index-9475009f.js} +2 -2
  27. package/lib/{index-9a7beddb.js → index-a3c0cecd.js} +2 -2
  28. package/lib/{index-bf427e64.js → index-c823fbfb.js} +3 -3
  29. package/lib/{index-c529b896.js → index-c8b542d8.js} +30 -21
  30. package/lib/{index-1bc2b507.js → index-d8fb5fed.js} +1 -1
  31. package/lib/{index-eff01b3d.js → index-f18c8530.js} +1 -1
  32. package/lib/snippets.js +7 -7
  33. package/lib/store.js +1 -1
  34. package/lib/theme.js +1 -1
  35. package/lib/types/traces/index.d.ts +1 -1
  36. package/lib/{useTransition-2df374a9.js → useTransition-159c9af8.js} +1 -1
  37. package/package.json +1 -1
package/lib/containers.js CHANGED
@@ -1,21 +1,21 @@
1
1
  import React, { useState, useEffect, forwardRef, useRef, useImperativeHandle, useMemo, Fragment, useCallback, Children } from 'react';
2
2
  import styled, { css } from 'styled-components';
3
- import { b as DISPLAY_TITLES, T as Theme, V as usePendingStore, W as useNotificationStore, Q as useDrawerStore, B as BUTTON_TEXTS, X as useEntityStore, A as ACTION_OPTIONS, g as getActionIcon, O as useModalStore, F as FORM_ALERTS, Y as useFilterStore, e as getInstrumentationRuleIcon, Z as useDataStreamStore, _ as useInstrumentStore, d as getEntityId, D as DISPLAY_LANGUAGES, M as MONITORS_OPTIONS, S as STORAGE_KEYS, a as DEFAULT_DATA_STREAM_NAME, c as compareCondition, $ as useSetupStore, f as getProgrammingLanguageIcon, I as INSTRUMENTATION_RULE_OPTIONS, a0 as useSelectedStore, l as ImageErrorIcon, a1 as useDarkMode } from './index-40dfa720.js';
3
+ import { b as DISPLAY_TITLES, T as Theme, V as usePendingStore, W as useNotificationStore, Q as useDrawerStore, B as BUTTON_TEXTS, X as useEntityStore, A as ACTION_OPTIONS, g as getActionIcon, O as useModalStore, F as FORM_ALERTS, Y as useFilterStore, e as getInstrumentationRuleIcon, Z as useDataStreamStore, _ as useInstrumentStore, d as getEntityId, D as DISPLAY_LANGUAGES, M as MONITORS_OPTIONS, S as STORAGE_KEYS, a as DEFAULT_DATA_STREAM_NAME, c as compareCondition, $ as useSetupStore, f as getProgrammingLanguageIcon, I as INSTRUMENTATION_RULE_OPTIONS, a0 as useSelectedStore, l as ImageErrorIcon, a1 as useDarkMode } from './index-89edd01d.js';
4
4
  import { ActionType, ActionKeyTypes, InputTypes, FieldTypes, EntityTypes, StatusType, Crud, OtherStatus, NodeTypes, EdgeTypes, AddNodeTypes, SignalType, HeadersCollectionKeyTypes, CustomInstrumentationsKeyTypes, CodeAttributesKeyTypes, PayloadCollectionKeyTypes, InstrumentationRuleType, K8sResourceKind, ProgrammingLanguages, MountMethod, AgentEnvVarsInjectionMethod, Profile, InstallationMethod } from './types.js';
5
- import { e as DataCardFieldTypes, p as FieldLabel, C as Checkbox, o as FieldError, v as Input, x as InputTable, a3 as Toggle, K as KeyValueInputsList, w as InputList, _ as Text, R as Segment, Q as SectionTitle, j as DocsButton, z as MonitorsCheckboxes, a2 as TextArea, k as Drawer, c as ConditionDetails, D as DataCard, a8 as FlexColumn, M as Modal, N as NavigationButtons, ac as ModalBody, L as NotificationNote, A as AutocompleteInput, i as Divider, W as Status, a7 as FlexRow, a4 as Tooltip, s as IconWrapped, G as MonitorsIcons, ad as TableContainer, ae as TableTitleWrap, r as IconTitleBadge, af as TableWrap, y as InteractiveTable, a9 as CenterThis, J as NoDataFound, a5 as TraceLoader, a as Badge, ag as nodeConfig, ah as useNodesState, ai as useEdgesState, aj as Flow, ak as applyNodeChanges, P as Popup, U as SelectionButton, aa as VerticalScroll, n as Dropdown, B as Button, I as IconButton, E as ExtendArrow, al as AddButton, F as FadeLoader, g as DataTab, X as Stepper, d as DataCardFields, Z as Tag, am as MarkerType, t as IconsNav, an as CopyText, h as DescribeRow, ao as PodContainer, ap as SourceContainer, q as IconGroup, O as PopupForm, S as ScrollX } from './index-c529b896.js';
5
+ import { e as DataCardFieldTypes, p as FieldLabel, C as Checkbox, o as FieldError, v as Input, x as InputTable, a3 as Toggle, K as KeyValueInputsList, w as InputList, _ as Text, R as Segment, Q as SectionTitle, j as DocsButton, z as MonitorsCheckboxes, a2 as TextArea, k as Drawer, c as ConditionDetails, D as DataCard, a8 as FlexColumn, M as Modal, N as NavigationButtons, ac as ModalBody, L as NotificationNote, A as AutocompleteInput, i as Divider, W as Status, a7 as FlexRow, a4 as Tooltip, s as IconWrapped, G as MonitorsIcons, ad as TableContainer, ae as TableTitleWrap, r as IconTitleBadge, af as TableWrap, y as InteractiveTable, a9 as CenterThis, J as NoDataFound, a5 as TraceLoader, a as Badge, ag as nodeConfig, ah as useNodesState, ai as useEdgesState, aj as Flow, ak as applyNodeChanges, P as Popup, U as SelectionButton, aa as VerticalScroll, n as Dropdown, B as Button, I as IconButton, E as ExtendArrow, al as AddButton, F as FadeLoader, g as DataTab, X as Stepper, d as DataCardFields, Z as Tag, am as MarkerType, t as IconsNav, an as CopyText, h as DescribeRow, ao as PodContainer, ap as SourceContainer, q as IconGroup, O as PopupForm, T as ToggleCodeComponent, S as ScrollX } from './index-c8b542d8.js';
6
6
  import { i as isEmpty, s as safeJsonParse, d as deepClone } from './index-5e5f7bda.js';
7
- import { C as CheckCircledIcon, O as OdigosLogo, E as ErrorTriangleIcon } from './index-eff01b3d.js';
8
- import { C as CrossCircledIcon, O as OdigosLogoText, F as FilterIcon, D as DataStreamsIcon, A as ArrowIcon, R as RefreshLeftArrowIcon, N as NotificationIcon, U as UserIcon, a as OverviewIcon, S as SlackLogo, K as KeyIcon, T as TerminalIcon, G as GearIcon } from './index-a53852b3.js';
7
+ import { C as CheckCircledIcon, O as OdigosLogo, W as WarningTriangleIcon, E as ErrorTriangleIcon } from './index-f18c8530.js';
8
+ import { C as CrossCircledIcon, O as OdigosLogoText, F as FilterIcon, D as DataStreamsIcon, A as ArrowIcon, R as RefreshLeftArrowIcon, N as NotificationIcon, U as UserIcon, a as OverviewIcon, S as SlackLogo, K as KeyIcon, T as TerminalIcon, G as GearIcon, b as TraceViewIcon } from './index-77cf7846.js';
9
9
  import { useActionFormData, useSessionStorage, useDataStreamFormData, useDestinationFormData, useClickNotification, useSourceFormData, useSourceSelectionFormData } from './hooks.js';
10
- import { u as useKeyDown, a as useContainerSize, b as useClickNode, c as usePopup, d as useOnClickOutside, e as useInstrumentationRuleFormData, f as useTransition, g as useTimeAgo, h as useCopy, i as useGenericForm } from './useTransition-2df374a9.js';
11
- import { E as EditIcon, T as TrashIcon, S as SearchIcon, h as CheckIcon, P as PlusIcon, a as CopyIcon } from './index-1bc2b507.js';
12
- import { D as DeleteWarning, C as CancelWarning } from './index-9a7beddb.js';
13
- import { g as getConditionsBooleans, m as mapConditions, b as getStatusIcon, h as splitCamelString, c as capitalizeFirstLetter, i as isStringABoolean, p as parseBooleanFromString } from './index-d92ef50b.js';
14
- import { f as filterActions, l as getEntityLabel, k as getEntityIcon, u as sleep, e as formatBytes, i as getContainersIcons, o as getValueForRange, j as getDestinationIcon, d as filterSourcesByStream, c as filterSources, b as filterDestinationsByStream, a as filterDestinations, t as mapDestinationFieldsForDisplay, q as getYamlFieldsForDestination, m as getMetricForEntity, p as getWorkloadId, r as hasUnhealthyInstances, h as getContainersInstrumentedCount, s as isOverTime, n as getRecursiveValues, g as formatDuration } from './index-bf427e64.js';
10
+ import { u as useKeyDown, a as useContainerSize, b as useClickNode, c as usePopup, d as useOnClickOutside, e as useInstrumentationRuleFormData, f as useTransition, g as useTimeAgo, h as useCopy, i as useGenericForm } from './useTransition-159c9af8.js';
11
+ import { E as EditIcon, T as TrashIcon, S as SearchIcon, h as CheckIcon, P as PlusIcon, a as CopyIcon } from './index-d8fb5fed.js';
12
+ import { D as DeleteWarning, C as CancelWarning } from './index-a3c0cecd.js';
13
+ import { g as getConditionsBooleans, m as mapConditions, b as getStatusIcon, h as splitCamelString, c as capitalizeFirstLetter, i as isStringABoolean, p as parseBooleanFromString } from './index-9475009f.js';
14
+ import { f as filterActions, l as getEntityLabel, k as getEntityIcon, u as sleep, e as formatBytes, i as getContainersIcons, o as getValueForRange, j as getDestinationIcon, d as filterSourcesByStream, c as filterSources, b as filterDestinationsByStream, a as filterDestinations, t as mapDestinationFieldsForDisplay, q as getYamlFieldsForDestination, m as getMetricForEntity, p as getWorkloadId, r as hasUnhealthyInstances, h as getContainersInstrumentedCount, s as isOverTime, g as formatDuration, n as getRecursiveValues } from './index-c823fbfb.js';
15
15
  import { m as mapExportedSignals } from './index-6a6bea6e.js';
16
16
  import { NoteBackToSummary, EditButton } from './snippets.js';
17
17
  import { D as DESTINATION_CATEGORIES } from './index-1cb4f9e2.js';
18
- import { a6 as RulesIcon, a3 as SourcesIcon, a5 as ActionsIcon, a4 as DestinationsIcon } from './index-b0883db6.js';
18
+ import { a6 as RulesIcon, a3 as SourcesIcon, a5 as ActionsIcon, a4 as DestinationsIcon } from './index-195415d4.js';
19
19
  import 'react-dom';
20
20
 
21
21
  const buildCard$3 = (action) => {
@@ -677,7 +677,7 @@ const FormContainer$4 = styled.div `
677
677
  overflow: overlay;
678
678
  overflow-y: auto;
679
679
  `;
680
- const DataContainer$4 = styled.div `
680
+ const DataContainer$5 = styled.div `
681
681
  display: flex;
682
682
  flex-direction: column;
683
683
  gap: 12px;
@@ -732,7 +732,7 @@ const ActionDrawer = ({ updateAction, deleteAction }) => {
732
732
  React.createElement(ActionForm, { isUpdate: true, action: thisOptionType, formData: formData, formErrors: formErrors, handleFormChange: (...params) => {
733
733
  setIsFormDirty(true);
734
734
  handleFormChange(...params);
735
- } }))) : (React.createElement(DataContainer$4, null,
735
+ } }))) : (React.createElement(DataContainer$5, null,
736
736
  React.createElement(ConditionDetails, { conditions: thisItem.conditions || [] }),
737
737
  React.createElement(DataCard, { title: DISPLAY_TITLES.ACTION_DETAILS, data: !!thisItem ? buildCard$3(thisItem) : [] })))));
738
738
  };
@@ -2373,7 +2373,7 @@ const FormContainer$2 = styled.div `
2373
2373
  overflow: overlay;
2374
2374
  overflow-y: auto;
2375
2375
  `;
2376
- const DataContainer$3 = styled.div `
2376
+ const DataContainer$4 = styled.div `
2377
2377
  display: flex;
2378
2378
  flex-direction: column;
2379
2379
  gap: 12px;
@@ -2438,7 +2438,7 @@ const DestinationDrawer = ({ categories, updateDestination, deleteDestination, t
2438
2438
  }, dynamicFields: dynamicFields, setDynamicFields: (...params) => {
2439
2439
  setIsFormDirty(true);
2440
2440
  setDynamicFields(...params);
2441
- }, validateForm: validateForm, testConnection: testConnection }))) : (React.createElement(DataContainer$3, null,
2441
+ }, validateForm: validateForm, testConnection: testConnection }))) : (React.createElement(DataContainer$4, null,
2442
2442
  thisItem.conditions?.length ? React.createElement(ConditionDetails, { conditions: thisItem.conditions }) : null,
2443
2443
  React.createElement(DataCard, { title: DISPLAY_TITLES.DESTINATION_DETAILS, data: !!thisItem ? buildCard$2(thisItem, yamlFields) : [] })))));
2444
2444
  };
@@ -4250,7 +4250,7 @@ const FormContainer = styled.div `
4250
4250
  overflow: overlay;
4251
4251
  overflow-y: auto;
4252
4252
  `;
4253
- const DataContainer$2 = styled.div `
4253
+ const DataContainer$3 = styled.div `
4254
4254
  display: flex;
4255
4255
  flex-direction: column;
4256
4256
  gap: 12px;
@@ -4359,7 +4359,7 @@ const SourceDrawer = ({ persistSources, updateSource, restartWorkloads, fetchSou
4359
4359
  setIsFormDirty(true);
4360
4360
  handleFormChange(...params);
4361
4361
  handleFormChange('currentStreamName', selectedStreamName);
4362
- } }))) : (React.createElement(DataContainer$2, null,
4362
+ } }))) : (React.createElement(DataContainer$3, null,
4363
4363
  React.createElement(ConditionDetails, { conditions: thisItem.conditions || [] }),
4364
4364
  React.createElement(DataCard, { title: DISPLAY_TITLES.SOURCE_DETAILS, data: !!thisItem ? buildCard(thisItem) : [] }),
4365
4365
  React.createElement(DataCard, { title: DISPLAY_TITLES.DETECTED_CONTAINERS, titleBadge: containersData.isLoading ? OtherStatus.Loading : containersData.containers.length, description: containersData.description || DISPLAY_TITLES.DETECTED_CONTAINERS_DESCRIPTION }, containersData.containers.map((container) => (React.createElement(SourceContainer, { key: `source-container-${container.containerName}`, ...container, callbackRuntimeOverride: async (payload) => await updateSource(drawerEntityId, payload) }))))))) : selectedTab === Tabs.Pods ? (React.createElement(Describe$1, { source: thisItem, fetchSourceDescribe: fetchSourceDescribe })) : (React.createElement(Libraries, { source: thisItem, fetchSourceLibraries: fetchSourceLibraries }))));
@@ -4372,7 +4372,7 @@ const SearchWrapper = styled.div `
4372
4372
  const SourceSelectionForm = forwardRef(({ isModal, fetchSingleNamespace, onClickSummary }, ref) => {
4373
4373
  const theme = Theme.useTheme();
4374
4374
  const formState = useSourceSelectionFormData({ fetchSingleNamespace });
4375
- const { availableSources, selectedSources, getApiSourcesPayload, getApiFutureAppsPayload, searchText, setSearchText, searchBy, setSearchBy, showSelectedOnly, setShowSelectedOnly, showRunningOnly, setShowRunningOnly, } = formState;
4375
+ const { availableSources, selectedSources, isFetchingEachNamespace, selectedAllNamespaces, onSelectAllNamespaces, getApiSourcesPayload, getApiFutureAppsPayload, searchText, setSearchText, searchBy, setSearchBy, showSelectedOnly, setShowSelectedOnly, showRunningOnly, setShowRunningOnly, } = formState;
4376
4376
  useImperativeHandle(ref, () => ({
4377
4377
  getFormValues: () => ({
4378
4378
  initial: availableSources,
@@ -4394,6 +4394,7 @@ const SourceSelectionForm = forwardRef(({ isModal, fetchSingleNamespace, onClick
4394
4394
  { label: DISPLAY_TITLES.NAMESPACE, value: EntityTypes.Namespace, selectedBgColor: theme.text.secondary, selectedTextColor: theme.text.primary },
4395
4395
  ], selected: searchBy, setSelected: setSearchBy })),
4396
4396
  React.createElement(FlexRow, { "$gap": 36 },
4397
+ React.createElement(Toggle, { title: DISPLAY_TITLES.SELECT_ALL, initialValue: selectedAllNamespaces, onChange: onSelectAllNamespaces, disabled: isFetchingEachNamespace }),
4397
4398
  React.createElement(Toggle, { title: DISPLAY_TITLES.ONLY_SELECTED, initialValue: showSelectedOnly, onChange: setShowSelectedOnly }),
4398
4399
  React.createElement(Toggle, { title: DISPLAY_TITLES.ONLY_RUNNING_INSTANCES, initialValue: showRunningOnly, onChange: setShowRunningOnly }))),
4399
4400
  React.createElement(Divider, null),
@@ -4416,6 +4417,8 @@ const SourceModal = ({ fetchSingleNamespace, persistSources }) => {
4416
4417
  };
4417
4418
  const formRef = useRef(null);
4418
4419
  useKeyDown({ key: 'Enter', active: isOpen }, handleSubmit);
4420
+ if (!isOpen)
4421
+ return null;
4419
4422
  return (React.createElement(Modal, { isOpen: isOpen, onClose: handleClose, header: { title: 'Add Source' }, actionComponent: React.createElement(NavigationButtons, { buttons: [
4420
4423
  {
4421
4424
  label: 'DONE',
@@ -4569,16 +4572,16 @@ const SourceTable = ({ metrics, maxHeight, maxWidth }) => {
4569
4572
  return (React.createElement(TableContainer, { "$maxWidth": maxWidth },
4570
4573
  React.createElement(TableTitleWrap, null,
4571
4574
  React.createElement(Checkbox, { partiallyChecked: hasSelected && filtered?.length !== totalSelectedSources, value: hasSelected && filtered?.length === totalSelectedSources, onChange: onSelectAll, disabled: !filtered?.length }),
4572
- React.createElement(IconTitleBadge, { icon: getEntityIcon(EntityTypes.Source), title: DISPLAY_TITLES.SOURCES, badge: badge, badgeTooltip: badgeTooltip, loading: sourcesLoading && !isAwaitingInstrumentation })),
4575
+ React.createElement(IconTitleBadge, { icon: getEntityIcon(EntityTypes.Source), title: DISPLAY_TITLES.SOURCES, badge: badge, badgeTooltip: badgeTooltip, loading: sourcesLoading || isAwaitingInstrumentation })),
4573
4576
  React.createElement(TableWrap, { "$maxHeight": maxHeight },
4574
- React.createElement(InteractiveTable, { columns: columns, rows: isAwaitingInstrumentation ? [] : rows })),
4575
- isAwaitingInstrumentation ? (React.createElement(CenterThis, { style: { marginTop: '2rem', gap: '24px' } },
4577
+ React.createElement(InteractiveTable, { columns: columns, rows: rows })),
4578
+ isAwaitingInstrumentation && !rows.length ? (React.createElement(CenterThis, { style: { marginTop: '2rem', gap: '24px' } },
4576
4579
  React.createElement(TraceLoader, { width: 420 }),
4577
4580
  React.createElement(FlexRow, { "$gap": 16 },
4578
4581
  React.createElement(Text, { color: theme.text.info },
4579
4582
  !!sourcesToCreate ? 'Instrumenting' : 'Uninstrumenting',
4580
4583
  " workloads..."),
4581
- React.createElement(Badge, { label: `${instrumentingPercent}%` })))) : !filtered.length ? (React.createElement(CenterThis, { style: { marginTop: '2rem' } },
4584
+ React.createElement(Badge, { label: `${instrumentingPercent}%` })))) : !rows.length ? (React.createElement(CenterThis, { style: { marginTop: '2rem' } },
4582
4585
  React.createElement(NoDataFound, null))) : null));
4583
4586
  };
4584
4587
 
@@ -4690,12 +4693,12 @@ const Describe = ({ fetchDescribeOdigos }) => {
4690
4693
  React.createElement(DataCard, { title: 'Node Collector', withExtend: true }, Object.values(describe?.nodeCollector || {}).map(mapObjectToCardChildren))));
4691
4694
  };
4692
4695
 
4693
- const DataContainer$1 = styled.div `
4696
+ const DataContainer$2 = styled.div `
4694
4697
  display: flex;
4695
4698
  flex-direction: column;
4696
4699
  gap: 12px;
4697
4700
  `;
4698
- const DRAWER_WIDTH$1 = '750px';
4701
+ const DRAWER_WIDTH$2 = '750px';
4699
4702
  const TITLE_TEXT$1 = 'System Overview';
4700
4703
  const SystemOverview = ({ tokens, saveToken, fetchDescribeOdigos }) => {
4701
4704
  const [isOpen, setIsOpen] = useState(false);
@@ -4703,13 +4706,13 @@ const SystemOverview = ({ tokens, saveToken, fetchDescribeOdigos }) => {
4703
4706
  return (React.createElement(React.Fragment, null,
4704
4707
  React.createElement(IconButton, { key: TITLE_TEXT$1, onClick: toggleOpen, tooltip: TITLE_TEXT$1 },
4705
4708
  React.createElement(TerminalIcon, { size: 18 })),
4706
- React.createElement(Drawer, { width: DRAWER_WIDTH$1, isOpen: isOpen, onClose: toggleOpen, header: {
4709
+ React.createElement(Drawer, { width: DRAWER_WIDTH$2, isOpen: isOpen, onClose: toggleOpen, header: {
4707
4710
  icons: [TerminalIcon],
4708
4711
  title: TITLE_TEXT$1,
4709
4712
  }, footer: {
4710
4713
  isOpen: false,
4711
4714
  } },
4712
- React.createElement(DataContainer$1, null,
4715
+ React.createElement(DataContainer$2, null,
4713
4716
  !!tokens?.length && React.createElement(Tokens, { tokens: tokens, saveToken: saveToken }),
4714
4717
  React.createElement(Describe, { fetchDescribeOdigos: fetchDescribeOdigos })))));
4715
4718
  };
@@ -4952,7 +4955,7 @@ const CollectorGatewaySettings = forwardRef(({ isAdvanced, formData, handleFormC
4952
4955
  });
4953
4956
  CollectorGatewaySettings.displayName = CollectorGatewaySettings.name;
4954
4957
 
4955
- const DataContainer = styled.div `
4958
+ const DataContainer$1 = styled.div `
4956
4959
  display: flex;
4957
4960
  flex-direction: column;
4958
4961
  gap: 12px;
@@ -4962,7 +4965,7 @@ const DataContainer = styled.div `
4962
4965
  const Relative = styled.div `
4963
4966
  position: relative;
4964
4967
  `;
4965
- const DRAWER_WIDTH = '750px';
4968
+ const DRAWER_WIDTH$1 = '750px';
4966
4969
  const TITLE_TEXT = 'System Settings';
4967
4970
  const SystemSettings = ({ installationMethod, fetchSettings, onSave }) => {
4968
4971
  const [settings, setSettings] = useState(undefined);
@@ -5048,7 +5051,7 @@ const SystemSettings = ({ installationMethod, fetchSettings, onSave }) => {
5048
5051
  return (React.createElement(React.Fragment, null,
5049
5052
  React.createElement(IconButton, { key: TITLE_TEXT, onClick: toggleOpen, tooltip: TITLE_TEXT },
5050
5053
  React.createElement(GearIcon, { size: 18 })),
5051
- React.createElement(Drawer, { width: DRAWER_WIDTH, isOpen: isOpen, onClose: () => handleWithCancelWarning(toggleOpen), header: {
5054
+ React.createElement(Drawer, { width: DRAWER_WIDTH$1, isOpen: isOpen, onClose: () => handleWithCancelWarning(toggleOpen), header: {
5052
5055
  icons: [GearIcon],
5053
5056
  title: TITLE_TEXT,
5054
5057
  tabs: tabsArray.map((tab) => ({
@@ -5079,7 +5082,7 @@ const SystemSettings = ({ installationMethod, fetchSettings, onSave }) => {
5079
5082
  children: BUTTON_TEXTS.SAVE,
5080
5083
  },
5081
5084
  ],
5082
- } }, formData?.imagePrefix !== undefined && !isSaving ? (React.createElement(DataContainer, { ref: scrollContainerRef },
5085
+ } }, formData?.imagePrefix !== undefined && !isSaving ? (React.createElement(DataContainer$1, { ref: scrollContainerRef },
5083
5086
  installationMethod === InstallationMethod.Helm && React.createElement(NotificationNote, { type: StatusType.Warning, title: 'Helm', message: "Changes won't persist unless you update the `values.yaml` file" }),
5084
5087
  React.createElement(GeneralSettings, { ref: generalRef, isAdvanced: isAdvanced, formData: formData, handleFormChange: handleFormChange }),
5085
5088
  React.createElement(UiSettings, { ref: uiRef, isAdvanced: isAdvanced, formData: formData, handleFormChange: handleFormChange }),
@@ -5228,6 +5231,100 @@ const buildSpans = (trace) => {
5228
5231
  return rootSpans.sort((a, b) => a.startTime - b.startTime);
5229
5232
  };
5230
5233
 
5234
+ const buildTagsCard = (span, isPrettyMode) => {
5235
+ const { tags } = span;
5236
+ const jsonTags = {};
5237
+ const arr = [];
5238
+ tags.forEach((tag) => {
5239
+ jsonTags[tag.key] = tag.value;
5240
+ });
5241
+ arr.push({
5242
+ type: DataCardFieldTypes.Code,
5243
+ value: {
5244
+ language: 'json',
5245
+ code: JSON.stringify(jsonTags, null, 2),
5246
+ pretty: isPrettyMode,
5247
+ },
5248
+ });
5249
+ return arr;
5250
+ };
5251
+
5252
+ const buildLogsCard = (span) => {
5253
+ const { logs } = span;
5254
+ const arr = [];
5255
+ logs.forEach((log, i) => {
5256
+ log.fields.forEach((field) => {
5257
+ arr.push({
5258
+ title: field.key,
5259
+ value: field.value,
5260
+ });
5261
+ });
5262
+ if (i !== logs.length - 1) {
5263
+ arr.push({ type: DataCardFieldTypes.Divider });
5264
+ }
5265
+ });
5266
+ return arr;
5267
+ };
5268
+
5269
+ const buildDetailsCard = (span) => {
5270
+ const { traceID, spanID, processID, operationName, duration, startTime, warnings } = span;
5271
+ const arr = [];
5272
+ arr.push({ type: DataCardFieldTypes.CopyText, title: 'Trace ID', value: traceID });
5273
+ arr.push({ type: DataCardFieldTypes.CopyText, title: 'Span ID', value: spanID });
5274
+ arr.push({ type: DataCardFieldTypes.Divider });
5275
+ arr.push({ title: 'Service', value: processID });
5276
+ arr.push({ title: 'Operation', value: operationName });
5277
+ arr.push({ title: 'Duration', value: formatDuration(duration) });
5278
+ arr.push({ title: 'Start time', value: new Date(startTime / 1000).toLocaleString() });
5279
+ if (warnings.length) {
5280
+ arr.push({ type: DataCardFieldTypes.Divider });
5281
+ arr.push({ title: 'Warnings', titleIcon: WarningTriangleIcon, value: warnings });
5282
+ }
5283
+ return arr;
5284
+ };
5285
+
5286
+ const buildProcessCard = (process, isPrettyMode) => {
5287
+ const { tags } = process;
5288
+ const jsonTags = {};
5289
+ const arr = [];
5290
+ tags.forEach((tag) => {
5291
+ jsonTags[tag.key] = tag.value;
5292
+ });
5293
+ arr.push({
5294
+ type: DataCardFieldTypes.Code,
5295
+ value: {
5296
+ language: 'json',
5297
+ code: JSON.stringify(jsonTags, null, 2),
5298
+ pretty: isPrettyMode,
5299
+ },
5300
+ });
5301
+ return arr;
5302
+ };
5303
+
5304
+ const DataContainer = styled.div `
5305
+ display: flex;
5306
+ flex-direction: column;
5307
+ gap: 12px;
5308
+ max-height: 100vh;
5309
+ overflow-y: auto;
5310
+ `;
5311
+ const DRAWER_WIDTH = '750px';
5312
+ const SpanDrawer = ({ span, process, onClose }) => {
5313
+ const [isTagsCodePretty, setIsTagsCodePretty] = useState(true);
5314
+ const [isProcessCodePretty, setIsProcessCodePretty] = useState(true);
5315
+ return (React.createElement(Drawer, { width: DRAWER_WIDTH, isOpen: true, onClose: onClose, header: {
5316
+ icons: [TraceViewIcon],
5317
+ title: span.operationName,
5318
+ }, footer: {
5319
+ isOpen: false,
5320
+ } },
5321
+ React.createElement(DataContainer, null,
5322
+ React.createElement(DataCard, { title: 'Details', data: buildDetailsCard(span) }),
5323
+ span.logs.length > 0 && React.createElement(DataCard, { title: 'Errors', titleBadge: span.logs.length, titleIcon: ErrorTriangleIcon, data: buildLogsCard(span) }),
5324
+ React.createElement(DataCard, { title: 'Tags', data: buildTagsCard(span, isTagsCodePretty), action: React.createElement(ToggleCodeComponent, { isPrettyMode: isTagsCodePretty, setIsPrettyMode: setIsTagsCodePretty }) }),
5325
+ process && (React.createElement(DataCard, { title: `Process (${process.serviceName})`, data: buildProcessCard(process, isProcessCodePretty), action: React.createElement(ToggleCodeComponent, { isPrettyMode: isProcessCodePretty, setIsPrettyMode: setIsProcessCodePretty }) })))));
5326
+ };
5327
+
5231
5328
  const LEFT_MAX_WIDTH = 370;
5232
5329
  const DURATION_COLORS = ['#33DCA7', '#50F6E8', '#444AD9', '#8B55FF', '#FF7CA9'].reverse();
5233
5330
  const Container$1 = styled.div `
@@ -5235,6 +5332,10 @@ const Container$1 = styled.div `
5235
5332
  align-items: center;
5236
5333
  width: ${LEFT_MAX_WIDTH}px;
5237
5334
  background-color: ${({ $withErrors, theme }) => ($withErrors ? theme.colors.error + Theme.opacity.hex['042'] : theme.colors.dark_grey)};
5335
+ &:hover {
5336
+ ${({ $withErrors, $preventHover, theme }) => !$preventHover && `background-color: ${$withErrors ? theme.colors.error : theme.colors.secondary + Theme.opacity.hex['010']};`}
5337
+ cursor: ${({ $preventHover }) => ($preventHover ? 'default' : 'pointer')};
5338
+ }
5238
5339
  `;
5239
5340
  const Left = styled(FlexRow) `
5240
5341
  align-items: center;
@@ -5266,8 +5367,9 @@ const DurationText = styled(Text) `
5266
5367
  font-family: ${({ theme }) => theme.font_family.secondary};
5267
5368
  white-space: nowrap;
5268
5369
  `;
5269
- const Span = ({ span, depth, indexInMatrix, maxDuration, minStartTime, maxEndTime, withErrors, errorTooltip, isOpen, withToggle, onToggleOpen }) => {
5370
+ const Span = ({ span, depth, indexInMatrix, maxDuration, minStartTime, maxEndTime, withErrors, errorTooltip, isOpen, withToggle, onToggleOpen, onSelect }) => {
5270
5371
  const theme = Theme.useTheme();
5372
+ const [isButtonHovered, setIsButtonHovered] = useState(false);
5271
5373
  const textMaxWidth = LEFT_MAX_WIDTH -
5272
5374
  // 12px times depth is the left padding, 12px is the right padding
5273
5375
  12 * depth -
@@ -5276,11 +5378,15 @@ const Span = ({ span, depth, indexInMatrix, maxDuration, minStartTime, maxEndTim
5276
5378
  // 16px is the width of the error icon, 4px is the gap between the text and the error icon
5277
5379
  (withErrors ? 16 - 4 : 0);
5278
5380
  const withErrorIcon = withErrors && (depth === 1 || span.logs.length > 0);
5279
- return (React.createElement(Container$1, { className: 'span-container', "$withErrors": withErrors },
5381
+ return (React.createElement(Container$1, { className: 'span-container', "$withErrors": withErrors, "$preventHover": isButtonHovered, onClick: onSelect },
5280
5382
  React.createElement(Left, { "$depth": depth, className: 'span-left' },
5281
5383
  React.createElement(FlexRow, { "$gap": 4, "$alignItems": 'center' },
5282
- withToggle ? (React.createElement(IconButton, { onClick: onToggleOpen, size: 24 },
5283
- React.createElement(ExtendArrow, { extend: isOpen ?? false }))) : (React.createElement("div", { style: { width: '24px' } })),
5384
+ withToggle ? (React.createElement("div", { onMouseEnter: () => setIsButtonHovered(true), onMouseLeave: () => setIsButtonHovered(false) },
5385
+ React.createElement(IconButton, { onClick: (e) => {
5386
+ e.stopPropagation();
5387
+ onToggleOpen?.();
5388
+ }, size: 24 },
5389
+ React.createElement(ExtendArrow, { extend: isOpen ?? false })))) : (React.createElement("div", { style: { width: '24px' } })),
5284
5390
  React.createElement(ScrollX, { maxWidth: textMaxWidth / 2, text: span.processID, textSize: 14 }),
5285
5391
  React.createElement(Text, { size: 12, color: theme.text.darker_grey }, "\u2022"),
5286
5392
  React.createElement(ScrollX, { maxWidth: textMaxWidth / 2, text: span.operationName, textSize: 12, textColor: theme.text.darker_grey })),
@@ -5293,7 +5399,7 @@ const Span = ({ span, depth, indexInMatrix, maxDuration, minStartTime, maxEndTim
5293
5399
  React.createElement(DurationBar, { "$indexInMatrix": indexInMatrix, "$duration": span.duration, "$maxDuration": maxDuration, "$startTime": span.startTime, "$minStartTime": minStartTime, "$maxEndTime": maxEndTime },
5294
5400
  React.createElement(DurationText, null, formatDuration(span.duration))))));
5295
5401
  };
5296
- const RecursiveSpans = ({ spans, logs, depth, indexInMatrix, maxDuration, minStartTime, maxEndTime, openSpanIdsState }) => {
5402
+ const RecursiveSpans = ({ spans, logs, depth, indexInMatrix, maxDuration, minStartTime, maxEndTime, openSpanIdsState, selectedSpanState }) => {
5297
5403
  const theme = Theme.useTheme();
5298
5404
  return spans.map((span, i) => {
5299
5405
  const id = span.spanID;
@@ -5313,8 +5419,12 @@ const RecursiveSpans = ({ spans, logs, depth, indexInMatrix, maxDuration, minSta
5313
5419
  if (alreadyOpen)
5314
5420
  return prev.filter((st) => st != id);
5315
5421
  return [...prev, id, ...getRecursiveValues(span, 'spans', 'spanID')];
5422
+ }), onSelect: () => selectedSpanState.set((prev) => {
5423
+ if (prev?.spanID === id)
5424
+ return null;
5425
+ return span;
5316
5426
  }) }),
5317
- isOpen && hasChildSpans ? (React.createElement(RecursiveSpans, { spans: span.spans || [], logs: allLogs, depth: depth + 1, indexInMatrix: indexInMatrix + i, maxDuration: maxDuration, minStartTime: minStartTime, maxEndTime: maxEndTime, openSpanIdsState: openSpanIdsState })) : null));
5427
+ isOpen && hasChildSpans ? (React.createElement(RecursiveSpans, { spans: span.spans || [], logs: allLogs, depth: depth + 1, indexInMatrix: indexInMatrix + i, maxDuration: maxDuration, minStartTime: minStartTime, maxEndTime: maxEndTime, openSpanIdsState: openSpanIdsState, selectedSpanState: selectedSpanState })) : null));
5318
5428
  });
5319
5429
  };
5320
5430
 
@@ -5354,8 +5464,9 @@ const DurationTitle = styled(Text) `
5354
5464
  padding-left: 12px;
5355
5465
  white-space: nowrap;
5356
5466
  `;
5357
- const TraceView = ({ heightToRemove, traces }) => {
5467
+ const TraceView = ({ heightToRemove, traces, isLoading }) => {
5358
5468
  const [openSpanIds, setOpenSpanIds] = useState([]);
5469
+ const [selectedSpan, setSelectedSpan] = useState(null);
5359
5470
  const finalTraces = useMemo(() => {
5360
5471
  const sorted = deepClone(traces).sort((a, b) => b.spans[0].startTime - a.spans[0].startTime);
5361
5472
  const mapped = sorted.map((trace) => ({ ...trace, spans: buildSpans(trace) }));
@@ -5366,23 +5477,34 @@ const TraceView = ({ heightToRemove, traces }) => {
5366
5477
  return Math.max(max, trace.spans.reduce((max, span) => max + span.duration, 0));
5367
5478
  }, 0);
5368
5479
  }, [finalTraces]);
5369
- return (React.createElement(Container, { "$heightToRemove": heightToRemove }, finalTraces.length ? (React.createElement(ContainSpans, { "$heightToRemove": heightToRemove },
5370
- React.createElement(ContainTitle, null,
5371
- React.createElement(Text, null, "Service & operation")),
5372
- new Array(NUM_OF_DURATION_DIVIDERS).fill(null).map((_, i) => (React.createElement(DurationDivider, { key: `${i}-divider`, "$heightToRemove": heightToRemove, index: i },
5373
- React.createElement(DurationTitle, null, formatDuration((maxDuration / NUM_OF_DURATION_DIVIDERS) * i))))),
5374
- finalTraces.map((trace, i) => {
5375
- const { spans } = trace;
5376
- // is equal CSS left: 0%;
5377
- const minStartTime = spans.reduce((min, span) => Math.min(min, span.startTime), Number.MAX_SAFE_INTEGER);
5378
- // is equal CSS left: 100%;
5379
- const maxEndTime = spans.reduce((max, span) => Math.max(max, span.startTime + span.duration), 0);
5380
- return (React.createElement(RecursiveSpans, { key: `recursive-spans-${trace.traceID}`, spans: spans, logs: [], depth: 1, indexInMatrix: i, maxDuration: maxDuration, minStartTime: minStartTime, maxEndTime: maxEndTime, openSpanIdsState: {
5381
- value: openSpanIds,
5382
- set: setOpenSpanIds,
5383
- } }));
5384
- }))) : (React.createElement(CenterThis, { "$height": '50vh' },
5385
- React.createElement(NoDataFound, { title: DISPLAY_TITLES.NO_TRACES_FOUND, subTitle: DISPLAY_TITLES.ARE_SERVICES_INSTRUMENTED_AND_PRODUCING_TRAFFIC })))));
5480
+ const selectedSpanProcess = useMemo(() => {
5481
+ const foundTrace = finalTraces.find((t) => t.spans.some((s) => s.spanID === selectedSpan?.spanID));
5482
+ const foundProcess = foundTrace?.processes.find((p) => p.serviceName === selectedSpan?.processID);
5483
+ return foundProcess;
5484
+ }, [finalTraces, selectedSpan]);
5485
+ return (React.createElement(React.Fragment, null,
5486
+ React.createElement(Container, { "$heightToRemove": heightToRemove }, isLoading ? (React.createElement(CenterThis, { "$height": '50vh' },
5487
+ React.createElement(FadeLoader, { scale: 1.5 }))) : !finalTraces.length ? (React.createElement(CenterThis, { "$height": '50vh' },
5488
+ React.createElement(NoDataFound, { title: DISPLAY_TITLES.NO_TRACES_FOUND, subTitle: DISPLAY_TITLES.ARE_SERVICES_INSTRUMENTED_AND_PRODUCING_TRAFFIC }))) : (React.createElement(ContainSpans, { "$heightToRemove": heightToRemove },
5489
+ React.createElement(ContainTitle, null,
5490
+ React.createElement(Text, null, "Service & operation")),
5491
+ new Array(NUM_OF_DURATION_DIVIDERS).fill(null).map((_, i) => (React.createElement(DurationDivider, { key: `${i}-divider`, "$heightToRemove": heightToRemove, index: i },
5492
+ React.createElement(DurationTitle, null, formatDuration((maxDuration / NUM_OF_DURATION_DIVIDERS) * i))))),
5493
+ finalTraces.map((trace, i) => {
5494
+ const { spans } = trace;
5495
+ // is equal CSS left: 0%;
5496
+ const minStartTime = spans.reduce((min, span) => Math.min(min, span.startTime), Number.MAX_SAFE_INTEGER);
5497
+ // is equal CSS left: 100%;
5498
+ const maxEndTime = spans.reduce((max, span) => Math.max(max, span.startTime + span.duration), 0);
5499
+ return (React.createElement(RecursiveSpans, { key: `recursive-spans-${trace.traceID}`, spans: spans, logs: [], depth: 1, indexInMatrix: i, maxDuration: maxDuration, minStartTime: minStartTime, maxEndTime: maxEndTime, openSpanIdsState: {
5500
+ value: openSpanIds,
5501
+ set: setOpenSpanIds,
5502
+ }, selectedSpanState: {
5503
+ value: selectedSpan,
5504
+ set: setSelectedSpan,
5505
+ } }));
5506
+ })))),
5507
+ selectedSpan && React.createElement(SpanDrawer, { span: selectedSpan, process: selectedSpanProcess, onClose: () => setSelectedSpan(null) })));
5386
5508
  };
5387
5509
 
5388
5510
  export { ActionDrawer, ActionForm, ActionModal, ActionTable, AwaitPipeline, ConditionDropdown, DataFlow, DataFlowActionsMenu, DataStreamDrawer, DataStreamForm, DataStreamSelectionForm, DestinationDrawer, DestinationForm, DestinationModal, DestinationSelectionForm, DestinationTable, ErrorDropdown, InstrumentationRuleDrawer, InstrumentationRuleForm, InstrumentationRuleModal, InstrumentationRuleTable, KindDropdown, LanguageDropdown, MonitorDropdown, MultiSourceControl, NamespaceDropdown, NavIconIds, NotificationManager, OverviewDrawer, ServiceMap, SetupSummary, SideNav, SlackInvite, SourceDrawer, SourceForm, SourceModal, SourceSelectionForm, SourceTable, SystemOverview, SystemSettings, TableCellConditions, ToastList, ToggleDarkMode, TraceView };
package/lib/functions.js CHANGED
@@ -1,15 +1,15 @@
1
- export { c as capitalizeFirstLetter, f as flattenObjectKeys, g as getConditionsBooleans, a as getMonitorIcon, b as getStatusIcon, i as isStringABoolean, d as isValidVersion, m as mapConditions, n as numbersOnly, p as parseBooleanFromString, e as parseJsonStringToPrettyString, r as removeEmptyValuesFromObject, s as safeJsonStringify, h as splitCamelString } from './index-d92ef50b.js';
2
- import { K as K8sLogo } from './index-40dfa720.js';
3
- export { c as compareCondition, g as getActionIcon, d as getEntityId, e as getInstrumentationRuleIcon, f as getProgrammingLanguageIcon } from './index-40dfa720.js';
1
+ export { c as capitalizeFirstLetter, f as flattenObjectKeys, g as getConditionsBooleans, a as getMonitorIcon, b as getStatusIcon, i as isStringABoolean, d as isValidVersion, m as mapConditions, n as numbersOnly, p as parseBooleanFromString, e as parseJsonStringToPrettyString, r as removeEmptyValuesFromObject, s as safeJsonStringify, h as splitCamelString } from './index-9475009f.js';
2
+ import { K as K8sLogo } from './index-89edd01d.js';
3
+ export { c as compareCondition, g as getActionIcon, d as getEntityId, e as getInstrumentationRuleIcon, f as getProgrammingLanguageIcon } from './index-89edd01d.js';
4
4
  export { d as deepClone, i as isEmpty, s as safeJsonParse } from './index-5e5f7bda.js';
5
- export { f as filterActions, a as filterDestinations, b as filterDestinationsByStream, c as filterSources, d as filterSourcesByStream, e as formatBytes, g as formatDuration, i as getContainersIcons, h as getContainersInstrumentedCount, j as getDestinationIcon, k as getEntityIcon, l as getEntityLabel, m as getMetricForEntity, n as getRecursiveValues, o as getValueForRange, p as getWorkloadId, q as getYamlFieldsForDestination, r as hasUnhealthyInstances, s as isOverTime, t as mapDestinationFieldsForDisplay, u as sleep } from './index-bf427e64.js';
5
+ export { f as filterActions, a as filterDestinations, b as filterDestinationsByStream, c as filterSources, d as filterSourcesByStream, e as formatBytes, g as formatDuration, i as getContainersIcons, h as getContainersInstrumentedCount, j as getDestinationIcon, k as getEntityIcon, l as getEntityLabel, m as getMetricForEntity, n as getRecursiveValues, o as getValueForRange, p as getWorkloadId, q as getYamlFieldsForDestination, r as hasUnhealthyInstances, s as isOverTime, t as mapDestinationFieldsForDisplay, u as sleep } from './index-c823fbfb.js';
6
6
  export { g as getIdFromSseTarget, i as isLegalK8sLabel, m as mapExportedSignals } from './index-6a6bea6e.js';
7
7
  import { ProgrammingLanguages, PlatformType, EntityTypes } from './types.js';
8
8
  import 'react';
9
9
  import 'styled-components';
10
- import { O as OdigosLogo } from './index-eff01b3d.js';
11
- import { V as VmLogo } from './index-333086d8.js';
12
- import './index-b0883db6.js';
10
+ import { O as OdigosLogo } from './index-f18c8530.js';
11
+ import { V as VmLogo } from './index-0a77c1be.js';
12
+ import './index-195415d4.js';
13
13
 
14
14
  const cleanObjectEmptyStringsValues = (obj) => {
15
15
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -14,6 +14,8 @@ export interface UseSourceSelectionFormData {
14
14
  getApiFutureAppsPayload: () => NamespaceSelectionFormData;
15
15
  selectedNamespace: string;
16
16
  onSelectNamespace: (namespace: NamespaceName, selectAll?: boolean) => void;
17
+ selectedAllNamespaces: boolean;
18
+ onSelectAllNamespaces: (selected: boolean) => void;
17
19
  selectedSources: SourceSelectionFormData;
18
20
  onSelectSource: (source: AvailableSource, namespace?: NamespaceName) => void;
19
21
  selectedFutureApps: NamespaceSelectionFormData;
package/lib/hooks.js CHANGED
@@ -1,10 +1,10 @@
1
- import { W as useNotificationStore, F as FORM_ALERTS, Q as useDrawerStore, X as useEntityStore, Z as useDataStreamStore, $ as useSetupStore } from './index-40dfa720.js';
1
+ import { W as useNotificationStore, F as FORM_ALERTS, Q as useDrawerStore, X as useEntityStore, Z as useDataStreamStore, $ as useSetupStore } from './index-89edd01d.js';
2
2
  import { ActionKeyTypes, ActionType, StatusType, EntityTypes, FieldTypes } from './types.js';
3
- import { useState, useEffect, useMemo } from 'react';
3
+ import { useState, useEffect, useRef, useMemo } from 'react';
4
4
  import 'styled-components';
5
5
  import { i as isEmpty, s as safeJsonParse } from './index-5e5f7bda.js';
6
- import { i as useGenericForm } from './useTransition-2df374a9.js';
7
- export { b as useClickNode, a as useContainerSize, h as useCopy, e as useInstrumentationRuleFormData, u as useKeyDown, d as useOnClickOutside, c as usePopup, g as useTimeAgo, f as useTransition } from './useTransition-2df374a9.js';
6
+ import { i as useGenericForm } from './useTransition-159c9af8.js';
7
+ export { b as useClickNode, a as useContainerSize, h as useCopy, e as useInstrumentationRuleFormData, u as useKeyDown, d as useOnClickOutside, c as usePopup, g as useTimeAgo, f as useTransition } from './useTransition-159c9af8.js';
8
8
  import { g as getIdFromSseTarget, i as isLegalK8sLabel, m as mapExportedSignals } from './index-6a6bea6e.js';
9
9
 
10
10
  const INITIAL$2 = {
@@ -469,34 +469,49 @@ const useSourceSelectionFormData = (params) => {
469
469
  const { fetchSingleNamespace } = params || {};
470
470
  const { namespaces } = useEntityStore();
471
471
  const { selectedStreamName } = useDataStreamStore();
472
+ const mountedRef = useRef(false);
472
473
  // only for "onboarding" - get unsaved values and set to state
473
474
  // (this is to persist the values when user navigates back to this page)
474
475
  const { configuredSources, configuredFutureApps, availableSources: availableSourcesFromStore } = useSetupStore();
475
476
  // Keeps intial values fetched from API, so we can later filter the user-specific-selections, therebey minimizing the amount of data sent to the API on "persist sources".
476
477
  const [availableSources, setRecordedInitialSources] = useState(availableSourcesFromStore);
477
478
  const [isFetchingEachNamespace, setIsFetchingEachNamespace] = useState(false);
479
+ const [selectedAllNamespaces, setSelectedAllNamespaces] = useState(false);
478
480
  const [fetchedNamespaces, setFetchedNamespaces] = useState([]);
479
481
  const [selectedNamespace, setSelectedNamespace] = useState('');
480
482
  const [selectedFutureApps, setSelectedFutureApps] = useState(configuredFutureApps);
481
483
  const [selectedSources, setSelectedSources] = useState(mergeAvailableAndSelectedSources(availableSourcesFromStore, configuredSources, selectedStreamName));
482
484
  const fetchAndSetThisNamespace = async (ns, selectAll) => {
483
485
  if (fetchSingleNamespace) {
484
- const { data } = await fetchSingleNamespace({ variables: { namespaceName: ns.name } });
485
- const { name, sources = [] } = data?.computePlatform?.k8sActualNamespace || {};
486
- if (!name)
487
- return;
488
- setFetchedNamespaces((prev) => [...prev, name]);
489
- setRecordedInitialSources((prev) => ({
490
- ...prev,
491
- [name]: sources.map((s) => mapToAvailableSource(s, selectedStreamName)),
492
- }));
493
- setSelectedSources((prev) => ({
494
- ...prev,
495
- [name]: typeof selectAll !== 'boolean' && prev[name]?.length ? prev[name] : sources.map((s) => mapToSelectedSource(s, selectedStreamName, selectAll)),
496
- }));
486
+ if (fetchedNamespaces.includes(ns.name)) {
487
+ setSelectedSources((prev) => ({
488
+ ...prev,
489
+ [ns.name]: prev[ns.name].map((s) => ({
490
+ ...s,
491
+ selected: typeof selectAll === 'boolean' ? selectAll : s.selected,
492
+ currentStreamName: selectedStreamName,
493
+ })),
494
+ }));
495
+ }
496
+ else {
497
+ const { data } = await fetchSingleNamespace({ variables: { namespaceName: ns.name } });
498
+ const { name, sources = [] } = data?.computePlatform?.k8sActualNamespace || {};
499
+ if (!name)
500
+ return;
501
+ setFetchedNamespaces((prev) => [...prev, name]);
502
+ setRecordedInitialSources((prev) => ({
503
+ ...prev,
504
+ [name]: sources.map((s) => mapToAvailableSource(s, selectedStreamName)),
505
+ }));
506
+ setSelectedSources((prev) => ({
507
+ ...prev,
508
+ [name]: typeof selectAll !== 'boolean' && prev[name]?.length ? prev[name] : sources.map((s) => mapToSelectedSource(s, selectedStreamName, selectAll)),
509
+ }));
510
+ }
497
511
  }
498
512
  };
499
513
  useEffect(() => {
514
+ mountedRef.current = true;
500
515
  if (!!namespaces?.length) {
501
516
  // initialize empty states to avoid undefined errors
502
517
  setRecordedInitialSources((prev) => {
@@ -517,16 +532,24 @@ const useSourceSelectionFormData = (params) => {
517
532
  (async () => {
518
533
  setIsFetchingEachNamespace(true);
519
534
  for await (const ns of namespaces)
520
- await fetchAndSetThisNamespace(ns);
535
+ if (mountedRef.current)
536
+ await fetchAndSetThisNamespace(ns);
521
537
  setIsFetchingEachNamespace(false);
522
538
  })();
523
539
  }
540
+ return () => {
541
+ mountedRef.current = false;
542
+ };
524
543
  }, [namespaces, selectedStreamName]);
525
544
  // form filters
526
545
  const [searchText, setSearchText] = useState('');
527
546
  const [searchBy, setSearchBy] = useState(EntityTypes.Source);
528
547
  const [showSelectedOnly, setShowSelectedOnly] = useState(false);
529
548
  const [showRunningOnly, setShowRunningOnly] = useState(false);
549
+ const onSelectAllNamespaces = (selected) => {
550
+ setSelectedAllNamespaces(selected);
551
+ namespaces.forEach((ns) => fetchAndSetThisNamespace(ns, selected));
552
+ };
530
553
  const onSelectNamespace = (nsName, selectAll) => {
531
554
  const ns = namespaces.find((namespace) => namespace.name === nsName);
532
555
  if (ns) {
@@ -606,6 +629,8 @@ const useSourceSelectionFormData = (params) => {
606
629
  getApiFutureAppsPayload,
607
630
  selectedNamespace,
608
631
  onSelectNamespace,
632
+ selectedAllNamespaces,
633
+ onSelectAllNamespaces,
609
634
  selectedSources,
610
635
  onSelectSource,
611
636
  selectedFutureApps,