@odigos/ui-kit 0.0.16 → 0.0.17

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 (259) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/lib/components/data-tab/index.d.ts +0 -1
  3. package/lib/components/drawer/drawer-header/index.d.ts +2 -2
  4. package/lib/components.js +45 -14
  5. package/lib/constants.js +9 -5
  6. package/lib/containers/overview-drawer/index.d.ts +2 -2
  7. package/lib/containers/source-modal/index.d.ts +0 -2
  8. package/lib/containers/source-selection-form/index.d.ts +0 -1
  9. package/lib/containers.js +129 -206
  10. package/lib/functions.js +15 -9
  11. package/lib/hooks.js +10 -10
  12. package/lib/icons.js +15 -7
  13. package/lib/index-B72aw6tI.js +23 -0
  14. package/lib/{index-D_Qn2U89.js → index-BJxaoI0G.js} +1 -8
  15. package/lib/{index-DiEc-llU.js → index-BQW5EUgp.js} +10 -7
  16. package/lib/index-BQs4sULy.js +32 -0
  17. package/lib/index-BVVVevuY.js +100 -0
  18. package/lib/index-BWqrekK4.js +11 -0
  19. package/lib/{index-D6cZdmUs.js → index-BiNX-Cge.js} +85 -130
  20. package/lib/{index-DM8CZWtL.js → index-BsH_egEe.js} +10 -1
  21. package/lib/{index-CKtl8KxE.js → index-BxQTUOME.js} +10 -12
  22. package/lib/index-C1PCuZgw.js +18 -0
  23. package/lib/{index-CLOUNx6Z.js → index-C3nz3TIx.js} +6 -8
  24. package/lib/{index-BGlk5VhF.js → index-CIXQeSHu.js} +1 -10
  25. package/lib/index-CIgHU72d.js +52 -0
  26. package/lib/index-DbfrGXPH.js +8 -0
  27. package/lib/{index-lL1o2K_5.js → index-G4WmxXds.js} +4 -21
  28. package/lib/{index-7-KCQK-x.js → index-Hz7AAE0t.js} +1 -1
  29. package/lib/{index-DH2zLaey.js → index-KOMAv-TS.js} +1 -8
  30. package/lib/index-RBS1MqCQ.js +37 -0
  31. package/lib/react-CjImwkhV.js +44 -0
  32. package/lib/store.js +6 -3
  33. package/lib/theme.js +86 -3
  34. package/lib/types.js +6 -215
  35. package/lib/useDarkMode-DxhIuVNi.js +201 -0
  36. package/lib/useSelectedStore-93bIo1kE.js +97 -0
  37. package/lib/useSetupStore-CoYx1UQw.js +211 -0
  38. package/lib/{useTransition-hWYVBuSi.js → useTimeAgo-weEj7br6.js} +544 -113
  39. package/lib/useTransition-D0wUpPGk.js +128 -0
  40. package/package.json +2 -1
  41. package/lib/components/auto-complete-input/auto-complete-input.stories.d.ts +0 -9
  42. package/lib/components/badge/badge.stories.d.ts +0 -13
  43. package/lib/components/button/button.stories.d.ts +0 -9
  44. package/lib/components/cancel-warning/cancel-warning.stories.d.ts +0 -9
  45. package/lib/components/checkbox/checkbox.stories.d.ts +0 -9
  46. package/lib/components/code/code.stories.d.ts +0 -9
  47. package/lib/components/condition-details/condition-details.stories.d.ts +0 -14
  48. package/lib/components/data-card/data-card.stories.d.ts +0 -10
  49. package/lib/components/data-tab/data-tab.stories.d.ts +0 -15
  50. package/lib/components/delete-warning/delete-warning.stories.d.ts +0 -9
  51. package/lib/components/describe-row/describe-row.stories.d.ts +0 -9
  52. package/lib/components/divider/divider.stories.d.ts +0 -9
  53. package/lib/components/docs-button/docs-button.stories.d.ts +0 -9
  54. package/lib/components/drawer/drawer.stories.d.ts +0 -10
  55. package/lib/components/dropdown/dropdown.stories.d.ts +0 -10
  56. package/lib/components/error-boundary/error-boundary.stories.d.ts +0 -9
  57. package/lib/components/extend-arrow/extend-arrow.stories.d.ts +0 -9
  58. package/lib/components/fade-loader/fade-loader.stories.d.ts +0 -9
  59. package/lib/components/field-error/field-error.stories.d.ts +0 -9
  60. package/lib/components/field-label/field-label.stories.d.ts +0 -9
  61. package/lib/components/header/header.stories.d.ts +0 -9
  62. package/lib/components/icon-button/icon-button.stories.d.ts +0 -9
  63. package/lib/components/icon-group/icon-group.stories.d.ts +0 -14
  64. package/lib/components/icon-title-badge/icon-title-badge.stories.d.ts +0 -9
  65. package/lib/components/icon-wrapped/icon-wrapped.stories.d.ts +0 -10
  66. package/lib/components/icons-nav/icons-nav.stories.d.ts +0 -9
  67. package/lib/components/image-controlled/image-controlled.stories.d.ts +0 -9
  68. package/lib/components/input/input.stories.d.ts +0 -9
  69. package/lib/components/input-list/input-list.stories.d.ts +0 -9
  70. package/lib/components/input-table/input-table.stories.d.ts +0 -9
  71. package/lib/components/interactive-table/interactive-table.stories.d.ts +0 -12
  72. package/lib/components/key-value-input-list/key-value-input-list.stories.d.ts +0 -9
  73. package/lib/components/modal/modal.stories.d.ts +0 -9
  74. package/lib/components/monitors-checkboxes/monitors-checkboxes.stories.d.ts +0 -9
  75. package/lib/components/monitors-icons/monitors-icons.stories.d.ts +0 -9
  76. package/lib/components/navigation-buttons/navigation-buttons.stories.d.ts +0 -9
  77. package/lib/components/no-data-found/no-data-found.stories.d.ts +0 -9
  78. package/lib/components/notification-note/notification-note.stories.d.ts +0 -10
  79. package/lib/components/section-title/section-title.stories.d.ts +0 -9
  80. package/lib/components/segment/segment.stories.d.ts +0 -9
  81. package/lib/components/skeleton-loader/skeleton-loader.stories.d.ts +0 -9
  82. package/lib/components/status/status.stories.d.ts +0 -9
  83. package/lib/components/stepper/stepper.stories.d.ts +0 -9
  84. package/lib/components/text/text.stories.d.ts +0 -9
  85. package/lib/components/textarea/textarea.stories.d.ts +0 -9
  86. package/lib/components/toggle/toggle.stories.d.ts +0 -9
  87. package/lib/components/tooltip/tooltip.stories.d.ts +0 -9
  88. package/lib/components/trace-loader/trace-loader.stories.d.ts +0 -9
  89. package/lib/components/warning-modal/warning-modal.stories.d.ts +0 -9
  90. package/lib/containers/action-drawer/action-drawer.stories.d.ts +0 -9
  91. package/lib/containers/action-form/action-form.stories.d.ts +0 -9
  92. package/lib/containers/action-modal/action-modal.stories.d.ts +0 -9
  93. package/lib/containers/action-table/action-table.stories.d.ts +0 -9
  94. package/lib/containers/await-pipeline/await-pipeline.stories.d.ts +0 -9
  95. package/lib/containers/compute-platform-select/compute-platform-select.stories.d.ts +0 -9
  96. package/lib/containers/compute-platforms/compute-platforms.stories.d.ts +0 -9
  97. package/lib/containers/compute-platforms-actions-menu/compute-platforms-actions-menu.stories.d.ts +0 -9
  98. package/lib/containers/data-flow/data-flow.stories.d.ts +0 -9
  99. package/lib/containers/data-flow-actions-menu/data-flow-actions-menu.stories.d.ts +0 -11
  100. package/lib/containers/destination-drawer/destination-drawer.stories.d.ts +0 -9
  101. package/lib/containers/destination-form/destination-form.stories.d.ts +0 -9
  102. package/lib/containers/destination-modal/destination-modal.stories.d.ts +0 -9
  103. package/lib/containers/destination-selection-form/destination-selection-form.stories.d.ts +0 -9
  104. package/lib/containers/destination-table/destination-table.stories.d.ts +0 -9
  105. package/lib/containers/dropdowns/connection-status-dropdown/connection-status-dropdown.stories.d.ts +0 -9
  106. package/lib/containers/dropdowns/connection-type-dropdown/connection-type-dropdown.stories.d.ts +0 -9
  107. package/lib/containers/dropdowns/error-dropdown/error-dropdown.stories.d.ts +0 -9
  108. package/lib/containers/dropdowns/kind-dropdown/error-dropdown.stories.d.ts +0 -9
  109. package/lib/containers/dropdowns/language-dropdown/language-dropdown.stories.d.ts +0 -9
  110. package/lib/containers/dropdowns/monitor-dropdown/monitor-dropdown.stories.d.ts +0 -9
  111. package/lib/containers/dropdowns/namespace-dropdown/namespace-dropdown.stories.d.ts +0 -9
  112. package/lib/containers/instrumentation-rule-drawer/instrumentation-rule-drawer.stories.d.ts +0 -9
  113. package/lib/containers/instrumentation-rule-form/instrumentation-rule-form.stories.d.ts +0 -9
  114. package/lib/containers/instrumentation-rule-modal/instrumentation-rule-modal.stories.d.ts +0 -9
  115. package/lib/containers/instrumentation-rule-table/instrumentation-rule-table.stories.d.ts +0 -9
  116. package/lib/containers/multi-source-control/multi-source-control.stories.d.ts +0 -9
  117. package/lib/containers/notification-manager/notification-manager.stories.d.ts +0 -9
  118. package/lib/containers/overview-drawer/overview-drawer.stories.d.ts +0 -9
  119. package/lib/containers/side-nav/side-nav.stories.d.ts +0 -9
  120. package/lib/containers/slack-invite/slack-invite.stories.d.ts +0 -9
  121. package/lib/containers/source-drawer/source-drawer.stories.d.ts +0 -9
  122. package/lib/containers/source-form/source-form.stories.d.ts +0 -9
  123. package/lib/containers/source-modal/source-modal.stories.d.ts +0 -9
  124. package/lib/containers/source-selection-form/fast/index.d.ts +0 -7
  125. package/lib/containers/source-selection-form/simple/controls/index.d.ts +0 -9
  126. package/lib/containers/source-selection-form/simple/index.d.ts +0 -7
  127. package/lib/containers/source-selection-form/simple/list/index.d.ts +0 -8
  128. package/lib/containers/source-selection-form/source-selection-form.stories.d.ts +0 -9
  129. package/lib/containers/source-table/source-table.stories.d.ts +0 -9
  130. package/lib/containers/system-overview/system-overview.stories.d.ts +0 -9
  131. package/lib/containers/table-cell-conditions/table-cell-conditions.stories.d.ts +0 -9
  132. package/lib/containers/toast-list/toast-list.stories.d.ts +0 -9
  133. package/lib/containers/toggle-dark-mode/toggle-dark-mode.stories.d.ts +0 -9
  134. package/lib/icons/actions/add-cluster-info-icon/add-cluster-info-icon.stories.d.ts +0 -8
  135. package/lib/icons/actions/delete-attribute-icon/delete-attribute-icon.stories.d.ts +0 -8
  136. package/lib/icons/actions/pii-masking-icon/pii-masking-icon.stories.d.ts +0 -8
  137. package/lib/icons/actions/rename-attribute-icon/rename-attribute-icon.stories.d.ts +0 -8
  138. package/lib/icons/actions/sampler-icon/sampler-icon.stories.d.ts +0 -8
  139. package/lib/icons/brand/odigos-logo/odigos-logo.stories.d.ts +0 -8
  140. package/lib/icons/brand/odigos-logo-text/odigos-logo-text.stories.d.ts +0 -8
  141. package/lib/icons/common/arrow-icon/arrow-icon.stories.d.ts +0 -8
  142. package/lib/icons/common/code-brackets-icon/code-brackets-icon.stories.d.ts +0 -8
  143. package/lib/icons/common/code-icon/code-icon.stories.d.ts +0 -8
  144. package/lib/icons/common/command-icon/command-icon.stories.d.ts +0 -8
  145. package/lib/icons/common/copy-icon/copy-icon.stories.d.ts +0 -8
  146. package/lib/icons/common/edit-icon/edit-icon.stories.d.ts +0 -8
  147. package/lib/icons/common/extend-arrow-icon/extend-arrow-icon.stories.d.ts +0 -8
  148. package/lib/icons/common/filter-icon/filter-icon.stories.d.ts +0 -8
  149. package/lib/icons/common/folder-icon/folder-icon.stories.d.ts +0 -8
  150. package/lib/icons/common/image-error-icon/image-error-icon.stories.d.ts +0 -8
  151. package/lib/icons/common/key-icon/key-icon.stories.d.ts +0 -8
  152. package/lib/icons/common/list-icon/list-icon.stories.d.ts +0 -8
  153. package/lib/icons/common/no-data-icon/no-data-icon.stories.d.ts +0 -8
  154. package/lib/icons/common/notebook-icon/notebook-icon.stories.d.ts +0 -8
  155. package/lib/icons/common/notification-icon/notification-icon.stories.d.ts +0 -8
  156. package/lib/icons/common/search-icon/search-icon.stories.d.ts +0 -8
  157. package/lib/icons/common/sort-arrows-icon/sort-arrows-icon.stories.d.ts +0 -8
  158. package/lib/icons/common/terminal-icon/terminal-icon.stories.d.ts +0 -8
  159. package/lib/icons/common/trash-icon/trash-icon.stories.d.ts +0 -8
  160. package/lib/icons/common/x-icon/x-icon.stories.d.ts +0 -8
  161. package/lib/icons/compute-platform/k8s-logo/k8s-logo.stories.d.ts +0 -8
  162. package/lib/icons/compute-platform/vm-logo/vm-logo.stories.d.ts +0 -8
  163. package/lib/icons/destinations/app-dynamics-logo/app-dynamics-logo.stories.d.ts +0 -8
  164. package/lib/icons/destinations/aws-cloudwatch-logo/aws-cloudwatch-logo.stories.d.ts +0 -8
  165. package/lib/icons/destinations/aws-s3-logo/aws-s3-logo.stories.d.ts +0 -8
  166. package/lib/icons/destinations/aws-xray-logo/aws-xray-logo.stories.d.ts +0 -8
  167. package/lib/icons/destinations/axiom-logo/axiom-logo.stories.d.ts +0 -8
  168. package/lib/icons/destinations/better-stack-logo/better-stack-logo.stories.d.ts +0 -8
  169. package/lib/icons/destinations/blob-storage-logo/blob-storage-logo.stories.d.ts +0 -8
  170. package/lib/icons/destinations/causely-logo/causely-logo.stories.d.ts +0 -8
  171. package/lib/icons/destinations/chronosphere-logo/chronosphere-logo.stories.d.ts +0 -8
  172. package/lib/icons/destinations/clickhouse-logo/clickhouse-logo.stories.d.ts +0 -8
  173. package/lib/icons/destinations/coralogix-logo/coralogix-logo.stories.d.ts +0 -8
  174. package/lib/icons/destinations/dash0-logo/dash0-logo.stories.d.ts +0 -8
  175. package/lib/icons/destinations/datadog-logo/datadog-logo.stories.d.ts +0 -8
  176. package/lib/icons/destinations/dynatrace-logo/dynatrace-logo.stories.d.ts +0 -8
  177. package/lib/icons/destinations/elastic-apm-logo/elastic-apm-logo.stories.d.ts +0 -8
  178. package/lib/icons/destinations/elastic-search-logo/elastic-search-logo.stories.d.ts +0 -8
  179. package/lib/icons/destinations/gigapipe-logo/gigapipe-logo.stories.d.ts +0 -8
  180. package/lib/icons/destinations/google-cloud-platform-logo/google-cloud-platform-logo.stories.d.ts +0 -8
  181. package/lib/icons/destinations/google-cloud-storage-logo/google-cloud-storage-logo.stories.d.ts +0 -8
  182. package/lib/icons/destinations/grafana-logo/grafana-logo.stories.d.ts +0 -8
  183. package/lib/icons/destinations/groundcover-logo/groundcover-logo.stories.d.ts +0 -8
  184. package/lib/icons/destinations/honeycomb-logo/honeycomb-logo.stories.d.ts +0 -8
  185. package/lib/icons/destinations/hyperdx-logo/hyperdx-logo.stories.d.ts +0 -8
  186. package/lib/icons/destinations/instana-logo/instana-logo.stories.d.ts +0 -8
  187. package/lib/icons/destinations/jaeger-logo/jaeger-logo.stories.d.ts +0 -8
  188. package/lib/icons/destinations/kafka-logo/kafka-logo.stories.d.ts +0 -8
  189. package/lib/icons/destinations/kloudmate-logo/kloudmate-logo.stories.d.ts +0 -8
  190. package/lib/icons/destinations/last9-logo/last9-logo.stories.d.ts +0 -8
  191. package/lib/icons/destinations/lightstep-logo/lightstep-logo.stories.d.ts +0 -8
  192. package/lib/icons/destinations/logzio-logo/logzio-logo.stories.d.ts +0 -8
  193. package/lib/icons/destinations/loki-logo/loki-logo.stories.d.ts +0 -8
  194. package/lib/icons/destinations/lumigo-logo/lumigo-logo.stories.d.ts +0 -8
  195. package/lib/icons/destinations/middleware-logo/middleware-logo.stories.d.ts +0 -8
  196. package/lib/icons/destinations/new-relic-logo/new-relic-logo.stories.d.ts +0 -8
  197. package/lib/icons/destinations/open-telemetry-logo/open-telemetry-logo.stories.d.ts +0 -8
  198. package/lib/icons/destinations/ops-verse-logo/ops-verse-logo.stories.d.ts +0 -8
  199. package/lib/icons/destinations/prometheus-logo/prometheus-logo.stories.d.ts +0 -8
  200. package/lib/icons/destinations/qryn-logo/qryn-logo.stories.d.ts +0 -8
  201. package/lib/icons/destinations/quickwit-logo/quickwit-logo.stories.d.ts +0 -8
  202. package/lib/icons/destinations/sentry-logo/sentry-logo.stories.d.ts +0 -8
  203. package/lib/icons/destinations/signoz-logo/signoz-logo.stories.d.ts +0 -8
  204. package/lib/icons/destinations/splunk-logo/splunk-logo.stories.d.ts +0 -8
  205. package/lib/icons/destinations/sumo-logic-logo/sumo-logic-logo.stories.d.ts +0 -8
  206. package/lib/icons/destinations/tempo-logo/tempo-logo.stories.d.ts +0 -8
  207. package/lib/icons/destinations/traceloop-logo/traceloop-logo.stories.d.ts +0 -8
  208. package/lib/icons/destinations/uptrace-logo/uptrace-logo.stories.d.ts +0 -8
  209. package/lib/icons/instrumentation-rules/code-attributes-icon/code-attributes-icon.stories.d.ts +0 -8
  210. package/lib/icons/instrumentation-rules/payload-collection-icon/payload-collection-icon.stories.d.ts +0 -8
  211. package/lib/icons/math/minus-icon/minus-icon.stories.d.ts +0 -8
  212. package/lib/icons/math/plus-icon/plus-icon.stories.d.ts +0 -8
  213. package/lib/icons/monitors/logs-icon/logs-icon.stories.d.ts +0 -8
  214. package/lib/icons/monitors/metrics-icon/metrics-icon.stories.d.ts +0 -8
  215. package/lib/icons/monitors/traces-icon/traces-icon.stories.d.ts +0 -8
  216. package/lib/icons/on-off/eye-closed-icon/eye-closed-icon.stories.d.ts +0 -8
  217. package/lib/icons/on-off/eye-open-icon/eye-open-icon.stories.d.ts +0 -8
  218. package/lib/icons/on-off/light-off-icon/light-off-icon.stories.d.ts +0 -8
  219. package/lib/icons/on-off/light-on-icon/light-on-icon.stories.d.ts +0 -8
  220. package/lib/icons/on-off/moon-icon/moon-icon.stories.d.ts +0 -8
  221. package/lib/icons/on-off/sun-icon/sun-icon.stories.d.ts +0 -8
  222. package/lib/icons/overview/actions-icon/actions-icon.stories.d.ts +0 -8
  223. package/lib/icons/overview/connections-icon/connections-icon.stories.d.ts +0 -8
  224. package/lib/icons/overview/destinations-icon/destinations-icon.stories.d.ts +0 -8
  225. package/lib/icons/overview/namespaces-icon/namespaces-icon.stories.d.ts +0 -8
  226. package/lib/icons/overview/overview-icon/overview-icon.stories.d.ts +0 -8
  227. package/lib/icons/overview/rules-icon/rules-icon.stories.d.ts +0 -8
  228. package/lib/icons/overview/service-map-icon/service-map-icon.stories.d.ts +0 -8
  229. package/lib/icons/overview/sources-icon/sources-icon.stories.d.ts +0 -8
  230. package/lib/icons/overview/trace-view-icon/trace-view-icon.stories.d.ts +0 -8
  231. package/lib/icons/programming-languages/c-plus-plus-logo/c-plus-plus-logo.stories.d.ts +0 -8
  232. package/lib/icons/programming-languages/c-sharp-logo/c-sharp-logo.stories.d.ts +0 -8
  233. package/lib/icons/programming-languages/dotnet-logo/dotnet-logo.stories.d.ts +0 -8
  234. package/lib/icons/programming-languages/elixir-logo/elixir-logo.stories.d.ts +0 -8
  235. package/lib/icons/programming-languages/go-logo/go-logo.stories.d.ts +0 -8
  236. package/lib/icons/programming-languages/java-logo/java-logo.stories.d.ts +0 -8
  237. package/lib/icons/programming-languages/mysql-logo/mysql-logo.stories.d.ts +0 -8
  238. package/lib/icons/programming-languages/nginx-logo/nginx-logo.stories.d.ts +0 -8
  239. package/lib/icons/programming-languages/nodejs-logo/nodejs-logo.stories.d.ts +0 -8
  240. package/lib/icons/programming-languages/php-logo/php-logo.stories.d.ts +0 -8
  241. package/lib/icons/programming-languages/postgres-logo/postgres-logo.stories.d.ts +0 -8
  242. package/lib/icons/programming-languages/python-logo/python-logo.stories.d.ts +0 -8
  243. package/lib/icons/programming-languages/redis-logo/redis-logo.stories.d.ts +0 -8
  244. package/lib/icons/programming-languages/ruby-logo/ruby-logo.stories.d.ts +0 -8
  245. package/lib/icons/programming-languages/rust-logo/rust-logo.stories.d.ts +0 -8
  246. package/lib/icons/programming-languages/swift-logo/swift-logo.stories.d.ts +0 -8
  247. package/lib/icons/social/slack-logo/slack-logo.stories.d.ts +0 -8
  248. package/lib/icons/status/check-circled-icon/check-circled-icon.stories.d.ts +0 -8
  249. package/lib/icons/status/check-icon/check-icon.stories.d.ts +0 -8
  250. package/lib/icons/status/cross-circled-icon/cross-circled-icon.stories.d.ts +0 -8
  251. package/lib/icons/status/cross-icon/cross-icon.stories.d.ts +0 -8
  252. package/lib/icons/status/error-round-icon/error-round-icon.stories.d.ts +0 -8
  253. package/lib/icons/status/error-triangle-icon/error-triangle-icon.stories.d.ts +0 -8
  254. package/lib/icons/status/info-icon/info-icon.stories.d.ts +0 -8
  255. package/lib/icons/status/warning-triangle-icon/warning-triangle-icon.stories.d.ts +0 -8
  256. package/lib/index-IvGLauAo.js +0 -683
  257. package/lib/useSourceSelectionFormData-R_uK7F7W.js +0 -563
  258. /package/lib/containers/source-selection-form/{fast/controls → controls}/index.d.ts +0 -0
  259. /package/lib/containers/source-selection-form/{fast/list → list}/index.d.ts +0 -0
@@ -1,563 +0,0 @@
1
- import { ActionType, StatusType, AddNodeTypes, EntityTypes, FieldTypes } from './types.js';
2
- import { useState, useEffect, useCallback } from 'react';
3
- import { f as useNotificationStore, e as useModalStore, a as useDrawerStore, b as useEntityStore, i as useSetupStore } from './index-IvGLauAo.js';
4
- import 'styled-components';
5
- import { i as isEmpty, s as safeJsonParse } from './index-BZS1ijMm.js';
6
- import './index-lL1o2K_5.js';
7
- import { F as FORM_ALERTS } from './index-C_0J5P9M.js';
8
- import { b as useGenericForm } from './useTransition-hWYVBuSi.js';
9
- import { g as getIdFromSseTarget } from './index-7-KCQK-x.js';
10
-
11
- const INITIAL$2 = {
12
- // @ts-ignore (TS complains about empty string because we expect an "ActionsType", but it's fine)
13
- type: '',
14
- name: '',
15
- notes: '',
16
- signals: [],
17
- disabled: false,
18
- clusterAttributes: null,
19
- renames: null,
20
- attributeNamesToDelete: null,
21
- piiCategories: null,
22
- fallbackSamplingRatio: null,
23
- samplingPercentage: null,
24
- endpointsFilters: null,
25
- };
26
- const useActionFormData = () => {
27
- const { addNotification } = useNotificationStore();
28
- const { formData, formErrors, handleFormChange, handleErrorChange, resetFormData } = useGenericForm(INITIAL$2);
29
- const validateForm = (params) => {
30
- const errors = {};
31
- let ok = true;
32
- Object.entries(formData).forEach(([k, v]) => {
33
- switch (k) {
34
- case 'type':
35
- case 'signals':
36
- if (isEmpty(v))
37
- errors[k] = FORM_ALERTS.FIELD_IS_REQUIRED;
38
- break;
39
- case 'clusterAttributes':
40
- if (formData.type === ActionType.AddClusterInfo && isEmpty(v))
41
- errors[k] = FORM_ALERTS.FIELD_IS_REQUIRED;
42
- break;
43
- case 'renames':
44
- if (formData.type === ActionType.RenameAttributes && isEmpty(v))
45
- errors[k] = FORM_ALERTS.FIELD_IS_REQUIRED;
46
- break;
47
- case 'attributeNamesToDelete':
48
- if (formData.type === ActionType.DeleteAttributes && isEmpty(v))
49
- errors[k] = FORM_ALERTS.FIELD_IS_REQUIRED;
50
- break;
51
- case 'piiCategories':
52
- if (formData.type === ActionType.PiiMasking && isEmpty(v))
53
- errors[k] = FORM_ALERTS.FIELD_IS_REQUIRED;
54
- break;
55
- case 'fallbackSamplingRatio':
56
- if (formData.type === ActionType.ErrorSampler && isEmpty(v))
57
- errors[k] = FORM_ALERTS.FIELD_IS_REQUIRED;
58
- break;
59
- case 'samplingPercentage':
60
- if (formData.type === ActionType.ProbabilisticSampler && isEmpty(v))
61
- errors[k] = FORM_ALERTS.FIELD_IS_REQUIRED;
62
- break;
63
- case 'endpointsFilters':
64
- if (formData.type === ActionType.LatencySampler) {
65
- if (isEmpty(v))
66
- errors[k] = FORM_ALERTS.FIELD_IS_REQUIRED;
67
- v?.forEach((endpoint) => {
68
- if (endpoint.httpRoute.charAt(0) !== '/')
69
- errors[k] = FORM_ALERTS.LATENCY_HTTP_ROUTE;
70
- });
71
- }
72
- break;
73
- }
74
- });
75
- ok = !Object.values(errors).length;
76
- if (!ok && params?.withAlert) {
77
- addNotification({
78
- type: StatusType.Warning,
79
- title: params.alertTitle,
80
- message: FORM_ALERTS.REQUIRED_FIELDS,
81
- hideFromHistory: true,
82
- });
83
- }
84
- handleErrorChange(undefined, undefined, errors);
85
- return ok;
86
- };
87
- const loadFormWithDrawerItem = ({ type, spec }) => {
88
- const updatedData = {
89
- ...INITIAL$2,
90
- type,
91
- };
92
- Object.entries(spec).forEach(([k, v]) => {
93
- if (!!v) {
94
- switch (k) {
95
- case 'actionName': {
96
- updatedData['name'] = v;
97
- break;
98
- }
99
- case 'type':
100
- case 'notes':
101
- case 'signals':
102
- case 'disabled':
103
- case 'collectContainerAttributes':
104
- case 'collectWorkloadId':
105
- case 'collectClusterId':
106
- case 'labelsAttributes':
107
- case 'annotationsAttributes':
108
- case 'clusterAttributes':
109
- case 'attributeNamesToDelete':
110
- case 'renames':
111
- case 'piiCategories':
112
- case 'fallbackSamplingRatio':
113
- case 'samplingPercentage':
114
- case 'endpointsFilters': {
115
- // @ts-ignore
116
- updatedData[k] = v;
117
- break;
118
- }
119
- }
120
- }
121
- });
122
- handleFormChange(undefined, undefined, updatedData);
123
- };
124
- return {
125
- formData,
126
- formErrors,
127
- handleFormChange,
128
- resetFormData,
129
- validateForm,
130
- loadFormWithDrawerItem,
131
- };
132
- };
133
-
134
- const useClickNode = () => {
135
- const { setCurrentModal } = useModalStore();
136
- const { setDrawerType, setDrawerEntityId } = useDrawerStore();
137
- const onClickNode = (_, object) => {
138
- const { data: { id, type }, } = object;
139
- switch (type) {
140
- case EntityTypes.Source:
141
- case EntityTypes.Destination:
142
- case EntityTypes.Action:
143
- case EntityTypes.InstrumentationRule:
144
- setDrawerType(type);
145
- setDrawerEntityId(id);
146
- break;
147
- case AddNodeTypes.AddSource:
148
- setCurrentModal(EntityTypes.Source);
149
- break;
150
- case AddNodeTypes.AddDestination:
151
- setCurrentModal(EntityTypes.Destination);
152
- break;
153
- case AddNodeTypes.AddAction:
154
- setCurrentModal(EntityTypes.Action);
155
- break;
156
- case AddNodeTypes.AddRule:
157
- setCurrentModal(EntityTypes.InstrumentationRule);
158
- break;
159
- default:
160
- console.warn('Unhandled node click', object);
161
- break;
162
- }
163
- };
164
- return { onClickNode };
165
- };
166
-
167
- const useClickNotification = () => {
168
- const { setDrawerType, setDrawerEntityId } = useDrawerStore();
169
- const { markAsDismissed, markAsSeen } = useNotificationStore();
170
- const onClickNotification = (notif, options) => {
171
- const { id, crdType, target } = notif;
172
- const { dismissToast } = options || {};
173
- if (crdType && target) {
174
- switch (crdType) {
175
- case EntityTypes.InstrumentationRule:
176
- setDrawerType(EntityTypes.InstrumentationRule);
177
- setDrawerEntityId(getIdFromSseTarget(target, EntityTypes.InstrumentationRule));
178
- break;
179
- case EntityTypes.Source:
180
- case 'InstrumentationConfig':
181
- case 'InstrumentationInstance':
182
- setDrawerType(EntityTypes.Source);
183
- setDrawerEntityId(getIdFromSseTarget(target, EntityTypes.Source));
184
- break;
185
- case EntityTypes.Action:
186
- setDrawerType(EntityTypes.Action);
187
- setDrawerEntityId(getIdFromSseTarget(target, EntityTypes.Action));
188
- break;
189
- case EntityTypes.Destination:
190
- case 'Destination':
191
- setDrawerType(EntityTypes.Destination);
192
- setDrawerEntityId(getIdFromSseTarget(target, EntityTypes.Destination));
193
- break;
194
- default:
195
- console.warn('notif click not handled for:', { crdType, target });
196
- break;
197
- }
198
- }
199
- markAsSeen(id);
200
- if (dismissToast)
201
- markAsDismissed(id);
202
- };
203
- return { onClickNotification };
204
- };
205
-
206
- const INITIAL$1 = {
207
- // @ts-ignore form should be initialized with empty values
208
- type: '',
209
- name: '',
210
- exportedSignals: {
211
- logs: false,
212
- metrics: false,
213
- traces: false,
214
- },
215
- fields: [],
216
- };
217
- const buildFormDynamicFields = (fields) => {
218
- return fields
219
- .filter((f) => !!f)
220
- .map((f) => {
221
- const { name, componentType, componentProperties, displayName, initialValue, renderCondition } = f;
222
- switch (componentType) {
223
- case FieldTypes.Dropdown: {
224
- const componentPropertiesJson = safeJsonParse(componentProperties, {});
225
- const options = Array.isArray(componentPropertiesJson.values)
226
- ? componentPropertiesJson.values.map((value) => ({
227
- id: value,
228
- value,
229
- }))
230
- : Object.entries(componentPropertiesJson.values).map(([key, value]) => ({
231
- id: key,
232
- value,
233
- }));
234
- return {
235
- name,
236
- componentType: componentType,
237
- title: displayName,
238
- value: initialValue,
239
- placeholder: componentPropertiesJson.placeholder || 'Select an option',
240
- options,
241
- renderCondition,
242
- ...componentPropertiesJson,
243
- };
244
- }
245
- default: {
246
- const componentPropertiesJson = safeJsonParse(componentProperties, {});
247
- return {
248
- name,
249
- componentType,
250
- title: displayName,
251
- value: initialValue,
252
- renderCondition,
253
- ...componentPropertiesJson,
254
- };
255
- }
256
- }
257
- });
258
- };
259
- const useDestinationFormData = (params) => {
260
- const { supportedSignals, preLoadedFields } = params || {};
261
- const { addNotification } = useNotificationStore();
262
- const { formData, formErrors, handleFormChange, handleErrorChange, resetFormData } = useGenericForm(INITIAL$1);
263
- const [yamlFields, setYamlFields] = useState([]);
264
- const [dynamicFields, setDynamicFields] = useState([]);
265
- useEffect(() => {
266
- if (yamlFields) {
267
- setDynamicFields(buildFormDynamicFields(yamlFields).map((field) => {
268
- // if we have preloaded fields, we need to set the value of the field
269
- // (this can be from an odigos-detected-destination during create, or from an existing destination during edit/update)
270
- if (!!preLoadedFields) {
271
- const parsedFields = typeof preLoadedFields === 'string' ? safeJsonParse(preLoadedFields, {}) : preLoadedFields;
272
- if (field.name in parsedFields) {
273
- return {
274
- ...field,
275
- // @ts-ignore
276
- value: parsedFields[field.name],
277
- };
278
- }
279
- }
280
- return field;
281
- }));
282
- }
283
- else {
284
- setDynamicFields([]);
285
- }
286
- }, [yamlFields, preLoadedFields]);
287
- useEffect(() => {
288
- handleFormChange('fields', dynamicFields.map((field) => ({
289
- key: field.name,
290
- value: field.value,
291
- })));
292
- }, [dynamicFields]);
293
- useEffect(() => {
294
- const { logs, metrics, traces } = supportedSignals || {};
295
- handleFormChange('exportedSignals', {
296
- logs: logs?.supported || false,
297
- metrics: metrics?.supported || false,
298
- traces: traces?.supported || false,
299
- });
300
- }, [supportedSignals]);
301
- const validateForm = (params) => {
302
- const errors = {};
303
- let ok = true;
304
- dynamicFields.forEach(({ name, value, required }) => {
305
- if (required && !value) {
306
- ok = false;
307
- errors[name] = FORM_ALERTS.FIELD_IS_REQUIRED;
308
- }
309
- });
310
- if (!ok && params?.withAlert) {
311
- addNotification({
312
- type: StatusType.Warning,
313
- title: params.alertTitle,
314
- message: FORM_ALERTS.REQUIRED_FIELDS,
315
- hideFromHistory: true,
316
- });
317
- }
318
- handleErrorChange(undefined, undefined, errors);
319
- return ok;
320
- };
321
- const loadFormWithDrawerItem = ({ destinationType: { type }, name, exportedSignals, fields }) => {
322
- const updatedData = {
323
- ...INITIAL$1,
324
- type,
325
- name,
326
- exportedSignals,
327
- fields: Object.entries(safeJsonParse(fields, {})).map(([key, value]) => ({ key, value })),
328
- };
329
- handleFormChange(undefined, undefined, updatedData);
330
- };
331
- return {
332
- formData,
333
- formErrors,
334
- handleFormChange,
335
- resetFormData,
336
- validateForm,
337
- loadFormWithDrawerItem,
338
- yamlFields,
339
- setYamlFields,
340
- dynamicFields,
341
- setDynamicFields,
342
- };
343
- };
344
-
345
- const INITIAL = {
346
- otelServiceName: '',
347
- };
348
- const useSourceFormData = () => {
349
- const { addNotification } = useNotificationStore();
350
- const { formData, formErrors, handleFormChange, handleErrorChange, resetFormData } = useGenericForm(INITIAL);
351
- const validateForm = (params) => {
352
- const errors = {};
353
- let ok = true;
354
- handleErrorChange(undefined, undefined, errors);
355
- return ok;
356
- };
357
- const loadFormWithDrawerItem = ({ otelServiceName, name }) => {
358
- const updatedData = {
359
- ...INITIAL,
360
- otelServiceName: otelServiceName || name || '',
361
- };
362
- handleFormChange(undefined, undefined, updatedData);
363
- };
364
- return {
365
- formData,
366
- formErrors,
367
- handleFormChange,
368
- resetFormData,
369
- validateForm,
370
- loadFormWithDrawerItem,
371
- };
372
- };
373
-
374
- const useSourceSelectionFormData = (params) => {
375
- const { namespaces } = useEntityStore();
376
- const { selectedNamespace, onSelectNamespace, namespace } = params || {};
377
- // only for "onboarding" - get unsaved values and set to state
378
- // (this is to persist the values when user navigates back to this page)
379
- const { configuredSources, configuredFutureApps, availableSources } = useSetupStore();
380
- // Keeps intial values fetched from API, so we can later filter the user-specific-selections, therebey minimizing the amount of data sent to the API on "persist sources".
381
- const [recordedInitialSources, setRecordedInitialSources] = useState(availableSources);
382
- const [selectAllForNamespace, setSelectAllForNamespace] = useState('');
383
- const [selectedSources, setSelectedSources] = useState(configuredSources);
384
- const [selectedFutureApps, setSelectedFutureApps] = useState(configuredFutureApps);
385
- useEffect(() => {
386
- if (!!namespaces?.length) {
387
- // initialize all states (to avoid undefined errors)
388
- setRecordedInitialSources((prev) => {
389
- const payload = { ...prev };
390
- namespaces.forEach(({ name }) => (payload[name] = payload[name] || []));
391
- return payload;
392
- });
393
- setSelectedSources((prev) => {
394
- const payload = { ...prev };
395
- namespaces.forEach(({ name }) => (payload[name] = payload[name] || []));
396
- return payload;
397
- });
398
- setSelectedFutureApps((prev) => {
399
- const payload = { ...prev };
400
- namespaces.forEach(({ name, selected }) => (payload[name] = payload[name] || selected || false));
401
- return payload;
402
- });
403
- }
404
- }, [namespaces]);
405
- useEffect(() => {
406
- if (!!namespace) {
407
- // initialize sources for this namespace
408
- const { name, sources = [] } = namespace;
409
- setRecordedInitialSources((prev) => ({
410
- ...prev,
411
- [name]: sources.map(({ name, kind, selected, numberOfInstances }) => ({
412
- name,
413
- kind,
414
- selected,
415
- numberOfInstances,
416
- })),
417
- }));
418
- setSelectedSources((prev) => ({
419
- ...prev,
420
- [name]: !!prev[name].length
421
- ? prev[name]
422
- : sources.map(({ name, kind, selected, numberOfInstances }) => ({
423
- name,
424
- kind,
425
- selected,
426
- numberOfInstances,
427
- })),
428
- }));
429
- }
430
- }, [namespace]);
431
- // form filters
432
- const [searchText, setSearchText] = useState('');
433
- const [showSelectedOnly, setShowSelectedOnly] = useState(false);
434
- const onSelectAll = useCallback((selected, ns, selectionsByNamespace) => {
435
- // When clicking "select all" on a single namespace
436
- if (!!ns) {
437
- if (!selectionsByNamespace) {
438
- // If the sources are not loaded yet, call the onSelectNamespace to load the sources
439
- onSelectNamespace?.(selected ? ns : '');
440
- // Set the state, so the interval would be able to use the namespace
441
- setSelectAllForNamespace(selected ? ns : '');
442
- }
443
- else if (!!selectionsByNamespace?.[ns]?.length) {
444
- // Clear the state, so the interval would stop
445
- setSelectAllForNamespace('');
446
- }
447
- // Set the selected sources
448
- setSelectedSources((prev) => ({
449
- ...prev,
450
- [ns]: selectionsByNamespace?.[ns]?.map((source) => ({
451
- ...source,
452
- selected,
453
- })) || [],
454
- }));
455
- // setSelectedFutureApps((prev) => ({
456
- // ...prev,
457
- // [ns]: !!selectionsByNamespace?.[ns]?.length ? selected : false,
458
- // }))
459
- }
460
- // When clicking "select all" on all namespaces
461
- else {
462
- setSelectedSources((prev) => {
463
- const payload = { ...prev };
464
- Object.entries(payload).forEach(([key, sources]) => {
465
- payload[key] = sources.map((source) => ({ ...source, selected }));
466
- });
467
- return payload;
468
- });
469
- }
470
- }, [selectedSources]);
471
- // This is to keep trying "select all" per namespace, until the sources are loaded (allows for 1-click, better UX).
472
- useEffect(() => {
473
- if (!!selectAllForNamespace) {
474
- const interval = setInterval(() => onSelectAll(true, selectAllForNamespace, selectedSources), 100);
475
- return () => clearInterval(interval);
476
- }
477
- }, [selectAllForNamespace, onSelectAll]);
478
- const onSelectSource = (source, namespace) => {
479
- const id = namespace || selectedNamespace;
480
- if (!id)
481
- return;
482
- const arr = [...(selectedSources[id] || [])];
483
- const foundIdx = arr.findIndex(({ name, kind }) => name === source.name && kind === source.kind);
484
- if (foundIdx !== -1) {
485
- // Replace the item with a new object to avoid mutating a possibly read-only object
486
- const updatedItem = { ...arr[foundIdx], selected: !arr[foundIdx].selected };
487
- arr[foundIdx] = updatedItem;
488
- }
489
- else {
490
- arr.push({ ...source, selected: true });
491
- }
492
- setSelectedSources((prev) => ({ ...prev, [id]: arr }));
493
- };
494
- const onSelectFutureApps = (bool, namespace) => {
495
- const id = namespace || selectedNamespace;
496
- if (!id)
497
- return;
498
- setSelectedFutureApps((prev) => ({ ...prev, [id]: bool }));
499
- };
500
- const filterNamespaces = (options) => {
501
- const { cancelSearch } = options || {};
502
- const namespaces = Object.entries(selectedSources);
503
- const isSearchOk = (targetText) => cancelSearch || !searchText || targetText.toLowerCase().includes(searchText);
504
- return namespaces.filter(([namespace]) => isSearchOk(namespace));
505
- };
506
- const filterSources = (namespace, options) => {
507
- const { cancelSearch, cancelSelected } = options || {};
508
- const id = namespace || selectedNamespace;
509
- if (!id)
510
- return [];
511
- const isSearchOk = (targetText) => cancelSearch || !searchText || targetText.toLowerCase().includes(searchText);
512
- const isOnlySelectedOk = (sources, compareKey, target) => cancelSelected || !showSelectedOnly || !!sources.find((item) => item[compareKey] === target && item.selected);
513
- return selectedSources[id].filter((source) => isSearchOk(source.name) && isOnlySelectedOk(selectedSources[id], 'name', source.name));
514
- };
515
- // This is to filter the user-specific-selections, therebey minimizing the amount of data sent to the API on "persist sources".
516
- const getApiSourcesPayload = () => {
517
- const payload = {};
518
- Object.entries(selectedSources).forEach(([namespace, sources]) => {
519
- sources.forEach((source) => {
520
- const foundInitial = recordedInitialSources[namespace]?.find((initialSource) => initialSource.name === source.name && initialSource.kind === source.kind);
521
- if (foundInitial?.selected !== source.selected) {
522
- if (!payload[namespace])
523
- payload[namespace] = [];
524
- payload[namespace].push({
525
- name: source.name,
526
- kind: source.kind,
527
- selected: source.selected,
528
- });
529
- }
530
- });
531
- });
532
- return payload;
533
- };
534
- // This is to filter the user-specific-selections, therebey minimizing the amount of data sent to the API on "persist namespaces".
535
- const getApiFutureAppsPayload = () => {
536
- const payload = {};
537
- Object.entries(selectedFutureApps).forEach(([namespace, selected]) => {
538
- const foundInitial = namespaces?.find((ns) => ns.name === namespace);
539
- if (foundInitial?.selected !== selected) {
540
- payload[namespace] = selected;
541
- }
542
- });
543
- return payload;
544
- };
545
- return {
546
- recordedInitialSources,
547
- filterNamespaces,
548
- filterSources,
549
- getApiSourcesPayload,
550
- getApiFutureAppsPayload,
551
- selectedSources,
552
- onSelectSource,
553
- selectedFutureApps,
554
- onSelectFutureApps,
555
- onSelectAll,
556
- searchText,
557
- setSearchText,
558
- showSelectedOnly,
559
- setShowSelectedOnly,
560
- };
561
- };
562
-
563
- export { useClickNode as a, useClickNotification as b, useDestinationFormData as c, useSourceFormData as d, useSourceSelectionFormData as e, useActionFormData as u };