@odigos/ui-kit 0.0.98 → 0.0.100
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 +20 -0
- package/lib/chunks/ui-components-bd79fd1d.js +1604 -0
- package/lib/chunks/vendor-1dea551d.js +1 -0
- package/lib/components.js +1 -163
- package/lib/constants.js +1 -9
- package/lib/containers.js +163 -5141
- package/lib/functions.js +1 -141
- package/lib/hooks.js +1 -649
- package/lib/icons.js +1 -187
- package/lib/snippets/add-button/index.d.ts +2 -1
- package/lib/snippets.js +1 -28
- package/lib/store/useDarkMode.d.ts +5 -3
- package/lib/store.js +1 -4
- package/lib/theme.js +1 -4
- package/lib/types.js +1 -369
- package/package.json +19 -13
- package/eslint.config.mjs +0 -34
- package/lib/index-0a77c1be.js +0 -11
- package/lib/index-195415d4.js +0 -676
- package/lib/index-1cb4f9e2.js +0 -20
- package/lib/index-5e5f7bda.js +0 -39
- package/lib/index-6a6bea6e.js +0 -37
- package/lib/index-77cf7846.js +0 -124
- package/lib/index-89edd01d.js +0 -1968
- package/lib/index-9475009f.js +0 -225
- package/lib/index-a3c0cecd.js +0 -36
- package/lib/index-c823fbfb.js +0 -342
- package/lib/index-c8b542d8.js +0 -38528
- package/lib/index-d8fb5fed.js +0 -138
- package/lib/index-f18c8530.js +0 -64
- package/lib/useTransition-159c9af8.js +0 -3598
package/lib/functions.js
CHANGED
|
@@ -1,141 +1 @@
|
|
|
1
|
-
export
|
|
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
|
-
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-c823fbfb.js';
|
|
6
|
-
export { g as getIdFromSseTarget, i as isLegalK8sLabel, m as mapExportedSignals } from './index-6a6bea6e.js';
|
|
7
|
-
import { ProgrammingLanguages, PlatformType, EntityTypes } from './types.js';
|
|
8
|
-
import 'react';
|
|
9
|
-
import 'styled-components';
|
|
10
|
-
import { O as OdigosLogo } from './index-f18c8530.js';
|
|
11
|
-
import { V as VmLogo } from './index-0a77c1be.js';
|
|
12
|
-
import './index-195415d4.js';
|
|
13
|
-
|
|
14
|
-
const cleanObjectEmptyStringsValues = (obj) => {
|
|
15
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16
|
-
const cleanArray = (arr) => arr.filter((item) => {
|
|
17
|
-
if (typeof item === 'object' && item !== null) {
|
|
18
|
-
return item.key !== '' && item.value !== '';
|
|
19
|
-
}
|
|
20
|
-
return item !== '';
|
|
21
|
-
});
|
|
22
|
-
const cleanObject = (o) => Object.fromEntries(Object.entries(o)
|
|
23
|
-
.filter(([key, value]) => key !== '' && value !== '')
|
|
24
|
-
.map(([key, value]) => {
|
|
25
|
-
if (Array.isArray(value))
|
|
26
|
-
return [key, cleanArray(value)];
|
|
27
|
-
else if (typeof value === 'object' && value !== null)
|
|
28
|
-
return [key, cleanObject(value)];
|
|
29
|
-
return [key, value];
|
|
30
|
-
}));
|
|
31
|
-
return Object.entries(obj).reduce((acc, [key, value]) => {
|
|
32
|
-
try {
|
|
33
|
-
const parsed = JSON.parse(value);
|
|
34
|
-
if (Array.isArray(parsed)) {
|
|
35
|
-
acc[key] = JSON.stringify(cleanArray(parsed));
|
|
36
|
-
}
|
|
37
|
-
else if (typeof parsed === 'object' && parsed !== null) {
|
|
38
|
-
acc[key] = JSON.stringify(cleanObject(parsed));
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
acc[key] = value;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
catch (_) {
|
|
45
|
-
// Handle non-stringified objects or arrays directly
|
|
46
|
-
if (typeof value === 'object' && value !== null) {
|
|
47
|
-
if (Array.isArray(value))
|
|
48
|
-
acc[key] = JSON.stringify(cleanArray(value));
|
|
49
|
-
else
|
|
50
|
-
acc[key] = JSON.stringify(cleanObject(value));
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
// In case JSON.parse fails, assume value is a plain string or non-object/array
|
|
54
|
-
acc[key] = value;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
return acc;
|
|
58
|
-
}, {});
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
// while odigos lists language per container, we want to aggregate one single language for the workload.
|
|
62
|
-
// the process is mostly heuristic, we iterate over the containers and return the first valid language we find.
|
|
63
|
-
// there are additional cases for when the workload programming language is not available.
|
|
64
|
-
const getMainContainerLanguage = (source) => {
|
|
65
|
-
const { numberOfInstances, containers } = source;
|
|
66
|
-
if (!containers) {
|
|
67
|
-
if (!!numberOfInstances && numberOfInstances > 0) {
|
|
68
|
-
return ProgrammingLanguages.Processing;
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
return ProgrammingLanguages.NoRunningPods;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
// we will filter out the ignored languages as we don't want to account them in the main language
|
|
75
|
-
const noneIgnoredLanguages = containers?.filter((container) => container.language !== ProgrammingLanguages.Ignored);
|
|
76
|
-
if (!noneIgnoredLanguages.length)
|
|
77
|
-
return ProgrammingLanguages.NoContainers;
|
|
78
|
-
// find the first container with valid language
|
|
79
|
-
const mainContainer = noneIgnoredLanguages.find((container) => container.language !== ProgrammingLanguages.Unknown);
|
|
80
|
-
// no valid language found, return the first one
|
|
81
|
-
if (!mainContainer)
|
|
82
|
-
return ProgrammingLanguages.Unknown;
|
|
83
|
-
return mainContainer.language;
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
const getPlatformIcon = (type) => {
|
|
87
|
-
if (!type)
|
|
88
|
-
return OdigosLogo;
|
|
89
|
-
const LOGOS = {
|
|
90
|
-
[PlatformType.K8s]: K8sLogo,
|
|
91
|
-
[PlatformType.Vm]: VmLogo,
|
|
92
|
-
};
|
|
93
|
-
return LOGOS[type];
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
const getPlatformLabel = (type) => {
|
|
97
|
-
if (!type)
|
|
98
|
-
return 'Unknown';
|
|
99
|
-
const LABELS = {
|
|
100
|
-
[PlatformType.K8s]: 'Kubernetes Cluster',
|
|
101
|
-
[PlatformType.Vm]: 'Virtual Machine',
|
|
102
|
-
};
|
|
103
|
-
return LABELS[type];
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
const getSseTargetFromId = (id, type) => {
|
|
107
|
-
switch (type) {
|
|
108
|
-
case EntityTypes.Source: {
|
|
109
|
-
let target = '';
|
|
110
|
-
Object.entries(id).forEach(([key, value]) => {
|
|
111
|
-
target += `${key}=${value}&`;
|
|
112
|
-
});
|
|
113
|
-
target.slice(0, -1);
|
|
114
|
-
return target;
|
|
115
|
-
}
|
|
116
|
-
default:
|
|
117
|
-
return id;
|
|
118
|
-
}
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
const isTimeElapsed = (originDate, difference = 0) => {
|
|
122
|
-
const now = new Date().getTime();
|
|
123
|
-
const compareWith = new Date(originDate).getTime();
|
|
124
|
-
return now - compareWith >= difference;
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
const stringifyNonStringValues = (obj) => {
|
|
128
|
-
return Object.entries(obj).reduce((acc, [key, value]) => {
|
|
129
|
-
// Check if the value is already a string
|
|
130
|
-
if (typeof value === 'string') {
|
|
131
|
-
acc[key] = value;
|
|
132
|
-
}
|
|
133
|
-
else {
|
|
134
|
-
// If not, stringify the value
|
|
135
|
-
acc[key] = JSON.stringify(value);
|
|
136
|
-
}
|
|
137
|
-
return acc;
|
|
138
|
-
}, {});
|
|
139
|
-
};
|
|
140
|
-
|
|
141
|
-
export { cleanObjectEmptyStringsValues, getMainContainerLanguage, getPlatformIcon, getPlatformLabel, getSseTargetFromId, isTimeElapsed, stringifyNonStringValues };
|
|
1
|
+
export{a$ as capitalizeFirstLetter,bX as cleanObjectEmptyStringsValues,aU as compareCondition,b2 as deepClone,a2 as filterActions,ax as filterDestinations,aw as filterDestinationsByStream,av as filterSources,au as filterSourcesByStream,bY as flattenObjectKeys,ai as formatBytes,bI as formatDuration,y as getActionIcon,W as getConditionsBooleans,an as getContainersIcons,by as getContainersInstrumentedCount,aq as getDestinationIcon,a9 as getEntityIcon,aE as getEntityId,a4 as getEntityLabel,bZ as getIdFromSseTarget,am as getInstrumentationRuleIcon,b_ as getMainContainerLanguage,b5 as getMetricForEntity,b$ as getMonitorIcon,c0 as getPlatformIcon,c1 as getPlatformLabel,bc as getProgrammingLanguageIcon,bK as getRecursiveValues,c2 as getSseTargetFromId,a0 as getStatusIcon,ao as getValueForRange,bh as getWorkloadId,aZ as getYamlFieldsForDestination,bm as hasUnhealthyInstances,i as isEmpty,c3 as isLegalK8sLabel,bz as isOverTime,bq as isStringABoolean,c4 as isTimeElapsed,c5 as isValidVersion,Z as mapConditions,aT as mapDestinationFieldsForDisplay,ap as mapExportedSignals,c6 as numbersOnly,br as parseBooleanFromString,c7 as parseJsonStringToPrettyString,c8 as removeEmptyValuesFromObject,aV as safeJsonParse,c9 as safeJsonStringify,ag as sleep,aG as splitCamelString,ca as stringifyNonStringValues}from"./chunks/ui-components-bd79fd1d.js";import"./icons.js";import"react";import"zustand";import"javascript-time-ago";import"./chunks/vendor-1dea551d.js";import"styled-components";import"@xyflow/react";import"react-dom";import"prism-react-renderer";import"react-error-boundary";import"lottie-react";
|