@odigos/ui-kit 0.0.33 → 0.0.35

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 (59) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/eslint.config.mjs +17 -0
  3. package/lib/components/data-card/index.d.ts +2 -1
  4. package/lib/components/dropdown/index.d.ts +1 -0
  5. package/lib/components/input/index.d.ts +1 -1
  6. package/lib/components/input-table/index.d.ts +3 -11
  7. package/lib/components/input-table/map-columns-to-fields/index.d.ts +15 -0
  8. package/lib/components/input-table/types.d.ts +15 -0
  9. package/lib/components.js +9 -10
  10. package/lib/constants/strings/index.d.ts +6 -0
  11. package/lib/constants.js +1 -2
  12. package/lib/containers/action-form/custom-fields/add-cluster-info.d.ts +1 -1
  13. package/lib/containers/action-form/custom-fields/delete-attributes.d.ts +1 -1
  14. package/lib/containers/action-form/custom-fields/error-sampler.d.ts +1 -1
  15. package/lib/containers/action-form/custom-fields/k8s-attributes.d.ts +1 -1
  16. package/lib/containers/action-form/custom-fields/latency-sampler.d.ts +1 -1
  17. package/lib/containers/action-form/custom-fields/pii-masking.d.ts +1 -1
  18. package/lib/containers/action-form/custom-fields/probabilistic-sampler.d.ts +1 -1
  19. package/lib/containers/action-form/custom-fields/rename-attributes.d.ts +1 -1
  20. package/lib/containers/action-form/custom-fields/service-name-sampler.d.ts +5 -0
  21. package/lib/containers/action-form/custom-fields/span-attribute-sampler.d.ts +5 -0
  22. package/lib/containers/data-flow/helpers/build-action-nodes.d.ts +7 -1
  23. package/lib/containers/data-flow/helpers/build-destination-nodes.d.ts +7 -1
  24. package/lib/containers/data-flow/helpers/build-rule-nodes.d.ts +7 -1
  25. package/lib/containers/destination-modal/choose-destination/destinations-list/index.d.ts +1 -1
  26. package/lib/containers/destination-modal/choose-destination/index.d.ts +2 -2
  27. package/lib/containers/instrumentation-rule-drawer/build-card.d.ts +1 -1
  28. package/lib/containers.js +515 -201
  29. package/lib/functions/get-action-icon/index.d.ts +2 -2
  30. package/lib/functions/index.d.ts +1 -0
  31. package/lib/functions/numbers-only/index.d.ts +1 -0
  32. package/lib/functions.js +6 -7
  33. package/lib/hooks/index.d.ts +1 -0
  34. package/lib/hooks/useSessionStorage.d.ts +5 -0
  35. package/lib/hooks.js +4 -5
  36. package/lib/icons.js +7 -7
  37. package/lib/{index-1N9wymEq.js → index-9R2N835W.js} +1 -1
  38. package/lib/{index-f8FRaVkE.js → index-BDqd3uNm.js} +1 -1
  39. package/lib/{index-Do3CYz7N.js → index-BVj4fOL3.js} +1 -1
  40. package/lib/{index-CnZlllYu.js → index-BlZKWuxe.js} +7 -1
  41. package/lib/{index-B_Gl6Qa6.js → index-CCX1HLUr.js} +9 -3
  42. package/lib/{index-CNfdJ1X8.js → index-CEWs8CTN.js} +1 -1
  43. package/lib/{index-CVH8Q8Sl.js → index-CKOBXat_.js} +360 -237
  44. package/lib/{index-CaAOgaiC.js → index-CyG_tD3y.js} +2 -2
  45. package/lib/{index-BjVl4-os.js → index-DmCjUtBQ.js} +4 -5
  46. package/lib/{index-BQQZyvRz.js → index-DqaI44fJ.js} +1 -1
  47. package/lib/{index-BedCNcwV.js → index-THrvNIPj.js} +112 -64
  48. package/lib/{index-Iq7U_fzb.js → index-dLZvpGw3.js} +5 -12
  49. package/lib/mock-data/sources/index.d.ts +2 -0
  50. package/lib/snippets.js +8 -9
  51. package/lib/store.js +1 -1
  52. package/lib/theme.js +1 -1
  53. package/lib/types/actions/index.d.ts +137 -41
  54. package/lib/types/common/index.d.ts +10 -16
  55. package/lib/types.js +85 -20
  56. package/lib/{useSourceSelectionFormData-DiwzViqL.js → useSourceSelectionFormData-DqSNROtZ.js} +73 -37
  57. package/lib/{useTransition-B0eagOib.js → useTransition-D9f1CP9n.js} +1 -1
  58. package/package.json +20 -23
  59. package/lib/index-mOgS3e5E.js +0 -101
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { ActionType, SignalType, InstrumentationRuleType, EntityTypes } from './types.js';
2
+ import { ActionCategory, ActionType, SignalType, InstrumentationRuleType, EntityTypes } from './types.js';
3
3
  import { ThemeProvider, keyframes, useTheme } from 'styled-components';
4
4
 
5
5
  const createStoreImpl = (createState) => {
@@ -43,234 +43,6 @@ const createImpl = (createState) => {
43
43
  };
44
44
  const create = (createState) => createState ? createImpl(createState) : createImpl;
45
45
 
46
- function createJSONStorage(getStorage, options) {
47
- let storage;
48
- try {
49
- storage = getStorage();
50
- } catch (e) {
51
- return;
52
- }
53
- const persistStorage = {
54
- getItem: (name) => {
55
- var _a;
56
- const parse = (str2) => {
57
- if (str2 === null) {
58
- return null;
59
- }
60
- return JSON.parse(str2, void 0 );
61
- };
62
- const str = (_a = storage.getItem(name)) != null ? _a : null;
63
- if (str instanceof Promise) {
64
- return str.then(parse);
65
- }
66
- return parse(str);
67
- },
68
- setItem: (name, newValue) => storage.setItem(
69
- name,
70
- JSON.stringify(newValue, void 0 )
71
- ),
72
- removeItem: (name) => storage.removeItem(name)
73
- };
74
- return persistStorage;
75
- }
76
- const toThenable = (fn) => (input) => {
77
- try {
78
- const result = fn(input);
79
- if (result instanceof Promise) {
80
- return result;
81
- }
82
- return {
83
- then(onFulfilled) {
84
- return toThenable(onFulfilled)(result);
85
- },
86
- catch(_onRejected) {
87
- return this;
88
- }
89
- };
90
- } catch (e) {
91
- return {
92
- then(_onFulfilled) {
93
- return this;
94
- },
95
- catch(onRejected) {
96
- return toThenable(onRejected)(e);
97
- }
98
- };
99
- }
100
- };
101
- const persistImpl = (config, baseOptions) => (set, get, api) => {
102
- let options = {
103
- storage: createJSONStorage(() => localStorage),
104
- partialize: (state) => state,
105
- version: 0,
106
- merge: (persistedState, currentState) => ({
107
- ...currentState,
108
- ...persistedState
109
- }),
110
- ...baseOptions
111
- };
112
- let hasHydrated = false;
113
- const hydrationListeners = /* @__PURE__ */ new Set();
114
- const finishHydrationListeners = /* @__PURE__ */ new Set();
115
- let storage = options.storage;
116
- if (!storage) {
117
- return config(
118
- (...args) => {
119
- console.warn(
120
- `[zustand persist middleware] Unable to update item '${options.name}', the given storage is currently unavailable.`
121
- );
122
- set(...args);
123
- },
124
- get,
125
- api
126
- );
127
- }
128
- const setItem = () => {
129
- const state = options.partialize({ ...get() });
130
- return storage.setItem(options.name, {
131
- state,
132
- version: options.version
133
- });
134
- };
135
- const savedSetState = api.setState;
136
- api.setState = (state, replace) => {
137
- savedSetState(state, replace);
138
- void setItem();
139
- };
140
- const configResult = config(
141
- (...args) => {
142
- set(...args);
143
- void setItem();
144
- },
145
- get,
146
- api
147
- );
148
- api.getInitialState = () => configResult;
149
- let stateFromStorage;
150
- const hydrate = () => {
151
- var _a, _b;
152
- if (!storage) return;
153
- hasHydrated = false;
154
- hydrationListeners.forEach((cb) => {
155
- var _a2;
156
- return cb((_a2 = get()) != null ? _a2 : configResult);
157
- });
158
- const postRehydrationCallback = ((_b = options.onRehydrateStorage) == null ? void 0 : _b.call(options, (_a = get()) != null ? _a : configResult)) || void 0;
159
- return toThenable(storage.getItem.bind(storage))(options.name).then((deserializedStorageValue) => {
160
- if (deserializedStorageValue) {
161
- if (typeof deserializedStorageValue.version === "number" && deserializedStorageValue.version !== options.version) {
162
- if (options.migrate) {
163
- const migration = options.migrate(
164
- deserializedStorageValue.state,
165
- deserializedStorageValue.version
166
- );
167
- if (migration instanceof Promise) {
168
- return migration.then((result) => [true, result]);
169
- }
170
- return [true, migration];
171
- }
172
- console.error(
173
- `State loaded from storage couldn't be migrated since no migrate function was provided`
174
- );
175
- } else {
176
- return [false, deserializedStorageValue.state];
177
- }
178
- }
179
- return [false, void 0];
180
- }).then((migrationResult) => {
181
- var _a2;
182
- const [migrated, migratedState] = migrationResult;
183
- stateFromStorage = options.merge(
184
- migratedState,
185
- (_a2 = get()) != null ? _a2 : configResult
186
- );
187
- set(stateFromStorage, true);
188
- if (migrated) {
189
- return setItem();
190
- }
191
- }).then(() => {
192
- postRehydrationCallback == null ? void 0 : postRehydrationCallback(stateFromStorage, void 0);
193
- stateFromStorage = get();
194
- hasHydrated = true;
195
- finishHydrationListeners.forEach((cb) => cb(stateFromStorage));
196
- }).catch((e) => {
197
- postRehydrationCallback == null ? void 0 : postRehydrationCallback(void 0, e);
198
- });
199
- };
200
- api.persist = {
201
- setOptions: (newOptions) => {
202
- options = {
203
- ...options,
204
- ...newOptions
205
- };
206
- if (newOptions.storage) {
207
- storage = newOptions.storage;
208
- }
209
- },
210
- clearStorage: () => {
211
- storage == null ? void 0 : storage.removeItem(options.name);
212
- },
213
- getOptions: () => options,
214
- rehydrate: () => hydrate(),
215
- hasHydrated: () => hasHydrated,
216
- onHydrate: (cb) => {
217
- hydrationListeners.add(cb);
218
- return () => {
219
- hydrationListeners.delete(cb);
220
- };
221
- },
222
- onFinishHydration: (cb) => {
223
- finishHydrationListeners.add(cb);
224
- return () => {
225
- finishHydrationListeners.delete(cb);
226
- };
227
- }
228
- };
229
- if (!options.skipHydration) {
230
- hydrate();
231
- }
232
- return stateFromStorage || configResult;
233
- };
234
- const persist = persistImpl;
235
-
236
- const useDarkMode = create()(persist((set) => ({
237
- darkMode: true,
238
- setDarkMode: (bool) => set({ darkMode: bool }),
239
- }), {
240
- name: 'odigos-dark-mode',
241
- storage: typeof window !== 'undefined' ? createJSONStorage(() => localStorage) : undefined,
242
- }));
243
-
244
- const initialState$1 = {
245
- dataStreamsLoading: false,
246
- dataStreams: [],
247
- selectedStreamName: '',
248
- };
249
- const useDataStreamStore = create((set) => ({
250
- ...initialState$1,
251
- setDataStreamsLoading: (bool) => set({ dataStreamsLoading: bool }),
252
- setDataStreams: (dataStreams) => set({ dataStreams }),
253
- addDataStreams: (newStreams) => set((state) => {
254
- const merged = [...state.dataStreams, ...newStreams];
255
- const mapped = merged.map((ds) => [ds.name, ds]);
256
- const uniqueByName = Array.from(new Map(mapped).values());
257
- return { dataStreams: uniqueByName };
258
- }),
259
- removeDataStreams: (dataStreams) => set((state) => {
260
- const filtered = state.dataStreams.filter((ds) => !dataStreams.find((toRemove) => toRemove.name === ds.name));
261
- return { dataStreams: filtered };
262
- }),
263
- setSelectedStreamName: (streamName) => set({ selectedStreamName: streamName }),
264
- resetDataStreamStore: () => set(initialState$1),
265
- }));
266
-
267
- const useDrawerStore = create((set) => ({
268
- drawerType: null,
269
- drawerEntityId: null,
270
- setDrawerType: (value) => set({ drawerType: value }),
271
- setDrawerEntityId: (value) => set({ drawerEntityId: value }),
272
- }));
273
-
274
46
  const AddClusterInfoIcon = ({ size = 16, fill: f, rotate = 0, onClick }) => {
275
47
  const theme = Theme.useTheme();
276
48
  const fill = f || theme.text.secondary;
@@ -343,8 +115,8 @@ const PayloadCollectionIcon = ({ size = 16, fill: f, rotate = 0, onClick }) => {
343
115
 
344
116
  const getActionIcon = (type) => {
345
117
  const typeLowerCased = type?.toLowerCase();
346
- const isSamplerCategory = typeLowerCased?.includes('sampler');
347
- const isAttributesCategory = typeLowerCased === 'attributes';
118
+ const isSamplerCategory = typeLowerCased?.includes(ActionCategory.Samplers);
119
+ const isAttributesCategory = typeLowerCased === ActionCategory.Attributes;
348
120
  if (isSamplerCategory)
349
121
  return SamplerIcon;
350
122
  if (isAttributesCategory)
@@ -358,6 +130,8 @@ const getActionIcon = (type) => {
358
130
  [ActionType.ErrorSampler]: SamplerIcon,
359
131
  [ActionType.ProbabilisticSampler]: SamplerIcon,
360
132
  [ActionType.LatencySampler]: SamplerIcon,
133
+ [ActionType.ServiceNameSampler]: SamplerIcon,
134
+ [ActionType.SpanAttributeSampler]: SamplerIcon,
361
135
  };
362
136
  return LOGOS[type] || ImageErrorIcon;
363
137
  };
@@ -365,7 +139,7 @@ const getActionIcon = (type) => {
365
139
  const ACTION_OPTIONS = [
366
140
  {
367
141
  label: 'Attributes',
368
- icon: getActionIcon('attributes'),
142
+ icon: getActionIcon(ActionCategory.Attributes),
369
143
  items: [
370
144
  {
371
145
  type: ActionType.K8sAttributes,
@@ -416,11 +190,11 @@ const ACTION_OPTIONS = [
416
190
  },
417
191
  {
418
192
  label: 'Samplers',
419
- icon: getActionIcon('sampler'),
193
+ icon: getActionIcon(ActionCategory.Samplers),
420
194
  items: [
421
195
  {
422
196
  type: ActionType.ErrorSampler,
423
- icon: getActionIcon('sampler'),
197
+ icon: getActionIcon(ActionCategory.Samplers),
424
198
  label: 'Error Sampler',
425
199
  description: 'Sample errors based on percentage.',
426
200
  allowedSignals: [SignalType.Traces],
@@ -429,7 +203,7 @@ const ACTION_OPTIONS = [
429
203
  },
430
204
  {
431
205
  type: ActionType.LatencySampler,
432
- icon: getActionIcon('sampler'),
206
+ icon: getActionIcon(ActionCategory.Samplers),
433
207
  label: 'Latency Sampler',
434
208
  description: 'Add latency to your traces.',
435
209
  allowedSignals: [SignalType.Traces],
@@ -438,13 +212,31 @@ const ACTION_OPTIONS = [
438
212
  },
439
213
  {
440
214
  type: ActionType.ProbabilisticSampler,
441
- icon: getActionIcon('sampler'),
215
+ icon: getActionIcon(ActionCategory.Samplers),
442
216
  label: 'Probabilistic Sampler',
443
217
  description: 'Sample traces based on percentage.',
444
218
  allowedSignals: [SignalType.Traces],
445
219
  docsEndpoint: '/pipeline/actions/sampling/probabilisticsampler',
446
220
  docsDescription: 'This action supports probabilistic sampling based on a configured sampling percentage applied to the TraceID.',
447
221
  },
222
+ {
223
+ type: ActionType.ServiceNameSampler,
224
+ icon: getActionIcon(ActionCategory.Samplers),
225
+ label: 'Service Name Sampler',
226
+ description: 'Sample traces based on the presence of specified services within a trace.',
227
+ allowedSignals: [SignalType.Traces],
228
+ docsEndpoint: '/pipeline/actions/sampling/servicenamesampler',
229
+ docsDescription: 'This action supports service name sampling based on the presence of specified services within a trace.',
230
+ },
231
+ {
232
+ type: ActionType.SpanAttributeSampler,
233
+ icon: getActionIcon(ActionCategory.Samplers),
234
+ label: 'Span Attributes Sampler',
235
+ description: 'Sample traces based on the presence or value of specific attributes within a trace.',
236
+ allowedSignals: [SignalType.Traces],
237
+ docsEndpoint: '/pipeline/actions/sampling/spanattributesampler',
238
+ docsDescription: 'This action supports service name sampling based on the presence or value of specific attributes within a trace.',
239
+ },
448
240
  ],
449
241
  },
450
242
  ];
@@ -501,6 +293,337 @@ const MONITORS_OPTIONS = [
501
293
  },
502
294
  ];
503
295
 
296
+ const DEFAULT_DATA_STREAM_NAME = 'default';
297
+ const STORAGE_KEYS = {
298
+ SELECTED_DATA_STREAM: 'SELECTED_DATA_STREAM',
299
+ SELECTED_DATA_STREAM_WITH_PROXY: (proxyId) => `SELECTED_DATA_STREAM_${proxyId}`,
300
+ OVERVIEW_FILTERS: 'OVERVIEW_FILTERS',
301
+ DARK_MODE: 'DARK_MODE',
302
+ };
303
+ const FORM_ALERTS = {
304
+ REQUIRED_FIELDS: 'Required fields are missing',
305
+ FIELD_IS_REQUIRED: 'This field is required',
306
+ FORBIDDEN: 'Forbidden',
307
+ ENTERPRISE_ONLY: (str = 'This') => `${str} is an Enterprise feature. Please upgrade your plan.`,
308
+ DEFINED_FOR_ALL_STREAMS: (str) => `${str} are defined for all Data Streams.`,
309
+ CANNOT_EDIT_RULE: 'Cannot edit a system-managed instrumentation rule',
310
+ CANNOT_DELETE_RULE: 'Cannot delete a system-managed instrumentation rule',
311
+ LATENCY_HTTP_ROUTE: 'HTTP route must start with a forward slash "/"',
312
+ READONLY_WARNING: "You're not allowed to create/update/delete in readonly mode",
313
+ ILLEGAL_K8S_LABEL: 'Must be 63 characters or less, must consist of alphanumeric characters, "-", "_", or ".", and must start & end with an alphanumeric character (e.g., my-name, 123.abc).',
314
+ };
315
+ const DISPLAY_TITLES = {
316
+ NAMESPACE: 'Namespace',
317
+ NAME: 'Name',
318
+ KIND: 'Kind',
319
+ CONNECTION: 'Connection',
320
+ CONNECTIONS: 'Connections',
321
+ DATA_STREAM: 'Data Stream',
322
+ DATA_STREAMS: 'Data Streams',
323
+ STREAM_NAME: 'Data Stream Name',
324
+ NAME_YOUR_STREAM: 'Name your Data Stream',
325
+ NAME_YOUR_STREAM_PLACEHOLDER: 'e.g. Highest priority',
326
+ STREAM_DESCRIPTION: 'Provide a clear and descriptive name for your pipeline to ensure its purpose is easily understood by you and your team.',
327
+ STREAM_CONFIRM: 'Confirm your new Data Stream',
328
+ ACTION: 'Action',
329
+ ACTIONS: 'Actions',
330
+ ADD_ACTION: 'Add Action',
331
+ ACTION_DETAILS: 'Action Details',
332
+ INSTRUMENTATION_RULE: 'Instrumentation Rule',
333
+ INSTRUMENTATION_RULES: 'Instrumentation Rules',
334
+ ADD_INSTRUMENTATION_RULE: 'Add Instrumentation Rule',
335
+ INSTRUMENTATION_RULE_DETAILS: 'Instrumentation Rule Details',
336
+ DESTINATION: 'Destination',
337
+ DESTINATIONS: 'Destinations',
338
+ ADD_DESTINATION: 'Add Destination',
339
+ ADD_DESTINATIONS: 'Add Destinations',
340
+ ADD_DESTINATION_DESCRIPTION: 'Add a destination to send your telemetry data to. You can add multiple destinations.',
341
+ DESTINATION_DETAILS: 'Destination Details',
342
+ SELECTED_DESTINATIONS: 'Selected Destinations',
343
+ SOURCE: 'Source',
344
+ SOURCES: 'Sources',
345
+ ADD_SOURCE: 'Add Source',
346
+ SOURCE_DETAILS: 'Source Details',
347
+ SELECT_SOURCES: 'Select Sources',
348
+ SELECTED_SOURCES: 'Selected Sources',
349
+ SELECT_SOURCES_DESCRIPTION: 'Select apps to monitor in each namespace. Odigos will instrument them and send telemetry data to your destinations.',
350
+ NO_SOURCES: 'No sources',
351
+ NO_SOURCES_GO_BACK: 'No sources selected. Please go back to select sources.',
352
+ PLEASE_ADD_SOURCE: 'Please add a source',
353
+ NO_SOURCES_NAMESPACE: 'No sources available in this namespace',
354
+ TRY_SEARCH_OR_OTHER_NAMESPACE: 'Try searching again or select another namespace.',
355
+ PLEASE_MAKE_SURE_UNIGNORED_NAMESPACES: 'Please make sure your cluster has unignored namespaces',
356
+ INSTALLATION: 'Installation',
357
+ SUMMARY: 'Summary',
358
+ TYPE: 'Type',
359
+ NOTES: 'Notes',
360
+ STATUS: 'Status',
361
+ READONLY: 'Readonly',
362
+ LANGUAGE: 'Language',
363
+ MONITORS: 'Monitors',
364
+ SIGNALS_FOR_PROCESSING: 'Signals for Processing',
365
+ MANAGED_BY_PROFILE: 'Managed by Profile',
366
+ API_TOKEN: 'API Token',
367
+ API_TOKENS: 'API Tokens',
368
+ DESCRIBE_ODIGOS: 'Describe Odigos',
369
+ DESCRIBE_SOURCE: 'Describe Source',
370
+ DETECTED_CONTAINERS: 'Detected Containers',
371
+ DETECTED_CONTAINERS_DESCRIPTION: 'The system automatically instruments the containers it detects with a supported programming language.',
372
+ CONTAINER_NAME: 'Container Name',
373
+ FILTERED_COUNT_TOOLTIP: 'Represents filtered amount, out of total amount',
374
+ SEARCH_NAMESPACES: 'Search Namespaces',
375
+ SHOW_SELECTED_ONLY: 'Show selected only',
376
+ TO_COLLECT_OTEL_DATA: 'To collect OpenTelemetry data',
377
+ TO_MONITOR_OTEL_DATA: 'To monitor OpenTelemetry data',
378
+ TO_MODIFY_OTEL_DATA: 'To modify OpenTelemetry data',
379
+ QUICK_BACK_TO_SUMMARY: 'When you finish editing you can quickly go back to the summary.',
380
+ GO_TO_SUMMARY: 'Go to summary',
381
+ };
382
+ const BUTTON_TEXTS = {
383
+ ADD: 'Add',
384
+ ADD_NEW: 'Add New',
385
+ NEW: 'New',
386
+ SELECT: 'Select',
387
+ CREATE: 'Create',
388
+ UPDATE: 'Update',
389
+ EDIT: 'Edit',
390
+ DELETE: 'Delete',
391
+ CANCEL: 'Cancel',
392
+ DONE: 'Done',
393
+ SAVE: 'Save',
394
+ BACK: 'Back',
395
+ NEXT: 'Next',
396
+ TEST: 'Test',
397
+ TEST_CONNECTION: 'Test Connection',
398
+ INSTRUMENT: 'Instrument',
399
+ UNINSTRUMENT: 'Uninstrument',
400
+ };
401
+
402
+ function createJSONStorage(getStorage, options) {
403
+ let storage;
404
+ try {
405
+ storage = getStorage();
406
+ } catch (e) {
407
+ return;
408
+ }
409
+ const persistStorage = {
410
+ getItem: (name) => {
411
+ var _a;
412
+ const parse = (str2) => {
413
+ if (str2 === null) {
414
+ return null;
415
+ }
416
+ return JSON.parse(str2, void 0 );
417
+ };
418
+ const str = (_a = storage.getItem(name)) != null ? _a : null;
419
+ if (str instanceof Promise) {
420
+ return str.then(parse);
421
+ }
422
+ return parse(str);
423
+ },
424
+ setItem: (name, newValue) => storage.setItem(name, JSON.stringify(newValue, void 0 )),
425
+ removeItem: (name) => storage.removeItem(name)
426
+ };
427
+ return persistStorage;
428
+ }
429
+ const toThenable = (fn) => (input) => {
430
+ try {
431
+ const result = fn(input);
432
+ if (result instanceof Promise) {
433
+ return result;
434
+ }
435
+ return {
436
+ then(onFulfilled) {
437
+ return toThenable(onFulfilled)(result);
438
+ },
439
+ catch(_onRejected) {
440
+ return this;
441
+ }
442
+ };
443
+ } catch (e) {
444
+ return {
445
+ then(_onFulfilled) {
446
+ return this;
447
+ },
448
+ catch(onRejected) {
449
+ return toThenable(onRejected)(e);
450
+ }
451
+ };
452
+ }
453
+ };
454
+ const persistImpl = (config, baseOptions) => (set, get, api) => {
455
+ let options = {
456
+ storage: createJSONStorage(() => localStorage),
457
+ partialize: (state) => state,
458
+ version: 0,
459
+ merge: (persistedState, currentState) => ({
460
+ ...currentState,
461
+ ...persistedState
462
+ }),
463
+ ...baseOptions
464
+ };
465
+ let hasHydrated = false;
466
+ const hydrationListeners = /* @__PURE__ */ new Set();
467
+ const finishHydrationListeners = /* @__PURE__ */ new Set();
468
+ let storage = options.storage;
469
+ if (!storage) {
470
+ return config(
471
+ (...args) => {
472
+ console.warn(
473
+ `[zustand persist middleware] Unable to update item '${options.name}', the given storage is currently unavailable.`
474
+ );
475
+ set(...args);
476
+ },
477
+ get,
478
+ api
479
+ );
480
+ }
481
+ const setItem = () => {
482
+ const state = options.partialize({ ...get() });
483
+ return storage.setItem(options.name, {
484
+ state,
485
+ version: options.version
486
+ });
487
+ };
488
+ const savedSetState = api.setState;
489
+ api.setState = (state, replace) => {
490
+ savedSetState(state, replace);
491
+ void setItem();
492
+ };
493
+ const configResult = config(
494
+ (...args) => {
495
+ set(...args);
496
+ void setItem();
497
+ },
498
+ get,
499
+ api
500
+ );
501
+ api.getInitialState = () => configResult;
502
+ let stateFromStorage;
503
+ const hydrate = () => {
504
+ var _a, _b;
505
+ if (!storage) return;
506
+ hasHydrated = false;
507
+ hydrationListeners.forEach((cb) => {
508
+ var _a2;
509
+ return cb((_a2 = get()) != null ? _a2 : configResult);
510
+ });
511
+ const postRehydrationCallback = ((_b = options.onRehydrateStorage) == null ? void 0 : _b.call(options, (_a = get()) != null ? _a : configResult)) || void 0;
512
+ return toThenable(storage.getItem.bind(storage))(options.name).then((deserializedStorageValue) => {
513
+ if (deserializedStorageValue) {
514
+ if (typeof deserializedStorageValue.version === "number" && deserializedStorageValue.version !== options.version) {
515
+ if (options.migrate) {
516
+ const migration = options.migrate(
517
+ deserializedStorageValue.state,
518
+ deserializedStorageValue.version
519
+ );
520
+ if (migration instanceof Promise) {
521
+ return migration.then((result) => [true, result]);
522
+ }
523
+ return [true, migration];
524
+ }
525
+ console.error(
526
+ `State loaded from storage couldn't be migrated since no migrate function was provided`
527
+ );
528
+ } else {
529
+ return [false, deserializedStorageValue.state];
530
+ }
531
+ }
532
+ return [false, void 0];
533
+ }).then((migrationResult) => {
534
+ var _a2;
535
+ const [migrated, migratedState] = migrationResult;
536
+ stateFromStorage = options.merge(
537
+ migratedState,
538
+ (_a2 = get()) != null ? _a2 : configResult
539
+ );
540
+ set(stateFromStorage, true);
541
+ if (migrated) {
542
+ return setItem();
543
+ }
544
+ }).then(() => {
545
+ postRehydrationCallback == null ? void 0 : postRehydrationCallback(stateFromStorage, void 0);
546
+ stateFromStorage = get();
547
+ hasHydrated = true;
548
+ finishHydrationListeners.forEach((cb) => cb(stateFromStorage));
549
+ }).catch((e) => {
550
+ postRehydrationCallback == null ? void 0 : postRehydrationCallback(void 0, e);
551
+ });
552
+ };
553
+ api.persist = {
554
+ setOptions: (newOptions) => {
555
+ options = {
556
+ ...options,
557
+ ...newOptions
558
+ };
559
+ if (newOptions.storage) {
560
+ storage = newOptions.storage;
561
+ }
562
+ },
563
+ clearStorage: () => {
564
+ storage == null ? void 0 : storage.removeItem(options.name);
565
+ },
566
+ getOptions: () => options,
567
+ rehydrate: () => hydrate(),
568
+ hasHydrated: () => hasHydrated,
569
+ onHydrate: (cb) => {
570
+ hydrationListeners.add(cb);
571
+ return () => {
572
+ hydrationListeners.delete(cb);
573
+ };
574
+ },
575
+ onFinishHydration: (cb) => {
576
+ finishHydrationListeners.add(cb);
577
+ return () => {
578
+ finishHydrationListeners.delete(cb);
579
+ };
580
+ }
581
+ };
582
+ if (!options.skipHydration) {
583
+ hydrate();
584
+ }
585
+ return stateFromStorage || configResult;
586
+ };
587
+ const persist = persistImpl;
588
+
589
+ const useDarkMode = create()(persist((set) => ({
590
+ darkMode: true,
591
+ setDarkMode: (bool) => set({ darkMode: bool }),
592
+ }), {
593
+ name: STORAGE_KEYS.DARK_MODE,
594
+ storage: typeof window !== 'undefined' ? createJSONStorage(() => localStorage) : undefined,
595
+ }));
596
+
597
+ const initialState$1 = {
598
+ dataStreamsLoading: false,
599
+ dataStreams: [],
600
+ selectedStreamName: '',
601
+ };
602
+ const useDataStreamStore = create((set) => ({
603
+ ...initialState$1,
604
+ setDataStreamsLoading: (bool) => set({ dataStreamsLoading: bool }),
605
+ setDataStreams: (dataStreams) => set({ dataStreams }),
606
+ addDataStreams: (newStreams) => set((state) => {
607
+ const merged = [...state.dataStreams, ...newStreams];
608
+ const mapped = merged.map((ds) => [ds.name, ds]);
609
+ const uniqueByName = Array.from(new Map(mapped).values());
610
+ return { dataStreams: uniqueByName };
611
+ }),
612
+ removeDataStreams: (dataStreams) => set((state) => {
613
+ const filtered = state.dataStreams.filter((ds) => !dataStreams.find((toRemove) => toRemove.name === ds.name));
614
+ return { dataStreams: filtered };
615
+ }),
616
+ setSelectedStreamName: (streamName) => set({ selectedStreamName: streamName }),
617
+ resetDataStreamStore: () => set(initialState$1),
618
+ }));
619
+
620
+ const useDrawerStore = create((set) => ({
621
+ drawerType: null,
622
+ drawerEntityId: null,
623
+ setDrawerType: (value) => set({ drawerType: value }),
624
+ setDrawerEntityId: (value) => set({ drawerEntityId: value }),
625
+ }));
626
+
504
627
  const getEntityId = (item) => {
505
628
  if ('ruleId' in item && !!item.ruleId) {
506
629
  // Instrumentation Rule
@@ -1175,4 +1298,4 @@ const Theme = {
1175
1298
  animations,
1176
1299
  };
1177
1300
 
1178
- export { ACTION_OPTIONS as A, CodeAttributesIcon as C, DeleteAttributeIcon as D, HeadersCollectionIcon as H, INSTRUMENTATION_RULE_OPTIONS as I, K8sLogo as K, MONITORS_OPTIONS as M, PiiMaskingIcon as P, RenameAttributeIcon as R, SamplerIcon as S, Theme as T, useDataStreamStore as a, useDrawerStore as b, useEntityStore as c, useFilterStore as d, useInstrumentStore as e, useModalStore as f, useNotificationStore as g, usePendingStore as h, useSelectedStore as i, useSetupStore as j, getActionIcon as k, getEntityId as l, getInstrumentationRuleIcon as m, ImageErrorIcon as n, AddClusterInfoIcon as o, PayloadCollectionIcon as p, styleInject as s, useDarkMode as u };
1301
+ export { ACTION_OPTIONS as A, BUTTON_TEXTS as B, CodeAttributesIcon as C, DEFAULT_DATA_STREAM_NAME as D, FORM_ALERTS as F, HeadersCollectionIcon as H, INSTRUMENTATION_RULE_OPTIONS as I, K8sLogo as K, MONITORS_OPTIONS as M, PiiMaskingIcon as P, RenameAttributeIcon as R, STORAGE_KEYS as S, Theme as T, useDataStreamStore as a, useDrawerStore as b, useEntityStore as c, useFilterStore as d, useInstrumentStore as e, useModalStore as f, useNotificationStore as g, usePendingStore as h, useSelectedStore as i, useSetupStore as j, DISPLAY_TITLES as k, getActionIcon as l, getEntityId as m, getInstrumentationRuleIcon as n, ImageErrorIcon as o, AddClusterInfoIcon as p, DeleteAttributeIcon as q, SamplerIcon as r, PayloadCollectionIcon as s, styleInject as t, useDarkMode as u };
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
- import { _ as WarningModal } from './index-BedCNcwV.js';
2
+ import { _ as WarningModal } from './index-THrvNIPj.js';
3
3
  import { StatusType, EntityTypes } from './types.js';
4
- import './index-CVH8Q8Sl.js';
4
+ import './index-CKOBXat_.js';
5
5
  import 'styled-components';
6
6
 
7
7
  const CancelWarning = ({ isOpen, noOverlay, name, onApprove, onDeny }) => {
@@ -1,11 +1,10 @@
1
1
  import React from 'react';
2
- import { T as Theme } from './index-CVH8Q8Sl.js';
3
- import { E as EditIcon } from './index-BQQZyvRz.js';
4
- import { B as BUTTON_TEXTS, a as DISPLAY_TITLES } from './index-mOgS3e5E.js';
5
- import { B as Button, V as Text, J as NotificationNote } from './index-BedCNcwV.js';
2
+ import { T as Theme, B as BUTTON_TEXTS, k as DISPLAY_TITLES } from './index-CKOBXat_.js';
3
+ import { E as EditIcon } from './index-DqaI44fJ.js';
4
+ import { B as Button, V as Text, J as NotificationNote } from './index-THrvNIPj.js';
6
5
  import { StatusType } from './types.js';
7
6
  import 'styled-components';
8
- import { I as InfoIcon } from './index-Do3CYz7N.js';
7
+ import { I as InfoIcon } from './index-BVj4fOL3.js';
9
8
 
10
9
  const EditButton = ({ label, onClick, variant = 'tertiary', ...props }) => {
11
10
  const theme = Theme.useTheme();
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { T as Theme } from './index-CVH8Q8Sl.js';
2
+ import { T as Theme } from './index-CKOBXat_.js';
3
3
 
4
4
  const EditIcon = ({ size = 16, fill: f, rotate = 0, onClick }) => {
5
5
  const theme = Theme.useTheme();