@odigos/ui-kit 0.0.79 → 0.0.81
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.
- package/CHANGELOG.md +22 -0
- package/lib/components/styled.d.ts +4 -2
- package/lib/components/text/index.d.ts +12 -1
- package/lib/components.js +8 -8
- package/lib/constants.js +1 -1
- package/lib/containers/data-flow-actions-menu/index.d.ts +1 -0
- package/lib/containers/data-flow-actions-menu/search/index.d.ts +3 -1
- package/lib/containers/data-flow-actions-menu/search/search-results/builder.d.ts +1 -1
- package/lib/containers/data-flow-actions-menu/search/search-results/index.d.ts +0 -1
- package/lib/containers/dropdowns/index.d.ts +0 -2
- package/lib/containers/index.d.ts +0 -3
- package/lib/containers.js +266 -393
- package/lib/functions.js +29 -7
- package/lib/hooks.js +3 -3
- package/lib/icons.js +7 -6
- package/lib/index-1b05e560.js +11 -0
- package/lib/{index-6034549d.js → index-4dfaeaab.js} +1 -1
- package/lib/{index-845f2100.js → index-50d05c9b.js} +2 -2
- package/lib/{index-b9d7a992.js → index-6bb0eb56.js} +2 -9
- package/lib/{index-19b8f8bc.js → index-72089d6e.js} +1 -1
- package/lib/{index-90ccd949.js → index-86030474.js} +1 -1
- package/lib/{index-ba4f9a19.js → index-8b736e84.js} +4 -25
- package/lib/{index-b674f184.js → index-ae53c3d8.js} +76 -39
- package/lib/{index-c8aab9c4.js → index-c1a8e92c.js} +1 -1
- package/lib/{index-a067d6e9.js → index-f22371cb.js} +2 -2
- package/lib/snippets.js +7 -7
- package/lib/store/useFilterStore.d.ts +1 -1
- package/lib/store.js +1 -1
- package/lib/theme.js +1 -1
- package/lib/types/index.d.ts +0 -1
- package/lib/{useTransition-807be8bc.js → useTransition-cac1649d.js} +2 -2
- package/package.json +2 -2
- package/lib/containers/compute-platform-select/index.d.ts +0 -10
- package/lib/containers/compute-platforms/index.d.ts +0 -8
- package/lib/containers/compute-platforms-actions-menu/index.d.ts +0 -7
- package/lib/containers/dropdowns/connection-status-dropdown/index.d.ts +0 -15
- package/lib/containers/dropdowns/connection-type-dropdown/index.d.ts +0 -15
- package/lib/types/connection/index.d.ts +0 -7
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, U as usePendingStore, V as useNotificationStore, O as useDrawerStore, B as BUTTON_TEXTS, W as useEntityStore, A as ACTION_OPTIONS, g as getActionIcon, z as useModalStore, F as FORM_ALERTS, X as useFilterStore,
|
|
3
|
+
import { b as DISPLAY_TITLES, T as Theme, U as usePendingStore, V as useNotificationStore, O as useDrawerStore, B as BUTTON_TEXTS, W as useEntityStore, A as ACTION_OPTIONS, g as getActionIcon, z as useModalStore, F as FORM_ALERTS, X as useFilterStore, d as getInstrumentationRuleIcon, Y as useDataStreamStore, Z as useInstrumentStore, c as getEntityId, D as DISPLAY_LANGUAGES, M as MONITORS_OPTIONS, S as STORAGE_KEYS, a as DEFAULT_DATA_STREAM_NAME, _ as useSetupStore, e as getProgrammingLanguageIcon, I as INSTRUMENTATION_RULE_OPTIONS, $ as useSelectedStore, k as ImageErrorIcon, a0 as useDarkMode } from './index-86030474.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, K as KeyValueInputsList, w as InputList, _ as Text, R as Segment, Q as SectionTitle, j as DocsButton, z as MonitorsCheckboxes,
|
|
5
|
+
import { e as DataCardFieldTypes, p as FieldLabel, C as Checkbox, o as FieldError, v as Input, x as InputTable, 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, a3 as Toggle, 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 } from './index-ae53c3d8.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 } from './index-
|
|
8
|
-
import { C as CrossCircledIcon, O as OdigosLogoText,
|
|
7
|
+
import { C as CheckCircledIcon, O as OdigosLogo } from './index-4dfaeaab.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-c1a8e92c.js';
|
|
9
9
|
import { useActionFormData, useSessionStorage, useDataStreamFormData, useDestinationFormData, useClickNotification, useSourceFormData, useSourceSelectionFormData } from './hooks.js';
|
|
10
|
-
import { u as useKeyDown, a as
|
|
11
|
-
import { E as EditIcon, T as TrashIcon, S as SearchIcon, h as CheckIcon, P as PlusIcon, a as CopyIcon } from './index-
|
|
12
|
-
import { D as DeleteWarning, C as CancelWarning } from './index-
|
|
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-
|
|
14
|
-
import { f as filterActions, l as getEntityLabel, k as getEntityIcon,
|
|
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-cac1649d.js';
|
|
11
|
+
import { E as EditIcon, T as TrashIcon, S as SearchIcon, h as CheckIcon, P as PlusIcon, a as CopyIcon } from './index-72089d6e.js';
|
|
12
|
+
import { D as DeleteWarning, C as CancelWarning } from './index-50d05c9b.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-f22371cb.js';
|
|
14
|
+
import { f as filterActions, l as getEntityLabel, k as getEntityIcon, t as sleep, g as formatBytes, i as getContainersIcons, n as getValueForRange, j as getDestinationIcon, e as filterSourcesByStream, d as filterSources, b as filterDestinationsByStream, a as filterDestinations, s as mapDestinationFieldsForDisplay, c as compareCondition, p as getYamlFieldsForDestination, m as getMetricForEntity, o as getWorkloadId, q as hasUnhealthyInstances, h as getContainersInstrumentedCount, r as isOverTime } from './index-8b736e84.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,
|
|
18
|
+
import { a6 as RulesIcon, a3 as SourcesIcon, a5 as ActionsIcon, a4 as DestinationsIcon } from './index-6bb0eb56.js';
|
|
19
19
|
import 'react-dom';
|
|
20
20
|
|
|
21
21
|
const buildCard$3 = (action) => {
|
|
@@ -503,7 +503,7 @@ const CustomFields$1 = ({ actionType, value, setValue, formErrors }) => {
|
|
|
503
503
|
return Component ? React.createElement(Component, { value: value, setValue: setValue, formErrors: formErrors }) : null;
|
|
504
504
|
};
|
|
505
505
|
|
|
506
|
-
const Container$
|
|
506
|
+
const Container$h = styled.div `
|
|
507
507
|
display: flex;
|
|
508
508
|
flex-direction: column;
|
|
509
509
|
gap: 24px;
|
|
@@ -514,7 +514,7 @@ const FieldTitle$2 = styled(Text) `
|
|
|
514
514
|
`;
|
|
515
515
|
const ActionForm = ({ isUpdate, action, formData, formErrors, handleFormChange }) => {
|
|
516
516
|
const theme = Theme.useTheme();
|
|
517
|
-
return (React.createElement(Container$
|
|
517
|
+
return (React.createElement(Container$h, null,
|
|
518
518
|
isUpdate && (React.createElement("div", null,
|
|
519
519
|
React.createElement(FieldTitle$2, null, "Status"),
|
|
520
520
|
React.createElement(Segment, { options: [
|
|
@@ -875,6 +875,64 @@ const ConditionsStatuses = ({ conditions, id }) => {
|
|
|
875
875
|
})));
|
|
876
876
|
};
|
|
877
877
|
|
|
878
|
+
const buildSearchResults = ({ instrumentationRules, sources, actions, destinations, searchText, selectedCategory }) => {
|
|
879
|
+
const filteredRules = !searchText ? instrumentationRules : instrumentationRules.filter((rule) => rule.type?.toLowerCase().includes(searchText) || rule.ruleName?.toLowerCase().includes(searchText));
|
|
880
|
+
const filteredSources = !searchText
|
|
881
|
+
? sources
|
|
882
|
+
: sources.filter((source) => source.name?.toLowerCase().includes(searchText) || source.otelServiceName?.toLowerCase().includes(searchText) || source.namespace?.toLowerCase().includes(searchText));
|
|
883
|
+
const filteredActions = !searchText ? actions : actions.filter((action) => action.type?.toLowerCase().includes(searchText) || action.spec.actionName?.toLowerCase().includes(searchText));
|
|
884
|
+
const filteredDestinations = !searchText
|
|
885
|
+
? destinations
|
|
886
|
+
: destinations.filter((destination) => destination.destinationType.displayName?.toLowerCase().includes(searchText) || destination.name?.toLowerCase().includes(searchText));
|
|
887
|
+
const categories = [
|
|
888
|
+
{
|
|
889
|
+
category: EntityTypes.Source,
|
|
890
|
+
label: 'Sources',
|
|
891
|
+
count: filteredSources.length,
|
|
892
|
+
entities: [],
|
|
893
|
+
},
|
|
894
|
+
{
|
|
895
|
+
category: EntityTypes.Action,
|
|
896
|
+
label: 'Actions',
|
|
897
|
+
count: filteredActions.length,
|
|
898
|
+
entities: [],
|
|
899
|
+
},
|
|
900
|
+
{
|
|
901
|
+
category: EntityTypes.Destination,
|
|
902
|
+
label: 'Destinations',
|
|
903
|
+
count: filteredDestinations.length,
|
|
904
|
+
entities: [],
|
|
905
|
+
},
|
|
906
|
+
{
|
|
907
|
+
category: EntityTypes.InstrumentationRule,
|
|
908
|
+
label: 'Instrumentation Rules',
|
|
909
|
+
count: filteredRules.length,
|
|
910
|
+
entities: [],
|
|
911
|
+
},
|
|
912
|
+
];
|
|
913
|
+
categories.unshift({
|
|
914
|
+
category: 'all',
|
|
915
|
+
label: 'All',
|
|
916
|
+
count: filteredRules.length + filteredSources.length + filteredActions.length + filteredDestinations.length,
|
|
917
|
+
entities: [],
|
|
918
|
+
});
|
|
919
|
+
const searchResults = categories
|
|
920
|
+
.filter(({ count, category }) => !!count && category !== 'all' && ['all', category].includes(selectedCategory))
|
|
921
|
+
.map((item) => ({
|
|
922
|
+
...item,
|
|
923
|
+
entities: item.category === EntityTypes.InstrumentationRule
|
|
924
|
+
? filteredRules
|
|
925
|
+
: item.category === EntityTypes.Source
|
|
926
|
+
? filteredSources
|
|
927
|
+
: item.category === EntityTypes.Action
|
|
928
|
+
? filteredActions
|
|
929
|
+
: item.category === EntityTypes.Destination
|
|
930
|
+
? filteredDestinations
|
|
931
|
+
: [],
|
|
932
|
+
}));
|
|
933
|
+
return { categories, searchResults };
|
|
934
|
+
};
|
|
935
|
+
|
|
878
936
|
const columns$3 = [
|
|
879
937
|
{ key: 'icon', title: '' },
|
|
880
938
|
{ key: 'name', title: DISPLAY_TITLES.NAME, sortable: true },
|
|
@@ -890,7 +948,14 @@ const ActionTable = ({ maxHeight, maxWidth }) => {
|
|
|
890
948
|
const filters = useFilterStore();
|
|
891
949
|
const { actions, actionsLoading } = useEntityStore();
|
|
892
950
|
const { setDrawerType, setDrawerEntityId } = useDrawerStore();
|
|
893
|
-
const filtered = useMemo(() =>
|
|
951
|
+
const filtered = useMemo(() => (buildSearchResults({
|
|
952
|
+
instrumentationRules: [],
|
|
953
|
+
sources: [],
|
|
954
|
+
actions: filterActions(actions, filters),
|
|
955
|
+
destinations: [],
|
|
956
|
+
searchText: filters.searchText,
|
|
957
|
+
selectedCategory: EntityTypes.Action,
|
|
958
|
+
}).searchResults.find(({ category }) => category === EntityTypes.Action)?.entities || []), [actions, filters]);
|
|
894
959
|
const rows = useMemo(() => filtered.map((act) => {
|
|
895
960
|
const { hasErrors, hasWarnings, hasDisableds } = getConditionsBooleans(act.conditions || []);
|
|
896
961
|
return {
|
|
@@ -942,8 +1007,18 @@ const ActionTable = ({ maxHeight, maxWidth }) => {
|
|
|
942
1007
|
],
|
|
943
1008
|
};
|
|
944
1009
|
}), [filtered]);
|
|
945
|
-
const badge = useMemo(() =>
|
|
946
|
-
|
|
1010
|
+
const { badge, badgeTooltip } = useMemo(() => {
|
|
1011
|
+
if (filtered.length !== actions.length) {
|
|
1012
|
+
return {
|
|
1013
|
+
badge: `${filtered.length}/${actions.length}`,
|
|
1014
|
+
badgeTooltip: DISPLAY_TITLES.FILTERED_COUNT_TOOLTIP,
|
|
1015
|
+
};
|
|
1016
|
+
}
|
|
1017
|
+
return {
|
|
1018
|
+
badge: actions.length,
|
|
1019
|
+
badgeTooltip: undefined,
|
|
1020
|
+
};
|
|
1021
|
+
}, [filtered, actions]);
|
|
947
1022
|
return (React.createElement(TableContainer, { "$maxWidth": maxWidth },
|
|
948
1023
|
React.createElement(TableTitleWrap, null,
|
|
949
1024
|
React.createElement(IconTitleBadge, { icon: getEntityIcon(EntityTypes.Action), title: DISPLAY_TITLES.ACTIONS, badge: badge, badgeTooltip: badgeTooltip, loading: actionsLoading })),
|
|
@@ -953,7 +1028,7 @@ const ActionTable = ({ maxHeight, maxWidth }) => {
|
|
|
953
1028
|
React.createElement(NoDataFound, null)))));
|
|
954
1029
|
};
|
|
955
1030
|
|
|
956
|
-
const Container$
|
|
1031
|
+
const Container$g = styled(FlexColumn) `
|
|
957
1032
|
// width: 100vw;
|
|
958
1033
|
// height: 100vh;
|
|
959
1034
|
gap: 64px;
|
|
@@ -966,7 +1041,7 @@ const TextWrap = styled(FlexColumn) `
|
|
|
966
1041
|
align-items: center;
|
|
967
1042
|
justify-content: center;
|
|
968
1043
|
`;
|
|
969
|
-
const Title$
|
|
1044
|
+
const Title$1 = styled(Text) `
|
|
970
1045
|
text-align: center;
|
|
971
1046
|
font-size: 24px;
|
|
972
1047
|
`;
|
|
@@ -987,292 +1062,16 @@ const AwaitPipeline = () => {
|
|
|
987
1062
|
useEffect(() => {
|
|
988
1063
|
awaitPipeline();
|
|
989
1064
|
}, []);
|
|
990
|
-
return (React.createElement(Container$
|
|
1065
|
+
return (React.createElement(Container$g, null,
|
|
991
1066
|
React.createElement(OdigosLogoText, { size: 100 }),
|
|
992
1067
|
React.createElement(TraceLoader, { width: 400 }),
|
|
993
1068
|
React.createElement(TextWrap, null,
|
|
994
1069
|
React.createElement(FlexRow, { "$gap": 16 },
|
|
995
|
-
React.createElement(Title$
|
|
1070
|
+
React.createElement(Title$1, null, "Preparing your workspace..."),
|
|
996
1071
|
React.createElement(Badge, { label: `${progress}%` })),
|
|
997
1072
|
React.createElement(Description, null, "It can take up to a few minutes. Grab a cup of coffee, look out a window, and enjoy your free moment!"))));
|
|
998
1073
|
};
|
|
999
1074
|
|
|
1000
|
-
const Tab = styled(FlexRow) `
|
|
1001
|
-
width: 260px;
|
|
1002
|
-
padding: 4px;
|
|
1003
|
-
gap: 10px;
|
|
1004
|
-
border: 1px solid ${({ theme }) => theme.colors.border};
|
|
1005
|
-
border-radius: 32px;
|
|
1006
|
-
cursor: ${({ $withSelect }) => ($withSelect ? 'pointer' : 'default')};
|
|
1007
|
-
|
|
1008
|
-
${({ $withSelect }) => $withSelect &&
|
|
1009
|
-
css `
|
|
1010
|
-
&:hover {
|
|
1011
|
-
border: 1px solid ${({ theme }) => theme.colors.secondary};
|
|
1012
|
-
}
|
|
1013
|
-
`}
|
|
1014
|
-
`;
|
|
1015
|
-
const Title$2 = styled(Text) `
|
|
1016
|
-
font-size: 14px;
|
|
1017
|
-
margin-right: 10px;
|
|
1018
|
-
color: ${({ theme }) => theme.text.secondary};
|
|
1019
|
-
`;
|
|
1020
|
-
const LogoWrap = styled.div `
|
|
1021
|
-
display: flex;
|
|
1022
|
-
align-items: center;
|
|
1023
|
-
justify-content: center;
|
|
1024
|
-
padding: 4px;
|
|
1025
|
-
border-radius: 100%;
|
|
1026
|
-
background-color: ${({ theme }) => theme.colors.info};
|
|
1027
|
-
`;
|
|
1028
|
-
const PushToEnd$1 = styled.div `
|
|
1029
|
-
margin-left: auto;
|
|
1030
|
-
margin-right: 6px;
|
|
1031
|
-
`;
|
|
1032
|
-
const RelativeContainer$3 = styled.div `
|
|
1033
|
-
position: relative;
|
|
1034
|
-
`;
|
|
1035
|
-
const AbsoluteContainer = styled.div `
|
|
1036
|
-
position: absolute;
|
|
1037
|
-
top: calc(100% + 8px);
|
|
1038
|
-
left: 0;
|
|
1039
|
-
z-index: 1;
|
|
1040
|
-
background-color: ${({ theme }) => theme.colors.dropdown_bg};
|
|
1041
|
-
border: ${({ theme }) => `1px solid ${theme.colors.border}`};
|
|
1042
|
-
border-radius: 24px;
|
|
1043
|
-
width: 420px;
|
|
1044
|
-
`;
|
|
1045
|
-
const HeadWrap = styled.div `
|
|
1046
|
-
border-bottom: ${({ theme }) => `1px solid ${theme.colors.border}`};
|
|
1047
|
-
padding: 12px;
|
|
1048
|
-
`;
|
|
1049
|
-
const FootWrap = styled.div `
|
|
1050
|
-
border-top: ${({ theme }) => `1px solid ${theme.colors.border}`};
|
|
1051
|
-
padding: 12px;
|
|
1052
|
-
`;
|
|
1053
|
-
const ComputePlatformSelect = ({ connections, selected, onSelect, onViewAll }) => {
|
|
1054
|
-
const theme = Theme.useTheme();
|
|
1055
|
-
const { addNotification } = useNotificationStore();
|
|
1056
|
-
const [isOpen, setIsOpen] = useState(false);
|
|
1057
|
-
const [searchText, setSearchText] = useState('');
|
|
1058
|
-
const onClose = () => {
|
|
1059
|
-
setIsOpen(false);
|
|
1060
|
-
};
|
|
1061
|
-
const containerRef = useRef(null);
|
|
1062
|
-
useOnClickOutside(containerRef, onClose);
|
|
1063
|
-
useKeyDown({ key: 'Escape', active: isOpen }, onClose);
|
|
1064
|
-
const withSelect = !!connections.length;
|
|
1065
|
-
const filtered = connections.filter(({ id }) => id.toLowerCase().includes(searchText));
|
|
1066
|
-
const Icon = !!selected?.type ? getPlatformIcon(selected.type) : null;
|
|
1067
|
-
return (React.createElement(RelativeContainer$3, { ref: containerRef },
|
|
1068
|
-
React.createElement(Tab, { "$withSelect": withSelect, onClick: () => setIsOpen((prev) => !prev) },
|
|
1069
|
-
React.createElement(LogoWrap, null, !!Icon ? React.createElement(Icon, { size: 20, fill: theme.text.info }) : React.createElement(OverviewIcon, { fill: theme.text.info })),
|
|
1070
|
-
React.createElement(Title$2, null, selected?.name || selected?.id || 'no platform'),
|
|
1071
|
-
withSelect && (React.createElement(PushToEnd$1, null,
|
|
1072
|
-
React.createElement(ExtendArrow, { extend: isOpen, align: 'right' })))),
|
|
1073
|
-
isOpen && withSelect && (React.createElement(AbsoluteContainer, null,
|
|
1074
|
-
React.createElement(HeadWrap, null,
|
|
1075
|
-
React.createElement(Input, { placeholder: 'Search...', icon: SearchIcon, value: searchText, onChange: (e) => setSearchText(e.target.value.toLowerCase()) })),
|
|
1076
|
-
React.createElement(VerticalScroll, { style: { maxHeight: '240px' } }, filtered.map(({ id, type, name, status }, idx) => (React.createElement(SelectionButton, { key: `platform-${id}`, icon: () => getPlatformIcon(type)?.({ fill: status === StatusType.Success ? theme.text.success : theme.text.error }), label: `${!!name ? name : getPlatformLabel(type)} (${id})`, isSelected: selected?.id === id, onClick: () => {
|
|
1077
|
-
if (status === StatusType.Success) {
|
|
1078
|
-
onSelect(filtered[idx]);
|
|
1079
|
-
}
|
|
1080
|
-
else {
|
|
1081
|
-
addNotification({
|
|
1082
|
-
type: StatusType.Warning,
|
|
1083
|
-
title: 'Connection lost',
|
|
1084
|
-
message: 'Cannot connect to this platform',
|
|
1085
|
-
hideFromHistory: true,
|
|
1086
|
-
});
|
|
1087
|
-
}
|
|
1088
|
-
onClose();
|
|
1089
|
-
}, color: 'transparent', style: { width: '100%', justifyContent: 'flex-start' } })))),
|
|
1090
|
-
React.createElement(FootWrap, null,
|
|
1091
|
-
React.createElement(Button, { variant: 'secondary', style: { width: '100%' }, onClick: onViewAll }, "VIEW ALL"))))));
|
|
1092
|
-
};
|
|
1093
|
-
|
|
1094
|
-
const ComputePlatforms = ({ connections, onSelect }) => {
|
|
1095
|
-
const { searchText, platformTypes, statuses } = useFilterStore();
|
|
1096
|
-
const filtered = useMemo(() => connections.filter(({ id, type, status }) => (!searchText || id.toLowerCase().includes(searchText)) &&
|
|
1097
|
-
(!platformTypes?.length || platformTypes.find((opt) => opt.id === type)) &&
|
|
1098
|
-
(!statuses?.length || statuses.find((opt) => opt.id === status))), [connections, searchText, platformTypes, statuses]);
|
|
1099
|
-
const rows = useMemo(() => filtered.map((item) => ({
|
|
1100
|
-
onClick: () => onSelect(item),
|
|
1101
|
-
cells: [
|
|
1102
|
-
{ columnKey: 'id', value: item.id },
|
|
1103
|
-
{ columnKey: 'type', value: item.type },
|
|
1104
|
-
{ columnKey: 'name', value: item.name || getPlatformLabel(item.type) },
|
|
1105
|
-
{ columnKey: 'icon', icon: getPlatformIcon(item.type) },
|
|
1106
|
-
{
|
|
1107
|
-
columnKey: 'status',
|
|
1108
|
-
component: () => (React.createElement("div", { style: { lineHeight: 1 } },
|
|
1109
|
-
React.createElement(Status, { title: status === StatusType.Success ? 'connection alive' : 'connection lost', status: item.status, withIcon: true, withBorder: true }))),
|
|
1110
|
-
},
|
|
1111
|
-
],
|
|
1112
|
-
})), [filtered]);
|
|
1113
|
-
return (React.createElement(React.Fragment, null,
|
|
1114
|
-
React.createElement(InteractiveTable, { columns: [
|
|
1115
|
-
{ key: 'icon', title: '' },
|
|
1116
|
-
{ key: 'name', title: 'Name' },
|
|
1117
|
-
{ key: 'type', title: 'Type' },
|
|
1118
|
-
{ key: 'status', title: 'Status' },
|
|
1119
|
-
{ key: 'id', title: 'Unique ID' },
|
|
1120
|
-
], rows: rows }),
|
|
1121
|
-
!filtered.length && (React.createElement(CenterThis, { style: { marginTop: '2rem' } },
|
|
1122
|
-
React.createElement(NoDataFound, null)))));
|
|
1123
|
-
};
|
|
1124
|
-
|
|
1125
|
-
const ConditionDropdown = ({ sources, title = 'Condition', value, onSelect, onDeselect, ...props }) => {
|
|
1126
|
-
const options = useMemo(() => {
|
|
1127
|
-
const payload = [];
|
|
1128
|
-
sources.forEach(({ conditions }) => {
|
|
1129
|
-
conditions?.forEach(({ type, reason }) => {
|
|
1130
|
-
if (!payload.find((opt) => opt.id === `${type}#${reason}`)) {
|
|
1131
|
-
payload.push({ id: `${type}#${reason}`, value: `${splitCamelString(type)} - ${splitCamelString(reason)}` });
|
|
1132
|
-
}
|
|
1133
|
-
});
|
|
1134
|
-
});
|
|
1135
|
-
return payload.sort((a, b) => a.id?.localeCompare(b.id || '') || 0);
|
|
1136
|
-
}, [sources]);
|
|
1137
|
-
return React.createElement(Dropdown, { disabled: !options?.length, title: title, placeholder: 'All', options: options, value: value, onSelect: onSelect, onDeselect: onDeselect, ...props });
|
|
1138
|
-
};
|
|
1139
|
-
|
|
1140
|
-
const ConnectionStatusDropdown = ({ connections, title = '', value, onSelect, onDeselect, ...props }) => {
|
|
1141
|
-
const options = useMemo(() => {
|
|
1142
|
-
const payload = [];
|
|
1143
|
-
connections?.forEach(({ status }) => {
|
|
1144
|
-
if (!payload.find((opt) => opt.id === status)) {
|
|
1145
|
-
payload.push({ id: status, value: status });
|
|
1146
|
-
}
|
|
1147
|
-
});
|
|
1148
|
-
return payload;
|
|
1149
|
-
}, [connections]);
|
|
1150
|
-
return React.createElement(Dropdown, { disabled: !options?.length, title: title, placeholder: 'All Statuses', options: options, value: value, onSelect: onSelect, onDeselect: onDeselect, ...props });
|
|
1151
|
-
};
|
|
1152
|
-
|
|
1153
|
-
const ConnectionTypeDropdown = ({ connections, title = '', value, onSelect, onDeselect, ...props }) => {
|
|
1154
|
-
const options = useMemo(() => {
|
|
1155
|
-
const payload = [];
|
|
1156
|
-
connections?.forEach(({ type }) => {
|
|
1157
|
-
if (!payload.find((opt) => opt.id === type)) {
|
|
1158
|
-
payload.push({ id: type, value: type });
|
|
1159
|
-
}
|
|
1160
|
-
});
|
|
1161
|
-
return payload;
|
|
1162
|
-
}, [connections]);
|
|
1163
|
-
return React.createElement(Dropdown, { disabled: !options?.length, title: title, placeholder: 'All Types', options: options, value: value, onSelect: onSelect, onDeselect: onDeselect, ...props });
|
|
1164
|
-
};
|
|
1165
|
-
|
|
1166
|
-
const ErrorDropdown = ({ sources, title = 'Error Message', value, onSelect, onDeselect, disabled, ...props }) => {
|
|
1167
|
-
const options = useMemo(() => {
|
|
1168
|
-
const payload = [];
|
|
1169
|
-
// !! note:
|
|
1170
|
-
// conditions no longer have "message" being a required string,
|
|
1171
|
-
// instead, it is now optional and we should fallback to "reason" which is also optional.
|
|
1172
|
-
sources.forEach(({ conditions }) => {
|
|
1173
|
-
mapConditions(conditions || []).forEach(({ status, message, reason }) => {
|
|
1174
|
-
if (status === StatusType.Error && !payload.find((opt) => opt.id === message)) {
|
|
1175
|
-
if (!!message) {
|
|
1176
|
-
if (!payload.find((opt) => opt.id === message))
|
|
1177
|
-
payload.push({ id: message, value: message });
|
|
1178
|
-
}
|
|
1179
|
-
else if (!!reason) {
|
|
1180
|
-
if (!payload.find((opt) => opt.id === reason))
|
|
1181
|
-
payload.push({ id: reason, value: reason });
|
|
1182
|
-
}
|
|
1183
|
-
}
|
|
1184
|
-
});
|
|
1185
|
-
});
|
|
1186
|
-
return payload;
|
|
1187
|
-
}, [sources]);
|
|
1188
|
-
return React.createElement(Dropdown, { disabled: disabled || !options?.length, title: title, placeholder: 'All', options: options, value: value, onSelect: onSelect, onDeselect: onDeselect, ...props });
|
|
1189
|
-
};
|
|
1190
|
-
|
|
1191
|
-
const LanguageDropdown = ({ sources, title = 'Programming Language', value, onSelect, onDeselect, ...props }) => {
|
|
1192
|
-
const options = useMemo(() => {
|
|
1193
|
-
const payload = [];
|
|
1194
|
-
sources.forEach(({ containers }) => {
|
|
1195
|
-
containers?.forEach(({ language }) => {
|
|
1196
|
-
if (!payload.find((opt) => opt.id === language)) {
|
|
1197
|
-
payload.push({ id: language, value: DISPLAY_LANGUAGES[language] || language });
|
|
1198
|
-
}
|
|
1199
|
-
});
|
|
1200
|
-
});
|
|
1201
|
-
return payload.sort((a, b) => a.id?.localeCompare(b.id || '') || 0);
|
|
1202
|
-
}, [sources]);
|
|
1203
|
-
return React.createElement(Dropdown, { disabled: !options?.length, title: title, placeholder: 'All', options: options, value: value, onSelect: onSelect, onDeselect: onDeselect, ...props });
|
|
1204
|
-
};
|
|
1205
|
-
|
|
1206
|
-
const MonitorDropdown = ({ title = 'Monitors', value, onSelect, onDeselect, ...props }) => {
|
|
1207
|
-
const options = useMemo(() => {
|
|
1208
|
-
const payload = [];
|
|
1209
|
-
MONITORS_OPTIONS.forEach(({ id, value }) => {
|
|
1210
|
-
if (!payload.find((opt) => opt.id === id))
|
|
1211
|
-
payload.push({ id, value });
|
|
1212
|
-
});
|
|
1213
|
-
return payload;
|
|
1214
|
-
}, []);
|
|
1215
|
-
return React.createElement(Dropdown, { disabled: !options?.length, title: title, placeholder: 'All', options: options, value: value, onSelect: onSelect, onDeselect: onDeselect, ...props });
|
|
1216
|
-
};
|
|
1217
|
-
|
|
1218
|
-
const NamespaceDropdown = ({ namespaces, title = 'Namespace', value, onSelect, onDeselect, ...props }) => {
|
|
1219
|
-
const options = useMemo(() => {
|
|
1220
|
-
const payload = [];
|
|
1221
|
-
namespaces?.forEach(({ name }) => {
|
|
1222
|
-
if (!payload.find((opt) => opt.id === name)) {
|
|
1223
|
-
payload.push({ id: name, value: name });
|
|
1224
|
-
}
|
|
1225
|
-
});
|
|
1226
|
-
return payload;
|
|
1227
|
-
}, [namespaces]);
|
|
1228
|
-
return React.createElement(Dropdown, { disabled: !options?.length, title: title, placeholder: 'Select namespace', options: options, value: value, onSelect: onSelect, onDeselect: onDeselect, ...props });
|
|
1229
|
-
};
|
|
1230
|
-
|
|
1231
|
-
const KindDropdown = ({ sources, title = 'Kind', value, onSelect, onDeselect, ...props }) => {
|
|
1232
|
-
const options = useMemo(() => {
|
|
1233
|
-
const payload = [];
|
|
1234
|
-
sources.forEach(({ kind: id }) => {
|
|
1235
|
-
if (!payload.find((opt) => opt.id === id)) {
|
|
1236
|
-
payload.push({ id, value: id });
|
|
1237
|
-
}
|
|
1238
|
-
});
|
|
1239
|
-
return payload;
|
|
1240
|
-
}, [sources]);
|
|
1241
|
-
return React.createElement(Dropdown, { disabled: !options?.length, title: title, placeholder: 'All', options: options, value: value, onSelect: onSelect, onDeselect: onDeselect, ...props });
|
|
1242
|
-
};
|
|
1243
|
-
|
|
1244
|
-
const Container$g = styled.div `
|
|
1245
|
-
display: flex;
|
|
1246
|
-
align-items: center;
|
|
1247
|
-
margin: 20px 0;
|
|
1248
|
-
padding: 0 16px;
|
|
1249
|
-
gap: 8px;
|
|
1250
|
-
`;
|
|
1251
|
-
const Title$1 = styled(Text) `
|
|
1252
|
-
font-size: 24px;
|
|
1253
|
-
white-space: nowrap;
|
|
1254
|
-
`;
|
|
1255
|
-
const SearchAndFilterWrapper = styled.div `
|
|
1256
|
-
width: 200px;
|
|
1257
|
-
`;
|
|
1258
|
-
const ComputePlatformsActionsMenu = ({ connections }) => {
|
|
1259
|
-
const { searchText, setSearchText, statuses, setStatuses, clearAll } = useFilterStore();
|
|
1260
|
-
// cleanup filters on unmount
|
|
1261
|
-
useEffect(() => {
|
|
1262
|
-
return () => clearAll();
|
|
1263
|
-
}, [clearAll]);
|
|
1264
|
-
return (React.createElement(Container$g, null,
|
|
1265
|
-
React.createElement(FlexRow, { "$gap": 16 },
|
|
1266
|
-
React.createElement(FlexRow, { "$gap": 12 },
|
|
1267
|
-
React.createElement(Title$1, null, "Compute platforms"),
|
|
1268
|
-
React.createElement(Badge, { label: connections.length, filled: !!connections.length })),
|
|
1269
|
-
React.createElement(Divider, { orientation: 'vertical', length: '20px', margin: '0' }),
|
|
1270
|
-
React.createElement(SearchAndFilterWrapper, null,
|
|
1271
|
-
React.createElement(Input, { placeholder: 'Search...', icon: SearchIcon, value: searchText, onChange: (e) => setSearchText(e.target.value.toLowerCase()) })),
|
|
1272
|
-
React.createElement(SearchAndFilterWrapper, null,
|
|
1273
|
-
React.createElement(ConnectionStatusDropdown, { connections: connections, value: statuses, onSelect: (val) => setStatuses([...(statuses || []), val]), onDeselect: (val) => setStatuses((statuses || []).filter((opt) => opt.id !== val.id)), showSearch: true, required: true, isMulti: true })))));
|
|
1274
|
-
};
|
|
1275
|
-
|
|
1276
1075
|
const { nodeHeight: nodeHeight$5, framePadding: framePadding$4 } = nodeConfig;
|
|
1277
1076
|
const createEdge = (edgeId, params) => {
|
|
1278
1077
|
const { theme, label, isMultiTarget, isError, animated } = params || {};
|
|
@@ -1902,72 +1701,15 @@ styled.div `
|
|
|
1902
1701
|
border-radius: 24px;
|
|
1903
1702
|
`;
|
|
1904
1703
|
|
|
1905
|
-
const buildSearchResults = ({ instrumentationRules, sources, actions, destinations, searchText, selectedCategory }) => {
|
|
1906
|
-
const filteredRules = !searchText ? instrumentationRules : instrumentationRules.filter((rule) => rule.type?.toLowerCase().includes(searchText) || rule.ruleName?.toLowerCase().includes(searchText));
|
|
1907
|
-
const filteredSources = !searchText
|
|
1908
|
-
? sources
|
|
1909
|
-
: sources.filter((source) => source.name?.toLowerCase().includes(searchText) || source.otelServiceName?.toLowerCase().includes(searchText) || source.namespace?.toLowerCase().includes(searchText));
|
|
1910
|
-
const filteredActions = !searchText ? actions : actions.filter((action) => action.type?.toLowerCase().includes(searchText) || action.spec.actionName?.toLowerCase().includes(searchText));
|
|
1911
|
-
const filteredDestinations = !searchText
|
|
1912
|
-
? destinations
|
|
1913
|
-
: destinations.filter((destination) => destination.destinationType.displayName?.toLowerCase().includes(searchText) || destination.name?.toLowerCase().includes(searchText));
|
|
1914
|
-
const categories = [
|
|
1915
|
-
{
|
|
1916
|
-
category: EntityTypes.Source,
|
|
1917
|
-
label: 'Sources',
|
|
1918
|
-
count: filteredSources.length,
|
|
1919
|
-
entities: [],
|
|
1920
|
-
},
|
|
1921
|
-
{
|
|
1922
|
-
category: EntityTypes.Action,
|
|
1923
|
-
label: 'Actions',
|
|
1924
|
-
count: filteredActions.length,
|
|
1925
|
-
entities: [],
|
|
1926
|
-
},
|
|
1927
|
-
{
|
|
1928
|
-
category: EntityTypes.Destination,
|
|
1929
|
-
label: 'Destinations',
|
|
1930
|
-
count: filteredDestinations.length,
|
|
1931
|
-
entities: [],
|
|
1932
|
-
},
|
|
1933
|
-
{
|
|
1934
|
-
category: EntityTypes.InstrumentationRule,
|
|
1935
|
-
label: 'Instrumentation Rules',
|
|
1936
|
-
count: filteredRules.length,
|
|
1937
|
-
entities: [],
|
|
1938
|
-
},
|
|
1939
|
-
];
|
|
1940
|
-
categories.unshift({
|
|
1941
|
-
category: 'all',
|
|
1942
|
-
label: 'All',
|
|
1943
|
-
count: filteredRules.length + filteredSources.length + filteredActions.length + filteredDestinations.length,
|
|
1944
|
-
entities: [],
|
|
1945
|
-
});
|
|
1946
|
-
const searchResults = categories
|
|
1947
|
-
.filter(({ count, category }) => !!count && category !== 'all' && ['all', category].includes(selectedCategory))
|
|
1948
|
-
.map((item) => ({
|
|
1949
|
-
...item,
|
|
1950
|
-
entities: item.category === EntityTypes.InstrumentationRule
|
|
1951
|
-
? filteredRules
|
|
1952
|
-
: item.category === EntityTypes.Source
|
|
1953
|
-
? filteredSources
|
|
1954
|
-
: item.category === EntityTypes.Action
|
|
1955
|
-
? filteredActions
|
|
1956
|
-
: item.category === EntityTypes.Destination
|
|
1957
|
-
? filteredDestinations
|
|
1958
|
-
: [],
|
|
1959
|
-
}));
|
|
1960
|
-
return { categories, searchResults };
|
|
1961
|
-
};
|
|
1962
|
-
|
|
1963
1704
|
const HorizontalScroll = styled.div `
|
|
1964
1705
|
display: flex;
|
|
1965
1706
|
align-items: center;
|
|
1966
1707
|
overflow-x: scroll;
|
|
1967
1708
|
`;
|
|
1968
|
-
const SearchResults = ({
|
|
1709
|
+
const SearchResults = ({ onClose }) => {
|
|
1969
1710
|
const theme = Theme.useTheme();
|
|
1970
1711
|
const { onClickNode } = useClickNode();
|
|
1712
|
+
const { searchText } = useFilterStore();
|
|
1971
1713
|
const { selectedStreamName } = useDataStreamStore();
|
|
1972
1714
|
const { sources, destinations, actions, instrumentationRules } = useEntityStore();
|
|
1973
1715
|
const { popupRef, popupOpen, setPopupOpen, popupPosition, handlePosition } = usePopup();
|
|
@@ -2002,19 +1744,113 @@ const SearchResults = ({ searchText, onClose }) => {
|
|
|
2002
1744
|
React.createElement(Divider, { thickness: catIdx === searchResults.length - 1 ? 0 : 1, length: '90%', margin: '8px auto' }))))));
|
|
2003
1745
|
};
|
|
2004
1746
|
|
|
2005
|
-
const Search = () => {
|
|
2006
|
-
const
|
|
1747
|
+
const Search = ({ preventPopup = false }) => {
|
|
1748
|
+
const { searchText, setSearchText } = useFilterStore();
|
|
2007
1749
|
const [focused, setFocused] = useState(false);
|
|
1750
|
+
const isOpen = !!searchText || focused;
|
|
2008
1751
|
const onClose = () => {
|
|
2009
|
-
|
|
1752
|
+
setSearchText('');
|
|
2010
1753
|
setFocused(false);
|
|
2011
1754
|
};
|
|
2012
1755
|
const containerRef = useRef(null);
|
|
2013
|
-
useOnClickOutside(containerRef,
|
|
2014
|
-
useKeyDown({ key: 'Escape', active:
|
|
1756
|
+
useOnClickOutside(containerRef, onClose);
|
|
1757
|
+
useKeyDown({ key: 'Escape', active: isOpen }, onClose);
|
|
2015
1758
|
return (React.createElement(RelativeContainer$2, { ref: containerRef },
|
|
2016
|
-
React.createElement(Input, { placeholder: 'Search', icon: SearchIcon, value:
|
|
2017
|
-
|
|
1759
|
+
React.createElement(Input, { placeholder: 'Search', icon: SearchIcon, value: searchText, onChange: (e) => setSearchText(e.target.value.toLowerCase()), onFocus: () => setFocused(true) }),
|
|
1760
|
+
isOpen && !preventPopup ? React.createElement(SearchResults, { onClose: onClose }) : null));
|
|
1761
|
+
};
|
|
1762
|
+
|
|
1763
|
+
const ConditionDropdown = ({ sources, title = 'Condition', value, onSelect, onDeselect, ...props }) => {
|
|
1764
|
+
const options = useMemo(() => {
|
|
1765
|
+
const payload = [];
|
|
1766
|
+
sources.forEach(({ conditions }) => {
|
|
1767
|
+
conditions?.forEach(({ type, reason }) => {
|
|
1768
|
+
if (!payload.find((opt) => opt.id === `${type}#${reason}`)) {
|
|
1769
|
+
payload.push({ id: `${type}#${reason}`, value: `${splitCamelString(type)} - ${splitCamelString(reason)}` });
|
|
1770
|
+
}
|
|
1771
|
+
});
|
|
1772
|
+
});
|
|
1773
|
+
return payload.sort((a, b) => a.id?.localeCompare(b.id || '') || 0);
|
|
1774
|
+
}, [sources]);
|
|
1775
|
+
return React.createElement(Dropdown, { disabled: !options?.length, title: title, placeholder: 'All', options: options, value: value, onSelect: onSelect, onDeselect: onDeselect, ...props });
|
|
1776
|
+
};
|
|
1777
|
+
|
|
1778
|
+
const ErrorDropdown = ({ sources, title = 'Error Message', value, onSelect, onDeselect, disabled, ...props }) => {
|
|
1779
|
+
const options = useMemo(() => {
|
|
1780
|
+
const payload = [];
|
|
1781
|
+
// !! note:
|
|
1782
|
+
// conditions no longer have "message" being a required string,
|
|
1783
|
+
// instead, it is now optional and we should fallback to "reason" which is also optional.
|
|
1784
|
+
sources.forEach(({ conditions }) => {
|
|
1785
|
+
mapConditions(conditions || []).forEach(({ status, message, reason }) => {
|
|
1786
|
+
if (status === StatusType.Error && !payload.find((opt) => opt.id === message)) {
|
|
1787
|
+
if (!!message) {
|
|
1788
|
+
if (!payload.find((opt) => opt.id === message))
|
|
1789
|
+
payload.push({ id: message, value: message });
|
|
1790
|
+
}
|
|
1791
|
+
else if (!!reason) {
|
|
1792
|
+
if (!payload.find((opt) => opt.id === reason))
|
|
1793
|
+
payload.push({ id: reason, value: reason });
|
|
1794
|
+
}
|
|
1795
|
+
}
|
|
1796
|
+
});
|
|
1797
|
+
});
|
|
1798
|
+
return payload;
|
|
1799
|
+
}, [sources]);
|
|
1800
|
+
return React.createElement(Dropdown, { disabled: disabled || !options?.length, title: title, placeholder: 'All', options: options, value: value, onSelect: onSelect, onDeselect: onDeselect, ...props });
|
|
1801
|
+
};
|
|
1802
|
+
|
|
1803
|
+
const LanguageDropdown = ({ sources, title = 'Programming Language', value, onSelect, onDeselect, ...props }) => {
|
|
1804
|
+
const options = useMemo(() => {
|
|
1805
|
+
const payload = [];
|
|
1806
|
+
sources.forEach(({ containers }) => {
|
|
1807
|
+
containers?.forEach(({ language }) => {
|
|
1808
|
+
if (!payload.find((opt) => opt.id === language)) {
|
|
1809
|
+
payload.push({ id: language, value: DISPLAY_LANGUAGES[language] || language });
|
|
1810
|
+
}
|
|
1811
|
+
});
|
|
1812
|
+
});
|
|
1813
|
+
return payload.sort((a, b) => a.id?.localeCompare(b.id || '') || 0);
|
|
1814
|
+
}, [sources]);
|
|
1815
|
+
return React.createElement(Dropdown, { disabled: !options?.length, title: title, placeholder: 'All', options: options, value: value, onSelect: onSelect, onDeselect: onDeselect, ...props });
|
|
1816
|
+
};
|
|
1817
|
+
|
|
1818
|
+
const MonitorDropdown = ({ title = 'Monitors', value, onSelect, onDeselect, ...props }) => {
|
|
1819
|
+
const options = useMemo(() => {
|
|
1820
|
+
const payload = [];
|
|
1821
|
+
MONITORS_OPTIONS.forEach(({ id, value }) => {
|
|
1822
|
+
if (!payload.find((opt) => opt.id === id))
|
|
1823
|
+
payload.push({ id, value });
|
|
1824
|
+
});
|
|
1825
|
+
return payload;
|
|
1826
|
+
}, []);
|
|
1827
|
+
return React.createElement(Dropdown, { disabled: !options?.length, title: title, placeholder: 'All', options: options, value: value, onSelect: onSelect, onDeselect: onDeselect, ...props });
|
|
1828
|
+
};
|
|
1829
|
+
|
|
1830
|
+
const NamespaceDropdown = ({ namespaces, title = 'Namespace', value, onSelect, onDeselect, ...props }) => {
|
|
1831
|
+
const options = useMemo(() => {
|
|
1832
|
+
const payload = [];
|
|
1833
|
+
namespaces?.forEach(({ name }) => {
|
|
1834
|
+
if (!payload.find((opt) => opt.id === name)) {
|
|
1835
|
+
payload.push({ id: name, value: name });
|
|
1836
|
+
}
|
|
1837
|
+
});
|
|
1838
|
+
return payload;
|
|
1839
|
+
}, [namespaces]);
|
|
1840
|
+
return React.createElement(Dropdown, { disabled: !options?.length, title: title, placeholder: 'Select namespace', options: options, value: value, onSelect: onSelect, onDeselect: onDeselect, ...props });
|
|
1841
|
+
};
|
|
1842
|
+
|
|
1843
|
+
const KindDropdown = ({ sources, title = 'Kind', value, onSelect, onDeselect, ...props }) => {
|
|
1844
|
+
const options = useMemo(() => {
|
|
1845
|
+
const payload = [];
|
|
1846
|
+
sources.forEach(({ kind: id }) => {
|
|
1847
|
+
if (!payload.find((opt) => opt.id === id)) {
|
|
1848
|
+
payload.push({ id, value: id });
|
|
1849
|
+
}
|
|
1850
|
+
});
|
|
1851
|
+
return payload;
|
|
1852
|
+
}, [sources]);
|
|
1853
|
+
return React.createElement(Dropdown, { disabled: !options?.length, title: title, placeholder: 'All', options: options, value: value, onSelect: onSelect, onDeselect: onDeselect, ...props });
|
|
2018
1854
|
};
|
|
2019
1855
|
|
|
2020
1856
|
const FormWrapper = styled.div `
|
|
@@ -2248,11 +2084,11 @@ const Container$c = styled.div `
|
|
|
2248
2084
|
const PushToEnd = styled.div `
|
|
2249
2085
|
margin-left: auto;
|
|
2250
2086
|
`;
|
|
2251
|
-
const DataFlowActionsMenu = ({ addEntity, onClickNewDataStream, updateDataStream, deleteDataStream }) => {
|
|
2087
|
+
const DataFlowActionsMenu = ({ addEntity, preventSearchPopup, onClickNewDataStream, updateDataStream, deleteDataStream }) => {
|
|
2252
2088
|
const { setCurrentModal } = useModalStore();
|
|
2253
2089
|
return (React.createElement(Container$c, null,
|
|
2254
2090
|
React.createElement(DataStreamSelect, { onClickNewDataStream: onClickNewDataStream, updateDataStream: updateDataStream, deleteDataStream: deleteDataStream }),
|
|
2255
|
-
React.createElement(Search,
|
|
2091
|
+
React.createElement(Search, { preventPopup: preventSearchPopup }),
|
|
2256
2092
|
React.createElement(Filters$1, null),
|
|
2257
2093
|
addEntity && (React.createElement(PushToEnd, null,
|
|
2258
2094
|
React.createElement(AddButton, { "data-id": `add-${addEntity}`, onClick: () => setCurrentModal(addEntity), label: `${BUTTON_TEXTS.ADD} ${addEntity}`, variant: 'primary' })))));
|
|
@@ -2972,8 +2808,15 @@ const DestinationTable = ({ metrics, maxHeight, maxWidth }) => {
|
|
|
2972
2808
|
const { setDrawerType, setDrawerEntityId } = useDrawerStore();
|
|
2973
2809
|
const { destinations, destinationsLoading } = useEntityStore();
|
|
2974
2810
|
const destinationsByStream = useMemo(() => filterDestinationsByStream(destinations, selectedStreamName), [destinations, selectedStreamName]);
|
|
2975
|
-
const
|
|
2976
|
-
|
|
2811
|
+
const filtered = useMemo(() => (buildSearchResults({
|
|
2812
|
+
instrumentationRules: [],
|
|
2813
|
+
sources: [],
|
|
2814
|
+
actions: [],
|
|
2815
|
+
destinations: filterDestinations(destinationsByStream, filters),
|
|
2816
|
+
searchText: filters.searchText,
|
|
2817
|
+
selectedCategory: EntityTypes.Destination,
|
|
2818
|
+
}).searchResults.find(({ category }) => category === EntityTypes.Destination)?.entities || []), [destinationsByStream, filters]);
|
|
2819
|
+
const rows = useMemo(() => filtered.map((dest) => {
|
|
2977
2820
|
const { hasErrors, hasWarnings, hasDisableds } = getConditionsBooleans(dest.conditions || []);
|
|
2978
2821
|
const { icon, iconSrc } = getDestinationIcon(dest.destinationType.type);
|
|
2979
2822
|
return {
|
|
@@ -3017,11 +2860,11 @@ const DestinationTable = ({ metrics, maxHeight, maxWidth }) => {
|
|
|
3017
2860
|
},
|
|
3018
2861
|
],
|
|
3019
2862
|
};
|
|
3020
|
-
}), [
|
|
2863
|
+
}), [filtered, metrics]);
|
|
3021
2864
|
const { badge, badgeTooltip } = useMemo(() => {
|
|
3022
|
-
if (
|
|
2865
|
+
if (filtered.length !== destinationsByStream.length) {
|
|
3023
2866
|
return {
|
|
3024
|
-
badge: `${
|
|
2867
|
+
badge: `${filtered.length}/${destinationsByStream.length}`,
|
|
3025
2868
|
badgeTooltip: DISPLAY_TITLES.FILTERED_COUNT_TOOLTIP,
|
|
3026
2869
|
};
|
|
3027
2870
|
}
|
|
@@ -3029,13 +2872,13 @@ const DestinationTable = ({ metrics, maxHeight, maxWidth }) => {
|
|
|
3029
2872
|
badge: destinationsByStream.length,
|
|
3030
2873
|
badgeTooltip: undefined,
|
|
3031
2874
|
};
|
|
3032
|
-
}, [
|
|
2875
|
+
}, [filtered, destinationsByStream]);
|
|
3033
2876
|
return (React.createElement(TableContainer, { "$maxWidth": maxWidth },
|
|
3034
2877
|
React.createElement(TableTitleWrap, null,
|
|
3035
2878
|
React.createElement(IconTitleBadge, { icon: getEntityIcon(EntityTypes.Destination), title: DISPLAY_TITLES.DESTINATIONS, badge: badge, badgeTooltip: badgeTooltip, loading: destinationsLoading })),
|
|
3036
2879
|
React.createElement(TableWrap, { "$maxHeight": maxHeight },
|
|
3037
2880
|
React.createElement(InteractiveTable, { columns: columns$2, rows: rows })),
|
|
3038
|
-
!
|
|
2881
|
+
!filtered.length && (React.createElement(CenterThis, { style: { marginTop: '2rem' } },
|
|
3039
2882
|
React.createElement(NoDataFound, null)))));
|
|
3040
2883
|
};
|
|
3041
2884
|
|
|
@@ -3496,11 +3339,20 @@ const columns$1 = [
|
|
|
3496
3339
|
];
|
|
3497
3340
|
const InstrumentationRuleTable = ({ maxHeight, maxWidth }) => {
|
|
3498
3341
|
const theme = Theme.useTheme();
|
|
3342
|
+
const filters = useFilterStore();
|
|
3499
3343
|
const { setDrawerType, setDrawerEntityId } = useDrawerStore();
|
|
3500
3344
|
const { instrumentationRules, instrumentationRulesLoading } = useEntityStore();
|
|
3345
|
+
const filtered = useMemo(() => (buildSearchResults({
|
|
3346
|
+
instrumentationRules,
|
|
3347
|
+
sources: [],
|
|
3348
|
+
actions: [],
|
|
3349
|
+
destinations: [],
|
|
3350
|
+
searchText: filters.searchText,
|
|
3351
|
+
selectedCategory: EntityTypes.InstrumentationRule,
|
|
3352
|
+
}).searchResults.find(({ category }) => category === EntityTypes.InstrumentationRule)?.entities || []), [instrumentationRules, filters]);
|
|
3501
3353
|
const rows = useMemo(() =>
|
|
3502
3354
|
// note: rules do not have filters yet
|
|
3503
|
-
|
|
3355
|
+
filtered.map((rule) => {
|
|
3504
3356
|
return {
|
|
3505
3357
|
onClick: () => {
|
|
3506
3358
|
setDrawerType(EntityTypes.InstrumentationRule);
|
|
@@ -3549,13 +3401,25 @@ const InstrumentationRuleTable = ({ maxHeight, maxWidth }) => {
|
|
|
3549
3401
|
},
|
|
3550
3402
|
],
|
|
3551
3403
|
};
|
|
3552
|
-
}), [
|
|
3404
|
+
}), [filtered]);
|
|
3405
|
+
const { badge, badgeTooltip } = useMemo(() => {
|
|
3406
|
+
if (filtered.length !== instrumentationRules.length) {
|
|
3407
|
+
return {
|
|
3408
|
+
badge: `${filtered.length}/${instrumentationRules.length}`,
|
|
3409
|
+
badgeTooltip: DISPLAY_TITLES.FILTERED_COUNT_TOOLTIP,
|
|
3410
|
+
};
|
|
3411
|
+
}
|
|
3412
|
+
return {
|
|
3413
|
+
badge: instrumentationRules.length,
|
|
3414
|
+
badgeTooltip: undefined,
|
|
3415
|
+
};
|
|
3416
|
+
}, [filtered, instrumentationRules]);
|
|
3553
3417
|
return (React.createElement(TableContainer, { "$maxWidth": maxWidth },
|
|
3554
3418
|
React.createElement(TableTitleWrap, null,
|
|
3555
|
-
React.createElement(IconTitleBadge, { icon: getEntityIcon(EntityTypes.Action), title: DISPLAY_TITLES.INSTRUMENTATION_RULES, badge:
|
|
3419
|
+
React.createElement(IconTitleBadge, { icon: getEntityIcon(EntityTypes.Action), title: DISPLAY_TITLES.INSTRUMENTATION_RULES, badge: badge, badgeTooltip: badgeTooltip, loading: instrumentationRulesLoading })),
|
|
3556
3420
|
React.createElement(TableWrap, { "$maxHeight": maxHeight },
|
|
3557
3421
|
React.createElement(InteractiveTable, { columns: columns$1, rows: rows })),
|
|
3558
|
-
!
|
|
3422
|
+
!filtered.length && (React.createElement(CenterThis, { style: { marginTop: '2rem' } },
|
|
3559
3423
|
React.createElement(NoDataFound, null)))));
|
|
3560
3424
|
};
|
|
3561
3425
|
|
|
@@ -4262,11 +4126,11 @@ const Describe$1 = ({ source, fetchSourceDescribe }) => {
|
|
|
4262
4126
|
});
|
|
4263
4127
|
}, [fetchSourceDescribe, source]);
|
|
4264
4128
|
if (!describe && !failed) {
|
|
4265
|
-
return (React.createElement(CenterThis,
|
|
4129
|
+
return (React.createElement(CenterThis, { "$height": '70vh' },
|
|
4266
4130
|
React.createElement(FadeLoader, null)));
|
|
4267
4131
|
}
|
|
4268
|
-
return (React.createElement(FlexColumn, { "$gap": 12 }, failed ? (React.createElement(CenterThis,
|
|
4269
|
-
React.createElement(NoDataFound, { subTitle: 'Could not fetch describe for this source' }))) : !describe?.pods?.length ? (React.createElement(CenterThis,
|
|
4132
|
+
return (React.createElement(FlexColumn, { "$gap": 12 }, failed ? (React.createElement(CenterThis, { "$height": '70vh' },
|
|
4133
|
+
React.createElement(NoDataFound, { subTitle: 'Could not fetch describe for this source' }))) : !describe?.pods?.length ? (React.createElement(CenterThis, { "$height": '70vh' },
|
|
4270
4134
|
React.createElement(NoDataFound, { subTitle: 'Check if you have any running pods and try again' }))) : (describe.pods.map(({ podName, nodeName, phase, agentInjected, runningLatestWorkloadRevision, containers }) => {
|
|
4271
4135
|
const podHasErrors = phase.status !== StatusType.Success || hasUnhealthyInstances(containers);
|
|
4272
4136
|
const podStatus = podHasErrors ? StatusType.Error : StatusType.Success;
|
|
@@ -4330,11 +4194,11 @@ const Libraries = ({ source, fetchSourceLibraries }) => {
|
|
|
4330
4194
|
});
|
|
4331
4195
|
}, [fetchSourceLibraries, source]);
|
|
4332
4196
|
if (!libraries && !failed) {
|
|
4333
|
-
return (React.createElement(CenterThis,
|
|
4197
|
+
return (React.createElement(CenterThis, { "$height": '70vh' },
|
|
4334
4198
|
React.createElement(FadeLoader, null)));
|
|
4335
4199
|
}
|
|
4336
|
-
return (React.createElement(FlexColumn, { "$gap": 12 }, failed ? (React.createElement(CenterThis,
|
|
4337
|
-
React.createElement(NoDataFound, { subTitle: 'Could not fetch libraries for this source' }))) : !libraries?.length ? (React.createElement(CenterThis, { "$gap": 12 },
|
|
4200
|
+
return (React.createElement(FlexColumn, { "$gap": 12 }, failed ? (React.createElement(CenterThis, { "$height": '70vh' },
|
|
4201
|
+
React.createElement(NoDataFound, { subTitle: 'Could not fetch libraries for this source' }))) : !libraries?.length ? (React.createElement(CenterThis, { "$height": '70vh', "$gap": 12 },
|
|
4338
4202
|
React.createElement(NoDataFound, { title: 'No libraries found', subTitle: '' }),
|
|
4339
4203
|
React.createElement(NotificationNote, { type: StatusType.Warning, message: 'This feature is in early development, and has very limited support' }))) : (React.createElement(DataCard, { title: 'Instrumented Libraries' }, libraries.map(({ name, nonIdentifyingAttributes }, i) => (React.createElement(Fragment, { key: `library-${name}` },
|
|
4340
4204
|
React.createElement(Row, null,
|
|
@@ -4387,10 +4251,10 @@ const SourceDrawer = ({ persistSources, updateSource, restartWorkloads, fetchSou
|
|
|
4387
4251
|
const [fetchedSource, setFetchedSource] = useState(null);
|
|
4388
4252
|
// this is used to fetch the source on drawer open, so we ensure we have the latest data
|
|
4389
4253
|
useEffect(() => {
|
|
4390
|
-
if (!isOpen || !drawerEntityId)
|
|
4254
|
+
if (!isOpen || !drawerEntityId || !!fetchedSource)
|
|
4391
4255
|
return;
|
|
4392
4256
|
fetchSourceById(drawerEntityId).then((source) => setFetchedSource(source || null));
|
|
4393
|
-
}, [isOpen, drawerEntityId]);
|
|
4257
|
+
}, [isOpen, drawerEntityId, fetchedSource]);
|
|
4394
4258
|
const { formData, handleFormChange, resetFormData, loadFormWithDrawerItem } = useSourceFormData();
|
|
4395
4259
|
const thisItem = useMemo(() => {
|
|
4396
4260
|
if (!isOpen)
|
|
@@ -4446,6 +4310,7 @@ const SourceDrawer = ({ persistSources, updateSource, restartWorkloads, fetchSou
|
|
|
4446
4310
|
const handleDelete = async () => {
|
|
4447
4311
|
const { namespace } = thisItem;
|
|
4448
4312
|
persistSources({ [namespace]: [{ ...thisItem, selected: false, currentStreamName: selectedStreamName }] }, {});
|
|
4313
|
+
setFetchedSource(null);
|
|
4449
4314
|
setIsFormDirty(false);
|
|
4450
4315
|
setIsEditing(false);
|
|
4451
4316
|
resetFormData();
|
|
@@ -4456,6 +4321,7 @@ const SourceDrawer = ({ persistSources, updateSource, restartWorkloads, fetchSou
|
|
|
4456
4321
|
const title = formData.otelServiceName !== thisItem.name ? formData.otelServiceName : '';
|
|
4457
4322
|
handleFormChange('otelServiceName', title);
|
|
4458
4323
|
await updateSource(drawerEntityId, { ...formData, otelServiceName: title });
|
|
4324
|
+
setFetchedSource(null);
|
|
4459
4325
|
setIsFormDirty(false);
|
|
4460
4326
|
setIsEditing(false);
|
|
4461
4327
|
};
|
|
@@ -4567,7 +4433,14 @@ const SourceTable = ({ metrics, maxHeight, maxWidth }) => {
|
|
|
4567
4433
|
return 1;
|
|
4568
4434
|
}, [sourcesToCreate, sourcesCreated, sourcesToDelete, sourcesDeleted]);
|
|
4569
4435
|
const sourcesByStream = useMemo(() => filterSourcesByStream(sources, selectedStreamName), [sources, selectedStreamName]);
|
|
4570
|
-
const
|
|
4436
|
+
const filtered = useMemo(() => (buildSearchResults({
|
|
4437
|
+
instrumentationRules: [],
|
|
4438
|
+
sources: filterSources(sourcesByStream, filters),
|
|
4439
|
+
actions: [],
|
|
4440
|
+
destinations: [],
|
|
4441
|
+
searchText: filters.searchText,
|
|
4442
|
+
selectedCategory: EntityTypes.Source,
|
|
4443
|
+
}).searchResults.find(({ category }) => category === EntityTypes.Source)?.entities || []), [sourcesByStream, filters]);
|
|
4571
4444
|
const [hasSelected, totalSelectedSources] = useMemo(() => {
|
|
4572
4445
|
let num = 0;
|
|
4573
4446
|
Object.values(selectedSources).forEach((selectedSources) => {
|
|
@@ -4578,7 +4451,7 @@ const SourceTable = ({ metrics, maxHeight, maxWidth }) => {
|
|
|
4578
4451
|
const onSelectAll = useCallback((bool) => {
|
|
4579
4452
|
if (bool) {
|
|
4580
4453
|
const payload = {};
|
|
4581
|
-
|
|
4454
|
+
filtered.forEach((source) => {
|
|
4582
4455
|
const id = { namespace: source.namespace, name: source.name, kind: source.kind };
|
|
4583
4456
|
const isPending = isThisPending({ entityType: EntityTypes.Source, entityId: id });
|
|
4584
4457
|
if (!isPending) {
|
|
@@ -4595,7 +4468,7 @@ const SourceTable = ({ metrics, maxHeight, maxWidth }) => {
|
|
|
4595
4468
|
else {
|
|
4596
4469
|
setSelectedSources({});
|
|
4597
4470
|
}
|
|
4598
|
-
}, [
|
|
4471
|
+
}, [filtered]);
|
|
4599
4472
|
const onSelectOne = useCallback((source) => {
|
|
4600
4473
|
const { namespace, name, kind } = source;
|
|
4601
4474
|
const payload = { ...selectedSources };
|
|
@@ -4610,7 +4483,7 @@ const SourceTable = ({ metrics, maxHeight, maxWidth }) => {
|
|
|
4610
4483
|
}
|
|
4611
4484
|
setSelectedSources(payload);
|
|
4612
4485
|
}, [selectedSources]);
|
|
4613
|
-
const rows = useMemo(() =>
|
|
4486
|
+
const rows = useMemo(() => filtered.map((source) => {
|
|
4614
4487
|
const id = getWorkloadId(source);
|
|
4615
4488
|
const idString = JSON.stringify(id);
|
|
4616
4489
|
const { hasErrors, hasWarnings, hasDisableds } = getConditionsBooleans(source.conditions || []);
|
|
@@ -4660,11 +4533,11 @@ const SourceTable = ({ metrics, maxHeight, maxWidth }) => {
|
|
|
4660
4533
|
},
|
|
4661
4534
|
],
|
|
4662
4535
|
};
|
|
4663
|
-
}), [
|
|
4536
|
+
}), [filtered, selectedSources, metrics, onSelectOne]);
|
|
4664
4537
|
const { badge, badgeTooltip } = useMemo(() => {
|
|
4665
|
-
if (
|
|
4538
|
+
if (filtered.length !== sourcesByStream.length) {
|
|
4666
4539
|
return {
|
|
4667
|
-
badge: `${
|
|
4540
|
+
badge: `${filtered.length}/${sourcesByStream.length}`,
|
|
4668
4541
|
badgeTooltip: DISPLAY_TITLES.FILTERED_COUNT_TOOLTIP,
|
|
4669
4542
|
};
|
|
4670
4543
|
}
|
|
@@ -4672,10 +4545,10 @@ const SourceTable = ({ metrics, maxHeight, maxWidth }) => {
|
|
|
4672
4545
|
badge: sourcesByStream.length,
|
|
4673
4546
|
badgeTooltip: undefined,
|
|
4674
4547
|
};
|
|
4675
|
-
}, [
|
|
4548
|
+
}, [filtered, sourcesByStream]);
|
|
4676
4549
|
return (React.createElement(TableContainer, { "$maxWidth": maxWidth },
|
|
4677
4550
|
React.createElement(TableTitleWrap, null,
|
|
4678
|
-
React.createElement(Checkbox, { partiallyChecked: hasSelected &&
|
|
4551
|
+
React.createElement(Checkbox, { partiallyChecked: hasSelected && filtered?.length !== totalSelectedSources, value: hasSelected && filtered?.length === totalSelectedSources, onChange: onSelectAll, disabled: !filtered?.length }),
|
|
4679
4552
|
React.createElement(IconTitleBadge, { icon: getEntityIcon(EntityTypes.Source), title: DISPLAY_TITLES.SOURCES, badge: badge, badgeTooltip: badgeTooltip, loading: sourcesLoading && !isAwaitingInstrumentation })),
|
|
4680
4553
|
React.createElement(TableWrap, { "$maxHeight": maxHeight },
|
|
4681
4554
|
React.createElement(InteractiveTable, { columns: columns, rows: isAwaitingInstrumentation ? [] : rows })),
|
|
@@ -4685,7 +4558,7 @@ const SourceTable = ({ metrics, maxHeight, maxWidth }) => {
|
|
|
4685
4558
|
React.createElement(Text, { color: theme.text.info },
|
|
4686
4559
|
!!sourcesToCreate ? 'Instrumenting' : 'Uninstrumenting',
|
|
4687
4560
|
" workloads..."),
|
|
4688
|
-
React.createElement(Badge, { label: `${instrumentingPercent}%` })))) : !
|
|
4561
|
+
React.createElement(Badge, { label: `${instrumentingPercent}%` })))) : !filtered.length ? (React.createElement(CenterThis, { style: { marginTop: '2rem' } },
|
|
4689
4562
|
React.createElement(NoDataFound, null))) : null));
|
|
4690
4563
|
};
|
|
4691
4564
|
|
|
@@ -5279,4 +5152,4 @@ const ToggleDarkMode = () => {
|
|
|
5279
5152
|
React.createElement(Background, { "$darkMode": darkMode })));
|
|
5280
5153
|
};
|
|
5281
5154
|
|
|
5282
|
-
export { ActionDrawer, ActionForm, ActionModal, ActionTable, AwaitPipeline,
|
|
5155
|
+
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 };
|