@odigos/ui-kit 0.0.15 → 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.
- package/CHANGELOG.md +26 -0
- package/lib/components/data-tab/index.d.ts +17 -6
- package/lib/components/drawer/drawer-header/index.d.ts +2 -2
- package/lib/components/icon-group/index.d.ts +1 -0
- package/lib/components.js +45 -14
- package/lib/constants.js +9 -5
- package/lib/containers/data-flow-actions-menu/filters/index.d.ts +0 -3
- package/lib/containers/data-flow-actions-menu/index.d.ts +0 -3
- package/lib/containers/dropdowns/namespace-dropdown/index.d.ts +0 -3
- package/lib/containers/overview-drawer/index.d.ts +2 -2
- package/lib/containers/source-modal/index.d.ts +1 -5
- package/lib/containers/source-selection-form/index.d.ts +1 -4
- package/lib/containers/source-selection-form/{fast/list → list}/index.d.ts +0 -1
- package/lib/containers/table-cell-conditions/index.d.ts +1 -0
- package/lib/containers.js +214 -230
- package/lib/data/destinations/index.d.ts +1 -1
- package/lib/functions/get-destination-icon/index.d.ts +5 -1
- package/lib/functions.js +17 -21
- package/lib/hooks/useSourceSelectionFormData.d.ts +1 -2
- package/lib/hooks.js +10 -10
- package/lib/icons/destinations/app-dynamics-logo/index.d.ts +2 -0
- package/lib/icons/destinations/aws-cloudwatch-logo/index.d.ts +2 -0
- package/lib/icons/destinations/aws-s3-logo/index.d.ts +2 -0
- package/lib/icons/destinations/aws-xray-logo/index.d.ts +2 -0
- package/lib/icons/destinations/axiom-logo/index.d.ts +2 -0
- package/lib/icons/destinations/better-stack-logo/index.d.ts +2 -0
- package/lib/icons/destinations/blob-storage-logo/index.d.ts +2 -0
- package/lib/icons/destinations/causely-logo/index.d.ts +2 -0
- package/lib/icons/destinations/chronosphere-logo/index.d.ts +2 -0
- package/lib/icons/destinations/clickhouse-logo/index.d.ts +2 -0
- package/lib/icons/destinations/coralogix-logo/index.d.ts +2 -0
- package/lib/icons/destinations/dash0-logo/index.d.ts +2 -0
- package/lib/icons/destinations/datadog-logo/index.d.ts +2 -0
- package/lib/icons/destinations/dynatrace-logo/index.d.ts +2 -0
- package/lib/icons/destinations/elastic-apm-logo/index.d.ts +2 -0
- package/lib/icons/destinations/elastic-search-logo/index.d.ts +2 -0
- package/lib/icons/destinations/gigapipe-logo/index.d.ts +2 -0
- package/lib/icons/destinations/google-cloud-platform-logo/index.d.ts +2 -0
- package/lib/icons/destinations/google-cloud-storage-logo/index.d.ts +2 -0
- package/lib/icons/destinations/grafana-logo/index.d.ts +2 -0
- package/lib/icons/destinations/groundcover-logo/index.d.ts +2 -0
- package/lib/icons/destinations/honeycomb-logo/index.d.ts +2 -0
- package/lib/icons/destinations/hyperdx-logo/index.d.ts +2 -0
- package/lib/icons/destinations/index.d.ts +46 -0
- package/lib/icons/destinations/instana-logo/index.d.ts +2 -0
- package/lib/icons/destinations/jaeger-logo/index.d.ts +2 -0
- package/lib/icons/destinations/kloudmate-logo/index.d.ts +2 -0
- package/lib/icons/destinations/last9-logo/index.d.ts +2 -0
- package/lib/icons/destinations/lightstep-logo/index.d.ts +2 -0
- package/lib/icons/destinations/logzio-logo/index.d.ts +2 -0
- package/lib/icons/destinations/loki-logo/index.d.ts +2 -0
- package/lib/icons/destinations/lumigo-logo/index.d.ts +2 -0
- package/lib/icons/destinations/middleware-logo/index.d.ts +2 -0
- package/lib/icons/destinations/new-relic-logo/index.d.ts +2 -0
- package/lib/icons/destinations/open-telemetry-logo/index.d.ts +2 -0
- package/lib/icons/destinations/ops-verse-logo/index.d.ts +2 -0
- package/lib/icons/destinations/prometheus-logo/index.d.ts +2 -0
- package/lib/icons/destinations/qryn-logo/index.d.ts +2 -0
- package/lib/icons/destinations/quickwit-logo/index.d.ts +2 -0
- package/lib/icons/destinations/sentry-logo/index.d.ts +2 -0
- package/lib/icons/destinations/signoz-logo/index.d.ts +2 -0
- package/lib/icons/destinations/splunk-logo/index.d.ts +2 -0
- package/lib/icons/destinations/sumo-logic-logo/index.d.ts +2 -0
- package/lib/icons/destinations/tempo-logo/index.d.ts +2 -0
- package/lib/icons/destinations/traceloop-logo/index.d.ts +2 -0
- package/lib/icons/destinations/uptrace-logo/index.d.ts +2 -0
- package/lib/icons/index.d.ts +1 -0
- package/lib/icons/overview/index.d.ts +1 -0
- package/lib/icons/overview/namespaces-icon/index.d.ts +2 -0
- package/lib/icons/programming-languages/index.d.ts +0 -1
- package/lib/icons.js +40 -8
- package/lib/index-B72aw6tI.js +23 -0
- package/lib/{index-D_Qn2U89.js → index-BJxaoI0G.js} +1 -8
- package/lib/{index-BtuW12KL.js → index-BQW5EUgp.js} +74 -8
- package/lib/index-BQs4sULy.js +32 -0
- package/lib/index-BVVVevuY.js +100 -0
- package/lib/index-BWqrekK4.js +11 -0
- package/lib/{index-zMKRaKMY.js → index-BiNX-Cge.js} +119 -156
- package/lib/{index-9ObpINp4.js → index-BsH_egEe.js} +15 -6
- package/lib/{index-CYn62h8x.js → index-BxQTUOME.js} +10 -12
- package/lib/index-C1PCuZgw.js +18 -0
- package/lib/{index-Db_ZDrEr.js → index-C3nz3TIx.js} +6 -8
- package/lib/{index-BGlk5VhF.js → index-CIXQeSHu.js} +1 -10
- package/lib/index-CIgHU72d.js +52 -0
- package/lib/index-DB8Djrsy.js +487 -0
- package/lib/index-DbfrGXPH.js +8 -0
- package/lib/{index-CJKFedQi.js → index-G4WmxXds.js} +4 -21
- package/lib/{index-7-KCQK-x.js → index-Hz7AAE0t.js} +1 -1
- package/lib/{index-3KUV6Vlt.js → index-KOMAv-TS.js} +6 -10
- package/lib/index-RBS1MqCQ.js +37 -0
- package/lib/react-CjImwkhV.js +44 -0
- package/lib/store/useEntityStore.d.ts +4 -2
- package/lib/store/useSetupStore.d.ts +2 -3
- package/lib/store.js +6 -3
- package/lib/theme.js +86 -3
- package/lib/types/common/index.d.ts +1 -0
- package/lib/types/destinations/index.d.ts +50 -3
- package/lib/types.js +6 -163
- package/lib/useDarkMode-DxhIuVNi.js +201 -0
- package/lib/useSelectedStore-93bIo1kE.js +97 -0
- package/lib/useSetupStore-CoYx1UQw.js +211 -0
- package/lib/{useTransition-CFmm4scp.js → useTimeAgo-weEj7br6.js} +544 -113
- package/lib/useTransition-D0wUpPGk.js +128 -0
- package/package.json +13 -12
- package/lib/components/auto-complete-input/auto-complete-input.stories.d.ts +0 -9
- package/lib/components/badge/badge.stories.d.ts +0 -13
- package/lib/components/button/button.stories.d.ts +0 -9
- package/lib/components/cancel-warning/cancel-warning.stories.d.ts +0 -9
- package/lib/components/checkbox/checkbox.stories.d.ts +0 -9
- package/lib/components/code/code.stories.d.ts +0 -9
- package/lib/components/condition-details/condition-details.stories.d.ts +0 -14
- package/lib/components/data-card/data-card.stories.d.ts +0 -10
- package/lib/components/data-tab/data-tab.stories.d.ts +0 -15
- package/lib/components/delete-warning/delete-warning.stories.d.ts +0 -9
- package/lib/components/describe-row/describe-row.stories.d.ts +0 -9
- package/lib/components/divider/divider.stories.d.ts +0 -9
- package/lib/components/docs-button/docs-button.stories.d.ts +0 -9
- package/lib/components/drawer/drawer.stories.d.ts +0 -10
- package/lib/components/dropdown/dropdown.stories.d.ts +0 -10
- package/lib/components/error-boundary/error-boundary.stories.d.ts +0 -9
- package/lib/components/extend-arrow/extend-arrow.stories.d.ts +0 -9
- package/lib/components/fade-loader/fade-loader.stories.d.ts +0 -9
- package/lib/components/field-error/field-error.stories.d.ts +0 -9
- package/lib/components/field-label/field-label.stories.d.ts +0 -9
- package/lib/components/header/header.stories.d.ts +0 -9
- package/lib/components/icon-button/icon-button.stories.d.ts +0 -9
- package/lib/components/icon-group/icon-group.stories.d.ts +0 -14
- package/lib/components/icon-title-badge/icon-title-badge.stories.d.ts +0 -9
- package/lib/components/icon-wrapped/icon-wrapped.stories.d.ts +0 -10
- package/lib/components/icons-nav/icons-nav.stories.d.ts +0 -9
- package/lib/components/image-controlled/image-controlled.stories.d.ts +0 -9
- package/lib/components/input/input.stories.d.ts +0 -9
- package/lib/components/input-list/input-list.stories.d.ts +0 -9
- package/lib/components/input-table/input-table.stories.d.ts +0 -9
- package/lib/components/interactive-table/interactive-table.stories.d.ts +0 -12
- package/lib/components/key-value-input-list/key-value-input-list.stories.d.ts +0 -9
- package/lib/components/modal/modal.stories.d.ts +0 -9
- package/lib/components/monitors-checkboxes/monitors-checkboxes.stories.d.ts +0 -9
- package/lib/components/monitors-icons/monitors-icons.stories.d.ts +0 -9
- package/lib/components/navigation-buttons/navigation-buttons.stories.d.ts +0 -9
- package/lib/components/no-data-found/no-data-found.stories.d.ts +0 -9
- package/lib/components/notification-note/notification-note.stories.d.ts +0 -10
- package/lib/components/section-title/section-title.stories.d.ts +0 -9
- package/lib/components/segment/segment.stories.d.ts +0 -9
- package/lib/components/skeleton-loader/skeleton-loader.stories.d.ts +0 -9
- package/lib/components/status/status.stories.d.ts +0 -9
- package/lib/components/stepper/stepper.stories.d.ts +0 -9
- package/lib/components/text/text.stories.d.ts +0 -9
- package/lib/components/textarea/textarea.stories.d.ts +0 -9
- package/lib/components/toggle/toggle.stories.d.ts +0 -9
- package/lib/components/tooltip/tooltip.stories.d.ts +0 -9
- package/lib/components/trace-loader/trace-loader.stories.d.ts +0 -9
- package/lib/components/warning-modal/warning-modal.stories.d.ts +0 -9
- package/lib/containers/action-drawer/action-drawer.stories.d.ts +0 -9
- package/lib/containers/action-form/action-form.stories.d.ts +0 -9
- package/lib/containers/action-modal/action-modal.stories.d.ts +0 -9
- package/lib/containers/action-table/action-table.stories.d.ts +0 -9
- package/lib/containers/await-pipeline/await-pipeline.stories.d.ts +0 -9
- package/lib/containers/compute-platform-select/compute-platform-select.stories.d.ts +0 -9
- package/lib/containers/compute-platforms/compute-platforms.stories.d.ts +0 -9
- package/lib/containers/compute-platforms-actions-menu/compute-platforms-actions-menu.stories.d.ts +0 -9
- package/lib/containers/data-flow/data-flow.stories.d.ts +0 -9
- package/lib/containers/data-flow-actions-menu/data-flow.stories.d.ts +0 -11
- package/lib/containers/destination-drawer/destination-drawer.stories.d.ts +0 -9
- package/lib/containers/destination-form/destination-form.stories.d.ts +0 -9
- package/lib/containers/destination-modal/destination-modal.stories.d.ts +0 -9
- package/lib/containers/destination-selection-form/destination-selection-form.stories.d.ts +0 -9
- package/lib/containers/destination-table/destination-table.stories.d.ts +0 -9
- package/lib/containers/dropdowns/connection-status-dropdown/connection-status-dropdown.stories.d.ts +0 -9
- package/lib/containers/dropdowns/connection-type-dropdown/connection-type-dropdown.stories.d.ts +0 -9
- package/lib/containers/dropdowns/error-dropdown/error-dropdown.stories.d.ts +0 -9
- package/lib/containers/dropdowns/kind-dropdown/error-dropdown.stories.d.ts +0 -9
- package/lib/containers/dropdowns/language-dropdown/language-dropdown.stories.d.ts +0 -9
- package/lib/containers/dropdowns/monitor-dropdown/monitor-dropdown.stories.d.ts +0 -9
- package/lib/containers/dropdowns/namespace-dropdown/namespace-dropdown.stories.d.ts +0 -9
- package/lib/containers/instrumentation-rule-drawer/instrumentation-rule-drawer.stories.d.ts +0 -9
- package/lib/containers/instrumentation-rule-form/instrumentation-rule-form.stories.d.ts +0 -9
- package/lib/containers/instrumentation-rule-modal/instrumentation-rule-modal.stories.d.ts +0 -9
- package/lib/containers/instrumentation-rule-table/instrumentation-rule-table.stories.d.ts +0 -9
- package/lib/containers/multi-source-control/multi-source-control.stories.d.ts +0 -9
- package/lib/containers/notification-manager/notification-manager.stories.d.ts +0 -9
- package/lib/containers/overview-drawer/overview-drawer.stories.d.ts +0 -9
- package/lib/containers/side-nav/side-nav.stories.d.ts +0 -9
- package/lib/containers/slack-invite/slack-invite.stories.d.ts +0 -9
- package/lib/containers/source-drawer/source-drawer.stories.d.ts +0 -9
- package/lib/containers/source-form/source-form.stories.d.ts +0 -9
- package/lib/containers/source-modal/source-modal.stories.d.ts +0 -9
- package/lib/containers/source-selection-form/fast/index.d.ts +0 -7
- package/lib/containers/source-selection-form/simple/controls/index.d.ts +0 -11
- package/lib/containers/source-selection-form/simple/index.d.ts +0 -7
- package/lib/containers/source-selection-form/simple/list/index.d.ts +0 -9
- package/lib/containers/source-selection-form/source-selection-form.stories.d.ts +0 -9
- package/lib/containers/source-table/source-table.stories.d.ts +0 -9
- package/lib/containers/system-overview/system-overview.stories.d.ts +0 -9
- package/lib/containers/table-cell-conditions/table-cell-conditions.stories.d.ts +0 -9
- package/lib/containers/toast-list/toast-list.stories.d.ts +0 -9
- package/lib/containers/toggle-dark-mode/toggle-dark-mode.stories.d.ts +0 -9
- package/lib/icons/actions/add-cluster-info-icon/add-cluster-info-icon.stories.d.ts +0 -8
- package/lib/icons/actions/delete-attribute-icon/delete-attribute-icon.stories.d.ts +0 -8
- package/lib/icons/actions/pii-masking-icon/pii-masking-icon.stories.d.ts +0 -8
- package/lib/icons/actions/rename-attribute-icon/rename-attribute-icon.stories.d.ts +0 -8
- package/lib/icons/actions/sampler-icon/sampler-icon.stories.d.ts +0 -8
- package/lib/icons/brand/odigos-logo/odigos-logo.stories.d.ts +0 -8
- package/lib/icons/brand/odigos-logo-text/odigos-logo-text.stories.d.ts +0 -8
- package/lib/icons/common/arrow-icon/arrow-icon.stories.d.ts +0 -8
- package/lib/icons/common/code-brackets-icon/code-brackets-icon.stories.d.ts +0 -8
- package/lib/icons/common/code-icon/code-icon.stories.d.ts +0 -8
- package/lib/icons/common/command-icon/command-icon.stories.d.ts +0 -8
- package/lib/icons/common/copy-icon/copy-icon.stories.d.ts +0 -8
- package/lib/icons/common/edit-icon/edit-icon.stories.d.ts +0 -8
- package/lib/icons/common/extend-arrow-icon/extend-arrow-icon.stories.d.ts +0 -8
- package/lib/icons/common/filter-icon/filter-icon.stories.d.ts +0 -8
- package/lib/icons/common/folder-icon/folder-icon.stories.d.ts +0 -8
- package/lib/icons/common/image-error-icon/image-error-icon.stories.d.ts +0 -8
- package/lib/icons/common/key-icon/key-icon.stories.d.ts +0 -8
- package/lib/icons/common/list-icon/list-icon.stories.d.ts +0 -8
- package/lib/icons/common/no-data-icon/no-data-icon.stories.d.ts +0 -8
- package/lib/icons/common/notebook-icon/notebook-icon.stories.d.ts +0 -8
- package/lib/icons/common/notification-icon/notification-icon.stories.d.ts +0 -8
- package/lib/icons/common/search-icon/search-icon.stories.d.ts +0 -8
- package/lib/icons/common/sort-arrows-icon/sort-arrows-icon.stories.d.ts +0 -8
- package/lib/icons/common/terminal-icon/terminal-icon.stories.d.ts +0 -8
- package/lib/icons/common/trash-icon/trash-icon.stories.d.ts +0 -8
- package/lib/icons/common/x-icon/x-icon.stories.d.ts +0 -8
- package/lib/icons/compute-platform/k8s-logo/k8s-logo.stories.d.ts +0 -8
- package/lib/icons/compute-platform/vm-logo/vm-logo.stories.d.ts +0 -8
- package/lib/icons/instrumentation-rules/code-attributes-icon/code-attributes-icon.stories.d.ts +0 -8
- package/lib/icons/instrumentation-rules/payload-collection-icon/payload-collection-icon.stories.d.ts +0 -8
- package/lib/icons/math/minus-icon/minus-icon.stories.d.ts +0 -8
- package/lib/icons/math/plus-icon/plus-icon.stories.d.ts +0 -8
- package/lib/icons/monitors/logs-icon/logs-icon.stories.d.ts +0 -8
- package/lib/icons/monitors/metrics-icon/metrics-icon.stories.d.ts +0 -8
- package/lib/icons/monitors/traces-icon/traces-icon.stories.d.ts +0 -8
- package/lib/icons/on-off/eye-closed-icon/eye-closed-icon.stories.d.ts +0 -8
- package/lib/icons/on-off/eye-open-icon/eye-open-icon.stories.d.ts +0 -8
- package/lib/icons/on-off/light-off-icon/light-off-icon.stories.d.ts +0 -8
- package/lib/icons/on-off/light-on-icon/light-on-icon.stories.d.ts +0 -8
- package/lib/icons/on-off/moon-icon/moon-icon.stories.d.ts +0 -8
- package/lib/icons/on-off/sun-icon/sun-icon.stories.d.ts +0 -8
- package/lib/icons/overview/actions-icon/actions-icon.stories.d.ts +0 -8
- package/lib/icons/overview/connections-icon/connections-icon.stories.d.ts +0 -8
- package/lib/icons/overview/destinations-icon/destinations-icon.stories.d.ts +0 -8
- package/lib/icons/overview/overview-icon/overview-icon.stories.d.ts +0 -8
- package/lib/icons/overview/rules-icon/rules-icon.stories.d.ts +0 -8
- package/lib/icons/overview/service-map-icon/service-map-icon.stories.d.ts +0 -8
- package/lib/icons/overview/sources-icon/sources-icon.stories.d.ts +0 -8
- package/lib/icons/overview/trace-view-icon/trace-view-icon.stories.d.ts +0 -8
- package/lib/icons/programming-languages/c-plus-plus-logo/c-plus-plus-logo.stories.d.ts +0 -8
- package/lib/icons/programming-languages/c-sharp-logo/c-sharp-logo.stories.d.ts +0 -8
- package/lib/icons/programming-languages/dotnet-logo/dotnet-logo.stories.d.ts +0 -8
- package/lib/icons/programming-languages/elixir-logo/elixir-logo.stories.d.ts +0 -8
- package/lib/icons/programming-languages/go-logo/go-logo.stories.d.ts +0 -8
- package/lib/icons/programming-languages/java-logo/java-logo.stories.d.ts +0 -8
- package/lib/icons/programming-languages/kafka-logo/kafka-logo.stories.d.ts +0 -8
- package/lib/icons/programming-languages/mysql-logo/mysql-logo.stories.d.ts +0 -8
- package/lib/icons/programming-languages/nginx-logo/nginx-logo.stories.d.ts +0 -8
- package/lib/icons/programming-languages/nodejs-logo/nodejs-logo.stories.d.ts +0 -8
- package/lib/icons/programming-languages/php-logo/php-logo.stories.d.ts +0 -8
- package/lib/icons/programming-languages/postgres-logo/postgres-logo.stories.d.ts +0 -8
- package/lib/icons/programming-languages/python-logo/python-logo.stories.d.ts +0 -8
- package/lib/icons/programming-languages/redis-logo/redis-logo.stories.d.ts +0 -8
- package/lib/icons/programming-languages/ruby-logo/ruby-logo.stories.d.ts +0 -8
- package/lib/icons/programming-languages/rust-logo/rust-logo.stories.d.ts +0 -8
- package/lib/icons/programming-languages/swift-logo/swift-logo.stories.d.ts +0 -8
- package/lib/icons/social/slack-logo/slack-logo.stories.d.ts +0 -8
- package/lib/icons/status/check-circled-icon/check-circled-icon.stories.d.ts +0 -8
- package/lib/icons/status/check-icon/check-icon.stories.d.ts +0 -8
- package/lib/icons/status/cross-circled-icon/cross-circled-icon.stories.d.ts +0 -8
- package/lib/icons/status/cross-icon/cross-icon.stories.d.ts +0 -8
- package/lib/icons/status/error-round-icon/error-round-icon.stories.d.ts +0 -8
- package/lib/icons/status/error-triangle-icon/error-triangle-icon.stories.d.ts +0 -8
- package/lib/icons/status/info-icon/info-icon.stories.d.ts +0 -8
- package/lib/icons/status/warning-triangle-icon/warning-triangle-icon.stories.d.ts +0 -8
- package/lib/index-BjJpYtF1.js +0 -42
- package/lib/index-DYEcdkUF.js +0 -671
- package/lib/useSourceSelectionFormData-BnlRp8m3.js +0 -561
- /package/lib/containers/source-selection-form/{fast/controls → controls}/index.d.ts +0 -0
- /package/lib/icons/{programming-languages → destinations}/kafka-logo/index.d.ts +0 -0
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import './index-
|
|
3
|
-
import {
|
|
4
|
-
import { CodeAttributesKeyTypes, PayloadCollectionKeyTypes } from './
|
|
5
|
-
import
|
|
1
|
+
import { c as useNotificationStore, b as useModalStore, u as useDrawerStore, a as useEntityStore, d as useSetupStore } from './useSetupStore-CoYx1UQw.js';
|
|
2
|
+
import { i as isEmpty, s as safeJsonParse } from './index-BZS1ijMm.js';
|
|
3
|
+
import { F as FORM_ALERTS } from './index-C_0J5P9M.js';
|
|
4
|
+
import { A as ActionType, C as CodeAttributesKeyTypes, P as PayloadCollectionKeyTypes } from './index-RBS1MqCQ.js';
|
|
5
|
+
import { S as StatusType, E as EntityTypes, F as FieldTypes } from './index-BVVVevuY.js';
|
|
6
|
+
import { A as AddNodeTypes } from './index-B72aw6tI.js';
|
|
7
|
+
import { g as getIdFromSseTarget } from './index-Hz7AAE0t.js';
|
|
8
|
+
import { useState, useEffect, useCallback } from 'react';
|
|
6
9
|
|
|
7
10
|
const useGenericForm = (initialFormData) => {
|
|
8
11
|
function copyInitial() {
|
|
@@ -61,69 +64,341 @@ const useGenericForm = (initialFormData) => {
|
|
|
61
64
|
};
|
|
62
65
|
};
|
|
63
66
|
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
67
|
+
const INITIAL$3 = {
|
|
68
|
+
// @ts-ignore (TS complains about empty string because we expect an "ActionsType", but it's fine)
|
|
69
|
+
type: '',
|
|
70
|
+
name: '',
|
|
71
|
+
notes: '',
|
|
72
|
+
signals: [],
|
|
73
|
+
disabled: false,
|
|
74
|
+
clusterAttributes: null,
|
|
75
|
+
renames: null,
|
|
76
|
+
attributeNamesToDelete: null,
|
|
77
|
+
piiCategories: null,
|
|
78
|
+
fallbackSamplingRatio: null,
|
|
79
|
+
samplingPercentage: null,
|
|
80
|
+
endpointsFilters: null,
|
|
81
|
+
};
|
|
82
|
+
const useActionFormData = () => {
|
|
83
|
+
const { addNotification } = useNotificationStore();
|
|
84
|
+
const { formData, formErrors, handleFormChange, handleErrorChange, resetFormData } = useGenericForm(INITIAL$3);
|
|
85
|
+
const validateForm = (params) => {
|
|
86
|
+
const errors = {};
|
|
87
|
+
let ok = true;
|
|
88
|
+
Object.entries(formData).forEach(([k, v]) => {
|
|
89
|
+
switch (k) {
|
|
90
|
+
case 'type':
|
|
91
|
+
case 'signals':
|
|
92
|
+
if (isEmpty(v))
|
|
93
|
+
errors[k] = FORM_ALERTS.FIELD_IS_REQUIRED;
|
|
94
|
+
break;
|
|
95
|
+
case 'clusterAttributes':
|
|
96
|
+
if (formData.type === ActionType.AddClusterInfo && isEmpty(v))
|
|
97
|
+
errors[k] = FORM_ALERTS.FIELD_IS_REQUIRED;
|
|
98
|
+
break;
|
|
99
|
+
case 'renames':
|
|
100
|
+
if (formData.type === ActionType.RenameAttributes && isEmpty(v))
|
|
101
|
+
errors[k] = FORM_ALERTS.FIELD_IS_REQUIRED;
|
|
102
|
+
break;
|
|
103
|
+
case 'attributeNamesToDelete':
|
|
104
|
+
if (formData.type === ActionType.DeleteAttributes && isEmpty(v))
|
|
105
|
+
errors[k] = FORM_ALERTS.FIELD_IS_REQUIRED;
|
|
106
|
+
break;
|
|
107
|
+
case 'piiCategories':
|
|
108
|
+
if (formData.type === ActionType.PiiMasking && isEmpty(v))
|
|
109
|
+
errors[k] = FORM_ALERTS.FIELD_IS_REQUIRED;
|
|
110
|
+
break;
|
|
111
|
+
case 'fallbackSamplingRatio':
|
|
112
|
+
if (formData.type === ActionType.ErrorSampler && isEmpty(v))
|
|
113
|
+
errors[k] = FORM_ALERTS.FIELD_IS_REQUIRED;
|
|
114
|
+
break;
|
|
115
|
+
case 'samplingPercentage':
|
|
116
|
+
if (formData.type === ActionType.ProbabilisticSampler && isEmpty(v))
|
|
117
|
+
errors[k] = FORM_ALERTS.FIELD_IS_REQUIRED;
|
|
118
|
+
break;
|
|
119
|
+
case 'endpointsFilters':
|
|
120
|
+
if (formData.type === ActionType.LatencySampler) {
|
|
121
|
+
if (isEmpty(v))
|
|
122
|
+
errors[k] = FORM_ALERTS.FIELD_IS_REQUIRED;
|
|
123
|
+
v?.forEach((endpoint) => {
|
|
124
|
+
if (endpoint.httpRoute.charAt(0) !== '/')
|
|
125
|
+
errors[k] = FORM_ALERTS.LATENCY_HTTP_ROUTE;
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
break;
|
|
74
129
|
}
|
|
130
|
+
});
|
|
131
|
+
ok = !Object.values(errors).length;
|
|
132
|
+
if (!ok && params?.withAlert) {
|
|
133
|
+
addNotification({
|
|
134
|
+
type: StatusType.Warning,
|
|
135
|
+
title: params.alertTitle,
|
|
136
|
+
message: FORM_ALERTS.REQUIRED_FIELDS,
|
|
137
|
+
hideFromHistory: true,
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
handleErrorChange(undefined, undefined, errors);
|
|
141
|
+
return ok;
|
|
142
|
+
};
|
|
143
|
+
const loadFormWithDrawerItem = ({ type, spec }) => {
|
|
144
|
+
const updatedData = {
|
|
145
|
+
...INITIAL$3,
|
|
146
|
+
type,
|
|
75
147
|
};
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
148
|
+
Object.entries(spec).forEach(([k, v]) => {
|
|
149
|
+
if (!!v) {
|
|
150
|
+
switch (k) {
|
|
151
|
+
case 'actionName': {
|
|
152
|
+
updatedData['name'] = v;
|
|
153
|
+
break;
|
|
154
|
+
}
|
|
155
|
+
case 'type':
|
|
156
|
+
case 'notes':
|
|
157
|
+
case 'signals':
|
|
158
|
+
case 'disabled':
|
|
159
|
+
case 'collectContainerAttributes':
|
|
160
|
+
case 'collectWorkloadId':
|
|
161
|
+
case 'collectClusterId':
|
|
162
|
+
case 'labelsAttributes':
|
|
163
|
+
case 'annotationsAttributes':
|
|
164
|
+
case 'clusterAttributes':
|
|
165
|
+
case 'attributeNamesToDelete':
|
|
166
|
+
case 'renames':
|
|
167
|
+
case 'piiCategories':
|
|
168
|
+
case 'fallbackSamplingRatio':
|
|
169
|
+
case 'samplingPercentage':
|
|
170
|
+
case 'endpointsFilters': {
|
|
171
|
+
// @ts-ignore
|
|
172
|
+
updatedData[k] = v;
|
|
173
|
+
break;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
handleFormChange(undefined, undefined, updatedData);
|
|
179
|
+
};
|
|
80
180
|
return {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
181
|
+
formData,
|
|
182
|
+
formErrors,
|
|
183
|
+
handleFormChange,
|
|
184
|
+
resetFormData,
|
|
185
|
+
validateForm,
|
|
186
|
+
loadFormWithDrawerItem,
|
|
84
187
|
};
|
|
85
188
|
};
|
|
86
189
|
|
|
87
|
-
const
|
|
88
|
-
const
|
|
89
|
-
const
|
|
90
|
-
const
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
190
|
+
const useClickNode = () => {
|
|
191
|
+
const { setCurrentModal } = useModalStore();
|
|
192
|
+
const { setDrawerType, setDrawerEntityId } = useDrawerStore();
|
|
193
|
+
const onClickNode = (_, object) => {
|
|
194
|
+
const { data: { id, type }, } = object;
|
|
195
|
+
switch (type) {
|
|
196
|
+
case EntityTypes.Source:
|
|
197
|
+
case EntityTypes.Destination:
|
|
198
|
+
case EntityTypes.Action:
|
|
199
|
+
case EntityTypes.InstrumentationRule:
|
|
200
|
+
setDrawerType(type);
|
|
201
|
+
setDrawerEntityId(id);
|
|
202
|
+
break;
|
|
203
|
+
case AddNodeTypes.AddSource:
|
|
204
|
+
setCurrentModal(EntityTypes.Source);
|
|
205
|
+
break;
|
|
206
|
+
case AddNodeTypes.AddDestination:
|
|
207
|
+
setCurrentModal(EntityTypes.Destination);
|
|
208
|
+
break;
|
|
209
|
+
case AddNodeTypes.AddAction:
|
|
210
|
+
setCurrentModal(EntityTypes.Action);
|
|
211
|
+
break;
|
|
212
|
+
case AddNodeTypes.AddRule:
|
|
213
|
+
setCurrentModal(EntityTypes.InstrumentationRule);
|
|
214
|
+
break;
|
|
215
|
+
default:
|
|
216
|
+
console.warn('Unhandled node click', object);
|
|
217
|
+
break;
|
|
218
|
+
}
|
|
219
|
+
};
|
|
220
|
+
return { onClickNode };
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
const useClickNotification = () => {
|
|
224
|
+
const { setDrawerType, setDrawerEntityId } = useDrawerStore();
|
|
225
|
+
const { markAsDismissed, markAsSeen } = useNotificationStore();
|
|
226
|
+
const onClickNotification = (notif, options) => {
|
|
227
|
+
const { id, crdType, target } = notif;
|
|
228
|
+
const { dismissToast } = options || {};
|
|
229
|
+
if (crdType && target) {
|
|
230
|
+
switch (crdType) {
|
|
231
|
+
case EntityTypes.InstrumentationRule:
|
|
232
|
+
setDrawerType(EntityTypes.InstrumentationRule);
|
|
233
|
+
setDrawerEntityId(getIdFromSseTarget(target, EntityTypes.InstrumentationRule));
|
|
234
|
+
break;
|
|
235
|
+
case EntityTypes.Source:
|
|
236
|
+
case 'InstrumentationConfig':
|
|
237
|
+
case 'InstrumentationInstance':
|
|
238
|
+
setDrawerType(EntityTypes.Source);
|
|
239
|
+
setDrawerEntityId(getIdFromSseTarget(target, EntityTypes.Source));
|
|
240
|
+
break;
|
|
241
|
+
case EntityTypes.Action:
|
|
242
|
+
setDrawerType(EntityTypes.Action);
|
|
243
|
+
setDrawerEntityId(getIdFromSseTarget(target, EntityTypes.Action));
|
|
244
|
+
break;
|
|
245
|
+
case EntityTypes.Destination:
|
|
246
|
+
case 'Destination':
|
|
247
|
+
setDrawerType(EntityTypes.Destination);
|
|
248
|
+
setDrawerEntityId(getIdFromSseTarget(target, EntityTypes.Destination));
|
|
249
|
+
break;
|
|
250
|
+
default:
|
|
251
|
+
console.warn('notif click not handled for:', { crdType, target });
|
|
252
|
+
break;
|
|
102
253
|
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
254
|
+
}
|
|
255
|
+
markAsSeen(id);
|
|
256
|
+
if (dismissToast)
|
|
257
|
+
markAsDismissed(id);
|
|
258
|
+
};
|
|
259
|
+
return { onClickNotification };
|
|
260
|
+
};
|
|
261
|
+
|
|
262
|
+
const INITIAL$2 = {
|
|
263
|
+
// @ts-ignore form should be initialized with empty values
|
|
264
|
+
type: '',
|
|
265
|
+
name: '',
|
|
266
|
+
exportedSignals: {
|
|
267
|
+
logs: false,
|
|
268
|
+
metrics: false,
|
|
269
|
+
traces: false,
|
|
270
|
+
},
|
|
271
|
+
fields: [],
|
|
272
|
+
};
|
|
273
|
+
const buildFormDynamicFields = (fields) => {
|
|
274
|
+
return fields
|
|
275
|
+
.filter((f) => !!f)
|
|
276
|
+
.map((f) => {
|
|
277
|
+
const { name, componentType, componentProperties, displayName, initialValue, renderCondition } = f;
|
|
278
|
+
switch (componentType) {
|
|
279
|
+
case FieldTypes.Dropdown: {
|
|
280
|
+
const componentPropertiesJson = safeJsonParse(componentProperties, {});
|
|
281
|
+
const options = Array.isArray(componentPropertiesJson.values)
|
|
282
|
+
? componentPropertiesJson.values.map((value) => ({
|
|
283
|
+
id: value,
|
|
284
|
+
value,
|
|
285
|
+
}))
|
|
286
|
+
: Object.entries(componentPropertiesJson.values).map(([key, value]) => ({
|
|
287
|
+
id: key,
|
|
288
|
+
value,
|
|
289
|
+
}));
|
|
290
|
+
return {
|
|
291
|
+
name,
|
|
292
|
+
componentType: componentType,
|
|
293
|
+
title: displayName,
|
|
294
|
+
value: initialValue,
|
|
295
|
+
placeholder: componentPropertiesJson.placeholder || 'Select an option',
|
|
296
|
+
options,
|
|
297
|
+
renderCondition,
|
|
298
|
+
...componentPropertiesJson,
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
default: {
|
|
302
|
+
const componentPropertiesJson = safeJsonParse(componentProperties, {});
|
|
303
|
+
return {
|
|
304
|
+
name,
|
|
305
|
+
componentType,
|
|
306
|
+
title: displayName,
|
|
307
|
+
value: initialValue,
|
|
308
|
+
renderCondition,
|
|
309
|
+
...componentPropertiesJson,
|
|
310
|
+
};
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
});
|
|
314
|
+
};
|
|
315
|
+
const useDestinationFormData = (params) => {
|
|
316
|
+
const { supportedSignals, preLoadedFields } = params || {};
|
|
317
|
+
const { addNotification } = useNotificationStore();
|
|
318
|
+
const { formData, formErrors, handleFormChange, handleErrorChange, resetFormData } = useGenericForm(INITIAL$2);
|
|
319
|
+
const [yamlFields, setYamlFields] = useState([]);
|
|
320
|
+
const [dynamicFields, setDynamicFields] = useState([]);
|
|
321
|
+
useEffect(() => {
|
|
322
|
+
if (yamlFields) {
|
|
323
|
+
setDynamicFields(buildFormDynamicFields(yamlFields).map((field) => {
|
|
324
|
+
// if we have preloaded fields, we need to set the value of the field
|
|
325
|
+
// (this can be from an odigos-detected-destination during create, or from an existing destination during edit/update)
|
|
326
|
+
if (!!preLoadedFields) {
|
|
327
|
+
const parsedFields = typeof preLoadedFields === 'string' ? safeJsonParse(preLoadedFields, {}) : preLoadedFields;
|
|
328
|
+
if (field.name in parsedFields) {
|
|
329
|
+
return {
|
|
330
|
+
...field,
|
|
331
|
+
// @ts-ignore
|
|
332
|
+
value: parsedFields[field.name],
|
|
333
|
+
};
|
|
334
|
+
}
|
|
114
335
|
}
|
|
115
|
-
|
|
336
|
+
return field;
|
|
337
|
+
}));
|
|
338
|
+
}
|
|
339
|
+
else {
|
|
340
|
+
setDynamicFields([]);
|
|
341
|
+
}
|
|
342
|
+
}, [yamlFields, preLoadedFields]);
|
|
343
|
+
useEffect(() => {
|
|
344
|
+
handleFormChange('fields', dynamicFields.map((field) => ({
|
|
345
|
+
key: field.name,
|
|
346
|
+
value: field.value,
|
|
347
|
+
})));
|
|
348
|
+
}, [dynamicFields]);
|
|
349
|
+
useEffect(() => {
|
|
350
|
+
const { logs, metrics, traces } = supportedSignals || {};
|
|
351
|
+
handleFormChange('exportedSignals', {
|
|
352
|
+
logs: logs?.supported || false,
|
|
353
|
+
metrics: metrics?.supported || false,
|
|
354
|
+
traces: traces?.supported || false,
|
|
355
|
+
});
|
|
356
|
+
}, [supportedSignals]);
|
|
357
|
+
const validateForm = (params) => {
|
|
358
|
+
const errors = {};
|
|
359
|
+
let ok = true;
|
|
360
|
+
dynamicFields.forEach(({ name, value, required }) => {
|
|
361
|
+
if (required && !value) {
|
|
362
|
+
ok = false;
|
|
363
|
+
errors[name] = FORM_ALERTS.FIELD_IS_REQUIRED;
|
|
116
364
|
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
365
|
+
});
|
|
366
|
+
if (!ok && params?.withAlert) {
|
|
367
|
+
addNotification({
|
|
368
|
+
type: StatusType.Warning,
|
|
369
|
+
title: params.alertTitle,
|
|
370
|
+
message: FORM_ALERTS.REQUIRED_FIELDS,
|
|
371
|
+
hideFromHistory: true,
|
|
372
|
+
});
|
|
121
373
|
}
|
|
374
|
+
handleErrorChange(undefined, undefined, errors);
|
|
375
|
+
return ok;
|
|
376
|
+
};
|
|
377
|
+
const loadFormWithDrawerItem = ({ destinationType: { type }, name, exportedSignals, fields }) => {
|
|
378
|
+
const updatedData = {
|
|
379
|
+
...INITIAL$2,
|
|
380
|
+
type,
|
|
381
|
+
name,
|
|
382
|
+
exportedSignals,
|
|
383
|
+
fields: Object.entries(safeJsonParse(fields, {})).map(([key, value]) => ({ key, value })),
|
|
384
|
+
};
|
|
385
|
+
handleFormChange(undefined, undefined, updatedData);
|
|
386
|
+
};
|
|
387
|
+
return {
|
|
388
|
+
formData,
|
|
389
|
+
formErrors,
|
|
390
|
+
handleFormChange,
|
|
391
|
+
resetFormData,
|
|
392
|
+
validateForm,
|
|
393
|
+
loadFormWithDrawerItem,
|
|
394
|
+
yamlFields,
|
|
395
|
+
setYamlFields,
|
|
396
|
+
dynamicFields,
|
|
397
|
+
setDynamicFields,
|
|
122
398
|
};
|
|
123
|
-
return { isCopied, copiedIndex, clickCopy };
|
|
124
399
|
};
|
|
125
400
|
|
|
126
|
-
const INITIAL = {
|
|
401
|
+
const INITIAL$1 = {
|
|
127
402
|
ruleName: '',
|
|
128
403
|
notes: '',
|
|
129
404
|
disabled: false,
|
|
@@ -146,7 +421,7 @@ const INITIAL = {
|
|
|
146
421
|
};
|
|
147
422
|
const useInstrumentationRuleFormData = () => {
|
|
148
423
|
const { addNotification } = useNotificationStore();
|
|
149
|
-
const { formData, formErrors, handleFormChange, handleErrorChange, resetFormData } = useGenericForm(INITIAL);
|
|
424
|
+
const { formData, formErrors, handleFormChange, handleErrorChange, resetFormData } = useGenericForm(INITIAL$1);
|
|
150
425
|
const validateForm = (params) => {
|
|
151
426
|
const errors = {};
|
|
152
427
|
let ok = true;
|
|
@@ -155,7 +430,7 @@ const useInstrumentationRuleFormData = () => {
|
|
|
155
430
|
};
|
|
156
431
|
const loadFormWithDrawerItem = ({ ruleName, notes, disabled, payloadCollection, codeAttributes }) => {
|
|
157
432
|
const updatedData = {
|
|
158
|
-
...INITIAL,
|
|
433
|
+
...INITIAL$1,
|
|
159
434
|
ruleName,
|
|
160
435
|
notes,
|
|
161
436
|
disabled,
|
|
@@ -190,44 +465,222 @@ const useInstrumentationRuleFormData = () => {
|
|
|
190
465
|
};
|
|
191
466
|
};
|
|
192
467
|
|
|
193
|
-
const
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
window.removeEventListener('keydown', handleKeyDown);
|
|
468
|
+
const INITIAL = {
|
|
469
|
+
otelServiceName: '',
|
|
470
|
+
};
|
|
471
|
+
const useSourceFormData = () => {
|
|
472
|
+
const { addNotification } = useNotificationStore();
|
|
473
|
+
const { formData, formErrors, handleFormChange, handleErrorChange, resetFormData } = useGenericForm(INITIAL);
|
|
474
|
+
const validateForm = (params) => {
|
|
475
|
+
const errors = {};
|
|
476
|
+
let ok = true;
|
|
477
|
+
handleErrorChange(undefined, undefined, errors);
|
|
478
|
+
return ok;
|
|
479
|
+
};
|
|
480
|
+
const loadFormWithDrawerItem = ({ otelServiceName, name }) => {
|
|
481
|
+
const updatedData = {
|
|
482
|
+
...INITIAL,
|
|
483
|
+
otelServiceName: otelServiceName || name || '',
|
|
210
484
|
};
|
|
211
|
-
|
|
212
|
-
|
|
485
|
+
handleFormChange(undefined, undefined, updatedData);
|
|
486
|
+
};
|
|
487
|
+
return {
|
|
488
|
+
formData,
|
|
489
|
+
formErrors,
|
|
490
|
+
handleFormChange,
|
|
491
|
+
resetFormData,
|
|
492
|
+
validateForm,
|
|
493
|
+
loadFormWithDrawerItem,
|
|
494
|
+
};
|
|
213
495
|
};
|
|
214
496
|
|
|
215
|
-
const
|
|
497
|
+
const useSourceSelectionFormData = (params) => {
|
|
498
|
+
const { namespaces } = useEntityStore();
|
|
499
|
+
const { selectedNamespace, onSelectNamespace, namespace } = params || {};
|
|
500
|
+
// only for "onboarding" - get unsaved values and set to state
|
|
501
|
+
// (this is to persist the values when user navigates back to this page)
|
|
502
|
+
const { configuredSources, configuredFutureApps, availableSources } = useSetupStore();
|
|
503
|
+
// 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".
|
|
504
|
+
const [recordedInitialSources, setRecordedInitialSources] = useState(availableSources);
|
|
505
|
+
const [selectAllForNamespace, setSelectAllForNamespace] = useState('');
|
|
506
|
+
const [selectedSources, setSelectedSources] = useState(configuredSources);
|
|
507
|
+
const [selectedFutureApps, setSelectedFutureApps] = useState(configuredFutureApps);
|
|
508
|
+
useEffect(() => {
|
|
509
|
+
if (!!namespaces?.length) {
|
|
510
|
+
// initialize all states (to avoid undefined errors)
|
|
511
|
+
setRecordedInitialSources((prev) => {
|
|
512
|
+
const payload = { ...prev };
|
|
513
|
+
namespaces.forEach(({ name }) => (payload[name] = payload[name] || []));
|
|
514
|
+
return payload;
|
|
515
|
+
});
|
|
516
|
+
setSelectedSources((prev) => {
|
|
517
|
+
const payload = { ...prev };
|
|
518
|
+
namespaces.forEach(({ name }) => (payload[name] = payload[name] || []));
|
|
519
|
+
return payload;
|
|
520
|
+
});
|
|
521
|
+
setSelectedFutureApps((prev) => {
|
|
522
|
+
const payload = { ...prev };
|
|
523
|
+
namespaces.forEach(({ name, selected }) => (payload[name] = payload[name] || selected || false));
|
|
524
|
+
return payload;
|
|
525
|
+
});
|
|
526
|
+
}
|
|
527
|
+
}, [namespaces]);
|
|
216
528
|
useEffect(() => {
|
|
217
|
-
|
|
218
|
-
//
|
|
219
|
-
|
|
220
|
-
|
|
529
|
+
if (!!namespace) {
|
|
530
|
+
// initialize sources for this namespace
|
|
531
|
+
const { name, sources = [] } = namespace;
|
|
532
|
+
setRecordedInitialSources((prev) => ({
|
|
533
|
+
...prev,
|
|
534
|
+
[name]: sources.map(({ name, kind, selected, numberOfInstances }) => ({
|
|
535
|
+
name,
|
|
536
|
+
kind,
|
|
537
|
+
selected,
|
|
538
|
+
numberOfInstances,
|
|
539
|
+
})),
|
|
540
|
+
}));
|
|
541
|
+
setSelectedSources((prev) => ({
|
|
542
|
+
...prev,
|
|
543
|
+
[name]: !!prev[name].length
|
|
544
|
+
? prev[name]
|
|
545
|
+
: sources.map(({ name, kind, selected, numberOfInstances }) => ({
|
|
546
|
+
name,
|
|
547
|
+
kind,
|
|
548
|
+
selected,
|
|
549
|
+
numberOfInstances,
|
|
550
|
+
})),
|
|
551
|
+
}));
|
|
552
|
+
}
|
|
553
|
+
}, [namespace]);
|
|
554
|
+
// form filters
|
|
555
|
+
const [searchText, setSearchText] = useState('');
|
|
556
|
+
const [showSelectedOnly, setShowSelectedOnly] = useState(false);
|
|
557
|
+
const onSelectAll = useCallback((selected, ns, selectionsByNamespace) => {
|
|
558
|
+
// When clicking "select all" on a single namespace
|
|
559
|
+
if (!!ns) {
|
|
560
|
+
if (!selectionsByNamespace) {
|
|
561
|
+
// If the sources are not loaded yet, call the onSelectNamespace to load the sources
|
|
562
|
+
onSelectNamespace?.(selected ? ns : '');
|
|
563
|
+
// Set the state, so the interval would be able to use the namespace
|
|
564
|
+
setSelectAllForNamespace(selected ? ns : '');
|
|
221
565
|
}
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
566
|
+
else if (!!selectionsByNamespace?.[ns]?.length) {
|
|
567
|
+
// Clear the state, so the interval would stop
|
|
568
|
+
setSelectAllForNamespace('');
|
|
569
|
+
}
|
|
570
|
+
// Set the selected sources
|
|
571
|
+
setSelectedSources((prev) => ({
|
|
572
|
+
...prev,
|
|
573
|
+
[ns]: selectionsByNamespace?.[ns]?.map((source) => ({
|
|
574
|
+
...source,
|
|
575
|
+
selected,
|
|
576
|
+
})) || [],
|
|
577
|
+
}));
|
|
578
|
+
// setSelectedFutureApps((prev) => ({
|
|
579
|
+
// ...prev,
|
|
580
|
+
// [ns]: !!selectionsByNamespace?.[ns]?.length ? selected : false,
|
|
581
|
+
// }))
|
|
582
|
+
}
|
|
583
|
+
// When clicking "select all" on all namespaces
|
|
584
|
+
else {
|
|
585
|
+
setSelectedSources((prev) => {
|
|
586
|
+
const payload = { ...prev };
|
|
587
|
+
Object.entries(payload).forEach(([key, sources]) => {
|
|
588
|
+
payload[key] = sources.map((source) => ({ ...source, selected }));
|
|
589
|
+
});
|
|
590
|
+
return payload;
|
|
591
|
+
});
|
|
592
|
+
}
|
|
593
|
+
}, [selectedSources]);
|
|
594
|
+
// This is to keep trying "select all" per namespace, until the sources are loaded (allows for 1-click, better UX).
|
|
595
|
+
useEffect(() => {
|
|
596
|
+
if (!!selectAllForNamespace) {
|
|
597
|
+
const interval = setInterval(() => onSelectAll(true, selectAllForNamespace, selectedSources), 100);
|
|
598
|
+
return () => clearInterval(interval);
|
|
599
|
+
}
|
|
600
|
+
}, [selectAllForNamespace, onSelectAll]);
|
|
601
|
+
const onSelectSource = (source, namespace) => {
|
|
602
|
+
const id = namespace || selectedNamespace;
|
|
603
|
+
if (!id)
|
|
604
|
+
return;
|
|
605
|
+
const arr = [...(selectedSources[id] || [])];
|
|
606
|
+
const foundIdx = arr.findIndex(({ name, kind }) => name === source.name && kind === source.kind);
|
|
607
|
+
if (foundIdx !== -1) {
|
|
608
|
+
// Replace the item with a new object to avoid mutating a possibly read-only object
|
|
609
|
+
const updatedItem = { ...arr[foundIdx], selected: !arr[foundIdx].selected };
|
|
610
|
+
arr[foundIdx] = updatedItem;
|
|
611
|
+
}
|
|
612
|
+
else {
|
|
613
|
+
arr.push({ ...source, selected: true });
|
|
614
|
+
}
|
|
615
|
+
setSelectedSources((prev) => ({ ...prev, [id]: arr }));
|
|
616
|
+
};
|
|
617
|
+
const onSelectFutureApps = (bool, namespace) => {
|
|
618
|
+
const id = namespace || selectedNamespace;
|
|
619
|
+
if (!id)
|
|
620
|
+
return;
|
|
621
|
+
setSelectedFutureApps((prev) => ({ ...prev, [id]: bool }));
|
|
622
|
+
};
|
|
623
|
+
const filterNamespaces = (options) => {
|
|
624
|
+
const { cancelSearch } = options || {};
|
|
625
|
+
const namespaces = Object.entries(selectedSources);
|
|
626
|
+
const isSearchOk = (targetText) => cancelSearch || !searchText || targetText.toLowerCase().includes(searchText);
|
|
627
|
+
return namespaces.filter(([namespace]) => isSearchOk(namespace));
|
|
628
|
+
};
|
|
629
|
+
const filterSources = (namespace, options) => {
|
|
630
|
+
const { cancelSearch, cancelSelected } = options || {};
|
|
631
|
+
const id = namespace || selectedNamespace;
|
|
632
|
+
if (!id)
|
|
633
|
+
return [];
|
|
634
|
+
const isSearchOk = (targetText) => cancelSearch || !searchText || targetText.toLowerCase().includes(searchText);
|
|
635
|
+
const isOnlySelectedOk = (sources, compareKey, target) => cancelSelected || !showSelectedOnly || !!sources.find((item) => item[compareKey] === target && item.selected);
|
|
636
|
+
return selectedSources[id].filter((source) => isSearchOk(source.name) && isOnlySelectedOk(selectedSources[id], 'name', source.name));
|
|
637
|
+
};
|
|
638
|
+
// This is to filter the user-specific-selections, therebey minimizing the amount of data sent to the API on "persist sources".
|
|
639
|
+
const getApiSourcesPayload = () => {
|
|
640
|
+
const payload = {};
|
|
641
|
+
Object.entries(selectedSources).forEach(([namespace, sources]) => {
|
|
642
|
+
sources.forEach((source) => {
|
|
643
|
+
const foundInitial = recordedInitialSources[namespace]?.find((initialSource) => initialSource.name === source.name && initialSource.kind === source.kind);
|
|
644
|
+
if (foundInitial?.selected !== source.selected) {
|
|
645
|
+
if (!payload[namespace])
|
|
646
|
+
payload[namespace] = [];
|
|
647
|
+
payload[namespace].push({
|
|
648
|
+
name: source.name,
|
|
649
|
+
kind: source.kind,
|
|
650
|
+
selected: source.selected,
|
|
651
|
+
});
|
|
652
|
+
}
|
|
653
|
+
});
|
|
654
|
+
});
|
|
655
|
+
return payload;
|
|
656
|
+
};
|
|
657
|
+
// This is to filter the user-specific-selections, therebey minimizing the amount of data sent to the API on "persist namespaces".
|
|
658
|
+
const getApiFutureAppsPayload = () => {
|
|
659
|
+
const payload = {};
|
|
660
|
+
Object.entries(selectedFutureApps).forEach(([namespace, selected]) => {
|
|
661
|
+
const foundInitial = namespaces?.find((ns) => ns.name === namespace);
|
|
662
|
+
if (foundInitial?.selected !== selected) {
|
|
663
|
+
payload[namespace] = selected;
|
|
664
|
+
}
|
|
665
|
+
});
|
|
666
|
+
return payload;
|
|
667
|
+
};
|
|
668
|
+
return {
|
|
669
|
+
recordedInitialSources,
|
|
670
|
+
filterNamespaces,
|
|
671
|
+
filterSources,
|
|
672
|
+
getApiSourcesPayload,
|
|
673
|
+
getApiFutureAppsPayload,
|
|
674
|
+
selectedSources,
|
|
675
|
+
onSelectSource,
|
|
676
|
+
selectedFutureApps,
|
|
677
|
+
onSelectFutureApps,
|
|
678
|
+
onSelectAll,
|
|
679
|
+
searchText,
|
|
680
|
+
setSearchText,
|
|
681
|
+
showSelectedOnly,
|
|
682
|
+
setShowSelectedOnly,
|
|
683
|
+
};
|
|
231
684
|
};
|
|
232
685
|
|
|
233
686
|
// Fallback locale.
|
|
@@ -3468,26 +3921,4 @@ const useTimeAgo = () => {
|
|
|
3468
3921
|
return timeAgo;
|
|
3469
3922
|
};
|
|
3470
3923
|
|
|
3471
|
-
|
|
3472
|
-
const Animated = styled(container) `
|
|
3473
|
-
animation-name: ${({ $isEntering, $isLeaving }) => ($isEntering ? animateIn : $isLeaving ? animateOut : 'none')};
|
|
3474
|
-
animation-duration: ${duration}ms;
|
|
3475
|
-
animation-fill-mode: forwards;
|
|
3476
|
-
`;
|
|
3477
|
-
// !! Do not deprecate this "useCallback" hook, it is necessary for the transition to work properly
|
|
3478
|
-
const Transition = useCallback(({ children, enter, ...props }) => {
|
|
3479
|
-
const [mounted, setMounted] = useState(false);
|
|
3480
|
-
useEffect(() => {
|
|
3481
|
-
const t = setTimeout(() => setMounted(enter), duration + 50); // +50ms to ensure the animation is finished
|
|
3482
|
-
return () => clearTimeout(t);
|
|
3483
|
-
}, [enter, duration]);
|
|
3484
|
-
if (!enter && !mounted)
|
|
3485
|
-
return null;
|
|
3486
|
-
return (React.createElement(Animated, { "$isEntering": enter, "$isLeaving": !enter && mounted, ...props }, children));
|
|
3487
|
-
},
|
|
3488
|
-
// !! Do not add dependencies here, it will cause re-renders which we want to avoid
|
|
3489
|
-
[]);
|
|
3490
|
-
return Transition;
|
|
3491
|
-
};
|
|
3492
|
-
|
|
3493
|
-
export { useCopy as a, useGenericForm as b, useInstrumentationRuleFormData as c, useKeyDown as d, useOnClickOutside as e, useTimeAgo as f, useTransition as g, useContainerSize as u };
|
|
3924
|
+
export { useClickNode as a, useClickNotification as b, useDestinationFormData as c, useGenericForm as d, useInstrumentationRuleFormData as e, useSourceFormData as f, useSourceSelectionFormData as g, useTimeAgo as h, useActionFormData as u };
|