@camunda/ccma-saas-frontend 0.0.46 → 0.1.0
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/lib/esm/components/c4-actionable-notification/c4-actionable-notification.d.ts +20 -3
- package/lib/esm/components/c4-actionable-notification/c4-actionable-notification.js +50 -17
- package/lib/esm/components/c4-advanced-search-filters/ArrayFieldContainer.js +2 -1
- package/lib/esm/components/c4-advanced-search-filters/AutosuggestInput.js +1 -6
- package/lib/esm/components/c4-advanced-search-filters/FieldRow.js +4 -1
- package/lib/esm/components/c4-advanced-search-filters/FiltersSection.js +1 -6
- package/lib/esm/components/c4-advanced-search-filters/OrSection.js +3 -1
- package/lib/esm/components/c4-advanced-search-filters/c4-advanced-search-filters.js +3 -1
- package/lib/esm/components/c4-ai-usage/c4-ai-usage.js +2 -7
- package/lib/esm/components/c4-alpha-cluster-at-checkout/c4-alpha-cluster-at-checkout.js +7 -7
- package/lib/esm/components/c4-app-teaser-card/c4-app-teaster-card.js +1 -6
- package/lib/esm/components/c4-app-teaser-card/c4-app-teaster-card.spec.d.ts +1 -0
- package/lib/esm/components/c4-app-teaser-card/c4-app-teaster-card.spec.js +43 -0
- package/lib/esm/components/c4-app-teaser-cards/c4-app-teaser-cards.js +1 -1
- package/lib/esm/components/c4-async-modal/c4-async-modal.js +3 -2
- package/lib/esm/components/c4-audit-log/c4-audit-log.js +4 -3
- package/lib/esm/components/c4-billing-page/c4-billing-page.js +8 -6
- package/lib/esm/components/c4-billing-page/elements/cluster-reservations.js +9 -14
- package/lib/esm/components/c4-billing-page/elements/current-usage-metrics.js +2 -1
- package/lib/esm/components/c4-billing-page/elements/usage-alerts.js +3 -8
- package/lib/esm/components/c4-billing-page/elements/value-metric.js +2 -1
- package/lib/esm/components/c4-bottom-links/c4-bottom-links.js +1 -6
- package/lib/esm/components/c4-breadcrumb/c4-breadcrumb.js +3 -6
- package/lib/esm/components/c4-charts-dashboard/c4-charts-dashboard.js +1 -1
- package/lib/esm/components/c4-charts-dashboard/elements/alluvial-chart.js +1 -1
- package/lib/esm/components/c4-charts-dashboard/elements/bar-chart.js +1 -1
- package/lib/esm/components/c4-charts-dashboard/elements/line-chart.js +1 -1
- package/lib/esm/components/c4-cluster-byom-clients/c4-cluster-byom-clients.js +6 -10
- package/lib/esm/components/c4-cluster-client-credentials/c4-cluster-client-credentials.js +8 -3
- package/lib/esm/components/c4-cluster-client-credentials-identity/c4-cluster-client-credentials-identity.js +8 -3
- package/lib/esm/components/c4-cluster-details-activity/c4-cluster-details-activity.js +6 -5
- package/lib/esm/components/c4-cluster-details-alerts/c4-cluster-details-alerts.js +12 -14
- package/lib/esm/components/c4-cluster-details-clients/c4-cluster-details-clients.js +6 -10
- package/lib/esm/components/c4-cluster-details-connector-secrets/c4-cluster-details-connector-secrets.js +8 -11
- package/lib/esm/components/c4-cluster-details-encryption/c4-cluster-details-encryption.js +9 -4
- package/lib/esm/components/c4-cluster-details-hot-backups/c4-cluster-details-hot-backups.js +12 -8
- package/lib/esm/components/c4-cluster-details-hot-backups-restore/c4-cluster-details-hot-backups-restore.js +3 -2
- package/lib/esm/components/c4-cluster-details-ip-whitelist/c4-cluster-details-ip-whitelist.js +7 -10
- package/lib/esm/components/c4-cluster-details-secure-connectivity/c4-cluster-details-secure-connectivity.js +15 -21
- package/lib/esm/components/c4-cluster-list/c4-cluster-list.js +6 -4
- package/lib/esm/components/c4-cluster-overview/applications.js +2 -1
- package/lib/esm/components/c4-cluster-overview/c4-cluster-overview.js +4 -3
- package/lib/esm/components/c4-cluster-overview/cluster-details.js +12 -10
- package/lib/esm/components/c4-cluster-overview/cluster-load.js +1 -1
- package/lib/esm/components/c4-cluster-settings/c4-cluster-settings.js +1 -6
- package/lib/esm/components/c4-cluster-settings/elements/danger-zone.js +1 -6
- package/lib/esm/components/c4-cluster-settings/elements/optimize-filtering-settings.js +3 -3
- package/lib/esm/components/c4-cluster-settings/elements/resource-based-authorizations.js +2 -7
- package/lib/esm/components/c4-cluster-settings/elements/settings-tile.js +1 -6
- package/lib/esm/components/c4-cluster-settings/elements/tasklist-mode-toggle.js +1 -1
- package/lib/esm/components/c4-cluster-tag-selector/c4-cluster-tag-selector.js +4 -2
- package/lib/esm/components/c4-clusters-empty-state/c4-clusters-empty-state.js +18 -14
- package/lib/esm/components/c4-clusters-empty-state/c4-clusters-empty-state.spec.d.ts +1 -0
- package/lib/esm/components/c4-clusters-empty-state/c4-clusters-empty-state.spec.js +40 -0
- package/lib/esm/components/c4-clusters-empty-state/c4-clusters-empty-state.types.d.ts +2 -0
- package/lib/esm/components/c4-clusters-trial-notification/c4-clusters-trial-notification.js +4 -9
- package/lib/esm/components/c4-clusters-trial-notification/c4-clusters-trial-notification.types.d.ts +2 -0
- package/lib/esm/components/c4-console-dashboard/c4-console-dashboard.js +11 -7
- package/lib/esm/components/c4-console-dashboard/elements/empty-state.js +2 -2
- package/lib/esm/components/c4-create-cluster/c4-create-cluster.js +44 -15
- package/lib/esm/components/c4-create-cluster-api-client-modal/c4-create-cluster-api-client-modal.js +4 -2
- package/lib/esm/components/c4-create-connector-secret-modal/c4-create-connector-secret-modal.js +4 -2
- package/lib/esm/components/c4-create-console-api-client-modal/c4-create-console-api-client-modal.js +2 -1
- package/lib/esm/components/c4-create-trial-organization-modal/c4-create-trial-organization-modal.js +2 -1
- package/lib/esm/components/c4-dashboard-first-launch/c4-dashboard-first-launch.js +1 -6
- package/lib/esm/components/c4-data-table/c4-data-table-skeleton.d.ts +15 -0
- package/lib/esm/components/c4-data-table/c4-data-table-skeleton.js +26 -0
- package/lib/esm/components/c4-data-table/c4-data-table.d.ts +3 -0
- package/lib/esm/components/c4-data-table/c4-data-table.js +194 -0
- package/lib/esm/components/c4-data-table/c4-data-table.spec.d.ts +1 -0
- package/lib/esm/components/c4-data-table/c4-data-table.spec.js +71 -0
- package/lib/esm/components/c4-delete-organization-modal/c4-delete-organization-modal.js +3 -2
- package/lib/esm/components/c4-empty-state/c4-empty-state.d.ts +47 -0
- package/lib/esm/components/c4-empty-state/c4-empty-state.js +33 -0
- package/lib/esm/components/c4-extend-trial-modal/c4-extend-trial-modal.d.ts +3 -0
- package/lib/esm/components/c4-extend-trial-modal/c4-extend-trial-modal.js +51 -0
- package/lib/esm/components/c4-extend-trial-modal/c4-extend-trial-modal.spec.d.ts +1 -0
- package/lib/esm/components/c4-extend-trial-modal/c4-extend-trial-modal.spec.js +33 -0
- package/lib/esm/components/c4-extend-trial-modal/c4-extend-trial-modal.types.d.ts +8 -0
- package/lib/esm/components/c4-extend-trial-modal/c4-extend-trial-modal.types.js +1 -0
- package/lib/esm/components/c4-external-link/c4-external-link.js +1 -6
- package/lib/esm/components/c4-feedback-modal/c4-feedback-modal.d.ts +40 -0
- package/lib/esm/components/c4-feedback-modal/c4-feedback-modal.js +109 -0
- package/lib/esm/components/c4-help-center/c4-help-center.d.ts +50 -0
- package/lib/esm/components/c4-help-center/c4-help-center.js +39 -0
- package/lib/esm/components/c4-inline-notification/c4-inline-notification.d.ts +15 -0
- package/lib/esm/components/c4-inline-notification/c4-inline-notification.js +37 -0
- package/lib/esm/components/c4-invite-user-to-organization-modal/c4-invite-user-to-organization-modal.js +4 -3
- package/lib/esm/components/c4-job-dashboard-details-page/c4-job-dashboard-details-page.js +4 -2
- package/lib/esm/components/c4-job-dashboard-details-page/elements/c4-job-dashboard-chart-heading.js +1 -1
- package/lib/esm/components/c4-job-dashboard-details-page/elements/c4-job-dashboard-error-table.js +3 -8
- package/lib/esm/components/c4-job-dashboard-details-page/elements/c4-job-dashboard-time-chart.js +1 -1
- package/lib/esm/components/c4-job-dashboard-details-page/elements/c4-job-dashboard-worker-table.js +3 -3
- package/lib/esm/components/c4-job-dashboard-entry-point/c4-job-dashboard-entry-point.js +2 -1
- package/lib/esm/components/c4-job-dashboard-overview-page/c4-job-dashboard-overview.js +43 -46
- package/lib/esm/components/c4-job-dashboard-shared/c4-background-fetching-indicator.js +1 -6
- package/lib/esm/components/c4-job-dashboard-shared/c4-job-dashboard-error-handler.js +1 -1
- package/lib/esm/components/c4-job-dashboard-shared/c4-job-dashboard-table-heading-with-tooltip.js +1 -1
- package/lib/esm/components/c4-job-dashboard-shared/c4-job-dashboard-time-range-dropdown.js +1 -1
- package/lib/esm/components/c4-leave-organization-modal/c4-leave-organization-modal.js +1 -6
- package/lib/esm/components/c4-link-button/c4-link-button.js +1 -6
- package/lib/esm/components/c4-llm-usage-meter/c4-llm-usage-meter.js +1 -1
- package/lib/esm/components/c4-management-activity/c4-management-activity.js +7 -9
- package/lib/esm/components/c4-management-api/c4-management-api.js +9 -11
- package/lib/esm/components/c4-management-overview/c4-management-overview.js +8 -12
- package/lib/esm/components/c4-management-settings/c4-management-settings.js +9 -11
- package/lib/esm/components/c4-management-users/c4-management-users.js +4 -9
- package/lib/esm/components/c4-multi-step-modal/c4-multi-step-modal.js +4 -2
- package/lib/esm/components/c4-multi-step-modal-ugly/c4-multi-step-modal-ugly.js +4 -2
- package/lib/esm/components/c4-navigation/c4-navigation.d.ts +55 -0
- package/lib/esm/components/c4-navigation/c4-navigation.js +175 -0
- package/lib/esm/components/c4-old-dashboard/c4-old-dashboard.js +2 -1
- package/lib/esm/components/c4-page-layout/c4-page-layout.d.ts +13 -0
- package/lib/esm/components/c4-page-layout/c4-page-layout.js +23 -0
- package/lib/esm/components/c4-page-template/c4-page-template.js +14 -3
- package/lib/esm/components/c4-permission-error-page/c4-permission-error-page.js +1 -1
- package/lib/esm/components/c4-pricing/c4-pricing.js +3 -7
- package/lib/esm/components/c4-pricing-card/c4-pricing-card.js +1 -1
- package/lib/esm/components/c4-rename-organization-modal/c4-rename-organization-modal.js +1 -1
- package/lib/esm/components/c4-search/c4-search-results.js +2 -1
- package/lib/esm/components/c4-selectable-tile/c4-selectable-tile.d.ts +20 -0
- package/lib/esm/components/c4-selectable-tile/c4-selectable-tile.js +41 -0
- package/lib/esm/components/c4-sm-cluster-details/automation-components.js +2 -1
- package/lib/esm/components/c4-sm-cluster-details/c4-sm-cluster-details.js +1 -6
- package/lib/esm/components/c4-sm-cluster-details/custom-properties.js +4 -8
- package/lib/esm/components/c4-sm-cluster-details/details.js +5 -4
- package/lib/esm/components/c4-sm-cluster-details/zeebe-components.js +2 -1
- package/lib/esm/components/c4-sm-dashboard/c4-sm-dashboard.js +1 -1
- package/lib/esm/components/c4-sm-dashboard/c4-sm-dashboard.types.d.ts +1 -1
- package/lib/esm/components/c4-sm-dashboard/cluster-tile.js +2 -1
- package/lib/esm/components/c4-sm-dashboard/component-tile.js +2 -1
- package/lib/esm/components/c4-sm-dashboard/explore.js +1 -6
- package/lib/esm/components/c4-sm-dashboard/overview.js +1 -1
- package/lib/esm/components/c4-sm-dashboard/usage-tile.js +2 -1
- package/lib/esm/components/c4-stat/c4-stat.js +1 -6
- package/lib/esm/components/c4-stateful-button/c4-stateful-button.js +2 -1
- package/lib/esm/components/c4-structured-list/c4-structured-list.d.ts +21 -0
- package/lib/esm/components/c4-structured-list/c4-structured-list.js +75 -0
- package/lib/esm/components/c4-tabs/c4-tabs.js +2 -1
- package/lib/esm/components/c4-telemetry-page/c4-telemetry-page.js +6 -2
- package/lib/esm/components/c4-telemetry-page/component-metrics.js +1 -6
- package/lib/esm/components/c4-telemetry-page/telemetry-for-component.js +2 -1
- package/lib/esm/components/c4-telemetry-teaser-page/c4-telemetry-teaser-page.js +1 -1
- package/lib/esm/components/c4-theme-switcher/c4-theme-switcher.js +1 -1
- package/lib/esm/components/c4-tile-with-title-and-action/c4-tile-with-title-and-action.js +1 -1
- package/lib/esm/components/c4-toast-notification/c4-toast-notification.d.ts +14 -0
- package/lib/esm/components/c4-toast-notification/c4-toast-notification.js +27 -0
- package/lib/esm/components/c4-toggle/c4-toggle.js +6 -8
- package/lib/esm/components/c4-tutorial-tile/c4-tutorial-tile.js +1 -1
- package/lib/esm/components/c4-usage-alert-update-modal/c4-usage-alert-update-modal.js +4 -2
- package/lib/esm/components/c4-usage-history/c4-usage-history.js +5 -3
- package/lib/esm/components/c4-usage-history/elements/usage-history-charts.js +1 -1
- package/lib/esm/components/c4-usage-metrics-per-cluster/c4-usage-metrics-per-cluster.js +8 -7
- package/lib/esm/components/c4-user-details/c4-user-details.js +2 -2
- package/lib/esm/components/c4-user-details/tabs/authorized-resources.js +1 -1
- package/lib/esm/components/c4-user-details/tabs/details.js +6 -10
- package/lib/esm/components/c4-user-details/tabs/roles.js +3 -8
- package/lib/esm/i18n/c4-console-i18n.js +8 -0
- package/lib/esm/i18n/en/modals/clusters.json +0 -8
- package/lib/esm/i18n/en/pages/clusterdetails.json +5 -1
- package/lib/esm/i18n/en/pages/orgmanagement.json +3 -1
- package/lib/esm/index.d.ts +17 -0
- package/lib/esm/index.js +13 -0
- package/lib/esm/runtime/c4-console-authz.js +1 -1
- package/lib/esm/runtime/c4-console-authz.spec.js +3 -3
- package/lib/esm/runtime/c4-console-runtime-context.d.ts +8 -1
- package/lib/esm/runtime/c4-console-runtime-context.js +50 -1
- package/lib/esm/runtime/c4-console-runtime.types.d.ts +8 -0
- package/lib/esm/ui/c4-modal-dialog.d.ts +14 -0
- package/lib/esm/ui/c4-modal-dialog.js +35 -0
- package/lib/esm/ui/families.d.ts +42 -0
- package/lib/esm/ui/families.js +46 -0
- package/lib/esm/ui/index.d.ts +31 -0
- package/lib/esm/ui/index.js +94 -0
- package/lib/esm/ui/switchable.d.ts +14 -0
- package/lib/esm/ui/switchable.js +27 -0
- package/lib/esm/ui/tabs.d.ts +21 -0
- package/lib/esm/ui/tabs.js +27 -0
- package/lib/esm/widgets/cluster-client-details/c4-cluster-client-details-app.js +7 -5
- package/lib/esm/widgets/cluster-details/c4-cluster-details-app.js +7 -2
- package/lib/esm/widgets/cluster-details/c4-cluster-details-page.js +1 -1
- package/lib/esm/widgets/cluster-details/c4-cluster-details-page.spec.js +2 -0
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-alerts-tab.js +10 -6
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-byom-clients-tab.js +5 -3
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-clients-tab.js +7 -5
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-connector-secrets-tab.js +10 -6
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-hot-backups-tab.js +3 -1
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-ip-whitelist-tab.js +7 -5
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-overview-tab.js +54 -21
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-overview-tab.spec.js +96 -5
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-secure-connectivity-tab.js +12 -9
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-settings-tab.js +5 -4
- package/lib/esm/widgets/clusters/c4-clusters-page.d.ts +1 -1
- package/lib/esm/widgets/clusters/c4-clusters-page.js +122 -66
- package/lib/esm/widgets/clusters/c4-clusters-page.spec.js +133 -0
- package/lib/esm/widgets/clusters/c4-clusters-page.types.d.ts +1 -0
- package/lib/esm/widgets/connector-management/c4-connector-management-executable-details-page.js +1 -1
- package/lib/esm/widgets/connector-management/c4-connector-management-executables-table-page.js +3 -2
- package/lib/esm/widgets/connector-management/c4-connector-management-outbound-details-page.d.ts +4 -0
- package/lib/esm/widgets/connector-management/c4-connector-management-outbound-details-page.js +59 -0
- package/lib/esm/widgets/connector-management/c4-connector-management-outbound-details-page.types.d.ts +18 -0
- package/lib/esm/widgets/connector-management/c4-connector-management-outbound-details-page.types.js +6 -0
- package/lib/esm/widgets/connector-management/c4-connector-management-page.d.ts +1 -1
- package/lib/esm/widgets/connector-management/c4-connector-management-page.js +38 -5
- package/lib/esm/widgets/connector-management/c4-connector-management-page.spec.js +54 -0
- package/lib/esm/widgets/connector-management/c4-connector-management-page.types.d.ts +11 -0
- package/lib/esm/widgets/connector-management/c4-connector-management.shared.d.ts +1 -0
- package/lib/esm/widgets/connector-management/c4-connector-management.shared.js +10 -2
- package/lib/esm/widgets/create-cluster/c4-create-cluster-page.js +1 -1
- package/lib/esm/widgets/management/c4-management-app.d.ts +1 -1
- package/lib/esm/widgets/management/c4-management-app.js +57 -4
- package/lib/esm/widgets/management/c4-management-app.spec.js +141 -1
- package/lib/esm/widgets/management/c4-management-app.types.d.ts +5 -0
- package/lib/esm/widgets/management/c4-management-page.js +1 -6
- package/lib/esm/widgets/management/tabs/c4-management-api-tab.js +4 -2
- package/lib/esm/widgets/management/tabs/c4-management-billing-tab.js +1 -1
- package/lib/esm/widgets/management/tabs/c4-management-groups-tab.js +1 -1
- package/lib/esm/widgets/management/tabs/c4-management-overview-tab.d.ts +2 -1
- package/lib/esm/widgets/management/tabs/c4-management-overview-tab.js +10 -3
- package/lib/esm/widgets/management/tabs/c4-management-pricing-tab.js +2 -1
- package/lib/esm/widgets/management/tabs/c4-management-settings-tab.js +1 -1
- package/lib/esm/widgets/management/tabs/c4-management-usage-tab.d.ts +1 -1
- package/lib/esm/widgets/management/tabs/c4-management-usage-tab.js +13 -11
- package/lib/esm/widgets/management/tabs/c4-management-users-tab.js +47 -5
- package/lib/esm/widgets/management/tabs/c4-management-users-tab.spec.js +98 -0
- package/lib/esm/widgets/use-extend-trial.d.ts +8 -0
- package/lib/esm/widgets/use-extend-trial.js +36 -0
- package/lib/esm/widgets/use-extend-trial.spec.d.ts +1 -0
- package/lib/esm/widgets/use-extend-trial.spec.js +79 -0
- package/lib/esm/widgets/user-details/c4-user-details-page.js +5 -4
- package/package.json +13 -6
|
@@ -6,14 +6,20 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
6
6
|
*/
|
|
7
7
|
import { C3ClusterTag, } from '@camunda/camunda-composite-components';
|
|
8
8
|
import { ClusterPlanTypeCategory, checkVersion, VersionCheckOperator, } from '@camunda/ccma-shared-types';
|
|
9
|
-
import {
|
|
9
|
+
import { Input, Textarea } from '@camunda/design-system';
|
|
10
|
+
import { Column, FormLabel, Grid, InlineLoading, Stack, TextArea, TextInput, } from '@carbon/react';
|
|
10
11
|
import { ChevronDown, ChevronUp, Code, DataBase } from '@carbon/react/icons/index.esm.js';
|
|
11
12
|
import { useRef, useState } from 'react';
|
|
12
13
|
import styled from 'styled-components';
|
|
14
|
+
import { useC4DesignSystem } from '../../runtime/c4-console-runtime-context.js';
|
|
15
|
+
import { Button, Checkbox, Link, SkeletonText, Tag, Tile } from '../../ui/index.js';
|
|
16
|
+
import { useContentSwitcherFamily, useRadioFamily } from '../../ui/families.js';
|
|
13
17
|
import { C4ClusterTagSelector } from '../c4-cluster-tag-selector/c4-cluster-tag-selector.js';
|
|
14
18
|
import { C4Divider } from '../c4-divider/c4-divider.js';
|
|
15
19
|
import { C4ExternalLink } from '../c4-external-link/c4-external-link.js';
|
|
20
|
+
import { C4InlineNotification } from '../c4-inline-notification/c4-inline-notification.js';
|
|
16
21
|
import { C4LinkButton } from '../c4-link-button/c4-link-button.js';
|
|
22
|
+
import { C4SelectableTile } from '../c4-selectable-tile/c4-selectable-tile.js';
|
|
17
23
|
var TasklistMode;
|
|
18
24
|
(function (TasklistMode) {
|
|
19
25
|
TasklistMode["V1"] = "v1";
|
|
@@ -48,7 +54,17 @@ const FormElementTitle = (props) => _jsx("h3", { children: props.title });
|
|
|
48
54
|
const ClusterPlanTypeTile = (props) => {
|
|
49
55
|
return (_jsxs(Stack, { gap: 4, children: [props.type === 'dev' ? _jsx(Code, {}) : _jsx(DataBase, {}), _jsx("h6", { children: props.title }), _jsx("p", { children: props.description })] }));
|
|
50
56
|
};
|
|
57
|
+
// In ds mode the family RadioButton renders a DS RadioGroupItem (Radix), which
|
|
58
|
+
// must live inside a RadioGroup and is driven by the group's value/onChange
|
|
59
|
+
// (the per-item checked/onChange are dropped). So ds wraps the grid in the
|
|
60
|
+
// family RadioButtonGroup and lifts selection to the group; carbon keeps the
|
|
61
|
+
// plain Grid with self-managed RadioButtons (unchanged).
|
|
51
62
|
const RadioButtonGroupWithGrid = (props) => {
|
|
63
|
+
const designSystem = useC4DesignSystem();
|
|
64
|
+
const { RadioButtonGroup } = useRadioFamily();
|
|
65
|
+
if (designSystem === 'ds') {
|
|
66
|
+
return (_jsx(RadioButtonGroup, { name: props.name ?? '', valueSelected: props.valueSelected ?? '', onChange: (value) => props.onChange?.(value), children: _jsx(Grid, { children: props.children }) }));
|
|
67
|
+
}
|
|
52
68
|
return _jsx(Grid, { children: props.children });
|
|
53
69
|
};
|
|
54
70
|
const enableMap = {
|
|
@@ -58,6 +74,9 @@ const enableMap = {
|
|
|
58
74
|
dev: ['dev', 'test'],
|
|
59
75
|
};
|
|
60
76
|
export const C4CreateCluster = ({ loading, cta, formElements, autoUpdate, tasklistModeToggle, authorizationToggle, banner: { noSlotsLeft }, }) => {
|
|
77
|
+
const designSystem = useC4DesignSystem();
|
|
78
|
+
const { RadioButton, RadioButtonGroup } = useRadioFamily();
|
|
79
|
+
const { ContentSwitcher, Switch } = useContentSwitcherFamily();
|
|
61
80
|
const preConditions = formElements.clusterPlanType.options.length > 0 &&
|
|
62
81
|
formElements.region.options.length > 0 &&
|
|
63
82
|
formElements.generation.channels.length > 0 &&
|
|
@@ -376,6 +395,10 @@ export const C4CreateCluster = ({ loading, cta, formElements, autoUpdate, taskli
|
|
|
376
395
|
: submitState === 'success'
|
|
377
396
|
? cta.states.success
|
|
378
397
|
: cta.states.error;
|
|
398
|
+
// ds-only: FormLabel's default `--cds-text-secondary` is remapped too dark
|
|
399
|
+
// for the summary panel in ds dark mode; force the primary text token there.
|
|
400
|
+
// Carbon keeps FormLabel's own default (unchanged) by leaving style undefined.
|
|
401
|
+
const summaryLabelStyle = designSystem === 'ds' ? { color: 'var(--cds-text-primary)' } : undefined;
|
|
379
402
|
return (_jsxs("div", { style: {
|
|
380
403
|
display: 'grid',
|
|
381
404
|
gridAutoFlow: 'row',
|
|
@@ -383,7 +406,7 @@ export const C4CreateCluster = ({ loading, cta, formElements, autoUpdate, taskli
|
|
|
383
406
|
overflow: 'hidden',
|
|
384
407
|
zIndex: 1,
|
|
385
408
|
minHeight: '572px',
|
|
386
|
-
}, children: [_jsxs("div", { children: [_jsx("h6", { children: "Summary" }), _jsx(C4Divider, {}), _jsxs(Stack, { gap: 4, children: [loading ? (_jsx(SkeletonText, {})) : (_jsxs("h6", { children: [summary.clusterPlanType, " - ", numberOfAllocatedHwPackages, "x"] })), _jsxs(Stack, { gap: 1, children: [_jsx(FormLabel, { children: "Provider and region" }), loading ? (_jsx(SkeletonText, {})) : summary.provider ? (`${summary.provider} - ${summary.region}`) : (summary.region)] }), formElements.region.dualRegionBackups && (_jsxs(Stack, { gap: 1, children: [_jsx(FormLabel, { children: "Backup region" }), loading ? _jsx(SkeletonText, {}) : summary.backup] })), summary.encryption && (_jsxs(Stack, { gap: 1, children: [_jsx(FormLabel, { children: encryptions?.title ?? 'Encryption at rest' }), loading ? _jsx(SkeletonText, {}) : summary.encryption] })), _jsxs(Stack, { gap: 1, children: [_jsx(FormLabel, { children: "Channel" }), loading ? _jsx(SkeletonText, {}) : summary.channel] }), _jsxs(Stack, { gap: 1, children: [_jsx(FormLabel, { children: "Generation" }), loading ? _jsx(SkeletonText, {}) : summary.generation] }), _jsxs(Stack, { gap: 1, children: [_jsx(FormLabel, { children: "Cluster tag" }), loading ? (_jsx(SkeletonText, {})) : (_jsx("span", { children: _jsx(C3ClusterTag, { stage: summary.stageTag }) }))] })] })] }), !loading && (_jsx("div", { style: { alignSelf: 'end' }, children: _jsx("div", { children: _jsxs(Stack, { gap: 3, children: [['submitting', 'success', 'error'].includes(submitState) ? (_jsx(InlineLoading, { description: submitStateDescription, status: getInlineStatusByState(submitState), style: { marginLeft: '1rem' } })) : (_jsx(Button, { disabled: !clusterCreationAllowed(), style: { width: '100%' }, onClick: handleSubmit, children: cta.label })), cta.cancel && (_jsx(Button, { onClick: () => {
|
|
409
|
+
}, children: [_jsxs("div", { children: [_jsx("h6", { children: "Summary" }), _jsx(C4Divider, {}), _jsxs(Stack, { gap: 4, children: [loading ? (_jsx(SkeletonText, {})) : (_jsxs("h6", { children: [summary.clusterPlanType, " - ", numberOfAllocatedHwPackages, "x"] })), _jsxs(Stack, { gap: 1, children: [_jsx(FormLabel, { style: summaryLabelStyle, children: "Provider and region" }), loading ? (_jsx(SkeletonText, {})) : summary.provider ? (`${summary.provider} - ${summary.region}`) : (summary.region)] }), formElements.region.dualRegionBackups && (_jsxs(Stack, { gap: 1, children: [_jsx(FormLabel, { style: summaryLabelStyle, children: "Backup region" }), loading ? _jsx(SkeletonText, {}) : summary.backup] })), summary.encryption && (_jsxs(Stack, { gap: 1, children: [_jsx(FormLabel, { style: summaryLabelStyle, children: encryptions?.title ?? 'Encryption at rest' }), loading ? _jsx(SkeletonText, {}) : summary.encryption] })), _jsxs(Stack, { gap: 1, children: [_jsx(FormLabel, { style: summaryLabelStyle, children: "Channel" }), loading ? _jsx(SkeletonText, {}) : summary.channel] }), _jsxs(Stack, { gap: 1, children: [_jsx(FormLabel, { style: summaryLabelStyle, children: "Generation" }), loading ? _jsx(SkeletonText, {}) : summary.generation] }), _jsxs(Stack, { gap: 1, children: [_jsx(FormLabel, { style: summaryLabelStyle, children: "Cluster tag" }), loading ? (_jsx(SkeletonText, {})) : (_jsx("span", { children: _jsx(C3ClusterTag, { stage: summary.stageTag }) }))] })] })] }), !loading && (_jsx("div", { style: { alignSelf: 'end' }, children: _jsx("div", { children: _jsxs(Stack, { gap: 3, children: [['submitting', 'success', 'error'].includes(submitState) ? (_jsx(InlineLoading, { description: submitStateDescription, status: getInlineStatusByState(submitState), style: { marginLeft: '1rem' } })) : (_jsx(Button, { disabled: !clusterCreationAllowed(), style: { width: '100%' }, onClick: handleSubmit, children: cta.label })), cta.cancel && (_jsx(Button, { onClick: () => {
|
|
387
410
|
if (cta.cancel) {
|
|
388
411
|
cta.cancel.onClick();
|
|
389
412
|
}
|
|
@@ -403,10 +426,10 @@ export const C4CreateCluster = ({ loading, cta, formElements, autoUpdate, taskli
|
|
|
403
426
|
}
|
|
404
427
|
return (_jsxs(Stack, { gap: 2, children: [_jsx(Grid, { children: _jsx(Column, { span: 12, children: _jsx(FormElementTitle, { title: authorizationToggle?.title ?? '' }) }) }), _jsx(Grid, { children: _jsx(Column, { span: 12, children: _jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '1rem' }, children: [_jsxs(RadioButtonGroup, { valueSelected: authorizationEnabled ? 'true' : 'false', invalidText: 'Invalid selection', legendText: _jsx("div", {}), name: 'authorization-mode', warnText: 'Please select an option', required: true, orientation: 'horizontal', onChange: (selection) => {
|
|
405
428
|
setAuthorizationEnabled(selection === 'true');
|
|
406
|
-
}, children: [_jsx(RadioButton, { id: 'authorization-enabled', labelText: 'Enabled', value: 'true' }), _jsx(RadioButton, { id: 'authorization-disabled', labelText: 'Disabled', value: 'false' })] }, authorizationEnabled ? 'true' : 'false'), _jsxs("div", { children: [_jsx("p", { children: "When enabled, authorization-based access control is enforced." }), _jsxs("p", { children: ["When disabled, all users and clients will have full access to the cluster.", ' ', _jsx("a", { href: authorizationToggle.authorizationDocs, target: '_blank', rel: 'noopener', children: "Learn more" })] })] }), !authorizationEnabled && (_jsx(
|
|
429
|
+
}, children: [_jsx(RadioButton, { id: 'authorization-enabled', labelText: 'Enabled', value: 'true' }), _jsx(RadioButton, { id: 'authorization-disabled', labelText: 'Disabled', value: 'false' })] }, authorizationEnabled ? 'true' : 'false'), _jsxs("div", { children: [_jsx("p", { children: "When enabled, authorization-based access control is enforced." }), _jsxs("p", { children: ["When disabled, all users and clients will have full access to the cluster.", ' ', _jsx("a", { href: authorizationToggle.authorizationDocs, target: '_blank', rel: 'noopener', children: "Learn more" })] })] }), !authorizationEnabled && (_jsx(C4InlineNotification, { lowContrast: true, kind: ['stage', 'prod'].includes(selectedTag) ? 'warning' : 'info', hideCloseButton: true, title: 'Authorizations disabled', children: _jsx("p", { children: "All authenticated users & clients will have full access to the cluster." }) }))] }) }) })] }));
|
|
407
430
|
};
|
|
408
431
|
const renderGenerationRadioButtons = (generations) => {
|
|
409
|
-
return (_jsx(RadioButtonGroupWithGrid, { children: generations.map((generation) => (_jsx(Column, { sm: 4, md: 4, lg: 3, style: {
|
|
432
|
+
return (_jsx(RadioButtonGroupWithGrid, { valueSelected: selectedGeneration, onChange: (value) => updateSelectedGeneration(value), children: generations.map((generation) => (_jsx(Column, { sm: 4, md: 4, lg: 3, style: {
|
|
410
433
|
justifySelf: 'start',
|
|
411
434
|
marginBottom: '0.5rem',
|
|
412
435
|
}, children: _jsx(RadioButton, { id: generation.uuid, value: generation.uuid, labelText: generation.title, checked: selectedGeneration === generation.uuid, onChange: (value) => {
|
|
@@ -457,27 +480,33 @@ export const C4CreateCluster = ({ loading, cta, formElements, autoUpdate, taskli
|
|
|
457
480
|
if (!preConditions) {
|
|
458
481
|
return (_jsx(Grid, { children: _jsx(Column, { span: 12, children: _jsx("p", { children: "Something went wrong. Please try again later." }) }) }));
|
|
459
482
|
}
|
|
460
|
-
return (_jsxs(Stack, { gap: 6, children: [noAvailableSlots && (_jsx(
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
483
|
+
return (_jsxs(Stack, { gap: 6, children: [noAvailableSlots && (_jsx(C4InlineNotification, { kind: 'warning', hideCloseButton: true, style: { minWidth: '0' }, title: noSlotsLeft.title, subtitle: noSlotsLeft.description })), _jsxs(Stack, { gap: 2, children: [_jsx(Grid, { children: _jsx(Column, { span: 12, children: _jsx(FormElementTitle, { title: formElements.name.title }) }) }), _jsx(Grid, { children: _jsx(Column, { span: 8, children: _jsx("div", { ref: clusterNameInputFieldRef, children: designSystem === 'ds' ? (_jsxs(_Fragment, { children: [_jsx(Input, { type: 'text', id: 'cluster-name', placeholder: formElements.name.placeholder, "aria-invalid": !clusterNameValidation.isValid || undefined, disabled: isSubmitting() || noAvailableSlots, onChange: (event) => updateClusterName(event.target.value) }), !clusterNameValidation.isValid && (_jsx("span", { className: 'mt-1 block text-xs text-danger-action-default', children: clusterNameValidation.message }))] })) : (_jsx(TextInput, { invalidText: clusterNameValidation.message, invalid: !clusterNameValidation.isValid, type: 'text', id: 'cluster-name', placeholder: formElements.name.placeholder, onChange: (event) => updateClusterName(event.target.value), labelText: '', disabled: isSubmitting() || noAvailableSlots })) }) }) })] }), formElements.description && (_jsxs(Stack, { gap: 2, children: [_jsx(Grid, { children: _jsx(Column, { span: 12, children: _jsx(FormElementTitle, { title: formElements.description.title }) }) }), _jsx(Grid, { children: _jsx(Column, { span: 8, children: _jsx("div", { ref: clusterDescriptionInputFieldRef, children: designSystem === 'ds' ? (_jsxs(_Fragment, { children: [_jsx(Textarea, { id: 'cluster-description', placeholder: formElements.description.placeholder, rows: 3, "aria-invalid": !clusterDescriptionValidation.isValid || undefined, disabled: isSubmitting() || noAvailableSlots, onChange: (event) => {
|
|
484
|
+
setClusterDescriptionValidation({
|
|
485
|
+
isValid: true,
|
|
486
|
+
message: '',
|
|
487
|
+
});
|
|
488
|
+
setClusterDescription(event.target.value);
|
|
489
|
+
} }), !clusterDescriptionValidation.isValid && (_jsx("span", { className: 'mt-1 block text-xs text-danger-action-default', children: clusterDescriptionValidation.message }))] })) : (_jsx(TextArea, { id: 'cluster-description', placeholder: formElements.description.placeholder, onChange: (event) => {
|
|
490
|
+
setClusterDescriptionValidation({
|
|
491
|
+
isValid: true,
|
|
492
|
+
message: '',
|
|
493
|
+
});
|
|
494
|
+
setClusterDescription(event.target.value);
|
|
495
|
+
}, labelText: '', disabled: isSubmitting() || noAvailableSlots, rows: 3, invalid: !clusterDescriptionValidation.isValid, invalidText: clusterDescriptionValidation.message })) }) }) })] })), _jsx(Grid, { children: _jsx(Column, { span: 12, children: _jsx(C4Divider, {}) }) }), _jsxs(Stack, { gap: 2, ref: regionSectionRef, children: [_jsx(Grid, { children: _jsxs(Column, { span: 12, children: [_jsx(FormElementTitle, { title: formElements.region.title }), !regionValidation.isValid && (_jsx("p", { style: {
|
|
467
496
|
color: 'var(--cds-text-error)',
|
|
468
497
|
marginTop: '0.25rem',
|
|
469
498
|
marginBottom: '0.5rem',
|
|
470
499
|
}, children: regionValidation.message })), getUniqueProviders().length > 1 && (_jsx(ContentSwitcher, { size: 'md', style: {
|
|
471
500
|
width: `${7 * getUniqueProviders().length}rem`,
|
|
472
501
|
marginBottom: '0.5rem',
|
|
473
|
-
}, onChange: (data) => updateProvider(String(data.name ?? '')), selectedIndex: getUniqueProviders().indexOf(provider), children: getUniqueProviders().map((provider) => (_jsx(Switch, { name: provider, children: provider }, provider))) }))] }) }), _jsx(Grid, { children: _jsx(Column, { span: 12, children: _jsx(RadioButtonGroupWithGrid, { children: formElements.region.options
|
|
502
|
+
}, onChange: (data) => updateProvider(String(data.name ?? '')), selectedIndex: getUniqueProviders().indexOf(provider), children: getUniqueProviders().map((provider) => (_jsx(Switch, { name: provider, children: provider }, provider))) }))] }) }), _jsx(Grid, { children: _jsx(Column, { span: 12, children: _jsx(RadioButtonGroupWithGrid, { valueSelected: region, onChange: (value) => updateRegion(value), children: formElements.region.options
|
|
474
503
|
.filter((option) => option.provider === provider)
|
|
475
504
|
.map((option) => (_jsx(Column, { sm: 4, md: 6, lg: 4, style: { justifySelf: 'start', marginBottom: '0.5rem' }, children: _jsx(RadioButton, { id: option.uuid, value: option.uuid, labelText: option.title, checked: option.uuid === region, disabled: isSubmitting() || noAvailableSlots, onChange: (value) => {
|
|
476
505
|
updateRegion(value);
|
|
477
506
|
} }, option.uuid) }, option.uuid))) }) }) }), _jsx(Grid, { children: _jsx(Column, { span: 12, children: _jsx("p", { children: formElements.region.description }) }) })] }), (() => {
|
|
478
507
|
if (formElements.region.dualRegionBackups) {
|
|
479
508
|
const selectedRegion = formElements.region.options.find((reg) => reg.uuid === region);
|
|
480
|
-
return (_jsxs(Stack, { gap: 2, children: [_jsx(Grid, { children: _jsx(Column, { span: 12, children: _jsx(FormElementTitle, { title: formElements.region.backupRegionTitle }) }) }), _jsx(Grid, { children: _jsx(Column, { span: 12, children: _jsx(RadioButtonGroupWithGrid, { children: selectedRegion?.backups.map((option) => (_jsx(Column, { sm: 4, md: 6, lg: 4, style: {
|
|
509
|
+
return (_jsxs(Stack, { gap: 2, children: [_jsx(Grid, { children: _jsx(Column, { span: 12, children: _jsx(FormElementTitle, { title: formElements.region.backupRegionTitle }) }) }), _jsx(Grid, { children: _jsx(Column, { span: 12, children: _jsx(RadioButtonGroupWithGrid, { valueSelected: backupRegion, onChange: (value) => updateBackupRegion(value), children: selectedRegion?.backups.map((option) => (_jsx(Column, { sm: 4, md: 6, lg: 4, style: {
|
|
481
510
|
justifySelf: 'start',
|
|
482
511
|
marginBottom: '0.5rem',
|
|
483
512
|
}, children: _jsx(RadioButton, { id: option.uuid, value: option.uuid, labelText: `${option.regions.length > 1
|
|
@@ -499,7 +528,7 @@ export const C4CreateCluster = ({ loading, cta, formElements, autoUpdate, taskli
|
|
|
499
528
|
}, children: formElements.clusterPlanType.options.map((option) => (_jsx("div", { style: { marginBottom: '2.0rem' }, children: _jsx("div", { style: {
|
|
500
529
|
height: '100%',
|
|
501
530
|
display: 'grid',
|
|
502
|
-
}, children: _jsx(
|
|
531
|
+
}, children: _jsx(C4SelectableTile, { value: option.uuid, checked: option.uuid === currentClusterPlanType, onChange: () => setClusterPlanTypeWithEffects(option.uuid), disabled: option.disabled || isSubmitting() || noAvailableSlots, style: { height: '100%' }, children: _jsx(ClusterPlanTypeTile, { type: option.type, title: option.title, description: option.description }) }, option.uuid) }) }, option.uuid))) })] }), formElements.allocatedHardwarePackages &&
|
|
503
532
|
formElements.clusterPlanType.options.find((option) => option.uuid === currentClusterPlanType &&
|
|
504
533
|
option.category === ClusterPlanTypeCategory.ADVANCED_OFFERING &&
|
|
505
534
|
option.availabilityClass !== 'unset' &&
|
|
@@ -535,7 +564,7 @@ export const C4CreateCluster = ({ loading, cta, formElements, autoUpdate, taskli
|
|
|
535
564
|
? formElements.autoUpdate?.description
|
|
536
565
|
: formElements.autoUpdate?.descriptionIfDisabled }) }) })] })] })), _jsx(Grid, { children: _jsx(Column, { span: 12, children: _jsx(C4Divider, {}) }) }), encryptions && providerSupportsEncryption() && (_jsxs(_Fragment, { children: [_jsxs(Stack, { gap: 2, children: [_jsx(Grid, { children: _jsx(Column, { span: 12, children: _jsx(FormElementTitle, { title: encryptions.title }) }) }), _jsxs(Stack, { gap: 6, children: [_jsx(Grid, { children: _jsx(Column, { span: 12, children: _jsxs("p", { children: [encryptions.description.text, ' ', _jsx("strong", { children: encryptions.description.bold }), ' ', _jsx(C4LinkButton, { label: encryptions.link.text, onClick: () => {
|
|
537
566
|
window.open(encryptions?.link.url ?? '', '_blank');
|
|
538
|
-
} })] }) }) }), _jsx(Grid, { children: _jsx(Column, { span: 12, children: _jsx(RadioButtonGroupWithGrid, { children: encryptions.options.map((option) => (_jsxs(Column, { sm: 4, md: 6, lg: 4, style: {
|
|
567
|
+
} })] }) }) }), _jsx(Grid, { children: _jsx(Column, { span: 12, children: _jsx(RadioButtonGroupWithGrid, { valueSelected: encryption, onChange: (value) => updateEncryption(value), children: encryptions.options.map((option) => (_jsxs(Column, { sm: 4, md: 6, lg: 4, style: {
|
|
539
568
|
justifySelf: 'start',
|
|
540
569
|
marginBottom: '0.5rem',
|
|
541
570
|
}, children: [_jsx(RadioButton, { id: option.value, value: option.value, labelText: option.title, checked: option.value === encryption, onChange: (value) => {
|
package/lib/esm/components/c4-create-cluster-api-client-modal/c4-create-cluster-api-client-modal.js
CHANGED
|
@@ -4,9 +4,11 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
4
4
|
* under one or more contributor license agreements. Licensed under a commercial license.
|
|
5
5
|
* You may not use this file except in compliance with the commercial license.
|
|
6
6
|
*/
|
|
7
|
-
import {
|
|
7
|
+
import { Form } from '@carbon/react';
|
|
8
8
|
import { forwardRef, useCallback, useImperativeHandle, useMemo, useState, } from 'react';
|
|
9
|
+
import { Checkbox, Modal, Stack, TextInput } from '../../ui/index.js';
|
|
9
10
|
import { C4ClusterClientCredentialsModal } from '../c4-cluster-client-credentials/c4-cluster-client-credentials.js';
|
|
11
|
+
import { C4InlineNotification } from '../c4-inline-notification/c4-inline-notification.js';
|
|
10
12
|
function safeTranslate(t, key, defaultValue, options) {
|
|
11
13
|
if (!t)
|
|
12
14
|
return defaultValue;
|
|
@@ -122,7 +124,7 @@ export const C4CreateClusterApiClientModal = forwardRef(({ t, onCreateClusterApi
|
|
|
122
124
|
label: safeTranslate(t, 'clusterclients:create.fields.scopes.secrets', 'Secrets'),
|
|
123
125
|
},
|
|
124
126
|
], [t]);
|
|
125
|
-
return (_jsxs(_Fragment, { children: [_jsx(Modal, { open: isOpen, modalHeading: modalHeading, primaryButtonText: safeTranslate(t, 'clusterclients:create.buttons.primary', 'Create'), secondaryButtonText: safeTranslate(t, 'clusterclients:create.buttons.secondary', 'Cancel'), primaryButtonDisabled: saving || scopes.length === 0, onRequestClose: close, onRequestSubmit: onSubmit, size: 'md', id: 'c4-create-cluster-api-client-modal', children: _jsx(Form, { noValidate: true, children: _jsxs(Stack, { gap: 6, children: [error && (_jsx(
|
|
127
|
+
return (_jsxs(_Fragment, { children: [_jsx(Modal, { open: isOpen, modalHeading: modalHeading, primaryButtonText: safeTranslate(t, 'clusterclients:create.buttons.primary', 'Create'), secondaryButtonText: safeTranslate(t, 'clusterclients:create.buttons.secondary', 'Cancel'), primaryButtonDisabled: saving || scopes.length === 0, onRequestClose: close, onRequestSubmit: onSubmit, size: 'md', id: 'c4-create-cluster-api-client-modal', children: _jsx(Form, { noValidate: true, children: _jsxs(Stack, { gap: 6, children: [error && (_jsx(C4InlineNotification, { kind: 'error', title: 'Error', subtitle: error, hideCloseButton: true, lowContrast: true })), _jsx(TextInput, { id: 'c4-cluster-api-client-name', name: 'name', "data-modal-primary-focus": true, labelText: safeTranslate(t, 'clusterclients:create.fields.name.label', 'Client Name'), maxLength: 50, value: name, placeholder: safeTranslate(t, 'clusterclients:create.fields.name.label', 'Client Name'), helperText: safeTranslate(t, 'clusterclients:create.fields.name.helperText', 'can contain letters, dashes, underscores, and digits'), invalid: Boolean(nameInvalid), invalidText: nameInvalid
|
|
126
128
|
? safeTranslate(t, 'clusterclients:create.error.doublette', 'Name is invalid')
|
|
127
129
|
: '', onChange: (event) => setName(event.target.value), onBlur: () => setNameTouched(true), disabled: saving }), _jsxs(Stack, { gap: 2, children: [_jsx("h3", { children: safeTranslate(t, 'clusterclients:create.fields.scopes.label', 'Scopes') }), _jsx("p", { children: safeTranslate(t, 'clusterclients:create.fields.scopes.helperText', 'Scopes define the access for client credentials.') })] }), _jsx("div", { children: scopeOptions.map((scope) => (_jsx(Checkbox, { labelText: scope.label, id: `c4-cluster-scope-${scope.value}`, value: scope.value, checked: scopes.includes(scope.value), onChange: () => {
|
|
128
130
|
setScopes((current) => {
|
package/lib/esm/components/c4-create-connector-secret-modal/c4-create-connector-secret-modal.js
CHANGED
|
@@ -5,8 +5,10 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
5
5
|
* You may not use this file except in compliance with the commercial license.
|
|
6
6
|
*/
|
|
7
7
|
import { SECRETS_MAX_LENGTH } from '@camunda/ccma-shared-types';
|
|
8
|
-
import { Form,
|
|
8
|
+
import { Form, PasswordInput } from '@carbon/react';
|
|
9
9
|
import { forwardRef, useCallback, useImperativeHandle, useMemo, useState, } from 'react';
|
|
10
|
+
import { Modal, Stack, TextInput } from '../../ui/index.js';
|
|
11
|
+
import { C4InlineNotification } from '../c4-inline-notification/c4-inline-notification.js';
|
|
10
12
|
function safeTranslate(t, key, defaultValue, options) {
|
|
11
13
|
if (!t)
|
|
12
14
|
return defaultValue;
|
|
@@ -79,7 +81,7 @@ export const C4CreateConnectorSecretModal = forwardRef(({ t, onCreateSecret }, r
|
|
|
79
81
|
}
|
|
80
82
|
})();
|
|
81
83
|
}, [close, clusterId, onCreateSecret, orgId, secretKey, secretValue]);
|
|
82
|
-
return (_jsx(Modal, { open: isOpen, modalHeading: modalHeading, primaryButtonText: safeTranslate(t, 'connectorsecrets:create.buttons.primary', 'Create'), secondaryButtonText: safeTranslate(t, 'connectorsecrets:create.buttons.secondary', 'Cancel'), primaryButtonDisabled: saving, onRequestClose: close, onRequestSubmit: onSubmit, id: 'c4-create-connector-secret-modal', size: 'sm', children: _jsxs(Stack, { gap: 6, children: [error && (_jsx(
|
|
84
|
+
return (_jsx(Modal, { open: isOpen, modalHeading: modalHeading, primaryButtonText: safeTranslate(t, 'connectorsecrets:create.buttons.primary', 'Create'), secondaryButtonText: safeTranslate(t, 'connectorsecrets:create.buttons.secondary', 'Cancel'), primaryButtonDisabled: saving, onRequestClose: close, onRequestSubmit: onSubmit, id: 'c4-create-connector-secret-modal', size: 'sm', children: _jsxs(Stack, { gap: 6, children: [error && (_jsx(C4InlineNotification, { kind: 'error', title: 'Error', subtitle: error, hideCloseButton: true, lowContrast: true })), _jsxs(Form, { noValidate: true, children: [_jsx(TextInput, { id: 'c4-secret-create-key', labelText: safeTranslate(t, 'connectorsecrets:create.fields.key', 'Key'), helperText: safeTranslate(t, 'connectorsecrets:create.fields.keyHelperText', 'Unique identifier for the secret'), maxLength: 50, value: secretKey, invalid: secretKeyInvalid, invalidText: 'Key is required', disabled: saving, onChange: (event) => {
|
|
83
85
|
const next = event.target.value;
|
|
84
86
|
setSecretKey(next);
|
|
85
87
|
if (secretKeyInvalid && next.trim().length > 0) {
|
package/lib/esm/components/c4-create-console-api-client-modal/c4-create-console-api-client-modal.js
CHANGED
|
@@ -4,8 +4,9 @@ import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-run
|
|
|
4
4
|
* under one or more contributor license agreements. Licensed under a commercial license.
|
|
5
5
|
* You may not use this file except in compliance with the commercial license.
|
|
6
6
|
*/
|
|
7
|
-
import {
|
|
7
|
+
import { Form, FormGroup } from '@carbon/react';
|
|
8
8
|
import { forwardRef, useCallback, useImperativeHandle, useMemo, useState, } from 'react';
|
|
9
|
+
import { Checkbox, Modal, Stack, TextInput } from '../../ui/index.js';
|
|
9
10
|
import { C4ClusterClientCredentialsModal } from '../c4-cluster-client-credentials/c4-cluster-client-credentials.js';
|
|
10
11
|
function isApiClientNameValid(name) {
|
|
11
12
|
if (!name.trim()) {
|
package/lib/esm/components/c4-create-trial-organization-modal/c4-create-trial-organization-modal.js
CHANGED
|
@@ -4,8 +4,9 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
4
4
|
* under one or more contributor license agreements. Licensed under a commercial license.
|
|
5
5
|
* You may not use this file except in compliance with the commercial license.
|
|
6
6
|
*/
|
|
7
|
-
import { Form
|
|
7
|
+
import { Form } from '@carbon/react';
|
|
8
8
|
import { useCallback, useRef } from 'react';
|
|
9
|
+
import { Stack, TextInput } from '../../ui/index.js';
|
|
9
10
|
import { C4AsyncModal } from '../c4-async-modal/c4-async-modal.js';
|
|
10
11
|
function safeTranslate(t, key, defaultValue, options) {
|
|
11
12
|
if (!t)
|
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
|
|
3
|
-
* Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
|
|
4
|
-
* under one or more contributor license agreements. Licensed under a commercial license.
|
|
5
|
-
* You may not use this file except in compliance with the commercial license.
|
|
6
|
-
*/
|
|
7
|
-
import { Stack, Tile } from '@carbon/react';
|
|
2
|
+
import { Stack, Tile } from '../../ui/index.js';
|
|
8
3
|
import { C4TutorialTile } from '../c4-tutorial-tile/c4-tutorial-tile.js';
|
|
9
4
|
export const C4DashboardFirstLaunch = ({ title, subtitle, tutorials, }) => (_jsx(Tile, { children: _jsxs(Stack, { orientation: 'vertical', gap: 5, children: [_jsxs(Stack, { gap: 1, children: [_jsx("h1", { children: title }), typeof subtitle === 'string' ? _jsx("p", { children: subtitle }) : subtitle] }), _jsx(Stack, { orientation: 'horizontal', gap: 5, style: { display: 'grid' }, children: tutorials.map((tutorial) => (_jsx(C4TutorialTile, { ...tutorial }, tutorial.id))) })] }) }));
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { DataTableSkeleton } from '@carbon/react';
|
|
2
|
+
import type { ComponentProps, JSX } from 'react';
|
|
3
|
+
type C4DataTableSkeletonProps = ComponentProps<typeof DataTableSkeleton>;
|
|
4
|
+
/**
|
|
5
|
+
* Design-system-switchable table loading skeleton.
|
|
6
|
+
*
|
|
7
|
+
* Carbon mode renders Carbon's `DataTableSkeleton` unchanged. ds mode renders a
|
|
8
|
+
* DS-styled skeleton matching the DS DataTable's own loading rows
|
|
9
|
+
* (`animate-pulse rounded bg-neutral-background-strong` inside a rounded,
|
|
10
|
+
* bordered container) — so a consumer's early-return loading state looks like
|
|
11
|
+
* the rest of the DS tables instead of a Carbon skeleton. The Carbon-shaped
|
|
12
|
+
* props (rowCount, etc.) are accepted so call sites stay unchanged.
|
|
13
|
+
*/
|
|
14
|
+
export declare function C4DataTableSkeleton(props: C4DataTableSkeletonProps): JSX.Element;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
|
|
4
|
+
* under one or more contributor license agreements. Licensed under a commercial license.
|
|
5
|
+
* You may not use this file except in compliance with the commercial license.
|
|
6
|
+
*/
|
|
7
|
+
import { DataTableSkeleton } from '@carbon/react';
|
|
8
|
+
import { useC4DesignSystem } from '../../runtime/c4-console-runtime-context.js';
|
|
9
|
+
/**
|
|
10
|
+
* Design-system-switchable table loading skeleton.
|
|
11
|
+
*
|
|
12
|
+
* Carbon mode renders Carbon's `DataTableSkeleton` unchanged. ds mode renders a
|
|
13
|
+
* DS-styled skeleton matching the DS DataTable's own loading rows
|
|
14
|
+
* (`animate-pulse rounded bg-neutral-background-strong` inside a rounded,
|
|
15
|
+
* bordered container) — so a consumer's early-return loading state looks like
|
|
16
|
+
* the rest of the DS tables instead of a Carbon skeleton. The Carbon-shaped
|
|
17
|
+
* props (rowCount, etc.) are accepted so call sites stay unchanged.
|
|
18
|
+
*/
|
|
19
|
+
export function C4DataTableSkeleton(props) {
|
|
20
|
+
const designSystem = useC4DesignSystem();
|
|
21
|
+
if (designSystem !== 'ds') {
|
|
22
|
+
return _jsx(DataTableSkeleton, { ...props });
|
|
23
|
+
}
|
|
24
|
+
const rowCount = props.rowCount ?? 5;
|
|
25
|
+
return (_jsx("div", { className: 'overflow-hidden rounded-xl border bg-neutral-background-subtle', children: Array.from({ length: rowCount }).map((_, index) => (_jsx("div", { className: 'border-b px-4 py-3 last:border-0', children: _jsx("div", { className: 'h-4 w-3/4 animate-pulse rounded bg-neutral-background-strong' }) }, index))) }));
|
|
26
|
+
}
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
|
|
4
|
+
* under one or more contributor license agreements. Licensed under a commercial license.
|
|
5
|
+
* You may not use this file except in compliance with the commercial license.
|
|
6
|
+
*/
|
|
7
|
+
import { C3DataTable, } from '@camunda/camunda-composite-components';
|
|
8
|
+
import { Button, DataTable, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, Input, MultiSelect, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from '@camunda/design-system';
|
|
9
|
+
import { useState } from 'react';
|
|
10
|
+
import { useC4DesignSystem } from '../../runtime/c4-console-runtime-context.js';
|
|
11
|
+
/**
|
|
12
|
+
* Design-system-switchable data table.
|
|
13
|
+
*
|
|
14
|
+
* Keeps the stable C3DataTable interface ('carbon' renders unchanged c3; 'ds'
|
|
15
|
+
* transforms onto the DS DataTable; c3 untouched). See docs/superpowers/specs/
|
|
16
|
+
* 2026-06-24-c4-datatable-ds-transformation-design.md.
|
|
17
|
+
*
|
|
18
|
+
* Stage 1: core mapping (headers→columns, actions→rowActions, options, expansion,
|
|
19
|
+
* row-click, loading, title/description). Stage 2 (this file): the toolbar shell
|
|
20
|
+
* — search / singleSelect / multiSelect (client-side filtering via the
|
|
21
|
+
* consumer's predicates) + button / menuButton. No bulk-row machinery
|
|
22
|
+
* (unused in app).
|
|
23
|
+
*
|
|
24
|
+
* Deviation from c3: filter state is local React state, not URL-synced via the
|
|
25
|
+
* c3 `queryName` (c4 has no router here). The filtering result is identical;
|
|
26
|
+
* only persistence across reload/links differs.
|
|
27
|
+
*/
|
|
28
|
+
// Carbon button `kind` → DS Button variant.
|
|
29
|
+
function kindToButtonVariant(kind) {
|
|
30
|
+
if (typeof kind !== 'string')
|
|
31
|
+
return 'default';
|
|
32
|
+
if (kind.includes('danger'))
|
|
33
|
+
return 'destructive';
|
|
34
|
+
if (kind.includes('tertiary'))
|
|
35
|
+
return 'secondary';
|
|
36
|
+
if (kind.includes('ghost'))
|
|
37
|
+
return 'ghost';
|
|
38
|
+
if (kind === 'secondary')
|
|
39
|
+
return 'secondary';
|
|
40
|
+
return 'default';
|
|
41
|
+
}
|
|
42
|
+
// Map one C3 header's cell content to a DS column cell node.
|
|
43
|
+
function renderCell(header, row) {
|
|
44
|
+
const content = header.type;
|
|
45
|
+
const value = row[header.key];
|
|
46
|
+
if (!content || content.type === 'text') {
|
|
47
|
+
return value;
|
|
48
|
+
}
|
|
49
|
+
switch (content.type) {
|
|
50
|
+
case 'wrapper':
|
|
51
|
+
return content.options?.wrapperOptions?.wrapper(row);
|
|
52
|
+
case 'link': {
|
|
53
|
+
const link = content.options?.linkOptions;
|
|
54
|
+
return link ? (_jsx("a", { href: link.href(row), target: link.target, rel: 'noopener noreferrer', children: value })) : (value);
|
|
55
|
+
}
|
|
56
|
+
case 'link-button': {
|
|
57
|
+
const link = content.options?.linkButtonOptions;
|
|
58
|
+
return (_jsx(Button, { variant: 'link', className: 'h-auto p-0', onClick: () => link?.onClick(row), disabled: link?.disabled?.(row), children: value }));
|
|
59
|
+
}
|
|
60
|
+
case 'code':
|
|
61
|
+
return _jsx("code", { children: value });
|
|
62
|
+
default:
|
|
63
|
+
return value;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
function toColumns(headers) {
|
|
67
|
+
return headers.map((header) => ({
|
|
68
|
+
id: header.key,
|
|
69
|
+
accessorFn: (row) => row[header.key],
|
|
70
|
+
header: header.label,
|
|
71
|
+
enableSorting: !!header.sorting,
|
|
72
|
+
...(header.sorting && {
|
|
73
|
+
sortingFn: (a, b) => header.sorting(a.original, b.original),
|
|
74
|
+
}),
|
|
75
|
+
cell: ({ row }) => renderCell(header, row.original),
|
|
76
|
+
}));
|
|
77
|
+
}
|
|
78
|
+
function toRowActions(actions) {
|
|
79
|
+
return actions?.map((action) => ({
|
|
80
|
+
id: action.id,
|
|
81
|
+
label: action.label,
|
|
82
|
+
onClick: (row) => action.onClick(row),
|
|
83
|
+
disabled: action.disabled,
|
|
84
|
+
visible: action.visible,
|
|
85
|
+
hasDivider: action.hasDivider,
|
|
86
|
+
variant: typeof action.kind === 'string' && action.kind.includes('danger')
|
|
87
|
+
? 'destructive'
|
|
88
|
+
: 'default',
|
|
89
|
+
icon: action.icon
|
|
90
|
+
? (row) => {
|
|
91
|
+
const Icon = typeof action.icon === 'function' ? action.icon(row) : action.icon;
|
|
92
|
+
return Icon ? _jsx(Icon, {}) : undefined;
|
|
93
|
+
}
|
|
94
|
+
: undefined,
|
|
95
|
+
}));
|
|
96
|
+
}
|
|
97
|
+
// Items that filter rows (search/singleSelect/multiSelect); button/menuButton
|
|
98
|
+
// do not.
|
|
99
|
+
function keepRow(row, items, state) {
|
|
100
|
+
return items.every((item) => {
|
|
101
|
+
if (item.type === 'search') {
|
|
102
|
+
const term = state[item.id];
|
|
103
|
+
const searchTerm = typeof term === 'string' ? term : '';
|
|
104
|
+
return !searchTerm || !item.filter
|
|
105
|
+
? true
|
|
106
|
+
: item.filter({ row, searchTerm });
|
|
107
|
+
}
|
|
108
|
+
if (item.type === 'singleSelect') {
|
|
109
|
+
const selectedItem = state[item.id];
|
|
110
|
+
const value = typeof selectedItem === 'string' ? selectedItem : '';
|
|
111
|
+
return !value || !item.filter
|
|
112
|
+
? true
|
|
113
|
+
: item.filter({ row, selectedItem: value });
|
|
114
|
+
}
|
|
115
|
+
if (item.type === 'multiSelect') {
|
|
116
|
+
const raw = state[item.id];
|
|
117
|
+
const selectedItems = Array.isArray(raw) ? raw : [];
|
|
118
|
+
return selectedItems.length === 0 || !item.filter
|
|
119
|
+
? true
|
|
120
|
+
: item.filter({ row, selectedItems });
|
|
121
|
+
}
|
|
122
|
+
return true;
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
function C4DataTableDs(props) {
|
|
126
|
+
const { headers, data, actions, options, isLoading, title, description, id } = props;
|
|
127
|
+
// Normalise `toolbar` (single row) / `toolbars` (multiple rows) into rows.
|
|
128
|
+
const toolbarRows = props.toolbars ?? (props.toolbar ? [props.toolbar] : []);
|
|
129
|
+
const allToolbarItems = toolbarRows.flat();
|
|
130
|
+
const [filterState, setFilterState] = useState(() => {
|
|
131
|
+
const initial = {};
|
|
132
|
+
for (const item of allToolbarItems) {
|
|
133
|
+
if (item.type === 'singleSelect' && item.defaultValue != null) {
|
|
134
|
+
initial[item.id] = String(item.defaultValue);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
return initial;
|
|
138
|
+
});
|
|
139
|
+
const setValue = (key, value) => setFilterState((prev) => ({ ...prev, [key]: value }));
|
|
140
|
+
const filteredData = allToolbarItems.length
|
|
141
|
+
? data.filter((row) => keepRow(row, allToolbarItems, filterState))
|
|
142
|
+
: data;
|
|
143
|
+
const renderToolbarItem = (item) => {
|
|
144
|
+
switch (item.type) {
|
|
145
|
+
case 'search': {
|
|
146
|
+
const raw = filterState[item.id];
|
|
147
|
+
const searchValue = typeof raw === 'string' ? raw : '';
|
|
148
|
+
return (_jsx(Input, { type: 'search', className: 'max-w-xs', placeholder: item.label ?? 'Search', "aria-label": item.label ?? 'Search', value: searchValue, onChange: (event) => setValue(item.id, event.target.value) }, item.id));
|
|
149
|
+
}
|
|
150
|
+
case 'singleSelect': {
|
|
151
|
+
const raw = filterState[item.id];
|
|
152
|
+
const value = typeof raw === 'string' ? raw : undefined;
|
|
153
|
+
return (_jsxs(Select, { value: value, onValueChange: (next) => setValue(item.id, next), disabled: item.disabled, children: [_jsx(SelectTrigger, { "aria-label": item.label, className: 'w-44', children: _jsx(SelectValue, { placeholder: item.label }) }), _jsx(SelectContent, { children: item.items?.map((option) => (_jsx(SelectItem, { value: option.id, children: option.label }, option.id))) })] }, item.id));
|
|
154
|
+
}
|
|
155
|
+
case 'multiSelect': {
|
|
156
|
+
const raw = filterState[item.id];
|
|
157
|
+
const value = Array.isArray(raw) ? raw : [];
|
|
158
|
+
return (_jsx(MultiSelect, { id: item.id, "aria-label": item.label ?? 'Filter', placeholder: item.label ?? 'Filter', className: 'w-64', options: (item.items ?? []).map((option) => ({
|
|
159
|
+
value: option.id,
|
|
160
|
+
label: option.label,
|
|
161
|
+
})), value: value, onValueChange: (next) => setValue(item.id, next) }, item.id));
|
|
162
|
+
}
|
|
163
|
+
case 'button': {
|
|
164
|
+
const Icon = item.icon;
|
|
165
|
+
return (_jsxs(Button, { variant: kindToButtonVariant(item.kind), onClick: item.onClick, disabled: item.disabled, children: [Icon ? _jsx(Icon, {}) : undefined, item.label] }, item.id));
|
|
166
|
+
}
|
|
167
|
+
case 'menuButton':
|
|
168
|
+
return (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(Button, { variant: 'secondary', disabled: item.disabled, children: item.label }) }), _jsx(DropdownMenuContent, { align: 'end', children: item.items.map((menuItem, index) => (_jsx(DropdownMenuItem
|
|
169
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: c3 menu items have no stable id
|
|
170
|
+
, { onClick: menuItem.onClick, disabled: menuItem.disabled, children: menuItem.label }, index))) })] }, item.id));
|
|
171
|
+
default:
|
|
172
|
+
return null;
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
const renderToolbarRow = (items, rowIndex) => {
|
|
176
|
+
const filters = items.filter((item) => item.type === 'search' ||
|
|
177
|
+
item.type === 'singleSelect' ||
|
|
178
|
+
item.type === 'multiSelect');
|
|
179
|
+
const buttons = items.filter((item) => item.type === 'button' || item.type === 'menuButton');
|
|
180
|
+
return (_jsxs("div", { className: 'flex flex-wrap items-center gap-2', children: [filters.map(renderToolbarItem), buttons.length > 0 && (_jsx("div", { className: 'ml-auto flex items-center gap-2', children: buttons.map(renderToolbarItem) }))] }, rowIndex));
|
|
181
|
+
};
|
|
182
|
+
const hasHeading = title !== undefined || description !== undefined;
|
|
183
|
+
const hasExpansion = data.some((row) => row.expansion !== undefined);
|
|
184
|
+
return (_jsxs("div", { className: 'flex flex-col gap-3', id: id, children: [hasHeading && (_jsxs("div", { className: 'flex flex-col gap-1', children: [title !== undefined && (_jsx("div", { className: 'text-base font-semibold', children: title })), description !== undefined && (_jsx("div", { className: 'text-sm text-neutral-foreground-subtle', children: description }))] })), toolbarRows.map(renderToolbarRow), _jsx(DataTable, { columns: toColumns(headers), data: filteredData, getRowId: (row, index) => row.id ?? String(index), sorting: headers.some((header) => !!header.sorting), pagination: options?.pageSize || options?.pageSizes
|
|
185
|
+
? {
|
|
186
|
+
defaultPageSize: options.pageSize,
|
|
187
|
+
pageSizes: options.pageSizes,
|
|
188
|
+
}
|
|
189
|
+
: true, size: options?.tableSize, zebra: options?.useZebraStyles, inlineActionsThreshold: options?.actionsUseOverflowMenuMinItems, rowActions: toRowActions(actions), loading: isLoading, onRowClick: (row) => row.onClick?.(), expansion: hasExpansion ? (row) => row.expansion ?? null : undefined })] }));
|
|
190
|
+
}
|
|
191
|
+
export function C4DataTable(props) {
|
|
192
|
+
const designSystem = useC4DesignSystem();
|
|
193
|
+
return designSystem === 'ds' ? (_jsx(C4DataTableDs, { ...props })) : (_jsx(C3DataTable, { ...props }));
|
|
194
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import userEvent from '@testing-library/user-event';
|
|
4
|
+
import { C4ConsoleRuntimeProvider } from '../../runtime/c4-console-runtime-context.js';
|
|
5
|
+
import { C4DataTable } from './c4-data-table.js';
|
|
6
|
+
const ROWS = [
|
|
7
|
+
{ id: 'r1', originalIndex: 0, name: 'Alice', rolesArray: ['admin'] },
|
|
8
|
+
{ id: 'r2', originalIndex: 1, name: 'Bob', rolesArray: ['developer'] },
|
|
9
|
+
{
|
|
10
|
+
id: 'r3',
|
|
11
|
+
originalIndex: 2,
|
|
12
|
+
name: 'Carol',
|
|
13
|
+
rolesArray: ['analyst', 'developer'],
|
|
14
|
+
},
|
|
15
|
+
];
|
|
16
|
+
function renderTable() {
|
|
17
|
+
const wrapper = ({ children }) => (_jsx(C4ConsoleRuntimeProvider, { config: {
|
|
18
|
+
stage: 'dev',
|
|
19
|
+
designSystem: 'ds',
|
|
20
|
+
auth: { getAccessToken: async () => '' },
|
|
21
|
+
backendUrls: {},
|
|
22
|
+
}, children: children }));
|
|
23
|
+
return render(_jsx(C4DataTable, { headers: [
|
|
24
|
+
{ key: 'name', label: 'Name' },
|
|
25
|
+
{ key: 'rolesArray', label: 'Roles' },
|
|
26
|
+
], data: ROWS, toolbar: [
|
|
27
|
+
{
|
|
28
|
+
id: 'role-filter',
|
|
29
|
+
type: 'multiSelect',
|
|
30
|
+
label: 'Filter by role',
|
|
31
|
+
items: [
|
|
32
|
+
{ id: 'admin', label: 'Admin' },
|
|
33
|
+
{ id: 'developer', label: 'Developer' },
|
|
34
|
+
{ id: 'analyst', label: 'Analyst' },
|
|
35
|
+
],
|
|
36
|
+
filter: ({ row, selectedItems }) => !selectedItems?.length ||
|
|
37
|
+
selectedItems.some((id) => row.rolesArray.includes(id)),
|
|
38
|
+
},
|
|
39
|
+
] }), { wrapper });
|
|
40
|
+
}
|
|
41
|
+
// jsdom does not implement Element.scrollIntoView; the DS MultiSelect uses
|
|
42
|
+
// cmdk under the hood, which calls it when items mount.
|
|
43
|
+
beforeAll(() => {
|
|
44
|
+
if (typeof window !== 'undefined' &&
|
|
45
|
+
!window.Element.prototype.scrollIntoView) {
|
|
46
|
+
window.Element.prototype.scrollIntoView = () => undefined;
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
describe('C4DataTableDs multiSelect toolbar item', () => {
|
|
50
|
+
it('renders the multi-select trigger and all rows by default', () => {
|
|
51
|
+
renderTable();
|
|
52
|
+
expect(screen.getByRole('combobox', { name: 'Filter by role' })).toBeInTheDocument();
|
|
53
|
+
expect(screen.getByText('Alice')).toBeInTheDocument();
|
|
54
|
+
expect(screen.getByText('Bob')).toBeInTheDocument();
|
|
55
|
+
expect(screen.getByText('Carol')).toBeInTheDocument();
|
|
56
|
+
});
|
|
57
|
+
it('narrows rows to those whose rolesArray includes a selected role', async () => {
|
|
58
|
+
const user = userEvent.setup();
|
|
59
|
+
renderTable();
|
|
60
|
+
// Open the dropdown.
|
|
61
|
+
await user.click(screen.getByRole('combobox', { name: 'Filter by role' }));
|
|
62
|
+
// Pick "Developer" from the popover. The DS MultiSelect renders options
|
|
63
|
+
// as command items inside a Radix Popover portal.
|
|
64
|
+
const developerOption = await screen.findByText('Developer');
|
|
65
|
+
await user.click(developerOption);
|
|
66
|
+
// After filtering: only Bob and Carol (both carry 'developer').
|
|
67
|
+
expect(screen.queryByText('Alice')).not.toBeInTheDocument();
|
|
68
|
+
expect(screen.getByText('Bob')).toBeInTheDocument();
|
|
69
|
+
expect(screen.getByText('Carol')).toBeInTheDocument();
|
|
70
|
+
});
|
|
71
|
+
});
|
|
@@ -4,8 +4,9 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
4
4
|
* under one or more contributor license agreements. Licensed under a commercial license.
|
|
5
5
|
* You may not use this file except in compliance with the commercial license.
|
|
6
6
|
*/
|
|
7
|
-
import { InlineNotification, Modal, Stack, TextInput } from '@carbon/react';
|
|
8
7
|
import { useEffect, useState } from 'react';
|
|
8
|
+
import { Modal, Stack, TextInput } from '../../ui/index.js';
|
|
9
|
+
import { C4InlineNotification } from '../c4-inline-notification/c4-inline-notification.js';
|
|
9
10
|
function safeTranslate(t, key, fallback, options) {
|
|
10
11
|
try {
|
|
11
12
|
const translated = t?.(key, options);
|
|
@@ -37,5 +38,5 @@ export const C4DeleteOrganizationModal = ({ t, open, loading, error, organizatio
|
|
|
37
38
|
const message = safeTranslate(t, 'orgmanagement:tabs.settings.orgmanagement.deleteConfirmation', `Are you sure you want to delete "${organizationName}"? The organization and its clusters, Web Modeler files, and other assets will be deleted. This action cannot be undone.`, { organizationName });
|
|
38
39
|
const confirmLabel = safeTranslate(t, 'orgmanagement:tabs.settings.orgmanagement.deleteConfirmLabel', 'Type the word DELETE to confirm');
|
|
39
40
|
const errorMessage = safeTranslate(t, 'orgmanagement:tabs.settings.orgmanagement.deleteError', 'Failed to delete organization. Please try again.');
|
|
40
|
-
return (_jsx(Modal, { modalHeading: modalHeading, open: open, onRequestClose: onRequestClose, onRequestSubmit: onRequestSubmit, primaryButtonText: primaryButtonText, primaryButtonDisabled: loading || confirmText.trim() !== 'DELETE', secondaryButtonText: secondaryButtonText, size: 'sm', danger: true, id: 'delete-organization-modal', preventCloseOnClickOutside: preventCloseOnClickOutside ?? true, children: _jsxs(Stack, { gap: 6, children: [error && (_jsx(
|
|
41
|
+
return (_jsx(Modal, { modalHeading: modalHeading, open: open, onRequestClose: onRequestClose, onRequestSubmit: onRequestSubmit, primaryButtonText: primaryButtonText, primaryButtonDisabled: loading || confirmText.trim() !== 'DELETE', secondaryButtonText: secondaryButtonText, size: 'sm', danger: true, id: 'delete-organization-modal', preventCloseOnClickOutside: preventCloseOnClickOutside ?? true, children: _jsxs(Stack, { gap: 6, children: [error && (_jsx(C4InlineNotification, { kind: 'error', title: errorMessage, hideCloseButton: true })), _jsx("p", { children: message }), _jsx(TextInput, { id: 'c4-delete-organization-confirmation', labelText: confirmLabel, value: confirmText, onChange: (e) => setConfirmText(e.target.value), disabled: loading })] }) }));
|
|
41
42
|
};
|